@puddle-code/cli 0.4.9 → 0.4.10
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 +34 -36
- package/dist/host-control.mjs +13 -6
- package/dist/index.js +17 -9
- package/dist/public/assets/App-DZPlytdY.js +63 -0
- package/dist/public/assets/{CompilationCommandForm-CipGdjjH.js → CompilationCommandForm-B-CEimt-.js} +1 -1
- package/dist/public/assets/Dashboard-D0qSbNc_.js +1 -0
- package/dist/public/assets/EditorTabClose-DoclvCbs.js +1 -0
- package/dist/public/assets/FindWidget-CNxi2b9L.js +1 -0
- package/dist/public/assets/LazyTerminal-BffV6rzu.js +2 -0
- package/dist/public/assets/{NotebookWidget-Bcavj7Lb.js → NotebookWidget-CpzrWj4z.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-DRA4WG0A.js → PaneEditorBody-C5SVOXKv.js} +6 -6
- package/dist/public/assets/{PdfViewer-Cr5306nr.js → PdfViewer-BH-FXEVV.js} +1 -1
- package/dist/public/assets/{ReleaseNotesDialog-CbFYKoYM.js → ReleaseNotesDialog-CN7W2Evg.js} +1 -1
- package/dist/public/assets/SettingsDialog-D5CH5-vH.js +8 -0
- package/dist/public/assets/{Terminal-Bo8hyZj7.js → Terminal-D7rw4Zu8.js} +2 -2
- package/dist/public/assets/{Workspace-Bf0VMnaa.css → Workspace-CuAYZ1-B.css} +1 -1
- package/dist/public/assets/Workspace-Cvhx3oi9.js +20 -0
- package/dist/public/assets/{api-B90WKMKj.js → api-CULxlzTe.js} +1 -1
- package/dist/public/assets/archive-i9DnVa-v.js +1 -0
- package/dist/public/assets/{auth-CdosKReE.js → auth-C3ruG3fE.js} +1 -1
- package/dist/public/assets/button-C-dovHYo.js +1 -0
- package/dist/public/assets/client-settings-Cy225e3b.js +1 -0
- package/dist/public/assets/command-klU_3huY.js +1 -0
- package/dist/public/assets/{context-CG70lLa4.js → context-D1MuDP6X.js} +1 -1
- package/dist/public/assets/dialog-B0poBDCr.js +41 -0
- package/dist/public/assets/dist-C4YjL9GW.js +1 -0
- package/dist/public/assets/{dist-Dge3wHdO.js → dist-DDTfSNTu.js} +1 -1
- package/dist/public/assets/dist-Duc5nm48.js +1 -0
- package/dist/public/assets/{errors-tuvbq1a_.js → errors-efDAjyqa.js} +1 -1
- package/dist/public/assets/expanding-content-Bens1wCS.js +1 -0
- package/dist/public/assets/{forward-link-BspnTVuc.js → forward-link-DWN_hZ7A.js} +1 -1
- package/dist/public/assets/index-CHGSBAX2.css +2 -0
- package/dist/public/assets/{index-Doe7MhnI.js → index-OKzoyhKK.js} +3 -3
- package/dist/public/assets/media-refresh-store-odkzJbkh.js +1 -0
- package/dist/public/assets/motion-CxPWS8Fa.js +1 -0
- package/dist/public/assets/notification-delivery-BHHCcyI1.js +1 -0
- package/dist/public/assets/popover-Cv4S_Eut.js +1 -0
- package/dist/public/assets/{protocol-support-TSI4Ig6W.js → protocol-support-BwRR1kRO.js} +1 -1
- package/dist/public/assets/{scroll-restoration-6GVbekSz.js → scroll-restoration-wdDB8mmu.js} +1 -1
- package/dist/public/assets/select-C0AnT3e9.js +1 -0
- package/dist/public/assets/{selection-actions-CvYaucrm.js → selection-actions-gU_r-7v_.js} +1 -1
- package/dist/public/assets/session-order-rnLHD6HV.js +1 -0
- package/dist/public/assets/switch-DllF_QQT.js +1 -0
- package/dist/public/assets/use-ui-state-2r7YwqCy.js +1 -0
- package/dist/public/assets/{view-state-store-DbQ7YOPe.js → view-state-store-DVvLMbeY.js} +1 -1
- package/dist/public/assets/whole-word-BJjKpISQ.js +1 -0
- package/dist/public/assets/{ws-Cp1eCJaM.js → ws-B_QsPbsD.js} +1 -1
- package/dist/public/index.html +4 -4
- package/dist/pudl.js +13 -6
- package/package.json +1 -1
- package/dist/public/assets/App-UQXXCAJF.js +0 -65
- package/dist/public/assets/Dashboard-6pSi_1fH.js +0 -1
- package/dist/public/assets/EditorTabClose-TixDVxvl.js +0 -1
- package/dist/public/assets/FindWidget-DG1YP6Zx.js +0 -1
- package/dist/public/assets/LazyTerminal-B88WIvyh.js +0 -2
- package/dist/public/assets/NewProjectDialog-C1TVzOvJ.js +0 -1
- package/dist/public/assets/SettingsDialog-BvaE3Ue8.js +0 -8
- package/dist/public/assets/Workspace-Bf2zQC6v.js +0 -20
- package/dist/public/assets/button-C_Rvtcwg.js +0 -1
- package/dist/public/assets/chevron-right-BEy-IXEZ.js +0 -1
- package/dist/public/assets/client-settings-DhfHheKR.js +0 -1
- package/dist/public/assets/command-BV8ZEhQz.js +0 -1
- package/dist/public/assets/context-menu-D3ZhKA9s.js +0 -1
- package/dist/public/assets/dialog-D-Axqpzg.js +0 -41
- package/dist/public/assets/dist-BmSuHjIq.js +0 -1
- package/dist/public/assets/dist-Cq-O0n8n.js +0 -1
- package/dist/public/assets/index-4XrK4Fes.css +0 -2
- package/dist/public/assets/media-refresh-store-CiyvSvEu.js +0 -1
- package/dist/public/assets/motion-OSLfKoC0.js +0 -1
- package/dist/public/assets/notification-delivery-CegOQxcZ.js +0 -1
- package/dist/public/assets/popover-D-jcaKGN.js +0 -1
- package/dist/public/assets/select-p5KTVHbg.js +0 -1
- package/dist/public/assets/session-order-CiDVvIU5.js +0 -1
- package/dist/public/assets/switch-oBD5uCTu.js +0 -1
- package/dist/public/assets/use-ui-state-D4FsRK2R.js +0 -1
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReleaseNotesDialog-CbFYKoYM.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-By8HlURe.js","assets/purify.es-D8QhFVkO.js","assets/dialog-D-Axqpzg.js","assets/react-dom-cJyBB_A4.js","assets/x-Dq6POV20.js","assets/createLucideIcon-C9A1vLE-.js","assets/dialog-BX0tebJL.css","assets/queue-BlrQxHDl.js","assets/markdown-it-CWoG9_Dn.js","assets/markdown-CMSzQtLp.js","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/SettingsDialog-BvaE3Ue8.js","assets/protocol-support-TSI4Ig6W.js","assets/auth-CdosKReE.js","assets/api-B90WKMKj.js","assets/LazyTerminal-B88WIvyh.js","assets/preload-helper-Czpn1I53.js","assets/chevron-right-BEy-IXEZ.js","assets/notification-delivery-CegOQxcZ.js","assets/theme-swfNLod9.js","assets/ws-Cp1eCJaM.js","assets/dist-BOS6OKSE.js","assets/switch-oBD5uCTu.js","assets/dist-Dge3wHdO.js","assets/notification-delivery-BZzMYzIP.css","assets/client-settings-DhfHheKR.js","assets/index-Doe7MhnI.js","assets/index-4XrK4Fes.css","assets/button-C_Rvtcwg.js","assets/select-p5KTVHbg.js","assets/chevron-down-HQLVE6o5.js","assets/dist-Cq-O0n8n.js","assets/code-Cf4ftdOa.js","assets/rotate-ccw-BI2k_h3A.js","assets/control-tray-c9uXOo-i.js","assets/control-tray-CG26TqqQ.css","assets/errors-tuvbq1a_.js","assets/use-debounced-value-C86N-mOK.js","assets/popover-D-jcaKGN.js","assets/CompilationCommandForm-CipGdjjH.js","assets/SettingsDialog-CJX0gDhJ.css","assets/Dashboard-6pSi_1fH.js","assets/session-order-CiDVvIU5.js","assets/context-menu-D3ZhKA9s.js","assets/dist-BmSuHjIq.js","assets/NewProjectDialog-C1TVzOvJ.js","assets/Workspace-Bf2zQC6v.js","assets/forward-link-BspnTVuc.js","assets/media-refresh-store-CiyvSvEu.js","assets/use-ui-state-D4FsRK2R.js","assets/preview-kind-CPkO-rSz.js","assets/debounce-B9DrqirV.js","assets/motion-OSLfKoC0.js","assets/selection-actions-CvYaucrm.js","assets/copy-D0Theg4Q.js","assets/view-state-store-DbQ7YOPe.js","assets/drafts-B_tChlzR.js","assets/buffer-logic-BAkSBQT7.js","assets/scroll-restoration-6GVbekSz.js","assets/Workspace-Bf0VMnaa.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{$ as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,Ft as d,Gt as f,H as p,Ht as m,It as h,J as g,L as _,Lt as v,Mt as y,N as b,Nt as x,O as S,P as C,Pt as ee,Rt as w,S as T,T as E,Tt as te,Ut as D,W as ne,Wt as re,X as ie,Y as ae,at as oe,b as se,ct as ce,et as le,ht as ue,kt as de,lt as fe,nt as pe,o as me,ot as he,st as ge,tt as _e,x as ve,yt as ye,z as be,zt as O}from"./protocol-support-TSI4Ig6W.js";import{$ as xe,F as Se,K as Ce,Q as we,T as Te,Y as Ee,o as k,p as De,r as Oe,z as ke}from"./auth-CdosKReE.js";import{a as A,c as Ae,o as je}from"./LazyTerminal-B88WIvyh.js";import{A as Me,C as Ne,E as Pe,M as Fe,N as Ie,O as Le,T as Re,_ as ze,a as Be,d as Ve,g as He,h as Ue,i as We,l as Ge,m as Ke,o as qe,p as Je,s as Ye,t as Xe,u as Ze,w as Qe}from"./notification-delivery-CegOQxcZ.js";import{i as $e,r as et,t as tt}from"./client-settings-DhfHheKR.js";import{c as nt,n as rt,r as it,s as at,t as j}from"./theme-swfNLod9.js";import{t as ot}from"./jsx-runtime-By8HlURe.js";import{t as M}from"./preload-helper-Czpn1I53.js";import{n as N}from"./api-B90WKMKj.js";import{_ as st,a as ct,b as lt,c as ut,d as P,f as dt,g as ft,h as pt,i as mt,m as ht,s as gt,t as F,u as _t,v as I,y as L}from"./ws-Cp1eCJaM.js";import{t as vt}from"./forward-link-BspnTVuc.js";import{a as yt,c as bt,d as xt,f as St,l as Ct,m as wt,p as Tt,r as Et,s as Dt,u as Ot}from"./session-order-CiDVvIU5.js";import{n as R,t as kt}from"./dist-BOS6OKSE.js";import"./dialog-D-Axqpzg.js";import{i as At,n as z,p as jt,r as Mt}from"./chevron-right-BEy-IXEZ.js";import{n as Nt,r as B}from"./dist-Dge3wHdO.js";import{$ as Pt,G as Ft,J as It,K as Lt,U as Rt,W as zt,X as Bt,Y as Vt,Z as Ht,at as V,d as Ut,et as Wt,f as Gt,h as H,i as Kt,it as U,m as qt,nt as Jt,ot as Yt,p as Xt,q as Zt,r as Qt,rt as $t,st as W,t as en,tt as tn}from"./use-ui-state-D4FsRK2R.js";import{n as G,t as K}from"./createLucideIcon-C9A1vLE-.js";import{n as nn,t as q}from"./button-C_Rvtcwg.js";import{c as rn,d as an,i as on,l as sn,o as cn,t as ln}from"./switch-oBD5uCTu.js";import{t as un}from"./copy-D0Theg4Q.js";import{n as dn,t as fn}from"./NewProjectDialog-C1TVzOvJ.js";import{t as pn}from"./control-tray-c9uXOo-i.js";import{n as J}from"./errors-tuvbq1a_.js";import{a as mn,c as hn,i as gn,n as _n,o as vn,r as yn,s as bn}from"./command-BV8ZEhQz.js";import{n as xn,r as Sn,t as Cn}from"./popover-D-jcaKGN.js";import{n as wn,r as Tn,t as En}from"./queue-BlrQxHDl.js";var Y=e(t(),1),X=ot();function Dn(){let[e,t]=(0,Y.useState)(`Opening forwarded application…`);return(0,Y.useEffect)(()=>{if(!/^\/forward\/([^/]+)\/(\d+)$/.exec(window.location.pathname)){t(`This forwarding link is invalid.`);return}let e=!0;return vt(new URL(window.location.href)).then(t=>{e&&window.location.replace(t)}).catch(()=>{e&&t(`The application is unavailable. Reconnect to Puddle and open this link again.`)}),()=>{e=!1}},[]),(0,X.jsx)(`p`,{className:`p-8 text-sm text-fg-secondary`,children:e})}var On=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new c({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=kn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=kn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=kn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=kn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>v(t,e))}findAll(e={}){return this.getAll().filter(t=>v(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function kn(e){return e.options.scope?.id}var An=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??h(r,t),a=this.get(i);return a||(a=new de({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>w(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>w(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new An,this.#t=e.mutationCache||new On,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=re.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(m(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return x.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=x.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(m(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return y.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(d(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{i(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(d(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{i(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=h(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===D&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Mn=class extends Y.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){this.state.error!==null&&e.resetOn!==this.props.resetOn&&this.setState({error:null})}componentDidCatch(e,t){console.error(`Puddle: the ${this.props.scope} crashed`,e,t.componentStack)}render(){let{error:e}=this.state;return e===null?this.props.children:(0,X.jsxs)(`div`,{className:`flex h-full min-h-40 flex-col items-center justify-center gap-4 px-8 py-10 text-center`,children:[(0,X.jsxs)(`p`,{className:`text-sm text-fg`,children:[`The `,this.props.scope,` stopped rendering.`]}),(0,X.jsx)(`p`,{className:`max-w-lg font-mono text-2xs leading-relaxed text-interrupted`,children:e.message||String(e)}),(0,X.jsx)(`p`,{className:`max-w-sm text-2xs leading-relaxed text-fg-muted`,children:`Your sessions and their worktrees are on the daemon and untouched; the layout is saved. The console has the full stack.`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>this.setState({error:null}),className:`text-2xs font-medium text-fg-gold transition-colors hover:underline`,children:`Try again`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Reload`})]})]})}};function Nn(){return(0,X.jsx)(kt,{theme:(0,Y.useSyncExternalStore)(at,it),position:`bottom-right`,toastOptions:{style:{background:`var(--bg-elevated)`,border:`none`,boxShadow:`var(--ui-overlay-shadow)`,borderRadius:`var(--ui-surface-radius)`,outline:`1px solid var(--border)`,color:`var(--text-primary)`},classNames:{description:`whitespace-pre-wrap break-words font-mono text-2xs leading-snug max-h-40 overflow-y-auto`}}})}function Pn(){return(0,X.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,X.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-24`,children:[(0,X.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm leading-relaxed text-fg-secondary`,children:[(0,X.jsxs)(`p`,{children:[`Authorise this browser by running`,` `,(0,X.jsx)(`span`,{className:`font-mono text-accent`,children:`puddle launch`}),` in a terminal.`]}),(0,X.jsx)(`p`,{children:`Use the link it opens. Your sessions, drafts and layouts stay in place.`})]})]})})}var Fn=e(n(),1),In=`a, button, [role="button"], [role="slider"], input, select, textarea, summary, label, [onclick], .cursor-pointer`,Ln=`.monaco-editor`;function Rn(e,t){return e?.closest(Ln)&&!e.closest(t)?`text`:e?.closest(In)?`interactive`:`default`}function zn(e,t=`.no-custom-caret`){(0,Y.useEffect)(()=>{let n=e.current;if(!n)return;let r=window.matchMedia(`(pointer: fine)`),i=0,a=null,o=null,s=!0,c=!1,l=new MutationObserver(()=>d()),u=()=>{a&&!i&&(i=requestAnimationFrame(p))},d=()=>{s=!0,c=!0,u()},f=()=>{cancelAnimationFrame(i),i=0,a=null,o=null,s=!0,l.disconnect(),n.style.opacity=`0`},p=()=>{if(i=0,!a)return;let{x:e,y:u}=a,d=c?document.elementFromPoint(e,u):a.target;if(a.target=d,c=!1,d instanceof HTMLIFrameElement||!r.matches){f();return}if(n.style.transform=`translate3d(${e}px, ${u}px, 0) translate(-50%, -50%)`,n.style.opacity=`1`,!s&&d===o)return;if(s=!1,o=d,l.disconnect(),d&&d!==n&&!n.contains(d)){l.observe(d,{attributes:!0,childList:!0});for(let e of d.childNodes)e.nodeType===Node.TEXT_NODE&&l.observe(e,{characterData:!0});for(let e=d.parentElement;e;e=e.parentElement)l.observe(e,{attributes:!0,childList:!0})}l.observe(document.head,{attributes:!0,childList:!0,characterData:!0,subtree:!0});let p=d?.closest(Ln),m=Rn(d,t),h=m===`text`,g=m===`interactive`,_=h;if(h&&p){let e=getComputedStyle(p);n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`)}else if(!g&&d&&!d.closest(t)&&Array.from(d.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())){let e=getComputedStyle(d);e.userSelect!==`none`&&(_=!0,n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`))}n.classList.toggle(`is-interactive`,g),n.classList.toggle(`is-text`,_)},m=e=>{if(e.pointerType===`touch`||!r.matches){f();return}a={x:e.clientX,y:e.clientY,target:e.target instanceof Element?e.target:null},c=!1,u()},h=()=>{r.matches?d():f()};return window.addEventListener(`pointermove`,m,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,f),window.addEventListener(`blur`,f),window.addEventListener(`resize`,d),document.addEventListener(`scroll`,d,!0),document.addEventListener(`focusin`,d),document.addEventListener(`focusout`,d),document.addEventListener(`pointerdown`,d),document.addEventListener(`pointerup`,d),r.addEventListener(`change`,h),document.fonts.addEventListener(`loadingdone`,d),()=>{window.removeEventListener(`pointermove`,m),document.documentElement.removeEventListener(`pointerleave`,f),window.removeEventListener(`blur`,f),window.removeEventListener(`resize`,d),document.removeEventListener(`scroll`,d,!0),document.removeEventListener(`focusin`,d),document.removeEventListener(`focusout`,d),document.removeEventListener(`pointerdown`,d),document.removeEventListener(`pointerup`,d),r.removeEventListener(`change`,h),document.fonts.removeEventListener(`loadingdone`,d),f()}},[t,e])}var Bn=[`top`,`right`,`bottom`,`left`];function Vn(){let e=(0,Y.useRef)(null);return zn(e),(0,X.jsx)(`div`,{ref:e,className:`custom-cursor drafting-cursor`,"aria-hidden":`true`,children:Bn.map(e=>(0,X.jsx)(`span`,{className:`drafting-cursor-tick`,"data-side":e},e))})}function Hn(){let e=(0,Y.useRef)(null);return zn(e),(0,X.jsx)(`div`,{ref:e,className:`custom-cursor invert-cursor`,"aria-hidden":`true`})}var Un=`h1, h2, h3, h4, h5, h6, .no-rangefinder-caret`,Z=40.5,Q=4.05,Wn=Q*Math.sqrt(3)/2;function Gn(){let e=[],t=[],n=Z/2,r=Math.ceil(n/Wn)+1,i=e=>Math.round(e*100)/100,a=e=>`M${e.map(([e,t])=>`${i(e)} ${i(t)}`).join(`L`)}Z`;for(let i=-r;i<r;i+=1){let o=n+i*Wn,s=o+Wn,c=(i%2+2)%2*(Q/2);for(let i=-r;i<r;i+=1){let r=n+i*Q+c,l=[[r+Q/2,o],[r,s],[r+Q,s]],u=[[r+Q/2,o],[r+3*Q/2,o],[r+Q,s]],d=e=>{let t=e.map(([e])=>e),n=e.map(([,e])=>e);return Math.max(...t)>0&&Math.min(...t)<Z&&Math.max(...n)>0&&Math.min(...n)<Z};d(l)&&e.push(a(l)),d(u)&&t.push(a(u))}}return{light:e.join(``),dark:t.join(``)}}var Kn=Gn();function qn(){let e=(0,Y.useRef)(null);return zn(e,Un),(0,X.jsx)(`div`,{ref:e,className:`custom-cursor rangefinder-cursor`,"aria-hidden":`true`,children:(0,X.jsxs)(`svg`,{className:`rangefinder-cursor-facets`,viewBox:`0 0 ${Z} ${Z}`,focusable:`false`,children:[(0,X.jsx)(`path`,{className:`rangefinder-cursor-facet-light`,d:Kn.light}),(0,X.jsx)(`path`,{className:`rangefinder-cursor-facet-dark`,d:Kn.dark})]})})}function Jn(){let{cursorPackage:e}=$e(),t=null;switch(e){case`rangefinder`:t=(0,X.jsx)(qn,{});break;case`drafting`:t=(0,X.jsx)(Vn,{});break;case`invert`:t=(0,X.jsx)(Hn,{});break;case`system`:return null}return(0,Fn.createPortal)(t,document.body)}var Yn=K(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Xn=K(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Zn=K(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Qn=K(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),$n=K(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),er=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),tr=K(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function nr(){let e=ge(),t=C(),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(ke),o=()=>{n.trim()&&t.mutate({name:n.trim(),branch_prefix:i.trim()},{onSuccess:e=>st(e.id)})},s=(e.data?.length??0)>0;return(0,X.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,X.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-16`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,X.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Who is working?`})]}),s&&(0,X.jsx)(`div`,{className:`flex flex-col`,children:e.data.map(e=>(0,X.jsxs)(`button`,{onClick:()=>st(e.id),className:`flex items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-elevated active:bg-border/70`,children:[(0,X.jsx)(Le,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,X.jsx)(`span`,{className:G(`text-base`,A(e.icon_colour)||`text-fg`),children:e.name}),e.branch_prefix&&(0,X.jsxs)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:[e.branch_prefix,`…`]})]},e.id))}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-5`,onSubmit:e=>{e.preventDefault(),o()},children:[s&&(0,X.jsx)(`p`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`or create a profile`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ae,{htmlFor:`profile-name`,children:`Name`}),(0,X.jsx)(z,{id:`profile-name`,placeholder:`e.g. alice`,value:n,onChange:e=>r(e.target.value),className:`h-10`,autoFocus:!s})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ae,{htmlFor:`branch-prefix`,children:`Branch prefix`}),(0,X.jsx)(z,{id:`branch-prefix`,placeholder:`no prefix`,value:i,onChange:e=>a(e.target.value),className:`h-10`})]}),t.error&&(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}),(0,X.jsx)(q,{type:`submit`,size:`lg`,className:`self-start px-6`,disabled:!n.trim()||t.isPending,children:`Create profile`})]})]})})}function rr(){let e=g(),{icon:t}=Pe(),n=I(),r=ht()[`host.peek`],[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{let e=()=>{o.current=!1,a(!1)},t=r?.split(`+`)??[],n=t.at(-1),i=r=>{o.current&&(r.key===`Escape`&&(r.preventDefault(),r.stopPropagation()),(r.type===`keyup`&&r.code===n||r.key===`Escape`||t.includes(`meta`)&&!r.metaKey||t.includes(`ctrl`)&&!r.ctrlKey||t.includes(`alt`)&&!r.altKey||t.includes(`shift`)&&!r.shiftKey)&&e())},s=()=>{document.hidden&&e()},c=P(`host.peek`,()=>{o.current||document.hidden||(o.current=!0,a(!0))});return window.addEventListener(`keyup`,i,!0),window.addEventListener(`keydown`,i,!0),window.addEventListener(`blur`,e),window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,s),()=>{c(),window.removeEventListener(`keyup`,i,!0),window.removeEventListener(`keydown`,i,!0),window.removeEventListener(`blur`,e),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,s),e()}},[r,n]),i?(0,Fn.createPortal)((0,X.jsx)(`div`,{"data-host-peek":!0,"data-state":`open`,className:`overlay-backdrop-motion fixed inset-0 z-[200] flex items-center justify-center p-8 text-fg backdrop-blur-[8px]`,onPointerDown:e=>e.preventDefault(),role:`status`,"aria-live":`polite`,children:(0,X.jsxs)(`div`,{className:`island-outline flex max-w-full flex-col items-center gap-8 rounded-[var(--ui-surface-radius)] px-12 py-10 text-center`,children:[(0,X.jsx)(Re,{icon:t,className:`size-[clamp(6rem,18vmin,14rem)] shrink-0`}),(0,X.jsx)(`span`,{className:`max-w-full break-words font-sans text-[clamp(0.8333rem,2.3333vw,2.3333rem)] leading-tight font-medium`,children:T(e.data)??`Host`})]})}),document.body):null}function ir(){let e=be().data?.protocol,t=e!==void 0&&(e.major>25||e.major===25&&e.minor>=5),{data:n}=o({queryKey:[`storage`],queryFn:()=>N(`GET`,`/api/storage`),enabled:t&&!k(),refetchInterval:1e4,retry:!1});if(!t||k()||!n)return null;let r=n.volumes.filter(e=>e.level!==`ok`);if(!n.logs_degraded&&!n.database_degraded&&r.length===0)return null;let i=r.some(e=>e.level===`critical`);return(0,X.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-2 px-3 py-2 text-xs text-warning`,children:[(0,X.jsx)($t,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[n.database_degraded&&(0,X.jsx)(`p`,{children:`Storage is full. Changes cannot be saved. Live session status may be unsaved.`}),n.logs_degraded&&(0,X.jsx)(`p`,{children:`Terminal history is temporarily not being saved. Live terminals remain connected.`}),i&&(0,X.jsx)(`p`,{children:`Storage is critically low. Free space or inodes before starting new sessions or worktrees.`}),r.length>0&&(0,X.jsx)(cn,{summary:`${r.length} storage ${r.length===1?`location needs`:`locations need`} attention`,children:(0,X.jsx)(`div`,{className:`max-h-32 overflow-y-auto pl-4`,children:r.map(e=>(0,X.jsxs)(`p`,{className:`break-all text-fg-secondary`,children:[e.level===`unknown`?`Could not check storage`:`Low storage`,` at`,` `,e.path,e.available_bytes!==null&&` · ${Math.round(e.available_bytes/1024**2).toLocaleString()} MiB available`,e.available_inodes!==null&&` · ${e.available_inodes.toLocaleString()} inodes available`]},e.path))})})]})]})}var ar=new class{transport;reload;pause;phase=`idle`;pending=null;constructor(e=fetch,t=()=>window.location.reload(),n=e=>new Promise(t=>setTimeout(t,e))){this.transport=e,this.reload=t,this.pause=n}refresh(e=12e4){return this.pending||=this.run(e).finally(()=>{this.pending=null}),this.pending}async run(e){this.phase=`requesting`;let t={authorization:`Bearer ${Oe.get()??``}`,"content-type":`application/json`};try{let n=await this.transport(`/cockpit/refresh`,{method:`POST`,headers:t,signal:AbortSignal.timeout(1e4),body:JSON.stringify({refreshId:crypto.randomUUID()})});if(n.status!==202)throw Error(`refresh rejected`);let r=Te.parse(await n.json());this.phase=`waiting`;let i=Date.now()+e;for(;Date.now()<i;){await this.pause(1e3);try{let e=await this.transport(`/cockpit/status`,{headers:t,cache:`no-store`,signal:AbortSignal.timeout(3e3)});if(!e.ok)continue;let n=De.parse(await e.json());if(n.instance===r.instance||n.refreshId!==r.refreshId||n.upstream!==`ready`)continue;return this.phase=`complete`,this.reload(),!0}catch{}}}catch{}return this.phase=`failed`,!1}},or=null;function sr(e){return or=e,()=>{or===e&&(or=null)}}function cr(){or?.()}var lr=new Set;function ur(){return[...lr].flatMap(e=>e())}function dr({onNewSession:e,onNewProject:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(`commands`),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=Tt(),p=wt(),m=I(),h=p.id,g=fe(m??void 0),_=he(m??void 0),v=ye(h),y=Bt();(0,Y.useEffect)(()=>P(`palette.toggle`,()=>r(e=>!e)),[]),(0,Y.useEffect)(()=>Wt(()=>r(!0)),[]),(0,Y.useEffect)(()=>{n||(a(`commands`),s(``),l(null),d(!1))},[n]);let b=(0,Y.useMemo)(()=>{let n=[],r=Et((g.data??[]).filter(e=>!e.archived),_.data?.projectOrder??[]);for(let e of r)n.push({id:`project-${e.id}`,group:`Projects`,label:e.name,icon:dn,keywords:`switch project open`,run:()=>void f(`/project/${e.id}`)});for(let e of v.data??[])e.status!==`archived`&&n.push({id:`session-${e.id}`,group:`Sessions`,label:y(e),icon:yt,keywords:`switch session ${e.branch}`,run:()=>void f(`/project/${e.project_id}/session/${e.id}`)});return h!==void 0&&e&&n.push({id:`new-agent`,group:`Actions`,label:`New agent`,icon:an,keywords:`new agent create start session`,run:()=>e()},{id:`new-terminal`,group:`Actions`,label:`New terminal`,icon:yt,keywords:`new terminal create start shell session`,run:()=>e({kind:`terminal`})}),h!==void 0&&n.push({id:`open-path`,group:`Actions`,label:`Open path`,icon:dn,keywords:`open path file directory folder editor tree browse absolute relative home`,closeOnRun:!1,run:()=>{s(``),l(null),a(`path`)}}),t&&n.push({id:`new-project`,group:`Actions`,label:`New project`,icon:B,keywords:`new project open create repository repo workspace`,run:t}),n.push({id:`theme-dark`,group:`Theme`,label:`Switch theme: dark`,icon:Fe,keywords:`switch theme dark appearance`,run:()=>void j(`dark`)},{id:`theme-light`,group:`Theme`,label:`Switch theme: light`,icon:Me,keywords:`switch theme light appearance`,run:()=>void j(`light`)},{id:`theme-system`,group:`Theme`,label:`Switch theme: system`,icon:Zn,keywords:`switch theme system appearance`,run:()=>void j(`system`)},{id:`open-settings`,group:`Actions`,label:`Settings`,icon:tr,keywords:`open settings preferences options configure`,run:()=>on()},{id:`switch-profile`,group:`Actions`,label:`Switch profile`,icon:rn,keywords:`switch profile identity user change`,run:()=>ft.set(null)},{id:`refresh-connection`,group:`Actions`,label:`Refresh connection`,icon:sn,keywords:`refresh connection reconnect restart cockpit tunnel ssh daemon`,run:()=>cr()}),[...n,...ur()]},[g.data,_.data?.projectOrder,v.data,h,f,e,t,y]),x=(0,Y.useMemo)(()=>{let e=new Map;for(let t of b){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]},[b]),S=async()=>{let e=o.trim();if(!(e===``||u)){d(!0),l(null);try{await Ht(e),r(!1)}catch(e){l(e instanceof Error?e.message:`Could not open that path.`)}finally{d(!1)}}};return(0,X.jsxs)(_n,{open:n,onOpenChange:r,children:[(0,X.jsx)(mn,{value:o,onValueChange:e=>{s(e),l(null)},placeholder:i===`path`?`Enter a path…`:`Type a command or search…`,onKeyDown:e=>{i===`path`&&(e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),S()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a(`commands`),s(``),l(null)))}}),i===`path`?(0,X.jsx)(bn,{children:(0,X.jsxs)(`div`,{className:`px-3 py-3 text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{children:`Relative paths start from the bound worktree or project. Absolute and ~ paths work too.`}),(0,X.jsx)(`p`,{className:c?`mt-2 text-danger`:`mt-2`,"aria-live":`polite`,children:c??(u?`Opening…`:`Press Enter to open.`)})]})}):(0,X.jsxs)(bn,{children:[(0,X.jsx)(yn,{children:`Nothing matches.`}),x.map(([e,t])=>(0,X.jsx)(gn,{heading:e,children:t.map(e=>{let t=e.icon;return(0,X.jsxs)(vn,{value:`${e.label} ${e.keywords??``}`,onSelect:()=>{e.closeOnRun!==!1&&r(!1),e.run()},children:[t&&(0,X.jsx)(t,{}),e.label,e.shortcut&&(0,X.jsx)(hn,{children:e.shortcut})]},e.id)})},e))]})]})}function fr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.xterm`)!==null}function pr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.monaco-editor`)!==null}function mr(){let e=he(I()??void 0).data?.hotkeys;return(0,Y.useEffect)(()=>{dt(e&&typeof e==`object`?e:void 0)},[e]),(0,Y.useEffect)(()=>P(`window.close`,()=>{let e=L();e?.closeWindow?e.closeWindow():window.close()}),[]),(0,Y.useEffect)(()=>{let e=e=>{if(e.target instanceof Element&&e.target.closest(`[data-hotkey-recording]`))return;let t=ct(e);if(!t)return;let n=mt(t);if(!n)return;let r=gt(n);if(!r||!_t(r,pr()))return;let i=ut(n);i&&(e.preventDefault(),e.stopPropagation(),(!r.hold||!e.repeat)&&i())},t=e=>{let t=ct(e);if(!t)return;let n=mt(t);if(!n)return;let r=gt(n);if(!r||r.editor&&pr()||r.deferInTerminal&&fr())return;let i=ut(n);i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`keydown`,t)}},[]),null}var hr=4e3;function gr(){let[e,t]=(0,Y.useState)(`hidden`),n=(0,Y.useRef)(e);n.current=e,(0,Y.useEffect)(()=>{let e=null,r=F.onConnectionChange(r=>{if(r){e!==null&&clearTimeout(e),e=null,n.current===`lost`&&t(`hidden`);return}e!==null||n.current!==`hidden`||(e=setTimeout(()=>{e=null,n.current===`hidden`&&t(`lost`)},hr))});return()=>{r(),e!==null&&clearTimeout(e)}},[]);let r=(0,Y.useCallback)(async()=>{n.current!==`refreshing`&&(t(`refreshing`),await ar.refresh()||(R.error(`The cockpit has not come back — it may need a terminal (ssh re-auth): puddle refresh`),t(F.isConnected()?`hidden`:`lost`)))},[]);return(0,Y.useEffect)(()=>sr(()=>void r()),[r]),e===`hidden`?null:(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 bg-elevated px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:e===`refreshing`?`Restarting the cockpit.`:`Connection to the daemon lost.`}),e===`lost`&&(0,X.jsxs)(q,{size:`sm`,className:`ml-auto`,onClick:()=>void r(),children:[(0,X.jsx)(sn,{}),`Refresh connection`]})]})}function _r({label:e,percentage:t,hint:n}){let r=Math.max(0,Math.min(100,t));return(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 truncate text-2xs text-fg-muted`,title:e,children:e}),(0,X.jsx)(`span`,{className:`relative h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border`,children:(0,X.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full ${r>=90?`bg-danger`:r>=75?`bg-warning`:`bg-action`}`,style:{width:`${r}%`}})}),(0,X.jsxs)(`span`,{className:`shrink-0 text-2xs tabular-nums text-fg-muted`,children:[Math.round(r),`%`,n?` · ${n}`:``]})]})}function vr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function yr(e){if(e===null)return`never`;let t=new Date(e).getTime(),n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function br({account:e,onLogin:t,onStartSession:n,installed:r=!0}){let i=E(e.id),a=e.logged_in?n:r?t:null,o=i.data?.subscription;return(0,X.jsxs)(`div`,{className:`rounded-md px-2 py-2 transition-colors hover:bg-elevated`,children:[(0,X.jsxs)(`button`,{type:`button`,disabled:a===null,onClick:()=>a?.(),className:`flex w-full items-center gap-3 text-left disabled:cursor-default`,children:[(0,X.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${e.logged_in?`bg-success`:`bg-idle`}`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.label}),(0,X.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[e.logged_in?`logged in`:`logged out`,i.data&&(0,X.jsxs)(X.Fragment,{children:[` · `,i.data.session_count,` session`,i.data.session_count===1?``:`s`,i.data.active_session_count>0&&` (${i.data.active_session_count} active)`,` · `,`last `,yr(i.data.last_activity_at)]})]}),i.data?.agent_usage&&(0,X.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[vr(i.data.agent_usage.input_tokens),` in ·`,` `,vr(i.data.agent_usage.output_tokens),` out ·`,` `,vr(i.data.agent_usage.cache_read_input_tokens),` cached ·`,` `,i.data.agent_usage.message_count,` msgs`]}),i.data?.live_usage?.context_used_percentage!=null&&(0,X.jsx)(`span`,{className:`mt-1 block`,children:(0,X.jsx)(_r,{label:`context`,percentage:i.data.live_usage.context_used_percentage})})]}),(0,X.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted`,children:r?e.logged_in?n?`new agent`:``:(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-warning`,children:[(0,X.jsx)(Ie,{className:`size-3`}),`sign in`]}):`unavailable`})]}),o!=null&&o.windows.length>0&&(0,X.jsx)(`div`,{className:`mt-2 flex flex-col gap-1 pl-5`,children:o.windows.map(e=>(0,X.jsx)(_r,{label:e.label,percentage:e.used_percentage,hint:e.resets==null?void 0:`resets ${e.resets}`},e.key))})]})}function xr(){let[e,t]=(0,Y.useState)(!1),[n,r]=(0,Y.useState)(!1),i=I(),a=ge(),o=_e(),c=a.data?.find(e=>e.id===i),u=l(i??void 0),d=s(),f=ie(),{open:p,handler:m}=Vt(),[h,g]=(0,Y.useState)(null),_=e=>f.mutate(e.id,{onSuccess:t=>g({stream:t.stream,label:`${e.agent_type}/${e.label}`}),onError:e=>J(e)}),v=e=>{t(!1),p({accountId:e.id})},y=e=>{r(!1);let t=e.trim();!i||!t||t===c?.name||o.mutate({id:i,name:t},{onError:e=>J(e)})},b=`profile-trigger font-sans compact:h-7 compact:px-1.5`;return n&&c?(0,X.jsxs)(`div`,{className:nn({variant:`ghost`,size:`sm`,className:b}),children:[(0,X.jsx)(Le,{icon:c.icon,colour:c.icon_colour}),(0,X.jsx)(tn,{initial:c.name,maxLength:100,fitContent:!0,className:A(c.icon_colour),onCommit:y,onCancel:()=>r(!1)})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Cn,{open:e,onOpenChange:t,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(Sn,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,className:b,children:[(0,X.jsx)(Le,{icon:c?.icon,colour:c?.icon_colour}),(0,X.jsx)(`span`,{className:A(c?.icon_colour),...Jt(()=>{t(!1),r(!0)}),children:c?.name??`…`})]})})}),(0,X.jsx)(V,{children:`Profile`})]}),(0,X.jsxs)(xn,{className:`w-[28rem] max-w-[calc(100vw-1rem)]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(d.data??[]).map(e=>{let t=u.data?.filter(t=>t.agent_type===e.id)??[];if(t.length===0)return null;let n=e.available!==!1;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`span`,{className:`px-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:[e.display_name,!n&&(0,X.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`not installed — no `,e.binary??e.id,` on PATH`]})]}),t.map(e=>(0,X.jsx)(br,{account:e,onLogin:()=>_(e),onStartSession:m&&n?()=>v(e):null,installed:n},e.id))]},e.id)}),u.data?.length===0&&(0,X.jsx)(`p`,{className:`px-2 text-sm text-fg-muted`,children:`No accounts yet — add one in settings.`})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),on(`accounts`)},children:[(0,X.jsx)(B,{}),`Add account`]}),(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,className:`ml-auto`,onClick:()=>{t(!1),ft.set(null)},children:[(0,X.jsx)(er,{}),`Switch profile`]})]})]})]}),h&&(0,X.jsx)(Ne,{stream:h.stream,label:h.label,onClose:()=>g(null)})]})}var Sr=`desktop-update`;function Cr(){let e=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let t=L();if(t?.updateReady===void 0||t.onUpdateReady===void 0)return;let n=t=>{e.current!==t&&(e.current=t,R(`Puddle ${t} is downloaded and ready.`,{id:Sr,duration:1/0,closeButton:!0,action:{label:`Restart to update`,onClick:()=>{L()?.installUpdate?.(),R.loading(`Restarting into Puddle ${t}…`,{id:`${Sr}-restarting`,duration:1/0})}}}))};return t.updateReady().then(e=>{e!==null&&n(e)}),t.onUpdateReady(n)},[]),null}var wr=new He;function Tr({onReview:e}={}){let t=Ke(),n=Ve(),r=T(g().data),i=Ue();return Je(),(0,Y.useEffect)(()=>{if(!(!n||!r||t.isError))for(let n of wr.take(i,ze(t.data))){let t=n.component===`daemon`?`Daemon`:`Runtime software`,a=`host-update-${i}-${n.component}-${n.version}`;R(`${r}: ${t} ${n.version} is available.`,{id:a,duration:1/0,closeButton:!0,action:{label:`Review update`,onClick:e??(()=>on(`host`))}})}},[t.data,t.isError,r,n,i,e]),null}function Er({hostKey:e,enabled:t=!0}){let n=o({queryKey:[`host`],queryFn:async({signal:e})=>Ce.parse(await N(`GET`,`/api/host`,void 0,e)),staleTime:1/0,enabled:t&&!e,retry:!1}),r=e??(n.data?En(n.data):void 0),i=k(),a=i?.generation,s=o({queryKey:[`release-notes`,r],queryFn:async({signal:e})=>{let t=Ee.parse(await N(`GET`,`/api/release-notes`,void 0,e));if(k()!==i||i?.generation!==a)throw Error(`Release notes connection changed`);return t},enabled:t&&!!r,staleTime:1/0,retry:!1});return(0,Y.useEffect)(()=>{t&&r&&s.data&&!s.isError&&Tn(r,s.data)},[t,r,s.data,s.isError]),null}var Dr=(0,Y.lazy)(()=>M(()=>import(`./ReleaseNotesDialog-CbFYKoYM.js`).then(e=>({default:e.ReleaseNotesDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function Or({remote:e=!1}){let t=(0,Y.useSyncExternalStore)(wn.subscribe,wn.snapshot)[0];return(0,Y.useEffect)(()=>{let t=e?[`cockpit`,`remote`]:[`cockpit`];wn.enqueue(`browser`,t.map(e=>({component:e,version:`0.4.9`,markdown:`## [0.4.9] — 2026-11-05
|
|
3
|
-
|
|
4
|
-
### Cockpit
|
|
5
|
-
|
|
6
|
-
#### Added
|
|
7
|
-
|
|
8
|
-
- Hold ⌘⌥/ (Ctrl+Alt+/ on Windows/Linux) to blur the workspace and glance at the host icon and name; release to return immediately.
|
|
9
|
-
- Customise each host’s icon and accent per profile, independently of Settings Sync; choose from 63 host-specific icons and the shared colour palette, with a coherent accent palette across text, controls, surfaces, borders and selections.
|
|
10
|
-
|
|
11
|
-
#### Changed
|
|
12
|
-
|
|
13
|
-
- Coalesce custom cursor movement per frame and reuse hover-role/style checks while preserving theme, font and target changes.
|
|
14
|
-
- Reduce memory held by long-inactive terminals while preserving their local transcripts, scroll position and offline copy; keep recent switches and unsupported terminal states warm.
|
|
15
|
-
- Share session lifecycle eligibility across mobile and desktop; explain unavailable resumes on mobile while keeping live sessions stoppable.
|
|
16
|
-
- Support selective component releases and manifest-pinned bootstrap; notify only for newly published host components, and reject explicitly requested skipped versions.
|
|
17
|
-
- Skip unchanged terminal rich-output projections, resolve tab sessions once, and share delayed blob-download cleanup for worktree downloads.
|
|
18
|
-
- Bound memory retained while streaming local or SSH logs, preserving complete output delivery and normal command capture.
|
|
19
|
-
|
|
20
|
-
#### Fixed
|
|
21
|
-
|
|
22
|
-
- Keep the original and new terminal tabs open after native \`/fork\`, \`/new\` and \`/clear\`; resume the saved original in its own runtime without replaying a prompt.
|
|
23
|
-
- Give active sessions a deeper background than hover in both expanded and collapsed right sidebars.
|
|
24
|
-
|
|
25
|
-
- Describe supported coordinated data purge, its protocol requirement, runtime-stop consent and reboot continuation in CLI help and removal guidance.
|
|
26
|
-
- Keep explorer gestures, confirmations and late file-create replies scoped to their directory; recheck read-only state before committing edits or deletions.
|
|
27
|
-
- Avoid refreshing explorer header controls for selection and drag-state changes.
|
|
28
|
-
- Preserve draft text and original layout ownership when file renames, draft saves or archive replies finish after switching projects; discard stale path and draft-open completions.
|
|
29
|
-
|
|
30
|
-
- Handle cancelled word highlighting and diff replies for disposed editor models during workspace transitions.
|
|
31
|
-
|
|
32
|
-
- Fit collapsed project abbreviations to the rail at the largest readable size, without ellipses.
|
|
33
|
-
- Avoid full-screen terminal redraws for cursor-only synchronised updates while preserving buffered output and the terminal's refresh timeout.
|
|
34
|
-
- Improve compact project-rail label sizing and vertical spacing; align selection and hover fills during dialogue scaling, and dismiss tab actions after pointer exit without losing keyboard access.
|
|
35
|
-
- Keep PDF zoom controls over the visible document instead of below its viewport; allow overlay trays to override their default positioning.
|
|
36
|
-
|
|
37
|
-
### Daemon
|
|
38
|
-
|
|
39
|
-
#### Changed
|
|
40
|
-
|
|
41
|
-
- Share eager compilation dependency watches and bounded asynchronous stats across targets; verify missed events less often with healthy watches and retire unobserved targets sooner.
|
|
42
|
-
|
|
43
|
-
- Protocol 26.3: acknowledge unchanged notebook execution revisions without resending outputs; back off idle and unfocused observation while preserving cross-window discovery and full reconnect snapshots.
|
|
44
|
-
- Stream uploads through bounded private staging with actual-byte limits, enumerate file trees asynchronously, and stop bounded directory downloads on cancellation.
|
|
45
|
-
- Bound Claude reference discovery to transcript prefixes and stream asynchronous usage reads, preserving totals across file replacement, truncation and partial writes.
|
|
46
|
-
- Share pending terminal snapshots at the same input boundary, preserving per-reader memory admission, fresh replay and durable checkpoint behaviour.
|
|
47
|
-
- Batch native conversation ingestion, avoid rewriting unchanged metadata, and read Codex file timestamps asynchronously while retaining complete discovery and missing-file confirmation.
|
|
48
|
-
- Resolve daemon and runtime updates independently from a release manifest, preserving existing pins and legacy catalogue readers.
|
|
49
|
-
- Publish changed notebook cells without repeatedly serialising every completed cell; preserve shared display updates, output clearing and cancellation.
|
|
50
|
-
|
|
51
|
-
#### Fixed
|
|
52
|
-
|
|
53
|
-
- Avoid native Codex database lock waits blocking other agents, and connect new runtimes directly instead of waiting for unrelated unavailable owners.
|
|
54
|
-
- Share bounded CLI version observations across capability checks and refresh them after CLI upgrades.
|
|
55
|
-
- Ignore delayed end hooks from previous conversations and Claude subagent status hooks; bound hook input while preserving Gemini's JSON response contract.
|
|
56
|
-
- Keep OpenCode metadata updates and late replies from switching or completing another conversation; report OpenCode 2's unsupported V1 synchronisation bridge as fallback.
|
|
57
|
-
- Avoid writing conversation presence twice during one catalogue scan, preserving newer lifecycle observations and two-scan deletion confirmation.
|
|
58
|
-
- Avoid scanning the owning Git repository twice during repository discovery.
|
|
59
|
-
|
|
60
|
-
### Runtime
|
|
61
|
-
|
|
62
|
-
#### Fixed
|
|
63
|
-
|
|
64
|
-
- Release idle Codex 0.166+ thread ownership promptly after native conversation switches so the original can run independently of its fork.
|
|
65
|
-
`})))},[e]),t?(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(Dr,{current:t})}):null}function kr(){let e=I(),t=ge().data?.find(t=>t.id===e),n=he(e??void 0),r=ue(e??void 0,void 0),i=$e(),a=qe(),o=Ye(),s=pe(e??``),c=_e(),l=_(),[u,d]=(0,Y.useReducer)(e=>e+1,0);(0,Y.useEffect)(()=>at(()=>d()),[]);let f=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{f.current=null},[t?.name]);let p=a.data?.available===!0?a.data.file:void 0,m=t!==void 0&&e!==null&&n.data!==void 0&&r.data!==void 0&&p!==void 0,h=t&&p?Be(p,t.name):void 0,g=s.isPending||c.isPending||l.isPending||o.isPending||n.isFetching||r.isFetching;(0,Y.useEffect)(()=>{if(!m||!h?.enabled||g)return;let a={client:i,theme:nt(),profileSettings:n.data,profile:t,scratchpad:r.data},u={setClient:e=>et(e),setTheme:e=>{typeof e==`string`&&j(e)},patchProfileSettings:e=>s.mutate(e),patchProfileColumns:t=>c.mutate({id:e,...t}),createScratchpad:t=>{for(let n of t)l.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},d=JSON.stringify(h.doc);if(f.current!==d){f.current=d,Ge(h.doc,u,a,h.groups);return}let p=Ze(h.groups,a),_=JSON.stringify(p);_!==d&&(f.current=_,o.mutate({profile:t.name,entry:{...h,doc:p,updatedAt:new Date().toISOString()}}))})}function Ar(e){let t=t=>{let n=xe.safeParse(t);n.success&&e(n.data)},n=L()?.onNotificationClick?.((e,n)=>t(n)),r=e=>{e.data?.t===`notification-click`&&t(e.data.target)};return navigator.serviceWorker?.addEventListener(`message`,r),()=>{n?.(),navigator.serviceWorker?.removeEventListener(`message`,r)}}var jr=5e3,Mr=`[data-notification-session]`;function Nr(e){let t=null,n=()=>{t=null},r=e=>e.target instanceof Element?e.target.closest(Mr):null,i=e=>{if(!e.isTrusted)return;let n=r(e),i=n?.dataset.notificationSession;t=n&&i?{element:n,session:i,at:performance.now()}:null},a=e=>{r(e)!==t?.element&&n()},o=[`pointerdown`,`keydown`,`input`,`paste`];for(let t of o)e.addEventListener(t,i,!0);return e.addEventListener(`focusin`,a,!0),e.addEventListener(`visibilitychange`,n),e.defaultView?.addEventListener(`blur`,n),{isInteracting(n){return t!==null&&t.session===n&&performance.now()-t.at<jr&&e.visibilityState===`visible`&&e.hasFocus()&&t.element.isConnected&&t.element.dataset.notificationSession===n&&t.element.getClientRects().length>0},dispose(){n();for(let t of o)e.removeEventListener(t,i,!0);e.removeEventListener(`focusin`,a,!0),e.removeEventListener(`visibilitychange`,n),e.defaultView?.removeEventListener(`blur`,n)}}}var Pr=new Set,Fr=e=>!!e&&Pr.has(e),Ir=we.parse({});function Lr(e){return e.prefs.muted_projects.includes(e.projectId)?{desktop:!1,sound:!1}:{desktop:e.prefs.desktop&&(e.permission===`granted`||e.permission===`unverified`)&&(e.prefs.when_focused||!e.sessionFocused),sound:e.prefs.sound}}function Rr(e,t){for(let[,n]of e.getQueriesData({queryKey:[`sessions`]})){let e=n?.find(e=>e.id===t);if(e)return e}for(let[,n]of e.getQueriesData({queryKey:[`project`]})){let e=n?.sessions.find(e=>e.id===t);if(e)return e}}function zr(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}function Br(){try{let e=new AudioContext,t=e.createGain();t.gain.value=.04,t.connect(e.destination);for(let[n,r]of[[880,0],[1318.5,.09]]){let i=e.createOscillator();i.type=`sine`,i.frequency.value=n,i.connect(t),i.start(e.currentTime+r),i.stop(e.currentTime+r+.12)}setTimeout(()=>void e.close(),400)}catch{}}function Vr(){let e=Tt(),t=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=Nr(document);return t.current=e,()=>{t.current=null,e.dispose()}},[]),(0,Y.useEffect)(()=>Ar(t=>{t.host||e(`/project/${t.project}/session/${t.session}`,{state:{notificationSession:t.session}})}),[e]),Hr(t=>{e(`/project/${t.project_id}/session/${t.id}`,{state:{notificationSession:t.id}})},e=>t.current?.isInteracting(e.id)??!1)}function Hr(e,t=()=>document.hasFocus()){let n=u(),r=(0,Y.useRef)(e);r.current=e;let i=(0,Y.useRef)(t);i.current=t;let a=T(g().data)??`Puddle`,o=(0,Y.useRef)(a);(0,Y.useEffect)(()=>{document.title===o.current&&(document.title=a),o.current=a},[a]),(0,Y.useEffect)(()=>{let e=new Set,t=()=>{document.title=e.size>0?`(${e.size}) ${o.current}`:o.current},a=!0,s=async e=>{let t=Rr(n,e.session);if(!t)try{t=(await se(n)).find(t=>t.id===e.session)}catch{return}if(!a||!t)return;let s=t,c,l;try{let e=await n.fetchQuery({queryKey:[`project`,s.project_id],queryFn:()=>N(`GET`,`/api/projects/${s.project_id}`),staleTime:1e4});if(!a)return;l=e.project;let t=l.profile_id,r=await n.fetchQuery({queryKey:[`profile-settings`,t],queryFn:()=>N(`GET`,`/api/profiles/${t}/settings`),staleTime:1e4});c=we.catch(Ir).parse(r.notifications??{})}catch{return}if(!a)return;let u=Lr({prefs:c,projectId:s.project_id,sessionFocused:i.current(s),permission:We()});u.sound&&Br(),u.desktop&&!Fr(k()?.scope)&&await Xe({id:e.id?`puddle-event-${e.id}`:`puddle-agent-${s.id}`,title:e.content?.title??zr(s).slice(0,160),body:e.content?.body??(e.reason===`exited`?`Agent finished running`:`Waiting for your input`),target:{project:s.project_id,session:s.id,...k()?.notificationHost?{host:k().notificationHost}:{}}},()=>{a&&r.current(s)},{host:o.current,project:l})},c=F.onAgentNotification(e=>{s(e)}),l=F.onStatus(r=>{let i=e.has(r.session);r.status===`waiting_input`?e.add(r.session):e.delete(r.session),t(),!(r.status!==`waiting_input`||i)&&n.fetchQuery({queryKey:[`version`],queryFn:()=>N(`GET`,`/api/version`),staleTime:1/0}).then(e=>{if(!(e.protocol.major>22||e.protocol.major===22&&e.protocol.minor>=3))return s({session:r.session,reason:`waiting_input`})}).catch(()=>{})});return()=>{a=!1,l(),c(),document.title=o.current}},[n])}function Ur({initial:e,defaultScope:t,allowProject:n=!0,agents:r,onSave:i,onCancel:a}){let[o,s]=(0,Y.useState)(e?.title??``),[c,l]=(0,Y.useState)(e?.body??``),[u,d]=(0,Y.useState)(n?e?.scope??t:`profile`),[f,p]=(0,Y.useState)((e?.tags??[]).join(`, `)),[m,h]=(0,Y.useState)(e?.agent_type??null),g=()=>{let e=c.trim();e&&i({title:o.trim()||null,body:e,scope:u,tags:f.split(`,`).map(e=>e.trim()).filter(Boolean),agent_type:m})};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(z,{value:o,placeholder:`Title (optional)`,spellCheck:!1,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-9 text-sm font-medium`}),(0,X.jsx)(Mt,{autoFocus:!0,value:c,placeholder:`Prompt or note…`,spellCheck:!1,rows:10,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`?a():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&g()},className:`resize-y text-sm leading-relaxed`}),(0,X.jsx)(z,{value:f,placeholder:`tags, comma, separated`,spellCheck:!1,onChange:e=>p(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-8 text-xs`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,X.jsxs)(`label`,{className:`flex items-center gap-1.5 text-2xs text-fg-secondary`,children:[(0,X.jsx)(ln,{checked:u===`profile`,onCheckedChange:e=>d(e?`profile`:`project`)}),`Profile-wide`]}),(0,X.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:r.map(e=>(0,X.jsxs)(`button`,{type:`button`,title:e.display_name,"aria-pressed":m===e.id,onClick:()=>h(t=>t===e.id?null:e.id),className:G(`rounded-md p-1 transition-colors`,m===e.id?`bg-surface text-fg`:`text-fg-gold hover:bg-surface hover:text-fg`),children:[(0,X.jsx)(Zt,{type:e.id,className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.display_name})]},e.id))})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,X.jsx)(q,{size:`sm`,disabled:!c.trim(),onClick:g,children:`Save`})]})]})}function Wr(){let e=Lt(),t=I(),n=wt().id,r=ue(t??void 0,n).data??[],i=s().data??[],a=_(),o=oe(),c=ne(),l=Ft(),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);(0,Y.useEffect)(()=>P(`scratchpad.toggle`,zt),[]),(0,Y.useEffect)(()=>{e||(d(null),p(null),h(null))},[e]);let x=(0,Y.useMemo)(()=>[...new Set(r.flatMap(e=>e.tags))].sort((e,t)=>e.localeCompare(t)),[r]),S=(0,Y.useMemo)(()=>[...new Set(r.map(e=>e.agent_type).filter(e=>e!==null))],[r]),C=f!==null||m!==null,ee=r.filter(e=>(f===null||e.tags.includes(f))&&(m===null||e.agent_type===m)),w=C?ee:y??r,T=e=>{t&&(a.mutate({profile_id:t,scope:e.scope,project_id:e.scope===`project`?n:void 0,title:e.title??void 0,body:e.body,tags:e.tags,agent_type:e.agent_type??void 0}),d(null))},E=(e,t)=>{o.mutate({id:e,scope:t.scope,project_id:t.scope===`project`?n??null:null,title:t.title,body:t.body,tags:t.tags,agent_type:t.agent_type}),d(null)},te=(e,t)=>{let n=y??r,i=n.findIndex(t=>t.id===e),a=n.findIndex(e=>e.id===t);if(i===-1||a===-1||i===a)return;let o=n.slice(),[s]=o.splice(i,1);o.splice(a,0,s),b(o)},D=()=>{let e=g,t=y;if(v(null),b(null),e===null||!t)return;let n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t[n-1],i=t[n+1],a=r?i?(r.position+i.position)/2:r.position+1:(i?i.position:0)-1;o.mutate({id:e,position:a})},re=e=>{navigator.clipboard?.writeText(e.body),R.success(`Copied to clipboard`)};return(0,X.jsxs)(Cn,{open:e,onOpenChange:Rt,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(Sn,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,X.jsx)(Qn,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Scratchpad`})]})})}),(0,X.jsx)(V,{children:`Scratchpad`})]}),(0,X.jsxs)(xn,{className:`w-[34rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Scratchpad`}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>d(u===`new`?null:`new`),className:G(At,`ml-auto`),children:[(0,X.jsx)(B,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`New entry`})]})]}),(x.length>0||S.length>0)&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:[x.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>p(t=>t===e?null:e),className:G(`rounded-full px-2 py-0.5 text-2xs transition-colors`,f===e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:e},e)),S.map(e=>(0,X.jsx)(`button`,{type:`button`,"aria-pressed":m===e,onClick:()=>h(t=>t===e?null:e),className:G(`rounded-md p-1 transition-colors`,m===e?`bg-action text-action-ink`:`text-fg-gold hover:bg-surface`),children:(0,X.jsx)(Zt,{type:e,className:`size-3.5`})},e))]}),(0,X.jsxs)(`div`,{className:`no-scrollbar max-h-[65vh] overflow-y-auto px-2 pb-3`,children:[u===`new`&&(0,X.jsx)(`div`,{className:`px-3 py-2`,children:(0,X.jsx)(Ur,{defaultScope:n?`project`:`profile`,allowProject:n!==void 0,agents:i,onSave:T,onCancel:()=>d(null)})}),w.length===0&&u!==`new`&&(0,X.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:C?`Nothing matches this filter.`:`No entries yet — press + to add a reusable prompt or note.`}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:w.map(e=>u===e.id?(0,X.jsx)(`li`,{className:`px-3 py-2`,children:(0,X.jsx)(Ur,{initial:e,defaultScope:e.scope,allowProject:n!==void 0||e.scope===`project`,agents:i,onSave:t=>E(e.id,t),onCancel:()=>d(null)})},e.id):(0,X.jsx)(`li`,{draggable:!C&&u===null,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,v(e.id)},onDragOver:t=>{g!==null&&(t.preventDefault(),g!==e.id&&te(g,e.id))},onDragEnd:D,className:G(`transition-opacity`,g===e.id&&`opacity-50`),children:(0,X.jsx)(Gr,{entry:e,onInsert:l?()=>{l(e.body),Rt(!1)}:null,onCopy:()=>re(e),onEdit:()=>d(e.id),onDelete:()=>c.mutate(e.id)})},e.id))})]})]})]})}function Gr({entry:e,onInsert:t,onCopy:n,onEdit:r,onDelete:i}){let[a,o]=(0,Y.useState)(!1);return(0,X.jsxs)(`div`,{onClick:e=>{e.target.closest(`button`)||r()},className:`cursor-pointer rounded-md px-3 py-2.5 transition-colors hover:bg-surface`,children:[e.title&&(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,X.jsx)(`p`,{className:G(`line-clamp-3 whitespace-pre-wrap text-sm text-fg-secondary`,e.title&&`mt-0.5`),children:e.body}),a?(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:`Delete this entry? This can’t be undone.`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),i()},className:G(jt,`text-danger`),children:`Delete`}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:jt,children:`Cancel`})]}):(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:e.scope===`profile`?`Profile-wide`:`Project`}),e.agent_type&&(0,X.jsx)(Zt,{type:e.agent_type,className:`size-3 text-fg-gold`}),e.tags.map(e=>(0,X.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-2xs text-fg-secondary`,children:e},e)),(0,X.jsxs)(pn,{label:`Scratchpad entry actions`,className:`ml-auto`,children:[t&&(0,X.jsx)(Kr,{icon:Yn,label:`Insert into focused terminal`,onClick:t}),(0,X.jsx)(Kr,{icon:un,label:`Copy`,onClick:n}),(0,X.jsx)(Kr,{icon:je,label:`Edit`,onClick:r}),(0,X.jsx)(Kr,{icon:Nt,label:`Delete`,onClick:()=>o(!0)})]})]})]})}function Kr({icon:e,label:t,onClick:n}){return(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:At,children:[(0,X.jsx)(e,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,X.jsx)(V,{children:t})]})}var qr=Se.parse({});function Jr(e,t){let[n,r]=(0,Y.useState)(null),i=S(t).data,o=fe(e??void 0,t&&e!==null).data;return(0,Y.useEffect)(()=>{if(!t||e===null){r(null);return}let n=!1,i;try{i=en(sessionStorage.getItem(Qt(e)))}catch{i={kind:`absent`}}if(i.kind===`present`){r(i.snapshot);return}return ve(e).then(e=>{n||r(e?e.ui_state:qr)}).catch(()=>{n||r(qr)}),()=>{n=!0}},[t,e]),(0,Y.useMemo)(()=>{if(!t||e===null||n===null)return null;let s=t=>{if(!i||!o)return!1;let{patch:s,projectBased:c}=Kt(n,t,{alive:new Set(i.filter(e=>e.status!==`archived`).map(e=>e.id)),sessionProject:new Map(i.map(e=>[e.id,e.project_id])),projectIds:o.map(e=>e.id),currentProject:null}),l={...n,...s};r(l),a(e,l).catch(e=>console.warn(`ui-state save failed: ${e.message}`));try{sessionStorage.setItem(Qt(e),JSON.stringify(l))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}return tt().projectBasedLayout!==c&&et({projectBasedLayout:c}),!0},c=Object.fromEntries(Object.entries(n.project_layouts).map(([e,t])=>[e,{layoutRef:t.layout_ref,signature:H(t.layout_tree)}]));return(n.layout_mode??`profile`)===`project`?{headless:!0,scope:`project`,projectId:``,layoutRef:null,signature:H(null),slices:c,capture:()=>({layout_tree:null,active_session:null}),apply:s}:{scope:`profile`,projectId:``,layoutRef:n.layout_ref,signature:H(n.layout_tree),slices:c,capture:()=>({layout_tree:n.layout_tree,active_session:n.active_session}),apply:s}},[t,e,n,i,o])}var Yr=H(null);function Xr(){let e=qt(),t=Tt(),n=I(),r=Xt(),i=Jr(n,e&&r===null),a=r??i,o=ae(n??void 0,void 0).data??[],s=fe(n??void 0,e&&n!==null).data??[],c=b(),l=le(),u=p(),[d,f]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null);(0,Y.useEffect)(()=>P(`layouts.toggle`,Gt),[]),(0,Y.useEffect)(()=>{e||(f(``),h(!1),_(null))},[e]);let v=a?.headless===!0,y=a===null||v?null:o.find(e=>e.id===a.layoutRef)??null,x=a!==null&&!v&&(y===null?a.signature!==Yr:H(y.layout_tree)!==a.signature),S=e=>{let t=a?.slices?.[e];if(!t)return!1;let n=t.layoutRef===null?null:o.find(e=>e.id===t.layoutRef)??null;return n?H(n.layout_tree)!==t.signature:t.signature!==Yr},C=e=>a===null?!1:e.scope===`profile`?a.scope===`profile`&&x:e.project_id===null?!1:a.scope===`project`?!v&&e.project_id===a.projectId?x:S(e.project_id):x||S(e.project_id),ee=e=>y!==null&&e.id===y.id,w=e=>(e===null?void 0:s.find(t=>t.id===e)?.name)??`Project`,T=a!==null&&!v&&a.scope===`project`?o.filter(e=>e.scope===`profile`||e.project_id===a.projectId):o,E=[...T.some(e=>e.scope===`profile`)?[{key:`profile`,name:`Profile-wide`}]:[],...[...new Set(T.flatMap(e=>e.project_id===null?[]:[e.project_id]))].map(e=>({key:e,name:w(e)})).sort((e,t)=>e.name.localeCompare(t.name))],te=g===null?T:g===`profile`?T.filter(e=>e.scope===`profile`):T.filter(e=>e.project_id===g),D=e=>a!==null&&e.scope===a.scope&&(a.scope===`profile`||e.project_id===a.projectId),ne=(e,t,r)=>{!a||!n||c.mutate({profile_id:n,scope:a.scope,project_id:a.scope===`project`?a.projectId:void 0,name:e,...t},{onSuccess:e=>{r&&a.apply(e)},onError:e=>J(e)})},re=e=>{if(!a)return;let t=D(e)?e:o.find(t=>t.name===e.name&&D(t));if(!t){ne(e.name,a.capture(),!0);return}l.mutate({id:t.id,...a.capture()},{onSuccess:e=>a.apply(e),onError:e=>J(e)})},ie=(e,t)=>ne(t,{layout_tree:e.layout_tree,active_session:e.active_session},!1),oe=e=>{if(a){if(!a.apply(e)){R.error(`Workspace is still loading — try again in a moment`);return}e.project_id!==null&&e.project_id!==a.projectId&&t(`/project/${e.project_id}`),Ut(!1)}};return(0,X.jsxs)(Cn,{open:e,onOpenChange:Ut,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(Sn,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,X.jsx)(Xn,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Layouts`})]})})}),(0,X.jsx)(V,{children:`Layouts`})]}),(0,X.jsxs)(xn,{className:`w-[26rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Layouts`}),a!==null&&!v&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:G(`inline-flex size-[var(--ui-control-height)] shrink-0 cursor-pointer items-center justify-center rounded-[var(--ui-radius)] text-fg transition-colors hover:bg-elevated disabled:pointer-events-none disabled:opacity-50`,`ml-auto`),children:[(0,X.jsx)(B,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Save the current layout as a new layout`})]})]}),a===null?(0,X.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Loading the profile’s layout state…`}):v?(0,X.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Project-based layout is on — every project keeps its own layout. Open a project to name or save it; loading works from here.`}):(y===null||m)&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 pb-3`,children:[y===null&&(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`Unnamed layout`}),(0,X.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:a.scope===`profile`?`Profile-wide`:`Project`}),(0,X.jsx)(`span`,{className:`ml-auto text-2xs text-interrupted`,children:`Unsaved`})]}),(0,X.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault();let t=d.trim();t&&(ne(t,a.capture(),!0),f(``),h(!1))},children:[(0,X.jsx)(z,{autoFocus:m,value:d,placeholder:y===null?`Name this layout…`:`Save as a new layout…`,spellCheck:!1,onChange:e=>f(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&h(!1)},className:`h-8 flex-1 text-sm`}),(0,X.jsx)(q,{size:`sm`,type:`submit`,disabled:!d.trim(),children:`Save`}),y!==null&&(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>h(!1),children:`Cancel`})]})]}),E.length>1&&(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:E.map(e=>(0,X.jsx)($r,{active:g===e.key,onClick:()=>_(t=>t===e.key?null:e.key),children:e.name},e.key))}),(0,X.jsxs)(`div`,{className:`no-scrollbar max-h-[60vh] overflow-y-auto px-2 pb-3`,children:[te.length===0&&(0,X.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:g===null?`No layouts yet — name and save the current layout to keep it.`:`Nothing matches this filter.`}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:te.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(Zr,{layout:e,projectLabel:e.scope===`profile`?null:w(e.project_id),isCurrent:ee(e),dirty:x,loadable:a!==null,savable:a!==null&&!v,confirmBeforeLoad:C(e),overwrites:D(e),onLoad:()=>oe(e),onRename:t=>l.mutate({id:e.id,name:t}),onDelete:()=>u.mutate(e.id),onSaveAs:()=>re(e),onDuplicate:t=>ie(e,t)})},e.id))})]})]})]})}function Zr({layout:e,projectLabel:t,isCurrent:n,dirty:r,loadable:i,savable:a,confirmBeforeLoad:o,overwrites:s,onLoad:c,onRename:l,onDelete:u,onSaveAs:d,onDuplicate:f}){let[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(e.name),y=()=>{if(!(!i||h!==null)){if(o&&p!==`load`){m(`load`);return}m(null),c()}},b=t=>{m(null),v(t===`rename`?e.name:`${e.name} copy`),g(t)},x=()=>{if(n){d();return}m(`save`)},S=n?r?`unsaved`:`active`:null;return(0,X.jsxs)(`div`,{onClick:e=>{e.target.closest(`button, input`)||y()},className:G(`rounded-md px-3 py-2.5 transition-colors`,i&&`cursor-pointer hover:bg-surface`),children:[h===null?(0,X.jsxs)(`p`,{className:G(`flex items-baseline gap-2 text-sm font-medium`,S===`active`?`text-success`:S===`unsaved`?`text-interrupted`:`text-fg`),children:[e.name,S!==null&&(0,X.jsx)(`span`,{className:`text-2xs font-normal`,children:S===`active`?`Active`:`Unsaved`})]}):(0,X.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:t=>{t.preventDefault();let n=_.trim();n&&(h===`rename`?n!==e.name&&l(n):f(n)),g(null)},children:[(0,X.jsx)(z,{autoFocus:!0,value:_,spellCheck:!1,onChange:e=>v(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&g(null)},className:`h-7 flex-1 text-sm`}),(0,X.jsx)(q,{size:`sm`,type:`submit`,disabled:!_.trim(),children:h===`rename`?`Rename`:`Save`})]}),p===`save`?(0,X.jsx)(Qr,{question:s?`Overwrite “${e.name}” with the current layout?`:`Save the current layout as “${e.name}” here?`,verb:s?`Overwrite`:`Save`,onConfirm:()=>{m(null),d()},onCancel:()=>m(null)}):p===`delete`?(0,X.jsx)(Qr,{question:`Delete this layout? This can’t be undone.`,verb:`Delete`,onConfirm:()=>{m(null),u()},onCancel:()=>m(null)}):p===`load`?(0,X.jsx)(Qr,{question:`Loading discards unsaved layout changes.`,verb:`Load`,onConfirm:y,onCancel:()=>m(null)}):(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[t!==null&&(0,X.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:t}),(0,X.jsxs)(pn,{label:`Layout actions`,className:`ml-auto`,children:[a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ei,{icon:$n,label:n?`Save`:`Save the current layout as “${e.name}”`,onClick:x}),(0,X.jsx)(ei,{icon:un,label:`Duplicate`,onClick:()=>b(`duplicate`)})]}),(0,X.jsx)(ei,{icon:je,label:`Rename`,onClick:()=>b(`rename`)}),(0,X.jsx)(ei,{icon:Nt,label:`Delete`,onClick:()=>m(`delete`)})]})]})]})}function Qr({question:e,verb:t,onConfirm:n,onCancel:r}){return(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),(0,X.jsx)(`button`,{type:`button`,onClick:n,className:G(jt,`text-danger`),children:t}),(0,X.jsx)(`button`,{type:`button`,onClick:r,className:jt,children:`Cancel`})]})}function $r({active:e,onClick:t,children:n}){return(0,X.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:t,className:G(`rounded-full px-2 py-0.5 text-2xs transition-colors`,e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:n})}function ei({icon:e,label:t,onClick:n}){return(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:At,children:[(0,X.jsx)(e,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,X.jsx)(V,{children:t})]})}var $=L()!==void 0&&/Mac/.test(navigator.platform),ti=(0,Y.lazy)(()=>M(()=>import(`./SettingsDialog-BvaE3Ue8.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([15,1,2,16,17,3,18,19,20,5,6,7,8,9,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])));function ni(){let e=u();(0,Y.useEffect)(()=>{let t=t=>{for(let[n,r]of e.getQueriesData({queryKey:[`sessions`]}))r&&e.setQueryData(n,r.map(t));for(let[n,r]of e.getQueriesData({queryKey:[`project`]}))r&&e.setQueryData(n,{...r,sessions:r.sessions.map(t)})},n=F.onStatus(e=>t(t=>t.id===e.session?{...t,status:e.status,last_activity_at:e.last_activity_at}:t)),r=F.onRenamed(e=>t(t=>t.id===e.session?{...t,title:e.title,agent_title:`agent_title`in e?e.agent_title:t.agent_title,osc_title:`osc_title`in e?e.osc_title:t.osc_title}:t)),i=F.onAccount(t=>{for(let[n,r]of e.getQueriesData({queryKey:[`accounts`]}))r&&e.setQueryData(n,r.map(e=>e.id===t.account_id?{...e,logged_in:t.logged_in}:e))}),a=t=>{e.invalidateQueries({queryKey:[`sessions`]});for(let n of t)e.invalidateQueries({queryKey:[`project`,n]})},o=F.onSessionsChanged(e=>a(e.project_ids)),s=F.onSessionSwitched(e=>a([e.target_project]));return()=>{n(),r(),i(),o(),s()}},[e])}function ri(){let e=Pe(),t=g(),n=r(),[i,a]=(0,Y.useState)(!1),o=T(t.data),s=e=>{a(!1);let r=e.trim();r!==o&&n.mutate({displayName:r===t.data?.hostname?``:r},{onError:e=>J(e)})},c=(0,X.jsx)(Re,{icon:e.icon}),l=G(`host-identity flex h-full shrink-0 items-center gap-2 px-4`,$&&`[-webkit-app-region:no-drag]`),u=`truncate font-sans text-xs font-normal`;return i&&o!==void 0?(0,X.jsxs)(`div`,{className:l,children:[c,(0,X.jsx)(tn,{initial:t.data?.displayName??o,maxLength:64,className:G(u,`w-40`),onCommit:s,onCancel:()=>a(!1)})]}):(0,X.jsxs)(bt,{to:`/`,className:G(l,`hover:bg-elevated focus-visible:bg-elevated`),title:`All projects`,children:[c,o!==void 0&&(0,X.jsx)(`span`,{className:u,...Jt(()=>a(!0)),children:o})]})}function ii(){let e=wt(),t=pt(`palette.toggle`),n=ce(e.id).data?.project,r=n!==void 0&&n.id===e.id?n.name:void 0;return(0,X.jsx)(`button`,{type:`button`,onClick:Pt,className:G(`flex h-full min-w-0 w-full cursor-pointer items-center justify-center gap-2 bg-transparent px-2 font-normal text-fg-muted transition-colors hover:bg-elevated focus-visible:bg-elevated`,$&&`[-webkit-app-region:no-drag]`),children:(0,X.jsxs)(`span`,{className:G(`pointer-events-none absolute left-1/2 top-1/2 flex max-w-[40%] -translate-x-1/2 -translate-y-1/2 items-center gap-2`,r&&A(n?.colour)),children:[(0,X.jsx)(`span`,{className:`truncate text-xs`,children:r??`Puddle`}),(0,X.jsx)(`span`,{className:`shrink-0 text-2xs`,children:t})]})})}function ai(){let e=Pe(),{fullScreen:t,animate:n}=lt(),r=$&&!t;return(0,X.jsxs)(`header`,{"data-host-colour":e.colour??void 0,onClick:e=>{let t=e.target;e.currentTarget.contains(t)&&(t.closest(`[data-header-section], [aria-label="Workspace controls"], button, a, input`)||Pt())},className:G(`host-header island-outline relative grid shrink-0 cursor-pointer grid-cols-[auto_1px_minmax(0,1fr)_1px_auto] items-center overflow-hidden rounded-[var(--ui-surface-radius)] bg-surface`,`h-9`,!$&&`mx-1.5 mt-1.5`,r&&`pl-[84px] [-webkit-app-region:drag]`,n&&`transition-[padding] duration-200 ease-out`),children:[r&&(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-[84px] top-1/2 h-5 w-px -translate-y-1/2 bg-border`}),(0,X.jsx)(`div`,{"data-header-section":!0,className:`flex h-full min-w-0 cursor-default items-center overflow-hidden`,children:(0,X.jsx)(ri,{})}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,X.jsx)(ii,{}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,X.jsxs)(pn,{label:`Workspace controls`,className:G(`shell-header-actions h-full justify-self-end rounded-none!`,$&&`[-webkit-app-region:no-drag]`),children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(q,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,onClick:()=>on(),children:[(0,X.jsx)(tr,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,X.jsx)(V,{children:`Settings`})]}),(0,X.jsx)(Xr,{}),(0,X.jsx)(Wr,{}),(0,X.jsx)(xr,{})]})]})}function oi(){ni(),kr(),Vr();let{handler:e}=Vt(),t=I(),{pathname:n}=St(),[r,i]=(0,Y.useState)(!1),a=be(),o=a.data!==void 0&&me(a.data.protocol);return(0,Y.useEffect)(()=>{if(!o)return;let e=()=>{let e=rt();F.reportTheme(e(`--text-primary`),e(`--bg-base`))};return e(),at(e)},[o]),(0,X.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden overscroll-y-none bg-ground`,children:[(0,X.jsx)(Qe,{}),(0,X.jsx)(rr,{}),(0,X.jsx)(ai,{}),(0,X.jsx)(`main`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(Mn,{resetOn:n,scope:n.startsWith(`/project/`)?`workspace`:`view`,children:(0,X.jsx)(Ct,{})})}),(0,X.jsx)(ir,{}),(0,X.jsx)(gr,{}),(0,X.jsx)(Cr,{}),(0,X.jsx)(Tr,{}),(0,X.jsx)(Er,{}),(0,X.jsx)(Or,{}),(0,X.jsx)(dr,{onNewSession:e??void 0,onNewProject:()=>i(!0)}),t!==null&&(0,X.jsx)(fn,{profileId:t,open:r,onOpenChange:i}),(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(ti,{})}),(0,X.jsx)(mr,{})]})}function si(){return(0,X.jsx)(It,{children:(0,X.jsx)(oi,{})})}var ci=(0,Y.lazy)(()=>M(()=>import(`./Dashboard-6pSi_1fH.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([45,1,2,16,17,3,18,19,20,5,6,7,8,9,21,24,25,46,32,47,48,35,49,41,40]))),li=(0,Y.lazy)(()=>M(()=>import(`./Workspace-Bf2zQC6v.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([50,1,2,6,16,17,3,18,19,20,5,7,8,9,21,29,30,23,31,24,25,51,52,48,35,46,27,53,26,54,55,32,47,56,33,34,57,58,38,39,40,59,60,61,62,43,63]))),ui=new jn({defaultOptions:{queries:{retry:1,staleTime:5e3}},mutationCache:new On({onError:e=>J(e)})});function di(){let e=I(),t=ge(),n=e!==null&&t.data!==void 0&&!t.data.some(t=>t.id===e);return e===null||n?(0,X.jsx)(nr,{}):(0,X.jsx)(Dt,{useTransitions:!1,children:(0,X.jsx)(Y.Suspense,{fallback:null,children:(0,X.jsx)(xt,{children:(0,X.jsxs)(Ot,{element:(0,X.jsx)(si,{}),children:[(0,X.jsx)(Ot,{path:`/`,element:(0,X.jsx)(ci,{})}),(0,X.jsx)(Ot,{path:`/project/:id`,element:(0,X.jsx)(li,{})}),(0,X.jsx)(Ot,{path:`/project/:id/session/:sid`,element:(0,X.jsx)(li,{})})]})})})})}function fi(){let e=(0,Y.useSyncExternalStore)(Oe.subscribe,Oe.get);return(0,X.jsx)(te,{client:ui,children:(0,X.jsxs)(Yt,{delayDuration:300,children:[(0,X.jsx)(Jn,{}),(0,X.jsx)(Mn,{scope:`app`,children:e?window.location.pathname.startsWith(`/forward/`)?(0,X.jsx)(Dn,{}):(0,X.jsx)(di,{}):(0,X.jsx)(Pn,{})}),(0,X.jsx)(Nn,{})]})})}export{fi as App};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{g as n,lt as r,mt as i,nt as a,ot as o,rt as s,yt as c,z as l}from"./protocol-support-TSI4Ig6W.js";import{b as u}from"./auth-CdosKReE.js";import{a as d,c as f,d as p,i as m,o as h,s as g,t as _,u as v}from"./LazyTerminal-B88WIvyh.js";import{t as y}from"./jsx-runtime-By8HlURe.js";import{h as b,t as x,v as S}from"./ws-Cp1eCJaM.js";import{a as C,c as w,i as T,r as E}from"./session-order-CiDVvIU5.js";import{a as D,o as O,r as k,s as A,t as ee}from"./dialog-D-Axqpzg.js";import{n as j,t as M}from"./chevron-right-BEy-IXEZ.js";import{n as N}from"./createLucideIcon-C9A1vLE-.js";import{t as P}from"./button-C_Rvtcwg.js";import{c as F,d as I,n as L,r as R,t as z,u as B}from"./context-menu-D3ZhKA9s.js";import{n as V,t as H}from"./NewProjectDialog-C1TVzOvJ.js";import{n as U}from"./errors-tuvbq1a_.js";var W=e(t(),1),G=y(),K=!1;function q(){let[e,t]=(0,W.useState)(K),[n,r]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e)return;let t=!1;return x.spawnShell(u).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let i=()=>{K=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&x.killShell(u,n),i()):(K=!0,t(!0))},onExit:i}}function J({term:e,onExit:t}){return(0,G.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,G.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:(0,G.jsx)(`div`,{className:`workspace-surface island-outline size-full bg-surface p-1`,children:(0,G.jsx)(`div`,{className:`size-full overflow-hidden rounded-[var(--ui-radius)] bg-ground p-1`,children:e!==null&&(0,G.jsx)(_,{stream:`home`,term:e,onExit:t})})})})})}var Y=`group block w-full island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,X=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function te({project:e,repoPath:t,sessions:n}){let r=n.filter(e=>e.status!==`archived`);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:N(`truncate pr-16 text-base font-semibold`,d(e.colour)||`text-fg group-hover:text-accent`),children:e.name}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,G.jsxs)(`span`,{children:[r.length,` session`,r.length===1?``:`s`]}),X.map(({status:e,colour:t})=>{let n=r.filter(t=>t.status===e).length;return n>0?(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),n,` `,e.replace(`_`,` `)]},e):null})]})]})}function Z({icon:e,label:t,onClick:n}){return(0,G.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,G.jsx)(e,{className:`size-4`})})}function Q({project:e,repoPath:t,draggable:r,dragging:i,onDragStart:a,onDragEnd:o,onDragOver:u}){let g=s(),_=n(l().data?.protocol),y=c(e.id),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(e.name),[T,E]=(0,W.useState)(p(e)),[M,V]=(0,W.useState)(e.colour??null),H=t=>g.mutate({id:e.id,archived:t},{onError:e=>U(e)}),K=()=>{C(e.name),V(e.colour??null),E(p(e)),x(!0)},q=()=>{let t=S.trim(),n=v(T);if(!t){x(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==p(e)?{abbrev:n}:{},..._&&M!==(e.colour??null)?{colour:M}:{}};if(Object.keys(r).length===0){x(!1);return}g.mutate({id:e.id,...r},{onSuccess:()=>x(!1),onError:e=>U(e)})};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(z,{children:[(0,G.jsx)(F,{asChild:!0,children:(0,G.jsxs)(`div`,{draggable:r,onDragStart:a,onDragEnd:o,onDragOver:u,className:N(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,G.jsx)(w,{draggable:!1,to:`/project/${e.id}`,className:Y,children:(0,G.jsx)(te,{project:e,repoPath:t,sessions:y.data??[]})}),(0,G.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,G.jsx)(Z,{icon:I,label:`Reopen project`,onClick:()=>H(!1)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{icon:h,label:`Edit project`,onClick:K}),(0,G.jsx)(Z,{icon:B,label:`Archive project`,onClick:()=>H(!0)})]})})]})}),(0,G.jsx)(L,{children:e.archived?(0,G.jsxs)(R,{onSelect:()=>H(!1),children:[(0,G.jsx)(I,{}),` Reopen`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(R,{onSelect:K,children:[(0,G.jsx)(h,{}),` Edit`]}),(0,G.jsxs)(R,{onSelect:()=>H(!0),children:[(0,G.jsx)(B,{}),` Archive`]})]})})]}),(0,G.jsx)(ee,{open:b,onOpenChange:x,children:(0,G.jsxs)(k,{children:[(0,G.jsx)(O,{children:(0,G.jsx)(A,{children:`Edit project`})}),(0,G.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),q()},children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(f,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,G.jsx)(j,{id:`project-name-${e.id}`,value:S,className:d(M),onChange:e=>C(e.target.value),autoFocus:!0})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(f,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,G.jsx)(j,{id:`project-abbrev-${e.id}`,maxLength:5,value:T,onChange:e=>E(v(e.target.value)),className:`w-24 uppercase`}),(0,G.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),_&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,G.jsx)(m,{value:M,onChange:V,label:`Project colour`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(f,{className:`text-fg-muted`,children:`Path`}),(0,G.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,G.jsxs)(D,{children:[(0,G.jsx)(P,{type:`button`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,G.jsx)(P,{type:`submit`,disabled:!S.trim()||g.isPending,children:`Save`})]})]})]})})]})}function $({icon:e,label:t,hint:n,onClick:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,G.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,G.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function ne(){let e=S(),t=r(e??void 0),n=i(),s=o(e??void 0),c=a(e??``),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=q(),_=b(`palette.toggle`),v=e=>n.data?.find(t=>t.id===e)?.path,y=t.data??[],x=s.data?.projectOrder??[],w=E(y.filter(e=>!e.archived),x),D=y.filter(e=>e.archived),O=(e,t)=>{e!==t&&c.mutate({projectOrder:T(w.map(e=>e.id),e,t)})};return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,G.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[y.length===0&&(0,G.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,G.jsx)(g,{className:`size-8 text-fg-muted`}),(0,G.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,_,`.`]})]}),(0,G.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[w.map(e=>(0,G.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:d===e.id,onDragStart:()=>f(e.id),onDragEnd:()=>f(null),onDragOver:t=>{t.preventDefault(),d&&d!==e.id&&O(d,e.id)}},e.id)),(0,G.jsx)($,{icon:V,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>u(!0)}),(0,G.jsx)($,{icon:C,label:h.open?`Close terminal`:`Open terminal`,hint:h.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:h.toggle})]}),D.length>0&&(0,G.jsxs)(`div`,{className:`mt-6`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>m(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,G.jsx)(M,{className:N(`size-3 transition-transform`,p&&`rotate-90`)}),(0,G.jsx)(B,{className:`size-3`}),(0,G.jsx)(`span`,{children:`Archived`}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:D.length})]}),p&&(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:D.map(e=>(0,G.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),h.open&&(0,G.jsx)(J,{term:h.term,onExit:h.onExit}),e!==null&&(0,G.jsx)(H,{profileId:e,open:l,onOpenChange:u})]})}export{ne as Dashboard};
|
|
@@ -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-By8HlURe.js";import{a as r,i,o as a,r as o,s,t as c}from"./dialog-D-Axqpzg.js";import{t as l}from"./x-Dq6POV20.js";import{t as u}from"./createLucideIcon-C9A1vLE-.js";import{t as d}from"./button-C_Rvtcwg.js";import{i as f,t as p,u as m}from"./buffer-store-Bh2IilxW.js";import{t as h}from"./drafts-B_tChlzR.js";import{t as g}from"./editor-sync-W1bamxAP.js";var _=u(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=p(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>m(r,e),[r]),()=>f(r))}function x({session:e,path:t,kind:n,root:r}){return b(e,t,r)&&n!==`commit`?(0,y.jsx)(_,{"aria-hidden":!0,className:`size-2 shrink-0 fill-current text-fg-muted group-hover:invisible group-focus-visible:invisible group-has-[:focus-visible]:invisible`}):null}function S({session:e,path:t,kind:n,root:u,label:f,onClose:p}){let m=b(e,t,u)&&n!==`commit`,[_,x]=(0,v.useState)(!1),S=()=>m?x(!0):p();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${f}`,children:(0,y.jsx)(l,{className:`size-3`})}),(0,y.jsx)(c,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(o,{children:[(0,y.jsxs)(a,{children:[(0,y.jsxs)(s,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(i,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(r,{children:[(0,y.jsx)(d,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(d,{variant:`danger`,onClick:()=>{h(e,t,u),g(e,t,u),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
|
|
@@ -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-By8HlURe.js";import{t as r}from"./x-Dq6POV20.js";import{n as i,t as a}from"./createLucideIcon-C9A1vLE-.js";import{a as o,i as s,r as c}from"./motion-OSLfKoC0.js";import{t as l}from"./chevron-down-HQLVE6o5.js";var u=a(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),d=e(t(),1),f=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);function p(e,t=f){return e.key.toLowerCase()===`f`&&!e.altKey&&!e.shiftKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}var m={index:-1,count:0},h={caseSensitive:!1,wholeWord:!1,regex:!1};function g({shortcutEnabled:e,onFind:t,onClear:n,onCloseFocus:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(0),[c,l]=(0,d.useState)(``),[u,f]=(0,d.useState)(h),[g,_]=(0,d.useState)(m),v=(0,d.useRef)({open:i,query:c,options:u});v.current={open:i,query:c,options:u};let y=(0,d.useRef)(t);y.current=t;let b=(0,d.useRef)(n);b.current=n;let x=(0,d.useRef)(r);x.current=r;let S=(0,d.useCallback)(e=>{let t=v.current;if(!t.open)return;let n=y.current(t.query,t.options,e);n&&_(n)},[]),C=(0,d.useCallback)(()=>{a(!0),s(e=>e+1)},[]),w=(0,d.useCallback)(()=>{a(!1),b.current(),x.current?.()},[]),T=(0,d.useCallback)(()=>S(`next`),[S]),E=(0,d.useCallback)(()=>S(`previous`),[S]),D=(0,d.useCallback)(()=>S(`reset`),[S]);return(0,d.useEffect)(()=>{i&&S(`reset`)},[i,c,u,S]),(0,d.useEffect)(()=>{if(!e)return;let t=e=>{p(e)&&(e.preventDefault(),e.stopPropagation(),C())};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,C]),(0,d.useEffect)(()=>()=>{b.current()},[]),{open:i,focusKey:o,query:c,options:u,result:g,openFind:C,close:w,next:T,previous:E,refresh:D,setQuery:l,setOptions:f,setResult:_}}var _=/[.*+?^${}()|[\]\\]/g;function v(e,t){if(e.length===0)return null;try{let n=t.regex?e:e.replace(_,`\\$&`);return t.wholeWord&&(n=`\\b(?:${n})\\b`),new RegExp(n,t.caseSensitive?`g`:`gi`)}catch{return null}}function y(e,t){return e.length===0||v(e,t)!==null}function b(e,t,n,r=1e3){let i=v(t,n);if(t.length>0&&i===null)return{matches:[],invalid:!0,limited:!1};if(!i)return{matches:[],invalid:!1,limited:!1};let a=[],o;for(;(o=i.exec(e))!==null;){if(o[0].length===0){i.lastIndex++;continue}if(a.length===r)return{matches:a,invalid:!1,limited:!0};a.push({start:o.index,end:o.index+o[0].length})}return{matches:a,invalid:!1,limited:!1}}var x=n();function S({active:e,label:t,onClick:n,children:r}){return(0,x.jsx)(`button`,{type:`button`,"aria-label":t,"aria-pressed":e,title:t,onClick:n,className:i(`rounded-sm p-1 transition-colors`,e?`bg-surface text-accent`:`text-fg-muted hover:bg-surface hover:text-fg`),children:r})}function C({query:e,result:t}){return e.length===0?null:t.invalid?(0,x.jsx)(x.Fragment,{children:`Invalid expression`}):t.count===0?(0,x.jsx)(x.Fragment,{children:`No results`}):t.limited?(0,x.jsxs)(x.Fragment,{children:[t.count,`+ results`]}):t.index<0?(0,x.jsxs)(x.Fragment,{children:[t.count,` results`]}):(0,x.jsxs)(x.Fragment,{children:[t.index+1,` of `,t.count]})}function w({query:e,focusKey:t,options:n,result:i,onQueryChange:a,onOptionsChange:f,onNext:m,onPrevious:h,onClose:g}){let _=(0,d.useRef)(null);(0,d.useEffect)(()=>{_.current?.focus(),_.current?.select()},[t]);let v=i.count>0&&!i.invalid;return(0,x.jsxs)(`div`,{role:`search`,"aria-label":`Find in view`,className:`absolute right-2 top-0 z-30 flex h-10 w-[min(34rem,calc(100%-0.5rem))] items-center gap-1.5 rounded-b-md bg-surface px-1.5 shadow-lg`,onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),g();return}if(e.key===`Enter`){e.preventDefault(),e.stopPropagation(),e.shiftKey?h():m();return}p(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),_.current?.select())},children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center rounded-md bg-elevated pl-2 pr-0.5`,children:[(0,x.jsx)(`input`,{ref:_,value:e,onChange:e=>a(e.target.value),placeholder:`Find`,spellCheck:!1,autoComplete:`off`,"aria-label":`Find`,className:`h-7 min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`}),(0,x.jsx)(S,{active:n.caseSensitive,label:`Match case`,onClick:()=>f({...n,caseSensitive:!n.caseSensitive}),children:(0,x.jsx)(o,{className:`size-3.5`})}),(0,x.jsx)(S,{active:n.wholeWord,label:`Match whole word`,onClick:()=>f({...n,wholeWord:!n.wholeWord}),children:(0,x.jsx)(c,{className:`size-3.5`})}),(0,x.jsx)(S,{active:n.regex,label:`Use regular expression`,onClick:()=>f({...n,regex:!n.regex}),children:(0,x.jsx)(s,{className:`size-3.5`})})]}),(0,x.jsx)(`div`,{className:`w-20 shrink-0 text-center text-xs text-fg-muted`,children:(0,x.jsx)(C,{query:e,result:i})}),(0,x.jsx)(`button`,{type:`button`,"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,disabled:!v,onClick:h,className:`rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-default disabled:opacity-40`,children:(0,x.jsx)(u,{className:`size-4`})}),(0,x.jsx)(`button`,{type:`button`,"aria-label":`Next match`,title:`Next match (Enter)`,disabled:!v,onClick:m,className:`rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-default disabled:opacity-40`,children:(0,x.jsx)(l,{className:`size-4`})}),(0,x.jsx)(`button`,{type:`button`,"aria-label":`Close find`,title:`Close (Escape)`,onClick:g,className:`rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg`,children:(0,x.jsx)(r,{className:`size-4`})})]})}export{g as a,y as i,v as n,m as o,b as r,p as s,w as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-Bo8hyZj7.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/protocol-support-TSI4Ig6W.js","assets/auth-CdosKReE.js","assets/jsx-runtime-By8HlURe.js","assets/api-B90WKMKj.js","assets/client-settings-DhfHheKR.js","assets/theme-swfNLod9.js","assets/preload-helper-Czpn1I53.js","assets/ws-Cp1eCJaM.js","assets/dist-BOS6OKSE.js","assets/forward-link-BspnTVuc.js","assets/createLucideIcon-C9A1vLE-.js","assets/motion-OSLfKoC0.js","assets/FindWidget-DG1YP6Zx.js","assets/x-Dq6POV20.js","assets/chevron-down-HQLVE6o5.js","assets/selection-actions-CvYaucrm.js","assets/index-Doe7MhnI.js","assets/index-4XrK4Fes.css","assets/button-C_Rvtcwg.js","assets/copy-D0Theg4Q.js","assets/code-Cf4ftdOa.js","assets/errors-tuvbq1a_.js","assets/math-delimiters-BCnTi7Ii.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{W as n}from"./auth-CdosKReE.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{C as a}from"./dialog-D-Axqpzg.js";import{n as o}from"./chevron-right-BEy-IXEZ.js";import{n as s,t as c}from"./createLucideIcon-C9A1vLE-.js";function l(e){return e.trim().slice(0,5).toUpperCase()}function u(e){return e.abbrev??l(e.name)}function d(e){return e.trim().toUpperCase().slice(0,5)}var f=e(t(),1),p=r(),m=`Label`,h=f.forwardRef((e,t)=>(0,p.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));h.displayName=m;var g=h;function _({className:e,...t}){return(0,p.jsx)(g,{className:s(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var v=c(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 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 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),y=c(`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`}]]),b={navy:`text-identity-navy`,gold:`text-identity-gold`,blue:`text-icon-blue`,green:`text-icon-green`,amber:`text-icon-amber`,red:`text-icon-red`,violet:`text-icon-violet`,cyan:`text-icon-cyan`,accent:`text-accent`};function x(e){return e&&b[e]||``}function S({value:e,onChange:t,disabled:r=!1,label:i=`Colour`}){return(0,p.jsx)(`div`,{role:`group`,"aria-label":i,className:`flex flex-wrap items-center gap-1`,children:[null,...n].map(n=>(0,p.jsx)(`button`,{type:`button`,title:n??`Default`,"aria-label":n??`Default colour`,"aria-pressed":(e??null)===n,disabled:r,onClick:()=>t(n),className:s(`flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-border/50 focus-visible:bg-border/50 disabled:cursor-default disabled:opacity-50`,(e??null)===n&&`bg-border/50`),children:(0,p.jsx)(`span`,{className:s(`size-3.5 rounded-full`,n?s(`bg-current`,x(n)):`bg-fg-muted`)})},n??`default`))})}function C({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:c,hintsClassName:l,autoFocus:u}){let[d,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(0),_=e=>{n(e.value),r?.(e),m(!1)};return(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(o,{id:e,value:t,onChange:e=>{n(e.target.value),m(!0),g(0)},onFocus:()=>m(!0),onBlur:()=>m(!1),onKeyDown:e=>{if(!(!d||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),g(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[h]??i[0];t&&(e.preventDefault(),_(t))}else e.key===`Escape`&&(e.stopPropagation(),m(!1))},placeholder:a,className:c,autoComplete:`off`,spellCheck:!1,autoFocus:u}),d&&i.length>0&&(0,p.jsx)(`ul`,{className:s(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,l??`w-full`),children:i.map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),_(e)},onMouseEnter:()=>g(t),className:s(`relative flex cursor-pointer select-none items-center gap-2 rounded-[var(--ui-menu-radius)] 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 text-xs`),"data-selected":t===h,children:[(0,p.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,p.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var w=(0,f.lazy)(()=>i(()=>import(`./Terminal-Bo8hyZj7.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))),T=null;async function E(){T=(await i(()=>import(`./Terminal-Bo8hyZj7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]))).Terminal}function D(e){return T?(0,p.jsx)(T,{...e}):(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,p.jsx)(w,{...e})})}export{x as a,_ as c,u as d,S as i,l,E as n,y as o,C as r,v as s,D as t,d as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{F as n,G as r,I as i,J as ee,c as a,g as o,mt as te,z as ne}from"./protocol-support-TSI4Ig6W.js";import{a as s,c,i as re,l,r as u,s as d,u as f}from"./LazyTerminal-B88WIvyh.js";import{t as p}from"./jsx-runtime-By8HlURe.js";import{o as m,p as ie}from"./session-order-CiDVvIU5.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dialog-D-Axqpzg.js";import{n as x}from"./chevron-right-BEy-IXEZ.js";import{t as S}from"./createLucideIcon-C9A1vLE-.js";import{t as C}from"./button-C_Rvtcwg.js";import{t as w}from"./use-debounced-value-C86N-mOK.js";var T=S(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),E=S(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),D=e(t(),1),O=p();function k(e){let t=e.trim().replace(/\/+$/,``);return t===``?`/`:t}function A(e){return e.startsWith(`/`)||e.startsWith(`~`)}function j(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function ae({dir:e,onNavigate:t,onChoose:n}){let i=r(e.endsWith(`/`)?e:`${e}/`);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>t(j(e)),disabled:e===`/`,title:`Parent directory`,className:`shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-40`,children:[(0,O.jsx)(m,{className:`size-3.5`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Parent directory`})]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`ml-auto shrink-0 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose this folder`})]}),(0,O.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[(i.data?.entries??[]).map(e=>(0,O.jsxs)(`div`,{className:`flex items-center rounded-md transition-colors hover:bg-elevated`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left`,children:[e.is_git?(0,O.jsx)(d,{className:`size-3.5 shrink-0 text-success`}):(0,O.jsx)(E,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,O.jsx)(`span`,{className:`truncate text-xs text-fg`,children:e.name})]}),e.is_git&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>n(e.path),className:`shrink-0 px-2 py-1 text-2xs text-fg-muted transition-colors hover:text-fg`,children:`choose`})]},e.path)),i.data!==void 0&&i.data.entries.length===0&&(0,O.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`No subdirectories.`})]})]})}function M({profileId:e,open:t,onOpenChange:d}){let p=te(),m=ne().data?.protocol,S=a(m),T=o(m),E=i(),j=n(),M=ie(),oe=ee(),[N,P]=(0,D.useState)(``),[F,I]=(0,D.useState)(``),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(``),[V,H]=(0,D.useState)(null),[U,W]=(0,D.useState)(!1),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(null),Y=oe.data?.home,se=()=>{let e=N.trim(),t=A(e)&&Y!==void 0?k(e.replace(/^~(?=\/|$)/,Y)):A(e)&&e.startsWith(`/`)?k(e):Y??`/`;Z(t)},X=e=>{I(e),U||B(l(e))},Z=e=>{J(e),P(e)},ce=e=>{P(e),J(null),X(e.split(`/`).filter(Boolean).pop()??``),R(!0)},Q=r(w(N,150)),le=(0,D.useMemo)(()=>{if(!A(N))return(p.data??[]).map(e=>({value:e.path,badge:`registered`,is_git:!0}));let e=new Set((p.data??[]).map(e=>e.path));return(Q.data?.entries??[]).map(t=>({value:t.path,label:t.name,badge:e.has(t.path)?`registered`:t.is_git?`git`:void 0,is_git:t.is_git}))},[N,p.data,Q.data]),ue=async()=>{K(null);try{let t=k(N),n=p.data?.find(e=>e.path===t)?.id??(await E.mutateAsync({path:t,...S?{default_base_branch:``}:{}})).id,r=await j.mutateAsync({profile_id:e,repo_id:n,name:F.trim(),...T?{colour:V}:{},...f(z)?{abbrev:f(z)}:{}});d(!1),M(`/project/${r.id}`)}catch(e){K(e instanceof Error?e.message:String(e))}},$=F.trim()!==``&&A(N.trim());return(0,O.jsx)(b,{open:t,onOpenChange:d,children:(0,O.jsxs)(v,{children:[(0,O.jsxs)(_,{children:[(0,O.jsx)(y,{children:`New project`}),(0,O.jsx)(g,{children:`Point at a git repository on the daemon host — known repositories are reused.`})]}),(0,O.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),$&&ue()},children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(c,{htmlFor:`repo-path`,children:`Repository path`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>q===null?se():J(null),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:q===null?`browse…`:`hide browser`})]}),(0,O.jsx)(u,{id:`repo-path`,placeholder:`~/src/my-repo`,value:N,onValueChange:P,onChoose:e=>{!L&&e.is_git&&X(e.value.split(`/`).filter(Boolean).pop()??``)},hints:le}),q!==null&&(0,O.jsx)(ae,{dir:q,onNavigate:Z,onChoose:ce})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(c,{htmlFor:`project-name`,children:`Project name`}),(0,O.jsx)(x,{id:`project-name`,placeholder:`e.g. checkout-rework`,value:F,className:s(V),onChange:e=>{X(e.target.value),R(!0)}})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,O.jsx)(c,{htmlFor:`project-abbrev`,children:`Abbreviation`}),(0,O.jsx)(x,{id:`project-abbrev`,placeholder:F.trim()?l(F):`ABBRV`,maxLength:5,value:z,onChange:e=>{B(f(e.target.value)),W(!0)},className:`w-24 uppercase`}),(0,O.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the project's label on the collapsed sidebar rail.`]})]}),T&&(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,O.jsx)(re,{value:V,onChange:H,label:`Project colour`})]}),G&&(0,O.jsx)(`p`,{className:`text-xs text-danger`,children:G}),(0,O.jsxs)(h,{children:[(0,O.jsx)(C,{type:`button`,variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,O.jsx)(C,{type:`submit`,disabled:!$||E.isPending||j.isPending,children:`Create project`})]})]})]})})}export{T as n,M as t};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{$ as r,B as i,Ct as a,D as o,E as s,Et as c,G as l,J as u,K as d,L as f,M as p,Q as m,S as h,U as g,X as _,c as v,ht as y,it as b,j as x,lt as S,mt as C,n as w,nt as T,ot as E,st as ee,tt as D,z as te}from"./protocol-support-TSI4Ig6W.js";import{B as ne,G as re,H as ie,Q as ae,U as oe,V as se,_ as ce,g as le,h as ue,q as de,v as fe,y as pe}from"./auth-CdosKReE.js";import{c as me,i as he,o as ge,r as _e,s as ve}from"./LazyTerminal-B88WIvyh.js";import{C as ye,D as be,N as xe,O as Se,S as Ce,T as we,_ as Te,a as Ee,b as De,c as Oe,d as ke,f as Ae,i as je,j as Me,k as Ne,l as Pe,m as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be,u as Ve,v as He,x as Ue,y as We}from"./notification-delivery-CegOQxcZ.js";import{a as Ge,i as Ke,r as O,t as qe}from"./client-settings-DhfHheKR.js";import{c as Je,t as Ye}from"./theme-swfNLod9.js";import{t as Xe}from"./jsx-runtime-By8HlURe.js";import{r as Ze}from"./index-Doe7MhnI.js";import{n as Qe,t as $e}from"./api-B90WKMKj.js";import{a as et,g as tt,n as nt,o as rt,p as it,r as at,v as k,y as ot}from"./ws-Cp1eCJaM.js";import{n as A}from"./dist-BOS6OKSE.js";import{a as j,i as M,n as st,o as ct,r as N,s as P,t as F}from"./dialog-D-Axqpzg.js";import{t as lt}from"./x-Dq6POV20.js";import{n as I,r as ut}from"./chevron-right-BEy-IXEZ.js";import{n as dt,r as ft}from"./dist-Dge3wHdO.js";import{n as L,t as R}from"./createLucideIcon-C9A1vLE-.js";import{t as z}from"./button-C_Rvtcwg.js";import{a as pt,c as mt,i as ht,l as gt,n as _t,o as vt,r as yt,t as B,u as bt}from"./switch-oBD5uCTu.js";import{a as V,i as H,n as U,r as W,t as G}from"./select-p5KTVHbg.js";import{t as xt}from"./code-Cf4ftdOa.js";import{t as St}from"./rotate-ccw-BI2k_h3A.js";import{t as Ct}from"./control-tray-c9uXOo-i.js";import{n as K}from"./errors-tuvbq1a_.js";import{t as wt}from"./use-debounced-value-C86N-mOK.js";import{n as Tt,r as Et,t as Dt}from"./popover-D-jcaKGN.js";import{a as Ot,o as kt,r as At,t as jt,u as Mt}from"./CompilationCommandForm-CipGdjjH.js";var Nt=R(`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`}]]),Pt=R(`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`}]]),Ft=R(`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`}]]),It=R(`shield-check`,[[`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:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Lt=R(`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`}]]),Rt=R(`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`}]]),q=e(n(),1),J=Xe();function zt({id:e,value:t,min:n,max:r,step:i,className:a,onCommit:o}){let[s,c]=(0,q.useState)(String(t));return(0,q.useEffect)(()=>c(String(t)),[t]),(0,J.jsx)(I,{id:e,type:`number`,min:n,max:r,step:i,className:a,value:s,onChange:e=>c(e.target.value),onBlur:()=>{let e=Number(s);if(s.trim()===``||!Number.isFinite(e)){c(String(t));return}let i=Math.min(r??e,Math.max(n??e,e));c(String(i)),i!==t&&o(i)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur()}})}function Y({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,J.jsxs)(`div`,{className:L(`flex items-center gap-4 py-2.5`,a),children:[(0,J.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,J.jsx)(`span`,{className:L(`text-xs text-fg-muted`,n),children:t})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function X({children:e,note:t}){return(0,J.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function Bt(){let e=Ke(),[t,n]=(0,q.useState)(Je());return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Appearance`}),(0,J.jsx)(Y,{label:`Theme`,children:(0,J.jsxs)(G,{value:t,onValueChange:e=>{n(e),Ye(e)},children:[(0,J.jsx)(H,{className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{value:`dark`,children:`Dark`}),(0,J.jsx)(W,{value:`light`,children:`Light`}),(0,J.jsx)(W,{value:`system`,children:`System`})]})]})}),(0,J.jsx)(Y,{label:`Cursor style`,children:(0,J.jsxs)(G,{value:e.cursorPackage,onValueChange:e=>O({cursorPackage:e}),children:[(0,J.jsx)(H,{className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(U,{children:Ge.map(e=>(0,J.jsx)(W,{value:e.id,children:e.label},e.id))})]})}),(0,J.jsx)(Y,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,J.jsx)(zt,{id:`ui-font-size`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onCommit:e=>O({uiFontSize:e})})}),(0,J.jsx)(Y,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,J.jsx)(zt,{id:`terminal-font-size`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onCommit:e=>O({terminalFontSize:e})})}),(0,J.jsx)(Y,{label:`Editor font size`,htmlFor:`editor-font-size`,children:(0,J.jsx)(zt,{id:`editor-font-size`,min:9,max:32,step:.5,className:`w-20 tabular-nums`,value:e.editorFontSize,onCommit:e=>O({editorFontSize:e})})}),(0,J.jsx)(Y,{label:`Density`,children:(0,J.jsxs)(G,{value:e.density,onValueChange:e=>O({density:e}),children:[(0,J.jsx)(H,{className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{value:`compact`,children:`Compact`}),(0,J.jsx)(W,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,J.jsx)(Y,{label:`Reduced animation and motion`,htmlFor:`reduce-motion`,children:(0,J.jsx)(B,{id:`reduce-motion`,checked:e.reduceMotion,onCheckedChange:e=>O({reduceMotion:e})})}),(0,J.jsx)(Y,{label:`Project-based layout`,description:`Editor layouts are separated across projects.`,htmlFor:`project-based-layout`,children:(0,J.jsx)(B,{id:`project-based-layout`,checked:e.projectBasedLayout,onCheckedChange:e=>O({projectBasedLayout:e})})}),(0,J.jsx)(Y,{label:`All projects in the session list`,description:`Right sidebar displays sessions from all projects.`,htmlFor:`show-all-project-sessions`,children:(0,J.jsx)(B,{id:`show-all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>O({showAllProjectSessions:e})})})]})}function Vt({profile:e}){let t=D(),[n,r]=(0,q.useState)(!1),i=n=>{t.mutate({id:e.id,icon:n},{onError:e=>K(e)}),r(!1)};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y,{label:`Icon`,children:(0,J.jsxs)(Dt,{open:n,onOpenChange:r,children:[(0,J.jsx)(Et,{asChild:!0,children:(0,J.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,J.jsx)(Se,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,J.jsx)(Tt,{align:`end`,className:`w-72`,children:(0,J.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>i(null),className:L(`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,J.jsx)(Se,{icon:null,colour:null,className:`size-4`})}),Ne.map(({name:t,Icon:n})=>(0,J.jsx)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:L(`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,J.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,J.jsx)(Y,{label:`Icon colour`,children:(0,J.jsx)(he,{value:e.icon_colour,onChange:n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>K(e)}),label:`Icon colour`})})]})}var Ht=`__none__`;function Ut(){let e=k(),t=ee().data?.find(t=>t.id===e),n=s(e??void 0),r=E(e??void 0),i=D(),a=T(e??``),o=g(),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``);if((0,q.useEffect)(()=>{t&&(l(t.name),d(t.branch_prefix))},[t]),!t)return null;let _=r.data?.default_account_id;return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Profile`}),(0,J.jsxs)(Y,{label:`Name`,description:`Letters, digits, dot, underscore and hyphen.`,htmlFor:`profile-name`,children:[(0,J.jsx)(I,{id:`profile-name`,value:c,onChange:e=>l(e.target.value),className:`w-44`}),(0,J.jsx)(z,{size:`sm`,variant:`secondary`,disabled:c===t.name||c.trim()===``||i.isPending,onClick:()=>i.mutate({id:t.id,name:c},{onError:e=>K(e)}),children:`Save`})]}),(0,J.jsxs)(Y,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,J.jsx)(I,{id:`branch-prefix`,value:u,onChange:e=>d(e.target.value),placeholder:`no prefix`,className:`w-44`}),(0,J.jsx)(z,{size:`sm`,variant:`secondary`,disabled:u===t.branch_prefix||i.isPending,onClick:()=>i.mutate({id:t.id,branch_prefix:u},{onError:e=>K(e)}),children:`Save`})]}),(0,J.jsx)(Vt,{profile:t}),(0,J.jsx)(Y,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,J.jsxs)(G,{value:typeof _==`number`?String(_):Ht,onValueChange:e=>a.mutate({default_account_id:e===Ht?null:Number(e)},{onError:e=>K(e)}),children:[(0,J.jsx)(H,{className:`w-56`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{value:Ht,children:`First available`}),n.data?.map(e=>(0,J.jsx)(W,{value:String(e.id),children:(0,J.jsxs)(`span`,{children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,J.jsx)(Y,{label:`Delete profile`,description:`Non-archived sessions block deletion.`,className:`mt-4`,children:(0,J.jsx)(z,{variant:`danger`,size:`sm`,onClick:()=>p(!0),children:`Delete…`})}),(0,J.jsx)(F,{open:f,onOpenChange:e=>{e||(p(!1),h(``))},children:(0,J.jsxs)(N,{children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(P,{children:[`Delete profile `,(0,J.jsx)(`span`,{className:`text-fg`,children:t.name}),`?`]}),(0,J.jsx)(M,{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,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(me,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,J.jsx)(`span`,{className:`text-fg`,children:t.name}),` to confirm`]}),(0,J.jsx)(I,{id:`delete-confirm-name`,value:m,onChange:e=>h(e.target.value),autoFocus:!0})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(z,{variant:`ghost`,onClick:()=>{p(!1),h(``)},children:`Cancel`}),(0,J.jsx)(z,{variant:`danger`,disabled:m!==t.name||o.isPending,onClick:()=>o.mutate(t.id,{onSuccess:()=>{yt(),tt.set(null)},onError:e=>{p(!1),h(``),K(e)}}),children:`Delete profile`})]})]})})]})}function Wt({agent:e,profileId:t,onClose:n,onCreated:r}){let i=p(),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),u=l(wt(s,150)),d=s.trim(),f=d===``||d.startsWith(`/`)||d.startsWith(`~`),m=a.trim()!==``&&f,h=()=>{!m||i.isPending||i.mutate({profile_id:t,agent_type:e.id,label:a.trim(),...d===``?{}:{import_dir:d}},{onSuccess:e=>{n(),r(e,d!==``)},onError:e=>K(e)})};return(0,J.jsx)(F,{open:!0,onOpenChange:e=>!e&&n(),children:(0,J.jsxs)(N,{children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(P,{children:[`Add a `,e.display_name,` account`]}),(0,J.jsxs)(M,{children:[`Accounts are isolated config dirs under this profile. Naming one is enough — Puddle creates it and takes you straight to `,e.display_name,`’s login. To reuse an account you already have on this machine, give its config directory: it is copied in and the original is never touched.`]})]}),(0,J.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,J.jsx)(I,{autoFocus:!0,placeholder:`label, e.g. personal`,value:a,onChange:e=>o(e.target.value)}),(0,J.jsx)(_e,{value:s,onValueChange:c,placeholder:`(optional) existing config dir, e.g. ~/.claude`,hints:(u.data?.entries??[]).map(e=>({value:e.path,label:e.name}))})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(z,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,J.jsxs)(z,{disabled:!m||i.isPending,onClick:h,children:[(0,J.jsx)(ft,{}),`Add account`]})]})]})})}function Gt({account:e,gateOpen:t,installed:n}){let r=_(),a=m(),o=i(),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(e.label),p=(0,q.useRef)(null);return(0,q.useEffect)(()=>f(e.label),[e.label]),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`input`,{ref:p,value:d,onChange:e=>f(e.target.value),onBlur:()=>{let t=d.trim();if(t!==e.label){if(t===``){f(e.label);return}a.mutate({id:e.id,label:t},{onError:t=>{K(t),f(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(f(e.label),t.currentTarget.blur())},"aria-label":`Account name`,className:`-mx-1 block w-full min-w-0 truncate rounded-sm bg-transparent px-1 py-0.5 text-sm text-fg transition-colors hover:bg-elevated focus:bg-elevated focus:outline-none`}),(0,J.jsxs)(`button`,{type:`button`,title:`Rename account`,onClick:()=>{p.current?.focus(),p.current?.select()},className:`shrink-0 rounded-sm p-0.5 text-fg-muted transition-colors hover:bg-elevated hover:text-fg`,children:[(0,J.jsx)(ge,{className:`size-3`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Rename account`})]})]}),(0,J.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-success`:`text-warning`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,J.jsx)(B,{checked:e.skip_permissions_default,onCheckedChange:t=>a.mutate({id:e.id,skip_permissions_default:t},{onError:e=>K(e)})})]}),(0,J.jsxs)(z,{size:`sm`,variant:`secondary`,disabled:r.isPending||!n,onClick:()=>r.mutate(e.id,{onSuccess:e=>c({stream:e.stream,hint:e.hint}),onError:e=>K(e)}),children:[(0,J.jsx)(xe,{}),e.logged_in?`Re-login`:`Login`]}),(0,J.jsxs)(z,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>u(!0),children:[(0,J.jsx)(dt,{}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),s&&(0,J.jsx)(ye,{stream:s.stream,hint:s.hint,label:`${e.agent_type}/${e.label}`,onClose:()=>c(null)}),(0,J.jsx)(F,{open:l,onOpenChange:u,children:(0,J.jsxs)(N,{children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(P,{children:[`Delete `,(0,J.jsx)(`span`,{className:`text-fg`,children:e.label}),`?`]}),(0,J.jsx)(M,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(z,{variant:`ghost`,onClick:()=>u(!1),children:`Cancel`}),(0,J.jsx)(z,{variant:`danger`,disabled:o.isPending,onClick:()=>o.mutate(e.id,{onSuccess:()=>u(!1),onError:e=>{u(!1),K(e)}}),children:`Delete account`})]})]})})]})}function Kt(){let e=k(),t=o(),n=s(e??void 0),r=E(e??void 0),i=_(),[a,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(null),d=r.data?.allowSkipPermissions===!0;return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[],r=e.available!==!1;return(0,J.jsxs)(`div`,{className:`mb-5`,children:[(0,J.jsx)(Y,{label:e.display_name,description:r?`Accounts are initialised in config dirs owned by this profile.`:`No ${e.binary??e.id} on the daemon’s PATH. Install it or add its directory to the agent search path in Sessions.`,className:`py-1`,children:(0,J.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e.id})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,J.jsx)(Gt,{account:t,gateOpen:d&&e.capabilities.skip_permissions,installed:r},t.id)),(0,J.jsx)(`div`,{className:`flex`,children:(0,J.jsxs)(z,{type:`button`,size:`sm`,variant:`secondary`,disabled:!r,onClick:()=>u(e),children:[(0,J.jsx)(ft,{}),`Add account`]})})]})]},e.id)}),a&&(0,J.jsx)(ye,{stream:a.stream,label:a.label,hint:a.hint,onClose:()=>c(null)}),l!==null&&e!==null&&(0,J.jsx)(Wt,{agent:l,profileId:e,onClose:()=>u(null),onCreated:(e,t)=>{if(t){e.logged_in||A.info(`Imported without credentials — press Login to authenticate.`);return}i.mutate(e.id,{onSuccess:t=>c({stream:t.stream,label:`${e.agent_type}/${e.label}`,hint:t.hint}),onError:e=>K(e)})}})]})}function qt(){let e=x(),t=r(),[n,i]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e.data&&i(e.data.agentPath)},[e.data]),(0,J.jsx)(Y,{label:`Agent search path (host-wide)`,description:`Colon-separated dirs the daemon prepends to PATH; helps find agent CLIs like claude (e.g. ~/.local/bin).`,htmlFor:`agent-path`,children:(0,J.jsx)(I,{id:`agent-path`,type:`text`,className:`w-64 text-2xs`,value:n,onChange:e=>i(e.target.value),onBlur:()=>{e.data&&n!==e.data.agentPath&&t.mutate({agentPath:n})}})})}function Jt({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=Mt(e,n),o=n.sessionDefaults??{},[s,c]=(0,q.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,J.jsx)(Y,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,J.jsx)(I,{id:`${e}-default-base`,type:`text`,placeholder:`repository default`,className:`w-48`,value:s,onChange:e=>c(e.target.value),onBlur:()=>{s.trim()!==a.baseBranch&&l({baseBranch:s.trim()})}})}),(0,J.jsx)(Y,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,J.jsx)(B,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,J.jsx)(Y,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`Start on working copy of the selected branch instead of sharing one directory.`,htmlFor:`${e}-default-dir`,children:(0,J.jsx)(B,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function Yt(){return(0,J.jsx)(Y,{label:`Terminal scrollback`,htmlFor:`scrollback`,children:(0,J.jsx)(zt,{id:`scrollback`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:Ke().terminalScrollback,onCommit:e=>O({terminalScrollback:e})})})}function Xt({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,q.useState)(r);return(0,J.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,J.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,J.jsx)(ut,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(z,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var Zt={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 Qt({initial:e,onSave:t,pending:n}){let[r,i]=(0,q.useState)(e),a=r.length>0?r:oe;return(0,J.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,J.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,J.jsx)(I,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:oe}),(0,J.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,J.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:_t(Zt,a)})]}),(0,J.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:re.map(([e,t])=>(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,J.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(z,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(oe),t(oe)},children:`Reset to default`})]})]})}function $t(){let e=k(),t=ee().data?.find(t=>t.id===e),n=E(e??void 0),r=T(e??``),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(``),c=n.data?.allowSkipPermissions===!0,l=e=>r.mutate({allowSkipPermissions:e},{onSuccess:()=>{a(!1),s(``)},onError:e=>K(e)}),u=e=>t=>r.mutate({[e]:t},{onError:e=>K(e)});return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Sessions`}),(0,J.jsx)(Y,{label:`Skip permission prompts`,htmlFor:`gate`,children:(0,J.jsx)(B,{id:`gate`,checked:c,onCheckedChange:e=>{e?a(!0):l(!1)}})}),(0,J.jsx)(Y,{label:`Capture exported env variables`,description:n.data?.captureSessionEnv===!1?`No variables are captured or injected; already-captured variabless are kept for when this is re-enabled.`:`Variables exported in a session persist and are re-injected upon terminal and agent restarts.`,htmlFor:`capture-env`,children:(0,J.jsx)(B,{id:`capture-env`,checked:n.data?.captureSessionEnv!==!1,disabled:r.isPending,onCheckedChange:e=>r.mutate({captureSessionEnv:e},{onError:e=>K(e)})})}),(0,J.jsx)(qt,{}),(0,J.jsx)(Yt,{}),(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsx)(X,{children:`New session defaults`}),n.data&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Jt,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>K(e)}),pending:r.isPending},`${e}:agent-seed`),(0,J.jsx)(Jt,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>K(e)}),pending:r.isPending},`${e}:terminal-seed`)]})]}),(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsx)(X,{note:`Sent to agent as opening message when a session (re)starts. You can make this empty.`,children:`Launch text`}),n.data&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Xt,{id:`onboarding-template`,label:`New worktree`,description:`Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??se,defaultText:se,onSave:u(`onboardingTemplate`),pending:r.isPending},`${e}:onboarding`),(0,J.jsx)(Xt,{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??ne,defaultText:ne,onSave:u(`concurrentTemplate`),pending:r.isPending},`${e}:concurrent`),(0,J.jsx)(Xt,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot.`,initial:n.data.restartTemplate??ie,defaultText:ie,onSave:u(`restartTemplate`),pending:r.isPending},`${e}:restart`)]})]}),(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsx)(X,{children:`Tab title`}),n.data&&(0,J.jsx)(Qt,{initial:n.data.tabTitleTemplate||"${name}",onSave:u(`tabTitleTemplate`),pending:r.isPending},`${e}:tab-title`)]}),(0,J.jsx)(F,{open:i,onOpenChange:e=>{e||(a(!1),s(``))},children:(0,J.jsxs)(N,{children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Ft,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,J.jsx)(M,{asChild:!0,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,J.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,J.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,J.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,J.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,J.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,J.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,J.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,J.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,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(me,{htmlFor:`confirm-name`,children:[`Type `,(0,J.jsx)(`span`,{className:`text-fg`,children:t?.name}),` to confirm`]}),(0,J.jsx)(I,{id:`confirm-name`,value:o,onChange:e=>s(e.target.value),autoFocus:!0})]}),(0,J.jsxs)(j,{children:[(0,J.jsx)(z,{variant:`ghost`,onClick:()=>{a(!1),s(``)},children:`Cancel`}),(0,J.jsx)(z,{variant:`danger`,disabled:o!==t?.name||r.isPending,onClick:()=>l(!0),children:`Open the gate`})]})]})})]})}var en=ae.parse({});function tn(){let[e,t]=(0,q.useState)(je);return(0,q.useEffect)(()=>{let e=()=>t(je());return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]),[e,()=>t(je())]}function nn({permission:e,onRequest:t}){return e===`granted`||e===`unverified`?null:(0,J.jsxs)(`p`,{className:`pb-2 text-xs text-warning`,children:[e==="default"&&(0,J.jsxs)(J.Fragment,{children:[`The browser has not been asked for permission yet, so nothing will show —`,` `,(0,J.jsx)(`button`,{type:`button`,onClick:t,className:`underline underline-offset-2 transition-colors hover:text-fg`,children:`request it now`}),`.`]}),e===`denied`&&`Blocked by the browser — allow notifications for this site in its site settings, then return here.`,e===`unsupported`&&`This browser cannot show desktop notifications.`]})}function rn(){let e=k(),t=E(e??void 0),n=T(e??``),r=S(e??void 0),[i,a]=tn(),o=Re(),[s,c]=(0,q.useState)(!1);(0,q.useEffect)(()=>{Ie();let e=()=>void Ie();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]);let l=ae.catch(en).parse(t.data?.notifications??{}),u=e=>n.mutate({notifications:e},{onError:e=>K(e)}),d=()=>{ot()?.showNotification||typeof Notification>`u`||Notification.requestPermission().then(a)};return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Notifications`}),(0,J.jsx)(Y,{label:`Agent notifications`,htmlFor:`notify-desktop`,children:(0,J.jsx)(B,{id:`notify-desktop`,checked:l.desktop,onCheckedChange:e=>{e&&d(),u({...l,desktop:e})}})}),l.desktop&&(0,J.jsx)(nn,{permission:i,onRequest:d}),(0,J.jsx)(Y,{label:`Notify while interacting with a session`,htmlFor:`notify-focused`,description:`When off, typing or clicking in a session silences its desktop alerts for five seconds. Mobile Web Push is configured separately on each device.`,children:(0,J.jsx)(B,{id:`notify-focused`,checked:l.when_focused,onCheckedChange:e=>u({...l,when_focused:e})})}),(0,J.jsx)(Y,{label:`Test delivery`,description:`Send a notification to check this device’s permissions.`,children:(0,J.jsx)(z,{variant:`ghost`,disabled:s,onClick:()=>{c(!0),(async()=>{!ot()?.showNotification&&typeof Notification<`u`&&Notification.permission==="default"&&(await Notification.requestPermission(),a()),await Be({id:`puddle-test`,title:`Puddle`,body:`Notifications are working on this device.`},()=>{})})().catch(K).finally(()=>c(!1))},children:s?`Sending…`:`Send test`})}),(0,J.jsx)(`p`,{role:`status`,className:`pb-2 text-xs text-fg-muted`,children:o.state===`shown`?`The system accepted the notification. Banner visibility also depends on Focus / Do Not Disturb.`:o.message??`Delivery has not been tested on this device.`}),(0,J.jsx)(Y,{label:`Sound`,htmlFor:`notify-sound`,children:(0,J.jsx)(B,{id:`notify-sound`,checked:l.sound,onCheckedChange:e=>u({...l,sound:e})})}),(0,J.jsx)(Y,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,J.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[l.muted_projects.length,` muted`]})}),(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:r.data?.map(e=>(0,J.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,J.jsx)(B,{checked:l.muted_projects.includes(e.id),onCheckedChange:t=>u({...l,muted_projects:t?[...l.muted_projects,e.id]:l.muted_projects.filter(t=>t!==e.id)})}),e.name]},e.id))})]})}function an(){let e=k(),t=w(te().data?.protocol),n=Ot(t&&e!==null),[r,i]=(0,q.useState)(null),a=n.data?.providers??[],o=a.find(e=>e.id===r)??a[0];return!t||!e?null:(0,J.jsxs)(`div`,{className:`mt-8`,children:[(0,J.jsx)(X,{note:`Defaults for this profile on the connected host. Individual files can override them from their tab menu.`,children:`Compilation & running code`}),n.isLoading?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Loading languages…`}):n.isError?(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:`Couldn’t load languages.`}):o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y,{label:`Language`,htmlFor:`compilation-language`,children:(0,J.jsxs)(G,{value:o.id,onValueChange:i,children:[(0,J.jsx)(H,{id:`compilation-language`,className:`w-48`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(U,{children:a.map(e=>(0,J.jsx)(W,{value:e.id,detail:e.available?void 0:`Not installed`,children:e.display_name},e.id))})]})}),!o.available&&(0,J.jsxs)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:[`No supported `,o.display_name,` tool is installed on this host. Saved commands apply when a supported tool is available.`]}),(0,J.jsx)(on,{request:{profile_id:e,provider:o.id}},`${e}:${o.id}`)]}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No languages advertised by this host.`})]})}function on({request:e}){let t=kt(e),n=c();return t.isLoading?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Loading commands…`}):t.isError?(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.error instanceof Error?t.error.message:`Couldn’t load commands`}):t.data?(0,J.jsx)(jt,{settings:t.data,onSave:async t=>{for(let r of t){let t=await At({...e,...r});n.setQueryData([`compilation-defaults`,e],t),await n.invalidateQueries({queryKey:[`compilation-settings`]})}}}):null}function sn(){let e=Ke();return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Editor`}),(0,J.jsx)(Y,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,J.jsx)(zt,{id:`tab-size`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onCommit:e=>O({editorTabSize:e})})}),(0,J.jsx)(Y,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,J.jsx)(B,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>O({editorWordWrap:e})})}),(0,J.jsx)(Y,{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,J.jsx)(I,{id:`editor-link-host`,type:`text`,placeholder:Ze.get()??`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>O({editorLinkSshHost:e.target.value})})}),(0,J.jsx)(an,{})]})}function cn({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,q.useState)(!1);return(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,"data-hotkey-recording":i||void 0,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=et(e.nativeEvent);t&&(n(t),a(!1))},className:L(`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…`:rt(e)}),!t&&(0,J.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,J.jsx)(St,{className:`size-3.5`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function ln(){let e=k(),t=E(e??void 0),n=T(e??``),r=t.data?.hotkeys??{},i=(e,t)=>r[e]||t,a=new Map;for(let e of nt){let t=i(e.id,it(e));a.set(t,(a.get(t)??0)+1)}let o=(e,t)=>n.mutate({hotkeys:{...r,[e]:t}},{onError:e=>K(e)}),s=e=>{let t={...r};delete t[e],n.mutate({hotkeys:t},{onError:e=>K(e)})};return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Hotkeys`}),(0,J.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed.`}),(0,J.jsx)(Y,{label:`App shortcuts in terminals`,description:t.data?.terminalAppShortcuts===!1?`A focused terminal receives these keys instead.`:`The shortcuts below work while a terminal is focused.`,htmlFor:`terminal-app-shortcuts`,className:`mb-4`,children:(0,J.jsx)(B,{id:`terminal-app-shortcuts`,checked:t.data?.terminalAppShortcuts!==!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({terminalAppShortcuts:e},{onError:e=>K(e)})})}),at.map(e=>{let t=nt.filter(t=>t.group===e);return t.length===0?null:(0,J.jsxs)(`div`,{className:`mb-5`,children:[(0,J.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,it(e)),n=(a.get(t)??0)>1?`Conflicts with another shortcut.`:void 0;return(0,J.jsx)(Y,{label:e.label,description:n,descriptionClassName:n?`text-interrupted`:void 0,children:(0,J.jsx)(cn,{value:t,isDefault:!r[e.id],onRecord:t=>o(e.id,t),onReset:()=>s(e.id)})},e.id)})]},e)})]})}var un=e=>[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);function dn(e,t){let[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(!0),[o,s]=(0,q.useState)(``),c=(0,q.useRef)(0),l=(0,q.useRef)(null);(0,q.useEffect)(()=>()=>{c.current+=1},[]),(0,q.useEffect)(()=>{if(n)return;let e=!0;return l.current=null,a(!0),(async()=>{try{let t=un(crypto.getRandomValues(new Uint8Array(32))),n=un(new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t))));e&&(l.current={code:t,challenge:n})}catch(t){e&&s(t instanceof Error?t.message:`Could not prepare sign-in.`)}finally{e&&a(!1)}})(),()=>{e=!1,l.current=null}},[n]);let u=(0,q.useRef)(t);return(0,q.useEffect)(()=>{u.current=t},[t]),(0,q.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{c.current+=1,r(null),s(`Sign-in expired. Try again.`)},Math.max(0,n.request.expires-Date.now()));return()=>clearTimeout(e)},[n]),(0,q.useEffect)(()=>{if(!n||e)return;let t=c.current,i=!1,a,o=async()=>{try{if(n.request.expires<=Date.now())throw Error(`Sign-in expired. Try again.`);let{ready:e}=ce.parse(await Qe(`POST`,`/cockpit/remote/registration`,{service:n.request.service,code:n.code}));if(i||t!==c.current)return;if(n.request.expires<=Date.now())throw Error(`Sign-in expired. Try again.`);e?(r(null),await u.current({t:`enable`,registration:{service:n.request.service,app:n.request.app,code:n.code}})):a=setTimeout(()=>void o(),2e3)}catch(e){if(i||t!==c.current)return;r(null),s(e instanceof Error?e.message:`Sign-in failed. Try again.`)}};return a=setTimeout(()=>void o(),2e3),()=>{i=!0,clearTimeout(a)}},[n,e]),{attempt:n,preparing:i,error:o,begin:(t,n,i)=>{if(!(e||!l.current)){s(``);try{let{code:e,challenge:a}=l.current,o=le.safeParse({service:t.trim(),app:n.trim(),label:i.trim(),challenge:a,expires:Date.now()+fe.invitationMs});if(!o.success)throw Error(`Enter a host name and exact HTTPS application and relay origins.`);let s=o.data,u=`${s.app}/#register=${encodeURIComponent(JSON.stringify(s))}`;c.current+=1,l.current=null,r({request:s,code:e,url:u}),window.open(u,`_blank`,`noopener,noreferrer`)}catch(e){s(e instanceof Error?e.message:`Could not start sign-in.`)}}},cancel:()=>{c.current+=1,l.current=null,a(!0),r(null)}}}function fn({service:e=`https://charles.waddlelabs.ai`,app:t=`https://puddle.waddlelabs.ai`,hostName:n,busy:r,disabled:i,enable:a,cancel:o}){let[s,c]=(0,q.useState)(e),[l,u]=(0,q.useState)(t),[d,f]=(0,q.useState)(n),p=dn(i,a),m=i||p.preparing||!!p.attempt;return(0,J.jsxs)(`form`,{className:`mt-4 space-y-4`,onSubmit:e=>{e.preventDefault(),m||p.begin(s,l,d)},children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Application origin`,(0,J.jsx)(I,{type:`url`,required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`https://app.example.com`,autoComplete:`off`,disabled:m})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Relay origin`,(0,J.jsx)(I,{type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://relay.example.com`,autoComplete:`off`,disabled:m})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Host name`,(0,J.jsx)(I,{required:!0,maxLength:80,value:d,onChange:e=>f(e.target.value),disabled:m})]}),o&&(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saving a new registration revokes existing browser approvals and invitations.`}),p.error&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p.error}),p.attempt?(0,J.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,J.jsxs)(`p`,{role:`status`,children:[`Confirm this host in your browser. Match request`,` `,(0,J.jsx)(`strong`,{className:`font-mono`,children:p.attempt.request.challenge.slice(0,8).toUpperCase()}),`. Sign-in expires in five minutes.`]}),(0,J.jsx)(`a`,{href:p.attempt.url,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:opacity-80`,children:`Continue in browser ↗`}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,onClick:p.cancel,children:`Cancel sign-in`})]}):(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(z,{type:`submit`,disabled:m||!d.trim()||!s||!l,children:r?`Enabling…`:p.preparing?`Preparing sign-in…`:`Sign in and enable`}),o&&(0,J.jsx)(z,{type:`button`,variant:`ghost`,disabled:m,onClick:o,children:`Cancel`})]})]})}var pn=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),Z=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),mn=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),hn=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),gn=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),_n=t((e=>{var t=Z().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),vn=t((e=>{var t=Z().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),yn=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),bn=t((e=>{var t=mn(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),xn=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Sn=t((e=>{var t=xn();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Cn=t(((e,t)=>{var n=Sn();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),wn=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Tn=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Q=t((e=>{var t=wn(),n=Tn();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),En=t((e=>{var t=Z(),n=bn(),r=mn(),i=Q(),a=wn(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Dn=t((e=>{var t=Z(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),On=t(((e,t)=>{var n=Q();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),kn=t(((e,t)=>{var n=Q(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),An=t(((e,t)=>{var n=Q();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),jn=t(((e,t)=>{var n=Q(),r=Z();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Mn=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Nn=t((e=>{var t=Q(),n=On(),r=kn(),i=An(),a=jn(),o=Tn(),s=Z(),c=Mn();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Pn=t((e=>{var t=Z(),n=mn(),r=hn(),i=gn(),a=_n(),o=vn(),s=yn(),c=bn(),l=Cn(),u=En(),d=Dn(),f=Q(),p=Nn();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
5
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
-
Minimum version required to store current data is: `+c+`.
|
|
7
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Fn=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),In=t((e=>{var t=Fn();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Ln=t((e=>{var t=Fn();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
8
|
-
`;return typeof a==`function`&&a(null,p),p}})),Rn=e(t((e=>{var t=pn(),n=Pn(),r=In(),i=Ln();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function zn({value:e,label:t}){let n=(0,q.useMemo)(()=>{try{let{modules:t}=Rn.create(e),n=[];for(let e=0;e<t.size;e+=1)for(let r=0;r<t.size;r+=1)t.get(e,r)&&n.push(`M${r+4} ${e+4}h1v1h-1z`);return{size:t.size+8,path:n.join(``)}}catch{return null}},[e]);return n?(0,J.jsx)(`svg`,{role:`img`,"aria-label":t,"data-theme":`light`,className:`block h-auto max-w-full rounded-lg bg-paper text-fg`,xmlns:`http://www.w3.org/2000/svg`,width:280,height:280,viewBox:`0 0 ${n.size} ${n.size}`,shapeRendering:`crispEdges`,children:(0,J.jsx)(`path`,{fill:`currentColor`,d:n.path})}):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`QR code unavailable. Use the pairing link.`})}function Bn({url:e,expires:t,dismiss:n}){let[r,i]=(0,q.useState)(``);return(0,q.useEffect)(()=>{let e=setTimeout(n,Math.max(0,t-Date.now()));return()=>clearTimeout(e)},[t,n]),(0,J.jsxs)(`section`,{className:`mt-5 space-y-3`,"aria-label":`Pairing invitation`,children:[(0,J.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`Scan or open this link on the new browser, then approve its exact identity below. Expires`,` `,new Date(t).toLocaleTimeString(),`.`]}),(0,J.jsx)(zn,{value:e,label:`Pairing invitation QR code`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(z,{variant:`secondary`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>i(`Pairing link copied.`)).catch(()=>i(`Could not copy. Open the pairing link or scan the QR code.`))},children:`Copy pairing link`}),(0,J.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`px-2 text-sm text-fg hover:opacity-80`,children:`Open pairing link ↗`}),(0,J.jsx)(z,{variant:`ghost`,onClick:n,children:`Hide invitation`})]}),r&&(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:r})]})}function Vn({devices:e,now:t,currentDevice:n,...r}){let i=e.filter(e=>e.status!==`revoked`).sort((e,t)=>Number(t.status===`pending`)-Number(e.status===`pending`));return(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[i.length===0&&(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`No browsers yet. Create a pairing invitation to add one.`}),i.map(e=>(0,J.jsx)(Hn,{device:e,now:t,current:e.id===n,...r},e.id))]})}function Hn({device:e,now:t,current:n,busy:r,approve:i,revoke:a,maintenance:o}){let s=e.status===`pending`,c=e.status===`approved`?Math.min(e.expires,e.lastUsed+fe.idleMs):e.expires,l=c<=t,u=l?`Expired`:s?`Awaiting approval`:`Approved`,d=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`truncate text-sm text-fg`,title:e.label,children:e.label}),(0,J.jsxs)(`p`,{className:L(`text-2xs`,l?`text-fg-muted`:s?`text-warning`:`text-success`),children:[u,n&&(0,J.jsx)(`span`,{className:`text-fg-muted`,children:` · this browser`})]})]}),f=(0,J.jsxs)(`div`,{className:`mt-2 space-y-1 text-2xs text-fg-muted`,children:[(0,J.jsx)(`code`,{className:`block break-all text-fg-secondary`,children:e.peer}),(0,J.jsxs)(`p`,{children:[l?`Expired`:`Expires`,` `,new Date(c).toLocaleString()]})]});return(0,J.jsxs)(`article`,{"aria-label":e.label,className:`min-w-0 rounded-[var(--ui-radius)] bg-ground px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[s?d:(0,J.jsx)(vt,{className:`min-w-0 flex-1`,summary:d,summaryClassName:`flex-row-reverse gap-2 [&>svg]:m-2`,children:f}),s&&!l&&(0,J.jsxs)(z,{variant:`secondary`,size:`sm`,disabled:r,onClick:()=>i(e.id),"aria-label":`Approve ${e.label}`,children:[(0,J.jsx)(It,{}),` Approve`]}),(0,J.jsx)(z,{variant:`ghost`,size:`icon`,className:`shrink-0 text-fg-muted`,disabled:r,"aria-label":`Revoke ${e.label}`,title:`Revoke browser`,onClick:()=>a(e.id),children:(0,J.jsx)(dt,{})})]}),s&&f,!s&&!l&&o&&(0,J.jsx)(z,{variant:`ghost`,size:`sm`,className:`mt-2`,disabled:r,onClick:()=>o(e.id,!e.maintenance),"aria-label":`${e.maintenance?`Revoke`:`Allow`} host maintenance for ${e.label}`,children:e.maintenance?`Revoke host maintenance`:`Allow host maintenance`})]})}function Un({devices:e,now:t,busy:n,act:r,canManageMaintenance:i}){return(0,J.jsx)(vt,{className:`mt-6 text-sm`,summary:`Connected browsers`,summaryClassName:`py-2`,children:(0,J.jsxs)(`section`,{className:`space-y-3 pt-2`,"aria-label":`Browsers`,children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Approval grants terminal control of this host. Compare the identity with the browser requesting access.`}),(0,J.jsx)(Vn,{devices:e,now:t,busy:n,approve:e=>void r({t:`approve`,id:e}),revoke:e=>void r({t:`revoke`,id:e}),maintenance:i?(e,t)=>void r({t:`maintenance`,id:e,enabled:t}):void 0}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Revocation detaches viewers; agents continue running. Browsers expire after 30 days of inactivity or 90 days overall.`}),i&&(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Host maintenance separately allows daemon and runtime software updates. Updates can affect every profile on this host. Pairing alone does not grant it or permission to restart other profiles' runtimes.`})]})})}function Wn({open:e,busy:t,error:n,onOpenChange:r,onConfirm:i}){return(0,J.jsx)(F,{open:e,onOpenChange:e=>!t&&r(e),children:(0,J.jsxs)(N,{children:[(0,J.jsx)(P,{children:`Delete this profile’s remote registration?`}),(0,J.jsx)(M,{children:`Disable remote access, remove the saved registration for this profile and revoke its browser approval and invitation. Agents keep running. Connecting again requires a new registration code and fresh browser approvals.`}),(0,J.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`This also removes this registration from its account’s remote host list. If the service is unavailable, removal finishes when it reconnects.`}),n&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:n}),(0,J.jsxs)(j,{children:[(0,J.jsx)(z,{variant:`ghost`,disabled:t,onClick:()=>r(!1),children:`Cancel`}),(0,J.jsx)(z,{variant:`danger`,disabled:t,onClick:i,children:t?`Deleting…`:`Delete registration`})]})]})})}function Gn(){let e=c(),t=u(),n=k(),r=ee().data?.find(e=>e.id===n)?.name??`this profile`,i=`/cockpit/remote?profile=${encodeURIComponent(n??``)}`,[o,s]=(0,q.useState)(!1),[l,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),S=(0,q.useCallback)(()=>x(null),[]),C=a({queryKey:[`cockpit-remote`,n],queryFn:async()=>ue.parse(await Qe(`GET`,i)),refetchInterval:!o&&5e3,refetchOnWindowFocus:!o,refetchOnReconnect:!o,retry:!1,gcTime:0,enabled:!!n}),w=async t=>{if(o||!n)return!1;s(!0),p(``),d(``);try{if(e.isFetching({queryKey:[`cockpit-remote`,n],exact:!0})){let e=await C.refetch({cancelRefetch:!1});if(e.isError)throw e.error}let r=pe.parse(await Qe(`POST`,i,t));return t.t===`pair`&&r.url&&r.invitation?x({url:r.url,expires:r.invitation.expires}):(d({enable:`Remote access enabled.`,approve:`Browser approved.`,revoke:`Browser revoked.`,disable:`Remote access disabled. Agents continue running.`,delete_registration:`Registration deleted from this host. Agents continue running.`,reset:`Host identity rotated and all browsers revoked. Enable access and pair again.`,status:`Status refreshed.`,devices:`Browsers refreshed.`,pair:`Invitation created.`,maintenance:t.t===`maintenance`&&t.enabled?`Host maintenance allowed for this browser.`:`Host maintenance revoked for this browser.`}[t.t]),(t.t===`disable`||t.t===`reset`||t.t===`enable`||t.t===`delete_registration`)&&S()),(t.t===`enable`||t.t===`delete_registration`)&&h(!1),_(!1),y(!1),await C.refetch(),!0}catch(e){return p(e instanceof Error?e.message:`Host operation failed. Refresh status before retrying.`),await C.refetch(),!1}finally{s(!1)}},T=C.data,E=C.error instanceof $e&&C.error.status===404,D=o||C.isError;return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{note:`${r} on ${t.data?.displayName||t.data?.hostname||`this host`} · only this profile’s projects and sessions`,children:`Remote access`}),(0,J.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{role:`status`,className:`text-sm font-medium`,children:C.isError?`Status unavailable`:T?T.availability===`ready`?T.configured?T.enabled?T.connected?`Connected to relay`:`Enabled · relay disconnected`:`Disabled`:`Not configured`:`Daemon upgrade required`:`Checking remote access…`}),(0,J.jsxs)(z,{variant:`ghost`,size:`sm`,disabled:o,onClick:()=>void C.refetch({cancelRefetch:!1}),children:[(0,J.jsx)(gt,{}),`Refresh status`]})]}),C.isError&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:E?`This cockpit does not provide remote controls. Update Puddle and reopen this window.`:C.error.message}),f&&!v&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:f}),l&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-secondary`,children:l}),T?.availability!==void 0&&T.availability!==`ready`&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:`Update the daemon on this host, then refresh status to set up mobile access.`}),T?.availability===`ready`&&(0,J.jsxs)(J.Fragment,{children:[!T.enabled&&T.supervisor&&(!T.configured||m)?(0,J.jsx)(fn,{service:T.service,app:T.app,hostName:`${t.data?.displayName||t.data?.hostname||`My host`} · ${r}`,busy:o,disabled:D,enable:w,cancel:T.configured?()=>h(!1):void 0},T.host??`new`):T.configured?(0,J.jsxs)(`dl`,{className:`mt-4 space-y-2 text-xs text-fg-secondary`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-fg-muted`,children:`Application`}),(0,J.jsx)(`dd`,{className:`break-all`,children:(0,J.jsxs)(`a`,{href:T.app,target:`_blank`,rel:`noreferrer`,className:`hover:text-fg`,children:[T.app,` ↗`]})})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-fg-muted`,children:`Relay`}),(0,J.jsx)(`dd`,{className:`break-all`,children:T.service})]}),T.peer&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-fg-muted`,children:`Host identity`}),(0,J.jsx)(`dd`,{className:`break-all font-mono`,children:T.peer})]})]}):null,!T.enabled&&!T.supervisor&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-fg-secondary`,children:`This host needs persistent systemd or launchd supervision before access can be enabled here. For another supervisor, configure both the daemon and connector using the remote CLI commands.`}),T.configured&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":`Registration actions`,children:[!T.enabled&&T.supervisor&&!m&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(z,{disabled:D,onClick:()=>void w({t:`enable`}),children:`Enable remote access`}),(0,J.jsx)(z,{variant:`ghost`,disabled:D,onClick:()=>h(!0),children:`Change registration`})]}),T.enabled&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(z,{disabled:D,onClick:()=>void w({t:`pair`}),children:`Pair a browser`}),(0,J.jsx)(z,{variant:`ghost`,disabled:D,onClick:()=>void w({t:`disable`}),children:`Disable remote access`})]}),T.canDeleteRegistration&&(0,J.jsx)(z,{variant:`ghost`,disabled:D,onClick:()=>{p(``),y(!0)},children:`Delete registration`})]}),b&&T.enabled&&(0,J.jsx)(Bn,{...b,dismiss:S}),T.configured&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Un,{devices:T.devices,now:C.dataUpdatedAt,busy:D,act:w,canManageMaintenance:T.canManageMaintenance===!0}),(0,J.jsxs)(vt,{className:`text-sm`,summary:`Host identity recovery`,summaryClassName:`py-2`,children:[(0,J.jsx)(`p`,{className:`my-3 text-xs text-fg-muted`,children:`Rotate a lost or compromised host identity. This profile’s browser approvals and invitations will be revoked.`}),(0,J.jsx)(z,{variant:`ghost`,disabled:D,onClick:()=>_(!0),children:`Reset host identity…`})]})]})]}),(0,J.jsx)(F,{open:g,onOpenChange:e=>!o&&_(e),children:(0,J.jsxs)(N,{children:[(0,J.jsx)(P,{children:`Reset this profile’s remote identity?`}),(0,J.jsx)(M,{children:`Disable remote access, rotate the host identity and revoke this profile’s paired browsers and invitation. Agents keep running. Enable access and pair each browser again afterwards.`}),(0,J.jsxs)(j,{children:[(0,J.jsx)(z,{variant:`ghost`,disabled:o,onClick:()=>_(!1),children:`Cancel`}),(0,J.jsx)(z,{variant:`danger`,disabled:o,onClick:()=>void w({t:`reset`}),children:`Reset host identity`})]})]})}),(0,J.jsx)(Wn,{open:v,busy:o,error:f,onOpenChange:y,onConfirm:()=>void w({t:`delete_registration`})})]})}var Kn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,$=65,qn=Object.fromEntries([...Kn].map((e,t)=>[e,t])),Jn=`H`,Yn=(()=>{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 Xn(e){let t=4294967295;for(let n of e)t=Yn[(t^n)&255]^t>>>8;return((t^4294967295)>>>0).toString(16).padStart(8,`0`)}function Zn(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function Qn(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 $n(e){let t=new Blob([new TextEncoder().encode(e)]).stream().pipeThrough(new CompressionStream(`gzip`));return new Uint8Array(await new Response(t).arrayBuffer())}async function er(e){let t=new Blob([e]).stream().pipeThrough(new DecompressionStream(`gzip`));return new Response(t).text()}function tr(e,t){let n=(t%$+$)%$,r=``;for(let t of e){let e=qn[t];r+=e===void 0?t:Kn[(e+n)%$]}return r}async function nr(e){let t=await $n(JSON.stringify(e));return tr(Zn(t)+Xn(t),1+Math.floor(Math.random()*($-1)))}async function rr(e){let t=e.trim(),n=t[0];if(!n||qn[n]===void 0)throw Error(`Not a settings export.`);let r=tr(t,-((qn[n]-qn[Jn]+$)%$));if(r.length<9||r[0]!==Jn)throw Error(`Not a settings export.`);let i=r.slice(0,-8),a=r.slice(-8),o=Qn(i);if(Xn(o)!==a)throw Error(`Settings export is corrupt (checksum mismatch).`);return JSON.parse(await er(o))}var ir=`puddle.sync-selection`;function ar(){try{let e=JSON.parse(localStorage.getItem(ir)??`null`);if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}catch{}return Oe.map(e=>e.id)}function or({selected:e,onToggle:t}){return(0,J.jsx)(`div`,{className:`flex flex-col gap-2 pl-1`,children:Oe.map(n=>(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,J.jsx)(B,{checked:e.includes(n.id),onCheckedChange:e=>t(n.id,e)}),n.label]},n.id))})}function sr(){let e=k(),t=E(e??void 0),n=ee().data?.find(t=>t.id===e),r=y(e??void 0,void 0),i=T(e??``),a=D(),o=f(),s=Le(),c=ze(),[l,u]=(0,q.useState)(``),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(ar),v=n&&s.data?Ee(s.data.file,n.name):void 0,b=v?.enabled===!0,x=b&&v?v.groups:g,S=()=>({client:qe(),theme:Je(),profileSettings:t.data??{},profile:n??{},scratchpad:r.data??[]}),C={setClient:e=>O(e),setTheme:e=>{typeof e==`string`&&Ye(e)},patchProfileSettings:e=>i.mutate(e,{onError:e=>K(e)}),patchProfileColumns:t=>{e&&a.mutate({id:e,...t},{onError:e=>K(e)})},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})}},w=(e,t)=>{n&&c.mutate({profile:n.name,entry:{enabled:e.enabled??b,groups:t,doc:Ve(t,S()),updatedAt:new Date().toISOString()}},{onError:e=>K(e)})},te=(e,t)=>{let n=t?[...x,e]:x.filter(t=>t!==e);_(n),localStorage.setItem(ir,JSON.stringify(n)),b&&w({},n)},ne=async()=>{h(!0);try{let e=Pe(await rr(l.trim()),C,{profileSettings:t.data??{},scratchpad:r.data??[]});e.length===0?A.error(`Nothing recognised to import.`):(A.success(`Imported ${e.join(`, `)}.`),u(``))}catch(e){A.error(e.message)}finally{h(!1)}},re=async()=>{h(!0);try{let e=await nr(Ve(x,S()));p(e),await navigator.clipboard?.writeText(e),A.success(`Copied to clipboard`)}finally{h(!1)}};return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Sync`}),(0,J.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,J.jsxs)(`div`,{className:`mb-6`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Sync locally`}),s.data?.available===!1?(0,J.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,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`mb-2 mt-1 text-xs text-fg-muted`,children:[`Sync selected groups through this machine’s`,` `,(0,J.jsx)(`span`,{className:`text-fg-secondary`,children:`~/.puddle`}),`, so every Puddle window stays in step for profiles named`,` `,(0,J.jsx)(`span`,{className:`text-fg-secondary`,children:n?.name??`…`}),`.`]}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,J.jsx)(B,{checked:b,disabled:!n||s.isLoading||c.isPending,onCheckedChange:e=>w({enabled:e},x)}),`Sync locally`]})]})]}),(0,J.jsx)(vt,{className:`mb-6`,summary:`Choose what to sync`,summaryClassName:`text-xs`,children:(0,J.jsx)(`div`,{className:`mt-2`,children:(0,J.jsx)(or,{selected:x,onToggle:te})})}),(0,J.jsxs)(`div`,{className:`mb-6`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Export`}),(0,J.jsx)(`p`,{className:`mb-2 mt-1 text-xs text-fg-muted`,children:`Builds a Puddle magic string that encodes settings from the checklist above.`}),(0,J.jsx)(z,{size:`sm`,disabled:m,onClick:()=>void re(),children:`Export & copy`}),d&&(0,J.jsx)(ut,{readOnly:!0,value:d,rows:3,spellCheck:!1,onFocus:e=>e.currentTarget.select(),className:`mt-2 resize-y font-mono text-xs`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:`Import`}),(0,J.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:`Paste a Puddle magic string to import its settings.`}),(0,J.jsx)(ut,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Paste a settings export…`,rows:3,spellCheck:!1,className:`resize-y font-mono text-xs`}),(0,J.jsx)(`div`,{className:`mt-2`,children:(0,J.jsx)(z,{size:`sm`,disabled:!l.trim()||m,onClick:()=>void ne(),children:`Import`})})]})]})}function cr(){return(0,J.jsxs)(`div`,{className:`space-y-8`,children:[(0,J.jsx)(Gn,{},k()),(0,J.jsx)(sr,{})]})}function lr({repo:e}){let t=b(),n=d(),r=v(te().data?.protocol),[i,a]=(0,q.useState)(e.default_base_branch),[o,s]=(0,q.useState)(e.onboarding_notes??``),c=e=>K(e);return(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg bg-surface p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:e.path}),(0,J.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,J.jsxs)(z,{size:`sm`,variant:`ghost`,disabled:n.isPending,onClick:()=>n.mutate(e.id,{onSuccess:()=>A.success(`Fetched.`),onError:c}),children:[(0,J.jsx)(gt,{}),`Fetch now`]})]}),(0,J.jsxs)(Y,{label:`Default base branch`,description:r?`Blank = the branch checked out at the clone location when each agent or terminal is created.`:`Choose a branch. Update the host to allow a blank default that follows the clone.`,htmlFor:`base-${e.id}`,className:`py-1.5`,children:[(0,J.jsx)(I,{id:`base-${e.id}`,placeholder:r?`current clone branch`:void 0,value:i,onChange:e=>a(e.target.value),className:`w-40`}),(0,J.jsx)(z,{size:`sm`,variant:`secondary`,disabled:i.trim()===e.default_base_branch||t.isPending||!r&&!i.trim(),onClick:()=>t.mutate({id:e.id,default_base_branch:i.trim()},{onError:c,onSuccess:()=>a(i.trim())}),children:`Save`})]}),(0,J.jsx)(Y,{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,J.jsx)(B,{id:`fetch-${e.id}`,checked:e.fetch_enabled,onCheckedChange:n=>t.mutate({id:e.id,fetch_enabled:n},{onError:c})})}),(0,J.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,J.jsxs)(`label`,{htmlFor:`notes-${e.id}`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Onboarding notes`,(0,J.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,J.jsx)(ut,{id:`notes-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:4}),(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{size:`sm`,variant:`secondary`,disabled:o===(e.onboarding_notes??``)||t.isPending,onClick:()=>t.mutate({id:e.id,onboarding_notes:o},{onError:c}),children:`Save notes`})})]}),e.orphan_worktrees.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 rounded-md bg-elevated p-2`,children:[(0,J.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,J.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5`,children:e.orphan_worktrees.map(e=>(0,J.jsx)(`li`,{className:`truncate text-2xs text-fg-muted`,children:e},e))})]})]})}function ur(){let e=C();return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(X,{children:`Projects`}),e.data?.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No projects yet — create one from the dashboard, pointing at a repository.`}),e.data?.map(e=>(0,J.jsx)(lr,{repo:e},e.id))]})}function dr(){let e=k(),t=E(e??void 0),n=T(e??``),[r,i]=(0,q.useState)(!1);if(!e||!t.data)return null;let a=t.data.hostIcon,o=t.data.hostColour,s=e=>{n.mutate({hostIcon:e},{onError:K}),i(!1)};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y,{label:`Icon`,children:(0,J.jsxs)(Dt,{open:r,onOpenChange:i,children:[(0,J.jsx)(Et,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-host-colour":o??void 0,className:`host-identity flex size-9 items-center justify-center rounded-md transition-colors hover:bg-elevated hover:text-fg`,children:[(0,J.jsx)(we,{icon:a,className:`size-5`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Choose a host icon`})]})}),(0,J.jsx)(Tt,{align:`end`,className:`w-72`,children:(0,J.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,title:`Default host icon`,"aria-pressed":!a,onClick:()=>s(null),className:L(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!a&&`bg-nav-selection text-nav-selection-ink`),children:(0,J.jsx)(we,{icon:null,className:`size-4`})}),be.map(({name:e,Icon:t})=>(0,J.jsx)(`button`,{type:`button`,title:e,"aria-pressed":a===e,onClick:()=>s(e),className:L(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,a===e&&`bg-nav-selection text-nav-selection-ink`),children:(0,J.jsx)(t,{className:`size-4`})},e))]})})]})}),(0,J.jsx)(Y,{label:`Accent`,children:(0,J.jsx)(he,{value:o,onChange:e=>n.mutate({hostColour:e},{onError:K}),label:`Host accent`})})]})}function fr({status:e,reply:t,disabled:n,offlineDisabled:r,act:i}){let a=e.result?.operation;if(!a)return null;let o={id:a.id,revision:a.revision},s=Ue(e,t),c=We(e),l=t?.ok&&t.operation?.id===a.id&&t.operation.revision===a.revision?t.review:void 0,u=de(a.phase);return(0,J.jsxs)(`div`,{className:`mt-5 space-y-3 text-sm`,children:[(0,J.jsxs)(`p`,{role:`status`,className:`font-medium`,children:[e.observation===`recorded`&&`Recorded status: `,De[a.phase]]}),e.observation===`recorded`&&(0,J.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Last recorded change: `,new Date(a.updated_at).toLocaleString(),`. This record does not confirm current service health or runtime adoption.`]}),(0,J.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:a.targets.map(({component:e,version:t})=>`${e===`daemon`?`Daemon`:`Runtime software`} ${t}`).join(` · `)}),a.message&&(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.message}),s&&(0,J.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[`Existing persistent runtimes keep running.`,` `,a.targets.some(({component:e})=>e===`daemon`)?`This window briefly reconnects while the daemon is replaced.`:`New runtimes will use the updated software.`]}),l&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[`Daemon-owned work affected: `,l.affected.terminals,` terminals,`,` `,l.affected.notebooks,` notebook kernels, `,l.affected.compilation,` compilation jobs/watchers, `,l.affected.programmes,` programmes.`]}),l.interruption_fingerprint&&(0,J.jsx)(`p`,{className:`text-xs text-warning`,children:`Applying interrupts the listed work. Shell jobs and in-memory kernel state will be lost; interrupted programmes are not replayed.`}),l.blockers.filter(({code:e})=>e!==`interruption_approval_required`).map(({code:e},t)=>(0,J.jsx)(`p`,{className:`text-xs text-warning`,children:e===`runtime_lifetime_unverified`?`A runtime has a limited or unverified host lifetime. Daemon replacement is blocked while it runs. Updating also requires a supported host service manager.`:`Check failed: ${e.replaceAll(`_`,` `)}`},`${e}-${t}`)),l.more_blockers>0&&(0,J.jsxs)(`p`,{className:`text-xs text-warning`,children:[l.more_blockers,` additional checks failed.`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c&&(0,J.jsx)(z,{size:`sm`,disabled:r,onClick:()=>i(c),children:`Continue recovery on host`}),He(a)&&(0,J.jsx)(z,{variant:`ghost`,size:`sm`,disabled:n,onClick:()=>i({action:`inspect`,reference:o}),children:l?`Check again`:`Review impact`}),s&&(0,J.jsx)(z,{size:`sm`,variant:s.interruption_approval?`danger`:`default`,disabled:n,onClick:()=>i(s),children:s.interruption_approval?`Interrupt listed work and apply`:`Apply update`}),!u&&!a.dispatched&&(0,J.jsx)(z,{variant:`ghost`,size:`sm`,disabled:n,onClick:()=>i({action:`cancel`,reference:o}),children:`Cancel update`}),!u&&a.dispatched&&e.capabilities.verify_completion&&(0,J.jsx)(z,{variant:`ghost`,size:`sm`,disabled:n,onClick:()=>i({action:`recover`,reference:o,strategy:`verify-completion`}),children:`Verify completion`}),a.phase===`recovery_required`&&e.capabilities.continue_recovery&&(0,J.jsx)(z,{size:`sm`,disabled:n,onClick:()=>i({action:`recover`,reference:o,strategy:`continue`}),children:`Continue recovery`})]}),c&&(0,J.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:`Recovery checks this update on the host before continuing unfinished steps. Keep this window open until the host accepts the request; accepted recovery runs independently.`}),a.dispatched&&!u&&(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`The host accepted this operation. Status will refresh as it reconnects. Recovery actions are explicit; applying is never repeated automatically.`})]})}function pr(){let e=Fe(),t=ke(),n=Ae(),r=h(u().data)??`this host`;if(!t)return null;let i=e.data,a=i?.catalogue,o=a?.releases,s=Te(i),c=e.error instanceof $e&&e.error.status===404,l=n.busy||e.isError||i?.availability!==`ready`,d=n.data&&!n.data.ok?n.data:i?.result&&!i.result.ok?i.result:null;return(0,J.jsxs)(`section`,{className:`mb-8`,"aria-label":`Host updates`,children:[(0,J.jsx)(X,{note:`Updates run on ${r}`,children:`Updates`}),(0,J.jsx)(Y,{label:`Daemon`,description:i?.observation===`recorded`?i.daemon_version?`Last connected version: ${i.daemon_version}`:`Version unavailable`:a?.daemon_version??i?.daemon_version??`Version unavailable`,children:(0,J.jsx)(z,{variant:`ghost`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch({cancelRefetch:!1}),children:e.isFetching?`Refreshing…`:`Refresh status`})}),a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y,{label:`Default runtime software`,description:`New runtimes use this build. Existing runtimes retain their current build.`,children:(0,J.jsx)(`span`,{className:`text-xs tabular-nums`,children:a.runtime_default?.version??`Unavailable`})}),a.runtimes.versions.length>0&&(0,J.jsxs)(`div`,{className:`my-3 space-y-1 text-xs text-fg-secondary`,children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`Existing runtimes`}),a.runtimes.versions.map(e=>(0,J.jsxs)(`p`,{children:[e.version,`: `,e.running,` connected · `,e.starting,` starting ·`,` `,e.unavailable,` unavailable`]},`${e.version}-${e.protocol.major}-${e.protocol.minor}`))]}),!a.runtimes.complete&&(0,J.jsx)(`p`,{className:`my-2 text-xs text-warning`,children:`Runtime inventory is incomplete. Update review checks compatibility separately.`})]}),!i&&!e.isError&&(0,J.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:`Checking host updates…`}),e.isError&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-warning`,children:c?`Update this cockpit and reopen the window to manage host updates.`:`Host status is unavailable. The last observation may be out of date. Refresh status before another action.`}),i?.availability===`upgrade_required`&&(0,J.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`This daemon needs an upgrade before cockpit update controls are available.`}),i?.availability===`unavailable`&&(0,J.jsxs)(`p`,{role:`status`,className:`text-sm text-fg-secondary`,children:[i.observation===`recorded`?`The daemon is unavailable. Showing the update record from this host.`:`Waiting for the daemon to reconnect.`,` `,`No update action will be repeated.`]}),o&&(0,J.jsxs)(`div`,{className:`my-4 space-y-1 text-xs text-fg-secondary`,children:[(0,J.jsx)(`p`,{children:o.state===`unconfigured`?`No release source is configured on this host.`:o.state===`checking`?`Checking for releases…`:o.state===`failed`?`Release check failed. Showing the last known result.`:`Release check completed.`}),o.latest&&(0,J.jsxs)(`p`,{children:[`Latest known release: `,o.latest.version,!o.components&&!o.latest.host_asset&&` · No package available for this host`]}),o.components&&(0,J.jsxs)(`p`,{children:[`Latest daemon: `,o.components.daemon.version,!o.components.daemon.host_asset&&` (unavailable for this host)`,` · `,`Runtime: `,o.components.runtime.version,!o.components.runtime.host_asset&&` (unavailable for this host)`]}),o.succeeded_at!==null&&(0,J.jsxs)(`p`,{children:[`Last successful check: `,new Date(o.succeeded_at).toLocaleString()]})]}),s.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.map(e=>(0,J.jsxs)(z,{size:`sm`,disabled:l||Ce(i),onClick:()=>n.act({action:`prepare`,targets:[e]}),children:[`Prepare `,e.component===`daemon`?`daemon`:`runtime software`,` `,e.version]},e.component)),s.length>1&&(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:l||Ce(i),onClick:()=>n.act({action:`prepare`,targets:s}),children:`Prepare both`})]}),s.length>0&&(0,J.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:`Preparation downloads and verifies the release. Review its impact before applying.`}),n.busy&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-secondary`,children:n.variables?.action===`prepare`?`Preparing update…`:`Waiting for the host…`}),n.isError&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-warning`,children:`The response was lost or unavailable. Status is being checked; the action has not been repeated.`}),d&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-warning`,children:d.code===`conflict`?`The host changed since review. Refresh status and review again.`:`The host could not complete the request (${d.code}). Refresh status before another action.`}),i&&(0,J.jsx)(fr,{status:i,reply:n.data,disabled:l,offlineDisabled:n.busy||e.isError,act:n.act})]})}function mr({label:e,description:t,field:n,config:i,min:a,step:o=1}){let s=r();return(0,J.jsx)(Y,{label:e,description:t,htmlFor:`host-${n}`,children:(0,J.jsx)(I,{id:`host-${n}`,type:`number`,min:a,step:o,className:`w-32 tabular-nums`,defaultValue:i[n],onBlur:e=>{if(e.target.value.trim()===``){e.target.value=String(i[n]);return}let t=Number(e.target.value);Number.isFinite(t)&&t!==i[n]&&s.mutate({[n]:t},{onError:e=>K(e)})}})})}function hr(){let e=x(),t=r(),n=u(),i=te().data?.protocol,a=i&&(i.major>25||i.major===25&&i.minor>=6);return e.data?(0,J.jsxs)(`div`,{children:[(0,J.jsx)(pr,{}),(0,J.jsx)(X,{note:`Icon and accent are per profile and not synced; other settings affect all profiles.`,children:`Host`}),(0,J.jsx)(Y,{label:`Display name`,description:`Shown in place of the hostname across the UI. Leave blank for the hostname.`,htmlFor:`host-displayName`,children:(0,J.jsx)(I,{id:`host-displayName`,type:`text`,maxLength:64,className:`w-48`,placeholder:n.data?.hostname,defaultValue:e.data.displayName,onBlur:n=>{let r=n.target.value.trim();r!==e.data.displayName&&t.mutate({displayName:r},{onError:e=>K(e)})}})}),(0,J.jsx)(dr,{}),(0,J.jsx)(mr,{label:`Fetch interval (minutes)`,description:`Periodic git fetch for repos with active sessions.`,field:`fetchIntervalMinutes`,config:e.data,min:1}),(0,J.jsx)(mr,{label:`Log size cap (bytes)`,description:`Per-terminal on-disk log cap.`,field:`logMaxBytes`,config:e.data,min:65536,step:1048576}),a&&(0,J.jsx)(mr,{label:`Bulk log retention (days)`,description:`Older inactive terminal logs keep only their replay tail. Archived restoration and shell history are preserved. Set 0 to disable age-based cleanup.`,field:`logRetentionDays`,config:e.data,min:0}),(0,J.jsx)(mr,{label:`Replay size (bytes)`,description:`Log tail sent to a terminal on attach.`,field:`replayBytes`,config:e.data,min:1024,step:65536}),(0,J.jsx)(mr,{label:`UI-state retention (days)`,description:`Stale workspace snapshots are swept at boot.`,field:`uiStateRetentionDays`,config:e.data,min:1}),(0,J.jsx)(Y,{label:`Auto-resume`,description:`Resume interrupted sessions automatically after a daemon restart.`,htmlFor:`host-autoResume`,children:(0,J.jsx)(B,{id:`host-autoResume`,checked:e.data.autoResume,onCheckedChange:e=>t.mutate({autoResume:e},{onError:e=>K(e)})})})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(dr,{}),(0,J.jsx)(pr,{})]})}var gr=[{id:`appearance`,label:`Appearance`,icon:bt,render:()=>(0,J.jsx)(Bt,{})},{id:`profile`,label:`Profile`,icon:mt,render:()=>(0,J.jsx)(Ut,{})},{id:`accounts`,label:`Accounts`,icon:Rt,render:()=>(0,J.jsx)(Kt,{})},{id:`sessions`,label:`Sessions`,icon:Lt,render:()=>(0,J.jsx)($t,{})},{id:`editor`,label:`Editor`,icon:xt,render:()=>(0,J.jsx)(sn,{})},{id:`hotkeys`,label:`Hotkeys`,icon:Pt,render:()=>(0,J.jsx)(ln,{})},{id:`notifications`,label:`Notifications`,icon:Nt,render:()=>(0,J.jsx)(rn,{})},{id:`projects`,label:`Projects`,icon:ve,render:()=>(0,J.jsx)(ur,{})},{id:`host`,label:`Host`,icon:Me,render:()=>(0,J.jsx)(hr,{})},{id:`remote-sync`,label:`Remote & Sync`,icon:gt,render:()=>(0,J.jsx)(cr,{})}],_r={terminal:`sessions`,repositories:`projects`,remote:`remote-sync`,sync:`remote-sync`};function vr(){let e=pt(),t=e===null?null:_r[e]??e,n=gr.find(e=>e.id===t)??gr[0];return(0,J.jsx)(F,{open:e!==null,onOpenChange:e=>!e&&yt(),children:(0,J.jsxs)(N,{wide:!0,surface:!1,showCloseButton:!1,className:`grid h-[34rem] grid-cols-[14rem_minmax(0,1fr)] items-start gap-[var(--ui-surface-gap)] overflow-visible p-0`,children:[(0,J.jsx)(`nav`,{className:`max-h-full min-h-0 overflow-y-auto rounded-[var(--ui-surface-radius)] shadow-2xl`,children:(0,J.jsxs)(Ct,{label:`Settings sections`,variant:`selection`,vertical:!0,className:`settings-navigation`,children:[(0,J.jsxs)(`div`,{className:`flex w-full items-center justify-between px-2.5 py-1.5`,children:[(0,J.jsx)(P,{className:`text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`Settings`}),(0,J.jsxs)(st,{className:`flex items-center rounded-md p-1.5 text-fg transition-colors hover:bg-ground`,children:[(0,J.jsx)(lt,{className:`size-4`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]}),gr.map(({id:e,label:t,icon:r})=>(0,J.jsxs)(`button`,{type:`button`,"data-tray-slot":!0,"aria-current":e===n.id?`page`:void 0,onClick:()=>ht(e),className:`text-left text-sm transition-colors`,children:[(0,J.jsx)(r,{className:`size-4 shrink-0`}),t]},e))]})}),(0,J.jsx)(`div`,{className:`island-outline h-full min-h-0 overflow-y-auto rounded-[var(--ui-surface-radius)] bg-surface p-5 shadow-2xl`,children:n.render()})]})})}export{vr as SettingsDialog};
|