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OAAOC,aAC1ClP,OAAOyO,eAAe7P,EAASqQ,OAAOC,YAAa,CAAErM,MAAO,WAE7D7C,OAAOyO,eAAe7P,EAAS,aAAc,CAAEiE,OAAO,K,MCLvD,IAAIsM,EACAjB,EAAoBS,EAAES,gBAAeD,EAAYjB,EAAoBS,EAAEpS,SAAW,IACtF,IAAIoE,EAAWuN,EAAoBS,EAAEhO,SACrC,IAAKwO,GAAaxO,IACbA,EAAS0O,gBACZF,EAAYxO,EAAS0O,cAAcC,MAC/BH,GAAW,CACf,IAAII,EAAU5O,EAAS6O,qBAAqB,UACzCD,EAAQjX,SAAQ6W,EAAYI,EAAQA,EAAQjX,OAAS,GAAGgX,KAK7D,IAAKH,EAAW,MAAM,IAAInS,MAAM,yDAChCmS,EAAYA,EAAUM,QAAQ,OAAQ,IAAIA,QAAQ,QAAS,IAAIA,QAAQ,YAAa,KACpFvB,EAAoBR,EAAIyB,G,GCZxB,IAAIO,EAAsBxB,EAAoB,K","sources":["webpack://stork/./node_modules/stork-search/stork.js","webpack://stork/./js/config.ts","webpack://stork/./js/dom.ts","webpack://stork/./js/entity.ts","webpack://stork/./js/entityDom.ts","webpack://stork/./js/entityManager.ts","webpack://stork/./js/loaders/indexLoader.ts","webpack://stork/./js/main.ts","webpack://stork/./js/pencil.ts","webpack://stork/./js/resultToListItem.ts","webpack://stork/./js/searchData.ts","webpack://stork/./js/storkError.ts","webpack://stork/./js/util.ts","webpack://stork/./js/validators/indexParamValidator.ts","webpack://stork/./js/wasmManager.ts","webpack://stork/webpack/bootstrap","webpack://stork/webpack/runtime/define property getters","webpack://stork/webpack/runtime/global","webpack://stork/webpack/runtime/hasOwnProperty shorthand","webpack://stork/webpack/runtime/make namespace object","webpack://stork/webpack/runtime/publicPath","webpack://stork/webpack/startup"],"sourcesContent":["\n function getAbsoluteUrl(relativeUrl) {\n const publicPath = __webpack_public_path__;\n\n let url = '';\n\n if (!publicPath || publicPath.indexOf('://') < 0) {\n url += window.location.protocol + '//' + window.location.host;\n }\n\n if (publicPath) {\n url += publicPath;\n } else {\n url += '/';\n }\n\n return url + relativeUrl;\n }\n\nlet wasm;\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nlet cachedTextEncoder = new TextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length);\n getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len);\n\n const mem = getUint8Memory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3);\n const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1);\n getUint8Memory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n/**\n* @param {string} name\n* @param {Uint8Array} data\n* @returns {string}\n*/\nexport function wasm_register_index(name, data) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);\n var len1 = WASM_VECTOR_LEN;\n wasm.wasm_register_index(retptr, ptr0, len0, ptr1, len1);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_free(r0, r1);\n }\n}\n\n/**\n* @param {string} name\n* @param {string} query\n* @returns {string}\n*/\nexport function wasm_search(name, query) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n var ptr1 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len1 = WASM_VECTOR_LEN;\n wasm.wasm_search(retptr, ptr0, len0, ptr1, len1);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_free(r0, r1);\n }\n}\n\n/**\n* @returns {string}\n*/\nexport function wasm_stork_version() {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.wasm_stork_version(retptr);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_free(r0, r1);\n }\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nasync function load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nasync function init(input) {\n if (typeof input === 'undefined') {\n input = new URL('stork_bg.wasm', ({ url: getAbsoluteUrl('node_modules/stork-search/stork.js') }).url);\n }\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_new_693216e109162396 = function() {\n var ret = new Error();\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {\n var ret = getObject(arg1).stack;\n var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n getInt32Memory0()[arg0 / 4 + 1] = len0;\n getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n };\n imports.wbg.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {\n try {\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(arg0, arg1);\n }\n };\n imports.wbg.__wbindgen_object_drop_ref = function(arg0) {\n takeObject(arg0);\n };\n\n if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n input = fetch(input);\n }\n\n\n\n const { instance, module } = await load(await input, imports);\n\n wasm = instance.exports;\n init.__wbindgen_wasm_module = module;\n\n return wasm;\n}\n\nexport default init;\n\n","import StorkError from \"./storkError\";\nimport { difference, plural } from \"./util\";\n\nexport interface Configuration {\n showProgress: boolean;\n printIndexInfo: boolean;\n showScores: boolean;\n showCloseButton: boolean;\n minimumQueryLength: number;\n forceOverwrite: boolean;\n resultNoun: { singular: string; plural: string };\n onQueryUpdate?: (query: string, results: unknown) => unknown;\n onResultSelected?: (query: string, result: unknown) => unknown;\n onResultsHidden?: () => unknown;\n onInputCleared?: () => unknown;\n transformResultUrl: (url: string) => string;\n}\n\nexport const defaultConfig: Readonly = {\n showProgress: true,\n printIndexInfo: false,\n showScores: false,\n showCloseButton: true,\n minimumQueryLength: 3,\n forceOverwrite: false,\n resultNoun: { singular: \"file\", plural: \"files\" },\n onQueryUpdate: undefined,\n onResultSelected: undefined,\n onResultsHidden: undefined,\n onInputCleared: undefined,\n transformResultUrl: url => url,\n};\n\nexport function calculateOverriddenConfig(\n overrides: Partial\n): Configuration | StorkError {\n const configKeyDiff = difference(\n Object.keys(overrides),\n Object.keys(defaultConfig)\n );\n\n if (configKeyDiff.length > 0) {\n const keys = plural(configKeyDiff.length, \"key\", \"keys\");\n const invalidKeys = JSON.stringify(configKeyDiff);\n return new StorkError(`Invalid ${keys} in config object: ${invalidKeys}`);\n }\n\n const output: Configuration = Object.assign({}, defaultConfig);\n\n for (const key of Object.keys(defaultConfig) as Array) {\n const overrideVal = overrides[key];\n if (overrideVal !== undefined) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n output[key] = overrideVal;\n }\n }\n\n return output;\n}\n","export function create(\n name: string,\n attributes: Record>\n): HTMLElement {\n const elem = document.createElement(name);\n if (attributes.classNames) {\n elem.setAttribute(\"class\", attributes.classNames.join(\" \"));\n }\n return elem;\n}\n\nexport function add(\n elem: HTMLElement,\n location: InsertPosition,\n reference: HTMLElement\n): void {\n reference.insertAdjacentElement(location, elem);\n}\n\nexport function clear(elem: HTMLElement | null): void {\n while (elem && elem.firstChild) {\n elem.removeChild(elem.firstChild);\n }\n}\n\nexport function setText(elem: HTMLElement | null, text: string): void {\n const textNode = document.createTextNode(text);\n if (elem && elem.firstChild) {\n elem.replaceChild(textNode, elem.firstChild);\n } else if (elem) {\n elem.appendChild(textNode);\n }\n}\n\nexport function existsBeyondContainerBounds(\n elem: HTMLElement,\n container: HTMLElement\n): boolean {\n const elemBoundingBox = elem.getBoundingClientRect();\n const containerBoundingBox = container.getBoundingClientRect();\n\n return (\n elemBoundingBox.bottom > containerBoundingBox.bottom ||\n elemBoundingBox.top < containerBoundingBox.top\n );\n}\n","import { Configuration } from \"./config\";\nimport { Result, SearchData, resolveSearch } from \"./searchData\";\nimport { EntityDom, RenderState } from \"./entityDom\";\nimport { wasm_register_index } from \"stork-search\";\nimport StorkError from \"./storkError\";\n\nexport type EntityState = \"initialized\" | \"loading\" | \"ready\" | \"error\";\n\nexport class Entity {\n readonly name: string;\n readonly url: string;\n readonly config: Configuration;\n\n private _state: EntityState = \"initialized\";\n\n downloadProgress = 0;\n\n index: Uint8Array;\n results: Array = [];\n totalResultCount = 0;\n\n domManager: EntityDom | null;\n eventListenerFunctions: Record void> = {};\n highlightedResult = 0;\n resultsVisible = false;\n hoverSelectEnabled = true;\n\n constructor(name: string, url: string, config: Configuration) {\n this.name = name;\n this.url = url;\n this.config = config;\n }\n\n public get state(): EntityState {\n return this._state;\n }\n\n public set state(value: EntityState) {\n this._state = value;\n this.render();\n }\n\n private getCurrentMessage(): string | null {\n if (!this.domManager) return null;\n const query = this.domManager.getQuery();\n if (this.state === \"error\") {\n return \"Error! Check the browser console.\";\n } else if (this.state != \"ready\") {\n return \"Loading...\";\n } else if (query?.length < this.config.minimumQueryLength) {\n return \"Filtering...\";\n } else if (this.results) {\n if (this.totalResultCount === 0) {\n return `No ${this.config.resultNoun.plural} found.`;\n } else if (this.totalResultCount === 1) {\n return `1 ${this.config.resultNoun.singular} found.`;\n } else {\n return `${this.totalResultCount} ${this.config.resultNoun.plural} found.`;\n }\n }\n\n return null;\n }\n\n private generateRenderConfig(): RenderState {\n return {\n results: this.results,\n resultsVisible: true,\n showScores: this.config.showScores,\n message: this.getCurrentMessage(),\n showProgress: this.config.showProgress,\n progress: this.downloadProgress,\n state: this.state\n };\n }\n\n private render() {\n if (!this.domManager) return;\n this.domManager.render(this.generateRenderConfig());\n }\n\n registerIndex(data: Uint8Array): Promise {\n return new Promise((resolve, reject) => {\n const indexInfo = JSON.parse(wasm_register_index(this.name, data));\n if (indexInfo.error) {\n reject(new StorkError(indexInfo.error));\n } else {\n if (this.config.printIndexInfo) {\n console.log(indexInfo);\n }\n\n this.state = \"ready\";\n resolve(indexInfo);\n }\n });\n }\n\n attachToDom(): void {\n this.domManager = new EntityDom(this.name, this);\n this.render();\n }\n\n injestSearchData(data: SearchData): void {\n this.results = data.results;\n this.totalResultCount = data.total_hit_count;\n this.highlightedResult = 0;\n\n // Mutate the result URL, like we do when there's a url prefix or suffix\n const urlPrefix = data.url_prefix || \"\";\n this.results.map(r => {\n let urlSuffix = \"\";\n\n const firstInternalAnnotations = r.excerpts\n .map(e => e.internal_annotations)\n .filter(ia => !!ia)[0];\n\n if (firstInternalAnnotations && firstInternalAnnotations[0]) {\n const annotationMap = firstInternalAnnotations[0];\n if (typeof annotationMap[\"a\"] === \"string\") {\n urlSuffix += annotationMap[\"a\"];\n }\n }\n\n // oof\n if (\n r.excerpts &&\n r.excerpts[0] &&\n r.excerpts[0].internal_annotations &&\n r.excerpts[0].internal_annotations[0] &&\n r.excerpts[0].internal_annotations[0][\"a\"] &&\n typeof r.excerpts[0].internal_annotations[0][\"a\"] === \"string\"\n ) {\n urlSuffix = r.excerpts[0].internal_annotations[0][\"a\"];\n }\n r.entry.url = this.config.transformResultUrl(`${urlPrefix}${r.entry.url}${urlSuffix}`);\n });\n\n this.render();\n }\n\n private getSanitizedResults() {\n const results = this.results;\n results.map(result => {\n delete result.title_highlight_ranges;\n result.excerpts.map(excerpt => {\n delete excerpt.highlight_ranges;\n delete excerpt.internal_annotations;\n });\n });\n return results;\n }\n\n setDownloadProgress = (percentage: number): void => {\n this.state = \"loading\";\n this.downloadProgress = percentage;\n if (this.config.showProgress) {\n this.render();\n }\n };\n\n setDownloadError(): void {\n this.state = \"error\";\n }\n\n performSearch(query: string): void {\n if (this.state !== \"ready\") {\n this.render();\n return;\n }\n\n if (query.length < this.config.minimumQueryLength) {\n this.results = [];\n this.render();\n return;\n }\n\n try {\n const data = resolveSearch(this.name, query);\n if (!data) return;\n\n this.injestSearchData(data);\n\n if (this.config.onQueryUpdate) {\n this.config.onQueryUpdate(query, this.getSanitizedResults());\n }\n } catch (error) {\n console.error(error);\n }\n }\n}\n","import { Result } from \"./searchData\";\n\nimport {\n create,\n add,\n clear,\n setText,\n existsBeyondContainerBounds\n} from \"./dom\";\nimport { Entity, EntityState } from \"./entity\";\nimport { ListItemDisplayOptions, resultToListItem } from \"./resultToListItem\";\n\ninterface ElementMap {\n input: HTMLInputElement;\n output: HTMLDivElement;\n progress: HTMLElement;\n list: HTMLElement;\n message: HTMLElement;\n attribution: HTMLElement;\n closeButton: HTMLElement;\n}\n\nexport interface RenderState {\n results: Array;\n resultsVisible: boolean;\n showScores: boolean;\n message: string | null;\n showProgress: boolean;\n progress: number;\n state: EntityState;\n}\n\nconst hiddenInterfaceRenderState: RenderState = {\n results: [],\n resultsVisible: false,\n showScores: false,\n message: null,\n showProgress: false,\n progress: 1,\n state: \"ready\"\n};\n\nexport class EntityDom {\n readonly elements: ElementMap;\n readonly entity: Entity;\n\n highlightedResult?: number;\n hoverSelectEnabled: boolean;\n lastRenderState: RenderState;\n\n scrollAnchorPoint: \"start\" | \"end\" = \"end\";\n\n constructor(name: string, entity: Entity) {\n this.entity = entity;\n\n const data = [\n {\n selector: `input[data-stork=\"${name}\"]`,\n elementName: \"input\"\n },\n {\n selector: `div[data-stork=\"${name}-output\"]`,\n elementName: \"output\"\n }\n ];\n\n const [input, output] = data.map(d => {\n const element = document.querySelector(d.selector);\n if (!element) {\n throw new Error(\n `Could not register search box \"${name}\": ${d.elementName} element not found. Make sure an element matches the query selector \\`${d.selector}\\``\n );\n }\n\n return element;\n }) as [HTMLInputElement, HTMLDivElement];\n\n this.elements = {\n input: input,\n output: output,\n list: create(\"ul\", { classNames: [\"stork-results\"] }),\n attribution: create(\"div\", {\n classNames: [\"stork-attribution\"]\n }),\n progress: create(\"div\", { classNames: [\"stork-progress\"] }),\n message: create(\"div\", { classNames: [\"stork-message\"] }),\n closeButton: create(\"button\", {\n classNames: [\"stork-close-button\"]\n })\n };\n\n // First, remove saved event listener functions from the element, if they exist.\n // This makes the EntityDom constructor safe to call multiple times, even if\n // the elements on the page haven't changed.\n this.elements.input.removeEventListener(\n \"input\",\n this.entity.eventListenerFunctions.inputInputEvent\n );\n\n this.elements.input.removeEventListener(\n \"keydown\",\n this.entity.eventListenerFunctions.inputKeydownEvent\n );\n\n // Then, save new event listener functions to the entity so that we can\n // delete those listeners from the corresponding elements when the\n // EntityDom object is recreated.\n this.entity.eventListenerFunctions = {\n inputInputEvent: (e: InputEvent) => {\n this.handleInputEvent(e as InputEvent);\n },\n\n inputKeydownEvent: (e: KeyboardEvent) => {\n this.handleKeyDownEvent(e as KeyboardEvent);\n }\n };\n\n // Then, add those newly saved functions as event listeners on the elements.\n this.elements.input.addEventListener(\n \"input\",\n this.entity.eventListenerFunctions.inputInputEvent\n );\n\n this.elements.input.addEventListener(\n \"keydown\",\n this.entity.eventListenerFunctions.inputKeydownEvent\n );\n\n // We didn't have to do the remove/add dance with this one because\n // this listener behavior is already idempotent.\n this.elements.list?.addEventListener(\"mousemove\", () => {\n this.hoverSelectEnabled = true;\n });\n\n this.elements.attribution.innerHTML =\n 'Powered by Stork';\n\n this.elements.closeButton.innerHTML = `\n\n\n\n\n\n\n\n`;\n\n if (this.entity.config.showProgress) {\n add(this.elements.progress, \"afterend\", this.elements.input);\n }\n\n this.elements.closeButton?.addEventListener(\"click\", () => {\n this.elements.input.value = \"\";\n this.elements.input.focus();\n this.render(hiddenInterfaceRenderState);\n const [m, n] = [\n this.entity.config.onInputCleared,\n this.entity.config.onResultsHidden\n ];\n m ? m() : null;\n n ? n() : null;\n });\n }\n\n private clearDom() {\n clear(this.elements.output);\n clear(this.elements.list);\n this.elements.closeButton?.remove();\n this.elements.output.classList.remove(\"stork-output-visible\");\n }\n\n render(state: RenderState): void {\n const query = (this.elements.input as HTMLInputElement).value;\n this.clearDom();\n this.lastRenderState = state;\n\n if (state.showProgress) {\n const getFakeProgress = (): number => {\n switch (state.state) {\n case \"ready\":\n case \"error\":\n return 1;\n case \"initialized\":\n case \"loading\":\n return state.progress * 0.9 + 0.05;\n }\n };\n\n const progress = getFakeProgress();\n\n if (progress < 1) {\n this.elements.progress.style.width = `${progress * 100}%`;\n this.elements.progress.style.opacity = \"1\";\n } else {\n this.elements.progress.style.width = `100%`;\n this.elements.progress.style.opacity = \"0\";\n }\n }\n\n if (state.state === \"error\") {\n this.elements.input.classList.add(\"stork-error\");\n }\n\n if (this.getQuery().length > 0 && state.resultsVisible) {\n this.elements.output.classList.add(\"stork-output-visible\");\n add(this.elements.message, \"beforeend\", this.elements.output);\n }\n\n if (state.message) {\n setText(this.elements.message, state.message);\n }\n\n if (state.results?.length > 0 && state.resultsVisible) {\n add(this.elements.list, \"beforeend\", this.elements.output);\n\n for (let i = 0; i < state.results.length; i++) {\n const result = state.results[i];\n const generateOptions: ListItemDisplayOptions = {\n selected: i === this.highlightedResult,\n showScores: state.showScores\n };\n\n const listItem = resultToListItem(result, generateOptions);\n add(listItem as HTMLElement, \"beforeend\", this.elements.list);\n\n listItem.addEventListener(\"mousemove\", () => {\n if (this.hoverSelectEnabled) {\n if (i !== this.highlightedResult) {\n this.changeHighlightedResult({ to: i, shouldScrollTo: false });\n }\n }\n });\n\n listItem.addEventListener(\"mouseleave\", () => {\n if (this.hoverSelectEnabled) {\n if (i === this.highlightedResult) {\n this.changeHighlightedResult({ to: -1, shouldScrollTo: false });\n }\n }\n });\n\n listItem.addEventListener(\"click\", e => {\n e.preventDefault();\n this.selectResult();\n });\n }\n\n add(this.elements.attribution, \"beforeend\", this.elements.output);\n }\n\n if ((query?.length || 0) > 0 && this.entity.config.showCloseButton) {\n add(this.elements.closeButton, \"afterend\", this.elements.input);\n }\n }\n\n private selectResult() {\n if (this.highlightedResult != null) {\n const result = this.entity.results[this.highlightedResult];\n if (this.entity.config.onResultSelected) {\n Promise.resolve(\n this.entity.config.onResultSelected(this.getQuery(), result)\n ).finally(() => {\n window.location.assign(result.entry.url);\n });\n } else {\n window.location.assign(result.entry.url);\n }\n }\n }\n\n changeHighlightedResult(options: {\n to: number;\n shouldScrollTo: boolean;\n }): number {\n const previousValue = this.highlightedResult;\n\n const resolvedIdx = Math.max(\n -1, // `to` will be -1 if we want to clear the highlight\n Math.min(this.entity.results.length - 1, options.to)\n );\n\n this.highlightedResult = resolvedIdx;\n this.scrollAnchorPoint =\n (previousValue || 0) < resolvedIdx ? \"end\" : \"start\";\n\n let targetForScrollTo = null;\n\n for (let i = 0; i < this.entity.results.length; i++) {\n const element = this.elements.list?.children[i];\n if (!element) {\n continue;\n }\n\n const highlightedClassName = \"selected\";\n\n if (i == resolvedIdx) {\n element.classList.add(highlightedClassName);\n targetForScrollTo = element;\n } else {\n element.classList.remove(highlightedClassName);\n }\n }\n\n if (options.shouldScrollTo) {\n this.hoverSelectEnabled = false;\n if (targetForScrollTo) {\n if (\n existsBeyondContainerBounds(\n targetForScrollTo as HTMLElement,\n this.elements.list\n )\n ) {\n (targetForScrollTo as HTMLElement).scrollIntoView({\n behavior: \"smooth\",\n block: this.scrollAnchorPoint,\n inline: \"nearest\"\n });\n }\n }\n }\n\n return resolvedIdx;\n }\n\n handleKeyDownEvent(event: KeyboardEvent): void {\n const UP = 38;\n const DOWN = 40;\n const RETURN = 13;\n const ESC = 27;\n\n switch (event.keyCode) {\n case DOWN: {\n if (this.highlightedResult == null) {\n this.changeHighlightedResult({ to: 0, shouldScrollTo: true });\n } else {\n const target = Math.min(\n this.highlightedResult + 1,\n this.entity.results.length - 1\n );\n this.changeHighlightedResult({ to: target, shouldScrollTo: true });\n }\n break;\n }\n\n case UP: {\n if (this.highlightedResult != null) {\n const target = Math.max(0, this.highlightedResult - 1);\n this.changeHighlightedResult({ to: target, shouldScrollTo: true });\n }\n break;\n }\n\n case RETURN:\n this.selectResult();\n break;\n\n case ESC:\n if (this.lastRenderState.resultsVisible) {\n this.render(hiddenInterfaceRenderState);\n const m = this.entity.config.onResultsHidden;\n m ? m() : null;\n } else if (this.elements.input.value.length > 0) {\n this.elements.input.value = \"\";\n this.render(hiddenInterfaceRenderState); // To clear [x] button\n const m = this.entity.config.onInputCleared;\n m ? m() : null;\n }\n\n break;\n\n default:\n return;\n }\n }\n\n handleInputEvent(event: InputEvent): void {\n this.entity.performSearch((event.target as HTMLInputElement).value);\n }\n\n getQuery(): string {\n return (this.elements.input as HTMLInputElement).value;\n }\n}\n","import { Entity } from \"./entity\";\nimport { Configuration, calculateOverriddenConfig } from \"./config\";\nimport { loadIndexFromUrl } from \"./loaders/indexLoader\";\nimport { runAfterWasmLoaded } from \"./wasmManager\";\nimport StorkError from \"./storkError\";\n\nconst entities: Record = {};\n\nconst register = (\n name: string,\n url: string,\n partialConfig: Partial\n): Promise => {\n return new Promise((res, rej) => {\n const fullConfig = calculateOverriddenConfig(partialConfig);\n if (fullConfig instanceof StorkError) {\n rej(fullConfig);\n return;\n }\n\n if (entities[name] && !fullConfig.forceOverwrite) {\n rej(\n new StorkError(\n `You're registering an index named \\`${name}\\`, but that already exists. If this is expected, set forceOverwrite to true in your Javascript config to allow overwriting indexes.`\n )\n );\n }\n\n const entity = new Entity(name, url, fullConfig);\n entities[name] = entity;\n\n loadIndexFromUrl(url, {\n progress: percentage => {\n entity.setDownloadProgress(percentage);\n },\n\n load: response => {\n runAfterWasmLoaded(\n () => {\n entity.registerIndex(new Uint8Array(response)).then(res).catch(rej);\n },\n () => {\n entity.state = \"error\";\n }\n );\n },\n\n error: () => {\n entity.setDownloadError();\n rej();\n }\n });\n });\n};\n\nconst attachToDom = (name: string): void => {\n if (!entities[name]) {\n throw new Error(`Index ${name} has not been registered!`);\n }\n\n entities[name].attachToDom();\n};\n\nconst entityIsReady = (name: string): boolean => {\n return entities[name]?.state === \"ready\";\n};\n\nconst debug = (): Record => ({\n entities: { ...entities },\n entitiesCount: entities.length\n});\n\nexport { register, attachToDom, entityIsReady, debug };\n","interface IndexLoaderCallbacks {\n load: (response: ArrayBufferLike) => void;\n progress: (percentage: number) => void;\n error: () => void;\n}\n\nexport function loadIndexFromUrl(\n url: string,\n callbacks: IndexLoaderCallbacks\n): void {\n const r = new XMLHttpRequest();\n\n r.addEventListener(\"load\", e => {\n const { status, response } = e.target as XMLHttpRequest;\n\n // This shouldn't happen on the `load` event, but handle it safely if it does\n if (status === 0) {\n callbacks.progress(e.loaded / e.total);\n return;\n }\n\n if (status < 200 || status > 299) {\n callbacks.error();\n return;\n }\n\n callbacks.load(response);\n });\n\n r.addEventListener(\"error\", () => {\n callbacks.error();\n });\n\n r.addEventListener(\"progress\", e => {\n callbacks.progress(e.loaded / e.total);\n });\n\n r.responseType = \"arraybuffer\";\n r.open(\"GET\", url);\n r.send();\n}\n","import { Configuration } from \"./config\";\nimport {\n register as registerEntity,\n attachToDom,\n entityIsReady,\n debug as entityDebug\n} from \"./entityManager\";\nimport { loadWasm, debug as wasmDebug } from \"./wasmManager\";\nimport { resolveSearch, SearchData } from \"./searchData\";\nimport StorkError from \"./storkError\";\nimport { validateIndexParams } from \"./validators/indexParamValidator\";\nimport { wasm_stork_version } from \"stork-search\";\n\nfunction initialize(wasmOverrideUrl: string | null = null): Promise {\n return loadWasm(wasmOverrideUrl).then(() => {\n return;\n });\n}\n\nfunction downloadIndex(name: string, url: string, config = {}): Promise {\n return new Promise((res, rej) => {\n const validationError = validateIndexParams(name, url);\n if (validationError) {\n rej(validationError);\n return;\n }\n\n registerEntity(name, url, config).then(res).catch(rej);\n });\n}\n\nfunction attach(name: string): void {\n try {\n attachToDom(name);\n } catch (e) {\n throw new StorkError(e.message);\n }\n}\n\nfunction register(\n name: string,\n url: string,\n config: Partial = {}\n): Promise {\n const initPromise = initialize();\n const downloadPromise = downloadIndex(name, url, config);\n attach(name);\n\n // This silly `then` call turns a [(void), (void)] into a (void), which is\n // only necessary to make Typescript happy.\n // You begin to wonder if you write Typescript code, or if Typescript code writes you.\n return Promise.all([initPromise, downloadPromise]).then();\n}\n\nfunction search(name: string, query: string): SearchData {\n if (!name || !query) {\n throw new StorkError(\n \"Make sure to call stork.search() with two arguments: the index name and the search query.\"\n );\n }\n\n if (!entityIsReady(name)) {\n throw new StorkError(\n \"Couldn't find index. Make sure the stork.downloadIndex() promise has resolved before calling stork.search().\"\n );\n }\n\n return resolveSearch(name, query);\n}\n\nfunction debug(): Record {\n return {\n ...wasmDebug(),\n ...entityDebug(),\n jsStorkVersion: process.env.VERSION,\n wasmStorkVersion: wasm_stork_version\n };\n}\n\nexport { initialize, downloadIndex, attach, search, register, debug };\n","// It's like Handlebars, but smaller.\n\nimport { HighlightRange } from \"./searchData\";\n\nexport function highlight(\n text: string,\n highlight_ranges: Array\n): string {\n function insert(str: string, index: number, value: string) {\n return str.substr(0, index) + value + str.substr(index);\n }\n\n let charactersAlreadyAdded = 0;\n\n for (const range of highlight_ranges) {\n const beginningInsertion = ``;\n const endInsertion = ``;\n\n text = insert(\n text,\n range.beginning + charactersAlreadyAdded,\n beginningInsertion\n );\n charactersAlreadyAdded += beginningInsertion.length;\n\n text = insert(text, range.end + charactersAlreadyAdded, endInsertion);\n charactersAlreadyAdded += endInsertion.length;\n }\n\n return text;\n}\n","import { highlight } from \"./pencil\";\nimport { Result } from \"./searchData\";\n\nexport interface ListItemDisplayOptions {\n selected: boolean;\n showScores: boolean;\n}\n\nexport function resultToListItem(\n result: Result,\n options: ListItemDisplayOptions\n): ChildNode {\n const template = document.createElement(\"template\");\n template.innerHTML = `\n
  • \n \n
    \n

    ${highlight(\n result.entry.title,\n result.title_highlight_ranges || []\n )}

    \n ${options.showScores ? `${result.score}` : \"\"}\n
    \n ${\n result.excerpts.length > 0\n ? '
    '\n : \"\"\n }\n ${result.excerpts\n .map(\n e => `

    \n ...${highlight(e.text, e.highlight_ranges || [])}...\n

    \n ${options.showScores ? `${e.score}` : \"\"}\n
    `\n )\n .join(\"\")}\n ${result.excerpts.length > 0 ? \"
    \" : \"\"}\n
    \n
  • `;\n return template.content.firstElementChild as ChildNode;\n}\n","import { wasm_search } from \"stork-search\";\nimport StorkError from \"./storkError\";\n\nexport interface HighlightRange {\n beginning: number;\n end: number;\n}\n\nexport interface Entry {\n fields: Record;\n title: string;\n url: string;\n}\n\nexport interface Excerpt {\n fields: Record;\n internal_annotations?: Array>;\n highlight_ranges?: Array;\n score: number;\n text: string;\n}\n\nexport interface Result {\n entry: Entry;\n excerpts: Array;\n score: number;\n title_highlight_ranges?: Array;\n}\n\nexport interface SearchData {\n results: Array;\n total_hit_count: number;\n url_prefix: string;\n}\n\nexport function resolveSearch(name: string, query: string): SearchData {\n let searchOutput = null;\n let data = null;\n\n try {\n searchOutput = wasm_search(name, query);\n // If wasm_search returns an error, it will return a JSON blob. Look for\n // data.error to see if this is the case.\n data = JSON.parse(searchOutput);\n } catch (e) {\n // Data has come back improperly, even beyond an error in Rust-land.\n // analytics.log(e)\n throw new StorkError(\n \"Could not parse data from wasm_search. If you see this, please file a bug: https://jil.im/storkbug \" +\n searchOutput\n );\n }\n\n if (!data) {\n throw new StorkError(\"Data was an empty object\");\n }\n\n if (data.error) {\n throw new StorkError(`Could not perform search: the WASM binary failed to return search results.\n You might not be serving your search index properly.\n If you think this is an error, please file a bug: https://jil.im/storkbug\n \n The WASM binary came back with:\n ${data.error}`);\n }\n\n return data;\n}\n","class StorkError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StorkError\";\n }\n}\n\nexport default StorkError;\n","export function htmlToElement(html: string): ChildNode | null {\n const template = document.createElement(\"template\");\n html = html.trim(); // Never return a text node of whitespace as the result\n template.innerHTML = html;\n return template.content.firstChild;\n}\n\nexport function difference(arr1: Array, arr2: Array): Array {\n const set1 = new Set(arr1);\n const set2 = new Set(arr2);\n const diff = new Set(Array.from(set1).filter(x => !set2.has(x)));\n return Array.from(diff);\n}\n\nexport const plural = (\n count: number,\n singular: string,\n plural: string\n): string => (count == 1 ? singular : plural);\n","import StorkError from \"../storkError\";\n\nexport const validateIndexParams = (\n name: string,\n url: string\n): StorkError | null => {\n if (typeof name !== \"string\") {\n return new StorkError(\"Index registration name must be a string.\");\n }\n\n if (typeof url !== \"string\") {\n return new StorkError(\"URL must be a string.\");\n }\n\n return null;\n};\n","import init from \"stork-search\";\nimport StorkError from \"./storkError\";\n\nconst version = process.env.VERSION;\nconst DEFAULT_WASM_URL = version\n ? `https://files.stork-search.net/releases/v${version}/stork.wasm`\n : `https://files.stork-search.net/stork.wasm`;\n\nlet wasmSourceUrl: string | null = null; // only for debug output\nlet wasmLoadPromise: Promise | null = null;\n\nlet queue: { (): void }[] = [];\nlet errorQueue: { (): void }[] = [];\n\nconst loadWasm = (\n overrideUrl: string | null = null\n): Promise => {\n // If there's a WASM load in flight or complete, don't try to call init again\n if (wasmLoadPromise) {\n return wasmLoadPromise;\n }\n\n const url = overrideUrl || DEFAULT_WASM_URL;\n wasmSourceUrl = url;\n\n const p = init(url)\n .then(() => {\n flush();\n return url;\n })\n .catch(() => {\n errorFlush();\n throw new StorkError(`Error while loading WASM at ${url}`);\n });\n\n wasmLoadPromise = p;\n return p;\n};\n\n/**\n * Caller should use this to queue up a function to be run only when the\n * WASM is loaded. If the WASM is already loaded when this method is called,\n * the function will run immediately.\n *\n * @param fn Function to be run once WASM is loaded\n *\n * @returns a promise if loadWasm has been called, or undefined if loadWasm\n * has not been called. If loadWasm has been called, the promise will resolve\n * when the WASM has been loaded and when the function has been run.\n */\nconst runAfterWasmLoaded = (\n fn: () => void,\n err: () => void\n): Promise | null => {\n if (!wasmLoadPromise) {\n queue.push(fn);\n errorQueue.push(err);\n return null;\n } else {\n // We have a wasmLoadPromise, but we don't know if it's resolved.\n // Let's wait for it to resolve, then run the function.\n wasmLoadPromise.then(() => fn()).catch(() => err());\n return wasmLoadPromise;\n }\n};\n\nconst flush = () => {\n queue.forEach(fn => {\n fn();\n });\n queue = [];\n};\n\nconst errorFlush = () => {\n errorQueue.forEach(fn => {\n fn();\n });\n errorQueue = [];\n};\n\nconst debug = (): Record => ({\n wasmSourceUrl,\n wasmLoadPromise,\n queueLength: queue.length\n});\n\nexport { runAfterWasmLoaded, loadWasm, debug };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(480);\n"],"names":["wasm","heap","Array","fill","undefined","getObject","idx","push","heap_next","length","WASM_VECTOR_LEN","cachegetUint8Memory0","getUint8Memory0","buffer","memory","Uint8Array","cachedTextEncoder","TextEncoder","encodeString","encodeInto","arg","view","buf","encode","set","read","written","passStringToWasm0","malloc","realloc","ptr","subarray","len","mem","offset","code","charCodeAt","slice","cachegetInt32Memory0","getInt32Memory0","Int32Array","cachedTextDecoder","TextDecoder","ignoreBOM","fatal","getStringFromWasm0","decode","wasm_register_index","name","data","retptr","__wbindgen_add_to_stack_pointer","ptr0","__wbindgen_malloc","__wbindgen_realloc","len0","ptr1","passArray8ToWasm0","len1","r0","r1","__wbindgen_free","wasm_search","query","wasm_stork_version","async","init","input","URL","relativeUrl","publicPath","url","indexOf","window","location","protocol","host","getAbsoluteUrl","imports","wbg","__wbg_new_693216e109162396","obj","addHeapObject","Error","__wbg_stack_0ddaca5d1abfb52f","arg0","arg1","stack","__wbg_error_09919627ac0992f5","console","error","__wbindgen_object_drop_ref","ret","dropObject","takeObject","Request","fetch","instance","module","Response","WebAssembly","instantiateStreaming","e","headers","get","warn","bytes","arrayBuffer","instantiate","Instance","load","exports","__wbindgen_wasm_module","defaultConfig","showProgress","printIndexInfo","showScores","showCloseButton","minimumQueryLength","forceOverwrite","resultNoun","singular","plural","onQueryUpdate","onResultSelected","onResultsHidden","onInputCleared","transformResultUrl","overrides","configKeyDiff","difference","Object","keys","invalidKeys","JSON","stringify","output","assign","key","overrideVal","attributes","elem","document","createElement","classNames","setAttribute","join","reference","insertAdjacentElement","firstChild","removeChild","text","textNode","createTextNode","replaceChild","appendChild","container","elemBoundingBox","getBoundingClientRect","containerBoundingBox","bottom","top","config","_state","downloadProgress","results","totalResultCount","eventListenerFunctions","highlightedResult","resultsVisible","hoverSelectEnabled","setDownloadProgress","percentage","state","render","this","value","getCurrentMessage","domManager","getQuery","generateRenderConfig","message","progress","registerIndex","Promise","resolve","reject","indexInfo","parse","log","attachToDom","EntityDom","injestSearchData","total_hit_count","urlPrefix","url_prefix","map","r","urlSuffix","firstInternalAnnotations","excerpts","internal_annotations","filter","ia","annotationMap","entry","getSanitizedResults","result","title_highlight_ranges","excerpt","highlight_ranges","setDownloadError","performSearch","resolveSearch","Entity","hiddenInterfaceRenderState","entity","scrollAnchorPoint","selector","elementName","d","element","querySelector","elements","list","create","attribution","closeButton","removeEventListener","inputInputEvent","inputKeydownEvent","handleInputEvent","handleKeyDownEvent","addEventListener","innerHTML","add","focus","m","n","clearDom","clear","remove","classList","lastRenderState","getFakeProgress","style","width","opacity","setText","i","generateOptions","selected","listItem","resultToListItem","changeHighlightedResult","to","shouldScrollTo","preventDefault","selectResult","finally","options","previousValue","resolvedIdx","Math","max","min","targetForScrollTo","children","highlightedClassName","existsBeyondContainerBounds","scrollIntoView","behavior","block","inline","event","keyCode","target","entities","register","partialConfig","res","rej","fullConfig","calculateOverriddenConfig","loadIndexFromUrl","response","runAfterWasmLoaded","then","catch","entityIsReady","debug","entitiesCount","callbacks","XMLHttpRequest","status","loaded","total","responseType","open","send","initialize","wasmOverrideUrl","loadWasm","downloadIndex","validationError","validateIndexParams","attach","initPromise","downloadPromise","all","search","jsStorkVersion","wasmStorkVersion","insert","str","index","substr","charactersAlreadyAdded","range","beginningInsertion","endInsertion","beginning","end","template","highlight","title","score","content","firstElementChild","searchOutput","StorkError","html","trim","arr1","arr2","set1","Set","set2","diff","from","x","has","count","DEFAULT_WASM_URL","wasmSourceUrl","wasmLoadPromise","queue","errorQueue","overrideUrl","p","flush","errorFlush","fn","err","forEach","queueLength","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call","definition","o","defineProperty","enumerable","g","globalThis","Function","prop","prototype","hasOwnProperty","Symbol","toStringTag","scriptUrl","importScripts","currentScript","src","scripts","getElementsByTagName","replace","__webpack_exports__"],"sourceRoot":""}