diff --git a/searx/static/themes/simple/chunk/CQ8vfMdp.min.js b/searx/static/themes/simple/chunk/CQ8vfMdp.min.js new file mode 100644 index 000000000..515ef36f7 --- /dev/null +++ b/searx/static/themes/simple/chunk/CQ8vfMdp.min.js @@ -0,0 +1,2 @@ +import{i as e,n as t,t as n}from"../sxng-core.min.js";import{t as r}from"./DH1EQbEY.min.js";var i=async(i,a)=>{try{let o;o=e.method===`GET`?await n(`GET`,`./autocompleter?q=${a}`):await n(`POST`,`./autocompleter`,{body:new URLSearchParams({q:a})});let s=await o.json(),c=document.querySelector(`.autocomplete`);r(c);let l=document.querySelector(`.autocomplete ul`);if(r(l),c.classList.add(`open`),l.replaceChildren(),s?.[1]?.length===0){let t=Object.assign(document.createElement(`li`),{className:`no-item-found`,textContent:e.translations?.no_item_found??`No results found`});l.append(t);return}let u=new DocumentFragment;for(let e of s[1]){let n=Object.assign(document.createElement(`li`),{textContent:e});t(`mousedown`,n,()=>{i.value=e,document.querySelector(`#search`)?.submit()}),u.append(n)}l.append(u)}catch(e){console.error(`Error fetching autocomplete results:`,e)}},a=document.getElementById(`q`);r(a);var o;t(`input`,a,()=>{clearTimeout(o);let t=a.value,n=e.autocomplete_min??2;t.length{t===a.value&&await i(a,t)},300))});var s=document.querySelector(`.autocomplete`),c=document.querySelector(`.autocomplete ul`);c&&(t(`keydown`,a,e=>{e.key===`Escape`&&s?.classList.remove(`open`)}),t(`keyup`,a,e=>{let t=[...c.children],n=t.findIndex(e=>e.classList.contains(`active`)),r=-1;switch(e.key){case`ArrowUp`:{let e=t[n];e&&n>=0&&e.classList.remove(`active`),r=(n-1+t.length)%t.length;break}case`ArrowDown`:{let e=t[n];e&&n>=0&&e.classList.remove(`active`),r=(n+1)%t.length;break}case`Enter`:s&&s.classList.remove(`open`);break;default:break}if(r!==-1){let e=t[r];if(e&&(e.classList.add(`active`),!e.classList.contains(`no-item-found`))){let t=document.getElementById(`q`);t&&(t.value=e.textContent??``)}}}),t(`blur`,a,()=>{s?.classList.remove(`open`)}),t(`focus`,a,()=>{s?.classList.add(`open`)})); +//# sourceMappingURL=CQ8vfMdp.min.js.map \ No newline at end of file diff --git a/searx/static/themes/simple/chunk/CQ8vfMdp.min.js.map b/searx/static/themes/simple/chunk/CQ8vfMdp.min.js.map new file mode 100644 index 000000000..1dbcc1572 --- /dev/null +++ b/searx/static/themes/simple/chunk/CQ8vfMdp.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CQ8vfMdp.min.js","names":[],"sources":["../../../../../client/simple/src/js/main/autocomplete.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { http, listen, settings } from \"../toolkit.ts\";\nimport { assertElement } from \"../util/assertElement.ts\";\n\nconst fetchResults = async (qInput: HTMLInputElement, query: string): Promise => {\n try {\n let res: Response;\n\n if (settings.method === \"GET\") {\n res = await http(\"GET\", `./autocompleter?q=${query}`);\n } else {\n res = await http(\"POST\", \"./autocompleter\", { body: new URLSearchParams({ q: query }) });\n }\n\n const results = await res.json();\n\n const autocomplete = document.querySelector(\".autocomplete\");\n assertElement(autocomplete);\n\n const autocompleteList = document.querySelector(\".autocomplete ul\");\n assertElement(autocompleteList);\n\n autocomplete.classList.add(\"open\");\n autocompleteList.replaceChildren();\n\n // show an error message that no result was found\n if (results?.[1]?.length === 0) {\n const noItemFoundMessage = Object.assign(document.createElement(\"li\"), {\n className: \"no-item-found\",\n textContent: settings.translations?.no_item_found ?? \"No results found\"\n });\n autocompleteList.append(noItemFoundMessage);\n return;\n }\n\n const fragment = new DocumentFragment();\n\n for (const result of results[1]) {\n const li = Object.assign(document.createElement(\"li\"), { textContent: result });\n\n listen(\"mousedown\", li, () => {\n qInput.value = result;\n\n const form = document.querySelector(\"#search\");\n form?.submit();\n });\n\n fragment.append(li);\n }\n\n autocompleteList.append(fragment);\n } catch (error) {\n console.error(\"Error fetching autocomplete results:\", error);\n }\n};\n\nconst qInput = document.getElementById(\"q\") as HTMLInputElement | null;\nassertElement(qInput);\n\nlet timeoutId: number;\n\nlisten(\"input\", qInput, () => {\n clearTimeout(timeoutId);\n\n const query = qInput.value;\n const minLength = settings.autocomplete_min ?? 2;\n\n if (query.length < minLength) return;\n\n timeoutId = window.setTimeout(async () => {\n if (query === qInput.value) {\n await fetchResults(qInput, query);\n }\n }, 300);\n});\n\nconst autocomplete: HTMLElement | null = document.querySelector(\".autocomplete\");\nconst autocompleteList: HTMLUListElement | null = document.querySelector(\".autocomplete ul\");\nif (autocompleteList) {\n listen(\"keydown\", qInput, (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n autocomplete?.classList.remove(\"open\");\n }\n });\n listen(\"keyup\", qInput, (event: KeyboardEvent) => {\n const listItems = [...autocompleteList.children] as HTMLElement[];\n\n const currentIndex = listItems.findIndex((item) => item.classList.contains(\"active\"));\n let newCurrentIndex = -1;\n\n switch (event.key) {\n case \"ArrowUp\": {\n const currentItem = listItems[currentIndex];\n if (currentItem && currentIndex >= 0) {\n currentItem.classList.remove(\"active\");\n }\n // we need to add listItems.length to the index calculation here because the JavaScript modulos\n // operator doesn't work with negative numbers\n newCurrentIndex = (currentIndex - 1 + listItems.length) % listItems.length;\n break;\n }\n case \"ArrowDown\": {\n const currentItem = listItems[currentIndex];\n if (currentItem && currentIndex >= 0) {\n currentItem.classList.remove(\"active\");\n }\n newCurrentIndex = (currentIndex + 1) % listItems.length;\n break;\n }\n case \"Enter\":\n if (autocomplete) {\n autocomplete.classList.remove(\"open\");\n }\n break;\n default:\n break;\n }\n\n if (newCurrentIndex !== -1) {\n const selectedItem = listItems[newCurrentIndex];\n if (selectedItem) {\n selectedItem.classList.add(\"active\");\n\n if (!selectedItem.classList.contains(\"no-item-found\")) {\n const qInput = document.getElementById(\"q\") as HTMLInputElement | null;\n if (qInput) {\n qInput.value = selectedItem.textContent ?? \"\";\n }\n }\n }\n }\n });\n\n listen(\"blur\", qInput, () => {\n autocomplete?.classList.remove(\"open\");\n });\n\n listen(\"focus\", qInput, () => {\n autocomplete?.classList.add(\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ElC,IAAI,GACP,CAEF,IAAM,EAAmC,SAAS,cAA2B,gBAAgB,CACvF,EAA4C,SAAS,cAAgC,mBAAmB,CAC1G,IACF,EAAO,UAAW,EAAS,GAAyB,CAC9C,EAAM,MAAQ,UAChB,GAAc,UAAU,OAAO,OAAO,EAExC,CACF,EAAO,QAAS,EAAS,GAAyB,CAChD,IAAM,EAAY,CAAC,GAAG,EAAiB,SAAS,CAE1C,EAAe,EAAU,UAAW,GAAS,EAAK,UAAU,SAAS,SAAS,CAAC,CACjF,EAAkB,GAEtB,OAAQ,EAAM,IAAd,CACE,IAAK,UAAW,CACd,IAAM,EAAc,EAAU,GAC1B,GAAe,GAAgB,GACjC,EAAY,UAAU,OAAO,SAAS,CAIxC,GAAmB,EAAe,EAAI,EAAU,QAAU,EAAU,OACpE,MAEF,IAAK,YAAa,CAChB,IAAM,EAAc,EAAU,GAC1B,GAAe,GAAgB,GACjC,EAAY,UAAU,OAAO,SAAS,CAExC,GAAmB,EAAe,GAAK,EAAU,OACjD,MAEF,IAAK,QACC,GACF,EAAa,UAAU,OAAO,OAAO,CAEvC,MACF,QACE,MAGJ,GAAI,IAAoB,GAAI,CAC1B,IAAM,EAAe,EAAU,GAC/B,GAAI,IACF,EAAa,UAAU,IAAI,SAAS,CAEhC,CAAC,EAAa,UAAU,SAAS,gBAAgB,EAAE,CACrD,IAAM,EAAS,SAAS,eAAe,IAAI,CACvC,IACF,EAAO,MAAQ,EAAa,aAAe,OAKnD,CAEF,EAAO,OAAQ,MAAc,CAC3B,GAAc,UAAU,OAAO,OAAO,EACtC,CAEF,EAAO,QAAS,MAAc,CAC5B,GAAc,UAAU,IAAI,OAAO,EACnC"} \ No newline at end of file diff --git a/searx/static/themes/simple/chunk/R1hV2I0v.min.js b/searx/static/themes/simple/chunk/R1hV2I0v.min.js deleted file mode 100644 index b1fdf35d7..000000000 --- a/searx/static/themes/simple/chunk/R1hV2I0v.min.js +++ /dev/null @@ -1,2 +0,0 @@ -import{i as e,n as t,t as n}from"../sxng-core.min.js";import{t as r}from"./DH1EQbEY.min.js";var i=async(i,a)=>{try{let o;o=e.method===`GET`?await n(`GET`,`./autocompleter?q=${a}`):await n(`POST`,`./autocompleter`,{body:new URLSearchParams({q:a})});let s=await o.json(),c=document.querySelector(`.autocomplete`);r(c);let l=document.querySelector(`.autocomplete ul`);if(r(l),c.classList.add(`open`),l.replaceChildren(),s?.[1]?.length===0){let t=Object.assign(document.createElement(`li`),{className:`no-item-found`,textContent:e.translations?.no_item_found??`No results found`});l.append(t);return}let u=new DocumentFragment;for(let e of s[1]){let n=Object.assign(document.createElement(`li`),{textContent:e});t(`mousedown`,n,()=>{i.value=e,document.querySelector(`#search`)?.submit(),c.classList.remove(`open`)}),u.append(n)}l.append(u)}catch(e){console.error(`Error fetching autocomplete results:`,e)}},a=document.getElementById(`q`);r(a);var o;t(`input`,a,()=>{clearTimeout(o);let t=a.value,n=e.autocomplete_min??2;t.length{t===a.value&&await i(a,t)},300))});var s=document.querySelector(`.autocomplete`),c=document.querySelector(`.autocomplete ul`);c&&t(`keyup`,a,e=>{let t=[...c.children],n=t.findIndex(e=>e.classList.contains(`active`)),r=-1;switch(e.key){case`ArrowUp`:{let e=t[n];e&&n>=0&&e.classList.remove(`active`),r=(n-1+t.length)%t.length;break}case`ArrowDown`:{let e=t[n];e&&n>=0&&e.classList.remove(`active`),r=(n+1)%t.length;break}case`Tab`:case`Enter`:s&&s.classList.remove(`open`);break;default:break}if(r!==-1){let e=t[r];if(e&&(e.classList.add(`active`),!e.classList.contains(`no-item-found`))){let t=document.getElementById(`q`);t&&(t.value=e.textContent??``)}}}); -//# sourceMappingURL=R1hV2I0v.min.js.map \ No newline at end of file diff --git a/searx/static/themes/simple/chunk/R1hV2I0v.min.js.map b/searx/static/themes/simple/chunk/R1hV2I0v.min.js.map deleted file mode 100644 index fd977b81b..000000000 --- a/searx/static/themes/simple/chunk/R1hV2I0v.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"R1hV2I0v.min.js","names":[],"sources":["../../../../../client/simple/src/js/main/autocomplete.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { http, listen, settings } from \"../toolkit.ts\";\nimport { assertElement } from \"../util/assertElement.ts\";\n\nconst fetchResults = async (qInput: HTMLInputElement, query: string): Promise => {\n try {\n let res: Response;\n\n if (settings.method === \"GET\") {\n res = await http(\"GET\", `./autocompleter?q=${query}`);\n } else {\n res = await http(\"POST\", \"./autocompleter\", { body: new URLSearchParams({ q: query }) });\n }\n\n const results = await res.json();\n\n const autocomplete = document.querySelector(\".autocomplete\");\n assertElement(autocomplete);\n\n const autocompleteList = document.querySelector(\".autocomplete ul\");\n assertElement(autocompleteList);\n\n autocomplete.classList.add(\"open\");\n autocompleteList.replaceChildren();\n\n // show an error message that no result was found\n if (results?.[1]?.length === 0) {\n const noItemFoundMessage = Object.assign(document.createElement(\"li\"), {\n className: \"no-item-found\",\n textContent: settings.translations?.no_item_found ?? \"No results found\"\n });\n autocompleteList.append(noItemFoundMessage);\n return;\n }\n\n const fragment = new DocumentFragment();\n\n for (const result of results[1]) {\n const li = Object.assign(document.createElement(\"li\"), { textContent: result });\n\n listen(\"mousedown\", li, () => {\n qInput.value = result;\n\n const form = document.querySelector(\"#search\");\n form?.submit();\n\n autocomplete.classList.remove(\"open\");\n });\n\n fragment.append(li);\n }\n\n autocompleteList.append(fragment);\n } catch (error) {\n console.error(\"Error fetching autocomplete results:\", error);\n }\n};\n\nconst qInput = document.getElementById(\"q\") as HTMLInputElement | null;\nassertElement(qInput);\n\nlet timeoutId: number;\n\nlisten(\"input\", qInput, () => {\n clearTimeout(timeoutId);\n\n const query = qInput.value;\n const minLength = settings.autocomplete_min ?? 2;\n\n if (query.length < minLength) return;\n\n timeoutId = window.setTimeout(async () => {\n if (query === qInput.value) {\n await fetchResults(qInput, query);\n }\n }, 300);\n});\n\nconst autocomplete: HTMLElement | null = document.querySelector(\".autocomplete\");\nconst autocompleteList: HTMLUListElement | null = document.querySelector(\".autocomplete ul\");\nif (autocompleteList) {\n listen(\"keyup\", qInput, (event: KeyboardEvent) => {\n const listItems = [...autocompleteList.children] as HTMLElement[];\n\n const currentIndex = listItems.findIndex((item) => item.classList.contains(\"active\"));\n let newCurrentIndex = -1;\n\n switch (event.key) {\n case \"ArrowUp\": {\n const currentItem = listItems[currentIndex];\n if (currentItem && currentIndex >= 0) {\n currentItem.classList.remove(\"active\");\n }\n // we need to add listItems.length to the index calculation here because the JavaScript modulos\n // operator doesn't work with negative numbers\n newCurrentIndex = (currentIndex - 1 + listItems.length) % listItems.length;\n break;\n }\n case \"ArrowDown\": {\n const currentItem = listItems[currentIndex];\n if (currentItem && currentIndex >= 0) {\n currentItem.classList.remove(\"active\");\n }\n newCurrentIndex = (currentIndex + 1) % listItems.length;\n break;\n }\n case \"Tab\":\n case \"Enter\":\n if (autocomplete) {\n autocomplete.classList.remove(\"open\");\n }\n break;\n default:\n break;\n }\n\n if (newCurrentIndex !== -1) {\n const selectedItem = listItems[newCurrentIndex];\n if (selectedItem) {\n selectedItem.classList.add(\"active\");\n\n if (!selectedItem.classList.contains(\"no-item-found\")) {\n const qInput = document.getElementById(\"q\") as HTMLInputElement | null;\n if (qInput) {\n qInput.value = selectedItem.textContent ?? \"\";\n }\n }\n }\n }\n });\n}\n"],"mappings":"4FAKA,IAAM,EAAe,MAAO,EAA0B,IAAiC,CACrF,GAAI,CACF,IAAI,EAEJ,AAGE,EAHE,EAAS,SAAW,MAChB,MAAM,EAAK,MAAO,qBAAqB,IAAQ,CAE/C,MAAM,EAAK,OAAQ,kBAAmB,CAAE,KAAM,IAAI,gBAAgB,CAAE,EAAG,EAAO,CAAC,CAAE,CAAC,CAG1F,IAAM,EAAU,MAAM,EAAI,MAAM,CAE1B,EAAe,SAAS,cAA2B,gBAAgB,CACzE,EAAc,EAAa,CAE3B,IAAM,EAAmB,SAAS,cAAgC,mBAAmB,CAOrF,GANA,EAAc,EAAiB,CAE/B,EAAa,UAAU,IA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AU,OACpE,MAEF,IAAK,YAAa,CAChB,IAAM,EAAc,EAAU,GAC1B,GAAe,GAAgB,GACjC,EAAY,UAAU,OAAO,SAAS,CAExC,GAAmB,EAAe,GAAK,EAAU,OACjD,MAEF,IAAK,MACL,IAAK,QACC,GACF,EAAa,UAAU,OAAO,OAAO,CAEvC,MACF,QACE,MAGJ,GAAI,IAAoB,GAAI,CAC1B,IAAM,EAAe,EAAU,GAC/B,GAAI,IACF,EAAa,UAAU,IAAI,SAAS,CAEhC,CAAC,EAAa,UAAU,SAAS,gBAAgB,EAAE,CACrD,IAAM,EAAS,SAAS,eAAe,IAAI,CACvC,IACF,EAAO,MAAQ,EAAa,aAAe,OAKnD"} \ No newline at end of file diff --git a/searx/static/themes/simple/manifest.json b/searx/static/themes/simple/manifest.json index a1b1f7519..b15b93f36 100644 --- a/searx/static/themes/simple/manifest.json +++ b/searx/static/themes/simple/manifest.json @@ -27,7 +27,7 @@ ] }, "src/js/main/autocomplete.ts": { - "file": "chunk/R1hV2I0v.min.js", + "file": "chunk/CQ8vfMdp.min.js", "name": "autocomplete", "src": "src/js/main/autocomplete.ts", "isDynamicEntry": true, diff --git a/searx/static/themes/simple/sxng-core.min.js b/searx/static/themes/simple/sxng-core.min.js index 50847b870..eb3cb2830 100644 --- a/searx/static/themes/simple/sxng-core.min.js +++ b/searx/static/themes/simple/sxng-core.min.js @@ -1,3 +1,3 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./chunk/wvOFojcs.min.js","./sxng-mapview.min.css","./chunk/Cx4rGXMm.min.js","./chunk/DH1EQbEY.min.js","./chunk/chlzpS6K.min.js","./chunk/BSJ3HQQa.min.js","./chunk/SAW3N6vv.min.js","./chunk/BnP4vIuG.min.js","./chunk/R1hV2I0v.min.js","./chunk/DGJ63wI6.min.js","./chunk/DZidprJh.min.js"])))=>i.map(i=>d[i]); -var e=class{id;constructor(e){this.id=e,queueMicrotask(()=>this.invoke())}async invoke(){try{console.debug(`[PLUGIN] ${this.id}: Running...`);let e=await this.run();if(!e)return;console.debug(`[PLUGIN] ${this.id}: Running post-exec...`),await this.post(e)}catch(e){console.error(`[PLUGIN] ${this.id}:`,e)}finally{console.debug(`[PLUGIN] ${this.id}: Done.`)}}},t={index:`index`,results:`results`,preferences:`preferences`,unknown:`unknown`},n={closeDetail:void 0,scrollPageToSelected:void 0,selectImage:void 0,selectNext:void 0,selectPrevious:void 0},r=()=>{let e=document.querySelector(`meta[name="endpoint"]`)?.getAttribute(`content`);return e&&e in t?e:t.unknown},i=()=>{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),{}}},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=r(),l=i(),u=(e,t)=>{d(t)&&e()},d=e=>{switch(e.on){case`global`:return!0;case`endpoint`:return!!e.where.includes(c)}},f=`modulepreload`,p=function(e,t){return new URL(e,t).href},m={},h=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=p(t,n),t in m)return;m[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)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 o=document.createElement(`link`);if(o.rel=r?`stylesheet`:f,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.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||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};s(()=>{document.documentElement.classList.remove(`no-js`),document.documentElement.classList.add(`js`),o(`click`,`.close`,function(){this.parentNode?.classList.add(`invisible`)}),o(`click`,`.searxng_init_map`,async function(e){e.preventDefault(),this.classList.remove(`searxng_init_map`),u(()=>h(async()=>{let{default:e}=await import(`./chunk/wvOFojcs.min.js`);return{default:e}},__vite__mapDeps([0,1]),import.meta.url).then(({default:e})=>new e(this)),{on:`endpoint`,where:[t.results]})}),l.plugins?.includes(`infiniteScroll`)&&u(()=>h(async()=>{let{default:e}=await import(`./chunk/Cx4rGXMm.min.js`);return{default:e}},__vite__mapDeps([2,3,4]),import.meta.url).then(({default:e})=>new e),{on:`endpoint`,where:[t.results]}),l.plugins?.includes(`calculator`)&&u(()=>h(async()=>{let{default:e}=await import(`./chunk/BSJ3HQQa.min.js`);return{default:e}},__vite__mapDeps([5,4,3]),import.meta.url).then(({default:e})=>new e),{on:`endpoint`,where:[t.results]})}),s(()=>{h(()=>import(`./chunk/SAW3N6vv.min.js`),__vite__mapDeps([6,3]),import.meta.url),h(()=>import(`./chunk/BnP4vIuG.min.js`),__vite__mapDeps([7,4,3]),import.meta.url),l.autocomplete&&h(()=>import(`./chunk/R1hV2I0v.min.js`),__vite__mapDeps([8,3]),import.meta.url)},{on:[c===t.index]}),s(()=>{h(()=>import(`./chunk/SAW3N6vv.min.js`),__vite__mapDeps([6,3]),import.meta.url),h(()=>import(`./chunk/DGJ63wI6.min.js`),__vite__mapDeps([9,3]),import.meta.url),h(()=>import(`./chunk/BnP4vIuG.min.js`),__vite__mapDeps([7,4,3]),import.meta.url),l.autocomplete&&h(()=>import(`./chunk/R1hV2I0v.min.js`),__vite__mapDeps([8,3]),import.meta.url)},{on:[c===t.results]}),s(()=>{h(()=>import(`./chunk/DZidprJh.min.js`),__vite__mapDeps([10,3]),import.meta.url)},{on:[c===t.preferences]});export{e as a,l as i,o as n,n as r,a as t}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./chunk/wvOFojcs.min.js","./sxng-mapview.min.css","./chunk/Cx4rGXMm.min.js","./chunk/DH1EQbEY.min.js","./chunk/chlzpS6K.min.js","./chunk/BSJ3HQQa.min.js","./chunk/SAW3N6vv.min.js","./chunk/BnP4vIuG.min.js","./chunk/CQ8vfMdp.min.js","./chunk/DGJ63wI6.min.js","./chunk/DZidprJh.min.js"])))=>i.map(i=>d[i]); +var e=class{id;constructor(e){this.id=e,queueMicrotask(()=>this.invoke())}async invoke(){try{console.debug(`[PLUGIN] ${this.id}: Running...`);let e=await this.run();if(!e)return;console.debug(`[PLUGIN] ${this.id}: Running post-exec...`),await this.post(e)}catch(e){console.error(`[PLUGIN] ${this.id}:`,e)}finally{console.debug(`[PLUGIN] ${this.id}: Done.`)}}},t={index:`index`,results:`results`,preferences:`preferences`,unknown:`unknown`},n={closeDetail:void 0,scrollPageToSelected:void 0,selectImage:void 0,selectNext:void 0,selectPrevious:void 0},r=()=>{let e=document.querySelector(`meta[name="endpoint"]`)?.getAttribute(`content`);return e&&e in t?e:t.unknown},i=()=>{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),{}}},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=r(),l=i(),u=(e,t)=>{d(t)&&e()},d=e=>{switch(e.on){case`global`:return!0;case`endpoint`:return!!e.where.includes(c)}},f=`modulepreload`,p=function(e,t){return new URL(e,t).href},m={},h=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=p(t,n),t in m)return;m[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)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 o=document.createElement(`link`);if(o.rel=r?`stylesheet`:f,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.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||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};s(()=>{document.documentElement.classList.remove(`no-js`),document.documentElement.classList.add(`js`),o(`click`,`.close`,function(){this.parentNode?.classList.add(`invisible`)}),o(`click`,`.searxng_init_map`,async function(e){e.preventDefault(),this.classList.remove(`searxng_init_map`),u(()=>h(async()=>{let{default:e}=await import(`./chunk/wvOFojcs.min.js`);return{default:e}},__vite__mapDeps([0,1]),import.meta.url).then(({default:e})=>new e(this)),{on:`endpoint`,where:[t.results]})}),l.plugins?.includes(`infiniteScroll`)&&u(()=>h(async()=>{let{default:e}=await import(`./chunk/Cx4rGXMm.min.js`);return{default:e}},__vite__mapDeps([2,3,4]),import.meta.url).then(({default:e})=>new e),{on:`endpoint`,where:[t.results]}),l.plugins?.includes(`calculator`)&&u(()=>h(async()=>{let{default:e}=await import(`./chunk/BSJ3HQQa.min.js`);return{default:e}},__vite__mapDeps([5,4,3]),import.meta.url).then(({default:e})=>new e),{on:`endpoint`,where:[t.results]})}),s(()=>{h(()=>import(`./chunk/SAW3N6vv.min.js`),__vite__mapDeps([6,3]),import.meta.url),h(()=>import(`./chunk/BnP4vIuG.min.js`),__vite__mapDeps([7,4,3]),import.meta.url),l.autocomplete&&h(()=>import(`./chunk/CQ8vfMdp.min.js`),__vite__mapDeps([8,3]),import.meta.url)},{on:[c===t.index]}),s(()=>{h(()=>import(`./chunk/SAW3N6vv.min.js`),__vite__mapDeps([6,3]),import.meta.url),h(()=>import(`./chunk/DGJ63wI6.min.js`),__vite__mapDeps([9,3]),import.meta.url),h(()=>import(`./chunk/BnP4vIuG.min.js`),__vite__mapDeps([7,4,3]),import.meta.url),l.autocomplete&&h(()=>import(`./chunk/CQ8vfMdp.min.js`),__vite__mapDeps([8,3]),import.meta.url)},{on:[c===t.results]}),s(()=>{h(()=>import(`./chunk/DZidprJh.min.js`),__vite__mapDeps([10,3]),import.meta.url)},{on:[c===t.preferences]});export{e as a,l as i,o as n,n as r,a as t}; //# sourceMappingURL=sxng-core.min.js.map \ No newline at end of file