@yuriai/web 0.1.5 → 0.1.7

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 (93) hide show
  1. package/README.md +3 -1
  2. package/dist/assets/{AgentAvatar-D6H7fWWf.js → AgentAvatar-BVnp9gE9.js} +1 -1
  3. package/dist/assets/AssistantView-BkMKCN9c.js +3 -0
  4. package/dist/assets/{DiagramView-TX1QZ1-S.js → DiagramView-B7_hOmVC.js} +1 -1
  5. package/dist/assets/{FadeInOnReveal-eVZbrwte.js → FadeInOnReveal-CzC5UKnq.js} +1 -1
  6. package/dist/assets/{Icon-2cKLcXGe.js → Icon-BXTZRnIO.js} +1 -1
  7. package/dist/assets/{ImageLoadingPlaceholder-DmCEIw55.js → ImageLoadingPlaceholder-Cv6IaJar.js} +1 -1
  8. package/dist/assets/{LoadingImage-B-cD_lfU.js → LoadingImage-NxtWlewi.js} +1 -1
  9. package/dist/assets/{MarkdownRenderer-DGUI8EIG.js → MarkdownRenderer-Va7Wdk98.js} +2 -2
  10. package/dist/assets/{MarkdownRendererImpl-DndseLUT.js → MarkdownRendererImpl-CsjvA5I5.js} +1 -1
  11. package/dist/assets/{MarkstreamRendererImpl-Ehxwt6MS.js → MarkstreamRendererImpl-Du38HKce.js} +1 -1
  12. package/dist/assets/{MobileDetailNavigation-D7uM40jU.js → MobileDetailNavigation-B_PYZ9xi.js} +1 -1
  13. package/dist/assets/MobileShareBridge-BbbQ15B3.js +4 -0
  14. package/dist/assets/MobileTabPageHeader-tiWNRKWN.js +2 -0
  15. package/dist/assets/{MultiRunWindow-CVI6D2LM.js → MultiRunWindow-CFFrKEHW.js} +1 -1
  16. package/dist/assets/{OnboardingScreen-CG2xI_UT.js → OnboardingScreen-BxS5LEOm.js} +1 -1
  17. package/dist/assets/{OverlayScrollbar-piA-chKb.js → OverlayScrollbar-CbWvRXm6.js} +1 -1
  18. package/dist/assets/SettingsView-CKn54R1o.js +26 -0
  19. package/dist/assets/{SettingsWindow-Cj6sYyvK.js → SettingsWindow-BKatx9Q_.js} +1 -1
  20. package/dist/assets/{TerminalView-DW4OxMaM.js → TerminalView-h15pBKLx.js} +2 -2
  21. package/dist/assets/{ToolOutputDialog-DxKGYhQ6.js → ToolOutputDialog-Bj-TWElC.js} +1 -1
  22. package/dist/assets/{appThemeRegistry-DlEr4DLc.js → appThemeRegistry-nntgbF9E.js} +1 -1
  23. package/dist/assets/button-D_HdP1Oy.js +1 -0
  24. package/dist/assets/{capgoAdapter-Onw1miMh.js → capgoAdapter-BV5kJq2r.js} +1 -1
  25. package/dist/assets/{collapsible-BRKOX_ML.js → collapsible-sUU_ORMe.js} +1 -1
  26. package/dist/assets/{diagram-C9F3kAJt.js → diagram-BE50CEiR.js} +1 -1
  27. package/dist/assets/{dialog-NsOVcGdh.js → dialog-B_87Teec.js} +1 -1
  28. package/dist/assets/{dropdown-menu.styles-CjPDePJF.js → dropdown-menu.styles-C_b80jxk.js} +1 -1
  29. package/dist/assets/{fileMentionTouchSelection-B26MejYr.js → fileMentionTouchSelection-Bx6vWiqF.js} +1 -1
  30. package/dist/assets/{gitApi-BXhXdWkh.js → gitApi-B1arMnHR.js} +1 -1
  31. package/dist/assets/{input-BI3Ya8O_.js → input-DDfJnn8e.js} +1 -1
  32. package/dist/assets/{insertionBoundaries-BxSGE3B7.js → insertionBoundaries-B8UdVMC9.js} +1 -1
  33. package/dist/assets/{main-BdV8Awp-.js → main-BLSF9qdf.js} +2 -2
  34. package/dist/assets/{main-CGpFMQTy.js → main-DJwLyPc3.js} +12 -12
  35. package/dist/assets/{markdownHeightCache-CHFSvA8u.js → markdownHeightCache-Cbd62oWw.js} +1 -1
  36. package/dist/assets/{mcpQueries-uZJFBhGj.js → mcpQueries-BxbbmYAd.js} +1 -1
  37. package/dist/assets/{miniChat-B1aBBLiq.js → miniChat-D_cBND3Z.js} +2 -2
  38. package/dist/assets/{mobile-B8U8FARq.js → mobile-CZNFYieO.js} +2 -2
  39. package/dist/assets/{mobileBackNavigation-D2yUxPpG.js → mobileBackNavigation-f8AMDP0N.js} +1 -1
  40. package/dist/assets/{multirun-DKsVtdZX.js → multirun-Cvl4FMPo.js} +1 -1
  41. package/dist/assets/{native-config-Bpk4DOW1.js → native-config-DLJCZcXh.js} +1 -1
  42. package/dist/assets/{projectMeta-yox5XHhN.js → projectMeta-D3cfkJyk.js} +1 -1
  43. package/dist/assets/{renderElectronMiniChatApp-CdEZXhzq.js → renderElectronMiniChatApp-_n69Pa_v.js} +2 -2
  44. package/dist/assets/renderMobileApp-DUiUPyd7.js +28 -0
  45. package/dist/assets/{runtimeConfig-B8s9sTX_.js → runtimeConfig-DwFJL5bm.js} +1 -1
  46. package/dist/assets/runtimeEndpointReset-C_1daihM.js +149 -0
  47. package/dist/assets/{scheduledTaskNavigation-DUskP6qh.js → scheduledTaskNavigation-DvSpMLdG.js} +1 -1
  48. package/dist/assets/sessionChangeSummary-evl_LmRN.js +1 -0
  49. package/dist/assets/sessionLookup-CJ8mXxHt.js +1 -0
  50. package/dist/assets/{sortable-tabs-strip-Benojjgi.js → sortable-tabs-strip-CrjW2aQk.js} +1 -1
  51. package/dist/assets/{speechSettingsQueries-CjTT-adl.js → speechSettingsQueries-xWFTnUfF.js} +1 -1
  52. package/dist/assets/src-omVWmz3o.css +2 -0
  53. package/dist/assets/{textarea-C5vjnZcE.js → textarea-BkOdxUN0.js} +1 -1
  54. package/dist/assets/{tooltip-C73L9gDf.js → tooltip-BQQoK7L_.js} +1 -1
  55. package/dist/assets/{types-Bu1xM0fS.js → types-BzF7Dhzq.js} +1 -1
  56. package/dist/assets/{useAppFontEffects-D6yauGdg.js → useAppFontEffects-lmtncXsi.js} +7 -7
  57. package/dist/assets/{useDesktopWindowControlsLayout-SKHaFoVu.js → useDesktopWindowControlsLayout-BY0_whx0.js} +1 -1
  58. package/dist/assets/{useEffectiveDirectory-D6GwXhDS.js → useEffectiveDirectory-CqkTJqRg.js} +1 -1
  59. package/dist/assets/{useMobileNavigationStore-ByrZJd5L.js → useMobileNavigationStore-BURkCJuM.js} +4 -4
  60. package/dist/assets/{useWorkerHighlightedLines-CwC34Jql.js → useWorkerHighlightedLines-Bla356tF.js} +1 -1
  61. package/dist/index.html +6 -6
  62. package/dist/mini-chat.html +6 -6
  63. package/dist/mobile.html +6 -6
  64. package/package.json +1 -1
  65. package/server/lib/assistants/DOCUMENTATION.md +13 -2
  66. package/server/lib/assistants/contact-store.js +2 -1
  67. package/server/lib/assistants/contact-store.test.js +13 -3
  68. package/server/lib/assistants/routes.js +2 -1
  69. package/server/lib/assistants/service.js +54 -7
  70. package/server/lib/assistants/service.test.js +59 -10
  71. package/server/lib/content-search/DOCUMENTATION.md +5 -1
  72. package/server/lib/opencode/DOCUMENTATION.md +8 -7
  73. package/server/lib/opencode/config-entity-routes.js +5 -1
  74. package/server/lib/opencode/config-entity-routes.test.js +23 -0
  75. package/server/lib/opencode/ensure-cli.js +48 -11
  76. package/server/lib/opencode/ensure-cli.test.js +53 -1
  77. package/server/lib/opencode/env-runtime.js +5 -5
  78. package/server/lib/opencode/feature-routes-runtime.js +1 -1
  79. package/server/lib/opencode/terminal-path.js +67 -0
  80. package/server/lib/opencode/terminal-path.test.js +68 -0
  81. package/server/lib/relay/DOCUMENTATION.md +2 -0
  82. package/server/lib/relay/service.js +1 -1
  83. package/server/lib/relay/service.test.js +3 -3
  84. package/dist/assets/AssistantView-D3j8FlaF.js +0 -3
  85. package/dist/assets/MobileShareBridge-BMQKnoEb.js +0 -4
  86. package/dist/assets/MobileTabPageHeader-Cco8ToA6.js +0 -2
  87. package/dist/assets/SettingsView-Bx-5WRtO.js +0 -26
  88. package/dist/assets/button-_ReBqWzC.js +0 -1
  89. package/dist/assets/renderMobileApp-BoV5wjPF.js +0 -28
  90. package/dist/assets/runtimeEndpointReset-BswmG9Bb.js +0 -149
  91. package/dist/assets/sessionChangeSummary-BGbmGpQw.js +0 -1
  92. package/dist/assets/sessionLookup-CGJA6W7O.js +0 -1
  93. package/dist/assets/src-CmermOKP.css +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Q as t,X as n,Y as r,Z as i,et as a,it as o,rt as s}from"./vendor-base-ui-CdzJ6My_.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{f as l,r as u}from"./button-_ReBqWzC.js";import{t as d}from"./SettingsView-Bx-5WRtO.js";var f=c(),p=e(o(),1),m=s(),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)(a,{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)(t,{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)(n,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(i,{"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)(r,{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{r as e}from"./rolldown-runtime-hePW80VL.js";import{Q as t,X as n,Y as r,Z as i,et as a,it as o,rt as s}from"./vendor-base-ui-CdzJ6My_.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{f as l,r as u}from"./button-D_HdP1Oy.js";import{t as d}from"./SettingsView-CKn54R1o.js";var f=c(),p=e(o(),1),m=s(),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)(a,{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)(t,{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)(n,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(i,{"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)(r,{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,8 +1,8 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./queryRuntime-DKGLQtb9.js";import{en as n}from"./persistence-Dzooc9Xg.js";import{it as r,nt as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{c as o,l as s,n as c}from"./useUIStore-NMQx_cnG.js";import{A as l}from"./runtime-file-resource-C1k5nbWb.js";import{o as u}from"./terminalApi-BHXvha-U.js";import{n as d,r as f,t as p}from"./vendor-ghostty-web-DbBrwBII.js";import{d as m,f as h,r as g,t as _}from"./button-_ReBqWzC.js";import{d as v}from"./useMobileNavigationStore-ByrZJd5L.js";import{n as y}from"./useThemeSystem-8jhE4Zyk.js";import{n as b}from"./Icon-2cKLcXGe.js";import{i as ee,t as x}from"./OverlayScrollbar-piA-chKb.js";import{n as S}from"./useEffectiveDirectory-D6GwXhDS.js";import{t as C}from"./sortable-tabs-strip-Benojjgi.js";import{n as w,t as T}from"./useFontPreferences-D9PX5t6Y.js";import{r as E}from"./projectActions-BX0cjZoq.js";var D=e(r(),1);function te(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 ne(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 re=e(i(),1),O=a(),k=null;function A(){return k||=f.load(),k}function ie(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 ae=D.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0},f)=>{let{t:_}=h(),v=D.useRef(null),y=D.useRef(null),b=D.useRef(null),ee=D.useRef(null),S=D.useRef(n),C=D.useRef(r),w=D.useRef(null),T=D.useRef(``),E=D.useRef(null),te=D.useRef(!1),k=D.useRef(null),ae=D.useRef(!0),j=D.useRef(null),M=D.useRef(null),oe=D.useRef(0),se=D.useRef(null),N=D.useRef(null),P=D.useRef(!1),F=D.useRef(!1),ce=D.useRef(null),le=D.useRef(null),ue=D.useRef(null),I=D.useRef(``),de=D.useRef(null),fe=D.useRef(!c),pe=D.useRef(u),[,me]=D.useReducer(e=>e+1,0),[he,ge]=D.useReducer(e=>e+1,0);S.current=n,C.current=r;let _e=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),L=!!c;D.useEffect(()=>{if(!c){fe.current=!0,pe.current=u;return}!pe.current&&u&&(fe.current=!1),pe.current=u},[c,u]);let ve=D.useCallback(()=>{if(!L)return;let e=v.current,t=se.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`)})},[L]),R=D.useCallback(e=>{if(de.current===e)return;let t=b.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),de.current=e;return}t.options&&(t.options.cursorBlink=e,de.current=e)}catch{}},[]),z=L&&_e,B=D.useCallback((e,t)=>{let n=z?N.current:se.current,r=v.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{}}},[z]),V=D.useCallback(()=>{if(L){B(),R(!0);return}b.current?.focus(),R(!0)},[B,R,L]),H=D.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),U=D.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),ye=D.useCallback(e=>{if(typeof window>`u`||z)return;ue.current!==null&&(window.clearTimeout(ue.current),ue.current=null);let t=0,n=()=>{ue.current=window.setTimeout(()=>{ue.current=null;let r=H(e);if(!r){if(t+=1,t<3){n();return}return}let i=I.current;I.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&S.current(a.replace(/\r\n|\r|\n/g,`\r`)),U(e),I.current=``},t===0?0:24)};n()},[U,H,z]);D.useEffect(()=>{let e=v.current;if(!L||!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{}B()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,L,B]);let W=D.useCallback(()=>{let e=b.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),be=D.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=v.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),xe=D.useCallback(async()=>{if(typeof document>`u`)return;let e=W()||be();e.trim()&&await m(e)},[be,W]),Se=D.useCallback(()=>W().trim()?!0:!!be().trim(),[be,W]);D.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Se()&&(e.preventDefault(),xe())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[xe,Se]);let G=D.useCallback(()=>{T.current=``,E.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(E.current),E.current=null,te.current=!1,k.current=null},[]),K=D.useCallback(()=>{let e=ee.current,t=b.current,n=v.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=w.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(w.current=n,C.current(n.cols,n.rows))}catch{}},[]),q=D.useCallback(()=>{if(te.current)return;let e=b.current;if(!e){G();return}if(!T.current)return;let t=T.current;T.current=``,te.current=!0,e.write(t,()=>{te.current=!1,T.current&&(typeof window<`u`?E.current=window.requestAnimationFrame(()=>{E.current=null,q()}):q())})},[G]),Ce=D.useCallback(()=>{E.current===null&&(typeof window<`u`?E.current=window.requestAnimationFrame(()=>{E.current=null,q()}):q())},[q]),J=D.useCallback(e=>{e&&(T.current+=e,Ce())},[Ce]),we=D.useCallback(()=>{if(j.current?.(),j.current=null,M.current!==null&&typeof window<`u`&&(window.clearTimeout(M.current),M.current=null),!c){oe.current=0;return}let e=v.current;if(!e)return;let t=b.current;if(!t)return;oe.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,p=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},m=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},h={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`){m(),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()),p(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){L?B(n.clientX,n.clientY):c&&!fe.current&&(fe.current=!0,b.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=p(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){m(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,h),e.addEventListener(`pointermove`,d,h),e.addEventListener(`pointerup`,f,h),e.addEventListener(`pointercancel`,f,h);let g=e.style.touchAction,_=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,j.current=()=>{m(),M.current!==null&&typeof window<`u`&&(window.clearTimeout(M.current),M.current=null),oe.current=0,e.removeEventListener(`pointerdown`,o,h),e.removeEventListener(`pointermove`,d,h),e.removeEventListener(`pointerup`,f,h),e.removeEventListener(`pointercancel`,f,h),e.style.touchAction=g,e.style.overscrollBehaviorY=_};return}let g=e=>{e.touches.length===1&&(m(),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)},_=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,m();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),h=d*(n+Math.min(r,Math.abs(d)/25)),g=h/f;l.velocity=l.velocity*.75+g*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),p(h)},y=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];L?B(t?.clientX,t?.clientY):c&&!fe.current&&(fe.current=!0,b.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=p(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){m(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,g,h),e.addEventListener(`touchmove`,_,h),e.addEventListener(`touchend`,y,h),e.addEventListener(`touchcancel`,y,h);let ee=e.style.touchAction,x=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,j.current=()=>{m(),M.current!==null&&typeof window<`u`&&(window.clearTimeout(M.current),M.current=null),oe.current=0,e.removeEventListener(`touchstart`,g,h),e.removeEventListener(`touchmove`,_,h),e.removeEventListener(`touchend`,y,h),e.removeEventListener(`touchcancel`,y,h),e.style.touchAction=ee,e.style.overscrollBehaviorY=x}},[c,L,B,o]);D.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,u=null,f=null,m=v.current;if(!m)return;if(m.tabIndex=L?-1:0,L){let e=m.focus.bind(m),t=m;t.focus=((...e)=>{B()}),f=()=>{t.focus=e}}let h=()=>{R(!0)},g=()=>{R(!1)},_=e=>{let t=e.target;if(t&&m.contains(t)){if(L&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),B()},0),R(!1);return}if(c&&!fe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),R(!1);return}R(!0);return}R(!1)},x=()=>{R(!1)},C=null;return(async()=>{try{let f=await A();if(e)return;let _=ne(a,o,i,f,!1),v=new d(_);ae.current=!0,L&&(v.focus=()=>{});let x=v;if(typeof x.scrollToBottom==`function`){let e=x.scrollToBottom.bind(x);x.scrollToBottom=()=>{ae.current&&e()},l=()=>{x.scrollToBottom=e}}let w=new p;if(t=v,b.current=v,ee.current=w,v.loadAddon(w),v.open(m),c){let e=v.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},u=()=>{e.renderScrollbar=t}}}ge(),de.current=!1,C=v.textarea??m.querySelector(`textarea`),C&&(C.addEventListener(`focus`,h),C.addEventListener(`blur`,g)),ve(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ve()}),r.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let T=ie(m);T?(T.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),y.current=T,me()):y.current=null,K();let E=w;typeof E.observeResize==`function`&&E.observeResize(),we(),s=[v.onData(e=>{S.current(e)}),v.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof v.hasSelection==`function`&&v.hasSelection();ae.current=!t&&e<=.5}}),v.onSelectionChange(()=>{if(typeof v.hasSelection==`function`&&v.hasSelection()){ae.current=!1;return}let e=typeof v.getViewportY==`function`?v.getViewportY():0;ae.current=e<=.5})],n=new ResizeObserver(()=>{K()}),n.observe(m),typeof window<`u`&&window.setTimeout(()=>{K()},0)}catch{}})(),document.addEventListener(`focusin`,_,!0),window.addEventListener(`blur`,x),()=>{e=!0,j.current?.(),j.current=null,document.removeEventListener(`focusin`,_,!0),window.removeEventListener(`blur`,x),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,C&&(C.removeEventListener(`focus`,h),C.removeEventListener(`blur`,g)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),b.current=null,ee.current=null,y.current=null,w.current=null,de.current=null,G()}},[ve,c,K,B,a,o,we,i,G,R,L]),D.useEffect(()=>{let e=b.current;e&&(e.reset(),G(),w.current=null,K())},[e,he,K,G]),D.useEffect(()=>{l&&b.current&&V()},[l,V,e,he]),D.useEffect(()=>(we(),()=>{j.current?.(),j.current=null}),[we,e]),D.useEffect(()=>{let e=b.current;if(!e)return;if(t.length===0){k.current!==null&&(e.reset(),G(),K());return}let n=k.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&&J(r.map(e=>e.data).join(``)),k.current=t[t.length-1].id},[t,he,J,K,G]),D.useImperativeHandle(f,()=>({focus:()=>{V()},clear:()=>{let e=b.current;e&&(e.reset(),G(),K())},fit:()=>{K()}}),[V,K,G]);let Y=D.useCallback(e=>{if(!L)return;let t=v.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[L]),X=D.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(le.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){P.current=!0;return}if(!n&&r){if(P.current)return;e.preventDefault(),S.current(r),ce.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0;return}if(n===`insertText`&&r){if(P.current)return;e.preventDefault(),S.current(r),ce.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0;return}if(n===`insertLineBreak`){if(P.current)return;e.preventDefault(),S.current(`\r`),ce.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0;return}if(n===`deleteContentBackward`){if(P.current)return;e.preventDefault(),S.current(``),ce.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0}},[]),Z=D.useCallback(e=>{let t=e.currentTarget;if(le.current=typeof performance<`u`?performance.now():Date.now(),P.current)return;if(F.current){let e=ce.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){F.current=!1,U(t);return}F.current=!1}let n=H(t);if(!n)return;I.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);S.current(r),U(t),I.current=``},[U,H]),Te=D.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)&&Se()){e.preventDefault(),xe();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(),S.current(String.fromCharCode(t.charCodeAt(0)-64)),U(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),S.current(`\x1B`+e.key),U(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(),S.current(i),U(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=ce.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(),S.current(`\r`),U(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;H(a)||S.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=le.current;t&&s-t<50||(e.preventDefault(),S.current(e.key),F.current=!0,ce.current={type:`keydown-text`,at:s})}ye(a)},[U,xe,Se,H,ye]),Ee=D.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||ye(t)},[ye]),De=D.useCallback(e=>{let t=e.currentTarget;P.current=!1;let n=e.data||H(t);if(le.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);S.current(r),U(t),ce.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0},[U,H]),Oe=D.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=b.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;S.current(n)},[]),ke={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,O.jsxs)(`div`,{ref:v,className:g(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":L?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!L||c)&&!Se()){let t=e.touches?.[0];B(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(L){if(Se())return;B(e.clientX,e.clientY)}else b.current?.focus()},onMouseUp:()=>{!c&&Se()&&xe()},onTouchEnd:()=>{!c&&Se()&&xe()},children:[L&&typeof document<`u`?(0,re.createPortal)((0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`input`,{ref:N,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...ke,display:z?`block`:`none`},onBlur:Y,onBeforeInput:X,onCompositionStart:()=>{P.current=!0},onInput:Z,onKeyDown:Te,onKeyUp:Ee,onCompositionEnd:De,onPaste:Oe}),(0,O.jsx)(`textarea`,{ref:se,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...ke,display:z?`none`:`block`},onBlur:Y,onBeforeInput:X,onCompositionStart:()=>{P.current=!0},onInput:Z,onKeyDown:Te,onKeyUp:Ee,onCompositionEnd:De,onPaste:Oe})]}),document.body):null,y.current&&!c?(0,O.jsx)(x,{containerRef:y,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});ae.displayName=`TerminalViewport`;var j=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),M=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,oe=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,se=/Serving HTTP on .*? port (\d{2,5})/i,N=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),P=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(N.has(e)){t=t.slice(0,-1);continue}break}return t},F=e=>{let t=P(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},ce=e=>{if(!e)return null;let t=e.replace(j,``),n=t.match(se);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{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./queryRuntime-DKGLQtb9.js";import{en as n}from"./persistence-Dzooc9Xg.js";import{it as r,nt as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{c as o,l as s,n as c}from"./useUIStore-NMQx_cnG.js";import{A as l}from"./runtime-file-resource-C1k5nbWb.js";import{o as u}from"./terminalApi-BHXvha-U.js";import{n as d,r as f,t as p}from"./vendor-ghostty-web-DbBrwBII.js";import{d as m,f as h,r as g,t as _}from"./button-D_HdP1Oy.js";import{d as v}from"./useMobileNavigationStore-BURkCJuM.js";import{n as y}from"./useThemeSystem-8jhE4Zyk.js";import{n as b}from"./Icon-BXTZRnIO.js";import{i as ee,t as x}from"./OverlayScrollbar-CbWvRXm6.js";import{n as S}from"./useEffectiveDirectory-CqkTJqRg.js";import{t as C}from"./sortable-tabs-strip-CrjW2aQk.js";import{n as w,t as T}from"./useFontPreferences-D9PX5t6Y.js";import{r as E}from"./projectActions-BX0cjZoq.js";var D=e(r(),1);function te(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 ne(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 re=e(i(),1),O=a(),k=null;function A(){return k||=f.load(),k}function ie(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 ae=D.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0},f)=>{let{t:_}=h(),v=D.useRef(null),y=D.useRef(null),b=D.useRef(null),ee=D.useRef(null),S=D.useRef(n),C=D.useRef(r),w=D.useRef(null),T=D.useRef(``),E=D.useRef(null),te=D.useRef(!1),k=D.useRef(null),ae=D.useRef(!0),j=D.useRef(null),M=D.useRef(null),oe=D.useRef(0),se=D.useRef(null),N=D.useRef(null),P=D.useRef(!1),F=D.useRef(!1),ce=D.useRef(null),le=D.useRef(null),ue=D.useRef(null),I=D.useRef(``),de=D.useRef(null),fe=D.useRef(!c),pe=D.useRef(u),[,me]=D.useReducer(e=>e+1,0),[he,ge]=D.useReducer(e=>e+1,0);S.current=n,C.current=r;let _e=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),L=!!c;D.useEffect(()=>{if(!c){fe.current=!0,pe.current=u;return}!pe.current&&u&&(fe.current=!1),pe.current=u},[c,u]);let ve=D.useCallback(()=>{if(!L)return;let e=v.current,t=se.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`)})},[L]),R=D.useCallback(e=>{if(de.current===e)return;let t=b.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),de.current=e;return}t.options&&(t.options.cursorBlink=e,de.current=e)}catch{}},[]),z=L&&_e,B=D.useCallback((e,t)=>{let n=z?N.current:se.current,r=v.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{}}},[z]),V=D.useCallback(()=>{if(L){B(),R(!0);return}b.current?.focus(),R(!0)},[B,R,L]),H=D.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),U=D.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),ye=D.useCallback(e=>{if(typeof window>`u`||z)return;ue.current!==null&&(window.clearTimeout(ue.current),ue.current=null);let t=0,n=()=>{ue.current=window.setTimeout(()=>{ue.current=null;let r=H(e);if(!r){if(t+=1,t<3){n();return}return}let i=I.current;I.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&S.current(a.replace(/\r\n|\r|\n/g,`\r`)),U(e),I.current=``},t===0?0:24)};n()},[U,H,z]);D.useEffect(()=>{let e=v.current;if(!L||!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{}B()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,L,B]);let W=D.useCallback(()=>{let e=b.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),be=D.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=v.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),xe=D.useCallback(async()=>{if(typeof document>`u`)return;let e=W()||be();e.trim()&&await m(e)},[be,W]),Se=D.useCallback(()=>W().trim()?!0:!!be().trim(),[be,W]);D.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Se()&&(e.preventDefault(),xe())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[xe,Se]);let G=D.useCallback(()=>{T.current=``,E.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(E.current),E.current=null,te.current=!1,k.current=null},[]),K=D.useCallback(()=>{let e=ee.current,t=b.current,n=v.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=w.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(w.current=n,C.current(n.cols,n.rows))}catch{}},[]),q=D.useCallback(()=>{if(te.current)return;let e=b.current;if(!e){G();return}if(!T.current)return;let t=T.current;T.current=``,te.current=!0,e.write(t,()=>{te.current=!1,T.current&&(typeof window<`u`?E.current=window.requestAnimationFrame(()=>{E.current=null,q()}):q())})},[G]),Ce=D.useCallback(()=>{E.current===null&&(typeof window<`u`?E.current=window.requestAnimationFrame(()=>{E.current=null,q()}):q())},[q]),J=D.useCallback(e=>{e&&(T.current+=e,Ce())},[Ce]),we=D.useCallback(()=>{if(j.current?.(),j.current=null,M.current!==null&&typeof window<`u`&&(window.clearTimeout(M.current),M.current=null),!c){oe.current=0;return}let e=v.current;if(!e)return;let t=b.current;if(!t)return;oe.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,p=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},m=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},h={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`){m(),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()),p(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){L?B(n.clientX,n.clientY):c&&!fe.current&&(fe.current=!0,b.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=p(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){m(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,h),e.addEventListener(`pointermove`,d,h),e.addEventListener(`pointerup`,f,h),e.addEventListener(`pointercancel`,f,h);let g=e.style.touchAction,_=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,j.current=()=>{m(),M.current!==null&&typeof window<`u`&&(window.clearTimeout(M.current),M.current=null),oe.current=0,e.removeEventListener(`pointerdown`,o,h),e.removeEventListener(`pointermove`,d,h),e.removeEventListener(`pointerup`,f,h),e.removeEventListener(`pointercancel`,f,h),e.style.touchAction=g,e.style.overscrollBehaviorY=_};return}let g=e=>{e.touches.length===1&&(m(),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)},_=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,m();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),h=d*(n+Math.min(r,Math.abs(d)/25)),g=h/f;l.velocity=l.velocity*.75+g*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),p(h)},y=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];L?B(t?.clientX,t?.clientY):c&&!fe.current&&(fe.current=!0,b.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=p(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){m(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,g,h),e.addEventListener(`touchmove`,_,h),e.addEventListener(`touchend`,y,h),e.addEventListener(`touchcancel`,y,h);let ee=e.style.touchAction,x=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,j.current=()=>{m(),M.current!==null&&typeof window<`u`&&(window.clearTimeout(M.current),M.current=null),oe.current=0,e.removeEventListener(`touchstart`,g,h),e.removeEventListener(`touchmove`,_,h),e.removeEventListener(`touchend`,y,h),e.removeEventListener(`touchcancel`,y,h),e.style.touchAction=ee,e.style.overscrollBehaviorY=x}},[c,L,B,o]);D.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,u=null,f=null,m=v.current;if(!m)return;if(m.tabIndex=L?-1:0,L){let e=m.focus.bind(m),t=m;t.focus=((...e)=>{B()}),f=()=>{t.focus=e}}let h=()=>{R(!0)},g=()=>{R(!1)},_=e=>{let t=e.target;if(t&&m.contains(t)){if(L&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),B()},0),R(!1);return}if(c&&!fe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),R(!1);return}R(!0);return}R(!1)},x=()=>{R(!1)},C=null;return(async()=>{try{let f=await A();if(e)return;let _=ne(a,o,i,f,!1),v=new d(_);ae.current=!0,L&&(v.focus=()=>{});let x=v;if(typeof x.scrollToBottom==`function`){let e=x.scrollToBottom.bind(x);x.scrollToBottom=()=>{ae.current&&e()},l=()=>{x.scrollToBottom=e}}let w=new p;if(t=v,b.current=v,ee.current=w,v.loadAddon(w),v.open(m),c){let e=v.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},u=()=>{e.renderScrollbar=t}}}ge(),de.current=!1,C=v.textarea??m.querySelector(`textarea`),C&&(C.addEventListener(`focus`,h),C.addEventListener(`blur`,g)),ve(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ve()}),r.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let T=ie(m);T?(T.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),y.current=T,me()):y.current=null,K();let E=w;typeof E.observeResize==`function`&&E.observeResize(),we(),s=[v.onData(e=>{S.current(e)}),v.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof v.hasSelection==`function`&&v.hasSelection();ae.current=!t&&e<=.5}}),v.onSelectionChange(()=>{if(typeof v.hasSelection==`function`&&v.hasSelection()){ae.current=!1;return}let e=typeof v.getViewportY==`function`?v.getViewportY():0;ae.current=e<=.5})],n=new ResizeObserver(()=>{K()}),n.observe(m),typeof window<`u`&&window.setTimeout(()=>{K()},0)}catch{}})(),document.addEventListener(`focusin`,_,!0),window.addEventListener(`blur`,x),()=>{e=!0,j.current?.(),j.current=null,document.removeEventListener(`focusin`,_,!0),window.removeEventListener(`blur`,x),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,C&&(C.removeEventListener(`focus`,h),C.removeEventListener(`blur`,g)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),b.current=null,ee.current=null,y.current=null,w.current=null,de.current=null,G()}},[ve,c,K,B,a,o,we,i,G,R,L]),D.useEffect(()=>{let e=b.current;e&&(e.reset(),G(),w.current=null,K())},[e,he,K,G]),D.useEffect(()=>{l&&b.current&&V()},[l,V,e,he]),D.useEffect(()=>(we(),()=>{j.current?.(),j.current=null}),[we,e]),D.useEffect(()=>{let e=b.current;if(!e)return;if(t.length===0){k.current!==null&&(e.reset(),G(),K());return}let n=k.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&&J(r.map(e=>e.data).join(``)),k.current=t[t.length-1].id},[t,he,J,K,G]),D.useImperativeHandle(f,()=>({focus:()=>{V()},clear:()=>{let e=b.current;e&&(e.reset(),G(),K())},fit:()=>{K()}}),[V,K,G]);let Y=D.useCallback(e=>{if(!L)return;let t=v.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[L]),X=D.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(le.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){P.current=!0;return}if(!n&&r){if(P.current)return;e.preventDefault(),S.current(r),ce.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0;return}if(n===`insertText`&&r){if(P.current)return;e.preventDefault(),S.current(r),ce.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0;return}if(n===`insertLineBreak`){if(P.current)return;e.preventDefault(),S.current(`\r`),ce.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0;return}if(n===`deleteContentBackward`){if(P.current)return;e.preventDefault(),S.current(``),ce.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0}},[]),Z=D.useCallback(e=>{let t=e.currentTarget;if(le.current=typeof performance<`u`?performance.now():Date.now(),P.current)return;if(F.current){let e=ce.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){F.current=!1,U(t);return}F.current=!1}let n=H(t);if(!n)return;I.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);S.current(r),U(t),I.current=``},[U,H]),Te=D.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)&&Se()){e.preventDefault(),xe();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(),S.current(String.fromCharCode(t.charCodeAt(0)-64)),U(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),S.current(`\x1B`+e.key),U(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(),S.current(i),U(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=ce.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(),S.current(`\r`),U(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;H(a)||S.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=le.current;t&&s-t<50||(e.preventDefault(),S.current(e.key),F.current=!0,ce.current={type:`keydown-text`,at:s})}ye(a)},[U,xe,Se,H,ye]),Ee=D.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||ye(t)},[ye]),De=D.useCallback(e=>{let t=e.currentTarget;P.current=!1;let n=e.data||H(t);if(le.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);S.current(r),U(t),ce.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},F.current=!0},[U,H]),Oe=D.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=b.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;S.current(n)},[]),ke={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,O.jsxs)(`div`,{ref:v,className:g(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":L?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!L||c)&&!Se()){let t=e.touches?.[0];B(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(L){if(Se())return;B(e.clientX,e.clientY)}else b.current?.focus()},onMouseUp:()=>{!c&&Se()&&xe()},onTouchEnd:()=>{!c&&Se()&&xe()},children:[L&&typeof document<`u`?(0,re.createPortal)((0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`input`,{ref:N,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...ke,display:z?`block`:`none`},onBlur:Y,onBeforeInput:X,onCompositionStart:()=>{P.current=!0},onInput:Z,onKeyDown:Te,onKeyUp:Ee,onCompositionEnd:De,onPaste:Oe}),(0,O.jsx)(`textarea`,{ref:se,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...ke,display:z?`none`:`block`},onBlur:Y,onBeforeInput:X,onCompositionStart:()=>{P.current=!0},onInput:Z,onKeyDown:Te,onKeyUp:Ee,onCompositionEnd:De,onPaste:Oe})]}),document.body):null,y.current&&!c?(0,O.jsx)(x,{containerRef:y,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});ae.displayName=`TerminalViewport`;var j=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),M=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,oe=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,se=/Serving HTTP on .*? port (\d{2,5})/i,N=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),P=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(N.has(e)){t=t.slice(0,-1);continue}break}return t},F=e=>{let t=P(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},ce=e=>{if(!e)return null;let t=e.replace(j,``),n=t.match(se);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(!oe.test(e))continue;let t=Array.from(e.matchAll(M));if(t.length!==0)return F((t.find(e=>{try{return!!new URL(F(e[1])).port}catch{return!1}})??t[0])[1])}return null},le=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)}},ue={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},I={ctrl:`5`,cmd:`3`},de={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},fe={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},pe=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${I[t]}A`;case`arrow-down`:return`\u001b[1;${I[t]}B`;case`arrow-right`:return`\u001b[1;${I[t]}C`;case`arrow-left`:return`\u001b[1;${I[t]}D`}return ue[e]??null},me=()=>{let{t:e}=h(),{terminal:t,runtime:r}=l(),{currentTheme:i}=y(),{monoFont:a}=T(),d=c(e=>e.terminalFontSize),f=c(e=>e.bottomTerminalHeight),p=c(e=>e.isBottomTerminalExpanded),{isMobile:m,isTablet:x,hasTouchOnlyPointer:ne}=ee(),re=m||x,k=(re||ne)&&r.platform===`web`,A=r.platform!==`vscode`,ie=c(e=>e.showTerminalQuickKeysOnDesktop),j=!n()&&(re||ie),M=v(e=>e.currentSessionId),oe=v(e=>e.newSessionDraft),se=M!==null||oe?.open===!0,N=S()??null,P=w(e=>e.sessions),F=w(e=>e.hasHydrated),ue=w(e=>e.ensureDirectory),I=w(e=>e.createTab),me=w(e=>e.setActiveTab),he=w(e=>e.closeTab),ge=w(e=>e.setTabSessionId),_e=w(e=>e.setTabLifecycle),L=w(e=>e.setConnecting),ve=w(e=>e.appendToBuffer),R=w(e=>e.setTabPreviewUrl),z=w(e=>e.clearBuffer),B=c(e=>e.openContextPreview),V=D.useMemo(()=>{if(N)return P.get(N)},[P,N]),H=D.useMemo(()=>V?A?V.activeTabId??V.tabs[0]?.id??null:V.tabs[0]?.id??null:null,[V,A]),U=D.useMemo(()=>{if(V)return H?V.tabs.find(e=>e.id===H)??V.tabs[0]:V.tabs[0]},[V,H]),ye=D.useMemo(()=>(V?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?E[t.iconKey]??`terminal`:`terminal`;return(0,O.jsx)(b,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[V?.tabs,e]),W=U?.terminalSessionId??null,be=U?.lifecycle??`idle`,xe=U?.bufferChunks??[],Se=U?.isConnecting??!1,G=U?.previewUrl??null,[K,q]=D.useState(null),[Ce,J]=D.useState(!1),[we,Y]=D.useState(!1),[X,Z]=D.useState(null),[Te,Ee]=D.useState(!1),[De,Oe]=D.useState(0),ke=D.useRef(null),Ae=D.useRef(null),je=D.useRef(H),Me=D.useRef(W),Ne=D.useRef(N),Pe=D.useRef(null),Fe=D.useRef(null),Ie=D.useRef(!1),Le=D.useRef(!1),Re=D.useRef(null),ze=D.useRef(null),Be=D.useRef(new Set),Ve=D.useRef(!1),He=D.useRef(``),Ue=D.useRef(new Set),We=D.useRef(0),Ge=D.useCallback(()=>{He.current=``,Ue.current.clear(),We.current+=1},[]),Ke=D.useCallback(()=>{k||typeof document<`u`&&!document.hasFocus()||Pe.current?.focus()},[k]),qe=D.useCallback(()=>{k||Pe.current?.focus()},[k]);D.useEffect(()=>{if(!F||Ve.current)return;Ve.current=!0;let e=new Set;for(let[,t]of w.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Be.current=e},[F]);let Je=c(e=>e.activeMainTab),Ye=c(e=>e.isBottomTerminalOpen),Xe=c(e=>e.setBottomTerminalOpen),Ze=c(e=>e.setBottomTerminalExpanded),Qe=Je===`terminal`,Q=Qe||Ye,[$e,et]=D.useState(Q);D.useEffect(()=>{!Q||r.platform===`vscode`||u()},[Q,r.platform]),D.useEffect(()=>{Q&&et(!0)},[Q]),D.useEffect(()=>{Le.current=Q},[Q]),D.useEffect(()=>{Me.current=W},[W]),D.useEffect(()=>{je.current=H,Ge()},[H,Ge]),D.useEffect(()=>{Ne.current=N},[N]),D.useEffect(()=>{!j&&X!==null&&Z(null)},[j,X,Z]),D.useEffect(()=>{!W&&X!==null&&Z(null)},[W,X,Z]);let $=D.useCallback(()=>{ke.current?.(),ke.current=null,Ae.current=null,Re.current=null,Y(!1)},[]);D.useEffect(()=>()=>{$(),Me.current=null},[$]);let tt=D.useCallback((e,t,n)=>{if(!n)return;let r=`${He.current}${n}`.replace(/\r\n|\r/g,`
3
3
  `),i=r.split(`
4
4
  `),a=r.endsWith(`
5
5
  `)?i.join(`
6
6
  `):i.slice(0,-1).join(`
7
7
  `);if(He.current=r.endsWith(`
8
- `)?``:(i[i.length-1]??``).slice(-1024),!a)return;let o=ce(a);if(!o||Ue.current.has(o))return;let s=We.current;Ue.current.add(o),le(o).then(n=>{if(Ue.current.delete(o),!n||We.current!==s)return;let r=w.getState().getDirectoryState(e)?.tabs.find(e=>e.id===t);!r||r.previewUrlLocked||r.previewUrl===o||R(e,t,o,{locked:!1,autoOpened:!1})})},[R]),nt=D.useCallback((n,r,i,a=de,o=!1)=>{if(Ae.current===i)return;$(),Ae.current=i;let s=t.connect(i,{onEvent:a=>{if(Ae.current===i)switch(a.type){case`connected`:Re.current=i,L(n,r,!1),q(null),J(!1),Y(!1),Ke(),ze.current===i&&(ze.current=null,t.sendInput(i,`\r`).catch(()=>{}));break;case`reconnecting`:q(null),J(!1),Y(!0);break;case`data`:a.data&&(ve(n,r,a.data),tt(n,r,a.data));break;case`exit`:{let t=typeof a.exitCode==`number`?a.exitCode:null,i=typeof a.signal==`number`?a.signal:null,o=!!(w.getState().getDirectoryState(n)?.tabs.find(e=>e.id===r))?.label?.startsWith(`Action:`);ve(n,r,e(`terminalView.stream.processExitedMessage`,{exitCodeSegment:t===null?``:e(`terminalView.stream.processExitedWithCode`,{exitCode:t}),signalSegment:i===null?``:e(`terminalView.stream.processExitedWithSignal`,{signal:i})})),_e(n,r,`exited`),ge(n,r,null),L(n,r,!1),q(o?null:e(`terminalView.error.sessionEnded`)),J(!1),Y(!1),$();break}}},onError:(t,a)=>{if(Ae.current===i){if(!a){q(null),J(!1);return}if(/session not found/i.test(t.message)||o){Y(!1),q(null),J(!1),L(n,r,!0),z(n,r),_e(n,r,`idle`),ge(n,r,null),$();return}Y(!1),q(e(`terminalView.error.connectionFailed`,{message:t.message})),J(!0),L(n,r,!1),z(n,r),_e(n,r,`exited`),ge(n,r,null),$()}}},a);ke.current=()=>{s.close(),Ae.current=null}},[ve,z,$,Ke,tt,L,_e,ge,e,t]);D.useEffect(()=>{let n=!1;if(!(!F||!$e)){if(!N){q(e(se?`terminalView.empty.noWorkingDirectory`:`terminalView.empty.selectSession`));return}return(async()=>{let r=N;if(!Ne.current||Ne.current!==r)return;ue(r);let i=w.getState().getDirectoryState(r);if(!i||i.tabs.length===0)return;let a=A?i.activeTabId??i.tabs[0]?.id??null:i.tabs[0]?.id??null;if(!a)return;let o=i.tabs.find(e=>e.id===a)??i.tabs[0],s=o?.terminalSessionId??null,c=o?.lifecycle??`idle`,l=!!o?.label?.startsWith(`Action:`),u=(o?.bufferLength??0)>0||(o?.bufferChunks?.length??0)>0;if(s)return;if(c===`exited`){L(r,a,!1);return}if(l&&u){L(r,a,!1);return}let d=Fe.current;if(!(!d&&Le.current)){q(null),J(!1),Y(!1),L(r,a,!0);try{let e=await t.createSession({cwd:r,cols:d?.cols,rows:d?.rows});if(!(!n&&Ne.current===r&&je.current===a)){try{await t.close(e.sessionId)}catch{}return}if(w.getState().getDirectoryState(r)?.tabs.find(e=>e.id===a)?.terminalSessionId){try{await t.close(e.sessionId)}catch{}return}ge(r,a,e.sessionId)}catch(t){n||(q(t instanceof Error?t.message:e(`terminalView.error.startSessionFailed`)),J(!0),Y(!1),L(r,a,!1))}}})(),()=>{n=!0}}},[se,N,W,be,H,$e,De,A,F,ue,L,ge,e,t]);let rt=D.useRef(nt);rt.current=nt;let it=D.useRef($);it.current=$,D.useEffect(()=>{if(!F||!$e)return;if(!N){it.current();return}let e=N,t=w.getState().getDirectoryState(e);if(!t||t.tabs.length===0){it.current();return}let n=A?t.activeTabId??t.tabs[0]?.id??null:t.tabs[0]?.id??null;if(!n){it.current();return}let r=t.tabs.find(e=>e.id===n)??t.tabs[0],i=r?.terminalSessionId??null;if(!i){it.current(),Me.current=null;return}if(Ae.current===i&&ke.current){Me.current=i;return}Me.current=i;let a=Be.current.has(i),o=a&&(r?.bufferLength??0)===0&&(r?.bufferChunks?.length??0)===0;a&&Be.current.delete(i),o&&(ze.current=i),rt.current(e,n,i,a?fe:de,a)},[N,W,H,A,$e,F]),D.useEffect(()=>{if(!Q||k)return;if(typeof window>`u`){Ke();return}let e=window.requestAnimationFrame(()=>{Ke()});return()=>{window.cancelAnimationFrame(e)}},[H,Ke,Q,k]);let at=D.useCallback(async()=>{if(!N||Te)return;let t=w.getState().getDirectoryState(N),n=A?H??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(n){Ee(!0),q(null),J(!1),Y(!1),$(),z(N,n),Ge();try{await he(N,n)}catch(t){q(t instanceof Error?t.message:e(`terminalView.error.restartFailed`)),J(!0),Y(!1)}finally{Ee(!1)}}},[H,z,he,$,N,A,Te,Ge,e]),ot=D.useCallback(async()=>{await at()},[at]),st=D.useCallback(()=>{if(!N)return;let e=I(N);me(N,e),q(null),J(!1),Y(!1),$()},[I,$,N,me]),ct=D.useCallback(e=>{N&&(me(N,e),q(null),J(!1),Y(!1),$())},[$,N,me]),lt=D.useCallback(e=>{N&&(e===H&&$(),q(null),J(!1),Y(!1),he(N,e))},[H,he,$,N]),ut=D.useCallback(n=>{if(!n||we)return;let r=n,i=!1;if(X&&n.length>0){let e=n[0];if(e.length===1&&/[a-zA-Z]/.test(e)){let t=e.toUpperCase();(X===`ctrl`||X===`cmd`)&&(r=String.fromCharCode(t.charCodeAt(0)&31),i=!0)}i||=!0}let a=Me.current;!a||Re.current!==a||(t.sendInput(a,r).catch(t=>{we||q(t instanceof Error?t.message:e(`terminalView.error.sendInputFailed`))}),i&&(Z(null),qe()))},[X,qe,we,Z,e,t]),dt=D.useCallback((e,n)=>{let r=Fe.current;if((!r||r.cols!==e||r.rows!==n)&&(Fe.current={cols:e,rows:n}),Ie.current||(Ie.current=!0,Oe(e=>e+1)),!Le.current)return;let i=Me.current;!i||Re.current!==i||t.resize({sessionId:i,cols:e,rows:n}).catch(()=>{})},[t]),ft=D.useCallback(e=>{Z(t=>t===e?null:e),qe()},[qe,Z]),pt=D.useCallback(e=>{let t=pe(e,X);t&&(ut(t),Z(null),qe())},[X,qe,ut,Z]);D.useEffect(()=>{if(!j||!X||!W)return;let e=e=>{if(e.repeat)return;let t=e.key;if(!t||t===`Control`||t===`Meta`||t===`Alt`||t===`Shift`)return;let n=t.length===1?t.toLowerCase():t,r=e.code??``,i=r.startsWith(`Key`)&&r.length===4?r.slice(3).toUpperCase():null,a=t.length===1&&/[a-zA-Z]/.test(t)?t.toUpperCase():i,o={Tab:`tab`,Enter:`enter`,ArrowUp:`arrow-up`,ArrowDown:`arrow-down`,ArrowLeft:`arrow-left`,ArrowRight:`arrow-right`,Escape:`esc`,tab:`tab`,enter:`enter`,arrowup:`arrow-up`,arrowdown:`arrow-down`,arrowleft:`arrow-left`,arrowright:`arrow-right`,escape:`esc`};if(n in o){e.preventDefault(),e.stopPropagation(),pt(o[n]);return}if(X===`ctrl`&&a&&a.length===1&&a>=`A`&&a<=`Z`){let t=String.fromCharCode(a.charCodeAt(0)&31);e.preventDefault(),e.stopPropagation(),ut(t),Z(null),qe()}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[X,pt,ut,qe,j,Z,W]);let mt=D.useMemo(()=>{let e=o[s].stack;if(typeof window>`u`)return(o[a]??o[`system-mono`]).stack;let t=window.getComputedStyle(document.documentElement).getPropertyValue(`--font-family-mono`);return t&&t.trim().length>0?t.trim():(o[a]??o[`system-mono`]).stack??e},[a]),ht=D.useMemo(()=>te(i),[i]),gt=D.useMemo(()=>`${N??`no-dir`}::${H??`no-tab`}`,[N,H]);if(D.useEffect(()=>{if(!Q||k)return;let e=Pe.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t(),Ke()}),n=[220,400].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[Ke,Q,k,gt,W]),D.useEffect(()=>{if(k||!Q||!Ye)return;let e=Pe.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t()}),n=[0,80,180,320].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[f,p,Ye,Q,k]),!se)return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground`,children:e(`terminalView.empty.selectSession`)});if(!N)return(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground`,children:[(0,O.jsx)(`p`,{children:e(`terminalView.empty.noWorkingDirectoryForSession`)}),(0,O.jsx)(`button`,{onClick:at,className:`rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:e(`terminalView.actions.retry`)})]});let _t=!W||Se||Te||we,vt=$e,yt=!re&&Ye&&!Qe,bt=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>pt(`esc`),disabled:_t,children:e(`terminalView.quickKeys.escape`)}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`tab`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-right`,className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.tabAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`ctrl`,className:`h-6 w-9 p-0`,onClick:()=>ft(`ctrl`),disabled:_t,children:[(0,O.jsx)(`span`,{className:`text-xs font-medium`,children:e(`terminalView.quickKeys.controlLabel`)}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.controlModifierAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`cmd`,className:`h-6 w-9 p-0`,onClick:()=>ft(`cmd`),disabled:_t,children:[(0,O.jsx)(b,{name:`command`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.commandModifierAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-up`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-up`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowUpAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-left`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-left`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowLeftAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-down`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-down`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowDownAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-right`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-right`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowRightAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`enter`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-go-back`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.enterAria`)})]})]});return(0,O.jsxs)(`div`,{"data-terminal-view":`true`,className:`flex h-full flex-col overflow-hidden bg-[var(--surface-background)]`,children:[(0,O.jsxs)(`div`,{className:g(`app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs`,re?`px-3 py-1.5`:`pl-3 pr-1.5 py-1`),children:[A&&V?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 pl-1 pr-1`,children:[(0,O.jsx)(`div`,{className:g(`min-w-0 flex-1`,re?`h-8`:`h-7`),children:(0,O.jsx)(C,{items:ye,activeId:H,onSelect:ct,onClose:lt,layoutMode:`scrollable`,variant:`default`,className:`h-full bg-transparent`})}),(0,O.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,className:g(`shrink-0`,re?`h-8 w-8 p-0`:`h-7 w-7 p-0`),onClick:st,title:e(`terminalView.tabs.newTabTitle`),children:(0,O.jsx)(b,{name:`add`,className:`${re?`h-[18px] w-[18px]`:`h-4 w-4`}`})}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 overflow-visible`,children:[G?(0,O.jsxs)(_,{type:`button`,size:`xs`,variant:`outline`,className:`h-6 shrink-0 gap-1 px-2`,onClick:()=>{N&&B(N,G)},title:e(`terminalView.preview.openTitle`),children:[(0,O.jsx)(b,{name:`global`,className:`h-3.5 w-3.5 shrink-0`}),(0,O.jsx)(`span`,{className:`whitespace-nowrap`,children:e(`terminalView.preview.open`)})]}):null,yt?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>Ze(!p),className:g(`shrink-0 p-0`,m?`h-8 w-8`:`h-7 w-7`),title:e(p?`terminalView.bottomDock.restoreTitle`:`terminalView.bottomDock.expandTitle`),"aria-label":e(p?`terminalView.bottomDock.restoreAria`:`terminalView.bottomDock.expandAria`),children:p?(0,O.jsx)(b,{name:`fullscreen-exit`,className:`h-4 w-4`}):(0,O.jsx)(b,{name:`fullscreen`,className:`h-4 w-4`})}),(0,O.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>Xe(!1),className:g(`shrink-0 p-0`,m?`h-8 w-8`:`h-7 w-7`),title:e(`terminalView.bottomDock.closeTitle`),"aria-label":e(`terminalView.bottomDock.closeAria`),children:(0,O.jsx)(b,{name:`close`,className:`h-4 w-4`})})]}):null]})]}):null,!m&&j&&A&&V?(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1`,children:bt}):null,j&&(m||!A||!V)?(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:bt}):null]}),(0,O.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,style:{backgroundColor:ht.background},children:[(0,O.jsx)(`div`,{className:`h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4`,children:vt?(0,O.jsx)(ae,{ref:e=>{Pe.current=e},sessionKey:gt,chunks:xe,onInput:ut,onResize:dt,theme:ht,fontFamily:mt,fontSize:d,enableTouchScroll:k,autoFocus:!k&&Q,isVisible:Q},gt):null}),!we&&K&&(0,O.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2`,children:[(0,O.jsx)(`span`,{children:K}),Ce&&m&&(0,O.jsx)(_,{size:`sm`,variant:`secondary`,className:`h-6 px-2 py-0 text-xs`,onClick:ot,disabled:Te,title:e(`terminalView.actions.hardRestartTitle`),type:`button`,children:e(`terminalView.actions.hardRestart`)})]})]})]})};export{me as TerminalView};
8
+ `)?``:(i[i.length-1]??``).slice(-1024),!a)return;let o=ce(a);if(!o||Ue.current.has(o))return;let s=We.current;Ue.current.add(o),le(o).then(n=>{if(Ue.current.delete(o),!n||We.current!==s)return;let r=w.getState().getDirectoryState(e)?.tabs.find(e=>e.id===t);!r||r.previewUrlLocked||r.previewUrl===o||R(e,t,o,{locked:!1,autoOpened:!1})})},[R]),nt=D.useCallback((n,r,i,a=de,o=!1)=>{if(Ae.current===i)return;$(),Ae.current=i;let s=t.connect(i,{onEvent:a=>{if(Ae.current===i)switch(a.type){case`connected`:Re.current=i,L(n,r,!1),q(null),J(!1),Y(!1),Ke(),ze.current===i&&(ze.current=null,t.sendInput(i,`\r`).catch(()=>{}));break;case`reconnecting`:q(null),J(!1),Y(!0);break;case`data`:a.data&&(ve(n,r,a.data),tt(n,r,a.data));break;case`exit`:{let t=typeof a.exitCode==`number`?a.exitCode:null,i=typeof a.signal==`number`?a.signal:null,o=!!(w.getState().getDirectoryState(n)?.tabs.find(e=>e.id===r))?.label?.startsWith(`Action:`);ve(n,r,e(`terminalView.stream.processExitedMessage`,{exitCodeSegment:t===null?``:e(`terminalView.stream.processExitedWithCode`,{exitCode:t}),signalSegment:i===null?``:e(`terminalView.stream.processExitedWithSignal`,{signal:i})})),_e(n,r,`exited`),ge(n,r,null),L(n,r,!1),q(o?null:e(`terminalView.error.sessionEnded`)),J(!1),Y(!1),$();break}}},onError:(t,a)=>{if(Ae.current===i){if(!a){q(null),J(!1);return}if(/session not found/i.test(t.message)||o){Y(!1),q(null),J(!1),L(n,r,!0),z(n,r),_e(n,r,`idle`),ge(n,r,null),$();return}Y(!1),q(e(`terminalView.error.connectionFailed`,{message:t.message})),J(!0),L(n,r,!1),z(n,r),_e(n,r,`exited`),ge(n,r,null),$()}}},a);ke.current=()=>{s.close(),Ae.current=null}},[ve,z,$,Ke,tt,L,_e,ge,e,t]);D.useEffect(()=>{let n=!1;if(!(!F||!$e)){if(!N){q(e(se?`terminalView.empty.noWorkingDirectory`:`terminalView.empty.selectSession`));return}return(async()=>{let r=N;if(!Ne.current||Ne.current!==r)return;ue(r);let i=w.getState().getDirectoryState(r);if(!i||i.tabs.length===0)return;let a=A?i.activeTabId??i.tabs[0]?.id??null:i.tabs[0]?.id??null;if(!a)return;let o=i.tabs.find(e=>e.id===a)??i.tabs[0],s=o?.terminalSessionId??null,c=o?.lifecycle??`idle`,l=!!o?.label?.startsWith(`Action:`),u=(o?.bufferLength??0)>0||(o?.bufferChunks?.length??0)>0;if(s)return;if(c===`exited`){L(r,a,!1);return}if(l&&u){L(r,a,!1);return}let d=Fe.current;if(!(!d&&Le.current)){q(null),J(!1),Y(!1),L(r,a,!0);try{let e=await t.createSession({cwd:r,cols:d?.cols,rows:d?.rows});if(!(!n&&Ne.current===r&&je.current===a)){try{await t.close(e.sessionId)}catch{}return}if(w.getState().getDirectoryState(r)?.tabs.find(e=>e.id===a)?.terminalSessionId){try{await t.close(e.sessionId)}catch{}return}ge(r,a,e.sessionId)}catch(t){n||(q(t instanceof Error?t.message:e(`terminalView.error.startSessionFailed`)),J(!0),Y(!1),L(r,a,!1))}}})(),()=>{n=!0}}},[se,N,W,be,H,$e,De,A,F,ue,L,ge,e,t]);let rt=D.useRef(nt);rt.current=nt;let it=D.useRef($);it.current=$,D.useEffect(()=>{if(!F||!$e)return;if(!N){it.current();return}let e=N,t=w.getState().getDirectoryState(e);if(!t||t.tabs.length===0){it.current();return}let n=A?t.activeTabId??t.tabs[0]?.id??null:t.tabs[0]?.id??null;if(!n){it.current();return}let r=t.tabs.find(e=>e.id===n)??t.tabs[0],i=r?.terminalSessionId??null;if(!i){it.current(),Me.current=null;return}if(Ae.current===i&&ke.current){Me.current=i;return}Me.current=i;let a=Be.current.has(i),o=a&&(r?.bufferLength??0)===0&&(r?.bufferChunks?.length??0)===0;a&&Be.current.delete(i),o&&(ze.current=i),rt.current(e,n,i,a?fe:de,a)},[N,W,H,A,$e,F]),D.useEffect(()=>{if(!Q||k)return;if(typeof window>`u`){Ke();return}let e=window.requestAnimationFrame(()=>{Ke()});return()=>{window.cancelAnimationFrame(e)}},[H,Ke,Q,k]);let at=D.useCallback(async()=>{if(!N||Te)return;let t=w.getState().getDirectoryState(N),n=A?H??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(n){Ee(!0),q(null),J(!1),Y(!1),$(),z(N,n),Ge();try{await he(N,n)}catch(t){q(t instanceof Error?t.message:e(`terminalView.error.restartFailed`)),J(!0),Y(!1)}finally{Ee(!1)}}},[H,z,he,$,N,A,Te,Ge,e]),ot=D.useCallback(async()=>{await at()},[at]),st=D.useCallback(()=>{if(!N)return;let e=I(N);me(N,e),q(null),J(!1),Y(!1),$()},[I,$,N,me]),ct=D.useCallback(e=>{N&&(me(N,e),q(null),J(!1),Y(!1),$())},[$,N,me]),lt=D.useCallback(e=>{N&&(e===H&&$(),q(null),J(!1),Y(!1),he(N,e))},[H,he,$,N]),ut=D.useCallback(n=>{if(!n||we)return;let r=n,i=!1;if(X&&n.length>0){let e=n[0];if(e.length===1&&/[a-zA-Z]/.test(e)){let t=e.toUpperCase();(X===`ctrl`||X===`cmd`)&&(r=String.fromCharCode(t.charCodeAt(0)&31),i=!0)}i||=!0}let a=Me.current;!a||Re.current!==a||(t.sendInput(a,r).catch(t=>{we||q(t instanceof Error?t.message:e(`terminalView.error.sendInputFailed`))}),i&&(Z(null),qe()))},[X,qe,we,Z,e,t]),dt=D.useCallback((e,n)=>{let r=Fe.current;if((!r||r.cols!==e||r.rows!==n)&&(Fe.current={cols:e,rows:n}),Ie.current||(Ie.current=!0,Oe(e=>e+1)),!Le.current)return;let i=Me.current;!i||Re.current!==i||t.resize({sessionId:i,cols:e,rows:n}).catch(()=>{})},[t]),ft=D.useCallback(e=>{Z(t=>t===e?null:e),qe()},[qe,Z]),pt=D.useCallback(e=>{let t=pe(e,X);t&&(ut(t),Z(null),qe())},[X,qe,ut,Z]);D.useEffect(()=>{if(!j||!X||!W)return;let e=e=>{if(e.repeat)return;let t=e.key;if(!t||t===`Control`||t===`Meta`||t===`Alt`||t===`Shift`)return;let n=t.length===1?t.toLowerCase():t,r=e.code??``,i=r.startsWith(`Key`)&&r.length===4?r.slice(3).toUpperCase():null,a=t.length===1&&/[a-zA-Z]/.test(t)?t.toUpperCase():i,o={Tab:`tab`,Enter:`enter`,ArrowUp:`arrow-up`,ArrowDown:`arrow-down`,ArrowLeft:`arrow-left`,ArrowRight:`arrow-right`,Escape:`esc`,tab:`tab`,enter:`enter`,arrowup:`arrow-up`,arrowdown:`arrow-down`,arrowleft:`arrow-left`,arrowright:`arrow-right`,escape:`esc`};if(n in o){e.preventDefault(),e.stopPropagation(),pt(o[n]);return}if(X===`ctrl`&&a&&a.length===1&&a>=`A`&&a<=`Z`){let t=String.fromCharCode(a.charCodeAt(0)&31);e.preventDefault(),e.stopPropagation(),ut(t),Z(null),qe()}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[X,pt,ut,qe,j,Z,W]);let mt=D.useMemo(()=>{let e=o[s].stack;if(typeof window>`u`)return(o[a]??o[`system-mono`]).stack;let t=window.getComputedStyle(document.documentElement).getPropertyValue(`--font-family-mono`);return t&&t.trim().length>0?t.trim():(o[a]??o[`system-mono`]).stack??e},[a]),ht=D.useMemo(()=>te(i),[i]),gt=D.useMemo(()=>`${N??`no-dir`}::${H??`no-tab`}`,[N,H]);if(D.useEffect(()=>{if(!Q||k)return;let e=Pe.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t(),Ke()}),n=[220,400].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[Ke,Q,k,gt,W]),D.useEffect(()=>{if(k||!Q||!Ye)return;let e=Pe.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t()}),n=[0,80,180,320].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[f,p,Ye,Q,k]),!se)return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground`,children:e(`terminalView.empty.selectSession`)});if(!N)return(0,O.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground`,children:[(0,O.jsx)(`p`,{children:e(`terminalView.empty.noWorkingDirectoryForSession`)}),(0,O.jsx)(_,{onClick:at,size:`sm`,children:e(`terminalView.actions.retry`)})]});let _t=!W||Se||Te||we,vt=$e,yt=!re&&Ye&&!Qe,bt=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>pt(`esc`),disabled:_t,children:e(`terminalView.quickKeys.escape`)}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`tab`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-right`,className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.tabAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`ctrl`,className:`h-6 w-9 p-0`,onClick:()=>ft(`ctrl`),disabled:_t,children:[(0,O.jsx)(`span`,{className:`text-xs font-medium`,children:e(`terminalView.quickKeys.controlLabel`)}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.controlModifierAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`cmd`,className:`h-6 w-9 p-0`,onClick:()=>ft(`cmd`),disabled:_t,children:[(0,O.jsx)(b,{name:`command`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.commandModifierAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-up`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-up`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowUpAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-left`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-left`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowLeftAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-down`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-down`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowDownAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`arrow-right`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-right`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowRightAria`)})]}),(0,O.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>pt(`enter`),disabled:_t,children:[(0,O.jsx)(b,{name:`arrow-go-back`}),(0,O.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.enterAria`)})]})]});return(0,O.jsxs)(`div`,{"data-terminal-view":`true`,className:`flex h-full flex-col overflow-hidden bg-[var(--surface-background)]`,children:[(0,O.jsxs)(`div`,{className:g(`app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs`,re?`px-3 py-1.5`:`pl-3 pr-1.5 py-1`),children:[A&&V?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 pl-1 pr-1`,children:[(0,O.jsx)(`div`,{className:g(`min-w-0 flex-1`,re?`h-8`:`h-7`),children:(0,O.jsx)(C,{items:ye,activeId:H,onSelect:ct,onClose:lt,layoutMode:`scrollable`,variant:`default`,className:`h-full bg-transparent`})}),(0,O.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,className:g(`shrink-0`,re?`h-8 w-8 p-0`:`h-7 w-7 p-0`),onClick:st,title:e(`terminalView.tabs.newTabTitle`),children:(0,O.jsx)(b,{name:`add`,className:`${re?`h-[18px] w-[18px]`:`h-4 w-4`}`})}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 overflow-visible`,children:[G?(0,O.jsxs)(_,{type:`button`,size:`xs`,variant:`outline`,className:`h-6 shrink-0 gap-1 px-2`,onClick:()=>{N&&B(N,G)},title:e(`terminalView.preview.openTitle`),children:[(0,O.jsx)(b,{name:`global`,className:`h-3.5 w-3.5 shrink-0`}),(0,O.jsx)(`span`,{className:`whitespace-nowrap`,children:e(`terminalView.preview.open`)})]}):null,yt?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>Ze(!p),className:g(`shrink-0 p-0`,m?`h-8 w-8`:`h-7 w-7`),title:e(p?`terminalView.bottomDock.restoreTitle`:`terminalView.bottomDock.expandTitle`),"aria-label":e(p?`terminalView.bottomDock.restoreAria`:`terminalView.bottomDock.expandAria`),children:p?(0,O.jsx)(b,{name:`fullscreen-exit`,className:`h-4 w-4`}):(0,O.jsx)(b,{name:`fullscreen`,className:`h-4 w-4`})}),(0,O.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>Xe(!1),className:g(`shrink-0 p-0`,m?`h-8 w-8`:`h-7 w-7`),title:e(`terminalView.bottomDock.closeTitle`),"aria-label":e(`terminalView.bottomDock.closeAria`),children:(0,O.jsx)(b,{name:`close`,className:`h-4 w-4`})})]}):null]})]}):null,!m&&j&&A&&V?(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1`,children:bt}):null,j&&(m||!A||!V)?(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:bt}):null]}),(0,O.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,style:{backgroundColor:ht.background},children:[(0,O.jsx)(`div`,{className:`h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4`,children:vt?(0,O.jsx)(ae,{ref:e=>{Pe.current=e},sessionKey:gt,chunks:xe,onInput:ut,onResize:dt,theme:ht,fontFamily:mt,fontSize:d,enableTouchScroll:k,autoFocus:!k&&Q,isVisible:Q},gt):null}),!we&&K&&(0,O.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2`,children:[(0,O.jsx)(`span`,{children:K}),Ce&&m&&(0,O.jsx)(_,{size:`sm`,variant:`secondary`,className:`h-6 px-2 py-0 text-xs`,onClick:ot,disabled:Te,title:e(`terminalView.actions.hardRestartTitle`),type:`button`,children:e(`terminalView.actions.hardRestart`)})]})]})]})};export{me as TerminalView};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,t as n,v as r,w as i}from"./runtime-auth-ef9W7A43.js";import{c as a,i as o}from"./runtime-switch-CAZiOV2G.js";import{s,u as c}from"./queryRuntime-DKGLQtb9.js";import{rn as l}from"./persistence-Dzooc9Xg.js";import{it as u,nt as d,rt as f}from"./vendor-base-ui-CdzJ6My_.js";import{n as p}from"./platform-7bX6qtBV.js";import{_ as m}from"./useUIStore-NMQx_cnG.js";import{n as h}from"./vendor-react-BP2cRVqX.js";import{s as g}from"./vendor-tanstack-react-query-CdqCAt40.js";import{c as _,f as v,o as y,s as b}from"./runtime-file-resource-C1k5nbWb.js";import{a as x,n as S}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as C,t as w}from"./runtime-file-download-DAOam_oV.js";import{a as T,i as E}from"./vendor-pierre-diffs-DPBtNDJ5.js";import{n as D}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as O,r as k,t as A}from"./button-_ReBqWzC.js";import{n as j,t as ee}from"./useThemeSystem-8jhE4Zyk.js";import{n as M}from"./Icon-2cKLcXGe.js";import{n as N,t as te}from"./dialog-NsOVcGdh.js";import{a as P,c as F,d as I,i as L,o as ne}from"./image-loading-23c-W-bq.js";import{t as re}from"./MobileWindowStack-DGLdgoGr.js";import{t as ie}from"./appThemeRegistry-DlEr4DLc.js";import{a as ae,n as R}from"./MarkdownRenderer-DGUI8EIG.js";import{l as oe}from"./markdown-worker-CkO3sT4Y.js";import{n as se}from"./useEffectiveDirectory-D6GwXhDS.js";import{t as ce}from"./ImageLoadingPlaceholder-DmCEIw55.js";import{d as le,f as z,g as B,h as ue,l as V,m as de,n as H,p as U,r as W,s as G,t as fe,u as pe}from"./useWorkerHighlightedLines-CwC34Jql.js";import{t as me}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as he}from"./markdownTheme-DHoKvD6O.js";import{n as ge}from"./mobileBackNavigation-D2yUxPpG.js";var K=h(),q=e(u(),1),J=f(),_e=80,Y=20,ve=q.memo(e=>{let t=(0,K.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}=j(),u;t[0]===l?u=t[1]:(u=he(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(be).join(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,t as n,v as r,w as i}from"./runtime-auth-ef9W7A43.js";import{c as a,i as o}from"./runtime-switch-CAZiOV2G.js";import{s,u as c}from"./queryRuntime-DKGLQtb9.js";import{rn as l}from"./persistence-Dzooc9Xg.js";import{it as u,nt as d,rt as f}from"./vendor-base-ui-CdzJ6My_.js";import{n as p}from"./platform-7bX6qtBV.js";import{_ as m}from"./useUIStore-NMQx_cnG.js";import{n as h}from"./vendor-react-BP2cRVqX.js";import{s as g}from"./vendor-tanstack-react-query-CdqCAt40.js";import{c as _,f as v,o as y,s as b}from"./runtime-file-resource-C1k5nbWb.js";import{a as x,n as S}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as C,t as w}from"./runtime-file-download-DAOam_oV.js";import{a as T,i as E}from"./vendor-pierre-diffs-DPBtNDJ5.js";import{n as D}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as O,r as k,t as A}from"./button-D_HdP1Oy.js";import{n as j,t as ee}from"./useThemeSystem-8jhE4Zyk.js";import{n as M}from"./Icon-BXTZRnIO.js";import{n as N,t as te}from"./dialog-B_87Teec.js";import{a as P,c as F,d as I,i as L,o as ne}from"./image-loading-23c-W-bq.js";import{t as re}from"./MobileWindowStack-DGLdgoGr.js";import{t as ie}from"./appThemeRegistry-nntgbF9E.js";import{a as ae,n as R}from"./MarkdownRenderer-Va7Wdk98.js";import{l as oe}from"./markdown-worker-CkO3sT4Y.js";import{n as se}from"./useEffectiveDirectory-CqkTJqRg.js";import{t as ce}from"./ImageLoadingPlaceholder-Cv6IaJar.js";import{d as le,f as z,g as B,h as ue,l as V,m as de,n as H,p as U,r as W,s as G,t as fe,u as pe}from"./useWorkerHighlightedLines-Bla356tF.js";import{t as me}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as he}from"./markdownTheme-DHoKvD6O.js";import{n as ge}from"./mobileBackNavigation-f8AMDP0N.js";var K=h(),q=e(u(),1),J=f(),_e=80,Y=20,ve=q.memo(e=>{let t=(0,K.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}=j(),u;t[0]===l?u=t[1]:(u=he(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(be).join(`
2
2
  `),t[2]=n,t[3]=f);let p=fe(f,r);if(!(n.length>_e)){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,J.jsx)(X,{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,J.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,J.jsx)(ye,{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});ve.displayName=`VirtualizedCodeBlock`;var ye=q.memo(({lines:e,highlighted:t,syntaxVars:n,maxHeight:r,showLineNumbers:i,lineStyles:a})=>{let o=q.useRef(null),s=`min(${e.length*Y}px, ${r})`,c=me({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>Y,overscan:20}),l=c.getVirtualItems();return(0,J.jsx)(`div`,{ref:o,className:`typography-code font-mono w-full min-w-0`,style:{...n,height:s,maxHeight:r,overflow:`auto`},children:(0,J.jsx)(`div`,{style:{height:c.getTotalSize(),position:`relative`},children:l.map(n=>{let r=e[n.index];return r?(0,J.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,J.jsx)(X,{line:r,html:t?.[n.index],showLineNumbers:i,style:a?.(r)})},n.index):null})})})});ye.displayName=`VirtualizedRows`;var X=q.memo(e=>{let t=(0,K.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,J.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,J.jsx)(`div`,{className:`flex-1 min-w-0`,children:n.isInfo?(0,J.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground/70 italic`,children:n.text}):r===void 0?(0,J.jsx)(`div`,{className:`whitespace-pre`,children:n.text}):(0,J.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,J.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});X.displayName=`VirtualizedCodeBlock.Row`;function be(e){return e.text}var xe=q.memo(function({jsonString:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2}){let{t:i}=O(),a=q.useRef(null),[o,s]=q.useState(null),c=q.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=q.useCallback(()=>{a.current?.expandAll()},[]),u=q.useCallback(()=>{a.current?.collapseAll()},[]);return o?(0,J.jsx)(`div`,{className:t,children:(0,J.jsxs)(`div`,{className:`rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4`,children:[(0,J.jsx)(`div`,{className:`mb-1 font-medium text-[var(--surface-foreground)]`,children:i(`jsonTreeView.error.invalidJsonTitle`)}),(0,J.jsx)(`div`,{className:`font-mono text-xs text-[var(--surface-mutedForeground)]`,children:o})]})}):c===null?null:(0,J.jsxs)(`div`,{className:t,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1`,children:[(0,J.jsxs)(A,{variant:`ghost`,size:`xs`,onClick:l,className:`gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(M,{name:`arrow-down-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.expandAll`)]}),(0,J.jsxs)(A,{variant:`ghost`,size:`xs`,onClick:u,className:`gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(M,{name:`arrow-up-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.collapseAll`)]})]}),(0,J.jsx)(`div`,{className:`bg-[var(--syntax-base-background)] py-1`,style:{maxHeight:n,overflow:`auto`},children:(0,J.jsx)(W,{ref:a,data:c,maxHeight:n,initiallyExpandedDepth:r})})]})}),Se=class extends Error{key;params;constructor(e,t){super(e),this.name=`MermaidLoadFailure`,this.key=e,this.params=t}},Ce=(e,t)=>new Se(e,t),we=e=>e instanceof Se,Te=e=>e+1,Ee=(e,t)=>e===t,De=e=>{let t=e.indexOf(`,`);if(t<0)throw Ce(`chat.toolOutputDialog.mermaid.dataUrlMalformed`);let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1);return n.includes(`;base64`)?atob(r):decodeURIComponent(r)},Oe=e=>Promise.resolve().then(()=>De(e)),ke=1,Ae=56,Z=(e,t,n)=>Math.min(n,Math.max(t,e)),je=({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)>=Ae&&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`},Me=(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)}},Q=(e,t)=>{let n=t.minScale??ke,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)}},Ne=(e,t,n,r,i)=>{let a=Z(t,i.minScale??ke,i.maxScale??5),o=a/e.scale;return Q({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)},Pe=(e,t,n)=>Q({...e,x:e.x+t.x,y:e.y+t.y},n),Fe=(e,t,n,r,i,a)=>{let o=Z(r,a.minScale??ke,a.maxScale??5),s=o/e.scale;return Q({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)},Ie=500,Le=24,Re=(e,t={})=>{let n=t.target??(typeof document>`u`?null:document);if(!n)return()=>{};let r=t.durationMs??Ie,i=t.maxDistance??Le,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},ze=(e,t,n={})=>{Re(e,n),t()},Be=e(d(),1);function Ve(e,t,n,r,i){let a=e instanceof HTMLImageElement?e:e.querySelector(`img`);if(!a||!t.complete||!t.naturalWidth||!t.animate)return;let o=t.getBoundingClientRect(),s=a.getBoundingClientRect();if(!o.width||!o.height||!s.width||!s.height)return;let c=getComputedStyle(a),l=t.naturalWidth/t.naturalHeight,u=c.objectFit===`cover`?Math.max(s.width,s.height*l):Math.min(s.width,s.height*l),d=u/l,f=c.objectPosition.split(` `);if(!f.every(e=>e.endsWith(`%`)))return;let p=(s.width-u)*parseFloat(f[0])/100,m=(s.height-d)*parseFloat(f[1]??f[0])/100,h=s.left,g=s.top,_=s.right,v=s.bottom,y=c.borderRadius;for(let e=a.parentElement;e;e=e.parentElement){let t=getComputedStyle(e),n=e.getBoundingClientRect();[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowX)&&(h=Math.max(h,n.left),_=Math.min(_,n.right)),[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowY)&&(g=Math.max(g,n.top),v=Math.min(v,n.bottom)),n.width===s.width&&n.height===s.height&&t.borderRadius!==`0px`&&(y=t.borderRadius)}if(_<=h||v<=g)return;let b=document.createElement(`div`);b.dataset.mediaCropAnimation=``,b.setAttribute(`aria-hidden`,`true`),Object.assign(b.style,{position:`fixed`,left:`0`,top:`0`,overflow:`hidden`,pointerEvents:`none`,zIndex:`51`,contain:`paint`});let x=document.createElement(`img`);x.src=t.currentSrc||t.src,x.alt=``,Object.assign(x.style,{display:`block`,width:`${o.width}px`,height:`${o.height}px`,maxWidth:`none`,transformOrigin:`0 0`}),b.append(x),document.body.append(b);let S={transform:`translate(${o.left}px, ${o.top}px)`,width:`${o.width}px`,height:`${o.height}px`,borderRadius:`0px`},C={transform:`translate(${h}px, ${g}px)`,width:`${_-h}px`,height:`${v-g}px`,borderRadius:y},w={transform:`translate(0px, 0px) scale(1)`},T={transform:`translate(${s.left+p-h}px, ${s.top+m-g}px) scale(${u/o.width})`},E={duration:280,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`},D=t.style.visibility;t.style.visibility=`hidden`;let O=[b.animate(r?[S,C]:[C,S],E),x.animate(r?[w,T]:[T,w],E),n.animate({opacity:r?[1,0]:[0,1]},E)],k=!1,A=(e=!1)=>{b.remove(),t.style.visibility=D,O.forEach((t,n)=>{(!e||n!==2)&&t.cancel()})};return Promise.all(O.map(e=>e.finished)).then(()=>{k||(A(r),i())},()=>{k||(A(),i())}),()=>{k=!0,A()}}function He(e,t,n,r,i=()=>{}){let a=e?.getBoundingClientRect(),o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!o&&e?.isConnected&&t instanceof HTMLImageElement&&n&&a?.width&&a.height&&a.bottom>0&&a.top<window.innerHeight&&a.right>0&&a.left<window.innerWidth){let a=Ve(e,t,n,r,i);if(a)return a}if(!document.startViewTransition||o||!e?.isConnected||!t||!n||!a?.width||!a.height||a.bottom<=0||a.top>=window.innerHeight||a.right<=0||a.left>=window.innerWidth){if(!n?.animate||o)return i(),()=>{};let e=n.animate({opacity:r?[1,0]:[0,1]},{duration:150,fill:`forwards`}),t=!1;return e.finished.then(()=>{t||i()},()=>{}),()=>{t=!0,e.cancel()}}let s=e.style.viewTransitionName,c=t.style.viewTransitionName,l=n.style.visibility,u=!1,d=`yuri-media-preview`;e.style.viewTransitionName=r?`none`:d,t.style.viewTransitionName=r?d:`none`,r||(n.style.visibility=`hidden`);let f=document.startViewTransition(()=>{u||(e.style.viewTransitionName=r?d:`none`,t.style.viewTransitionName=r?`none`:d,n.style.visibility=r?`hidden`:l)}),p=()=>{e.style.viewTransitionName=s,t.style.viewTransitionName=c,n.style.visibility=l};f.ready.catch(()=>{});let m=()=>{u||(p(),i())};return f.finished.then(m,m),()=>{u=!0,f.skipTransition(),p()}}function Ue(e){let t=(0,K.c)(12),{onClose:n,isMobile:r,size:i}=e,{t:a}=O(),o;t[0]!==r||t[1]!==i?(o=r?{top:`calc(var(--yuri-safe-area-top, 0px) + 0.5rem)`,right:`calc(var(--yuri-safe-area-right, 0px) + 0.75rem)`}:{top:i?`calc(50% - ${i.height/2}px + 0.5rem)`:`0.5rem`,right:i?`calc(50% - ${i.width/2}px + 0.5rem)`:`0.5rem`},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a(`dialog.common.actions.close`),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(M,{name:`close`,className:`size-5`}),t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==s?(l=(0,J.jsx)(A,{variant:`mobileGlass`,size:`mobileIcon`,"aria-label":s,onClick:n,children:c}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,J.jsx)(`div`,{className:`absolute right-3 z-20`,style:o,children:l}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function We(e){let t=(0,K.c)(9),{children:n,isMobile:r}=e,i;t[0]===r?i=t[1]:(i=r?{bottom:`calc(var(--yuri-safe-area-bottom, 0px) + 0.75rem)`,right:`calc(var(--yuri-safe-area-right, 0px) + 0.75rem)`}:{bottom:`1rem`,left:`1rem`},t[0]=r,t[1]=i);let a=r?`mobile`:`desktop`,o=`pointer-events-auto flex items-center text-[var(--yuri-media-preview-foreground)] ${r?`gap-1.5`:`gap-2`}`,s;t[2]!==n||t[3]!==a||t[4]!==o?(s=(0,J.jsx)(`div`,{"data-media-preview-toolbar":a,className:o,onPointerDown:Ke,onDoubleClick:Ge,children:n}),t[2]=n,t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,J.jsx)(`div`,{className:`pointer-events-none absolute z-20`,style:i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function Ge(e){return e.stopPropagation()}function Ke(e){return e.stopPropagation()}function qe(e){let t=(0,K.c)(28),{open:n,title:r,kind:i,source:a,isMobile:o,onOpenChange:s,children:c}=e,l=q.useRef(null),u=q.useId(),d=q.useRef(null),f=q.useRef(!1),[p,m]=q.useState(!1),h;t[0]!==s||t[1]!==a?(h=()=>{if(f.current)return;f.current=!0,d.current?.();let e=l.current?.querySelector(`[data-preview-transition-target]`)??null;d.current=He(e?.dataset.previewReturn===`false`?void 0:a,e,l.current,!0,()=>{m(!0),s(!1)})},t[0]=s,t[1]=a,t[2]=h):h=t[2];let g=D(h),_=`${i}-preview`,v=n&&!p&&o,y;t[3]!==g||t[4]!==_||t[5]!==v?(y={id:_,active:v,layer:`overlay`,onBack:g,surfaceRef:l},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6],ge(y);let b,x;if(t[7]!==g||t[8]!==p||t[9]!==o||t[10]!==u||t[11]!==n||t[12]!==a?(b=()=>{if(!n){m(!1),f.current=!1;return}if(p)return;let e=l.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null,r=o?re.add({id:u,onClose:g},document.body):void 0;return e?.querySelector(`button`)?.focus({preventScroll:!0}),d.current=He(a,e?.querySelector(`[data-preview-transition-target]`)??null,e,!1),()=>{d.current?.(),d.current=null,f.current=!1,r?.(),t?.isConnected&&t.focus({preventScroll:!0})}},x=[p,n,a,o,u,g],t[7]=g,t[8]=p,t[9]=o,t[10]=u,t[11]=n,t[12]=a,t[13]=b,t[14]=x):(b=t[13],x=t[14]),q.useLayoutEffect(b,x),!n||p||typeof document>`u`)return null;let S=o?`var(--yuri-media-preview-background)`:`color-mix(in srgb, var(--yuri-media-preview-background) ${i===`mermaid`?90:70}%, transparent)`,C;t[15]===S?C=t[16]:(C={backgroundColor:S,color:`var(--yuri-media-preview-foreground)`},t[15]=S,t[16]=C);let w;t[17]===g?w=t[18]:(w=e=>{if(!e.currentTarget.contains(e.target)||(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g()),e.key!==`Tab`))return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex="0"]`)),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},t[17]=g,t[18]=w);let T;t[19]!==c||t[20]!==g?(T=c(g),t[19]=c,t[20]=g,t[21]=T):T=t[21];let E;return t[22]!==i||t[23]!==T||t[24]!==C||t[25]!==w||t[26]!==r?(E=(0,Be.createPortal)((0,J.jsx)(`div`,{ref:l,role:`dialog`,"aria-modal":`true`,"aria-label":r,"data-media-preview":i,"data-page-scroll-lock":`true`,tabIndex:-1,className:`fixed inset-0 z-[80] overflow-hidden select-none [-webkit-touch-callout:none]`,style:C,onClick:Je,onKeyDown:w,children:T}),document.body),t[22]=i,t[23]=T,t[24]=C,t[25]=w,t[26]=r,t[27]=E):E=t[27],E}function Je(e){e.stopPropagation()}var Ye=1048576,$=x(`YuriVideo`),Xe=e=>{let t=/^bytes=(\d*)-(\d*)$/.exec(e||`bytes=0-1048575`);if(!t||!t[1]&&!t[2])throw Error(`Invalid media range`);if(!t[1]){let e=Number(t[2]);if(!Number.isSafeInteger(e)||e<=0)throw Error(`Invalid media range`);return`bytes=-${Math.min(e,Ye)}`}let n=Number(t[1]),r=t[2]?Number(t[2]):n+Ye-1;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r)||r<n)throw Error(`Invalid media range`);return`bytes=${n}-${Math.min(r,n+Ye-1)}`},Ze=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)};async function Qe(e,n,r){if(!S.isNativePlatform()||S.getPlatform()!==`ios`||!S.isPluginAvailable(`YuriVideo`))return null;let i=o(),s=crypto.randomUUID(),l=new Map,u=!1,d=()=>{},f=()=>{},p=async()=>{if(!u){u=!0,d(),f(),r.removeEventListener(`abort`,m);for(let e of l.values())e.abort();l.clear(),await Promise.allSettled([g?.remove(),$.release({assetId:s})])}},m=()=>{p()},h=async t=>{if(t.assetId!==s||u)return;if(t.cancelled){l.get(t.requestId)?.abort();return}if(l.has(t.requestId))return;let a=new AbortController;l.set(t.requestId,a);let d;try{if(i!==o()||r.aborted)throw Error(`Video runtime changed`);let s=t.method===`HEAD`?`bytes=0-0`:Xe(t.range),l=new URLSearchParams(e.split(`?`)[1]??``);(n.query instanceof URLSearchParams?n.query:new URLSearchParams(n.query)).forEach((e,t)=>l.set(t,e));let f=l.get(`path`);d=e.split(`?`)[0]===`/api/fs/raw`&&f?await b({path:f,range:s,signal:a.signal,directory:new Headers(n.headers).get(`x-opencode-directory`)??l.get(`directory`)??void 0,allowOutsideWorkspace:l.get(`allowOutsideWorkspace`)===`true`,outsideFileGrant:l.get(`outsideFileGrant`)??void 0}):await c(e,{...n,headers:{Range:s},signal:a.signal});let p=d.headers.get(`content-range`)||``;if(d.status===416&&/^bytes \*\/\d+$/.test(p)){await $.respond({requestId:t.requestId,status:416,contentRange:p,dataBase64:``});return}let m=/^bytes (\d+)-(\d+)\/(\d+)$/.exec(p);if(d.status!==206||!m)throw Error(`Host does not support video ranges`);let[h,g,_]=m.slice(1).map(Number),v=g-h+1;if(![h,g,_].every(Number.isSafeInteger)||v<=0||v>1048576||g>=_)throw Error(`Invalid video range response`);let y=d.body?.getReader();if(!y)throw Error(`Missing video response body`);let x=new Uint8Array(v),S=0;try{for(;;){let{done:e,value:t}=await y.read();if(e)break;if(S+t.length>v)throw Error(`Oversized video range`);x.set(t,S),S+=t.length}}finally{await y.cancel().catch(()=>{}),y.releaseLock()}if(S!==v)throw Error(`Truncated video range`);if(u||a.signal.aborted||i!==o())return;let C=d.headers.get(`content-type`)?.split(`;`)[0]||`application/octet-stream`;await $.respond({requestId:t.requestId,status:t.method===`HEAD`?200:206,contentType:C,contentRange:t.method===`HEAD`?void 0:p,contentLength:t.method===`HEAD`?_:v,dataBase64:t.method===`HEAD`?``:Ze(x)})}catch{!u&&!a.signal.aborted&&await $.respond({requestId:t.requestId,status:502,dataBase64:``}).catch(()=>{})}finally{d?.body&&!d.body.locked&&await d.body.cancel().catch(()=>{}),l.delete(t.requestId)}},g=await $.addListener(`request`,e=>{h(e)});r.addEventListener(`abort`,m,{once:!0}),d=a(m),f=t(m);try{r.throwIfAborted();let{url:e}=await $.create({assetId:s});if(u||r.aborted)throw await $.release({assetId:s}),new DOMException(`Aborted`,`AbortError`);return{url:e,release:p}}catch(e){throw await p(),e}}var $e=`image/png`,et=x(`YuriMedia`),tt=e=>{let t=e.toLowerCase().split(`;`)[0]?.trim()||$e;if(t===`image/jpeg`||t===`image/jpg`)return`jpg`;if(t===`image/webp`)return`webp`;if(t===`image/gif`)return`gif`;if(t===`image/svg+xml`)return`svg`;if(t===`image/png`)return`png`;if(t===`video/quicktime`)return`mov`;let n=t.split(`/`)[1];return n&&/^[a-z0-9.+-]+$/i.test(n)?n:`png`},nt=(e,t)=>{let n=`${t.startsWith(`video/`)?`video`:`image`}.${tt(t)}`,r=(((e||``).trim()||n).split(/[\\/]/).pop()||n).replace(/[^\w.\- ()[\]]+/g,`_`).replace(/^\.+/,``);return r?/\.[a-z0-9]{1,8}$/i.test(r)?r:`${r}.${tt(t)}`:n},rt=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result==`string`){t(r.result);return}n(Error(`Failed to encode image`))},r.onerror=()=>n(r.error??Error(`Failed to encode image`)),r.readAsDataURL(e)}),it=async e=>{let t=await rt(e),n=t.indexOf(`,`);return n>=0?t.slice(n+1):t},at=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)},ot=async(e,t,n)=>{if(e.startsWith(`yuri-asset:`)){let r=await v(e,t,n);if(r)return r;if(p())throw Error(`Image display stream is no longer available`)}return y(e,t,n)},st=async(e,t,n)=>_({path:e,signal:t},n),ct=async(e,t,n)=>{let r=e.effectiveDirectory??``,i=null;e.prefetchedBlob&&e.prefetchedBlob.size>0&&(i=e.prefetchedBlob);let a=e.displayUrl?.trim();if(!i&&a&&(!/^https?:/i.test(a)||!L(P(e.sourceUrl,r))))try{i=await ot(a,t,n)}catch{t?.throwIfAborted(),i=null,n?.(0)}if(!i){let a=e.sourceUrl.trim();if(!a)throw Error(`Image source is empty`);if(/^(?:data|blob):/i.test(a)||/^https?:/i.test(a)||/^\/api(?=\/|[?#]|$)/.test(a))i=await ot(a,t,n);else{let e=P(a,r);i=L(e)?await st(e.path,t,n):await ot(e.source,t,n)}}if(!i||i.size<=0)throw Error(`Image is empty`);n?.(100);let o=(e.mimeType||(i.type&&/^(image|video)\//.test(i.type)?i.type:``)||(e.kind===`video`?`video/mp4`:``)||$e).split(`;`)[0].trim()||$e;return{blob:i,filename:nt(e.filename,o),mimeType:o}},lt=()=>!p()||S===void 0?!1:S.isPluginAvailable(`YuriMedia`),ut=async(e,t,n)=>{let r=P(e.sourceUrl,e.effectiveDirectory??``);if(l()&&e.kind===`video`&&!lt()){let e=s()?.files;if(L(r)&&e?.downloadFile)return t?.throwIfAborted(),await e.downloadFile(r.path),`saved`;throw Error(`Video download is unavailable for this source in VS Code`)}if(L(r)&&!e.prefetchedBlob&&!/^(?:blob|data|yuri-asset):/i.test(e.displayUrl??``)&&!lt()&&!l())return await w({path:r.path,filename:e.filename,signal:t},n),`downloaded`;let{blob:i,filename:a,mimeType:o}=await ct(e,t,n);if(t?.throwIfAborted(),lt()){let n=await it(i);if(t?.throwIfAborted(),e.kind===`video`){if((await et.saveFile({dataBase64:n,mimeType:o,filename:a}))?.cancelled)throw new DOMException(`Save cancelled`,`AbortError`);return`saved`}return await et.saveImage({dataBase64:n,mimeType:o,filename:a}),`saved`}if(l()){let e=s()?.vscode;if(e?.saveImage){let t=await rt(i);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return at(i,a),`downloaded`};function dt(e){let t=(0,K.c)(34),{target:n,isMobile:r}=e,{t:i}=O(),[a,o]=q.useState(`idle`),[s,c]=q.useState(0),l=q.useRef(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>l.current?.abort(),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),q.useEffect(u,d);let f;t[2]===n?f=t[3]:(f=async()=>{if(l.current)return;let e=new AbortController;l.current=e,o(`saving`),c(0);try{await ut(n,e.signal,t=>{e.signal.aborted||c(t)}),e.signal.aborted||o(`saved`)}catch(t){let n=t;if(e.signal.aborted)return;l.current=null,o(n instanceof DOMException&&n.name===`AbortError`?`idle`:`error`)}},t[2]=n,t[3]=f);let p=D(f),m=a===`saving`,h=a===`saved`,g;t[4]!==h||t[5]!==m||t[6]!==i||t[7]!==n?(g=i(m?`chat.image.actions.saving`:h?`filesView.editor.saved`:n.kind===`video`?`filesView.editor.saveFile`:`chat.image.actions.saveImage`),t[4]=h,t[5]=m,t[6]=i,t[7]=n,t[8]=g):g=t[8];let _=g,v=r?`ghost`:`mobileGlass`,y=r?`icon`:`mobileIcon`,b=m||h,x;t[9]!==r||t[10]!==_||t[11]!==s||t[12]!==h||t[13]!==m?(x=m?(0,J.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:r?`size-4`:`size-6`,role:`progressbar`,"aria-label":_,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s??void 0,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:[(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`0.25`}),(0,J.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,pathLength:`100`,strokeDasharray:`${s??0} 100`,transform:`rotate(-90 12 12)`})]}):h?(0,J.jsx)(M,{name:`check`,weight:`medium`,className:r?`size-4`:`size-6`}):(0,J.jsx)(M,{name:`download-2-fill`,className:r?`size-4`:`size-6`}),t[9]=r,t[10]=_,t[11]=s,t[12]=h,t[13]=m,t[14]=x):x=t[14];let S;t[15]!==_||t[16]!==p||t[17]!==m||t[18]!==a||t[19]!==v||t[20]!==y||t[21]!==b||t[22]!==x?(S=(0,J.jsx)(A,{variant:v,size:y,"data-media-save":a,className:`rounded-full [corner-shape:round] disabled:opacity-100`,"aria-label":_,"aria-busy":m,disabled:b,onClick:p,children:x}),t[15]=_,t[16]=p,t[17]=m,t[18]=a,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S):S=t[23];let C;t[24]!==_||t[25]!==a||t[26]!==i||t[27]!==n?(C=a===`error`?i(n.kind===`video`?`filesView.toast.saveFailed`:`chat.image.actions.saveFailed`):a===`idle`?``:_,t[24]=_,t[25]=a,t[26]=i,t[27]=n,t[28]=C):C=t[28];let w;t[29]===C?w=t[30]:(w=(0,J.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:C}),t[29]=C,t[30]=w);let T;return t[31]!==w||t[32]!==S?(T=(0,J.jsxs)(J.Fragment,{children:[S,w]}),t[31]=w,t[32]=S,t[33]=T):T=t[33],T}function ft({video:e,onClose:t,isMobile:a}){let{t:o}=O(),s=se()??``,c=e.directory??s,l=F(),u=P(e.url,c),d=L(u)?u.path:``,f=/^\/api(?=\/|[?#]|$)/.test(e.url)?e.url:``,p=!!(d||f),m=`${l}\n${c}\n${e.url}`,[h,v]=q.useState();q.useEffect(()=>{if(!p)return;let e=new AbortController,t;return Qe(f||`/api/fs/raw`,{query:d?{path:d}:void 0},e.signal).then(async n=>{if(e.signal.aborted){await n?.release();return}t=n?.release,v({key:m,url:n?.url,unsupported:!n})}).catch(()=>{e.signal.aborted||v({key:m,error:!0})}),()=>{e.abort(),t?.()}},[p,d,f,m]);let b=h?.key===m?h:void 0,[x,S]=q.useState(0);q.useEffect(()=>{if(!p||i())return;let e=n(),t=r(()=>S(e=>e+1));return()=>{t(),e()}},[p,l]);let w=g({queryKey:[`video-preview`,l,c,e.url,x],enabled:p&&b?.unsupported===!0,gcTime:0,staleTime:1/0,retry:!1,queryFn:async({signal:e})=>{if(!i()){let t=await C(f||`/api/fs/raw`,d?{path:d}:void 0);return e.throwIfAborted(),{url:t,blob:void 0}}return{blob:d?await _({path:d,signal:e}):await y(f,e),url:void 0}}}),[T,E]=q.useState(null);q.useEffect(()=>{if(!w.data?.blob)return;let e=URL.createObjectURL(w.data.blob);return E({blob:w.data.blob,url:e}),()=>URL.revokeObjectURL(e)},[w.data]);let D=p?b?.url||w.data?.url||(T?.blob===w.data?.blob?T?.url:``):u.source,[k,A]=q.useState(),j=b?.error||w.isError||!!(D&&k===D);return(0,J.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 p-4`,children:[(0,J.jsx)(Ue,{onClose:t,isMobile:a}),!D&&!j&&(0,J.jsx)(`p`,{role:`status`,children:o(`common.loading`)}),j&&(0,J.jsx)(`p`,{role:`alert`,children:o(`filesView.error.readFileFailed`)}),D&&(0,J.jsx)(`video`,{src:D,controls:!0,playsInline:!0,preload:`metadata`,"aria-label":e.filename,className:`max-h-[80dvh] w-full max-w-5xl object-contain`,onError:()=>A(D),controlsList:`nodownload`,onContextMenu:e=>e.preventDefault()},D),(0,J.jsx)(We,{isMobile:a,children:(0,J.jsx)(dt,{isMobile:a,target:{kind:`video`,sourceUrl:e.url,displayUrl:b?.url||w.data?.url?void 0:D,filename:e.filename,mimeType:e.mimeType,effectiveDirectory:c,prefetchedBlob:w.data?.blob}},m)})]})}var pt=400,mt=(e,t)=>new Se(e,t),ht=e=>{let t=`h-3.5 w-3.5 flex-shrink-0`,n=e.toLowerCase();return n===`reasoning`?(0,J.jsx)(M,{name:`brain-ai-3`,className:t}):n===`image-preview`?(0,J.jsx)(M,{name:`file-image`,className:t}):n===`mermaid-preview`?(0,J.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,J.jsx)(M,{name:`pencil-ai`,className:t}):n===`write`||n===`create`||n===`file_write`||n===`read`||n===`view`||n===`file_read`||n===`cat`?(0,J.jsx)(M,{name:`file-pdf`,className:t}):n===`bash`||n===`shell`||n===`cmd`||n===`terminal`?(0,J.jsx)(M,{name:`terminal-box`,className:t}):n===`list`||n===`ls`||n===`dir`||n===`list_files`?(0,J.jsx)(M,{name:`folder-6`,className:t}):n===`search`||n===`grep`||n===`find`||n===`ripgrep`?(0,J.jsx)(M,{name:`search`,className:t}):n===`glob`?(0,J.jsx)(M,{name:`file-search`,className:t}):n===`fetch`||n===`curl`||n===`wget`||n===`webfetch`?(0,J.jsx)(M,{name:`global`,className:t}):n===`web-search`||n===`websearch`||n===`search_web`||n===`google`||n===`bing`||n===`duckduckgo`?(0,J.jsx)(M,{name:`search`,className:t}):n===`todowrite`||n===`todoread`?(0,J.jsx)(M,{name:`list-check-3`,className:t}):n.startsWith(`git`)?(0,J.jsx)(M,{name:`git-branch`,className:t}):(0,J.jsx)(M,{name:`tools`,className:t})},gt={style:{background:`transparent`,backgroundColor:`transparent`,fontSize:`inherit`}},_t={download:!1,copy:!1,showPanZoomControls:!0},vt=`
3
3
  [data-diff-header],
4
4
  [data-diff] {
@@ -1 +1 @@
1
- import{a as e}from"./vendor-zustand-o69pgTEK.js";import{n as t,t as n}from"./platform-7bX6qtBV.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{a as r,n as i}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as a}from"./vendor-pierre-diffs-DPBtNDJ5.js";import{o}from"./useMobileNavigationStore-ByrZJd5L.js";import{t as s}from"./agentColors-DWSbQXy2.js";import{t as c}from"./rasterizePng-056Poix7.js";var l=`yuri.iosNativeUi`,u=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(l)===`1`}catch{return!1}},d=e=>{if(!(typeof window>`u`))try{e?window.localStorage.setItem(l,`1`):window.localStorage.removeItem(l)}catch{}},f=e(e=>({enabled:u(),setEnabled:t=>{d(t),e({enabled:t})}})),p=()=>f.getState().enabled,m=()=>f(te),ee=()=>t()&&n()===`ios`;function te(e){return e.enabled}var h=5,g=Math.ceil(h/2);function _(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t>>>0}function ne(e){let t=Array.from({length:h},()=>Array.from({length:h},()=>!1));if(!e)return t;let n=_(e);for(let e=0;e<h;e++)for(let r=0;r<g;r++){let i=(n&1)==1;n>>>=1,t[e][r]=i,t[e][4-r]=i}return t}var re=`yuri-native-ios-composer`,v=`--yuri-native-composer-height`,y=`--yuri-native-composer-accessory`,b=33554432,x=`YuriComposer`,S=`#22c55e`,C=32,w=()=>({open:!1,highlightedIndex:0,query:``,highlightColor:``,rows:[]}),T=()=>({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:S,agentIdenticon:Array.from({length:25},()=>0),agentIcon:``,suppressed:!0,showScrollToBottom:!1,scrollAria:``,autocomplete:w()}),ie=r(x),ae=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.isMobile&&e.nativeUiEnabled!==!1;function oe(e){return typeof window>`u`?!1:ae({isCapacitor:t(),platform:n(),pluginAvailable:i.isPluginAvailable(x),isMobile:e,nativeUiEnabled:p()})}var se=e=>e.classList.contains(`dark`)?`dark`:`light`,ce=e=>{let t=e?.height;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:t},le=(e,t)=>{if(!(t>0)){e.style.removeProperty(v);return}e.style.setProperty(v,`${Math.round(t)}px`)},ue=(e,t)=>{if(!(t>0)){e.style.removeProperty(y);return}e.style.setProperty(y,`${Math.round(t)}px`)},E=(e,t)=>{e.classList.toggle(re,t),t||(e.style.removeProperty(v),e.style.removeProperty(y))},de=e=>ne(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 S;!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,S),S;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},fe=e=>k(s(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.agentIcon===t.agentIcon&&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.query===t.query&&e.highlightColor===t.highlightColor&&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)}),F=(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},I=(e,t)=>e.map(e=>({start:e.start,end:e.end,triggerLength:e.triggerLength,color:t})),L=e=>e.map(e=>`${e.id}:${e.filename}:${e.mimeType}:${e.dataUrl?.length??0}`).join(`|`),R=e=>{let t=e?.id;return typeof t==`string`&&t.trim()?t:``},z=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},B=e=>{let t=z(e?.selectionStart);if(t===null)return null;let n=z(e?.selectionEnd);return{start:t,end:n!==null&&n>=t?n:t}},V=e=>z(e?.index)??0,pe=(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))},me=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},he=e=>e.replacedText!==null&&e.incoming===e.replacedText,ge=e=>setTimeout(e,0),_e=e=>{e.applyDocument(e.text),ge(e.submit)},H=(e,t)=>e===t,ve=(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`,H),a(`modelLabel`,H),a(`modelVariantLabel`,H),a(`modelIcon`,H),a(`canSend`,H),a(`canAbort`,H),a(`attachmentCount`,H),a(`attachmentPreviews`,M),a(`citationRanges`,N),a(`chipRanges`,P),a(`appearance`,H),a(`attachAria`,H),a(`attachTitle`,H),a(`attachPhotosLabel`,H),a(`attachFilesLabel`,H),a(`attachCancelLabel`,H),a(`sendAria`,H),a(`queueAria`,H),a(`stopAria`,H),a(`modelAria`,H),a(`agentAria`,H),a(`agentLabel`,H),a(`agentColor`,H),a(`agentIdenticon`,(e,t)=>e.join(``)===t.join(``)),a(`agentIcon`,H),a(`suppressed`,H),a(`showScrollToBottom`,H),a(`scrollAria`,H),a(`autocomplete`,j),Object.keys(i).length===0?null:i},ye=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},be=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}},xe=(e,t=b)=>{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=be(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},U=80,Se=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=U,e.height=U;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,U,U),r.drawImage(n,0,0,U,U);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}),Ce=e=>c(e,C),W=()=>ie,G=((e=W)=>{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,B(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`,xe(t),ye(t)),e().focus()}),t.addListener(`removeAttachment`,e=>{let t=R(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`,ce(e))}),t.addListener(`scrollToBottom`,()=>{l(`onScrollToBottom`)}),t.addListener(`autocompleteAccept`,e=>{l(`onAutocompleteAccept`,V(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(T()))},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();let r=s||t>0;t=0,s=!1,o=!1,i=null,E(n,!1),r&&e().dismiss()},snapshot(){return{retainCount:t,listenerCount:r.length,hidePending:n!==null,concealed:o,warmed:s}}}})(),we=()=>r(`YuriNavigation`),K=e=>e?.kind===`chat`||e?.kind===`draft`,q=e=>e?e.kind===`draft`||e.kind===`chat`&&e.routes.length<=1:!1,Te=(e,t)=>K(e)&&!K(t),Ee=(e=G)=>{q(o.getState().secondary)&&e.conceal()},De=(e=G)=>{let t=o.subscribe((t,n)=>{Te(n.secondary,t.secondary)&&e.conceal()}),n=[],r=!1;return i.getPlatform()===`ios`&&(async()=>{let t=we(),i=await t.addListener(`backStarted`,()=>{q(o.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=[]}},Oe=e=>/^#[0-9a-fA-F]{6}$/.test(e),ke=e=>/^#[0-9a-fA-F]{8}$/.test(e),Ae=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?Oe(e)?`${e}${t}`:ke(e)?`${e.slice(0,7)}${t}`:e:e,J=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,je=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>J(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}}]},Y=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=J(a.diffAddedBackground,r.successBackground),s=J(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":J(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":Ae(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":J(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":J(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":J(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":J(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":J(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":J(a.diffRemoved,r.error),"terminal.ansiGreen":J(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":J(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":J(e.colors.primary.foreground,t.background),"badge.foreground":J(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":J(e.colors.primary.foreground,t.background)}};function Me(e){return{name:e.metadata.name,type:e.metadata.variant,colors:Y(e),tokenColors:je(e)}}var Ne=e=>/^#[0-9a-fA-F]{8}$/.test(e),X=e=>Ne(e)?e.slice(0,7):e;function Pe(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 Z=new Map,Q=new Set,Fe=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?X(n):void 0,a=r?X(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return Pe({...e,name:t,fg:a,bg:i,settings:o},t)},Ie=e=>Me(e),$=e=>{let t=Z.get(e.metadata.id);if(t)return t;let n=Fe(Ie(e),e.metadata.id);return Z.set(e.metadata.id,n),n},Le=e=>{let t=e.metadata.id;if(Q.has(t))return;let n=$(e);a(t,async()=>n),Q.add(t)};export{p as A,Ce as C,E as D,me as E,f as M,he as O,Se as S,k as T,F as _,G as a,se as b,le as c,ve as d,oe as f,j as g,_e as h,Ee as i,m as j,ee as k,L as l,W as m,$ as n,v as o,w as p,De as r,ue as s,Le as t,I as u,A as v,pe as w,de as x,fe as y};
1
+ import{a as e}from"./vendor-zustand-o69pgTEK.js";import{n as t,t as n}from"./platform-7bX6qtBV.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{a as r,n as i}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as a}from"./vendor-pierre-diffs-DPBtNDJ5.js";import{o}from"./useMobileNavigationStore-BURkCJuM.js";import{t as s}from"./agentColors-DWSbQXy2.js";import{t as c}from"./rasterizePng-056Poix7.js";var l=`yuri.iosNativeUi`,u=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(l)===`1`}catch{return!1}},d=e=>{if(!(typeof window>`u`))try{e?window.localStorage.setItem(l,`1`):window.localStorage.removeItem(l)}catch{}},f=e(e=>({enabled:u(),setEnabled:t=>{d(t),e({enabled:t})}})),p=()=>f.getState().enabled,m=()=>f(te),ee=()=>t()&&n()===`ios`;function te(e){return e.enabled}var h=5,g=Math.ceil(h/2);function _(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t>>>0}function ne(e){let t=Array.from({length:h},()=>Array.from({length:h},()=>!1));if(!e)return t;let n=_(e);for(let e=0;e<h;e++)for(let r=0;r<g;r++){let i=(n&1)==1;n>>>=1,t[e][r]=i,t[e][4-r]=i}return t}var re=`yuri-native-ios-composer`,v=`--yuri-native-composer-height`,y=`--yuri-native-composer-accessory`,b=33554432,x=`YuriComposer`,S=`#22c55e`,C=32,w=()=>({open:!1,highlightedIndex:0,query:``,highlightColor:``,rows:[]}),T=()=>({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:S,agentIdenticon:Array.from({length:25},()=>0),agentIcon:``,suppressed:!0,showScrollToBottom:!1,scrollAria:``,autocomplete:w()}),ie=r(x),ae=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.isMobile&&e.nativeUiEnabled!==!1;function oe(e){return typeof window>`u`?!1:ae({isCapacitor:t(),platform:n(),pluginAvailable:i.isPluginAvailable(x),isMobile:e,nativeUiEnabled:p()})}var se=e=>e.classList.contains(`dark`)?`dark`:`light`,ce=e=>{let t=e?.height;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:t},le=(e,t)=>{if(!(t>0)){e.style.removeProperty(v);return}e.style.setProperty(v,`${Math.round(t)}px`)},ue=(e,t)=>{if(!(t>0)){e.style.removeProperty(y);return}e.style.setProperty(y,`${Math.round(t)}px`)},E=(e,t)=>{e.classList.toggle(re,t),t||(e.style.removeProperty(v),e.style.removeProperty(y))},de=e=>ne(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 S;!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,S),S;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},fe=e=>k(s(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.agentIcon===t.agentIcon&&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.query===t.query&&e.highlightColor===t.highlightColor&&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)}),F=(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},I=(e,t)=>e.map(e=>({start:e.start,end:e.end,triggerLength:e.triggerLength,color:t})),L=e=>e.map(e=>`${e.id}:${e.filename}:${e.mimeType}:${e.dataUrl?.length??0}`).join(`|`),R=e=>{let t=e?.id;return typeof t==`string`&&t.trim()?t:``},z=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},B=e=>{let t=z(e?.selectionStart);if(t===null)return null;let n=z(e?.selectionEnd);return{start:t,end:n!==null&&n>=t?n:t}},V=e=>z(e?.index)??0,pe=(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))},me=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},he=e=>e.replacedText!==null&&e.incoming===e.replacedText,ge=e=>setTimeout(e,0),_e=e=>{e.applyDocument(e.text),ge(e.submit)},H=(e,t)=>e===t,ve=(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`,H),a(`modelLabel`,H),a(`modelVariantLabel`,H),a(`modelIcon`,H),a(`canSend`,H),a(`canAbort`,H),a(`attachmentCount`,H),a(`attachmentPreviews`,M),a(`citationRanges`,N),a(`chipRanges`,P),a(`appearance`,H),a(`attachAria`,H),a(`attachTitle`,H),a(`attachPhotosLabel`,H),a(`attachFilesLabel`,H),a(`attachCancelLabel`,H),a(`sendAria`,H),a(`queueAria`,H),a(`stopAria`,H),a(`modelAria`,H),a(`agentAria`,H),a(`agentLabel`,H),a(`agentColor`,H),a(`agentIdenticon`,(e,t)=>e.join(``)===t.join(``)),a(`agentIcon`,H),a(`suppressed`,H),a(`showScrollToBottom`,H),a(`scrollAria`,H),a(`autocomplete`,j),Object.keys(i).length===0?null:i},ye=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},be=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}},xe=(e,t=b)=>{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=be(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},U=80,Se=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=U,e.height=U;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,U,U),r.drawImage(n,0,0,U,U);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}),Ce=e=>c(e,C),W=()=>ie,G=((e=W)=>{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,B(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`,xe(t),ye(t)),e().focus()}),t.addListener(`removeAttachment`,e=>{let t=R(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`,ce(e))}),t.addListener(`scrollToBottom`,()=>{l(`onScrollToBottom`)}),t.addListener(`autocompleteAccept`,e=>{l(`onAutocompleteAccept`,V(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(T()))},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();let r=s||t>0;t=0,s=!1,o=!1,i=null,E(n,!1),r&&e().dismiss()},snapshot(){return{retainCount:t,listenerCount:r.length,hidePending:n!==null,concealed:o,warmed:s}}}})(),we=()=>r(`YuriNavigation`),K=e=>e?.kind===`chat`||e?.kind===`draft`,q=e=>e?e.kind===`draft`||e.kind===`chat`&&e.routes.length<=1:!1,Te=(e,t)=>K(e)&&!K(t),Ee=(e=G)=>{q(o.getState().secondary)&&e.conceal()},De=(e=G)=>{let t=o.subscribe((t,n)=>{Te(n.secondary,t.secondary)&&e.conceal()}),n=[],r=!1;return i.getPlatform()===`ios`&&(async()=>{let t=we(),i=await t.addListener(`backStarted`,()=>{q(o.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=[]}},Oe=e=>/^#[0-9a-fA-F]{6}$/.test(e),ke=e=>/^#[0-9a-fA-F]{8}$/.test(e),Ae=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?Oe(e)?`${e}${t}`:ke(e)?`${e.slice(0,7)}${t}`:e:e,J=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,je=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>J(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}}]},Y=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=J(a.diffAddedBackground,r.successBackground),s=J(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":J(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":Ae(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":J(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":J(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":J(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":J(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":J(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":J(a.diffRemoved,r.error),"terminal.ansiGreen":J(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":J(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":J(e.colors.primary.foreground,t.background),"badge.foreground":J(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":J(e.colors.primary.foreground,t.background)}};function Me(e){return{name:e.metadata.name,type:e.metadata.variant,colors:Y(e),tokenColors:je(e)}}var Ne=e=>/^#[0-9a-fA-F]{8}$/.test(e),X=e=>Ne(e)?e.slice(0,7):e;function Pe(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 Z=new Map,Q=new Set,Fe=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?X(n):void 0,a=r?X(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return Pe({...e,name:t,fg:a,bg:i,settings:o},t)},Ie=e=>Me(e),$=e=>{let t=Z.get(e.metadata.id);if(t)return t;let n=Fe(Ie(e),e.metadata.id);return Z.set(e.metadata.id,n),n},Le=e=>{let t=e.metadata.id;if(Q.has(t))return;let n=$(e);a(t,async()=>n),Q.add(t)};export{p as A,Ce as C,E as D,me as E,f as M,he as O,Se as S,k as T,F as _,G as a,se as b,le as c,ve as d,oe as f,j as g,_e as h,Ee as i,m as j,ee as k,L as l,W as m,$ as n,v as o,w as p,De as r,ue as s,Le as t,I as u,A as v,pe as w,de as x,fe as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Xt as t,Zt as n,en as r}from"./persistence-Dzooc9Xg.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{a as s,i as c,o as l,t as u}from"./store-szlu5Wxv.js";import{n as d,t as f}from"./vendor-class-variance-authority-BLUaYARZ.js";import{t as p}from"./vendor-tailwind-merge-BicNWLTg.js";var m=e(i(),1),h=o(),g=async(e,r)=>{if(!t())throw Error(`Desktop runtime is not available`);return n(e,r)},_=async()=>{if(r())try{await g(`desktop_start_window_drag`)}catch{}},v=async e=>{if(r())try{await g(`desktop_set_window_title`,{title:e})}catch{}},y=async(e,t)=>{if(r())try{await g(`desktop_set_window_theme`,{themeMode:e,themeVariant:t})}catch{}},ee=async e=>{if(r())try{await g(`desktop_set_menu_locale`,{locale:e})}catch{}},b=async()=>{if(!r())return null;try{let e=await g(`desktop_get_app_version`);return typeof e==`string`&&e.trim().length>0?e:null}catch{return null}},x=m.createContext(null),S=a(),C=e=>{let t=(0,h.c)(19),{children:n}=e,r=c(w),i=c(te),a=c(T),o=c(ne),d,f;t[0]===r?(d=t[1],f=t[2]):(d=()=>{typeof document>`u`||(document.documentElement.lang=r)},f=[r],t[0]=r,t[1]=d,t[2]=f),m.useEffect(d,f);let p,g;t[3]!==a||t[4]!==r?(p=()=>{a===null&&ee(r)},g=[r,a],t[3]=a,t[4]=r,t[5]=p,t[6]=g):(p=t[5],g=t[6]),m.useEffect(p,g);let _;t[7]===i?_=t[8]:(_=(e,t)=>u(i,e,t),t[7]=i,t[8]=_);let v=_,y;t[9]===v?y=t[10]:(y=e=>v(l[e]),t[9]=v,t[10]=y);let b;t[11]!==r||t[12]!==o||t[13]!==v||t[14]!==y?(b={locale:r,locales:s,setLocale:o,label:y,t:v},t[11]=r,t[12]=o,t[13]=v,t[14]=y,t[15]=b):b=t[15];let C=b,E;return t[16]!==n||t[17]!==C?(E=(0,S.jsx)(x.Provider,{value:C,children:n}),t[16]=n,t[17]=C,t[18]=E):E=t[18],E};function w(e){return e.locale}function te(e){return e.dictionary}function T(e){return e.loadingLocale}function ne(e){return e.setLocale}var E={startingApi:`Starting OpenCode API…`,initializing:`Initializing…`,connecting:`Connecting…`,connected:`Connected!`,connectionError:`Connection error`,disconnected:`Disconnected`,reconnecting:`Reconnecting…`,initialDataLoadFailed:`OpenCode connected, but initial data load failed.`,cliNotFound:`OpenCode CLI not found. Please install it first.`,providersReady:`✓ Providers`,providersLoading:`… Providers`,agentsReady:`✓ Agents`,agentsLoading:`… Agents`,startingDevServer:e=>`Starting webview dev server (${e})...`,waitingDevServer:(e,t)=>`Waiting for webview dev server (${e})... attempt ${t}`,loadingData:(e,t)=>`Loading data (${e}, ${t})…`},re={startingApi:`Démarrage de l’API OpenCode…`,initializing:`Initialisation…`,connecting:`Connexion…`,connected:`Connecté !`,connectionError:`Erreur de connexion`,disconnected:`Déconnecté`,reconnecting:`Reconnexion…`,initialDataLoadFailed:`OpenCode est connecté, mais le chargement initial des données a échoué.`,cliNotFound:`L’interface en ligne de commande OpenCode est introuvable. Veuillez l’installer d’abord.`,providersReady:`✓ Fournisseurs`,providersLoading:`… Fournisseurs`,agentsReady:`✓ Agents`,agentsLoading:`… Agents`,startingDevServer:e=>`Démarrage du serveur de développement de la webview (${e})...`,waitingDevServer:(e,t)=>`En attente du serveur de développement de la webview (${e})... tentative ${t}`,loadingData:(e,t)=>`Chargement des données (${e}, ${t})…`},D={startingApi:`正在启动 OpenCode API…`,initializing:`正在初始化…`,connecting:`正在连接…`,connected:`已连接!`,connectionError:`连接错误`,disconnected:`已断开连接`,reconnecting:`正在重新连接…`,initialDataLoadFailed:`OpenCode 已连接,但初始数据加载失败。`,cliNotFound:`未找到 OpenCode CLI。请先安装它。`,providersReady:`✓ 提供商`,providersLoading:`… 提供商`,agentsReady:`✓ Agent`,agentsLoading:`… Agent`,startingDevServer:e=>`正在启动 webview 开发服务器 (${e})...`,waitingDevServer:(e,t)=>`正在等待 webview 开发服务器 (${e})... 第 ${t} 次尝试`,loadingData:(e,t)=>`正在加载数据 (${e}, ${t})…`},O={startingApi:`正在啟動 OpenCode API…`,initializing:`正在初始化…`,connecting:`正在連線…`,connected:`已連線!`,connectionError:`連線錯誤`,disconnected:`已中斷連線`,reconnecting:`正在重新連線…`,initialDataLoadFailed:`OpenCode 已連線,但初始資料載入失敗。`,cliNotFound:`找不到 OpenCode CLI。請先安裝。`,providersReady:`✓ 提供者`,providersLoading:`… 提供者`,agentsReady:`✓ 代理`,agentsLoading:`… 代理`,startingDevServer:e=>`正在啟動 webview 開發伺服器 (${e})...`,waitingDevServer:(e,t)=>`正在等待 webview 開發伺服器 (${e})... 第 ${t} 次嘗試`,loadingData:(e,t)=>`正在載入資料 (${e}, ${t})…`},k={startingApi:`Запуск OpenCode API…`,initializing:`Ініціалізація…`,connecting:`Підключення…`,connected:`Підключено!`,connectionError:`Помилка підключення`,disconnected:`Відключено`,reconnecting:`Повторне підключення…`,initialDataLoadFailed:`OpenCode підключено, але початкове завантаження даних не вдалося.`,cliNotFound:`OpenCode CLI не знайдено. Спершу встановіть його.`,providersReady:`✓ Провайдери`,providersLoading:`… Провайдери`,agentsReady:`✓ Агенти`,agentsLoading:`… Агенти`,startingDevServer:e=>`Запуск dev-сервера webview (${e})...`,waitingDevServer:(e,t)=>`Очікування dev-сервера webview (${e})... спроба ${t}`,loadingData:(e,t)=>`Завантаження даних (${e}, ${t})…`},A={startingApi:`Iniciando la API de OpenCode…`,initializing:`Inicializando…`,connecting:`Conectando…`,connected:`¡Conectado!`,connectionError:`Error de conexión`,disconnected:`Desconectado`,reconnecting:`Reconectando…`,initialDataLoadFailed:`OpenCode se conectó, pero falló la carga inicial de datos.`,cliNotFound:`No se encontró OpenCode CLI. Instálalo primero.`,providersReady:`✓ Proveedores`,providersLoading:`… Proveedores`,agentsReady:`✓ Agentes`,agentsLoading:`… Agentes`,startingDevServer:e=>`Iniciando el servidor de desarrollo de webview (${e})...`,waitingDevServer:(e,t)=>`Esperando el servidor de desarrollo de webview (${e})... intento ${t}`,loadingData:(e,t)=>`Cargando datos (${e}, ${t})…`},j={startingApi:`Iniciando a API do OpenCode…`,initializing:`Inicializando…`,connecting:`Conectando…`,connected:`Conectado!`,connectionError:`Erro de conexão`,disconnected:`Desconectado`,reconnecting:`Reconectando…`,initialDataLoadFailed:`OpenCode conectado, mas o carregamento inicial dos dados falhou.`,cliNotFound:`OpenCode CLI não encontrado. Instale-o primeiro.`,providersReady:`✓ Provedores`,providersLoading:`… Provedores`,agentsReady:`✓ Agentes`,agentsLoading:`… Agentes`,startingDevServer:e=>`Iniciando o servidor de desenvolvimento da webview (${e})...`,waitingDevServer:(e,t)=>`Aguardando o servidor de desenvolvimento da webview (${e})... tentativa ${t}`,loadingData:(e,t)=>`Carregando dados (${e}, ${t})…`},M={startingApi:`OpenCode API 시작 중…`,initializing:`초기화 중…`,connecting:`연결 중…`,connected:`연결됨!`,connectionError:`연결 오류`,disconnected:`연결 끊김`,reconnecting:`다시 연결 중…`,initialDataLoadFailed:`OpenCode에 연결되었지만 초기 데이터 로드에 실패했습니다.`,cliNotFound:`OpenCode CLI를 찾을 수 없습니다. 먼저 설치하세요.`,providersReady:`✓ 공급자`,providersLoading:`… 공급자`,agentsReady:`✓ 에이전트`,agentsLoading:`… 에이전트`,startingDevServer:e=>`webview 개발 서버 시작 중 (${e})...`,waitingDevServer:(e,t)=>`webview 개발 서버 대기 중 (${e})... ${t}번째 시도`,loadingData:(e,t)=>`데이터 로드 중 (${e}, ${t})…`},N={startingApi:`Uruchamianie API OpenCode…`,initializing:`Inicjalizacja…`,connecting:`Łączenie…`,connected:`Połączono!`,connectionError:`Błąd połączenia`,disconnected:`Rozłączono`,reconnecting:`Ponowne łączenie…`,initialDataLoadFailed:`OpenCode połączony, ale początkowe ładowanie danych nie powiodło się.`,cliNotFound:`Nie znaleziono OpenCode CLI. Najpierw go zainstaluj.`,providersReady:`✓ Dostawcy`,providersLoading:`… Dostawcy`,agentsReady:`✓ Agenci`,agentsLoading:`… Agenci`,startingDevServer:e=>`Uruchamianie serwera deweloperskiego webview (${e})...`,waitingDevServer:(e,t)=>`Oczekiwanie na serwer deweloperski webview (${e})... próba ${t}`,loadingData:(e,t)=>`Ładowanie danych (${e}, ${t})…`},P={startingApi:`OpenCode API を起動中…`,initializing:`初期化中…`,connecting:`接続中…`,connected:`接続完了!`,connectionError:`接続エラー`,disconnected:`切断されました`,reconnecting:`再接続中…`,initialDataLoadFailed:`OpenCode に接続しましたが、初期データの読み込みに失敗しました。`,cliNotFound:`OpenCode CLI が見つかりません。先にインストールしてください。`,providersReady:`✓ プロバイダ`,providersLoading:`… プロバイダ`,agentsReady:`✓ エージェント`,agentsLoading:`… エージェント`,startingDevServer:e=>`Webview 開発サーバーを起動中 (${e})...`,waitingDevServer:(e,t)=>`Webview 開発サーバーを待機中 (${e})... 試行 ${t}`,loadingData:(e,t)=>`データを読み込み中 (${e}, ${t})…`},F=e=>I[e],I={en:E,fr:re,"zh-CN":D,"zh-TW":O,uk:k,es:A,"pt-BR":j,ko:M,pl:N,ja:P},L={en:`en-US`,fr:`fr-FR`,"zh-CN":`zh-CN`,"zh-TW":`zh-TW`,uk:`uk-UA`,es:`es-ES`,"pt-BR":`pt-BR`,ko:`ko-KR`,pl:`pl-PL`,ja:`ja-JP`},R=e=>L[e]??`en-US`,z=()=>R(c.getState().locale);function B(){let e=m.useContext(x);if(!e)throw Error(`useI18n must be used within I18nProvider`);return e}async function V(e){let t=null;if(typeof navigator<`u`&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),{ok:!0,method:`clipboard`}}catch(e){t=e instanceof Error?e.message:String(e)}if(typeof document<`u`&&document.body){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.left=`-1000px`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);let n=document.execCommand(`copy`);if(document.body.removeChild(t),n)return{ok:!0,method:`execCommand`}}return{ok:!1,error:t??`Clipboard access denied in current context`}}function H(...e){return p(d(e))}var U=()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),W=()=>typeof navigator>`u`?!1:/Windows/.test(navigator.userAgent||``),G=()=>U()?`common.revealPath.finder`:W()?`common.revealPath.fileExplorer`:`common.revealPath.fileManager`,K=e=>U()&&r()?e.metaKey:e.ctrlKey,q=()=>U()&&r()?`⌘`:`Ctrl`,J=(e,t)=>{let n=e??``,r=Math.max(16,t?.maxLength??45);if(n.length<=r)return n;let i=n.split(`/`);if(i.length<=1)return n;let a=i.pop()??``;if(!a)return n;let o=Math.max(0,r-(a.length+2));if(o<=0)return`…/${a}`;let s=``;for(let e of i){if(!e)continue;let t=s?`${s}/${e}`:e;if(t.length>o)break;s=t}if(!s){let e=i[0]??``;s=e?e.slice(0,o):``}return s?`${s}…/${a}`:`…/${a}`},Y=e=>e?e===`/`?`/`:e.replace(/\/+$/,``):``;function X(e,t){if(!e)return``;let n=Y(e);if(n===`/`)return`/`;let r=t?Y(t):void 0;if(r&&r!==`/`){if(n===r)return`~`;if(n.startsWith(`${r}/`)){let e=n.slice(r.length+1);return e?`~/${e}`:`~`}}return n}function ie(e,t){if(!e)return`/`;let n=Y(e);if(!n||n===`/`)return`/`;let r=t?Y(t):void 0;return r&&r!==`/`&&n===r?`~`:n.split(`/`).pop()||n||`/`}function ae(e,t){let n=(0,h.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{for(let r of[e,t])r&&(typeof r==`function`?r(n):r.current=n)},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}function oe(e,t){let n={...t};for(let r in e){let i=t[r],a=e[r];n[r]=/^on[A-Z]/.test(r)&&typeof i==`function`&&typeof a==`function`?(...e)=>{a(...e),i(...e)}:r===`className`&&typeof i==`string`&&typeof a==`string`?`${a} ${i}`:r===`style`&&typeof i==`object`&&typeof a==`object`?{...a,...i}:a}return n}var Z=m.forwardRef(function(e,t){let n=(0,h.c)(3),{children:r,...i}=e,a=m.isValidElement(r)?r:null,o=ae(t,a?a.ref:void 0);if(!a)return null;let s=oe(a.props,i),c;return n[0]!==o||n[1]!==s?(c={...s,ref:o},n[0]=o,n[1]=s,n[2]=c):c=n[2],m.cloneElement(a,c)}),Q=[`bg-[var(--surface-muted)] text-foreground border-0 shadow-none`,`hover:bg-[color-mix(in_srgb,var(--foreground)_6%,var(--surface-muted))]`,`active:bg-[color-mix(in_srgb,var(--foreground)_12%,var(--surface-muted))]`,`focus-visible:border-transparent focus-visible:ring-foreground/20`].join(` `),$=[`bg-[color-mix(in_srgb,var(--status-error)_7%,var(--background))]`,`text-[var(--status-error)]`,`border border-[color-mix(in_srgb,var(--status-error)_9%,transparent)]`,`hover:bg-[color-mix(in_srgb,var(--status-error)_11%,var(--background))]`,`active:bg-[color-mix(in_srgb,var(--status-error)_16%,var(--background))]`,`dark:bg-[color-mix(in_srgb,var(--status-error)_9%,transparent)]`,`dark:border-[color-mix(in_srgb,var(--status-error)_14%,transparent)]`,`dark:hover:bg-[color-mix(in_srgb,var(--status-error)_14%,transparent)]`,`dark:active:bg-[color-mix(in_srgb,var(--status-error)_20%,transparent)]`].join(` `),se=f([`group relative inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] typography-ui-label font-medium tracking-[0.01em] shrink-0 select-none`,`transition-[background-color,border-color,color,opacity,filter,transform] duration-150 ease-out outline-none`,`focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,`disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`],{variants:{variant:{default:Q,destructive:H($,`focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40`),neutral:Q,outline:Q,mobileGlass:`yuri-mobile-floating-action text-foreground hover:brightness-105 active:bg-interactive-active focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,chip:H(Q,`aria-pressed:bg-[color-mix(in_srgb,var(--foreground)_6%,var(--surface-muted))]`,`aria-pressed:hover:bg-[color-mix(in_srgb,var(--foreground)_8%,var(--surface-muted))]`,`aria-pressed:active:bg-[color-mix(in_srgb,var(--foreground)_10%,var(--surface-muted))]`),secondary:`bg-interactive-hover text-foreground hover:bg-interactive-active`,ghost:`text-foreground hover:bg-interactive-hover hover:text-foreground active:bg-interactive-active`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-3.5 has-[>svg]:px-3`,sm:`h-8 gap-1.5 px-2.5 has-[>svg]:px-2 rounded-[9px] supports-[corner-shape:squircle]:rounded-[50px]`,xs:`h-6 gap-1 px-2 typography-micro has-[>svg]:px-1.5 rounded-[7px] supports-[corner-shape:squircle]:rounded-[50px]`,lg:`h-10 px-4 has-[>svg]:px-3.5 rounded-[12px] supports-[corner-shape:squircle]:rounded-[50px]`,icon:`size-9`,mobileIcon:`size-10 min-h-10 min-w-10 rounded-full`}},defaultVariants:{variant:`default`,size:`default`}}),ce=new Set([`icon`,`mobileIcon`,`xs`]);function le(e){let t=(0,h.c)(20),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:n,variant:s,size:i,asChild:a,type:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a!==void 0&&a,l=c?Z:`button`,u;t[7]!==c||t[8]!==o?(u=c?o===void 0?{}:{type:o}:{type:o??`button`},t[7]=c,t[8]=o,t[9]=u):u=t[9];let d=u,f=i!=null&&ce.has(i)?`compact`:void 0,p;t[10]!==n||t[11]!==i||t[12]!==s?(p=H(se({variant:s,size:i,className:n})),t[10]=n,t[11]=i,t[12]=s,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==f||t[16]!==r||t[17]!==p||t[18]!==d?(m=(0,S.jsx)(l,{"data-slot":`button`,"data-mobile-press-feedback":f,className:p,...d,...r}),t[14]=l,t[15]=f,t[16]=r,t[17]=p,t[18]=d,t[19]=m):m=t[19],m}export{g as _,X as a,_ as b,K as c,V as d,B as f,b as g,C as h,ie as i,U as l,F as m,Z as n,q as o,z as p,H as r,G as s,le as t,J as u,y as v,v as y};
@@ -1 +1 @@
1
- import{a as e,n as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{t as n}from"./types-Bu1xM0fS.js";var r=e(`CapacitorUpdater`),i=()=>{if(typeof window>`u`)return!1;try{return t.isNativePlatform()&&t.isPluginAvailable(`CapacitorUpdater`)}catch{return!1}},a=()=>{throw new n},o=()=>({async notifyAppReady(){return i()||a(),r.notifyAppReady()},async download(e){return i()||a(),r.download(e)},async next(e){return i()||a(),r.next(e)},async reload(){return i()||a(),r.reload()},async current(){return i()||a(),r.current()},async getDeviceId(){return i()||a(),r.getDeviceId()},async list(){return i()||a(),r.list()},addListener:(async(e,t)=>(i()||a(),r.addListener(e,t)))}),s,c=async()=>s===void 0?i()?(s=o(),s):(s=null,null):s,l=()=>i();export{l as n,c as t};
1
+ import{a as e,n as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{t as n}from"./types-BzF7Dhzq.js";var r=e(`CapacitorUpdater`),i=()=>{if(typeof window>`u`)return!1;try{return t.isNativePlatform()&&t.isPluginAvailable(`CapacitorUpdater`)}catch{return!1}},a=()=>{throw new n},o=()=>({async notifyAppReady(){return i()||a(),r.notifyAppReady()},async download(e){return i()||a(),r.download(e)},async next(e){return i()||a(),r.next(e)},async reload(){return i()||a(),r.reload()},async current(){return i()||a(),r.current()},async getDeviceId(){return i()||a(),r.getDeviceId()},async list(){return i()||a(),r.list()},addListener:(async(e,t)=>(i()||a(),r.addListener(e,t)))}),s,c=async()=>s===void 0?i()?(s=o(),s):(s=null,null):s,l=()=>i();export{l as n,c as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,n,r,rt as i,t as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{r as s}from"./button-_ReBqWzC.js";var c=o(),l=e(t(),1),u=i(),d=r,f=e=>{let t=(0,c.c)(14),r,i,a,o;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4]):({className:a,asChild:r,children:i,...o}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o);let d;t[5]!==r||t[6]!==i?(d=r&&l.isValidElement(i)?{render:i}:{children:i},t[5]=r,t[6]=i,t[7]=d):d=t[7];let f=d,p;t[8]===a?p=t[9]:(p=s(`flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,a),t[8]=a,t[9]=p);let m;return t[10]!==o||t[11]!==f||t[12]!==p?(m=(0,u.jsx)(n,{className:p,...o,...f}),t[10]=o,t[11]=f,t[12]=p,t[13]=m):m=t[13],m},p=e=>{let t=(0,c.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=s(`overflow-hidden data-[closed]:animate-collapsible-up data-[open]:animate-collapsible-down`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,u.jsx)(a,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o};export{p as n,f as r,d as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,n,r,rt as i,t as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{r as s}from"./button-D_HdP1Oy.js";var c=o(),l=e(t(),1),u=i(),d=r,f=e=>{let t=(0,c.c)(14),r,i,a,o;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4]):({className:a,asChild:r,children:i,...o}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o);let d;t[5]!==r||t[6]!==i?(d=r&&l.isValidElement(i)?{render:i}:{children:i},t[5]=r,t[6]=i,t[7]=d):d=t[7];let f=d,p;t[8]===a?p=t[9]:(p=s(`flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,a),t[8]=a,t[9]=p);let m;return t[10]!==o||t[11]!==f||t[12]!==p?(m=(0,u.jsx)(n,{className:p,...o,...f}),t[10]=o,t[11]=f,t[12]=p,t[13]=m):m=t[13],m},p=e=>{let t=(0,c.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=s(`overflow-hidden data-[closed]:animate-collapsible-up data-[open]:animate-collapsible-down`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,u.jsx)(a,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o};export{p as n,f as r,d as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{r}from"./button-_ReBqWzC.js";import{t as i}from"./vendor-react-drawio-Ck9ZKdNN.js";var a=e(t(),1),o=n(),s=`<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>`;function c(){if(typeof document>`u`)return!1;let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||!e&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}var l=a.forwardRef(function({xml:e,readOnly:t,className:n,onChange:l},u){let d=a.useRef(e),f=a.useRef(null),p=a.useRef(!1),[m,h]=a.useState(c),g=a.useRef(e),_=a.useRef(e);_.current!==e&&(_.current=e,g.current=e,d.current=e);let v=a.useRef(m);v.current!==m&&(v.current=m,g.current=d.current);let y=a.useRef(null);a.useEffect(()=>{let e=()=>h(c());e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},[]),a.useEffect(()=>{let e=setTimeout(()=>{y.current?.querySelector(`.diagrams-iframe`)?.focus()},600);return()=>clearTimeout(e)},[]),a.useImperativeHandle(u,()=>({getXml:()=>d.current}));let b=a.useCallback(()=>{!e&&!p.current&&(p.current=!0,setTimeout(()=>{f.current?.template({})},500))},[e]),x=a.useCallback(e=>{d.current=e.xml,l?.(e.xml)},[l]);return(0,o.jsx)(`div`,{ref:y,className:r(`h-full w-full`,n),children:(0,o.jsx)(i,{ref:f,xml:g.current||s,autosave:!0,urlParameters:{ui:t?`simple`:m?`dark`:`kennedy`,spin:!0,libraries:!t,chrome:t,nav:t,layers:t,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:b,onAutoSave:x},m?`dark`:`light`)})});export{l as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{r}from"./button-D_HdP1Oy.js";import{t as i}from"./vendor-react-drawio-Ck9ZKdNN.js";var a=e(t(),1),o=n(),s=`<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>`;function c(){if(typeof document>`u`)return!1;let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||!e&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}var l=a.forwardRef(function({xml:e,readOnly:t,className:n,onChange:l},u){let d=a.useRef(e),f=a.useRef(null),p=a.useRef(!1),[m,h]=a.useState(c),g=a.useRef(e),_=a.useRef(e);_.current!==e&&(_.current=e,g.current=e,d.current=e);let v=a.useRef(m);v.current!==m&&(v.current=m,g.current=d.current);let y=a.useRef(null);a.useEffect(()=>{let e=()=>h(c());e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},[]),a.useEffect(()=>{let e=setTimeout(()=>{y.current?.querySelector(`.diagrams-iframe`)?.focus()},600);return()=>clearTimeout(e)},[]),a.useImperativeHandle(u,()=>({getXml:()=>d.current}));let b=a.useCallback(()=>{!e&&!p.current&&(p.current=!0,setTimeout(()=>{f.current?.template({})},500))},[e]),x=a.useCallback(e=>{d.current=e.xml,l?.(e.xml)},[l]);return(0,o.jsx)(`div`,{ref:y,className:r(`h-full w-full`,n),children:(0,o.jsx)(i,{ref:f,xml:g.current||s,autosave:!0,urlParameters:{ui:t?`simple`:m?`dark`:`kennedy`,spin:!0,libraries:!t,chrome:t,nav:t,layers:t,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:b,onAutoSave:x},m?`dark`:`light`)})});export{l as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,J as n,Q as r,X as i,Y as a,Z as o,et as s,it as c,q as l,rt as u}from"./vendor-base-ui-CdzJ6My_.js";import{n as d}from"./vendor-react-BP2cRVqX.js";import{f,r as p}from"./button-_ReBqWzC.js";import{n as m}from"./Icon-2cKLcXGe.js";var h=d(),g=e(c(),1),_=u(),v=0;function y(e,t){return e&&g.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,h.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,_.jsx)(a,{...n}),t[2]=n,t[3]=r),r}function x(e){let t=(0,h.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({asChild:n,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=y(n,r),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o=a,s;return t[7]!==i||t[8]!==o?(s=(0,_.jsx)(l,{"data-slot":`dialog-trigger`,...i,...o}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function S(e){let t=(0,h.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,_.jsx)(i,{...n}),t[2]=n,t[3]=r),r}var C=g.forwardRef((e,t)=>{let n=(0,h.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3],g.useEffect(A,a);let o=t,c;n[4]===r?c=n[5]:(c=p(`app-region-no-drag 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`,r),n[4]=r,n[5]=c);let l;return n[6]!==i||n[7]!==o||n[8]!==c?(l=(0,_.jsx)(s,{ref:o,"data-slot":`dialog-overlay`,className:c,...i}),n[6]=i,n[7]=o,n[8]=c,n[9]=l):l=n[9],l});C.displayName=`DialogOverlay`;function w(e){let n=(0,h.c)(29),r,i,a,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4],c=n[5],l=n[6]):({className:i,overlayClassName:s,containerClassName:a,children:r,showCloseButton:l,...c}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s,n[5]=c,n[6]=l);let u=l===void 0||l,{t:d}=f(),g;n[7]===s?g=n[8]:(g=p(`rounded-none`,s),n[7]=s,n[8]=g);let v;n[9]===g?v=n[10]:(v=(0,_.jsx)(C,{className:g}),n[9]=g,n[10]=v);let y=a??`items-center p-4`,b;n[11]===y?b=n[12]:(b=p(`fixed inset-0 z-50 flex justify-center pointer-events-none`,y),n[11]=y,n[12]=b);let x;n[13]===i?x=n[14]:(x=p(`app-region-no-drag relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`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]`,i),n[13]=i,n[14]=x);let w;n[15]!==u||n[16]!==d?(w=u&&(0,_.jsxs)(t,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(m,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:d(`dialog.common.actions.close`)})]}),n[15]=u,n[16]=d,n[17]=w):w=n[17];let T;n[18]!==r||n[19]!==c||n[20]!==x||n[21]!==w?(T=(0,_.jsxs)(o,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,className:x,...c,children:[r,w]}),n[18]=r,n[19]=c,n[20]=x,n[21]=w,n[22]=T):T=n[22];let E;n[23]!==b||n[24]!==T?(E=(0,_.jsx)(`div`,{className:b,children:T}),n[23]=b,n[24]=T,n[25]=E):E=n[25];let D;return n[26]!==v||n[27]!==E?(D=(0,_.jsxs)(S,{children:[v,E]}),n[26]=v,n[27]=E,n[28]=D):D=n[28],D}function T(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,h.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=p(`typography-markdown leading-none font-semibold text-foreground`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,_.jsx)(n,{"data-slot":`dialog-title`,className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function O(e){let t=(0,h.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=p(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,_.jsx)(r,{"data-slot":`dialog-description`,className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`yuri-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`yuri-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,J as n,Q as r,X as i,Y as a,Z as o,et as s,it as c,q as l,rt as u}from"./vendor-base-ui-CdzJ6My_.js";import{n as d}from"./vendor-react-BP2cRVqX.js";import{f,r as p}from"./button-D_HdP1Oy.js";import{n as m}from"./Icon-BXTZRnIO.js";var h=d(),g=e(c(),1),_=u(),v=0;function y(e,t){return e&&g.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,h.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,_.jsx)(a,{...n}),t[2]=n,t[3]=r),r}function x(e){let t=(0,h.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({asChild:n,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=y(n,r),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o=a,s;return t[7]!==i||t[8]!==o?(s=(0,_.jsx)(l,{"data-slot":`dialog-trigger`,...i,...o}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function S(e){let t=(0,h.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,_.jsx)(i,{...n}),t[2]=n,t[3]=r),r}var C=g.forwardRef((e,t)=>{let n=(0,h.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3],g.useEffect(A,a);let o=t,c;n[4]===r?c=n[5]:(c=p(`app-region-no-drag 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`,r),n[4]=r,n[5]=c);let l;return n[6]!==i||n[7]!==o||n[8]!==c?(l=(0,_.jsx)(s,{ref:o,"data-slot":`dialog-overlay`,className:c,...i}),n[6]=i,n[7]=o,n[8]=c,n[9]=l):l=n[9],l});C.displayName=`DialogOverlay`;function w(e){let n=(0,h.c)(29),r,i,a,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4],c=n[5],l=n[6]):({className:i,overlayClassName:s,containerClassName:a,children:r,showCloseButton:l,...c}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s,n[5]=c,n[6]=l);let u=l===void 0||l,{t:d}=f(),g;n[7]===s?g=n[8]:(g=p(`rounded-none`,s),n[7]=s,n[8]=g);let v;n[9]===g?v=n[10]:(v=(0,_.jsx)(C,{className:g}),n[9]=g,n[10]=v);let y=a??`items-center p-4`,b;n[11]===y?b=n[12]:(b=p(`fixed inset-0 z-50 flex justify-center pointer-events-none`,y),n[11]=y,n[12]=b);let x;n[13]===i?x=n[14]:(x=p(`app-region-no-drag relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`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]`,i),n[13]=i,n[14]=x);let w;n[15]!==u||n[16]!==d?(w=u&&(0,_.jsxs)(t,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(m,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:d(`dialog.common.actions.close`)})]}),n[15]=u,n[16]=d,n[17]=w):w=n[17];let T;n[18]!==r||n[19]!==c||n[20]!==x||n[21]!==w?(T=(0,_.jsxs)(o,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,className:x,...c,children:[r,w]}),n[18]=r,n[19]=c,n[20]=x,n[21]=w,n[22]=T):T=n[22];let E;n[23]!==b||n[24]!==T?(E=(0,_.jsx)(`div`,{className:b,children:T}),n[23]=b,n[24]=T,n[25]=E):E=n[25];let D;return n[26]!==v||n[27]!==E?(D=(0,_.jsxs)(S,{children:[v,E]}),n[26]=v,n[27]=E,n[28]=D):D=n[28],D}function T(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,h.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=p(`typography-markdown leading-none font-semibold text-foreground`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,_.jsx)(n,{"data-slot":`dialog-title`,className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function O(e){let t=(0,h.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=p(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,_.jsx)(r,{"data-slot":`dialog-description`,className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`yuri-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`yuri-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};