wherever-dev 0.15.2 → 0.16.0
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.
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +20 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/index.js +294 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/_app/immutable/chunks/{GsxEkebq.js → CL1IiFPX.js} +2 -2
- package/public/_app/immutable/chunks/{GsxEkebq.js.map → CL1IiFPX.js.map} +1 -1
- package/public/_app/immutable/chunks/{3zeFojTv.js → EJHE1g3U.js} +2 -2
- package/public/_app/immutable/chunks/{3zeFojTv.js.map → EJHE1g3U.js.map} +1 -1
- package/public/_app/immutable/chunks/{Bpr39rfQ.js → vI97EmaY.js} +2 -2
- package/public/_app/immutable/chunks/{Bpr39rfQ.js.map → vI97EmaY.js.map} +1 -1
- package/public/_app/immutable/entry/{app.BErKadgE.js → app.tGQ27-uR.js} +3 -3
- package/public/_app/immutable/entry/{app.BErKadgE.js.map → app.tGQ27-uR.js.map} +1 -1
- package/public/_app/immutable/entry/start.DsqdmxNo.js +2 -0
- package/public/_app/immutable/entry/start.DsqdmxNo.js.map +1 -0
- package/public/_app/immutable/nodes/{0.C17tWp9Z.js → 0.DcKNbQrU.js} +2 -2
- package/public/_app/immutable/nodes/{0.C17tWp9Z.js.map → 0.DcKNbQrU.js.map} +1 -1
- package/public/_app/immutable/nodes/{1.BJS7gXOu.js → 1.TK7FGwGI.js} +2 -2
- package/public/_app/immutable/nodes/{1.BJS7gXOu.js.map → 1.TK7FGwGI.js.map} +1 -1
- package/public/_app/immutable/nodes/{2.C8VPPAI7.js → 2.Bj45Z-NA.js} +2 -2
- package/public/_app/immutable/nodes/{2.C8VPPAI7.js.map → 2.Bj45Z-NA.js.map} +1 -1
- package/public/_app/version.json +1 -1
- package/public/index.html +10 -10
- package/public/service-worker.js +1 -1
- package/public/_app/immutable/entry/start.BcmPw-69.js +0 -2
- package/public/_app/immutable/entry/start.BcmPw-69.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a2 as q,W as _e,as as F,b4 as Y,am as ke,aq as ye,aj as se,aT as Te,p as Ae,b9 as ae,b5 as G,ar as B,d as Ce,m as $e,ax as ie,a3 as Ie,j as y,X as Z,ac as Re,b7 as Ue,aa as Fe,aA as Me,V as ne,i as Le,h as Ne,aI as He,ba as ce,E as Pe,D as De,aY as ge,aN as ve,I as K,b as Oe,Z as xe,aH as We,ab as je,an as Be,g as we,aS as me,f as Ve,A as ze,N as qe,ao as Ye,F as Ge,U as Ke,s as Xe,al as Qe,r as be,ai as M,bn as _}from"./Cum3gQOV.js";import{b as Je,r as Ze,a as et,v as tt}from"./3zeFojTv.js";import{p as rt}from"./GsxEkebq.js";function xt(e,t){return t}function nt(e,t,r){for(var s=[],n=t.length,a,o=t.length,l=0;l<n;l++){let b=t[l];ve(b,()=>{if(a){if(a.pending.delete(b),a.done.add(b),a.pending.size===0){var p=e.outrogroups;ee(e,ne(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var i=s.length===0&&r!==null;if(i){var u=r,f=u.parentNode;xe(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,r=!0){var s;if(e.pending.size>0){s=new Set;for(const o of e.pending.values())for(const l of o)s.add(e.items.get(l).e)}for(var n=0;n<t.length;n++){var a=t[n];if(s?.has(a)){a.f|=y;const o=document.createDocumentFragment();We(a,o)}else je(t[n],r)}}var le;function Wt(e,t,r,s,n,a=null){var o=e,l=new Map,i=(t&we)!==0;if(i){var u=e;o=F?Y(ke(u)):u.appendChild(q())}F&&ye();var f=null,b=Fe(()=>{var h=r();return Me(h)?h:h==null?[]:ne(h)}),p,E=new Map,S=!0;function L(h){($.effect.f&De)===0&&($.pending.delete(h),$.fallback=f,ot($,p,o,t,s),f!==null&&(p.length===0?(f.f&y)===0?ge(f):(f.f^=y,D(f,null,o)):ve(f,()=>{f=null})))}function c(h){$.pending.delete(h)}var d=_e(()=>{p=se(b);var h=p.length;let m=!1;if(F){var W=Te(o)===Ae;W!==(h===0)&&(o=ae(),Y(o),G(!1),m=!0)}for(var I=new Set,g=Ie,N=Ue(),R=0;R<h;R+=1){F&&B.nodeType===Ce&&B.data===$e&&(o=B,m=!0,G(!1));var k=p[R],j=s(k,R),T=S?null:l.get(j);T?(T.v&&ie(T.v,k),T.i&&ie(T.i,R),N&&g.unskip_effect(T.e)):(T=st(l,S?o:le??=q(),k,j,R,n,t,r),S||(T.e.f|=y),l.set(j,T)),I.add(j)}if(h===0&&a&&!f&&(S?f=Z(()=>a(o)):(f=Z(()=>a(le??=q())),f.f|=y)),h>I.size&&Re(),F&&h>0&&Y(ae()),!S)if(E.set(g,I),N){for(const[Ee,Se]of l)I.has(Ee)||g.skip_effect(Se.e);g.oncommit(L),g.ondiscard(c)}else L(g);m&&G(!0),se(b)}),$={effect:d,items:l,pending:E,outrogroups:null,fallback:f};S=!1,F&&(o=B)}function H(e){for(;e!==null&&(e.f&Oe)===0;)e=e.next;return e}function ot(e,t,r,s,n){var a=(s&Ve)!==0,o=t.length,l=e.items,i=H(e.effect.first),u,f=null,b,p=[],E=[],S,L,c,d;if(a)for(d=0;d<o;d+=1)S=t[d],L=n(S,d),c=l.get(L).e,(c.f&y)===0&&(c.nodes?.a?.measure(),(b??=new Set).add(c));for(d=0;d<o;d+=1){if(S=t[d],L=n(S,d),c=l.get(L).e,e.outrogroups!==null)for(const k of e.outrogroups)k.pending.delete(c),k.done.delete(c);if((c.f&K)!==0&&(ge(c),a&&(c.nodes?.a?.unfix(),(b??=new Set).delete(c))),(c.f&y)!==0)if(c.f^=y,c===i)D(c,null,r);else{var $=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,$),D(c,$,r),f=c,p=[],E=[],i=H(f.next);continue}if(c!==i){if(u!==void 0&&u.has(c)){if(p.length<E.length){var h=E[0],m;f=h.prev;var W=p[0],I=p[p.length-1];for(m=0;m<p.length;m+=1)D(p[m],h,r);for(m=0;m<E.length;m+=1)u.delete(E[m]);U(e,W.prev,I.next),U(e,f,W),U(e,I,h),i=h,f=I,d-=1,p=[],E=[]}else u.delete(c),D(c,i,r),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=[],E=[];i!==null&&i!==c;)(u??=new Set).add(i),E.push(i),i=H(i.next);if(i===null)continue}(c.f&y)===0&&p.push(c),f=c,i=H(c.next)}if(e.outrogroups!==null){for(const k of e.outrogroups)k.pending.size===0&&(ee(e,ne(k.done)),e.outrogroups?.delete(k));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&K)===0&&g.push(c);for(;i!==null;)(i.f&K)===0&&i!==e.fallback&&g.push(i),i=H(i.next);var N=g.length;if(N>0){var R=(s&we)!==0&&o===0?r: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()}nt(e,g,R)}}a&&me(()=>{if(b!==void 0)for(c of b)c.nodes?.a?.apply()})}function st(e,t,r,s,n,a,o,l){var i=(o&Le)!==0?(o&Ne)===0?He(r,!1,!1):ce(r):null,u=(o&Pe)!==0?ce(n):null;return{v:i,i:u,e:Z(()=>(a(t,i??r,u??n,l),()=>{e.delete(s)}))}}function D(e,t,r){if(e.nodes)for(var s=e.nodes.start,n=e.nodes.end,a=t&&(t.f&y)===0?t.nodes.start:r;s!==null;){var o=Be(s);if(a.before(s),s===n)return;s=o}}function U(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}const at=Symbol("is custom element"),it=Symbol("is html"),ct=be?"link":"LINK",lt=be?"progress":"PROGRESS";function jt(e){if(F){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var s=e.value;fe(e,"value",null),e.value=s}if(e.hasAttribute("checked")){var n=e.checked;fe(e,"checked",null),e.checked=n}}};e[Ge]=r,me(r),Ke()}}function Bt(e,t){var r=oe(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==lt)||(e.value=t??"")}function Vt(e,t){var r=oe(e);r.checked!==(r.checked=t??void 0)&&(e.checked=t)}function fe(e,t,r,s){var n=oe(e);F&&(n[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===ct)||n[t]!==(n[t]=r)&&(t==="loading"&&(e[Xe]=r),r==null?e.removeAttribute(t):typeof r!="string"&&ft(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function oe(e){return e[ze]??={[at]:e.nodeName.includes("-"),[it]:e.namespaceURI===qe}}var ue=new Map;function ft(e){var t=e.getAttribute("is")||e.nodeName,r=ue.get(t);if(r)return r;ue.set(t,r=[]);for(var s,n=e,a=Element.prototype;a!==n;){s=Qe(n);for(var o in s)s[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&r.push(o);n=Ye(n)}return r}const ut="";function dt(...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 Je+ut+Ze(e[0],e[1])}const v=()=>{},pt={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 ht(){return globalThis?._logFactory}function gt(e,t){const r=ht();return r?r(e,{decoration:t?.decoration}):pt}function vt(e,t){let r=performance.now();function s(n){const a=performance.now();a-r>t.idle&&e.update(),r=a}return["focus","pointerdown"].forEach(n=>window.addEventListener(n,s)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e.update()}),e.update(),setInterval(()=>e.update(),t.checks)}function wt(e,t){function r(){e.installing&&e.installing.addEventListener("statechange",function(){this.state==="installed"&&t(e)})}if(e){if(e.waiting)return t(e);e.installing?r():e.addEventListener("updatefound",r)}}function mt(){let e=1;const t=_([]);function r(a){t.update(o=>[...o,{...a,id:++e}])}function s(a){t.update(o=>o.filter(l=>l.id!==a))}function n(a){const o=M(t).find(l=>l.id==a);s(a),o?.type==="push-notification"&&o.data.options.data?.navigate&&et(o.data.options.data.navigate,rt.state)}return{subscribe:t.subscribe,add:r,remove:s,onClick:n}}const bt=mt(),w=gt("service-worker");function X(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 Et=180*1e3,St=1800*1e3;function _t(){const e=_(void 0);function t(o="active"){r({type:"ping"},o)}function r(o,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(o)}function s(){w.log("accepting update...");const o=M(e);if(!o)throw new Error("not loaded");if(o.notSupported)throw new Error("not supported");if(o.registering)throw new Error("is registering...");if(o.updateAvailable&&o.registration){const l=o.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:o.registration,registering:o.registering})}}function n(){const o=M(e);if(!o)throw new Error("not loaded");if(o.notSupported)throw new Error("not supported");if(o.registering)throw new Error("is registering...");e.set({notSupported:!1,updateAvailable:!1,registration:o.registration,registering:o.registering})}function a(){if(typeof navigator<"u"&&"serviceWorker"in navigator){e.set({notSupported:!1,registering:!0});let o=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{o||(o=!0,window.location.reload())}),navigator.serviceWorker.onmessage=i=>{i.data&&i.data.type==="notification"&&(console.log(i),bt.add({type:"push-notification",data:i.data.notification}))};const l=dt("/service-worker.js");navigator.serviceWorker.register(l,{type:"classic"}).then(i=>{try{vt(i,{idle:Et,checks:St})}catch{}e.set({notSupported:!1,updateAvailable:!1,registration:i,registering:!1}),X(i.installing),X(i.waiting),X(i.active),wt(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 o=M(e);if(o&&"registration"in o)return o.registration},get updateAvailable(){const o=M(e);return o&&"updateAvailable"in o?o.updateAvailable:!1},register:a,pingServideWorker:t,sendMessage:r,skipWaiting:s,skip:n}}function kt(e){if(!e)return{params:{},pathname:""};const t={},r=e.lastIndexOf("#");let s=e;r!==-1&&(s=s.slice(0,r));const n=s.indexOf("?");n!==-1&&s.slice(n+1).split("&").forEach(o=>{const[l,i=""]=o.split("=");t[decodeURIComponent(l)]=i===""?"true":decodeURIComponent(i)});let a=s.slice(0,n)||"";return a&&!a.endsWith("/")&&(a+="/"),{params:t,pathname:a}}function yt(){return typeof window>"u"?{params:{}}:kt(window.location.href)}function Tt(e){if(typeof window>"u")return{};const t=window.location.hash,r={},s=t.lastIndexOf("#");return s!==-1&&t.slice(s+1).split("&").forEach(n=>{const[a,o=""]=n.split("=");r[decodeURIComponent(a)]=decodeURIComponent(o)}),r}const zt=_t();Tt();const{params:qt}=yt();console.log(`VERSION: ${tt}`);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"},At=["--color-brand-cyan","--color-brand-blue","--color-brand-purple"],Ct={label:"",accent:null,colors:null,frame:!1,pattern:"none"};function Yt(e){if(typeof document>"u")return;const t=document.documentElement;for(const r of Object.values(de))t.style.removeProperty(r);if(t.classList.remove("wherever-framed"),delete t.dataset.whereverPattern,e.accent){for(const r of At)t.style.setProperty(r,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[r,s]of Object.entries(e.colors)){const n=de[r];n&&typeof s=="string"&&t.style.setProperty(n,s)}}const x=_({folders:[],activeSessions:[],currentSession:null,loading:!1}),Q=_({models:[],loading:!1}),V=_({folders:[],activeSessions:[],currentSession:null,loading:!1});function J(){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 A(){const e=localStorage.getItem("wherever-config"),t=typeof window<"u"&&window.location&&window.location.hostname?window.location.hostname:"localhost";if(e){const r=JSON.parse(e),s=window.location.protocol==="https:"?"https:":"http:";let n=r.host||t;(n==="localhost"||n==="127.0.0.1")&&t&&t!=="localhost"&&t!=="127.0.0.1"&&(n=t),n=n.startsWith("http")?n.replace(/^wss?:\/\//,""):n;let a=r.port;return(a===31415||a===void 0)&&J()!==31415&&(a=J()),`${s}//${n}:${a||J()}`}return`${window.location.protocol}//${window.location.host}`}let P=null,O=[],te=!1,re=!1,pe=0;const $t=150,It=1e3;async function Rt(){te=!0;try{const e=A(),t=C(),r=`${e}/sessions${t?`?token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();x.set({folders:n.folders||[],activeSessions:(n.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(x).currentSession,loading:!1})}catch(e){x.update(t=>({...t,loading:!1})),console.error("Failed to fetch sessions:",e)}finally{te=!1}}function Gt(){x.update(r=>({...r,loading:!0}));const e=new Promise(r=>{O.push(r)});if(te)return re=!0,e;const t=Date.now();if(!P)pe=t;else if(clearTimeout(P),t-pe>=It)return P=null,he(),e;return P=setTimeout(()=>{P=null,he()},$t),e}async function he(){try{do{re=!1;const e=O;O=[];try{await Rt()}finally{for(const t of e)t()}}while(re)}finally{const e=O;O=[];for(const t of e)t()}}async function Kt(){V.update(e=>({...e,loading:!0}));try{const e=A(),t=C(),r=`${e}/sessions?view=readonly${t?`&token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();V.set({folders:n.folders||[],activeSessions:(n.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(V).currentSession,loading:!1})}catch(e){V.update(t=>({...t,loading:!1})),console.error("Failed to fetch read-only sessions:",e)}}let z=null;async function Xt(e,t="default"){z?.abort();const r=new AbortController;z=r;try{const s=A(),n=C(),a=new URLSearchParams({q:e});t==="readonly"&&a.set("view","readonly"),n&&a.set("token",n);const o=await fetch(`${s}/search?${a.toString()}`,{signal:r.signal});return o.ok?await o.json():{status:"error",query:e,hits:[],message:o.status===401?"Unauthorized: check the token in Connection Settings.":`Search failed (HTTP ${o.status}).`}}catch(s){return s?.name==="AbortError"?null:{status:"error",query:e,hits:[],message:s?.message||"Search request failed."}}finally{z===r&&(z=null)}}async function Qt(){Q.update(e=>({...e,loading:!0}));try{const e=A(),t=C(),r=`${e}/models${t?`?token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();Q.set({models:n.models||[],loading:!1})}catch(e){Q.update(t=>({...t,loading:!1})),console.error("Failed to fetch models:",e)}}function C(){try{const e=localStorage.getItem("wherever-config");if(e)return JSON.parse(e).token||""}catch{}return""}const Ut=_(!1),Ft=_("websocket"),Mt=_(null),Lt=_(!1),Nt=_(null),Ht=_(Ct);async function Jt(e){if(!e.trim())return null;try{const t=A(),r=C(),s=`${t}/check-path?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}catch(t){return console.error("Failed to check path:",t),null}}async function Zt(e){if(!e.trim())return null;try{const t=A(),r=C(),s=`${t}/check-remote-repo?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}catch(t){return console.error("Failed to check remote repo:",t),null}}async function er(e){if(!e.trim())return[];try{const t=A(),r=C(),s=`${t}/remote-candidates?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);const a=await n.json();return Array.isArray(a.candidates)?a.candidates:[]}catch(t){return console.error("Failed to resolve remote candidates:",t),[]}}async function tr(e){try{const t=A(),r=C(),s=`${t}/autocomplete-path?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).completions||[]}catch(t){return console.error("Failed to autocomplete path:",t),[]}}async function rr(){try{const e=A(),t=C(),r=`${e}/config${t?`?token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();Ut.set(!!n.gitInitDefault),Ft.set(n.uploadMethod||"websocket"),Mt.set(n.searchFolder||null),Lt.set(!!n.searchCreateRemote),Nt.set(n.searchDefaultModel||null);const a={label:n.appearance?.label||"",accent:n.appearance?.accent||null,colors:n.appearance?.colors||null,frame:!!n.appearance?.frame,pattern:n.appearance?.pattern||"none"};Ht.set(a)}catch(e){console.error("Failed to fetch config:",e)}}function nr(e){x.update(t=>({...t,currentSession:e}))}export{nr as A,fe as B,Vt as C,Bt as D,Ft as E,Ht as a,Yt as b,tr as c,Q as d,Jt as e,Zt as f,Wt as g,rr as h,Qt as i,Kt as j,er as k,Gt as l,A as m,C as n,Ut as o,xt as p,bt as q,V as r,jt as s,dt as t,Xt as u,Lt as v,Nt as w,Mt as x,zt as y,x as z};
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
import{a2 as q,W as _e,as as F,b4 as Y,am as ke,aq as ye,aj as se,aT as Te,p as Ae,b9 as ae,b5 as G,ar as B,d as Ce,m as $e,ax as ie,a3 as Ie,j as y,X as Z,ac as Re,b7 as Ue,aa as Fe,aA as Me,V as ne,i as Le,h as Ne,aI as He,ba as ce,E as Pe,D as De,aY as ge,aN as ve,I as K,b as Oe,Z as xe,aH as We,ab as je,an as Be,g as we,aS as me,f as Ve,A as ze,N as qe,ao as Ye,F as Ge,U as Ke,s as Xe,al as Qe,r as be,ai as M,bn as _}from"./Cum3gQOV.js";import{b as Je,r as Ze,a as et,v as tt}from"./EJHE1g3U.js";import{p as rt}from"./CL1IiFPX.js";function xt(e,t){return t}function nt(e,t,r){for(var s=[],n=t.length,a,o=t.length,l=0;l<n;l++){let b=t[l];ve(b,()=>{if(a){if(a.pending.delete(b),a.done.add(b),a.pending.size===0){var p=e.outrogroups;ee(e,ne(a.done)),p.delete(a),p.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var i=s.length===0&&r!==null;if(i){var u=r,f=u.parentNode;xe(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,r=!0){var s;if(e.pending.size>0){s=new Set;for(const o of e.pending.values())for(const l of o)s.add(e.items.get(l).e)}for(var n=0;n<t.length;n++){var a=t[n];if(s?.has(a)){a.f|=y;const o=document.createDocumentFragment();We(a,o)}else je(t[n],r)}}var le;function Wt(e,t,r,s,n,a=null){var o=e,l=new Map,i=(t&we)!==0;if(i){var u=e;o=F?Y(ke(u)):u.appendChild(q())}F&&ye();var f=null,b=Fe(()=>{var h=r();return Me(h)?h:h==null?[]:ne(h)}),p,E=new Map,S=!0;function L(h){($.effect.f&De)===0&&($.pending.delete(h),$.fallback=f,ot($,p,o,t,s),f!==null&&(p.length===0?(f.f&y)===0?ge(f):(f.f^=y,D(f,null,o)):ve(f,()=>{f=null})))}function c(h){$.pending.delete(h)}var d=_e(()=>{p=se(b);var h=p.length;let m=!1;if(F){var W=Te(o)===Ae;W!==(h===0)&&(o=ae(),Y(o),G(!1),m=!0)}for(var I=new Set,g=Ie,N=Ue(),R=0;R<h;R+=1){F&&B.nodeType===Ce&&B.data===$e&&(o=B,m=!0,G(!1));var k=p[R],j=s(k,R),T=S?null:l.get(j);T?(T.v&&ie(T.v,k),T.i&&ie(T.i,R),N&&g.unskip_effect(T.e)):(T=st(l,S?o:le??=q(),k,j,R,n,t,r),S||(T.e.f|=y),l.set(j,T)),I.add(j)}if(h===0&&a&&!f&&(S?f=Z(()=>a(o)):(f=Z(()=>a(le??=q())),f.f|=y)),h>I.size&&Re(),F&&h>0&&Y(ae()),!S)if(E.set(g,I),N){for(const[Ee,Se]of l)I.has(Ee)||g.skip_effect(Se.e);g.oncommit(L),g.ondiscard(c)}else L(g);m&&G(!0),se(b)}),$={effect:d,items:l,pending:E,outrogroups:null,fallback:f};S=!1,F&&(o=B)}function H(e){for(;e!==null&&(e.f&Oe)===0;)e=e.next;return e}function ot(e,t,r,s,n){var a=(s&Ve)!==0,o=t.length,l=e.items,i=H(e.effect.first),u,f=null,b,p=[],E=[],S,L,c,d;if(a)for(d=0;d<o;d+=1)S=t[d],L=n(S,d),c=l.get(L).e,(c.f&y)===0&&(c.nodes?.a?.measure(),(b??=new Set).add(c));for(d=0;d<o;d+=1){if(S=t[d],L=n(S,d),c=l.get(L).e,e.outrogroups!==null)for(const k of e.outrogroups)k.pending.delete(c),k.done.delete(c);if((c.f&K)!==0&&(ge(c),a&&(c.nodes?.a?.unfix(),(b??=new Set).delete(c))),(c.f&y)!==0)if(c.f^=y,c===i)D(c,null,r);else{var $=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,$),D(c,$,r),f=c,p=[],E=[],i=H(f.next);continue}if(c!==i){if(u!==void 0&&u.has(c)){if(p.length<E.length){var h=E[0],m;f=h.prev;var W=p[0],I=p[p.length-1];for(m=0;m<p.length;m+=1)D(p[m],h,r);for(m=0;m<E.length;m+=1)u.delete(E[m]);U(e,W.prev,I.next),U(e,f,W),U(e,I,h),i=h,f=I,d-=1,p=[],E=[]}else u.delete(c),D(c,i,r),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=[],E=[];i!==null&&i!==c;)(u??=new Set).add(i),E.push(i),i=H(i.next);if(i===null)continue}(c.f&y)===0&&p.push(c),f=c,i=H(c.next)}if(e.outrogroups!==null){for(const k of e.outrogroups)k.pending.size===0&&(ee(e,ne(k.done)),e.outrogroups?.delete(k));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&K)===0&&g.push(c);for(;i!==null;)(i.f&K)===0&&i!==e.fallback&&g.push(i),i=H(i.next);var N=g.length;if(N>0){var R=(s&we)!==0&&o===0?r: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()}nt(e,g,R)}}a&&me(()=>{if(b!==void 0)for(c of b)c.nodes?.a?.apply()})}function st(e,t,r,s,n,a,o,l){var i=(o&Le)!==0?(o&Ne)===0?He(r,!1,!1):ce(r):null,u=(o&Pe)!==0?ce(n):null;return{v:i,i:u,e:Z(()=>(a(t,i??r,u??n,l),()=>{e.delete(s)}))}}function D(e,t,r){if(e.nodes)for(var s=e.nodes.start,n=e.nodes.end,a=t&&(t.f&y)===0?t.nodes.start:r;s!==null;){var o=Be(s);if(a.before(s),s===n)return;s=o}}function U(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}const at=Symbol("is custom element"),it=Symbol("is html"),ct=be?"link":"LINK",lt=be?"progress":"PROGRESS";function jt(e){if(F){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var s=e.value;fe(e,"value",null),e.value=s}if(e.hasAttribute("checked")){var n=e.checked;fe(e,"checked",null),e.checked=n}}};e[Ge]=r,me(r),Ke()}}function Bt(e,t){var r=oe(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==lt)||(e.value=t??"")}function Vt(e,t){var r=oe(e);r.checked!==(r.checked=t??void 0)&&(e.checked=t)}function fe(e,t,r,s){var n=oe(e);F&&(n[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName===ct)||n[t]!==(n[t]=r)&&(t==="loading"&&(e[Xe]=r),r==null?e.removeAttribute(t):typeof r!="string"&&ft(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function oe(e){return e[ze]??={[at]:e.nodeName.includes("-"),[it]:e.namespaceURI===qe}}var ue=new Map;function ft(e){var t=e.getAttribute("is")||e.nodeName,r=ue.get(t);if(r)return r;ue.set(t,r=[]);for(var s,n=e,a=Element.prototype;a!==n;){s=Qe(n);for(var o in s)s[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&r.push(o);n=Ye(n)}return r}const ut="";function dt(...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 Je+ut+Ze(e[0],e[1])}const v=()=>{},pt={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 ht(){return globalThis?._logFactory}function gt(e,t){const r=ht();return r?r(e,{decoration:t?.decoration}):pt}function vt(e,t){let r=performance.now();function s(n){const a=performance.now();a-r>t.idle&&e.update(),r=a}return["focus","pointerdown"].forEach(n=>window.addEventListener(n,s)),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e.update()}),e.update(),setInterval(()=>e.update(),t.checks)}function wt(e,t){function r(){e.installing&&e.installing.addEventListener("statechange",function(){this.state==="installed"&&t(e)})}if(e){if(e.waiting)return t(e);e.installing?r():e.addEventListener("updatefound",r)}}function mt(){let e=1;const t=_([]);function r(a){t.update(o=>[...o,{...a,id:++e}])}function s(a){t.update(o=>o.filter(l=>l.id!==a))}function n(a){const o=M(t).find(l=>l.id==a);s(a),o?.type==="push-notification"&&o.data.options.data?.navigate&&et(o.data.options.data.navigate,rt.state)}return{subscribe:t.subscribe,add:r,remove:s,onClick:n}}const bt=mt(),w=gt("service-worker");function X(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 Et=180*1e3,St=1800*1e3;function _t(){const e=_(void 0);function t(o="active"){r({type:"ping"},o)}function r(o,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(o)}function s(){w.log("accepting update...");const o=M(e);if(!o)throw new Error("not loaded");if(o.notSupported)throw new Error("not supported");if(o.registering)throw new Error("is registering...");if(o.updateAvailable&&o.registration){const l=o.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:o.registration,registering:o.registering})}}function n(){const o=M(e);if(!o)throw new Error("not loaded");if(o.notSupported)throw new Error("not supported");if(o.registering)throw new Error("is registering...");e.set({notSupported:!1,updateAvailable:!1,registration:o.registration,registering:o.registering})}function a(){if(typeof navigator<"u"&&"serviceWorker"in navigator){e.set({notSupported:!1,registering:!0});let o=!1;navigator.serviceWorker.addEventListener("controllerchange",()=>{o||(o=!0,window.location.reload())}),navigator.serviceWorker.onmessage=i=>{i.data&&i.data.type==="notification"&&(console.log(i),bt.add({type:"push-notification",data:i.data.notification}))};const l=dt("/service-worker.js");navigator.serviceWorker.register(l,{type:"classic"}).then(i=>{try{vt(i,{idle:Et,checks:St})}catch{}e.set({notSupported:!1,updateAvailable:!1,registration:i,registering:!1}),X(i.installing),X(i.waiting),X(i.active),wt(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 o=M(e);if(o&&"registration"in o)return o.registration},get updateAvailable(){const o=M(e);return o&&"updateAvailable"in o?o.updateAvailable:!1},register:a,pingServideWorker:t,sendMessage:r,skipWaiting:s,skip:n}}function kt(e){if(!e)return{params:{},pathname:""};const t={},r=e.lastIndexOf("#");let s=e;r!==-1&&(s=s.slice(0,r));const n=s.indexOf("?");n!==-1&&s.slice(n+1).split("&").forEach(o=>{const[l,i=""]=o.split("=");t[decodeURIComponent(l)]=i===""?"true":decodeURIComponent(i)});let a=s.slice(0,n)||"";return a&&!a.endsWith("/")&&(a+="/"),{params:t,pathname:a}}function yt(){return typeof window>"u"?{params:{}}:kt(window.location.href)}function Tt(e){if(typeof window>"u")return{};const t=window.location.hash,r={},s=t.lastIndexOf("#");return s!==-1&&t.slice(s+1).split("&").forEach(n=>{const[a,o=""]=n.split("=");r[decodeURIComponent(a)]=decodeURIComponent(o)}),r}const zt=_t();Tt();const{params:qt}=yt();console.log(`VERSION: ${tt}`);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"},At=["--color-brand-cyan","--color-brand-blue","--color-brand-purple"],Ct={label:"",accent:null,colors:null,frame:!1,pattern:"none"};function Yt(e){if(typeof document>"u")return;const t=document.documentElement;for(const r of Object.values(de))t.style.removeProperty(r);if(t.classList.remove("wherever-framed"),delete t.dataset.whereverPattern,e.accent){for(const r of At)t.style.setProperty(r,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[r,s]of Object.entries(e.colors)){const n=de[r];n&&typeof s=="string"&&t.style.setProperty(n,s)}}const x=_({folders:[],activeSessions:[],currentSession:null,loading:!1}),Q=_({models:[],loading:!1}),V=_({folders:[],activeSessions:[],currentSession:null,loading:!1});function J(){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 A(){const e=localStorage.getItem("wherever-config"),t=typeof window<"u"&&window.location&&window.location.hostname?window.location.hostname:"localhost";if(e){const r=JSON.parse(e),s=window.location.protocol==="https:"?"https:":"http:";let n=r.host||t;(n==="localhost"||n==="127.0.0.1")&&t&&t!=="localhost"&&t!=="127.0.0.1"&&(n=t),n=n.startsWith("http")?n.replace(/^wss?:\/\//,""):n;let a=r.port;return(a===31415||a===void 0)&&J()!==31415&&(a=J()),`${s}//${n}:${a||J()}`}return`${window.location.protocol}//${window.location.host}`}let P=null,O=[],te=!1,re=!1,pe=0;const $t=150,It=1e3;async function Rt(){te=!0;try{const e=A(),t=C(),r=`${e}/sessions${t?`?token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();x.set({folders:n.folders||[],activeSessions:(n.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(x).currentSession,loading:!1})}catch(e){x.update(t=>({...t,loading:!1})),console.error("Failed to fetch sessions:",e)}finally{te=!1}}function Gt(){x.update(r=>({...r,loading:!0}));const e=new Promise(r=>{O.push(r)});if(te)return re=!0,e;const t=Date.now();if(!P)pe=t;else if(clearTimeout(P),t-pe>=It)return P=null,he(),e;return P=setTimeout(()=>{P=null,he()},$t),e}async function he(){try{do{re=!1;const e=O;O=[];try{await Rt()}finally{for(const t of e)t()}}while(re)}finally{const e=O;O=[];for(const t of e)t()}}async function Kt(){V.update(e=>({...e,loading:!0}));try{const e=A(),t=C(),r=`${e}/sessions?view=readonly${t?`&token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();V.set({folders:n.folders||[],activeSessions:(n.activeSessions||[]).map(a=>a.sessionFile),currentSession:M(V).currentSession,loading:!1})}catch(e){V.update(t=>({...t,loading:!1})),console.error("Failed to fetch read-only sessions:",e)}}let z=null;async function Xt(e,t="default"){z?.abort();const r=new AbortController;z=r;try{const s=A(),n=C(),a=new URLSearchParams({q:e});t==="readonly"&&a.set("view","readonly"),n&&a.set("token",n);const o=await fetch(`${s}/search?${a.toString()}`,{signal:r.signal});return o.ok?await o.json():{status:"error",query:e,hits:[],message:o.status===401?"Unauthorized: check the token in Connection Settings.":`Search failed (HTTP ${o.status}).`}}catch(s){return s?.name==="AbortError"?null:{status:"error",query:e,hits:[],message:s?.message||"Search request failed."}}finally{z===r&&(z=null)}}async function Qt(){Q.update(e=>({...e,loading:!0}));try{const e=A(),t=C(),r=`${e}/models${t?`?token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();Q.set({models:n.models||[],loading:!1})}catch(e){Q.update(t=>({...t,loading:!1})),console.error("Failed to fetch models:",e)}}function C(){try{const e=localStorage.getItem("wherever-config");if(e)return JSON.parse(e).token||""}catch{}return""}const Ut=_(!1),Ft=_("websocket"),Mt=_(null),Lt=_(!1),Nt=_(null),Ht=_(Ct);async function Jt(e){if(!e.trim())return null;try{const t=A(),r=C(),s=`${t}/check-path?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}catch(t){return console.error("Failed to check path:",t),null}}async function Zt(e){if(!e.trim())return null;try{const t=A(),r=C(),s=`${t}/check-remote-repo?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}catch(t){return console.error("Failed to check remote repo:",t),null}}async function er(e){if(!e.trim())return[];try{const t=A(),r=C(),s=`${t}/remote-candidates?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);const a=await n.json();return Array.isArray(a.candidates)?a.candidates:[]}catch(t){return console.error("Failed to resolve remote candidates:",t),[]}}async function tr(e){try{const t=A(),r=C(),s=`${t}/autocomplete-path?path=${encodeURIComponent(e)}${r?`&token=${encodeURIComponent(r)}`:""}`,n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).completions||[]}catch(t){return console.error("Failed to autocomplete path:",t),[]}}async function rr(){try{const e=A(),t=C(),r=`${e}/config${t?`?token=${encodeURIComponent(t)}`:""}`,s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);const n=await s.json();Ut.set(!!n.gitInitDefault),Ft.set(n.uploadMethod||"websocket"),Mt.set(n.searchFolder||null),Lt.set(!!n.searchCreateRemote),Nt.set(n.searchDefaultModel||null);const a={label:n.appearance?.label||"",accent:n.appearance?.accent||null,colors:n.appearance?.colors||null,frame:!!n.appearance?.frame,pattern:n.appearance?.pattern||"none"};Ht.set(a)}catch(e){console.error("Failed to fetch config:",e)}}function nr(e){x.update(t=>({...t,currentSession:e}))}export{nr as A,fe as B,Vt as C,Bt as D,Ft as E,Ht as a,Yt as b,tr as c,Q as d,Jt as e,Zt as f,Wt as g,rr as h,Qt as i,Kt as j,er as k,Gt as l,A as m,C as n,Ut as o,xt as p,bt as q,V as r,jt as s,dt as t,Xt as u,Lt as v,Nt as w,Mt as x,zt as y,x as z};
|
|
2
|
+
//# sourceMappingURL=vI97EmaY.js.map
|