@puddle-code/cli 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -3
- package/dist/index.js +3 -2
- package/dist/public/assets/App-D-hMqX7b.js +13 -0
- package/dist/public/assets/{CompilationCommandForm-ByQ3n2Av.js → CompilationCommandForm-Csg3VkC6.js} +1 -1
- package/dist/public/assets/{Dashboard-DXufaZFW.js → Dashboard-C0AvtM5m.js} +1 -1
- package/dist/public/assets/EditorTabClose-QgdaqA1X.js +1 -0
- package/dist/public/assets/{LazyTerminal-CQNsHnn5.js → LazyTerminal-Dp2CN0Y8.js} +2 -2
- package/dist/public/assets/{ModelRefcount-CrRz4dBj.js → ModelRefcount-CHKuXiJY.js} +1 -1
- package/dist/public/assets/{NewProjectDialog-CRoDFgh9.js → NewProjectDialog-DMixZDC_.js} +1 -1
- package/dist/public/assets/{NotebookWidget-D_cBVZys.js → NotebookWidget-CCRsiBIE.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-_H5u21rG.js → PaneEditorBody-DD8UshBi.js} +4 -4
- package/dist/public/assets/{PdfViewer-CvbL21Y7.js → PdfViewer-BX025YLW.js} +1 -1
- package/dist/public/assets/{ReleaseNotesDialog-WjdHjwjo.js → ReleaseNotesDialog-CbFYKoYM.js} +1 -1
- package/dist/public/assets/{SettingsDialog-CiDPg9PP.js → SettingsDialog-DgMm212x.js} +1 -1
- package/dist/public/assets/{Terminal-kGAX-Lcx.js → Terminal-CYeh8_uU.js} +3 -3
- package/dist/public/assets/Workspace-Bf0VMnaa.css +1 -0
- package/dist/public/assets/Workspace-CrZkK55U.js +20 -0
- package/dist/public/assets/{buffer-store-BvfE0iGv.js → buffer-store-DIOiWz9q.js} +1 -1
- package/dist/public/assets/button-C_Rvtcwg.js +1 -0
- package/dist/public/assets/{chevron-right-nSpC9bNN.js → chevron-right-BEy-IXEZ.js} +1 -1
- package/dist/public/assets/{command-CrnEVrrI.js → command-BV8ZEhQz.js} +1 -1
- package/dist/public/assets/context-menu-D3ZhKA9s.js +1 -0
- package/dist/public/assets/control-tray-CdoVaVhT.js +1 -0
- package/dist/public/assets/control-tray-DE2RhHP3.css +1 -0
- package/dist/public/assets/dialog-BX0tebJL.css +1 -0
- package/dist/public/assets/{dialog-BIriom7c.js → dialog-D-Axqpzg.js} +1 -1
- package/dist/public/assets/dist-BmSuHjIq.js +1 -0
- package/dist/public/assets/{dist-gLwIpKj2.js → dist-Cq-O0n8n.js} +1 -1
- package/dist/public/assets/{dist-DsLo0ckR.js → dist-Dge3wHdO.js} +1 -1
- package/dist/public/assets/{index-Nd31gVbt.js → index-BqOVeoIr.js} +2 -2
- package/dist/public/assets/index-LpAqnBR3.css +2 -0
- package/dist/public/assets/{markdown-mermaid-ByeNUiyP.js → markdown-mermaid-SyDYdSZz.js} +1 -1
- package/dist/public/assets/media-refresh-store-NSkvkBxN.js +1 -0
- package/dist/public/assets/{notification-delivery-BrgeSks8.js → notification-delivery-BBt_CJ19.js} +1 -1
- package/dist/public/assets/popover-D-jcaKGN.js +1 -0
- package/dist/public/assets/select-p5KTVHbg.js +1 -0
- package/dist/public/assets/{selection-actions-2STnRxD9.js → selection-actions-Cm0Oytya.js} +1 -1
- package/dist/public/assets/{switch-B1LYyDZA.js → switch-OMx-_DY7.js} +1 -1
- package/dist/public/assets/use-ui-state-DdnTFosh.js +1 -0
- package/dist/public/index.html +2 -2
- package/package.json +1 -1
- package/dist/public/assets/App-CiC_hRBz.js +0 -7
- package/dist/public/assets/EditorTabClose-dEi1apPb.js +0 -1
- package/dist/public/assets/Workspace-D8fTPYJv.js +0 -20
- package/dist/public/assets/Workspace-fmUH5XvW.css +0 -1
- package/dist/public/assets/button-q0ardkfx.js +0 -1
- package/dist/public/assets/context-menu-BaamZoTk.js +0 -1
- package/dist/public/assets/control-tray-CHewYBoS.css +0 -1
- package/dist/public/assets/control-tray-D6zVSZF4.js +0 -1
- package/dist/public/assets/dialog-BYIi-VQq.css +0 -1
- package/dist/public/assets/dist-t7ZlsY9S.js +0 -1
- package/dist/public/assets/index-DAZZvnBz.css +0 -2
- package/dist/public/assets/media-refresh-store-1wdl12UC.js +0 -1
- package/dist/public/assets/popover-ChiZqTsE.js +0 -1
- package/dist/public/assets/select-4yfFmU4K.js +0 -1
- package/dist/public/assets/use-ui-state-Bi73JKcr.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-EQHMWEbX.js","assets/preload-helper-Czpn1I53.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{M as n}from"./auth-olLlgxc3.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{n as a}from"./api-BOuyloUi.js";import{n as o}from"./dist-BOS6OKSE.js";import{t as s}from"./createLucideIcon-C9A1vLE-.js";import{t as c}from"./control-tray-D6zVSZF4.js";import{r as l,t as u}from"./view-state-store-Cy9sQJoZ.js";import{t as d}from"./scroll-restoration-CwXbvZvT.js";var f=s(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),p=s(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),m=e(t(),1),h=r();function g({page:e,scale:t}){let n=(0,m.useRef)(null),r=(0,m.useRef)(null),a=(0,m.useRef)(t);return a.current=t,(0,m.useLayoutEffect)(()=>{r.current?.update({viewport:e.getViewport({scale:t})})},[e,t]),(0,m.useEffect)(()=>{let t=n.current;if(!t)return;let o=!1,s=null;return i(async()=>{let{TextLayer:e}=await import(`./pdf-EQHMWEbX.js`);return{TextLayer:e}},__vite__mapDeps([0,1])).then(async({TextLayer:n})=>{o||(s=new n({textContentSource:e.streamTextContent(),container:t,viewport:e.getViewport({scale:a.current})}),await s.render(),!o&&(s.update({viewport:e.getViewport({scale:a.current})}),r.current=s))}).catch(e=>{o||(t.replaceChildren(),console.warn(`Couldn’t render PDF text`,e))}),()=>{o=!0,s?.cancel(),r.current=null,t.replaceChildren()}},[e]),(0,h.jsx)(`div`,{ref:n,className:`pdf-text-layer`,style:{"--total-scale-factor":t*e.userUnit}})}function _(e,t){let n=e.getBoundingClientRect(),r=t?.clientX??n.left+e.clientWidth/2,i=t?.clientY??n.top+e.clientHeight/2,a=null,o=1/0;for(let t of e.querySelectorAll(`[data-pdf-page]`)){let e=t.getBoundingClientRect(),n=Math.max(e.top-i,i-e.bottom,0);n<o&&(a=t,o=n)}if(!a)return null;let s=a.getBoundingClientRect();return!s.width||!s.height?null:{page:a,clientX:r,clientY:i,x:(r-s.left)/s.width,y:(i-s.top)/s.height}}function v(e,t){if(!e.contains(t.page))return;let n=t.page.getBoundingClientRect();e.scrollLeft+=n.left+t.x*n.width-t.clientX,e.scrollTop+=n.top+t.y*n.height-t.clientY}var y=[.5,.75,1,1.25,1.5,2,3],b=y[0],x=y.at(-1);function S(e){return k(e,b,x)}function C(e,t){return S(e*Math.exp(-t*.01))}function w(e,t,n){return S(t<=0||n<=0?e:n/t*e)}function T(e){let t=Math.round(S(e)*1e3)/10;return`${Number.isInteger(t)?t.toFixed(0):t.toFixed(1)}%`}function E(e,t){return t===`in`?y.find(t=>t>e+2**-52)??y.at(-1):[...y].reverse().find(t=>t<e-2**-52)??y[0]}function D(e,t,n,r=12e6){let i=Math.max(1,Math.min(n||1,2.5)),a=e*t;return a<=0||r<=0?1:Math.max(.25,Math.min(i,Math.sqrt(r/a)))}function O(e,t,n,r,i){if(n.width<=0||n.height<=0||r<=0||i<=0)return null;let a=k(e-n.left,0,n.width),o=k(t-n.top,0,n.height);return{x:a/n.width*r,y:o/n.height*i}}function k(e,t,n){return Math.min(n,Math.max(t,e))}var A=null,j=new u;function M({blob:e,session:t,path:r,root:i,onRevealSource:s,onDownload:c}){let u=l(`pdf`,[t,i,r]),f=(0,m.useRef)(null),p=(0,m.useRef)(null),g=(0,m.useRef)(null),y=(0,m.useRef)(null),[T,D]=(0,m.useState)(()=>j.get(u)??1),O=(0,m.useRef)(T),k=(0,m.useRef)(!1),[A,M]=(0,m.useState)(null),[R,U]=(0,m.useState)(!1),W=z(f);(0,m.useLayoutEffect)(()=>{let e=f.current,t=p.current;if(!e||!t||!A)return;let n=d(e,t,u,()=>t.isConnected&&!k.current&&t.querySelectorAll(`[data-scroll-ready="true"]`).length===A.numPages);return g.current=n,()=>{n.dispose(),g.current=null}},[A,u,W!==null]),(0,m.useLayoutEffect)(()=>{let e=f.current,t=y.current;e&&t&&v(e,t),y.current=null,k.current=!1,t&&g.current?.capture()},[T]);let G=(0,m.useCallback)((e,t)=>{let n=S(e);if(Math.abs(n-O.current)<2**-52)return;let r=f.current;y.current=r?_(r,t):null,O.current=n,j.set(u,n),k.current=!0,D(n)},[u]);(0,m.useEffect)(()=>{let e=f.current;if(!e)return;let t=null,n=t=>{if(!t.ctrlKey)return;t.preventDefault();let n=P(t,e.clientHeight);G(C(O.current,n),t)},r=e=>{if(e.touches.length!==2){t=null;return}t={distance:F(e.touches),zoom:O.current}},i=e=>{!t||e.touches.length!==2||(e.preventDefault(),G(w(t.zoom,t.distance,F(e.touches)),I(e.touches)))},a=e=>{e.touches.length<2&&(t=null)};return e.addEventListener(`wheel`,n,{passive:!1}),e.addEventListener(`touchstart`,r,{passive:!0}),e.addEventListener(`touchmove`,i,{passive:!1}),e.addEventListener(`touchend`,a,{passive:!0}),e.addEventListener(`touchcancel`,a,{passive:!0}),()=>{e.removeEventListener(`wheel`,n),e.removeEventListener(`touchstart`,r),e.removeEventListener(`touchmove`,i),e.removeEventListener(`touchend`,a),e.removeEventListener(`touchcancel`,a)}},[G]),(0,m.useEffect)(()=>{let t=!1,n=null,r=null;return M(null),U(!1),Promise.all([H(),e.arrayBuffer()]).then(([e,r])=>t?null:(n=e.getDocument({data:r}),n.promise)).then(e=>{if(e){if(r=e,t){n?.destroy();return}M(e)}}).catch(e=>{!t&&!V(e)&&U(!0)}),()=>{t=!0,M(null),r&&r.cleanup(),n&&n.destroy()}},[e]);let K=(0,m.useCallback)(async(e,c,l)=>{if(s)try{let o=await a(`POST`,`/api/latex/synctex`,{session:t,path:r,root:i,page:e,x:c,y:l});s(n.parse(o))}catch(e){o.error(e instanceof Error?e.message:`Couldn’t locate the TeX source`)}},[s,r,i,t]);return R?(0,h.jsxs)(B,{children:[(0,h.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Couldn’t display this PDF.`}),c&&(0,h.jsx)(`button`,{type:`button`,onClick:c,className:`rounded-md bg-elevated px-3 py-1.5 text-sm text-fg transition-colors hover:bg-border/70`,children:`Download`})]}):(0,h.jsxs)(`div`,{className:`relative h-full w-full bg-ground`,children:[(0,h.jsx)(`div`,{ref:f,role:`region`,"aria-label":`PDF document`,className:`h-full w-full overflow-auto`,children:!A||W===null?(0,h.jsx)(B,{children:(0,h.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Loading PDF…`})}):(0,h.jsx)(`div`,{ref:p,className:`flex min-h-full w-max min-w-full flex-col items-center gap-4 p-4`,children:Array.from({length:A.numPages},(e,t)=>(0,h.jsx)(L,{document:A,pageNumber:t+1,availableWidth:W*T,scrollRoot:f.current,inverseSearch:s?K:void 0},t+1))})}),A&&W!==null&&(0,h.jsx)(N,{zoom:T,minimum:b,maximum:x,onZoomOut:()=>G(E(T,`out`)),onReset:()=>G(1),onZoomIn:()=>G(E(T,`in`))})]})}function N({zoom:e,minimum:t,maximum:n,onZoomOut:r,onReset:i,onZoomIn:a}){let o=T(e);return(0,h.jsxs)(c,{variant:`overlay`,label:`PDF zoom`,className:`absolute right-3 top-3 z-10 shadow-sm`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:e<=t,onClick:r,className:`cursor-pointer rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-default disabled:opacity-40`,"aria-label":`Zoom out`,title:`Zoom out`,children:(0,h.jsx)(p,{className:`size-3.5`})}),(0,h.jsx)(`button`,{type:`button`,onClick:i,className:`min-w-12 cursor-pointer rounded-sm px-1.5 py-1 font-mono text-[11px] tabular-nums text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,"aria-label":`Zoom ${o}; reset to fit width`,title:`Reset to fit width`,children:o}),(0,h.jsx)(`button`,{type:`button`,disabled:e>=n,onClick:a,className:`cursor-pointer rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-default disabled:opacity-40`,"aria-label":`Zoom in`,title:`Zoom in`,children:(0,h.jsx)(f,{className:`size-3.5`})})]})}function P(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t:e.deltaY}function F(e){let t=e.item(0),n=e.item(1);return!t||!n?0:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}function I(e){let t=e.item(0),n=e.item(1);if(!(!t||!n))return{clientX:(t.clientX+n.clientX)/2,clientY:(t.clientY+n.clientY)/2}}function L({document:e,pageNumber:t,availableWidth:n,scrollRoot:r,inverseSearch:i}){let a=(0,m.useRef)(null),o=(0,m.useRef)(null),s=(0,m.useRef)(null),[c,l]=(0,m.useState)(null),[u,d]=(0,m.useState)(null),[f,p]=(0,m.useState)(!1),_=R(a,r,t<=2);(0,m.useEffect)(()=>{let n=!1,r=null;return l(null),d(null),p(!1),e.getPage(t).then(e=>{if(r=e,n){e.cleanup();return}let t=e.getViewport({scale:1});d({width:t.width,height:t.height}),l(e)}).catch(e=>{!n&&!V(e)&&p(!0)}),()=>{n=!0,s.current?.cancel(),s.current=null,r?.cleanup()}},[e,t]),(0,m.useEffect)(()=>{let e=o.current;if(!e||!c||!u||!_)return;let t=n/u.width,r=c.getViewport({scale:t}),i=D(r.width,r.height,window.devicePixelRatio||1),a=c.getViewport({scale:t*i});s.current?.cancel(),e.width=Math.max(1,Math.floor(a.width)),e.height=Math.max(1,Math.floor(a.height)),e.style.width=`${r.width}px`,e.style.height=`${r.height}px`;let l=c.render({canvas:e,viewport:a});return s.current=l,l.promise.catch(e=>{V(e)||p(!0)}).finally(()=>{s.current===l&&(s.current=null)}),()=>{l.cancel(),s.current===l&&(s.current=null)}},[n,c,u,_]);let v=e=>{if(!e.metaKey&&!e.ctrlKey||!i||!u)return;let n=O(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),u.width,u.height);n&&(e.preventDefault(),i(t,n.x,n.y))};if(f)return(0,h.jsxs)(`p`,{"data-scroll-ready":`true`,className:`py-8 text-xs text-fg-muted`,children:[`Couldn’t render page `,t,`.`]});let y=Math.round(u?n/u.width*u.height:n*1.3);return(0,h.jsxs)(`div`,{ref:a,"data-scroll-ready":u!==null,"data-pdf-page":t,className:`relative shrink-0 bg-elevated shadow-sm`,style:{width:n,height:y},"aria-label":`PDF page ${t}`,onClick:v,title:i?`Command-click to open the corresponding TeX source`:void 0,children:[(0,h.jsx)(`canvas`,{ref:o,className:`block`}),c&&u&&_&&(0,h.jsx)(g,{page:c,scale:n/u.width})]})}function R(e,t,n){let[r,i]=(0,m.useState)(n);return(0,m.useEffect)(()=>{if(r)return;let n=e.current;if(!n)return;let a=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(i(!0),a.disconnect())},{root:t,rootMargin:`100% 0px`});return a.observe(n),()=>a.disconnect()},[r,e,t]),r}function z(e){let[t,n]=(0,m.useState)(null);return(0,m.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=0,i=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(()=>{t.clientWidth>32&&n(t.clientWidth-32)})};i();let a=new ResizeObserver(i);return a.observe(t),()=>{cancelAnimationFrame(r),a.disconnect()}},[e]),t}function B({children:e}){return(0,h.jsx)(`div`,{className:`flex h-full min-h-32 w-full flex-col items-center justify-center gap-3 p-4`,children:e})}function V(e){return e instanceof Error&&(e.name===`RenderingCancelledException`||e.name===`AbortException`)}async function H(){return A??=Promise.all([i(()=>import(`./pdf-EQHMWEbX.js`),__vite__mapDeps([0,1])),i(()=>import(`./pdf.worker.min-C8Ts8bNu.js`),[])]).then(([e,t])=>(e.GlobalWorkerOptions.workerSrc=t.default,e)).catch(e=>{throw A=null,e}),A}export{M as PdfViewer};
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{M as n}from"./auth-olLlgxc3.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{n as a}from"./api-BOuyloUi.js";import{n as o}from"./dist-BOS6OKSE.js";import{t as s}from"./createLucideIcon-C9A1vLE-.js";import{t as c}from"./control-tray-CdoVaVhT.js";import{r as l,t as u}from"./view-state-store-Cy9sQJoZ.js";import{t as d}from"./scroll-restoration-CwXbvZvT.js";var f=s(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),p=s(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),m=e(t(),1),h=r();function g({page:e,scale:t}){let n=(0,m.useRef)(null),r=(0,m.useRef)(null),a=(0,m.useRef)(t);return a.current=t,(0,m.useLayoutEffect)(()=>{r.current?.update({viewport:e.getViewport({scale:t})})},[e,t]),(0,m.useEffect)(()=>{let t=n.current;if(!t)return;let o=!1,s=null;return i(async()=>{let{TextLayer:e}=await import(`./pdf-EQHMWEbX.js`);return{TextLayer:e}},__vite__mapDeps([0,1])).then(async({TextLayer:n})=>{o||(s=new n({textContentSource:e.streamTextContent(),container:t,viewport:e.getViewport({scale:a.current})}),await s.render(),!o&&(s.update({viewport:e.getViewport({scale:a.current})}),r.current=s))}).catch(e=>{o||(t.replaceChildren(),console.warn(`Couldn’t render PDF text`,e))}),()=>{o=!0,s?.cancel(),r.current=null,t.replaceChildren()}},[e]),(0,h.jsx)(`div`,{ref:n,className:`pdf-text-layer`,style:{"--total-scale-factor":t*e.userUnit}})}function _(e,t){let n=e.getBoundingClientRect(),r=t?.clientX??n.left+e.clientWidth/2,i=t?.clientY??n.top+e.clientHeight/2,a=null,o=1/0;for(let t of e.querySelectorAll(`[data-pdf-page]`)){let e=t.getBoundingClientRect(),n=Math.max(e.top-i,i-e.bottom,0);n<o&&(a=t,o=n)}if(!a)return null;let s=a.getBoundingClientRect();return!s.width||!s.height?null:{page:a,clientX:r,clientY:i,x:(r-s.left)/s.width,y:(i-s.top)/s.height}}function v(e,t){if(!e.contains(t.page))return;let n=t.page.getBoundingClientRect();e.scrollLeft+=n.left+t.x*n.width-t.clientX,e.scrollTop+=n.top+t.y*n.height-t.clientY}var y=[.5,.75,1,1.25,1.5,2,3],b=y[0],x=y.at(-1);function S(e){return k(e,b,x)}function C(e,t){return S(e*Math.exp(-t*.01))}function w(e,t,n){return S(t<=0||n<=0?e:n/t*e)}function T(e){let t=Math.round(S(e)*1e3)/10;return`${Number.isInteger(t)?t.toFixed(0):t.toFixed(1)}%`}function E(e,t){return t===`in`?y.find(t=>t>e+2**-52)??y.at(-1):[...y].reverse().find(t=>t<e-2**-52)??y[0]}function D(e,t,n,r=12e6){let i=Math.max(1,Math.min(n||1,2.5)),a=e*t;return a<=0||r<=0?1:Math.max(.25,Math.min(i,Math.sqrt(r/a)))}function O(e,t,n,r,i){if(n.width<=0||n.height<=0||r<=0||i<=0)return null;let a=k(e-n.left,0,n.width),o=k(t-n.top,0,n.height);return{x:a/n.width*r,y:o/n.height*i}}function k(e,t,n){return Math.min(n,Math.max(t,e))}var A=null,j=new u;function M({blob:e,session:t,path:r,root:i,onRevealSource:s,onDownload:c}){let u=l(`pdf`,[t,i,r]),f=(0,m.useRef)(null),p=(0,m.useRef)(null),g=(0,m.useRef)(null),y=(0,m.useRef)(null),[T,D]=(0,m.useState)(()=>j.get(u)??1),O=(0,m.useRef)(T),k=(0,m.useRef)(!1),[A,M]=(0,m.useState)(null),[R,U]=(0,m.useState)(!1),W=z(f);(0,m.useLayoutEffect)(()=>{let e=f.current,t=p.current;if(!e||!t||!A)return;let n=d(e,t,u,()=>t.isConnected&&!k.current&&t.querySelectorAll(`[data-scroll-ready="true"]`).length===A.numPages);return g.current=n,()=>{n.dispose(),g.current=null}},[A,u,W!==null]),(0,m.useLayoutEffect)(()=>{let e=f.current,t=y.current;e&&t&&v(e,t),y.current=null,k.current=!1,t&&g.current?.capture()},[T]);let G=(0,m.useCallback)((e,t)=>{let n=S(e);if(Math.abs(n-O.current)<2**-52)return;let r=f.current;y.current=r?_(r,t):null,O.current=n,j.set(u,n),k.current=!0,D(n)},[u]);(0,m.useEffect)(()=>{let e=f.current;if(!e)return;let t=null,n=t=>{if(!t.ctrlKey)return;t.preventDefault();let n=P(t,e.clientHeight);G(C(O.current,n),t)},r=e=>{if(e.touches.length!==2){t=null;return}t={distance:F(e.touches),zoom:O.current}},i=e=>{!t||e.touches.length!==2||(e.preventDefault(),G(w(t.zoom,t.distance,F(e.touches)),I(e.touches)))},a=e=>{e.touches.length<2&&(t=null)};return e.addEventListener(`wheel`,n,{passive:!1}),e.addEventListener(`touchstart`,r,{passive:!0}),e.addEventListener(`touchmove`,i,{passive:!1}),e.addEventListener(`touchend`,a,{passive:!0}),e.addEventListener(`touchcancel`,a,{passive:!0}),()=>{e.removeEventListener(`wheel`,n),e.removeEventListener(`touchstart`,r),e.removeEventListener(`touchmove`,i),e.removeEventListener(`touchend`,a),e.removeEventListener(`touchcancel`,a)}},[G]),(0,m.useEffect)(()=>{let t=!1,n=null,r=null;return M(null),U(!1),Promise.all([H(),e.arrayBuffer()]).then(([e,r])=>t?null:(n=e.getDocument({data:r}),n.promise)).then(e=>{if(e){if(r=e,t){n?.destroy();return}M(e)}}).catch(e=>{!t&&!V(e)&&U(!0)}),()=>{t=!0,M(null),r&&r.cleanup(),n&&n.destroy()}},[e]);let K=(0,m.useCallback)(async(e,c,l)=>{if(s)try{let o=await a(`POST`,`/api/latex/synctex`,{session:t,path:r,root:i,page:e,x:c,y:l});s(n.parse(o))}catch(e){o.error(e instanceof Error?e.message:`Couldn’t locate the TeX source`)}},[s,r,i,t]);return R?(0,h.jsxs)(B,{children:[(0,h.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Couldn’t display this PDF.`}),c&&(0,h.jsx)(`button`,{type:`button`,onClick:c,className:`rounded-md bg-elevated px-3 py-1.5 text-sm text-fg transition-colors hover:bg-border/70`,children:`Download`})]}):(0,h.jsxs)(`div`,{className:`relative h-full w-full bg-ground`,children:[(0,h.jsx)(`div`,{ref:f,role:`region`,"aria-label":`PDF document`,className:`h-full w-full overflow-auto`,children:!A||W===null?(0,h.jsx)(B,{children:(0,h.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Loading PDF…`})}):(0,h.jsx)(`div`,{ref:p,className:`flex min-h-full w-max min-w-full flex-col items-center gap-4 p-4`,children:Array.from({length:A.numPages},(e,t)=>(0,h.jsx)(L,{document:A,pageNumber:t+1,availableWidth:W*T,scrollRoot:f.current,inverseSearch:s?K:void 0},t+1))})}),A&&W!==null&&(0,h.jsx)(N,{zoom:T,minimum:b,maximum:x,onZoomOut:()=>G(E(T,`out`)),onReset:()=>G(1),onZoomIn:()=>G(E(T,`in`))})]})}function N({zoom:e,minimum:t,maximum:n,onZoomOut:r,onReset:i,onZoomIn:a}){let o=T(e);return(0,h.jsxs)(c,{variant:`overlay`,label:`PDF zoom`,className:`absolute right-3 top-3 z-10 shadow-sm`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:e<=t,onClick:r,className:`cursor-pointer rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-default disabled:opacity-40`,"aria-label":`Zoom out`,title:`Zoom out`,children:(0,h.jsx)(p,{className:`size-3.5`})}),(0,h.jsx)(`button`,{type:`button`,onClick:i,className:`min-w-12 cursor-pointer rounded-sm px-1.5 py-1 font-mono text-[11px] tabular-nums text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,"aria-label":`Zoom ${o}; reset to fit width`,title:`Reset to fit width`,children:o}),(0,h.jsx)(`button`,{type:`button`,disabled:e>=n,onClick:a,className:`cursor-pointer rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-default disabled:opacity-40`,"aria-label":`Zoom in`,title:`Zoom in`,children:(0,h.jsx)(f,{className:`size-3.5`})})]})}function P(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t:e.deltaY}function F(e){let t=e.item(0),n=e.item(1);return!t||!n?0:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}function I(e){let t=e.item(0),n=e.item(1);if(!(!t||!n))return{clientX:(t.clientX+n.clientX)/2,clientY:(t.clientY+n.clientY)/2}}function L({document:e,pageNumber:t,availableWidth:n,scrollRoot:r,inverseSearch:i}){let a=(0,m.useRef)(null),o=(0,m.useRef)(null),s=(0,m.useRef)(null),[c,l]=(0,m.useState)(null),[u,d]=(0,m.useState)(null),[f,p]=(0,m.useState)(!1),_=R(a,r,t<=2);(0,m.useEffect)(()=>{let n=!1,r=null;return l(null),d(null),p(!1),e.getPage(t).then(e=>{if(r=e,n){e.cleanup();return}let t=e.getViewport({scale:1});d({width:t.width,height:t.height}),l(e)}).catch(e=>{!n&&!V(e)&&p(!0)}),()=>{n=!0,s.current?.cancel(),s.current=null,r?.cleanup()}},[e,t]),(0,m.useEffect)(()=>{let e=o.current;if(!e||!c||!u||!_)return;let t=n/u.width,r=c.getViewport({scale:t}),i=D(r.width,r.height,window.devicePixelRatio||1),a=c.getViewport({scale:t*i});s.current?.cancel(),e.width=Math.max(1,Math.floor(a.width)),e.height=Math.max(1,Math.floor(a.height)),e.style.width=`${r.width}px`,e.style.height=`${r.height}px`;let l=c.render({canvas:e,viewport:a});return s.current=l,l.promise.catch(e=>{V(e)||p(!0)}).finally(()=>{s.current===l&&(s.current=null)}),()=>{l.cancel(),s.current===l&&(s.current=null)}},[n,c,u,_]);let v=e=>{if(!e.metaKey&&!e.ctrlKey||!i||!u)return;let n=O(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect(),u.width,u.height);n&&(e.preventDefault(),i(t,n.x,n.y))};if(f)return(0,h.jsxs)(`p`,{"data-scroll-ready":`true`,className:`py-8 text-xs text-fg-muted`,children:[`Couldn’t render page `,t,`.`]});let y=Math.round(u?n/u.width*u.height:n*1.3);return(0,h.jsxs)(`div`,{ref:a,"data-scroll-ready":u!==null,"data-pdf-page":t,className:`relative shrink-0 bg-elevated shadow-sm`,style:{width:n,height:y},"aria-label":`PDF page ${t}`,onClick:v,title:i?`Command-click to open the corresponding TeX source`:void 0,children:[(0,h.jsx)(`canvas`,{ref:o,className:`block`}),c&&u&&_&&(0,h.jsx)(g,{page:c,scale:n/u.width})]})}function R(e,t,n){let[r,i]=(0,m.useState)(n);return(0,m.useEffect)(()=>{if(r)return;let n=e.current;if(!n)return;let a=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(i(!0),a.disconnect())},{root:t,rootMargin:`100% 0px`});return a.observe(n),()=>a.disconnect()},[r,e,t]),r}function z(e){let[t,n]=(0,m.useState)(null);return(0,m.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=0,i=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(()=>{t.clientWidth>32&&n(t.clientWidth-32)})};i();let a=new ResizeObserver(i);return a.observe(t),()=>{cancelAnimationFrame(r),a.disconnect()}},[e]),t}function B({children:e}){return(0,h.jsx)(`div`,{className:`flex h-full min-h-32 w-full flex-col items-center justify-center gap-3 p-4`,children:e})}function V(e){return e instanceof Error&&(e.name===`RenderingCancelledException`||e.name===`AbortException`)}async function H(){return A??=Promise.all([i(()=>import(`./pdf-EQHMWEbX.js`),__vite__mapDeps([0,1])),i(()=>import(`./pdf.worker.min-C8Ts8bNu.js`),[])]).then(([e,t])=>(e.GlobalWorkerOptions.workerSrc=t.default,e)).catch(e=>{throw A=null,e}),A}export{M as PdfViewer};
|
package/dist/public/assets/{ReleaseNotesDialog-WjdHjwjo.js → ReleaseNotesDialog-CbFYKoYM.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{t as r}from"./purify.es-D8QhFVkO.js";import{i,o as a,r as o,s,t as c}from"./dialog-
|
|
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"./purify.es-D8QhFVkO.js";import{i,o as a,r as o,s,t as c}from"./dialog-D-Axqpzg.js";import{a as l,i as u,n as d}from"./queue-BlrQxHDl.js";import{t as f}from"./markdown-CMSzQtLp.js";var p=e(t(),1),m=n();function h({markdown:e}){let t=(0,p.useId)().replace(/[^A-Za-z0-9_-]/g,``),n=(0,p.useMemo)(()=>{let n=r.sanitize(f(e,t),{RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0},FORBID_TAGS:[`img`,`video`,`audio`,`source`,`iframe`,`object`,`embed`,`style`,`form`],FORBID_ATTR:[`style`,`src`,`srcset`,`poster`,`action`]});for(let e of n.querySelectorAll(`a`)){let t=e.getAttribute(`href`)??``;/^https?:\/\//i.test(t)?(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):t.startsWith(`#`)||e.removeAttribute(`href`)}let i=document.createElement(`div`);return i.append(n),{__html:i.innerHTML}},[e,t]);return(0,m.jsx)(`div`,{className:`md-preview text-sm text-fg-secondary`,onClick:e=>{let t=e.target.closest(`a`)?.getAttribute(`href`);if(t?.startsWith(`#`)){e.preventDefault();try{e.currentTarget.closest(`[role="dialog"]`)?.querySelector(`#${CSS.escape(decodeURIComponent(t.slice(1)))}`)?.scrollIntoView({block:`nearest`})}catch{}}},dangerouslySetInnerHTML:n})}function g(){let[e,t]=(0,p.useState)(!1);return(0,p.useLayoutEffect)(()=>{let e=()=>{let e=Array.from(document.querySelectorAll(`[role="dialog"], [role="alertdialog"], dialog[open]`)).some(e=>!e.hasAttribute(`data-release-notes`)&&!e.hidden&&e.getAttribute(`data-state`)!==`closed`);t(!e)},n=new MutationObserver(e);return n.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`,`hidden`,`open`,`role`]}),e(),()=>n.disconnect()},[]),e}function _({group:e}){return(0,p.useEffect)(()=>d.presented(e),[e]),null}function v({current:e}){let t=g(),n=l.flatMap(t=>{let n=e.entries.find(e=>e.component===t);return n?[n]:[]});return t?(0,m.jsx)(c,{open:!0,onOpenChange:t=>{t||d.dismiss(e)},children:(0,m.jsxs)(o,{wide:!0,className:`gap-6`,"data-release-notes":``,children:[(0,m.jsx)(_,{group:e}),(0,m.jsxs)(a,{children:[(0,m.jsxs)(s,{children:[`What’s new in `,e.version]}),(0,m.jsxs)(i,{children:[n.map(e=>u[e.component]).join(` · `),` release notes`]})]}),(0,m.jsx)(`nav`,{"aria-label":`Release note sections`,className:`flex flex-wrap gap-x-5 gap-y-2 text-sm`,children:n.map(e=>(0,m.jsx)(`a`,{className:`text-fg-muted hover:text-fg`,href:`#${e.component}`,onClick:t=>{t.preventDefault(),t.currentTarget.closest(`[role="dialog"]`)?.querySelector(`#${e.component}`)?.scrollIntoView({block:`nearest`})},children:u[e.component]},e.component))}),n.map(e=>(0,m.jsx)(`section`,{id:e.component,"aria-label":u[e.component],children:(0,m.jsx)(h,{markdown:e.markdown})},e.component))]})}):null}export{v as ReleaseNotesDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{A as r,E as i,G as a,H as o,I as s,Q as c,R as l,St as u,T as d,Tt as f,W as p,Y as m,Z as h,at as g,c as _,ct as v,et as y,j as b,mt as x,n as S,ot as C,pt as w,q as T,rt as E,tt as D,x as O,z as ee}from"./protocol-support-BApsXw77.js";import{B as te,G as ne,H as re,Q as ie,U as ae,V as oe,_ as se,g as ce,h as le,q as ue,v as de,y as fe}from"./auth-olLlgxc3.js";import{c as pe,i as me,o as he,r as ge,s as _e}from"./LazyTerminal-CQNsHnn5.js";import{C as ve,O as ye,S as be,T as xe,_ as Se,a as Ce,b as we,c as Te,d as Ee,f as De,i as Oe,l as ke,m as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./notification-delivery-BrgeSks8.js";import{a as Ve,i as He,r as k,t as Ue}from"./client-settings-DhfHheKR.js";import{t as We}from"./jsx-runtime-By8HlURe.js";import{d as Ge,o as Ke,t as qe}from"./index-Nd31gVbt.js";import{n as Je,t as Ye}from"./api-BOuyloUi.js";import{_ as Xe,a as Ze,f as Qe,g as A,i as $e,m as et,n as tt,t as nt}from"./hotkeys-Cu0t6sbz.js";import{n as j}from"./dist-BOS6OKSE.js";import{a as M,i as N,n as rt,o as it,r as P,s as F,t as I}from"./dialog-BIriom7c.js";import{t as at}from"./x-Dq6POV20.js";import{n as L,r as ot}from"./chevron-right-nSpC9bNN.js";import{n as st,r as ct}from"./dist-DsLo0ckR.js";import{n as R,t as z}from"./createLucideIcon-C9A1vLE-.js";import{t as B}from"./button-q0ardkfx.js";import{a as lt,c as ut,i as dt,l as ft,n as pt,o as mt,r as ht,t as V,u as gt}from"./switch-B1LYyDZA.js";import{a as H,i as U,n as _t,r as W,t as vt}from"./select-4yfFmU4K.js";import{t as yt}from"./code-Cf4ftdOa.js";import{t as bt}from"./rotate-ccw-BI2k_h3A.js";import{t as xt}from"./control-tray-D6zVSZF4.js";import{r as G}from"./ws-Dgc69_w8.js";import{t as St}from"./use-debounced-value-C86N-mOK.js";import{n as Ct,r as wt,t as Tt}from"./popover-ChiZqTsE.js";import{a as Et,o as Dt,r as Ot,t as kt,u as At}from"./CompilationCommandForm-ByQ3n2Av.js";var jt=z(`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`}]]),Mt=z(`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`}]]),Nt=z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Pt=z(`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`}]]),Ft=z(`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`}]]),It=z(`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`}]]),Lt=z(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),K=e(n(),1),q=We();function Rt({id:e,value:t,min:n,max:r,step:i,className:a,onCommit:o}){let[s,c]=(0,K.useState)(String(t));return(0,K.useEffect)(()=>c(String(t)),[t]),(0,q.jsx)(L,{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 J({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,q.jsxs)(`div`,{className:R(`flex items-center gap-4 py-2.5`,a),children:[(0,q.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:R(`text-xs text-fg-muted`,n),children:t})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function Y({children:e,note:t}){return(0,q.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function zt(){let e=He(),[t,n]=(0,K.useState)(Ke());return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Appearance`}),(0,q.jsx)(J,{label:`Theme`,children:(0,q.jsxs)(vt,{value:t,onValueChange:e=>{n(e),qe(e)},children:[(0,q.jsx)(U,{className:`w-32`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(_t,{children:[(0,q.jsx)(W,{value:`dark`,children:`Dark`}),(0,q.jsx)(W,{value:`light`,children:`Light`}),(0,q.jsx)(W,{value:`system`,children:`System`})]})]})}),(0,q.jsx)(J,{label:`Cursor style`,children:(0,q.jsxs)(vt,{value:e.cursorPackage,onValueChange:e=>k({cursorPackage:e}),children:[(0,q.jsx)(U,{className:`w-36`,children:(0,q.jsx)(H,{})}),(0,q.jsx)(_t,{children:Ve.map(e=>(0,q.jsx)(W,{value:e.id,children:e.label},e.id))})]})}),(0,q.jsx)(J,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,q.jsx)(Rt,{id:`ui-font-size`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onCommit:e=>k({uiFontSize:e})})}),(0,q.jsx)(J,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,q.jsx)(Rt,{id:`terminal-font-size`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onCommit:e=>k({terminalFontSize:e})})}),(0,q.jsx)(J,{label:`Editor font size`,htmlFor:`editor-font-size`,children:(0,q.jsx)(Rt,{id:`editor-font-size`,min:9,max:32,step:.5,className:`w-20 tabular-nums`,value:e.editorFontSize,onCommit:e=>k({editorFontSize:e})})}),(0,q.jsx)(J,{label:`Density`,children:(0,q.jsxs)(vt,{value:e.density,onValueChange:e=>k({density:e}),children:[(0,q.jsx)(U,{className:`w-36`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(_t,{children:[(0,q.jsx)(W,{value:`compact`,children:`Compact`}),(0,q.jsx)(W,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,q.jsx)(J,{label:`Reduced animation and motion`,htmlFor:`reduce-motion`,children:(0,q.jsx)(V,{id:`reduce-motion`,checked:e.reduceMotion,onCheckedChange:e=>k({reduceMotion:e})})}),(0,q.jsx)(J,{label:`Project-based layout`,description:`Editor layouts are separated across projects.`,htmlFor:`project-based-layout`,children:(0,q.jsx)(V,{id:`project-based-layout`,checked:e.projectBasedLayout,onCheckedChange:e=>k({projectBasedLayout:e})})}),(0,q.jsx)(J,{label:`All projects in the session list`,description:`Right sidebar displays sessions from all projects.`,htmlFor:`show-all-project-sessions`,children:(0,q.jsx)(V,{id:`show-all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>k({showAllProjectSessions:e})})})]})}function Bt({profile:e}){let t=y(),[n,r]=(0,K.useState)(!1),i=n=>{t.mutate({id:e.id,icon:n},{onError:e=>G(e)}),r(!1)};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{label:`Icon`,children:(0,q.jsxs)(Tt,{open:n,onOpenChange:r,children:[(0,q.jsx)(wt,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-md text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(Re,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,q.jsx)(Ct,{align:`end`,className:`w-72`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,q.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>i(null),className:R(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!e.icon&&`bg-elevated text-fg`),children:(0,q.jsx)(Re,{icon:null,colour:null,className:`size-4`})}),xe.map(({name:t,Icon:n})=>(0,q.jsx)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:R(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,e.icon===t&&`bg-elevated text-fg`),children:(0,q.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,q.jsx)(J,{label:`Icon colour`,children:(0,q.jsx)(me,{value:e.icon_colour,onChange:n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>G(e)}),label:`Icon colour`})})]})}var Vt=`__none__`;function Ht(){let e=A(),t=C().data?.find(t=>t.id===e),n=d(e??void 0),r=g(e??void 0),i=y(),a=D(e??``),s=o(),[c,l]=(0,K.useState)(``),[u,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(!1),[h,_]=(0,K.useState)(``);if((0,K.useEffect)(()=>{t&&(l(t.name),f(t.branch_prefix))},[t]),!t)return null;let v=r.data?.default_account_id;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Profile`}),(0,q.jsxs)(J,{label:`Name`,description:`Letters, digits, dot, underscore and hyphen.`,htmlFor:`profile-name`,children:[(0,q.jsx)(L,{id:`profile-name`,value:c,onChange:e=>l(e.target.value),className:`w-44`}),(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:c===t.name||c.trim()===``||i.isPending,onClick:()=>i.mutate({id:t.id,name:c},{onError:e=>G(e)}),children:`Save`})]}),(0,q.jsxs)(J,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,q.jsx)(L,{id:`branch-prefix`,value:u,onChange:e=>f(e.target.value),placeholder:`no prefix`,className:`w-44`}),(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:u===t.branch_prefix||i.isPending,onClick:()=>i.mutate({id:t.id,branch_prefix:u},{onError:e=>G(e)}),children:`Save`})]}),(0,q.jsx)(Bt,{profile:t}),(0,q.jsx)(J,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,q.jsxs)(vt,{value:typeof v==`number`?String(v):Vt,onValueChange:e=>a.mutate({default_account_id:e===Vt?null:Number(e)},{onError:e=>G(e)}),children:[(0,q.jsx)(U,{className:`w-56`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(_t,{children:[(0,q.jsx)(W,{value:Vt,children:`First available`}),n.data?.map(e=>(0,q.jsx)(W,{value:String(e.id),children:(0,q.jsxs)(`span`,{children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,q.jsx)(J,{label:`Delete profile`,description:`Non-archived sessions block deletion.`,className:`mt-4`,children:(0,q.jsx)(B,{variant:`danger`,size:`sm`,onClick:()=>m(!0),children:`Delete…`})}),(0,q.jsx)(I,{open:p,onOpenChange:e=>{e||(m(!1),_(``))},children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{children:[`Delete profile `,(0,q.jsx)(`span`,{className:`text-fg`,children:t.name}),`?`]}),(0,q.jsx)(N,{children:`Everything this profile owns goes with it: projects, workspace layouts, accounts and their credential directories, and archived session history. Branches, repositories, and terminal logs on disk are untouched. This cannot be undone.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(pe,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`text-fg`,children:t.name}),` to confirm`]}),(0,q.jsx)(L,{id:`delete-confirm-name`,value:h,onChange:e=>_(e.target.value),autoFocus:!0})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:()=>{m(!1),_(``)},children:`Cancel`}),(0,q.jsx)(B,{variant:`danger`,disabled:h!==t.name||s.isPending,onClick:()=>s.mutate(t.id,{onSuccess:()=>{ht(),et.set(null)},onError:e=>{m(!1),_(``),G(e)}}),children:`Delete profile`})]})]})})]})}function Ut({agent:e,profileId:t,onClose:n,onCreated:r}){let i=b(),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),l=p(St(s,150)),u=s.trim(),d=u===``||u.startsWith(`/`)||u.startsWith(`~`),f=a.trim()!==``&&d,m=()=>{!f||i.isPending||i.mutate({profile_id:t,agent_type:e.id,label:a.trim(),...u===``?{}:{import_dir:u}},{onSuccess:e=>{n(),r(e,u!==``)},onError:e=>G(e)})};return(0,q.jsx)(I,{open:!0,onOpenChange:e=>!e&&n(),children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{children:[`Add a `,e.display_name,` account`]}),(0,q.jsxs)(N,{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,q.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,q.jsx)(L,{autoFocus:!0,placeholder:`label, e.g. personal`,value:a,onChange:e=>o(e.target.value)}),(0,q.jsx)(ge,{value:s,onValueChange:c,placeholder:`(optional) existing config dir, e.g. ~/.claude`,hints:(l.data?.entries??[]).map(e=>({value:e.path,label:e.name}))})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,q.jsxs)(B,{disabled:!f||i.isPending,onClick:m,children:[(0,q.jsx)(ct,{}),`Add account`]})]})]})})}function Wt({account:e,gateOpen:t,installed:n}){let r=m(),i=h(),a=ee(),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(e.label),f=(0,K.useRef)(null);return(0,K.useEffect)(()=>d(e.label),[e.label]),(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`input`,{ref:f,value:u,onChange:e=>d(e.target.value),onBlur:()=>{let t=u.trim();if(t!==e.label){if(t===``){d(e.label);return}i.mutate({id:e.id,label:t},{onError:t=>{G(t),d(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(d(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,q.jsxs)(`button`,{type:`button`,title:`Rename account`,onClick:()=>{f.current?.focus(),f.current?.select()},className:`shrink-0 rounded-sm p-0.5 text-fg-muted transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(he,{className:`size-3`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Rename account`})]})]}),(0,q.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-success`:`text-warning`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,q.jsx)(V,{checked:e.skip_permissions_default,onCheckedChange:t=>i.mutate({id:e.id,skip_permissions_default:t},{onError:e=>G(e)})})]}),(0,q.jsxs)(B,{size:`sm`,variant:`secondary`,disabled:r.isPending||!n,onClick:()=>r.mutate(e.id,{onSuccess:e=>s({stream:e.stream,hint:e.hint}),onError:e=>G(e)}),children:[(0,q.jsx)(ye,{}),e.logged_in?`Re-login`:`Login`]}),(0,q.jsxs)(B,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>l(!0),children:[(0,q.jsx)(st,{}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),o&&(0,q.jsx)(ve,{stream:o.stream,hint:o.hint,label:`${e.agent_type}/${e.label}`,onClose:()=>s(null)}),(0,q.jsx)(I,{open:c,onOpenChange:l,children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{children:[`Delete `,(0,q.jsx)(`span`,{className:`text-fg`,children:e.label}),`?`]}),(0,q.jsx)(N,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,q.jsx)(B,{variant:`danger`,disabled:a.isPending,onClick:()=>a.mutate(e.id,{onSuccess:()=>l(!1),onError:e=>{l(!1),G(e)}}),children:`Delete account`})]})]})})]})}function Gt(){let e=A(),t=i(),n=d(e??void 0),r=g(e??void 0),a=m(),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(null),u=r.data?.allowSkipPermissions===!0;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[],r=e.available!==!1;return(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(J,{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,q.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e.id})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,q.jsx)(Wt,{account:t,gateOpen:u&&e.capabilities.skip_permissions,installed:r},t.id)),(0,q.jsx)(`div`,{className:`flex`,children:(0,q.jsxs)(B,{type:`button`,size:`sm`,variant:`secondary`,disabled:!r,onClick:()=>l(e),children:[(0,q.jsx)(ct,{}),`Add account`]})})]})]},e.id)}),o&&(0,q.jsx)(ve,{stream:o.stream,label:o.label,hint:o.hint,onClose:()=>s(null)}),c!==null&&e!==null&&(0,q.jsx)(Ut,{agent:c,profileId:e,onClose:()=>l(null),onCreated:(e,t)=>{if(t){e.logged_in||j.info(`Imported without credentials — press Login to authenticate.`);return}a.mutate(e.id,{onSuccess:t=>s({stream:t.stream,label:`${e.agent_type}/${e.label}`,hint:t.hint}),onError:e=>G(e)})}})]})}function Kt(){let e=r(),t=c(),[n,i]=(0,K.useState)(``);return(0,K.useEffect)(()=>{e.data&&i(e.data.agentPath)},[e.data]),(0,q.jsx)(J,{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,q.jsx)(L,{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 qt({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=At(e,n),o=n.sessionDefaults??{},[s,c]=(0,K.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,q.jsx)(J,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,q.jsx)(L,{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,q.jsx)(J,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,q.jsx)(V,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,q.jsx)(J,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`Start on working copy of the selected branch instead of sharing one directory.`,htmlFor:`${e}-default-dir`,children:(0,q.jsx)(V,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function Jt(){return(0,q.jsx)(J,{label:`Terminal scrollback`,htmlFor:`scrollback`,children:(0,q.jsx)(Rt,{id:`scrollback`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:He().terminalScrollback,onCommit:e=>k({terminalScrollback:e})})})}function Yt({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,K.useState)(r);return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,q.jsx)(ot,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,q.jsx)(B,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var Xt={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 Zt({initial:e,onSave:t,pending:n}){let[r,i]=(0,K.useState)(e),a=r.length>0?r:ae;return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,q.jsx)(L,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:ae}),(0,q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,q.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:pt(Xt,a)})]}),(0,q.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:ne.map(([e,t])=>(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,q.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,q.jsx)(B,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(ae),t(ae)},children:`Reset to default`})]})]})}function Qt(){let e=A(),t=C().data?.find(t=>t.id===e),n=g(e??void 0),r=D(e??``),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(``),c=n.data?.allowSkipPermissions===!0,l=e=>r.mutate({allowSkipPermissions:e},{onSuccess:()=>{a(!1),s(``)},onError:e=>G(e)}),u=e=>t=>r.mutate({[e]:t},{onError:e=>G(e)});return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Sessions`}),(0,q.jsx)(J,{label:`Skip permission prompts`,htmlFor:`gate`,children:(0,q.jsx)(V,{id:`gate`,checked:c,onCheckedChange:e=>{e?a(!0):l(!1)}})}),(0,q.jsx)(J,{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,q.jsx)(V,{id:`capture-env`,checked:n.data?.captureSessionEnv!==!1,disabled:r.isPending,onCheckedChange:e=>r.mutate({captureSessionEnv:e},{onError:e=>G(e)})})}),(0,q.jsx)(Kt,{}),(0,q.jsx)(Jt,{}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{children:`New session defaults`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(qt,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>G(e)}),pending:r.isPending},`${e}:agent-seed`),(0,q.jsx)(qt,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>G(e)}),pending:r.isPending},`${e}:terminal-seed`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{note:`Sent to agent as opening message when a session (re)starts. You can make this empty.`,children:`Launch text`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Yt,{id:`onboarding-template`,label:`New worktree`,description:`Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??oe,defaultText:oe,onSave:u(`onboardingTemplate`),pending:r.isPending},`${e}:onboarding`),(0,q.jsx)(Yt,{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??te,defaultText:te,onSave:u(`concurrentTemplate`),pending:r.isPending},`${e}:concurrent`),(0,q.jsx)(Yt,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot.`,initial:n.data.restartTemplate??re,defaultText:re,onSave:u(`restartTemplate`),pending:r.isPending},`${e}:restart`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{children:`Tab title`}),n.data&&(0,q.jsx)(Zt,{initial:n.data.tabTitleTemplate||"${name}",onSave:u(`tabTitleTemplate`),pending:r.isPending},`${e}:tab-title`)]}),(0,q.jsx)(I,{open:i,onOpenChange:e=>{e||(a(!1),s(``))},children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Pt,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,q.jsx)(N,{asChild:!0,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,q.jsx)(`p`,{children:`A prompt-free agent acts unattended, with your credentials, inside its worktree — and nothing technically stops a shell command from reaching outside it. It can:`}),(0,q.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,q.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,q.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,q.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,q.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,q.jsx)(`p`,{children:`Only open this gate if every account you opt in runs work you would trust a colleague to run unsupervised on this machine.`}),(0,q.jsx)(`p`,{className:`text-fg-muted`,children:`Opening it also records the agent’s own bypass-permissions acceptance for this profile’s accounts, so the skip actually takes effect.`})]})})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(pe,{htmlFor:`confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`text-fg`,children:t?.name}),` to confirm`]}),(0,q.jsx)(L,{id:`confirm-name`,value:o,onChange:e=>s(e.target.value),autoFocus:!0})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:()=>{a(!1),s(``)},children:`Cancel`}),(0,q.jsx)(B,{variant:`danger`,disabled:o!==t?.name||r.isPending,onClick:()=>l(!0),children:`Open the gate`})]})]})})]})}var $t=ie.parse({});function en(){let[e,t]=(0,K.useState)(Oe);return(0,K.useEffect)(()=>{let e=()=>t(Oe());return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]),[e,()=>t(Oe())]}function tn({permission:e,onRequest:t}){return e===`granted`||e===`unverified`?null:(0,q.jsxs)(`p`,{className:`pb-2 text-xs text-warning`,children:[e==="default"&&(0,q.jsxs)(q.Fragment,{children:[`The browser has not been asked for permission yet, so nothing will show —`,` `,(0,q.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 nn(){let e=A(),t=g(e??void 0),n=D(e??``),r=v(e??void 0),[i,a]=en(),o=Ne(),[s,c]=(0,K.useState)(!1);(0,K.useEffect)(()=>{je();let e=()=>void je();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]);let l=ie.catch($t).parse(t.data?.notifications??{}),u=e=>n.mutate({notifications:e},{onError:e=>G(e)}),d=()=>{Xe()?.showNotification||typeof Notification>`u`||Notification.requestPermission().then(a)};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Notifications`}),(0,q.jsx)(J,{label:`Agent notifications`,htmlFor:`notify-desktop`,children:(0,q.jsx)(V,{id:`notify-desktop`,checked:l.desktop,onCheckedChange:e=>{e&&d(),u({...l,desktop:e})}})}),l.desktop&&(0,q.jsx)(tn,{permission:i,onRequest:d}),(0,q.jsx)(J,{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,q.jsx)(V,{id:`notify-focused`,checked:l.when_focused,onCheckedChange:e=>u({...l,when_focused:e})})}),(0,q.jsx)(J,{label:`Test delivery`,description:`Send a notification to check this device’s permissions.`,children:(0,q.jsx)(B,{variant:`ghost`,disabled:s,onClick:()=>{c(!0),(async()=>{!Xe()?.showNotification&&typeof Notification<`u`&&Notification.permission==="default"&&(await Notification.requestPermission(),a()),await Fe({id:`puddle-test`,title:`Puddle`,body:`Notifications are working on this device.`},()=>{})})().catch(G).finally(()=>c(!1))},children:s?`Sending…`:`Send test`})}),(0,q.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,q.jsx)(J,{label:`Sound`,htmlFor:`notify-sound`,children:(0,q.jsx)(V,{id:`notify-sound`,checked:l.sound,onCheckedChange:e=>u({...l,sound:e})})}),(0,q.jsx)(J,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,q.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[l.muted_projects.length,` muted`]})}),(0,q.jsx)(`div`,{className:`flex flex-col gap-1`,children:r.data?.map(e=>(0,q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,q.jsx)(V,{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 rn(){let e=A(),t=S(l().data?.protocol),n=Et(t&&e!==null),[r,i]=(0,K.useState)(null),a=n.data?.providers??[],o=a.find(e=>e.id===r)??a[0];return!t||!e?null:(0,q.jsxs)(`div`,{className:`mt-8`,children:[(0,q.jsx)(Y,{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,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Loading languages…`}):n.isError?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:`Couldn’t load languages.`}):o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{label:`Language`,htmlFor:`compilation-language`,children:(0,q.jsxs)(vt,{value:o.id,onValueChange:i,children:[(0,q.jsx)(U,{id:`compilation-language`,className:`w-48`,children:(0,q.jsx)(H,{})}),(0,q.jsx)(_t,{children:a.map(e=>(0,q.jsx)(W,{value:e.id,detail:e.available?void 0:`Not installed`,children:e.display_name},e.id))})]})}),!o.available&&(0,q.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,q.jsx)(an,{request:{profile_id:e,provider:o.id}},`${e}:${o.id}`)]}):(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No languages advertised by this host.`})]})}function an({request:e}){let t=Dt(e),n=f();return t.isLoading?(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Loading commands…`}):t.isError?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.error instanceof Error?t.error.message:`Couldn’t load commands`}):t.data?(0,q.jsx)(kt,{settings:t.data,onSave:async t=>{for(let r of t){let t=await Ot({...e,...r});n.setQueryData([`compilation-defaults`,e],t),await n.invalidateQueries({queryKey:[`compilation-settings`]})}}}):null}function on(){let e=He();return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Editor`}),(0,q.jsx)(J,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,q.jsx)(Rt,{id:`tab-size`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onCommit:e=>k({editorTabSize:e})})}),(0,q.jsx)(J,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,q.jsx)(V,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>k({editorWordWrap:e})})}),(0,q.jsx)(J,{label:`SSH host for editor links`,description:`Used for vscode:// and cursor:// remote links until the CLI supplies it automatically.`,htmlFor:`editor-link-host`,children:(0,q.jsx)(L,{id:`editor-link-host`,type:`text`,placeholder:Ge.get()??`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>k({editorLinkSshHost:e.target.value})})}),(0,q.jsx)(rn,{})]})}function sn({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=$e(e.nativeEvent);t&&(n(t),a(!1))},className:R(`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…`:Ze(e)}),!t&&(0,q.jsxs)(`button`,{type:`button`,title:`Reset to default`,onClick:r,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(bt,{className:`size-3.5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function cn(){let e=A(),t=g(e??void 0),n=D(e??``),r=t.data?.hotkeys??{},i=(e,t)=>r[e]||t,a=new Map;for(let e of nt){let t=i(e.id,Qe(e));a.set(t,(a.get(t)??0)+1)}let o=(e,t)=>n.mutate({hotkeys:{...r,[e]:t}},{onError:e=>G(e)}),s=e=>{let t={...r};delete t[e],n.mutate({hotkeys:t},{onError:e=>G(e)})};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Hotkeys`}),(0,q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed.`}),(0,q.jsx)(J,{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,q.jsx)(V,{id:`terminal-app-shortcuts`,checked:t.data?.terminalAppShortcuts!==!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({terminalAppShortcuts:e},{onError:e=>G(e)})})}),tt.map(e=>{let t=nt.filter(t=>t.group===e);return t.length===0?null:(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(`div`,{className:`mb-1 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e}),t.map(e=>{let t=i(e.id,Qe(e)),n=(a.get(t)??0)>1?`Conflicts with another shortcut.`:void 0;return(0,q.jsx)(J,{label:e.label,description:n,descriptionClassName:n?`text-interrupted`:void 0,children:(0,q.jsx)(sn,{value:t,isDefault:!r[e.id],onRecord:t=>o(e.id,t),onReset:()=>s(e.id)})},e.id)})]},e)})]})}var ln=e=>[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);function un(e,t){let[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(!0),[o,s]=(0,K.useState)(``),c=(0,K.useRef)(0),l=(0,K.useRef)(null);(0,K.useEffect)(()=>()=>{c.current+=1},[]),(0,K.useEffect)(()=>{if(n)return;let e=!0;return l.current=null,a(!0),(async()=>{try{let t=ln(crypto.getRandomValues(new Uint8Array(32))),n=ln(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,K.useRef)(t);return(0,K.useEffect)(()=>{u.current=t},[t]),(0,K.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,K.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}=se.parse(await Je(`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=ce.safeParse({service:t.trim(),app:n.trim(),label:i.trim(),challenge:a,expires:Date.now()+de.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 dn({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,K.useState)(e),[l,u]=(0,K.useState)(t),[d,f]=(0,K.useState)(n),p=un(i,a),m=i||p.preparing||!!p.attempt;return(0,q.jsxs)(`form`,{className:`mt-4 space-y-4`,onSubmit:e=>{e.preventDefault(),m||p.begin(s,l,d)},children:[(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Application origin`,(0,q.jsx)(L,{type:`url`,required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`https://app.example.com`,autoComplete:`off`,disabled:m})]}),(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Relay origin`,(0,q.jsx)(L,{type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://relay.example.com`,autoComplete:`off`,disabled:m})]}),(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Host name`,(0,q.jsx)(L,{required:!0,maxLength:80,value:d,onChange:e=>f(e.target.value),disabled:m})]}),o&&(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saving a new registration revokes existing browser approvals and invitations.`}),p.error&&(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p.error}),p.attempt?(0,q.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,q.jsxs)(`p`,{role:`status`,children:[`Confirm this host in your browser. Match request`,` `,(0,q.jsx)(`strong`,{className:`font-mono`,children:p.attempt.request.challenge.slice(0,8).toUpperCase()}),`. Sign-in expires in five minutes.`]}),(0,q.jsx)(`a`,{href:p.attempt.url,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:opacity-80`,children:`Continue in browser ↗`}),(0,q.jsx)(B,{type:`button`,variant:`ghost`,onClick:p.cancel,children:`Cancel sign-in`})]}):(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(B,{type:`submit`,disabled:m||!d.trim()||!s||!l,children:r?`Enabling…`:p.preparing?`Preparing sign-in…`:`Sign in and enable`}),o&&(0,q.jsx)(B,{type:`button`,variant:`ghost`,disabled:m,onClick:o,children:`Cancel`})]})]})}var fn=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),X=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)}})),pn=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}}})),mn=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})),hn=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})),gn=t((e=>{var t=X().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}})),_n=t((e=>{var t=X().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),vn=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}})),yn=t((e=>{var t=pn(),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}}})),bn=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]]}})),xn=t((e=>{var t=bn();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}})),Sn=t(((e,t)=>{var n=xn();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})),Cn=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),wn=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
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{A as r,E as i,G as a,H as o,I as s,Q as c,R as l,St as u,T as d,Tt as f,W as p,Y as m,Z as h,at as g,c as _,ct as v,et as y,j as b,mt as x,n as S,ot as C,pt as w,q as T,rt as E,tt as D,x as O,z as ee}from"./protocol-support-BApsXw77.js";import{B as te,G as ne,H as re,Q as ie,U as ae,V as oe,_ as se,g as ce,h as le,q as ue,v as de,y as fe}from"./auth-olLlgxc3.js";import{c as pe,i as me,o as he,r as ge,s as _e}from"./LazyTerminal-Dp2CN0Y8.js";import{C as ve,O as ye,S as be,T as xe,_ as Se,a as Ce,b as we,c as Te,d as Ee,f as De,i as Oe,l as ke,m as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./notification-delivery-BBt_CJ19.js";import{a as Ve,i as He,r as k,t as Ue}from"./client-settings-DhfHheKR.js";import{t as We}from"./jsx-runtime-By8HlURe.js";import{d as Ge,o as Ke,t as qe}from"./index-BqOVeoIr.js";import{n as Je,t as Ye}from"./api-BOuyloUi.js";import{_ as Xe,a as Ze,f as Qe,g as A,i as $e,m as et,n as tt,t as nt}from"./hotkeys-Cu0t6sbz.js";import{n as j}from"./dist-BOS6OKSE.js";import{a as M,i as N,n as rt,o as it,r as P,s as F,t as I}from"./dialog-D-Axqpzg.js";import{t as at}from"./x-Dq6POV20.js";import{n as L,r as ot}from"./chevron-right-BEy-IXEZ.js";import{n as st,r as ct}from"./dist-Dge3wHdO.js";import{n as R,t as z}from"./createLucideIcon-C9A1vLE-.js";import{t as B}from"./button-C_Rvtcwg.js";import{a as lt,c as ut,i as dt,l as ft,n as pt,o as mt,r as ht,t as V,u as gt}from"./switch-OMx-_DY7.js";import{a as H,i as U,n as _t,r as W,t as vt}from"./select-p5KTVHbg.js";import{t as yt}from"./code-Cf4ftdOa.js";import{t as bt}from"./rotate-ccw-BI2k_h3A.js";import{t as xt}from"./control-tray-CdoVaVhT.js";import{r as G}from"./ws-Dgc69_w8.js";import{t as St}from"./use-debounced-value-C86N-mOK.js";import{n as Ct,r as wt,t as Tt}from"./popover-D-jcaKGN.js";import{a as Et,o as Dt,r as Ot,t as kt,u as At}from"./CompilationCommandForm-Csg3VkC6.js";var jt=z(`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`}]]),Mt=z(`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`}]]),Nt=z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Pt=z(`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`}]]),Ft=z(`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`}]]),It=z(`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`}]]),Lt=z(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),K=e(n(),1),q=We();function Rt({id:e,value:t,min:n,max:r,step:i,className:a,onCommit:o}){let[s,c]=(0,K.useState)(String(t));return(0,K.useEffect)(()=>c(String(t)),[t]),(0,q.jsx)(L,{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 J({label:e,description:t,descriptionClassName:n,htmlFor:r,children:i,className:a}){return(0,q.jsxs)(`div`,{className:R(`flex items-center gap-4 py-2.5`,a),children:[(0,q.jsxs)(`label`,{htmlFor:r,className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-sm text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:R(`text-xs text-fg-muted`,n),children:t})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:i})]})}function Y({children:e,note:t}){return(0,q.jsxs)(`div`,{className:`mb-2 flex flex-col gap-0.5`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e}),t&&(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t})]})}function zt(){let e=He(),[t,n]=(0,K.useState)(Ke());return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Appearance`}),(0,q.jsx)(J,{label:`Theme`,children:(0,q.jsxs)(vt,{value:t,onValueChange:e=>{n(e),qe(e)},children:[(0,q.jsx)(U,{className:`w-32`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(_t,{children:[(0,q.jsx)(W,{value:`dark`,children:`Dark`}),(0,q.jsx)(W,{value:`light`,children:`Light`}),(0,q.jsx)(W,{value:`system`,children:`System`})]})]})}),(0,q.jsx)(J,{label:`Cursor style`,children:(0,q.jsxs)(vt,{value:e.cursorPackage,onValueChange:e=>k({cursorPackage:e}),children:[(0,q.jsx)(U,{className:`w-36`,children:(0,q.jsx)(H,{})}),(0,q.jsx)(_t,{children:Ve.map(e=>(0,q.jsx)(W,{value:e.id,children:e.label},e.id))})]})}),(0,q.jsx)(J,{label:`UI font size`,htmlFor:`ui-font-size`,children:(0,q.jsx)(Rt,{id:`ui-font-size`,min:12,max:24,step:.5,className:`w-20 tabular-nums`,value:e.uiFontSize,onCommit:e=>k({uiFontSize:e})})}),(0,q.jsx)(J,{label:`Terminal font size`,htmlFor:`terminal-font-size`,children:(0,q.jsx)(Rt,{id:`terminal-font-size`,min:9,max:24,className:`w-20 tabular-nums`,value:e.terminalFontSize,onCommit:e=>k({terminalFontSize:e})})}),(0,q.jsx)(J,{label:`Editor font size`,htmlFor:`editor-font-size`,children:(0,q.jsx)(Rt,{id:`editor-font-size`,min:9,max:32,step:.5,className:`w-20 tabular-nums`,value:e.editorFontSize,onCommit:e=>k({editorFontSize:e})})}),(0,q.jsx)(J,{label:`Density`,children:(0,q.jsxs)(vt,{value:e.density,onValueChange:e=>k({density:e}),children:[(0,q.jsx)(U,{className:`w-36`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(_t,{children:[(0,q.jsx)(W,{value:`compact`,children:`Compact`}),(0,q.jsx)(W,{value:`comfortable`,children:`Comfortable`})]})]})}),(0,q.jsx)(J,{label:`Reduced animation and motion`,htmlFor:`reduce-motion`,children:(0,q.jsx)(V,{id:`reduce-motion`,checked:e.reduceMotion,onCheckedChange:e=>k({reduceMotion:e})})}),(0,q.jsx)(J,{label:`Project-based layout`,description:`Editor layouts are separated across projects.`,htmlFor:`project-based-layout`,children:(0,q.jsx)(V,{id:`project-based-layout`,checked:e.projectBasedLayout,onCheckedChange:e=>k({projectBasedLayout:e})})}),(0,q.jsx)(J,{label:`All projects in the session list`,description:`Right sidebar displays sessions from all projects.`,htmlFor:`show-all-project-sessions`,children:(0,q.jsx)(V,{id:`show-all-project-sessions`,checked:e.showAllProjectSessions,onCheckedChange:e=>k({showAllProjectSessions:e})})})]})}function Bt({profile:e}){let t=y(),[n,r]=(0,K.useState)(!1),i=n=>{t.mutate({id:e.id,icon:n},{onError:e=>G(e)}),r(!1)};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{label:`Icon`,children:(0,q.jsxs)(Tt,{open:n,onOpenChange:r,children:[(0,q.jsx)(wt,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-md text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(Re,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Choose an icon`})]})}),(0,q.jsx)(Ct,{align:`end`,className:`w-72`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-8 gap-1`,children:[(0,q.jsx)(`button`,{type:`button`,title:`Default`,onClick:()=>i(null),className:R(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,!e.icon&&`bg-elevated text-fg`),children:(0,q.jsx)(Re,{icon:null,colour:null,className:`size-4`})}),xe.map(({name:t,Icon:n})=>(0,q.jsx)(`button`,{type:`button`,title:t,onClick:()=>i(t),className:R(`flex h-8 items-center justify-center rounded-md text-fg-secondary transition-colors hover:bg-elevated hover:text-fg`,e.icon===t&&`bg-elevated text-fg`),children:(0,q.jsx)(n,{className:`size-4`})},t))]})})]})}),(0,q.jsx)(J,{label:`Icon colour`,children:(0,q.jsx)(me,{value:e.icon_colour,onChange:n=>t.mutate({id:e.id,icon_colour:n},{onError:e=>G(e)}),label:`Icon colour`})})]})}var Vt=`__none__`;function Ht(){let e=A(),t=C().data?.find(t=>t.id===e),n=d(e??void 0),r=g(e??void 0),i=y(),a=D(e??``),s=o(),[c,l]=(0,K.useState)(``),[u,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(!1),[h,_]=(0,K.useState)(``);if((0,K.useEffect)(()=>{t&&(l(t.name),f(t.branch_prefix))},[t]),!t)return null;let v=r.data?.default_account_id;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Profile`}),(0,q.jsxs)(J,{label:`Name`,description:`Letters, digits, dot, underscore and hyphen.`,htmlFor:`profile-name`,children:[(0,q.jsx)(L,{id:`profile-name`,value:c,onChange:e=>l(e.target.value),className:`w-44`}),(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:c===t.name||c.trim()===``||i.isPending,onClick:()=>i.mutate({id:t.id,name:c},{onError:e=>G(e)}),children:`Save`})]}),(0,q.jsxs)(J,{label:`Branch prefix`,description:`Session branches become <prefix><slug(title)>.`,htmlFor:`branch-prefix`,children:[(0,q.jsx)(L,{id:`branch-prefix`,value:u,onChange:e=>f(e.target.value),placeholder:`no prefix`,className:`w-44`}),(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:u===t.branch_prefix||i.isPending,onClick:()=>i.mutate({id:t.id,branch_prefix:u},{onError:e=>G(e)}),children:`Save`})]}),(0,q.jsx)(Bt,{profile:t}),(0,q.jsx)(J,{label:`Default account`,description:`Preselected in the new-session modal.`,children:(0,q.jsxs)(vt,{value:typeof v==`number`?String(v):Vt,onValueChange:e=>a.mutate({default_account_id:e===Vt?null:Number(e)},{onError:e=>G(e)}),children:[(0,q.jsx)(U,{className:`w-56`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(_t,{children:[(0,q.jsx)(W,{value:Vt,children:`First available`}),n.data?.map(e=>(0,q.jsx)(W,{value:String(e.id),children:(0,q.jsxs)(`span`,{children:[e.agent_type,`/`,e.label]})},e.id))]})]})}),(0,q.jsx)(J,{label:`Delete profile`,description:`Non-archived sessions block deletion.`,className:`mt-4`,children:(0,q.jsx)(B,{variant:`danger`,size:`sm`,onClick:()=>m(!0),children:`Delete…`})}),(0,q.jsx)(I,{open:p,onOpenChange:e=>{e||(m(!1),_(``))},children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{children:[`Delete profile `,(0,q.jsx)(`span`,{className:`text-fg`,children:t.name}),`?`]}),(0,q.jsx)(N,{children:`Everything this profile owns goes with it: projects, workspace layouts, accounts and their credential directories, and archived session history. Branches, repositories, and terminal logs on disk are untouched. This cannot be undone.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(pe,{htmlFor:`delete-confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`text-fg`,children:t.name}),` to confirm`]}),(0,q.jsx)(L,{id:`delete-confirm-name`,value:h,onChange:e=>_(e.target.value),autoFocus:!0})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:()=>{m(!1),_(``)},children:`Cancel`}),(0,q.jsx)(B,{variant:`danger`,disabled:h!==t.name||s.isPending,onClick:()=>s.mutate(t.id,{onSuccess:()=>{ht(),et.set(null)},onError:e=>{m(!1),_(``),G(e)}}),children:`Delete profile`})]})]})})]})}function Ut({agent:e,profileId:t,onClose:n,onCreated:r}){let i=b(),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),l=p(St(s,150)),u=s.trim(),d=u===``||u.startsWith(`/`)||u.startsWith(`~`),f=a.trim()!==``&&d,m=()=>{!f||i.isPending||i.mutate({profile_id:t,agent_type:e.id,label:a.trim(),...u===``?{}:{import_dir:u}},{onSuccess:e=>{n(),r(e,u!==``)},onError:e=>G(e)})};return(0,q.jsx)(I,{open:!0,onOpenChange:e=>!e&&n(),children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{children:[`Add a `,e.display_name,` account`]}),(0,q.jsxs)(N,{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,q.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,q.jsx)(L,{autoFocus:!0,placeholder:`label, e.g. personal`,value:a,onChange:e=>o(e.target.value)}),(0,q.jsx)(ge,{value:s,onValueChange:c,placeholder:`(optional) existing config dir, e.g. ~/.claude`,hints:(l.data?.entries??[]).map(e=>({value:e.path,label:e.name}))})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,q.jsxs)(B,{disabled:!f||i.isPending,onClick:m,children:[(0,q.jsx)(ct,{}),`Add account`]})]})]})})}function Wt({account:e,gateOpen:t,installed:n}){let r=m(),i=h(),a=ee(),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(e.label),f=(0,K.useRef)(null);return(0,K.useEffect)(()=>d(e.label),[e.label]),(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-surface px-3 py-2`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`input`,{ref:f,value:u,onChange:e=>d(e.target.value),onBlur:()=>{let t=u.trim();if(t!==e.label){if(t===``){d(e.label);return}i.mutate({id:e.id,label:t},{onError:t=>{G(t),d(e.label)}})}},onKeyDown:t=>{t.key===`Enter`?t.currentTarget.blur():t.key===`Escape`&&(d(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,q.jsxs)(`button`,{type:`button`,title:`Rename account`,onClick:()=>{f.current?.focus(),f.current?.select()},className:`shrink-0 rounded-sm p-0.5 text-fg-muted transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(he,{className:`size-3`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Rename account`})]})]}),(0,q.jsx)(`span`,{className:`text-2xs ${e.logged_in?`text-success`:`text-warning`}`,children:e.logged_in?`logged in`:`not logged in`})]}),t&&(0,q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-secondary`,children:[`skip prompts`,(0,q.jsx)(V,{checked:e.skip_permissions_default,onCheckedChange:t=>i.mutate({id:e.id,skip_permissions_default:t},{onError:e=>G(e)})})]}),(0,q.jsxs)(B,{size:`sm`,variant:`secondary`,disabled:r.isPending||!n,onClick:()=>r.mutate(e.id,{onSuccess:e=>s({stream:e.stream,hint:e.hint}),onError:e=>G(e)}),children:[(0,q.jsx)(ye,{}),e.logged_in?`Re-login`:`Login`]}),(0,q.jsxs)(B,{size:`icon`,variant:`ghost`,className:`size-7 text-fg-muted hover:text-danger`,onClick:()=>l(!0),children:[(0,q.jsx)(st,{}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Delete account`})]}),o&&(0,q.jsx)(ve,{stream:o.stream,hint:o.hint,label:`${e.agent_type}/${e.label}`,onClose:()=>s(null)}),(0,q.jsx)(I,{open:c,onOpenChange:l,children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{children:[`Delete `,(0,q.jsx)(`span`,{className:`text-fg`,children:e.label}),`?`]}),(0,q.jsx)(N,{children:`Removes the account, its archived session history, and its credential directory — this logs the account out. Non-archived sessions block deletion.`})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,q.jsx)(B,{variant:`danger`,disabled:a.isPending,onClick:()=>a.mutate(e.id,{onSuccess:()=>l(!1),onError:e=>{l(!1),G(e)}}),children:`Delete account`})]})]})})]})}function Gt(){let e=A(),t=i(),n=d(e??void 0),r=g(e??void 0),a=m(),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(null),u=r.data?.allowSkipPermissions===!0;return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Accounts`}),t.data?.map(e=>{let t=n.data?.filter(t=>t.agent_type===e.id)??[],r=e.available!==!1;return(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(J,{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,q.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e.id})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.map(t=>(0,q.jsx)(Wt,{account:t,gateOpen:u&&e.capabilities.skip_permissions,installed:r},t.id)),(0,q.jsx)(`div`,{className:`flex`,children:(0,q.jsxs)(B,{type:`button`,size:`sm`,variant:`secondary`,disabled:!r,onClick:()=>l(e),children:[(0,q.jsx)(ct,{}),`Add account`]})})]})]},e.id)}),o&&(0,q.jsx)(ve,{stream:o.stream,label:o.label,hint:o.hint,onClose:()=>s(null)}),c!==null&&e!==null&&(0,q.jsx)(Ut,{agent:c,profileId:e,onClose:()=>l(null),onCreated:(e,t)=>{if(t){e.logged_in||j.info(`Imported without credentials — press Login to authenticate.`);return}a.mutate(e.id,{onSuccess:t=>s({stream:t.stream,label:`${e.agent_type}/${e.label}`,hint:t.hint}),onError:e=>G(e)})}})]})}function Kt(){let e=r(),t=c(),[n,i]=(0,K.useState)(``);return(0,K.useEffect)(()=>{e.data&&i(e.data.agentPath)},[e.data]),(0,q.jsx)(J,{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,q.jsx)(L,{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 qt({kind:e,heading:t,settings:n,onSave:r,pending:i}){let a=At(e,n),o=n.sessionDefaults??{},[s,c]=(0,K.useState)(a.baseBranch),l=t=>r({...o,[e]:{...o[e],...t}});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`mb-1 mt-4 text-xs font-medium uppercase tracking-wide text-fg-gold`,children:t}),(0,q.jsx)(J,{label:`Base branch`,description:`Blank = the repository's default base branch.`,htmlFor:`${e}-default-base`,children:(0,q.jsx)(L,{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,q.jsx)(J,{label:`Separate branch`,description:`Start on a fresh branch off the base, in its own directory.`,htmlFor:`${e}-default-branch`,children:(0,q.jsx)(V,{id:`${e}-default-branch`,checked:a.separateBranch,disabled:i,onCheckedChange:e=>l({separateBranch:e})})}),(0,q.jsx)(J,{label:`Separate directory`,description:a.separateBranch?`Always on while a separate branch is used.`:`Start on working copy of the selected branch instead of sharing one directory.`,htmlFor:`${e}-default-dir`,children:(0,q.jsx)(V,{id:`${e}-default-dir`,checked:a.separateWorktree,disabled:i||a.separateBranch,onCheckedChange:e=>l({separateWorktree:e})})})]})}function Jt(){return(0,q.jsx)(J,{label:`Terminal scrollback`,htmlFor:`scrollback`,children:(0,q.jsx)(Rt,{id:`scrollback`,min:500,max:1e5,step:500,className:`w-28 tabular-nums`,value:He().terminalScrollback,onCommit:e=>k({terminalScrollback:e})})})}function Yt({id:e,label:t,description:n,initial:r,defaultText:i,onSave:a,pending:o}){let[s,c]=(0,K.useState)(r);return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[t,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n})]}),(0,q.jsx)(ot,{id:e,value:s,onChange:e=>c(e.target.value),rows:6,className:`font-mono`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:s===r||o,onClick:()=>a(s),children:`Save`}),(0,q.jsx)(B,{size:`sm`,variant:`ghost`,disabled:s===i||o,onClick:()=>{c(i),a(i)},children:`Reset to default`})]})]})}var Xt={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 Zt({initial:e,onSave:t,pending:n}){let[r,i]=(0,K.useState)(e),a=r.length>0?r:ae;return(0,q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{htmlFor:`tab-title-template`,className:`flex flex-col gap-0.5 text-sm text-fg`,children:[`Template`,(0,q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Compose the label from the parts below. Empty falls back to the default.`})]}),(0,q.jsx)(L,{id:`tab-title-template`,value:r,onChange:e=>i(e.target.value),className:`font-mono`,placeholder:ae}),(0,q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Preview`,` `,(0,q.jsx)(`span`,{className:`ml-1 font-sans text-fg`,children:pt(Xt,a)})]}),(0,q.jsx)(`dl`,{className:`mt-1 flex flex-col gap-0.5 text-xs`,children:ne.map(([e,t])=>(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`dt`,{className:`w-24 shrink-0 font-mono text-fg-secondary`,children:`\${${e}}`}),(0,q.jsx)(`dd`,{className:`text-fg-muted`,children:t})]},e))}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(B,{size:`sm`,variant:`secondary`,disabled:r===e||n,onClick:()=>t(r),children:`Save`}),(0,q.jsx)(B,{size:`sm`,variant:`ghost`,disabled:r==="${name}"||n,onClick:()=>{i(ae),t(ae)},children:`Reset to default`})]})]})}function Qt(){let e=A(),t=C().data?.find(t=>t.id===e),n=g(e??void 0),r=D(e??``),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(``),c=n.data?.allowSkipPermissions===!0,l=e=>r.mutate({allowSkipPermissions:e},{onSuccess:()=>{a(!1),s(``)},onError:e=>G(e)}),u=e=>t=>r.mutate({[e]:t},{onError:e=>G(e)});return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Sessions`}),(0,q.jsx)(J,{label:`Skip permission prompts`,htmlFor:`gate`,children:(0,q.jsx)(V,{id:`gate`,checked:c,onCheckedChange:e=>{e?a(!0):l(!1)}})}),(0,q.jsx)(J,{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,q.jsx)(V,{id:`capture-env`,checked:n.data?.captureSessionEnv!==!1,disabled:r.isPending,onCheckedChange:e=>r.mutate({captureSessionEnv:e},{onError:e=>G(e)})})}),(0,q.jsx)(Kt,{}),(0,q.jsx)(Jt,{}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{children:`New session defaults`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(qt,{kind:`agent`,heading:`New agents`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>G(e)}),pending:r.isPending},`${e}:agent-seed`),(0,q.jsx)(qt,{kind:`terminal`,heading:`New terminals`,settings:n.data,onSave:e=>r.mutate({sessionDefaults:e},{onError:e=>G(e)}),pending:r.isPending},`${e}:terminal-seed`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{note:`Sent to agent as opening message when a session (re)starts. You can make this empty.`,children:`Launch text`}),n.data&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Yt,{id:`onboarding-template`,label:`New worktree`,description:`Use {{rules}} where the repo's onboarding notes should appear.`,initial:n.data.onboardingTemplate??oe,defaultText:oe,onSave:u(`onboardingTemplate`),pending:r.isPending},`${e}:onboarding`),(0,q.jsx)(Yt,{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??te,defaultText:te,onSave:u(`concurrentTemplate`),pending:r.isPending},`${e}:concurrent`),(0,q.jsx)(Yt,{id:`restart-template`,label:`Resume after restart`,description:`Sent when a session resumes after a daemon restart or machine reboot.`,initial:n.data.restartTemplate??re,defaultText:re,onSave:u(`restartTemplate`),pending:r.isPending},`${e}:restart`)]})]}),(0,q.jsxs)(`div`,{className:`mt-5`,children:[(0,q.jsx)(Y,{children:`Tab title`}),n.data&&(0,q.jsx)(Zt,{initial:n.data.tabTitleTemplate||"${name}",onSave:u(`tabTitleTemplate`),pending:r.isPending},`${e}:tab-title`)]}),(0,q.jsx)(I,{open:i,onOpenChange:e=>{e||(a(!1),s(``))},children:(0,q.jsxs)(P,{children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)(F,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Pt,{className:`size-5 text-danger`}),`Run agents without permission prompts?`]}),(0,q.jsx)(N,{asChild:!0,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,q.jsx)(`p`,{children:`A prompt-free agent acts unattended, with your credentials, inside its worktree — and nothing technically stops a shell command from reaching outside it. It can:`}),(0,q.jsxs)(`ul`,{className:`list-disc pl-5 text-fg-secondary`,children:[(0,q.jsx)(`li`,{children:`run any shell command without asking first,`}),(0,q.jsx)(`li`,{children:`modify, delete, or exfiltrate files your user can reach,`}),(0,q.jsx)(`li`,{children:`install dependencies and execute the network requests they make,`}),(0,q.jsx)(`li`,{children:`push branches or call remote APIs with the credentials it finds.`})]}),(0,q.jsx)(`p`,{children:`Only open this gate if every account you opt in runs work you would trust a colleague to run unsupervised on this machine.`}),(0,q.jsx)(`p`,{className:`text-fg-muted`,children:`Opening it also records the agent’s own bypass-permissions acceptance for this profile’s accounts, so the skip actually takes effect.`})]})})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(pe,{htmlFor:`confirm-name`,children:[`Type `,(0,q.jsx)(`span`,{className:`text-fg`,children:t?.name}),` to confirm`]}),(0,q.jsx)(L,{id:`confirm-name`,value:o,onChange:e=>s(e.target.value),autoFocus:!0})]}),(0,q.jsxs)(M,{children:[(0,q.jsx)(B,{variant:`ghost`,onClick:()=>{a(!1),s(``)},children:`Cancel`}),(0,q.jsx)(B,{variant:`danger`,disabled:o!==t?.name||r.isPending,onClick:()=>l(!0),children:`Open the gate`})]})]})})]})}var $t=ie.parse({});function en(){let[e,t]=(0,K.useState)(Oe);return(0,K.useEffect)(()=>{let e=()=>t(Oe());return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]),[e,()=>t(Oe())]}function tn({permission:e,onRequest:t}){return e===`granted`||e===`unverified`?null:(0,q.jsxs)(`p`,{className:`pb-2 text-xs text-warning`,children:[e==="default"&&(0,q.jsxs)(q.Fragment,{children:[`The browser has not been asked for permission yet, so nothing will show —`,` `,(0,q.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 nn(){let e=A(),t=g(e??void 0),n=D(e??``),r=v(e??void 0),[i,a]=en(),o=Ne(),[s,c]=(0,K.useState)(!1);(0,K.useEffect)(()=>{je();let e=()=>void je();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[]);let l=ie.catch($t).parse(t.data?.notifications??{}),u=e=>n.mutate({notifications:e},{onError:e=>G(e)}),d=()=>{Xe()?.showNotification||typeof Notification>`u`||Notification.requestPermission().then(a)};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Notifications`}),(0,q.jsx)(J,{label:`Agent notifications`,htmlFor:`notify-desktop`,children:(0,q.jsx)(V,{id:`notify-desktop`,checked:l.desktop,onCheckedChange:e=>{e&&d(),u({...l,desktop:e})}})}),l.desktop&&(0,q.jsx)(tn,{permission:i,onRequest:d}),(0,q.jsx)(J,{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,q.jsx)(V,{id:`notify-focused`,checked:l.when_focused,onCheckedChange:e=>u({...l,when_focused:e})})}),(0,q.jsx)(J,{label:`Test delivery`,description:`Send a notification to check this device’s permissions.`,children:(0,q.jsx)(B,{variant:`ghost`,disabled:s,onClick:()=>{c(!0),(async()=>{!Xe()?.showNotification&&typeof Notification<`u`&&Notification.permission==="default"&&(await Notification.requestPermission(),a()),await Fe({id:`puddle-test`,title:`Puddle`,body:`Notifications are working on this device.`},()=>{})})().catch(G).finally(()=>c(!1))},children:s?`Sending…`:`Send test`})}),(0,q.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,q.jsx)(J,{label:`Sound`,htmlFor:`notify-sound`,children:(0,q.jsx)(V,{id:`notify-sound`,checked:l.sound,onCheckedChange:e=>u({...l,sound:e})})}),(0,q.jsx)(J,{label:`Muted projects`,description:`No notifications from these projects.`,children:(0,q.jsxs)(`span`,{className:`text-2xs text-fg-muted tabular-nums`,children:[l.muted_projects.length,` muted`]})}),(0,q.jsx)(`div`,{className:`flex flex-col gap-1`,children:r.data?.map(e=>(0,q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-secondary hover:bg-elevated`,children:[(0,q.jsx)(V,{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 rn(){let e=A(),t=S(l().data?.protocol),n=Et(t&&e!==null),[r,i]=(0,K.useState)(null),a=n.data?.providers??[],o=a.find(e=>e.id===r)??a[0];return!t||!e?null:(0,q.jsxs)(`div`,{className:`mt-8`,children:[(0,q.jsx)(Y,{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,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Loading languages…`}):n.isError?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:`Couldn’t load languages.`}):o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{label:`Language`,htmlFor:`compilation-language`,children:(0,q.jsxs)(vt,{value:o.id,onValueChange:i,children:[(0,q.jsx)(U,{id:`compilation-language`,className:`w-48`,children:(0,q.jsx)(H,{})}),(0,q.jsx)(_t,{children:a.map(e=>(0,q.jsx)(W,{value:e.id,detail:e.available?void 0:`Not installed`,children:e.display_name},e.id))})]})}),!o.available&&(0,q.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,q.jsx)(an,{request:{profile_id:e,provider:o.id}},`${e}:${o.id}`)]}):(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`No languages advertised by this host.`})]})}function an({request:e}){let t=Dt(e),n=f();return t.isLoading?(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Loading commands…`}):t.isError?(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t.error instanceof Error?t.error.message:`Couldn’t load commands`}):t.data?(0,q.jsx)(kt,{settings:t.data,onSave:async t=>{for(let r of t){let t=await Ot({...e,...r});n.setQueryData([`compilation-defaults`,e],t),await n.invalidateQueries({queryKey:[`compilation-settings`]})}}}):null}function on(){let e=He();return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Editor`}),(0,q.jsx)(J,{label:`Tab size`,description:`Spaces per indent level.`,htmlFor:`tab-size`,children:(0,q.jsx)(Rt,{id:`tab-size`,min:1,max:8,className:`w-20 tabular-nums`,value:e.editorTabSize,onCommit:e=>k({editorTabSize:e})})}),(0,q.jsx)(J,{label:`Word wrap`,htmlFor:`word-wrap`,children:(0,q.jsx)(V,{id:`word-wrap`,checked:e.editorWordWrap,onCheckedChange:e=>k({editorWordWrap:e})})}),(0,q.jsx)(J,{label:`SSH host for editor links`,description:`Used for vscode:// and cursor:// remote links until the CLI supplies it automatically.`,htmlFor:`editor-link-host`,children:(0,q.jsx)(L,{id:`editor-link-host`,type:`text`,placeholder:Ge.get()??`user@host`,className:`w-48`,value:e.editorLinkSshHost,onChange:e=>k({editorLinkSshHost:e.target.value})})}),(0,q.jsx)(rn,{})]})}function sn({value:e,isDefault:t,onRecord:n,onReset:r}){let[i,a]=(0,K.useState)(!1);return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(!0),onBlur:()=>a(!1),onKeyDown:e=>{if(!i)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=$e(e.nativeEvent);t&&(n(t),a(!1))},className:R(`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…`:Ze(e)}),!t&&(0,q.jsxs)(`button`,{type:`button`,title:`Reset to default`,onClick:r,className:`rounded-md p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,q.jsx)(bt,{className:`size-3.5`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Reset to default`})]})]})}function cn(){let e=A(),t=g(e??void 0),n=D(e??``),r=t.data?.hotkeys??{},i=(e,t)=>r[e]||t,a=new Map;for(let e of nt){let t=i(e.id,Qe(e));a.set(t,(a.get(t)??0)+1)}let o=(e,t)=>n.mutate({hotkeys:{...r,[e]:t}},{onError:e=>G(e)}),s=e=>{let t={...r};delete t[e],n.mutate({hotkeys:t},{onError:e=>G(e)})};return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Y,{children:`Hotkeys`}),(0,q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:`Per-profile keyboard shortcuts. Filetree navigation and terminal line-edits are fixed.`}),(0,q.jsx)(J,{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,q.jsx)(V,{id:`terminal-app-shortcuts`,checked:t.data?.terminalAppShortcuts!==!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({terminalAppShortcuts:e},{onError:e=>G(e)})})}),tt.map(e=>{let t=nt.filter(t=>t.group===e);return t.length===0?null:(0,q.jsxs)(`div`,{className:`mb-5`,children:[(0,q.jsx)(`div`,{className:`mb-1 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e}),t.map(e=>{let t=i(e.id,Qe(e)),n=(a.get(t)??0)>1?`Conflicts with another shortcut.`:void 0;return(0,q.jsx)(J,{label:e.label,description:n,descriptionClassName:n?`text-interrupted`:void 0,children:(0,q.jsx)(sn,{value:t,isDefault:!r[e.id],onRecord:t=>o(e.id,t),onReset:()=>s(e.id)})},e.id)})]},e)})]})}var ln=e=>[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);function un(e,t){let[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(!0),[o,s]=(0,K.useState)(``),c=(0,K.useRef)(0),l=(0,K.useRef)(null);(0,K.useEffect)(()=>()=>{c.current+=1},[]),(0,K.useEffect)(()=>{if(n)return;let e=!0;return l.current=null,a(!0),(async()=>{try{let t=ln(crypto.getRandomValues(new Uint8Array(32))),n=ln(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,K.useRef)(t);return(0,K.useEffect)(()=>{u.current=t},[t]),(0,K.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,K.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}=se.parse(await Je(`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=ce.safeParse({service:t.trim(),app:n.trim(),label:i.trim(),challenge:a,expires:Date.now()+de.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 dn({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,K.useState)(e),[l,u]=(0,K.useState)(t),[d,f]=(0,K.useState)(n),p=un(i,a),m=i||p.preparing||!!p.attempt;return(0,q.jsxs)(`form`,{className:`mt-4 space-y-4`,onSubmit:e=>{e.preventDefault(),m||p.begin(s,l,d)},children:[(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Application origin`,(0,q.jsx)(L,{type:`url`,required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`https://app.example.com`,autoComplete:`off`,disabled:m})]}),(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Relay origin`,(0,q.jsx)(L,{type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://relay.example.com`,autoComplete:`off`,disabled:m})]}),(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Host name`,(0,q.jsx)(L,{required:!0,maxLength:80,value:d,onChange:e=>f(e.target.value),disabled:m})]}),o&&(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saving a new registration revokes existing browser approvals and invitations.`}),p.error&&(0,q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p.error}),p.attempt?(0,q.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,q.jsxs)(`p`,{role:`status`,children:[`Confirm this host in your browser. Match request`,` `,(0,q.jsx)(`strong`,{className:`font-mono`,children:p.attempt.request.challenge.slice(0,8).toUpperCase()}),`. Sign-in expires in five minutes.`]}),(0,q.jsx)(`a`,{href:p.attempt.url,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:opacity-80`,children:`Continue in browser ↗`}),(0,q.jsx)(B,{type:`button`,variant:`ghost`,onClick:p.cancel,children:`Cancel sign-in`})]}):(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(B,{type:`submit`,disabled:m||!d.trim()||!s||!l,children:r?`Enabling…`:p.preparing?`Preparing sign-in…`:`Sign in and enable`}),o&&(0,q.jsx)(B,{type:`button`,variant:`ghost`,disabled:m,onClick:o,children:`Cancel`})]})]})}var fn=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),X=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)}})),pn=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}}})),mn=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})),hn=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})),gn=t((e=>{var t=X().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}})),_n=t((e=>{var t=X().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),vn=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}})),yn=t((e=>{var t=pn(),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}}})),bn=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]]}})),xn=t((e=>{var t=bn();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}})),Sn=t(((e,t)=>{var n=xn();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})),Cn=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),wn=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
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)}})),Z=t((e=>{var t=Cn(),n=wn();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}}})),Tn=t((e=>{var t=X(),n=yn(),r=pn(),i=Z(),a=Cn(),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}})),En=t((e=>{var t=X(),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}})),Dn=t(((e,t)=>{var n=Z();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})),On=t(((e,t)=>{var n=Z(),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})),kn=t(((e,t)=>{var n=Z();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})),An=t(((e,t)=>{var n=Z(),r=X();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
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),jn=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)})),Mn=t((e=>{var t=Z(),n=Dn(),r=On(),i=kn(),a=An(),o=wn(),s=X(),c=jn();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
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()))}})),Nn=t((e=>{var t=X(),n=pn(),r=mn(),i=hn(),a=gn(),o=_n(),s=vn(),c=yn(),l=Sn(),u=Tn(),d=En(),f=Z(),p=Mn();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(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-mermaid-
|
|
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{R as r,at as i,o as a}from"./protocol-support-BApsXw77.js";import{a as o}from"./auth-olLlgxc3.js";import{i as s}from"./client-settings-DhfHheKR.js";import{t as c}from"./jsx-runtime-By8HlURe.js";import{t as l}from"./preload-helper-Czpn1I53.js";import{a as u,c as d,n as f,r as p,s as m}from"./index-Nd31gVbt.js";import{g as h,i as g,o as _,r as ee,s as te}from"./hotkeys-Cu0t6sbz.js";import{n as ne}from"./forward-link-DMvLf0Xw.js";import{n as re}from"./dist-BOS6OKSE.js";import{n as ie}from"./createLucideIcon-C9A1vLE-.js";import{n as ae}from"./motion-OSLfKoC0.js";import{a as oe,i as v,o as se,s as y,t as ce}from"./FindWidget-DG1YP6Zx.js";import{_ as b,a as le,b as ue,f as de,i as x,m as fe,n as pe,t as me,v as he,y as ge}from"./selection-actions-2STnRxD9.js";import{t as S}from"./code-Cf4ftdOa.js";import{r as _e,t as C}from"./ws-Dgc69_w8.js";import{r as ve}from"./math-delimiters-BCnTi7Ii.js";var w=e(t(),1),ye=Object.defineProperty,be=Object.getOwnPropertyDescriptor,xe=(e,t)=>{for(var n in t)ye(e,n,{get:t[n],enumerable:!0})},T=(e,t,n,r)=>{for(var i=r>1?void 0:r?be(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ye(t,n,i),i},E=(e,t)=>(n,r)=>t(n,r,e),Se=`Terminal input`,Ce={get:()=>Se,set:e=>Se=e},we=`Too much output to announce, navigate to rows manually to read`,Te={get:()=>we,set:e=>we=e};function Ee(e){return e.replace(/\r?\n/g,`\r`)}function De(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Oe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ke(e,t,n,r){e.stopPropagation(),e.clipboardData&&Ae(e.clipboardData.getData(`text/plain`),t,n,r)}function Ae(e,t,n,r){e=Ee(e),e=De(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function je(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function Me(e,t,n,r,i){je(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Ne(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function D(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Pe=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Fe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Ie=``,Le=` `,Re=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ze}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ze=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Be=class e extends Re{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ze,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ne(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ve=`di$target`,He=`di$dependencies`,Ue=new Map;function We(e){return e[He]||[]}function O(e){if(Ue.has(e))return Ue.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Ge(t,e,r)};return t._id=e,Ue.set(e,t),t}function Ge(e,t,n){t[Ve]===t?t[He].push({id:e,index:n}):(t[He]=[{id:e,index:n}],t[Ve]=t)}var k=O(`BufferService`),Ke=O(`CoreMouseService`),qe=O(`CoreService`),Je=O(`CharsetService`),Ye=O(`InstantiationService`),Xe=O(`LogService`),A=O(`OptionsService`),Ze=O(`OscLinkService`),Qe=O(`UnicodeService`),$e=O(`DecorationService`),et=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Be,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):tt(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};et=T([E(0,k),E(1,A),E(2,Ze)],et);function tt(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-mermaid-SyDYdSZz.js","assets/rolldown-runtime-QTnfLwEv.js","assets/preload-helper-Czpn1I53.js","assets/index-BqOVeoIr.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/auth-olLlgxc3.js","assets/client-settings-DhfHheKR.js","assets/jsx-runtime-By8HlURe.js","assets/index-LpAqnBR3.css","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/purify.es-D8QhFVkO.js","assets/katex.min-ZqdHjttS.js","assets/katex-Dz-67XSV.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{R as r,at as i,o as a}from"./protocol-support-BApsXw77.js";import{a as o}from"./auth-olLlgxc3.js";import{i as s}from"./client-settings-DhfHheKR.js";import{t as c}from"./jsx-runtime-By8HlURe.js";import{t as l}from"./preload-helper-Czpn1I53.js";import{a as u,c as d,n as f,r as p,s as m}from"./index-BqOVeoIr.js";import{g as h,i as g,o as _,r as ee,s as te}from"./hotkeys-Cu0t6sbz.js";import{n as ne}from"./forward-link-DMvLf0Xw.js";import{n as re}from"./dist-BOS6OKSE.js";import{n as ie}from"./createLucideIcon-C9A1vLE-.js";import{n as ae}from"./motion-OSLfKoC0.js";import{a as oe,i as v,o as se,s as y,t as ce}from"./FindWidget-DG1YP6Zx.js";import{_ as b,a as le,b as ue,f as de,i as x,m as fe,n as pe,t as me,v as he,y as ge}from"./selection-actions-Cm0Oytya.js";import{t as S}from"./code-Cf4ftdOa.js";import{r as _e,t as C}from"./ws-Dgc69_w8.js";import{r as ve}from"./math-delimiters-BCnTi7Ii.js";var w=e(t(),1),ye=Object.defineProperty,be=Object.getOwnPropertyDescriptor,xe=(e,t)=>{for(var n in t)ye(e,n,{get:t[n],enumerable:!0})},T=(e,t,n,r)=>{for(var i=r>1?void 0:r?be(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ye(t,n,i),i},E=(e,t)=>(n,r)=>t(n,r,e),Se=`Terminal input`,Ce={get:()=>Se,set:e=>Se=e},we=`Too much output to announce, navigate to rows manually to read`,Te={get:()=>we,set:e=>we=e};function Ee(e){return e.replace(/\r?\n/g,`\r`)}function De(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Oe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ke(e,t,n,r){e.stopPropagation(),e.clipboardData&&Ae(e.clipboardData.getData(`text/plain`),t,n,r)}function Ae(e,t,n,r){e=Ee(e),e=De(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function je(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function Me(e,t,n,r,i){je(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Ne(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function D(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Pe=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Fe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Ie=``,Le=` `,Re=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ze}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ze=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Be=class e extends Re{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ze,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ne(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ve=`di$target`,He=`di$dependencies`,Ue=new Map;function We(e){return e[He]||[]}function O(e){if(Ue.has(e))return Ue.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Ge(t,e,r)};return t._id=e,Ue.set(e,t),t}function Ge(e,t,n){t[Ve]===t?t[He].push({id:e,index:n}):(t[He]=[{id:e,index:n}],t[Ve]=t)}var k=O(`BufferService`),Ke=O(`CoreMouseService`),qe=O(`CoreService`),Je=O(`CharsetService`),Ye=O(`InstantiationService`),Xe=O(`LogService`),A=O(`OptionsService`),Ze=O(`OscLinkService`),Qe=O(`UnicodeService`),$e=O(`DecorationService`),et=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Be,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):tt(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};et=T([E(0,k),E(1,A),E(2,Ze)],et);function tt(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
3
3
|
|
|
4
4
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var nt=O(`CharSizeService`),rt=O(`CoreBrowserService`),it=O(`MouseService`),at=O(`RenderService`),ot=O(`SelectionService`),st=O(`CharacterJoinerService`),ct=O(`ThemeService`),lt=O(`LinkProviderService`),ut=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?gt.isErrorNoTelemetry(e)?new gt(e.message+`
|
|
5
5
|
|
|
@@ -61,6 +61,6 @@ ${s.join(`
|
|
|
61
61
|
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);rl.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*nl<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||hc;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof tl)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},al=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ol=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),sl;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof cl?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Gc.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ol})})(sl||={});var cl=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ol:(this._emitter||=new il,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},ll=`en`,ul=!1,dl=!1,fl=ll,pl,ml=globalThis,hl;typeof ml.vscode<`u`&&typeof ml.vscode.process<`u`?hl=ml.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(hl=process);var gl=typeof hl?.versions?.electron==`string`&&hl?.type===`renderer`;if(typeof hl==`object`){hl.platform,hl.platform,ul=hl.platform===`linux`,ul&&hl.env.SNAP&&hl.env.SNAP_REVISION,hl.env.CI||hl.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fl=ll;let e=hl.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,fl=t.resolvedLanguage||ll,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!gl?(pl=navigator.userAgent,pl.indexOf(`Windows`),pl.indexOf(`Macintosh`),(pl.indexOf(`Macintosh`)>=0||pl.indexOf(`iPad`)>=0||pl.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,ul=pl.indexOf(`Linux`)>=0,pl?.indexOf(`Mobi`),dl=!0,fl=globalThis._VSCODE_NLS_LANGUAGE||ll,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);dl&&typeof ml.importScripts==`function`&&ml.origin;var _l=pl,vl=fl,yl;(e=>{function t(){return vl}e.value=t;function n(){return vl.length===2?vl===`en`:vl.length>=3&&vl[0]===`e`&&vl[1]===`n`&&vl[2]===`-`}e.isDefaultVariant=n;function r(){return vl===`en`}e.isDefault=r})(yl||={});var bl=typeof ml.postMessage==`function`&&!ml.importScripts;(()=>{if(bl){let e=[];ml.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),ml.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var xl=!!(_l&&_l.indexOf(`Chrome`)>=0);_l&&_l.indexOf(`Firefox`),!xl&&_l&&_l.indexOf(`Safari`),_l&&_l.indexOf(`Edg/`),_l&&_l.indexOf(`Android`);function Sl(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=Lc(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Cl;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Cl||={});var wl=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new il,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Gc.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};wl.EMPTY=wl.fromArray([]);var Tl=class extends Bc{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Vc),this._linesCacheDisposables=this._register(new Vc),this._register(Lc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ic(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Sl(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},El=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Dl=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},Ol=class extends Bc{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Lc(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){Fc(n)}}}clearHighlightDecorations(){Fc(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>Fc(e))),s.push(i)}}return s.length===0?void 0:s}},kl=class extends Bc{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new il)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Al=class extends Bc{constructor(e){super(),this._highlightTimeout=this._register(new Vc),this._lineCache=this._register(new Vc),this._state=new El,this._resultTracker=this._register(new kl),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Tl(e),this._engine=new Dl(e,this._lineCache.value),this._decorationManager=new Ol(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Lc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Sl(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}};function jl(e){return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)}function Ml(){return(0,w.useSyncExternalStore)(jl,()=>document.visibilityState===`visible`)}function Nl(e){let t=/^#?([0-9a-fA-F]{6})(?:[0-9a-fA-F]{2})?$/.exec(e.trim());if(!t)return null;let n=t[1].toLowerCase(),r=e=>n.slice(e,e+2).repeat(2);return`rgb:${r(0)}/${r(2)}/${r(4)}`}function Pl(e,t){let n=Nl(t);return n?`\x1b]${e};${n}\x1b\\`:null}function Fl(e,t){let n=[10,11].map(n=>e.parser.registerOscHandler(n,e=>{if(e!==`?`)return!1;if(!t.daemonAnswers&&!t.isReplaying()){let e=Pl(n,t.readColour(n));e&&t.reply(e)}return!0}));return{dispose:()=>n.forEach(e=>e.dispose())}}function Il(e,t,n=!1){return e.type===`keydown`?n&&Ll(e)?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`c`:e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`:!1}function Ll(e){return e.type===`keydown`&&e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`c`}function Rl(e){if(!/^https?:\/\//i.test(e)||/[\s<>"`\\\p{Cc}]/u.test(e))return!1;try{return new URL(e).hostname!==``}catch{return!1}}function zl(e){let t=[];for(let n of e.matchAll(/\bhttps?:\/\/[^\s<>"'`\\{}|^]+/gi)){let e=n[0];for(;e;){let t=e.at(-1),n=t===`)`?`(`:t===`]`?`[`:null;if(/[.,;:!?]/.test(t)||n&&e.split(t).length>e.split(n).length)e=e.slice(0,-1);else break}Rl(e)&&t.push({uri:e,start:n.index,end:n.index+e.length})}return t}function Bl(e,t,n,r){let i=zl(r).at(-1),a=/\bhttps?:\/\/[^\s<>"'`\\{}|^]*$/i.exec(r)?.[0];if(!a||i&&/[\])]/.test(r.slice(i.end)))return!1;let o=t.text.trimStart();if(!o||/^(?:https?:\/\/|~\/|\.{1,2}\/)/i.test(o))return!1;let s=o.split(/\s/,1)[0].replace(/[.,;:!?\])]+$/,``);if(!/^[\p{L}\p{N}_%/?.:#&=+~-]/u.test(s))return!1;let c=/[/_.?&#=%+~-]/.test(s);if(!c&&/\s/.test(o.trimEnd()))return!1;let l=e.cells[e.text.trimEnd().length-1];return a.endsWith(`/`)&&c||l!==void 0&&l.col>=n-9}function Vl(e,t,n){return b(e,t,n,zl,Bl)}function Hl(e,t){return e.registerLinkProvider({provideLinks(n,r){r(Vl(e.buffer.active,n-1,e.cols).map(({candidate:e,start:n,end:r})=>({range:{start:{x:n.col+1,y:n.row+1},end:{x:r.col+1,y:r.row+1}},text:e.uri,activate:()=>t(e.uri)})))}})}function Ul(e){let t=e.trim(),n=/^<([^<>]+)>$/.exec(t);if(n&&Rl(n[1]))return n[1];let r=/^\[(?:\\.|[^\]\\])*\]\(\s*(?:<([^<>]+)>|([^\s]+))\s*\)$/.exec(t);if(!r)return e;let i=r[1]??r[2];if(r[2]){let t=0;for(let n=0;n<i.length;n++)if(i[n]===`\\`)n++;else if(i[n]===`(`)t++;else if(i[n]===`)`&&--t<0)return e;if(t!==0)return e}let a=i.replace(/\\([!-/:-@[-`{-~])/g,`$1`);return Rl(a)?a:e}function Wl(e){let t=e.getSelection(),n=e.getSelectionPosition();if(n&&/\r?\n/.test(t)){let r=t.trim().replace(/[\t ]*\r?\n[\t ]*/g,``),i=Vl(e.buffer.active,n.start.y,e.cols).find(({candidate:e})=>e.uri===r);if(i)return i.candidate.uri}return Ul(t)}function Gl(e){let t=null,n=null,r=()=>{n?.cancel(),n=null},i=()=>{r(),t=null},a={reset:i,input(e){!e.startsWith(`\x1B[<`)&&!e.startsWith(`\x1B[M`)&&i()},osc(a){if(!e.available())return i(),!0;let o=a.indexOf(`;`);if(o<0)return!0;let s=a.slice(o+1);if(s===`?`)return!0;if(!s)return i(),!0;try{let e=Uint8Array.from(atob(s),e=>e.charCodeAt(0));t=Ul(new TextDecoder(`utf-8`,{fatal:!0}).decode(e)),t&&n?.resolve(t),r()}catch{i()}return!0},key(a){let o=Ul(e.selection()),s=o||t,c=Il(a,e.isMac,!!s),l=Ll(a);if(!c&&!l)return!1;if(o)return r(),e.writeClipboard(o),!0;if(!e.available())return i(),c;if(s)return r(),e.writeClipboard(s),!0;if(!e.mouseTracking())return!1;r();let u=new Promise((e,t)=>{let i=setTimeout(()=>{r()},2e3);n={resolve:t=>{clearTimeout(i),e(t)},cancel:()=>{clearTimeout(i),t(new DOMException(`Copy cancelled`,`AbortError`))}}});return e.writeClipboard(u),e.writeInput(l?``:e.isMac?`\x1B[99;9u`:`\x1B[99;6u`),!0},copy(n){let r=Ul(e.selection()),i=r||t;if(!(!r&&!e.available())){if(!i){a.key({type:`keydown`,key:`c`,metaKey:e.isMac,ctrlKey:!e.isMac,shiftKey:!e.isMac,altKey:!1})&&(n.preventDefault(),n.stopPropagation());return}n.clipboardData&&(n.clipboardData.setData(`text/plain`,i),n.preventDefault(),n.stopPropagation())}}};return a}function Kl(e,t){typeof e!=`string`&&e.catch(()=>{}),(async()=>{if(typeof e==`string`)await navigator.clipboard.writeText(e);else if(typeof ClipboardItem<`u`&&navigator.clipboard?.write){let t=e.then(e=>new Blob([e],{type:`text/plain`}));t.catch(()=>{}),await navigator.clipboard.write([new ClipboardItem({"text/plain":t})])}else await navigator.clipboard.writeText(await e)})().catch(async n=>{if(!(n instanceof DOMException&&n.name===`AbortError`)){if(typeof e!=`string`)try{await e}catch{return}t()}})}function ql(e){if(e.type!==`keydown`||e.ctrlKey||e.shiftKey)return null;if(e.metaKey&&!e.altKey)switch(e.key){case`ArrowLeft`:return``;case`ArrowRight`:return``;case`Backspace`:return``;case`Delete`:return`\v`}if(e.altKey&&!e.metaKey)switch(e.key){case`ArrowLeft`:return`\x1Bb`;case`ArrowRight`:return`\x1Bf`}return null}var Jl=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`]);function Yl(e,t,n){if(!n)return e;let r;try{r=new URL(e)}catch{return e}return r.protocol!==`http:`&&r.protocol!==`https:`||!Jl.has(r.hostname)?e:`/forward/${t}/${r.port===``?r.protocol===`https:`?`443`:`80`:r.port}?path=${encodeURIComponent(r.pathname+r.search+r.hash)}`}var Xl=1e3,Zl=250;function Ql(e,t){return o(JSON.stringify([e,t]))}function $l(e){return Number.isFinite(e)?Math.max(0,Math.trunc(e)):0}function eu(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):1}function tu(e,t){return t===0?1:Math.max(0,Math.min(1,e/t))}function nu(e,t){let n=$l(t),r=Math.min(n,$l(e));return{viewportY:r,atBottom:r>=n}}function ru(e,t){let n=$l(t);return e.atBottom?n:Math.min(e.viewportY,n)}function iu(e,t,n,r){let i=nu(e,t),a=i.viewportY;if(!i.atBottom)for(;a>0&&r(a);)a--;return{...i,logicalLineY:a,cellOffset:(i.viewportY-a)*eu(n),scrollProgress:tu(i.viewportY,$l(t))}}function au(e,t,n,r){let i=$l(r);if(e.atBottom)return i;if(t===void 0||t<0)return Math.round(e.scrollProgress*i);let a=$l(t)+Math.floor(e.cellOffset/eu(n));return Math.min(a,i)}var ou=class{timer;managedScrolls=0;state;capture(e){if(this.state)return this.arm(Xl),!0;let t=e.buffer.active;if(t.type!==`normal`)return!1;let n=iu(t.viewportY,t.baseY,e.cols,e=>t.getLine(e)?.isWrapped===!0);if(n.atBottom)return!1;let r=t.baseY+t.cursorY;return this.state={anchor:n,marker:e.registerMarker(n.logicalLineY-r),buffer:t.type},this.arm(Xl),!0}restore(e){let t=this.state,n=e.buffer.active;if(!t||n.type!==t.buffer)return null;let r=t.marker.isDisposed?void 0:t.marker.line;return e.scrollToLine(au(t.anchor,r,e.cols,n.baseY)),r===void 0?(this.arm(Zl),`replaced`):`tracked`}beginManagedScroll(){this.managedScrolls++}endManagedScroll(){this.managedScrolls=Math.max(0,this.managedScrolls-1)}get managingScroll(){return this.managedScrolls>0}release(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.managedScrolls=0,this.state?.marker.dispose(),this.state=void 0}arm(e){this.timer!==void 0&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.release(),e)}},su=new class{maxEntries;positions=new Map;constructor(e=500){this.maxEntries=e}set(e,t,n,r){let i=Ql(e,t),a=nu(n,r);for(this.positions.delete(i),this.positions.set(i,a);this.positions.size>this.maxEntries;){let e=this.positions.keys().next().value;if(e===void 0)break;this.positions.delete(e)}return a}get(e,t){return this.positions.get(Ql(e,t))}},cu=new WeakSet;function lu(e){let t=e._core?._inputHandler,n=t;if(typeof t!=`object`||!t||typeof n?.scrollUp!=`function`||typeof n._eraseAttrData!=`function`||typeof n._bufferService?.scroll!=`function`||typeof n._dirtyRowTracker?.markRangeDirty!=`function`)throw Error(`xterm scrollback internals do not match the pinned 6.0.0 release`);return t}function uu(e){let t=lu(e);if(cu.has(t))return;cu.add(t);let n=t.scrollUp.bind(t);t.scrollUp=e=>{if(t._activeBuffer.scrollTop!==0)return n(e);let r=e.params[0]||1;for(;r--;){let e=t._activeBuffer.ybase;t._bufferService.scroll(t._eraseAttrData()),t._activeBuffer.savedY+=t._activeBuffer.ybase-e}return t._dirtyRowTracker.markRangeDirty(t._activeBuffer.scrollTop,t._activeBuffer.scrollBottom),!0}}function du(e,t,n,r){let i=null,a=!1,o=0,s=null,c=0,l=(n,r)=>{let i=t.getBoundingClientRect(),a=Math.max(0,Math.min(e.cols-1,Math.floor((n-i.left)/(i.width/e.cols)))),o=e.buffer.active.viewportY+Math.max(0,Math.min(e.rows-1,Math.floor((r-i.top)/(i.height/e.rows)))),s=e.buffer.active.getLine(o),c=a>0&&s?.getCell(a)?.getWidth()===0?a-1:a;return{row:o,column:c,width:Math.max(1,s?.getCell(c)?.getWidth()??1)}},u=()=>{if(!i||!s)return;let t=l(s.x,s.y),r=t.row*e.cols+t.column,a=Math.min(i.start,r),o=Math.max(i.end,r+t.width);e.select(a%e.cols,Math.floor(a/e.cols),o-a),n(e.getSelection())},d=()=>{cancelAnimationFrame(o),o=0,s=null},f=n=>{if(o=0,!s)return;let i=t.getBoundingClientRect(),a=s.y<i.top?-1:+(s.y>=i.bottom);a&&n-c>=50&&e.buffer.active.type===`normal`&&(c=n,r(),e.scrollLines(a),u()),o=requestAnimationFrame(f)},p=e.onSelectionChange(()=>{a&&(e.hasSelection()?n(e.getSelection()):(d(),i=null,a=!1,n(null)))});return{begin(t,r){let o=l(t,r),s=e.buffer.active.getLine(o.row),c=o.column,u=o.column+o.width,d=e=>{let t=s?.getCell(e);return t&&(t.getWidth()===0||/\S/u.test(t.getChars()))};if(d(c)){for(;c>0&&d(c-1);)c--;for(;u<e.cols&&d(u);)u++}i={start:o.row*e.cols+c,end:o.row*e.cols+u},a=!0,e.select(c,o.row,u-c),n(e.getSelection())},extend(e,t){s={x:e,y:t},u(),o||=requestAnimationFrame(f)},stop:d,clear:()=>{d(),i=null,a=!1,e.clearSelection(),n(null)},dispose(){d(),p.dispose()}}}var fu=8;function pu(e,t,n,r){let i=e.element?.querySelector(`.xterm-screen`);if(!i)return()=>{};let a=du(e,i,r,n),o,s=null,c=()=>{clearTimeout(o),a.stop(),s=null},l=e=>{if(c(),e.touches.length!==1||!t())return;a.clear();let n=e.touches[0];s={id:n.identifier,x:n.clientX,y:n.clientY,lastY:n.clientY,remainder:0,at:performance.now(),dragged:!1,selecting:!1},o=setTimeout(()=>{!s||!t()||(s.selecting=!0,a.begin(s.x,s.y))},450)},u=r=>{if(!s)return;let l=r.touches[0];if(r.touches.length!==1||l?.identifier!==s.id||!t()){c();return}if(s.selecting){r.preventDefault(),a.extend(l.clientX,l.clientY);return}if(!s.dragged){if(Math.hypot(l.clientX-s.x,l.clientY-s.y)<fu)return;s.dragged=!0,clearTimeout(o)}r.preventDefault();let u=i.getBoundingClientRect(),d=u.height/e.rows;if(d<=0)return;s.remainder+=s.lastY-l.clientY,s.lastY=l.clientY;let f=Math.trunc(s.remainder/d);if(f!==0){if(s.remainder-=f*d,n(),e.buffer.active.type===`normal`&&e.modes.mouseTrackingMode===`none`){e.scrollLines(f);return}for(let e=0;e<Math.abs(f);e++)i.dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:Math.sign(f),clientX:Math.max(u.left,Math.min(u.right-1,l.clientX)),clientY:Math.max(u.top,Math.min(u.bottom-1,l.clientY))}))}},d=n=>{s?.dragged||s?.selecting?n.preventDefault():s&&t()&&performance.now()-s.at<300&&e.focus(),c()},f=e=>{!s||!t()||(e.preventDefault(),e.stopPropagation())};return i.addEventListener(`contextmenu`,f,!0),i.addEventListener(`touchstart`,l,{passive:!0}),i.addEventListener(`touchmove`,u,{passive:!1}),i.addEventListener(`touchend`,d,{passive:!1}),i.addEventListener(`touchcancel`,c),()=>{i.removeEventListener(`touchstart`,l),i.removeEventListener(`touchmove`,u),i.removeEventListener(`touchend`,d),i.removeEventListener(`touchcancel`,c),i.removeEventListener(`contextmenu`,f,!0),c(),a.dispose()}}var mu=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,hu=8,gu=2,_u=[,,,,,].fill(` `.repeat(hu)).join(`
|
|
62
62
|
`),vu=22;function yu(e,t){if(!mu)return()=>{};let n=e.textarea,r=n.parentElement,i=new AbortController,a={capture:!0,signal:i.signal},o=!1,s=e.onKey(({domEvent:e})=>e.preventDefault());n.style.whiteSpace=`pre`;let c=n=>{n&&t()&&e.input(n,!0)},l=()=>{n.value!==_u&&(n.value=_u),n.setSelectionRange(vu,vu)};return r.addEventListener(`focus`,l,a),r.addEventListener(`blur`,l,a),r.addEventListener(`keydown`,e=>{o||e.isComposing?e.stopImmediatePropagation():l()},a),r.addEventListener(`keyup`,()=>{o||l()},a),r.addEventListener(`beforeinput`,e=>{o||e.isComposing||(e.preventDefault(),l(),c({insertText:e.data,insertLineBreak:`\r`,insertParagraph:`\r`,deleteContentBackward:``,deleteWordBackward:`\x1B`,deleteContentForward:`\x1B[3~`}[e.inputType]??null))},a),r.addEventListener(`compositionstart`,e=>{e.stopImmediatePropagation(),l(),o=!0},a),r.addEventListener(`compositionupdate`,e=>e.stopImmediatePropagation(),a),r.addEventListener(`compositionend`,e=>{e.stopImmediatePropagation(),o=!1,c(e.data),l()},a),document.addEventListener(`selectionchange`,()=>{if(o||document.activeElement!==n)return;let{selectionStart:r,selectionEnd:i}=n;if(!(n.value===_u&&r===vu&&i===vu)){if(n.value===_u&&t()){let t=r===vu?i:r,n=Math.floor(t/9)-gu,a=t%9-hu/2;if(Math.abs(n||a)<gu)return;let o=n<0?`A`:n>0?`B`:a<0?`D`:`C`;c(`\x1b${e.modes.applicationCursorKeysMode?`O`:`[`}${o}`)}l()}},{signal:i.signal}),document.activeElement===n&&l(),()=>{s.dispose(),i.abort()}}var bu=e(n(),1),xu=128,Su=32768,Cu=32,wu=/^\s*(`{3,}|~{3,})(.*)$/,Tu=/^\s*(?:flowchart|graph)\s+(?:TB|TD|BT|RL|LR)\s*;?\s*$/,Eu=/^\s*sequenceDiagram\s*$/;function Du(e,t){let n=e.trim();return n===``||/^(?:%%|end\b)/.test(n)?!0:t?/^(?:participant|actor|create|destroy|activate|deactivate|note|loop|alt|else|opt|par|and|critical|option|break|rect|autonumber)\b/i.test(n)||/^\S+\s*(?:--?|<<-)[<>x)+-]*>/.test(n):/^(?:subgraph|direction|style|classDef|class|linkStyle)\b/.test(n)||/^[\w-]+\s*(?:\[|\(|\{|>|@\{|<*[-=.]+[->ox| ])/.test(n)}function Ou(e,t,n,r){if(t<1||r<1)return[];let i=Math.min(xu,Math.max(0,Math.floor((Su/(t+1)-r)/2))),a=Math.max(0,n-i),o=Math.min(e.length,n+r+i),s=[],c=0;for(let n=a;n<o;n++){let r=he(e,n,t);if(!r)break;let i=e.getLine(n+1)?.isWrapped?r.text.length:r.text.trimEnd().length;if(c+=i+1,c>Su)break;let a=s.at(-1);r.isWrapped&&a?(a.text+=r.text.slice(0,i),a.cells.push(...r.cells.slice(0,i))):s.push({text:r.text.slice(0,i),cells:r.cells.slice(0,i)})}let l=[],u=(t,i,a,o)=>{let s=o[0],c=o.at(-1);if(!s||!c||!i.trim()||l.length>=Cu||c.row<n||s.row>=n+r)return;let u=e.getLine(c.row)?.getCell(c.col)?.getWidth()??1;l.push({kind:t,source:i.trim(),display:a,start:s,end:{row:c.row,col:c.col+Math.max(1,u)-1}})};for(let e=0;e<s.length&&l.length<Cu;e++){let t=s[e],n=wu.exec(t.text);if(n){let t=e+1;for(;t<s.length;){let e=wu.exec(s[t].text);if(e&&!e[2].trim()&&e[1][0]===n[1][0]&&e[1].length>=n[1].length)break;t++}if(t===s.length)break;let r=n[2].trim().split(/\s+/)[0].toLowerCase();if([`mermaid`,`math`,`latex`,`tex`].includes(r)){let n=s.slice(e+1,t).map(e=>e.text).join(`
|
|
63
63
|
`);u(r===`mermaid`?`mermaid`:`math`,n,!0,s.slice(e,t+1).flatMap(e=>e.cells))}e=t;continue}let r=Eu.test(t.text);if(Tu.test(t.text)||r){let t=e+1;for(;t<s.length&&Du(s[t].text,r);)t++;for(;t>e+1&&!s[t-1].text.trim();)t--;if(t>e+1){let n=s.slice(e,t);u(`mermaid`,n.map(e=>e.text).join(`
|
|
64
|
-
`),!0,n.flatMap(e=>e.cells)),e=t-1;continue}}let i=t.text.trim();if(i.startsWith(`$$`)||i.startsWith(`\\[`)){let t=i,n=e,r=ve(t);for(;!r&&n+1<s.length&&(t+=`\n${s[++n].text.trim()}`,r=ve(t),!/\n\s*\n/.test(t)););if(r?.display&&r.length===t.length){u(`math`,r.tex,!0,s.slice(e,n+1).flatMap(e=>e.cells)),e=n;continue}if(i===`$$`||i===`\\[`)continue}for(let e=0;e<t.text.length;e++){if(t.text[e]==="`"){let n=/^`+/.exec(t.text.slice(e))[0],r=t.text.indexOf(n,e+n.length);if(r<0)break;e=r+n.length-1;continue}let n=ve(t.text,e);if(n){let r=t.cells.slice(e,e+n.length);(r[0]?.row===r.at(-1)?.row||t.text.trim()===t.text.slice(e,e+n.length))&&u(`math`,n.tex,n.display,r),e+=n.length-1}else t.text[e]===`\\`&&e++}}return l}var ku=c();function Au({block:e,box:t,theme:n,fontSize:r}){let i=(0,w.useRef)(null),a=(0,w.useRef)(null),[o,s]=(0,w.useState)(!1),[c,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(!1),{source:p,kind:m,display:h}=e;(0,w.useEffect)(()=>{let e=i.current;if(!e)return;let t=new AbortController;return s(!1),u(``),e.replaceChildren(),(async()=>{if(m===`mermaid`){let{renderMermaidDiagrams:r}=await l(async()=>{let{renderMermaidDiagrams:e}=await import(`./markdown-mermaid-
|
|
64
|
+
`),!0,n.flatMap(e=>e.cells)),e=t-1;continue}}let i=t.text.trim();if(i.startsWith(`$$`)||i.startsWith(`\\[`)){let t=i,n=e,r=ve(t);for(;!r&&n+1<s.length&&(t+=`\n${s[++n].text.trim()}`,r=ve(t),!/\n\s*\n/.test(t)););if(r?.display&&r.length===t.length){u(`math`,r.tex,!0,s.slice(e,n+1).flatMap(e=>e.cells)),e=n;continue}if(i===`$$`||i===`\\[`)continue}for(let e=0;e<t.text.length;e++){if(t.text[e]==="`"){let n=/^`+/.exec(t.text.slice(e))[0],r=t.text.indexOf(n,e+n.length);if(r<0)break;e=r+n.length-1;continue}let n=ve(t.text,e);if(n){let r=t.cells.slice(e,e+n.length);(r[0]?.row===r.at(-1)?.row||t.text.trim()===t.text.slice(e,e+n.length))&&u(`math`,n.tex,n.display,r),e+=n.length-1}else t.text[e]===`\\`&&e++}}return l}var ku=c();function Au({block:e,box:t,theme:n,fontSize:r}){let i=(0,w.useRef)(null),a=(0,w.useRef)(null),[o,s]=(0,w.useState)(!1),[c,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(!1),{source:p,kind:m,display:h}=e;(0,w.useEffect)(()=>{let e=i.current;if(!e)return;let t=new AbortController;return s(!1),u(``),e.replaceChildren(),(async()=>{if(m===`mermaid`){let{renderMermaidDiagrams:r}=await l(async()=>{let{renderMermaidDiagrams:e}=await import(`./markdown-mermaid-SyDYdSZz.js`).then(e=>e.t);return{renderMermaidDiagrams:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));if(t.signal.aborted)return;let i=document.createElement(`div`);if(i.setAttribute(`data-puddle-mermaid`,``),i.textContent=p,e.append(i),await r(e,n,t.signal,!0),t.signal.aborted)return;let a=i.querySelector(`svg`);if(!a)throw Error(`Unable to render Mermaid diagram`);let o=a.viewBox.baseVal;a.style.maxWidth=`none`,a.style.width=`${o.width}px`,a.style.height=`${o.height}px`}else{let[{renderMathHtml:n},{default:r}]=await Promise.all([l(()=>import(`./math-CSw6sgCC.js`).then(e=>e.n),__vite__mapDeps([10,1,11])),l(()=>import(`./purify.es-D8QhFVkO.js`).then(e=>e.n),__vite__mapDeps([12,1])),l(()=>import(`./katex.min-ZqdHjttS.js`).then(e=>e.t),__vite__mapDeps([13,1,14]))]);if(t.signal.aborted)return;if(e.innerHTML=r.sanitize(n(p,h)),e.querySelector(`.katex-error`))throw Error(`Unable to render LaTeX`)}t.signal.aborted||s(!0)})().catch(e=>{t.signal.aborted||u(e instanceof Error?e.message:`Unable to render output`)}),()=>t.abort()},[p,m,h,n]),(0,w.useLayoutEffect)(()=>{let e=i.current,t=a.current;if(!e||!t)return;let n=()=>{let n=e.scrollWidth,r=e.scrollHeight;if(!n||!r)return;let i=Math.min(1,t.clientWidth/n,t.clientHeight/r);e.style.transform=`scale(${i})`,e.style.left=`${h?(t.clientWidth-n*i)/2:0}px`,e.style.top=`${(t.clientHeight-r*i)/2}px`},r=new ResizeObserver(n);return r.observe(e),r.observe(t),n(),()=>r.disconnect()},[h,o]);let g=o&&!d,_=g?`Show terminal source`:`Render ${m===`math`?`LaTeX`:`Mermaid`}`;return(0,ku.jsxs)(`div`,{ref:a,className:ie(`absolute overflow-hidden`,g&&`bg-ground`),style:{...t,fontSize:r},"data-terminal-rich-block":m,"data-rendered":g,children:[(0,ku.jsx)(`div`,{ref:i,className:ie(`absolute w-max origin-top-left text-fg`,!g&&`invisible`),"aria-hidden":!g}),(0,ku.jsx)(`button`,{type:`button`,"aria-label":_,title:c||_,style:{top:Math.max(0,-t.top)},disabled:!o,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),f(e=>!e)},className:`pointer-events-auto absolute right-0 top-0 rounded-sm bg-ground p-0.5 text-fg-muted opacity-0 transition-opacity hover:text-fg focus:opacity-100 group-hover/terminal:opacity-100 pointer-coarse:opacity-100`,children:g?(0,ku.jsx)(S,{className:`size-3`}):(0,ku.jsx)(ue,{className:`size-3`})})]})}function ju(e,t){return t.map(({start:t,end:n})=>{let r=[];for(let i=t.row;i<=n.row;i++)r.push(e.getLine(i)?.translateToString(!0)??``);return r.join(`
|
|
65
65
|
`)}).join(`
|
|
66
66
|
\0`)}function Mu({terminal:e}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(!1),a=(0,w.useSyncExternalStore)(u,p,p),o=e.element?.querySelector(`.xterm-screen`);if((0,w.useEffect)(()=>{if(!o)return;let t,r=0,a=!0,s,c=()=>{r=0;let t=e.buffer.active,c=Ou(t,e.cols,t.viewportY,e.rows);s={blocks:c,signature:ju(t,c),buffer:t,viewportY:t.viewportY,cols:e.cols},n({blocks:c,viewportY:t.viewportY,buffer:t.type,width:o.clientWidth,cellWidth:o.clientWidth/e.cols,cellHeight:o.clientHeight/e.rows,fontSize:e.options.fontSize??14}),a=!1,i(e.hasSelection())},l=(e,n=!1)=>{n||(i(!0),a=!0),!(e>0&&(t!==void 0||r!==0))&&(clearTimeout(t),cancelAnimationFrame(r),t=setTimeout(()=>{t=void 0,r=requestAnimationFrame(c)},e))},u=[e.onWriteParsed(()=>{let t=e.buffer.active,n=!!s&&s.buffer===t&&s.cols===e.cols&&s.viewportY===t.viewportY&&s.signature===ju(t,s.blocks);l(120,n)}),e.onScroll(()=>l(0)),e.onResize(()=>l(0)),e.buffer.onBufferChange(()=>l(0)),e.onSelectionChange(()=>i(a||e.hasSelection()))],d=new ResizeObserver(()=>l(0));return d.observe(o),l(0),()=>{clearTimeout(t),cancelAnimationFrame(r),d.disconnect();for(let e of u)e.dispose()}},[e,o]),!o||!t)return null;let{cellWidth:s,cellHeight:c,viewportY:l,width:d}=t;return(0,bu.createPortal)((0,ku.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 overflow-hidden`,style:{visibility:r?`hidden`:void 0},children:t.blocks.map(e=>{let n=e.start.row!==e.end.row,r=n?0:e.start.col*s;return(0,ku.jsx)(Au,{block:e,theme:a,fontSize:t.fontSize,box:{left:r,top:(e.start.row-l)*c,width:n?d:(e.end.col-e.start.col+1)*s,height:(e.end.row-e.start.row+1)*c}},`${t.buffer}:${e.start.row}:${e.start.col}:${e.source}`)})}),o)}var Nu=/Mac|iPhone|iPad/.test(navigator.platform),Pu=`'Ubuntu Sans Mono', ui-monospace, monospace`,Fu=`12px 'Ubuntu Sans Mono'`,Iu=typeof document>`u`||!(`fonts`in document)||document.fonts.check(Fu),Lu=Iu?null:document.fonts.load(Fu).catch(()=>void 0).then(()=>{Iu=!0});function Ru(){let[e,t]=(0,w.useState)(Iu);return(0,w.useEffect)(()=>{if(e||Lu===null)return;let n=!0;return Lu.then(()=>{n&&t(!0)}),()=>{n=!1}},[e]),e}var zu=[`starting`,`running`,`waiting_input`];function Bu(e){let t=f();return{...e,decorations:{matchBackground:t(`--bg-surface`),matchBorder:t(`--text-muted`),matchOverviewRuler:t(`--text-muted`),activeMatchBackground:t(`--bg-elevated`),activeMatchBorder:t(`--accent`),activeMatchColorOverviewRuler:t(`--accent`)}}}function Vu(e,t){let[n,r]=(0,w.useState)(e);return(0,w.useEffect)(()=>{if(e){r(!0);return}let n=setTimeout(()=>r(!1),t);return()=>clearTimeout(n)},[e,t]),n}var Hu=1500;function Uu({stream:e,term:t=`agent`,className:n,onExit:o,onOpenFile:c,paused:l=!1}){let p=(0,w.useRef)(null),b=(0,w.useRef)(null),[ue,he]=(0,w.useState)(null),S=(0,w.useRef)(null),[ve,ye]=(0,w.useState)(null),be=(0,w.useRef)(null),xe=(0,w.useRef)(null),T=(0,w.useRef)(new ou),E=(0,w.useRef)(!1),Se=(0,w.useRef)(!1),Ce=s(),we=ae(),Te=(0,w.useRef)(o);Te.current=o;let Ee=(0,w.useRef)(c);Ee.current=c;let De=Ml(),Oe=(0,w.useRef)(!l&&De);Oe.current=!l&&De;let ke=Vu(!l&&De,Hu),Ae=Ru(),je=a(r().data?.protocol),Me=i(h()??void 0).data?.terminalAppShortcuts!==!1,Ne=(0,w.useRef)(Me);Ne.current=Me;let D=oe({shortcutEnabled:!1,onFind:(e,t,n)=>{let r=xe.current,i=b.current;if(!r||!i)return se;if(e.length===0)return r.clearDecorations(),i.clearSelection(),se;if(!v(e,t))return r.clearDecorations(),i.clearSelection(),{index:-1,count:0,invalid:!0};let a=Bu(t);n===`previous`?r.findPrevious(e,a):r.findNext(e,{...a,incremental:n===`reset`})},onClear:()=>{xe.current?.clearDecorations(),b.current?.clearSelection()},onCloseFocus:()=>b.current?.focus()}),Pe=(0,w.useCallback)(n=>{if(!Se.current||E.current)return;T.current.restore(n);let r=n.buffer.active;r.type===`normal`&&su.set(e,t,r.viewportY,r.baseY)},[e,t]),Fe=(0,w.useCallback)(()=>{let e=b.current,t=p.current;if(!e||!t||t.clientWidth===0||t.clientHeight===0)return null;let n=T.current;n.capture(e),n.beginManagedScroll();try{be.current?.fit(),e.refresh(0,e.rows-1),Pe(e)}finally{n.endManagedScroll()}return e},[Pe]),Ie=(0,w.useCallback)(()=>{if(!Oe.current)return;let n=Fe();n&&C.resize(e,t,n.cols,n.rows)},[Fe,e,t]);return(0,w.useEffect)(()=>{if(!De)return;let e=requestAnimationFrame(()=>{let e=b.current;e&&e.refresh(0,e.rows-1)});return()=>cancelAnimationFrame(e)},[De]),(0,w.useEffect)(()=>{let n=p.current;if(!n||!Ae)return;let r=e.startsWith(`login-`)||e===`home`,i=t=>{ne(r?t:Yl(t,e,ge()!==null)).catch(_e)},a=new uc({allowProposedApi:!0,...d(),fontFamily:Pu,fontSize:Ce.terminalFontSize,scrollback:Ce.terminalScrollback,cursorBlink:!we,macOptionClickForcesSelection:Nu,linkHandler:{activate:(e,t)=>i(t)}});uu(a),Se.current=!1,E.current=!1,b.current=a;let o=new pc,s=new Al;a.loadAddon(o),a.loadAddon(s);let c=Hl(a,i);a.open(n),he(a),o.fit(),be.current=o,xe.current=s;let l=s.onDidChangeResults(e=>{D.setResult({index:e.resultIndex,count:e.resultCount})}),h=a.onScroll(n=>{if(!Se.current||E.current)return;T.current.managingScroll||T.current.release();let r=a.buffer.active;r.type===`normal`&&su.set(e,t,n,r.baseY)}),ie=Ee.current&&!r?de(a,e,e=>Ee.current?.(e)):null,ae=Gl({isMac:Nu,selection:()=>Wl(a),mouseTracking:()=>a.modes.mouseTrackingMode!==`none`,available:()=>Oe.current&&C.isConnected()&&!E.current,writeInput:n=>C.write(e,t,n),writeClipboard:e=>Kl(e,()=>{re.error(`Could not copy the selection. Allow clipboard access and try again.`)})});S.current=ae;let oe=e=>ae.copy(e),v=()=>ae.reset();n.addEventListener(`copy`,oe,!0),n.addEventListener(`focusout`,v),n.addEventListener(`mousedown`,v,!0),window.addEventListener(`blur`,v);let se=null,ce=yu(a,()=>Oe.current&&C.isConnected()&&!E.current),ue=le(e,t,e=>{se=[];try{return a.paste(e),se.join(``)}finally{se=null}},()=>a.focus(),()=>a.modes.applicationCursorKeysMode),x=a.onData(n=>{if(se){se.push(n);return}E.current||(ae.input(n),C.write(e,t,pe(e,t,n)))}),me=Fl(a,{daemonAnswers:je,isReplaying:()=>E.current,readColour:e=>f()(e===10?`--text-primary`:`--bg-base`),reply:n=>C.write(e,t,n)}),ve=a.parser.registerOscHandler(52,ae.osc);a.attachCustomKeyEventHandler(n=>{if(n.type===`keydown`&&y(n,Nu))return n.preventDefault(),D.openFind(),!1;if(ae.key(n))return n.preventDefault(),!1;if(n.type===`keydown`&&Ne.current){let e=g(n),t=e===null?void 0:ee(e),r=t===void 0?void 0:_(t);if(t!==void 0&&r!==void 0&&!r.editor&&!r.deferInTerminal&&te(t)!==void 0)return!1}if(!Nu)return!0;let r=ql(n);return r?(n.preventDefault(),C.write(e,t,r),!1):!0});let w=n=>{fe(n,e,t)&&(n.preventDefault(),n.stopPropagation())};n.addEventListener(`paste`,w,!0);let Te=()=>T.current.release();n.addEventListener(`wheel`,Te,{capture:!0,passive:!0});let De=pu(a,()=>Oe.current,Te,e=>ye(e===null?null:Wl(a))),ke=()=>Ie();n.addEventListener(`focusin`,ke);let Me=new ResizeObserver(()=>Ie());Me.observe(n);let Pe=u(()=>{a.options.theme=m(),D.refresh()});return()=>{ae.reset(),S.current=null,n.removeEventListener(`copy`,oe,!0),n.removeEventListener(`focusout`,v),n.removeEventListener(`mousedown`,v,!0),window.removeEventListener(`blur`,v),n.removeEventListener(`paste`,w,!0),n.removeEventListener(`wheel`,Te,!0),n.removeEventListener(`focusin`,ke),De(),ce(),Me.disconnect(),Pe(),T.current.release(),l.dispose(),h.dispose(),me.dispose(),ve.dispose(),c.dispose(),ie?.dispose(),ue(),x.dispose(),a.dispose(),he(null),b.current=null,be.current=null,xe.current=null}},[e,t,Ie,Ae,je]),(0,w.useEffect)(()=>{let n=b.current;if(!n||!ke)return;let r=p.current;r&&r.clientWidth>0&&r.clientHeight>0&&Fe(),n.refresh(0,n.rows-1);let i=0,a=0,o=[],s=()=>{if(i!==0&&cancelAnimationFrame(i),i=0,a===0)return;let e=o.join(``);o=[],a=0;let t=T.current;t.beginManagedScroll(),n.write(e,()=>{try{Pe(n)}finally{t.endManagedScroll()}})},c=e=>{o.push(e),a+=e.length,a>=64*1024?s():i===0&&(i=requestAnimationFrame(s))},l=C.attach(e,t,n.cols,n.rows,{onData:(r,s)=>{if(s===`replay`){i!==0&&cancelAnimationFrame(i),i=0,a=0,o=[];let s=su.get(e,t);S.current?.reset(),E.current=!0;let c=T.current;c.beginManagedScroll(),n.reset(),n.write(r,()=>{try{if(b.current!==n)return;E.current=!1,Se.current=!0,n.refresh(0,n.rows-1),s&&(n.scrollToLine(ru(s,n.buffer.active.baseY)),c.capture(n)),Pe(n)}finally{c.endManagedScroll()}});return}c(r)},onExit:e=>Te.current?.(e)});return()=>{i!==0&&cancelAnimationFrame(i),S.current?.reset(),l()}},[e,t,ke,Ae,je,Fe,Pe]),(0,w.useEffect)(()=>{let e=b.current;e&&(e.options.cursorBlink=!we,e.options.fontSize=Ce.terminalFontSize,e.options.scrollback=Ce.terminalScrollback,Ie())},[Ce.terminalFontSize,Ce.terminalScrollback,Ie,we]),(0,w.useEffect)(()=>{let t=!1;return C.onStatus(n=>{if(n.session!==e)return;let r=zu.includes(n.status);r&&!t&&Ie(),t=r})},[e,Ie]),(0,ku.jsxs)(`div`,{className:ie(`puddle-terminal group/terminal relative size-full`,n),"data-notification-session":!l&&t===`agent`?e:void 0,children:[(0,ku.jsx)(`div`,{ref:p,className:`size-full`}),ue&&!l&&De&&(0,ku.jsx)(Mu,{terminal:ue}),ve!==null&&!l&&(0,ku.jsx)(me,{label:`Selected terminal text`,text:ve,paste:()=>x(e,t,()=>Oe.current),clear:()=>{b.current?.clearSelection(),ye(null)}}),D.open&&(0,ku.jsx)(ce,{query:D.query,focusKey:D.focusKey,options:D.options,result:D.result,onQueryChange:D.setQuery,onOptionsChange:D.setOptions,onNext:D.next,onPrevious:D.previous,onClose:D.close})]})}export{Uu as Terminal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
html.sidebar-transition::view-transition{pointer-events:none}html.sidebar-transition .control-tray-selection{transition:none}html.sidebar-transition::view-transition-group(*){animation-duration:.28s;animation-timing-function:ease-out}html.sidebar-transition::view-transition-old(root){display:none}html.sidebar-transition::view-transition-new(root){animation:none}html.sidebar-transition::view-transition-old(*.sidebar-item){object-fit:none;object-position:left center;width:100%;height:100%;animation-duration:.14s}html.sidebar-transition::view-transition-new(*.sidebar-item){object-fit:none;object-position:left center;width:100%;height:100%;animation-duration:.14s}@media (prefers-reduced-motion:reduce){html.sidebar-transition::view-transition-group(*){animation-duration:0s}}html[data-reduce-motion=true]::view-transition-group(*){animation:none!important}html[data-reduce-motion=true]::view-transition-old(*){animation:none!important}html[data-reduce-motion=true]::view-transition-new(*){animation:none!important}.island-resize-edge{z-index:30;pointer-events:none;box-sizing:border-box;border:3px solid var(--border);position:fixed}.remote-viewport,.remote-viewport body{overscroll-behavior:none;height:100%;overflow:hidden}.remote-viewport #root{top:var(--phone-top,0px);height:var(--phone-height,100dvh);overscroll-behavior:none;position:fixed;inset-inline:0;overflow:auto}.remote-ui{overscroll-behavior:contain;height:100%;color:var(--text-primary);background:var(--bg-base);overflow:auto}.remote-account{width:min(calc(100% - 2 * var(--ui-surface-gap)), 28rem);margin:max(2rem, env(safe-area-inset-top)) auto;background:var(--bg-surface);border-radius:var(--ui-surface-radius);outline:1px solid var(--border);outline-offset:-1px;padding:1.5rem}.remote-dashboard{max-width:52rem;padding:max(1.5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));margin-inline:auto}.remote-host-projects{padding-block:1.25rem}.remote-host-projects+.remote-host-projects{border-top:1px solid var(--border)}.remote-connected{gap:var(--ui-surface-gap);height:100%;padding:max(var(--ui-surface-gap), env(safe-area-inset-top)) max(var(--ui-surface-gap), env(safe-area-inset-right)) max(var(--ui-surface-gap), env(safe-area-inset-bottom)) max(var(--ui-surface-gap), env(safe-area-inset-left));flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden}.remote-topbar{flex:none;align-items:center;gap:.25rem;padding:.125rem;display:flex}.remote-topbar>button{min-width:2.75rem;min-height:2.75rem}.remote-workspace{flex:1;min-height:0}.phone-workspace{--phone-workspace-bar-height:2.75rem;min-width:0;height:100%;min-height:0;color:var(--text-primary);background:var(--bg-base);flex-direction:column;display:flex}.phone-workspace-bar{min-width:0;height:var(--phone-workspace-bar-height);background:var(--bg-surface);border-radius:var(--ui-radius);flex:none;justify-content:space-between;align-items:center;gap:.25rem;padding:.125rem .25rem;display:flex}.phone-workspace-bar button{min-height:2.5rem}.phone-terminal-title{border-radius:var(--ui-radius);background:var(--bg-surface);flex:1;align-items:center;min-width:0;display:flex}.phone-workspace-body{flex:1;min-height:0;display:flex;position:relative;overflow:hidden}.phone-centre{isolation:isolate;flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.phone-session-rail{gap:var(--ui-surface-gap);flex-direction:column;flex:none;width:2.75rem;display:flex}.phone-session-rail.is-expanded{z-index:30;background:var(--bg-elevated);width:min(18rem,85%);position:absolute;inset:0 auto 0 0}.phone-rail-backdrop{z-index:20;background:color-mix(in srgb, var(--bg-base) 70%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);position:absolute;inset:0}.phone-session-rail .rail-control{width:100%;height:2rem;min-height:2rem;font-size:var(--text-2xs);color:var(--text-gold);padding:.25rem}.phone-session-rail .rail-control:hover{color:var(--text-primary);background:var(--bg-elevated)}.phone-session-rail .rail-toggle{min-height:var(--phone-workspace-bar-height);height:var(--phone-workspace-bar-height)}.phone-session-rail .rail-control svg{width:1rem;height:1rem}.phone-session-rail.is-expanded .rail-control{justify-content:start;gap:.75rem}.phone-session-group{margin-top:.25rem}.phone-project-label{white-space:nowrap;width:100%;min-height:2rem;font-family:var(--font-mono);font-size:calc(var(--text-2xs) * .9);color:var(--text-muted);overflow:hidden}.phone-project-label:hover{color:var(--text-primary)}.is-expanded .phone-project-label{text-align:left;font-size:var(--text-2xs);font-family:var(--font-sans);text-overflow:ellipsis;padding-inline:.75rem}.phone-session-button{border-radius:var(--ui-radius);touch-action:pan-y;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;justify-content:center;align-items:center;gap:.75rem;width:100%;min-width:0;min-height:2rem;padding:.25rem;display:flex}.phone-session-button:hover{background:var(--bg-elevated)}.is-expanded .phone-session-button{justify-content:start}.phone-view{flex:1;min-height:0;position:relative}.phone-view[hidden],.phone-terminal[hidden]{display:none}.phone-terminal{flex-direction:column;padding-inline:.25rem;display:flex;position:absolute;inset:0}.phone-composer{background:var(--bg-base);flex:none;min-width:0;padding-block:.25rem}.phone-keys{scrollbar-width:none;overscroll-behavior-x:contain;display:flex;overflow-x:auto}.phone-keys button{min-width:var(--phone-key-min-width);min-height:2.75rem;padding-inline:var(--phone-key-padding-inline);font-size:var(--text-xs);touch-action:manipulation;flex:none}.phone-composer form{align-items:flex-end;gap:.5rem;padding:.25rem;display:flex}.phone-composer textarea{resize:none;flex:1;min-width:0;max-height:25dvh}.phone-composer p{margin-block:.5rem}.phone-files{flex-direction:column;height:100%;min-height:0;display:flex}.phone-files button{min-height:2.75rem}.phone-files .phone-workspace-bar button{min-height:2.5rem}.phone-files-toolbar{gap:0}.phone-file-row{text-align:left;min-width:0;font-size:var(--text-xs);font-family:var(--font-sans);border-radius:var(--ui-radius);touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;flex:1;align-items:center;gap:.5rem;padding:.5rem;display:flex}.phone-file-row:hover{background:var(--bg-surface)}.phone-file-source{font-family:var(--font-mono);font-size:var(--text-xs);white-space:pre;tab-size:2;-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}.phone-review{overscroll-behavior:contain;flex:1;min-height:0;padding:.5rem;overflow:auto}.phone-review nav{flex-wrap:wrap;gap:.25rem;margin-bottom:.5rem;display:flex}.phone-review .phone-file-source{font-family:var(--font-mono);font-size:var(--text-xs);white-space:pre-wrap;overflow-wrap:anywhere;padding-block:1rem}.phone-review [aria-pressed=true]{background:var(--bg-surface)}.phone-diff-hunk{margin-bottom:1.5rem}.phone-diff-pane+.phone-diff-pane{margin-top:.75rem}.phone-diff-code{font-family:var(--font-mono);font-size:var(--text-xs);tab-size:2;-webkit-user-select:text;user-select:text}.phone-diff-line{align-items:baseline;min-height:1.5em;display:flex}.phone-diff-number,.phone-diff-sign{color:var(--text-muted);-webkit-user-select:none;user-select:none;flex:none}.phone-diff-number{text-align:right;width:4ch;padding-right:.5ch}.phone-diff-sign{text-align:center;width:2ch}.phone-diff-line code{white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-width:0}.phone-diff-line[data-change=added],.phone-diff-line[data-change=added] mark{background:var(--diff-added)}.phone-diff-line[data-change=removed],.phone-diff-line[data-change=removed] mark{background:var(--diff-removed)}.phone-diff-line mark{color:inherit}.phone-file{text-align:left;white-space:normal;overflow-wrap:anywhere;width:100%;height:auto;display:block}.phone-empty{color:var(--text-muted);padding:1rem}.phone-selectors{gap:.5rem;padding:.5rem;display:flex}.phone-selectors select{flex:1;min-width:0;min-height:2.75rem;padding:.5rem}.phone-selectors>button{min-height:2.75rem}.remote-viewport [role=dialog]{overscroll-behavior:contain}@media (pointer:coarse){input,textarea,select,.xterm-helper-textarea{font-size:max(16px,1rem)}[role=dialog] button,.remote-account button{min-height:2.75rem}}.remote-dashboard-header,.remote-topbar,.phone-centre,.phone-rail-controls,.phone-session-group,.phone-rail-archive{border-radius:var(--ui-surface-radius);background:var(--bg-surface);outline:1px solid var(--border);outline-offset:-1px}.remote-dashboard-header{justify-content:space-between;align-items:center;gap:var(--ui-surface-gap);margin-bottom:var(--ui-surface-gap);padding:.25rem .25rem .25rem .75rem;display:flex}.remote-controls>button{min-width:2.5rem;min-height:2.5rem}.phone-workspace-body{gap:var(--ui-surface-gap)}.phone-centre{padding:.25rem;overflow:hidden}.phone-view{border-radius:var(--ui-radius);background:var(--bg-base);overflow:hidden}.phone-terminal-title{background:var(--bg-elevated);border-radius:var(--ui-surface-radius)}.phone-rail-controls{background:var(--bg-tray);flex-direction:column;flex-shrink:0;padding:.25rem;display:flex}.phone-rail-controls .rail-toggle{margin-bottom:.375rem;position:relative}.phone-rail-controls .rail-toggle:after{content:"";bottom:-.1875rem;background:var(--border);height:1px;position:absolute;inset-inline:.25rem}.phone-session-group{margin-top:0;margin-bottom:var(--ui-surface-gap);background:var(--bg-tray);padding:.25rem}.phone-rail-archive{background:var(--bg-tray);flex-shrink:0;padding:.25rem}.phone-rail-archive .rail-control{min-height:2.25rem}.phone-session-rail.is-expanded{border-radius:var(--ui-surface-radius);background:var(--bg-surface);outline:1px solid var(--border);outline-offset:-1px;box-shadow:var(--ui-overlay-shadow);padding:.25rem}.is-expanded .phone-rail-controls{background:var(--bg-elevated)}.is-expanded .phone-session-group{background:0 0;border-radius:0;outline:none;margin-inline:.25rem}.is-expanded .phone-session-group+.phone-session-group{border-top:1px solid var(--border)}.phone-project-label{cursor:pointer;border-radius:var(--ui-radius)}.phone-project-label:hover{background:var(--bg-elevated)}.phone-session-rail .rail-control{color:var(--text-primary);border-radius:var(--ui-radius)}.phone-session-rail .rail-control:not(:disabled):hover{background:var(--bg-base)}.phone-keys{border-radius:var(--ui-surface-radius);background:var(--bg-elevated)}.phone-keys [aria-pressed=true]{background:var(--action);color:var(--action-ink)}.phone-session-rail .control-tray{align-items:stretch}.phone-session-rail .control-tray>button{height:auto;min-height:2.75rem}.phone-session-rail.is-expanded .control-tray>button{justify-content:flex-start;gap:.75rem;padding-inline:.75rem}.phone-session-button{min-height:2.75rem}.phone-session-group>div>button:last-child:not(:first-child){min-width:2.75rem;min-height:2.75rem}.session-sidebar-controls{height:calc(var(--ui-control-height) + 1.125rem);padding:.375rem .5rem;display:flex;position:relative}.session-sidebar-search-tray{width:calc(var(--ui-control-height) * 3 + 1.5rem);transition:width .18s;position:absolute;right:.5rem}.session-sidebar-controls[data-searching=true] .session-sidebar-search-tray{width:calc(100% - 1rem)}.session-sidebar-search-tray input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}@media (prefers-reduced-motion:reduce){.session-sidebar-search-tray{transition:none}}.collapsed-session-list{border-radius:var(--ui-surface-radius);flex-basis:auto}.collapsed-session-project+.collapsed-session-project:before{content:"";top:0;inset-inline:var(--ui-list-inset);background:var(--border);height:1px;position:absolute}.session-hover-surface{background:var(--explorer-hover)}.collapsed-session-list>.session-hover-surface{background:var(--bg-elevated)}.session-hover-row{z-index:1}.session-hover-list>:not(.session-hover-surface){z-index:1;position:relative}.pane-tab-controls:has(>button):not(:has(>button~button)){padding:0}.pane-single-tab-edge{z-index:20;height:.5rem;position:absolute;inset:0 0 auto}.pane-single-tab>:not(.pane-tab-controls):not(input){display:none}.pane-single-tab>.pane-tab-controls{top:.375rem;right:.375rem;translate:none}.pane-single-tab.pane-tab-renaming{height:var(--ui-field-height);padding-inline:var(--ui-list-inset);background:var(--bg-base);border-radius:var(--ui-radius)}
|