diff --git a/searx/static/themes/simple/js/searxng.core.min.js b/searx/static/themes/simple/js/searxng.core.min.js index cc968920b..b54c5b8a5 100644 --- a/searx/static/themes/simple/js/searxng.core.min.js +++ b/searx/static/themes/simple/js/searxng.core.min.js @@ -1,2 +1,2 @@ -const e={index:`index`,results:`results`,preferences:`preferences`,unknown:`unknown`},t={closeDetail:void 0,scrollPageToSelected:void 0,selectImage:void 0,selectNext:void 0,selectPrevious:void 0},n=()=>{let t=document.querySelector(`meta[name="endpoint"]`)?.getAttribute(`content`);return t&&t in e?t:e.unknown},r=()=>{let e=document.querySelector(`script[client_settings]`)?.getAttribute(`client_settings`);if(!e)return{};try{return JSON.parse(atob(e))}catch(e){return console.error(`Failed to load client_settings:`,e),{}}},i=e=>{if(!e)throw Error(`Bad assertion: DOM element not found`)},a=async(e,t,n)=>{let r=new AbortController,i=setTimeout(()=>r.abort(),n?.timeout??3e4),a=await fetch(t,{body:n?.body,method:e,signal:r.signal}).finally(()=>clearTimeout(i));if(!a.ok)throw Error(a.statusText);return a},o=(e,t,n,r)=>{if(typeof t!=`string`){t.addEventListener(e,n,r);return}document.addEventListener(e,e=>{for(let r of e.composedPath())if(r instanceof HTMLElement&&r.matches(t)){try{n.call(r,e)}catch(e){console.error(e)}break}},r)},s=(e,t)=>{for(let e of t?.on??[])if(!e)return;document.readyState===`loading`?o(`DOMContentLoaded`,document,e,{once:!0}):e()},c=n(),l=r(),u=function(e){return`/static/themes/simple/`+e},d={},f=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=u(t,n),t in d)return;d[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``,o=!!n;if(o)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let s=document.createElement(`link`);if(s.rel=r?`stylesheet`:`modulepreload`,r||(s.as=`script`),s.crossOrigin=``,s.href=t,a&&s.setAttribute(`nonce`,a),document.head.appendChild(s),r)return new Promise((e,n)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[]){if(e.status!==`rejected`)continue;i(e.reason)}return e().catch(i)})};s(()=>{f(()=>import(`./keyboard.min.js`),[]),f(()=>import(`./search.min.js`),[]),l.autocomplete&&f(()=>import(`./autocomplete.min.js`),[])},{on:[c===e.index]}),s(()=>{f(()=>import(`./keyboard.min.js`),[]),f(()=>import(`./mapresult.min.js`),[]),f(()=>import(`./results.min.js`),[]),f(()=>import(`./search.min.js`),[]),l.infinite_scroll&&f(()=>import(`./infinite_scroll.min.js`),[]),l.autocomplete&&f(()=>import(`./autocomplete.min.js`),[])},{on:[c===e.results]}),s(()=>{f(()=>import(`./preferences.min.js`),[])},{on:[c===e.preferences]}),o(`click`,`.close`,function(){this.parentNode?.classList.add(`invisible`)});export{f as b,i as c,a as d,o as e,t as f,l as g}; +const e={index:`index`,results:`results`,preferences:`preferences`,unknown:`unknown`},t={closeDetail:void 0,scrollPageToSelected:void 0,selectImage:void 0,selectNext:void 0,selectPrevious:void 0},n=()=>{let t=document.querySelector(`meta[name="endpoint"]`)?.getAttribute(`content`);return t&&t in e?t:e.unknown},r=()=>{let e=document.querySelector(`script[client_settings]`)?.getAttribute(`client_settings`);if(!e)return{};try{return JSON.parse(atob(e))}catch(e){return console.error(`Failed to load client_settings:`,e),{}}},i=e=>{if(!e)throw Error(`Bad assertion: DOM element not found`)},a=async(e,t,n)=>{let r=new AbortController,i=setTimeout(()=>r.abort(),n?.timeout??3e4),a=await fetch(t,{body:n?.body,method:e,signal:r.signal}).finally(()=>clearTimeout(i));if(!a.ok)throw Error(a.statusText);return a},o=(e,t,n,r)=>{if(typeof t!=`string`){t.addEventListener(e,n,r);return}document.addEventListener(e,e=>{for(let r of e.composedPath())if(r instanceof HTMLElement&&r.matches(t)){try{n.call(r,e)}catch(e){console.error(e)}break}},r)},s=(e,t)=>{for(let e of t?.on??[])if(!e)return;document.readyState===`loading`?o(`DOMContentLoaded`,document,e,{once:!0}):e()},c=n(),l=r();s(()=>{document.documentElement.classList.remove(`no-js`),document.documentElement.classList.add(`js`)});const u=function(e){return`/static/themes/simple/`+e},d={},f=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=u(t,n),t in d)return;d[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``,o=!!n;if(o)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let s=document.createElement(`link`);if(s.rel=r?`stylesheet`:`modulepreload`,r||(s.as=`script`),s.crossOrigin=``,s.href=t,a&&s.setAttribute(`nonce`,a),document.head.appendChild(s),r)return new Promise((e,n)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[]){if(e.status!==`rejected`)continue;i(e.reason)}return e().catch(i)})};s(()=>{f(()=>import(`./keyboard.min.js`),[]),f(()=>import(`./search.min.js`),[]),l.autocomplete&&f(()=>import(`./autocomplete.min.js`),[])},{on:[c===e.index]}),s(()=>{f(()=>import(`./keyboard.min.js`),[]),f(()=>import(`./mapresult.min.js`),[]),f(()=>import(`./results.min.js`),[]),f(()=>import(`./search.min.js`),[]),l.infinite_scroll&&f(()=>import(`./infinite_scroll.min.js`),[]),l.autocomplete&&f(()=>import(`./autocomplete.min.js`),[])},{on:[c===e.results]}),s(()=>{f(()=>import(`./preferences.min.js`),[])},{on:[c===e.preferences]}),o(`click`,`.close`,function(){this.parentNode?.classList.add(`invisible`)});export{f as b,i as c,a as d,o as e,t as f,l as g}; //# sourceMappingURL=searxng.core.min.js.map \ No newline at end of file diff --git a/searx/static/themes/simple/js/searxng.core.min.js.map b/searx/static/themes/simple/js/searxng.core.min.js.map index d10ddad8f..dcde11256 100644 --- a/searx/static/themes/simple/js/searxng.core.min.js.map +++ b/searx/static/themes/simple/js/searxng.core.min.js.map @@ -1 +1 @@ -{"version":3,"mappings":"AAsCA,MAAa,EAAY,CACvB,MAAO,QACP,QAAS,UACT,YAAa,cACb,QAAS,UACV,CAEY,EAAU,CACrB,YAAa,OACb,qBAAsB,OACtB,YAAa,OACb,WAAY,OACZ,eAAgB,OACjB,CAEK,MAAmC,CACvC,IAAM,EAAe,SAAS,cAAc,0BAA0B,aAAa,WAMnF,OAJI,GAAgB,KAAgB,EAC3B,EAGF,EAAU,OAClB,EAEK,MAA8B,CAClC,IAAM,EAAW,SAAS,cAAc,4BAA4B,aAAa,mBACjF,GAAI,CAAC,EAAU,MAAO,EAAE,CAExB,GAAI,CACF,OAAO,KAAK,MAAM,KAAK,GACxB,OAAQ,EAAO,CAEd,OADA,QAAQ,MAAM,kCAAmC,GAC1C,EAAE,CAEZ,EAEYA,EAAgC,GAAiE,CAC5G,GAAI,CAAC,EACH,MAAU,MAAM,uCAEnB,EAEY,EAAO,MAAO,EAAgB,EAAmB,IAA6C,CACzG,IAAM,EAAa,IAAI,gBACjB,EAAY,eAAiB,EAAW,QAAS,GAAS,SAAW,KAErE,EAAM,MAAM,MAAM,EAAK,CAC3B,KAAM,GAAS,KACP,SACR,OAAQ,EAAW,OACpB,EAAE,YAAc,aAAa,IAC9B,GAAI,CAAC,EAAI,GACP,MAAU,MAAM,EAAI,YAGtB,OAAO,CACR,EAEY,GACX,EACA,EACA,EACA,IACS,CACT,GAAI,OAAO,GAAW,SAAU,CAC9B,EAAO,iBAAiB,EAAM,EAA2B,GACzD,MACD,CAED,SAAS,iBACP,EACC,GAAiB,CAChB,IAAK,IAAM,KAAQ,EAAM,eACvB,GAAI,aAAgB,aAAe,EAAK,QAAQ,GAAS,CACvD,GAAI,CACF,EAAS,KAAK,EAAW,EAC1B,OAAQ,EAAO,CACd,QAAQ,MAAM,EACf,CACD,KACD,CAEJ,EACD,EAEH,EAEY,GAAS,EAAsB,IAAiC,CAC3E,IAAK,IAAM,KAAa,GAAS,IAAM,EAAE,CACvC,GAAI,CAAC,EACH,OAIA,SAAS,aAAe,UAG1B,EAAO,mBAAoB,SAAU,EAAU,CAAE,KAAM,GAAM,EAF7D,GAIH,EAEYC,EAA0B,IAC1BC,EAAqB,6rCCzIlC,MACQ,CACJ,aAAO,yBACP,aAAO,uBAEH,EAAS,cACX,aAAO,4BAEV,EACD,CAAE,GAAI,CAAC,IAAa,EAAU,MAAM,CAAE,EAGxC,MACQ,CACJ,aAAO,yBACP,aAAO,0BACP,aAAO,wBACP,aAAO,uBAEH,EAAS,iBACX,aAAO,gCAGL,EAAS,cACX,aAAO,4BAEV,EACD,CAAE,GAAI,CAAC,IAAa,EAAU,QAAQ,CAAE,EAG1C,MACQ,CACJ,aAAO,2BACR,EACD,CAAE,GAAI,CAAC,IAAa,EAAU,YAAY,CAAE,EClC9C,EAAO,QAAS,SAAU,UAA6B,CACpD,KAAK,YAA4B,UAAU,IAAI,YACjD","names":["assertElement: AssertElement","endpoint: EndpointsKeys","settings: Settings"],"ignoreList":[],"sources":["../../../../../client/simple/src/js/core/toolkit.ts","../../../../../client/simple/src/js/core/router.ts","../../../../../client/simple/src/js/core/listener.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport type { KeyBindingLayout } from \"../main/keyboard.ts\";\n\n// synced with searx/webapp.py get_client_settings\ntype Settings = {\n advanced_search?: boolean;\n autocomplete?: string;\n autocomplete_min?: number;\n doi_resolver?: string;\n favicon_resolver?: string;\n hotkeys?: KeyBindingLayout;\n infinite_scroll?: boolean;\n method?: \"GET\" | \"POST\";\n query_in_title?: boolean;\n results_on_new_tab?: boolean;\n safesearch?: 0 | 1 | 2;\n search_on_category_select?: boolean;\n theme?: string;\n theme_static_path?: string;\n translations?: Record;\n url_formatting?: \"pretty\" | \"full\" | \"host\";\n};\n\ntype HTTPOptions = {\n body?: BodyInit;\n timeout?: number;\n};\n\ntype ReadyOptions = {\n // all values must be truthy for the callback to be executed\n on?: (boolean | undefined)[];\n};\n\ntype AssertElement = (element?: HTMLElement | null) => asserts element is HTMLElement;\n\nexport type EndpointsKeys = keyof typeof Endpoints;\n\nexport const Endpoints = {\n index: \"index\",\n results: \"results\",\n preferences: \"preferences\",\n unknown: \"unknown\"\n} as const;\n\nexport const mutable = {\n closeDetail: undefined as (() => void) | undefined,\n scrollPageToSelected: undefined as (() => void) | undefined,\n selectImage: undefined as ((resultElement: HTMLElement) => void) | undefined,\n selectNext: undefined as ((openDetailView?: boolean) => void) | undefined,\n selectPrevious: undefined as ((openDetailView?: boolean) => void) | undefined\n};\n\nconst getEndpoint = (): EndpointsKeys => {\n const metaEndpoint = document.querySelector('meta[name=\"endpoint\"]')?.getAttribute(\"content\");\n\n if (metaEndpoint && metaEndpoint in Endpoints) {\n return metaEndpoint as EndpointsKeys;\n }\n\n return Endpoints.unknown;\n};\n\nconst getSettings = (): Settings => {\n const settings = document.querySelector(\"script[client_settings]\")?.getAttribute(\"client_settings\");\n if (!settings) return {};\n\n try {\n return JSON.parse(atob(settings));\n } catch (error) {\n console.error(\"Failed to load client_settings:\", error);\n return {};\n }\n};\n\nexport const assertElement: AssertElement = (element?: HTMLElement | null): asserts element is HTMLElement => {\n if (!element) {\n throw new Error(\"Bad assertion: DOM element not found\");\n }\n};\n\nexport const http = async (method: string, url: string | URL, options?: HTTPOptions): Promise => {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), options?.timeout ?? 30_000);\n\n const res = await fetch(url, {\n body: options?.body,\n method: method,\n signal: controller.signal\n }).finally(() => clearTimeout(timeoutId));\n if (!res.ok) {\n throw new Error(res.statusText);\n }\n\n return res;\n};\n\nexport const listen = (\n type: string | K,\n target: string | Document | E,\n listener: (this: E, event: DocumentEventMap[K]) => void | Promise,\n options?: AddEventListenerOptions\n): void => {\n if (typeof target !== \"string\") {\n target.addEventListener(type, listener as EventListener, options);\n return;\n }\n\n document.addEventListener(\n type,\n (event: Event) => {\n for (const node of event.composedPath()) {\n if (node instanceof HTMLElement && node.matches(target)) {\n try {\n listener.call(node as E, event as DocumentEventMap[K]);\n } catch (error) {\n console.error(error);\n }\n break;\n }\n }\n },\n options\n );\n};\n\nexport const ready = (callback: () => void, options?: ReadyOptions): void => {\n for (const condition of options?.on ?? []) {\n if (!condition) {\n return;\n }\n }\n\n if (document.readyState !== \"loading\") {\n callback();\n } else {\n listen(\"DOMContentLoaded\", document, callback, { once: true });\n }\n};\n\nexport const endpoint: EndpointsKeys = getEndpoint();\nexport const settings: Settings = getSettings();\n","// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { Endpoints, endpoint, ready, settings } from \"./toolkit.ts\";\n\nready(\n () => {\n import(\"../main/keyboard.ts\");\n import(\"../main/search.ts\");\n\n if (settings.autocomplete) {\n import(\"../main/autocomplete.ts\");\n }\n },\n { on: [endpoint === Endpoints.index] }\n);\n\nready(\n () => {\n import(\"../main/keyboard.ts\");\n import(\"../main/mapresult.ts\");\n import(\"../main/results.ts\");\n import(\"../main/search.ts\");\n\n if (settings.infinite_scroll) {\n import(\"../main/infinite_scroll.ts\");\n }\n\n if (settings.autocomplete) {\n import(\"../main/autocomplete.ts\");\n }\n },\n { on: [endpoint === Endpoints.results] }\n);\n\nready(\n () => {\n import(\"../main/preferences.ts\");\n },\n { on: [endpoint === Endpoints.preferences] }\n);\n","// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { listen } from \"./toolkit.ts\";\n\nlisten(\"click\", \".close\", function (this: HTMLElement) {\n (this.parentNode as HTMLElement)?.classList.add(\"invisible\");\n});\n"],"file":"js/searxng.core.min.js"} \ No newline at end of file +{"version":3,"mappings":"AAsCA,MAAa,EAAY,CACvB,MAAO,QACP,QAAS,UACT,YAAa,cACb,QAAS,UACV,CAEY,EAAU,CACrB,YAAa,OACb,qBAAsB,OACtB,YAAa,OACb,WAAY,OACZ,eAAgB,OACjB,CAEK,MAAmC,CACvC,IAAM,EAAe,SAAS,cAAc,0BAA0B,aAAa,WAMnF,OAJI,GAAgB,KAAgB,EAC3B,EAGF,EAAU,OAClB,EAEK,MAA8B,CAClC,IAAM,EAAW,SAAS,cAAc,4BAA4B,aAAa,mBACjF,GAAI,CAAC,EAAU,MAAO,EAAE,CAExB,GAAI,CACF,OAAO,KAAK,MAAM,KAAK,GACxB,OAAQ,EAAO,CAEd,OADA,QAAQ,MAAM,kCAAmC,GAC1C,EAAE,CAEZ,EAEYA,EAAgC,GAAiE,CAC5G,GAAI,CAAC,EACH,MAAU,MAAM,uCAEnB,EAEY,EAAO,MAAO,EAAgB,EAAmB,IAA6C,CACzG,IAAM,EAAa,IAAI,gBACjB,EAAY,eAAiB,EAAW,QAAS,GAAS,SAAW,KAErE,EAAM,MAAM,MAAM,EAAK,CAC3B,KAAM,GAAS,KACP,SACR,OAAQ,EAAW,OACpB,EAAE,YAAc,aAAa,IAC9B,GAAI,CAAC,EAAI,GACP,MAAU,MAAM,EAAI,YAGtB,OAAO,CACR,EAEY,GACX,EACA,EACA,EACA,IACS,CACT,GAAI,OAAO,GAAW,SAAU,CAC9B,EAAO,iBAAiB,EAAM,EAA2B,GACzD,MACD,CAED,SAAS,iBACP,EACC,GAAiB,CAChB,IAAK,IAAM,KAAQ,EAAM,eACvB,GAAI,aAAgB,aAAe,EAAK,QAAQ,GAAS,CACvD,GAAI,CACF,EAAS,KAAK,EAAW,EAC1B,OAAQ,EAAO,CACd,QAAQ,MAAM,EACf,CACD,KACD,CAEJ,EACD,EAEH,EAEY,GAAS,EAAsB,IAAiC,CAC3E,IAAK,IAAM,KAAa,GAAS,IAAM,EAAE,CACvC,GAAI,CAAC,EACH,OAIA,SAAS,aAAe,UAG1B,EAAO,mBAAoB,SAAU,EAAU,CAAE,KAAM,GAAM,EAF7D,GAIH,EAEYC,EAA0B,IAC1BC,EAAqB,ICzIlC,MAAY,CACV,SAAS,gBAAgB,UAAU,OAAO,SAC1C,SAAS,gBAAgB,UAAU,IAAI,KACxC,ksCCHD,MACQ,CACJ,aAAO,yBACP,aAAO,uBAEH,EAAS,cACX,aAAO,4BAEV,EACD,CAAE,GAAI,CAAC,IAAa,EAAU,MAAM,CAAE,EAGxC,MACQ,CACJ,aAAO,yBACP,aAAO,0BACP,aAAO,wBACP,aAAO,uBAEH,EAAS,iBACX,aAAO,gCAGL,EAAS,cACX,aAAO,4BAEV,EACD,CAAE,GAAI,CAAC,IAAa,EAAU,QAAQ,CAAE,EAG1C,MACQ,CACJ,aAAO,2BACR,EACD,CAAE,GAAI,CAAC,IAAa,EAAU,YAAY,CAAE,EClC9C,EAAO,QAAS,SAAU,UAA6B,CACpD,KAAK,YAA4B,UAAU,IAAI,YACjD","names":["assertElement: AssertElement","endpoint: EndpointsKeys","settings: Settings"],"ignoreList":[],"sources":["../../../../../client/simple/src/js/core/toolkit.ts","../../../../../client/simple/src/js/core/nojs.ts","../../../../../client/simple/src/js/core/router.ts","../../../../../client/simple/src/js/core/listener.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport type { KeyBindingLayout } from \"../main/keyboard.ts\";\n\n// synced with searx/webapp.py get_client_settings\ntype Settings = {\n advanced_search?: boolean;\n autocomplete?: string;\n autocomplete_min?: number;\n doi_resolver?: string;\n favicon_resolver?: string;\n hotkeys?: KeyBindingLayout;\n infinite_scroll?: boolean;\n method?: \"GET\" | \"POST\";\n query_in_title?: boolean;\n results_on_new_tab?: boolean;\n safesearch?: 0 | 1 | 2;\n search_on_category_select?: boolean;\n theme?: string;\n theme_static_path?: string;\n translations?: Record;\n url_formatting?: \"pretty\" | \"full\" | \"host\";\n};\n\ntype HTTPOptions = {\n body?: BodyInit;\n timeout?: number;\n};\n\ntype ReadyOptions = {\n // all values must be truthy for the callback to be executed\n on?: (boolean | undefined)[];\n};\n\ntype AssertElement = (element?: HTMLElement | null) => asserts element is HTMLElement;\n\nexport type EndpointsKeys = keyof typeof Endpoints;\n\nexport const Endpoints = {\n index: \"index\",\n results: \"results\",\n preferences: \"preferences\",\n unknown: \"unknown\"\n} as const;\n\nexport const mutable = {\n closeDetail: undefined as (() => void) | undefined,\n scrollPageToSelected: undefined as (() => void) | undefined,\n selectImage: undefined as ((resultElement: HTMLElement) => void) | undefined,\n selectNext: undefined as ((openDetailView?: boolean) => void) | undefined,\n selectPrevious: undefined as ((openDetailView?: boolean) => void) | undefined\n};\n\nconst getEndpoint = (): EndpointsKeys => {\n const metaEndpoint = document.querySelector('meta[name=\"endpoint\"]')?.getAttribute(\"content\");\n\n if (metaEndpoint && metaEndpoint in Endpoints) {\n return metaEndpoint as EndpointsKeys;\n }\n\n return Endpoints.unknown;\n};\n\nconst getSettings = (): Settings => {\n const settings = document.querySelector(\"script[client_settings]\")?.getAttribute(\"client_settings\");\n if (!settings) return {};\n\n try {\n return JSON.parse(atob(settings));\n } catch (error) {\n console.error(\"Failed to load client_settings:\", error);\n return {};\n }\n};\n\nexport const assertElement: AssertElement = (element?: HTMLElement | null): asserts element is HTMLElement => {\n if (!element) {\n throw new Error(\"Bad assertion: DOM element not found\");\n }\n};\n\nexport const http = async (method: string, url: string | URL, options?: HTTPOptions): Promise => {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), options?.timeout ?? 30_000);\n\n const res = await fetch(url, {\n body: options?.body,\n method: method,\n signal: controller.signal\n }).finally(() => clearTimeout(timeoutId));\n if (!res.ok) {\n throw new Error(res.statusText);\n }\n\n return res;\n};\n\nexport const listen = (\n type: string | K,\n target: string | Document | E,\n listener: (this: E, event: DocumentEventMap[K]) => void | Promise,\n options?: AddEventListenerOptions\n): void => {\n if (typeof target !== \"string\") {\n target.addEventListener(type, listener as EventListener, options);\n return;\n }\n\n document.addEventListener(\n type,\n (event: Event) => {\n for (const node of event.composedPath()) {\n if (node instanceof HTMLElement && node.matches(target)) {\n try {\n listener.call(node as E, event as DocumentEventMap[K]);\n } catch (error) {\n console.error(error);\n }\n break;\n }\n }\n },\n options\n );\n};\n\nexport const ready = (callback: () => void, options?: ReadyOptions): void => {\n for (const condition of options?.on ?? []) {\n if (!condition) {\n return;\n }\n }\n\n if (document.readyState !== \"loading\") {\n callback();\n } else {\n listen(\"DOMContentLoaded\", document, callback, { once: true });\n }\n};\n\nexport const endpoint: EndpointsKeys = getEndpoint();\nexport const settings: Settings = getSettings();\n","// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { ready } from \"./toolkit.ts\";\n\nready(() => {\n document.documentElement.classList.remove(\"no-js\");\n document.documentElement.classList.add(\"js\");\n});\n","// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { Endpoints, endpoint, ready, settings } from \"./toolkit.ts\";\n\nready(\n () => {\n import(\"../main/keyboard.ts\");\n import(\"../main/search.ts\");\n\n if (settings.autocomplete) {\n import(\"../main/autocomplete.ts\");\n }\n },\n { on: [endpoint === Endpoints.index] }\n);\n\nready(\n () => {\n import(\"../main/keyboard.ts\");\n import(\"../main/mapresult.ts\");\n import(\"../main/results.ts\");\n import(\"../main/search.ts\");\n\n if (settings.infinite_scroll) {\n import(\"../main/infinite_scroll.ts\");\n }\n\n if (settings.autocomplete) {\n import(\"../main/autocomplete.ts\");\n }\n },\n { on: [endpoint === Endpoints.results] }\n);\n\nready(\n () => {\n import(\"../main/preferences.ts\");\n },\n { on: [endpoint === Endpoints.preferences] }\n);\n","// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { listen } from \"./toolkit.ts\";\n\nlisten(\"click\", \".close\", function (this: HTMLElement) {\n (this.parentNode as HTMLElement)?.classList.add(\"invisible\");\n});\n"],"file":"js/searxng.core.min.js"} \ No newline at end of file