@puddle-code/cli 0.0.11 → 0.0.13
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 +5 -51
- package/README.md +12 -0
- package/dist/index.js +16 -2
- package/dist/public/assets/Dashboard-T4hbzT6P.js +1 -0
- package/dist/public/assets/{EditorTabClose-AQGPNeQZ.js → EditorTabClose-DxU5M-9J.js} +1 -1
- package/dist/public/assets/LazyTerminal-Dpk5-lcY.js +2 -0
- package/dist/public/assets/{ModelRefcount-BQMI3Vu-.js → ModelRefcount-BGB1nvG5.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-mk4tny45.js → PaneEditorBody-DX0u3ISF.js} +1 -1
- package/dist/public/assets/SettingsDialog-58D8eQOa.js +1 -0
- package/dist/public/assets/Terminal-DlXSwAG0.js +117 -0
- package/dist/public/assets/Workspace-B_eXJKAN.js +6 -0
- package/dist/public/assets/{api-CNOSFtPh.js → api-Bh5IJ30S.js} +2 -2
- package/dist/public/assets/{buffer-store-B6LPaCyf.js → buffer-store-zsL8CNKc.js} +2 -2
- package/dist/public/assets/context-menu-C8MwVsBG.js +1 -0
- package/dist/public/assets/{cssMode-Cb9x7qHj.js → cssMode-Dzho6NMm.js} +1 -1
- package/dist/public/assets/editor-tabs-D0_DZriG.js +1 -0
- package/dist/public/assets/{htmlMode-B24wJNmk.js → htmlMode-pj_l07tD.js} +1 -1
- package/dist/public/assets/index-DK5CyY2G.css +2 -0
- package/dist/public/assets/index-oAv85qtL.js +10 -0
- package/dist/public/assets/{jsonMode-CzL1xPlh.js → jsonMode-Dx2T0LuI.js} +1 -1
- package/dist/public/assets/poll-focus-B7dQPFj6.js +1 -0
- package/dist/public/assets/{session-seed-DFIaOrWq.js → session-seed-C8M00YNU.js} +1 -1
- package/dist/public/assets/ssh-mode-BdHO6hP9.js +1 -0
- package/dist/public/assets/{tsMode-hBn59dP5.js → tsMode-DXWeq4NK.js} +1 -1
- package/dist/public/index.html +5 -5
- package/package.json +1 -1
- package/dist/public/assets/Dashboard-kSBMMJl-.js +0 -1
- package/dist/public/assets/LazyTerminal-yvOIwEDK.js +0 -2
- package/dist/public/assets/SettingsDialog-CkttcYNN.js +0 -1
- package/dist/public/assets/Terminal-Gbu8EGSD.js +0 -35
- package/dist/public/assets/Workspace-Da28EOc_.js +0 -6
- package/dist/public/assets/context-menu-Bsz8Kf7T.js +0 -1
- package/dist/public/assets/editor-tabs-D36ZKi_c.js +0 -1
- package/dist/public/assets/index-Ckwo55p_.css +0 -2
- package/dist/public/assets/index-DVjqBrui.js +0 -10
- package/dist/public/assets/ssh-mode-B1KdLV_0.js +0 -1
- package/dist/public/assets/useMutation-Da9b4jwS.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as e,p as t}from"./editor.api2-4X9Vh9Zw.js";import{m as n}from"./buffer-store-
|
|
1
|
+
import{h as e,p as t}from"./editor.api2-4X9Vh9Zw.js";import{m as n}from"./buffer-store-zsL8CNKc.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b}from"./lspLanguageFeatures-x2nWJpem.js";var x=120*1e3,S=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>x&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=n({moduleId:`vs/language/json/jsonWorker`,createWorker:()=>new Worker(new URL(`/assets/json.worker-Oa9UrkKE.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId,enableSchemaRequest:this._defaults.diagnosticsOptions.enableSchemaRequest}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function C(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&E(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&E(e.charCodeAt(r)))for(r++;r<e.length&&E(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&E(e.charCodeAt(r))){for(r++;r<e.length&&E(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
2
2
|
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(T(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(w(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(w(t));return o=15}if(T(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
|
|
3
3
|
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!T(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,T(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!E(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(w(e)||T(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function w(e){return e===32||e===9}function T(e){return e===10||e===13}function E(e){return e>=48&&e<=57}var D;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(D||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t));var O=200;Array(O).fill(0).map((e,t)=>`
|
|
4
4
|
`+` `.repeat(t)),Array(O).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(O).fill(0).map((e,t)=>`\r
|
|
@@ -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"./jsx-runtime-ffCh33zF.js";var r=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(){}},i=new class extends r{#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`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;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 s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(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 g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(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:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(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 C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{o.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var E=Symbol();function D(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===E?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O(e,t){return typeof e==`function`?e(...t):!!e}function ie(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 k=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function A(){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 ae=s;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,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 j=oe(),M=new class extends r{#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 se(e){return Math.min(1e3*2**e,3e4)}function N(e){return(e??`online`)!==`online`||M.isOnline()}var P=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function F(e){let t=!1,n=0,r,a=A(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new P(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),d=()=>N(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())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(o())return;let i=e.retry??(k.isServer()?0:3),a=e.retryDelay??se,s=typeof a==`function`?a(n,r):a,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),te(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var I=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}};function ce(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=>{ie(e,()=>t.signal,()=>n=!0)},u=D(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?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?R:L,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:L(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 L(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 R(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function le(e,t){return t?L(e,t)!=null:!1}function ue(e,t){return!t||!e.getPreviousPageParam?!1:R(e,t)!=null}var de=class extends I{#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=V(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=V(this.options);e.data!==void 0&&(this.setState(B(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(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(l).catch(l):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=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===E||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>p(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:!f(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=D(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`?ce(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=F({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof P&&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 P){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,...z(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...B(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),j.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function z(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:N(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function B(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function V(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 H=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=A(),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),U(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return W(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return W(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 m(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&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&G(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(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 pe(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(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(k.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.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,!(k.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(o.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(o.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&&U(e,t),o=i&&G(e,n,t,r);(a||o)&&(l={...l,...z(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(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(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`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:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:K(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(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=A();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),!S(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){j.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function fe(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&m(t.retryOnMount,e)===!1)}function U(e,t){return fe(e,t)||e.state.data!==void 0&&W(e,t,t.refetchOnMount)}function W(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&K(e,t)}return!1}function G(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&K(e,n)}function K(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function pe(e,t){return!S(e.getCurrentResult(),t)}var me=class extends I{#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||q(),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=F({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),j.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function q(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var he=class extends r{#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),S(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&v(t.mutationKey)!==v(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??q();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){j.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)})})}},J=e(t(),1),ge=n(),Y=J.createContext(void 0),X=e=>{let t=J.useContext(Y);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},_e=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,ge.jsx)(Y.Provider,{value:e,children:t})),Z=J.createContext(!1),ve=()=>J.useContext(Z);Z.Provider;function ye(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var be=J.createContext(ye()),xe=()=>J.useContext(be),Se=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?O(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ce=e=>{J.useEffect(()=>{e.clearReset()},[e])},we=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||O(n,[e.error,r])),Te=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))}},Ee=(e,t)=>e.isLoading&&e.isFetching&&!t,De=(e,t)=>e?.suspense&&t.isPending,Oe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Q(e,t,n){let r=ve(),i=xe(),a=X(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,Te(o),Se(o,i,s),Ce(i);let u=!a.getQueryCache().get(o.queryHash),[d]=J.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=p?d.subscribe(j.batchCalls(e)):l;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),J.useEffect(()=>{d.setOptions(o)},[o,d]),De(o,f))throw Oe(o,d,i);if(we({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!k.isServer()&&Ee(f,r)&&(u?Oe(o,d,i):s?.promise)?.catch(l).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}function ke(e,t){return Q(e,H,t)}function Ae(e,t){let n=X(t),[r]=J.useState(()=>new he(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);let i=J.useSyncExternalStore(J.useCallback(e=>r.subscribe(j.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=J.useCallback((e,t)=>{r.mutate(e,t).catch(l)},[r]);if(i.error&&O(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var je=12,$=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{$=!0}),window.addEventListener(`blur`,()=>{$=!1}),i.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 Me(e){return()=>$?e:e*je}export{i as C,E as S,g as _,_e as a,y as b,H as c,ue as d,M as f,_ as g,v as h,Q as i,de as l,u as m,Ae as n,X as o,j as p,ke as r,me as s,Me as t,le as u,h as v,r as w,p as x,l as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{A as i,C as a,E as o,O as s,S as c,_ as l,b as u,d,f,j as p,m,p as h,v as g,w as _,x as v,y}from"./dialog-B43iKmfK.js";import{ct as b,dt as x,ft as S,it as C,lt as w,ot as T,st as E,ut as D}from"./LazyTerminal-yvOIwEDK.js";import{t as O}from"./utils-B6KiDbIe.js";import{t as k}from"./createLucideIcon-DyMAgLa3.js";import{n as A,t as j}from"./dist-VDiYuPKw.js";import{o as ee,tt as te}from"./index-DVjqBrui.js";var M=k(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),N=k(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),P=e(t(),1),F=e(n(),1);function I(e,[t,n]){return Math.min(n,Math.max(t,e))}var L=r(),R=[` `,`Enter`,`ArrowUp`,`ArrowDown`],z=[` `,`Enter`],B=`Select`,[V,H,U]=A(B),[W,ne]=s(B,[U,S]),G=S(),[re,K]=W(B),[ie,q]=W(B),ae=`SelectProvider`;function oe(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g,internal_do_not_use_render:_}=e,v=G(t),[y,b]=P.useState(null),[S,C]=P.useState(null),[w,T]=P.useState(!1),E=j(d),[D,O]=l({prop:r,defaultProp:i??!1,onChange:a,caller:B}),[k,A]=l({prop:o,defaultProp:s,onChange:c,caller:B}),ee=P.useRef(null),te=P.useRef(k);P.useEffect(()=>{let e=g?y?.ownerDocument.getElementById(g):y?.form;if(e instanceof HTMLFormElement){let t=()=>A(te.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[g,y,A]);let M=!y||!!g||!!y.closest(`form`),[N,F]=P.useState(new Set),I=u(),R=Array.from(N).map(e=>e.props.value).join(`;`),z=P.useCallback(e=>{F(t=>new Set(t).add(e))},[]),H=P.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:h,trigger:y,onTriggerChange:b,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:I,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:ee,disabled:m,name:f,autoComplete:p,form:g,nativeOptions:N,nativeSelectKey:R,isFormControl:M};return(0,L.jsx)(x,{...v,children:(0,L.jsx)(re,{scope:t,...U,children:(0,L.jsx)(V.Provider,{scope:t,children:(0,L.jsx)(ie,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:H,children:tt(_)?_(U):n})})})})}oe.displayName=ae;var se=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,L.jsx)(oe,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[n,e?(0,L.jsx)(et,{__scopeSelect:t}):null]})})};se.displayName=B;var ce=`SelectTrigger`,le=P.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=G(n),s=K(ce,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=H(n),d=P.useRef(`touch`),[f,m,h]=nt(e=>{let t=u().filter(e=>!e.disabled),n=rt(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,L.jsx)(b,{asChild:!0,...o,children:(0,L.jsx)(_.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:p(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:p(a.onPointerDown,e=>{d.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:p(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&R.includes(e.key)&&(g(),e.preventDefault())})})})});le.displayName=ce;var ue=`SelectValue`,de=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=K(ue,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);v(()=>{u(d)},[u,d]);let p=$(l.value);return(0,L.jsx)(_.span,{...c,asChild:!p&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,L.jsx)(P.Fragment,{children:p?s:o},p?`placeholder`:`value`)})});de.displayName=ue;var fe=`SelectIcon`,pe=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,L.jsx)(_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});pe.displayName=fe;var me=`SelectPortal`,[he,ge]=W(me,{forceMount:void 0}),_e=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,L.jsx)(he,{scope:e.__scopeSelect,forceMount:n,children:(0,L.jsx)(y,{asChild:!0,...r})})};_e.displayName=me;var J=`SelectContent`,ve=P.forwardRef((e,t)=>{let n=ge(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(J,e.__scopeSelect),[o,s]=P.useState();return v(()=>{s(new DocumentFragment)},[]),(0,L.jsx)(g,{present:r||a.open,children:({present:e})=>e?(0,L.jsx)(Ce,{...i,ref:t}):(0,L.jsx)(ye,{...i,fragment:o})})});ve.displayName=J;var ye=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?F.createPortal((0,L.jsx)(be,{scope:n,children:(0,L.jsx)(V.Slot,{scope:n,children:(0,L.jsx)(`div`,{ref:t,children:r})})}),i):null});ye.displayName=`SelectContentFragment`;var Y=10,[be,X]=W(J),xe=`SelectContentImpl`,Se=o(`SelectContent.RemoveScroll`),Ce=P.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:l,sideOffset:u,align:g,alignOffset:_,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=K(J,n),[E,D]=P.useState(null),[O,k]=P.useState(null),A=i(t,D),[j,ee]=P.useState(null),[te,M]=P.useState(null),N=H(n),[F,I]=P.useState(!1),R=P.useRef(!1);P.useEffect(()=>{if(E)return d(E)},[E]),h();let z=P.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=P.useCallback(()=>z([j,E]),[z,j,E]);P.useEffect(()=>{F&&B()},[F,B]);let{onOpenChange:V,triggerPointerDownPosRef:U}=T;P.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(U.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),U.current=null};return U.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,U]),P.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[W,ne]=nt(e=>{let t=N().filter(e=>!e.disabled),n=rt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),G=P.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(R.current=!0))},[T.value]),re=P.useCallback(()=>E?.focus(),[E]),ie=P.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),q=r===`popper`?De:Te,ae=q===De?{side:l,sideOffset:u,align:g,alignOffset:_,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,L.jsx)(be,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:G,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:F,searchRef:W,children:(0,L.jsx)(f,{as:Se,allowPinchZoom:!0,children:(0,L.jsx)(m,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,L.jsx)(c,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,L.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:p(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(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()}})})})})})})});Ce.displayName=xe;var we=`SelectItemAlignedPosition`,Te=P.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=K(J,n),s=X(J,n),[c,l]=P.useState(null),[u,d]=P.useState(null),f=i(t,d),p=H(n),m=P.useRef(!1),h=P.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=P.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.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=I(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=I(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-Y*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),v=parseInt(d.paddingBottom,10),x=f+h+l+v+_,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(g),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+h+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=u.clientHeight-g.offsetTop-g.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+_);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+g.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,g.scrollTop=A-E+g.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,y,b,o.dir,r]);v(()=>S(),[S]);let[C,w]=P.useState();return v(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,L.jsx)(Oe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:P.useCallback(e=>{e&&h.current===!0&&(S(),x?.(),h.current=!1)},[S,x]),children:(0,L.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,L.jsx)(_.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Te.displayName=we;var Ee=`SelectPopperPosition`,De=P.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=G(n);return(0,L.jsx)(D,{...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)`}})});De.displayName=Ee;var[Oe,ke]=W(J,{}),Ae=`SelectViewport`,je=P.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(Ae,n),s=ke(Ae,n),c=i(t,o.onViewportChange),l=P.useRef(0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.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,L.jsx)(V.Slot,{scope:n,children:(0,L.jsx)(_.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:p(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.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`)}}}l.current=t.scrollTop})})})]})});je.displayName=Ae;var Me=`SelectGroup`,[Ne,Pe]=W(Me),Fe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=u();return(0,L.jsx)(Ne,{scope:n,id:i,children:(0,L.jsx)(_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Fe.displayName=Me;var Ie=`SelectLabel`,Le=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pe(Ie,n);return(0,L.jsx)(_.div,{id:i.id,...r,ref:t})});Le.displayName=Ie;var Z=`SelectItem`,[Re,ze]=W(Z),Be=P.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...c}=e,l=K(Z,n),d=X(Z,n),f=l.value===r,[m,h]=P.useState(s??``),[g,v]=P.useState(!1),y=i(t,a(e=>d.itemRefCallback?.(e,r,o))),b=u(),x=P.useRef(`touch`),S=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};return(0,L.jsx)(Re,{scope:n,value:r,disabled:o,textId:b,isSelected:f,onItemTextChange:P.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,L.jsx)(V.ItemSlot,{scope:n,value:r,disabled:o,textValue:m,children:(0,L.jsx)(_.div,{role:`option`,"aria-labelledby":b,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":o||void 0,"data-disabled":o?``:void 0,tabIndex:o?void 0:-1,...c,ref:y,onFocus:p(c.onFocus,()=>v(!0)),onBlur:p(c.onBlur,()=>v(!1)),onClick:p(c.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(c.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(c.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(c.onPointerMove,e=>{x.current=e.pointerType,o?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:p(c.onKeyDown,e=>{o||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(z.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Be.displayName=Z;var Q=`SelectItemText`,Ve=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:o,...s}=e,c=K(Q,n),l=X(Q,n),u=ze(Q,n),d=q(Q,n),[f,p]=P.useState(null),m=a(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),h=i(t,p,u.onItemTextChange,m),g=f?.textContent,y=P.useMemo(()=>(0,L.jsx)(`option`,{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return v(()=>(b(y),()=>x(y)),[b,x,y]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_.span,{id:u.textId,...s,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?F.createPortal(s.children,c.valueNode):null]})});Ve.displayName=Q;var He=`SelectItemIndicator`,Ue=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ze(He,n).isSelected?(0,L.jsx)(_.span,{"aria-hidden":!0,...r,ref:t}):null});Ue.displayName=He;var We=`SelectScrollUpButton`,Ge=P.forwardRef((e,t)=>{let n=X(We,e.__scopeSelect),r=ke(We,e.__scopeSelect),[a,o]=P.useState(!1),s=i(t,r.onScrollButtonChange);return v(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,L.jsx)(Je,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ge.displayName=We;var Ke=`SelectScrollDownButton`,qe=P.forwardRef((e,t)=>{let n=X(Ke,e.__scopeSelect),r=ke(Ke,e.__scopeSelect),[a,o]=P.useState(!1),s=i(t,r.onScrollButtonChange);return v(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,L.jsx)(Je,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});qe.displayName=Ke;var Je=P.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=P.useRef(null),s=H(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),v(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,L.jsx)(_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ye=`SelectSeparator`,Xe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,L.jsx)(_.div,{"aria-hidden":!0,...r,ref:t})});Xe.displayName=Ye;var Ze=`SelectArrow`,Qe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n);return X(Ze,n).position===`popper`?(0,L.jsx)(w,{...i,...r,ref:t}):null});Qe.displayName=Ze;var $e=`SelectBubbleInput`,et=P.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K($e,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=P.useRef(null),h=i(n,m),g=a??``,v=ee(g),y=Array.from(f).some(e=>(e.props.value??``)===``);return P.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[v,g]),(0,L.jsxs)(_.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...te,...t.style},ref:h,defaultValue:g,children:[$(a)&&!y?(0,L.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});et.displayName=$e;function tt(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function nt(e){let t=a(e),n=P.useRef(``),r=P.useRef(0),i=P.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]),o=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function rt(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=it(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 it(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var at=se,ot=de;function st({className:e,children:t,...n}){return(0,L.jsxs)(le,{className:O(`flex h-8 w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,C,e),...n,children:[t,(0,L.jsx)(pe,{asChild:!0,children:(0,L.jsx)(N,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function ct({className:e,children:t,position:n=`popper`,...r}){return(0,L.jsx)(_e,{children:(0,L.jsx)(ve,{position:n,sideOffset:4,className:O(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,e),...r,children:(0,L.jsx)(je,{children:t})})})}function lt({className:e,children:t,detail:n,...r}){return(0,L.jsxs)(Be,{className:O(E,T,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,L.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,L.jsx)(Ue,{children:(0,L.jsx)(M,{className:`size-3.5`})})}),(0,L.jsx)(Ve,{children:t}),n]})}var ut={agent:{baseBranch:``,separateBranch:!0,separateWorktree:!0},terminal:{baseBranch:``,separateBranch:!1,separateWorktree:!1}};function dt(e,t){let n=t?.sessionDefaults?.[e],r=ut[e],i=n?.separateBranch??r.separateBranch;return{baseBranch:n?.baseBranch??r.baseBranch,separateBranch:i,separateWorktree:i?!0:n?.separateWorktree??r.separateWorktree}}export{st as a,lt as i,at as n,ot as o,ct as r,N as s,dt as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{A as i,C as a,E as o,O as s,S as c,_ as l,b as u,d,f,j as p,m,p as h,v as g,w as _,x as v,y}from"./dialog-B43iKmfK.js";import{at as b,ct as x,dt as S,ft as C,lt as w,pt as T,st as E,ut as D}from"./LazyTerminal-Dpk5-lcY.js";import{t as O}from"./utils-B6KiDbIe.js";import{t as k}from"./createLucideIcon-DyMAgLa3.js";import{n as A,t as j}from"./dist-VDiYuPKw.js";import{o as ee,tt as te}from"./index-oAv85qtL.js";var M=k(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),N=k(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),P=e(t(),1),F=e(n(),1);function I(e,[t,n]){return Math.min(n,Math.max(t,e))}var L=r(),R=[` `,`Enter`,`ArrowUp`,`ArrowDown`],z=[` `,`Enter`],B=`Select`,[V,H,U]=A(B),[W,ne]=s(B,[U,T]),G=T(),[re,K]=W(B),[ie,q]=W(B),ae=`SelectProvider`;function oe(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g,internal_do_not_use_render:_}=e,v=G(t),[y,b]=P.useState(null),[x,S]=P.useState(null),[w,T]=P.useState(!1),E=j(d),[D,O]=l({prop:r,defaultProp:i??!1,onChange:a,caller:B}),[k,A]=l({prop:o,defaultProp:s,onChange:c,caller:B}),ee=P.useRef(null),te=P.useRef(k);P.useEffect(()=>{let e=g?y?.ownerDocument.getElementById(g):y?.form;if(e instanceof HTMLFormElement){let t=()=>A(te.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[g,y,A]);let M=!y||!!g||!!y.closest(`form`),[N,F]=P.useState(new Set),I=u(),R=Array.from(N).map(e=>e.props.value).join(`;`),z=P.useCallback(e=>{F(t=>new Set(t).add(e))},[]),H=P.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:h,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:I,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:ee,disabled:m,name:f,autoComplete:p,form:g,nativeOptions:N,nativeSelectKey:R,isFormControl:M};return(0,L.jsx)(C,{...v,children:(0,L.jsx)(re,{scope:t,...U,children:(0,L.jsx)(V.Provider,{scope:t,children:(0,L.jsx)(ie,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:H,children:tt(_)?_(U):n})})})})}oe.displayName=ae;var se=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,L.jsx)(oe,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[n,e?(0,L.jsx)(et,{__scopeSelect:t}):null]})})};se.displayName=B;var ce=`SelectTrigger`,le=P.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=G(n),s=K(ce,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=H(n),d=P.useRef(`touch`),[f,m,h]=nt(e=>{let t=u().filter(e=>!e.disabled),n=rt(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,L.jsx)(w,{asChild:!0,...o,children:(0,L.jsx)(_.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:p(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:p(a.onPointerDown,e=>{d.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:p(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&R.includes(e.key)&&(g(),e.preventDefault())})})})});le.displayName=ce;var ue=`SelectValue`,de=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=K(ue,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);v(()=>{u(d)},[u,d]);let p=$(l.value);return(0,L.jsx)(_.span,{...c,asChild:!p&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,L.jsx)(P.Fragment,{children:p?s:o},p?`placeholder`:`value`)})});de.displayName=ue;var fe=`SelectIcon`,pe=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,L.jsx)(_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});pe.displayName=fe;var me=`SelectPortal`,[he,ge]=W(me,{forceMount:void 0}),_e=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,L.jsx)(he,{scope:e.__scopeSelect,forceMount:n,children:(0,L.jsx)(y,{asChild:!0,...r})})};_e.displayName=me;var J=`SelectContent`,ve=P.forwardRef((e,t)=>{let n=ge(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(J,e.__scopeSelect),[o,s]=P.useState();return v(()=>{s(new DocumentFragment)},[]),(0,L.jsx)(g,{present:r||a.open,children:({present:e})=>e?(0,L.jsx)(Ce,{...i,ref:t}):(0,L.jsx)(ye,{...i,fragment:o})})});ve.displayName=J;var ye=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?F.createPortal((0,L.jsx)(be,{scope:n,children:(0,L.jsx)(V.Slot,{scope:n,children:(0,L.jsx)(`div`,{ref:t,children:r})})}),i):null});ye.displayName=`SelectContentFragment`;var Y=10,[be,X]=W(J),xe=`SelectContentImpl`,Se=o(`SelectContent.RemoveScroll`),Ce=P.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:l,sideOffset:u,align:g,alignOffset:_,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=K(J,n),[E,D]=P.useState(null),[O,k]=P.useState(null),A=i(t,D),[j,ee]=P.useState(null),[te,M]=P.useState(null),N=H(n),[F,I]=P.useState(!1),R=P.useRef(!1);P.useEffect(()=>{if(E)return d(E)},[E]),h();let z=P.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=P.useCallback(()=>z([j,E]),[z,j,E]);P.useEffect(()=>{F&&B()},[F,B]);let{onOpenChange:V,triggerPointerDownPosRef:U}=T;P.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(U.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),U.current=null};return U.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,U]),P.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[W,ne]=nt(e=>{let t=N().filter(e=>!e.disabled),n=rt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),G=P.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(R.current=!0))},[T.value]),re=P.useCallback(()=>E?.focus(),[E]),ie=P.useCallback((e,t,n)=>{let r=!R.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),q=r===`popper`?De:Te,ae=q===De?{side:l,sideOffset:u,align:g,alignOffset:_,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,L.jsx)(be,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:G,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:F,searchRef:W,children:(0,L.jsx)(f,{as:Se,allowPinchZoom:!0,children:(0,L.jsx)(m,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,L.jsx)(c,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,L.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:p(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(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()}})})})})})})});Ce.displayName=xe;var we=`SelectItemAlignedPosition`,Te=P.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=K(J,n),s=X(J,n),[c,l]=P.useState(null),[u,d]=P.useState(null),f=i(t,d),p=H(n),m=P.useRef(!1),h=P.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=P.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.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=I(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=I(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-Y*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),v=parseInt(d.paddingBottom,10),x=f+h+l+v+_,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(g),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+h+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=u.clientHeight-g.offsetTop-g.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+_);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+g.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,g.scrollTop=A-E+g.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,y,b,o.dir,r]);v(()=>S(),[S]);let[C,w]=P.useState();return v(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,L.jsx)(Oe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:P.useCallback(e=>{e&&h.current===!0&&(S(),x?.(),h.current=!1)},[S,x]),children:(0,L.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,L.jsx)(_.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Te.displayName=we;var Ee=`SelectPopperPosition`,De=P.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=G(n);return(0,L.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)`}})});De.displayName=Ee;var[Oe,ke]=W(J,{}),Ae=`SelectViewport`,je=P.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(Ae,n),s=ke(Ae,n),c=i(t,o.onViewportChange),l=P.useRef(0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.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,L.jsx)(V.Slot,{scope:n,children:(0,L.jsx)(_.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:p(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.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`)}}}l.current=t.scrollTop})})})]})});je.displayName=Ae;var Me=`SelectGroup`,[Ne,Pe]=W(Me),Fe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=u();return(0,L.jsx)(Ne,{scope:n,id:i,children:(0,L.jsx)(_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Fe.displayName=Me;var Ie=`SelectLabel`,Le=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pe(Ie,n);return(0,L.jsx)(_.div,{id:i.id,...r,ref:t})});Le.displayName=Ie;var Z=`SelectItem`,[Re,ze]=W(Z),Be=P.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...c}=e,l=K(Z,n),d=X(Z,n),f=l.value===r,[m,h]=P.useState(s??``),[g,v]=P.useState(!1),y=i(t,a(e=>d.itemRefCallback?.(e,r,o))),b=u(),x=P.useRef(`touch`),S=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};return(0,L.jsx)(Re,{scope:n,value:r,disabled:o,textId:b,isSelected:f,onItemTextChange:P.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,L.jsx)(V.ItemSlot,{scope:n,value:r,disabled:o,textValue:m,children:(0,L.jsx)(_.div,{role:`option`,"aria-labelledby":b,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":o||void 0,"data-disabled":o?``:void 0,tabIndex:o?void 0:-1,...c,ref:y,onFocus:p(c.onFocus,()=>v(!0)),onBlur:p(c.onBlur,()=>v(!1)),onClick:p(c.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(c.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(c.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(c.onPointerMove,e=>{x.current=e.pointerType,o?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:p(c.onKeyDown,e=>{o||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(z.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Be.displayName=Z;var Q=`SelectItemText`,Ve=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:o,...s}=e,c=K(Q,n),l=X(Q,n),u=ze(Q,n),d=q(Q,n),[f,p]=P.useState(null),m=a(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),h=i(t,p,u.onItemTextChange,m),g=f?.textContent,y=P.useMemo(()=>(0,L.jsx)(`option`,{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return v(()=>(b(y),()=>x(y)),[b,x,y]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_.span,{id:u.textId,...s,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?F.createPortal(s.children,c.valueNode):null]})});Ve.displayName=Q;var He=`SelectItemIndicator`,Ue=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ze(He,n).isSelected?(0,L.jsx)(_.span,{"aria-hidden":!0,...r,ref:t}):null});Ue.displayName=He;var We=`SelectScrollUpButton`,Ge=P.forwardRef((e,t)=>{let n=X(We,e.__scopeSelect),r=ke(We,e.__scopeSelect),[a,o]=P.useState(!1),s=i(t,r.onScrollButtonChange);return v(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,L.jsx)(Je,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ge.displayName=We;var Ke=`SelectScrollDownButton`,qe=P.forwardRef((e,t)=>{let n=X(Ke,e.__scopeSelect),r=ke(Ke,e.__scopeSelect),[a,o]=P.useState(!1),s=i(t,r.onScrollButtonChange);return v(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,L.jsx)(Je,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});qe.displayName=Ke;var Je=P.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=P.useRef(null),s=H(n),c=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>c(),[c]),v(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,L.jsx)(_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ye=`SelectSeparator`,Xe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,L.jsx)(_.div,{"aria-hidden":!0,...r,ref:t})});Xe.displayName=Ye;var Ze=`SelectArrow`,Qe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n);return X(Ze,n).position===`popper`?(0,L.jsx)(D,{...i,...r,ref:t}):null});Qe.displayName=Ze;var $e=`SelectBubbleInput`,et=P.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K($e,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=P.useRef(null),h=i(n,m),g=a??``,v=ee(g),y=Array.from(f).some(e=>(e.props.value??``)===``);return P.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[v,g]),(0,L.jsxs)(_.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...te,...t.style},ref:h,defaultValue:g,children:[$(a)&&!y?(0,L.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});et.displayName=$e;function tt(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function nt(e){let t=a(e),n=P.useRef(``),r=P.useRef(0),i=P.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]),o=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function rt(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=it(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 it(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var at=se,ot=de;function st({className:e,children:t,...n}){return(0,L.jsxs)(le,{className:O(`flex h-8 w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,b,e),...n,children:[t,(0,L.jsx)(pe,{asChild:!0,children:(0,L.jsx)(N,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function ct({className:e,children:t,position:n=`popper`,...r}){return(0,L.jsx)(_e,{children:(0,L.jsx)(ve,{position:n,sideOffset:4,className:O(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,e),...r,children:(0,L.jsx)(je,{children:t})})})}function lt({className:e,children:t,detail:n,...r}){return(0,L.jsxs)(Be,{className:O(x,E,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,L.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,L.jsx)(Ue,{children:(0,L.jsx)(M,{className:`size-3.5`})})}),(0,L.jsx)(Ve,{children:t}),n]})}var ut={agent:{baseBranch:``,separateBranch:!0,separateWorktree:!0},terminal:{baseBranch:``,separateBranch:!1,separateWorktree:!1}};function dt(e,t){let n=t?.sessionDefaults?.[e],r=ut[e],i=n?.separateBranch??r.separateBranch;return{baseBranch:n?.baseBranch??r.baseBranch,separateBranch:i,separateWorktree:i?!0:n?.separateWorktree??r.separateWorktree}}export{st as a,lt as i,at as n,ot as o,ct as r,N as s,dt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./index-oAv85qtL.js";function t(){return e.get()}export{t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,c as t,f as n,h as r,o as i,p as a}from"./editor.api2-4X9Vh9Zw.js";import{m as o,p as s}from"./buffer-store-
|
|
1
|
+
import{a as e,c as t,f as n,h as r,o as i,p as a}from"./editor.api2-4X9Vh9Zw.js";import{m as o,p as s}from"./buffer-store-zsL8CNKc.js";var c=class{constructor(e,t){this._modeId=e,this._defaults=t,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}async _updateExtraLibs(){if(!this._worker)return;let e=++this._updateExtraLibsToken,t=await this._worker.getProxy();this._updateExtraLibsToken===e&&t.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){return this._client||=(async()=>(this._worker=o({moduleId:`vs/language/typescript/tsWorker`,createWorker:()=>new Worker(new URL(`/assets/ts.worker-BtjBFNHX.js`,``+import.meta.url),{type:`module`}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync()?await this._worker.withSyncedResources(a.getModels().filter(e=>e.getLanguageId()===this._modeId).map(e=>e.uri)):await this._worker.getProxy()))(),this._client}async getLanguageServiceWorker(...e){let t=await this._getClient();return this._worker&&await this._worker.withSyncedResources(e),t}},l={};l[`lib.d.ts`]=!0,l[`lib.decorators.d.ts`]=!0,l[`lib.decorators.legacy.d.ts`]=!0,l[`lib.dom.asynciterable.d.ts`]=!0,l[`lib.dom.d.ts`]=!0,l[`lib.dom.iterable.d.ts`]=!0,l[`lib.es2015.collection.d.ts`]=!0,l[`lib.es2015.core.d.ts`]=!0,l[`lib.es2015.d.ts`]=!0,l[`lib.es2015.generator.d.ts`]=!0,l[`lib.es2015.iterable.d.ts`]=!0,l[`lib.es2015.promise.d.ts`]=!0,l[`lib.es2015.proxy.d.ts`]=!0,l[`lib.es2015.reflect.d.ts`]=!0,l[`lib.es2015.symbol.d.ts`]=!0,l[`lib.es2015.symbol.wellknown.d.ts`]=!0,l[`lib.es2016.array.include.d.ts`]=!0,l[`lib.es2016.d.ts`]=!0,l[`lib.es2016.full.d.ts`]=!0,l[`lib.es2016.intl.d.ts`]=!0,l[`lib.es2017.arraybuffer.d.ts`]=!0,l[`lib.es2017.d.ts`]=!0,l[`lib.es2017.date.d.ts`]=!0,l[`lib.es2017.full.d.ts`]=!0,l[`lib.es2017.intl.d.ts`]=!0,l[`lib.es2017.object.d.ts`]=!0,l[`lib.es2017.sharedmemory.d.ts`]=!0,l[`lib.es2017.string.d.ts`]=!0,l[`lib.es2017.typedarrays.d.ts`]=!0,l[`lib.es2018.asyncgenerator.d.ts`]=!0,l[`lib.es2018.asynciterable.d.ts`]=!0,l[`lib.es2018.d.ts`]=!0,l[`lib.es2018.full.d.ts`]=!0,l[`lib.es2018.intl.d.ts`]=!0,l[`lib.es2018.promise.d.ts`]=!0,l[`lib.es2018.regexp.d.ts`]=!0,l[`lib.es2019.array.d.ts`]=!0,l[`lib.es2019.d.ts`]=!0,l[`lib.es2019.full.d.ts`]=!0,l[`lib.es2019.intl.d.ts`]=!0,l[`lib.es2019.object.d.ts`]=!0,l[`lib.es2019.string.d.ts`]=!0,l[`lib.es2019.symbol.d.ts`]=!0,l[`lib.es2020.bigint.d.ts`]=!0,l[`lib.es2020.d.ts`]=!0,l[`lib.es2020.date.d.ts`]=!0,l[`lib.es2020.full.d.ts`]=!0,l[`lib.es2020.intl.d.ts`]=!0,l[`lib.es2020.number.d.ts`]=!0,l[`lib.es2020.promise.d.ts`]=!0,l[`lib.es2020.sharedmemory.d.ts`]=!0,l[`lib.es2020.string.d.ts`]=!0,l[`lib.es2020.symbol.wellknown.d.ts`]=!0,l[`lib.es2021.d.ts`]=!0,l[`lib.es2021.full.d.ts`]=!0,l[`lib.es2021.intl.d.ts`]=!0,l[`lib.es2021.promise.d.ts`]=!0,l[`lib.es2021.string.d.ts`]=!0,l[`lib.es2021.weakref.d.ts`]=!0,l[`lib.es2022.array.d.ts`]=!0,l[`lib.es2022.d.ts`]=!0,l[`lib.es2022.error.d.ts`]=!0,l[`lib.es2022.full.d.ts`]=!0,l[`lib.es2022.intl.d.ts`]=!0,l[`lib.es2022.object.d.ts`]=!0,l[`lib.es2022.regexp.d.ts`]=!0,l[`lib.es2022.string.d.ts`]=!0,l[`lib.es2023.array.d.ts`]=!0,l[`lib.es2023.collection.d.ts`]=!0,l[`lib.es2023.d.ts`]=!0,l[`lib.es2023.full.d.ts`]=!0,l[`lib.es2023.intl.d.ts`]=!0,l[`lib.es2024.arraybuffer.d.ts`]=!0,l[`lib.es2024.collection.d.ts`]=!0,l[`lib.es2024.d.ts`]=!0,l[`lib.es2024.full.d.ts`]=!0,l[`lib.es2024.object.d.ts`]=!0,l[`lib.es2024.promise.d.ts`]=!0,l[`lib.es2024.regexp.d.ts`]=!0,l[`lib.es2024.sharedmemory.d.ts`]=!0,l[`lib.es2024.string.d.ts`]=!0,l[`lib.es5.d.ts`]=!0,l[`lib.es6.d.ts`]=!0,l[`lib.esnext.array.d.ts`]=!0,l[`lib.esnext.collection.d.ts`]=!0,l[`lib.esnext.d.ts`]=!0,l[`lib.esnext.decorators.d.ts`]=!0,l[`lib.esnext.disposable.d.ts`]=!0,l[`lib.esnext.error.d.ts`]=!0,l[`lib.esnext.float16.d.ts`]=!0,l[`lib.esnext.full.d.ts`]=!0,l[`lib.esnext.intl.d.ts`]=!0,l[`lib.esnext.iterator.d.ts`]=!0,l[`lib.esnext.promise.d.ts`]=!0,l[`lib.esnext.sharedmemory.d.ts`]=!0,l[`lib.scripthost.d.ts`]=!0,l[`lib.webworker.asynciterable.d.ts`]=!0,l[`lib.webworker.d.ts`]=!0,l[`lib.webworker.importscripts.d.ts`]=!0,l[`lib.webworker.iterable.d.ts`]=!0;function u(e,t,n=0){if(typeof e==`string`)return e;if(e===void 0)return``;let r=``;if(n){r+=t;for(let e=0;e<n;e++)r+=` `}if(r+=e.messageText,n++,e.next)for(let i of e.next)r+=u(i,t,n);return r}function d(e){return e?e.map(e=>e.text).join(``):``}var f=class{constructor(e){this._worker=e}_textSpanToRange(e,t){let n=e.getPositionAt(t.start),r=e.getPositionAt(t.start+t.length),{lineNumber:i,column:a}=n,{lineNumber:o,column:s}=r;return{startLineNumber:i,startColumn:a,endLineNumber:o,endColumn:s}}},p=class{constructor(e){this._worker=e,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(e){return e?e.path.indexOf(`/lib.`)===0&&!!l[e.path.slice(1)]:!1}getOrCreateModel(e){let t=n.parse(e),r=a.getModel(t);if(r)return r;if(this.isLibFile(t)&&this._hasFetchedLibFiles)return a.createModel(this._libFiles[t.path.slice(1)],`typescript`,t);let i=s.getExtraLibs()[e];return i?a.createModel(i.content,`typescript`,t):null}_containsLibFile(e){for(let t of e)if(this.isLibFile(t))return!0;return!1}async fetchLibFilesIfNecessary(e){this._containsLibFile(e)&&await this._fetchLibFiles()}_fetchLibFiles(){return this._fetchLibFilesPromise||=this._worker().then(e=>e.getLibFiles()).then(e=>{this._hasFetchedLibFiles=!0,this._libFiles=e}),this._fetchLibFilesPromise}},m=class extends f{constructor(e,t,n,r){super(r),this._libFiles=e,this._defaults=t,this._selector=n,this._disposables=[],this._listener=Object.create(null);let i=e=>{if(e.getLanguageId()!==n)return;let t=()=>{let{onlyVisible:t}=this._defaults.getDiagnosticsOptions();t?e.isAttachedToEditor()&&this._doValidate(e):this._doValidate(e)},r,i=e.onDidChangeContent(()=>{clearTimeout(r),r=window.setTimeout(t,500)}),o=e.onDidChangeAttached(()=>{let{onlyVisible:n}=this._defaults.getDiagnosticsOptions();n&&(e.isAttachedToEditor()?t():a.setModelMarkers(e,this._selector,[]))});this._listener[e.uri.toString()]={dispose(){i.dispose(),o.dispose(),clearTimeout(r)}},t()},o=e=>{a.setModelMarkers(e,this._selector,[]);let t=e.uri.toString();this._listener[t]&&(this._listener[t].dispose(),delete this._listener[t])};this._disposables.push(a.onDidCreateModel(e=>i(e))),this._disposables.push(a.onWillDisposeModel(o)),this._disposables.push(a.onDidChangeModelLanguage(e=>{o(e.model),i(e.model)})),this._disposables.push({dispose(){for(let e of a.getModels())o(e)}});let s=()=>{for(let e of a.getModels())o(e),i(e)};this._disposables.push(this._defaults.onDidChange(s)),this._disposables.push(this._defaults.onDidExtraLibsChange(s)),a.getModels().forEach(e=>i(e))}dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables=[]}async _doValidate(e){let t=await this._worker(e.uri);if(e.isDisposed())return;let r=[],{noSyntaxValidation:i,noSemanticValidation:o,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();i||r.push(t.getSyntacticDiagnostics(e.uri.toString())),o||r.push(t.getSemanticDiagnostics(e.uri.toString())),s||r.push(t.getSuggestionDiagnostics(e.uri.toString()));let c=await Promise.all(r);if(!c||e.isDisposed())return;let l=c.reduce((e,t)=>t.concat(e),[]).filter(e=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(e.code)===-1),u=l.map(e=>e.relatedInformation||[]).reduce((e,t)=>t.concat(e),[]).map(e=>e.file?n.parse(e.file.fileName):null);await this._libFiles.fetchLibFilesIfNecessary(u),!e.isDisposed()&&a.setModelMarkers(e,this._selector,l.map(t=>this._convertDiagnostics(e,t)))}_convertDiagnostics(e,t){let n=t.start||0,r=t.length||1,{lineNumber:a,column:o}=e.getPositionAt(n),{lineNumber:s,column:c}=e.getPositionAt(n+r),l=[];return t.reportsUnnecessary&&l.push(i.Unnecessary),t.reportsDeprecated&&l.push(i.Deprecated),{severity:this._tsDiagnosticCategoryToMarkerSeverity(t.category),startLineNumber:a,startColumn:o,endLineNumber:s,endColumn:c,message:u(t.messageText,`
|
|
2
2
|
`),code:t.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(e,t.relatedInformation)}}_convertRelatedInformation(e,t){if(!t)return[];let n=[];return t.forEach(t=>{let r=e;if(t.file&&(r=this._libFiles.getOrCreateModel(t.file.fileName)),!r)return;let i=t.start||0,a=t.length||1,{lineNumber:o,column:s}=r.getPositionAt(i),{lineNumber:c,column:l}=r.getPositionAt(i+a);n.push({resource:r.uri,startLineNumber:o,startColumn:s,endLineNumber:c,endColumn:l,message:u(t.messageText,`
|
|
3
3
|
`)})}),n}_tsDiagnosticCategoryToMarkerSeverity(t){switch(t){case 1:return e.Error;case 3:return e.Info;case 0:return e.Warning;case 2:return e.Hint}return e.Info}},h=class e extends f{get triggerCharacters(){return[`.`]}async provideCompletionItems(n,i,a,o){let s=n.getWordUntilPosition(i),c=new t(i.lineNumber,s.startColumn,i.lineNumber,s.endColumn),l=n.uri,u=n.getOffsetAt(i),d=await this._worker(l);if(n.isDisposed())return;let f=await d.getCompletionsAtPosition(l.toString(),u);if(!(!f||n.isDisposed()))return{suggestions:f.entries.map(a=>{let o=c;if(a.replacementSpan){let e=n.getPositionAt(a.replacementSpan.start),r=n.getPositionAt(a.replacementSpan.start+a.replacementSpan.length);o=new t(e.lineNumber,e.column,r.lineNumber,r.column)}let s=[];return a.kindModifiers!==void 0&&a.kindModifiers.indexOf(`deprecated`)!==-1&&s.push(r.CompletionItemTag.Deprecated),{uri:l,position:i,offset:u,range:o,label:a.name,insertText:a.name,sortText:a.sortText,kind:e.convertKind(a.kind),tags:s}})}}async resolveCompletionItem(t,n){let r=t,i=r.uri,a=r.position,o=r.offset,s=await(await this._worker(i)).getCompletionEntryDetails(i.toString(),o,r.label);return s?{uri:i,position:a,label:s.name,kind:e.convertKind(s.kind),detail:d(s.displayParts),documentation:{value:e.createDocumentationString(s)}}:r}static convertKind(e){switch(e){case C.primitiveType:case C.keyword:return r.CompletionItemKind.Keyword;case C.variable:case C.localVariable:return r.CompletionItemKind.Variable;case C.memberVariable:case C.memberGetAccessor:case C.memberSetAccessor:return r.CompletionItemKind.Field;case C.function:case C.memberFunction:case C.constructSignature:case C.callSignature:case C.indexSignature:return r.CompletionItemKind.Function;case C.enum:return r.CompletionItemKind.Enum;case C.module:return r.CompletionItemKind.Module;case C.class:return r.CompletionItemKind.Class;case C.interface:return r.CompletionItemKind.Interface;case C.warning:return r.CompletionItemKind.File}return r.CompletionItemKind.Property}static createDocumentationString(e){let t=d(e.documentation);if(e.tags)for(let n of e.tags)t+=`
|
|
4
4
|
|
package/dist/public/index.html
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/puddle.svg" />
|
|
7
7
|
<title>puddle</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-oAv85qtL.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/react-CZI7_Jkm.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-ffCh33zF.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/poll-focus-B7dQPFj6.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/api-Bh5IJ30S.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/utils-B6KiDbIe.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-DyMAgLa3.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/dialog-B43iKmfK.js">
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/LazyTerminal-
|
|
19
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/LazyTerminal-Dpk5-lcY.js">
|
|
19
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DK5CyY2G.css">
|
|
20
20
|
</head>
|
|
21
21
|
<body>
|
|
22
22
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puddle-code/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "puddle — 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 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,x as i}from"./api-CNOSFtPh.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{$ as d,B as f,I as p,J as m,L as h,U as g,nt as _,o as v,s as y,t as b,tt as x}from"./LazyTerminal-yvOIwEDK.js";import{t as S}from"./utils-B6KiDbIe.js";import{A as C,O as w,c as T,j as E,k as D,n as O,r as k,t as A}from"./context-menu-Bsz8Kf7T.js";import{i as j,r as M}from"./dist-VDiYuPKw.js";import{M as N,P,W as F,X as I,ct as L}from"./index-DVjqBrui.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,i]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return P.spawnShell(r).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),i(null)};return{open:e,term:n,toggle:()=>{e?(n&&P.killShell(r,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(b,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=d(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:d,onDragEnd:f,onDragOver:p}){let m=h(),[g,v]=(0,R.useState)(!1),[b,w]=(0,R.useState)(e.name),D=t=>m.mutate({id:e.id,archived:t},{onError:e=>i.error(e.message)}),j=()=>{let t=b.trim();if(!t||t===e.name){v(!1);return}m.mutate({id:e.id,name:t},{onSuccess:()=>v(!1),onError:e=>i.error(e.message)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(T,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:d,onDragEnd:f,onDragOver:p,className:S(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,z.jsxs)(L,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex`,children:e.archived?(0,z.jsx)(G,{icon:E,label:`Reopen project`,onClick:()=>D(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:y,label:`Rename project`,onClick:()=>{w(e.name),v(!0)}}),(0,z.jsx)(G,{icon:C,label:`Archive project`,onClick:()=>D(!0)})]})})]})}),(0,z.jsx)(O,{children:e.archived?(0,z.jsxs)(k,{onSelect:()=>D(!1),children:[(0,z.jsx)(E,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(k,{onSelect:()=>{w(e.name),v(!0)},children:[(0,z.jsx)(y,{}),` Rename`]}),(0,z.jsxs)(k,{onSelect:()=>D(!0),children:[(0,z.jsx)(C,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:g,onOpenChange:v,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,z.jsx)(_,{value:b,onChange:e=>w(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(x,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>v(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!b.trim()||m.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=v(),t=g(e??void 0),n=m(),r=f(e??void 0),i=p(e??``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),d=V(),h=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],y=r.data?.projectOrder??[],b=w(_.filter(e=>!e.archived),y),x=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&i.mutate({projectOrder:D(b.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[_.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(M,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[b.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&T(s,e.id)}},e.id)),(0,z.jsx)(q,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,z.jsx)(q,{icon:F,label:d.open?`Close terminal`:`Open terminal`,hint:d.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:d.toggle})]}),x.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(j,{className:S(`size-3 transition-transform`,l&&`rotate-90`)}),(0,z.jsx)(C,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:x.length})]}),l&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:x.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),d.open&&(0,z.jsx)(H,{term:d.term,onExit:d.onExit}),e!==null&&(0,z.jsx)(N,{profileId:e,open:a,onOpenChange:o})]})}export{J as Dashboard};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-Gbu8EGSD.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-CNOSFtPh.js","assets/utils-B6KiDbIe.js","assets/index-DVjqBrui.js","assets/useMutation-Da9b4jwS.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-Ckwo55p_.css","assets/ssh-mode-B1KdLV_0.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{a as i,n as a,t as o}from"./useMutation-Da9b4jwS.js";import{t as s}from"./preload-helper-Czpn1I53.js";import{n as c,y as l}from"./api-CNOSFtPh.js";import{A as u,C as d,O as f,w as p,x as m}from"./dialog-B43iKmfK.js";import{t as h}from"./utils-B6KiDbIe.js";import{t as g}from"./createLucideIcon-DyMAgLa3.js";var _=e(t(),1),v=[`top`,`right`,`bottom`,`left`],y=Math.min,b=Math.max,x=Math.round,S=Math.floor,C=e=>({x:e,y:e}),w={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function T(e,t,n){return b(e,y(t,n))}function E(e,t){return typeof e==`function`?e(t):e}function D(e){return e.split(`-`)[0]}function O(e){return e.split(`-`)[1]}function k(e){return e===`x`?`y`:`x`}function A(e){return e===`y`?`height`:`width`}function j(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function M(e){return k(j(e))}function N(e,t,n){n===void 0&&(n=!1);let r=O(e),i=M(e),a=A(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function P(e){let t=B(e);return[F(e),t,F(t)]}function F(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var I=[`left`,`right`],L=[`right`,`left`],R=[`top`,`bottom`],z=[`bottom`,`top`];function ee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?L:I:t?I:L;case`left`:case`right`:return t?R:z;default:return[]}}function te(e,t,n,r){let i=O(e),a=ee(D(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(F)))),a}function B(e){let t=D(e);return w[t]+e.slice(t.length)}function ne(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function re(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ne(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ie(e,t,n){let{reference:r,floating:i}=e,a=j(t),o=M(t),s=A(o),c=D(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=O(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ae(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=E(t,e),p=re(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var oe=50,se=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ae},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ie(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<oe&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ie(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ce=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=E(e,t)||{};if(l==null)return{};let d=re(u),f={x:n,y:r},p=M(i),m=A(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,b=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[b]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[b]||a.floating[m]);let D=x/2-S/2,k=w/2-h[m]/2-1,j=y(d[_],k),N=y(d[v],k),P=w-h[m]-N,F=w/2-h[m]/2+D,I=T(j,F,P),L=!c.arrow&&O(i)!=null&&F!==I&&a.reference[m]/2-(F<j?j:N)-h[m]/2<0,R=L?F<j?F-j:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),le=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=E(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=D(r),_=j(o),v=D(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:P(o)),x=p!==`none`;!d&&x&&b.push(...te(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=N(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==j(t))||T.every(e=>j(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=j(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ue(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function de(e){return v.some(t=>e[t]>=0)}var fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=E(e,t);switch(i){case`referenceHidden`:{let e=ue(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:de(e)}}}case`escaped`:{let e=ue(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:de(e)}}}default:return{}}}}},pe=new Set([`left`,`top`]);async function me(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=D(n),s=O(n),c=j(n)===`y`,l=pe.has(o)?-1:1,u=a&&c?-1:1,d=E(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var he=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await me(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ge=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=E(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=j(i),p=k(f),m=u[p],h=u[f],g=(e,t)=>T(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},_e=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=E(e,t),u={x:n,y:r},d=j(i),f=k(d),p=u[f],m=u[d],h=E(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=pe.has(D(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=E(e,t),c=await i.detectOverflow(t,s),l=D(n),u=O(n),d=j(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=y(p-c[m],g),x=y(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=x;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*b(c.left,c.right):w=p-2*b(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let k=await i.getDimensions(a.floating);return f!==k.width||p!==k.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<`u`}function H(e){return be(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((be(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function be(e){return ye()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return ye()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return ye()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function xe(e){return!ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Se(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ce(e){return/^(table|td|th)$/.test(H(e))}function we(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Te=/transform|translate|scale|rotate|perspective|filter/,Ee=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,De;function Oe(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!Ae()&&(q(t.backdropFilter)||q(t.filter))||Te.test(t.willChange||``)||Ee.test(t.contain||``)}function ke(e){let t=Y(e);for(;K(t)&&!je(t);){if(Oe(t))return t;if(we(t))return null;t=Y(t)}return null}function Ae(){return De??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),De}function je(e){return/^(html|body|#document)$/.test(H(e))}function J(e){return U(e).getComputedStyle(e)}function Me(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||xe(e)&&e.host||W(e);return xe(t)?t.host:t}function Ne(e){let t=Y(e);return je(t)?(e.ownerDocument||e).body:K(t)&&Se(t)?t:Ne(t)}function Pe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ne(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Fe(a);return t.concat(a,a.visualViewport||[],Se(r)?r:[],e&&n?Pe(e):[])}else return t.concat(r,Pe(r,[],n))}function Fe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ie(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=x(n)!==a||x(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Le(e){return G(e)?e:e.contextElement}function X(e){let t=Le(e);if(!K(t))return C(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ie(t),o=(a?x(n.width):n.width)/r,s=(a?x(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Re=C(0);function ze(e){let t=U(e);return!Ae()||!t.visualViewport?Re:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Be(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Le(e),o=C(1);t&&(r?G(r)&&(o=X(r)):o=X(e));let s=Be(a,n,r)?ze(a):C(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Fe(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Fe(n)}}return V({width:u,height:d,x:c,y:l})}function Ve(e,t){let n=Me(e).scrollLeft;return t?t.left+n:Z(W(e)).left+n}function He(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ve(e,n),y:n.top+t.scrollTop}}function Ue(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?we(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=C(1),u=C(0),d=K(r);if((d||!a)&&((H(r)!==`body`||Se(o))&&(c=Me(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?He(o,c):C(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function We(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ge(e){let t=Me(e),n=e.ownerDocument.body,r=b(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=b(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ve(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=b(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ke=25;function qe(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ae()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ve(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Ke&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Je(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ye(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=qe(e,n,t);else if(t===`document`)r=Ge(W(e));else if(G(t))r=Je(t,n);else{let n=ze(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function Xe(e,t){let n=t.get(e);if(n)return n;let r=Pe(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!je(o);){let e=J(o),t=Oe(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Ze(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?we(t)?[]:Xe(t,this._c):[].concat(n),r],o=Ye(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ye(t,a[e],i);s=b(n.top,s),c=y(n.right,c),l=y(n.bottom,l),u=b(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qe(e){let{width:t,height:n}=Ie(e);return{width:t,height:n}}function $e(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=C(0);if((r||!a)&&((H(t)!==`body`||Se(i))&&(s=Me(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ve(i));let l=i&&!r&&!a?He(i,s):C(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function et(e){return J(e).position===`static`}function tt(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function nt(e,t){let n=U(e);if(we(e))return n;if(!K(e)){let t=Y(e);for(;t&&!je(t);){if(G(t)&&!et(t))return t;t=Y(t)}return n}let r=tt(e,t);for(;r&&Ce(r)&&et(r);)r=tt(r,t);return r&&je(r)&&et(r)&&!Oe(r)?n:r||ke(e)||n}var rt=async function(e){let t=this.getOffsetParent||nt,n=this.getDimensions,r=await n(e.floating);return{reference:$e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function it(e){return J(e).direction===`rtl`}var at={convertOffsetParentRelativeRectToViewportRelativeRect:Ue,getDocumentElement:W,getClippingRect:Ze,getOffsetParent:nt,getElementRects:rt,getClientRects:We,getDimensions:Qe,getScale:X,isElement:G,isRTL:it};function ot(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function st(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=S(d),h=S(a.clientWidth-(u+f)),g=S(a.clientHeight-(d+p)),_=S(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:b(0,y(1,c))||1},x=!0;function C(t){let n=t[0].intersectionRatio;if(!ot(l,e.getBoundingClientRect()))return s();if(n!==c){if(!x)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{r=new IntersectionObserver(C,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ct(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Le(e),u=i||a?[...l?Pe(l):[],...t?Pe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?st(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!ot(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var lt=he,ut=ge,dt=le,ft=ve,pt=fe,mt=ce,ht=_e,gt=(e,t,n)=>{let r=new Map,i=n??{},a={...at,...i.platform,_c:r};return se(e,t,{...i,platform:a})},_t=e(n(),1),vt=typeof document<`u`?_.useLayoutEffect:function(){};function yt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!yt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!yt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xt(e,t){let n=bt(e);return Math.round(t*n)/n}function St(e){let t=_.useRef(e);return vt(()=>{t.current=e}),t}function Ct(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);yt(f,r)||p(r);let[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=_.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||g,C=_.useRef(null),w=_.useRef(null),T=_.useRef(u),E=c!=null,D=St(c),O=St(i),k=St(l),A=_.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),gt(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!yt(T.current,t)&&(T.current=t,_t.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);vt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=_.useRef(!1);vt(()=>(j.current=!0,()=>{j.current=!1}),[]),vt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=_.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=_.useMemo(()=>({reference:x,floating:S}),[x,S]),P=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=xt(N.floating,u.x),r=xt(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var wt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:mt({element:r.current,padding:i}).fn(n):r?mt({element:r,padding:i}).fn(n):{}}}},Tt=(e,t)=>{let n=lt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>({fn:ht(e).fn,options:[e,t]}),Ot=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=wt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Mt=`Arrow`,Nt=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(p.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Nt.displayName=Mt;var Pt=Nt;function Ft(e){let[t,n]=_.useState(void 0);return m(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var It=`Popper`,[Lt,Rt]=f(It),[zt,Bt]=Lt(It),Vt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null),[a,o]=_.useState(void 0);return(0,Q.jsx)(zt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Vt.displayName=It;var Ht=`PopperAnchor`,Ut=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Bt(Ht,n),o=_.useRef(null),s=a.onAnchorChange,c=u(t,_.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=_.useRef(null);_.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let d=a.placementState&&$t(a.placementState),f=d?.[0],m=d?.[1];return r?null:(0,Q.jsx)(p.div,{"data-radix-popper-side":f,"data-radix-popper-align":m,...i,ref:c})});Ut.displayName=Ht;var Wt=`PopperContent`,[Gt,Kt]=Lt(Wt),qt=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=Bt(Wt,n),[S,C]=_.useState(null),w=u(t,C),[T,E]=_.useState(null),D=Ft(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Zt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=Ct({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>ct(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[Tt({mainAxis:i+k,alignmentAxis:o}),c&&Et({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?Dt():void 0,...P}),c&&Ot({...P}),kt({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&jt({element:T,padding:s}),Qt({arrowWidth:O,arrowHeight:k}),g&&At({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;m(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,B]=$t(L),ne=d(y);m(()=>{R&&ne?.()},[R,ne]);let re=z.arrow?.x,V=z.arrow?.y,ie=z.arrow?.centerOffset!==0,[ae,oe]=_.useState();return m(()=>{S&&oe(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Gt,{scope:n,placedSide:te,placedAlign:B,onArrowChange:E,arrowX:re,arrowY:V,shouldHideArrow:ie,children:(0,Q.jsx)(p.div,{"data-side":te,"data-align":B,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});qt.displayName=Wt;var Jt=`PopperArrow`,Yt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Xt=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Kt(Jt,n),a=Yt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Pt,{...r,ref:t,style:{...r.style,display:`block`}})})});Xt.displayName=Jt;function Zt(e){return e!==null}var Qt=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=$t(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function $t(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var en=Vt,tn=Ut,nn=qt,rn=Xt,an=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,on=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,sn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,cn=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function ln({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:h(`flex h-8 w-full px-2.5`,an,e),...n})}function un({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:h(`flex min-h-16 w-full px-2.5 py-2`,an,e),...t})}var dn=`Label`,fn=_.forwardRef((e,t)=>(0,Q.jsx)(p.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));fn.displayName=dn;var pn=fn;function mn({className:e,...t}){return(0,Q.jsx)(pn,{className:h(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function hn(){return a({queryKey:[`profiles`],queryFn:()=>c(`GET`,`/api/profiles`)})}function gn(e){return a({queryKey:[`profile-settings`,e],queryFn:()=>c(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function _n(e){return a({queryKey:[`accounts`,e],queryFn:()=>c(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function vn(e){return a({queryKey:[`account-usage`,e],queryFn:()=>c(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function yn(){return a({queryKey:[`repos`],queryFn:()=>c(`GET`,`/api/repos`)})}function bn(e){return a({queryKey:[`projects`,e??`all`],queryFn:()=>c(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`)})}function xn(e){return a({queryKey:[`project`,e],queryFn:()=>c(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Sn(e){return a({queryKey:[`sessions`,e],queryFn:()=>c(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}function Cn(){return a({queryKey:[`sessions`,`all`],queryFn:()=>c(`GET`,`/api/sessions`)})}function wn(){return a({queryKey:[`config`],queryFn:()=>c(`GET`,`/api/config`)})}function Tn(e){return a({queryKey:[`repo-branches`,e],queryFn:()=>c(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function En(e){return a({queryKey:[`repo-worktrees`,e],queryFn:()=>c(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function Dn(e,t){let n=i();return o({mutationFn:t=>c(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function On(e,t){let n=i();return o({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),c(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function kn(e){return a({queryKey:[`fs-dirs`,e],queryFn:()=>c(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function An(){return a({queryKey:[`version`],queryFn:()=>c(`GET`,`/api/version`),staleTime:1/0})}function jn(){return a({queryKey:[`host`],queryFn:()=>c(`GET`,`/api/host`),staleTime:1/0})}function Mn(){return a({queryKey:[`agents`],queryFn:()=>c(`GET`,`/api/agents`),staleTime:1/0})}function Nn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Pn(e){let t=i();return o({mutationFn:t=>c(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function Fn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function In(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function Ln(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Rn(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function zn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Bn(){return o({mutationFn:e=>c(`POST`,`/api/accounts/${e}/login`)})}function Vn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Hn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Un(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Wn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Gn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Kn(e,t){return a({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>c(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function qn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Jn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Yn(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Xn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function Zn(e){let t=i();return o({mutationFn:t=>c(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function Qn(){let e=i();return o({mutationFn:({sessionId:e,accountId:t})=>c(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function $n(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function er(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function tr(){let e=i();return o({mutationFn:({sessionId:e,title:t})=>c(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function nr(){let e=i();return o({mutationFn:e=>c(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function rr(e){try{return await c(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function ir(e,t){return c(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function ar(e,t){return a({queryKey:[`ports`,e],queryFn:()=>c(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:5e3,refetchIntervalInBackground:!1})}function or(e,t){return a({queryKey:[`session-env`,e],queryFn:()=>c(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:5e3,refetchIntervalInBackground:!1})}function sr(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var cr=g(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),lr=l(`puddle.profile-id`);function ur(){let e=(0,_.useSyncExternalStore)(lr.subscribe,lr.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function dr(e){lr.set(e)}function fr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(ln,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:h(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:h(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var pr=(0,_.lazy)(()=>s(()=>import(`./Terminal-Gbu8EGSD.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),mr=null;async function hr(){mr=(await s(()=>import(`./Terminal-Gbu8EGSD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function gr(e){return mr?(0,Q.jsx)(mr,{...e}):(0,Q.jsx)(_.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(pr,{...e})})}export{Sn as $,jn as A,gn as B,An as C,Yn as D,Ln as E,Fn as F,tr as G,xn as H,Pn as I,yn as J,Tn as K,Gn as L,Qn as M,In as N,kn as O,nr as P,ar as Q,Hn as R,Xn as S,On as T,bn as U,hn as V,Dn as W,Zn as X,Kn as Y,or as Z,zn as _,dr as a,cn as at,Vn as b,rr as c,tn as ct,_n as d,en as dt,er as et,Mn as f,Rt as ft,wn as g,sr as h,lr as i,an as it,Bn as j,Un as k,ir as l,rn as lt,$n as m,hr as n,ln as nt,ur as o,sn as ot,Cn as p,Ft as pt,En as q,fr as r,un as rt,cr as s,on as st,gr as t,mn as tt,vn as u,nn as ut,Nn as v,Rn as w,qn as x,Wn as y,Jn as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{d as r,f as i,g as a,h as o,m as s,p as c,u as l,x as u}from"./api-CNOSFtPh.js";import{a as d,g as f,i as p,n as m,o as h,r as g,t as _}from"./dialog-B43iKmfK.js";import{B as v,E as y,F as b,I as x,J as S,N as C,O as w,P as T,R as E,U as D,V as O,Y as k,_ as A,d as j,f as ee,g as M,i as te,j as ne,k as re,nt as N,o as P,r as ie,rt as F,tt as ae,w as oe,x as se}from"./LazyTerminal-yvOIwEDK.js";import{t as I}from"./utils-B6KiDbIe.js";import{t as L}from"./createLucideIcon-DyMAgLa3.js";import{a as R,i as z,n as B,o as V,r as H,s as ce,t as le}from"./session-seed-DFIaOrWq.js";import{i as ue,r as de}from"./dist-VDiYuPKw.js";import{A as fe,B as pe,C as me,D as he,E as ge,F as _e,H as ve,I as ye,J as be,K as xe,L as Se,N as Ce,O as we,T as Te,U as Ee,V as De,Y as Oe,a as U,b as ke,c as Ae,d as je,f as Me,g as W,h as G,l as Ne,m as Pe,nt as Fe,ot as Ie,p as Le,q as Re,u as ze,v as Be,x as Ve,y as He,z as Ue}from"./index-DVjqBrui.js";var We=L(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Ge=L(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ke=L(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),qe=L(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Je=L(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ye=L(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xe=L(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ze=L(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Qe=L(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),K=e(t(),1),q=n();function J({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,q.jsxs)(`div`,{className:I(`flex items-center gap-4 py-2.5`,a),children:[(0,q.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:I(`text-xs text-fg-muted`,n),children:t})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function Y({children:e,note:t}){return(0,q.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function $e(){let e=W(),[t,n]=(0,K.useState)(Ie());return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{note:`This browser only`,children:`Appearance`}),(0,q.jsx)(J,{label:`Theme`,description:`Chrome, terminal, and editor restyle together.`,children:(0,q.jsxs)(B,{value:t,onValueChange:e=>{n(e),Fe(e)},children:[(0,q.jsx)(R,{className:`w-32`,children:(0,q.jsx)(V,{})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(z,{value:`dark`,children:`Dark`}),(0,q.jsx)(z,{value:`light`,children:`Light`}),(0,q.jsx)(z,{value:`system`,children:`System`})]})]})}),(0,q.jsx)(J,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,q.jsx)(N,{id:`ui-font-size`,type:`number`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onChange:e=>G({uiFontSize:Number(e.target.value)||Le.uiFontSize})})}),(0,q.jsx)(J,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,q.jsx)(N,{id:`terminal-font-size`,type:`number`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onChange:e=>G({terminalFontSize:Number(e.target.value)||13})})}),(0,q.jsx)(J,{label:`Density`,children:(0,q.jsxs)(B,{value:e.density,onValueChange:e=>G({density:e}),children:[(0,q.jsx)(R,{className:`w-36`,children:(0,q.jsx)(V,{})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(z,{value:`compact`,children:`Compact`}),(0,q.jsx)(z,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,q.jsx)(J,{label:`Reduced motion`,description:`Status ripples become static dots.`,htmlFor:`reduced-motion`,children:(0,q.jsx)(U,{id:`reduced-motion`,checked:e.reducedMotion,onCheckedChange:e=>G({reducedMotion:e})})}),(0,q.jsx)(J,{label:`All projects in the sidebar`,description:`Show every project's sessions in the right sidebar, grouped by project.`,htmlFor:`all-project-sessions`,children:(0,q.jsx)(U,{id:`all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>G({showAllProjectSessions:e})})})]})}function et({profile:e}){let t=b(),[n,r]=(0,K.useState)(!1),i=n=>{t.mutate({id:e.id,icon:n},{onError:e=>u.error(e.message)}),r(!1)},a=n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>u.error(e.message)});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{label:`Icon`,description:`The glyph shown wherever this profile appears.`,children:(0,q.jsxs)(He,{open:n,onOpenChange:r,children:[(0,q.jsx)(Ve,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-md text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(Ue,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,q.jsx)(ke,{align:`end`,className:`w-72`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,q.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>i(null),className:I(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!e.icon&&`bg-elevated text-fg`),children:(0,q.jsx)(Ue,{icon:null,colour:null,className:`size-4`})}),De.map(({name:t,Icon:n})=>(0,q.jsx)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:I(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,e.icon===t&&`bg-elevated text-fg`),children:(0,q.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,q.jsx)(J,{label:`Icon colour`,description:`Any theme colour; recolours with light/dark.`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,q.jsxs)(`button`,{type:`button`,title:`Default`,onClick:()=>a(null),className:I(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,!e.icon_colour&&`bg-elevated`),children:[(0,q.jsx)(`span`,{className:`size-3.5 rounded-full bg-fg-muted`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Default colour`})]}),o.map(t=>(0,q.jsxs)(`button`,{type:`button`,title:t,onClick:()=>a(t),className:I(`flex size-7 items-center justify-center rounded-md transition-colors hover:bg-elevated`,e.icon_colour===t&&`bg-elevated`),children:[(0,q.jsx)(`span`,{className:I(`size-3.5 rounded-full bg-current`,pe(t))}),(0,q.jsx)(`span`,{className:`sr-only`,children:t})]},t))]})})]})}var X=`__none__`;function tt(){let e=P(),t=O().data?.find(t=>t.id===e),n=j(e??void 0),r=v(e??void 0),i=b(),a=x(e??``),o=y(),[s,c]=(0,K.useState)(``),[S,C]=(0,K.useState)(``),[w,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(``);if((0,K.useEffect)(()=>{t&&(c(t.name),C(t.branch_prefix))},[t]),!t)return null;let k=r.data?.default_account_id;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Profile`}),(0,q.jsxs)(J,{label:`Name`,description:`A display label. Letters, digits, dot, underscore and hyphen; must be unique.`,htmlFor:`profile-name`,children:[(0,q.jsx)(N,{id:`profile-name`,value:s,onChange:e=>c(e.target.value),className:`w-44 font-mono`}),(0,q.jsx)(f,{size:`sm`,variant:`secondary`,disabled:s===t.name||s.trim()===``||i.isPending,onClick:()=>i.mutate({id:t.id,name:s},{onError:e=>u.error(e.message)}),children:`Save`})]}),(0,q.jsxs)(J,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,q.jsx)(N,{id:`branch-prefix`,value:S,onChange:e=>C(e.target.value),placeholder:l,className:`w-44 font-mono`}),(0,q.jsx)(f,{size:`sm`,variant:`secondary`,disabled:S===t.branch_prefix||i.isPending,onClick:()=>i.mutate({id:t.id,branch_prefix:S},{onError:e=>u.error(e.message)}),children:`Save`})]}),(0,q.jsx)(et,{profile:t}),(0,q.jsx)(J,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,q.jsxs)(B,{value:typeof k==`number`?String(k):X,onValueChange:e=>a.mutate({default_account_id:e===X?null:Number(e)},{onError:e=>u.error(e.message)}),children:[(0,q.jsx)(R,{className:`w-56`,children:(0,q.jsx)(V,{})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(z,{value:X,children:`First available`}),n.data?.map(e=>(0,q.jsx)(z,{value:String(e.id),children:(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,q.jsx)(J,{label:`Delete profile`,description:`Removes its projects, accounts (logging them out), and archived history. Non-archived sessions block deletion.`,className:`mt-4`,children:(0,q.jsx)(f,{variant:`danger`,size:`sm`,onClick:()=>T(!0),children:`Delete…`})}),(0,q.jsx)(_,{open:w,onOpenChange:e=>{e||(T(!1),D(``))},children:(0,q.jsxs)(m,{children:[(0,q.jsxs)(d,{children:[(0,q.jsxs)(h,{children:[`Delete profile `,(0,q.jsx)(`span`,{className:`font-mono`,children:t.name}),`?`]}),(0,q.jsx)(g,{children:`Everything this profile owns goes with it: projects, workspace layouts, accounts and their credential directories, and archived session history. Branches, repositories, and terminal logs on disk are untouched. This cannot be undone.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(ae,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`font-mono text-fg`,children:t.name}),` to confirm`]}),(0,q.jsx)(N,{id:`delete-confirm-name`,value:E,onChange:e=>D(e.target.value),className:`font-mono`,autoFocus:!0})]}),(0,q.jsxs)(p,{children:[(0,q.jsx)(f,{variant:`ghost`,onClick:()=>{T(!1),D(``)},children:`Cancel`}),(0,q.jsx)(f,{variant:`danger`,disabled:E!==t.name||o.isPending,onClick:()=>o.mutate(t.id,{onSuccess:()=>{_e(),te.set(null)},onError:e=>{T(!1),D(``),u.error(e.message)}}),children:`Delete profile`})]})]})})]})}function nt({agentId:e,profileId:t,onClose:n}){let r=A(),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(``),c=w(Ce(o,150)),l=i.trim()!==``&&(o.startsWith(`/`)||o.startsWith(`~`));return(0,q.jsx)(_,{open:!0,onOpenChange:e=>!e&&n(),children:(0,q.jsxs)(m,{children:[(0,q.jsxs)(d,{children:[(0,q.jsx)(h,{children:`Import an existing account`}),(0,q.jsx)(g,{children:`The directory is copied into a puddle-owned account; the original is never touched. If credentials do not travel (macOS keychain), log in once afterwards.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,q.jsx)(N,{placeholder:`label, e.g. personal`,value:i,onChange:e=>a(e.target.value),className:`font-mono`}),(0,q.jsx)(ie,{value:o,onValueChange:s,placeholder:`config dir on the host, e.g. ~/.claude`,hints:(c.data?.entries??[]).map(e=>({value:e.path,label:e.name})),className:`font-mono`})]}),(0,q.jsxs)(p,{children:[(0,q.jsx)(f,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,q.jsxs)(f,{disabled:!l||r.isPending,onClick:()=>r.mutate({profile_id:t,agent_type:e,label:i.trim(),import_dir:o.trim()},{onSuccess:e=>{n(),e.logged_in||u.info(`Imported without credentials — press Login to authenticate.`)},onError:e=>u.error(e.message)}),children:[(0,q.jsx)(Ke,{}),`Import`]})]})]})})}function rt({account:e,gateOpen:t}){let n=ne(),r=C(),i=oe(),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(!1),[l,v]=(0,K.useState)(e.label);return(0,K.useEffect)(()=>v(e.label),[e.label]),(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`input`,{value:l,onChange:e=>v(e.target.value),onBlur:()=>{let t=l.trim();if(t!==e.label){if(t===``){v(e.label);return}r.mutate({id:e.id,label:t},{onError:t=>{u.error(t.message),v(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(v(e.label),t.currentTarget.blur())},"aria-label":`Account name`,className:`-mx-1 block w-full truncate rounded-sm bg-transparent px-1 py-0.5 font-mono text-sm text-fg transition-colors hover:bg-elevated focus:bg-elevated focus:outline-none`}),(0,q.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-running`:`text-waiting`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,q.jsx)(U,{checked:e.skip_permissions_default,onCheckedChange:t=>r.mutate({id:e.id,skip_permissions_default:t},{onError:e=>u.error(e.message)})})]}),(0,q.jsxs)(f,{size:`sm`,variant:`secondary`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:e=>o(e.stream),onError:e=>u.error(e.message)}),children:[(0,q.jsx)(Oe,{}),e.logged_in?`Re-login`:`Login`]}),(0,q.jsxs)(f,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>c(!0),children:[(0,q.jsx)(Ee,{}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),a&&(0,q.jsx)(Be,{stream:a,label:`${e.agent_type}/${e.label}`,onClose:()=>o(null)}),(0,q.jsx)(_,{open:s,onOpenChange:c,children:(0,q.jsxs)(m,{children:[(0,q.jsxs)(d,{children:[(0,q.jsxs)(h,{children:[`Delete `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.label}),`?`]}),(0,q.jsx)(g,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,q.jsxs)(p,{children:[(0,q.jsx)(f,{variant:`ghost`,onClick:()=>c(!1),children:`Cancel`}),(0,q.jsx)(f,{variant:`danger`,disabled:i.isPending,onClick:()=>i.mutate(e.id,{onSuccess:()=>c(!1),onError:e=>{c(!1),u.error(e.message)}}),children:`Delete account`})]})]})})]})}function it(){let e=P(),t=ee(),n=j(e??void 0),r=v(e??void 0),i=A(),a=ne(),[o,s]=(0,K.useState)({}),[c,l]=(0,K.useState)(null),[d,p]=(0,K.useState)(null),m=r.data?.allowSkipPermissions===!0,h=t=>{let n=(o[t]??``).trim();!n||e===null||i.mutate({profile_id:e,agent_type:t,label:n},{onSuccess:e=>{s(e=>({...e,[t]:``})),a.mutate(e.id,{onSuccess:n=>l({stream:n.stream,label:`${t}/${e.label}`})})},onError:e=>u.error(e.message)})};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[];return(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(J,{label:e.display_name,description:`Accounts are isolated config dirs under this profile.`,className:`py-1`,children:(0,q.jsx)(`span`,{className:`font-mono text-2xs text-fg-muted`,children:e.id})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,q.jsx)(rt,{account:t,gateOpen:m&&e.capabilities.skip_permissions},t.id)),(0,q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),h(e.id)},children:[(0,q.jsx)(N,{placeholder:`label, e.g. personal`,value:o[e.id]??``,onChange:t=>s(n=>({...n,[e.id]:t.target.value})),className:`w-48 font-mono`}),(0,q.jsxs)(f,{type:`submit`,size:`sm`,variant:`secondary`,disabled:!(o[e.id]??``).trim()||i.isPending,children:[(0,q.jsx)(Re,{}),`Add account`]}),(0,q.jsxs)(f,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>p(e.id),children:[(0,q.jsx)(Ke,{}),`Import existing…`]})]})]})]},e.id)}),c&&(0,q.jsx)(Be,{stream:c.stream,label:c.label,onClose:()=>l(null)}),d!==null&&e!==null&&(0,q.jsx)(nt,{agentId:d,profileId:e,onClose:()=>p(null)})]})}function at(){let e=M(),t=T(),[n,r]=(0,K.useState)(``);return(0,K.useEffect)(()=>{e.data&&r(e.data.agentPath)},[e.data]),(0,q.jsx)(J,{label:`Agent search path (host-wide)`,description:`Colon-separated dirs the daemon prepends to PATH to find agent CLIs like claude (e.g. ~/.local/bin). Applies after the daemon restarts.`,htmlFor:`agent-path`,children:(0,q.jsx)(N,{id:`agent-path`,type:`text`,className:`w-64 font-mono text-2xs`,value:n,onChange:e=>r(e.target.value),onBlur:()=>{e.data&&n!==e.data.agentPath&&t.mutate({agentPath:n})}})})}function ot({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=le(e,n),o=n.sessionDefaults??{},[s,c]=(0,K.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,q.jsx)(J,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,q.jsx)(N,{id:`${e}-default-base`,type:`text`,placeholder:`repository default`,className:`w-48 font-mono`,value:s,onChange:e=>c(e.target.value),onBlur:()=>{s.trim()!==a.baseBranch&&l({baseBranch:s.trim()})}})}),(0,q.jsx)(J,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,q.jsx)(U,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,q.jsx)(J,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`An own working copy of the base branch, instead of sharing one.`,htmlFor:`${e}-default-dir`,children:(0,q.jsx)(U,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function st(){return(0,q.jsx)(J,{label:`Terminal scrollback`,description:`Lines kept per terminal. This browser only.`,htmlFor:`scrollback`,children:(0,q.jsx)(N,{id:`scrollback`,type:`number`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:W().terminalScrollback,onChange:e=>G({terminalScrollback:Number(e.target.value)||5e3})})})}function ct({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,K.useState)(r);return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,q.jsx)(F,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(f,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,q.jsx)(f,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var lt={id:`4f3c2b1a-7e6d-5c4b-3a2f-1e0d9c8b7a6f`,title:null,agent_title:`Refactor the auth flow`,osc_title:`claude`,branch:`alice/refactor-auth`,worktree_path:`/home/alice/code/app--refactor-auth`,status:`waiting_input`,agent_type:`claude-code`};function ut({initial:e,onSave:t,pending:n}){let[r,i]=(0,K.useState)(e),o=r.length>0?r:s;return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,q.jsx)(N,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:s}),(0,q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,q.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:me(lt,o)})]}),(0,q.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:a.map(([e,t])=>(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,q.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(f,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,q.jsx)(f,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(s),t(s)},children:`Reset to default`})]})]})}function dt(){let e=P(),t=O().data?.find(t=>t.id===e),n=v(e??void 0),a=x(e??``),[o,s]=(0,K.useState)(!1),[l,y]=(0,K.useState)(``),b=n.data?.allowSkipPermissions===!0,S=e=>a.mutate({allowSkipPermissions:e},{onSuccess:()=>{s(!1),y(``)},onError:e=>u.error(e.message)}),C=e=>t=>a.mutate({[e]:t},{onError:e=>u.error(e.message)});return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Sessions`}),(0,q.jsx)(`p`,{className:`mb-3 text-xs text-fg-secondary`,children:`Permission prompts are on by default, everywhere. Skipping them requires this profile gate, a per-account opt-in, and a per-session toggle — and the daemon re-checks all three on every launch, resume, and hand-off.`}),(0,q.jsx)(J,{label:`Allow skipping permission prompts`,description:b?`The gate is open: opted-in accounts can start prompt-free sessions.`:`The gate is closed: every session keeps its permission prompts.`,htmlFor:`gate`,children:(0,q.jsx)(U,{id:`gate`,checked:b,onCheckedChange:e=>{e?s(!0):S(!1)}})}),(0,q.jsx)(J,{label:`Capture exported env vars`,description:n.data?.captureSessionEnv===!1?`Paused: session shells spawn plain — nothing new is captured or injected. Already-captured vars are kept for when this is re-enabled.`:`Vars exported in a session terminal persist: re-injected into its new shells and agent restarts. Values stay on the daemon host.`,htmlFor:`capture-env`,children:(0,q.jsx)(U,{id:`capture-env`,checked:n.data?.captureSessionEnv!==!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({captureSessionEnv:e},{onError:e=>u.error(e.message)})})}),(0,q.jsx)(at,{}),(0,q.jsx)(st,{}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{note:`What the new-agent and new-terminal modals open with — everything stays editable per session.`,children:`New session defaults`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ot,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>a.mutate({sessionDefaults:e},{onError:e=>u.error(e.message)}),pending:a.isPending},`${e}:agent-seed`),(0,q.jsx)(ot,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>a.mutate({sessionDefaults:e},{onError:e=>u.error(e.message)}),pending:a.isPending},`${e}:terminal-seed`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{note:`Sent to the agent as its opening message when a session starts. Leave a box empty to send no preamble.`,children:`Launch text`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ct,{id:`onboarding-template`,label:`New worktree`,description:`For a freshly created worktree. Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??i,defaultText:i,onSave:C(`onboardingTemplate`),pending:a.isPending},`${e}:onboarding`),(0,q.jsx)(ct,{id:`concurrent-template`,label:`Existing / shared worktree`,description:`For a session joining a worktree other agents may already be working in.`,initial:n.data.concurrentTemplate??r,defaultText:r,onSave:C(`concurrentTemplate`),pending:a.isPending},`${e}:concurrent`),(0,q.jsx)(ct,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot — its processes are gone.`,initial:n.data.restartTemplate??c,defaultText:c,onSave:C(`restartTemplate`),pending:a.isPending},`${e}:restart`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{note:`How each session's tab and sidebar label is composed from its parts.`,children:`Tab title`}),n.data&&(0,q.jsx)(ut,{initial:n.data.tabTitleTemplate??"${name}",onSave:C(`tabTitleTemplate`),pending:a.isPending},`${e}:tab-title`)]}),(0,q.jsx)(_,{open:o,onOpenChange:e=>{e||(s(!1),y(``))},children:(0,q.jsxs)(m,{children:[(0,q.jsxs)(d,{children:[(0,q.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Xe,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,q.jsx)(g,{asChild:!0,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,q.jsx)(`p`,{children:`A prompt-free agent acts unattended, with your credentials, inside its worktree — and nothing technically stops a shell command from reaching outside it. It can:`}),(0,q.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,q.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,q.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,q.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,q.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,q.jsx)(`p`,{children:`Only open this gate if every account you opt in runs work you would trust a colleague to run unsupervised on this machine.`}),(0,q.jsx)(`p`,{className:`text-fg-muted`,children:`Opening it also records the agent’s own bypass-permissions acceptance for this profile’s accounts, so the skip actually takes effect.`})]})})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(ae,{htmlFor:`confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`font-mono text-fg`,children:t?.name}),` to confirm`]}),(0,q.jsx)(N,{id:`confirm-name`,value:l,onChange:e=>y(e.target.value),className:`font-mono`,autoFocus:!0})]}),(0,q.jsxs)(p,{children:[(0,q.jsx)(f,{variant:`ghost`,onClick:()=>{s(!1),y(``)},children:`Cancel`}),(0,q.jsx)(f,{variant:`danger`,disabled:l!==t?.name||a.isPending,onClick:()=>S(!0),children:`Open the gate`})]})]})})]})}var ft={desktop:!0,sound:!1,muted_projects:[]};function pt(){let e=P(),t=v(e??void 0),n=x(e??``),r=D(e??void 0),i={...ft,...t.data?.notifications??{}},a=e=>n.mutate({notifications:e},{onError:e=>u.error(e.message)});return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{note:`Delivery lands in a later phase`,children:`Notifications`}),(0,q.jsx)(J,{label:`Desktop notification on waiting`,description:`When a session flips to waiting for input.`,htmlFor:`notify-desktop`,children:(0,q.jsx)(U,{id:`notify-desktop`,checked:i.desktop,onCheckedChange:e=>a({...i,desktop:e})})}),(0,q.jsx)(J,{label:`Sound`,htmlFor:`notify-sound`,children:(0,q.jsx)(U,{id:`notify-sound`,checked:i.sound,onCheckedChange:e=>a({...i,sound:e})})}),(0,q.jsx)(J,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,q.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[i.muted_projects.length,` muted`]})}),(0,q.jsx)(`div`,{className:`flex flex-col gap-1`,children:r.data?.map(e=>(0,q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,q.jsx)(U,{checked:i.muted_projects.includes(e.id),onCheckedChange:t=>a({...i,muted_projects:t?[...i.muted_projects,e.id]:i.muted_projects.filter(t=>t!==e.id)})}),e.name]},e.id))})]})}function mt(){let e=W();return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{note:`This browser only`,children:`Editor`}),(0,q.jsx)(J,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,q.jsx)(N,{id:`tab-size`,type:`number`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onChange:e=>G({editorTabSize:Number(e.target.value)||2})})}),(0,q.jsx)(J,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,q.jsx)(U,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>G({editorWordWrap:e})})}),(0,q.jsx)(J,{label:`SSH host for editor links`,description:`Used for vscode:// and cursor:// remote links until the CLI supplies it automatically.`,htmlFor:`editor-link-host`,children:(0,q.jsx)(N,{id:`editor-link-host`,type:`text`,placeholder:`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>G({editorLinkSshHost:e.target.value})})})]})}function ht({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=he(e.nativeEvent);t&&(n(t),a(!1))},className:I(`min-w-24 rounded-md px-2 py-1 text-center font-mono text-xs transition-colors`,i?`bg-action text-action-ink`:`bg-elevated text-fg hover:bg-border/70`),children:i?`Press keys…`:we(e)}),!t&&(0,q.jsxs)(`button`,{type:`button`,title:`Reset to default`,onClick:r,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(Je,{className:`size-3.5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function gt(){let e=P(),t=v(e??void 0),n=x(e??``),r=t.data?.hotkeys??{},i=(e,t)=>r[e]||t,a=new Map;for(let e of Te){let t=i(e.id,e.defaultBinding);a.set(t,(a.get(t)??0)+1)}let o=(e,t)=>n.mutate({hotkeys:{...r,[e]:t}},{onError:e=>u.error(e.message)}),s=e=>{let t={...r};delete t[e],n.mutate({hotkeys:t},{onError:e=>u.error(e.message)})};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Hotkeys`}),(0,q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed. Browser-reserved combos (⌘W, ⌘T, ⌘⇧B, …) can’t be captured by a web tab.`}),ge.map(e=>{let t=Te.filter(t=>t.group===e);return t.length===0?null:(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(`div`,{className:`mb-1 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e}),t.map(e=>{let t=i(e.id,e.defaultBinding),n=(a.get(t)??0)>1,c=fe(t)?`Browser-reserved — won’t fire in a tab.`:n?`Conflicts with another shortcut.`:void 0;return(0,q.jsx)(J,{label:e.label,description:c,descriptionClassName:c?`text-interrupted`:void 0,children:(0,q.jsx)(ht,{value:t,isDefault:!r[e.id],onRecord:t=>o(e.id,t),onReset:()=>s(e.id)})},e.id)})]},e)})]})}var _t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,Z=65,Q=Object.fromEntries([..._t].map((e,t)=>[e,t])),vt=`H`,yt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function bt(e){let t=4294967295;for(let n of e)t=yt[(t^n)&255]^t>>>8;return((t^4294967295)>>>0).toString(16).padStart(8,`0`)}function xt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function St(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}async function Ct(e){let t=new Blob([new TextEncoder().encode(e)]).stream().pipeThrough(new CompressionStream(`gzip`));return new Uint8Array(await new Response(t).arrayBuffer())}async function wt(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`gzip`));return new Response(t).text()}function Tt(e,t){let n=(t%Z+Z)%Z,r=``;for(let t of e){let e=Q[t];r+=e===void 0?t:_t[(e+n)%Z]}return r}async function Et(e){let t=await Ct(JSON.stringify(e));return Tt(xt(t)+bt(t),1+Math.floor(Math.random()*(Z-1)))}async function Dt(e){let t=e.trim(),n=t[0];if(!n||Q[n]===void 0)throw Error(`Not a settings export.`);let r=Tt(t,-((Q[n]-Q[vt]+Z)%Z));if(r.length<9||r[0]!==vt)throw Error(`Not a settings export.`);let i=r.slice(0,-8),a=r.slice(-8),o=St(i);if(bt(o)!==a)throw Error(`Settings export is corrupt (checksum mismatch).`);return JSON.parse(await wt(o))}var Ot=`puddle.sync-selection`;function kt(){try{let e=JSON.parse(localStorage.getItem(Ot)??`null`);if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}catch{}return Ae.map(e=>e.id)}function At({selected:e,onToggle:t}){return(0,q.jsx)(`div`,{className:`flex flex-col gap-2 pl-1`,children:Ae.map(n=>(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,q.jsx)(U,{checked:e.includes(n.id),onCheckedChange:e=>t(n.id,e)}),n.label]},n.id))})}function jt(){let e=P(),t=v(e??void 0),n=O().data?.find(t=>t.id===e),r=k(e??void 0,void 0),i=x(e??``),a=b(),o=se(),s=je(),c=Me(),[l,d]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(!1),[_,y]=(0,K.useState)(!1),[S,C]=(0,K.useState)(kt),w=n?s.data?.file.profiles[n.name]:void 0,T=w?.enabled===!0,E=T&&w?w.groups:S,D=()=>({client:Pe(),theme:Ie(),profileSettings:t.data??{},profile:n??{},scratchpad:r.data??[]}),A={setClient:e=>G(e),setTheme:e=>{typeof e==`string`&&Fe(e)},patchProfileSettings:e=>i.mutate(e,{onError:e=>u.error(e.message)}),patchProfileColumns:t=>{e&&a.mutate({id:e,...t},{onError:e=>u.error(e.message)})},createScratchpad:t=>{if(e)for(let n of t)o.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},j=(e,t)=>{n&&c.mutate({profile:n.name,entry:{enabled:e.enabled??T,groups:t,doc:ze(t,D()),updatedAt:new Date().toISOString()}},{onError:e=>u.error(e.message)})},ee=(e,t)=>{let n=t?[...E,e]:E.filter(t=>t!==e);C(n),localStorage.setItem(Ot,JSON.stringify(n)),T&&j({},n)},M=async()=>{y(!0);try{let e=Ne(await Dt(l.trim()),A,{profileSettings:t.data??{},scratchpad:r.data??[]});e.length===0?u.error(`Nothing recognised to import.`):(u.success(`Imported ${e.join(`, `)}.`),d(``))}catch(e){u.error(e.message)}finally{y(!1)}},te=async()=>{y(!0);try{let e=await Et(ze(E,D()));m(e),await navigator.clipboard?.writeText(e),u.success(`Copied to clipboard`)}finally{y(!1)}};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Sync`}),(0,q.jsx)(`p`,{className:`mb-5 text-xs text-fg-muted`,children:`Carry your settings between machines. Accounts, repositories, and anything host-specific are never included. Applies to this profile.`}),(0,q.jsxs)(`div`,{className:`mb-6`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Sync locally`}),s.data?.available===!1?(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:`Not available in this cockpit — start the UI with the puddle CLI to sync across windows.`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`mb-2 mt-1 text-xs text-fg-muted`,children:[`Mirror the selected groups through this machine’s`,` `,(0,q.jsx)(`span`,{className:`font-mono`,children:`~/.puddle`}),`, so every puddle window — any port, any host — stays in step for profiles named`,` `,(0,q.jsx)(`span`,{className:`font-mono`,children:n?.name??`…`}),`. The checklist below then applies to imports and exports alike; scratchpad entries merge and never overwrite.`]}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,q.jsx)(U,{checked:T,disabled:!n||s.isLoading||c.isPending,onCheckedChange:e=>j({enabled:e},E)}),`Sync locally`]})]})]}),(0,q.jsxs)(`div`,{className:`mb-6`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`flex items-center gap-1 text-xs text-fg-secondary transition-colors hover:text-fg`,children:[h?(0,q.jsx)(ce,{className:`size-3.5`}):(0,q.jsx)(ue,{className:`size-3.5`}),`Choose what to sync`]}),h&&(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(At,{selected:E,onToggle:ee})})]}),(0,q.jsxs)(`div`,{className:`mb-6`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Import`}),(0,q.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:`Paste an exported string — only the settings it carries are updated. Scratchpad entries are added alongside yours, never replacing them.`}),(0,q.jsx)(F,{value:l,onChange:e=>d(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Paste a settings export…`,rows:3,spellCheck:!1,className:`resize-y font-mono text-xs`}),(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(f,{size:`sm`,disabled:!l.trim()||_,onClick:()=>void M(),children:`Import`})})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Export`}),(0,q.jsx)(`p`,{className:`mb-2 mt-1 text-xs text-fg-muted`,children:`One click builds the string from the checklist above and copies it to your clipboard.`}),(0,q.jsx)(f,{size:`sm`,disabled:_,onClick:()=>void te(),children:`Export & copy`}),p&&(0,q.jsx)(F,{readOnly:!0,value:p,rows:3,spellCheck:!1,onFocus:e=>e.currentTarget.select(),className:`mt-2 resize-y font-mono text-xs`})]})]})}function Mt({repo:e}){let t=E(),n=re(),[r,i]=(0,K.useState)(e.default_base_branch),[a,o]=(0,K.useState)(e.onboarding_notes??``),s=e=>u.error(e.message);return(0,q.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface p-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-fg`,children:e.path}),(0,q.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted tabular-nums`,children:e.last_fetched_at?`fetched ${new Date(e.last_fetched_at).toLocaleString()}`:`never fetched`}),(0,q.jsxs)(f,{size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:()=>u.success(`Fetched.`),onError:s}),children:[(0,q.jsx)(xe,{}),`Fetch now`]})]}),(0,q.jsxs)(J,{label:`Default base branch`,htmlFor:`base-${e.id}`,className:`py-1.5`,children:[(0,q.jsx)(N,{id:`base-${e.id}`,value:r,onChange:e=>i(e.target.value),className:`w-40 font-mono`}),(0,q.jsx)(f,{size:`sm`,variant:`secondary`,disabled:r===e.default_base_branch||t.isPending,onClick:()=>t.mutate({id:e.id,default_base_branch:r},{onError:s}),children:`Save`})]}),(0,q.jsx)(J,{label:`Periodic fetch`,description:`Fetched on open and on the daemon's interval while sessions are active.`,htmlFor:`fetch-${e.id}`,className:`py-1.5`,children:(0,q.jsx)(U,{id:`fetch-${e.id}`,checked:e.fetch_enabled,onCheckedChange:n=>t.mutate({id:e.id,fetch_enabled:n},{onError:s})})}),(0,q.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`notes-${e.id}`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Onboarding notes`,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Standing setup rules, injected into every fresh worktree. Agents update them via .puddle/onboarding-notes.md.`})]}),(0,q.jsx)(F,{id:`notes-${e.id}`,value:a,onChange:e=>o(e.target.value),rows:4,className:`font-mono`}),(0,q.jsx)(`div`,{children:(0,q.jsx)(f,{size:`sm`,variant:`secondary`,disabled:a===(e.onboarding_notes??``)||t.isPending,onClick:()=>t.mutate({id:e.id,onboarding_notes:a},{onError:s}),children:`Save notes`})})]}),e.orphan_worktrees.length>0&&(0,q.jsxs)(`div`,{className:`mt-3 rounded-md bg-elevated p-2`,children:[(0,q.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:`Orphan worktrees — directories no session claims. Puddle never deletes these automatically; remove them by hand if unwanted.`}),(0,q.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5`,children:e.orphan_worktrees.map(e=>(0,q.jsx)(`li`,{className:`truncate font-mono text-2xs text-fg-muted`,children:e},e))})]})]})}function Nt(){let e=S();return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Repositories`}),e.data?.length===0&&(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No repositories yet — register one from the new-project flow on the dashboard.`}),e.data?.map(e=>(0,q.jsx)(Mt,{repo:e},e.id))]})}function $({label:e,description:t,field:n,config:r,min:i,step:a=1}){let o=T();return(0,q.jsx)(J,{label:e,description:t,htmlFor:`host-${n}`,children:(0,q.jsx)(N,{id:`host-${n}`,type:`number`,min:i,step:a,className:`w-32 tabular-nums`,defaultValue:r[n],onBlur:e=>{let t=Number(e.target.value);Number.isFinite(t)&&t!==r[n]&&o.mutate({[n]:t},{onError:e=>u.error(e.message)})}})})}function Pt(){let e=M(),t=T();return e.data?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{note:`Affects all profiles on this host`,children:`Host`}),(0,q.jsx)(J,{label:`Display name`,description:`Shown in place of the hostname across the UI. Leave blank for the hostname.`,htmlFor:`host-displayName`,children:(0,q.jsx)(N,{id:`host-displayName`,type:`text`,maxLength:64,className:`w-48`,defaultValue:e.data.displayName,onBlur:n=>{let r=n.target.value.trim();r!==e.data.displayName&&t.mutate({displayName:r},{onError:e=>u.error(e.message)})}})}),(0,q.jsx)($,{label:`Fetch interval (minutes)`,description:`Periodic git fetch for repos with active sessions.`,field:`fetchIntervalMinutes`,config:e.data,min:1}),(0,q.jsx)($,{label:`Log size cap (bytes)`,description:`Per-terminal on-disk log cap.`,field:`logMaxBytes`,config:e.data,min:65536,step:1048576}),(0,q.jsx)($,{label:`Replay size (bytes)`,description:`Log tail sent to a terminal on attach.`,field:`replayBytes`,config:e.data,min:1024,step:65536}),(0,q.jsx)($,{label:`UI-state retention (days)`,description:`Stale workspace snapshots are swept at boot.`,field:`uiStateRetentionDays`,config:e.data,min:1}),(0,q.jsx)(J,{label:`Auto-resume`,description:`Resume interrupted sessions automatically after a daemon restart.`,htmlFor:`host-autoResume`,children:(0,q.jsx)(U,{id:`host-autoResume`,checked:e.data.autoResume,onCheckedChange:e=>t.mutate({autoResume:e},{onError:e=>u.error(e.message)})})})]}):null}var Ft=[{id:`appearance`,label:`Appearance`,icon:be,render:()=>(0,q.jsx)($e,{})},{id:`profile`,label:`Profile`,icon:ve,render:()=>(0,q.jsx)(tt,{})},{id:`accounts`,label:`Accounts`,icon:Qe,render:()=>(0,q.jsx)(it,{})},{id:`sessions`,label:`Sessions`,icon:Ze,render:()=>(0,q.jsx)(dt,{})},{id:`editor`,label:`Editor`,icon:Ge,render:()=>(0,q.jsx)(mt,{})},{id:`hotkeys`,label:`Hotkeys`,icon:qe,render:()=>(0,q.jsx)(gt,{})},{id:`notifications`,label:`Notifications`,icon:We,render:()=>(0,q.jsx)(pt,{})},{id:`repositories`,label:`Repositories`,icon:de,render:()=>(0,q.jsx)(Nt,{})},{id:`host`,label:`Host`,icon:Ye,render:()=>(0,q.jsx)(Pt,{})},{id:`sync`,label:`Sync`,icon:xe,render:()=>(0,q.jsx)(jt,{})}],It={terminal:`sessions`};function Lt(){let e=Se(),t=e===null?null:It[e]??e,n=Ft.find(e=>e.id===t)??Ft[0];return(0,q.jsx)(_,{open:e!==null,onOpenChange:e=>!e&&_e(),children:(0,q.jsxs)(m,{wide:!0,className:`grid h-[34rem] grid-cols-[14rem_1fr] gap-0 overflow-hidden p-0`,children:[(0,q.jsx)(h,{className:`sr-only`,children:`Settings`}),(0,q.jsxs)(`nav`,{className:`flex flex-col gap-1 bg-surface p-2.5 pr-6`,children:[(0,q.jsx)(`span`,{className:`px-2.5 py-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`Settings`}),Ft.map(({id:e,label:t,icon:r})=>(0,q.jsxs)(`button`,{onClick:()=>ye(e),className:I(`flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors`,e===n.id?`bg-elevated text-fg`:`text-fg-secondary hover:bg-elevated hover:text-fg`),children:[(0,q.jsx)(r,{className:`size-4 shrink-0`}),t]},e))]}),(0,q.jsx)(`div`,{className:`overflow-y-auto p-5`,children:n.render()})]})})}export{Lt as SettingsDialog};
|