wherever-dev 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/session-pool.d.ts +36 -0
  2. package/dist/session-pool.d.ts.map +1 -1
  3. package/dist/session-pool.js +92 -1
  4. package/dist/session-pool.js.map +1 -1
  5. package/package.json +1 -1
  6. package/public/_app/immutable/chunks/{6cDLdLMr.js → B-wwgngN.js} +2 -2
  7. package/public/_app/immutable/chunks/{6cDLdLMr.js.map → B-wwgngN.js.map} +1 -1
  8. package/public/_app/immutable/chunks/{C2gDSNg3.js → BS1e7MNH.js} +2 -2
  9. package/public/_app/immutable/chunks/{C2gDSNg3.js.map → BS1e7MNH.js.map} +1 -1
  10. package/public/_app/immutable/chunks/D7tJYS3B.js +2 -0
  11. package/public/_app/immutable/chunks/{BWLk4g7S.js.map → D7tJYS3B.js.map} +1 -1
  12. package/public/_app/immutable/entry/{app.DCsaSS2h.js → app.vIHfKp_M.js} +3 -3
  13. package/public/_app/immutable/entry/{app.DCsaSS2h.js.map → app.vIHfKp_M.js.map} +1 -1
  14. package/public/_app/immutable/entry/start.DLmhFByO.js +2 -0
  15. package/public/_app/immutable/entry/start.DLmhFByO.js.map +1 -0
  16. package/public/_app/immutable/nodes/{0.BKhPUBoV.js → 0.OosB8P5k.js} +2 -2
  17. package/public/_app/immutable/nodes/{0.BKhPUBoV.js.map → 0.OosB8P5k.js.map} +1 -1
  18. package/public/_app/immutable/nodes/{1.D-6k-nc0.js → 1.DJT-BX9k.js} +2 -2
  19. package/public/_app/immutable/nodes/{1.D-6k-nc0.js.map → 1.DJT-BX9k.js.map} +1 -1
  20. package/public/_app/immutable/nodes/{2.B1UIQ9ew.js → 2.CuG3NS5s.js} +2 -2
  21. package/public/_app/immutable/nodes/{2.B1UIQ9ew.js.map → 2.CuG3NS5s.js.map} +1 -1
  22. package/public/_app/version.json +1 -1
  23. package/public/index.html +10 -10
  24. package/public/service-worker.js +1 -1
  25. package/public/_app/immutable/chunks/BWLk4g7S.js +0 -2
  26. package/public/_app/immutable/entry/start.CVu9YCQp.js +0 -2
  27. package/public/_app/immutable/entry/start.CVu9YCQp.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"6cDLdLMr.js","sources":["../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/client.js","../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/index.js"],"sourcesContent":["import {\n\tpage as _page,\n\tnavigating as _navigating,\n\tupdated as _updated\n} from '../../client/state.svelte.js';\nimport { stores } from '../../client/client.js';\n\nexport const page = {\n\tget data() {\n\t\treturn _page.data;\n\t},\n\tget error() {\n\t\treturn _page.error;\n\t},\n\tget form() {\n\t\treturn _page.form;\n\t},\n\tget params() {\n\t\treturn _page.params;\n\t},\n\tget route() {\n\t\treturn _page.route;\n\t},\n\tget state() {\n\t\treturn _page.state;\n\t},\n\tget status() {\n\t\treturn _page.status;\n\t},\n\tget url() {\n\t\treturn _page.url;\n\t}\n};\n\nexport const navigating = {\n\tget from() {\n\t\treturn _navigating.current ? _navigating.current.from : null;\n\t},\n\tget to() {\n\t\treturn _navigating.current ? _navigating.current.to : null;\n\t},\n\tget type() {\n\t\treturn _navigating.current ? _navigating.current.type : null;\n\t},\n\tget willUnload() {\n\t\treturn _navigating.current ? _navigating.current.willUnload : null;\n\t},\n\tget delta() {\n\t\treturn _navigating.current ? _navigating.current.delta : null;\n\t},\n\tget complete() {\n\t\treturn _navigating.current ? _navigating.current.complete : null;\n\t}\n};\n\nObject.defineProperty(navigating, 'current', {\n\tget() {\n\t\t// between 2.12.0 and 2.12.1 `navigating.current` existed\n\t\tthrow new Error('Replace navigating.current.<prop> with navigating.<prop>');\n\t}\n});\n\nexport const updated = {\n\tget current() {\n\t\treturn _updated.current;\n\t},\n\tcheck: stores.updated.check\n};\n","import {\n\tpage as client_page,\n\tnavigating as client_navigating,\n\tupdated as client_updated\n} from './client.js';\nimport {\n\tpage as server_page,\n\tnavigating as server_navigating,\n\tupdated as server_updated\n} from './server.js';\nimport { BROWSER } from 'esm-env';\n\n/**\n * A read-only reactive object with information about the current page, serving several use cases:\n * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))\n * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))\n * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))\n * - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error\n *\n * ```svelte\n * <!--- file: +layout.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * </script>\n *\n * <p>Currently at {page.url.pathname}</p>\n *\n * {#if page.error}\n * \t<span class=\"red\">Problem detected</span>\n * {:else}\n * \t<span class=\"small\">All systems operational</span>\n * {/if}\n * ```\n *\n * Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes)\n *\n * ```svelte\n * <!--- file: +page.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * \tconst id = $derived(page.params.id); // This will correctly update id for usage on this page\n * \t$: badId = page.params.id; // Do not use; will never update after initial load\n * </script>\n * ```\n *\n * On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.\n *\n * @type {import('@sveltejs/kit').Page}\n */\nexport const page = BROWSER ? client_page : server_page;\n\n/**\n * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.\n * Values are `null` when no navigation is occurring, or during server rendering.\n * @type {import('@sveltejs/kit').Navigation | { from: null, to: null, type: null, willUnload: null, delta: null, complete: null }}\n */\n// @ts-expect-error\nexport const navigating = BROWSER ? client_navigating : server_navigating;\n\n/**\n * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.\n * @type {{ get current(): boolean; check(): Promise<boolean>; }}\n */\nexport const updated = BROWSER ? client_updated : server_updated;\n"],"names":["page","_page","stores","client_page"],"mappings":"yCAOO,MAAMA,EAAO,CAInB,IAAI,OAAQ,CACX,OAAOC,EAAM,KACd,EAUA,IAAI,OAAQ,CACX,OAAOA,EAAM,KACd,EACA,IAAI,QAAS,CACZ,OAAOA,EAAM,MACd,EACA,IAAI,KAAM,CACT,OAAOA,EAAM,GACd,CACD,EAkCQC,EAAO,QAAQ,MCjBX,MAACF,EAAiBG","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"B-wwgngN.js","sources":["../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/client.js","../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/state/index.js"],"sourcesContent":["import {\n\tpage as _page,\n\tnavigating as _navigating,\n\tupdated as _updated\n} from '../../client/state.svelte.js';\nimport { stores } from '../../client/client.js';\n\nexport const page = {\n\tget data() {\n\t\treturn _page.data;\n\t},\n\tget error() {\n\t\treturn _page.error;\n\t},\n\tget form() {\n\t\treturn _page.form;\n\t},\n\tget params() {\n\t\treturn _page.params;\n\t},\n\tget route() {\n\t\treturn _page.route;\n\t},\n\tget state() {\n\t\treturn _page.state;\n\t},\n\tget status() {\n\t\treturn _page.status;\n\t},\n\tget url() {\n\t\treturn _page.url;\n\t}\n};\n\nexport const navigating = {\n\tget from() {\n\t\treturn _navigating.current ? _navigating.current.from : null;\n\t},\n\tget to() {\n\t\treturn _navigating.current ? _navigating.current.to : null;\n\t},\n\tget type() {\n\t\treturn _navigating.current ? _navigating.current.type : null;\n\t},\n\tget willUnload() {\n\t\treturn _navigating.current ? _navigating.current.willUnload : null;\n\t},\n\tget delta() {\n\t\treturn _navigating.current ? _navigating.current.delta : null;\n\t},\n\tget complete() {\n\t\treturn _navigating.current ? _navigating.current.complete : null;\n\t}\n};\n\nObject.defineProperty(navigating, 'current', {\n\tget() {\n\t\t// between 2.12.0 and 2.12.1 `navigating.current` existed\n\t\tthrow new Error('Replace navigating.current.<prop> with navigating.<prop>');\n\t}\n});\n\nexport const updated = {\n\tget current() {\n\t\treturn _updated.current;\n\t},\n\tcheck: stores.updated.check\n};\n","import {\n\tpage as client_page,\n\tnavigating as client_navigating,\n\tupdated as client_updated\n} from './client.js';\nimport {\n\tpage as server_page,\n\tnavigating as server_navigating,\n\tupdated as server_updated\n} from './server.js';\nimport { BROWSER } from 'esm-env';\n\n/**\n * A read-only reactive object with information about the current page, serving several use cases:\n * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))\n * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))\n * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))\n * - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error\n *\n * ```svelte\n * <!--- file: +layout.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * </script>\n *\n * <p>Currently at {page.url.pathname}</p>\n *\n * {#if page.error}\n * \t<span class=\"red\">Problem detected</span>\n * {:else}\n * \t<span class=\"small\">All systems operational</span>\n * {/if}\n * ```\n *\n * Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes)\n *\n * ```svelte\n * <!--- file: +page.svelte --->\n * <script>\n * \timport { page } from '$app/state';\n * \tconst id = $derived(page.params.id); // This will correctly update id for usage on this page\n * \t$: badId = page.params.id; // Do not use; will never update after initial load\n * </script>\n * ```\n *\n * On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.\n *\n * @type {import('@sveltejs/kit').Page}\n */\nexport const page = BROWSER ? client_page : server_page;\n\n/**\n * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.\n * Values are `null` when no navigation is occurring, or during server rendering.\n * @type {import('@sveltejs/kit').Navigation | { from: null, to: null, type: null, willUnload: null, delta: null, complete: null }}\n */\n// @ts-expect-error\nexport const navigating = BROWSER ? client_navigating : server_navigating;\n\n/**\n * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.\n * @type {{ get current(): boolean; check(): Promise<boolean>; }}\n */\nexport const updated = BROWSER ? client_updated : server_updated;\n"],"names":["page","_page","stores","client_page"],"mappings":"yCAOO,MAAMA,EAAO,CAInB,IAAI,OAAQ,CACX,OAAOC,EAAM,KACd,EAUA,IAAI,OAAQ,CACX,OAAOA,EAAM,KACd,EACA,IAAI,QAAS,CACZ,OAAOA,EAAM,MACd,EACA,IAAI,KAAM,CACT,OAAOA,EAAM,GACd,CACD,EAkCQC,EAAO,QAAQ,MCjBX,MAACF,EAAiBG","x_google_ignoreList":[0,1]}
@@ -1,2 +1,2 @@
1
- import{W as K,J as $e,ao as F,aU as Y,ai as Ae,am as Ce,af as se,aK as Ie,m as Re,a$ as ae,aV as q,an as z,b as Ue,j as Fe,aq as ie,X as Me,h as y,K as Z,a6 as Le,aY as Ne,a4 as Oe,as as Pe,z as re,g as He,f as De,az as We,b0 as ce,E as xe,D as je,aP as me,aE as be,I as G,a as ze,O as Be,ay as Ve,a5 as Ke,aj as Ye,e as ke,aJ as Se,d as qe,A as Ge,N as Je,ak as Xe,F as Qe,x as Ze,o as et,ah as tt,n as Ee,ae as M,be as E}from"./CAL8yDNt.js";import{b as nt,r as rt,c as ot,v as st}from"./BWLk4g7S.js";import{p as at}from"./6cDLdLMr.js";function qt(e,t){return t}function it(e,t,n){for(var o=[],r=t.length,a,s=t.length,l=0;l<r;l++){let b=t[l];be(b,()=>{if(a){if(a.pending.delete(b),a.done.add(b),a.pending.size===0){var p=e.outrogroups;ee(e,re(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var i=o.length===0&&n!==null;if(i){var u=n,f=u.parentNode;Be(f),f.append(u),e.items.clear()}ee(e,t,!i)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function ee(e,t,n=!0){var o;if(e.pending.size>0){o=new Set;for(const s of e.pending.values())for(const l of s)o.add(e.items.get(l).e)}for(var r=0;r<t.length;r++){var a=t[r];if(o?.has(a)){a.f|=y;const s=document.createDocumentFragment();Ve(a,s)}else Ke(t[r],n)}}var le;function Gt(e,t,n,o,r,a=null){var s=e,l=new Map,i=(t&ke)!==0;if(i){var u=e;s=F?Y(Ae(u)):u.appendChild(K())}F&&Ce();var f=null,b=Oe(()=>{var h=n();return Pe(h)?h:h==null?[]:re(h)}),p,k=new Map,S=!0;function L(h){(C.effect.f&je)===0&&(C.pending.delete(h),C.fallback=f,ct(C,p,s,t,o),f!==null&&(p.length===0?(f.f&y)===0?me(f):(f.f^=y,H(f,null,s)):be(f,()=>{f=null})))}function c(h){C.pending.delete(h)}var d=$e(()=>{p=se(b);var h=p.length;let m=!1;if(F){var x=Ie(s)===Re;x!==(h===0)&&(s=ae(),Y(s),q(!1),m=!0)}for(var I=new Set,g=Me,N=Ne(),R=0;R<h;R+=1){F&&z.nodeType===Ue&&z.data===Fe&&(s=z,m=!0,q(!1));var _=p[R],j=o(_,R),T=S?null:l.get(j);T?(T.v&&ie(T.v,_),T.i&&ie(T.i,R),N&&g.unskip_effect(T.e)):(T=lt(l,S?s:le??=K(),_,j,R,r,t,n),S||(T.e.f|=y),l.set(j,T)),I.add(j)}if(h===0&&a&&!f&&(S?f=Z(()=>a(s)):(f=Z(()=>a(le??=K())),f.f|=y)),h>I.size&&Le(),F&&h>0&&Y(ae()),!S)if(k.set(g,I),N){for(const[ye,Te]of l)I.has(ye)||g.skip_effect(Te.e);g.oncommit(L),g.ondiscard(c)}else L(g);m&&q(!0),se(b)}),C={effect:d,items:l,pending:k,outrogroups:null,fallback:f};S=!1,F&&(s=z)}function O(e){for(;e!==null&&(e.f&ze)===0;)e=e.next;return e}function ct(e,t,n,o,r){var a=(o&qe)!==0,s=t.length,l=e.items,i=O(e.effect.first),u,f=null,b,p=[],k=[],S,L,c,d;if(a)for(d=0;d<s;d+=1)S=t[d],L=r(S,d),c=l.get(L).e,(c.f&y)===0&&(c.nodes?.a?.measure(),(b??=new Set).add(c));for(d=0;d<s;d+=1){if(S=t[d],L=r(S,d),c=l.get(L).e,e.outrogroups!==null)for(const _ of e.outrogroups)_.pending.delete(c),_.done.delete(c);if((c.f&G)!==0&&(me(c),a&&(c.nodes?.a?.unfix(),(b??=new Set).delete(c))),(c.f&y)!==0)if(c.f^=y,c===i)H(c,null,n);else{var C=f?f.next:i;c===e.effect.last&&(e.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),U(e,f,c),U(e,c,C),H(c,C,n),f=c,p=[],k=[],i=O(f.next);continue}if(c!==i){if(u!==void 0&&u.has(c)){if(p.length<k.length){var h=k[0],m;f=h.prev;var x=p[0],I=p[p.length-1];for(m=0;m<p.length;m+=1)H(p[m],h,n);for(m=0;m<k.length;m+=1)u.delete(k[m]);U(e,x.prev,I.next),U(e,f,x),U(e,I,h),i=h,f=I,d-=1,p=[],k=[]}else u.delete(c),H(c,i,n),U(e,c.prev,c.next),U(e,c,f===null?e.effect.first:f.next),U(e,f,c),f=c;continue}for(p=[],k=[];i!==null&&i!==c;)(u??=new Set).add(i),k.push(i),i=O(i.next);if(i===null)continue}(c.f&y)===0&&p.push(c),f=c,i=O(c.next)}if(e.outrogroups!==null){for(const _ of e.outrogroups)_.pending.size===0&&(ee(e,re(_.done)),e.outrogroups?.delete(_));e.outrogroups.size===0&&(e.outrogroups=null)}if(i!==null||u!==void 0){var g=[];if(u!==void 0)for(c of u)(c.f&G)===0&&g.push(c);for(;i!==null;)(i.f&G)===0&&i!==e.fallback&&g.push(i),i=O(i.next);var N=g.length;if(N>0){var R=(o&ke)!==0&&s===0?n:null;if(a){for(d=0;d<N;d+=1)g[d].nodes?.a?.measure();for(d=0;d<N;d+=1)g[d].nodes?.a?.fix()}it(e,g,R)}}a&&Se(()=>{if(b!==void 0)for(c of b)c.nodes?.a?.apply()})}function lt(e,t,n,o,r,a,s,l){var i=(s&He)!==0?(s&De)===0?We(n,!1,!1):ce(n):null,u=(s&xe)!==0?ce(r):null;return{v:i,i:u,e:Z(()=>(a(t,i??n,u??r,l),()=>{e.delete(o)}))}}function H(e,t,n){if(e.nodes)for(var o=e.nodes.start,r=e.nodes.end,a=t&&(t.f&y)===0?t.nodes.start:n;o!==null;){var s=Ye(o);if(a.before(o),o===r)return;o=s}}function U(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const ft=Symbol("is custom element"),ut=Symbol("is html"),dt=Ee?"link":"LINK",pt=Ee?"progress":"PROGRESS";function Jt(e){if(F){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var o=e.value;fe(e,"value",null),e.value=o}if(e.hasAttribute("checked")){var r=e.checked;fe(e,"checked",null),e.checked=r}}};e[Qe]=n,Se(n),Ze()}}function Xt(e,t){var n=oe(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==pt)||(e.value=t??"")}function Qt(e,t){var n=oe(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function fe(e,t,n,o){var r=oe(e);F&&(r[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===dt)||r[t]!==(r[t]=n)&&(t==="loading"&&(e[et]=n),n==null?e.removeAttribute(t):typeof n!="string"&&ht(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function oe(e){return e[Ge]??={[ft]:e.nodeName.includes("-"),[ut]:e.namespaceURI===Je}}var ue=new Map;function ht(e){var t=e.getAttribute("is")||e.nodeName,n=ue.get(t);if(n)return n;ue.set(t,n=[]);for(var o,r=e,a=Element.prototype;a!==r;){o=tt(r);for(var s in o)o[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&n.push(s);r=Xe(r)}return n}const gt="";function vt(...e){if(!e[0].startsWith("/"))throw new Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return nt+gt+rt(e[0],e[1])}const v=()=>{},wt={assert:v,error:v,warn:v,info:v,log:v,debug:v,dir:v,table:v,trace:v,write:v,time:v,timeEnd:v,timeLog:v};function mt(){return globalThis?._logFactory}function bt(e,t){const n=mt();return n?n(e,{decoration:t?.decoration}):wt}function kt(e,t){let n=performance.now();function o(r){const a=performance.now();a-n>t.idle&&e.update(),n=a}return["focus","pointerdown"].forEach(r=>window.addEventListener(r,o)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e.update()}),e.update(),setInterval(()=>e.update(),t.checks)}function St(e,t){function n(){e.installing&&e.installing.addEventListener("statechange",function(){this.state==="installed"&&t(e)})}if(e){if(e.waiting)return t(e);e.installing?n():e.addEventListener("updatefound",n)}}function Et(){let e=1;const t=E([]);function n(a){t.update(s=>[...s,{...a,id:++e}])}function o(a){t.update(s=>s.filter(l=>l.id!==a))}function r(a){const s=M(t).find(l=>l.id==a);o(a),s?.type==="push-notification"&&s.data.options.data?.navigate&&ot(s.data.options.data.navigate,at.state)}return{subscribe:t.subscribe,add:n,remove:o,onClick:r}}const _t=Et(),w=bt("service-worker");function J(e){e&&(w.enabled?w.debug(`enabling logging for service worker, level: ${w.level}`):w.debug(`disabling logging for service worker, level: ${w.level}`),e.postMessage({type:"debug",level:w.level,enabled:w.enabled}))}const yt=180*1e3,Tt=1800*1e3;function $t(){const e=E(void 0);function t(s="active"){n({type:"ping"},s)}function n(s,l="active"){const i=M(e);if(!i)throw new Error("not loaded");if(i.notSupported)throw new Error("not supported");if(i.registering)throw new Error("is registering...");const u=i.registration;if(!u)throw new Error("no registration");if(!u[l])throw new Error(`no registration in state: ${l}`);u[l].postMessage(s)}function o(){w.log("accepting update...");const s=M(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");if(s.updateAvailable&&s.registration){const l=s.registration;if(!l)throw new Error("no registration");l.waiting?(w.log("was waiting, skipping..."),l.waiting.postMessage("skipWaiting")):(w.log("was not waiting, should we reload?"),w.error("not waiting..., todo reload?")),w.log("update store"),e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}}function r(){const s=M(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}function a(){if(typeof navigator<"u"&&"serviceWorker"in navigator){e.set({notSupported:!1,registering:!0});let s=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{s||(s=!0,window.location.reload())}),navigator.serviceWorker.onmessage=i=>{i.data&&i.data.type==="notification"&&(console.log(i),_t.add({type:"push-notification",data:i.data.notification}))};const l=vt("/service-worker.js");navigator.serviceWorker.register(l,{type:"classic"}).then(i=>{try{kt(i,{idle:yt,checks:Tt})}catch{}e.set({notSupported:!1,updateAvailable:!1,registration:i,registering:!1}),J(i.installing),J(i.waiting),J(i.active),St(i,()=>{e.set({notSupported:!1,updateAvailable:!0,registration:i,registering:!1})})}).catch(i=>{console.error(i),e.set({registering:!1,notSupported:!1,updateAvailable:!1,registration:void 0,error:{message:"failed to register service-worker",cause:i.message||i}}),w.error("Failed to register service worker",i)})}else typeof window<"u"&&e.set({notSupported:!0})}return{subscribe:e.subscribe,set:e.set,get registration(){const s=M(e);if(s&&"registration"in s)return s.registration},get updateAvailable(){const s=M(e);return s&&"updateAvailable"in s?s.updateAvailable:!1},register:a,pingServideWorker:t,sendMessage:n,skipWaiting:o,skip:r}}function At(e){if(!e)return{params:{},pathname:""};const t={},n=e.lastIndexOf("#");let o=e;n!==-1&&(o=o.slice(0,n));const r=o.indexOf("?");r!==-1&&o.slice(r+1).split("&").forEach(s=>{const[l,i=""]=s.split("=");t[decodeURIComponent(l)]=i===""?"true":decodeURIComponent(i)});let a=o.slice(0,r)||"";return a&&!a.endsWith("/")&&(a+="/"),{params:t,pathname:a}}function Ct(){return typeof window>"u"?{params:{}}:At(window.location.href)}function It(e){if(typeof window>"u")return{};const t=window.location.hash,n={},o=t.lastIndexOf("#");return o!==-1&&t.slice(o+1).split("&").forEach(r=>{const[a,s=""]=r.split("=");n[decodeURIComponent(a)]=decodeURIComponent(s)}),n}const Zt=$t();It();const{params:en}=Ct();console.log(`VERSION: ${st}`);const de={brandDark:"--color-brand-dark",brandSurface:"--color-brand-surface",brandSurface2:"--color-brand-surface-2",brandSurface3:"--color-brand-surface-3",brandBorder:"--color-brand-border",brandText:"--color-brand-text",brandTextMuted:"--color-brand-text-muted",brandCyan:"--color-brand-cyan",brandBlue:"--color-brand-blue",brandPurple:"--color-brand-purple"},Rt=["--color-brand-cyan","--color-brand-blue","--color-brand-purple"],Ut={label:"",accent:null,colors:null,frame:!1,pattern:"none"};function tn(e){if(typeof document>"u")return;const t=document.documentElement;for(const n of Object.values(de))t.style.removeProperty(n);if(t.classList.remove("wherever-framed"),delete t.dataset.whereverPattern,e.accent){for(const n of Rt)t.style.setProperty(n,e.accent);document.querySelector('meta[name="theme-color"]')?.setAttribute("content",e.accent)}if(e.frame&&t.classList.add("wherever-framed"),e.pattern&&e.pattern!=="none"&&(t.dataset.whereverPattern=e.pattern),e.colors)for(const[n,o]of Object.entries(e.colors)){const r=de[n];r&&typeof o=="string"&&t.style.setProperty(r,o)}}const pe="wherever-config",Ft="token";function he(e,t){const n=e.startsWith(t)?e.slice(1):e;if(!n)return{present:!1,value:"",rest:e};const o=new URLSearchParams(n),r=[...new Set([...o.keys()].filter(i=>i.toLowerCase()===Ft))];if(r.length===0)return{present:!1,value:"",rest:e};const s=r.flatMap(i=>o.getAll(i)).find(i=>i.trim())??"";for(const i of r)o.delete(i);const l=o.toString();return{present:!0,value:s,rest:l?`${t}${l}`:""}}function _e(e,t){const n=he(t||"","#"),o=he(e||"","?"),r=n.value||o.value;return{token:r||null,present:n.present||o.present,search:o.rest,hash:n.rest}}function Mt(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=_e(e.search||"",e.hash||"");if(!t.present)return!1;try{const n=window.history;if(n&&typeof n.replaceState=="function"){const o=e.pathname||"/";return n.replaceState(n.state??null,"",`${o}${t.search}${t.hash}`),!0}}catch{}return!1}function Lt(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=_e(e.search||"",e.hash||"");if(!t.present||(Mt(),!t.token))return!1;let n={};try{const o=localStorage.getItem(pe);if(o){const r=JSON.parse(o);r&&typeof r=="object"&&(n=r)}}catch{n={}}try{return localStorage.setItem(pe,JSON.stringify({...n,token:t.token})),!0}catch{return!1}}let ge=!1;function Nt(){return ge?!1:(ge=!0,Lt())}Nt();const W=E({folders:[],activeSessions:[],currentSession:null,loading:!1}),X=E({models:[],loading:!1}),B=E({folders:[],activeSessions:[],currentSession:null,loading:!1});function Q(){if(typeof window<"u"&&window.location){const e=window.location;if(e.port)return Number(e.port);if(e.protocol==="https:")return 443;if(e.protocol==="http:")return 80}return 31415}function $(){const e=localStorage.getItem("wherever-config"),t=typeof window<"u"&&window.location&&window.location.hostname?window.location.hostname:"localhost";if(e){const n=JSON.parse(e),o=window.location.protocol==="https:"?"https:":"http:";let r=n.host||t;(r==="localhost"||r==="127.0.0.1")&&t&&t!=="localhost"&&t!=="127.0.0.1"&&(r=t),r=r.startsWith("http")?r.replace(/^wss?:\/\//,""):r;let a=n.port;return(a===31415||a===void 0)&&Q()!==31415&&(a=Q()),`${o}//${r}:${a||Q()}`}return`${window.location.protocol}//${window.location.host}`}let P=null,D=[],te=!1,ne=!1,ve=0;const Ot=150,Pt=1e3;async function Ht(){te=!0;try{const e=$(),t=A(),n=`${e}/sessions${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();W.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(W).currentSession,loading:!1})}catch(e){W.update(t=>({...t,loading:!1})),console.error("Failed to fetch sessions:",e)}finally{te=!1}}function nn(){W.update(n=>({...n,loading:!0}));const e=new Promise(n=>{D.push(n)});if(te)return ne=!0,e;const t=Date.now();if(!P)ve=t;else if(clearTimeout(P),t-ve>=Pt)return P=null,we(),e;return P=setTimeout(()=>{P=null,we()},Ot),e}async function we(){try{do{ne=!1;const e=D;D=[];try{await Ht()}finally{for(const t of e)t()}}while(ne)}finally{const e=D;D=[];for(const t of e)t()}}async function rn(){B.update(e=>({...e,loading:!0}));try{const e=$(),t=A(),n=`${e}/sessions?view=readonly${t?`&token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();B.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(B).currentSession,loading:!1})}catch(e){B.update(t=>({...t,loading:!1})),console.error("Failed to fetch read-only sessions:",e)}}let V=null;async function on(e,t="default"){V?.abort();const n=new AbortController;V=n;try{const o=$(),r=A(),a=new URLSearchParams({q:e});t==="readonly"&&a.set("view","readonly"),r&&a.set("token",r);const s=await fetch(`${o}/search?${a.toString()}`,{signal:n.signal});return s.ok?await s.json():{status:"error",query:e,hits:[],message:s.status===401?"Unauthorized: check the token in Connection Settings.":`Search failed (HTTP ${s.status}).`}}catch(o){return o?.name==="AbortError"?null:{status:"error",query:e,hits:[],message:o?.message||"Search request failed."}}finally{V===n&&(V=null)}}async function sn(){X.update(e=>({...e,loading:!0}));try{const e=$(),t=A(),n=`${e}/models${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();X.set({models:r.models||[],loading:!1})}catch(e){X.update(t=>({...t,loading:!1})),console.error("Failed to fetch models:",e)}}function A(){try{const e=localStorage.getItem("wherever-config");if(e)return JSON.parse(e).token||""}catch{}return""}const Dt=E(!1),Wt=E("websocket"),xt=E(null),jt=E(!1),zt=E(null),Bt=E(Ut);async function an(e){if(!e.trim())return null;try{const t=$(),n=A(),o=`${t}/check-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check path:",t),null}}async function cn(e){if(!e.trim())return null;try{const t=$(),n=A(),o=`${t}/check-remote-repo?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check remote repo:",t),null}}async function ln(e){if(!e.trim())return[];try{const t=$(),n=A(),o=`${t}/remote-candidates?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();return Array.isArray(a.candidates)?a.candidates:[]}catch(t){return console.error("Failed to resolve remote candidates:",t),[]}}async function fn(e){try{const t=$(),n=A(),o=`${t}/autocomplete-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).completions||[]}catch(t){return console.error("Failed to autocomplete path:",t),[]}}async function un(){try{const e=$(),t=A(),n=`${e}/config${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();Dt.set(!!r.gitInitDefault),Wt.set(r.uploadMethod||"websocket"),xt.set(r.searchFolder||null),jt.set(!!r.searchCreateRemote),zt.set(r.searchDefaultModel||null);const a={label:r.appearance?.label||"",accent:r.appearance?.accent||null,colors:r.appearance?.colors||null,frame:!!r.appearance?.frame,pattern:r.appearance?.pattern||"none"};Bt.set(a)}catch(e){console.error("Failed to fetch config:",e)}}function dn(e){W.update(t=>({...t,currentSession:e}))}export{Zt as A,W as B,dn as C,fe as D,Qt as E,Xt as F,Wt as G,Nt as a,Bt as b,tn as c,fn as d,X as e,an as f,cn as g,Gt as h,un as i,sn as j,rn as k,ln as l,nn as m,$ as n,A as o,Dt as p,qt as q,_t as r,B as s,Jt as t,vt as u,Mt as v,on as w,jt as x,zt as y,xt as z};
2
- //# sourceMappingURL=C2gDSNg3.js.map
1
+ import{W as K,J as $e,ao as F,aU as Y,ai as Ae,am as Ce,af as se,aK as Ie,m as Re,a$ as ae,aV as q,an as z,b as Ue,j as Fe,aq as ie,X as Me,h as y,K as Z,a6 as Le,aY as Ne,a4 as Oe,as as Pe,z as re,g as He,f as De,az as We,b0 as ce,E as xe,D as je,aP as me,aE as be,I as G,a as ze,O as Be,ay as Ve,a5 as Ke,aj as Ye,e as ke,aJ as Se,d as qe,A as Ge,N as Je,ak as Xe,F as Qe,x as Ze,o as et,ah as tt,n as Ee,ae as M,be as E}from"./CAL8yDNt.js";import{b as nt,r as rt,c as ot,v as st}from"./D7tJYS3B.js";import{p as at}from"./B-wwgngN.js";function qt(e,t){return t}function it(e,t,n){for(var o=[],r=t.length,a,s=t.length,l=0;l<r;l++){let b=t[l];be(b,()=>{if(a){if(a.pending.delete(b),a.done.add(b),a.pending.size===0){var p=e.outrogroups;ee(e,re(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var i=o.length===0&&n!==null;if(i){var u=n,f=u.parentNode;Be(f),f.append(u),e.items.clear()}ee(e,t,!i)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function ee(e,t,n=!0){var o;if(e.pending.size>0){o=new Set;for(const s of e.pending.values())for(const l of s)o.add(e.items.get(l).e)}for(var r=0;r<t.length;r++){var a=t[r];if(o?.has(a)){a.f|=y;const s=document.createDocumentFragment();Ve(a,s)}else Ke(t[r],n)}}var le;function Gt(e,t,n,o,r,a=null){var s=e,l=new Map,i=(t&ke)!==0;if(i){var u=e;s=F?Y(Ae(u)):u.appendChild(K())}F&&Ce();var f=null,b=Oe(()=>{var h=n();return Pe(h)?h:h==null?[]:re(h)}),p,k=new Map,S=!0;function L(h){(C.effect.f&je)===0&&(C.pending.delete(h),C.fallback=f,ct(C,p,s,t,o),f!==null&&(p.length===0?(f.f&y)===0?me(f):(f.f^=y,H(f,null,s)):be(f,()=>{f=null})))}function c(h){C.pending.delete(h)}var d=$e(()=>{p=se(b);var h=p.length;let m=!1;if(F){var x=Ie(s)===Re;x!==(h===0)&&(s=ae(),Y(s),q(!1),m=!0)}for(var I=new Set,g=Me,N=Ne(),R=0;R<h;R+=1){F&&z.nodeType===Ue&&z.data===Fe&&(s=z,m=!0,q(!1));var _=p[R],j=o(_,R),T=S?null:l.get(j);T?(T.v&&ie(T.v,_),T.i&&ie(T.i,R),N&&g.unskip_effect(T.e)):(T=lt(l,S?s:le??=K(),_,j,R,r,t,n),S||(T.e.f|=y),l.set(j,T)),I.add(j)}if(h===0&&a&&!f&&(S?f=Z(()=>a(s)):(f=Z(()=>a(le??=K())),f.f|=y)),h>I.size&&Le(),F&&h>0&&Y(ae()),!S)if(k.set(g,I),N){for(const[ye,Te]of l)I.has(ye)||g.skip_effect(Te.e);g.oncommit(L),g.ondiscard(c)}else L(g);m&&q(!0),se(b)}),C={effect:d,items:l,pending:k,outrogroups:null,fallback:f};S=!1,F&&(s=z)}function O(e){for(;e!==null&&(e.f&ze)===0;)e=e.next;return e}function ct(e,t,n,o,r){var a=(o&qe)!==0,s=t.length,l=e.items,i=O(e.effect.first),u,f=null,b,p=[],k=[],S,L,c,d;if(a)for(d=0;d<s;d+=1)S=t[d],L=r(S,d),c=l.get(L).e,(c.f&y)===0&&(c.nodes?.a?.measure(),(b??=new Set).add(c));for(d=0;d<s;d+=1){if(S=t[d],L=r(S,d),c=l.get(L).e,e.outrogroups!==null)for(const _ of e.outrogroups)_.pending.delete(c),_.done.delete(c);if((c.f&G)!==0&&(me(c),a&&(c.nodes?.a?.unfix(),(b??=new Set).delete(c))),(c.f&y)!==0)if(c.f^=y,c===i)H(c,null,n);else{var C=f?f.next:i;c===e.effect.last&&(e.effect.last=c.prev),c.prev&&(c.prev.next=c.next),c.next&&(c.next.prev=c.prev),U(e,f,c),U(e,c,C),H(c,C,n),f=c,p=[],k=[],i=O(f.next);continue}if(c!==i){if(u!==void 0&&u.has(c)){if(p.length<k.length){var h=k[0],m;f=h.prev;var x=p[0],I=p[p.length-1];for(m=0;m<p.length;m+=1)H(p[m],h,n);for(m=0;m<k.length;m+=1)u.delete(k[m]);U(e,x.prev,I.next),U(e,f,x),U(e,I,h),i=h,f=I,d-=1,p=[],k=[]}else u.delete(c),H(c,i,n),U(e,c.prev,c.next),U(e,c,f===null?e.effect.first:f.next),U(e,f,c),f=c;continue}for(p=[],k=[];i!==null&&i!==c;)(u??=new Set).add(i),k.push(i),i=O(i.next);if(i===null)continue}(c.f&y)===0&&p.push(c),f=c,i=O(c.next)}if(e.outrogroups!==null){for(const _ of e.outrogroups)_.pending.size===0&&(ee(e,re(_.done)),e.outrogroups?.delete(_));e.outrogroups.size===0&&(e.outrogroups=null)}if(i!==null||u!==void 0){var g=[];if(u!==void 0)for(c of u)(c.f&G)===0&&g.push(c);for(;i!==null;)(i.f&G)===0&&i!==e.fallback&&g.push(i),i=O(i.next);var N=g.length;if(N>0){var R=(o&ke)!==0&&s===0?n:null;if(a){for(d=0;d<N;d+=1)g[d].nodes?.a?.measure();for(d=0;d<N;d+=1)g[d].nodes?.a?.fix()}it(e,g,R)}}a&&Se(()=>{if(b!==void 0)for(c of b)c.nodes?.a?.apply()})}function lt(e,t,n,o,r,a,s,l){var i=(s&He)!==0?(s&De)===0?We(n,!1,!1):ce(n):null,u=(s&xe)!==0?ce(r):null;return{v:i,i:u,e:Z(()=>(a(t,i??n,u??r,l),()=>{e.delete(o)}))}}function H(e,t,n){if(e.nodes)for(var o=e.nodes.start,r=e.nodes.end,a=t&&(t.f&y)===0?t.nodes.start:n;o!==null;){var s=Ye(o);if(a.before(o),o===r)return;o=s}}function U(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}const ft=Symbol("is custom element"),ut=Symbol("is html"),dt=Ee?"link":"LINK",pt=Ee?"progress":"PROGRESS";function Jt(e){if(F){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var o=e.value;fe(e,"value",null),e.value=o}if(e.hasAttribute("checked")){var r=e.checked;fe(e,"checked",null),e.checked=r}}};e[Qe]=n,Se(n),Ze()}}function Xt(e,t){var n=oe(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==pt)||(e.value=t??"")}function Qt(e,t){var n=oe(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function fe(e,t,n,o){var r=oe(e);F&&(r[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===dt)||r[t]!==(r[t]=n)&&(t==="loading"&&(e[et]=n),n==null?e.removeAttribute(t):typeof n!="string"&&ht(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function oe(e){return e[Ge]??={[ft]:e.nodeName.includes("-"),[ut]:e.namespaceURI===Je}}var ue=new Map;function ht(e){var t=e.getAttribute("is")||e.nodeName,n=ue.get(t);if(n)return n;ue.set(t,n=[]);for(var o,r=e,a=Element.prototype;a!==r;){o=tt(r);for(var s in o)o[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&n.push(s);r=Xe(r)}return n}const gt="";function vt(...e){if(!e[0].startsWith("/"))throw new Error(`Cannot use \`resolve(...)\` with a non-absolute pathname or route ID (got "${e[0]}"). \`resolve\` is only for internal pathnames and route IDs; external URLs should be used directly.`);return nt+gt+rt(e[0],e[1])}const v=()=>{},wt={assert:v,error:v,warn:v,info:v,log:v,debug:v,dir:v,table:v,trace:v,write:v,time:v,timeEnd:v,timeLog:v};function mt(){return globalThis?._logFactory}function bt(e,t){const n=mt();return n?n(e,{decoration:t?.decoration}):wt}function kt(e,t){let n=performance.now();function o(r){const a=performance.now();a-n>t.idle&&e.update(),n=a}return["focus","pointerdown"].forEach(r=>window.addEventListener(r,o)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e.update()}),e.update(),setInterval(()=>e.update(),t.checks)}function St(e,t){function n(){e.installing&&e.installing.addEventListener("statechange",function(){this.state==="installed"&&t(e)})}if(e){if(e.waiting)return t(e);e.installing?n():e.addEventListener("updatefound",n)}}function Et(){let e=1;const t=E([]);function n(a){t.update(s=>[...s,{...a,id:++e}])}function o(a){t.update(s=>s.filter(l=>l.id!==a))}function r(a){const s=M(t).find(l=>l.id==a);o(a),s?.type==="push-notification"&&s.data.options.data?.navigate&&ot(s.data.options.data.navigate,at.state)}return{subscribe:t.subscribe,add:n,remove:o,onClick:r}}const _t=Et(),w=bt("service-worker");function J(e){e&&(w.enabled?w.debug(`enabling logging for service worker, level: ${w.level}`):w.debug(`disabling logging for service worker, level: ${w.level}`),e.postMessage({type:"debug",level:w.level,enabled:w.enabled}))}const yt=180*1e3,Tt=1800*1e3;function $t(){const e=E(void 0);function t(s="active"){n({type:"ping"},s)}function n(s,l="active"){const i=M(e);if(!i)throw new Error("not loaded");if(i.notSupported)throw new Error("not supported");if(i.registering)throw new Error("is registering...");const u=i.registration;if(!u)throw new Error("no registration");if(!u[l])throw new Error(`no registration in state: ${l}`);u[l].postMessage(s)}function o(){w.log("accepting update...");const s=M(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");if(s.updateAvailable&&s.registration){const l=s.registration;if(!l)throw new Error("no registration");l.waiting?(w.log("was waiting, skipping..."),l.waiting.postMessage("skipWaiting")):(w.log("was not waiting, should we reload?"),w.error("not waiting..., todo reload?")),w.log("update store"),e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}}function r(){const s=M(e);if(!s)throw new Error("not loaded");if(s.notSupported)throw new Error("not supported");if(s.registering)throw new Error("is registering...");e.set({notSupported:!1,updateAvailable:!1,registration:s.registration,registering:s.registering})}function a(){if(typeof navigator<"u"&&"serviceWorker"in navigator){e.set({notSupported:!1,registering:!0});let s=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{s||(s=!0,window.location.reload())}),navigator.serviceWorker.onmessage=i=>{i.data&&i.data.type==="notification"&&(console.log(i),_t.add({type:"push-notification",data:i.data.notification}))};const l=vt("/service-worker.js");navigator.serviceWorker.register(l,{type:"classic"}).then(i=>{try{kt(i,{idle:yt,checks:Tt})}catch{}e.set({notSupported:!1,updateAvailable:!1,registration:i,registering:!1}),J(i.installing),J(i.waiting),J(i.active),St(i,()=>{e.set({notSupported:!1,updateAvailable:!0,registration:i,registering:!1})})}).catch(i=>{console.error(i),e.set({registering:!1,notSupported:!1,updateAvailable:!1,registration:void 0,error:{message:"failed to register service-worker",cause:i.message||i}}),w.error("Failed to register service worker",i)})}else typeof window<"u"&&e.set({notSupported:!0})}return{subscribe:e.subscribe,set:e.set,get registration(){const s=M(e);if(s&&"registration"in s)return s.registration},get updateAvailable(){const s=M(e);return s&&"updateAvailable"in s?s.updateAvailable:!1},register:a,pingServideWorker:t,sendMessage:n,skipWaiting:o,skip:r}}function At(e){if(!e)return{params:{},pathname:""};const t={},n=e.lastIndexOf("#");let o=e;n!==-1&&(o=o.slice(0,n));const r=o.indexOf("?");r!==-1&&o.slice(r+1).split("&").forEach(s=>{const[l,i=""]=s.split("=");t[decodeURIComponent(l)]=i===""?"true":decodeURIComponent(i)});let a=o.slice(0,r)||"";return a&&!a.endsWith("/")&&(a+="/"),{params:t,pathname:a}}function Ct(){return typeof window>"u"?{params:{}}:At(window.location.href)}function It(e){if(typeof window>"u")return{};const t=window.location.hash,n={},o=t.lastIndexOf("#");return o!==-1&&t.slice(o+1).split("&").forEach(r=>{const[a,s=""]=r.split("=");n[decodeURIComponent(a)]=decodeURIComponent(s)}),n}const Zt=$t();It();const{params:en}=Ct();console.log(`VERSION: ${st}`);const de={brandDark:"--color-brand-dark",brandSurface:"--color-brand-surface",brandSurface2:"--color-brand-surface-2",brandSurface3:"--color-brand-surface-3",brandBorder:"--color-brand-border",brandText:"--color-brand-text",brandTextMuted:"--color-brand-text-muted",brandCyan:"--color-brand-cyan",brandBlue:"--color-brand-blue",brandPurple:"--color-brand-purple"},Rt=["--color-brand-cyan","--color-brand-blue","--color-brand-purple"],Ut={label:"",accent:null,colors:null,frame:!1,pattern:"none"};function tn(e){if(typeof document>"u")return;const t=document.documentElement;for(const n of Object.values(de))t.style.removeProperty(n);if(t.classList.remove("wherever-framed"),delete t.dataset.whereverPattern,e.accent){for(const n of Rt)t.style.setProperty(n,e.accent);document.querySelector('meta[name="theme-color"]')?.setAttribute("content",e.accent)}if(e.frame&&t.classList.add("wherever-framed"),e.pattern&&e.pattern!=="none"&&(t.dataset.whereverPattern=e.pattern),e.colors)for(const[n,o]of Object.entries(e.colors)){const r=de[n];r&&typeof o=="string"&&t.style.setProperty(r,o)}}const pe="wherever-config",Ft="token";function he(e,t){const n=e.startsWith(t)?e.slice(1):e;if(!n)return{present:!1,value:"",rest:e};const o=new URLSearchParams(n),r=[...new Set([...o.keys()].filter(i=>i.toLowerCase()===Ft))];if(r.length===0)return{present:!1,value:"",rest:e};const s=r.flatMap(i=>o.getAll(i)).find(i=>i.trim())??"";for(const i of r)o.delete(i);const l=o.toString();return{present:!0,value:s,rest:l?`${t}${l}`:""}}function _e(e,t){const n=he(t||"","#"),o=he(e||"","?"),r=n.value||o.value;return{token:r||null,present:n.present||o.present,search:o.rest,hash:n.rest}}function Mt(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=_e(e.search||"",e.hash||"");if(!t.present)return!1;try{const n=window.history;if(n&&typeof n.replaceState=="function"){const o=e.pathname||"/";return n.replaceState(n.state??null,"",`${o}${t.search}${t.hash}`),!0}}catch{}return!1}function Lt(){if(typeof window>"u"||!window.location)return!1;const e=window.location,t=_e(e.search||"",e.hash||"");if(!t.present||(Mt(),!t.token))return!1;let n={};try{const o=localStorage.getItem(pe);if(o){const r=JSON.parse(o);r&&typeof r=="object"&&(n=r)}}catch{n={}}try{return localStorage.setItem(pe,JSON.stringify({...n,token:t.token})),!0}catch{return!1}}let ge=!1;function Nt(){return ge?!1:(ge=!0,Lt())}Nt();const W=E({folders:[],activeSessions:[],currentSession:null,loading:!1}),X=E({models:[],loading:!1}),B=E({folders:[],activeSessions:[],currentSession:null,loading:!1});function Q(){if(typeof window<"u"&&window.location){const e=window.location;if(e.port)return Number(e.port);if(e.protocol==="https:")return 443;if(e.protocol==="http:")return 80}return 31415}function $(){const e=localStorage.getItem("wherever-config"),t=typeof window<"u"&&window.location&&window.location.hostname?window.location.hostname:"localhost";if(e){const n=JSON.parse(e),o=window.location.protocol==="https:"?"https:":"http:";let r=n.host||t;(r==="localhost"||r==="127.0.0.1")&&t&&t!=="localhost"&&t!=="127.0.0.1"&&(r=t),r=r.startsWith("http")?r.replace(/^wss?:\/\//,""):r;let a=n.port;return(a===31415||a===void 0)&&Q()!==31415&&(a=Q()),`${o}//${r}:${a||Q()}`}return`${window.location.protocol}//${window.location.host}`}let P=null,D=[],te=!1,ne=!1,ve=0;const Ot=150,Pt=1e3;async function Ht(){te=!0;try{const e=$(),t=A(),n=`${e}/sessions${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();W.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(W).currentSession,loading:!1})}catch(e){W.update(t=>({...t,loading:!1})),console.error("Failed to fetch sessions:",e)}finally{te=!1}}function nn(){W.update(n=>({...n,loading:!0}));const e=new Promise(n=>{D.push(n)});if(te)return ne=!0,e;const t=Date.now();if(!P)ve=t;else if(clearTimeout(P),t-ve>=Pt)return P=null,we(),e;return P=setTimeout(()=>{P=null,we()},Ot),e}async function we(){try{do{ne=!1;const e=D;D=[];try{await Ht()}finally{for(const t of e)t()}}while(ne)}finally{const e=D;D=[];for(const t of e)t()}}async function rn(){B.update(e=>({...e,loading:!0}));try{const e=$(),t=A(),n=`${e}/sessions?view=readonly${t?`&token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();B.set({folders:r.folders||[],activeSessions:(r.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(B).currentSession,loading:!1})}catch(e){B.update(t=>({...t,loading:!1})),console.error("Failed to fetch read-only sessions:",e)}}let V=null;async function on(e,t="default"){V?.abort();const n=new AbortController;V=n;try{const o=$(),r=A(),a=new URLSearchParams({q:e});t==="readonly"&&a.set("view","readonly"),r&&a.set("token",r);const s=await fetch(`${o}/search?${a.toString()}`,{signal:n.signal});return s.ok?await s.json():{status:"error",query:e,hits:[],message:s.status===401?"Unauthorized: check the token in Connection Settings.":`Search failed (HTTP ${s.status}).`}}catch(o){return o?.name==="AbortError"?null:{status:"error",query:e,hits:[],message:o?.message||"Search request failed."}}finally{V===n&&(V=null)}}async function sn(){X.update(e=>({...e,loading:!0}));try{const e=$(),t=A(),n=`${e}/models${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();X.set({models:r.models||[],loading:!1})}catch(e){X.update(t=>({...t,loading:!1})),console.error("Failed to fetch models:",e)}}function A(){try{const e=localStorage.getItem("wherever-config");if(e)return JSON.parse(e).token||""}catch{}return""}const Dt=E(!1),Wt=E("websocket"),xt=E(null),jt=E(!1),zt=E(null),Bt=E(Ut);async function an(e){if(!e.trim())return null;try{const t=$(),n=A(),o=`${t}/check-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check path:",t),null}}async function cn(e){if(!e.trim())return null;try{const t=$(),n=A(),o=`${t}/check-remote-repo?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}catch(t){return console.error("Failed to check remote repo:",t),null}}async function ln(e){if(!e.trim())return[];try{const t=$(),n=A(),o=`${t}/remote-candidates?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();return Array.isArray(a.candidates)?a.candidates:[]}catch(t){return console.error("Failed to resolve remote candidates:",t),[]}}async function fn(e){try{const t=$(),n=A(),o=`${t}/autocomplete-path?path=${encodeURIComponent(e)}${n?`&token=${encodeURIComponent(n)}`:""}`,r=await fetch(o);if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).completions||[]}catch(t){return console.error("Failed to autocomplete path:",t),[]}}async function un(){try{const e=$(),t=A(),n=`${e}/config${t?`?token=${encodeURIComponent(t)}`:""}`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();Dt.set(!!r.gitInitDefault),Wt.set(r.uploadMethod||"websocket"),xt.set(r.searchFolder||null),jt.set(!!r.searchCreateRemote),zt.set(r.searchDefaultModel||null);const a={label:r.appearance?.label||"",accent:r.appearance?.accent||null,colors:r.appearance?.colors||null,frame:!!r.appearance?.frame,pattern:r.appearance?.pattern||"none"};Bt.set(a)}catch(e){console.error("Failed to fetch config:",e)}}function dn(e){W.update(t=>({...t,currentSession:e}))}export{Zt as A,W as B,dn as C,fe as D,Qt as E,Xt as F,Wt as G,Nt as a,Bt as b,tn as c,fn as d,X as e,an as f,cn as g,Gt as h,un as i,sn as j,rn as k,ln as l,nn as m,$ as n,A as o,Dt as p,qt as q,_t as r,B as s,Jt as t,vt as u,Mt as v,on as w,jt as x,zt as y,xt as z};
2
+ //# sourceMappingURL=BS1e7MNH.js.map