claude-remote-cli 2.4.1 → 2.4.2
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.
|
@@ -7,7 +7,7 @@ var kf=Object.defineProperty;var fh=e=>{throw TypeError(e)};var xf=(e,t,i)=>t in
|
|
|
7
7
|
[Gave up reconnecting after `+Nh+` attempts]\r
|
|
8
8
|
`);return}const r=Math.min(1e3*2**pr,1e4);pr++,pn=setTimeout(async()=>{pn=null;try{if(!(await(await fetch("/sessions")).json()).some(a=>a.id===e)){t.write(`\r
|
|
9
9
|
[Session ended]\r
|
|
10
|
-
`),s();return}t.clear(),fd(e,t,i,s)}catch{_d(e,t,i,s)}},r)}function Yt(e){wt&&wt.readyState===WebSocket.OPEN&&wt.send(e)}function Fh(e,t){wt&&wt.readyState===WebSocket.OPEN&&wt.send(JSON.stringify({type:"resize",cols:e,rows:t}))}function ur(){return wt!==null&&wt.readyState===WebSocket.OPEN}var Hv=X('<p class="error svelte-1qp96yb"> </p>'),Wv=X('<div class="pin-gate svelte-1qp96yb"><div class="pin-container svelte-1qp96yb"><h1 class="svelte-1qp96yb">Claude Remote CLI</h1> <p class="svelte-1qp96yb">Enter PIN to continue</p> <input type="password" inputmode="numeric" maxlength="20" placeholder="PIN" class="svelte-1qp96yb"/> <button class="svelte-1qp96yb">Unlock</button> <!></div></div>');function zv(e,t){_t(t,!0);const i=rd();let s=Z("");async function r(){const f=_(s).trim();f&&(await Bv(f),i.pinError&&C(s,""))}function n(f){f.key==="Enter"&&r()}var o=Wv(),a=R(o),h=I(R(a),4);A_(h);var l=I(h,2),u=I(l,2);{var c=f=>{var v=Hv(),p=R(v);me(()=>ge(p,i.pinError)),V(f,v)};fe(u,f=>{i.pinError&&f(c)})}$("keydown",h,n),go(h,()=>_(s),f=>C(s,f)),$("click",l,r),V(e,o),vt()}St(["keydown","click"]);var Fn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Uv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rs,Ol,Yc,Kv=(Yc=class{constructor(){U(this,rs,Uv);U(this,Ol,!1)}setTimeoutProvider(e){A(this,rs,e)}setTimeout(e,t){return d(this,rs).setTimeout(e,t)}clearTimeout(e){d(this,rs).clearTimeout(e)}setInterval(e,t){return d(this,rs).setInterval(e,t)}clearInterval(e){d(this,rs).clearInterval(e)}},rs=new WeakMap,Ol=new WeakMap,Yc),As=new Kv;function qv(e){setTimeout(e,0)}var Ur=typeof window>"u"||"Deno"in globalThis;function Qt(){}function jv(e,t){return typeof e=="function"?e(t):e}function Oa(e){return typeof e=="number"&&e>=0&&e!==1/0}function vd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function bs(e,t){return typeof e=="function"?e(t):e}function Zt(e,t){return typeof e=="function"?e(t):e}function Hh(e,t){const{type:i="all",exact:s,fetchStatus:r,predicate:n,queryKey:o,stale:a}=e;if(o){if(s){if(t.queryHash!==Ql(o,t.options))return!1}else if(!bn(t.queryKey,o))return!1}if(i!=="all"){const h=t.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||r&&r!==t.state.fetchStatus||n&&!n(t))}function Wh(e,t){const{exact:i,status:s,predicate:r,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(i){if(Sn(t.options.mutationKey)!==Sn(n))return!1}else if(!bn(t.options.mutationKey,n))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function Ql(e,t){return((t==null?void 0:t.queryKeyHashFn)||Sn)(e)}function Sn(e){return JSON.stringify(e,(t,i)=>Na(i)?Object.keys(i).sort().reduce((s,r)=>(s[r]=i[r],s),{}):i)}function bn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(i=>bn(e[i],t[i])):!1}var Vv=Object.prototype.hasOwnProperty;function pd(e,t,i=0){if(e===t)return e;if(i>500)return t;const s=zh(e)&&zh(t);if(!s&&!(Na(e)&&Na(t)))return t;const n=(s?e:Object.keys(e)).length,o=s?t:Object.keys(t),a=o.length,h=s?new Array(a):{};let l=0;for(let u=0;u<a;u++){const c=s?u:o[u],f=e[c],v=t[c];if(f===v){h[c]=f,(s?u<n:Vv.call(e,c))&&l++;continue}if(f===null||v===null||typeof f!="object"||typeof v!="object"){h[c]=v;continue}const p=pd(f,v,i+1);h[c]=p,p===f&&l++}return n===a&&l===n?e:h}function Ia(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}function zh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Na(e){if(!Uh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!Uh(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Uh(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yv(e){return new Promise(t=>{As.setTimeout(t,e)})}function Fa(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?pd(e,t):t}function Gv(e,t,i=0){const s=[...e,t];return i&&s.length>i?s.slice(1):s}function Xv(e,t,i=0){const s=[t,...e];return i&&s.length>i?s.slice(0,-1):s}var Jl=Symbol();function gd(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Jl?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qv(e,t,i){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?i():r.addEventListener("abort",i,{once:!0})),r)}),e}var zs,ns,xr,Gc,Jv=(Gc=class extends Fn{constructor(){super();U(this,zs);U(this,ns);U(this,xr);A(this,xr,t=>{if(!Ur&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){d(this,ns)||this.setEventListener(d(this,xr))}onUnsubscribe(){var t;this.hasListeners()||((t=d(this,ns))==null||t.call(this),A(this,ns,void 0))}setEventListener(t){var i;A(this,xr,t),(i=d(this,ns))==null||i.call(this),A(this,ns,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){d(this,zs)!==t&&(A(this,zs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof d(this,zs)=="boolean"?d(this,zs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zs=new WeakMap,ns=new WeakMap,xr=new WeakMap,Gc),Zl=new Jv;function Ha(){let e,t;const i=new Promise((r,n)=>{e=r,t=n});i.status="pending",i.catch(()=>{});function s(r){Object.assign(i,r),delete i.resolve,delete i.reject}return i.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},i.reject=r=>{s({status:"rejected",reason:r}),t(r)},i}var Zv=qv;function $v(){let e=[],t=0,i=a=>{a()},s=a=>{a()},r=Zv;const n=a=>{t?e.push(a):r(()=>{i(a)})},o=()=>{const a=e;e=[],a.length&&r(()=>{s(()=>{a.forEach(h=>{i(h)})})})};return{batch:a=>{let h;t++;try{h=a()}finally{t--,t||o()}return h},batchCalls:a=>(...h)=>{n(()=>{a(...h)})},schedule:n,setNotifyFunction:a=>{i=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{r=a}}}var mt=$v(),Er,os,Dr,Xc,ep=(Xc=class extends Fn{constructor(){super();U(this,Er,!0);U(this,os);U(this,Dr);A(this,Dr,t=>{if(!Ur&&window.addEventListener){const i=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",s)}}})}onSubscribe(){d(this,os)||this.setEventListener(d(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=d(this,os))==null||t.call(this),A(this,os,void 0))}setEventListener(t){var i;A(this,Dr,t),(i=d(this,os))==null||i.call(this),A(this,os,t(this.setOnline.bind(this)))}setOnline(t){d(this,Er)!==t&&(A(this,Er,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return d(this,Er)}},Er=new WeakMap,os=new WeakMap,Dr=new WeakMap,Xc),bo=new ep;function tp(e){return Math.min(1e3*2**e,3e4)}function md(e){return(e??"online")==="online"?bo.isOnline():!0}var Wa=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sd(e){let t=!1,i=0,s;const r=Ha(),n=()=>r.status!=="pending",o=m=>{var g;if(!n()){const b=new Wa(m);f(b),(g=e.onCancel)==null||g.call(e,b)}},a=()=>{t=!0},h=()=>{t=!1},l=()=>Zl.isFocused()&&(e.networkMode==="always"||bo.isOnline())&&e.canRun(),u=()=>md(e.networkMode)&&e.canRun(),c=m=>{n()||(s==null||s(),r.resolve(m))},f=m=>{n()||(s==null||s(),r.reject(m))},v=()=>new Promise(m=>{var g;s=b=>{(n()||l())&&m(b)},(g=e.onPause)==null||g.call(e)}).then(()=>{var m;s=void 0,n()||(m=e.onContinue)==null||m.call(e)}),p=()=>{if(n())return;let m;const g=i===0?e.initialPromise:void 0;try{m=g??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(c).catch(b=>{var F;if(n())return;const P=e.retry??(Ur?0:3),y=e.retryDelay??tp,S=typeof y=="function"?y(i,b):y,x=P===!0||typeof P=="number"&&i<P||typeof P=="function"&&P(i,b);if(t||!x){f(b);return}i++,(F=e.onFail)==null||F.call(e,i,b),Yv(S).then(()=>l()?void 0:v()).then(()=>{t?f(b):p()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(s==null||s(),r),cancelRetry:a,continueRetry:h,canStart:u,start:()=>(u()?p():v().then(p),r)}}var Us,Qc,bd=(Qc=class{constructor(){U(this,Us)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Oa(this.gcTime)&&A(this,Us,As.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ur?1/0:300*1e3))}clearGcTimeout(){d(this,Us)&&(As.clearTimeout(d(this,Us)),A(this,Us,void 0))}},Us=new WeakMap,Qc),Ks,Rr,Xt,qs,$e,Rn,js,hi,Ai,Jc,ip=(Jc=class extends bd{constructor(t){super();U(this,hi);U(this,Ks);U(this,Rr);U(this,Xt);U(this,qs);U(this,$e);U(this,Rn);U(this,js);A(this,js,!1),A(this,Rn,t.defaultOptions),this.setOptions(t.options),this.observers=[],A(this,qs,t.client),A(this,Xt,d(this,qs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,A(this,Ks,qh(this.options)),this.state=t.state??d(this,Ks),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=d(this,$e))==null?void 0:t.promise}setOptions(t){if(this.options={...d(this,Rn),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=qh(this.options);i.data!==void 0&&(this.setState(Kh(i.data,i.dataUpdatedAt)),A(this,Ks,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&d(this,Xt).remove(this)}setData(t,i){const s=Fa(this.state.data,t,this.options);return ie(this,hi,Ai).call(this,{data:s,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),s}setState(t,i){ie(this,hi,Ai).call(this,{type:"setState",state:t,setStateOptions:i})}cancel(t){var s,r;const i=(s=d(this,$e))==null?void 0:s.promise;return(r=d(this,$e))==null||r.cancel(t),i?i.then(Qt).catch(Qt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(d(this,Ks))}isActive(){return this.observers.some(t=>Zt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jl||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>bs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!vd(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=d(this,$e))==null||i.continue()}onOnline(){var i;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=d(this,$e))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),d(this,Xt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(d(this,$e)&&(d(this,js)?d(this,$e).cancel({revert:!0}):d(this,$e).cancelRetry()),this.scheduleGc()),d(this,Xt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ie(this,hi,Ai).call(this,{type:"invalidate"})}async fetch(t,i){var h,l,u,c,f,v,p,m,g,b,P,y;if(this.state.fetchStatus!=="idle"&&((h=d(this,$e))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(d(this,$e))return d(this,$e).continueRetry(),d(this,$e).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(x=>x.options.queryFn);S&&this.setOptions(S.options)}const s=new AbortController,r=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(A(this,js,!0),s.signal)})},n=()=>{const S=gd(this.options,i),F=(()=>{const W={client:d(this,qs),queryKey:this.queryKey,meta:this.meta};return r(W),W})();return A(this,js,!1),this.options.persister?this.options.persister(S,F,this):S(F)},a=(()=>{const S={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:d(this,qs),state:this.state,fetchFn:n};return r(S),S})();(l=this.options.behavior)==null||l.onFetch(a,this),A(this,Rr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&ie(this,hi,Ai).call(this,{type:"fetch",meta:(c=a.fetchOptions)==null?void 0:c.meta}),A(this,$e,Sd({initialPromise:i==null?void 0:i.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof Wa&&S.revert&&this.setState({...d(this,Rr),fetchStatus:"idle"}),s.abort()},onFail:(S,x)=>{ie(this,hi,Ai).call(this,{type:"failed",failureCount:S,error:x})},onPause:()=>{ie(this,hi,Ai).call(this,{type:"pause"})},onContinue:()=>{ie(this,hi,Ai).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await d(this,$e).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(v=(f=d(this,Xt).config).onSuccess)==null||v.call(f,S,this),(m=(p=d(this,Xt).config).onSettled)==null||m.call(p,S,this.state.error,this),S}catch(S){if(S instanceof Wa){if(S.silent)return d(this,$e).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw ie(this,hi,Ai).call(this,{type:"error",error:S}),(b=(g=d(this,Xt).config).onError)==null||b.call(g,S,this),(y=(P=d(this,Xt).config).onSettled)==null||y.call(P,this.state.data,S,this),S}finally{this.scheduleGc()}}},Ks=new WeakMap,Rr=new WeakMap,Xt=new WeakMap,qs=new WeakMap,$e=new WeakMap,Rn=new WeakMap,js=new WeakMap,hi=new WeakSet,Ai=function(t){const i=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...yd(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...Kh(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return A(this,Rr,t.manual?r:void 0),r;case"error":const n=t.error;return{...s,error:n,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=i(this.state),mt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),d(this,Xt).notify({query:this,type:"updated",action:t})})},Jc);function yd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:md(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,i=t!==void 0,s=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:i?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var Rt,we,Pn,yt,Vs,Pr,Fi,as,Mn,Mr,Tr,Ys,Gs,ls,Br,ke,an,za,Ua,Ka,qa,ja,Va,Ya,wd,Zc,sp=(Zc=class extends Fn{constructor(t,i){super();U(this,ke);U(this,Rt);U(this,we);U(this,Pn);U(this,yt);U(this,Vs);U(this,Pr);U(this,Fi);U(this,as);U(this,Mn);U(this,Mr);U(this,Tr);U(this,Ys);U(this,Gs);U(this,ls);U(this,Br,new Set);this.options=i,A(this,Rt,t),A(this,as,null),A(this,Fi,Ha()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(d(this,we).addObserver(this),jh(d(this,we),this.options)?ie(this,ke,an).call(this):this.updateResult(),ie(this,ke,qa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ga(d(this,we),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ga(d(this,we),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ie(this,ke,ja).call(this),ie(this,ke,Va).call(this),d(this,we).removeObserver(this)}setOptions(t){const i=this.options,s=d(this,we);if(this.options=d(this,Rt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zt(this.options.enabled,d(this,we))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ie(this,ke,Ya).call(this),d(this,we).setOptions(this.options),i._defaulted&&!Ia(this.options,i)&&d(this,Rt).getQueryCache().notify({type:"observerOptionsUpdated",query:d(this,we),observer:this});const r=this.hasListeners();r&&Vh(d(this,we),s,this.options,i)&&ie(this,ke,an).call(this),this.updateResult(),r&&(d(this,we)!==s||Zt(this.options.enabled,d(this,we))!==Zt(i.enabled,d(this,we))||bs(this.options.staleTime,d(this,we))!==bs(i.staleTime,d(this,we)))&&ie(this,ke,za).call(this);const n=ie(this,ke,Ua).call(this);r&&(d(this,we)!==s||Zt(this.options.enabled,d(this,we))!==Zt(i.enabled,d(this,we))||n!==d(this,ls))&&ie(this,ke,Ka).call(this,n)}getOptimisticResult(t){const i=d(this,Rt).getQueryCache().build(d(this,Rt),t),s=this.createResult(i,t);return np(this,s)&&(A(this,yt,s),A(this,Pr,this.options),A(this,Vs,d(this,we).state)),s}getCurrentResult(){return d(this,yt)}trackResult(t,i){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),i==null||i(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&d(this,Fi).status==="pending"&&d(this,Fi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){d(this,Br).add(t)}getCurrentQuery(){return d(this,we)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=d(this,Rt).defaultQueryOptions(t),s=d(this,Rt).getQueryCache().build(d(this,Rt),i);return s.fetch().then(()=>this.createResult(s,i))}fetch(t){return ie(this,ke,an).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),d(this,yt)))}createResult(t,i){var J;const s=d(this,we),r=this.options,n=d(this,yt),o=d(this,Vs),a=d(this,Pr),l=t!==s?t.state:d(this,Pn),{state:u}=t;let c={...u},f=!1,v;if(i._optimisticResults){const te=this.hasListeners(),ee=!te&&jh(t,i),K=te&&Vh(t,s,i,r);(ee||K)&&(c={...c,...yd(u.data,t.options)}),i._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:g}=c;v=c.data;let b=!1;if(i.placeholderData!==void 0&&v===void 0&&g==="pending"){let te;n!=null&&n.isPlaceholderData&&i.placeholderData===(a==null?void 0:a.placeholderData)?(te=n.data,b=!0):te=typeof i.placeholderData=="function"?i.placeholderData((J=d(this,Tr))==null?void 0:J.state.data,d(this,Tr)):i.placeholderData,te!==void 0&&(g="success",v=Fa(n==null?void 0:n.data,te,i),f=!0)}if(i.select&&v!==void 0&&!b)if(n&&v===(o==null?void 0:o.data)&&i.select===d(this,Mn))v=d(this,Mr);else try{A(this,Mn,i.select),v=i.select(v),v=Fa(n==null?void 0:n.data,v,i),A(this,Mr,v),A(this,as,null)}catch(te){A(this,as,te)}d(this,as)&&(p=d(this,as),v=d(this,Mr),m=Date.now(),g="error");const P=c.fetchStatus==="fetching",y=g==="pending",S=g==="error",x=y&&P,F=v!==void 0,z={status:g,fetchStatus:c.fetchStatus,isPending:y,isSuccess:g==="success",isError:S,isInitialLoading:x,isLoading:x,data:v,dataUpdatedAt:c.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:P,isRefetching:P&&!y,isLoadingError:S&&!F,isPaused:c.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&F,isStale:$l(t,i),refetch:this.refetch,promise:d(this,Fi),isEnabled:Zt(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const te=z.data!==void 0,ee=z.status==="error"&&!te,K=E=>{ee?E.reject(z.error):te&&E.resolve(z.data)},k=()=>{const E=A(this,Fi,z.promise=Ha());K(E)},w=d(this,Fi);switch(w.status){case"pending":t.queryHash===s.queryHash&&K(w);break;case"fulfilled":(ee||z.data!==w.value)&&k();break;case"rejected":(!ee||z.error!==w.reason)&&k();break}}return z}updateResult(){const t=d(this,yt),i=this.createResult(d(this,we),this.options);if(A(this,Vs,d(this,we).state),A(this,Pr,this.options),d(this,Vs).data!==void 0&&A(this,Tr,d(this,we)),Ia(i,t))return;A(this,yt,i);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,n=typeof r=="function"?r():r;if(n==="all"||!n&&!d(this,Br).size)return!0;const o=new Set(n??d(this,Br));return this.options.throwOnError&&o.add("error"),Object.keys(d(this,yt)).some(a=>{const h=a;return d(this,yt)[h]!==t[h]&&o.has(h)})};ie(this,ke,wd).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ie(this,ke,qa).call(this)}},Rt=new WeakMap,we=new WeakMap,Pn=new WeakMap,yt=new WeakMap,Vs=new WeakMap,Pr=new WeakMap,Fi=new WeakMap,as=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Tr=new WeakMap,Ys=new WeakMap,Gs=new WeakMap,ls=new WeakMap,Br=new WeakMap,ke=new WeakSet,an=function(t){ie(this,ke,Ya).call(this);let i=d(this,we).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(Qt)),i},za=function(){ie(this,ke,ja).call(this);const t=bs(this.options.staleTime,d(this,we));if(Ur||d(this,yt).isStale||!Oa(t))return;const s=vd(d(this,yt).dataUpdatedAt,t)+1;A(this,Ys,As.setTimeout(()=>{d(this,yt).isStale||this.updateResult()},s))},Ua=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(d(this,we)):this.options.refetchInterval)??!1},Ka=function(t){ie(this,ke,Va).call(this),A(this,ls,t),!(Ur||Zt(this.options.enabled,d(this,we))===!1||!Oa(d(this,ls))||d(this,ls)===0)&&A(this,Gs,As.setInterval(()=>{(this.options.refetchIntervalInBackground||Zl.isFocused())&&ie(this,ke,an).call(this)},d(this,ls)))},qa=function(){ie(this,ke,za).call(this),ie(this,ke,Ka).call(this,ie(this,ke,Ua).call(this))},ja=function(){d(this,Ys)&&(As.clearTimeout(d(this,Ys)),A(this,Ys,void 0))},Va=function(){d(this,Gs)&&(As.clearInterval(d(this,Gs)),A(this,Gs,void 0))},Ya=function(){const t=d(this,Rt).getQueryCache().build(d(this,Rt),this.options);if(t===d(this,we))return;const i=d(this,we);A(this,we,t),A(this,Pn,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},wd=function(t){mt.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(d(this,yt))}),d(this,Rt).getQueryCache().notify({query:d(this,we),type:"observerResultsUpdated"})})},Zc);function rp(e,t){return Zt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function jh(e,t){return rp(e,t)||e.state.data!==void 0&&Ga(e,t,t.refetchOnMount)}function Ga(e,t,i){if(Zt(t.enabled,e)!==!1&&bs(t.staleTime,e)!=="static"){const s=typeof i=="function"?i(e):i;return s==="always"||s!==!1&&$l(e,t)}return!1}function Vh(e,t,i,s){return(e!==t||Zt(s.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&$l(e,i)}function $l(e,t){return Zt(t.enabled,e)!==!1&&e.isStaleByTime(bs(t.staleTime,e))}function np(e,t){return!Ia(e.getCurrentResult(),t)}function Yh(e){return{onFetch:(t,i)=>{var u,c,f,v,p;const s=t.options,r=(f=(c=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:c.fetchMore)==null?void 0:f.direction,n=((v=t.state.data)==null?void 0:v.pages)||[],o=((p=t.state.data)==null?void 0:p.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const l=async()=>{let m=!1;const g=y=>{Qv(y,()=>t.signal,()=>m=!0)},b=gd(t.options,t.fetchOptions),P=async(y,S,x)=>{if(m)return Promise.reject();if(S==null&&y.pages.length)return Promise.resolve(y);const W=(()=>{const ee={client:t.client,queryKey:t.queryKey,pageParam:S,direction:x?"backward":"forward",meta:t.options.meta};return g(ee),ee})(),z=await b(W),{maxPages:J}=t.options,te=x?Xv:Gv;return{pages:te(y.pages,z,J),pageParams:te(y.pageParams,S,J)}};if(r&&n.length){const y=r==="backward",S=y?op:Gh,x={pages:n,pageParams:o},F=S(s,x);a=await P(x,F,y)}else{const y=e??n.length;do{const S=h===0?o[0]??s.initialPageParam:Gh(s,a);if(h>0&&S==null)break;a=await P(a,S),h++}while(h<y)}return a};t.options.persister?t.fetchFn=()=>{var m,g;return(g=(m=t.options).persister)==null?void 0:g.call(m,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=l}}}function Gh(e,{pages:t,pageParams:i}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,i[s],i):void 0}function op(e,{pages:t,pageParams:i}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,i[0],i):void 0}var Tn,ki,gt,Xs,xi,es,$c,ap=($c=class extends bd{constructor(t){super();U(this,xi);U(this,Tn);U(this,ki);U(this,gt);U(this,Xs);A(this,Tn,t.client),this.mutationId=t.mutationId,A(this,gt,t.mutationCache),A(this,ki,[]),this.state=t.state||lp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){d(this,ki).includes(t)||(d(this,ki).push(t),this.clearGcTimeout(),d(this,gt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){A(this,ki,d(this,ki).filter(i=>i!==t)),this.scheduleGc(),d(this,gt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){d(this,ki).length||(this.state.status==="pending"?this.scheduleGc():d(this,gt).remove(this))}continue(){var t;return((t=d(this,Xs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,h,l,u,c,f,v,p,m,g,b,P,y,S,x,F,W;const i=()=>{ie(this,xi,es).call(this,{type:"continue"})},s={client:d(this,Tn),meta:this.options.meta,mutationKey:this.options.mutationKey};A(this,Xs,Sd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(z,J)=>{ie(this,xi,es).call(this,{type:"failed",failureCount:z,error:J})},onPause:()=>{ie(this,xi,es).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>d(this,gt).canRun(this)}));const r=this.state.status==="pending",n=!d(this,Xs).canStart();try{if(r)i();else{ie(this,xi,es).call(this,{type:"pending",variables:t,isPaused:n}),d(this,gt).config.onMutate&&await d(this,gt).config.onMutate(t,this,s);const J=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,s));J!==this.state.context&&ie(this,xi,es).call(this,{type:"pending",context:J,variables:t,isPaused:n})}const z=await d(this,Xs).start();return await((l=(h=d(this,gt).config).onSuccess)==null?void 0:l.call(h,z,t,this.state.context,this,s)),await((c=(u=this.options).onSuccess)==null?void 0:c.call(u,z,t,this.state.context,s)),await((v=(f=d(this,gt).config).onSettled)==null?void 0:v.call(f,z,null,this.state.variables,this.state.context,this,s)),await((m=(p=this.options).onSettled)==null?void 0:m.call(p,z,null,t,this.state.context,s)),ie(this,xi,es).call(this,{type:"success",data:z}),z}catch(z){try{await((b=(g=d(this,gt).config).onError)==null?void 0:b.call(g,z,t,this.state.context,this,s))}catch(J){Promise.reject(J)}try{await((y=(P=this.options).onError)==null?void 0:y.call(P,z,t,this.state.context,s))}catch(J){Promise.reject(J)}try{await((x=(S=d(this,gt).config).onSettled)==null?void 0:x.call(S,void 0,z,this.state.variables,this.state.context,this,s))}catch(J){Promise.reject(J)}try{await((W=(F=this.options).onSettled)==null?void 0:W.call(F,void 0,z,t,this.state.context,s))}catch(J){Promise.reject(J)}throw ie(this,xi,es).call(this,{type:"error",error:z}),z}finally{d(this,gt).runNext(this)}}},Tn=new WeakMap,ki=new WeakMap,gt=new WeakMap,Xs=new WeakMap,xi=new WeakSet,es=function(t){const i=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),mt.batch(()=>{d(this,ki).forEach(s=>{s.onMutationUpdate(t)}),d(this,gt).notify({mutation:this,type:"updated",action:t})})},$c);function lp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hi,ci,Bn,eu,hp=(eu=class extends Fn{constructor(t={}){super();U(this,Hi);U(this,ci);U(this,Bn);this.config=t,A(this,Hi,new Set),A(this,ci,new Map),A(this,Bn,0)}build(t,i,s){const r=new ap({client:t,mutationCache:this,mutationId:++Kn(this,Bn)._,options:t.defaultMutationOptions(i),state:s});return this.add(r),r}add(t){d(this,Hi).add(t);const i=Yn(t);if(typeof i=="string"){const s=d(this,ci).get(i);s?s.push(t):d(this,ci).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(d(this,Hi).delete(t)){const i=Yn(t);if(typeof i=="string"){const s=d(this,ci).get(i);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&d(this,ci).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Yn(t);if(typeof i=="string"){const s=d(this,ci).get(i),r=s==null?void 0:s.find(n=>n.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const i=Yn(t);if(typeof i=="string"){const r=(s=d(this,ci).get(i))==null?void 0:s.find(n=>n!==t&&n.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){mt.batch(()=>{d(this,Hi).forEach(t=>{this.notify({type:"removed",mutation:t})}),d(this,Hi).clear(),d(this,ci).clear()})}getAll(){return Array.from(d(this,Hi))}find(t){const i={exact:!0,...t};return this.getAll().find(s=>Wh(i,s))}findAll(t={}){return this.getAll().filter(i=>Wh(t,i))}notify(t){mt.batch(()=>{this.listeners.forEach(i=>{i(t)})})}resumePausedMutations(){const t=this.getAll().filter(i=>i.state.isPaused);return mt.batch(()=>Promise.all(t.map(i=>i.continue().catch(Qt))))}},Hi=new WeakMap,ci=new WeakMap,Bn=new WeakMap,eu);function Yn(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ei,tu,cp=(tu=class extends Fn{constructor(t={}){super();U(this,Ei);this.config=t,A(this,Ei,new Map)}build(t,i,s){const r=i.queryKey,n=i.queryHash??Ql(r,i);let o=this.get(n);return o||(o=new ip({client:t,queryKey:r,queryHash:n,options:t.defaultQueryOptions(i),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){d(this,Ei).has(t.queryHash)||(d(this,Ei).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=d(this,Ei).get(t.queryHash);i&&(t.destroy(),i===t&&d(this,Ei).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){mt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return d(this,Ei).get(t)}getAll(){return[...d(this,Ei).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(s=>Hh(i,s))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(s=>Hh(t,s)):i}notify(t){mt.batch(()=>{this.listeners.forEach(i=>{i(t)})})}onFocus(){mt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){mt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ei=new WeakMap,tu),Oe,hs,cs,Lr,Ar,us,Or,Ir,iu,Cd=(iu=class{constructor(e={}){U(this,Oe);U(this,hs);U(this,cs);U(this,Lr);U(this,Ar);U(this,us);U(this,Or);U(this,Ir);A(this,Oe,e.queryCache||new cp),A(this,hs,e.mutationCache||new hp),A(this,cs,e.defaultOptions||{}),A(this,Lr,new Map),A(this,Ar,new Map),A(this,us,0)}mount(){Kn(this,us)._++,d(this,us)===1&&(A(this,Or,Zl.subscribe(async e=>{e&&(await this.resumePausedMutations(),d(this,Oe).onFocus())})),A(this,Ir,bo.subscribe(async e=>{e&&(await this.resumePausedMutations(),d(this,Oe).onOnline())})))}unmount(){var e,t;Kn(this,us)._--,d(this,us)===0&&((e=d(this,Or))==null||e.call(this),A(this,Or,void 0),(t=d(this,Ir))==null||t.call(this),A(this,Ir,void 0))}isFetching(e){return d(this,Oe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return d(this,hs).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=d(this,Oe).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=d(this,Oe).build(this,t),s=i.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(bs(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return d(this,Oe).findAll(e).map(({queryKey:t,state:i})=>{const s=i.data;return[t,s]})}setQueryData(e,t,i){const s=this.defaultQueryOptions({queryKey:e}),r=d(this,Oe).get(s.queryHash),n=r==null?void 0:r.state.data,o=jv(t,n);if(o!==void 0)return d(this,Oe).build(this,s).setData(o,{...i,manual:!0})}setQueriesData(e,t,i){return mt.batch(()=>d(this,Oe).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,i)]))}getQueryState(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=d(this,Oe).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=d(this,Oe);mt.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=d(this,Oe);return mt.batch(()=>(i.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},s=mt.batch(()=>d(this,Oe).findAll(e).map(r=>r.cancel(i)));return Promise.all(s).then(Qt).catch(Qt)}invalidateQueries(e,t={}){return mt.batch(()=>(d(this,Oe).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},s=mt.batch(()=>d(this,Oe).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let n=r.fetch(void 0,i);return i.throwOnError||(n=n.catch(Qt)),r.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(s).then(Qt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=d(this,Oe).build(this,t);return i.isStaleByTime(bs(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Qt).catch(Qt)}fetchInfiniteQuery(e){return e.behavior=Yh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Qt).catch(Qt)}ensureInfiniteQueryData(e){return e.behavior=Yh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bo.isOnline()?d(this,hs).resumePausedMutations():Promise.resolve()}getQueryCache(){return d(this,Oe)}getMutationCache(){return d(this,hs)}getDefaultOptions(){return d(this,cs)}setDefaultOptions(e){A(this,cs,e)}setQueryDefaults(e,t){d(this,Lr).set(Sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...d(this,Lr).values()],i={};return t.forEach(s=>{bn(e,s.queryKey)&&Object.assign(i,s.defaultOptions)}),i}setMutationDefaults(e,t){d(this,Ar).set(Sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...d(this,Ar).values()],i={};return t.forEach(s=>{bn(e,s.mutationKey)&&Object.assign(i,s.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...d(this,cs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ql(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Jl&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...d(this,cs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){d(this,Oe).clear(),d(this,hs).clear()}},Oe=new WeakMap,hs=new WeakMap,cs=new WeakMap,Lr=new WeakMap,Ar=new WeakMap,us=new WeakMap,Or=new WeakMap,Ir=new WeakMap,iu);const kd=Symbol("QueryClient"),up=()=>{const e=vu(kd);if(!e)throw new Error("No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?");return e},dp=e=>{h_(kd,e)},fp=Symbol("isRestoring"),_p=()=>{try{return vu(fp)??{current:!1}}catch{return{current:!1}}};function vp(){return _p()}function pp(e){return up()}var gp=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],mp=["difference","intersection","symmetricDifference","union"],Xh=!1,Nr,ui,ds,Po,qr,xd,Ed;const Mo=class Mo extends Set{constructor(i){super();U(this,qr);U(this,Nr,new Map);U(this,ui,Z(0));U(this,ds,Z(0));U(this,Po,Ki||-1);if(i){for(var s of i)super.add(s);d(this,ds).v=super.size}Xh||ie(this,qr,Ed).call(this)}has(i){var s=super.has(i),r=d(this,Nr),n=r.get(i);if(n===void 0){if(!s)return _(d(this,ui)),!1;n=ie(this,qr,xd).call(this,!0),r.set(i,n)}return _(n),s}add(i){return super.has(i)||(super.add(i),C(d(this,ds),super.size),ms(d(this,ui))),this}delete(i){var s=super.delete(i),r=d(this,Nr),n=r.get(i);return n!==void 0&&(r.delete(i),C(n,!1)),s&&(C(d(this,ds),super.size),ms(d(this,ui))),s}clear(){if(super.size!==0){super.clear();var i=d(this,Nr);for(var s of i.values())C(s,!1);i.clear(),C(d(this,ds),0),ms(d(this,ui))}}keys(){return this.values()}values(){return _(d(this,ui)),super.values()}entries(){return _(d(this,ui)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return _(d(this,ds))}};Nr=new WeakMap,ui=new WeakMap,ds=new WeakMap,Po=new WeakMap,qr=new WeakSet,xd=function(i){return Ki===d(this,Po)?Z(i):ws(i)},Ed=function(){Xh=!0;var i=Mo.prototype,s=Set.prototype;for(const r of gp)i[r]=function(...n){return _(d(this,ui)),s[r].apply(this,n)};for(const r of mp)i[r]=function(...n){_(d(this,ui));var o=s[r].apply(this,n);return new Mo(o)}};let Xa=Mo;function Sp(e){const t=Array.isArray(e)?[]:{},i=new Xa,s=new Proxy(t,{set(n,o,a,h){if(i.delete(o),o in n)return Reflect.set(n,o,a,h);let l=Z(a);return Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get:()=>_(l)&&yp(_(l))?_(l)():_(l),set:u=>{C(l,u)}}),!0},has:(n,o)=>i.has(o)?!1:o in n,ownKeys(n){return Reflect.ownKeys(n).filter(o=>!i.has(o))},getOwnPropertyDescriptor(n,o){if(!i.has(o))return Reflect.getOwnPropertyDescriptor(n,o)},deleteProperty(n,o){return o in n?(n[o]=void 0,i.add(o),Array.isArray(n)&&n.length--,!0):!1}});function r(n){const o=Object.keys(s),a=Object.keys(n),h=o.filter(l=>!a.includes(l));for(const l of h)delete s[l];for(const l of a)s[l]=bp(()=>n[l])}return r(e),[s,r]}const Dd=Symbol("LazyValue");function bp(e){return e[Dd]=!0,e}function yp(e){return!!e[Dd]}function wp(e,t){switch(e){case"post":Zs(t);break;case"pre":N_(t);break}}const Qo=(e,t,i)=>{let s=!1,r=Array.isArray(e)?[]:void 0;wp(t,()=>{const n=Array.isArray(e)?e.map(a=>a()):e();if(!s){s=!0,r=n;return}const o=Vi(()=>i(n,r));return r=n,o})};function Cp(e,t,i){const s=he(()=>pp()),r=vp(),n=he(()=>{const u=_(s).defaultQueryOptions(e());return u._optimisticResults=r.current?"isRestoring":"optimistic",u});let o=Z(rt(new t(_(s),_(n))));Qo(()=>_(s),"pre",()=>{C(o,new t(_(s),_(n)),!0)});function a(){const u=_(o).getOptimisticResult(_(n));return _(n).notifyOnChangeProps?u:_(o).trackResult(u)}const[h,l]=Sp(a());return Zs(()=>{const u=r.current?()=>{}:_(o).subscribe(()=>l(a()));return _(o).updateResult(),u}),Qo(()=>_(n),"pre",()=>{_(o).setOptions(_(n))}),Qo(()=>[_(n),_(o)],"pre",()=>{l(a())}),h}function kp(e,t){return Cp(e,sp)}function xp(e,t){_t(t,!0);const i=id(t,"client",19,()=>new Cd);Vr(()=>{i().mount()}),dp(i()),dv(()=>{i().unmount()});var s=lr(),r=ct(s);iv(r,()=>t.children),V(e,s),vt()}function no(e){return e.split("/").filter(Boolean).pop()||e}function Qa(e){if(!e)return"";const t=Date.now(),i=new Date(e).getTime(),s=Math.floor((t-i)/1e3);if(s<60)return"just now";const r=Math.floor(s/60);if(r<60)return r+"m ago";const n=Math.floor(r/60);if(n<24)return n+"h ago";const o=Math.floor(n/24);if(o===1)return"yesterday";if(o<7)return o+"d ago";const a=new Date(e);return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a.getMonth()]+" "+a.getDate()}const di=typeof window<"u"&&"ontouchstart"in window&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);function gr(e){const t=e.firstElementChild,i=e.closest("li");if(!t||!i)return;let s=0;const r=()=>{s=e.scrollWidth-e.clientWidth,s>0?e.classList.add("has-overflow"):(e.classList.remove("has-overflow"),t.style.transform="",t.style.transition="")},n=()=>{if(s<=0)return;const h=Math.max(.6,s/80);t.style.transition=`transform ${h}s linear 0.3s`,t.style.transform=`translateX(-${s}px)`},o=()=>{if(s<=0)return;const h=Math.max(.4,s/100);t.style.transition=`transform ${h}s linear`,t.style.transform="translateX(0)"};r();const a=new ResizeObserver(r);return a.observe(e),i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",o),i.addEventListener("longpressstart",n),i.addEventListener("longpressend",o),{destroy(){a.disconnect(),i.removeEventListener("mouseenter",n),i.removeEventListener("mouseleave",o),i.removeEventListener("longpressstart",n),i.removeEventListener("longpressend",o)}}}function Ep(e){let t=null,i=null,s=!1;const r=()=>{s=!0,e.classList.add("longpress"),e.dispatchEvent(new CustomEvent("longpressstart"))},n=()=>{s=!1,e.classList.remove("longpress"),e.dispatchEvent(new CustomEvent("longpressend"))},o=()=>{i&&(clearTimeout(i),i=null),t=setTimeout(r,500)},a=()=>{t&&(clearTimeout(t),t=null)},h=()=>{t&&(clearTimeout(t),t=null),s&&(i=setTimeout(n,3e3))},l=()=>{t&&(clearTimeout(t),t=null),s&&n()};return e.addEventListener("touchstart",o,{passive:!0}),e.addEventListener("touchmove",a,{passive:!0}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",l,{passive:!0}),{destroy(){t&&clearTimeout(t),i&&clearTimeout(i),e.removeEventListener("touchstart",o),e.removeEventListener("touchmove",a),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",l)},get active(){return s}}}function Rd(e){let t;function i(r){return t=Ep(r),t}function s(){t!=null&&t.active||e()}return{action:i,handleClick:s}}var Dp=X("<span> </span>"),Rp=X('<span class="diff-add svelte-ix4pl2"> </span>'),Pp=X('<span class="diff-del svelte-ix4pl2"> </span>'),Mp=X('<span class="git-diff svelte-ix4pl2"><!> <!></span>'),Tp=X('<div class="session-row-3 svelte-ix4pl2"><span class="session-time svelte-ix4pl2"> </span> <!></div>'),Bp=X('<button class="action-pill svelte-ix4pl2" aria-label="Rename session">✎</button>'),Lp=X('<button class="action-pill action-pill--danger svelte-ix4pl2" aria-label="Kill session">×</button>'),Ap=X("<!> <!>",1),Op=X('<button class="action-pill action-pill--mono svelte-ix4pl2" aria-label="Resume in yolo mode">YOLO</button>'),Ip=X('<button class="action-pill action-pill--danger svelte-ix4pl2" aria-label="Delete worktree">🗑</button>'),Np=X("<!> <!>",1),Fp=X('<button class="action-pill action-pill--mono svelte-ix4pl2" aria-label="New worktree">+ worktree</button>'),Hp=X('<li><div class="session-info svelte-ix4pl2"><div class="session-row-1 svelte-ix4pl2"><span></span> <span class="session-name svelte-ix4pl2"><span class="session-name-text svelte-ix4pl2"> </span></span></div> <div class="session-row-2 svelte-ix4pl2"><!> <span class="session-sub svelte-ix4pl2"> </span></div> <!></div> <div class="session-actions svelte-ix4pl2"><!></div></li>');function Gn(e,t){_t(t,!0);let i=he(()=>t.variant.kind==="active"?t.variant.session.displayName||t.variant.session.repoName||t.variant.session.id:t.variant.kind==="inactive-worktree"?t.variant.worktree.displayName||t.variant.worktree.name:t.variant.repo.name),s=he(()=>t.variant.kind==="active"?t.variant.session.root?no(t.variant.session.root):"":t.variant.kind==="inactive-worktree"?t.variant.worktree.root?no(t.variant.worktree.root):"":t.variant.repo.root?no(t.variant.repo.root):t.variant.repo.path),r=he(()=>t.variant.kind==="active"?t.variant.session.repoName||"":t.variant.kind==="inactive-worktree"&&t.variant.worktree.repoName||""),n=he(()=>t.variant.kind==="active"?Qa(t.variant.session.lastActivity):t.variant.kind==="inactive-worktree"?Qa(t.variant.worktree.lastActivity):""),o=he(()=>t.variant.kind==="active"?"status-dot status-dot--"+t.variant.status:"status-dot status-dot--inactive"),a=he(()=>t.variant.kind==="active"&&t.variant.isSelected),h=he(()=>t.variant.kind==="active"),l=he(()=>t.gitStatus?t.gitStatus.prState==="open"?"○":t.gitStatus.prState==="merged"?"⬤":t.gitStatus.prState==="closed"?"⊗":"":""),u=he(()=>t.gitStatus?t.gitStatus.prState==="open"?"pr-icon pr-open":t.gitStatus.prState==="merged"?"pr-icon pr-merged":t.gitStatus.prState==="closed"?"pr-icon pr-closed":"":"");const{action:c,handleClick:f}=Rd(()=>t.onclick());function v(N){var L;N.stopPropagation(),(L=t.onkill)==null||L.call(t)}function p(N){var L;N.stopPropagation(),(L=t.onrename)==null||L.call(t)}function m(N){var L;N.stopPropagation(),(L=t.onresumeYolo)==null||L.call(t)}function g(N){var L;N.stopPropagation(),(L=t.ondelete)==null||L.call(t)}function b(N){N.stopPropagation(),t.onclick()}var P=Hp();let y;var S=R(P),x=R(S),F=R(x),W=I(F,2),z=R(W),J=R(z);vo(W,N=>gr==null?void 0:gr(N));var te=I(x,2),ee=R(te);{var K=N=>{var L=Dp(),Q=R(L);me(()=>{qe(L,1,xa(_(u)),"svelte-ix4pl2"),ge(Q,_(l))}),V(N,L)};fe(ee,N=>{_(l)&&N(K)})}var k=I(ee,2),w=R(k),E=I(te,2);{var O=N=>{var L=Tp(),Q=R(L),oe=R(Q),ae=I(Q,2);{var le=re=>{var ne=Mp(),Ae=R(ne);{var Me=ze=>{var D=Rp(),ce=R(D);me(()=>ge(ce,`+${t.gitStatus.additions??""}`)),V(ze,D)};fe(Ae,ze=>{t.gitStatus.additions&&ze(Me)})}var Fe=I(Ae,2);{var ve=ze=>{var D=Pp(),ce=R(D);me(()=>ge(ce,`-${t.gitStatus.deletions??""}`)),V(ze,D)};fe(Fe,ze=>{t.gitStatus.deletions&&ze(ve)})}V(re,ne)};fe(ae,re=>{t.gitStatus&&(t.gitStatus.additions||t.gitStatus.deletions)&&re(le)})}me(()=>ge(oe,_(n))),V(N,L)};fe(E,N=>{(_(n)||t.gitStatus&&(t.gitStatus.additions||t.gitStatus.deletions))&&N(O)})}var Y=I(S,2),H=R(Y);{var se=N=>{var L=Ap(),Q=ct(L);{var oe=re=>{var ne=Bp();$("click",ne,p),V(re,ne)};fe(Q,re=>{t.onrename&&re(oe)})}var ae=I(Q,2);{var le=re=>{var ne=Lp();$("click",ne,v),V(re,ne)};fe(ae,re=>{t.onkill&&re(le)})}V(N,L)},M=N=>{var L=Np(),Q=ct(L);{var oe=re=>{var ne=Op();$("click",ne,m),V(re,ne)};fe(Q,re=>{t.onresumeYolo&&re(oe)})}var ae=I(Q,2);{var le=re=>{var ne=Ip();$("click",ne,g),V(re,ne)};fe(ae,re=>{t.ondelete&&re(le)})}V(N,L)},B=N=>{var L=Fp();$("click",L,b),V(N,L)};fe(H,N=>{t.variant.kind==="active"?N(se):t.variant.kind==="inactive-worktree"?N(M,1):t.variant.kind==="idle-repo"&&N(B,2)})}vo(P,N=>c==null?void 0:c(N)),me(()=>{y=qe(P,1,"svelte-ix4pl2",null,y,{"active-session":_(h),"inactive-worktree":!_(h),selected:_(a)}),qe(F,1,xa(_(o)),"svelte-ix4pl2"),ge(J,_(i)),ge(w,`${_(s)??""}${_(r)?" · "+_(r):""}`)}),$("click",P,f),V(e,P),vt()}St(["click"]);var Wp=X('<option class="svelte-1o5d4l8"> </option>'),zp=X('<option class="svelte-1o5d4l8"> </option>'),Up=X('<div class="role-filter svelte-1o5d4l8"><button>All</button> <button>Author</button> <button>Reviewer</button></div>'),Kp=X('<div class="sidebar-filters svelte-1o5d4l8"><select class="svelte-1o5d4l8"><option class="svelte-1o5d4l8">All roots</option><!></select> <select><option class="svelte-1o5d4l8">All repos</option><!></select> <input type="text" placeholder="Search..." class="svelte-1o5d4l8"/> <!></div>');function qp(e,t){_t(t,!0);const i=Nn(),s=Xl();let r=he(()=>(()=>{const y=new Set;for(const S of s.sessions)S.root&&y.add(S.root);for(const S of s.worktrees)S.root&&y.add(S.root);return[...y].sort()})()),n=he(()=>(()=>{const y=new Set;for(const S of s.sessions)(!i.rootFilter||S.root===i.rootFilter)&&S.repoName&&y.add(S.repoName);for(const S of s.worktrees)(!i.rootFilter||S.root===i.rootFilter)&&S.repoName&&y.add(S.repoName);return[...y].sort()})());var o=Kp(),a=R(o),h=R(a);h.value=h.__value="";var l=I(h);Ht(l,17,()=>_(r),Ch,(y,S)=>{var x=Wp(),F=R(x),W={};me(z=>{ge(F,z),W!==(W=_(S))&&(x.value=(x.__value=_(S))??"")},[()=>no(_(S))]),V(y,x)});var u;Ea(a);var c=I(a,2);let f;var v=R(c);v.value=v.__value="";var p=I(v);Ht(p,17,()=>_(n),Ch,(y,S)=>{var x=zp(),F=R(x),W={};me(()=>{ge(F,_(S)),W!==(W=_(S))&&(x.value=(x.__value=_(S))??"")}),V(y,x)});var m;Ea(c);var g=I(c,2),b=I(g,2);{var P=y=>{var S=Up(),x=R(S);let F;var W=I(x,2);let z;var J=I(W,2);let te;me(()=>{F=qe(x,1,"role-btn svelte-1o5d4l8",null,F,{active:i.prRoleFilter==="all"}),z=qe(W,1,"role-btn svelte-1o5d4l8",null,z,{active:i.prRoleFilter==="author"}),te=qe(J,1,"role-btn svelte-1o5d4l8",null,te,{active:i.prRoleFilter==="reviewer"})}),$("click",x,()=>{i.prRoleFilter="all"}),$("click",W,()=>{i.prRoleFilter="author"}),$("click",J,()=>{i.prRoleFilter="reviewer"}),V(y,S)};fe(b,y=>{i.activeTab==="prs"&&y(P)})}me(()=>{u!==(u=i.rootFilter)&&(a.value=(a.__value=i.rootFilter)??"",po(a,i.rootFilter)),f=qe(c,1,"svelte-1o5d4l8",null,f,{highlight:i.activeTab==="prs"&&!i.repoFilter}),m!==(m=i.repoFilter)&&(c.value=(c.__value=i.repoFilter)??"",po(c,i.repoFilter)),hv(g,i.searchFilter)}),$("change",a,y=>{i.rootFilter=y.target.value,i.repoFilter=""}),$("change",c,y=>{i.repoFilter=y.target.value}),$("input",g,y=>{i.searchFilter=y.target.value}),V(e,o),vt()}St(["change","input","click"]);var jp=X('<span class="diff-add svelte-jhsg4e"> </span>'),Vp=X('<span class="diff-del svelte-jhsg4e"> </span>'),Yp=X('<span class="git-diff svelte-jhsg4e"><!> <!></span>'),Gp=X('<div class="pr-row-3 svelte-jhsg4e"><span class="pr-time svelte-jhsg4e"> </span> <!></div>'),Xp=X("<span> </span>"),Qp=X('<li><div class="pr-info svelte-jhsg4e"><div class="pr-row-1 svelte-jhsg4e"><span> </span> <span class="pr-title svelte-jhsg4e"><span class="pr-title-text svelte-jhsg4e"> </span></span></div> <div class="pr-row-2 svelte-jhsg4e"><span class="pr-meta svelte-jhsg4e"> </span> <span> </span></div> <!></div> <div class="pr-actions svelte-jhsg4e"><!> <button class="external-link-btn svelte-jhsg4e" aria-label="Open in GitHub">↗</button></div></li>');function Jp(e,t){_t(t,!0);let i=he(()=>t.pr.state==="OPEN"?"○":t.pr.state==="MERGED"?"⬤":"⊗"),s=he(()=>t.pr.state==="OPEN"?"pr-state pr-open":t.pr.state==="MERGED"?"pr-state pr-merged":"pr-state pr-closed"),r=he(()=>t.pr.role==="author"?"Author":"Reviewer"),n=he(()=>t.pr.reviewDecision==="APPROVED"?"✓":t.pr.reviewDecision==="CHANGES_REQUESTED"?"✗":t.pr.reviewDecision==="REVIEW_REQUIRED"?"⏳":""),o=he(()=>t.pr.reviewDecision==="APPROVED"?"review-approved":t.pr.reviewDecision==="CHANGES_REQUESTED"?"review-changes":"review-pending"),a=he(()=>Qa(t.pr.updatedAt));const{action:h,handleClick:l}=Rd(()=>t.onclick());function u(E){E.stopPropagation(),window.open(t.pr.url,"_blank","noopener")}var c=Qp();let f;var v=R(c),p=R(v),m=R(p),g=R(m),b=I(m,2),P=R(b),y=R(P);vo(b,E=>gr==null?void 0:gr(E));var S=I(p,2),x=R(S),F=R(x),W=I(x,2),z=R(W),J=I(S,2);{var te=E=>{var O=Gp(),Y=R(O),H=R(Y),se=I(Y,2);{var M=B=>{var N=Yp(),L=R(N);{var Q=le=>{var re=jp(),ne=R(re);me(()=>ge(ne,`+${t.pr.additions??""}`)),V(le,re)};fe(L,le=>{t.pr.additions&&le(Q)})}var oe=I(L,2);{var ae=le=>{var re=Vp(),ne=R(re);me(()=>ge(ne,`-${t.pr.deletions??""}`)),V(le,re)};fe(oe,le=>{t.pr.deletions&&le(ae)})}V(B,N)};fe(se,B=>{(t.pr.additions||t.pr.deletions)&&B(M)})}me(()=>ge(H,_(a))),V(E,O)};fe(J,E=>{(_(a)||t.pr.additions||t.pr.deletions)&&E(te)})}var ee=I(v,2),K=R(ee);{var k=E=>{var O=Xp(),Y=R(O);me(()=>{qe(O,1,`review-badge ${_(o)??""}`,"svelte-jhsg4e"),qi(O,"title",t.pr.reviewDecision??""),ge(Y,_(n))}),V(E,O)};fe(K,E=>{_(n)&&E(k)})}var w=I(K,2);vo(c,E=>h==null?void 0:h(E)),me(()=>{f=qe(c,1,"pr-item svelte-jhsg4e",null,f,{"active-session":t.isActiveSession}),qe(m,1,xa(_(s)),"svelte-jhsg4e"),ge(g,_(i)),ge(y,t.pr.title),ge(F,`#${t.pr.number??""} · ${t.pr.author??""}`),qe(W,1,`role-badge role-${t.pr.role??""}`,"svelte-jhsg4e"),ge(z,_(r))}),$("click",c,l),$("click",w,u),V(e,c),vt()}St(["click"]);var Zp=X('<li class="session-divider">Available</li>'),$p=X("<!> <!> <!>",1),eg=X('<li class="session-divider">Available</li>'),tg=X("<!> <!> <!>",1),ig=X('<div class="pr-toolbar svelte-ynafm7"><button class="refresh-btn svelte-ynafm7" aria-label="Refresh pull requests"><span>↻</span></button></div>'),sg=X('<li class="pr-hint">Select a repo to view pull requests</li>'),rg=X('<li class="pr-hint">Loading pull requests...</li>'),ng=X('<li class="pr-hint">GitHub CLI not authenticated<br/><span class="pr-hint-sub">Run <code>gh auth login</code> on the host</span></li>'),og=X('<li class="pr-hint">Could not fetch pull requests</li>'),ag=X('<li class="pr-hint">No open pull requests</li>'),lg=X("<!> <!>",1),hg=X('<div class="session-list-tabs svelte-ynafm7"><button>Repos <span class="tab-count svelte-ynafm7"> </span></button> <button>Worktrees <span class="tab-count svelte-ynafm7"> </span></button> <button>PRs <span class="tab-count svelte-ynafm7"> </span></button></div> <!> <ul class="session-list svelte-ynafm7"><!></ul>',1);function cg(e,t){_t(t,!0);const i=Nn(),s=Xl();let r=null,n=he(()=>s.sessions.filter(D=>D.type==="repo")),o=he(()=>s.sessions.filter(D=>D.type!=="repo")),a=he(()=>new Set(_(n).map(D=>D.repoPath))),h=he(()=>new Set(_(o).map(D=>D.repoPath).filter(Boolean)));function l(D,ce,je){return!(i.rootFilter&&D!==i.rootFilter||i.repoFilter&&ce!==i.repoFilter||i.searchFilter&&je.toLowerCase().indexOf(i.searchFilter.toLowerCase())===-1)}let u=he(()=>_(n).filter(D=>l(D.root,D.repoName,D.displayName||D.repoName||D.id))),c=he(()=>s.repos.filter(D=>!_(a).has(D.path)&&l(D.root,D.name,D.name)).sort((D,ce)=>(D.name||"").localeCompare(ce.name||""))),f=he(()=>_(o).filter(D=>l(D.root,D.repoName,D.displayName||D.repoName||D.worktreeName||D.id))),v=he(()=>s.worktrees.filter(D=>!_(h).has(D.path)&&l(D.root,D.repoName,D.name)).sort((D,ce)=>(D.name||"").localeCompare(ce.name||""))),p=he(()=>(()=>{if(i.activeTab!=="prs"||!i.repoFilter)return null;const D=s.repos.find(ce=>ce.name===i.repoFilter);return(D==null?void 0:D.path)??null})());const m=kp(()=>({queryKey:["pull-requests",_(p)],queryFn:()=>_(p)?yv(_(p)):Promise.resolve({prs:[]}),enabled:!!_(p)}));let g=he(()=>m.data),b=he(()=>{var D;return((D=_(g))==null?void 0:D.error)??null}),P=he(()=>{var D;return((D=_(g))==null?void 0:D.prs)??[]}),y=he(()=>_(P).filter(D=>!(i.prRoleFilter!=="all"&&D.role!==i.prRoleFilter||i.searchFilter&&D.title.toLowerCase().indexOf(i.searchFilter.toLowerCase())===-1))),S=he(()=>_(u).length+_(c).length),x=he(()=>_(f).length+_(v).length),F=he(()=>_(y).length);function W(D){return s.sessions.find(ce=>ce.type==="worktree"&&ce.worktreeName===D)}function z(D){return s.worktrees.find(ce=>ce.name===D)}async function J(D){const ce=W(D.headRefName);if(ce){Aa(ce.id),t.onSelectSession(ce.id);return}const je=z(D.headRefName);if(je){try{const Ve=await ro({repoPath:je.repoPath,repoName:je.repoName,worktreePath:je.path});await Wt(),Ve!=null&&Ve.id&&t.onSelectSession(Ve.id)}catch{}return}const xt=s.repos.find(Ve=>Ve.name===i.repoFilter);if(xt)try{const Ve=await ro({repoPath:xt.path,repoName:xt.name,branchName:D.headRefName});await Wt(),Ve!=null&&Ve.id&&t.onSelectSession(Ve.id)}catch{}}async function te(D){await Cv(D.id),await Wt(),s.activeSessionId===D.id&&(s.activeSessionId=null)}async function ee(D){const ce=prompt("Rename session:",D.displayName||D.repoName||D.id);ce&&ce.trim()&&ce.trim()!==(D.displayName||D.repoName||D.id)&&(await kv(D.id,ce.trim()),await Wt())}function K(D){Aa(D.id),t.onSelectSession(D.id)}async function k(D){if(!r){r=D.path;try{const ce=await ro({repoPath:D.repoPath,repoName:D.repoName,worktreePath:D.path});await Wt(),ce!=null&&ce.id&&t.onSelectSession(ce.id)}catch{}finally{r=null}}}function w(D){t.onOpenNewSession(D)}var E=hg(),O=ct(E),Y=R(O);let H;var se=I(R(Y)),M=R(se),B=I(Y,2);let N;var L=I(R(B)),Q=R(L),oe=I(B,2);let ae;var le=I(R(oe)),re=R(le),ne=I(O,2);qp(ne,{});var Ae=I(ne,2),Me=R(Ae);{var Fe=D=>{var ce=$p(),je=ct(ce);Ht(je,17,()=>_(u),Re=>Re.id,(Re,ye)=>{{let Kt=he(()=>({kind:"active",session:_(ye),status:Ih(_(ye)),isSelected:s.activeSessionId===_(ye).id}));Gn(Re,{get variant(){return _(Kt)},get gitStatus(){return s.gitStatuses[_(ye).repoPath+":"+_(ye).worktreeName]},onclick:()=>K(_(ye)),onkill:()=>te(_(ye)),onrename:()=>ee(_(ye))})}});var xt=I(je,2);{var Ve=Re=>{var ye=Zp();V(Re,ye)};fe(xt,Re=>{_(u).length>0&&_(c).length>0&&Re(Ve)})}var ks=I(xt,2);Ht(ks,17,()=>_(c),Re=>Re.path,(Re,ye)=>{{let Kt=he(()=>({kind:"idle-repo",repo:_(ye)}));Gn(Re,{get variant(){return _(Kt)},onclick:()=>w(_(ye))})}}),V(D,ce)},ve=D=>{var ce=tg(),je=ct(ce);Ht(je,17,()=>_(f),Re=>Re.id,(Re,ye)=>{{let Kt=he(()=>({kind:"active",session:_(ye),status:Ih(_(ye)),isSelected:s.activeSessionId===_(ye).id}));Gn(Re,{get variant(){return _(Kt)},get gitStatus(){return s.gitStatuses[_(ye).repoPath+":"+_(ye).worktreeName]},onclick:()=>K(_(ye)),onkill:()=>te(_(ye)),onrename:()=>ee(_(ye))})}});var xt=I(je,2);{var Ve=Re=>{var ye=eg();V(Re,ye)};fe(xt,Re=>{_(f).length>0&&_(v).length>0&&Re(Ve)})}var ks=I(xt,2);Ht(ks,17,()=>_(v),Re=>Re.path,(Re,ye)=>{{let Kt=he(()=>({kind:"inactive-worktree",worktree:_(ye)}));Gn(Re,{get variant(){return _(Kt)},get gitStatus(){return s.gitStatuses[_(ye).repoPath+":"+_(ye).name]},onclick:()=>k(_(ye)),onresumeYolo:()=>t.onResumeYolo(_(ye)),ondelete:()=>t.onDeleteWorktree(_(ye))})}}),V(D,ce)},ze=D=>{var ce=lg(),je=ct(ce);{var xt=j=>{var ue=ig(),xe=R(ue),Ye=R(xe);let Ee;me(()=>{xe.disabled=m.isFetching,Ee=qe(Ye,1,"svelte-ynafm7",null,Ee,{spinning:m.isFetching})}),$("click",xe,()=>m.refetch()),V(j,ue)};fe(je,j=>{i.repoFilter&&j(xt)})}var Ve=I(je,2);{var ks=j=>{var ue=sg();V(j,ue)},Re=j=>{var ue=rg();V(j,ue)},ye=j=>{var ue=ng();V(j,ue)},Kt=j=>{var ue=og();V(j,ue)},Xr=j=>{var ue=ag();V(j,ue)},zo=j=>{var ue=lr(),xe=ct(ue);Ht(xe,17,()=>_(y),Ye=>Ye.number,(Ye,Ee)=>{{let Xi=he(()=>!!W(_(Ee).headRefName));Jp(Ye,{get pr(){return _(Ee)},get isActiveSession(){return _(Xi)},onclick:()=>J(_(Ee))})}}),V(j,ue)};fe(Ve,j=>{i.repoFilter?m.isLoading?j(Re,1):_(b)==="gh_not_authenticated"?j(ye,2):_(b)?j(Kt,3):_(y).length===0?j(Xr,4):j(zo,!1):j(ks)})}V(D,ce)};fe(Me,D=>{i.activeTab==="repos"?D(Fe):i.activeTab==="worktrees"?D(ve,1):D(ze,!1)})}me(()=>{H=qe(Y,1,"sidebar-tab svelte-ynafm7",null,H,{active:i.activeTab==="repos"}),ge(M,_(S)),N=qe(B,1,"sidebar-tab svelte-ynafm7",null,N,{active:i.activeTab==="worktrees"}),ge(Q,_(x)),ae=qe(oe,1,"sidebar-tab svelte-ynafm7",null,ae,{active:i.activeTab==="prs"}),ge(re,_(F))}),$("click",Y,()=>{i.activeTab="repos"}),$("click",B,()=>{i.activeTab="worktrees"}),$("click",oe,()=>{i.activeTab="prs"}),V(e,E),vt()}St(["click"]);var ug=X('<span class="sidebar-label svelte-owj5vn">Sessions</span>'),dg=X('<!> <button class="new-session-btn svelte-owj5vn"> </button> <button class="settings-btn svelte-owj5vn">⚙ Settings</button> <div class="resize-handle svelte-owj5vn"></div>',1),fg=X('<aside><div class="sidebar-header svelte-owj5vn"><button class="collapse-btn svelte-owj5vn"> </button> <!> <button class="icon-btn svelte-owj5vn" aria-label="Close sidebar">✕</button></div> <!></aside>');function _g(e,t){_t(t,!0);const i=Nn();let s=he(()=>i.activeTab==="worktrees"?"+ New Worktree":"+ New Session"),r=he(()=>i.sidebarCollapsed?Lv:i.sidebarWidth);function n(P){P.preventDefault();const y=P.clientX,S=i.sidebarWidth,x=W=>{const z=Math.min(hd,Math.max(ld,S+(W.clientX-y)));i.sidebarWidth=z},F=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",F),document.body.style.cursor="",document.body.style.userSelect="",Oh()};document.addEventListener("mousemove",x),document.addEventListener("mouseup",F),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}function o(P){P.preventDefault(),i.sidebarWidth=ad,Oh()}var a=fg();let h,l;var u=R(a),c=R(u),f=R(c),v=I(c,2);{var p=P=>{var y=ug();V(P,y)};fe(v,P=>{i.sidebarCollapsed||P(p)})}var m=I(v,2),g=I(u,2);{var b=P=>{var y=dg(),S=ct(y);cg(S,{get onSelectSession(){return t.onSelectSession},get onOpenNewSession(){return t.onOpenNewSession},get onResumeYolo(){return t.onResumeYolo},get onDeleteWorktree(){return t.onDeleteWorktree}});var x=I(S,2),F=R(x),W=I(x,2),z=I(W,2);me(()=>ge(F,_(s))),$("click",x,()=>t.onOpenNewSession()),$("click",W,function(...J){var te;(te=t.onOpenSettings)==null||te.apply(this,J)}),$("mousedown",z,n),$("dblclick",z,o),V(P,y)};fe(g,P=>{i.sidebarCollapsed||P(b)})}me(()=>{h=qe(a,1,"sidebar svelte-owj5vn",null,h,{open:i.sidebarOpen,collapsed:i.sidebarCollapsed}),l=Yl(a,"",l,{width:`${_(r)??""}px`,"min-width":`${_(r)??""}px`}),qi(c,"aria-label",i.sidebarCollapsed?"Expand sidebar":"Collapse sidebar"),ge(f,i.sidebarCollapsed?"»":"«")}),$("click",c,function(...P){Go==null||Go.apply(this,P)}),$("click",m,function(...P){is==null||is.apply(this,P)}),V(e,a),vt()}St(["click","mousedown","dblclick"]);/**
|
|
10
|
+
`),s();return}t.clear(),fd(e,t,i,s)}catch{_d(e,t,i,s)}},r)}function Yt(e){wt&&wt.readyState===WebSocket.OPEN&&wt.send(e)}function Fh(e,t){wt&&wt.readyState===WebSocket.OPEN&&wt.send(JSON.stringify({type:"resize",cols:e,rows:t}))}function ur(){return wt!==null&&wt.readyState===WebSocket.OPEN}var Hv=X('<p class="error svelte-1qp96yb"> </p>'),Wv=X('<div class="pin-gate svelte-1qp96yb"><div class="pin-container svelte-1qp96yb"><h1 class="svelte-1qp96yb">Claude Remote CLI</h1> <p class="svelte-1qp96yb">Enter PIN to continue</p> <input type="password" inputmode="numeric" maxlength="20" placeholder="PIN" class="svelte-1qp96yb"/> <button class="svelte-1qp96yb">Unlock</button> <!></div></div>');function zv(e,t){_t(t,!0);const i=rd();let s=Z("");async function r(){const f=_(s).trim();f&&(await Bv(f),i.pinError&&C(s,""))}function n(f){f.key==="Enter"&&r()}var o=Wv(),a=R(o),h=I(R(a),4);A_(h);var l=I(h,2),u=I(l,2);{var c=f=>{var v=Hv(),p=R(v);me(()=>ge(p,i.pinError)),V(f,v)};fe(u,f=>{i.pinError&&f(c)})}$("keydown",h,n),go(h,()=>_(s),f=>C(s,f)),$("click",l,r),V(e,o),vt()}St(["keydown","click"]);var Fn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Uv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rs,Ol,Yc,Kv=(Yc=class{constructor(){U(this,rs,Uv);U(this,Ol,!1)}setTimeoutProvider(e){A(this,rs,e)}setTimeout(e,t){return d(this,rs).setTimeout(e,t)}clearTimeout(e){d(this,rs).clearTimeout(e)}setInterval(e,t){return d(this,rs).setInterval(e,t)}clearInterval(e){d(this,rs).clearInterval(e)}},rs=new WeakMap,Ol=new WeakMap,Yc),As=new Kv;function qv(e){setTimeout(e,0)}var Ur=typeof window>"u"||"Deno"in globalThis;function Qt(){}function jv(e,t){return typeof e=="function"?e(t):e}function Oa(e){return typeof e=="number"&&e>=0&&e!==1/0}function vd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function bs(e,t){return typeof e=="function"?e(t):e}function Zt(e,t){return typeof e=="function"?e(t):e}function Hh(e,t){const{type:i="all",exact:s,fetchStatus:r,predicate:n,queryKey:o,stale:a}=e;if(o){if(s){if(t.queryHash!==Ql(o,t.options))return!1}else if(!bn(t.queryKey,o))return!1}if(i!=="all"){const h=t.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||r&&r!==t.state.fetchStatus||n&&!n(t))}function Wh(e,t){const{exact:i,status:s,predicate:r,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(i){if(Sn(t.options.mutationKey)!==Sn(n))return!1}else if(!bn(t.options.mutationKey,n))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function Ql(e,t){return((t==null?void 0:t.queryKeyHashFn)||Sn)(e)}function Sn(e){return JSON.stringify(e,(t,i)=>Na(i)?Object.keys(i).sort().reduce((s,r)=>(s[r]=i[r],s),{}):i)}function bn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(i=>bn(e[i],t[i])):!1}var Vv=Object.prototype.hasOwnProperty;function pd(e,t,i=0){if(e===t)return e;if(i>500)return t;const s=zh(e)&&zh(t);if(!s&&!(Na(e)&&Na(t)))return t;const n=(s?e:Object.keys(e)).length,o=s?t:Object.keys(t),a=o.length,h=s?new Array(a):{};let l=0;for(let u=0;u<a;u++){const c=s?u:o[u],f=e[c],v=t[c];if(f===v){h[c]=f,(s?u<n:Vv.call(e,c))&&l++;continue}if(f===null||v===null||typeof f!="object"||typeof v!="object"){h[c]=v;continue}const p=pd(f,v,i+1);h[c]=p,p===f&&l++}return n===a&&l===n?e:h}function Ia(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}function zh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Na(e){if(!Uh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!Uh(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Uh(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yv(e){return new Promise(t=>{As.setTimeout(t,e)})}function Fa(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?pd(e,t):t}function Gv(e,t,i=0){const s=[...e,t];return i&&s.length>i?s.slice(1):s}function Xv(e,t,i=0){const s=[t,...e];return i&&s.length>i?s.slice(0,-1):s}var Jl=Symbol();function gd(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Jl?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qv(e,t,i){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?i():r.addEventListener("abort",i,{once:!0})),r)}),e}var zs,ns,xr,Gc,Jv=(Gc=class extends Fn{constructor(){super();U(this,zs);U(this,ns);U(this,xr);A(this,xr,t=>{if(!Ur&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){d(this,ns)||this.setEventListener(d(this,xr))}onUnsubscribe(){var t;this.hasListeners()||((t=d(this,ns))==null||t.call(this),A(this,ns,void 0))}setEventListener(t){var i;A(this,xr,t),(i=d(this,ns))==null||i.call(this),A(this,ns,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){d(this,zs)!==t&&(A(this,zs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof d(this,zs)=="boolean"?d(this,zs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zs=new WeakMap,ns=new WeakMap,xr=new WeakMap,Gc),Zl=new Jv;function Ha(){let e,t;const i=new Promise((r,n)=>{e=r,t=n});i.status="pending",i.catch(()=>{});function s(r){Object.assign(i,r),delete i.resolve,delete i.reject}return i.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},i.reject=r=>{s({status:"rejected",reason:r}),t(r)},i}var Zv=qv;function $v(){let e=[],t=0,i=a=>{a()},s=a=>{a()},r=Zv;const n=a=>{t?e.push(a):r(()=>{i(a)})},o=()=>{const a=e;e=[],a.length&&r(()=>{s(()=>{a.forEach(h=>{i(h)})})})};return{batch:a=>{let h;t++;try{h=a()}finally{t--,t||o()}return h},batchCalls:a=>(...h)=>{n(()=>{a(...h)})},schedule:n,setNotifyFunction:a=>{i=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{r=a}}}var mt=$v(),Er,os,Dr,Xc,ep=(Xc=class extends Fn{constructor(){super();U(this,Er,!0);U(this,os);U(this,Dr);A(this,Dr,t=>{if(!Ur&&window.addEventListener){const i=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",s)}}})}onSubscribe(){d(this,os)||this.setEventListener(d(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=d(this,os))==null||t.call(this),A(this,os,void 0))}setEventListener(t){var i;A(this,Dr,t),(i=d(this,os))==null||i.call(this),A(this,os,t(this.setOnline.bind(this)))}setOnline(t){d(this,Er)!==t&&(A(this,Er,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return d(this,Er)}},Er=new WeakMap,os=new WeakMap,Dr=new WeakMap,Xc),bo=new ep;function tp(e){return Math.min(1e3*2**e,3e4)}function md(e){return(e??"online")==="online"?bo.isOnline():!0}var Wa=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sd(e){let t=!1,i=0,s;const r=Ha(),n=()=>r.status!=="pending",o=m=>{var g;if(!n()){const b=new Wa(m);f(b),(g=e.onCancel)==null||g.call(e,b)}},a=()=>{t=!0},h=()=>{t=!1},l=()=>Zl.isFocused()&&(e.networkMode==="always"||bo.isOnline())&&e.canRun(),u=()=>md(e.networkMode)&&e.canRun(),c=m=>{n()||(s==null||s(),r.resolve(m))},f=m=>{n()||(s==null||s(),r.reject(m))},v=()=>new Promise(m=>{var g;s=b=>{(n()||l())&&m(b)},(g=e.onPause)==null||g.call(e)}).then(()=>{var m;s=void 0,n()||(m=e.onContinue)==null||m.call(e)}),p=()=>{if(n())return;let m;const g=i===0?e.initialPromise:void 0;try{m=g??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(c).catch(b=>{var F;if(n())return;const P=e.retry??(Ur?0:3),y=e.retryDelay??tp,S=typeof y=="function"?y(i,b):y,x=P===!0||typeof P=="number"&&i<P||typeof P=="function"&&P(i,b);if(t||!x){f(b);return}i++,(F=e.onFail)==null||F.call(e,i,b),Yv(S).then(()=>l()?void 0:v()).then(()=>{t?f(b):p()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(s==null||s(),r),cancelRetry:a,continueRetry:h,canStart:u,start:()=>(u()?p():v().then(p),r)}}var Us,Qc,bd=(Qc=class{constructor(){U(this,Us)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Oa(this.gcTime)&&A(this,Us,As.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ur?1/0:300*1e3))}clearGcTimeout(){d(this,Us)&&(As.clearTimeout(d(this,Us)),A(this,Us,void 0))}},Us=new WeakMap,Qc),Ks,Rr,Xt,qs,$e,Rn,js,hi,Ai,Jc,ip=(Jc=class extends bd{constructor(t){super();U(this,hi);U(this,Ks);U(this,Rr);U(this,Xt);U(this,qs);U(this,$e);U(this,Rn);U(this,js);A(this,js,!1),A(this,Rn,t.defaultOptions),this.setOptions(t.options),this.observers=[],A(this,qs,t.client),A(this,Xt,d(this,qs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,A(this,Ks,qh(this.options)),this.state=t.state??d(this,Ks),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=d(this,$e))==null?void 0:t.promise}setOptions(t){if(this.options={...d(this,Rn),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=qh(this.options);i.data!==void 0&&(this.setState(Kh(i.data,i.dataUpdatedAt)),A(this,Ks,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&d(this,Xt).remove(this)}setData(t,i){const s=Fa(this.state.data,t,this.options);return ie(this,hi,Ai).call(this,{data:s,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),s}setState(t,i){ie(this,hi,Ai).call(this,{type:"setState",state:t,setStateOptions:i})}cancel(t){var s,r;const i=(s=d(this,$e))==null?void 0:s.promise;return(r=d(this,$e))==null||r.cancel(t),i?i.then(Qt).catch(Qt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(d(this,Ks))}isActive(){return this.observers.some(t=>Zt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jl||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>bs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!vd(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=d(this,$e))==null||i.continue()}onOnline(){var i;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=d(this,$e))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),d(this,Xt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(d(this,$e)&&(d(this,js)?d(this,$e).cancel({revert:!0}):d(this,$e).cancelRetry()),this.scheduleGc()),d(this,Xt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ie(this,hi,Ai).call(this,{type:"invalidate"})}async fetch(t,i){var h,l,u,c,f,v,p,m,g,b,P,y;if(this.state.fetchStatus!=="idle"&&((h=d(this,$e))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(d(this,$e))return d(this,$e).continueRetry(),d(this,$e).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(x=>x.options.queryFn);S&&this.setOptions(S.options)}const s=new AbortController,r=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(A(this,js,!0),s.signal)})},n=()=>{const S=gd(this.options,i),F=(()=>{const W={client:d(this,qs),queryKey:this.queryKey,meta:this.meta};return r(W),W})();return A(this,js,!1),this.options.persister?this.options.persister(S,F,this):S(F)},a=(()=>{const S={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:d(this,qs),state:this.state,fetchFn:n};return r(S),S})();(l=this.options.behavior)==null||l.onFetch(a,this),A(this,Rr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&ie(this,hi,Ai).call(this,{type:"fetch",meta:(c=a.fetchOptions)==null?void 0:c.meta}),A(this,$e,Sd({initialPromise:i==null?void 0:i.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof Wa&&S.revert&&this.setState({...d(this,Rr),fetchStatus:"idle"}),s.abort()},onFail:(S,x)=>{ie(this,hi,Ai).call(this,{type:"failed",failureCount:S,error:x})},onPause:()=>{ie(this,hi,Ai).call(this,{type:"pause"})},onContinue:()=>{ie(this,hi,Ai).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await d(this,$e).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(v=(f=d(this,Xt).config).onSuccess)==null||v.call(f,S,this),(m=(p=d(this,Xt).config).onSettled)==null||m.call(p,S,this.state.error,this),S}catch(S){if(S instanceof Wa){if(S.silent)return d(this,$e).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw ie(this,hi,Ai).call(this,{type:"error",error:S}),(b=(g=d(this,Xt).config).onError)==null||b.call(g,S,this),(y=(P=d(this,Xt).config).onSettled)==null||y.call(P,this.state.data,S,this),S}finally{this.scheduleGc()}}},Ks=new WeakMap,Rr=new WeakMap,Xt=new WeakMap,qs=new WeakMap,$e=new WeakMap,Rn=new WeakMap,js=new WeakMap,hi=new WeakSet,Ai=function(t){const i=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...yd(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...Kh(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return A(this,Rr,t.manual?r:void 0),r;case"error":const n=t.error;return{...s,error:n,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=i(this.state),mt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),d(this,Xt).notify({query:this,type:"updated",action:t})})},Jc);function yd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:md(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,i=t!==void 0,s=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:i?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var Rt,we,Pn,yt,Vs,Pr,Fi,as,Mn,Mr,Tr,Ys,Gs,ls,Br,ke,an,za,Ua,Ka,qa,ja,Va,Ya,wd,Zc,sp=(Zc=class extends Fn{constructor(t,i){super();U(this,ke);U(this,Rt);U(this,we);U(this,Pn);U(this,yt);U(this,Vs);U(this,Pr);U(this,Fi);U(this,as);U(this,Mn);U(this,Mr);U(this,Tr);U(this,Ys);U(this,Gs);U(this,ls);U(this,Br,new Set);this.options=i,A(this,Rt,t),A(this,as,null),A(this,Fi,Ha()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(d(this,we).addObserver(this),jh(d(this,we),this.options)?ie(this,ke,an).call(this):this.updateResult(),ie(this,ke,qa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ga(d(this,we),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ga(d(this,we),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ie(this,ke,ja).call(this),ie(this,ke,Va).call(this),d(this,we).removeObserver(this)}setOptions(t){const i=this.options,s=d(this,we);if(this.options=d(this,Rt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zt(this.options.enabled,d(this,we))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ie(this,ke,Ya).call(this),d(this,we).setOptions(this.options),i._defaulted&&!Ia(this.options,i)&&d(this,Rt).getQueryCache().notify({type:"observerOptionsUpdated",query:d(this,we),observer:this});const r=this.hasListeners();r&&Vh(d(this,we),s,this.options,i)&&ie(this,ke,an).call(this),this.updateResult(),r&&(d(this,we)!==s||Zt(this.options.enabled,d(this,we))!==Zt(i.enabled,d(this,we))||bs(this.options.staleTime,d(this,we))!==bs(i.staleTime,d(this,we)))&&ie(this,ke,za).call(this);const n=ie(this,ke,Ua).call(this);r&&(d(this,we)!==s||Zt(this.options.enabled,d(this,we))!==Zt(i.enabled,d(this,we))||n!==d(this,ls))&&ie(this,ke,Ka).call(this,n)}getOptimisticResult(t){const i=d(this,Rt).getQueryCache().build(d(this,Rt),t),s=this.createResult(i,t);return np(this,s)&&(A(this,yt,s),A(this,Pr,this.options),A(this,Vs,d(this,we).state)),s}getCurrentResult(){return d(this,yt)}trackResult(t,i){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),i==null||i(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&d(this,Fi).status==="pending"&&d(this,Fi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){d(this,Br).add(t)}getCurrentQuery(){return d(this,we)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=d(this,Rt).defaultQueryOptions(t),s=d(this,Rt).getQueryCache().build(d(this,Rt),i);return s.fetch().then(()=>this.createResult(s,i))}fetch(t){return ie(this,ke,an).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),d(this,yt)))}createResult(t,i){var J;const s=d(this,we),r=this.options,n=d(this,yt),o=d(this,Vs),a=d(this,Pr),l=t!==s?t.state:d(this,Pn),{state:u}=t;let c={...u},f=!1,v;if(i._optimisticResults){const te=this.hasListeners(),ee=!te&&jh(t,i),K=te&&Vh(t,s,i,r);(ee||K)&&(c={...c,...yd(u.data,t.options)}),i._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:g}=c;v=c.data;let b=!1;if(i.placeholderData!==void 0&&v===void 0&&g==="pending"){let te;n!=null&&n.isPlaceholderData&&i.placeholderData===(a==null?void 0:a.placeholderData)?(te=n.data,b=!0):te=typeof i.placeholderData=="function"?i.placeholderData((J=d(this,Tr))==null?void 0:J.state.data,d(this,Tr)):i.placeholderData,te!==void 0&&(g="success",v=Fa(n==null?void 0:n.data,te,i),f=!0)}if(i.select&&v!==void 0&&!b)if(n&&v===(o==null?void 0:o.data)&&i.select===d(this,Mn))v=d(this,Mr);else try{A(this,Mn,i.select),v=i.select(v),v=Fa(n==null?void 0:n.data,v,i),A(this,Mr,v),A(this,as,null)}catch(te){A(this,as,te)}d(this,as)&&(p=d(this,as),v=d(this,Mr),m=Date.now(),g="error");const P=c.fetchStatus==="fetching",y=g==="pending",S=g==="error",x=y&&P,F=v!==void 0,z={status:g,fetchStatus:c.fetchStatus,isPending:y,isSuccess:g==="success",isError:S,isInitialLoading:x,isLoading:x,data:v,dataUpdatedAt:c.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:P,isRefetching:P&&!y,isLoadingError:S&&!F,isPaused:c.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&F,isStale:$l(t,i),refetch:this.refetch,promise:d(this,Fi),isEnabled:Zt(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const te=z.data!==void 0,ee=z.status==="error"&&!te,K=E=>{ee?E.reject(z.error):te&&E.resolve(z.data)},k=()=>{const E=A(this,Fi,z.promise=Ha());K(E)},w=d(this,Fi);switch(w.status){case"pending":t.queryHash===s.queryHash&&K(w);break;case"fulfilled":(ee||z.data!==w.value)&&k();break;case"rejected":(!ee||z.error!==w.reason)&&k();break}}return z}updateResult(){const t=d(this,yt),i=this.createResult(d(this,we),this.options);if(A(this,Vs,d(this,we).state),A(this,Pr,this.options),d(this,Vs).data!==void 0&&A(this,Tr,d(this,we)),Ia(i,t))return;A(this,yt,i);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,n=typeof r=="function"?r():r;if(n==="all"||!n&&!d(this,Br).size)return!0;const o=new Set(n??d(this,Br));return this.options.throwOnError&&o.add("error"),Object.keys(d(this,yt)).some(a=>{const h=a;return d(this,yt)[h]!==t[h]&&o.has(h)})};ie(this,ke,wd).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ie(this,ke,qa).call(this)}},Rt=new WeakMap,we=new WeakMap,Pn=new WeakMap,yt=new WeakMap,Vs=new WeakMap,Pr=new WeakMap,Fi=new WeakMap,as=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Tr=new WeakMap,Ys=new WeakMap,Gs=new WeakMap,ls=new WeakMap,Br=new WeakMap,ke=new WeakSet,an=function(t){ie(this,ke,Ya).call(this);let i=d(this,we).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(Qt)),i},za=function(){ie(this,ke,ja).call(this);const t=bs(this.options.staleTime,d(this,we));if(Ur||d(this,yt).isStale||!Oa(t))return;const s=vd(d(this,yt).dataUpdatedAt,t)+1;A(this,Ys,As.setTimeout(()=>{d(this,yt).isStale||this.updateResult()},s))},Ua=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(d(this,we)):this.options.refetchInterval)??!1},Ka=function(t){ie(this,ke,Va).call(this),A(this,ls,t),!(Ur||Zt(this.options.enabled,d(this,we))===!1||!Oa(d(this,ls))||d(this,ls)===0)&&A(this,Gs,As.setInterval(()=>{(this.options.refetchIntervalInBackground||Zl.isFocused())&&ie(this,ke,an).call(this)},d(this,ls)))},qa=function(){ie(this,ke,za).call(this),ie(this,ke,Ka).call(this,ie(this,ke,Ua).call(this))},ja=function(){d(this,Ys)&&(As.clearTimeout(d(this,Ys)),A(this,Ys,void 0))},Va=function(){d(this,Gs)&&(As.clearInterval(d(this,Gs)),A(this,Gs,void 0))},Ya=function(){const t=d(this,Rt).getQueryCache().build(d(this,Rt),this.options);if(t===d(this,we))return;const i=d(this,we);A(this,we,t),A(this,Pn,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},wd=function(t){mt.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(d(this,yt))}),d(this,Rt).getQueryCache().notify({query:d(this,we),type:"observerResultsUpdated"})})},Zc);function rp(e,t){return Zt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function jh(e,t){return rp(e,t)||e.state.data!==void 0&&Ga(e,t,t.refetchOnMount)}function Ga(e,t,i){if(Zt(t.enabled,e)!==!1&&bs(t.staleTime,e)!=="static"){const s=typeof i=="function"?i(e):i;return s==="always"||s!==!1&&$l(e,t)}return!1}function Vh(e,t,i,s){return(e!==t||Zt(s.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&$l(e,i)}function $l(e,t){return Zt(t.enabled,e)!==!1&&e.isStaleByTime(bs(t.staleTime,e))}function np(e,t){return!Ia(e.getCurrentResult(),t)}function Yh(e){return{onFetch:(t,i)=>{var u,c,f,v,p;const s=t.options,r=(f=(c=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:c.fetchMore)==null?void 0:f.direction,n=((v=t.state.data)==null?void 0:v.pages)||[],o=((p=t.state.data)==null?void 0:p.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const l=async()=>{let m=!1;const g=y=>{Qv(y,()=>t.signal,()=>m=!0)},b=gd(t.options,t.fetchOptions),P=async(y,S,x)=>{if(m)return Promise.reject();if(S==null&&y.pages.length)return Promise.resolve(y);const W=(()=>{const ee={client:t.client,queryKey:t.queryKey,pageParam:S,direction:x?"backward":"forward",meta:t.options.meta};return g(ee),ee})(),z=await b(W),{maxPages:J}=t.options,te=x?Xv:Gv;return{pages:te(y.pages,z,J),pageParams:te(y.pageParams,S,J)}};if(r&&n.length){const y=r==="backward",S=y?op:Gh,x={pages:n,pageParams:o},F=S(s,x);a=await P(x,F,y)}else{const y=e??n.length;do{const S=h===0?o[0]??s.initialPageParam:Gh(s,a);if(h>0&&S==null)break;a=await P(a,S),h++}while(h<y)}return a};t.options.persister?t.fetchFn=()=>{var m,g;return(g=(m=t.options).persister)==null?void 0:g.call(m,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=l}}}function Gh(e,{pages:t,pageParams:i}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,i[s],i):void 0}function op(e,{pages:t,pageParams:i}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,i[0],i):void 0}var Tn,ki,gt,Xs,xi,es,$c,ap=($c=class extends bd{constructor(t){super();U(this,xi);U(this,Tn);U(this,ki);U(this,gt);U(this,Xs);A(this,Tn,t.client),this.mutationId=t.mutationId,A(this,gt,t.mutationCache),A(this,ki,[]),this.state=t.state||lp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){d(this,ki).includes(t)||(d(this,ki).push(t),this.clearGcTimeout(),d(this,gt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){A(this,ki,d(this,ki).filter(i=>i!==t)),this.scheduleGc(),d(this,gt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){d(this,ki).length||(this.state.status==="pending"?this.scheduleGc():d(this,gt).remove(this))}continue(){var t;return((t=d(this,Xs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,h,l,u,c,f,v,p,m,g,b,P,y,S,x,F,W;const i=()=>{ie(this,xi,es).call(this,{type:"continue"})},s={client:d(this,Tn),meta:this.options.meta,mutationKey:this.options.mutationKey};A(this,Xs,Sd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(z,J)=>{ie(this,xi,es).call(this,{type:"failed",failureCount:z,error:J})},onPause:()=>{ie(this,xi,es).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>d(this,gt).canRun(this)}));const r=this.state.status==="pending",n=!d(this,Xs).canStart();try{if(r)i();else{ie(this,xi,es).call(this,{type:"pending",variables:t,isPaused:n}),d(this,gt).config.onMutate&&await d(this,gt).config.onMutate(t,this,s);const J=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,s));J!==this.state.context&&ie(this,xi,es).call(this,{type:"pending",context:J,variables:t,isPaused:n})}const z=await d(this,Xs).start();return await((l=(h=d(this,gt).config).onSuccess)==null?void 0:l.call(h,z,t,this.state.context,this,s)),await((c=(u=this.options).onSuccess)==null?void 0:c.call(u,z,t,this.state.context,s)),await((v=(f=d(this,gt).config).onSettled)==null?void 0:v.call(f,z,null,this.state.variables,this.state.context,this,s)),await((m=(p=this.options).onSettled)==null?void 0:m.call(p,z,null,t,this.state.context,s)),ie(this,xi,es).call(this,{type:"success",data:z}),z}catch(z){try{await((b=(g=d(this,gt).config).onError)==null?void 0:b.call(g,z,t,this.state.context,this,s))}catch(J){Promise.reject(J)}try{await((y=(P=this.options).onError)==null?void 0:y.call(P,z,t,this.state.context,s))}catch(J){Promise.reject(J)}try{await((x=(S=d(this,gt).config).onSettled)==null?void 0:x.call(S,void 0,z,this.state.variables,this.state.context,this,s))}catch(J){Promise.reject(J)}try{await((W=(F=this.options).onSettled)==null?void 0:W.call(F,void 0,z,t,this.state.context,s))}catch(J){Promise.reject(J)}throw ie(this,xi,es).call(this,{type:"error",error:z}),z}finally{d(this,gt).runNext(this)}}},Tn=new WeakMap,ki=new WeakMap,gt=new WeakMap,Xs=new WeakMap,xi=new WeakSet,es=function(t){const i=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),mt.batch(()=>{d(this,ki).forEach(s=>{s.onMutationUpdate(t)}),d(this,gt).notify({mutation:this,type:"updated",action:t})})},$c);function lp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hi,ci,Bn,eu,hp=(eu=class extends Fn{constructor(t={}){super();U(this,Hi);U(this,ci);U(this,Bn);this.config=t,A(this,Hi,new Set),A(this,ci,new Map),A(this,Bn,0)}build(t,i,s){const r=new ap({client:t,mutationCache:this,mutationId:++Kn(this,Bn)._,options:t.defaultMutationOptions(i),state:s});return this.add(r),r}add(t){d(this,Hi).add(t);const i=Yn(t);if(typeof i=="string"){const s=d(this,ci).get(i);s?s.push(t):d(this,ci).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(d(this,Hi).delete(t)){const i=Yn(t);if(typeof i=="string"){const s=d(this,ci).get(i);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&d(this,ci).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Yn(t);if(typeof i=="string"){const s=d(this,ci).get(i),r=s==null?void 0:s.find(n=>n.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const i=Yn(t);if(typeof i=="string"){const r=(s=d(this,ci).get(i))==null?void 0:s.find(n=>n!==t&&n.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){mt.batch(()=>{d(this,Hi).forEach(t=>{this.notify({type:"removed",mutation:t})}),d(this,Hi).clear(),d(this,ci).clear()})}getAll(){return Array.from(d(this,Hi))}find(t){const i={exact:!0,...t};return this.getAll().find(s=>Wh(i,s))}findAll(t={}){return this.getAll().filter(i=>Wh(t,i))}notify(t){mt.batch(()=>{this.listeners.forEach(i=>{i(t)})})}resumePausedMutations(){const t=this.getAll().filter(i=>i.state.isPaused);return mt.batch(()=>Promise.all(t.map(i=>i.continue().catch(Qt))))}},Hi=new WeakMap,ci=new WeakMap,Bn=new WeakMap,eu);function Yn(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ei,tu,cp=(tu=class extends Fn{constructor(t={}){super();U(this,Ei);this.config=t,A(this,Ei,new Map)}build(t,i,s){const r=i.queryKey,n=i.queryHash??Ql(r,i);let o=this.get(n);return o||(o=new ip({client:t,queryKey:r,queryHash:n,options:t.defaultQueryOptions(i),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){d(this,Ei).has(t.queryHash)||(d(this,Ei).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=d(this,Ei).get(t.queryHash);i&&(t.destroy(),i===t&&d(this,Ei).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){mt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return d(this,Ei).get(t)}getAll(){return[...d(this,Ei).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(s=>Hh(i,s))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(s=>Hh(t,s)):i}notify(t){mt.batch(()=>{this.listeners.forEach(i=>{i(t)})})}onFocus(){mt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){mt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ei=new WeakMap,tu),Oe,hs,cs,Lr,Ar,us,Or,Ir,iu,Cd=(iu=class{constructor(e={}){U(this,Oe);U(this,hs);U(this,cs);U(this,Lr);U(this,Ar);U(this,us);U(this,Or);U(this,Ir);A(this,Oe,e.queryCache||new cp),A(this,hs,e.mutationCache||new hp),A(this,cs,e.defaultOptions||{}),A(this,Lr,new Map),A(this,Ar,new Map),A(this,us,0)}mount(){Kn(this,us)._++,d(this,us)===1&&(A(this,Or,Zl.subscribe(async e=>{e&&(await this.resumePausedMutations(),d(this,Oe).onFocus())})),A(this,Ir,bo.subscribe(async e=>{e&&(await this.resumePausedMutations(),d(this,Oe).onOnline())})))}unmount(){var e,t;Kn(this,us)._--,d(this,us)===0&&((e=d(this,Or))==null||e.call(this),A(this,Or,void 0),(t=d(this,Ir))==null||t.call(this),A(this,Ir,void 0))}isFetching(e){return d(this,Oe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return d(this,hs).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=d(this,Oe).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=d(this,Oe).build(this,t),s=i.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(bs(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return d(this,Oe).findAll(e).map(({queryKey:t,state:i})=>{const s=i.data;return[t,s]})}setQueryData(e,t,i){const s=this.defaultQueryOptions({queryKey:e}),r=d(this,Oe).get(s.queryHash),n=r==null?void 0:r.state.data,o=jv(t,n);if(o!==void 0)return d(this,Oe).build(this,s).setData(o,{...i,manual:!0})}setQueriesData(e,t,i){return mt.batch(()=>d(this,Oe).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,i)]))}getQueryState(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=d(this,Oe).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=d(this,Oe);mt.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=d(this,Oe);return mt.batch(()=>(i.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},s=mt.batch(()=>d(this,Oe).findAll(e).map(r=>r.cancel(i)));return Promise.all(s).then(Qt).catch(Qt)}invalidateQueries(e,t={}){return mt.batch(()=>(d(this,Oe).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},s=mt.batch(()=>d(this,Oe).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let n=r.fetch(void 0,i);return i.throwOnError||(n=n.catch(Qt)),r.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(s).then(Qt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=d(this,Oe).build(this,t);return i.isStaleByTime(bs(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Qt).catch(Qt)}fetchInfiniteQuery(e){return e.behavior=Yh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Qt).catch(Qt)}ensureInfiniteQueryData(e){return e.behavior=Yh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bo.isOnline()?d(this,hs).resumePausedMutations():Promise.resolve()}getQueryCache(){return d(this,Oe)}getMutationCache(){return d(this,hs)}getDefaultOptions(){return d(this,cs)}setDefaultOptions(e){A(this,cs,e)}setQueryDefaults(e,t){d(this,Lr).set(Sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...d(this,Lr).values()],i={};return t.forEach(s=>{bn(e,s.queryKey)&&Object.assign(i,s.defaultOptions)}),i}setMutationDefaults(e,t){d(this,Ar).set(Sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...d(this,Ar).values()],i={};return t.forEach(s=>{bn(e,s.mutationKey)&&Object.assign(i,s.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...d(this,cs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ql(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Jl&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...d(this,cs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){d(this,Oe).clear(),d(this,hs).clear()}},Oe=new WeakMap,hs=new WeakMap,cs=new WeakMap,Lr=new WeakMap,Ar=new WeakMap,us=new WeakMap,Or=new WeakMap,Ir=new WeakMap,iu);const kd=Symbol("QueryClient"),up=()=>{const e=vu(kd);if(!e)throw new Error("No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?");return e},dp=e=>{h_(kd,e)},fp=Symbol("isRestoring"),_p=()=>{try{return vu(fp)??{current:!1}}catch{return{current:!1}}};function vp(){return _p()}function pp(e){return up()}var gp=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],mp=["difference","intersection","symmetricDifference","union"],Xh=!1,Nr,ui,ds,Po,qr,xd,Ed;const Mo=class Mo extends Set{constructor(i){super();U(this,qr);U(this,Nr,new Map);U(this,ui,Z(0));U(this,ds,Z(0));U(this,Po,Ki||-1);if(i){for(var s of i)super.add(s);d(this,ds).v=super.size}Xh||ie(this,qr,Ed).call(this)}has(i){var s=super.has(i),r=d(this,Nr),n=r.get(i);if(n===void 0){if(!s)return _(d(this,ui)),!1;n=ie(this,qr,xd).call(this,!0),r.set(i,n)}return _(n),s}add(i){return super.has(i)||(super.add(i),C(d(this,ds),super.size),ms(d(this,ui))),this}delete(i){var s=super.delete(i),r=d(this,Nr),n=r.get(i);return n!==void 0&&(r.delete(i),C(n,!1)),s&&(C(d(this,ds),super.size),ms(d(this,ui))),s}clear(){if(super.size!==0){super.clear();var i=d(this,Nr);for(var s of i.values())C(s,!1);i.clear(),C(d(this,ds),0),ms(d(this,ui))}}keys(){return this.values()}values(){return _(d(this,ui)),super.values()}entries(){return _(d(this,ui)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return _(d(this,ds))}};Nr=new WeakMap,ui=new WeakMap,ds=new WeakMap,Po=new WeakMap,qr=new WeakSet,xd=function(i){return Ki===d(this,Po)?Z(i):ws(i)},Ed=function(){Xh=!0;var i=Mo.prototype,s=Set.prototype;for(const r of gp)i[r]=function(...n){return _(d(this,ui)),s[r].apply(this,n)};for(const r of mp)i[r]=function(...n){_(d(this,ui));var o=s[r].apply(this,n);return new Mo(o)}};let Xa=Mo;function Sp(e){const t=Array.isArray(e)?[]:{},i=new Xa,s=new Proxy(t,{set(n,o,a,h){if(i.delete(o),o in n)return Reflect.set(n,o,a,h);let l=Z(a);return Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get:()=>_(l)&&yp(_(l))?_(l)():_(l),set:u=>{C(l,u)}}),!0},has:(n,o)=>i.has(o)?!1:o in n,ownKeys(n){return Reflect.ownKeys(n).filter(o=>!i.has(o))},getOwnPropertyDescriptor(n,o){if(!i.has(o))return Reflect.getOwnPropertyDescriptor(n,o)},deleteProperty(n,o){return o in n?(n[o]=void 0,i.add(o),Array.isArray(n)&&n.length--,!0):!1}});function r(n){const o=Object.keys(s),a=Object.keys(n),h=o.filter(l=>!a.includes(l));for(const l of h)delete s[l];for(const l of a)s[l]=bp(()=>n[l])}return r(e),[s,r]}const Dd=Symbol("LazyValue");function bp(e){return e[Dd]=!0,e}function yp(e){return!!e[Dd]}function wp(e,t){switch(e){case"post":Zs(t);break;case"pre":N_(t);break}}const Qo=(e,t,i)=>{let s=!1,r=Array.isArray(e)?[]:void 0;wp(t,()=>{const n=Array.isArray(e)?e.map(a=>a()):e();if(!s){s=!0,r=n;return}const o=Vi(()=>i(n,r));return r=n,o})};function Cp(e,t,i){const s=he(()=>pp()),r=vp(),n=he(()=>{const u=_(s).defaultQueryOptions(e());return u._optimisticResults=r.current?"isRestoring":"optimistic",u});let o=Z(rt(new t(_(s),_(n))));Qo(()=>_(s),"pre",()=>{C(o,new t(_(s),_(n)),!0)});function a(){const u=_(o).getOptimisticResult(_(n));return _(n).notifyOnChangeProps?u:_(o).trackResult(u)}const[h,l]=Sp(a());return Zs(()=>{const u=r.current?()=>{}:_(o).subscribe(()=>l(a()));return _(o).updateResult(),u}),Qo(()=>_(n),"pre",()=>{_(o).setOptions(_(n))}),Qo(()=>[_(n),_(o)],"pre",()=>{l(a())}),h}function kp(e,t){return Cp(e,sp)}function xp(e,t){_t(t,!0);const i=id(t,"client",19,()=>new Cd);Vr(()=>{i().mount()}),dp(i()),dv(()=>{i().unmount()});var s=lr(),r=ct(s);iv(r,()=>t.children),V(e,s),vt()}function no(e){return e.split("/").filter(Boolean).pop()||e}function Qa(e){if(!e)return"";const t=Date.now(),i=new Date(e).getTime(),s=Math.floor((t-i)/1e3);if(s<60)return"just now";const r=Math.floor(s/60);if(r<60)return r+"m ago";const n=Math.floor(r/60);if(n<24)return n+"h ago";const o=Math.floor(n/24);if(o===1)return"yesterday";if(o<7)return o+"d ago";const a=new Date(e);return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a.getMonth()]+" "+a.getDate()}const di=typeof window<"u"&&"ontouchstart"in window&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);function gr(e){const t=e.firstElementChild,i=e.closest("li");if(!t||!i)return;let s=0;const r=()=>{s=e.scrollWidth-e.clientWidth,s>0?e.classList.add("has-overflow"):(e.classList.remove("has-overflow"),t.style.transform="",t.style.transition="")},n=()=>{if(s<=0)return;const h=Math.max(.6,s/80);t.style.transition=`transform ${h}s linear 0.3s`,t.style.transform=`translateX(-${s}px)`},o=()=>{if(s<=0)return;const h=Math.max(.4,s/100);t.style.transition=`transform ${h}s linear`,t.style.transform="translateX(0)"};r();const a=new ResizeObserver(r);return a.observe(e),i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",o),i.addEventListener("longpressstart",n),i.addEventListener("longpressend",o),{destroy(){a.disconnect(),i.removeEventListener("mouseenter",n),i.removeEventListener("mouseleave",o),i.removeEventListener("longpressstart",n),i.removeEventListener("longpressend",o)}}}function Ep(e){let t=null,i=null,s=!1;const r=()=>{s=!0,e.classList.add("longpress"),e.dispatchEvent(new CustomEvent("longpressstart"))},n=()=>{s=!1,e.classList.remove("longpress"),e.dispatchEvent(new CustomEvent("longpressend"))},o=()=>{i&&(clearTimeout(i),i=null),t=setTimeout(r,500)},a=()=>{t&&(clearTimeout(t),t=null)},h=()=>{t&&(clearTimeout(t),t=null),s&&(i=setTimeout(n,3e3))},l=()=>{t&&(clearTimeout(t),t=null),s&&n()};return e.addEventListener("touchstart",o,{passive:!0}),e.addEventListener("touchmove",a,{passive:!0}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",l,{passive:!0}),{destroy(){t&&clearTimeout(t),i&&clearTimeout(i),e.removeEventListener("touchstart",o),e.removeEventListener("touchmove",a),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",l)},get active(){return s}}}function Rd(e){let t;function i(r){return t=Ep(r),t}function s(){t!=null&&t.active||e()}return{action:i,handleClick:s}}var Dp=X("<span> </span>"),Rp=X('<span class="diff-add svelte-ix4pl2"> </span>'),Pp=X('<span class="diff-del svelte-ix4pl2"> </span>'),Mp=X('<span class="git-diff svelte-ix4pl2"><!> <!></span>'),Tp=X('<div class="session-row-3 svelte-ix4pl2"><span class="session-time svelte-ix4pl2"> </span> <!></div>'),Bp=X('<button class="action-pill svelte-ix4pl2" aria-label="Rename session">✎</button>'),Lp=X('<button class="action-pill action-pill--danger svelte-ix4pl2" aria-label="Kill session">×</button>'),Ap=X("<!> <!>",1),Op=X('<button class="action-pill action-pill--mono svelte-ix4pl2" aria-label="Resume in yolo mode">YOLO</button>'),Ip=X('<button class="action-pill action-pill--danger svelte-ix4pl2" aria-label="Delete worktree">🗑</button>'),Np=X("<!> <!>",1),Fp=X('<button class="action-pill action-pill--mono svelte-ix4pl2" aria-label="New worktree">+ worktree</button>'),Hp=X('<li><div class="session-info svelte-ix4pl2"><div class="session-row-1 svelte-ix4pl2"><span></span> <span class="session-name svelte-ix4pl2"><span class="session-name-text svelte-ix4pl2"> </span></span></div> <div class="session-row-2 svelte-ix4pl2"><!> <span class="session-sub svelte-ix4pl2"> </span></div> <!></div> <div class="session-actions svelte-ix4pl2"><!></div></li>');function Gn(e,t){_t(t,!0);let i=he(()=>t.variant.kind==="active"?t.variant.session.displayName||t.variant.session.repoName||t.variant.session.id:t.variant.kind==="inactive-worktree"?t.variant.worktree.displayName||t.variant.worktree.name:t.variant.repo.name),s=he(()=>t.variant.kind==="active"?t.variant.session.root?no(t.variant.session.root):"":t.variant.kind==="inactive-worktree"?t.variant.worktree.root?no(t.variant.worktree.root):"":t.variant.repo.root?no(t.variant.repo.root):t.variant.repo.path),r=he(()=>t.variant.kind==="active"?t.variant.session.repoName||"":t.variant.kind==="inactive-worktree"&&t.variant.worktree.repoName||""),n=he(()=>t.variant.kind==="active"?Qa(t.variant.session.lastActivity):t.variant.kind==="inactive-worktree"?Qa(t.variant.worktree.lastActivity):""),o=he(()=>t.variant.kind==="active"?"status-dot status-dot--"+t.variant.status:"status-dot status-dot--inactive"),a=he(()=>t.variant.kind==="active"&&t.variant.isSelected),h=he(()=>t.variant.kind==="active"),l=he(()=>t.gitStatus?t.gitStatus.prState==="open"?"○":t.gitStatus.prState==="merged"?"⬤":t.gitStatus.prState==="closed"?"⊗":"":""),u=he(()=>t.gitStatus?t.gitStatus.prState==="open"?"pr-icon pr-open":t.gitStatus.prState==="merged"?"pr-icon pr-merged":t.gitStatus.prState==="closed"?"pr-icon pr-closed":"":"");const{action:c,handleClick:f}=Rd(()=>t.onclick());function v(N){var L;N.stopPropagation(),(L=t.onkill)==null||L.call(t)}function p(N){var L;N.stopPropagation(),(L=t.onrename)==null||L.call(t)}function m(N){var L;N.stopPropagation(),(L=t.onresumeYolo)==null||L.call(t)}function g(N){var L;N.stopPropagation(),(L=t.ondelete)==null||L.call(t)}function b(N){N.stopPropagation(),t.onclick()}var P=Hp();let y;var S=R(P),x=R(S),F=R(x),W=I(F,2),z=R(W),J=R(z);vo(W,N=>gr==null?void 0:gr(N));var te=I(x,2),ee=R(te);{var K=N=>{var L=Dp(),Q=R(L);me(()=>{qe(L,1,xa(_(u)),"svelte-ix4pl2"),ge(Q,_(l))}),V(N,L)};fe(ee,N=>{_(l)&&N(K)})}var k=I(ee,2),w=R(k),E=I(te,2);{var O=N=>{var L=Tp(),Q=R(L),oe=R(Q),ae=I(Q,2);{var le=re=>{var ne=Mp(),Ae=R(ne);{var Me=ze=>{var D=Rp(),ce=R(D);me(()=>ge(ce,`+${t.gitStatus.additions??""}`)),V(ze,D)};fe(Ae,ze=>{t.gitStatus.additions&&ze(Me)})}var Fe=I(Ae,2);{var ve=ze=>{var D=Pp(),ce=R(D);me(()=>ge(ce,`-${t.gitStatus.deletions??""}`)),V(ze,D)};fe(Fe,ze=>{t.gitStatus.deletions&&ze(ve)})}V(re,ne)};fe(ae,re=>{t.gitStatus&&(t.gitStatus.additions||t.gitStatus.deletions)&&re(le)})}me(()=>ge(oe,_(n))),V(N,L)};fe(E,N=>{(_(n)||t.gitStatus&&(t.gitStatus.additions||t.gitStatus.deletions))&&N(O)})}var Y=I(S,2),H=R(Y);{var se=N=>{var L=Ap(),Q=ct(L);{var oe=re=>{var ne=Bp();$("click",ne,p),V(re,ne)};fe(Q,re=>{t.onrename&&re(oe)})}var ae=I(Q,2);{var le=re=>{var ne=Lp();$("click",ne,v),V(re,ne)};fe(ae,re=>{t.onkill&&re(le)})}V(N,L)},M=N=>{var L=Np(),Q=ct(L);{var oe=re=>{var ne=Op();$("click",ne,m),V(re,ne)};fe(Q,re=>{t.onresumeYolo&&re(oe)})}var ae=I(Q,2);{var le=re=>{var ne=Ip();$("click",ne,g),V(re,ne)};fe(ae,re=>{t.ondelete&&re(le)})}V(N,L)},B=N=>{var L=Fp();$("click",L,b),V(N,L)};fe(H,N=>{t.variant.kind==="active"?N(se):t.variant.kind==="inactive-worktree"?N(M,1):t.variant.kind==="idle-repo"&&N(B,2)})}vo(P,N=>c==null?void 0:c(N)),me(()=>{y=qe(P,1,"svelte-ix4pl2",null,y,{"active-session":_(h),"inactive-worktree":!_(h),selected:_(a)}),qe(F,1,xa(_(o)),"svelte-ix4pl2"),ge(J,_(i)),ge(w,`${_(s)??""}${_(r)?" · "+_(r):""}`)}),$("click",P,f),V(e,P),vt()}St(["click"]);var Wp=X('<option class="svelte-1o5d4l8"> </option>'),zp=X('<option class="svelte-1o5d4l8"> </option>'),Up=X('<div class="role-filter svelte-1o5d4l8"><button>All</button> <button>Author</button> <button>Reviewer</button></div>'),Kp=X('<div class="sidebar-filters svelte-1o5d4l8"><select class="svelte-1o5d4l8"><option class="svelte-1o5d4l8">All roots</option><!></select> <select><option class="svelte-1o5d4l8">All repos</option><!></select> <input type="text" placeholder="Search..." class="svelte-1o5d4l8"/> <!></div>');function qp(e,t){_t(t,!0);const i=Nn(),s=Xl();let r=he(()=>(()=>{const y=new Set;for(const S of s.sessions)S.root&&y.add(S.root);for(const S of s.worktrees)S.root&&y.add(S.root);for(const S of s.repos)S.root&&y.add(S.root);return[...y].sort()})()),n=he(()=>(()=>{const y=new Set;for(const S of s.sessions)(!i.rootFilter||S.root===i.rootFilter)&&S.repoName&&y.add(S.repoName);for(const S of s.worktrees)(!i.rootFilter||S.root===i.rootFilter)&&S.repoName&&y.add(S.repoName);for(const S of s.repos)(!i.rootFilter||S.root===i.rootFilter)&&S.name&&y.add(S.name);return[...y].sort()})());var o=Kp(),a=R(o),h=R(a);h.value=h.__value="";var l=I(h);Ht(l,17,()=>_(r),Ch,(y,S)=>{var x=Wp(),F=R(x),W={};me(z=>{ge(F,z),W!==(W=_(S))&&(x.value=(x.__value=_(S))??"")},[()=>no(_(S))]),V(y,x)});var u;Ea(a);var c=I(a,2);let f;var v=R(c);v.value=v.__value="";var p=I(v);Ht(p,17,()=>_(n),Ch,(y,S)=>{var x=zp(),F=R(x),W={};me(()=>{ge(F,_(S)),W!==(W=_(S))&&(x.value=(x.__value=_(S))??"")}),V(y,x)});var m;Ea(c);var g=I(c,2),b=I(g,2);{var P=y=>{var S=Up(),x=R(S);let F;var W=I(x,2);let z;var J=I(W,2);let te;me(()=>{F=qe(x,1,"role-btn svelte-1o5d4l8",null,F,{active:i.prRoleFilter==="all"}),z=qe(W,1,"role-btn svelte-1o5d4l8",null,z,{active:i.prRoleFilter==="author"}),te=qe(J,1,"role-btn svelte-1o5d4l8",null,te,{active:i.prRoleFilter==="reviewer"})}),$("click",x,()=>{i.prRoleFilter="all"}),$("click",W,()=>{i.prRoleFilter="author"}),$("click",J,()=>{i.prRoleFilter="reviewer"}),V(y,S)};fe(b,y=>{i.activeTab==="prs"&&y(P)})}me(()=>{u!==(u=i.rootFilter)&&(a.value=(a.__value=i.rootFilter)??"",po(a,i.rootFilter)),f=qe(c,1,"svelte-1o5d4l8",null,f,{highlight:i.activeTab==="prs"&&!i.repoFilter}),m!==(m=i.repoFilter)&&(c.value=(c.__value=i.repoFilter)??"",po(c,i.repoFilter)),hv(g,i.searchFilter)}),$("change",a,y=>{i.rootFilter=y.target.value,i.repoFilter=""}),$("change",c,y=>{i.repoFilter=y.target.value}),$("input",g,y=>{i.searchFilter=y.target.value}),V(e,o),vt()}St(["change","input","click"]);var jp=X('<span class="diff-add svelte-jhsg4e"> </span>'),Vp=X('<span class="diff-del svelte-jhsg4e"> </span>'),Yp=X('<span class="git-diff svelte-jhsg4e"><!> <!></span>'),Gp=X('<div class="pr-row-3 svelte-jhsg4e"><span class="pr-time svelte-jhsg4e"> </span> <!></div>'),Xp=X("<span> </span>"),Qp=X('<li><div class="pr-info svelte-jhsg4e"><div class="pr-row-1 svelte-jhsg4e"><span> </span> <span class="pr-title svelte-jhsg4e"><span class="pr-title-text svelte-jhsg4e"> </span></span></div> <div class="pr-row-2 svelte-jhsg4e"><span class="pr-meta svelte-jhsg4e"> </span> <span> </span></div> <!></div> <div class="pr-actions svelte-jhsg4e"><!> <button class="external-link-btn svelte-jhsg4e" aria-label="Open in GitHub">↗</button></div></li>');function Jp(e,t){_t(t,!0);let i=he(()=>t.pr.state==="OPEN"?"○":t.pr.state==="MERGED"?"⬤":"⊗"),s=he(()=>t.pr.state==="OPEN"?"pr-state pr-open":t.pr.state==="MERGED"?"pr-state pr-merged":"pr-state pr-closed"),r=he(()=>t.pr.role==="author"?"Author":"Reviewer"),n=he(()=>t.pr.reviewDecision==="APPROVED"?"✓":t.pr.reviewDecision==="CHANGES_REQUESTED"?"✗":t.pr.reviewDecision==="REVIEW_REQUIRED"?"⏳":""),o=he(()=>t.pr.reviewDecision==="APPROVED"?"review-approved":t.pr.reviewDecision==="CHANGES_REQUESTED"?"review-changes":"review-pending"),a=he(()=>Qa(t.pr.updatedAt));const{action:h,handleClick:l}=Rd(()=>t.onclick());function u(E){E.stopPropagation(),window.open(t.pr.url,"_blank","noopener")}var c=Qp();let f;var v=R(c),p=R(v),m=R(p),g=R(m),b=I(m,2),P=R(b),y=R(P);vo(b,E=>gr==null?void 0:gr(E));var S=I(p,2),x=R(S),F=R(x),W=I(x,2),z=R(W),J=I(S,2);{var te=E=>{var O=Gp(),Y=R(O),H=R(Y),se=I(Y,2);{var M=B=>{var N=Yp(),L=R(N);{var Q=le=>{var re=jp(),ne=R(re);me(()=>ge(ne,`+${t.pr.additions??""}`)),V(le,re)};fe(L,le=>{t.pr.additions&&le(Q)})}var oe=I(L,2);{var ae=le=>{var re=Vp(),ne=R(re);me(()=>ge(ne,`-${t.pr.deletions??""}`)),V(le,re)};fe(oe,le=>{t.pr.deletions&&le(ae)})}V(B,N)};fe(se,B=>{(t.pr.additions||t.pr.deletions)&&B(M)})}me(()=>ge(H,_(a))),V(E,O)};fe(J,E=>{(_(a)||t.pr.additions||t.pr.deletions)&&E(te)})}var ee=I(v,2),K=R(ee);{var k=E=>{var O=Xp(),Y=R(O);me(()=>{qe(O,1,`review-badge ${_(o)??""}`,"svelte-jhsg4e"),qi(O,"title",t.pr.reviewDecision??""),ge(Y,_(n))}),V(E,O)};fe(K,E=>{_(n)&&E(k)})}var w=I(K,2);vo(c,E=>h==null?void 0:h(E)),me(()=>{f=qe(c,1,"pr-item svelte-jhsg4e",null,f,{"active-session":t.isActiveSession}),qe(m,1,xa(_(s)),"svelte-jhsg4e"),ge(g,_(i)),ge(y,t.pr.title),ge(F,`#${t.pr.number??""} · ${t.pr.author??""}`),qe(W,1,`role-badge role-${t.pr.role??""}`,"svelte-jhsg4e"),ge(z,_(r))}),$("click",c,l),$("click",w,u),V(e,c),vt()}St(["click"]);var Zp=X('<li class="session-divider">Available</li>'),$p=X("<!> <!> <!>",1),eg=X('<li class="session-divider">Available</li>'),tg=X("<!> <!> <!>",1),ig=X('<div class="pr-toolbar svelte-ynafm7"><button class="refresh-btn svelte-ynafm7" aria-label="Refresh pull requests"><span>↻</span></button></div>'),sg=X('<li class="pr-hint">Select a repo to view pull requests</li>'),rg=X('<li class="pr-hint">Loading pull requests...</li>'),ng=X('<li class="pr-hint">GitHub CLI not authenticated<br/><span class="pr-hint-sub">Run <code>gh auth login</code> on the host</span></li>'),og=X('<li class="pr-hint">Could not fetch pull requests</li>'),ag=X('<li class="pr-hint">No open pull requests</li>'),lg=X("<!> <!>",1),hg=X('<div class="session-list-tabs svelte-ynafm7"><button>Repos <span class="tab-count svelte-ynafm7"> </span></button> <button>Worktrees <span class="tab-count svelte-ynafm7"> </span></button> <button>PRs <span class="tab-count svelte-ynafm7"> </span></button></div> <!> <ul class="session-list svelte-ynafm7"><!></ul>',1);function cg(e,t){_t(t,!0);const i=Nn(),s=Xl();let r=null,n=he(()=>s.sessions.filter(D=>D.type==="repo")),o=he(()=>s.sessions.filter(D=>D.type!=="repo")),a=he(()=>new Set(_(n).map(D=>D.repoPath))),h=he(()=>new Set(_(o).map(D=>D.repoPath).filter(Boolean)));function l(D,ce,je){return!(i.rootFilter&&D!==i.rootFilter||i.repoFilter&&ce!==i.repoFilter||i.searchFilter&&je.toLowerCase().indexOf(i.searchFilter.toLowerCase())===-1)}let u=he(()=>_(n).filter(D=>l(D.root,D.repoName,D.displayName||D.repoName||D.id))),c=he(()=>s.repos.filter(D=>!_(a).has(D.path)&&l(D.root,D.name,D.name)).sort((D,ce)=>(D.name||"").localeCompare(ce.name||""))),f=he(()=>_(o).filter(D=>l(D.root,D.repoName,D.displayName||D.repoName||D.worktreeName||D.id))),v=he(()=>s.worktrees.filter(D=>!_(h).has(D.path)&&l(D.root,D.repoName,D.name)).sort((D,ce)=>(D.name||"").localeCompare(ce.name||""))),p=he(()=>(()=>{if(i.activeTab!=="prs"||!i.repoFilter)return null;const D=s.repos.find(ce=>ce.name===i.repoFilter);return(D==null?void 0:D.path)??null})());const m=kp(()=>({queryKey:["pull-requests",_(p)],queryFn:()=>_(p)?yv(_(p)):Promise.resolve({prs:[]}),enabled:!!_(p)}));let g=he(()=>m.data),b=he(()=>{var D;return((D=_(g))==null?void 0:D.error)??null}),P=he(()=>{var D;return((D=_(g))==null?void 0:D.prs)??[]}),y=he(()=>_(P).filter(D=>!(i.prRoleFilter!=="all"&&D.role!==i.prRoleFilter||i.searchFilter&&D.title.toLowerCase().indexOf(i.searchFilter.toLowerCase())===-1))),S=he(()=>_(u).length+_(c).length),x=he(()=>_(f).length+_(v).length),F=he(()=>_(y).length);function W(D){return s.sessions.find(ce=>ce.type==="worktree"&&ce.worktreeName===D)}function z(D){return s.worktrees.find(ce=>ce.name===D)}async function J(D){const ce=W(D.headRefName);if(ce){Aa(ce.id),t.onSelectSession(ce.id);return}const je=z(D.headRefName);if(je){try{const Ve=await ro({repoPath:je.repoPath,repoName:je.repoName,worktreePath:je.path});await Wt(),Ve!=null&&Ve.id&&t.onSelectSession(Ve.id)}catch{}return}const xt=s.repos.find(Ve=>Ve.name===i.repoFilter);if(xt)try{const Ve=await ro({repoPath:xt.path,repoName:xt.name,branchName:D.headRefName});await Wt(),Ve!=null&&Ve.id&&t.onSelectSession(Ve.id)}catch{}}async function te(D){await Cv(D.id),await Wt(),s.activeSessionId===D.id&&(s.activeSessionId=null)}async function ee(D){const ce=prompt("Rename session:",D.displayName||D.repoName||D.id);ce&&ce.trim()&&ce.trim()!==(D.displayName||D.repoName||D.id)&&(await kv(D.id,ce.trim()),await Wt())}function K(D){Aa(D.id),t.onSelectSession(D.id)}async function k(D){if(!r){r=D.path;try{const ce=await ro({repoPath:D.repoPath,repoName:D.repoName,worktreePath:D.path});await Wt(),ce!=null&&ce.id&&t.onSelectSession(ce.id)}catch{}finally{r=null}}}function w(D){t.onOpenNewSession(D)}var E=hg(),O=ct(E),Y=R(O);let H;var se=I(R(Y)),M=R(se),B=I(Y,2);let N;var L=I(R(B)),Q=R(L),oe=I(B,2);let ae;var le=I(R(oe)),re=R(le),ne=I(O,2);qp(ne,{});var Ae=I(ne,2),Me=R(Ae);{var Fe=D=>{var ce=$p(),je=ct(ce);Ht(je,17,()=>_(u),Re=>Re.id,(Re,ye)=>{{let Kt=he(()=>({kind:"active",session:_(ye),status:Ih(_(ye)),isSelected:s.activeSessionId===_(ye).id}));Gn(Re,{get variant(){return _(Kt)},get gitStatus(){return s.gitStatuses[_(ye).repoPath+":"+_(ye).worktreeName]},onclick:()=>K(_(ye)),onkill:()=>te(_(ye)),onrename:()=>ee(_(ye))})}});var xt=I(je,2);{var Ve=Re=>{var ye=Zp();V(Re,ye)};fe(xt,Re=>{_(u).length>0&&_(c).length>0&&Re(Ve)})}var ks=I(xt,2);Ht(ks,17,()=>_(c),Re=>Re.path,(Re,ye)=>{{let Kt=he(()=>({kind:"idle-repo",repo:_(ye)}));Gn(Re,{get variant(){return _(Kt)},onclick:()=>w(_(ye))})}}),V(D,ce)},ve=D=>{var ce=tg(),je=ct(ce);Ht(je,17,()=>_(f),Re=>Re.id,(Re,ye)=>{{let Kt=he(()=>({kind:"active",session:_(ye),status:Ih(_(ye)),isSelected:s.activeSessionId===_(ye).id}));Gn(Re,{get variant(){return _(Kt)},get gitStatus(){return s.gitStatuses[_(ye).repoPath+":"+_(ye).worktreeName]},onclick:()=>K(_(ye)),onkill:()=>te(_(ye)),onrename:()=>ee(_(ye))})}});var xt=I(je,2);{var Ve=Re=>{var ye=eg();V(Re,ye)};fe(xt,Re=>{_(f).length>0&&_(v).length>0&&Re(Ve)})}var ks=I(xt,2);Ht(ks,17,()=>_(v),Re=>Re.path,(Re,ye)=>{{let Kt=he(()=>({kind:"inactive-worktree",worktree:_(ye)}));Gn(Re,{get variant(){return _(Kt)},get gitStatus(){return s.gitStatuses[_(ye).repoPath+":"+_(ye).name]},onclick:()=>k(_(ye)),onresumeYolo:()=>t.onResumeYolo(_(ye)),ondelete:()=>t.onDeleteWorktree(_(ye))})}}),V(D,ce)},ze=D=>{var ce=lg(),je=ct(ce);{var xt=j=>{var ue=ig(),xe=R(ue),Ye=R(xe);let Ee;me(()=>{xe.disabled=m.isFetching,Ee=qe(Ye,1,"svelte-ynafm7",null,Ee,{spinning:m.isFetching})}),$("click",xe,()=>m.refetch()),V(j,ue)};fe(je,j=>{i.repoFilter&&j(xt)})}var Ve=I(je,2);{var ks=j=>{var ue=sg();V(j,ue)},Re=j=>{var ue=rg();V(j,ue)},ye=j=>{var ue=ng();V(j,ue)},Kt=j=>{var ue=og();V(j,ue)},Xr=j=>{var ue=ag();V(j,ue)},zo=j=>{var ue=lr(),xe=ct(ue);Ht(xe,17,()=>_(y),Ye=>Ye.number,(Ye,Ee)=>{{let Xi=he(()=>!!W(_(Ee).headRefName));Jp(Ye,{get pr(){return _(Ee)},get isActiveSession(){return _(Xi)},onclick:()=>J(_(Ee))})}}),V(j,ue)};fe(Ve,j=>{i.repoFilter?m.isLoading?j(Re,1):_(b)==="gh_not_authenticated"?j(ye,2):_(b)?j(Kt,3):_(y).length===0?j(Xr,4):j(zo,!1):j(ks)})}V(D,ce)};fe(Me,D=>{i.activeTab==="repos"?D(Fe):i.activeTab==="worktrees"?D(ve,1):D(ze,!1)})}me(()=>{H=qe(Y,1,"sidebar-tab svelte-ynafm7",null,H,{active:i.activeTab==="repos"}),ge(M,_(S)),N=qe(B,1,"sidebar-tab svelte-ynafm7",null,N,{active:i.activeTab==="worktrees"}),ge(Q,_(x)),ae=qe(oe,1,"sidebar-tab svelte-ynafm7",null,ae,{active:i.activeTab==="prs"}),ge(re,_(F))}),$("click",Y,()=>{i.activeTab="repos"}),$("click",B,()=>{i.activeTab="worktrees"}),$("click",oe,()=>{i.activeTab="prs"}),V(e,E),vt()}St(["click"]);var ug=X('<span class="sidebar-label svelte-owj5vn">Sessions</span>'),dg=X('<!> <button class="new-session-btn svelte-owj5vn"> </button> <button class="settings-btn svelte-owj5vn">⚙ Settings</button> <div class="resize-handle svelte-owj5vn"></div>',1),fg=X('<aside><div class="sidebar-header svelte-owj5vn"><button class="collapse-btn svelte-owj5vn"> </button> <!> <button class="icon-btn svelte-owj5vn" aria-label="Close sidebar">✕</button></div> <!></aside>');function _g(e,t){_t(t,!0);const i=Nn();let s=he(()=>i.activeTab==="worktrees"?"+ New Worktree":"+ New Session"),r=he(()=>i.sidebarCollapsed?Lv:i.sidebarWidth);function n(P){P.preventDefault();const y=P.clientX,S=i.sidebarWidth,x=W=>{const z=Math.min(hd,Math.max(ld,S+(W.clientX-y)));i.sidebarWidth=z},F=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",F),document.body.style.cursor="",document.body.style.userSelect="",Oh()};document.addEventListener("mousemove",x),document.addEventListener("mouseup",F),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}function o(P){P.preventDefault(),i.sidebarWidth=ad,Oh()}var a=fg();let h,l;var u=R(a),c=R(u),f=R(c),v=I(c,2);{var p=P=>{var y=ug();V(P,y)};fe(v,P=>{i.sidebarCollapsed||P(p)})}var m=I(v,2),g=I(u,2);{var b=P=>{var y=dg(),S=ct(y);cg(S,{get onSelectSession(){return t.onSelectSession},get onOpenNewSession(){return t.onOpenNewSession},get onResumeYolo(){return t.onResumeYolo},get onDeleteWorktree(){return t.onDeleteWorktree}});var x=I(S,2),F=R(x),W=I(x,2),z=I(W,2);me(()=>ge(F,_(s))),$("click",x,()=>t.onOpenNewSession()),$("click",W,function(...J){var te;(te=t.onOpenSettings)==null||te.apply(this,J)}),$("mousedown",z,n),$("dblclick",z,o),V(P,y)};fe(g,P=>{i.sidebarCollapsed||P(b)})}me(()=>{h=qe(a,1,"sidebar svelte-owj5vn",null,h,{open:i.sidebarOpen,collapsed:i.sidebarCollapsed}),l=Yl(a,"",l,{width:`${_(r)??""}px`,"min-width":`${_(r)??""}px`}),qi(c,"aria-label",i.sidebarCollapsed?"Expand sidebar":"Collapse sidebar"),ge(f,i.sidebarCollapsed?"»":"«")}),$("click",c,function(...P){Go==null||Go.apply(this,P)}),$("click",m,function(...P){is==null||is.apply(this,P)}),V(e,a),vt()}St(["click","mousedown","dblclick"]);/**
|
|
11
11
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
12
12
|
* @license MIT
|
|
13
13
|
*
|
package/dist/frontend/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
12
12
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
13
13
|
<meta name="theme-color" content="#1a1a1a" />
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BohhNs0Y.js"></script>
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/index-B71YYqJ5.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|