@openchambery/web 1.19.13-beta.7 → 1.19.13-beta.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.
Files changed (38) hide show
  1. package/dist/assets/{AssistantView-DhV6GhFz.js → AssistantView-9oT-4rrf.js} +1 -1
  2. package/dist/assets/{DiagramView-DZc-OYOG.js → DiagramView-CYUqybPc.js} +1 -1
  3. package/dist/assets/{MarkdownRenderer-Ck0GdWsh.js → MarkdownRenderer-BtTS1Ozp.js} +2 -2
  4. package/dist/assets/{MarkdownRendererImpl-DVQVI5vx.js → MarkdownRendererImpl-BEhPEY-K.js} +1 -1
  5. package/dist/assets/{MarkstreamRendererImpl-BfNDXMOp.js → MarkstreamRendererImpl-BBIXOvj9.js} +1 -1
  6. package/dist/assets/{MobileDetailNavigation-DsDo9Wi_.js → MobileDetailNavigation-BFhhqnT-.js} +1 -1
  7. package/dist/assets/{MobileShareBridge-71toeoY_.js → MobileShareBridge-C-nI6cMk.js} +1 -1
  8. package/dist/assets/{MobileSurface-DQ7ckeN6.js → MobileSurface-DfpJ7ZG3.js} +1 -1
  9. package/dist/assets/{MultiRunWindow-WmoZ6nx8.js → MultiRunWindow-BPdh488N.js} +1 -1
  10. package/dist/assets/{SettingsView-B8DTddcL.js → SettingsView-5LETatyz.js} +1 -1
  11. package/dist/assets/{SettingsWindow-DC7meuIP.js → SettingsWindow-Cqi1gao_.js} +1 -1
  12. package/dist/assets/{TerminalView-D75fVyUc.js → TerminalView-BXskZg5z.js} +1 -1
  13. package/dist/assets/{ToolOutputDialog-BkUqgPvz.js → ToolOutputDialog-BGajL6NC.js} +1 -1
  14. package/dist/assets/{appThemeRegistry-BRuvElyv.js → appThemeRegistry-us8BB0kB.js} +1 -1
  15. package/dist/assets/{fileMentionTouchSelection-BHGsKCxs.js → fileMentionTouchSelection-buQYMABq.js} +1 -1
  16. package/dist/assets/{gitApi-CL2Myx_e.js → gitApi-BDac93wX.js} +1 -1
  17. package/dist/assets/{insertionBoundaries-D7rBkplR.js → insertionBoundaries-CZ8xg19I.js} +1 -1
  18. package/dist/assets/{main-DguaBQR-.js → main-CsEvjHBa.js} +4 -4
  19. package/dist/assets/{main-B4hVU-l2.js → main-H3xrKU3r.js} +2 -2
  20. package/dist/assets/{miniChat-oSX3inOA.js → miniChat-lOQvoCsg.js} +2 -2
  21. package/dist/assets/{mobile-D4M85fxw.js → mobile-CkgGU1Ny.js} +2 -2
  22. package/dist/assets/{multirun-DZJk1_Zk.js → multirun-EAcUxuTW.js} +1 -1
  23. package/dist/assets/{projectMeta-OucjgJJr.js → projectMeta-BPt2rFf7.js} +1 -1
  24. package/dist/assets/{renderElectronMiniChatApp-CCVDhPaw.js → renderElectronMiniChatApp-D3jz3rsq.js} +2 -2
  25. package/dist/assets/{renderMobileApp-BrtjHPwj.js → renderMobileApp-DwI_Y-m7.js} +5 -5
  26. package/dist/assets/{runtimeConfig-CPYy2HWF.js → runtimeConfig-ZhBzBnMy.js} +1 -1
  27. package/dist/assets/{runtimeEndpointReset-OyMKgGCH.js → runtimeEndpointReset-DlZ-eeHx.js} +1 -1
  28. package/dist/assets/{sessionLookup-Bzs-d6ek.js → sessionLookup-Dl9fnqg-.js} +1 -1
  29. package/dist/assets/{useAppFontEffects-PwYVhdyQ.js → useAppFontEffects-ZhfcHjRn.js} +5 -5
  30. package/dist/assets/{useDesktopWindowControlsLayout-DbVLYP--.js → useDesktopWindowControlsLayout-C3rrp_8O.js} +1 -1
  31. package/dist/assets/{useEffectiveDirectory-1LhqeRsH.js → useEffectiveDirectory-BKMGPXJq.js} +1 -1
  32. package/dist/assets/{useMobileNavigationStore-CNpuVBEn.js → useMobileNavigationStore-DF9UNgl_.js} +1 -1
  33. package/dist/assets/{useSessionAutoCleanup-hiDGV_VZ.js → useSessionAutoCleanup-BdQQPtS2.js} +1 -1
  34. package/dist/assets/{useWorkerHighlightedLines-z7yMKbSr.js → useWorkerHighlightedLines-D79zvQt4.js} +1 -1
  35. package/dist/index.html +2 -2
  36. package/dist/mini-chat.html +2 -2
  37. package/dist/mobile.html +2 -2
  38. package/package.json +1 -1
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$ as t,J as n,X as r,Y as i,Z as a,nt as o,rt as s}from"./vendor-base-ui-CnHfUmDN.js";import{n as c}from"./vendor-react-DLPElpoQ.js";import{n as l}from"./clipboard-CzXos-TI.js";import{t as u}from"./utils-2ZK8yboQ.js";import{t as d}from"./SettingsView-B8DTddcL.js";var f=c(),p=e(s(),1),m=o(),h=e=>{let o=(0,f.c)(19),{open:s,onOpenChange:c}=e,{t:h}=l(),_=p.useId(),v=g,y;o[0]===c?y=o[1]:(y=e=>{!e&&v()||c(e)},o[0]=c,o[1]=y);let b;o[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(t,{className:u(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),o[2]=b):b=o[2];let x;o[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=u(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),o[3]=x):x=o[3];let S;o[4]===h?S=o[5]:(S=h(`settings.window.description`),o[4]=h,o[5]=S);let C;o[6]!==_||o[7]!==S?(C=(0,m.jsx)(a,{id:_,className:`sr-only`,children:S}),o[6]=_,o[7]=S,o[8]=C):C=o[8];let w;o[9]===c?w=o[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),o[9]=c,o[10]=w);let T;o[11]!==_||o[12]!==C||o[13]!==w?(T=(0,m.jsxs)(i,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),o[11]=_,o[12]=C,o[13]=w,o[14]=T):T=o[14];let E;return o[15]!==s||o[16]!==y||o[17]!==T?(E=(0,m.jsx)(n,{open:s,onOpenChange:y,children:T}),o[15]=s,o[16]=y,o[17]=T,o[18]=E):E=o[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$ as t,J as n,X as r,Y as i,Z as a,nt as o,rt as s}from"./vendor-base-ui-CnHfUmDN.js";import{n as c}from"./vendor-react-DLPElpoQ.js";import{n as l}from"./clipboard-CzXos-TI.js";import{t as u}from"./utils-2ZK8yboQ.js";import{t as d}from"./SettingsView-5LETatyz.js";var f=c(),p=e(s(),1),m=o(),h=e=>{let o=(0,f.c)(19),{open:s,onOpenChange:c}=e,{t:h}=l(),_=p.useId(),v=g,y;o[0]===c?y=o[1]:(y=e=>{!e&&v()||c(e)},o[0]=c,o[1]=y);let b;o[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(t,{className:u(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),o[2]=b):b=o[2];let x;o[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=u(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),o[3]=x):x=o[3];let S;o[4]===h?S=o[5]:(S=h(`settings.window.description`),o[4]=h,o[5]=S);let C;o[6]!==_||o[7]!==S?(C=(0,m.jsx)(a,{id:_,className:`sr-only`,children:S}),o[6]=_,o[7]=S,o[8]=C):C=o[8];let w;o[9]===c?w=o[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),o[9]=c,o[10]=w);let T;o[11]!==_||o[12]!==C||o[13]!==w?(T=(0,m.jsxs)(i,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),o[11]=_,o[12]=C,o[13]=w,o[14]=T):T=o[14];let E;return o[15]!==s||o[16]!==y||o[17]!==T?(E=(0,m.jsx)(n,{open:s,onOpenChange:y,children:T}),o[15]=s,o[16]=y,o[17]=T,o[18]=E):E=o[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{Qt as n}from"./persistence-DwRBC4zl.js";import{nt as r,rt as i,tt as a}from"./vendor-base-ui-CnHfUmDN.js";import{c as o,s,t as c}from"./useUIStore-CxOoCv7B.js";import{o as l}from"./terminalApi-CfgOfnZk.js";import{n as u,r as d,t as f}from"./vendor-ghostty-web-HohRXr3g.js";import{n as ee,t as p}from"./clipboard-CzXos-TI.js";import{c as m}from"./useMobileNavigationStore-CNpuVBEn.js";import{t as h}from"./utils-2ZK8yboQ.js";import{n as g}from"./Icon-D1BcR8Tz.js";import{t as _}from"./button-9R-WgVMl.js";import{n as v}from"./useThemeSystem-DMzWVJaW.js";import{i as y,t as b}from"./OverlayScrollbar-Bahg_P3r.js";import{n as te}from"./useRuntimeAPIs-DSLXJybW.js";import{n as x}from"./useEffectiveDirectory-1LhqeRsH.js";import{t as S}from"./sortable-tabs-strip-BSzFYDAO.js";import{n as C,t as w}from"./useFontPreferences-DCaY8NbU.js";import{r as T}from"./projectActions-CWvNGKfA.js";var E=e(i(),1);function ne(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function re(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ie=e(a(),1),D=r(),O=null;function k(){return O||=d.load(),O}function ae(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var oe=E.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:d=!0},m)=>{let{t:g}=ee(),_=E.useRef(null),v=E.useRef(null),y=E.useRef(null),te=E.useRef(null),x=E.useRef(n),S=E.useRef(r),C=E.useRef(null),w=E.useRef(``),T=E.useRef(null),ne=E.useRef(!1),O=E.useRef(null),oe=E.useRef(!0),A=E.useRef(null),j=E.useRef(null),se=E.useRef(0),ce=E.useRef(null),M=E.useRef(null),N=E.useRef(!1),P=E.useRef(!1),le=E.useRef(null),ue=E.useRef(null),de=E.useRef(null),F=E.useRef(``),fe=E.useRef(null),pe=E.useRef(!c),me=E.useRef(d),[,he]=E.useReducer(e=>e+1,0),[ge,_e]=E.useReducer(e=>e+1,0);x.current=n,S.current=r;let ve=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c;E.useEffect(()=>{if(!c){pe.current=!0,me.current=d;return}!me.current&&d&&(pe.current=!1),me.current=d},[c,d]);let ye=E.useCallback(()=>{if(!I)return;let e=_.current,t=ce.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=E.useCallback(e=>{if(fe.current===e)return;let t=y.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),fe.current=e;return}t.options&&(t.options.cursorBlink=e,fe.current=e)}catch{}},[]),R=I&&ve,z=E.useCallback((e,t)=>{let n=R?M.current:ce.current,r=_.current;if(!n||!r)return;let i=r.getBoundingClientRect(),a=typeof window<`u`?window.innerWidth:i.width,o=typeof window<`u`?window.innerHeight:i.height,s=i.left+i.width/2,c=i.top+i.height-12,l=typeof e==`number`?e:s,u=typeof t==`number`?t:c,d=Math.max(8,Math.min(a-8,l)),f=Math.max(8,Math.min(o-8,u));n.style.left=`${d}px`,n.style.top=`${f}px`,n.style.bottom=``,(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&(n.disabled=!1,n.readOnly=!1,n.removeAttribute(`disabled`),n.removeAttribute(`readonly`));try{n.focus({preventScroll:!0})}catch{try{n.focus()}catch{}}},[R]),B=E.useCallback(()=>{if(I){z(),L(!0);return}y.current?.focus(),L(!0)},[z,L,I]),V=E.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),H=E.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),be=E.useCallback(e=>{if(typeof window>`u`||R)return;de.current!==null&&(window.clearTimeout(de.current),de.current=null);let t=0,n=()=>{de.current=window.setTimeout(()=>{de.current=null;let r=V(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&x.current(a.replace(/\r\n|\r|\n/g,`\r`)),H(e),F.current=``},t===0?0:24)};n()},[H,V,R]);E.useEffect(()=>{let e=_.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}z()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,z]);let U=E.useCallback(()=>{let e=y.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),xe=E.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=_.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),Se=E.useCallback(async()=>{if(typeof document>`u`)return;let e=U()||xe();e.trim()&&await p(e)},[xe,U]),Ce=E.useCallback(()=>U().trim()?!0:!!xe().trim(),[xe,U]);E.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Ce()&&(e.preventDefault(),Se())};return window.addEventListener(`openchamber:copy`,e),()=>{window.removeEventListener(`openchamber:copy`,e)}},[Se,Ce]);let W=E.useCallback(()=>{w.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,ne.current=!1,O.current=null},[]),G=E.useCallback(()=>{let e=te.current,t=y.current,n=_.current;if(!e||!t||!n)return;let r=n.getBoundingClientRect();if(!(r.width<24||r.height<24))try{e.fit();let n={cols:t.cols,rows:t.rows},r=C.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(C.current=n,S.current(n.cols,n.rows))}catch{}},[]),K=E.useCallback(()=>{if(ne.current)return;let e=y.current;if(!e){W();return}if(!w.current)return;let t=w.current;w.current=``,ne.current=!0,e.write(t,()=>{ne.current=!1,w.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())})},[W]),we=E.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())},[K]),q=E.useCallback(e=>{e&&(w.current+=e,we())},[we]),Te=E.useCallback(()=>{if(A.current?.(),A.current=null,j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),!c){se.current=0;return}let e=_.current;if(!e)return;let t=y.current;if(!t)return;se.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,ee=e=>{if(!e)return!1;let n=t.getViewportY(),r=f+e,i=Math.trunc(r/d);return f=r-i*d,i!==0&&t.scrollLines(i),t.getViewportY()!==n},p=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},m={passive:!1,capture:!1};if(typeof window<`u`&&`PointerEvent`in window){let t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),o=n=>{if(n.pointerType===`touch`){p(),t.pointerId=n.pointerId,t.startX=n.clientX,t.startY=n.clientY,t.moved=!1,t.lastY=n.clientY,t.lastTime=u(),t.velocity=0;try{e.setPointerCapture(n.pointerId)}catch{}}},d=e=>{if(e.pointerType!==`touch`||t.pointerId!==e.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>=6&&(t.moved=!0)}if(t.lastY===null){t.lastY=e.clientY,t.lastTime=u();return}let a=t.lastY,o=t.lastTime??u(),s=u();t.lastY=e.clientY,t.lastTime=s;let c=a-e.clientY;if(Math.abs(c)<1)return;let l=Math.max(s-o,8),d=c*(n+Math.min(r,Math.abs(c)/25)),f=d/l;t.velocity=t.velocity*.75+f*i,t.velocity>8?t.velocity=8:t.velocity<-8&&(t.velocity=-8),t.moved&&(e.cancelable&&e.preventDefault(),e.stopPropagation()),ee(d)},f=n=>{if(n.pointerType!==`touch`||t.pointerId!==n.pointerId)return;let r=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(n.pointerId)}catch{}if(r){I?z(n.clientX,n.clientY):c&&!pe.current&&(pe.current=!0,y.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(t.velocity)<a){t.velocity=0;return}let i=u(),o=()=>{let e=u(),n=Math.max(e-i,8);i=e;let r=ee(t.velocity*n)??!1,c=Math.sign(t.velocity),l=Math.max(0,Math.abs(t.velocity)-s*n);if(t.velocity=l*c,!r||l<=a){p(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,m),e.addEventListener(`pointermove`,d,m),e.addEventListener(`pointerup`,f,m),e.addEventListener(`pointercancel`,f,m);let h=e.style.touchAction,g=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,A.current=()=>{p(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.current=0,e.removeEventListener(`pointerdown`,o,m),e.removeEventListener(`pointermove`,d,m),e.removeEventListener(`pointerup`,f,m),e.removeEventListener(`pointercancel`,f,m),e.style.touchAction=h,e.style.overscrollBehaviorY=g};return}let h=e=>{e.touches.length===1&&(p(),l.lastY=e.touches[0].clientY,l.lastTime=u(),l.velocity=0,l.startX=e.touches[0].clientX,l.startY=e.touches[0].clientY,l.didMove=!1)},g=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,p();return}let t=e.touches[0].clientX,a=e.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){let e=t-l.startX,n=a-l.startY;Math.hypot(e,n)>=6&&(l.didMove=!0)}if(l.lastY===null){l.lastY=a,l.lastTime=u();return}let o=l.lastY,s=l.lastTime??u(),c=u();l.lastY=a,l.lastTime=c;let d=o-a;if(Math.abs(d)<1)return;let f=Math.max(c-s,8),m=d*(n+Math.min(r,Math.abs(d)/25)),h=m/f;l.velocity=l.velocity*.75+h*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),ee(m)},v=e=>{let t=!l.didMove;l.lastY=null,l.lastTime=null;let n=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,t){let t=e.changedTouches?.[0];I?z(t?.clientX,t?.clientY):c&&!pe.current&&(pe.current=!0,y.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(n)<a){l.velocity=0;return}let r=u(),i=()=>{let e=u(),t=Math.max(e-r,8);r=e;let n=ee(l.velocity*t)??!1,o=Math.sign(l.velocity),c=Math.max(0,Math.abs(l.velocity)-s*t);if(l.velocity=c*o,!n||c<=a){p(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,h,m),e.addEventListener(`touchmove`,g,m),e.addEventListener(`touchend`,v,m),e.addEventListener(`touchcancel`,v,m);let b=e.style.touchAction,te=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,A.current=()=>{p(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.current=0,e.removeEventListener(`touchstart`,h,m),e.removeEventListener(`touchmove`,g,m),e.removeEventListener(`touchend`,v,m),e.removeEventListener(`touchcancel`,v,m),e.style.touchAction=b,e.style.overscrollBehaviorY=te}},[c,I,z,o]);E.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,d=null,ee=null,p=_.current;if(!p)return;if(p.tabIndex=I?-1:0,I){let e=p.focus.bind(p),t=p;t.focus=((...e)=>{z()}),ee=()=>{t.focus=e}}let m=()=>{L(!0)},h=()=>{L(!1)},g=e=>{let t=e.target;if(t&&p.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),z()},0),L(!1);return}if(c&&!pe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},b=()=>{L(!1)},S=null;return(async()=>{try{let ee=await k();if(e)return;let g=re(a,o,i,ee,!1),_=new u(g);oe.current=!0,I&&(_.focus=()=>{});let b=_;if(typeof b.scrollToBottom==`function`){let e=b.scrollToBottom.bind(b);b.scrollToBottom=()=>{oe.current&&e()},l=()=>{b.scrollToBottom=e}}let C=new f;if(t=_,y.current=_,te.current=C,_.loadAddon(C),_.open(p),c){let e=_.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},d=()=>{e.renderScrollbar=t}}}_e(),fe.current=!1,S=_.textarea??p.querySelector(`textarea`),S&&(S.addEventListener(`focus`,m),S.addEventListener(`blur`,h)),ye(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ye()}),r.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let w=ae(p);w?(w.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),v.current=w,he()):v.current=null,G();let T=C;typeof T.observeResize==`function`&&T.observeResize(),Te(),s=[_.onData(e=>{x.current(e)}),_.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof _.hasSelection==`function`&&_.hasSelection();oe.current=!t&&e<=.5}}),_.onSelectionChange(()=>{if(typeof _.hasSelection==`function`&&_.hasSelection()){oe.current=!1;return}let e=typeof _.getViewportY==`function`?_.getViewportY():0;oe.current=e<=.5})],n=new ResizeObserver(()=>{G()}),n.observe(p),typeof window<`u`&&window.setTimeout(()=>{G()},0)}catch{}})(),document.addEventListener(`focusin`,g,!0),window.addEventListener(`blur`,b),()=>{e=!0,A.current?.(),A.current=null,document.removeEventListener(`focusin`,g,!0),window.removeEventListener(`blur`,b),s.forEach(e=>e.dispose()),l?.(),l=null,d?.(),d=null,S&&(S.removeEventListener(`focus`,m),S.removeEventListener(`blur`,h)),n?.disconnect(),r?.disconnect(),ee?.(),t?.dispose(),y.current=null,te.current=null,v.current=null,C.current=null,fe.current=null,W()}},[ye,c,G,z,a,o,Te,i,W,L,I]),E.useEffect(()=>{let e=y.current;e&&(e.reset(),W(),C.current=null,G())},[e,ge,G,W]),E.useEffect(()=>{l&&y.current&&B()},[l,B,e,ge]),E.useEffect(()=>(Te(),()=>{A.current?.(),A.current=null}),[Te,e]),E.useEffect(()=>{let e=y.current;if(!e)return;if(t.length===0){O.current!==null&&(e.reset(),W(),G());return}let n=O.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&q(r.map(e=>e.data).join(``)),O.current=t[t.length-1].id},[t,ge,q,G,W]),E.useImperativeHandle(m,()=>({focus:()=>{B()},clear:()=>{let e=y.current;e&&(e.reset(),W(),G())},fit:()=>{G()}}),[B,G,W]);let J=E.useCallback(e=>{if(!I)return;let t=_.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[I]),Y=E.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(ue.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){N.current=!0;return}if(!n&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertText`&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertLineBreak`){if(N.current)return;e.preventDefault(),x.current(`\r`),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`deleteContentBackward`){if(N.current)return;e.preventDefault(),x.current(``),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0}},[]),X=E.useCallback(e=>{let t=e.currentTarget;if(ue.current=typeof performance<`u`?performance.now():Date.now(),N.current)return;if(P.current){let e=le.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){P.current=!1,H(t);return}P.current=!1}let n=V(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),F.current=``},[H,V]),Ee=E.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&Ce()){e.preventDefault(),Se();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(String.fromCharCode(t.charCodeAt(0)-64)),H(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(`\x1B`+e.key),H(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),x.current(i),H(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=le.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),x.current(`\r`),H(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;V(a)||x.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=ue.current;t&&s-t<50||(e.preventDefault(),x.current(e.key),P.current=!0,le.current={type:`keydown-text`,at:s})}be(a)},[H,Se,Ce,V,be]),De=E.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||be(t)},[be]),Oe=E.useCallback(e=>{let t=e.currentTarget;N.current=!1;let n=e.data||V(t);if(ue.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),le.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0},[H,V]),ke=E.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=y.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;x.current(n)},[]),Ae={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,D.jsxs)(`div`,{ref:_,className:h(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!Ce()){let t=e.touches?.[0];z(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(Ce())return;z(e.clientX,e.clientY)}else y.current?.focus()},onMouseUp:()=>{!c&&Ce()&&Se()},onTouchEnd:()=>{!c&&Ce()&&Se()},children:[I&&typeof document<`u`?(0,ie.createPortal)((0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{ref:M,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":g(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`block`:`none`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke}),(0,D.jsx)(`textarea`,{ref:ce,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":g(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`none`:`block`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke})]}),document.body):null,v.current&&!c?(0,D.jsx)(b,{containerRef:v,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});oe.displayName=`TerminalViewport`;var A=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),j=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,se=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ce=/Serving HTTP on .*? port (\d{2,5})/i,M=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),N=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(M.has(e)){t=t.slice(0,-1);continue}break}return t},P=e=>{let t=N(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},le=e=>{if(!e)return null;let t=e.replace(A,``),n=t.match(ce);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{Qt as n}from"./persistence-DwRBC4zl.js";import{nt as r,rt as i,tt as a}from"./vendor-base-ui-CnHfUmDN.js";import{c as o,s,t as c}from"./useUIStore-CxOoCv7B.js";import{o as l}from"./terminalApi-CfgOfnZk.js";import{n as u,r as d,t as f}from"./vendor-ghostty-web-HohRXr3g.js";import{n as ee,t as p}from"./clipboard-CzXos-TI.js";import{c as m}from"./useMobileNavigationStore-DF9UNgl_.js";import{t as h}from"./utils-2ZK8yboQ.js";import{n as g}from"./Icon-D1BcR8Tz.js";import{t as _}from"./button-9R-WgVMl.js";import{n as v}from"./useThemeSystem-DMzWVJaW.js";import{i as y,t as b}from"./OverlayScrollbar-Bahg_P3r.js";import{n as te}from"./useRuntimeAPIs-DSLXJybW.js";import{n as x}from"./useEffectiveDirectory-BKMGPXJq.js";import{t as S}from"./sortable-tabs-strip-BSzFYDAO.js";import{n as C,t as w}from"./useFontPreferences-DCaY8NbU.js";import{r as T}from"./projectActions-CWvNGKfA.js";var E=e(i(),1);function ne(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function re(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ie=e(a(),1),D=r(),O=null;function k(){return O||=d.load(),O}function ae(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var oe=E.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:d=!0},m)=>{let{t:g}=ee(),_=E.useRef(null),v=E.useRef(null),y=E.useRef(null),te=E.useRef(null),x=E.useRef(n),S=E.useRef(r),C=E.useRef(null),w=E.useRef(``),T=E.useRef(null),ne=E.useRef(!1),O=E.useRef(null),oe=E.useRef(!0),A=E.useRef(null),j=E.useRef(null),se=E.useRef(0),ce=E.useRef(null),M=E.useRef(null),N=E.useRef(!1),P=E.useRef(!1),le=E.useRef(null),ue=E.useRef(null),de=E.useRef(null),F=E.useRef(``),fe=E.useRef(null),pe=E.useRef(!c),me=E.useRef(d),[,he]=E.useReducer(e=>e+1,0),[ge,_e]=E.useReducer(e=>e+1,0);x.current=n,S.current=r;let ve=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c;E.useEffect(()=>{if(!c){pe.current=!0,me.current=d;return}!me.current&&d&&(pe.current=!1),me.current=d},[c,d]);let ye=E.useCallback(()=>{if(!I)return;let e=_.current,t=ce.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=E.useCallback(e=>{if(fe.current===e)return;let t=y.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),fe.current=e;return}t.options&&(t.options.cursorBlink=e,fe.current=e)}catch{}},[]),R=I&&ve,z=E.useCallback((e,t)=>{let n=R?M.current:ce.current,r=_.current;if(!n||!r)return;let i=r.getBoundingClientRect(),a=typeof window<`u`?window.innerWidth:i.width,o=typeof window<`u`?window.innerHeight:i.height,s=i.left+i.width/2,c=i.top+i.height-12,l=typeof e==`number`?e:s,u=typeof t==`number`?t:c,d=Math.max(8,Math.min(a-8,l)),f=Math.max(8,Math.min(o-8,u));n.style.left=`${d}px`,n.style.top=`${f}px`,n.style.bottom=``,(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&(n.disabled=!1,n.readOnly=!1,n.removeAttribute(`disabled`),n.removeAttribute(`readonly`));try{n.focus({preventScroll:!0})}catch{try{n.focus()}catch{}}},[R]),B=E.useCallback(()=>{if(I){z(),L(!0);return}y.current?.focus(),L(!0)},[z,L,I]),V=E.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),H=E.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),be=E.useCallback(e=>{if(typeof window>`u`||R)return;de.current!==null&&(window.clearTimeout(de.current),de.current=null);let t=0,n=()=>{de.current=window.setTimeout(()=>{de.current=null;let r=V(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&x.current(a.replace(/\r\n|\r|\n/g,`\r`)),H(e),F.current=``},t===0?0:24)};n()},[H,V,R]);E.useEffect(()=>{let e=_.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}z()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,z]);let U=E.useCallback(()=>{let e=y.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),xe=E.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=_.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),Se=E.useCallback(async()=>{if(typeof document>`u`)return;let e=U()||xe();e.trim()&&await p(e)},[xe,U]),Ce=E.useCallback(()=>U().trim()?!0:!!xe().trim(),[xe,U]);E.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Ce()&&(e.preventDefault(),Se())};return window.addEventListener(`openchamber:copy`,e),()=>{window.removeEventListener(`openchamber:copy`,e)}},[Se,Ce]);let W=E.useCallback(()=>{w.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,ne.current=!1,O.current=null},[]),G=E.useCallback(()=>{let e=te.current,t=y.current,n=_.current;if(!e||!t||!n)return;let r=n.getBoundingClientRect();if(!(r.width<24||r.height<24))try{e.fit();let n={cols:t.cols,rows:t.rows},r=C.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(C.current=n,S.current(n.cols,n.rows))}catch{}},[]),K=E.useCallback(()=>{if(ne.current)return;let e=y.current;if(!e){W();return}if(!w.current)return;let t=w.current;w.current=``,ne.current=!0,e.write(t,()=>{ne.current=!1,w.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())})},[W]),we=E.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())},[K]),q=E.useCallback(e=>{e&&(w.current+=e,we())},[we]),Te=E.useCallback(()=>{if(A.current?.(),A.current=null,j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),!c){se.current=0;return}let e=_.current;if(!e)return;let t=y.current;if(!t)return;se.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,ee=e=>{if(!e)return!1;let n=t.getViewportY(),r=f+e,i=Math.trunc(r/d);return f=r-i*d,i!==0&&t.scrollLines(i),t.getViewportY()!==n},p=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},m={passive:!1,capture:!1};if(typeof window<`u`&&`PointerEvent`in window){let t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),o=n=>{if(n.pointerType===`touch`){p(),t.pointerId=n.pointerId,t.startX=n.clientX,t.startY=n.clientY,t.moved=!1,t.lastY=n.clientY,t.lastTime=u(),t.velocity=0;try{e.setPointerCapture(n.pointerId)}catch{}}},d=e=>{if(e.pointerType!==`touch`||t.pointerId!==e.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>=6&&(t.moved=!0)}if(t.lastY===null){t.lastY=e.clientY,t.lastTime=u();return}let a=t.lastY,o=t.lastTime??u(),s=u();t.lastY=e.clientY,t.lastTime=s;let c=a-e.clientY;if(Math.abs(c)<1)return;let l=Math.max(s-o,8),d=c*(n+Math.min(r,Math.abs(c)/25)),f=d/l;t.velocity=t.velocity*.75+f*i,t.velocity>8?t.velocity=8:t.velocity<-8&&(t.velocity=-8),t.moved&&(e.cancelable&&e.preventDefault(),e.stopPropagation()),ee(d)},f=n=>{if(n.pointerType!==`touch`||t.pointerId!==n.pointerId)return;let r=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(n.pointerId)}catch{}if(r){I?z(n.clientX,n.clientY):c&&!pe.current&&(pe.current=!0,y.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(t.velocity)<a){t.velocity=0;return}let i=u(),o=()=>{let e=u(),n=Math.max(e-i,8);i=e;let r=ee(t.velocity*n)??!1,c=Math.sign(t.velocity),l=Math.max(0,Math.abs(t.velocity)-s*n);if(t.velocity=l*c,!r||l<=a){p(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,m),e.addEventListener(`pointermove`,d,m),e.addEventListener(`pointerup`,f,m),e.addEventListener(`pointercancel`,f,m);let h=e.style.touchAction,g=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,A.current=()=>{p(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.current=0,e.removeEventListener(`pointerdown`,o,m),e.removeEventListener(`pointermove`,d,m),e.removeEventListener(`pointerup`,f,m),e.removeEventListener(`pointercancel`,f,m),e.style.touchAction=h,e.style.overscrollBehaviorY=g};return}let h=e=>{e.touches.length===1&&(p(),l.lastY=e.touches[0].clientY,l.lastTime=u(),l.velocity=0,l.startX=e.touches[0].clientX,l.startY=e.touches[0].clientY,l.didMove=!1)},g=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,p();return}let t=e.touches[0].clientX,a=e.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){let e=t-l.startX,n=a-l.startY;Math.hypot(e,n)>=6&&(l.didMove=!0)}if(l.lastY===null){l.lastY=a,l.lastTime=u();return}let o=l.lastY,s=l.lastTime??u(),c=u();l.lastY=a,l.lastTime=c;let d=o-a;if(Math.abs(d)<1)return;let f=Math.max(c-s,8),m=d*(n+Math.min(r,Math.abs(d)/25)),h=m/f;l.velocity=l.velocity*.75+h*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),ee(m)},v=e=>{let t=!l.didMove;l.lastY=null,l.lastTime=null;let n=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,t){let t=e.changedTouches?.[0];I?z(t?.clientX,t?.clientY):c&&!pe.current&&(pe.current=!0,y.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(n)<a){l.velocity=0;return}let r=u(),i=()=>{let e=u(),t=Math.max(e-r,8);r=e;let n=ee(l.velocity*t)??!1,o=Math.sign(l.velocity),c=Math.max(0,Math.abs(l.velocity)-s*t);if(l.velocity=c*o,!n||c<=a){p(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,h,m),e.addEventListener(`touchmove`,g,m),e.addEventListener(`touchend`,v,m),e.addEventListener(`touchcancel`,v,m);let b=e.style.touchAction,te=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,A.current=()=>{p(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.current=0,e.removeEventListener(`touchstart`,h,m),e.removeEventListener(`touchmove`,g,m),e.removeEventListener(`touchend`,v,m),e.removeEventListener(`touchcancel`,v,m),e.style.touchAction=b,e.style.overscrollBehaviorY=te}},[c,I,z,o]);E.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,d=null,ee=null,p=_.current;if(!p)return;if(p.tabIndex=I?-1:0,I){let e=p.focus.bind(p),t=p;t.focus=((...e)=>{z()}),ee=()=>{t.focus=e}}let m=()=>{L(!0)},h=()=>{L(!1)},g=e=>{let t=e.target;if(t&&p.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),z()},0),L(!1);return}if(c&&!pe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},b=()=>{L(!1)},S=null;return(async()=>{try{let ee=await k();if(e)return;let g=re(a,o,i,ee,!1),_=new u(g);oe.current=!0,I&&(_.focus=()=>{});let b=_;if(typeof b.scrollToBottom==`function`){let e=b.scrollToBottom.bind(b);b.scrollToBottom=()=>{oe.current&&e()},l=()=>{b.scrollToBottom=e}}let C=new f;if(t=_,y.current=_,te.current=C,_.loadAddon(C),_.open(p),c){let e=_.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},d=()=>{e.renderScrollbar=t}}}_e(),fe.current=!1,S=_.textarea??p.querySelector(`textarea`),S&&(S.addEventListener(`focus`,m),S.addEventListener(`blur`,h)),ye(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ye()}),r.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let w=ae(p);w?(w.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),v.current=w,he()):v.current=null,G();let T=C;typeof T.observeResize==`function`&&T.observeResize(),Te(),s=[_.onData(e=>{x.current(e)}),_.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof _.hasSelection==`function`&&_.hasSelection();oe.current=!t&&e<=.5}}),_.onSelectionChange(()=>{if(typeof _.hasSelection==`function`&&_.hasSelection()){oe.current=!1;return}let e=typeof _.getViewportY==`function`?_.getViewportY():0;oe.current=e<=.5})],n=new ResizeObserver(()=>{G()}),n.observe(p),typeof window<`u`&&window.setTimeout(()=>{G()},0)}catch{}})(),document.addEventListener(`focusin`,g,!0),window.addEventListener(`blur`,b),()=>{e=!0,A.current?.(),A.current=null,document.removeEventListener(`focusin`,g,!0),window.removeEventListener(`blur`,b),s.forEach(e=>e.dispose()),l?.(),l=null,d?.(),d=null,S&&(S.removeEventListener(`focus`,m),S.removeEventListener(`blur`,h)),n?.disconnect(),r?.disconnect(),ee?.(),t?.dispose(),y.current=null,te.current=null,v.current=null,C.current=null,fe.current=null,W()}},[ye,c,G,z,a,o,Te,i,W,L,I]),E.useEffect(()=>{let e=y.current;e&&(e.reset(),W(),C.current=null,G())},[e,ge,G,W]),E.useEffect(()=>{l&&y.current&&B()},[l,B,e,ge]),E.useEffect(()=>(Te(),()=>{A.current?.(),A.current=null}),[Te,e]),E.useEffect(()=>{let e=y.current;if(!e)return;if(t.length===0){O.current!==null&&(e.reset(),W(),G());return}let n=O.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&q(r.map(e=>e.data).join(``)),O.current=t[t.length-1].id},[t,ge,q,G,W]),E.useImperativeHandle(m,()=>({focus:()=>{B()},clear:()=>{let e=y.current;e&&(e.reset(),W(),G())},fit:()=>{G()}}),[B,G,W]);let J=E.useCallback(e=>{if(!I)return;let t=_.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[I]),Y=E.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(ue.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){N.current=!0;return}if(!n&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertText`&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertLineBreak`){if(N.current)return;e.preventDefault(),x.current(`\r`),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`deleteContentBackward`){if(N.current)return;e.preventDefault(),x.current(``),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0}},[]),X=E.useCallback(e=>{let t=e.currentTarget;if(ue.current=typeof performance<`u`?performance.now():Date.now(),N.current)return;if(P.current){let e=le.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){P.current=!1,H(t);return}P.current=!1}let n=V(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),F.current=``},[H,V]),Ee=E.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&Ce()){e.preventDefault(),Se();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(String.fromCharCode(t.charCodeAt(0)-64)),H(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(`\x1B`+e.key),H(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),x.current(i),H(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=le.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),x.current(`\r`),H(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;V(a)||x.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=ue.current;t&&s-t<50||(e.preventDefault(),x.current(e.key),P.current=!0,le.current={type:`keydown-text`,at:s})}be(a)},[H,Se,Ce,V,be]),De=E.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||be(t)},[be]),Oe=E.useCallback(e=>{let t=e.currentTarget;N.current=!1;let n=e.data||V(t);if(ue.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),le.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0},[H,V]),ke=E.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=y.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;x.current(n)},[]),Ae={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,D.jsxs)(`div`,{ref:_,className:h(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!Ce()){let t=e.touches?.[0];z(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(Ce())return;z(e.clientX,e.clientY)}else y.current?.focus()},onMouseUp:()=>{!c&&Ce()&&Se()},onTouchEnd:()=>{!c&&Ce()&&Se()},children:[I&&typeof document<`u`?(0,ie.createPortal)((0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{ref:M,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":g(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`block`:`none`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke}),(0,D.jsx)(`textarea`,{ref:ce,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":g(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`none`:`block`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke})]}),document.body):null,v.current&&!c?(0,D.jsx)(b,{containerRef:v,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});oe.displayName=`TerminalViewport`;var A=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),j=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,se=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ce=/Serving HTTP on .*? port (\d{2,5})/i,M=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),N=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(M.has(e)){t=t.slice(0,-1);continue}break}return t},P=e=>{let t=N(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},le=e=>{if(!e)return null;let t=e.replace(A,``),n=t.match(ce);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
2
2
  `);for(let e of r){if(!se.test(e))continue;let t=Array.from(e.matchAll(j));if(t.length!==0)return P((t.find(e=>{try{return!!new URL(P(e[1])).port}catch{return!1}})??t[0])[1])}return null},ue=async(e,n=1500)=>{if(!e||typeof window>`u`)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!==`http:`&&r.protocol!==`https:`)return!1;let i=r.hostname.toLowerCase();if(i!==`localhost`&&i!==`127.0.0.1`&&i!==`0.0.0.0`&&i!==`::1`&&i!==`::`)return!1;let a=new AbortController,o=window.setTimeout(()=>a.abort(),n);try{let e=await t(`/api/system/probe-url`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:r.toString()}),cache:`no-store`,signal:a.signal});return e.ok?(await e.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(o)}},de={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},F={ctrl:`5`,cmd:`3`},fe={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},pe={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},me=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${F[t]}A`;case`arrow-down`:return`\u001b[1;${F[t]}B`;case`arrow-right`:return`\u001b[1;${F[t]}C`;case`arrow-left`:return`\u001b[1;${F[t]}D`}return de[e]??null},he=()=>{let{t:e}=ee(),{terminal:t,runtime:r}=te(),{currentTheme:i}=v(),{monoFont:a}=w(),u=c(e=>e.terminalFontSize),d=c(e=>e.bottomTerminalHeight),f=c(e=>e.isBottomTerminalExpanded),{isMobile:p,isTablet:b,hasTouchOnlyPointer:re}=y(),ie=p||b,O=(ie||re)&&r.platform===`web`,k=r.platform!==`vscode`,ae=c(e=>e.showTerminalQuickKeysOnDesktop),A=!n()&&(ie||ae),j=m(e=>e.currentSessionId),se=m(e=>e.newSessionDraft),ce=j!==null||se?.open===!0,M=x()??null,N=C(e=>e.sessions),P=C(e=>e.hasHydrated),de=C(e=>e.ensureDirectory),F=C(e=>e.createTab),he=C(e=>e.setActiveTab),ge=C(e=>e.closeTab),_e=C(e=>e.setTabSessionId),ve=C(e=>e.setTabLifecycle),I=C(e=>e.setConnecting),ye=C(e=>e.appendToBuffer),L=C(e=>e.setTabPreviewUrl),R=C(e=>e.clearBuffer),z=c(e=>e.openContextPreview),B=E.useMemo(()=>{if(M)return N.get(M)},[N,M]),V=E.useMemo(()=>B?k?B.activeTabId??B.tabs[0]?.id??null:B.tabs[0]?.id??null:null,[B,k]),H=E.useMemo(()=>{if(B)return V?B.tabs.find(e=>e.id===V)??B.tabs[0]:B.tabs[0]},[B,V]),be=E.useMemo(()=>(B?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?T[t.iconKey]??`terminal`:`terminal`;return(0,D.jsx)(g,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[B?.tabs,e]),U=H?.terminalSessionId??null,xe=H?.lifecycle??`idle`,Se=H?.bufferChunks??[],Ce=H?.isConnecting??!1,W=H?.previewUrl??null,[G,K]=E.useState(null),[we,q]=E.useState(!1),[Te,J]=E.useState(!1),[Y,X]=E.useState(null),[Ee,De]=E.useState(!1),[Oe,ke]=E.useState(0),Ae=E.useRef(null),je=E.useRef(null),Me=E.useRef(V),Ne=E.useRef(U),Pe=E.useRef(M),Fe=E.useRef(null),Ie=E.useRef(null),Le=E.useRef(!1),Re=E.useRef(!1),ze=E.useRef(null),Be=E.useRef(null),Ve=E.useRef(new Set),He=E.useRef(!1),Ue=E.useRef(``),We=E.useRef(new Set),Ge=E.useRef(0),Ke=E.useCallback(()=>{Ue.current=``,We.current.clear(),Ge.current+=1},[]),qe=E.useCallback(()=>{O||typeof document<`u`&&!document.hasFocus()||Fe.current?.focus()},[O]),Je=E.useCallback(()=>{O||Fe.current?.focus()},[O]);E.useEffect(()=>{if(!P||He.current)return;He.current=!0;let e=new Set;for(let[,t]of C.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Ve.current=e},[P]);let Ye=c(e=>e.activeMainTab),Xe=c(e=>e.isBottomTerminalOpen),Ze=c(e=>e.setBottomTerminalOpen),Qe=c(e=>e.setBottomTerminalExpanded),$e=Ye===`terminal`,Z=$e||Xe,[et,tt]=E.useState(Z);E.useEffect(()=>{!Z||r.platform===`vscode`||l()},[Z,r.platform]),E.useEffect(()=>{Z&&tt(!0)},[Z]),E.useEffect(()=>{Re.current=Z},[Z]),E.useEffect(()=>{Ne.current=U},[U]),E.useEffect(()=>{Me.current=V,Ke()},[V,Ke]),E.useEffect(()=>{Pe.current=M},[M]),E.useEffect(()=>{!A&&Y!==null&&X(null)},[A,Y,X]),E.useEffect(()=>{!U&&Y!==null&&X(null)},[U,Y,X]);let Q=E.useCallback(()=>{Ae.current?.(),Ae.current=null,je.current=null,ze.current=null,J(!1)},[]);E.useEffect(()=>()=>{Q(),Ne.current=null},[Q]);let nt=E.useCallback((e,t,n)=>{if(!n)return;let r=`${Ue.current}${n}`.replace(/\r\n|\r/g,`
3
3
  `),i=r.split(`
4
4
  `),a=r.endsWith(`
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{nt as n,rt as r,tt as i}from"./vendor-base-ui-CnHfUmDN.js";import{g as a}from"./useUIStore-CxOoCv7B.js";import{n as o}from"./vendor-react-DLPElpoQ.js";import{a as s,i as c}from"./vendor-pierre-diffs-DX7XTPG3.js";import{n as l}from"./vendor-reactuses-core-BnW6GxJt.js";import{n as u}from"./clipboard-CzXos-TI.js";import{n as d,t as f}from"./dialog-gtFLyacK.js";import{t as p}from"./utils-2ZK8yboQ.js";import{n as m}from"./Icon-D1BcR8Tz.js";import{t as h}from"./button-9R-WgVMl.js";import{n as g,t as _}from"./useThemeSystem-DMzWVJaW.js";import{i as v,n as y,s as b}from"./markdownTheme-DOfGg-A7.js";import{i as x,t as S}from"./appThemeRegistry-BRuvElyv.js";import{n as ee}from"./MarkdownRenderer-Ck0GdWsh.js";import{c as C}from"./markdown-worker-CptoICmq.js";import{n as te}from"./useEffectiveDirectory-1LhqeRsH.js";import{s as w}from"./imageSource-BlAJJUEI.js";import{_ as T,d as E,f as ne,g as D,h as re,l as O,m as k,n as A,p as j,r as M,s as N,t as P,u as F}from"./useWorkerHighlightedLines-z7yMKbSr.js";import{t as I}from"./vendor-tanstack-react-virtual-tlDgH6PG.js";var ie=e(i(),1),L=o(),R=e(r(),1),z=n(),B=80,ae=20,V=R.memo(e=>{let t=(0,L.c)(26),{lines:n,language:r,maxHeight:i,showLineNumbers:a,lineStyles:o}=e,s=i===void 0?`60vh`:i,c=a===void 0||a,{currentTheme:l}=g(),u;t[0]===l?u=t[1]:(u=y(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(W).join(`
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{nt as n,rt as r,tt as i}from"./vendor-base-ui-CnHfUmDN.js";import{g as a}from"./useUIStore-CxOoCv7B.js";import{n as o}from"./vendor-react-DLPElpoQ.js";import{a as s,i as c}from"./vendor-pierre-diffs-DX7XTPG3.js";import{n as l}from"./vendor-reactuses-core-BnW6GxJt.js";import{n as u}from"./clipboard-CzXos-TI.js";import{n as d,t as f}from"./dialog-gtFLyacK.js";import{t as p}from"./utils-2ZK8yboQ.js";import{n as m}from"./Icon-D1BcR8Tz.js";import{t as h}from"./button-9R-WgVMl.js";import{n as g,t as _}from"./useThemeSystem-DMzWVJaW.js";import{i as v,n as y,s as b}from"./markdownTheme-DOfGg-A7.js";import{i as x,t as S}from"./appThemeRegistry-us8BB0kB.js";import{n as ee}from"./MarkdownRenderer-BtTS1Ozp.js";import{c as C}from"./markdown-worker-CptoICmq.js";import{n as te}from"./useEffectiveDirectory-BKMGPXJq.js";import{s as w}from"./imageSource-BlAJJUEI.js";import{_ as T,d as E,f as ne,g as D,h as re,l as O,m as k,n as A,p as j,r as M,s as N,t as P,u as F}from"./useWorkerHighlightedLines-D79zvQt4.js";import{t as I}from"./vendor-tanstack-react-virtual-tlDgH6PG.js";var ie=e(i(),1),L=o(),R=e(r(),1),z=n(),B=80,ae=20,V=R.memo(e=>{let t=(0,L.c)(26),{lines:n,language:r,maxHeight:i,showLineNumbers:a,lineStyles:o}=e,s=i===void 0?`60vh`:i,c=a===void 0||a,{currentTheme:l}=g(),u;t[0]===l?u=t[1]:(u=y(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(W).join(`
2
2
  `),t[2]=n,t[3]=f);let p=P(f,r);if(!(n.length>B)){let e=d,r;t[4]!==s||t[5]!==e?(r={...e,maxHeight:s,overflow:`auto`},t[4]=s,t[5]=e,t[6]=r):r=t[6];let i;if(t[7]!==p||t[8]!==o||t[9]!==n||t[10]!==c){let e;t[12]!==p||t[13]!==o||t[14]!==c?(e=(e,t)=>(0,z.jsx)(U,{line:e,html:p?.[t],showLineNumbers:c,style:o?.(e)},t),t[12]=p,t[13]=o,t[14]=c,t[15]=e):e=t[15],i=n.map(e),t[7]=p,t[8]=o,t[9]=n,t[10]=c,t[11]=i}else i=t[11];let a;return t[16]!==r||t[17]!==i?(a=(0,z.jsx)(`div`,{className:`typography-code font-mono w-full min-w-0`,style:r,children:i}),t[16]=r,t[17]=i,t[18]=a):a=t[18],a}let m;return t[19]!==p||t[20]!==o||t[21]!==n||t[22]!==s||t[23]!==c||t[24]!==d?(m=(0,z.jsx)(H,{lines:n,highlighted:p,syntaxVars:d,maxHeight:s,showLineNumbers:c,lineStyles:o}),t[19]=p,t[20]=o,t[21]=n,t[22]=s,t[23]=c,t[24]=d,t[25]=m):m=t[25],m});V.displayName=`VirtualizedCodeBlock`;var H=R.memo(({lines:e,highlighted:t,syntaxVars:n,maxHeight:r,showLineNumbers:i,lineStyles:a})=>{let o=R.useRef(null),s=`min(${e.length*ae}px, ${r})`,c=I({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>ae,overscan:20}),l=c.getVirtualItems();return(0,z.jsx)(`div`,{ref:o,className:`typography-code font-mono w-full min-w-0`,style:{...n,height:s,maxHeight:r,overflow:`auto`},children:(0,z.jsx)(`div`,{style:{height:c.getTotalSize(),position:`relative`},children:l.map(n=>{let r=e[n.index];return r?(0,z.jsx)(`div`,{"data-index":n.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${n.start}px)`},children:(0,z.jsx)(U,{line:r,html:t?.[n.index],showLineNumbers:i,style:a?.(r)})},n.index):null})})})});H.displayName=`VirtualizedRows`;var U=R.memo(e=>{let t=(0,L.c)(12),{line:n,html:r,showLineNumbers:i,style:a}=e,o;t[0]!==n.isInfo||t[1]!==n.lineNumber||t[2]!==i?(o=i&&(0,z.jsx)(`span`,{className:`w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5`,style:{color:`var(--tools-edit-line-number)`,borderColor:`var(--tools-border)`},children:!n.isInfo&&n.lineNumber!=null?n.lineNumber:``}),t[0]=n.isInfo,t[1]=n.lineNumber,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n.isInfo||t[6]!==n.text?(s=(0,z.jsx)(`div`,{className:`flex-1 min-w-0`,children:n.isInfo?(0,z.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground/70 italic`,children:n.text}):r===void 0?(0,z.jsx)(`div`,{className:`whitespace-pre`,children:n.text}):(0,z.jsx)(`div`,{className:`whitespace-pre`,dangerouslySetInnerHTML:{__html:r}})}),t[4]=r,t[5]=n.isInfo,t[6]=n.text,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,z.jsxs)(`div`,{className:`typography-code font-mono flex w-full min-w-0`,style:a,children:[o,s]}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c});U.displayName=`VirtualizedCodeBlock.Row`;function W(e){return e.text}var G=R.memo(function({jsonString:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2}){let{t:i}=u(),a=R.useRef(null),[o,s]=R.useState(null),c=R.useMemo(()=>{try{let t=e.trim();if(!t)return s(i(`jsonTreeView.error.emptyJson`)),null;let n=JSON.parse(t);return s(null),n}catch(e){return s(e instanceof Error?e.message:i(`jsonTreeView.error.invalidJson`)),null}},[e,i]),l=R.useCallback(()=>{a.current?.expandAll()},[]),d=R.useCallback(()=>{a.current?.collapseAll()},[]);return o?(0,z.jsx)(`div`,{className:t,children:(0,z.jsxs)(`div`,{className:`rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4`,children:[(0,z.jsx)(`div`,{className:`mb-1 font-medium text-[var(--surface-foreground)]`,children:i(`jsonTreeView.error.invalidJsonTitle`)}),(0,z.jsx)(`div`,{className:`font-mono text-xs text-[var(--surface-mutedForeground)]`,children:o})]})}):c===null?null:(0,z.jsxs)(`div`,{className:t,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1`,children:[(0,z.jsxs)(h,{variant:`ghost`,size:`xs`,onClick:l,className:`gap-1 text-xs text-muted-foreground`,children:[(0,z.jsx)(m,{name:`arrow-down-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.expandAll`)]}),(0,z.jsxs)(h,{variant:`ghost`,size:`xs`,onClick:d,className:`gap-1 text-xs text-muted-foreground`,children:[(0,z.jsx)(m,{name:`arrow-up-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.collapseAll`)]})]}),(0,z.jsx)(`div`,{className:`bg-[var(--syntax-base-background)] py-1`,style:{maxHeight:n,overflow:`auto`},children:(0,z.jsx)(M,{ref:a,data:c,maxHeight:n,initiallyExpandedDepth:r})})]})}),K=class extends Error{key;params;constructor(e,t){super(e),this.name=`MermaidLoadFailure`,this.key=e,this.params=t}},q=(e,t)=>new K(e,t),oe=e=>e instanceof K,se=e=>e+1,ce=(e,t)=>e===t,J=e=>{let t=e.indexOf(`,`);if(t<0)throw q(`chat.toolOutputDialog.mermaid.dataUrlMalformed`);let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1);return n.includes(`;base64`)?atob(r):decodeURIComponent(r)},le=e=>Promise.resolve().then(()=>J(e)),Y=1,X=56,Z=(e,t,n)=>Math.min(n,Math.max(t,e)),ue=({isMobile:e,pointerType:t,cancelled:n,moved:r,suppressTap:i,targetWasCanvas:a,start:o,end:s,startScale:c,hasMultipleImages:l})=>{if(n||i)return`none`;let u={x:s.x-o.x,y:s.y-o.y},d=Math.hypot(u.x,u.y),f=t!==`mouse`;if(e&&f&&c<=1.01&&Math.abs(u.x)>=X&&Math.abs(u.x)>Math.abs(u.y)*1.2)return l?u.x<0?`next`:`previous`:`none`;let p=!r&&d<=10;return e&&f&&p||!e&&t===`mouse`&&p&&a?`close`:`none`},de=(e,t)=>{if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{width:1,height:1};let n=Math.min(t.width/e.width,t.height/e.height);return{width:Math.max(1,e.width*n),height:Math.max(1,e.height*n)}},fe=(e,t)=>{let n=t.minScale??Y,r=t.maxScale??5,i=Z(e.scale,n,r),a=Math.max(0,(t.image.width*i-t.viewport.width)/2),o=Math.max(0,(t.image.height*i-t.viewport.height)/2);return{scale:i,x:Z(e.x,-a,a),y:Z(e.y,-o,o)}},pe=(e,t,n,r,i)=>{let a=Z(t,i.minScale??Y,i.maxScale??5),o=a/e.scale;return fe({scale:a,x:n.x-r.x-(n.x-r.x-e.x)*o,y:n.y-r.y-(n.y-r.y-e.y)*o},i)},me=(e,t,n)=>fe({...e,x:e.x+t.x,y:e.y+t.y},n),he=(e,t,n,r,i,a)=>{let o=Z(r,a.minScale??Y,a.maxScale??5),s=o/e.scale;return fe({scale:o,x:n.x-i.x-(t.x-i.x-e.x)*s,y:n.y-i.y-(t.y-i.y-e.y)*s},a)},Q=500,$=24,ge=(e,t={})=>{let n=t.target??(typeof document>`u`?null:document);if(!n)return()=>{};let r=t.durationMs??Q,i=t.maxDistance??$,a=!0,o,s=()=>{a&&(a=!1,n.removeEventListener(`click`,c,!0),o!==void 0&&globalThis.clearTimeout(o))},c=t=>{let n=t;typeof n.clientX==`number`&&typeof n.clientY==`number`&&(Math.hypot(n.clientX-e.x,n.clientY-e.y)>i||(s(),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()))};return n.addEventListener(`click`,c,!0),o=globalThis.setTimeout(s,r),s},_e=(e,t,n={})=>{ge(e,n),t()},ve=500,ye=400,be=(e,t)=>new K(e,t),xe=e=>{let t=`h-3.5 w-3.5 flex-shrink-0`,n=e.toLowerCase();return n===`reasoning`?(0,z.jsx)(m,{name:`brain-ai-3`,className:t}):n===`image-preview`?(0,z.jsx)(m,{name:`file-image`,className:t}):n===`mermaid-preview`?(0,z.jsx)(m,{name:`file-list-2`,className:t}):n===`edit`||n===`multiedit`||n===`apply_patch`||n===`str_replace`||n===`str_replace_based_edit_tool`?(0,z.jsx)(m,{name:`pencil-ai`,className:t}):n===`write`||n===`create`||n===`file_write`||n===`read`||n===`view`||n===`file_read`||n===`cat`?(0,z.jsx)(m,{name:`file-pdf`,className:t}):n===`bash`||n===`shell`||n===`cmd`||n===`terminal`?(0,z.jsx)(m,{name:`terminal-box`,className:t}):n===`list`||n===`ls`||n===`dir`||n===`list_files`?(0,z.jsx)(m,{name:`folder-6`,className:t}):n===`search`||n===`grep`||n===`find`||n===`ripgrep`?(0,z.jsx)(m,{name:`search`,className:t}):n===`glob`?(0,z.jsx)(m,{name:`file-search`,className:t}):n===`fetch`||n===`curl`||n===`wget`||n===`webfetch`?(0,z.jsx)(m,{name:`global`,className:t}):n===`web-search`||n===`websearch`||n===`search_web`||n===`google`||n===`bing`||n===`duckduckgo`?(0,z.jsx)(m,{name:`search`,className:t}):n===`todowrite`||n===`todoread`?(0,z.jsx)(m,{name:`list-check-3`,className:t}):n.startsWith(`git`)?(0,z.jsx)(m,{name:`git-branch`,className:t}):(0,z.jsx)(m,{name:`tools`,className:t})},Se=150,Ce=40,we=120,Te=3,Ee={style:{background:`transparent`,backgroundColor:`transparent`,fontSize:`inherit`}},De={download:!1,copy:!1,showPanZoomControls:!0},Oe=`
3
3
  [data-diff-header],
4
4
  [data-diff] {
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t}from"./vendor-zustand-B4dlGEM2.js";import{rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r,t as i}from"./platform-DQ5_LNKO.js";import{a,n as o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{r as c}from"./vendor-pierre-diffs-DX7XTPG3.js";import{n as l}from"./vendor-reactuses-core-BnW6GxJt.js";import{r as u}from"./useMobileNavigationStore-CNpuVBEn.js";import{c as d,l as f}from"./dialog-gtFLyacK.js";var p=e(n(),1),m=s(),h=`openchamber.iosNativeUi`,g=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(h)===`1`}catch{return!1}},_=e=>{if(!(typeof window>`u`))try{e?window.localStorage.setItem(h,`1`):window.localStorage.removeItem(h)}catch{}},v=t(e=>({enabled:g(),setEnabled:t=>{_(t),e({enabled:t})}})),y=()=>v.getState().enabled,ee=()=>v(ne),te=()=>r()&&i()===`ios`;function ne(e){return e.enabled}var re=`oc-native-ios-composer`,b=`--oc-native-composer-height`,x=`--oc-native-composer-accessory`,ie=33554432,S=`OpenChamberComposer`,C=`#22c55e`,w=32,T=()=>({open:!1,highlightedIndex:0,rows:[]}),ae=()=>({text:``,placeholder:``,modelLabel:``,modelVariantLabel:``,modelIcon:``,canSend:!1,canAbort:!1,attachmentCount:0,attachmentPreviews:[],citationRanges:[],chipRanges:[],appearance:`dark`,attachAria:``,attachTitle:``,attachPhotosLabel:``,attachFilesLabel:``,attachCancelLabel:``,sendAria:``,queueAria:``,stopAria:``,modelAria:``,agentAria:``,agentLabel:``,agentColor:C,agentIdenticon:Array.from({length:25},()=>0),suppressed:!0,showScrollToBottom:!1,scrollAria:``,autocomplete:T()}),oe=a(S),se=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.isMobile&&e.nativeUiEnabled!==!1;function ce(e){return typeof window>`u`?!1:se({isCapacitor:r(),platform:i(),pluginAvailable:o.isPluginAvailable(S),isMobile:e,nativeUiEnabled:y()})}var le=e=>e.classList.contains(`dark`)?`dark`:`light`,ue=e=>{let t=e?.height;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:t},de=(e,t)=>{if(!(t>0)){e.style.removeProperty(b);return}e.style.setProperty(b,`${Math.round(t)}px`)},fe=(e,t)=>{if(!(t>0)){e.style.removeProperty(x);return}e.style.setProperty(x,`${Math.round(t)}px`)},E=(e,t)=>{e.classList.toggle(re,t),t||(e.style.removeProperty(b),e.style.removeProperty(x))},pe=e=>d(e).flat().map(e=>+!!e),D=new Map,O=null,k=e=>{let t=D.get(e);if(t!==void 0)return t;if(typeof document>`u`||typeof getComputedStyle>`u`)return C;!O&&typeof MutationObserver<`u`&&(O=new MutationObserver(()=>{D.clear()}),O.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}));let n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),r=document.createElement(`span`);r.style.color=n||`var(${e})`,document.documentElement.appendChild(r);let i=getComputedStyle(r).color;r.remove();let a=/rgba?\(\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)(?:\s*,\s*|\s+)([\d.]+)/.exec(i);if(!a)return D.set(e,C),C;let o=e=>Math.max(0,Math.min(255,Math.round(Number(e)))).toString(16).padStart(2,`0`),s=`#${o(a[1])}${o(a[2])}${o(a[3])}`;return D.set(e,s),s},me=e=>k(f(e).var),A=(e,t)=>e.text===t.text&&e.placeholder===t.placeholder&&e.modelLabel===t.modelLabel&&e.modelVariantLabel===t.modelVariantLabel&&e.modelIcon===t.modelIcon&&e.canSend===t.canSend&&e.canAbort===t.canAbort&&e.attachmentCount===t.attachmentCount&&M(e.attachmentPreviews,t.attachmentPreviews)&&N(e.citationRanges,t.citationRanges)&&P(e.chipRanges,t.chipRanges)&&e.appearance===t.appearance&&e.attachAria===t.attachAria&&e.attachTitle===t.attachTitle&&e.attachPhotosLabel===t.attachPhotosLabel&&e.attachFilesLabel===t.attachFilesLabel&&e.attachCancelLabel===t.attachCancelLabel&&e.sendAria===t.sendAria&&e.queueAria===t.queueAria&&e.stopAria===t.stopAria&&e.modelAria===t.modelAria&&e.agentAria===t.agentAria&&e.agentLabel===t.agentLabel&&e.agentColor===t.agentColor&&e.agentIdenticon.join(``)===t.agentIdenticon.join(``)&&e.suppressed===t.suppressed&&e.showScrollToBottom===t.showScrollToBottom&&e.scrollAria===t.scrollAria&&j(e.autocomplete,t.autocomplete),j=(e,t)=>e.open===t.open&&e.highlightedIndex===t.highlightedIndex&&e.rows.length===t.rows.length&&e.rows.every((e,n)=>{let r=t.rows[n];return!!(r&&e.id===r.id&&e.title===r.title&&e.subtitle===r.subtitle&&e.badge===r.badge&&e.iconBase64===r.iconBase64)}),M=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.id===r.id&&e.filename===r.filename&&e.mime===r.mime&&e.thumbnailBase64===r.thumbnailBase64&&e.removeAria===r.removeAria)}),N=(e,t)=>e.length===t.length&&e.every((e,n)=>e.start===t[n]?.start&&e.end===t[n]?.end),P=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.start===r.start&&e.end===r.end&&e.triggerLength===r.triggerLength&&e.color===r.color)}),he=(e,t)=>{if(!e||!t||t.length===0)return[];let n=[],r=0;for(let e of t){let t=r;r+=e.text.length;let i=e.visual;if(!i)continue;let a=i.trigger.length;a<1||t+a>r||i.icon&&n.push({start:t,end:r,triggerLength:a,iconName:i.icon})}return n},ge=(e,t)=>e.map(e=>({start:e.start,end:e.end,triggerLength:e.triggerLength,color:t})),_e=e=>e.map(e=>`${e.id}:${e.filename}:${e.mimeType}:${e.dataUrl?.length??0}`).join(`|`),ve=e=>{let t=e?.id;return typeof t==`string`&&t.trim()?t:``},F=e=>{if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return Math.floor(e);if(typeof e==`string`&&e.trim()){let t=Number(e);if(Number.isFinite(t)&&t>=0)return Math.floor(t)}return null},ye=e=>{let t=F(e?.selectionStart);if(t===null)return null;let n=F(e?.selectionEnd);return{start:t,end:n!==null&&n>=t?n:t}},be=e=>F(e?.index)??0,xe=(e,t)=>{let n=Math.max(0,e);return typeof t!=`number`||!Number.isFinite(t)?n:Math.max(0,Math.min(Math.floor(t),n))},Se=e=>e.nextText===e.nativeOwnedText?{omitText:!0,forceText:!1}:e.nextText.length===0&&e.nativeOwnedText.length>0||e.preset?{omitText:!1,forceText:!0}:e.echoingNative?{omitText:!0,forceText:!1}:{omitText:!1,forceText:!0},Ce=e=>e.replacedText!==null&&e.incoming===e.replacedText,we=e=>setTimeout(e,0),Te=e=>{e.applyDocument(e.text),we(e.submit)},I=(e,t)=>e===t,Ee=(e,t,n,r)=>{if(n.omitText&&e&&A(e,t))return null;let i={};if(n.omitText||(i.text=t.text,n.forceText&&(i.forceText=!0),n.forceText&&typeof r?.caret==`number`&&Number.isFinite(r.caret)&&(i.caret=Math.max(0,Math.floor(r.caret)))),!e){let{text:e,...n}=t;return Object.assign(i,n),i}let a=(n,r)=>{r(e[n],t[n])||(i[n]=t[n])};return a(`placeholder`,I),a(`modelLabel`,I),a(`modelVariantLabel`,I),a(`modelIcon`,I),a(`canSend`,I),a(`canAbort`,I),a(`attachmentCount`,I),a(`attachmentPreviews`,M),a(`citationRanges`,N),a(`chipRanges`,P),a(`appearance`,I),a(`attachAria`,I),a(`attachTitle`,I),a(`attachPhotosLabel`,I),a(`attachFilesLabel`,I),a(`attachCancelLabel`,I),a(`sendAria`,I),a(`queueAria`,I),a(`stopAria`,I),a(`modelAria`,I),a(`agentAria`,I),a(`agentLabel`,I),a(`agentColor`,I),a(`agentIdenticon`,(e,t)=>e.join(``)===t.join(``)),a(`suppressed`,I),a(`showScrollToBottom`,I),a(`scrollAria`,I),a(`autocomplete`,j),Object.keys(i).length===0?null:i},De=e=>{let t=Array.isArray(e?.skipped)?e.skipped:[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e.name;typeof t==`string`&&t.trim()&&n.push(t)}return n},Oe=e=>{try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch{return null}},ke=(e,t=ie)=>{let n=Array.isArray(e?.files)?e.files:[],r=[];for(let e of n){if(!e||typeof e!=`object`)continue;let n=e;if(typeof n.dataBase64!=`string`||n.dataBase64.length===0)continue;let i=Oe(n.dataBase64);if(!i||i.byteLength===0||i.byteLength>t)continue;let a=typeof n.name==`string`&&n.name.trim()?n.name:`file`,o=typeof n.mime==`string`&&n.mime.trim()?n.mime:`application/octet-stream`;r.push(new File([new Uint8Array(i)],a,{type:o}))}return r},L=80,Ae=e=>typeof document>`u`||!e||!e.startsWith(`data:image/`)?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=L,e.height=L;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,L,L),r.drawImage(n,0,0,L,L);let i=e.toDataURL(`image/jpeg`,.72),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),je=e=>typeof document>`u`||!e?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=w,e.height=w;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,w,w),r.drawImage(n,0,0,w,w);let i=e.toDataURL(`image/png`),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),R=()=>oe,z=((e=R)=>{let t=0,n=null,r=[],i=null,a=``,o=!1,s=!1,c=()=>{n!==null&&(clearTimeout(n),n=null)},l=(e,...t)=>{let n=i;n&&n[e](...t)},u=async()=>{if(r.length>0)return;let t=e(),n=await Promise.all([t.addListener(`textChanged`,e=>{let t=typeof e.text==`string`?e.text:``;a=t,l(`onText`,t,e.composing===!0,ye(e))}),t.addListener(`send`,e=>{let t=typeof e.text==`string`?e.text:a;a=t,l(`onSend`,t)}),t.addListener(`abort`,()=>{l(`onAbort`)}),t.addListener(`attach`,()=>{l(`onAttach`)}),t.addListener(`filesPicked`,t=>{l(`onFiles`,ke(t),De(t)),e().focus()}),t.addListener(`removeAttachment`,e=>{let t=ve(e);t&&l(`onRemoveAttachment`,t)}),t.addListener(`openModel`,()=>{l(`onOpenModel`)}),t.addListener(`cycleAgent`,()=>{l(`onCycleAgent`)}),t.addListener(`openAgent`,()=>{l(`onOpenAgent`)}),t.addListener(`heightChanged`,e=>{l(`onHeight`,ue(e))}),t.addListener(`scrollToBottom`,()=>{l(`onScrollToBottom`)}),t.addListener(`autocompleteAccept`,e=>{l(`onAutocompleteAccept`,be(e))}),t.addListener(`autocompleteDismiss`,()=>{l(`onAutocompleteDismiss`)})]);if(r.length>0){for(let e of n)e.remove();return}r=n},d=n=>{t>0||(i=null,o=!1,E(n,!1),e().dismiss())};return{bind(e){i=e},rememberText(e){a=e},rememberState(e){a=e.text},conceal(){o||t===0||(o=!0,e().hide())},reveal(){!o||t===0||(o=!1,e().show())},async warm(){s||t>0||(s=!0,await e().present(ae()))},async retain(n,i){c(),t+=1,o=!1,s=!0,a=i.text,E(n,!0),r.length===0&&await u(),await e().present(i)},release(e){t=Math.max(0,t-1),!(t>0)&&(c(),n=setTimeout(()=>{n=null,d(e)},0))},shutdown(n=document.documentElement){c(),t=0,s=!1,o=!1,i=null,E(n,!1),e().dismiss()},snapshot(){return{retainCount:t,listenerCount:r.length,hidePending:n!==null,concealed:o,warmed:s}}}})(),Me=()=>a(`OpenChamberNavigation`),B=e=>e?.kind===`chat`||e?.kind===`draft`,V=e=>e?e.kind===`draft`||e.kind===`chat`&&e.routes.length<=1:!1,Ne=(e,t)=>B(e)&&!B(t),Pe=(e=z)=>{V(u.getState().secondary)&&e.conceal()},Fe=(e=z)=>{let t=u.subscribe((t,n)=>{Ne(n.secondary,t.secondary)&&e.conceal()}),n=[],r=!1;return o.getPlatform()===`ios`&&(async()=>{let t=Me(),i=await t.addListener(`backStarted`,()=>{V(u.getState().secondary)&&e.conceal()}),a=await t.addListener(`backCancelled`,()=>{e.reveal()});if(r){i.remove(),a.remove();return}n=[i,a]})(),()=>{r=!0,t();for(let e of n)e.remove();n=[]}},H=`__openchamberMobileBackRoute`,Ie=()=>typeof window>`u`||r()?null:{currentState:()=>window.history.state&&typeof window.history.state==`object`?window.history.state:null,pushState:e=>window.history.pushState(e,``,window.location.href),back:()=>window.history.back(),subscribe:e=>{let t=t=>e(t.state&&typeof t.state==`object`?t.state:null);return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)}},U=e=>{let t=e?.[H];return typeof t==`number`&&Number.isFinite(t)?t:null},W=new class{routes=[];listeners=new Set;nextToken=1;history;removeHistoryListener=null;programmaticHistoryBackToken=null;pendingHistoryRemovals=new Map;animatedBackDriver=null;presentationCancelDriver=null;constructor(e=Ie()){this.history=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getTopRoute=()=>this.routes.at(-1)??null;register=e=>{let t=this.pendingHistoryRemovals.get(e.id);this.pendingHistoryRemovals.delete(e.id);let n=!!(this.history&&t!==void 0&&U(this.history.currentState())===t),r={...e,token:n&&t!==void 0?t:this.nextToken++};this.routes.push(r),this.ensureHistoryListener(),this.history&&!n&&this.history.pushState({...this.history.currentState()??{},[H]:r.token}),this.notify();let i=!0;return()=>{if(!i)return;i=!1;let e=this.routes.indexOf(r);e<0||(this.routes.splice(e,1),this.history&&U(this.history.currentState())===r.token?(this.pendingHistoryRemovals.set(r.id,r.token),queueMicrotask(()=>{if(this.pendingHistoryRemovals.get(r.id)===r.token){if(this.pendingHistoryRemovals.delete(r.id),!this.history||U(this.history.currentState())!==r.token){this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener();return}this.programmaticHistoryBackToken=r.token,this.history.back(),this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener()}})):this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener(),this.notify())}};backImmediately=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:t.onBack()!==!1};requestAnimatedBack=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:this.animatedBackDriver?.(t)?!0:this.backImmediately(e)};setAnimatedBackDriver=e=>(this.animatedBackDriver=e,()=>{this.animatedBackDriver===e&&(this.animatedBackDriver=null)});setPresentationCancelDriver=e=>(this.presentationCancelDriver=e,()=>{this.presentationCancelDriver===e&&(this.presentationCancelDriver=null)});cancelPresentation=()=>{this.presentationCancelDriver?.()};requestBrowserBack=()=>{let e=this.getTopRoute();return e?this.history&&U(this.history.currentState())===e.token?(this.history.back(),!0):e.onBack()!==!1:!1};ensureHistoryListener(){!this.history||this.removeHistoryListener||(this.removeHistoryListener=this.history.subscribe(e=>{if(this.programmaticHistoryBackToken!==null){this.programmaticHistoryBackToken=null;return}let t=this.getTopRoute();t&&U(e)!==t.token&&t.onBack()===!1&&this.history&&this.history.pushState({...this.history.currentState()??{},[H]:t.token})}))}disposeHistoryListener(){this.removeHistoryListener?.(),this.removeHistoryListener=null,this.programmaticHistoryBackToken=null,this.pendingHistoryRemovals.clear()}notify(){this.listeners.forEach(e=>e())}},Le=e=>{let t=(0,m.c)(8),{id:n,active:r,layer:i,onBack:a,surfaceRef:o,underlayRef:s}=e,c=i===void 0?`root`:i,u=l(a),d,f;t[0]!==r||t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==s?(d=()=>{if(r)return W.register({id:n,layer:c,onBack:u,getSurface:()=>o.current,getUnderlay:()=>s?.current??null})},f=[r,u,n,c,o,s],t[0]=r,t[1]=u,t[2]=n,t[3]=c,t[4]=o,t[5]=s,t[6]=d,t[7]=f):(d=t[6],f=t[7]),p.useEffect(d,f)},G=a(`OpenChamberNavigation`),K=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),Re=(e,t)=>!e||!t?!1:e.onBack()!==!1,q=e=>{let t=K(e.progress),n=e.commit?1-t:t;if(n<=.001)return 0;let r=Math.max(1,e.viewportWidth??390),i=Math.abs(e.velocityX??0)/r,a=n/Math.max(e.commit?2.4:2.8,i)*1e3,o=e.commit?90:100,s=e.commit?320:260;return Math.round(Math.min(s,Math.max(o,a)))},J=e=>{let{surface:t,underlay:n,surfaceTransition:r,surfaceAnimation:i,underlayTransition:a,underlayAnimation:o}=e;t.style.removeProperty(`transform`),t.style.removeProperty(`opacity`),t.style.removeProperty(`will-change`),t.style.removeProperty(`box-shadow`),t.style.transition=r,t.style.animation=i,n&&(n.style.removeProperty(`transform`),n.style.removeProperty(`opacity`),n.style.removeProperty(`will-change`),n.style.transition=a??``,n.style.animation=o??``)},Y=(e,t)=>{let n=K(t),{surface:r}=e;r.style.transform=`translate3d(${n*100}%, 0, 0)`},ze=e=>!e.surfaceConnected||e.topRouteToken!==e.routeToken||e.routeSurface!==e.outgoingSurface,Be=async(e,t,n,r)=>{if(!r&&typeof e.animate==`function`){let r=e.style.transform||`translate3d(0%, 0, 0)`,i=`translate3d(${t}%, 0, 0)`,a=e.animate([{transform:r},{transform:i}],{duration:n,easing:`cubic-bezier(0.22, 1, 0.36, 1)`,fill:`forwards`}),o=!1;try{await a.finished,o=!0}catch{}finally{o&&(e.style.transform=i),a.cancel()}return}e.style.transform=`translate3d(${t}%, 0, 0)`},Ve=async(e,t,n=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,r=q({progress:Number.parseFloat(e.style.transform.match(/translate3d\(([-\d.]+)%/)?.[1]??`0`)/100,commit:t}))=>Be(e,t?100:0,r,n),He=class{pending=0;enqueue(){this.pending+=1}take(){return this.pending!==0&&(--this.pending,!0)}clear(){this.pending=0}},Ue=e=>{let t=(0,m.c)(4),{enabled:n,rootRoutesBlocked:i}=e,a,s;t[0]!==n||t[1]!==i?(a=()=>{if(!n||!r()||o.getPlatform()===`web`)return;let e=!1,t=null,a=null,s=0,c=0,l=0,u=new He,d=[],f=e=>!!e&&(!i||e?.layer===`overlay`),p=()=>{let e=f(W.getTopRoute());G.setEnabled({enabled:e}).catch(We)},m=()=>{if(W.cancelPresentation(),a)return;let e=W.getTopRoute();if(!f(e))return;let n=e.getSurface();if(!n)return;n.getAnimations().forEach(Ge),a=null;let r=e.layer===`root`?e.getUnderlay():null,i=n.style.transition,o=n.style.animation,s=r?.style.transition??null,c=r?.style.animation??null;r?.getAnimations().forEach(Ke),n.style.transition=`none`,n.style.animation=`none`,n.style.willChange=`transform`,r&&(r.style.removeProperty(`transform`),r.style.removeProperty(`will-change`)),l+=1,t={route:e,surface:n,underlay:r,surfaceTransition:i,surfaceAnimation:o,underlayTransition:s,underlayAnimation:c},Y(t,0)},h=e=>{c=K(e),!s&&(s=window.requestAnimationFrame(()=>{s=0,t&&Y(t,c)}))},g=qe,_=(n,r,i)=>{if(n&&Pe(),a)return n&&f(W.getTopRoute())?(u.enqueue(),!0):!1;s&&=(window.cancelAnimationFrame(s),0),t||m(),t&&r!==void 0&&Y(t,r);let o=t,d=l;if(t=null,!o){if(!n)return!1;let e=W.getTopRoute();return Re(e,f(e))}a=o;let p=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,h=q({progress:K(r??c),commit:n,velocityX:i,viewportWidth:window.innerWidth});return Ve(o.surface,n,p,h).then(async()=>{d===l&&(!e&&n&&(o.route.onBack(),await g(o)),d===l&&(J(o),a===o&&(a=null),!e&&u.take()&&_(!0,0,0)))}),!0},v=W.setAnimatedBackDriver(e=>e!==W.getTopRoute()||!f(e)?!1:_(!0,0,0)),y=W.subscribe(p);return(async()=>{let t=await G.addListener(`backStarted`,m),n=await G.addListener(`backProgressed`,e=>h(e.progress??0)),r=await G.addListener(`backCancelled`,e=>_(!1,e.progress,e.velocityX)),i=await G.addListener(`backInvoked`,e=>_(!0,e.progress,e.velocityX));if(e){await Promise.all([t.remove(),n.remove(),r.remove(),i.remove()]);return}d.push(t,n,r,i),p()})().catch(Je),p(),()=>{e=!0,l+=1,u.clear(),y(),v(),s&&window.cancelAnimationFrame(s),t&&J(t),a&&(a.surface.getAnimations().forEach(Ye),a.underlay?.getAnimations().forEach(Xe),J(a)),t=null,a=null,G.setEnabled({enabled:!1}).catch(Ze),d.forEach(Qe)}},s=[n,i],t[0]=n,t[1]=i,t[2]=a,t[3]=s):(a=t[2],s=t[3]),p.useEffect(a,s)};function We(){}function Ge(e){return e.cancel()}function Ke(e){return e.cancel()}function qe(e){return new Promise(t=>{let n=0,r=12,i=!1,a=()=>{i||(i=!0,c(),n&&window.cancelAnimationFrame(n),t())},o=()=>{let t=W.getTopRoute();return ze({surfaceConnected:e.surface.isConnected,routeToken:e.route.token,topRouteToken:t?.token??null,routeSurface:e.route.getSurface(),outgoingSurface:e.surface})},s=()=>{if(o()||r<=0){a();return}--r,n=window.requestAnimationFrame(s)},c=W.subscribe(()=>{o()&&a()});s()})}function Je(){}function Ye(e){return e.cancel()}function Xe(e){return e.cancel()}function Ze(){}function Qe(e){e.remove()}var $e=e=>/^#[0-9a-fA-F]{6}$/.test(e),et=e=>/^#[0-9a-fA-F]{8}$/.test(e),tt=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?$e(e)?`${e}${t}`:et(e)?`${e.slice(0,7)}${t}`:e:e,X=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,nt=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>X(n[e],t);return[{name:`plain`,scope:[`source`,`support.type.property-name.css`],settings:{foreground:t.foreground}},{name:`classes`,scope:[`entity.name.type.class`],settings:{foreground:r(`className`,r(`class`,t.function))}},{name:`interfaces`,scope:[`entity.name.type.interface`,`entity.name.type`],settings:{foreground:r(`interface`,t.type)}},{name:`structs`,scope:[`entity.name.type.struct`],settings:{foreground:r(`struct`,t.function)}},{name:`enums`,scope:[`entity.name.type.enum`],settings:{foreground:r(`enum`,t.function)}},{name:`keys`,scope:[`meta.object-literal.key`,`support.type.property-name`],settings:{foreground:r(`key`,t.function)}},{name:`methods`,scope:[`entity.name.function.method`,`meta.function.method`],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`functions`,scope:[`entity.name.function`,`support.function`,`meta.function-call.generic`],settings:{foreground:t.function,fontStyle:`bold`}},{name:`variables`,scope:[`variable`,`meta.variable`,`variable.other.object.property`],settings:{foreground:t.variable}},{name:`variablesOther`,scope:[`variable.other.object`,`variable.other.readwrite.alias`],settings:{foreground:r(`variableOther`,r(`method`,e.colors.status.success))}},{name:`globalVariables`,scope:[`variable.other.global`,`variable.language.this`],settings:{foreground:r(`variableGlobal`,t.number)}},{name:`localVariables`,scope:[`variable.other.local`],settings:{foreground:r(`variableLocal`,e.colors.surface.elevated)}},{name:`parameters`,scope:[`variable.parameter`,`meta.parameter`],settings:{foreground:r(`parameter`,t.foreground)}},{name:`properties`,scope:[`variable.other.property`,`meta.property`],settings:{foreground:r(`variableProperty`,e.colors.status.info)}},{name:`strings`,scope:[`string`,`string.other.link`,`markup.inline.raw.string.markdown`],settings:{foreground:t.string}},{name:`stringEscapeSequences`,scope:[`constant.character.escape`,`constant.other.placeholder`],settings:{foreground:r(`stringEscape`,t.foreground)}},{name:`keywords`,scope:[`keyword`],settings:{foreground:t.keyword}},{name:`keywordsControl`,scope:[`keyword.control.import`,`keyword.control.from`,`keyword.import`],settings:{foreground:r(`keywordImport`,t.operator)}},{name:`storageModifiers`,scope:[`storage.modifier`,`keyword.modifier`,`storage.type`],settings:{foreground:r(`storageModifier`,t.keyword)}},{name:`comments`,scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:t.comment}},{name:`docComments`,scope:[`comment.documentation`,`comment.line.documentation`],settings:{foreground:r(`commentDoc`,e.colors.surface.mutedForeground)}},{name:`numbers`,scope:[`constant.numeric`],settings:{foreground:t.number}},{name:`booleans`,scope:[`constant.language`],settings:{foreground:r(`boolean`,t.type)}},{name:`operators`,scope:[`keyword.operator`],settings:{foreground:t.operator}},{name:`macros`,scope:[`entity.name.function.preprocessor`,`meta.preprocessor`],settings:{foreground:r(`macro`,t.keyword)}},{name:`preprocessor`,scope:[`meta.preprocessor`],settings:{foreground:r(`preprocessor`,r(`label`,t.number))}},{name:`urls`,scope:[`markup.underline.link`],settings:{foreground:r(`url`,e.colors.status.info)}},{name:`tags`,scope:[`entity.name.tag`],settings:{foreground:r(`tag`,t.keyword)}},{name:`jsxTags`,scope:[`support.class.component`],settings:{foreground:r(`jsxTag`,r(`label`,t.number))}},{name:`attributes`,scope:[`entity.other.attribute-name`,`meta.attribute`],settings:{foreground:r(`tagAttribute`,t.type)}},{name:`types`,scope:[`support.type`],settings:{foreground:t.type}},{name:`constants`,scope:[`variable.other.constant`,`variable.readonly`],settings:{foreground:r(`constant`,t.foreground)}},{name:`labels`,scope:[`entity.name.label`,`punctuation.definition.label`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`namespaces`,scope:[`entity.name.namespace`,`storage.modifier.namespace`,`markup.bold.markdown`],settings:{foreground:r(`namespace`,t.type)}},{name:`modules`,scope:[`entity.name.module`,`storage.modifier.module`],settings:{foreground:r(`module`,t.operator)}},{name:`typeParameters`,scope:[`variable.type.parameter`,`variable.parameter.type`],settings:{foreground:r(`typeParameter`,t.function)}},{name:`exceptions`,scope:[`keyword.control.exception`,`keyword.control.trycatch`],settings:{foreground:r(`exception`,r(`label`,t.number))}},{name:`decorators`,scope:[`meta.decorator`,`punctuation.decorator`,`entity.name.function.decorator`],settings:{foreground:r(`decorator`,t.type)}},{name:`calls`,scope:[`variable.function`],settings:{foreground:t.foreground}},{name:`punctuation`,scope:[`punctuation`,`punctuation.terminator`,`punctuation.definition.tag`,`punctuation.separator`,`punctuation.definition.string`,`punctuation.section.block`],settings:{foreground:r(`punctuation`,t.comment)}},{name:`yellow`,scope:[`storage.type.numeric.go`,`storage.type.byte.go`,`storage.type.boolean.go`,`storage.type.string.go`,`storage.type.uintptr.go`,`storage.type.error.go`,`storage.type.rune.go`,`constant.language.go`,`support.class.dart`,`keyword.other.documentation`,`storage.modifier.import.java`,`punctuation.definition.list.begin.markdown`,`punctuation.definition.quote.begin.markdown`,`meta.separator.markdown`,`entity.name.section.markdown`],settings:{foreground:t.type}},{name:`green`,scope:[],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`cyan`,scope:[`markup.italic.markdown`,`support.type.python`,`variable.legacy.builtin.python`,`support.constant.property-value.css`,`storage.modifier.attribute.swift`],settings:{foreground:t.string}},{name:`blue`,scope:[],settings:{foreground:t.keyword}},{name:`purple`,scope:[`keyword.channel.go`,`keyword.other.platform.os.swift`],settings:{foreground:t.number}},{name:`magenta`,scope:[`punctuation.definition.heading.markdown`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`red`,scope:[],settings:{foreground:t.operator}},{name:`orange`,scope:[],settings:{foreground:t.function}}]},rt=e=>{let t=e.colors.surface,n=e.colors.interactive,r=e.colors.status,i=e.colors.syntax.base,a=e.colors.syntax.highlights??{},o=X(a.diffAddedBackground,r.successBackground),s=X(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":X(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":tt(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":X(n.active,n.borderHover),"notifications.background":t.elevated,"editorInlayHint.typeBackground":t.subtle,"editorInlayHint.typeForeground":t.foreground,"editorWhitespace.foreground":n.borderHover,"editorIndentGuide.background1":t.subtle,"editorHoverWidget.background":t.elevated,"editorLineNumber.activeForeground":X(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":X(a.lineNumber,t.mutedForeground),"editorGutter.background":t.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":t.elevated,"editorBracketMatch.border":t.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":o,"diffEditor.removedTextBackground":s,"editorGroupHeader.tabsBackground":t.background,"editorGroup.border":n.border,"tab.activeBackground":t.background,"tab.inactiveBackground":t.muted,"tab.inactiveForeground":t.mutedForeground,"tab.activeForeground":t.foreground,"tab.hoverBackground":t.subtle,"tab.unfocusedHoverBackground":t.subtle,"tab.border":n.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":t.muted,"editorWidget.border":n.border,"editorSuggestWidget.background":t.background,"editorSuggestWidget.border":n.border,"editorSuggestWidget.foreground":t.foreground,"editorSuggestWidget.highlightForeground":t.mutedForeground,"editorSuggestWidget.selectedBackground":t.subtle,"peekView.border":n.border,"peekViewEditor.background":t.background,"peekViewEditor.matchHighlightBackground":t.subtle,"peekViewResult.background":t.muted,"peekViewResult.fileForeground":t.foreground,"peekViewResult.lineForeground":t.mutedForeground,"peekViewResult.matchHighlightBackground":t.subtle,"peekViewResult.selectionBackground":t.elevated,"peekViewResult.selectionForeground":t.mutedForeground,"peekViewTitle.background":t.subtle,"peekViewTitleDescription.foreground":t.mutedForeground,"peekViewTitleLabel.foreground":t.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":X(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":X(a.diffModified,r.info),"merge.border":n.border,"merge.commonContentBackground":t.subtle,"merge.commonHeaderBackground":t.muted,"panel.background":t.background,"panel.border":n.border,"panelTitle.activeBorder":n.borderHover,"panelTitle.activeForeground":t.foreground,"panelTitle.inactiveForeground":t.mutedForeground,"statusBar.background":t.background,"statusBar.foreground":t.foreground,"statusBar.border":n.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":t.subtle,"statusBar.noFolderForeground":t.mutedForeground,"titleBar.activeBackground":t.background,"titleBar.activeForeground":t.foreground,"titleBar.inactiveBackground":t.muted,"titleBar.inactiveForeground":t.mutedForeground,"titleBar.border":n.border,"menu.foreground":t.foreground,"menu.background":t.background,"menu.selectionForeground":t.foreground,"menu.selectionBackground":t.subtle,"menu.border":n.border,"editorInlayHint.foreground":t.mutedForeground,"editorInlayHint.background":t.subtle,"terminal.foreground":t.foreground,"terminal.background":t.background,"terminalCursor.foreground":t.foreground,"terminalCursor.background":t.background,"terminal.ansiRed":X(a.diffRemoved,r.error),"terminal.ansiGreen":X(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":X(a.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":t.background,"activityBar.foreground":t.foreground,"activityBar.inactiveForeground":t.mutedForeground,"activityBar.activeBorder":t.foreground,"activityBar.border":n.border,"sideBar.background":t.background,"sideBar.foreground":t.foreground,"sideBar.border":n.border,"sideBarTitle.foreground":t.foreground,"sideBarSectionHeader.background":t.muted,"sideBarSectionHeader.foreground":t.foreground,"sideBarSectionHeader.border":n.border,"sideBar.activeBackground":t.subtle,"sideBar.activeForeground":t.foreground,"sideBar.hoverBackground":t.muted,"sideBar.hoverForeground":t.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":t.subtle,"list.activeSelectionBackground":t.elevated,"list.inactiveSelectionForeground":t.foreground,"list.activeSelectionForeground":t.foreground,"list.hoverForeground":t.foreground,"list.hoverBackground":t.muted,"input.background":t.muted,"input.foreground":t.foreground,"input.border":n.border,"input.placeholderForeground":t.mutedForeground,"inputOption.activeBorder":n.border,"inputOption.activeBackground":t.elevated,"inputOption.activeForeground":t.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":t.muted,"dropdown.foreground":t.foreground,"dropdown.border":n.border,"dropdown.listBackground":t.background,"badge.background":e.colors.primary.base,"activityBarBadge.background":e.colors.primary.base,"button.background":e.colors.primary.base,"button.foreground":X(e.colors.primary.foreground,t.background),"badge.foreground":X(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":X(e.colors.primary.foreground,t.background)}};function it(e){return{name:e.metadata.name,type:e.metadata.variant,colors:rt(e),tokenColors:nt(e)}}var at=e=>/^#[0-9a-fA-F]{8}$/.test(e),Z=e=>at(e)?e.slice(0,7):e;function ot(e,t){return Object.defineProperty(e,"toString",{value:()=>t,enumerable:!1,configurable:!0}),Object.defineProperty(e,Symbol.toPrimitive,{value:()=>t,enumerable:!1,configurable:!0}),e}var Q=new Map,$=new Set,st=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?Z(n):void 0,a=r?Z(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return ot({...e,name:t,fg:a,bg:i,settings:o},t)},ct=e=>it(e),lt=e=>{let t=Q.get(e.metadata.id);if(t)return t;let n=st(ct(e),e.metadata.id);return Q.set(e.metadata.id,n),n},ut=e=>{let t=e.metadata.id;if($.has(t))return;let n=lt(e);c(t,async()=>n),$.add(t)};export{te as A,Ae as C,Se as D,k as E,ee as M,v as N,E as O,pe as S,xe as T,j as _,Ue as a,me as b,fe as c,ge as d,Ee as f,Te as g,R as h,Le as i,y as j,Ce as k,de as l,T as m,lt as n,Fe as o,ce as p,W as r,z as s,ut as t,_e as u,he as v,je as w,le as x,A as y};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t}from"./vendor-zustand-B4dlGEM2.js";import{rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r,t as i}from"./platform-DQ5_LNKO.js";import{a,n as o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{r as c}from"./vendor-pierre-diffs-DX7XTPG3.js";import{n as l}from"./vendor-reactuses-core-BnW6GxJt.js";import{r as u}from"./useMobileNavigationStore-DF9UNgl_.js";import{c as d,l as f}from"./dialog-gtFLyacK.js";var p=e(n(),1),m=s(),h=`openchamber.iosNativeUi`,g=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(h)===`1`}catch{return!1}},_=e=>{if(!(typeof window>`u`))try{e?window.localStorage.setItem(h,`1`):window.localStorage.removeItem(h)}catch{}},v=t(e=>({enabled:g(),setEnabled:t=>{_(t),e({enabled:t})}})),y=()=>v.getState().enabled,ee=()=>v(ne),te=()=>r()&&i()===`ios`;function ne(e){return e.enabled}var re=`oc-native-ios-composer`,b=`--oc-native-composer-height`,x=`--oc-native-composer-accessory`,ie=33554432,S=`OpenChamberComposer`,C=`#22c55e`,w=32,T=()=>({open:!1,highlightedIndex:0,rows:[]}),ae=()=>({text:``,placeholder:``,modelLabel:``,modelVariantLabel:``,modelIcon:``,canSend:!1,canAbort:!1,attachmentCount:0,attachmentPreviews:[],citationRanges:[],chipRanges:[],appearance:`dark`,attachAria:``,attachTitle:``,attachPhotosLabel:``,attachFilesLabel:``,attachCancelLabel:``,sendAria:``,queueAria:``,stopAria:``,modelAria:``,agentAria:``,agentLabel:``,agentColor:C,agentIdenticon:Array.from({length:25},()=>0),suppressed:!0,showScrollToBottom:!1,scrollAria:``,autocomplete:T()}),oe=a(S),se=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.isMobile&&e.nativeUiEnabled!==!1;function ce(e){return typeof window>`u`?!1:se({isCapacitor:r(),platform:i(),pluginAvailable:o.isPluginAvailable(S),isMobile:e,nativeUiEnabled:y()})}var le=e=>e.classList.contains(`dark`)?`dark`:`light`,ue=e=>{let t=e?.height;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:t},de=(e,t)=>{if(!(t>0)){e.style.removeProperty(b);return}e.style.setProperty(b,`${Math.round(t)}px`)},fe=(e,t)=>{if(!(t>0)){e.style.removeProperty(x);return}e.style.setProperty(x,`${Math.round(t)}px`)},E=(e,t)=>{e.classList.toggle(re,t),t||(e.style.removeProperty(b),e.style.removeProperty(x))},pe=e=>d(e).flat().map(e=>+!!e),D=new Map,O=null,k=e=>{let t=D.get(e);if(t!==void 0)return t;if(typeof document>`u`||typeof getComputedStyle>`u`)return C;!O&&typeof MutationObserver<`u`&&(O=new MutationObserver(()=>{D.clear()}),O.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}));let n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),r=document.createElement(`span`);r.style.color=n||`var(${e})`,document.documentElement.appendChild(r);let i=getComputedStyle(r).color;r.remove();let a=/rgba?\(\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)(?:\s*,\s*|\s+)([\d.]+)/.exec(i);if(!a)return D.set(e,C),C;let o=e=>Math.max(0,Math.min(255,Math.round(Number(e)))).toString(16).padStart(2,`0`),s=`#${o(a[1])}${o(a[2])}${o(a[3])}`;return D.set(e,s),s},me=e=>k(f(e).var),A=(e,t)=>e.text===t.text&&e.placeholder===t.placeholder&&e.modelLabel===t.modelLabel&&e.modelVariantLabel===t.modelVariantLabel&&e.modelIcon===t.modelIcon&&e.canSend===t.canSend&&e.canAbort===t.canAbort&&e.attachmentCount===t.attachmentCount&&M(e.attachmentPreviews,t.attachmentPreviews)&&N(e.citationRanges,t.citationRanges)&&P(e.chipRanges,t.chipRanges)&&e.appearance===t.appearance&&e.attachAria===t.attachAria&&e.attachTitle===t.attachTitle&&e.attachPhotosLabel===t.attachPhotosLabel&&e.attachFilesLabel===t.attachFilesLabel&&e.attachCancelLabel===t.attachCancelLabel&&e.sendAria===t.sendAria&&e.queueAria===t.queueAria&&e.stopAria===t.stopAria&&e.modelAria===t.modelAria&&e.agentAria===t.agentAria&&e.agentLabel===t.agentLabel&&e.agentColor===t.agentColor&&e.agentIdenticon.join(``)===t.agentIdenticon.join(``)&&e.suppressed===t.suppressed&&e.showScrollToBottom===t.showScrollToBottom&&e.scrollAria===t.scrollAria&&j(e.autocomplete,t.autocomplete),j=(e,t)=>e.open===t.open&&e.highlightedIndex===t.highlightedIndex&&e.rows.length===t.rows.length&&e.rows.every((e,n)=>{let r=t.rows[n];return!!(r&&e.id===r.id&&e.title===r.title&&e.subtitle===r.subtitle&&e.badge===r.badge&&e.iconBase64===r.iconBase64)}),M=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.id===r.id&&e.filename===r.filename&&e.mime===r.mime&&e.thumbnailBase64===r.thumbnailBase64&&e.removeAria===r.removeAria)}),N=(e,t)=>e.length===t.length&&e.every((e,n)=>e.start===t[n]?.start&&e.end===t[n]?.end),P=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.start===r.start&&e.end===r.end&&e.triggerLength===r.triggerLength&&e.color===r.color)}),he=(e,t)=>{if(!e||!t||t.length===0)return[];let n=[],r=0;for(let e of t){let t=r;r+=e.text.length;let i=e.visual;if(!i)continue;let a=i.trigger.length;a<1||t+a>r||i.icon&&n.push({start:t,end:r,triggerLength:a,iconName:i.icon})}return n},ge=(e,t)=>e.map(e=>({start:e.start,end:e.end,triggerLength:e.triggerLength,color:t})),_e=e=>e.map(e=>`${e.id}:${e.filename}:${e.mimeType}:${e.dataUrl?.length??0}`).join(`|`),ve=e=>{let t=e?.id;return typeof t==`string`&&t.trim()?t:``},F=e=>{if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return Math.floor(e);if(typeof e==`string`&&e.trim()){let t=Number(e);if(Number.isFinite(t)&&t>=0)return Math.floor(t)}return null},ye=e=>{let t=F(e?.selectionStart);if(t===null)return null;let n=F(e?.selectionEnd);return{start:t,end:n!==null&&n>=t?n:t}},be=e=>F(e?.index)??0,xe=(e,t)=>{let n=Math.max(0,e);return typeof t!=`number`||!Number.isFinite(t)?n:Math.max(0,Math.min(Math.floor(t),n))},Se=e=>e.nextText===e.nativeOwnedText?{omitText:!0,forceText:!1}:e.nextText.length===0&&e.nativeOwnedText.length>0||e.preset?{omitText:!1,forceText:!0}:e.echoingNative?{omitText:!0,forceText:!1}:{omitText:!1,forceText:!0},Ce=e=>e.replacedText!==null&&e.incoming===e.replacedText,we=e=>setTimeout(e,0),Te=e=>{e.applyDocument(e.text),we(e.submit)},I=(e,t)=>e===t,Ee=(e,t,n,r)=>{if(n.omitText&&e&&A(e,t))return null;let i={};if(n.omitText||(i.text=t.text,n.forceText&&(i.forceText=!0),n.forceText&&typeof r?.caret==`number`&&Number.isFinite(r.caret)&&(i.caret=Math.max(0,Math.floor(r.caret)))),!e){let{text:e,...n}=t;return Object.assign(i,n),i}let a=(n,r)=>{r(e[n],t[n])||(i[n]=t[n])};return a(`placeholder`,I),a(`modelLabel`,I),a(`modelVariantLabel`,I),a(`modelIcon`,I),a(`canSend`,I),a(`canAbort`,I),a(`attachmentCount`,I),a(`attachmentPreviews`,M),a(`citationRanges`,N),a(`chipRanges`,P),a(`appearance`,I),a(`attachAria`,I),a(`attachTitle`,I),a(`attachPhotosLabel`,I),a(`attachFilesLabel`,I),a(`attachCancelLabel`,I),a(`sendAria`,I),a(`queueAria`,I),a(`stopAria`,I),a(`modelAria`,I),a(`agentAria`,I),a(`agentLabel`,I),a(`agentColor`,I),a(`agentIdenticon`,(e,t)=>e.join(``)===t.join(``)),a(`suppressed`,I),a(`showScrollToBottom`,I),a(`scrollAria`,I),a(`autocomplete`,j),Object.keys(i).length===0?null:i},De=e=>{let t=Array.isArray(e?.skipped)?e.skipped:[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e.name;typeof t==`string`&&t.trim()&&n.push(t)}return n},Oe=e=>{try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch{return null}},ke=(e,t=ie)=>{let n=Array.isArray(e?.files)?e.files:[],r=[];for(let e of n){if(!e||typeof e!=`object`)continue;let n=e;if(typeof n.dataBase64!=`string`||n.dataBase64.length===0)continue;let i=Oe(n.dataBase64);if(!i||i.byteLength===0||i.byteLength>t)continue;let a=typeof n.name==`string`&&n.name.trim()?n.name:`file`,o=typeof n.mime==`string`&&n.mime.trim()?n.mime:`application/octet-stream`;r.push(new File([new Uint8Array(i)],a,{type:o}))}return r},L=80,Ae=e=>typeof document>`u`||!e||!e.startsWith(`data:image/`)?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=L,e.height=L;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,L,L),r.drawImage(n,0,0,L,L);let i=e.toDataURL(`image/jpeg`,.72),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),je=e=>typeof document>`u`||!e?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=w,e.height=w;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,w,w),r.drawImage(n,0,0,w,w);let i=e.toDataURL(`image/png`),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),R=()=>oe,z=((e=R)=>{let t=0,n=null,r=[],i=null,a=``,o=!1,s=!1,c=()=>{n!==null&&(clearTimeout(n),n=null)},l=(e,...t)=>{let n=i;n&&n[e](...t)},u=async()=>{if(r.length>0)return;let t=e(),n=await Promise.all([t.addListener(`textChanged`,e=>{let t=typeof e.text==`string`?e.text:``;a=t,l(`onText`,t,e.composing===!0,ye(e))}),t.addListener(`send`,e=>{let t=typeof e.text==`string`?e.text:a;a=t,l(`onSend`,t)}),t.addListener(`abort`,()=>{l(`onAbort`)}),t.addListener(`attach`,()=>{l(`onAttach`)}),t.addListener(`filesPicked`,t=>{l(`onFiles`,ke(t),De(t)),e().focus()}),t.addListener(`removeAttachment`,e=>{let t=ve(e);t&&l(`onRemoveAttachment`,t)}),t.addListener(`openModel`,()=>{l(`onOpenModel`)}),t.addListener(`cycleAgent`,()=>{l(`onCycleAgent`)}),t.addListener(`openAgent`,()=>{l(`onOpenAgent`)}),t.addListener(`heightChanged`,e=>{l(`onHeight`,ue(e))}),t.addListener(`scrollToBottom`,()=>{l(`onScrollToBottom`)}),t.addListener(`autocompleteAccept`,e=>{l(`onAutocompleteAccept`,be(e))}),t.addListener(`autocompleteDismiss`,()=>{l(`onAutocompleteDismiss`)})]);if(r.length>0){for(let e of n)e.remove();return}r=n},d=n=>{t>0||(i=null,o=!1,E(n,!1),e().dismiss())};return{bind(e){i=e},rememberText(e){a=e},rememberState(e){a=e.text},conceal(){o||t===0||(o=!0,e().hide())},reveal(){!o||t===0||(o=!1,e().show())},async warm(){s||t>0||(s=!0,await e().present(ae()))},async retain(n,i){c(),t+=1,o=!1,s=!0,a=i.text,E(n,!0),r.length===0&&await u(),await e().present(i)},release(e){t=Math.max(0,t-1),!(t>0)&&(c(),n=setTimeout(()=>{n=null,d(e)},0))},shutdown(n=document.documentElement){c(),t=0,s=!1,o=!1,i=null,E(n,!1),e().dismiss()},snapshot(){return{retainCount:t,listenerCount:r.length,hidePending:n!==null,concealed:o,warmed:s}}}})(),Me=()=>a(`OpenChamberNavigation`),B=e=>e?.kind===`chat`||e?.kind===`draft`,V=e=>e?e.kind===`draft`||e.kind===`chat`&&e.routes.length<=1:!1,Ne=(e,t)=>B(e)&&!B(t),Pe=(e=z)=>{V(u.getState().secondary)&&e.conceal()},Fe=(e=z)=>{let t=u.subscribe((t,n)=>{Ne(n.secondary,t.secondary)&&e.conceal()}),n=[],r=!1;return o.getPlatform()===`ios`&&(async()=>{let t=Me(),i=await t.addListener(`backStarted`,()=>{V(u.getState().secondary)&&e.conceal()}),a=await t.addListener(`backCancelled`,()=>{e.reveal()});if(r){i.remove(),a.remove();return}n=[i,a]})(),()=>{r=!0,t();for(let e of n)e.remove();n=[]}},H=`__openchamberMobileBackRoute`,Ie=()=>typeof window>`u`||r()?null:{currentState:()=>window.history.state&&typeof window.history.state==`object`?window.history.state:null,pushState:e=>window.history.pushState(e,``,window.location.href),back:()=>window.history.back(),subscribe:e=>{let t=t=>e(t.state&&typeof t.state==`object`?t.state:null);return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)}},U=e=>{let t=e?.[H];return typeof t==`number`&&Number.isFinite(t)?t:null},W=new class{routes=[];listeners=new Set;nextToken=1;history;removeHistoryListener=null;programmaticHistoryBackToken=null;pendingHistoryRemovals=new Map;animatedBackDriver=null;presentationCancelDriver=null;constructor(e=Ie()){this.history=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getTopRoute=()=>this.routes.at(-1)??null;register=e=>{let t=this.pendingHistoryRemovals.get(e.id);this.pendingHistoryRemovals.delete(e.id);let n=!!(this.history&&t!==void 0&&U(this.history.currentState())===t),r={...e,token:n&&t!==void 0?t:this.nextToken++};this.routes.push(r),this.ensureHistoryListener(),this.history&&!n&&this.history.pushState({...this.history.currentState()??{},[H]:r.token}),this.notify();let i=!0;return()=>{if(!i)return;i=!1;let e=this.routes.indexOf(r);e<0||(this.routes.splice(e,1),this.history&&U(this.history.currentState())===r.token?(this.pendingHistoryRemovals.set(r.id,r.token),queueMicrotask(()=>{if(this.pendingHistoryRemovals.get(r.id)===r.token){if(this.pendingHistoryRemovals.delete(r.id),!this.history||U(this.history.currentState())!==r.token){this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener();return}this.programmaticHistoryBackToken=r.token,this.history.back(),this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener()}})):this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener(),this.notify())}};backImmediately=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:t.onBack()!==!1};requestAnimatedBack=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:this.animatedBackDriver?.(t)?!0:this.backImmediately(e)};setAnimatedBackDriver=e=>(this.animatedBackDriver=e,()=>{this.animatedBackDriver===e&&(this.animatedBackDriver=null)});setPresentationCancelDriver=e=>(this.presentationCancelDriver=e,()=>{this.presentationCancelDriver===e&&(this.presentationCancelDriver=null)});cancelPresentation=()=>{this.presentationCancelDriver?.()};requestBrowserBack=()=>{let e=this.getTopRoute();return e?this.history&&U(this.history.currentState())===e.token?(this.history.back(),!0):e.onBack()!==!1:!1};ensureHistoryListener(){!this.history||this.removeHistoryListener||(this.removeHistoryListener=this.history.subscribe(e=>{if(this.programmaticHistoryBackToken!==null){this.programmaticHistoryBackToken=null;return}let t=this.getTopRoute();t&&U(e)!==t.token&&t.onBack()===!1&&this.history&&this.history.pushState({...this.history.currentState()??{},[H]:t.token})}))}disposeHistoryListener(){this.removeHistoryListener?.(),this.removeHistoryListener=null,this.programmaticHistoryBackToken=null,this.pendingHistoryRemovals.clear()}notify(){this.listeners.forEach(e=>e())}},Le=e=>{let t=(0,m.c)(8),{id:n,active:r,layer:i,onBack:a,surfaceRef:o,underlayRef:s}=e,c=i===void 0?`root`:i,u=l(a),d,f;t[0]!==r||t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==s?(d=()=>{if(r)return W.register({id:n,layer:c,onBack:u,getSurface:()=>o.current,getUnderlay:()=>s?.current??null})},f=[r,u,n,c,o,s],t[0]=r,t[1]=u,t[2]=n,t[3]=c,t[4]=o,t[5]=s,t[6]=d,t[7]=f):(d=t[6],f=t[7]),p.useEffect(d,f)},G=a(`OpenChamberNavigation`),K=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),Re=(e,t)=>!e||!t?!1:e.onBack()!==!1,q=e=>{let t=K(e.progress),n=e.commit?1-t:t;if(n<=.001)return 0;let r=Math.max(1,e.viewportWidth??390),i=Math.abs(e.velocityX??0)/r,a=n/Math.max(e.commit?2.4:2.8,i)*1e3,o=e.commit?90:100,s=e.commit?320:260;return Math.round(Math.min(s,Math.max(o,a)))},J=e=>{let{surface:t,underlay:n,surfaceTransition:r,surfaceAnimation:i,underlayTransition:a,underlayAnimation:o}=e;t.style.removeProperty(`transform`),t.style.removeProperty(`opacity`),t.style.removeProperty(`will-change`),t.style.removeProperty(`box-shadow`),t.style.transition=r,t.style.animation=i,n&&(n.style.removeProperty(`transform`),n.style.removeProperty(`opacity`),n.style.removeProperty(`will-change`),n.style.transition=a??``,n.style.animation=o??``)},Y=(e,t)=>{let n=K(t),{surface:r}=e;r.style.transform=`translate3d(${n*100}%, 0, 0)`},ze=e=>!e.surfaceConnected||e.topRouteToken!==e.routeToken||e.routeSurface!==e.outgoingSurface,Be=async(e,t,n,r)=>{if(!r&&typeof e.animate==`function`){let r=e.style.transform||`translate3d(0%, 0, 0)`,i=`translate3d(${t}%, 0, 0)`,a=e.animate([{transform:r},{transform:i}],{duration:n,easing:`cubic-bezier(0.22, 1, 0.36, 1)`,fill:`forwards`}),o=!1;try{await a.finished,o=!0}catch{}finally{o&&(e.style.transform=i),a.cancel()}return}e.style.transform=`translate3d(${t}%, 0, 0)`},Ve=async(e,t,n=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,r=q({progress:Number.parseFloat(e.style.transform.match(/translate3d\(([-\d.]+)%/)?.[1]??`0`)/100,commit:t}))=>Be(e,t?100:0,r,n),He=class{pending=0;enqueue(){this.pending+=1}take(){return this.pending!==0&&(--this.pending,!0)}clear(){this.pending=0}},Ue=e=>{let t=(0,m.c)(4),{enabled:n,rootRoutesBlocked:i}=e,a,s;t[0]!==n||t[1]!==i?(a=()=>{if(!n||!r()||o.getPlatform()===`web`)return;let e=!1,t=null,a=null,s=0,c=0,l=0,u=new He,d=[],f=e=>!!e&&(!i||e?.layer===`overlay`),p=()=>{let e=f(W.getTopRoute());G.setEnabled({enabled:e}).catch(We)},m=()=>{if(W.cancelPresentation(),a)return;let e=W.getTopRoute();if(!f(e))return;let n=e.getSurface();if(!n)return;n.getAnimations().forEach(Ge),a=null;let r=e.layer===`root`?e.getUnderlay():null,i=n.style.transition,o=n.style.animation,s=r?.style.transition??null,c=r?.style.animation??null;r?.getAnimations().forEach(Ke),n.style.transition=`none`,n.style.animation=`none`,n.style.willChange=`transform`,r&&(r.style.removeProperty(`transform`),r.style.removeProperty(`will-change`)),l+=1,t={route:e,surface:n,underlay:r,surfaceTransition:i,surfaceAnimation:o,underlayTransition:s,underlayAnimation:c},Y(t,0)},h=e=>{c=K(e),!s&&(s=window.requestAnimationFrame(()=>{s=0,t&&Y(t,c)}))},g=qe,_=(n,r,i)=>{if(n&&Pe(),a)return n&&f(W.getTopRoute())?(u.enqueue(),!0):!1;s&&=(window.cancelAnimationFrame(s),0),t||m(),t&&r!==void 0&&Y(t,r);let o=t,d=l;if(t=null,!o){if(!n)return!1;let e=W.getTopRoute();return Re(e,f(e))}a=o;let p=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,h=q({progress:K(r??c),commit:n,velocityX:i,viewportWidth:window.innerWidth});return Ve(o.surface,n,p,h).then(async()=>{d===l&&(!e&&n&&(o.route.onBack(),await g(o)),d===l&&(J(o),a===o&&(a=null),!e&&u.take()&&_(!0,0,0)))}),!0},v=W.setAnimatedBackDriver(e=>e!==W.getTopRoute()||!f(e)?!1:_(!0,0,0)),y=W.subscribe(p);return(async()=>{let t=await G.addListener(`backStarted`,m),n=await G.addListener(`backProgressed`,e=>h(e.progress??0)),r=await G.addListener(`backCancelled`,e=>_(!1,e.progress,e.velocityX)),i=await G.addListener(`backInvoked`,e=>_(!0,e.progress,e.velocityX));if(e){await Promise.all([t.remove(),n.remove(),r.remove(),i.remove()]);return}d.push(t,n,r,i),p()})().catch(Je),p(),()=>{e=!0,l+=1,u.clear(),y(),v(),s&&window.cancelAnimationFrame(s),t&&J(t),a&&(a.surface.getAnimations().forEach(Ye),a.underlay?.getAnimations().forEach(Xe),J(a)),t=null,a=null,G.setEnabled({enabled:!1}).catch(Ze),d.forEach(Qe)}},s=[n,i],t[0]=n,t[1]=i,t[2]=a,t[3]=s):(a=t[2],s=t[3]),p.useEffect(a,s)};function We(){}function Ge(e){return e.cancel()}function Ke(e){return e.cancel()}function qe(e){return new Promise(t=>{let n=0,r=12,i=!1,a=()=>{i||(i=!0,c(),n&&window.cancelAnimationFrame(n),t())},o=()=>{let t=W.getTopRoute();return ze({surfaceConnected:e.surface.isConnected,routeToken:e.route.token,topRouteToken:t?.token??null,routeSurface:e.route.getSurface(),outgoingSurface:e.surface})},s=()=>{if(o()||r<=0){a();return}--r,n=window.requestAnimationFrame(s)},c=W.subscribe(()=>{o()&&a()});s()})}function Je(){}function Ye(e){return e.cancel()}function Xe(e){return e.cancel()}function Ze(){}function Qe(e){e.remove()}var $e=e=>/^#[0-9a-fA-F]{6}$/.test(e),et=e=>/^#[0-9a-fA-F]{8}$/.test(e),tt=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?$e(e)?`${e}${t}`:et(e)?`${e.slice(0,7)}${t}`:e:e,X=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,nt=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>X(n[e],t);return[{name:`plain`,scope:[`source`,`support.type.property-name.css`],settings:{foreground:t.foreground}},{name:`classes`,scope:[`entity.name.type.class`],settings:{foreground:r(`className`,r(`class`,t.function))}},{name:`interfaces`,scope:[`entity.name.type.interface`,`entity.name.type`],settings:{foreground:r(`interface`,t.type)}},{name:`structs`,scope:[`entity.name.type.struct`],settings:{foreground:r(`struct`,t.function)}},{name:`enums`,scope:[`entity.name.type.enum`],settings:{foreground:r(`enum`,t.function)}},{name:`keys`,scope:[`meta.object-literal.key`,`support.type.property-name`],settings:{foreground:r(`key`,t.function)}},{name:`methods`,scope:[`entity.name.function.method`,`meta.function.method`],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`functions`,scope:[`entity.name.function`,`support.function`,`meta.function-call.generic`],settings:{foreground:t.function,fontStyle:`bold`}},{name:`variables`,scope:[`variable`,`meta.variable`,`variable.other.object.property`],settings:{foreground:t.variable}},{name:`variablesOther`,scope:[`variable.other.object`,`variable.other.readwrite.alias`],settings:{foreground:r(`variableOther`,r(`method`,e.colors.status.success))}},{name:`globalVariables`,scope:[`variable.other.global`,`variable.language.this`],settings:{foreground:r(`variableGlobal`,t.number)}},{name:`localVariables`,scope:[`variable.other.local`],settings:{foreground:r(`variableLocal`,e.colors.surface.elevated)}},{name:`parameters`,scope:[`variable.parameter`,`meta.parameter`],settings:{foreground:r(`parameter`,t.foreground)}},{name:`properties`,scope:[`variable.other.property`,`meta.property`],settings:{foreground:r(`variableProperty`,e.colors.status.info)}},{name:`strings`,scope:[`string`,`string.other.link`,`markup.inline.raw.string.markdown`],settings:{foreground:t.string}},{name:`stringEscapeSequences`,scope:[`constant.character.escape`,`constant.other.placeholder`],settings:{foreground:r(`stringEscape`,t.foreground)}},{name:`keywords`,scope:[`keyword`],settings:{foreground:t.keyword}},{name:`keywordsControl`,scope:[`keyword.control.import`,`keyword.control.from`,`keyword.import`],settings:{foreground:r(`keywordImport`,t.operator)}},{name:`storageModifiers`,scope:[`storage.modifier`,`keyword.modifier`,`storage.type`],settings:{foreground:r(`storageModifier`,t.keyword)}},{name:`comments`,scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:t.comment}},{name:`docComments`,scope:[`comment.documentation`,`comment.line.documentation`],settings:{foreground:r(`commentDoc`,e.colors.surface.mutedForeground)}},{name:`numbers`,scope:[`constant.numeric`],settings:{foreground:t.number}},{name:`booleans`,scope:[`constant.language`],settings:{foreground:r(`boolean`,t.type)}},{name:`operators`,scope:[`keyword.operator`],settings:{foreground:t.operator}},{name:`macros`,scope:[`entity.name.function.preprocessor`,`meta.preprocessor`],settings:{foreground:r(`macro`,t.keyword)}},{name:`preprocessor`,scope:[`meta.preprocessor`],settings:{foreground:r(`preprocessor`,r(`label`,t.number))}},{name:`urls`,scope:[`markup.underline.link`],settings:{foreground:r(`url`,e.colors.status.info)}},{name:`tags`,scope:[`entity.name.tag`],settings:{foreground:r(`tag`,t.keyword)}},{name:`jsxTags`,scope:[`support.class.component`],settings:{foreground:r(`jsxTag`,r(`label`,t.number))}},{name:`attributes`,scope:[`entity.other.attribute-name`,`meta.attribute`],settings:{foreground:r(`tagAttribute`,t.type)}},{name:`types`,scope:[`support.type`],settings:{foreground:t.type}},{name:`constants`,scope:[`variable.other.constant`,`variable.readonly`],settings:{foreground:r(`constant`,t.foreground)}},{name:`labels`,scope:[`entity.name.label`,`punctuation.definition.label`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`namespaces`,scope:[`entity.name.namespace`,`storage.modifier.namespace`,`markup.bold.markdown`],settings:{foreground:r(`namespace`,t.type)}},{name:`modules`,scope:[`entity.name.module`,`storage.modifier.module`],settings:{foreground:r(`module`,t.operator)}},{name:`typeParameters`,scope:[`variable.type.parameter`,`variable.parameter.type`],settings:{foreground:r(`typeParameter`,t.function)}},{name:`exceptions`,scope:[`keyword.control.exception`,`keyword.control.trycatch`],settings:{foreground:r(`exception`,r(`label`,t.number))}},{name:`decorators`,scope:[`meta.decorator`,`punctuation.decorator`,`entity.name.function.decorator`],settings:{foreground:r(`decorator`,t.type)}},{name:`calls`,scope:[`variable.function`],settings:{foreground:t.foreground}},{name:`punctuation`,scope:[`punctuation`,`punctuation.terminator`,`punctuation.definition.tag`,`punctuation.separator`,`punctuation.definition.string`,`punctuation.section.block`],settings:{foreground:r(`punctuation`,t.comment)}},{name:`yellow`,scope:[`storage.type.numeric.go`,`storage.type.byte.go`,`storage.type.boolean.go`,`storage.type.string.go`,`storage.type.uintptr.go`,`storage.type.error.go`,`storage.type.rune.go`,`constant.language.go`,`support.class.dart`,`keyword.other.documentation`,`storage.modifier.import.java`,`punctuation.definition.list.begin.markdown`,`punctuation.definition.quote.begin.markdown`,`meta.separator.markdown`,`entity.name.section.markdown`],settings:{foreground:t.type}},{name:`green`,scope:[],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`cyan`,scope:[`markup.italic.markdown`,`support.type.python`,`variable.legacy.builtin.python`,`support.constant.property-value.css`,`storage.modifier.attribute.swift`],settings:{foreground:t.string}},{name:`blue`,scope:[],settings:{foreground:t.keyword}},{name:`purple`,scope:[`keyword.channel.go`,`keyword.other.platform.os.swift`],settings:{foreground:t.number}},{name:`magenta`,scope:[`punctuation.definition.heading.markdown`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`red`,scope:[],settings:{foreground:t.operator}},{name:`orange`,scope:[],settings:{foreground:t.function}}]},rt=e=>{let t=e.colors.surface,n=e.colors.interactive,r=e.colors.status,i=e.colors.syntax.base,a=e.colors.syntax.highlights??{},o=X(a.diffAddedBackground,r.successBackground),s=X(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":X(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":tt(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":X(n.active,n.borderHover),"notifications.background":t.elevated,"editorInlayHint.typeBackground":t.subtle,"editorInlayHint.typeForeground":t.foreground,"editorWhitespace.foreground":n.borderHover,"editorIndentGuide.background1":t.subtle,"editorHoverWidget.background":t.elevated,"editorLineNumber.activeForeground":X(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":X(a.lineNumber,t.mutedForeground),"editorGutter.background":t.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":t.elevated,"editorBracketMatch.border":t.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":o,"diffEditor.removedTextBackground":s,"editorGroupHeader.tabsBackground":t.background,"editorGroup.border":n.border,"tab.activeBackground":t.background,"tab.inactiveBackground":t.muted,"tab.inactiveForeground":t.mutedForeground,"tab.activeForeground":t.foreground,"tab.hoverBackground":t.subtle,"tab.unfocusedHoverBackground":t.subtle,"tab.border":n.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":t.muted,"editorWidget.border":n.border,"editorSuggestWidget.background":t.background,"editorSuggestWidget.border":n.border,"editorSuggestWidget.foreground":t.foreground,"editorSuggestWidget.highlightForeground":t.mutedForeground,"editorSuggestWidget.selectedBackground":t.subtle,"peekView.border":n.border,"peekViewEditor.background":t.background,"peekViewEditor.matchHighlightBackground":t.subtle,"peekViewResult.background":t.muted,"peekViewResult.fileForeground":t.foreground,"peekViewResult.lineForeground":t.mutedForeground,"peekViewResult.matchHighlightBackground":t.subtle,"peekViewResult.selectionBackground":t.elevated,"peekViewResult.selectionForeground":t.mutedForeground,"peekViewTitle.background":t.subtle,"peekViewTitleDescription.foreground":t.mutedForeground,"peekViewTitleLabel.foreground":t.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":X(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":X(a.diffModified,r.info),"merge.border":n.border,"merge.commonContentBackground":t.subtle,"merge.commonHeaderBackground":t.muted,"panel.background":t.background,"panel.border":n.border,"panelTitle.activeBorder":n.borderHover,"panelTitle.activeForeground":t.foreground,"panelTitle.inactiveForeground":t.mutedForeground,"statusBar.background":t.background,"statusBar.foreground":t.foreground,"statusBar.border":n.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":t.subtle,"statusBar.noFolderForeground":t.mutedForeground,"titleBar.activeBackground":t.background,"titleBar.activeForeground":t.foreground,"titleBar.inactiveBackground":t.muted,"titleBar.inactiveForeground":t.mutedForeground,"titleBar.border":n.border,"menu.foreground":t.foreground,"menu.background":t.background,"menu.selectionForeground":t.foreground,"menu.selectionBackground":t.subtle,"menu.border":n.border,"editorInlayHint.foreground":t.mutedForeground,"editorInlayHint.background":t.subtle,"terminal.foreground":t.foreground,"terminal.background":t.background,"terminalCursor.foreground":t.foreground,"terminalCursor.background":t.background,"terminal.ansiRed":X(a.diffRemoved,r.error),"terminal.ansiGreen":X(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":X(a.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":t.background,"activityBar.foreground":t.foreground,"activityBar.inactiveForeground":t.mutedForeground,"activityBar.activeBorder":t.foreground,"activityBar.border":n.border,"sideBar.background":t.background,"sideBar.foreground":t.foreground,"sideBar.border":n.border,"sideBarTitle.foreground":t.foreground,"sideBarSectionHeader.background":t.muted,"sideBarSectionHeader.foreground":t.foreground,"sideBarSectionHeader.border":n.border,"sideBar.activeBackground":t.subtle,"sideBar.activeForeground":t.foreground,"sideBar.hoverBackground":t.muted,"sideBar.hoverForeground":t.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":t.subtle,"list.activeSelectionBackground":t.elevated,"list.inactiveSelectionForeground":t.foreground,"list.activeSelectionForeground":t.foreground,"list.hoverForeground":t.foreground,"list.hoverBackground":t.muted,"input.background":t.muted,"input.foreground":t.foreground,"input.border":n.border,"input.placeholderForeground":t.mutedForeground,"inputOption.activeBorder":n.border,"inputOption.activeBackground":t.elevated,"inputOption.activeForeground":t.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":t.muted,"dropdown.foreground":t.foreground,"dropdown.border":n.border,"dropdown.listBackground":t.background,"badge.background":e.colors.primary.base,"activityBarBadge.background":e.colors.primary.base,"button.background":e.colors.primary.base,"button.foreground":X(e.colors.primary.foreground,t.background),"badge.foreground":X(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":X(e.colors.primary.foreground,t.background)}};function it(e){return{name:e.metadata.name,type:e.metadata.variant,colors:rt(e),tokenColors:nt(e)}}var at=e=>/^#[0-9a-fA-F]{8}$/.test(e),Z=e=>at(e)?e.slice(0,7):e;function ot(e,t){return Object.defineProperty(e,"toString",{value:()=>t,enumerable:!1,configurable:!0}),Object.defineProperty(e,Symbol.toPrimitive,{value:()=>t,enumerable:!1,configurable:!0}),e}var Q=new Map,$=new Set,st=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?Z(n):void 0,a=r?Z(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return ot({...e,name:t,fg:a,bg:i,settings:o},t)},ct=e=>it(e),lt=e=>{let t=Q.get(e.metadata.id);if(t)return t;let n=st(ct(e),e.metadata.id);return Q.set(e.metadata.id,n),n},ut=e=>{let t=e.metadata.id;if($.has(t))return;let n=lt(e);c(t,async()=>n),$.add(t)};export{te as A,Ae as C,Se as D,k as E,ee as M,v as N,E as O,pe as S,xe as T,j as _,Ue as a,me as b,fe as c,ge as d,Ee as f,Te as g,R as h,Le as i,y as j,Ce as k,de as l,T as m,lt as n,Fe as o,ce as p,W as r,z as s,ut as t,_e as u,he as v,je as w,le as x,A as y};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{ct as t}from"./persistence-DwRBC4zl.js";import{nt as n,rt as r,tt as i}from"./vendor-base-ui-CnHfUmDN.js";import{n as a}from"./vendor-react-DLPElpoQ.js";import{at as o}from"./useMobileNavigationStore-CNpuVBEn.js";import{t as s}from"./utils-2ZK8yboQ.js";import{r as c,t as l}from"./Icon-D1BcR8Tz.js";var u=32,d=(e,t)=>{let n=c[e];return typeof n!=`string`||n.length===0?null:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="${l}" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`},f=(e,t)=>{let n=d(e,t);return!n||typeof document>`u`?Promise.resolve(null):new Promise(e=>{let t=new Image;t.decoding=`async`,t.onload=()=>{try{let n=document.createElement(`canvas`);n.width=u,n.height=u;let r=n.getContext(`2d`);if(!r){e(null);return}r.clearRect(0,0,u,u),r.drawImage(t,0,0,u,u);let i=n.toDataURL(`image/png`),a=i.indexOf(`,`);e(a>=0?i.slice(a+1):null)}catch{e(null)}},t.onerror=()=>e(null),t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`})},p=(e,n)=>{if(!e.includes(`/`)||n.size===0)return[];let r=RegExp(`(^|\\s)/(${t})?([A-Za-z0-9][A-Za-z0-9_-]*)(?=$|\\s)`,`g`),i=[],a;for(;(a=r.exec(e))!==null;){let e=a[3]??``;if(!n.has(e.toLowerCase()))continue;let t=a[2]??``,r=a.index+(a[1]?.length??0);i.push({start:r,end:r+1+t.length+e.length,name:e,hasSlot:t.length>0})}return i},m=(e,n,r=e.length)=>{let i=p(e,n).filter(e=>!e.hasSlot);if(i.length===0)return null;let a=e,o=r;for(let e=i.length-1;e>=0;--e){let n=i[e].start+1;a=`${a.slice(0,n)}${t}${a.slice(n)}`,o>n&&(o+=t.length)}return a===e?null:{text:a,caret:o}},h=e=>e.startsWith(t)?e.slice(t.length):e,g=e=>{if(e.inputMode===`shell`)return null;let t=e.text,n=Math.max(0,Math.min(e.cursor,t.length));if(t.startsWith(`/`)){let e=t.indexOf(` `),r=t.indexOf(`
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{ct as t}from"./persistence-DwRBC4zl.js";import{nt as n,rt as r,tt as i}from"./vendor-base-ui-CnHfUmDN.js";import{n as a}from"./vendor-react-DLPElpoQ.js";import{at as o}from"./useMobileNavigationStore-DF9UNgl_.js";import{t as s}from"./utils-2ZK8yboQ.js";import{r as c,t as l}from"./Icon-D1BcR8Tz.js";var u=32,d=(e,t)=>{let n=c[e];return typeof n!=`string`||n.length===0?null:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="${l}" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`},f=(e,t)=>{let n=d(e,t);return!n||typeof document>`u`?Promise.resolve(null):new Promise(e=>{let t=new Image;t.decoding=`async`,t.onload=()=>{try{let n=document.createElement(`canvas`);n.width=u,n.height=u;let r=n.getContext(`2d`);if(!r){e(null);return}r.clearRect(0,0,u,u),r.drawImage(t,0,0,u,u);let i=n.toDataURL(`image/png`),a=i.indexOf(`,`);e(a>=0?i.slice(a+1):null)}catch{e(null)}},t.onerror=()=>e(null),t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`})},p=(e,n)=>{if(!e.includes(`/`)||n.size===0)return[];let r=RegExp(`(^|\\s)/(${t})?([A-Za-z0-9][A-Za-z0-9_-]*)(?=$|\\s)`,`g`),i=[],a;for(;(a=r.exec(e))!==null;){let e=a[3]??``;if(!n.has(e.toLowerCase()))continue;let t=a[2]??``,r=a.index+(a[1]?.length??0);i.push({start:r,end:r+1+t.length+e.length,name:e,hasSlot:t.length>0})}return i},m=(e,n,r=e.length)=>{let i=p(e,n).filter(e=>!e.hasSlot);if(i.length===0)return null;let a=e,o=r;for(let e=i.length-1;e>=0;--e){let n=i[e].start+1;a=`${a.slice(0,n)}${t}${a.slice(n)}`,o>n&&(o+=t.length)}return a===e?null:{text:a,caret:o}},h=e=>e.startsWith(t)?e.slice(t.length):e,g=e=>{if(e.inputMode===`shell`)return null;let t=e.text,n=Math.max(0,Math.min(e.cursor,t.length));if(t.startsWith(`/`)){let e=t.indexOf(` `),r=t.indexOf(`
2
2
  `),i=Math.min(e===-1?t.length:e,r===-1?t.length:r);if(n<=i&&e===-1)return{kind:`slash-command`,query:h(t.substring(1,i)),tokenStart:0,tokenEnd:i}}let r=t.substring(0,n),i=r.lastIndexOf(`/`);if(i!==-1){let e=i>0?r[i-1]:null,t=h(r.substring(i+1)),a=t.includes(` `)||t.includes(`
3
3
  `);if((!e||/\s/.test(e))&&!a)return{kind:`slash-skill`,query:t,tokenStart:i,tokenEnd:n}}let a=r.lastIndexOf(`#`);if(a!==-1){let e=a>0?r[a-1]:null,t=r.substring(a+1);if((!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
4
4
  `))return{kind:`snippet`,query:t,tokenStart:a,tokenEnd:n}}let s=o({value:t,cursorPosition:n,inputSource:e.mentionInputSource??`manual`,insertedText:e.insertedText});return s===null?null:{kind:`mention`,query:s,tokenStart:r.lastIndexOf(`@`),tokenEnd:n}},_=e=>e===`mention`?`@`:e===`snippet`?`#`:`/`,v=(e,t,n)=>{if(n&&n.tokenStart>=0&&n.tokenEnd>=n.tokenStart&&n.tokenEnd<=e.length&&e.startsWith(_(n.kind),n.tokenStart))return{start:n.tokenStart,end:n.tokenEnd};let r=g({text:e,cursor:t});return r?{start:r.tokenStart,end:r.tokenEnd}:null},y=e(r(),1),b=a(),x=e(i(),1),S=`absolute z-[100] min-w-0 w-full bottom-full mb-2 left-0 flex flex-col rounded-xl`,C=`pointer-events-auto absolute z-[100] min-w-0 flex flex-col rounded-xl`;function w(e,t){return s(e?C:S,e?`oc-mobile-overlay-surface oc-mobile-overlay-surface--translucent oc-composer-autocomplete-surface`:`bg-background border-2 border-border/60 shadow-none`,t)}function T(e,t){return e?`oc-composer-autocomplete-row`:t?`bg-interactive-selection`:void 0}var E=.4,D=e=>{let t=e.gap??8,n=Math.min(e.composerTop-t,e.visibleBottom-t);return{left:e.composerLeft,width:e.composerWidth,bottom:Math.max(0,e.fixedContainingBottom-n),maxHeight:O({popupBottom:n,boundaryTop:e.boundaryTop,viewportHeight:e.viewportHeight,gap:t})}},O=e=>{let t=e.gap??8,n=Math.max(0,e.popupBottom-e.boundaryTop-t),r=e.viewportHeight*E,i=Math.floor(Math.min(n,r));return n>=120?Math.min(n,Math.max(120,i)):i},k=(e,t=0)=>{let n=e.closest(`main`);if(!n)return null;let r=(e.closest(`.mobile-chat-screen__content`)?.parentElement??n.parentElement?.closest(`main`)??n).querySelector(`:scope > .oc-mobile-detail-navigation`)?.getBoundingClientRect().bottom,i=n.getBoundingClientRect().top;return Math.max(r===void 0?i:Math.max(r,i),t)},A=(e,t)=>{let n=(0,b.c)(5),[r,i]=y.useState(void 0),a;n[0]!==t||n[1]!==e?(a=()=>{if(!t){i(void 0);return}let n=0,r=0,a=()=>{let t=e.current?.parentElement;if(!t)return;let n=t.getBoundingClientRect(),r=window.visualViewport,a=r?.offsetTop??0,o=r?.height??window.innerHeight,s=window.innerHeight,c=a+o,l=k(t,a)??a,u=D({composerTop:n.top,composerLeft:n.left,composerWidth:n.width,fixedContainingBottom:s,visibleBottom:c,boundaryTop:l,viewportHeight:o});i(e=>e&&e.left===u.left&&e.width===u.width&&e.bottom===u.bottom&&e.maxHeight===u.maxHeight?e:u)},o=()=>{a(),n&&window.cancelAnimationFrame(n),r&&window.clearTimeout(r),n=window.requestAnimationFrame(()=>{a(),r=window.setTimeout(a,220)})};return a(),window.addEventListener(`resize`,a),window.addEventListener(`oc:keyboard-settled`,o),window.addEventListener(`oc:keyboard-anim`,o),window.visualViewport?.addEventListener(`resize`,a),window.visualViewport?.addEventListener(`scroll`,a),()=>{n&&window.cancelAnimationFrame(n),r&&window.clearTimeout(r),window.removeEventListener(`resize`,a),window.removeEventListener(`oc:keyboard-settled`,o),window.removeEventListener(`oc:keyboard-anim`,o),window.visualViewport?.removeEventListener(`resize`,a),window.visualViewport?.removeEventListener(`scroll`,a)}},n[0]=t,n[1]=e,n[2]=a):a=n[2];let o;return n[3]===t?o=n[4]:(o=[t],n[3]=t,n[4]=o),y.useLayoutEffect(a,o),t?r:void 0},j=n(),M=y.forwardRef((e,t)=>{let n=(0,b.c)(24),{isMobile:r,className:i,style:a,children:o}=e,s=y.useRef(null),c=A(s,r),l=typeof document<`u`?document.body:null;if(!r){let e;n[0]===i?e=n[1]:(e=w(!1,i),n[0]=i,n[1]=e);let r;return n[2]!==o||n[3]!==t||n[4]!==a||n[5]!==e?(r=(0,j.jsx)(`div`,{ref:t,className:e,style:a,children:o}),n[2]=o,n[3]=t,n[4]=a,n[5]=e,n[6]=r):r=n[6],r}let u;n[7]===i?u=n[8]:(u=w(!0,i),n[7]=i,n[8]=u);let d;n[9]===c?d=n[10]:(d=c?{left:c.left,width:c.width,bottom:c.bottom,maxHeight:c.maxHeight,overflow:`hidden`}:{visibility:`hidden`},n[9]=c,n[10]=d);let f;n[11]!==a||n[12]!==d?(f={...a,...d},n[11]=a,n[12]=d,n[13]=f):f=n[13];let p;n[14]!==o||n[15]!==t||n[16]!==u||n[17]!==f?(p=(0,j.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[100]`,children:(0,j.jsx)(`div`,{ref:t,className:u,style:f,children:o})}),n[14]=o,n[15]=t,n[16]=u,n[17]=f,n[18]=p):p=n[18];let m=p,h;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,j.jsx)(`span`,{ref:s,className:`hidden`,"aria-hidden":!0}),n[19]=h):h=n[19];let g;n[20]===m?g=n[21]:(g=l?(0,x.createPortal)(m,l):m,n[20]=m,n[21]=g);let _;return n[22]===g?_=n[23]:(_=(0,j.jsxs)(j.Fragment,{children:[h,g]}),n[22]=g,n[23]=_),_});M.displayName=`ComposerAutocompleteLayer`;var N=()=>{let e=null,t=!1,n=!1;return{pointerDown:(n,r)=>{e={x:n,y:r},t=!1},pointerMove:(n,r)=>{e&&Math.hypot(n-e.x,r-e.y)>6&&(t=!0)},pointerCancel:()=>{e=null,t=!1},pointerUp:r=>{if(!e)return!1;let i=!t;return e=null,t=!1,i?(n=!0,r(),!0):(n=!0,!1)},click:e=>n?(n=!1,!1):(e(),!0)}};export{g as a,f as c,v as i,M as n,m as o,T as r,h as s,N as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{Cn as n}from"./persistence-DwRBC4zl.js";import{$ as r,A as i,C as a,F as o,G as s,J as c,K as l,L as u,M as d,N as f,Nt as p,O as m,Q as h,R as ee,S as te,T as ne,X as re,Y as g,Z as ie,_ as ae,at as oe,b as se,c as ce,d as le,gt as ue,h as de,ht as fe,it as pe,lt as me,m as he,nt as ge,o as _e,pt as ve,rt as ye,u as be,ut as xe,v as Se,vt as Ce,w as we,x as Te,xt as Ee,yt as De,z as Oe}from"./platform-DQ5_LNKO.js";import{Ia as ke,Qi as _,Wi as v,c as y,o as Ae}from"./useMobileNavigationStore-CNpuVBEn.js";var je=e({applyGitStash:()=>G,checkIsGitRepository:()=>S,checkoutCommit:()=>Ke,cherryPick:()=>qe,countGitStashFiles:()=>U,createBranch:()=>J,createGitIdentity:()=>Z,createGitWorktree:()=>z,deleteGitIdentity:()=>$,deleteGitWorktree:()=>B,deleteRemoteBranch:()=>j,discoverGitCredentials:()=>He,discoverGitRepositories:()=>C,dropGitStash:()=>q,generateCommitMessage:()=>N,getCommitFileDiff:()=>Y,getConflictDetails:()=>Xe,getGitBranches:()=>A,getGitIdentities:()=>X,getGitStatus:()=>w,getGitWorktreeBootstrapStatus:()=>L,getGlobalGitIdentity:()=>Ue,git:()=>V,listGitStashes:()=>H,listGitWorktrees:()=>F,merge:()=>Ge,popGitStash:()=>K,previewGitWorktree:()=>R,rebase:()=>We,resetToCommit:()=>Ye,resolveGitPrimaryRoot:()=>T,resolveGitTopLevel:()=>E,revertCommit:()=>Je,stageGitFile:()=>D,stageGitFiles:()=>O,stashGitChanges:()=>W,unstageGitFile:()=>Pe,unstageGitFiles:()=>k,updateGitIdentity:()=>Q,validateGitWorktree:()=>I}),b=()=>n()?.git??null,Me=e=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`openchamber:chat-force-scroll-bottom`,{detail:{sessionId:e}}))},x=e=>{let t=e.trim(),n=(t.match(/```(?:json)?\s*([\s\S]*?)```/i)?.[1]??t).trim(),r=[n.indexOf(`{`)].filter(e=>e>=0);for(let e of r)for(let t=n.length;t>e;--t)if(n[t-1]===`}`)try{let r=JSON.parse(n.slice(e,t));if(r&&typeof r==`object`&&!Array.isArray(r))return r}catch{}return null},Ne=e=>{let t=e?.data;return(Array.isArray(t?.parts)?t.parts:[]).map(e=>{let t=e;return t.type===`text`?typeof t.text==`string`?t.text:typeof t.content==`string`?t.content:typeof t.value==`string`?t.value:``:``}).filter(e=>e.trim().length>0).join(`
1
+ import{r as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{Cn as n}from"./persistence-DwRBC4zl.js";import{$ as r,A as i,C as a,F as o,G as s,J as c,K as l,L as u,M as d,N as f,Nt as p,O as m,Q as h,R as ee,S as te,T as ne,X as re,Y as g,Z as ie,_ as ae,at as oe,b as se,c as ce,d as le,gt as ue,h as de,ht as fe,it as pe,lt as me,m as he,nt as ge,o as _e,pt as ve,rt as ye,u as be,ut as xe,v as Se,vt as Ce,w as we,x as Te,xt as Ee,yt as De,z as Oe}from"./platform-DQ5_LNKO.js";import{Ia as ke,Qi as _,Wi as v,c as y,o as Ae}from"./useMobileNavigationStore-DF9UNgl_.js";var je=e({applyGitStash:()=>G,checkIsGitRepository:()=>S,checkoutCommit:()=>Ke,cherryPick:()=>qe,countGitStashFiles:()=>U,createBranch:()=>J,createGitIdentity:()=>Z,createGitWorktree:()=>z,deleteGitIdentity:()=>$,deleteGitWorktree:()=>B,deleteRemoteBranch:()=>j,discoverGitCredentials:()=>He,discoverGitRepositories:()=>C,dropGitStash:()=>q,generateCommitMessage:()=>N,getCommitFileDiff:()=>Y,getConflictDetails:()=>Xe,getGitBranches:()=>A,getGitIdentities:()=>X,getGitStatus:()=>w,getGitWorktreeBootstrapStatus:()=>L,getGlobalGitIdentity:()=>Ue,git:()=>V,listGitStashes:()=>H,listGitWorktrees:()=>F,merge:()=>Ge,popGitStash:()=>K,previewGitWorktree:()=>R,rebase:()=>We,resetToCommit:()=>Ye,resolveGitPrimaryRoot:()=>T,resolveGitTopLevel:()=>E,revertCommit:()=>Je,stageGitFile:()=>D,stageGitFiles:()=>O,stashGitChanges:()=>W,unstageGitFile:()=>Pe,unstageGitFiles:()=>k,updateGitIdentity:()=>Q,validateGitWorktree:()=>I}),b=()=>n()?.git??null,Me=e=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`openchamber:chat-force-scroll-bottom`,{detail:{sessionId:e}}))},x=e=>{let t=e.trim(),n=(t.match(/```(?:json)?\s*([\s\S]*?)```/i)?.[1]??t).trim(),r=[n.indexOf(`{`)].filter(e=>e>=0);for(let e of r)for(let t=n.length;t>e;--t)if(n[t-1]===`}`)try{let r=JSON.parse(n.slice(e,t));if(r&&typeof r==`object`&&!Array.isArray(r))return r}catch{}return null},Ne=e=>{let t=e?.data;return(Array.isArray(t?.parts)?t.parts:[]).map(e=>{let t=e;return t.type===`text`?typeof t.text==`string`?t.text:typeof t.content==`string`?t.content:typeof t.value==`string`?t.value:``:``}).filter(e=>e.trim().length>0).join(`
2
2
  `).trim()};async function S(e){let t=b();return t?t.checkIsGitRepository(e):ce(e)}async function C(e){return we(e)}async function w(e,t){let n=b();return n?n.getGitStatus(e,t):u(e,t)}async function T(e){return(await ye(e)).root}async function E(e){return(await pe(e)).root}async function D(e,t){let n=b();return n?.stageGitFile?n.stageGitFile(e,t):me(e,t)}async function O(e,t){let n=b();return n?.stageGitFiles?n.stageGitFiles(e,t):xe(e,t)}async function Pe(e,t){let n=b();return n?.unstageGitFile?n.unstageGitFile(e,t):fe(e,t)}async function k(e,t){let n=b();return n?.unstageGitFiles?n.unstageGitFiles(e,t):ue(e,t)}async function A(e,t){let n=b();if(t?.signal?.throwIfAborted(),n){let r=await n.getGitBranches(e,t);return t?.signal?.throwIfAborted(),r}return d(e,t)}async function j(e,t){let n=b();return n?n.deleteRemoteBranch(e,t):te(e,t)}var Fe=30,Ie=12e4,Le=async(e,t)=>{let n=t.slice(0,Fe),r=await Promise.all(n.map(async t=>{try{let[n,r]=await Promise.all([f(e,{path:t,staged:!0}).catch(()=>null),f(e,{path:t,staged:!1}).catch(()=>null)]);return[n?.diff,r?.diff].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
3
3
  `)||`--- ${t} (no textual diff available)`}catch{return`--- ${t} (diff unavailable)`}})),i=``;for(let e of r){if(i.length+e.length>Ie){i+=`
4
4
  [remaining diffs truncated]`;break}i+=(i?`