@puddle-code/cli 0.4.5 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -2
- package/dist/index.js +5 -2
- package/dist/install.sh +13 -2
- package/dist/public/assets/App-Ckp6kzac.css +1 -0
- package/dist/public/assets/App-D-hMqX7b.js +13 -0
- package/dist/public/assets/{CompilationCommandForm-C71yC-_B.js → CompilationCommandForm-Csg3VkC6.js} +1 -1
- package/dist/public/assets/{Dashboard-CB_H-DLw.js → Dashboard-C0AvtM5m.js} +1 -1
- package/dist/public/assets/EditorTabClose-QgdaqA1X.js +1 -0
- package/dist/public/assets/FindWidget-DG1YP6Zx.js +1 -0
- package/dist/public/assets/{LazyTerminal-BoKGfXrR.js → LazyTerminal-Dp2CN0Y8.js} +2 -2
- package/dist/public/assets/{ModelRefcount-B7HGdIpN.js → ModelRefcount-CHKuXiJY.js} +1 -1
- package/dist/public/assets/{NewProjectDialog-CdXJRYKt.js → NewProjectDialog-DMixZDC_.js} +1 -1
- package/dist/public/assets/{NotebookWidget-kFo_mQZh.js → NotebookWidget-CCRsiBIE.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-DPzHCCV7.js → PaneEditorBody-DD8UshBi.js} +19 -19
- package/dist/public/assets/{PdfViewer-C-dXDOjG.js → PdfViewer-BX025YLW.js} +1 -1
- package/dist/public/assets/ReleaseNotesDialog-CbFYKoYM.js +1 -0
- package/dist/public/assets/SettingsDialog-CJX0gDhJ.css +1 -0
- package/dist/public/assets/SettingsDialog-DgMm212x.js +8 -0
- package/dist/public/assets/Terminal-CYeh8_uU.js +66 -0
- package/dist/public/assets/Workspace-Bf0VMnaa.css +1 -0
- package/dist/public/assets/Workspace-CrZkK55U.js +20 -0
- package/dist/public/assets/{buffer-store-D78ZR3kb.js → buffer-store-DIOiWz9q.js} +1 -1
- package/dist/public/assets/button-C_Rvtcwg.js +1 -0
- package/dist/public/assets/{chevron-right-BP2NLwlG.js → chevron-right-BEy-IXEZ.js} +1 -1
- package/dist/public/assets/client-settings-DhfHheKR.js +1 -0
- package/dist/public/assets/command-BV8ZEhQz.js +1 -0
- package/dist/public/assets/{context-C3-WejyN.js → context-CSOKgBuW.js} +1 -1
- package/dist/public/assets/context-menu-D3ZhKA9s.js +1 -0
- package/dist/public/assets/control-tray-CdoVaVhT.js +1 -0
- package/dist/public/assets/control-tray-DE2RhHP3.css +1 -0
- package/dist/public/assets/dialog-BX0tebJL.css +1 -0
- package/dist/public/assets/dialog-D-Axqpzg.js +41 -0
- package/dist/public/assets/dist-BmSuHjIq.js +1 -0
- package/dist/public/assets/{dist-CGlwr6Pc.js → dist-Cq-O0n8n.js} +1 -1
- package/dist/public/assets/{dist-BHBQY7ao.js → dist-Dge3wHdO.js} +1 -1
- package/dist/public/assets/{index-BKT8bLLH.js → index-BqOVeoIr.js} +3 -3
- package/dist/public/assets/index-LpAqnBR3.css +2 -0
- package/dist/public/assets/{markdown-mermaid-A8_2kS9k.js → markdown-mermaid-SyDYdSZz.js} +1 -1
- package/dist/public/assets/media-refresh-store-NSkvkBxN.js +1 -0
- package/dist/public/assets/motion-OSLfKoC0.js +1 -0
- package/dist/public/assets/{notification-delivery-CoEqmE8J.js → notification-delivery-BBt_CJ19.js} +1 -1
- package/dist/public/assets/popover-D-jcaKGN.js +1 -0
- package/dist/public/assets/{protocol-support-CsLR9u7d.js → protocol-support-BApsXw77.js} +1 -1
- package/dist/public/assets/select-p5KTVHbg.js +1 -0
- package/dist/public/assets/selection-actions-Cm0Oytya.js +1 -0
- package/dist/public/assets/{switch-DihTSmnc.js → switch-OMx-_DY7.js} +1 -1
- package/dist/public/assets/use-ui-state-DdnTFosh.js +1 -0
- package/dist/public/index.html +3 -3
- package/package.json +1 -1
- package/dist/public/assets/App-Cr5uXso0.js +0 -7
- package/dist/public/assets/EditorTabClose-wG0D8Zxq.js +0 -1
- package/dist/public/assets/FindWidget-CaVwYvST.js +0 -1
- package/dist/public/assets/ReleaseNotesDialog-BXqx8SP6.js +0 -1
- package/dist/public/assets/SettingsDialog-D7eSDoiW.js +0 -8
- package/dist/public/assets/Terminal-BEHawoLK.js +0 -66
- package/dist/public/assets/Workspace-D5qlJNnU.css +0 -1
- package/dist/public/assets/Workspace-PBHY5dWY.js +0 -20
- package/dist/public/assets/button-q0ardkfx.js +0 -1
- package/dist/public/assets/client-settings-CwqpIric.js +0 -1
- package/dist/public/assets/command-BkdEYC1b.js +0 -1
- package/dist/public/assets/context-menu-C0cOAj0E.js +0 -1
- package/dist/public/assets/control-tray-D7OXXkAy.css +0 -1
- package/dist/public/assets/control-tray-OJfh0_ml.js +0 -1
- package/dist/public/assets/dialog-IU2fjIs9.js +0 -41
- package/dist/public/assets/dist-eLNGMhYC.js +0 -1
- package/dist/public/assets/index-C3TPFFMc.css +0 -2
- package/dist/public/assets/media-refresh-store-CHPkX-XV.js +0 -1
- package/dist/public/assets/popover-B5Bw2ljC.js +0 -1
- package/dist/public/assets/select-C0UTbo8D.js +0 -1
- package/dist/public/assets/selection-actions-Ccf4ZuaR.js +0 -1
- package/dist/public/assets/use-ui-state-e6mUjW-H.js +0 -1
- package/dist/public/assets/whole-word-BJjKpISQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-olLlgxc3.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{n as r}from"./api-BOuyloUi.js";var i={major:26,minor:1};function a(e,t,n=i){return e?.major===n.major&&(e.major>t.major||e.major===t.major&&e.minor>=t.minor)}var o=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(){}},s=new class extends o{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){return typeof e==`function`?e(t):e}function v(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==b(o,t.options))return!1}else if(!S(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function y(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(x(t.options.mutationKey)!==x(a))return!1}else if(!S(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function b(e,t){return(t?.queryKeyHashFn||x)(e)}function x(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function S(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>S(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{l.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function re(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function ae(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k(e,t){return typeof e==`function`?e(...t):!!e}function oe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var A=(()=>{let e=()=>d;return{isServer(){return e()},setIsServer(t){e=t}}})();function j(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var se=u;function ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var M=ce(),N=new class extends o{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function le(e){return Math.min(1e3*2**e,3e4)}function P(e){return(e??`online`)!==`online`||N.isOnline()}var F=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,r,i=j(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new F(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>s.isFocused()&&(e.networkMode===`always`||N.isOnline())&&e.canRun(),d=()=>P(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(A.isServer()?0:3),o=e.retryDelay??le,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ne(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(A.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function ue(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{oe(e,()=>t.signal,()=>n=!0)},u=ae(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ie:re;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?z:R,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:R(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function R(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function z(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function de(e,t){return t?R(e,t)!=null:!1}function fe(e,t){return!t||!e.getPreviousPageParam?!1:z(e,t)!=null}var pe=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ge(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ge(this.options);e.data!==void 0&&(this.setState(he(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>_(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ae(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ue(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=I({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof F&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof F){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...me(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...he(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),M.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function me(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:P(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function he(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ge(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends o{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=j(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return B(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return B(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof _(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&V(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return be(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(A.isServer()||this.#r.isStale||!m(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#d=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(A.isServer()||_(this.options.enabled,this.#t)===!1||!m(this.#p)||this.#p===0)&&(this.#f=l.setInterval(()=>{(this.options.refetchIntervalInBackground||s.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(l.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(l.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&V(e,n,t,r);(a||o)&&(l={...l,...me(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:H(e,t),refetch:this.refetch,promise:this.#o,isEnabled:_(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=j();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!w(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){M.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ve(e,t){return _(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&_(t.retryOnMount,e)===!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&B(e,t,t.refetchOnMount)}function B(e,t,n){if(_(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&H(e,t)}return!1}function V(e,t,n,r){return(e!==t||_(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&H(e,n)}function H(e,t){return _(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function be(e,t){return!w(e.getCurrentResult(),t)}var xe=class extends L{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=I({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),M.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function U(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Se=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),w(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&x(t.mutationKey)!==x(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??U();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){M.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},W=e(t(),1),Ce=n(),G=W.createContext(void 0),K=e=>{let t=W.useContext(G);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},we=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Ce.jsx)(G.Provider,{value:e,children:t})),q=W.createContext(!1),Te=()=>W.useContext(q);q.Provider;function Ee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var De=W.createContext(Ee()),Oe=()=>W.useContext(De),ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?k(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ae=e=>{W.useEffect(()=>{e.clearReset()},[e])},je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||k(n,[e.error,r])),Me=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ne=(e,t)=>e.isLoading&&e.isFetching&&!t,Pe=(e,t)=>e?.suspense&&t.isPending,Fe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ie(e,t,n){let r=Te(),i=Oe(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Me(o),ke(o,i,s),Ae(i);let l=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),p=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=p?u.subscribe(M.batchCalls(e)):f;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),Pe(o,d))throw Fe(o,u,i);if(je({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!A.isServer()&&Ne(d,r)&&(l?Fe(o,u,i):s?.promise)?.catch(f).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function J(e,t){return Ie(e,_e,t)}function Y(e,t){let n=K(t),[r]=W.useState(()=>new Se(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(M.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(f)},[r]);if(i.error&&k(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Le=12,X=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{X=!0}),window.addEventListener(`blur`,()=>{X=!1}),s.setEventListener(e=>{let t=()=>e(void 0);return window.addEventListener(`visibilitychange`,t,!1),window.addEventListener(`focus`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}}));function Z(e){return()=>X?e:e*Le}function Re(){return J({queryKey:[`profiles`],queryFn:()=>r(`GET`,`/api/profiles`)})}function ze(e){return J({queryKey:[`profile-settings`,e],queryFn:()=>r(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function Be(e){return J({queryKey:[`accounts`,e],queryFn:()=>r(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function Ve(e){return J({queryKey:[`account-usage`,e],queryFn:()=>r(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function He(){return J({queryKey:[`repos`],queryFn:()=>r(`GET`,`/api/repos`)})}function Ue(e,t=!0){return J({queryKey:[`projects`,e??`all`],queryFn:()=>r(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function We(e){return J({queryKey:[`project`,e],queryFn:()=>r(`GET`,`/api/projects/${e}`),enabled:e!==void 0,placeholderData:e=>e})}function Ge(e){return r(`POST`,`/api/projects/${e}/conversations/refresh`)}function Ke(e){return J({queryKey:[`sessions`,e],queryFn:()=>r(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var qe={queryKey:[`sessions`,`all`],queryFn:()=>r(`GET`,`/api/sessions`)};function Je(e=!0){return J({...qe,enabled:e})}function Ye(e){return e.fetchQuery(qe)}function Xe(){return J({queryKey:[`config`],queryFn:()=>r(`GET`,`/api/config`)})}function Ze(e){return J({queryKey:[`repo-branches`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Qe(e,t=1e4){return J({queryKey:[`repo-worktrees`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:t})}function $e(e,t){let n=K();return Y({mutationFn:t=>r(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function et(e,t){let n=K();return Y({mutationFn:({name:t,confirm:n})=>{let i=new URLSearchParams({name:t});return n&&i.set(`confirm`,`1`),r(`DELETE`,`/api/repos/${e}/branches?${i.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function tt(e){return J({queryKey:[`fs-dirs`,e],queryFn:()=>r(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function nt(){return J({queryKey:[`version`],queryFn:()=>r(`GET`,`/api/version`),staleTime:1/0})}function rt(){return J({queryKey:[`host`],queryFn:()=>r(`GET`,`/api/host`),staleTime:1/0})}function it(e){return e?e.displayName||e.hostname:void 0}function at(){return J({queryKey:[`agents`],queryFn:()=>r(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function ot(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function st(e){let t=K();return Y({mutationFn:t=>r(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function ct(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function lt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function ut(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function dt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function ft(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function pt(){return Y({mutationFn:e=>r(`POST`,`/api/accounts/${e}/login`)})}function mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function ht(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function gt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function _t(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function vt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/projects/${e}`,t),onSuccess:t=>{e.setQueryData([`project`,t.id],e=>e&&{...e,project:t}),e.invalidateQueries({queryKey:[`projects`]})}})}function yt(e,t){return J({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>r(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function bt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function xt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function St(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Ct(e,t){return J({queryKey:[`layouts`,e,t??`none`],queryFn:()=>r(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function wt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Tt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Et(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/layouts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Q(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Dt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions`,e),onSuccess:t=>Q(e,t)})}function Ot(e){let t=K();return Y({mutationFn:t=>r(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>Q(t,e)})}function kt(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>Q(e,t)})}function At(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{Q(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function jt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>Q(e,t)})}function Mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>Q(e,t)})}function Nt(){let e=K();return Y({mutationFn:({sessionId:e,title:t})=>r(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>Q(e,t)})}function Pt(){let e=K();return Y({mutationFn:e=>r(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function Ft(e){try{return await r(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function It(e,t){return r(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function Lt(e,t){return J({queryKey:[`ports`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function Rt(e,t){return J({queryKey:[`session-env`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function zt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var Bt=e=>a(e,{major:25,minor:15});function $(e,t,n){return!e||e.major>t||e.major===t&&e.minor>=n}var Vt=e=>e!==void 0&&$(e,21,3),Ht=e=>e!==void 0&&$(e,24,5);function Ut(e){return $(e,17,1)}function Wt(e){return $(e,17,3)}var Gt=e=>e!==void 0&&$(e,24,4),Kt=e=>$(e,10,3),qt=e=>$(e,12,3),Jt=e=>$(e,12,4),Yt=e=>$(e,15,3),Xt=e=>e!==void 0&&$(e,16,3),Zt=e=>$(e,16,4),Qt=e=>$(e,14,1),$t=e=>e!==void 0&&$(e,24,6),en=e=>e!==void 0&&$(e,25,1),tn=e=>e!==void 0&&$(e,25,2),nn=e=>e!==void 0&&$(e,25,3),rn=e=>e!==void 0&&$(e,25,4);export{Tt as $,Xe as A,fe as At,et as B,C as Bt,Ge as C,Ie as Ct,Je as D,_e as Dt,at as E,xe as Et,mt as F,b as Ft,gt as G,ut as H,O as Ht,bt as I,y as It,Ct as J,At as K,Dt as L,v as Lt,wt as M,M as Mt,ot as N,p as Nt,jt as O,pe as Ot,_t as P,x as Pt,Pt as Q,nt as R,f as Rt,It as S,J as St,Be as T,K as Tt,St as U,s as Ut,Et as V,g as Vt,tt as W,o as Wt,kt as X,pt as Y,lt as Z,Yt as _,Lt as _t,Xt as a,ze as at,Ft as b,Z as bt,Vt as c,Ue as ct,tn as d,Ze as dt,ct as et,nn as f,Qe as ft,Bt as g,Rt as gt,Ht as h,Ot as ht,Ut as i,xt as it,ft as j,N as jt,zt as k,de as kt,Zt as l,$e as lt,rn as m,yt as mt,Gt as n,vt as nt,Qt as o,Re as ot,$t as p,He as pt,rt as q,Wt as r,ht as rt,Jt as s,We as st,qt as t,st as tt,en as u,Nt as ut,Kt as v,Ke as vt,Ve as w,we as wt,it as x,Y as xt,Ye as y,Mt as yt,dt as z,S as zt};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-olLlgxc3.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{n as r}from"./api-BOuyloUi.js";var i={major:26,minor:1};function a(e,t,n=i){return e?.major===n.major&&(e.major>t.major||e.major===t.major&&e.minor>=t.minor)}var o=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(){}},s=new class extends o{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){return typeof e==`function`?e(t):e}function v(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==b(o,t.options))return!1}else if(!S(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function y(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(x(t.options.mutationKey)!==x(a))return!1}else if(!S(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function b(e,t){return(t?.queryKeyHashFn||x)(e)}function x(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function S(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>S(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{l.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function re(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function ae(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k(e,t){return typeof e==`function`?e(...t):!!e}function oe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var A=(()=>{let e=()=>d;return{isServer(){return e()},setIsServer(t){e=t}}})();function j(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var se=u;function ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var M=ce(),N=new class extends o{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function le(e){return Math.min(1e3*2**e,3e4)}function P(e){return(e??`online`)!==`online`||N.isOnline()}var F=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,r,i=j(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new F(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>s.isFocused()&&(e.networkMode===`always`||N.isOnline())&&e.canRun(),d=()=>P(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(A.isServer()?0:3),o=e.retryDelay??le,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ne(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(A.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function ue(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{oe(e,()=>t.signal,()=>n=!0)},u=ae(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ie:re;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?z:R,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:R(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function R(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function z(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function de(e,t){return t?R(e,t)!=null:!1}function fe(e,t){return!t||!e.getPreviousPageParam?!1:z(e,t)!=null}var pe=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ge(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ge(this.options);e.data!==void 0&&(this.setState(he(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>_(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ae(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ue(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=I({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof F&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof F){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...me(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...he(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),M.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function me(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:P(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function he(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ge(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends o{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=j(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return B(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return B(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof _(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&V(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return be(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(A.isServer()||this.#r.isStale||!m(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#d=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(A.isServer()||_(this.options.enabled,this.#t)===!1||!m(this.#p)||this.#p===0)&&(this.#f=l.setInterval(()=>{(this.options.refetchIntervalInBackground||s.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(l.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(l.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&V(e,n,t,r);(a||o)&&(l={...l,...me(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:H(e,t),refetch:this.refetch,promise:this.#o,isEnabled:_(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=j();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!w(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){M.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ve(e,t){return _(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&_(t.retryOnMount,e)===!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&B(e,t,t.refetchOnMount)}function B(e,t,n){if(_(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&H(e,t)}return!1}function V(e,t,n,r){return(e!==t||_(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&H(e,n)}function H(e,t){return _(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function be(e,t){return!w(e.getCurrentResult(),t)}var xe=class extends L{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=I({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),M.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function U(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Se=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),w(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&x(t.mutationKey)!==x(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??U();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){M.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},W=e(t(),1),Ce=n(),G=W.createContext(void 0),K=e=>{let t=W.useContext(G);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},we=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Ce.jsx)(G.Provider,{value:e,children:t})),q=W.createContext(!1),Te=()=>W.useContext(q);q.Provider;function Ee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var De=W.createContext(Ee()),Oe=()=>W.useContext(De),ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?k(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ae=e=>{W.useEffect(()=>{e.clearReset()},[e])},je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||k(n,[e.error,r])),Me=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ne=(e,t)=>e.isLoading&&e.isFetching&&!t,Pe=(e,t)=>e?.suspense&&t.isPending,Fe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ie(e,t,n){let r=Te(),i=Oe(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Me(o),ke(o,i,s),Ae(i);let l=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),p=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=p?u.subscribe(M.batchCalls(e)):f;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),Pe(o,d))throw Fe(o,u,i);if(je({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!A.isServer()&&Ne(d,r)&&(l?Fe(o,u,i):s?.promise)?.catch(f).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function J(e,t){return Ie(e,_e,t)}function Y(e,t){let n=K(t),[r]=W.useState(()=>new Se(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(M.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(f)},[r]);if(i.error&&k(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Le=12,X=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{X=!0}),window.addEventListener(`blur`,()=>{X=!1}),s.setEventListener(e=>{let t=()=>e(void 0);return window.addEventListener(`visibilitychange`,t,!1),window.addEventListener(`focus`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}}));function Z(e){return()=>X?e:e*Le}function Re(){return J({queryKey:[`profiles`],queryFn:()=>r(`GET`,`/api/profiles`)})}function ze(e){return J({queryKey:[`profile-settings`,e],queryFn:()=>r(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function Be(e){return J({queryKey:[`accounts`,e],queryFn:()=>r(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function Ve(e){return J({queryKey:[`account-usage`,e],queryFn:()=>r(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function He(){return J({queryKey:[`repos`],queryFn:()=>r(`GET`,`/api/repos`)})}function Ue(e,t=!0){return J({queryKey:[`projects`,e??`all`],queryFn:()=>r(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function We(e){return J({queryKey:[`project`,e],queryFn:()=>r(`GET`,`/api/projects/${e}`),enabled:e!==void 0,placeholderData:e=>e})}function Ge(e){return r(`POST`,`/api/projects/${e}/conversations/refresh`)}function Ke(e){return J({queryKey:[`sessions`,e],queryFn:()=>r(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var qe={queryKey:[`sessions`,`all`],queryFn:()=>r(`GET`,`/api/sessions`)};function Je(e=!0){return J({...qe,enabled:e})}function Ye(e){return e.fetchQuery({...qe,staleTime:0})}function Xe(){return J({queryKey:[`config`],queryFn:()=>r(`GET`,`/api/config`)})}function Ze(e){return J({queryKey:[`repo-branches`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Qe(e,t=1e4){return J({queryKey:[`repo-worktrees`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:t})}function $e(e,t){let n=K();return Y({mutationFn:t=>r(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function et(e,t){let n=K();return Y({mutationFn:({name:t,confirm:n})=>{let i=new URLSearchParams({name:t});return n&&i.set(`confirm`,`1`),r(`DELETE`,`/api/repos/${e}/branches?${i.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function tt(e){return J({queryKey:[`fs-dirs`,e],queryFn:()=>r(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function nt(){return J({queryKey:[`version`],queryFn:()=>r(`GET`,`/api/version`),staleTime:1/0})}function rt(){return J({queryKey:[`host`],queryFn:()=>r(`GET`,`/api/host`),staleTime:1/0})}function it(e){return e?e.displayName||e.hostname:void 0}function at(){return J({queryKey:[`agents`],queryFn:()=>r(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function ot(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function st(e){let t=K();return Y({mutationFn:t=>r(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function ct(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function lt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function ut(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function dt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function ft(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function pt(){return Y({mutationFn:e=>r(`POST`,`/api/accounts/${e}/login`)})}function mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function ht(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function gt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function _t(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function vt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/projects/${e}`,t),onSuccess:t=>{e.setQueryData([`project`,t.id],e=>e&&{...e,project:t}),e.invalidateQueries({queryKey:[`projects`]})}})}function yt(e,t){return J({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>r(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function bt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function xt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function St(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Ct(e,t){return J({queryKey:[`layouts`,e,t??`none`],queryFn:()=>r(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function wt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Tt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Et(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/layouts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Q(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Dt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions`,e),onSuccess:t=>Q(e,t)})}function Ot(e){let t=K();return Y({mutationFn:t=>r(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>Q(t,e)})}function kt(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>Q(e,t)})}function At(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{Q(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function jt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>Q(e,t)})}function Mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>Q(e,t)})}function Nt(){let e=K();return Y({mutationFn:({sessionId:e,title:t})=>r(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>Q(e,t)})}function Pt(){let e=K();return Y({mutationFn:e=>r(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function Ft(e){try{return await r(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function It(e,t){return r(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function Lt(e,t){return J({queryKey:[`ports`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function Rt(e,t){return J({queryKey:[`session-env`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function zt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var Bt=e=>a(e,{major:25,minor:15});function $(e,t,n){return!e||e.major>t||e.major===t&&e.minor>=n}var Vt=e=>e!==void 0&&$(e,21,3),Ht=e=>e!==void 0&&$(e,24,5);function Ut(e){return $(e,17,1)}function Wt(e){return $(e,17,3)}var Gt=e=>e!==void 0&&$(e,24,4),Kt=e=>$(e,10,3),qt=e=>$(e,12,3),Jt=e=>$(e,12,4),Yt=e=>$(e,15,3),Xt=e=>e!==void 0&&$(e,16,3),Zt=e=>$(e,16,4),Qt=e=>$(e,14,1),$t=e=>e!==void 0&&$(e,24,6),en=e=>e!==void 0&&$(e,25,1),tn=e=>e!==void 0&&$(e,25,2),nn=e=>e!==void 0&&$(e,25,3),rn=e=>e!==void 0&&$(e,25,4);export{Tt as $,Xe as A,fe as At,et as B,C as Bt,Ge as C,Ie as Ct,Je as D,_e as Dt,at as E,xe as Et,mt as F,b as Ft,gt as G,ut as H,O as Ht,bt as I,y as It,Ct as J,At as K,Dt as L,v as Lt,wt as M,M as Mt,ot as N,p as Nt,jt as O,pe as Ot,_t as P,x as Pt,Pt as Q,nt as R,f as Rt,It as S,J as St,Be as T,K as Tt,St as U,s as Ut,Et as V,g as Vt,tt as W,o as Wt,kt as X,pt as Y,lt as Z,Yt as _,Lt as _t,Xt as a,ze as at,Ft as b,Z as bt,Vt as c,Ue as ct,tn as d,Ze as dt,ct as et,nn as f,Qe as ft,Bt as g,Rt as gt,Ht as h,Ot as ht,Ut as i,xt as it,ft as j,N as jt,zt as k,de as kt,Zt as l,$e as lt,rn as m,yt as mt,Gt as n,vt as nt,Qt as o,Re as ot,$t as p,He as pt,rt as q,Wt as r,ht as rt,Jt as s,We as st,qt as t,st as tt,en as u,Nt as ut,Kt as v,Ke as vt,Ve as w,we as wt,it as x,Y as xt,Ye as y,Mt as yt,dt as z,S as zt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{C as i,E as a,S as o,T as s,_ as c,b as l,f as u,g as d,h as f,m as p,p as m,v as h,x as g,y as _}from"./dialog-D-Axqpzg.js";import{o as v,r as y}from"./x-Dq6POV20.js";import{_ as b,c as x,g as S,h as C,l as w,m as T,o as E,u as D,v as O}from"./chevron-right-BEy-IXEZ.js";import{a as k,t as A}from"./dist-Dge3wHdO.js";import{n as j,t as ee}from"./createLucideIcon-C9A1vLE-.js";import{t as te}from"./chevron-down-HQLVE6o5.js";import{n as M,t as N}from"./dist-Cq-O0n8n.js";var P=ee(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),F=e(t(),1),I=e(n(),1);function L(e,[t,n]){return Math.min(n,Math.max(t,e))}var R=r(),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,ne]=M(V),[W,re]=s(V,[ne,O]),G=O(),[ie,K]=W(V),[q,ae]=W(V),oe=`SelectProvider`;function se(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,v=G(t),[y,x]=F.useState(null),[S,C]=F.useState(null),[w,T]=F.useState(!1),E=N(l),[D,O]=d({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[k,A]=d({prop:o,defaultProp:s,onChange:c,caller:V}),j=F.useRef(null),ee=F.useRef(k);F.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>A(ee.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,A]);let te=!y||!!h||!!y.closest(`form`),[M,P]=F.useState(new Set),I=_(),L=Array.from(M).map(e=>e.props.value).join(`;`),z=F.useCallback(e=>{P(t=>new Set(t).add(e))},[]),B=F.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:m,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:I,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:j,disabled:p,name:u,autoComplete:f,form:h,nativeOptions:M,nativeSelectKey:L,isFormControl:te};return(0,R.jsx)(b,{...v,children:(0,R.jsx)(ie,{scope:t,...U,children:(0,R.jsx)(H.Provider,{scope:t,children:(0,R.jsx)(q,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:B,children:nt(g)?g(U):n})})})})}se.displayName=oe;var ce=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,R.jsx)(se,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[n,e?(0,R.jsx)(tt,{__scopeSelect:t}):null]})})};ce.displayName=V;var le=`SelectTrigger`,ue=F.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...o}=e,s=G(n),c=K(le,n),l=c.disabled||r,u=v(t,c.onTriggerChange),d=U(n),f=F.useRef(`touch`),[p,m,h]=rt(e=>{let t=d().filter(e=>!e.disabled),n=it(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,R.jsx)(T,{asChild:!0,...s,children:(0,R.jsx)(i.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...o,ref:u,onClick:a(o.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:a(o.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:a(o.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(g(),e.preventDefault())})})})});ue.displayName=le;var de=`SelectValue`,fe=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,u=K(de,n),{onValueNodeHasChildrenChange:d}=u,f=o!==void 0,p=v(t,u.onValueNodeChange);l(()=>{d(f)},[d,f]);let m=$(u.value);return(0,R.jsx)(i.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,R.jsx)(F.Fragment,{children:m?s:o},m?`placeholder`:`value`)})});fe.displayName=de;var pe=`SelectIcon`,me=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...a}=e;return(0,R.jsx)(i.span,{"aria-hidden":!0,...a,ref:t,children:r||`▼`})});me.displayName=pe;var he=`SelectPortal`,[ge,_e]=W(he,{forceMount:void 0}),ve=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,R.jsx)(ge,{scope:e.__scopeSelect,forceMount:n,children:(0,R.jsx)(h,{asChild:!0,...r})})};ve.displayName=he;var J=`SelectContent`,ye=F.forwardRef((e,t)=>{let n=_e(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(J,e.__scopeSelect),[o,s]=F.useState();return l(()=>{s(new DocumentFragment)},[]),(0,R.jsx)(c,{present:r||a.open,children:({present:e})=>e?(0,R.jsx)(we,{...i,ref:t}):(0,R.jsx)(be,{...i,fragment:o})})});ye.displayName=J;var be=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?I.createPortal((0,R.jsx)(xe,{scope:n,children:(0,R.jsx)(H.Slot,{scope:n,children:(0,R.jsx)(`div`,{ref:t,children:r})})}),i):null});be.displayName=`SelectContentFragment`;var Y=10,[xe,X]=W(J),Se=`SelectContentImpl`,Ce=y(`SelectContent.RemoveScroll`),we=F.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:h,arrowPadding:_,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=K(J,n),[E,D]=F.useState(null),[O,k]=F.useState(null),A=v(t,D),[j,ee]=F.useState(null),[te,M]=F.useState(null),N=U(n),[P,I]=F.useState(!1),L=F.useRef(!1);F.useEffect(()=>{if(E)return u(E)},[E]),p();let z=F.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,O]),B=F.useCallback(()=>z([j,E]),[z,j,E]);F.useEffect(()=>{P&&B()},[P,B]);let{onOpenChange:V,triggerPointerDownPosRef:H}=T;F.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(H.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(H.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),H.current=null};return H.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,V,H]),F.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[ne,W]=rt(e=>{let t=N().filter(e=>!e.disabled),n=it(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(L.current=!0))},[T.value]),G=F.useCallback(()=>E?.focus(),[E]),ie=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),q=r===`popper`?Oe:Ee,ae=q===Oe?{side:c,sideOffset:l,align:d,alignOffset:h,arrowPadding:_,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,R.jsx)(xe,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:G,itemTextRefCallback:ie,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:P,searchRef:ne,children:(0,R.jsx)(m,{as:Ce,allowPinchZoom:!0,children:(0,R.jsx)(f,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:a(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,R.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>I(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:a(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&W(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});we.displayName=Se;var Te=`SelectItemAlignedPosition`,Ee=F.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=K(J,n),s=X(J,n),[c,u]=F.useState(null),[d,f]=F.useState(null),p=v(t,f),m=U(n),h=F.useRef(!1),g=F.useRef(!0),{viewport:_,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=F.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&_&&y&&b){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=L(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=L(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=m(),s=window.innerHeight-Y*2,l=_.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),v=parseInt(u.paddingBottom,10),x=f+p+l+v+g,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,c,d,_,y,b,o.dir,r]);l(()=>S(),[S]);let[C,w]=F.useState();return l(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,R.jsx)(ke,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:F.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,R.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,R.jsx)(i.div,{...a,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Ee.displayName=Te;var De=`SelectPopperPosition`,Oe=F.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=G(n);return(0,R.jsx)(S,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Oe.displayName=De;var[ke,Ae]=W(J,{}),je=`SelectViewport`,Me=F.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...o}=e,s=X(je,n),c=Ae(je,n),l=v(t,s.onViewportChange),u=F.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,R.jsx)(H.Slot,{scope:n,children:(0,R.jsx)(i.div,{"data-radix-select-viewport":``,role:`presentation`,...o,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...o.style},onScroll:a(o.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});Me.displayName=je;var Ne=`SelectGroup`,[Pe,Fe]=W(Ne),Ie=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=_();return(0,R.jsx)(Pe,{scope:n,id:a,children:(0,R.jsx)(i.div,{role:`group`,"aria-labelledby":a,...r,ref:t})})});Ie.displayName=Ne;var Le=`SelectLabel`,Re=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,a=Fe(Le,n);return(0,R.jsx)(i.div,{id:a.id,...r,ref:t})});Re.displayName=Le;var Z=`SelectItem`,[ze,Be]=W(Z),Ve=F.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:s=!1,textValue:c,...l}=e,u=K(Z,n),d=X(Z,n),f=u.value===r,[p,m]=F.useState(c??``),[h,g]=F.useState(!1),y=v(t,o(e=>d.itemRefCallback?.(e,r,s))),b=_(),x=F.useRef(`touch`),S=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};return(0,R.jsx)(ze,{scope:n,value:r,disabled:s,textId:b,isSelected:f,onItemTextChange:F.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(H.ItemSlot,{scope:n,value:r,disabled:s,textValue:p,children:(0,R.jsx)(i.div,{role:`option`,"aria-labelledby":b,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":s||void 0,"data-disabled":s?``:void 0,tabIndex:s?void 0:-1,...l,ref:y,onFocus:a(l.onFocus,()=>g(!0)),onBlur:a(l.onBlur,()=>g(!1)),onClick:a(l.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:a(l.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:a(l.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:a(l.onPointerMove,e=>{x.current=e.pointerType,s?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:a(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:a(l.onKeyDown,e=>{s||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(B.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Ve.displayName=Z;var Q=`SelectItemText`,He=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...s}=e,c=K(Q,n),u=X(Q,n),d=Be(Q,n),f=ae(Q,n),[p,m]=F.useState(null),h=o(e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=v(t,m,d.onItemTextChange,h),_=p?.textContent,y=F.useMemo(()=>(0,R.jsx)(`option`,{value:d.value,disabled:d.disabled,children:_},d.value),[d.disabled,d.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return l(()=>(b(y),()=>x(y)),[b,x,y]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(i.span,{id:d.textId,...s,ref:g}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?I.createPortal(s.children,c.valueNode):null]})});He.displayName=Q;var Ue=`SelectItemIndicator`,We=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Be(Ue,n).isSelected?(0,R.jsx)(i.span,{"aria-hidden":!0,...r,ref:t}):null});We.displayName=Ue;var Ge=`SelectScrollUpButton`,Ke=F.forwardRef((e,t)=>{let n=X(Ge,e.__scopeSelect),r=Ae(Ge,e.__scopeSelect),[i,a]=F.useState(!1),o=v(t,r.onScrollButtonChange);return l(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Ye,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ke.displayName=Ge;var qe=`SelectScrollDownButton`,Je=F.forwardRef((e,t)=>{let n=X(qe,e.__scopeSelect),r=Ae(qe,e.__scopeSelect),[i,a]=F.useState(!1),o=v(t,r.onScrollButtonChange);return l(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Ye,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Je.displayName=qe;var Ye=F.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...o}=e,s=X(`SelectScrollButton`,n),c=F.useRef(null),u=U(n),d=F.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return F.useEffect(()=>()=>d(),[d]),l(()=>{u().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[u]),(0,R.jsx)(i.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:a(o.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:a(o.onPointerMove,()=>{s.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:a(o.onPointerLeave,()=>{d()})})}),Xe=`SelectSeparator`,Ze=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,R.jsx)(i.div,{"aria-hidden":!0,...r,ref:t})});Ze.displayName=Xe;var Qe=`SelectArrow`,$e=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n);return X(Qe,n).position===`popper`?(0,R.jsx)(C,{...i,...r,ref:t}):null});$e.displayName=Qe;var et=`SelectBubbleInput`,tt=F.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(et,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=F.useRef(null),h=v(n,m),g=a??``,_=A(g),y=Array.from(f).some(e=>(e.props.value??``)===``);return F.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(_!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[_,g]),(0,R.jsxs)(i.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...k,...t.style},ref:h,defaultValue:g,children:[$(a)&&!y?(0,R.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});tt.displayName=et;function nt(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function rt(e){let t=o(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function it(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=at(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function at(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ot=ce,st=fe;function ct({className:e,children:t,...n}){return(0,R.jsxs)(ue,{className:j(`flex h-[var(--ui-field-height)] w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,E,e),...n,children:[t,(0,R.jsx)(me,{asChild:!0,children:(0,R.jsx)(te,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function lt({className:e,children:t,position:n=`popper`,...r}){return(0,R.jsx)(ve,{children:(0,R.jsx)(ye,{position:n,sideOffset:4,className:j(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto`,D,`overlay-select-motion`,e),...r,children:(0,R.jsx)(Me,{children:t})})})}function ut({className:e,children:t,detail:n,...r}){return(0,R.jsxs)(Ve,{className:j(w,x,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,R.jsx)(We,{children:(0,R.jsx)(P,{className:`size-3.5`})})}),(0,R.jsx)(He,{children:t}),n]})}export{st as a,ct as i,lt as n,P as o,ut as r,ot as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{A as n,X as r,a as i,d as a,et as o,f as s,j as c,o as l,v as u}from"./auth-olLlgxc3.js";import{t as d}from"./jsx-runtime-By8HlURe.js";import{d as f}from"./index-BqOVeoIr.js";import{n as p}from"./api-BOuyloUi.js";import{n as m}from"./dist-BOS6OKSE.js";import{t as h}from"./x-Dq6POV20.js";import{t as g}from"./createLucideIcon-C9A1vLE-.js";import{t as _}from"./button-C_Rvtcwg.js";import{t as v}from"./copy-D0Theg4Q.js";import{t as y}from"./ws-Dgc69_w8.js";var b=g(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),x=g(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function ee(){return f.get()}var S=32,C=2048;function w(e,t,n){let r=e.getLine(t);if(!r)return null;let i=e.getNullCell(),a=``,o=[];for(let s=0;s<Math.min(n,r.length);s++){if(!r.getCell(s,i)||i.getWidth()===0)continue;if(s===n-1&&i.getChars()===``){let n=e.getLine(t+1);if(n?.isWrapped&&n.getCell(0)?.getWidth()===2)continue}let c=i.getChars()||` `;a+=c;for(let e=0;e<c.length;e++)o.push({row:t,col:s})}return{text:a,cells:o,isWrapped:r.isWrapped}}function te(e,t,n){return{...e,text:e.text.slice(t,n),cells:e.cells.slice(t,n)}}function T(e,t,n,r,i){if(t<0||n<1)return[];let a=Math.max(0,t-S+1),o=new Map;for(let r=a;r<t+S;r++){let t=w(e,r,n);if(!t)break;o.set(r,t)}let s=new Set,c=[];for(let l of[!0,!1])for(let u=a;u<=t;u++){if(o.get(u)?.isWrapped&&u>a)continue;let d=``,f=[];for(let a=u;a<u+S;a++){let p=o.get(a);if(!p)break;let m=o.get(a-1);if(a>u&&!p.isWrapped&&!(l&&m&&i(m,p,n,d)))break;let h=o.get(a+1),g=te(p,a>u&&!p.isWrapped?p.text.length-p.text.trimStart().length:0,h?.isWrapped?p.text.length:p.text.trimEnd().length);if(d.length+g.text.length>C)break;if(d+=g.text,f.push(...g.cells),!(a<t))for(let n of r(d)){let r=f[n.start],i=f[n.end-1];if(!r||!i||r.row>t||i.row<t)continue;let a=`${d.slice(n.start,n.end)}\0${r.row}:${r.col}-${i.row}:${i.col}`;if(s.has(a))continue;s.add(a);let o=e.getLine(i.row)?.getCell(i.col)?.getWidth()??1;c.push({candidate:n,start:r,end:{row:i.row,col:i.col+Math.max(1,o)-1},text:d.slice(n.start,n.end)})}}}return c.sort((e,t)=>t.text.length-e.text.length)}var E=n.options.join(`,`),D=a.imageBytes,O=20*1024*1024;async function ne(e,t,r){r?.throwIfAborted();let i=n.safeParse(e.type);if(!i.success)throw Error(`Choose a PNG, JPEG, GIF or WebP image.`);if(e.size===0)throw Error(`This image is empty.`);if(e.size>O)throw Error(`Choose an image smaller than 20 MiB.`);if(!t||e.size<=D)return{blob:e,mime:i.data,resized:!1};if(i.data===`image/gif`)throw Error(`Choose a GIF no larger than 4 MiB for remote access.`);let a=await createImageBitmap(e);try{r?.throwIfAborted();let e=document.createElement(`canvas`),t=e.getContext(`2d`);if(!t)throw Error(`Could not prepare this image.`);let o=i.data===`image/jpeg`?`image/jpeg`:`image/webp`,s=Math.min(1,2048/Math.max(a.width,a.height));for(let i=0;i<8;i++){e.width=Math.max(1,Math.round(a.width*s)),e.height=Math.max(1,Math.round(a.height*s)),t.drawImage(a,0,0,e.width,e.height);for(let t of[.85,.7,.55]){let i=await new Promise(n=>e.toBlob(n,o,t));if(r?.throwIfAborted(),i&&i.size<=D)return{blob:i,mime:n.parse(i.type),resized:!0}}s*=.75}throw Error(`This image is too large to attach remotely. Choose a smaller image.`)}finally{a.close()}}var k=new WeakSet,re=Math.floor((u.requestBytes-1024)*3/4);async function ie(e,t,n,i,l,u,d){let f=e.generation,p=()=>{if(u?.throwIfAborted(),l(),e.generation!==f)throw Error(`The connection changed; the image upload was interrupted.`)};if(p(),!n.size||n.size>a.imageBytes)throw Error(`The prepared image must be no larger than 4 MiB.`);if(k.has(e))throw Error(`An image upload is already in progress.`);k.add(e);let m=crypto.randomUUID(),h=`/api/worktrees/${t}/paste-upload`,g=!1,_=!1,v=async(t,n,r)=>{p();let i=await e.request(t,n,r,u),a=await i.json();if(p(),!i.ok){let e=o.safeParse(a);throw Error(e.success?e.data.error.message:`The image upload failed.`)}return a},y=e=>v(`POST`,h,e),b=async e=>{let t=new Uint8Array(await e.arrayBuffer());return p(),btoa(Array.from(t,e=>String.fromCharCode(e)).join(``))};try{let e=r.parse(await v(`GET`,`/api/version`));if(d?.(0,n.size),!e.remote_image_uploads){if(n.size>re)throw Error(`Update the host connector to upload images larger than 191 KiB.`);let e=await b(n),r=c.parse(await v(`POST`,`/api/worktrees/${t}/paste`,{mime:i,data:e}));return d?.(n.size,n.size),r}if(g=!0,s.parse(await y({action:`start`,upload:m,mime:i,size:n.size})).received!==0)throw Error(`Invalid image upload acknowledgement.`);for(let e=0;e<n.size;e+=a.chunkBytes){let t=n.slice(e,e+a.chunkBytes),r=await b(t),i=s.parse(await y({action:`chunk`,upload:m,offset:e,data:r}));if(i.received!==e+t.size)throw Error(`Invalid image upload acknowledgement.`);d?.(i.received,n.size)}let o=c.parse(await y({action:`finish`,upload:m}));return _=!0,o}finally{if(g&&!_&&e.generation===f)try{l(),e.request(`POST`,h,{action:`cancel`,upload:m}).catch(()=>{})}catch{}k.delete(e)}}function ae(e,t,n){if(t.startsWith(`login-`)||t===`home`)return!1;let r=Array.from(e.clipboardData?.items??[]);if(r.some(e=>e.type===`text/plain`))return!1;let i=r.find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!i)return!1;let a=i.getAsFile();return a?(A(a,t,n).then(({resized:e})=>{e&&m(`Image resized for remote access`)}).catch(e=>{m.error(e instanceof Error?`Image paste failed: ${e.message}`:`Image paste failed`)}),!0):!1}async function A(e,t,n,r={}){if(t.startsWith(`login-`)||t===`home`)throw Error(`Open a project terminal to attach an image.`);let i=l(),a=i?.generation,o=()=>{if(l()!==i||i?.generation!==a||!y.isConnected())throw Error(`The terminal connection changed; the image was not inserted.`)};r.signal?.throwIfAborted(),o(),r.onProgress?.({stage:`preparing`});let{blob:s,mime:u,resized:d}=await ne(e,i!==null,r.signal);o();let f=i?await ie(i,t,s,u,o,r.signal,(e,t)=>r.onProgress?.(e===t?{stage:`saving`}:{stage:`uploading`,received:e,total:t})):await(async()=>{let e=await oe(s);return o(),r.signal?.throwIfAborted(),c.parse(await p(`POST`,`/api/worktrees/${t}/paste`,{mime:u,data:e}))})();return r.signal?.throwIfAborted(),o(),r.onProgress?.({stage:`inserting`}),r.insert?r.insert(`${f.path} `):i?await i.input(t,n,`${f.path} `):y.write(t,n,`${f.path} `),{resized:d}}function oe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,``)),r.onerror=()=>n(r.error??Error(`could not read the clipboard image`)),r.readAsDataURL(e)})}var se=/(?:^|[\s"'`([<])((?:(?:\/|\.{1,2}\/|~\/)(?:[\w.+@~-]+\/)*[\w.+@~-]+|(?:[\w.+@~-]+\/)+[\w.+@~-]*|[\w.+@~-]+\.[A-Za-z]\w{0,11}))(?::(\d{1,6})(?::(\d{1,6}))?)?/dg,ce=/(?:^|[\s"'`([<])((?:~?\/|\.{1,2}\/|[\w.+@~-]+\/)(?:[\w.+@~-]+(?: [\w.+@~-]+)*\/)*[\w.+@~-]+)(?::(\d{1,6})(?::(\d{1,6}))?)?/dg,le=/"([^"\r\n]+)"|'([^'\r\n]+)'|`([^`\r\n]+)`|\(([^()\r\n]+)\)|\[([^\]\r\n[]+)\]/dg,ue=new Set([`.`,`,`,`;`,`:`,`)`,`]`,`'`,`"`]);function de(e){let t=[];for(let n of e.matchAll(le)){let e=n.slice(1).findIndex(e=>e!==void 0)+1,r=n[e];if(!r.includes(` `))continue;let i=/^(@?)(.+?)(?::(\d{1,6})(?::(\d{1,6}))?)?$/.exec(r);if(!i)continue;let a=i[2];if(!a.includes(`/`)&&!/\.[A-Za-z]\w{0,11}$/.test(a))continue;let o=n.indices[e][0]+i[1].length;t.push({path:a,line:i[3]===void 0?void 0:Number(i[3]),column:i[4]===void 0?void 0:Number(i[4]),start:o,end:n.indices[e][1]})}for(let n of[ce,se]){let r=new RegExp(n.source,n.flags),i;for(;i=r.exec(e);){let e=i.indices,n=i[1];if(!e?.[1]||n===void 0)continue;let r=e[1][0],a=e[1][1],o=n;for(o.startsWith(`@`)&&(o=o.slice(1),r++);o.length>0&&ue.has(o[o.length-1]);)o=o.slice(0,-1),a--;if(o.length===0)continue;let s=i[2]===void 0?void 0:Number.parseInt(i[2],10),c=i[3]===void 0?void 0:Number.parseInt(i[3],10),l=c!==void 0&&e[3]?e[3][1]:s!==void 0&&e[2]?e[2][1]:a;t.push({path:o,line:s,column:c,start:r,end:l})}}let n=new Set;return t.filter(e=>{let t=`${e.start}:${e.end}:${e.path}`;return n.has(t)?!1:(n.add(t),!0)}).sort((e,t)=>e.start-t.start||t.end-e.end)}function fe(e,t,n){let r=e.text.trimEnd(),i=t.text.trimStart();if(!/[\w.+@~/:-]$/.test(r)||!/^[\w.+@~/:-]/.test(i)||/^(?:~\/|\.{1,2}\/)/.test(i))return!1;let a=e.cells[r.length-1];return r.endsWith(`/`)||i.startsWith(`/`)||a!==void 0&&a.col>=n-9}function pe(e,t,n){return T(e,t,n,de,fe)}function me(e,t){return e.kind===`file`&&e.root!==void 0&&e.root!==t?e.root:null}var j=class{fetcher;now;positiveTtlMs;negativeTtlMs;maxEntries;maxConcurrent;entries=new Map;inflight=new Map;inUse=0;waiters=[];constructor(e){this.fetcher=e.fetcher,this.now=e.now??Date.now,this.positiveTtlMs=e.positiveTtlMs??15e3,this.negativeTtlMs=e.negativeTtlMs??5e3,this.maxEntries=e.maxEntries??500,this.maxConcurrent=e.maxConcurrent??4}resolve(e,t,n){let r=`${e}\0${t}`,i=this.entries.get(r);if(i){if(this.now()<i.expiresAt)return Promise.resolve(i.value);this.entries.delete(r)}let a=this.inflight.get(r);if(a)return a;let o=this.withSlot(()=>this.fetcher(e,t,n)).then(e=>(this.store(r,e),e)).finally(()=>{this.inflight.delete(r)});return this.inflight.set(r,o),o}store(e,t){let n=t?this.positiveTtlMs:this.negativeTtlMs;for(this.entries.set(e,{value:t,expiresAt:this.now()+n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}async withSlot(e){this.inUse>=this.maxConcurrent&&await new Promise(e=>this.waiters.push(e)),this.inUse++;try{return await e()}finally{this.inUse--,this.waiters.shift()?.()}}};async function M(e,t,n,r){let i=new URLSearchParams({path:t});return n!==void 0&&i.set(`line`,String(n)),r!==void 0&&i.set(`root`,r),p(`GET`,`/api/worktrees/${e}/resolve?${i}`)}function N(e,t,n){let r=e.kind??`file`;return{kind:r,path:e.path,...e.root===void 0?{}:{root:e.root},...e.relative_path===void 0?{}:{relativePath:e.relative_path},...r===`file`&&t!==void 0?{line:Math.max(1,t)}:{},...r===`file`&&n!==void 0?{column:n}:{}}}async function P(e,t,n){return N(await M(e,t,n?.line,n?.root),n?.line,n?.column)}async function F(e,t,n){try{return await M(e,t,n)}catch{return null}}function I(e,t,n){let r=new j({fetcher:F});return e.registerLinkProvider({provideLinks(i,a){let o=e.buffer.active,s=pe(o,i-1,e.cols);if(s.length===0){a(void 0);return}Promise.all(s.map(async({candidate:e,start:i,end:a,text:o})=>{let s=await r.resolve(t,e.path,e.line);return s?{range:{start:{x:i.col+1,y:i.row+1},end:{x:a.col+1,y:a.row+1}},text:o,decorations:{underline:!0,pointerCursor:!0},activate:t=>{!t.metaKey&&!t.ctrlKey||n(N(s,e.line,e.column))}}:null})).then(e=>{let t=e.filter(e=>e!==null);a(t.length>0?t:void 0)})}})}var L=e(t(),1),R={ctrl:1,alt:2,shift:4},he=/^(?:\[[ABCD]|O[ABCD]|\[1;([2-8])[ABCD])$/,z=e=>e.startsWith(`\x1B`)?he.exec(e.slice(1)):null;function B(e){return!e.startsWith(`\x1B`)||e===`\x1B`||z(e)!==null||e===`\x1B[Z`}function ge(e,t){if(!t)return e;let n=(t&R.ctrl)!==0,r=(t&R.alt)!==0,i=(t&R.shift)!==0,a=!!i|(r?2:0)|(n?4:0),o=z(e);if(o)return`\x1b[1;${1+(a|(o[1]?Number(o[1])-1:0))}${e.slice(-1)}`;if(!B(e))return e;if(e===` `||e===`\x1B[Z`)return i||e===`\x1B[Z`?`\x1B[Z`:` `;if(e===`\r`&&i)return`\x1b[13;${1+a}u`;if(i&&e.length===1){let t="`1234567890-=[]\\;',./".indexOf(e);t===-1?/[a-z]/.test(e)&&(e=e.toUpperCase()):e=`~!@#$%^&*()_+{}|:"<>?`[t]}if(n&&e.length===1){let t=e.toUpperCase().charCodeAt(0);t>=64&&t<=95?e=String.fromCharCode(t-64):e===` `?e=`\0`:e===`?`&&(e=``)}return r?`\x1b${e}`:e}function _e(e){return e.length===3&&(e.startsWith(`\x1B[`)||e.startsWith(`\x1BO`))&&`ABCD`.includes(e[2])}var V=new Map,H=new Map,U=new Map,W=new Map,G=new Set,K=e=>(G.add(e),()=>{G.delete(e)}),q=()=>{for(let e of G)e()},J=(e,t)=>i(JSON.stringify([e,t]));function ve(e,t){return(0,L.useSyncExternalStore)(K,()=>V.has(J(e,t)))}function ye(e,t,n,r,i){let a=J(e,t);return V.set(a,n),r&&H.set(a,r),i?U.set(a,i):U.delete(a),q(),()=>{V.get(a)===n&&(V.delete(a),H.delete(a),U.delete(a),W.delete(a),q())}}function Y(e,t){H.get(J(e,t))?.()}function X(e,t){return(0,L.useSyncExternalStore)(K,()=>W.get(J(e,t))??0)}function be(e,t,n){let r=J(e,t);W.set(r,(W.get(r)??0)^n),q()}function Z(e,t,n){let r=J(e,t),i=W.get(r)??0;return!i||!B(n)?n:(W.delete(r),q(),ge(n,i))}async function xe(e,t,n,r=!1){let i=J(e,t),a=V.get(i);if(!a)throw Error(`Wait for the terminal to attach; nothing was sent`);let o=r?`${a(n)}\r`:Z(e,t,n);!r&&_e(o)&&U.get(i)?.()&&(o=`\x1bO${o.slice(-1)}`),await Q(e,t,o)}async function Se(e,t,n){let r=J(e,t),i=V.get(r),a=l(),o=a?.generation;if(!i||!n()||!y.isConnected())throw Error(`Wait for the terminal to attach; nothing was pasted.`);let s;try{let n=navigator.clipboard.readText();Y(e,t),s=await n}catch{throw Error(`Could not read the clipboard. Allow clipboard access or use your keyboard’s Paste action.`)}if(!n()||V.get(r)!==i||l()!==a||a?.generation!==o||!y.isConnected())throw Error(`The terminal changed; nothing was pasted. Try again in the active terminal.`);s&&await Q(e,t,i(s))}async function Q(e,t,n){let r=l();if(r)await r.input(e,t,n);else{if(!y.isConnected())throw Error(`Terminal is disconnected; nothing was sent`);y.write(e,t,n)}}var $=d();function Ce({text:e,label:t,clear:n,paste:r}){let[i,a]=(0,L.useState)(!1);return(0,$.jsxs)(`div`,{role:`toolbar`,"aria-label":t,onPointerDown:e=>e.preventDefault(),className:`absolute right-2 top-2 z-20 flex gap-1 rounded-md bg-elevated p-1 shadow-lg`,children:[(0,$.jsxs)(_,{variant:`ghost`,size:`sm`,disabled:!e||i,onClick:async()=>{try{await navigator.clipboard.writeText(e),n()}catch{m.error(`Could not copy the selection. Try again.`)}},children:[(0,$.jsx)(v,{}),` Copy`]}),r&&(0,$.jsxs)(_,{variant:`ghost`,size:`sm`,disabled:i,onClick:async()=>{if(!i){a(!0);try{await r(),n()}catch(e){m.error(e instanceof Error?e.message:`Could not paste. Try again.`)}finally{a(!1)}}},children:[(0,$.jsx)(b,{}),` Paste`]}),(0,$.jsx)(_,{variant:`ghost`,size:`icon`,"aria-label":`Clear selection`,disabled:i,onClick:n,children:(0,$.jsx)(h,{})})]})}export{T as _,ye as a,x as b,ve as c,me as d,I as f,E as g,A as h,Se as i,X as l,ae as m,Z as n,xe as o,P as p,Y as r,be as s,Ce as t,R as u,w as v,ee as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{U as n}from"./auth-olLlgxc3.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{U as n}from"./auth-olLlgxc3.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{C as i,E as a,T as o,g as s}from"./dialog-D-Axqpzg.js";import{o as c}from"./x-Dq6POV20.js";import{t as l,y as u}from"./chevron-right-BEy-IXEZ.js";import{t as d}from"./dist-Dge3wHdO.js";import{n as f,t as p}from"./createLucideIcon-C9A1vLE-.js";var m=p(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),h=p(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),g=p(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),_=p(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),v=p(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),y=r();function b({summary:e,summaryClassName:t,className:n,children:r,...i}){return(0,y.jsxs)(`details`,{className:f(`[&[open]>summary>svg]:rotate-90`,n),...i,children:[(0,y.jsxs)(`summary`,{className:f(`flex cursor-pointer select-none list-none items-center gap-1 text-fg-secondary transition-colors hover:text-fg [&::-webkit-details-marker]:hidden`,t),children:[(0,y.jsx)(l,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]}),r]})}var x=e(t(),1),S=new Set;function C(e){let t=/^#settings\/([\w-]+)$/.exec(e);return t?t[1]:null}var w=C(window.location.hash);function T(){let e=w?`#settings/${w}`:``;window.location.hash!==e&&history.replaceState(null,``,window.location.pathname+window.location.search+e)}function E(e){if(e!==w){w=e;for(let e of S)e()}queueMicrotask(T)}window.addEventListener(`hashchange`,()=>E(C(window.location.hash))),window.addEventListener(`popstate`,()=>E(C(window.location.hash)));function D(){return(0,x.useSyncExternalStore)(e=>(S.add(e),()=>{S.delete(e)}),()=>w)}function O(e=`appearance`){E(e)}function k(){E(null)}function A(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}var j=` — `;function M(e){return e.replace(/\/+$/,``).split(`/`).pop()??``}function N(e){return{name:A(e),title:e.title??``,agentName:e.agent_title??``,sequence:e.osc_title??``,branch:e.branch,cwd:M(e.worktree_path),id:e.id.slice(0,8),status:e.status,agent:e.agent_type??``}}function P(e,t){let r=t&&t.length>0?t:n,i=N(e),a=[];for(let e of r.split(/(\$\{[a-zA-Z]+\})/)){if(e===``)continue;let t=/^\$\{([a-zA-Z]+)\}$/.exec(e)?.[1];t===void 0?a.push({text:e,sep:!1}):t===`separator`?a.push({text:j,sep:!0}):a.push({text:i[t]??e,sep:!1})}let o=[];a.forEach((e,t)=>{if(!e.sep){o.push(e.text);return}let n=o.join(``).trim().length>0,r=a.slice(t+1).some(e=>!e.sep&&e.text.trim().length>0);n&&r&&o.push(e.text)});let s=o.join(``).trim();return s.length>0?s:e.id.slice(0,8)}var F=`Switch`,[I,L]=o(F),[R,z]=I(F);function B(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=s({prop:n,defaultProp:i??!1,onChange:l,caller:F}),[h,g]=x.useState(null),[_,v]=x.useState(null),b={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:c,form:o,value:d,hasConsumerStoppedPropagationRef:x.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,y.jsx)(R,{scope:t,...b,children:J(f)?f(b):r})}var V=`SwitchTrigger`,H=x.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:o,form:s,value:l,disabled:u,checked:d,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:_}=z(V,e),v=c(r,p),b=x.useRef(d);return x.useEffect(()=>{let e=s?o?.ownerDocument.getElementById(s):o?.form;if(e instanceof HTMLFormElement){let t=()=>m(b.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,s,m]),(0,y.jsx)(i.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":Y(d),"data-disabled":u?``:void 0,disabled:u,value:l,...n,ref:v,onClick:a(t,e=>{m(e=>!e),_&&g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});H.displayName=V;var U=x.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,y.jsx)(B,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(H,{...d,ref:t,__scopeSwitch:n}),e&&(0,y.jsx)(q,{__scopeSwitch:n})]})})});U.displayName=F;var W=`SwitchThumb`,G=x.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,a=z(W,n);return(0,y.jsx)(i.span,{"data-state":Y(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})});G.displayName=W;var K=`SwitchBubbleInput`,q=x.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:s,required:l,disabled:f,name:p,value:m,form:h,bubbleInput:g,setBubbleInput:_}=z(K,e),v=c(n,_),b=d(o),S=u(r);x.useEffect(()=>{let e=g;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!a.current;if(b!==o&&n){let t=new Event(`click`,{bubbles:r});n.call(e,o),e.dispatchEvent(t)}},[g,b,o,a]);let C=x.useRef(o);return(0,y.jsx)(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:l,disabled:f,name:p,value:m,form:h,...t,tabIndex:-1,ref:v,style:{...t.style,...S,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});q.displayName=K;function J(e){return typeof e==`function`}function Y(e){return e?`checked`:`unchecked`}function X({className:e,...t}){return(0,y.jsx)(U,{className:f(`peer group/switch inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,y.jsx)(`span`,{className:`pointer-events-none inline-flex h-5 w-9 shrink-0 items-center rounded-full bg-border transition-colors group-hover/switch:bg-border/70 group-data-[state=checked]/switch:bg-action`,children:(0,y.jsx)(G,{className:`block size-4 rounded-full bg-ground shadow-sm transition-[translate] duration-200 ease-out data-[state=checked]:translate-x-[1.125rem] data-[state=unchecked]:translate-x-0.5`})})})}export{D as a,_ as c,m as d,O as i,g as l,P as n,b as o,k as r,v as s,X as t,h as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{S as n,at as r,b as i}from"./protocol-support-BApsXw77.js";import{F as a}from"./auth-olLlgxc3.js";import{t as o}from"./jsx-runtime-By8HlURe.js";import{g as s}from"./hotkeys-Cu0t6sbz.js";import{C as c,E as l,T as u,_ as d,g as f,v as p,x as m,y as ee}from"./dialog-D-Axqpzg.js";import{i as h,o as g}from"./x-Dq6POV20.js";import{_ as te,a as _,d as v,g as y,h as ne,m as b,v as x}from"./chevron-right-BEy-IXEZ.js";import{i as S}from"./dist-Dge3wHdO.js";import{n as C,t as re}from"./createLucideIcon-C9A1vLE-.js";import{c as ie,n as ae}from"./switch-OMx-_DY7.js";import{a as w,n as oe,o as T}from"./preview-kind-CPkO-rSz.js";import{t as se}from"./debounce-B9DrqirV.js";var E=e(t(),1),D=o(),[O,ce]=u(`Tooltip`,[x]),k=x(),le=`TooltipProvider`,ue=700,A=`tooltip.open`,[de,j]=O(le),fe=e=>{let{__scopeTooltip:t,delayDuration:n=ue,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=E.useRef(!0),s=E.useRef(!1),c=E.useRef(0);return E.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,D.jsx)(de,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:E.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:E.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:E.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};fe.displayName=le;var M=`Tooltip`,[pe,N]=O(M),me=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=j(M,e.__scopeTooltip),l=k(t),[u,d]=E.useState(null),p=ee(),m=E.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=E.useRef(!1),[v,y]=f({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(A))):c.onClose(),a?.(e)},caller:M}),ne=E.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),b=E.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),x=E.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),S=E.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return E.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,D.jsx)(te,{...l,children:(0,D.jsx)(pe,{scope:t,contentId:p,open:v,stateAttribute:ne,trigger:u,onTriggerChange:d,onTriggerEnter:E.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:E.useCallback(()=>{h?x():(window.clearTimeout(m.current),m.current=0)},[x,h]),onOpen:b,onClose:x,disableHoverableContent:h,children:n})})};me.displayName=M;var P=`TooltipTrigger`,he=E.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=N(P,n),a=j(P,n),o=k(n),s=g(t,E.useRef(null),i.onTriggerChange),u=E.useRef(!1),d=E.useRef(!1),f=E.useCallback(()=>u.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,D.jsx)(b,{asChild:!0,...o,children:(0,D.jsx)(c.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:l(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:l(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:l(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:l(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:l(e.onBlur,i.onClose),onClick:l(e.onClick,i.onClose)})})});he.displayName=P;var F=`TooltipPortal`,[ge,_e]=O(F,{forceMount:void 0}),ve=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=N(F,t);return(0,D.jsx)(ge,{scope:t,forceMount:n,children:(0,D.jsx)(d,{present:n||a.open,children:(0,D.jsx)(p,{asChild:!0,container:i,children:r})})})};ve.displayName=F;var I=`TooltipContent`,ye=E.forwardRef((e,t)=>{let n=_e(I,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=N(I,e.__scopeTooltip);return(0,D.jsx)(d,{present:r||o.open,children:o.disableHoverableContent?(0,D.jsx)(we,{side:i,...a,ref:t}):(0,D.jsx)(be,{side:i,...a,ref:t})})}),be=E.forwardRef((e,t)=>{let n=N(I,e.__scopeTooltip),r=j(I,e.__scopeTooltip),i=E.useRef(null),a=g(t,i),[o,s]=E.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=E.useCallback(()=>{s(null),d(!1)},[d]),p=E.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Oe(r,De(r,n.getBoundingClientRect())),a=ke(t.getBoundingClientRect()),o=je([...i,...a]);s(o),d(!0)},[d]);return E.useEffect(()=>()=>f(),[f]),E.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),E.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Ae(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,D.jsx)(we,{...e,ref:a})}),[xe,Se]=O(M,{isInside:!1}),Ce=h(`TooltipContent`),we=E.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=N(I,n),l=k(n),{onClose:u}=c;return E.useEffect(()=>(document.addEventListener(A,u),()=>document.removeEventListener(A,u)),[u]),E.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,D.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,D.jsxs)(y,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,D.jsx)(Ce,{children:r}),(0,D.jsx)(xe,{scope:n,isInside:!0,children:(0,D.jsx)(S,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ye.displayName=I;var Te=`TooltipArrow`,Ee=E.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=k(n);return Se(Te,n).isInside?null:(0,D.jsx)(ne,{...i,...r,ref:t})});Ee.displayName=Te;function De(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Oe(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ke(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function je(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Me(t)}function Me(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Ne=fe,Pe=me,Fe=he,Ie=ve,Le=ye,Re=Ne,ze=Pe,Be=Fe;function Ve({className:e,sideOffset:t=4,...n}){return(0,D.jsx)(Ie,{children:(0,D.jsx)(Le,{sideOffset:t,className:C(`z-50 overflow-hidden px-2 py-1 text-xs text-fg`,_,v,`overlay-tooltip-motion`,e),...n})})}var He=re(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);function Ue({initial:e,maxLength:t,className:n,fitContent:r=!1,onCommit:i,onCancel:a}){let[o,s]=(0,E.useState)(e),c=(0,D.jsx)(`input`,{autoFocus:!0,value:o,maxLength:t,onFocus:e=>e.currentTarget.select(),onChange:e=>s(e.target.value),onBlur:()=>i(o),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?i(o):e.key===`Escape`&&a()},className:C(`bg-transparent outline-none`,r?`col-start-1 row-start-1 w-0 min-w-full p-0`:n)});return r?(0,D.jsxs)(`span`,{className:C(`inline-grid min-w-px`,n),children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 whitespace-pre`,children:o||``}),c]}):c}function We(e){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:t=>{t.preventDefault(),e()}}}var L=null;function Ge(e){return L=e,()=>{L===e&&(L=null)}}function Ke(){L?.()}var R=null;function qe(e){return R=e,()=>{R===e&&(R=null)}}async function Je(e){if(!R)throw Error(`Open a project before opening a path.`);await R(e)}function Ye(){let e=r(s()??void 0).data?.tabTitleTemplate;return(0,E.useCallback)(t=>ae(t,e),[e])}var Xe=(0,E.createContext)({open:()=>void 0,handler:null,setHandler:()=>void 0});function Ze({children:e}){let[t,n]=(0,E.useState)(null),r=(0,E.useCallback)(e=>n(()=>e),[]),i=(0,E.useCallback)(e=>t?.(e),[t]),a=(0,E.useMemo)(()=>({open:i,handler:t,setHandler:r}),[i,t,r]);return(0,D.jsx)(Xe.Provider,{value:a,children:e})}function Qe(){return(0,E.useContext)(Xe)}function $e({className:e,strokeScale:t=1}){return(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`22`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`20.66`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`20.66`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`2`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`3.34`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`3.34`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`15.25`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`18.5`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`15.25`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`8.75`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`5.5`}),(0,D.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`8.75`})]})}function et({className:e,strokeScale:t=1}){return(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.6*t,"aria-hidden":!0,children:[(0,D.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,D.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(60 12 12)`}),(0,D.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(120 12 12)`})]})}function tt({className:e,strokeScale:t=1}){return(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,D.jsx)(`path`,{d:`M8 4H4v16h4`}),(0,D.jsx)(`path`,{d:`M16 4h4v16h-4`}),(0,D.jsx)(`rect`,{x:`10.5`,y:`10.5`,width:`3`,height:`3`,fill:`currentColor`,stroke:`none`})]})}function nt({className:e}){return(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,"aria-hidden":!0,children:(0,D.jsx)(`path`,{d:`M12 1.5c0 5.8 4.7 10.5 10.5 10.5C16.7 12 12 16.7 12 22.5 12 16.7 7.3 12 1.5 12 7.3 12 12 7.3 12 1.5Z`})})}function rt({type:e,className:t,strokeScale:n=1}){switch(e){case`claude-code`:return(0,D.jsx)($e,{className:t,strokeScale:n});case`codex`:return(0,D.jsx)(et,{className:t,strokeScale:n});case`opencode`:return(0,D.jsx)(tt,{className:t,strokeScale:n});case`gemini-cli`:return(0,D.jsx)(nt,{className:t});default:return(0,D.jsx)(ie,{className:t,strokeWidth:2*n})}}var z=new Set,B=!1,it=null;function at(){for(let e of z)e()}function ot(e){return z.add(e),()=>z.delete(e)}function st(e){B!==e&&(B=e,at())}function ct(){st(!B)}function lt(){return(0,E.useSyncExternalStore)(ot,()=>B)}function ut(e){it=e,at()}function dt(){return(0,E.useSyncExternalStore)(ot,()=>it)}function V(){return crypto.randomUUID()}function H(e){return e.type===`terminal`?`term:${e.session}`:`editor:${w(e.tab)}`}function U(e,t){return H(e)===H(t)}function ft(e){return e.type===`terminal`}function pt(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function W(e=[],t){let n=e.map(H),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:V(),tabs:e,activeKey:r,previewKey:null}}function G(e,t,n){return{kind:`split`,id:V(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function K(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=K(n,t);if(e)return e}return null}function q(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>H(e)===t)?e:null;for(let n of e.children){let e=q(n,t);if(e)return e}return null}function J(e){return e.kind===`leaf`?[e]:e.children.flatMap(J)}function mt(e){return J(e).flatMap(e=>e.tabs)}function ht(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(ht)]}function gt(e){let t=ht(e);return new Set(t).size!==t.length}function _t(e){return e.kind===`leaf`?{...e,id:V()}:{...e,id:V(),children:e.children.map(_t)}}function vt(e){if(!gt(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?V():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function yt(e){let t=e.tabs.map(H),n=e.activeKey&&t.includes(e.activeKey)?e.activeKey:t[0]??null,r=e.previewKey&&t.includes(e.previewKey)?e.previewKey:null;return n===e.activeKey&&r===(e.previewKey??null)?e:{...e,activeKey:n,previewKey:r}}function Y(e){if(e.kind===`leaf`)return yt(e);let t=e.children.map(Y),n=[],r=[];t.forEach((t,i)=>{let a=e.sizes[i]??1;if(t.kind===`split`&&t.direction===e.direction){let e=t.sizes.reduce((e,t)=>e+t,0)||t.children.length;t.children.forEach((i,o)=>{n.push(i),r.push(a*(t.sizes[o]??1)/e)})}else n.push(t),r.push(a)});let i=[],a=[];return n.forEach((e,t)=>{e.kind===`leaf`&&e.tabs.length===0||(i.push(e),a.push(r[t]??1))}),i.length===0?W([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function X(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>X(e,t,n))}}function bt(e,t,n){return X(e,t,e=>{if(!e.tabs.some(e=>H(e)===n))return e;let t=e.tabs.filter(e=>H(e)!==n),r=e.activeKey===n?xt(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function xt(e,t){let n=e.tabs.findIndex(e=>H(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>H(e)!==t);return r.length===0?null:H(r[Math.min(n,r.length-1)])}function St(e,t,n){let r=e.tabs.filter(e=>!U(e,t)),i=n===void 0?r.length:Math.max(0,Math.min(n,r.length)),a=[...r.slice(0,i),t,...r.slice(i)];return{...e,tabs:a,activeKey:H(t)}}function Ct(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return Y(X(e,t,e=>{let t=W([r]);return G(i,a?[t,e]:[e,t],[50,50])}))}function wt(e,t){let{fromLeafId:n,toLeafId:r,edge:i}=t;if(n===r)return e;let a=K(e,n),o=K(e,r);if(!a||!o)return e;if(i===`center`){let t=e=>e.kind===`leaf`?e.id===n?o:e.id===r?a:e:{...e,children:e.children.map(t)};return t(e)}let s=Y(X(e,n,e=>({...e,tabs:[],activeKey:null,previewKey:null}))),c=i===`left`||i===`right`?`row`:`col`,l=i===`left`||i===`top`;return Y(X(s,r,e=>G(c,l?[a,e]:[e,a],[50,50])))}function Tt(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=H(n),o=t.copy===!0&&!ft(n),s=t.index;if(i===`center`&&s!==void 0){let t=K(e,r)?.tabs.findIndex(e=>H(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:bt(e,t.fromLeafId,a);if(i===`center`){let e=X(c,r,e=>St(e,n,s));return!K(e,r)&&!q(e,a)?Z(Y(Et(e,n)),a):Z(Y(e),a)}return K(c,r)?Z(Ct(c,r,i,n),a):Y(W([n]))}function Et(e,t){let n=J(e)[0];return n?X(e,n.id,e=>St(e,t)):W([t])}function Dt(e,t,n){return Y(X(e,t,e=>e.tabs.some(e=>H(e)===n)?{...e,tabs:e.tabs.filter(e=>H(e)!==n),activeKey:e.activeKey===n?xt(e,n):e.activeKey}:e))}function Ot(e,t,n){let r=H(n);return Y(X(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>U(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function kt(e,t,n){let r=H(n);return Y(X(e,t,e=>e.tabs.some(e=>H(e)===r)?{...e,tabs:e.tabs.map(e=>H(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function At(e,t,n){let r=H(n);return X(e,t,e=>({...e,tabs:e.tabs.map(e=>H(e)===r?n:e)}))}function jt(e,t,n){let r=w(t),i=e=>e.kind===`split`?{...e,children:e.children.map(i)}:{...e,tabs:e.tabs.map(e=>e.type===`editor`&&w(e.tab)===r?{...e,tab:{...e.tab,compile_mode:n}}:e)};return i(e)}function Mt(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||oe(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function Nt(e,t,n){let r=H(n);return Y(X(e,t,e=>{if(e.tabs.some(e=>U(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>H(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=e.tabs.length>1&&i!==void 0&&!ft(i)&&!pt(i),o=i?Mt(i,n):n,s=a?e.tabs.map((e,n)=>n===t?o:e):[...e.tabs,o];return{...e,tabs:s,activeKey:r,previewKey:r}}))}function Z(e,t){let n=e=>e.kind===`leaf`?e.previewKey===t?{...e,previewKey:null}:e:{...e,children:e.children.map(n)};return n(e)}function Pt(e,t,n,r){return X(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&H(e)===n),i=t>=0?e.tabs[t]:void 0;if(i===void 0||i.type!==`editor`)return e;let a={...i,tab:{...i.tab,view:r}},o=H(a);if(o===n)return{...e,tabs:e.tabs.map((e,n)=>n===t?a:e)};let s=e.tabs.some((e,n)=>n!==t&&H(e)===o),c=s?e.tabs.filter((e,n)=>n!==t):e.tabs.map((e,n)=>n===t?a:e);return{...e,tabs:c,activeKey:e.activeKey===n?o:e.activeKey,previewKey:e.previewKey===n?s?null:o:e.previewKey??null}})}function Ft(e,t){let n=T(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function It(e,t,n){if(n===t.path)return e;let r=!1,i=e=>{if(e.kind===`split`){let t=e.children.map(i);return t.some((t,n)=>t!==e.children[n])?{...e,children:t}:e}let a=new Map,o=!1,s=e.tabs.map(e=>{if(e.type!==`editor`||!Ft(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(H(e),H(r)),o=!0,r});if(!o)return e;r=!0;let c=e.activeKey,l=e.previewKey??null;return{...e,tabs:s,activeKey:c===null?null:a.get(c)??c,previewKey:l===null?null:a.get(l)??l}},a=i(e);return r?a:e}function Lt(e){if(e.type!==`editor`)return null;let t=e.tab,n=T(t);return n!==`file`&&n!==`external`||t.view===`linked`||t.view===`locked`||oe(t.path)===null?null:t}function Rt(e,t){let n=Lt(t);if(!n)return e;let r=!1,i=e=>{if(e.kind===`split`)return{...e,children:e.children.map(i)};let t=!1,a=e.tabs.map(e=>{if(e.type!==`editor`||!pt(e))return e;let r=e.tab;return r.session===n.session&&r.path===n.path&&(r.root??``)===(n.root??``)&&T(r)===T(n)?e:(t=!0,{type:`editor`,tab:{session:n.session,path:n.path,...n.kind===void 0?{}:{kind:n.kind},...n.root===void 0?{}:{root:n.root},view:r.view}})});return t?(r=!0,{...e,tabs:a}):e},a=i(e);return r?a:e}function zt(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&T(e)===T(t)}function Bt(e,t,n){let r=J(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!zt(n.tab,t)?[]:[{leafId:e.id,ref:n}]));return r.find(({leafId:e})=>e===n)??r.find(({ref:e})=>(e.tab.view??`source`)===`source`)??r[0]??null}function Vt(e,t,n){return X(e,t,e=>e.tabs.some(e=>H(e)===n)?{...e,activeKey:n}:e)}function Ht(e,t,n){function r(e){return e.kind===`leaf`?e:e.id===t&&n.length===e.children.length?{...e,children:e.children.map(r),sizes:[...n]}:{...e,children:e.children.map(r)}}return r(e)}function Ut(e){let t=e.type===`terminal`?e.session:e.tab.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function Wt(e){return t=>{let n=Ut(t);return n===null||e.has(n)}}function Q(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return Y(n(e))}function Gt(e){let t=new Set,n=[];for(let r of e){let e=Y(Q(r,e=>!t.has(H(e)))),i=mt(e);if(i.length!==0){for(let e of i)t.add(H(e));n.push(e)}}return n.length===0?W([]):vt(n.length===1?n[0]:Y(G(`row`,n)))}function Kt(e){let t=e.editor_tabs.map(e=>({type:`editor`,tab:e})),n=e.session_tabs.map(e=>({type:`terminal`,session:e})),r=e.active_editor_tab?H({type:`editor`,tab:e.active_editor_tab}):null,i=e.active_session?`term:${e.active_session}`:null;if(t.length===0&&n.length===0)return W([]);if(t.length===0)return W(n,i);if(n.length===0)return W(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return Y(G(`col`,[W(t,r),W(n,i)],[o,s]))}function qt(e){return JSON.stringify(Jt(e))}function Jt(e){return e===null?null:e.kind===`leaf`?e.tabs.length===0?null:{t:e.tabs.map(H)}:{d:e.direction,s:e.sizes.map(e=>Math.round(e*10)/10),c:e.children.map(Jt)}}var Yt=new Set,$=!1,Xt=null;function Zt(){for(let e of Yt)e()}function Qt(e){return Yt.add(e),()=>Yt.delete(e)}function $t(e){$!==e&&($=e,Zt())}function en(){$t(!$)}function tn(){return(0,E.useSyncExternalStore)(Qt,()=>$)}function nn(e){Xt=e,Zt()}function rn(){return(0,E.useSyncExternalStore)(Qt,()=>Xt)}var an={layout_tree:null,active_session:null,layout_ref:null};function on(e){return e.type===`terminal`?e.session:e.tab.session}function sn(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of mt(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function cn(e,t){let n=e.project_layouts[t];return{...e,layout_tree:n?.layout_tree??null,active_session:n?.active_session??null,layout_ref:n?.layout_ref??null,session_tabs:[],editor_tabs:[],active_editor_tab:null}}function ln(e,t,n){return n?{loaded:e.loaded,snapshot:cn(e.snapshot,t),current:()=>cn(e.current(),t),update(n){let r={},i={...n};if(`layout_tree`in n&&(r.layout_tree=n.layout_tree??null,delete i.layout_tree),`active_session`in n&&(r.active_session=n.active_session??null,delete i.active_session),`layout_ref`in n&&(r.layout_ref=n.layout_ref??null,delete i.layout_ref),Object.keys(r).length>0){let n=e.current().project_layouts;i.project_layouts={...n,[t]:{...n[t]??an,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function un(e,t,n,r){let i=e.layout_tree??Kt(e),a={};for(let o of t)a[o]={layout_tree:_t(Q(i,e=>{let i=on(e);return i===`00000000-0000-0000-0000-000000000000`?o===(r??t[0]):n.get(i)===o})),active_session:e.active_session!==null&&n.get(e.active_session)===o?e.active_session:null,layout_ref:null};return{layout_mode:`project`,project_layouts:a}}function dn(e,t,n={}){return{...e,...t,...n}}function fn(e,t,n){let r=t.layout_tree?Q(t.layout_tree,e=>{let t=on(e);return t===`00000000-0000-0000-0000-000000000000`||n.alive.has(t)}):null,i=t.active_session!==null&&n.alive.has(t.active_session)?t.active_session:null;if(t.scope===`profile`)return{projectBased:!1,patch:{layout_mode:`profile`,layout_tree:r,active_session:i,layout_ref:t.id}};let a=t.project_id??n.currentProject??n.projectIds[0]??``,o={layout_tree:r,active_session:i,layout_ref:t.id};if((e.layout_mode??`profile`)===`project`)return{projectBased:!0,patch:{project_layouts:{...e.project_layouts,[a]:o}}};let s=un(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:dn(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function pn(e,t){let n=e.project_layouts,r=[...t.filter(e=>e in n),...Object.keys(n).filter(e=>!t.includes(e))].map(e=>n[e]);return{layout_mode:`profile`,project_layouts:{},layout_tree:Gt(r.map(e=>e.layout_tree).filter(e=>e!==null)),active_session:r.map(e=>e.active_session).find(e=>e!==null)??null,layout_ref:null}}var mn=2e3,hn=a.parse({});function gn(e){return`puddle.ws.${e}`}function _n(e){if(e===null)return{kind:`absent`};try{return{kind:`present`,snapshot:a.parse(JSON.parse(e))}}catch{return{kind:`corrupt`}}}function vn(){let e=s(),[t,r]=(0,E.useState)(!1),[a,o]=(0,E.useState)(hn),c=(0,E.useRef)(a);c.current=a;let l=(0,E.useRef)(null),u=(0,E.useMemo)(()=>se((e,t)=>{n(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`))},mn),[]);return(0,E.useEffect)(()=>{if(e===null){l.current=null;return}let t=gn(e);l.current=t;let n=!1;r(!1),o(hn);let a;try{a=_n(sessionStorage.getItem(t)),a.kind===`corrupt`&&sessionStorage.removeItem(t)}catch(e){console.warn(`ui-state read failed: ${e.message}`),a={kind:`absent`}}return a.kind===`present`?(o(a.snapshot),r(!0)):i(e).then(e=>{n||(e&&o(e.ui_state),r(!0))}).catch(e=>{console.warn(`ui-state load failed: ${e.message}`),n||r(!0)}),()=>{n=!0,u.flush()}},[e,u]),{loaded:t,snapshot:a,current:()=>c.current,update(t){if(e===null)return;let n={...c.current,...t};c.current=n,o(n);let r=l.current??gn(e);u(e,n);try{sessionStorage.setItem(r,JSON.stringify(n))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}}}}export{Ke as $,W as A,H as B,wt as C,Vt as D,mt as E,Ht as F,dt as G,ut as H,Rt as I,Ze as J,lt as K,jt as L,Z as M,Q as N,q as O,It as P,qe as Q,Pt as R,vt as S,K as T,st as U,At as V,ct as W,Ye as X,Qe as Y,Je as Z,Ot as _,dn as a,Ve as at,Kt as b,un as c,$t as d,Ge as et,en as f,kt as g,qt as h,fn as i,ze as it,Nt as j,Lt as k,pn as l,tn as m,vn as n,We as nt,sn as o,Re as ot,rn as p,rt as q,gn as r,He as rt,ln as s,Be as st,_n as t,Ue as tt,nn as u,J as v,Tt as w,Dt as x,Wt as y,Bt as z};
|
package/dist/public/index.html
CHANGED
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
// Storage disabled or unreadable: the module's own init still runs.
|
|
48
48
|
}
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-BqOVeoIr.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-CZI7_Jkm.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/react-dom-cJyBB_A4.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="/assets/auth-olLlgxc3.js">
|
|
55
|
-
<link rel="modulepreload" crossorigin href="/assets/client-settings-
|
|
55
|
+
<link rel="modulepreload" crossorigin href="/assets/client-settings-DhfHheKR.js">
|
|
56
56
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-By8HlURe.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
58
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
58
|
+
<link rel="stylesheet" crossorigin href="/assets/index-LpAqnBR3.css">
|
|
59
59
|
</head>
|
|
60
60
|
<body>
|
|
61
61
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puddle-code/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "puddle \u2014 self-hosted orchestrator for CLI coding agents: serves the cockpit UI and connects it to local or SSH hosts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/PerceptronV/puddle-code#readme",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReleaseNotesDialog-BXqx8SP6.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-By8HlURe.js","assets/purify.es-D8QhFVkO.js","assets/dialog-IU2fjIs9.js","assets/react-dom-cJyBB_A4.js","assets/x-Dq6POV20.js","assets/createLucideIcon-C9A1vLE-.js","assets/queue-BlrQxHDl.js","assets/markdown-it-CWoG9_Dn.js","assets/markdown-CMSzQtLp.js","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/SettingsDialog-D7eSDoiW.js","assets/protocol-support-CsLR9u7d.js","assets/auth-olLlgxc3.js","assets/api-BOuyloUi.js","assets/LazyTerminal-BoKGfXrR.js","assets/preload-helper-Czpn1I53.js","assets/chevron-right-BP2NLwlG.js","assets/notification-delivery-CoEqmE8J.js","assets/hotkeys-Cu0t6sbz.js","assets/switch-DihTSmnc.js","assets/dist-BHBQY7ao.js","assets/ws-Dgc69_w8.js","assets/dist-BOS6OKSE.js","assets/client-settings-CwqpIric.js","assets/index-BKT8bLLH.js","assets/index-C3TPFFMc.css","assets/button-q0ardkfx.js","assets/select-C0UTbo8D.js","assets/chevron-down-HQLVE6o5.js","assets/dist-CGlwr6Pc.js","assets/code-Cf4ftdOa.js","assets/rotate-ccw-BI2k_h3A.js","assets/use-debounced-value-C86N-mOK.js","assets/popover-B5Bw2ljC.js","assets/CompilationCommandForm-C71yC-_B.js","assets/Dashboard-CB_H-DLw.js","assets/session-order-2oedrwDu.js","assets/context-menu-C0cOAj0E.js","assets/dist-eLNGMhYC.js","assets/NewProjectDialog-CdXJRYKt.js","assets/Workspace-PBHY5dWY.js","assets/forward-link-DMvLf0Xw.js","assets/media-refresh-store-CHPkX-XV.js","assets/use-ui-state-e6mUjW-H.js","assets/preview-kind-CPkO-rSz.js","assets/debounce-B9DrqirV.js","assets/whole-word-BJjKpISQ.js","assets/selection-actions-Ccf4ZuaR.js","assets/copy-D0Theg4Q.js","assets/control-tray-OJfh0_ml.js","assets/control-tray-D7OXXkAy.css","assets/view-state-store-Cy9sQJoZ.js","assets/drafts-B_tChlzR.js","assets/buffer-logic-BAkSBQT7.js","assets/scroll-restoration-CwXbvZvT.js","assets/Workspace-D5qlJNnU.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{$ as r,D as i,E as a,Et as o,Ft as s,Ht as c,I as l,It as u,J as d,Lt as f,M as p,Mt as m,N as h,Nt as g,Ot as _,Pt as v,Q as y,R as b,Rt as x,S,St as C,T as ee,Tt as w,U as te,Ut as T,V as ne,Vt as E,Wt as D,Y as O,at as k,b as re,ct as ie,et as ae,it as oe,jt as se,mt as ce,o as le,ot as ue,q as de,st as fe,tt as pe,vt as me,w as he,wt as ge,x as _e,y as ve,zt as ye}from"./protocol-support-CsLR9u7d.js";import{$ as be,F as xe,K as Se,Q as Ce,T as we,Y as Te,o as A,p as Ee,r as De,z as Oe}from"./auth-olLlgxc3.js";import{a as j,c as ke,o as Ae}from"./LazyTerminal-BoKGfXrR.js";import{C as je,D as Me,E as Ne,O as Pe,_ as Fe,a as Ie,d as Le,g as Re,h as ze,i as Be,l as Ve,m as He,o as Ue,p as We,s as Ge,t as Ke,u as qe,w as Je}from"./notification-delivery-CoEqmE8J.js";import{i as Ye,r as Xe,t as Ze}from"./client-settings-CwqpIric.js";import{t as Qe}from"./jsx-runtime-By8HlURe.js";import{t as M}from"./preload-helper-Czpn1I53.js";import{a as $e,n as et,o as tt,r as nt,t as rt}from"./index-BKT8bLLH.js";import{n as N}from"./api-BOuyloUi.js";import{_ as P,d as it,g as F,h as at,i as ot,l as st,m as ct,o as lt,p as ut,r as dt,s as ft,u as pt,v as mt}from"./hotkeys-Cu0t6sbz.js";import{t as ht}from"./forward-link-DMvLf0Xw.js";import{a as gt,c as _t,d as vt,f as yt,l as bt,m as xt,p as St,r as Ct,s as wt,u as Tt}from"./session-order-2oedrwDu.js";import{n as I,t as Et}from"./dist-BOS6OKSE.js";import{n as L,r as Dt}from"./chevron-right-BP2NLwlG.js";import{n as Ot,r as R}from"./dist-BHBQY7ao.js";import{$ as kt,G as At,J as jt,K as Mt,U as Nt,W as Pt,X as Ft,Y as It,Z as Lt,at as z,d as Rt,et as zt,f as Bt,h as B,i as Vt,it as V,m as Ht,nt as Ut,ot as Wt,p as Gt,q as Kt,r as qt,rt as Jt,st as H,t as Yt,tt as Xt}from"./use-ui-state-e6mUjW-H.js";import{n as U,t as W}from"./createLucideIcon-C9A1vLE-.js";import{n as Zt,t as G}from"./button-q0ardkfx.js";import{c as Qt,d as $t,i as en,l as tn,o as nn,t as rn}from"./switch-DihTSmnc.js";import{t as an}from"./copy-D0Theg4Q.js";import{n as on,t as sn}from"./NewProjectDialog-CdXJRYKt.js";import{t as cn}from"./control-tray-OJfh0_ml.js";import{r as K,t as q}from"./ws-Dgc69_w8.js";import{a as ln,c as un,i as dn,n as fn,o as pn,r as mn,s as hn}from"./command-BkdEYC1b.js";import{n as gn,r as _n,t as vn}from"./popover-B5Bw2ljC.js";import{n as yn,r as bn,t as xn}from"./queue-BlrQxHDl.js";var J=e(t(),1),Y=Qe();function Sn(){let[e,t]=(0,J.useState)(`Opening forwarded application…`);return(0,J.useEffect)(()=>{if(!/^\/forward\/([^/]+)\/(\d+)$/.exec(window.location.pathname)){t(`This forwarding link is invalid.`);return}let e=!0;return ht(new URL(window.location.href)).then(t=>{e&&window.location.replace(t)}).catch(()=>{e&&t(`The application is unavailable. Reconnect to Puddle and open this link again.`)}),()=>{e=!1}},[]),(0,Y.jsx)(`p`,{className:`p-8 text-sm text-fg-secondary`,children:e})}var Cn=class extends D{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new o({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=wn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=wn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=wn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=wn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){m.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>u(t,e))}findAll(e={}){return this.getAll().filter(t=>u(e,t))}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return m.batch(()=>Promise.all(e.map(e=>e.continue().catch(x))))}};function wn(e){return e.options.scope?.id}var Tn=class extends D{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??s(r,t),a=this.get(i);return a||(a=new _({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){m.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>f(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>f(e,t)):t}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){m.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){m.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},En=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Tn,this.#t=e.mutationCache||new Cn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=T.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=se.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(E(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return m.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;m.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return m.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=m.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(x).catch(x)}invalidateQueries(e,t={}){return m.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=m.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(x)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(x)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(E(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(x).catch(x)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(x).catch(x)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return se.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(v(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ye(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(v(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ye(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=s(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===c&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Dn=class extends J.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){this.state.error!==null&&e.resetOn!==this.props.resetOn&&this.setState({error:null})}componentDidCatch(e,t){console.error(`Puddle: the ${this.props.scope} crashed`,e,t.componentStack)}render(){let{error:e}=this.state;return e===null?this.props.children:(0,Y.jsxs)(`div`,{className:`flex h-full min-h-40 flex-col items-center justify-center gap-4 px-8 py-10 text-center`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-fg`,children:[`The `,this.props.scope,` stopped rendering.`]}),(0,Y.jsx)(`p`,{className:`max-w-lg font-mono text-2xs leading-relaxed text-interrupted`,children:e.message||String(e)}),(0,Y.jsx)(`p`,{className:`max-w-sm text-2xs leading-relaxed text-fg-muted`,children:`Your sessions and their worktrees are on the daemon and untouched; the layout is saved. The console has the full stack.`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>this.setState({error:null}),className:`text-2xs font-medium text-fg-gold transition-colors hover:underline`,children:`Try again`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Reload`})]})]})}};function On(){return(0,Y.jsx)(Et,{theme:(0,J.useSyncExternalStore)($e,nt),position:`bottom-right`,toastOptions:{style:{background:`var(--bg-elevated)`,border:`none`,boxShadow:`0 8px 30px rgb(0 0 0 / 0.25)`,color:`var(--text-primary)`},classNames:{description:`whitespace-pre-wrap break-words font-mono text-2xs leading-snug max-h-40 overflow-y-auto`}}})}function kn(){return(0,Y.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-24`,children:[(0,Y.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm leading-relaxed text-fg-secondary`,children:[(0,Y.jsxs)(`p`,{children:[`Authorise this browser by running`,` `,(0,Y.jsx)(`span`,{className:`font-mono text-accent`,children:`puddle launch`}),` in a terminal.`]}),(0,Y.jsx)(`p`,{children:`Use the link it opens. Your sessions, drafts and layouts stay in place.`})]})]})})}var An=e(n(),1),jn=`a, button, [role="button"], [role="slider"], input, select, textarea, summary, label, [onclick], .cursor-pointer`,Mn=`.monaco-editor`;function Nn(e,t){return e?.closest(Mn)&&!e.closest(t)?`text`:e?.closest(jn)?`interactive`:`default`}function Pn(e,t=`.no-custom-caret`){(0,J.useEffect)(()=>{let n=e.current;if(!n)return;let r=window.matchMedia(`(pointer: fine)`),i=()=>{n.style.opacity=`0`},a=e=>{if(e.pointerType===`touch`||!r.matches){i();return}n.style.transform=`translate3d(${e.clientX}px, ${e.clientY}px, 0) translate(-50%, -50%)`;let a=e.target instanceof Element?e.target:null;if(a instanceof HTMLIFrameElement){i();return}n.style.opacity=`1`;let o=a?.closest(Mn),s=Nn(a,t),c=s===`text`,l=s===`interactive`,u=c;if(c&&o){let e=getComputedStyle(o);n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`)}else if(!l&&a&&!a.closest(t)&&Array.from(a.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())){let e=getComputedStyle(a);e.userSelect!==`none`&&(u=!0,n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`))}n.classList.toggle(`is-interactive`,l),n.classList.toggle(`is-text`,u)};return window.addEventListener(`pointermove`,a,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,i),window.addEventListener(`blur`,i),()=>{window.removeEventListener(`pointermove`,a),document.documentElement.removeEventListener(`pointerleave`,i),window.removeEventListener(`blur`,i)}},[t,e])}var Fn=[`top`,`right`,`bottom`,`left`];function In(){let e=(0,J.useRef)(null);return Pn(e),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor drafting-cursor`,"aria-hidden":`true`,children:Fn.map(e=>(0,Y.jsx)(`span`,{className:`drafting-cursor-tick`,"data-side":e},e))})}function Ln(){let e=(0,J.useRef)(null);return Pn(e),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor invert-cursor`,"aria-hidden":`true`})}var Rn=`h1, h2, h3, h4, h5, h6, .no-rangefinder-caret`,X=40.5,Z=4.05,zn=Z*Math.sqrt(3)/2;function Bn(){let e=[],t=[],n=X/2,r=Math.ceil(n/zn)+1,i=e=>Math.round(e*100)/100,a=e=>`M${e.map(([e,t])=>`${i(e)} ${i(t)}`).join(`L`)}Z`;for(let i=-r;i<r;i+=1){let o=n+i*zn,s=o+zn,c=(i%2+2)%2*(Z/2);for(let i=-r;i<r;i+=1){let r=n+i*Z+c,l=[[r+Z/2,o],[r,s],[r+Z,s]],u=[[r+Z/2,o],[r+3*Z/2,o],[r+Z,s]],d=e=>{let t=e.map(([e])=>e),n=e.map(([,e])=>e);return Math.max(...t)>0&&Math.min(...t)<X&&Math.max(...n)>0&&Math.min(...n)<X};d(l)&&e.push(a(l)),d(u)&&t.push(a(u))}}return{light:e.join(``),dark:t.join(``)}}var Vn=Bn();function Hn(){let e=(0,J.useRef)(null);return Pn(e,Rn),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor rangefinder-cursor`,"aria-hidden":`true`,children:(0,Y.jsxs)(`svg`,{className:`rangefinder-cursor-facets`,viewBox:`0 0 ${X} ${X}`,focusable:`false`,children:[(0,Y.jsx)(`path`,{className:`rangefinder-cursor-facet-light`,d:Vn.light}),(0,Y.jsx)(`path`,{className:`rangefinder-cursor-facet-dark`,d:Vn.dark})]})})}function Un(){let{cursorPackage:e}=Ye(),t=null;switch(e){case`rangefinder`:t=(0,Y.jsx)(Hn,{});break;case`drafting`:t=(0,Y.jsx)(In,{});break;case`invert`:t=(0,Y.jsx)(Ln,{});break;case`system`:return null}return(0,An.createPortal)(t,document.body)}var Wn=W(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Gn=W(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Kn=W(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),qn=W(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),Jn=W(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Yn=W(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Xn=W(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function Zn(){let e=ue(),t=h(),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(Oe),o=()=>{n.trim()&&t.mutate({name:n.trim(),branch_prefix:i.trim()},{onSuccess:e=>at(e.id)})},s=(e.data?.length??0)>0;return(0,Y.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-16`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,Y.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Who is working?`})]}),s&&(0,Y.jsx)(`div`,{className:`flex flex-col`,children:e.data.map(e=>(0,Y.jsxs)(`button`,{onClick:()=>at(e.id),className:`flex items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-elevated active:bg-border/70`,children:[(0,Y.jsx)(Je,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,Y.jsx)(`span`,{className:U(`text-base`,j(e.icon_colour)||`text-fg`),children:e.name}),e.branch_prefix&&(0,Y.jsxs)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:[e.branch_prefix,`…`]})]},e.id))}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-5`,onSubmit:e=>{e.preventDefault(),o()},children:[s&&(0,Y.jsx)(`p`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`or create a profile`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(ke,{htmlFor:`profile-name`,children:`Name`}),(0,Y.jsx)(L,{id:`profile-name`,placeholder:`e.g. alice`,value:n,onChange:e=>r(e.target.value),className:`h-10`,autoFocus:!s})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(ke,{htmlFor:`branch-prefix`,children:`Branch prefix`}),(0,Y.jsx)(L,{id:`branch-prefix`,placeholder:`no prefix`,value:i,onChange:e=>a(e.target.value),className:`h-10`})]}),t.error&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}),(0,Y.jsx)(G,{type:`submit`,size:`lg`,className:`self-start px-6`,disabled:!n.trim()||t.isPending,children:`Create profile`})]})]})})}function Qn(){let e=b().data?.protocol,t=e!==void 0&&(e.major>25||e.major===25&&e.minor>=5),{data:n}=C({queryKey:[`storage`],queryFn:()=>N(`GET`,`/api/storage`),enabled:t&&!A(),refetchInterval:1e4,retry:!1});if(!t||A()||!n)return null;let r=n.volumes.filter(e=>e.level!==`ok`);if(!n.logs_degraded&&!n.database_degraded&&r.length===0)return null;let i=r.some(e=>e.level===`critical`);return(0,Y.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-2 px-3 py-2 text-xs text-warning`,children:[(0,Y.jsx)(Jt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[n.database_degraded&&(0,Y.jsx)(`p`,{children:`Storage is full. Changes cannot be saved. Live session status may be unsaved.`}),n.logs_degraded&&(0,Y.jsx)(`p`,{children:`Terminal history is temporarily not being saved. Live terminals remain connected.`}),i&&(0,Y.jsx)(`p`,{children:`Storage is critically low. Free space or inodes before starting new sessions or worktrees.`}),r.length>0&&(0,Y.jsx)(nn,{summary:`${r.length} storage ${r.length===1?`location needs`:`locations need`} attention`,children:(0,Y.jsx)(`div`,{className:`max-h-32 overflow-y-auto pl-4`,children:r.map(e=>(0,Y.jsxs)(`p`,{className:`break-all text-fg-secondary`,children:[e.level===`unknown`?`Could not check storage`:`Low storage`,` at`,` `,e.path,e.available_bytes!==null&&` · ${Math.round(e.available_bytes/1024**2).toLocaleString()} MiB available`,e.available_inodes!==null&&` · ${e.available_inodes.toLocaleString()} inodes available`]},e.path))})})]})]})}var $n=new class{transport;reload;pause;phase=`idle`;pending=null;constructor(e=fetch,t=()=>window.location.reload(),n=e=>new Promise(t=>setTimeout(t,e))){this.transport=e,this.reload=t,this.pause=n}refresh(e=12e4){return this.pending||=this.run(e).finally(()=>{this.pending=null}),this.pending}async run(e){this.phase=`requesting`;let t={authorization:`Bearer ${De.get()??``}`,"content-type":`application/json`};try{let n=await this.transport(`/cockpit/refresh`,{method:`POST`,headers:t,signal:AbortSignal.timeout(1e4),body:JSON.stringify({refreshId:crypto.randomUUID()})});if(n.status!==202)throw Error(`refresh rejected`);let r=we.parse(await n.json());this.phase=`waiting`;let i=Date.now()+e;for(;Date.now()<i;){await this.pause(1e3);try{let e=await this.transport(`/cockpit/status`,{headers:t,cache:`no-store`,signal:AbortSignal.timeout(3e3)});if(!e.ok)continue;let n=Ee.parse(await e.json());if(n.instance===r.instance||n.refreshId!==r.refreshId||n.upstream!==`ready`)continue;return this.phase=`complete`,this.reload(),!0}catch{}}}catch{}return this.phase=`failed`,!1}},Q=null;function er(e){return Q=e,()=>{Q===e&&(Q=null)}}function tr(){Q?.()}var nr=new Set;function rr(){return[...nr].flatMap(e=>e())}function ir({onNewSession:e,onNewProject:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(`commands`),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=St(),p=xt(),m=F(),h=p.id,g=ie(m??void 0),_=k(m??void 0),v=me(h),y=Ft();(0,J.useEffect)(()=>pt(`palette.toggle`,()=>r(e=>!e)),[]),(0,J.useEffect)(()=>zt(()=>r(!0)),[]),(0,J.useEffect)(()=>{n||(a(`commands`),s(``),l(null),d(!1))},[n]);let b=(0,J.useMemo)(()=>{let n=[],r=Ct((g.data??[]).filter(e=>!e.archived),_.data?.projectOrder??[]);for(let e of r)n.push({id:`project-${e.id}`,group:`Projects`,label:e.name,icon:on,keywords:`switch project open`,run:()=>void f(`/project/${e.id}`)});for(let e of v.data??[])e.status!==`archived`&&n.push({id:`session-${e.id}`,group:`Sessions`,label:y(e),icon:gt,keywords:`switch session ${e.branch}`,run:()=>void f(`/project/${e.project_id}/session/${e.id}`)});return h!==void 0&&e&&n.push({id:`new-agent`,group:`Actions`,label:`New agent`,icon:$t,keywords:`new agent create start session`,run:()=>e()},{id:`new-terminal`,group:`Actions`,label:`New terminal`,icon:gt,keywords:`new terminal create start shell session`,run:()=>e({kind:`terminal`})}),h!==void 0&&n.push({id:`open-path`,group:`Actions`,label:`Open path`,icon:on,keywords:`open path file directory folder editor tree browse absolute relative home`,closeOnRun:!1,run:()=>{s(``),l(null),a(`path`)}}),t&&n.push({id:`new-project`,group:`Actions`,label:`New project`,icon:R,keywords:`new project open create repository repo workspace`,run:t}),n.push({id:`theme-dark`,group:`Theme`,label:`Switch theme: dark`,icon:Me,keywords:`switch theme dark appearance`,run:()=>void rt(`dark`)},{id:`theme-light`,group:`Theme`,label:`Switch theme: light`,icon:Ne,keywords:`switch theme light appearance`,run:()=>void rt(`light`)},{id:`theme-system`,group:`Theme`,label:`Switch theme: system`,icon:Kn,keywords:`switch theme system appearance`,run:()=>void rt(`system`)},{id:`open-settings`,group:`Actions`,label:`Settings`,icon:Xn,keywords:`open settings preferences options configure`,run:()=>en()},{id:`switch-profile`,group:`Actions`,label:`Switch profile`,icon:Qt,keywords:`switch profile identity user change`,run:()=>ct.set(null)},{id:`refresh-connection`,group:`Actions`,label:`Refresh connection`,icon:tn,keywords:`refresh connection reconnect restart cockpit tunnel ssh daemon`,run:()=>tr()}),[...n,...rr()]},[g.data,_.data?.projectOrder,v.data,h,f,e,t,y]),x=(0,J.useMemo)(()=>{let e=new Map;for(let t of b){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]},[b]),S=async()=>{let e=o.trim();if(!(e===``||u)){d(!0),l(null);try{await Lt(e),r(!1)}catch(e){l(e instanceof Error?e.message:`Could not open that path.`)}finally{d(!1)}}};return(0,Y.jsxs)(fn,{open:n,onOpenChange:r,children:[(0,Y.jsx)(ln,{value:o,onValueChange:e=>{s(e),l(null)},placeholder:i===`path`?`Enter a path…`:`Type a command or search…`,onKeyDown:e=>{i===`path`&&(e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),S()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a(`commands`),s(``),l(null)))}}),i===`path`?(0,Y.jsx)(hn,{children:(0,Y.jsxs)(`div`,{className:`px-3 py-3 text-xs text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:`Relative paths start from the bound worktree or project. Absolute and ~ paths work too.`}),(0,Y.jsx)(`p`,{className:c?`mt-2 text-danger`:`mt-2`,"aria-live":`polite`,children:c??(u?`Opening…`:`Press Enter to open.`)})]})}):(0,Y.jsxs)(hn,{children:[(0,Y.jsx)(mn,{children:`Nothing matches.`}),x.map(([e,t])=>(0,Y.jsx)(dn,{heading:e,children:t.map(e=>{let t=e.icon;return(0,Y.jsxs)(pn,{value:`${e.label} ${e.keywords??``}`,onSelect:()=>{e.closeOnRun!==!1&&r(!1),e.run()},children:[t&&(0,Y.jsx)(t,{}),e.label,e.shortcut&&(0,Y.jsx)(un,{children:e.shortcut})]},e.id)})},e))]})]})}function ar(){let e=document.activeElement;return e instanceof Element&&e.closest(`.xterm`)!==null}function or(){let e=document.activeElement;return e instanceof Element&&e.closest(`.monaco-editor`)!==null}function sr(){let e=k(F()??void 0).data?.hotkeys;return(0,J.useEffect)(()=>{it(e&&typeof e==`object`?e:void 0)},[e]),(0,J.useEffect)(()=>pt(`window.close`,()=>{let e=P();e?.closeWindow?e.closeWindow():window.close()}),[]),(0,J.useEffect)(()=>{let e=e=>{let t=ot(e);if(!t)return;let n=dt(t);if(!n)return;let r=lt(n);if(!r||!st(r,or()))return;let i=ft(n);i&&(e.preventDefault(),e.stopPropagation(),i())},t=e=>{let t=ot(e);if(!t)return;let n=dt(t);if(!n)return;let r=lt(n);if(!r||r.editor&&or()||r.deferInTerminal&&ar())return;let i=ft(n);i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`keydown`,t)}},[]),null}var cr=4e3;function lr(){let[e,t]=(0,J.useState)(`hidden`),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>{let e=null,r=q.onConnectionChange(r=>{if(r){e!==null&&clearTimeout(e),e=null,n.current===`lost`&&t(`hidden`);return}e!==null||n.current!==`hidden`||(e=setTimeout(()=>{e=null,n.current===`hidden`&&t(`lost`)},cr))});return()=>{r(),e!==null&&clearTimeout(e)}},[]);let r=(0,J.useCallback)(async()=>{n.current!==`refreshing`&&(t(`refreshing`),await $n.refresh()||(I.error(`The cockpit has not come back — it may need a terminal (ssh re-auth): puddle refresh`),t(q.isConnected()?`hidden`:`lost`)))},[]);return(0,J.useEffect)(()=>er(()=>void r()),[r]),e===`hidden`?null:(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 bg-elevated px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:e===`refreshing`?`Restarting the cockpit.`:`Connection to the daemon lost.`}),e===`lost`&&(0,Y.jsxs)(G,{size:`sm`,className:`ml-auto`,onClick:()=>void r(),children:[(0,Y.jsx)(tn,{}),`Refresh connection`]})]})}function ur({label:e,percentage:t,hint:n}){let r=Math.max(0,Math.min(100,t));return(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 truncate text-2xs text-fg-muted`,title:e,children:e}),(0,Y.jsx)(`span`,{className:`relative h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border`,children:(0,Y.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full ${r>=90?`bg-danger`:r>=75?`bg-warning`:`bg-action`}`,style:{width:`${r}%`}})}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-2xs tabular-nums text-fg-muted`,children:[Math.round(r),`%`,n?` · ${n}`:``]})]})}function dr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function fr(e){if(e===null)return`never`;let t=new Date(e).getTime(),n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function pr({account:e,onLogin:t,onStartSession:n,installed:r=!0}){let i=he(e.id),a=e.logged_in?n:r?t:null,o=i.data?.subscription;return(0,Y.jsxs)(`div`,{className:`rounded-md px-2 py-2 transition-colors hover:bg-elevated`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:a===null,onClick:()=>a?.(),className:`flex w-full items-center gap-3 text-left disabled:cursor-default`,children:[(0,Y.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${e.logged_in?`bg-success`:`bg-idle`}`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.label}),(0,Y.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[e.logged_in?`logged in`:`logged out`,i.data&&(0,Y.jsxs)(Y.Fragment,{children:[` · `,i.data.session_count,` session`,i.data.session_count===1?``:`s`,i.data.active_session_count>0&&` (${i.data.active_session_count} active)`,` · `,`last `,fr(i.data.last_activity_at)]})]}),i.data?.agent_usage&&(0,Y.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[dr(i.data.agent_usage.input_tokens),` in ·`,` `,dr(i.data.agent_usage.output_tokens),` out ·`,` `,dr(i.data.agent_usage.cache_read_input_tokens),` cached ·`,` `,i.data.agent_usage.message_count,` msgs`]}),i.data?.live_usage?.context_used_percentage!=null&&(0,Y.jsx)(`span`,{className:`mt-1 block`,children:(0,Y.jsx)(ur,{label:`context`,percentage:i.data.live_usage.context_used_percentage})})]}),(0,Y.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted`,children:r?e.logged_in?n?`new agent`:``:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-warning`,children:[(0,Y.jsx)(Pe,{className:`size-3`}),`sign in`]}):`unavailable`})]}),o!=null&&o.windows.length>0&&(0,Y.jsx)(`div`,{className:`mt-2 flex flex-col gap-1 pl-5`,children:o.windows.map(e=>(0,Y.jsx)(ur,{label:e.label,percentage:e.used_percentage,hint:e.resets==null?void 0:`resets ${e.resets}`},e.key))})]})}function mr(){let[e,t]=(0,J.useState)(!1),[n,r]=(0,J.useState)(!1),i=F(),o=ue(),s=ae(),c=o.data?.find(e=>e.id===i),l=ee(i??void 0),u=a(),d=O(),{open:f,handler:p}=It(),[m,h]=(0,J.useState)(null),g=e=>d.mutate(e.id,{onSuccess:t=>h({stream:t.stream,label:`${e.agent_type}/${e.label}`}),onError:e=>K(e)}),_=e=>{t(!1),f({accountId:e.id})},v=e=>{r(!1);let t=e.trim();!i||!t||t===c?.name||s.mutate({id:i,name:t},{onError:e=>K(e)})},y=`font-sans compact:h-7 compact:px-1.5`;return n&&c?(0,Y.jsxs)(`div`,{className:Zt({variant:`ghost`,size:`sm`,className:y}),children:[(0,Y.jsx)(Je,{icon:c.icon,colour:c.icon_colour}),(0,Y.jsx)(Xt,{initial:c.name,maxLength:100,fitContent:!0,className:j(c.icon_colour),onCommit:v,onCancel:()=>r(!1)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(vn,{open:e,onOpenChange:t,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(_n,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`sm`,className:y,children:[(0,Y.jsx)(Je,{icon:c?.icon,colour:c?.icon_colour}),(0,Y.jsx)(`span`,{className:j(c?.icon_colour),...Ut(()=>{t(!1),r(!0)}),children:c?.name??`…`})]})})}),(0,Y.jsx)(z,{children:`Profile`})]}),(0,Y.jsxs)(gn,{className:`w-[28rem] max-w-[calc(100vw-1rem)]`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(u.data??[]).map(e=>{let t=l.data?.filter(t=>t.agent_type===e.id)??[];if(t.length===0)return null;let n=e.available!==!1;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`span`,{className:`px-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:[e.display_name,!n&&(0,Y.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`not installed — no `,e.binary??e.id,` on PATH`]})]}),t.map(e=>(0,Y.jsx)(pr,{account:e,onLogin:()=>g(e),onStartSession:p&&n?()=>_(e):null,installed:n},e.id))]},e.id)}),l.data?.length===0&&(0,Y.jsx)(`p`,{className:`px-2 text-sm text-fg-muted`,children:`No accounts yet — add one in settings.`})]}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,Y.jsxs)(G,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),en(`accounts`)},children:[(0,Y.jsx)(R,{}),`Add account`]}),(0,Y.jsxs)(G,{variant:`ghost`,size:`sm`,className:`ml-auto`,onClick:()=>{t(!1),ct.set(null)},children:[(0,Y.jsx)(Yn,{}),`Switch profile`]})]})]})]}),m&&(0,Y.jsx)(je,{stream:m.stream,label:m.label,onClose:()=>h(null)})]})}var hr=`desktop-update`;function gr(){let e=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let t=P();if(t?.updateReady===void 0||t.onUpdateReady===void 0)return;let n=t=>{e.current!==t&&(e.current=t,I(`Puddle ${t} is downloaded and ready.`,{id:hr,duration:1/0,closeButton:!0,action:{label:`Restart to update`,onClick:()=>{P()?.installUpdate?.(),I.loading(`Restarting into Puddle ${t}…`,{id:`${hr}-restarting`,duration:1/0})}}}))};return t.updateReady().then(e=>{e!==null&&n(e)}),t.onUpdateReady(n)},[]),null}var _r=new Re;function vr({onReview:e}={}){let t=He(),n=Le(),r=_e(de().data),i=ze();return We(),(0,J.useEffect)(()=>{if(!(!n||!r||t.isError))for(let n of _r.take(i,Fe(t.data))){let t=n.component===`daemon`?`Daemon`:`Runtime software`,a=`host-update-${i}-${n.component}-${n.version}`;I(`${r}: ${t} ${n.version} is available.`,{id:a,duration:1/0,closeButton:!0,action:{label:`Review update`,onClick:e??(()=>en(`host`))}})}},[t.data,t.isError,r,n,i,e]),null}function yr({hostKey:e,enabled:t=!0}){let n=C({queryKey:[`host`],queryFn:async({signal:e})=>Se.parse(await N(`GET`,`/api/host`,void 0,e)),staleTime:1/0,enabled:t&&!e,retry:!1}),r=e??(n.data?xn(n.data):void 0),i=A(),a=i?.generation,o=C({queryKey:[`release-notes`,r],queryFn:async({signal:e})=>{let t=Te.parse(await N(`GET`,`/api/release-notes`,void 0,e));if(A()!==i||i?.generation!==a)throw Error(`Release notes connection changed`);return t},enabled:t&&!!r,staleTime:1/0,retry:!1});return(0,J.useEffect)(()=>{t&&r&&o.data&&!o.isError&&bn(r,o.data)},[t,r,o.data,o.isError]),null}var br=(0,J.lazy)(()=>M(()=>import(`./ReleaseNotesDialog-BXqx8SP6.js`).then(e=>({default:e.ReleaseNotesDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function xr({remote:e=!1}){let t=(0,J.useSyncExternalStore)(yn.subscribe,yn.snapshot)[0];return(0,J.useEffect)(()=>{let t=e?[`cockpit`,`remote`]:[`cockpit`];yn.enqueue(`browser`,t.map(e=>({component:e,version:`0.4.5`,markdown:`## [0.4.5] — 2026-11-05
|
|
3
|
-
|
|
4
|
-
### Cockpit
|
|
5
|
-
|
|
6
|
-
- Preserve keyboard activation of notebook toolbar buttons instead of intercepting Enter as a cell-editing shortcut.
|
|
7
|
-
`})))},[e]),t?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(br,{current:t})}):null}function Sr(){let e=F(),t=ue().data?.find(t=>t.id===e),n=k(e??void 0),r=ce(e??void 0,void 0),i=Ye(),a=Ue(),o=Ge(),s=pe(e??``),c=ae(),u=l(),[d,f]=(0,J.useReducer)(e=>e+1,0);(0,J.useEffect)(()=>$e(()=>f()),[]);let p=(0,J.useRef)(null);(0,J.useEffect)(()=>{p.current=null},[t?.name]);let m=a.data?.available===!0?a.data.file:void 0,h=t!==void 0&&e!==null&&n.data!==void 0&&r.data!==void 0&&m!==void 0,g=t&&m?Ie(m,t.name):void 0,_=s.isPending||c.isPending||u.isPending||o.isPending||n.isFetching||r.isFetching;(0,J.useEffect)(()=>{if(!h||!g?.enabled||_)return;let a={client:i,theme:tt(),profileSettings:n.data,profile:t,scratchpad:r.data},l={setClient:e=>Xe(e),setTheme:e=>{typeof e==`string`&&rt(e)},patchProfileSettings:e=>s.mutate(e),patchProfileColumns:t=>c.mutate({id:e,...t}),createScratchpad:t=>{for(let n of t)u.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},d=JSON.stringify(g.doc);if(p.current!==d){p.current=d,Ve(g.doc,l,a,g.groups);return}let f=qe(g.groups,a),m=JSON.stringify(f);m!==d&&(p.current=m,o.mutate({profile:t.name,entry:{...g,doc:f,updatedAt:new Date().toISOString()}}))})}function Cr(e){let t=t=>{let n=be.safeParse(t);n.success&&e(n.data)},n=P()?.onNotificationClick?.((e,n)=>t(n)),r=e=>{e.data?.t===`notification-click`&&t(e.data.target)};return navigator.serviceWorker?.addEventListener(`message`,r),()=>{n?.(),navigator.serviceWorker?.removeEventListener(`message`,r)}}var wr=5e3,Tr=`[data-notification-session]`;function Er(e){let t=null,n=()=>{t=null},r=e=>e.target instanceof Element?e.target.closest(Tr):null,i=e=>{if(!e.isTrusted)return;let n=r(e),i=n?.dataset.notificationSession;t=n&&i?{element:n,session:i,at:performance.now()}:null},a=e=>{r(e)!==t?.element&&n()},o=[`pointerdown`,`keydown`,`input`,`paste`];for(let t of o)e.addEventListener(t,i,!0);return e.addEventListener(`focusin`,a,!0),e.addEventListener(`visibilitychange`,n),e.defaultView?.addEventListener(`blur`,n),{isInteracting(n){return t!==null&&t.session===n&&performance.now()-t.at<wr&&e.visibilityState===`visible`&&e.hasFocus()&&t.element.isConnected&&t.element.dataset.notificationSession===n&&t.element.getClientRects().length>0},dispose(){n();for(let t of o)e.removeEventListener(t,i,!0);e.removeEventListener(`focusin`,a,!0),e.removeEventListener(`visibilitychange`,n),e.defaultView?.removeEventListener(`blur`,n)}}}var Dr=new Set,Or=e=>!!e&&Dr.has(e),kr=Ce.parse({});function Ar(e){return e.prefs.muted_projects.includes(e.projectId)?{desktop:!1,sound:!1}:{desktop:e.prefs.desktop&&(e.permission===`granted`||e.permission===`unverified`)&&(e.prefs.when_focused||!e.sessionFocused),sound:e.prefs.sound}}function jr(e,t){for(let[,n]of e.getQueriesData({queryKey:[`sessions`]})){let e=n?.find(e=>e.id===t);if(e)return e}for(let[,n]of e.getQueriesData({queryKey:[`project`]})){let e=n?.sessions.find(e=>e.id===t);if(e)return e}}function Mr(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}function Nr(){try{let e=new AudioContext,t=e.createGain();t.gain.value=.04,t.connect(e.destination);for(let[n,r]of[[880,0],[1318.5,.09]]){let i=e.createOscillator();i.type=`sine`,i.frequency.value=n,i.connect(t),i.start(e.currentTime+r),i.stop(e.currentTime+r+.12)}setTimeout(()=>void e.close(),400)}catch{}}function Pr(){let e=St(),t=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=Er(document);return t.current=e,()=>{t.current=null,e.dispose()}},[]),(0,J.useEffect)(()=>Cr(t=>{t.host||e(`/project/${t.project}/session/${t.session}`,{state:{notificationSession:t.session}})}),[e]),Fr(t=>{e(`/project/${t.project_id}/session/${t.id}`,{state:{notificationSession:t.id}})},e=>t.current?.isInteracting(e.id)??!1)}function Fr(e,t=()=>document.hasFocus()){let n=w(),r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(t);i.current=t;let a=_e(de().data)??`Puddle`,o=(0,J.useRef)(a);(0,J.useEffect)(()=>{document.title===o.current&&(document.title=a),o.current=a},[a]),(0,J.useEffect)(()=>{let e=new Set,t=()=>{document.title=e.size>0?`(${e.size}) ${o.current}`:o.current},a=!0,s=async e=>{let t=jr(n,e.session);if(!t)try{t=(await ve(n)).find(t=>t.id===e.session)}catch{return}if(!a||!t)return;let s=t,c,l;try{let e=await n.fetchQuery({queryKey:[`project`,s.project_id],queryFn:()=>N(`GET`,`/api/projects/${s.project_id}`),staleTime:1e4});if(!a)return;l=e.project;let t=l.profile_id,r=await n.fetchQuery({queryKey:[`profile-settings`,t],queryFn:()=>N(`GET`,`/api/profiles/${t}/settings`),staleTime:1e4});c=Ce.catch(kr).parse(r.notifications??{})}catch{return}if(!a)return;let u=Ar({prefs:c,projectId:s.project_id,sessionFocused:i.current(s),permission:Be()});u.sound&&Nr(),u.desktop&&!Or(A()?.scope)&&await Ke({id:e.id?`puddle-event-${e.id}`:`puddle-agent-${s.id}`,title:e.content?.title??Mr(s).slice(0,160),body:e.content?.body??(e.reason===`exited`?`Agent finished running`:`Waiting for your input`),target:{project:s.project_id,session:s.id,...A()?.notificationHost?{host:A().notificationHost}:{}}},()=>{a&&r.current(s)},{host:o.current,project:l})},c=q.onAgentNotification(e=>{s(e)}),l=q.onStatus(r=>{let i=e.has(r.session);r.status===`waiting_input`?e.add(r.session):e.delete(r.session),t(),!(r.status!==`waiting_input`||i)&&n.fetchQuery({queryKey:[`version`],queryFn:()=>N(`GET`,`/api/version`),staleTime:1/0}).then(e=>{if(!(e.protocol.major>22||e.protocol.major===22&&e.protocol.minor>=3))return s({session:r.session,reason:`waiting_input`})}).catch(()=>{})});return()=>{a=!1,l(),c(),document.title=o.current}},[n])}function Ir({initial:e,defaultScope:t,allowProject:n=!0,agents:r,onSave:i,onCancel:a}){let[o,s]=(0,J.useState)(e?.title??``),[c,l]=(0,J.useState)(e?.body??``),[u,d]=(0,J.useState)(n?e?.scope??t:`profile`),[f,p]=(0,J.useState)((e?.tags??[]).join(`, `)),[m,h]=(0,J.useState)(e?.agent_type??null),g=()=>{let e=c.trim();e&&i({title:o.trim()||null,body:e,scope:u,tags:f.split(`,`).map(e=>e.trim()).filter(Boolean),agent_type:m})};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(L,{value:o,placeholder:`Title (optional)`,spellCheck:!1,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-9 text-sm font-medium`}),(0,Y.jsx)(Dt,{autoFocus:!0,value:c,placeholder:`Prompt or note…`,spellCheck:!1,rows:10,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`?a():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&g()},className:`resize-y text-sm leading-relaxed`}),(0,Y.jsx)(L,{value:f,placeholder:`tags, comma, separated`,spellCheck:!1,onChange:e=>p(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-8 text-xs`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-2xs text-fg-secondary`,children:[(0,Y.jsx)(rn,{checked:u===`profile`,onCheckedChange:e=>d(e?`profile`:`project`)}),`Profile-wide`]}),(0,Y.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:r.map(e=>(0,Y.jsxs)(`button`,{type:`button`,title:e.display_name,"aria-pressed":m===e.id,onClick:()=>h(t=>t===e.id?null:e.id),className:U(`rounded-md p-1 transition-colors`,m===e.id?`bg-surface text-fg`:`text-fg-gold hover:bg-surface hover:text-fg`),children:[(0,Y.jsx)(Kt,{type:e.id,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.display_name})]},e.id))})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,Y.jsx)(G,{size:`sm`,disabled:!c.trim(),onClick:g,children:`Save`})]})]})}function Lr(){let e=Mt(),t=F(),n=xt().id,r=ce(t??void 0,n).data??[],i=a().data??[],o=l(),s=oe(),c=te(),u=At(),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(null);(0,J.useEffect)(()=>pt(`scratchpad.toggle`,Pt),[]),(0,J.useEffect)(()=>{e||(f(null),m(null),g(null))},[e]);let x=(0,J.useMemo)(()=>[...new Set(r.flatMap(e=>e.tags))].sort((e,t)=>e.localeCompare(t)),[r]),S=(0,J.useMemo)(()=>[...new Set(r.map(e=>e.agent_type).filter(e=>e!==null))],[r]),C=p!==null||h!==null,ee=r.filter(e=>(p===null||e.tags.includes(p))&&(h===null||e.agent_type===h)),w=C?ee:y??r,T=e=>{t&&(o.mutate({profile_id:t,scope:e.scope,project_id:e.scope===`project`?n:void 0,title:e.title??void 0,body:e.body,tags:e.tags,agent_type:e.agent_type??void 0}),f(null))},ne=(e,t)=>{s.mutate({id:e,scope:t.scope,project_id:t.scope===`project`?n??null:null,title:t.title,body:t.body,tags:t.tags,agent_type:t.agent_type}),f(null)},E=(e,t)=>{let n=y??r,i=n.findIndex(t=>t.id===e),a=n.findIndex(e=>e.id===t);if(i===-1||a===-1||i===a)return;let o=n.slice(),[s]=o.splice(i,1);o.splice(a,0,s),b(o)},D=()=>{let e=_,t=y;if(v(null),b(null),e===null||!t)return;let n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t[n-1],i=t[n+1],a=r?i?(r.position+i.position)/2:r.position+1:(i?i.position:0)-1;s.mutate({id:e,position:a})},O=e=>{navigator.clipboard?.writeText(e.body),I.success(`Copied to clipboard`)};return(0,Y.jsxs)(vn,{open:e,onOpenChange:Nt,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(_n,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,Y.jsx)(qn,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Scratchpad`})]})})}),(0,Y.jsx)(z,{children:`Scratchpad`})]}),(0,Y.jsxs)(gn,{className:`w-[34rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Scratchpad`}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>f(d===`new`?null:`new`),className:`ml-auto flex items-center rounded-md p-1 text-fg-gold transition-colors hover:bg-surface hover:text-fg`,children:[(0,Y.jsx)(R,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`New entry`})]})]}),(x.length>0||S.length>0)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:[x.map(e=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(t=>t===e?null:e),className:U(`rounded-full px-2 py-0.5 text-2xs transition-colors`,p===e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:e},e)),S.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":h===e,onClick:()=>g(t=>t===e?null:e),className:U(`rounded-md p-1 transition-colors`,h===e?`bg-action text-action-ink`:`text-fg-gold hover:bg-surface`),children:(0,Y.jsx)(Kt,{type:e,className:`size-3.5`})},e))]}),(0,Y.jsxs)(`div`,{className:`no-scrollbar max-h-[65vh] overflow-y-auto px-2 pb-3`,children:[d===`new`&&(0,Y.jsx)(`div`,{className:`px-3 py-2`,children:(0,Y.jsx)(Ir,{defaultScope:n?`project`:`profile`,allowProject:n!==void 0,agents:i,onSave:T,onCancel:()=>f(null)})}),w.length===0&&d!==`new`&&(0,Y.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:C?`Nothing matches this filter.`:`No entries yet — press + to add a reusable prompt or note.`}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:w.map(e=>d===e.id?(0,Y.jsx)(`li`,{className:`px-3 py-2`,children:(0,Y.jsx)(Ir,{initial:e,defaultScope:e.scope,allowProject:n!==void 0||e.scope===`project`,agents:i,onSave:t=>ne(e.id,t),onCancel:()=>f(null)})},e.id):(0,Y.jsx)(`li`,{draggable:!C&&d===null,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,v(e.id)},onDragOver:t=>{_!==null&&(t.preventDefault(),_!==e.id&&E(_,e.id))},onDragEnd:D,className:U(`transition-opacity`,_===e.id&&`opacity-50`),children:(0,Y.jsx)(Rr,{entry:e,onInsert:u?()=>{u(e.body),Nt(!1)}:null,onCopy:()=>O(e),onEdit:()=>f(e.id),onDelete:()=>c.mutate(e.id)})},e.id))})]})]})]})}function Rr({entry:e,onInsert:t,onCopy:n,onEdit:r,onDelete:i}){let[a,o]=(0,J.useState)(!1);return(0,Y.jsxs)(`div`,{onClick:e=>{e.target.closest(`button`)||r()},className:`cursor-pointer rounded-md px-3 py-2.5 transition-colors hover:bg-surface`,children:[e.title&&(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`p`,{className:U(`line-clamp-3 whitespace-pre-wrap text-sm text-fg-secondary`,e.title&&`mt-0.5`),children:e.body}),a?(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:`Delete this entry? This can’t be undone.`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),i()},className:`text-2xs font-medium text-interrupted transition-colors hover:underline`,children:`Delete`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Cancel`})]}):(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:e.scope===`profile`?`Profile-wide`:`Project`}),e.agent_type&&(0,Y.jsx)(Kt,{type:e.agent_type,className:`size-3 text-fg-gold`}),e.tags.map(e=>(0,Y.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-2xs text-fg-secondary`,children:e},e)),(0,Y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[t&&(0,Y.jsx)(zr,{icon:Wn,label:`Insert into focused terminal`,onClick:t}),(0,Y.jsx)(zr,{icon:an,label:`Copy`,onClick:n}),(0,Y.jsx)(zr,{icon:Ae,label:`Edit`,onClick:r}),(0,Y.jsx)(zr,{icon:Ot,label:`Delete`,onClick:()=>o(!0)})]})]})]})}function zr({icon:e,label:t,onClick:n}){return(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(e,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(z,{children:t})]})}var Br=xe.parse({});function Vr(e,t){let[n,r]=(0,J.useState)(null),a=i(t).data,o=ie(e??void 0,t&&e!==null).data;return(0,J.useEffect)(()=>{if(!t||e===null){r(null);return}let n=!1,i;try{i=Yt(sessionStorage.getItem(qt(e)))}catch{i={kind:`absent`}}if(i.kind===`present`){r(i.snapshot);return}return re(e).then(e=>{n||r(e?e.ui_state:Br)}).catch(()=>{n||r(Br)}),()=>{n=!0}},[t,e]),(0,J.useMemo)(()=>{if(!t||e===null||n===null)return null;let i=t=>{if(!a||!o)return!1;let{patch:i,projectBased:s}=Vt(n,t,{alive:new Set(a.filter(e=>e.status!==`archived`).map(e=>e.id)),sessionProject:new Map(a.map(e=>[e.id,e.project_id])),projectIds:o.map(e=>e.id),currentProject:null}),c={...n,...i};r(c),S(e,c).catch(e=>console.warn(`ui-state save failed: ${e.message}`));try{sessionStorage.setItem(qt(e),JSON.stringify(c))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}return Ze().projectBasedLayout!==s&&Xe({projectBasedLayout:s}),!0},s=Object.fromEntries(Object.entries(n.project_layouts).map(([e,t])=>[e,{layoutRef:t.layout_ref,signature:B(t.layout_tree)}]));return(n.layout_mode??`profile`)===`project`?{headless:!0,scope:`project`,projectId:``,layoutRef:null,signature:B(null),slices:s,capture:()=>({layout_tree:null,active_session:null}),apply:i}:{scope:`profile`,projectId:``,layoutRef:n.layout_ref,signature:B(n.layout_tree),slices:s,capture:()=>({layout_tree:n.layout_tree,active_session:n.active_session}),apply:i}},[t,e,n,a,o])}var Hr=B(null);function Ur(){let e=Ht(),t=St(),n=F(),i=Gt(),a=Vr(n,e&&i===null),o=i??a,s=d(n??void 0,void 0).data??[],c=ie(n??void 0,e&&n!==null).data??[],l=p(),u=r(),f=ne(),[m,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null);(0,J.useEffect)(()=>pt(`layouts.toggle`,Bt),[]),(0,J.useEffect)(()=>{e||(h(``),_(!1),y(null))},[e]);let b=o?.headless===!0,x=o===null||b?null:s.find(e=>e.id===o.layoutRef)??null,S=o!==null&&!b&&(x===null?o.signature!==Hr:B(x.layout_tree)!==o.signature),C=e=>{let t=o?.slices?.[e];if(!t)return!1;let n=t.layoutRef===null?null:s.find(e=>e.id===t.layoutRef)??null;return n?B(n.layout_tree)!==t.signature:t.signature!==Hr},ee=e=>o===null?!1:e.scope===`profile`?o.scope===`profile`&&S:e.project_id===null?!1:o.scope===`project`?!b&&e.project_id===o.projectId?S:C(e.project_id):S||C(e.project_id),w=e=>x!==null&&e.id===x.id,te=e=>(e===null?void 0:c.find(t=>t.id===e)?.name)??`Project`,T=o!==null&&!b&&o.scope===`project`?s.filter(e=>e.scope===`profile`||e.project_id===o.projectId):s,E=[...T.some(e=>e.scope===`profile`)?[{key:`profile`,name:`Profile-wide`}]:[],...[...new Set(T.flatMap(e=>e.project_id===null?[]:[e.project_id]))].map(e=>({key:e,name:te(e)})).sort((e,t)=>e.name.localeCompare(t.name))],D=v===null?T:v===`profile`?T.filter(e=>e.scope===`profile`):T.filter(e=>e.project_id===v),O=e=>o!==null&&e.scope===o.scope&&(o.scope===`profile`||e.project_id===o.projectId),k=(e,t,r)=>{!o||!n||l.mutate({profile_id:n,scope:o.scope,project_id:o.scope===`project`?o.projectId:void 0,name:e,...t},{onSuccess:e=>{r&&o.apply(e)},onError:e=>K(e)})},re=e=>{if(!o)return;let t=O(e)?e:s.find(t=>t.name===e.name&&O(t));if(!t){k(e.name,o.capture(),!0);return}u.mutate({id:t.id,...o.capture()},{onSuccess:e=>o.apply(e),onError:e=>K(e)})},ae=(e,t)=>k(t,{layout_tree:e.layout_tree,active_session:e.active_session},!1),oe=e=>{if(o){if(!o.apply(e)){I.error(`Workspace is still loading — try again in a moment`);return}e.project_id!==null&&e.project_id!==o.projectId&&t(`/project/${e.project_id}`),Rt(!1)}};return(0,Y.jsxs)(vn,{open:e,onOpenChange:Rt,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(_n,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,Y.jsx)(Gn,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Layouts`})]})})}),(0,Y.jsx)(z,{children:`Layouts`})]}),(0,Y.jsxs)(gn,{className:`w-[26rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Layouts`}),o!==null&&!b&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>_(e=>!e),className:`ml-auto flex items-center rounded-md p-1 text-fg-gold transition-colors hover:bg-surface hover:text-fg`,children:[(0,Y.jsx)(R,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Save the current layout as a new layout`})]})]}),o===null?(0,Y.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Loading the profile’s layout state…`}):b?(0,Y.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Project-based layout is on — every project keeps its own layout. Open a project to name or save it; loading works from here.`}):(x===null||g)&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 pb-3`,children:[x===null&&(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`Unnamed layout`}),(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:o.scope===`profile`?`Profile-wide`:`Project`}),(0,Y.jsx)(`span`,{className:`ml-auto text-2xs text-interrupted`,children:`Unsaved`})]}),(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault();let t=m.trim();t&&(k(t,o.capture(),!0),h(``),_(!1))},children:[(0,Y.jsx)(L,{autoFocus:g,value:m,placeholder:x===null?`Name this layout…`:`Save as a new layout…`,spellCheck:!1,onChange:e=>h(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&_(!1)},className:`h-8 flex-1 text-sm`}),(0,Y.jsx)(G,{size:`sm`,type:`submit`,disabled:!m.trim(),children:`Save`}),x!==null&&(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,onClick:()=>_(!1),children:`Cancel`})]})]}),E.length>1&&(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:E.map(e=>(0,Y.jsx)(Kr,{active:v===e.key,onClick:()=>y(t=>t===e.key?null:e.key),children:e.name},e.key))}),(0,Y.jsxs)(`div`,{className:`no-scrollbar max-h-[60vh] overflow-y-auto px-2 pb-3`,children:[D.length===0&&(0,Y.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:v===null?`No layouts yet — name and save the current layout to keep it.`:`Nothing matches this filter.`}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:D.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Wr,{layout:e,projectLabel:e.scope===`profile`?null:te(e.project_id),isCurrent:w(e),dirty:S,loadable:o!==null,savable:o!==null&&!b,confirmBeforeLoad:ee(e),overwrites:O(e),onLoad:()=>oe(e),onRename:t=>u.mutate({id:e.id,name:t}),onDelete:()=>f.mutate(e.id),onSaveAs:()=>re(e),onDuplicate:t=>ae(e,t)})},e.id))})]})]})]})}function Wr({layout:e,projectLabel:t,isCurrent:n,dirty:r,loadable:i,savable:a,confirmBeforeLoad:o,overwrites:s,onLoad:c,onRename:l,onDelete:u,onSaveAs:d,onDuplicate:f}){let[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(e.name),y=()=>{if(!(!i||h!==null)){if(o&&p!==`load`){m(`load`);return}m(null),c()}},b=t=>{m(null),v(t===`rename`?e.name:`${e.name} copy`),g(t)},x=()=>{if(n){d();return}m(`save`)},S=n?r?`unsaved`:`active`:null;return(0,Y.jsxs)(`div`,{onClick:e=>{e.target.closest(`button, input`)||y()},className:U(`rounded-md px-3 py-2.5 transition-colors`,i&&`cursor-pointer hover:bg-surface`),children:[h===null?(0,Y.jsxs)(`p`,{className:U(`flex items-baseline gap-2 text-sm font-medium`,S===`active`?`text-success`:S===`unsaved`?`text-interrupted`:`text-fg`),children:[e.name,S!==null&&(0,Y.jsx)(`span`,{className:`text-2xs font-normal`,children:S===`active`?`Active`:`Unsaved`})]}):(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:t=>{t.preventDefault();let n=_.trim();n&&(h===`rename`?n!==e.name&&l(n):f(n)),g(null)},children:[(0,Y.jsx)(L,{autoFocus:!0,value:_,spellCheck:!1,onChange:e=>v(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&g(null)},className:`h-7 flex-1 text-sm`}),(0,Y.jsx)(G,{size:`sm`,type:`submit`,disabled:!_.trim(),children:h===`rename`?`Rename`:`Save`})]}),p===`save`?(0,Y.jsx)(Gr,{question:s?`Overwrite “${e.name}” with the current layout?`:`Save the current layout as “${e.name}” here?`,verb:s?`Overwrite`:`Save`,onConfirm:()=>{m(null),d()},onCancel:()=>m(null)}):p===`delete`?(0,Y.jsx)(Gr,{question:`Delete this layout? This can’t be undone.`,verb:`Delete`,onConfirm:()=>{m(null),u()},onCancel:()=>m(null)}):p===`load`?(0,Y.jsx)(Gr,{question:`Loading discards unsaved layout changes.`,verb:`Load`,onConfirm:y,onCancel:()=>m(null)}):(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[t!==null&&(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:t}),(0,Y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(qr,{icon:Jn,label:n?`Save`:`Save the current layout as “${e.name}”`,onClick:x}),(0,Y.jsx)(qr,{icon:an,label:`Duplicate`,onClick:()=>b(`duplicate`)})]}),(0,Y.jsx)(qr,{icon:Ae,label:`Rename`,onClick:()=>b(`rename`)}),(0,Y.jsx)(qr,{icon:Ot,label:`Delete`,onClick:()=>m(`delete`)})]})]})]})}function Gr({question:e,verb:t,onConfirm:n,onCancel:r}){return(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`text-2xs font-medium text-interrupted transition-colors hover:underline`,children:t}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Cancel`})]})}function Kr({active:e,onClick:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:t,className:U(`rounded-full px-2 py-0.5 text-2xs transition-colors`,e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:n})}function qr({icon:e,label:t,onClick:n}){return(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(e,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(z,{children:t})]})}var $=P()!==void 0&&/Mac/.test(navigator.platform),Jr=(0,J.lazy)(()=>M(()=>import(`./SettingsDialog-D7eSDoiW.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([14,1,2,15,16,3,17,18,19,5,6,7,8,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38])));function Yr(){let e=w();(0,J.useEffect)(()=>{let t=t=>{for(let[n,r]of e.getQueriesData({queryKey:[`sessions`]}))r&&e.setQueryData(n,r.map(t));for(let[n,r]of e.getQueriesData({queryKey:[`project`]}))r&&e.setQueryData(n,{...r,sessions:r.sessions.map(t)})},n=q.onStatus(e=>t(t=>t.id===e.session?{...t,status:e.status,last_activity_at:e.last_activity_at}:t)),r=q.onRenamed(e=>t(t=>t.id===e.session?{...t,title:e.title,agent_title:`agent_title`in e?e.agent_title:t.agent_title,osc_title:`osc_title`in e?e.osc_title:t.osc_title}:t)),i=q.onAccount(t=>{for(let[n,r]of e.getQueriesData({queryKey:[`accounts`]}))r&&e.setQueryData(n,r.map(e=>e.id===t.account_id?{...e,logged_in:t.logged_in}:e))}),a=t=>{e.invalidateQueries({queryKey:[`sessions`]});for(let n of t)e.invalidateQueries({queryKey:[`project`,n]})},o=q.onSessionsChanged(e=>a(e.project_ids)),s=q.onSessionSwitched(e=>a([e.target_project]));return()=>{n(),r(),i(),o(),s()}},[e])}function Xr(){let e=de(),t=y(),[n,r]=(0,J.useState)(!1),i=_e(e.data),a=n=>{r(!1);let a=n.trim();a!==i&&t.mutate({displayName:a===e.data?.hostname?``:a},{onError:e=>K(e)})},o=!$&&(0,Y.jsx)(`img`,{src:`/puddle.svg`,alt:`Puddle`,className:`size-4`}),s=U(`flex shrink-0 items-center gap-2`,$&&`[-webkit-app-region:no-drag]`),c=`truncate font-sans text-sm font-semibold text-fg-secondary`;return n&&i!==void 0?(0,Y.jsxs)(`div`,{className:s,children:[o,(0,Y.jsx)(Xt,{initial:e.data?.displayName??i,maxLength:64,className:U(c,`w-40`),onCommit:a,onCancel:()=>r(!1)})]}):(0,Y.jsxs)(_t,{to:`/`,className:U(s,`transition-opacity hover:opacity-70`),title:`All projects`,children:[o,i!==void 0&&(0,Y.jsx)(`span`,{className:c,...Ut(()=>r(!0)),children:i})]})}function Zr(){let e=xt(),t=ut(`palette.toggle`),n=fe(e.id).data?.project,r=n!==void 0&&n.id===e.id?n.name:void 0;return(0,Y.jsx)(`button`,{type:`button`,onClick:kt,className:U(`flex h-full min-w-0 w-full cursor-pointer items-center justify-center gap-2 bg-transparent px-2 text-fg-muted transition-colors hover:bg-elevated hover:text-fg-secondary`,$&&`[-webkit-app-region:no-drag]`),children:(0,Y.jsxs)(`span`,{className:`pointer-events-none absolute left-1/2 top-1/2 flex max-w-[40%] -translate-x-1/2 -translate-y-1/2 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:U(`truncate text-xs`,r&&j(n?.colour)),children:r??`Puddle`}),(0,Y.jsx)(`span`,{className:`shrink-0 text-2xs`,children:t})]})})}function Qr(){let{fullScreen:e,animate:t}=mt();return(0,Y.jsxs)(`header`,{onClick:e=>{let t=e.target;e.currentTarget.contains(t)&&(t.closest(`[data-header-section], [aria-label="Workspace controls"], button, a, input`)||kt())},className:U(`island-outline relative grid shrink-0 cursor-pointer grid-cols-[auto_1px_minmax(0,1fr)_1px_auto] items-center overflow-hidden rounded-[var(--ui-surface-radius)] bg-surface`,`h-9`,!$&&`mx-1.5 mt-1.5`,$&&!e&&`pl-[88px] [-webkit-app-region:drag]`,t&&`transition-[padding] duration-200 ease-out`),children:[(0,Y.jsx)(`div`,{"data-header-section":!0,className:`flex h-full min-w-0 cursor-default items-center overflow-hidden px-3`,children:(0,Y.jsx)(Xr,{})}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,Y.jsx)(Zr,{}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,Y.jsxs)(cn,{label:`Workspace controls`,className:U(`h-full justify-self-end rounded-none!`,$&&`[-webkit-app-region:no-drag]`),children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,onClick:()=>en(),children:[(0,Y.jsx)(Xn,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Y.jsx)(z,{children:`Settings`})]}),(0,Y.jsx)(Ur,{}),(0,Y.jsx)(Lr,{}),(0,Y.jsx)(mr,{})]})]})}function $r(){Yr(),Sr(),Pr();let{handler:e}=It(),t=F(),{pathname:n}=yt(),[r,i]=(0,J.useState)(!1),a=b(),o=a.data!==void 0&&le(a.data.protocol);return(0,J.useEffect)(()=>{if(!o)return;let e=()=>{let e=et();q.reportTheme(e(`--text-primary`),e(`--bg-base`))};return e(),$e(e)},[o]),(0,Y.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden overscroll-y-none bg-ground`,children:[(0,Y.jsx)(Qr,{}),(0,Y.jsx)(`main`,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(Dn,{resetOn:n,scope:n.startsWith(`/project/`)?`workspace`:`view`,children:(0,Y.jsx)(bt,{})})}),(0,Y.jsx)(Qn,{}),(0,Y.jsx)(lr,{}),(0,Y.jsx)(gr,{}),(0,Y.jsx)(vr,{}),(0,Y.jsx)(yr,{}),(0,Y.jsx)(xr,{}),(0,Y.jsx)(ir,{onNewSession:e??void 0,onNewProject:()=>i(!0)}),t!==null&&(0,Y.jsx)(sn,{profileId:t,open:r,onOpenChange:i}),(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(Jr,{})}),(0,Y.jsx)(sr,{})]})}function ei(){return(0,Y.jsx)(jt,{children:(0,Y.jsx)($r,{})})}var ti=(0,J.lazy)(()=>M(()=>import(`./Dashboard-CB_H-DLw.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([39,1,2,15,16,3,17,18,19,5,6,7,8,20,22,40,30,41,42,33,43,36,25,26]))),ni=(0,J.lazy)(()=>M(()=>import(`./Workspace-PBHY5dWY.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([44,1,2,6,15,16,3,17,18,19,5,7,8,20,27,28,29,22,45,46,26,42,33,40,24,47,23,48,49,30,41,50,31,32,51,52,25,53,54,55,56,57,58,38,59]))),ri=new En({defaultOptions:{queries:{retry:1,staleTime:5e3}},mutationCache:new Cn({onError:e=>K(e)})});function ii(){let e=F(),t=ue(),n=e!==null&&t.data!==void 0&&!t.data.some(t=>t.id===e);return e===null||n?(0,Y.jsx)(Zn,{}):(0,Y.jsx)(wt,{useTransitions:!1,children:(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(vt,{children:(0,Y.jsxs)(Tt,{element:(0,Y.jsx)(ei,{}),children:[(0,Y.jsx)(Tt,{path:`/`,element:(0,Y.jsx)(ti,{})}),(0,Y.jsx)(Tt,{path:`/project/:id`,element:(0,Y.jsx)(ni,{})}),(0,Y.jsx)(Tt,{path:`/project/:id/session/:sid`,element:(0,Y.jsx)(ni,{})})]})})})})}function ai(){let e=(0,J.useSyncExternalStore)(De.subscribe,De.get);return(0,Y.jsx)(ge,{client:ri,children:(0,Y.jsxs)(Wt,{delayDuration:300,children:[(0,Y.jsx)(Un,{}),(0,Y.jsx)(Dn,{scope:`app`,children:e?window.location.pathname.startsWith(`/forward/`)?(0,Y.jsx)(Sn,{}):(0,Y.jsx)(ii,{}):(0,Y.jsx)(kn,{})}),(0,Y.jsx)(On,{})]})})}export{ai as App};
|