@yuriai/web 0.2.34 → 0.2.35-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AssistantContactStatus-PWo73pfN.js → AssistantContactStatus-CXn8uOl3.js} +3 -3
- package/dist/assets/{AssistantUnreadBadge-PRiDJ-Ys.js → AssistantUnreadBadge-BP09p1sv.js} +1 -1
- package/dist/assets/{AssistantView-Cuz4v_fG.js → AssistantView-DZAFO4ni.js} +1 -1
- package/dist/assets/{DiagramView-dxbQ6MXl.js → DiagramView-BxTkrA-k.js} +1 -1
- package/dist/assets/{GuiPluginSurface--HkD4nKM.js → GuiPluginSurface-Ts3G8N0H.js} +1 -1
- package/dist/assets/MarkdownRenderer-eLQNc5xA.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-BcRYBCHW.js → MarkdownRendererImpl-DssC4VQ9.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-zQ6bU9wm.js → MarkstreamRendererImpl-2XFRYrA1.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-pEUXnpqd.js → MobileDetailNavigation-BFH_V7Ti.js} +1 -1
- package/dist/assets/{MobileShareBridge-13ws-R6X.js → MobileShareBridge-BXuPxAfg.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-BxUA9rmy.js → MobileTabPageHeader-COg734_r.js} +1 -1
- package/dist/assets/{MultiRunWindow-BEMTJndj.js → MultiRunWindow-B1u-wbqI.js} +1 -1
- package/dist/assets/{SettingsView-DI-zla9J.js → SettingsView-D79k9-Pq.js} +1 -1
- package/dist/assets/{SettingsWindow-Cdhi7oJR.js → SettingsWindow-zEvva4EI.js} +1 -1
- package/dist/assets/{SetupTourDialog-DoeHKyr7.js → SetupTourDialog-BM1FP01e.js} +1 -1
- package/dist/assets/{TerminalView-BIKNgq3M.js → TerminalView-BNbJXzad.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Wq2Qn7Nh.js → ToolOutputDialog-Uf6KHnDC.js} +1 -1
- package/dist/assets/{VoiceSettings-Y1dbxZXa.js → VoiceSettings-DFr5VGER.js} +1 -1
- package/dist/assets/{appThemeRegistry-ClsRp7sO.js → appThemeRegistry-Bt-gBmVi.js} +1 -1
- package/dist/assets/{capgoAdapter-C3LxG5Eu.js → capgoAdapter-B6jsRLxl.js} +1 -1
- package/dist/assets/{gitApi-DxUmZcUw.js → gitApi-BAmdJT8d.js} +1 -1
- package/dist/assets/{insertionBoundaries-DUy8i_LT.js → insertionBoundaries-Sd8d4Qdl.js} +1 -1
- package/dist/assets/{main-D7TMj7hd.js → main-BEVCYmdD.js} +4 -4
- package/dist/assets/{main-B1kgopEY.js → main-DkYn5SpT.js} +2 -2
- package/dist/assets/{mcpQueries-UE2a-IBc.js → mcpQueries-9NOaAqoJ.js} +1 -1
- package/dist/assets/{miniChat-D-04iNeR.js → miniChat-DOwtfzME.js} +2 -2
- package/dist/assets/{mobile-CDPRNGIg.js → mobile-Dz-PGhIG.js} +2 -2
- package/dist/assets/{mobileBackNavigation-DaCBsLLk.js → mobileBackNavigation-C9Yye3Qn.js} +1 -1
- package/dist/assets/{multirun-C-f8cwos.js → multirun-TMlzS4Ey.js} +1 -1
- package/dist/assets/{native-config-C32KBsgV.js → native-config-COJPp7qo.js} +1 -1
- package/dist/assets/{projectMeta-DD7W5l0p.js → projectMeta-DpHNDC2w.js} +1 -1
- package/dist/assets/{pwa-BApESewB.js → pwa-f7t7EOCI.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-DEras0MF.js → queue-abort-optimistic-DaDpERla.js} +1 -1
- package/dist/assets/{readiness-DSB26e24.js → readiness-CqTQCG8Z.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-BzRnk_52.js → renderElectronMiniChatApp-CHkrEhD6.js} +2 -2
- package/dist/assets/{renderMobileApp-BEWiG7ie.js → renderMobileApp-DcflI62s.js} +4 -4
- package/dist/assets/{runtimeConfig-CRxel2dc.js → runtimeConfig-DBP6ows7.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-Dc7CPkqY.js → runtimeEndpointReset-D86NKKJw.js} +3 -3
- package/dist/assets/{sessionLookup-CV0eH5rT.js → sessionLookup-CvNkfZcq.js} +1 -1
- package/dist/assets/{speechSettingsQueries-C_e3XdqK.js → speechSettingsQueries-CgqHOKES.js} +1 -1
- package/dist/assets/{src-BgE3FRXg.css → src-YbAVLHDT.css} +1 -1
- package/dist/assets/types-D0NV5DU5.js +2 -0
- package/dist/assets/{useAppFontEffects-B-VpUGq4.js → useAppFontEffects-CJ256RrJ.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-DMCQ5xgT.js → useDesktopWindowControlsLayout-rHfoZZca.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-F4aXdQ21.js → useEffectiveDirectory-bp20IWKE.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DHX2bCjA.js → useMobileNavigationStore-BeJ4ikzg.js} +4 -4
- package/dist/assets/{usePluginsStore-YObSp0OZ.js → usePluginsStore-BAHWSpgH.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-Di0GTxuY.js → useWorkerHighlightedLines-DCuDVobw.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +6 -6
- package/package.json +1 -1
- package/server/lib/opencode/DOCUMENTATION.md +4 -4
- package/server/lib/opencode/proxy.js +1 -3
- package/server/lib/opencode/proxy.test.js +4 -3
- package/dist/assets/MarkdownRenderer-CJAX6rqh.js +0 -2
- package/dist/assets/types-DUFadVpY.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-CzHs0bHY.js";import{n as c}from"./vendor-react-DlzBev0S.js";import{f as l,r as u}from"./button-C-gRcs_2.js";import{t as d}from"./SettingsView-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-CzHs0bHY.js";import{n as c}from"./vendor-react-DlzBev0S.js";import{f as l,r as u}from"./button-C-gRcs_2.js";import{t as d}from"./SettingsView-D79k9-Pq.js";var f=c(),p=e(o(),1),m=i(),h=e=>{let i=(0,f.c)(19),{open:o,onOpenChange:c}=e,{t:h}=l(),_=p.useId(),v=g,y;i[0]===c?y=i[1]:(y=e=>{!e&&v()||c(e)},i[0]=c,i[1]=y);let b;i[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`)}),i[2]=b):b=i[2];let x;i[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]`),i[3]=x):x=i[3];let S;i[4]===h?S=i[5]:(S=h(`settings.window.description`),i[4]=h,i[5]=S);let C;i[6]!==_||i[7]!==S?(C=(0,m.jsx)(s,{id:_,className:`sr-only`,children:S}),i[6]=_,i[7]=S,i[8]=C):C=i[8];let w;i[9]===c?w=i[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),i[9]=c,i[10]=w);let T;i[11]!==_||i[12]!==C||i[13]!==w?(T=(0,m.jsxs)(t,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),i[11]=_,i[12]=C,i[13]=w,i[14]=T):T=i[14];let E;return i[15]!==o||i[16]!==y||i[17]!==T?(E=(0,m.jsx)(n,{open:o,onOpenChange:y,children:T}),i[15]=o,i[16]=y,i[17]=T,i[18]=E):E=i[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 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEZ1K7qW.js";import{ot as r,st as i}from"./vendor-base-ui-CzHs0bHY.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{s as o}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as s}from"./queryRuntime-2dx7jbt9.js";import{i as c}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as ee,r as l,t as u}from"./button-C-gRcs_2.js";import{fa as d,ki as f}from"./useMobileNavigationStore-DHX2bCjA.js";import{n as p}from"./Icon-OJf0qBKf.js";import{a as m,n as h,o as g,t as _}from"./dialog-3UseH0hM.js";import{t as v}from"./checkbox-BrJBzET8.js";import{t as y}from"./YuriLogo-CMUoGUHc.js";import{g as b,h as x,l as S,p as C}from"./select-J8r9SxHt.js";import{n as w}from"./MarkdownRenderer-CJAX6rqh.js";import{n as T}from"./speechSettingsQueries-C_e3XdqK.js";import{n as E,t as D}from"./YuriWordmark-DHYo0FlR.js";import{a as O,c as k,f as A,n as j,r as M,t as N}from"./usePluginsStore-YObSp0OZ.js";import{c as P,i as F,n as I,r as L,s as R,t as z}from"./VoiceSettings-Y1dbxZXa.js";import{a as B,c as te,d as ne,l as V,o as H,s as re,t as U,u as W}from"./historyImportQueries-C8VK9R5_.js";var G=e(i(),1),K=a(),q=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ie(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function J(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ie(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function ae(e,r,i){let a=t(),o=n();return J(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...M(r,a),staleTime:0})).entries,create:e=>N.getState().createEntry({spec:e,scope:`user`})})}var Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,X=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,Z=r(),oe={claude:Y,codex:X,cursor:b,dsh:x,opencode:C};function se({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=ee(),d=t(),f=n(),[m,h]=G.useState([]),[g,_]=G.useState(!1),[y,b]=G.useState(null),x=H(),S=x.data?.state===`running`,C=re(x.isSuccess&&!S),w=te(C.data?.id,r,`${x.data?.id??``}:${x.data?.state??``}`,!S&&!C.isFetching&&!C.isError),T=G.useRef(null),E=G.useRef(!1),D=G.useRef(null),O=G.useRef(null),k=c(e),A=c(e=>i?.(e)),j=c((e,t)=>h(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));G.useEffect(()=>{let e=new AbortController;return T.current=e,()=>{e.abort(),k(!1)}},[d,f,k]);let M=G.useMemo(()=>{let e=V.map(e=>({...e,sessions:[]}));for(let t of C.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[C.data]),N=!!(D.current&&x.data?.id===D.current&&ne(x.data)),P=g||!S&&!N&&(C.isFetching||!C.data||C.isError||x.isError);G.useEffect(()=>{A({disabled:P,background:S})},[P,S,A]);let F=()=>!T.current?.signal.aborted&&d===t()&&f===n(),I=async e=>{if(!(E.current||!T.current)){E.current=!0,_(!0),k(!0),b(null);try{await e(T.current.signal)}catch(e){F()&&b(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{E.current=!1,F()&&(_(!1),k(!1))}}},L=()=>I(async e=>{if(P)return;if(S||N){F()&&a?.();return}if(!m.length){F()&&a?.();return}let t=await B(m,r,e,d,f);F()&&(D.current=t.id,O.current?.scrollIntoView({block:`start`}))}),R=C.error??x.error,z=y||(R instanceof Error&&/^[a-z_]+$/.test(R.message)?R.message:C.isError||x.isError?`import_failed`:null),K=G.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),q=x.data?W(x.data):null,ie=G.useMemo(()=>new Intl.NumberFormat(s),[s]),J=(e,t)=>{let n=C.data?.counts?.[e],r=n?.value;if(r==null||C.isError)return null;let i=ie.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,Z.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:C.isFetching?(0,Z.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,Z.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),L()},children:[(0,Z.jsx)(`h2`,{ref:O,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,Z.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),x.data&&!ne(x.data)&&(S||D.current===x.data.id)&&(0,Z.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,Z.jsx)(p,{name:S?`loader-4`:`error-warning`,className:l(`size-4`,S&&`animate-spin`)}),(0,Z.jsx)(`span`,{children:o(S&&q?`historyImport.phase.${q.phase}`:`historyImport.state.${x.data.state}`)}),q&&q.total>0&&(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[q.completed,` / `,q.total]}),S&&(0,Z.jsx)(u,{variant:`ghost`,size:`icon`,disabled:g,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void I(async e=>{await U(x.data.id,e,d),F()&&await x.refetch()}),children:(0,Z.jsx)(p,{name:`stop`,className:`size-4`})}),S&&q&&(0,Z.jsx)(`progress`,{value:q.total?q.completed:void 0,max:q.total||1,"aria-label":o(`historyImport.progress`)}),x.data.progress?.code&&(0,Z.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,Z.jsx)(`code`,{children:x.data.progress.code})]}),x.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,Z.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(x.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,Z.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,Z.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:V.map(e=>{let t=C.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=C.data?.counts?.[e.id]?.value!=null&&!C.isError?` history-import-count-${e.id}`:``;return(0,Z.jsxs)(u,{variant:`ghost`,"data-history-source":e.id,className:l(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:g||S,"aria-pressed":m.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>j(e.id,!m.includes(e.id)),children:[(0,Z.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,Z.jsx)(`img`,{src:oe[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,Z.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,Z.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),J(e.id,`history-import-count-${e.id}`),(0,Z.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,Z.jsx)(p,{name:`check`,className:`size-3`})})]},e.id)})}),z&&(0,Z.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,Z.jsxs)(`p`,{children:[o(z===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,Z.jsx)(`code`,{children:z})]}),(C.isError||x.isError)&&(0,Z.jsx)(u,{variant:`ghost`,size:`xs`,disabled:C.isFetching||x.isFetching,onClick:()=>{Promise.all([C.refetch(),x.refetch()])},children:o(`settings.plugins.status.retry`)})]}),C.data&&!C.isFetching&&!C.isError&&!C.data.sessions.length&&!C.data.errors.length&&(0,Z.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),M.length>0&&(0,Z.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,Z.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,Z.jsx)(`div`,{className:`yuri-import-preview-groups`,children:M.map(e=>(0,Z.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":m.includes(e.id),children:[(0,Z.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,Z.jsx)(`h3`,{children:e.name}),J(e.id),(0,Z.jsx)(v,{checked:m.includes(e.id),disabled:g||S,ariaLabel:e.name,onChange:t=>j(e.id,t)})]}),(0,Z.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,Z.jsxs)(`li`,{"data-history-session":e.key,className:l(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,Z.jsx)(`img`,{src:oe[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,Z.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,Z.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,Z.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!w.isError&&w.data?.states[e.key]===`imported`&&(0,Z.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,Z.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:K.format(e.updated)}):null]}),e.excerpt&&(0,Z.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Q=q.map(e=>e.spec),ce=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],le=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function ue(e){let t=(0,K.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=ee(),d=q[n],f=r?.kind===`npm-ok`?r:void 0,m=a&&`yuri-tour-card-selected`,h;t[0]===m?h=t[1]:(h=l(`yuri-tour-plugin yuri-tour-select-card`,m),t[0]=m,t[1]=h);let g;t[2]===a?g=t[3]:(g=a&&(0,Z.jsx)(p,{name:`check`,className:`size-5`}),t[2]=a,t[3]=g);let _;t[4]===g?_=t[5]:(_=(0,Z.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:g}),t[4]=g,t[5]=_);let v;t[6]!==o||t[7]!==d.name||t[8]!==a||t[9]!==_?(v=(0,Z.jsx)(u,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":d.name,"aria-pressed":a,onClick:o,children:_}),t[6]=o,t[7]=d.name,t[8]=a,t[9]=_,t[10]=v):v=t[10];let y=f?.icon,b;t[11]!==d.name||t[12]!==y?(b=(0,Z.jsx)(P,{name:d.name,src:y,size:30}),t[11]=d.name,t[12]=y,t[13]=b):b=t[13];let x;t[14]===d.name?x=t[15]:(x=(0,Z.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:d.name}),t[14]=d.name,t[15]=x);let S;t[16]===d.spec?S=t[17]:(S=(0,Z.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:d.spec}),t[16]=d.spec,t[17]=S);let C;t[18]!==x||t[19]!==S?(C=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[18]=x,t[19]=S,t[20]=C):C=t[20];let w;t[21]===f?w=t[22]:(w=f?.latestVersion&&(0,Z.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:f.latestVersion}),t[21]=f,t[22]=w);let T;t[23]!==C||t[24]!==w||t[25]!==b?(T=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[b,C,w]}),t[23]=C,t[24]=w,t[25]=b,t[26]=T):T=t[26];let E;t[27]!==r||t[28]!==f?.description||t[29]!==c?(E=f?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=f?.description,t[29]=c,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,Z.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:E}),t[31]=E,t[32]=D);let O=!f,k;t[33]!==s||t[34]!==O?(k=(0,Z.jsx)(u,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:O,onClick:s,children:`README`}),t[33]=s,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==i||t[37]!==c?(A=i&&(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=A):A=t[38];let j;t[39]!==k||t[40]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[k,A]}),t[39]=k,t[40]=A,t[41]=j):j=t[41];let M;return t[42]!==T||t[43]!==D||t[44]!==j||t[45]!==h||t[46]!==v?(M=(0,Z.jsxs)(`section`,{className:h,children:[v,T,D,j]}),t[42]=T,t[43]=D,t[44]=j,t[45]=h,t[46]=v,t[47]=M):M=t[47],M}function de(e){let t=(0,K.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=ee(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=I(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),G.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,m;t[9]===p?m=t[10]:(m=e=>void p(e),t[9]=p,t[10]=m);let h;t[11]===a?h=t[12]:(h=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=h);let g,_;t[13]===s?(g=t[14],_=t[15]):(g=(0,Z.jsx)(L,{mode:`tts`,form:s}),_=(0,Z.jsx)(L,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=g,t[15]=_);let v;t[16]!==h||t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(A,{label:h,children:[g,_]}),t[16]=h,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(y=!n.configured&&!s.draft.apiKey?.trim()&&(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==m||t[26]!==v?(b=(0,Z.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:m,className:`yuri-settings-section-stack`,children:[v,y]}),t[24]=y,t[25]=m,t[26]=v,t[27]=b):b=t[27],b}function fe({runtime:e,onClose:r}){let{t:i}=ee(),a=O(),c=E(t=>t.progress[e]?.step??0),[v,b]=G.useState(`magpie`),[x,C]=G.useState(),[A,M]=G.useState(Q.slice(1)),[N,P]=G.useState(`tour`),[I,L]=G.useState(null),[R,B]=G.useState(!1),[te,ne]=G.useState({disabled:!0}),[V,H]=G.useState(null),re=n(),U=t(),W=G.useRef(null),K=G.useRef(!1);G.useEffect(()=>{let e=new AbortController;return W.current=e,()=>e.abort()},[]);let J=k(),Y=o({...j(a,Q.slice(1),!1,U,!0),enabled:c===1}),X=o({...T(U),enabled:c===3}),oe=J.data?.entries??[],fe=e=>{let t=f.getState(),n=e&&t.providers.some(t=>t.id===e);b(`other`),C(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),P(`providers`)},$=()=>!W.current?.signal.aborted&&re===n()&&U===t(),pe=t=>{P(`tour`),H(null),E.getState().move(e,t)},me=()=>{$()&&r()},he=()=>{c===3?me():pe(c+1)},ge=async()=>{if(c===2){he();return}if(!(K.current||R||!W.current)){K.current=!0,B(!0),H(null);try{let e=c===0?v===`magpie`?[Q[0]]:[]:A;if(e.length){let t=await ae(e,a,W.current.signal);if(!$())return;if(t.failed.length){H(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&v===`other`){let e=await s.fetchQuery({...d(a,U),staleTime:0});if(!$())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){H(i(`tour.noModels`));return}await f.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}$()&&he()}catch{$()&&H(i(`tour.operationFailed`))}finally{K.current=!1,$()&&B(!1)}}},_e=()=>{I===null?N===`tour`?c>0&&pe(c-1):P(`tour`):L(null)},ve=I===null?void 0:Y.data?.[Q[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,Z.jsx)(_,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||N!==`tour`?_e():me())},children:(0,Z.jsxs)(h,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,Z.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,Z.jsx)(y,{width:440,height:440})}),(0,Z.jsx)(m,{children:(0,Z.jsxs)(g,{className:`yuri-tour-title`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,Z.jsxs)(G.Fragment,{children:[t>0&&(0,Z.jsx)(D,{width:`2.05em`}),(0,Z.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,Z.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,Z.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:ce.map((e,t)=>(0,Z.jsxs)(u,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),pe(t)},children:[(0,Z.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,Z.jsx)(`span`,{children:i(e)})]},e))}),(0,Z.jsx)(`div`,{className:l(`yuri-tour-content`,N===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,Z.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?N===`providers`?(0,Z.jsx)(F,{initialConnectionId:x}):N===`voice`&&X.data?(0,Z.jsx)(de,{settings:X.data,onComplete:me,onBusy:B}):N===`asr`||N===`tts`?(0,Z.jsx)(z,{section:N}):(0,Z.jsxs)(Z.Fragment,{children:[c<2&&(c===1&&Y.isError||J.isError)&&(0,Z.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,Z.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,Z.jsx)(u,{size:`xs`,onClick:()=>{c===1&&Y.refetch(),J.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:l(`yuri-tour-magpie yuri-tour-select-card`,v===`magpie`&&`yuri-tour-card-selected`),children:[(0,Z.jsx)(u,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":v===`magpie`,onClick:()=>b(v===`magpie`?`other`:`magpie`),children:(0,Z.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:v===`magpie`&&(0,Z.jsx)(p,{name:`check`,className:`size-5`})})}),(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,Z.jsx)(S,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,Z.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,Z.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,Z.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,Z.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,Z.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,Z.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:le.map(e=>(0,Z.jsxs)(u,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>fe(e.id),children:[(0,Z.jsx)(S,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,Z.jsx)(`span`,{children:e.name})]},e.id))}),(0,Z.jsxs)(u,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>fe(),children:[i(`tour.otherProvider`),(0,Z.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,Z.jsx)(ue,{index:e,info:Y.data?.[Q[e]],installed:ie(oe,Q[e]),selected:A.includes(Q[e]),onSelect:()=>M(t=>t.includes(Q[e])?t.filter(t=>t!==Q[e]):[...t,Q[e]]),onReadme:()=>L(e)},e))}),(0,Z.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,Z.jsx)(se,{onBusy:B,directory:a,onPrimaryChange:ne,onComplete:()=>pe(3)}),c===3&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,Z.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,Z.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(p,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,Z.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,Z.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,Z.jsxs)(u,{size:`sm`,onClick:()=>P(`asr`),children:[i(`tour.configureInput`),(0,Z.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(p,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,Z.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,Z.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(S,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,Z.jsxs)(u,{size:`sm`,onClick:()=>P(`tts`),children:[i(`tour.configureReadAloud`),(0,Z.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,Z.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,Z.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,Z.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,Z.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,Z.jsx)(u,{disabled:!X.data,size:`sm`,onClick:()=>P(`voice`),children:i(`tour.configureVoice`)})]}),X.isError&&(0,Z.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,Z.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,Z.jsx)(u,{size:`xs`,onClick:()=>void X.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[q[I].name,` · README`]}),ye?(0,Z.jsx)(w,{content:ye,enableFileReferences:!1}):(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),V&&I===null&&(0,Z.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:V})]})})]}),(0,Z.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(N!==`tour`||I!==null)&&(0,Z.jsx)(u,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,Z.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,Z.jsx)(u,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,Z.jsxs)(u,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||te.disabled,"aria-busy":R,children:[R&&(0,Z.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(te.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,Z.jsx)(u,{size:`sm`,disabled:R,type:N===`voice`?`submit`:`button`,form:N===`voice`?`yuri-tour-voice`:void 0,onClick:N===`voice`?void 0:me,children:i(N===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,Z.jsxs)(u,{size:`sm`,disabled:R||c<2&&(!J.data||J.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,Z.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{fe as SetupTourDialog};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEZ1K7qW.js";import{ot as r,st as i}from"./vendor-base-ui-CzHs0bHY.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{s as o}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as s}from"./queryRuntime-2dx7jbt9.js";import{i as c}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as ee,r as l,t as u}from"./button-C-gRcs_2.js";import{fa as d,ki as f}from"./useMobileNavigationStore-BeJ4ikzg.js";import{n as p}from"./Icon-OJf0qBKf.js";import{a as m,n as h,o as g,t as _}from"./dialog-3UseH0hM.js";import{t as v}from"./checkbox-BrJBzET8.js";import{t as y}from"./YuriLogo-CMUoGUHc.js";import{g as b,h as x,l as S,p as C}from"./select-J8r9SxHt.js";import{n as w}from"./MarkdownRenderer-eLQNc5xA.js";import{n as T}from"./speechSettingsQueries-CgqHOKES.js";import{n as E,t as D}from"./YuriWordmark-DHYo0FlR.js";import{a as O,c as k,f as A,n as j,r as M,t as N}from"./usePluginsStore-BAHWSpgH.js";import{c as P,i as F,n as I,r as L,s as R,t as z}from"./VoiceSettings-DFr5VGER.js";import{a as B,c as te,d as ne,l as V,o as H,s as re,t as U,u as W}from"./historyImportQueries-C8VK9R5_.js";var G=e(i(),1),K=a(),q=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ie(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function J(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ie(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function ae(e,r,i){let a=t(),o=n();return J(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...M(r,a),staleTime:0})).entries,create:e=>N.getState().createEntry({spec:e,scope:`user`})})}var Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,X=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,Z=r(),oe={claude:Y,codex:X,cursor:b,dsh:x,opencode:C};function se({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=ee(),d=t(),f=n(),[m,h]=G.useState([]),[g,_]=G.useState(!1),[y,b]=G.useState(null),x=H(),S=x.data?.state===`running`,C=re(x.isSuccess&&!S),w=te(C.data?.id,r,`${x.data?.id??``}:${x.data?.state??``}`,!S&&!C.isFetching&&!C.isError),T=G.useRef(null),E=G.useRef(!1),D=G.useRef(null),O=G.useRef(null),k=c(e),A=c(e=>i?.(e)),j=c((e,t)=>h(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));G.useEffect(()=>{let e=new AbortController;return T.current=e,()=>{e.abort(),k(!1)}},[d,f,k]);let M=G.useMemo(()=>{let e=V.map(e=>({...e,sessions:[]}));for(let t of C.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[C.data]),N=!!(D.current&&x.data?.id===D.current&&ne(x.data)),P=g||!S&&!N&&(C.isFetching||!C.data||C.isError||x.isError);G.useEffect(()=>{A({disabled:P,background:S})},[P,S,A]);let F=()=>!T.current?.signal.aborted&&d===t()&&f===n(),I=async e=>{if(!(E.current||!T.current)){E.current=!0,_(!0),k(!0),b(null);try{await e(T.current.signal)}catch(e){F()&&b(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{E.current=!1,F()&&(_(!1),k(!1))}}},L=()=>I(async e=>{if(P)return;if(S||N){F()&&a?.();return}if(!m.length){F()&&a?.();return}let t=await B(m,r,e,d,f);F()&&(D.current=t.id,O.current?.scrollIntoView({block:`start`}))}),R=C.error??x.error,z=y||(R instanceof Error&&/^[a-z_]+$/.test(R.message)?R.message:C.isError||x.isError?`import_failed`:null),K=G.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),q=x.data?W(x.data):null,ie=G.useMemo(()=>new Intl.NumberFormat(s),[s]),J=(e,t)=>{let n=C.data?.counts?.[e],r=n?.value;if(r==null||C.isError)return null;let i=ie.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,Z.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:C.isFetching?(0,Z.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,Z.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),L()},children:[(0,Z.jsx)(`h2`,{ref:O,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,Z.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),x.data&&!ne(x.data)&&(S||D.current===x.data.id)&&(0,Z.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,Z.jsx)(p,{name:S?`loader-4`:`error-warning`,className:l(`size-4`,S&&`animate-spin`)}),(0,Z.jsx)(`span`,{children:o(S&&q?`historyImport.phase.${q.phase}`:`historyImport.state.${x.data.state}`)}),q&&q.total>0&&(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[q.completed,` / `,q.total]}),S&&(0,Z.jsx)(u,{variant:`ghost`,size:`icon`,disabled:g,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void I(async e=>{await U(x.data.id,e,d),F()&&await x.refetch()}),children:(0,Z.jsx)(p,{name:`stop`,className:`size-4`})}),S&&q&&(0,Z.jsx)(`progress`,{value:q.total?q.completed:void 0,max:q.total||1,"aria-label":o(`historyImport.progress`)}),x.data.progress?.code&&(0,Z.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,Z.jsx)(`code`,{children:x.data.progress.code})]}),x.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,Z.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(x.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,Z.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,Z.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:V.map(e=>{let t=C.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=C.data?.counts?.[e.id]?.value!=null&&!C.isError?` history-import-count-${e.id}`:``;return(0,Z.jsxs)(u,{variant:`ghost`,"data-history-source":e.id,className:l(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:g||S,"aria-pressed":m.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>j(e.id,!m.includes(e.id)),children:[(0,Z.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,Z.jsx)(`img`,{src:oe[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,Z.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,Z.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),J(e.id,`history-import-count-${e.id}`),(0,Z.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,Z.jsx)(p,{name:`check`,className:`size-3`})})]},e.id)})}),z&&(0,Z.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,Z.jsxs)(`p`,{children:[o(z===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,Z.jsx)(`code`,{children:z})]}),(C.isError||x.isError)&&(0,Z.jsx)(u,{variant:`ghost`,size:`xs`,disabled:C.isFetching||x.isFetching,onClick:()=>{Promise.all([C.refetch(),x.refetch()])},children:o(`settings.plugins.status.retry`)})]}),C.data&&!C.isFetching&&!C.isError&&!C.data.sessions.length&&!C.data.errors.length&&(0,Z.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),M.length>0&&(0,Z.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,Z.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,Z.jsx)(`div`,{className:`yuri-import-preview-groups`,children:M.map(e=>(0,Z.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":m.includes(e.id),children:[(0,Z.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,Z.jsx)(`h3`,{children:e.name}),J(e.id),(0,Z.jsx)(v,{checked:m.includes(e.id),disabled:g||S,ariaLabel:e.name,onChange:t=>j(e.id,t)})]}),(0,Z.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,Z.jsxs)(`li`,{"data-history-session":e.key,className:l(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,Z.jsx)(`img`,{src:oe[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,Z.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,Z.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,Z.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!w.isError&&w.data?.states[e.key]===`imported`&&(0,Z.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,Z.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:K.format(e.updated)}):null]}),e.excerpt&&(0,Z.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Q=q.map(e=>e.spec),ce=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],le=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function ue(e){let t=(0,K.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=ee(),d=q[n],f=r?.kind===`npm-ok`?r:void 0,m=a&&`yuri-tour-card-selected`,h;t[0]===m?h=t[1]:(h=l(`yuri-tour-plugin yuri-tour-select-card`,m),t[0]=m,t[1]=h);let g;t[2]===a?g=t[3]:(g=a&&(0,Z.jsx)(p,{name:`check`,className:`size-5`}),t[2]=a,t[3]=g);let _;t[4]===g?_=t[5]:(_=(0,Z.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:g}),t[4]=g,t[5]=_);let v;t[6]!==o||t[7]!==d.name||t[8]!==a||t[9]!==_?(v=(0,Z.jsx)(u,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":d.name,"aria-pressed":a,onClick:o,children:_}),t[6]=o,t[7]=d.name,t[8]=a,t[9]=_,t[10]=v):v=t[10];let y=f?.icon,b;t[11]!==d.name||t[12]!==y?(b=(0,Z.jsx)(P,{name:d.name,src:y,size:30}),t[11]=d.name,t[12]=y,t[13]=b):b=t[13];let x;t[14]===d.name?x=t[15]:(x=(0,Z.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:d.name}),t[14]=d.name,t[15]=x);let S;t[16]===d.spec?S=t[17]:(S=(0,Z.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:d.spec}),t[16]=d.spec,t[17]=S);let C;t[18]!==x||t[19]!==S?(C=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[18]=x,t[19]=S,t[20]=C):C=t[20];let w;t[21]===f?w=t[22]:(w=f?.latestVersion&&(0,Z.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:f.latestVersion}),t[21]=f,t[22]=w);let T;t[23]!==C||t[24]!==w||t[25]!==b?(T=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[b,C,w]}),t[23]=C,t[24]=w,t[25]=b,t[26]=T):T=t[26];let E;t[27]!==r||t[28]!==f?.description||t[29]!==c?(E=f?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=f?.description,t[29]=c,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,Z.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:E}),t[31]=E,t[32]=D);let O=!f,k;t[33]!==s||t[34]!==O?(k=(0,Z.jsx)(u,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:O,onClick:s,children:`README`}),t[33]=s,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==i||t[37]!==c?(A=i&&(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=A):A=t[38];let j;t[39]!==k||t[40]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[k,A]}),t[39]=k,t[40]=A,t[41]=j):j=t[41];let M;return t[42]!==T||t[43]!==D||t[44]!==j||t[45]!==h||t[46]!==v?(M=(0,Z.jsxs)(`section`,{className:h,children:[v,T,D,j]}),t[42]=T,t[43]=D,t[44]=j,t[45]=h,t[46]=v,t[47]=M):M=t[47],M}function de(e){let t=(0,K.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=ee(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=I(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),G.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,m;t[9]===p?m=t[10]:(m=e=>void p(e),t[9]=p,t[10]=m);let h;t[11]===a?h=t[12]:(h=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=h);let g,_;t[13]===s?(g=t[14],_=t[15]):(g=(0,Z.jsx)(L,{mode:`tts`,form:s}),_=(0,Z.jsx)(L,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=g,t[15]=_);let v;t[16]!==h||t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(A,{label:h,children:[g,_]}),t[16]=h,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(y=!n.configured&&!s.draft.apiKey?.trim()&&(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==m||t[26]!==v?(b=(0,Z.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:m,className:`yuri-settings-section-stack`,children:[v,y]}),t[24]=y,t[25]=m,t[26]=v,t[27]=b):b=t[27],b}function fe({runtime:e,onClose:r}){let{t:i}=ee(),a=O(),c=E(t=>t.progress[e]?.step??0),[v,b]=G.useState(`magpie`),[x,C]=G.useState(),[A,M]=G.useState(Q.slice(1)),[N,P]=G.useState(`tour`),[I,L]=G.useState(null),[R,B]=G.useState(!1),[te,ne]=G.useState({disabled:!0}),[V,H]=G.useState(null),re=n(),U=t(),W=G.useRef(null),K=G.useRef(!1);G.useEffect(()=>{let e=new AbortController;return W.current=e,()=>e.abort()},[]);let J=k(),Y=o({...j(a,Q.slice(1),!1,U,!0),enabled:c===1}),X=o({...T(U),enabled:c===3}),oe=J.data?.entries??[],fe=e=>{let t=f.getState(),n=e&&t.providers.some(t=>t.id===e);b(`other`),C(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),P(`providers`)},$=()=>!W.current?.signal.aborted&&re===n()&&U===t(),pe=t=>{P(`tour`),H(null),E.getState().move(e,t)},me=()=>{$()&&r()},he=()=>{c===3?me():pe(c+1)},ge=async()=>{if(c===2){he();return}if(!(K.current||R||!W.current)){K.current=!0,B(!0),H(null);try{let e=c===0?v===`magpie`?[Q[0]]:[]:A;if(e.length){let t=await ae(e,a,W.current.signal);if(!$())return;if(t.failed.length){H(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&v===`other`){let e=await s.fetchQuery({...d(a,U),staleTime:0});if(!$())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){H(i(`tour.noModels`));return}await f.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}$()&&he()}catch{$()&&H(i(`tour.operationFailed`))}finally{K.current=!1,$()&&B(!1)}}},_e=()=>{I===null?N===`tour`?c>0&&pe(c-1):P(`tour`):L(null)},ve=I===null?void 0:Y.data?.[Q[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,Z.jsx)(_,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||N!==`tour`?_e():me())},children:(0,Z.jsxs)(h,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,Z.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,Z.jsx)(y,{width:440,height:440})}),(0,Z.jsx)(m,{children:(0,Z.jsxs)(g,{className:`yuri-tour-title`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,Z.jsxs)(G.Fragment,{children:[t>0&&(0,Z.jsx)(D,{width:`2.05em`}),(0,Z.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,Z.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,Z.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:ce.map((e,t)=>(0,Z.jsxs)(u,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),pe(t)},children:[(0,Z.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,Z.jsx)(`span`,{children:i(e)})]},e))}),(0,Z.jsx)(`div`,{className:l(`yuri-tour-content`,N===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,Z.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?N===`providers`?(0,Z.jsx)(F,{initialConnectionId:x}):N===`voice`&&X.data?(0,Z.jsx)(de,{settings:X.data,onComplete:me,onBusy:B}):N===`asr`||N===`tts`?(0,Z.jsx)(z,{section:N}):(0,Z.jsxs)(Z.Fragment,{children:[c<2&&(c===1&&Y.isError||J.isError)&&(0,Z.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,Z.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,Z.jsx)(u,{size:`xs`,onClick:()=>{c===1&&Y.refetch(),J.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:l(`yuri-tour-magpie yuri-tour-select-card`,v===`magpie`&&`yuri-tour-card-selected`),children:[(0,Z.jsx)(u,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":v===`magpie`,onClick:()=>b(v===`magpie`?`other`:`magpie`),children:(0,Z.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:v===`magpie`&&(0,Z.jsx)(p,{name:`check`,className:`size-5`})})}),(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,Z.jsx)(S,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,Z.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,Z.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,Z.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,Z.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,Z.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,Z.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,Z.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:le.map(e=>(0,Z.jsxs)(u,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>fe(e.id),children:[(0,Z.jsx)(S,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,Z.jsx)(`span`,{children:e.name})]},e.id))}),(0,Z.jsxs)(u,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>fe(),children:[i(`tour.otherProvider`),(0,Z.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,Z.jsx)(ue,{index:e,info:Y.data?.[Q[e]],installed:ie(oe,Q[e]),selected:A.includes(Q[e]),onSelect:()=>M(t=>t.includes(Q[e])?t.filter(t=>t!==Q[e]):[...t,Q[e]]),onReadme:()=>L(e)},e))}),(0,Z.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,Z.jsx)(se,{onBusy:B,directory:a,onPrimaryChange:ne,onComplete:()=>pe(3)}),c===3&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,Z.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,Z.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(p,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,Z.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,Z.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,Z.jsxs)(u,{size:`sm`,onClick:()=>P(`asr`),children:[i(`tour.configureInput`),(0,Z.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(p,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,Z.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,Z.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,Z.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(S,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(p,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,Z.jsxs)(u,{size:`sm`,onClick:()=>P(`tts`),children:[i(`tour.configureReadAloud`),(0,Z.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,Z.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,Z.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,Z.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,Z.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,Z.jsx)(u,{disabled:!X.data,size:`sm`,onClick:()=>P(`voice`),children:i(`tour.configureVoice`)})]}),X.isError&&(0,Z.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,Z.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,Z.jsx)(u,{size:`xs`,onClick:()=>void X.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[q[I].name,` · README`]}),ye?(0,Z.jsx)(w,{content:ye,enableFileReferences:!1}):(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),V&&I===null&&(0,Z.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:V})]})})]}),(0,Z.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(N!==`tour`||I!==null)&&(0,Z.jsx)(u,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,Z.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,Z.jsx)(u,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,Z.jsxs)(u,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||te.disabled,"aria-busy":R,children:[R&&(0,Z.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(te.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,Z.jsx)(u,{size:`sm`,disabled:R,type:N===`voice`?`submit`:`button`,form:N===`voice`?`yuri-tour-voice`:void 0,onClick:N===`voice`?void 0:me,children:i(N===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,Z.jsxs)(u,{size:`sm`,disabled:R||c<2&&(!J.data||J.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,Z.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{fe as SetupTourDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-D0YWp3FJ.js";import{S as n}from"./desktop-BAmoc_34.js";import{at as r,ot as i,st as a}from"./vendor-base-ui-CzHs0bHY.js";import{l as o,r as s,u as c}from"./useUIStore-BerIUSLP.js";import{u as l}from"./fileQueries-C2Rs6TPz.js";import{o as u}from"./terminalApi-BMWW_0wH.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-C-gRcs_2.js";import{p as v}from"./useMobileNavigationStore-DHX2bCjA.js";import{n as y}from"./useThemeSystem-CNzUUkFn.js";import{n as b}from"./Icon-OJf0qBKf.js";import{r as ee}from"./device-w1ioiqv3.js";import{n as x}from"./useEffectiveDirectory-F4aXdQ21.js";import{t as te}from"./OverlayScrollbar-CZD1yU06.js";import{t as S}from"./sortable-tabs-strip-CiP6RIQa.js";import{n as C,t as w}from"./useFontPreferences-CEK8G_Ps.js";import{r as T}from"./projectActions-BX0cjZoq.js";var E=e(a(),1);function ne(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function re(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ie=e(r(),1),D=i(),O=null;function k(){return O||=f.load(),O}function ae(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var oe=E.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0},f)=>{let{t:_}=h(),v=E.useRef(null),y=E.useRef(null),b=E.useRef(null),ee=E.useRef(null),x=E.useRef(n),S=E.useRef(r),C=E.useRef(null),w=E.useRef(``),T=E.useRef(null),ne=E.useRef(!1),O=E.useRef(null),oe=E.useRef(!0),A=E.useRef(null),j=E.useRef(null),se=E.useRef(0),ce=E.useRef(null),M=E.useRef(null),N=E.useRef(!1),P=E.useRef(!1),le=E.useRef(null),ue=E.useRef(null),de=E.useRef(null),F=E.useRef(``),fe=E.useRef(null),pe=E.useRef(!c),me=E.useRef(u),[,he]=E.useReducer(e=>e+1,0),[ge,_e]=E.useReducer(e=>e+1,0);x.current=n,S.current=r;let ve=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c;E.useEffect(()=>{if(!c){pe.current=!0,me.current=u;return}!me.current&&u&&(pe.current=!1),me.current=u},[c,u]);let ye=E.useCallback(()=>{if(!I)return;let e=v.current,t=ce.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=E.useCallback(e=>{if(fe.current===e)return;let t=b.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),fe.current=e;return}t.options&&(t.options.cursorBlink=e,fe.current=e)}catch{}},[]),R=I&&ve,z=E.useCallback((e,t)=>{let n=R?M.current:ce.current,r=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{}}},[R]),B=E.useCallback(()=>{if(I){z(),L(!0);return}b.current?.focus(),L(!0)},[z,L,I]),V=E.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),H=E.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),be=E.useCallback(e=>{if(typeof window>`u`||R)return;de.current!==null&&(window.clearTimeout(de.current),de.current=null);let t=0,n=()=>{de.current=window.setTimeout(()=>{de.current=null;let r=V(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&x.current(a.replace(/\r\n|\r|\n/g,`\r`)),H(e),F.current=``},t===0?0:24)};n()},[H,V,R]);E.useEffect(()=>{let e=v.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}z()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,z]);let U=E.useCallback(()=>{let e=b.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),xe=E.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=v.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),Se=E.useCallback(async()=>{if(typeof document>`u`)return;let e=U()||xe();e.trim()&&await m(e)},[xe,U]),Ce=E.useCallback(()=>U().trim()?!0:!!xe().trim(),[xe,U]);E.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Ce()&&(e.preventDefault(),Se())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[Se,Ce]);let W=E.useCallback(()=>{w.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,ne.current=!1,O.current=null},[]),G=E.useCallback(()=>{let e=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=C.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(C.current=n,S.current(n.cols,n.rows))}catch{}},[]),K=E.useCallback(()=>{if(ne.current)return;let e=b.current;if(!e){W();return}if(!w.current)return;let t=w.current;w.current=``,ne.current=!0,e.write(t,()=>{ne.current=!1,w.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())})},[W]),we=E.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())},[K]),q=E.useCallback(e=>{e&&(w.current+=e,we())},[we]),Te=E.useCallback(()=>{if(A.current?.(),A.current=null,j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),!c){se.current=0;return}let e=v.current;if(!e)return;let t=b.current;if(!t)return;se.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,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){I?z(n.clientX,n.clientY):c&&!pe.current&&(pe.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`,A.current=()=>{m(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.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];I?z(t?.clientX,t?.clientY):c&&!pe.current&&(pe.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`,A.current=()=>{m(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.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,I,z,o]);E.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=I?-1:0,I){let e=m.focus.bind(m),t=m;t.focus=((...e)=>{z()}),f=()=>{t.focus=e}}let h=()=>{L(!0)},g=()=>{L(!1)},_=e=>{let t=e.target;if(t&&m.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),z()},0),L(!1);return}if(c&&!pe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},te=()=>{L(!1)},S=null;return(async()=>{try{let f=await k();if(e)return;let _=re(a,o,i,f,!1),v=new d(_);oe.current=!0,I&&(v.focus=()=>{});let te=v;if(typeof te.scrollToBottom==`function`){let e=te.scrollToBottom.bind(te);te.scrollToBottom=()=>{oe.current&&e()},l=()=>{te.scrollToBottom=e}}let C=new p;if(t=v,b.current=v,ee.current=C,v.loadAddon(C),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}}}_e(),fe.current=!1,S=v.textarea??m.querySelector(`textarea`),S&&(S.addEventListener(`focus`,h),S.addEventListener(`blur`,g)),ye(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ye()}),r.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let w=ae(m);w?(w.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),y.current=w,he()):y.current=null,G();let T=C;typeof T.observeResize==`function`&&T.observeResize(),Te(),s=[v.onData(e=>{x.current(e)}),v.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof v.hasSelection==`function`&&v.hasSelection();oe.current=!t&&e<=.5}}),v.onSelectionChange(()=>{if(typeof v.hasSelection==`function`&&v.hasSelection()){oe.current=!1;return}let e=typeof v.getViewportY==`function`?v.getViewportY():0;oe.current=e<=.5})],n=new ResizeObserver(()=>{G()}),n.observe(m),typeof window<`u`&&window.setTimeout(()=>{G()},0)}catch{}})(),document.addEventListener(`focusin`,_,!0),window.addEventListener(`blur`,te),()=>{e=!0,A.current?.(),A.current=null,document.removeEventListener(`focusin`,_,!0),window.removeEventListener(`blur`,te),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,S&&(S.removeEventListener(`focus`,h),S.removeEventListener(`blur`,g)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),b.current=null,ee.current=null,y.current=null,C.current=null,fe.current=null,W()}},[ye,c,G,z,a,o,Te,i,W,L,I]),E.useEffect(()=>{let e=b.current;e&&(e.reset(),W(),C.current=null,G())},[e,ge,G,W]),E.useEffect(()=>{l&&b.current&&B()},[l,B,e,ge]),E.useEffect(()=>(Te(),()=>{A.current?.(),A.current=null}),[Te,e]),E.useEffect(()=>{let e=b.current;if(!e)return;if(t.length===0){O.current!==null&&(e.reset(),W(),G());return}let n=O.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&q(r.map(e=>e.data).join(``)),O.current=t[t.length-1].id},[t,ge,q,G,W]),E.useImperativeHandle(f,()=>({focus:()=>{B()},clear:()=>{let e=b.current;e&&(e.reset(),W(),G())},fit:()=>{G()}}),[B,G,W]);let J=E.useCallback(e=>{if(!I)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)},[I]),Y=E.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(ue.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){N.current=!0;return}if(!n&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertText`&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertLineBreak`){if(N.current)return;e.preventDefault(),x.current(`\r`),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`deleteContentBackward`){if(N.current)return;e.preventDefault(),x.current(``),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0}},[]),X=E.useCallback(e=>{let t=e.currentTarget;if(ue.current=typeof performance<`u`?performance.now():Date.now(),N.current)return;if(P.current){let e=le.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){P.current=!1,H(t);return}P.current=!1}let n=V(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),F.current=``},[H,V]),Ee=E.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&Ce()){e.preventDefault(),Se();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(String.fromCharCode(t.charCodeAt(0)-64)),H(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(`\x1B`+e.key),H(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),x.current(i),H(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=le.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),x.current(`\r`),H(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;V(a)||x.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=ue.current;t&&s-t<50||(e.preventDefault(),x.current(e.key),P.current=!0,le.current={type:`keydown-text`,at:s})}be(a)},[H,Se,Ce,V,be]),De=E.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||be(t)},[be]),Oe=E.useCallback(e=>{let t=e.currentTarget;N.current=!1;let n=e.data||V(t);if(ue.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),le.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0},[H,V]),ke=E.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=b.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;x.current(n)},[]),Ae={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,D.jsxs)(`div`,{ref:v,className:g(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!Ce()){let t=e.touches?.[0];z(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(Ce())return;z(e.clientX,e.clientY)}else b.current?.focus()},onMouseUp:()=>{!c&&Ce()&&Se()},onTouchEnd:()=>{!c&&Ce()&&Se()},children:[I&&typeof document<`u`?(0,ie.createPortal)((0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{ref:M,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`block`:`none`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke}),(0,D.jsx)(`textarea`,{ref:ce,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`none`:`block`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke})]}),document.body):null,y.current&&!c?(0,D.jsx)(te,{containerRef:y,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});oe.displayName=`TerminalViewport`;var A=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),j=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,se=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ce=/Serving HTTP on .*? port (\d{2,5})/i,M=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),N=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(M.has(e)){t=t.slice(0,-1);continue}break}return t},P=e=>{let t=N(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},le=e=>{if(!e)return null;let t=e.replace(A,``),n=t.match(ce);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-D0YWp3FJ.js";import{S as n}from"./desktop-BAmoc_34.js";import{at as r,ot as i,st as a}from"./vendor-base-ui-CzHs0bHY.js";import{l as o,r as s,u as c}from"./useUIStore-BerIUSLP.js";import{u as l}from"./fileQueries-C2Rs6TPz.js";import{o as u}from"./terminalApi-BMWW_0wH.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-C-gRcs_2.js";import{p as v}from"./useMobileNavigationStore-BeJ4ikzg.js";import{n as y}from"./useThemeSystem-CNzUUkFn.js";import{n as b}from"./Icon-OJf0qBKf.js";import{r as ee}from"./device-w1ioiqv3.js";import{n as x}from"./useEffectiveDirectory-bp20IWKE.js";import{t as te}from"./OverlayScrollbar-CZD1yU06.js";import{t as S}from"./sortable-tabs-strip-CiP6RIQa.js";import{n as C,t as w}from"./useFontPreferences-CEK8G_Ps.js";import{r as T}from"./projectActions-BX0cjZoq.js";var E=e(a(),1);function ne(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function re(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ie=e(r(),1),D=i(),O=null;function k(){return O||=f.load(),O}function ae(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var oe=E.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0},f)=>{let{t:_}=h(),v=E.useRef(null),y=E.useRef(null),b=E.useRef(null),ee=E.useRef(null),x=E.useRef(n),S=E.useRef(r),C=E.useRef(null),w=E.useRef(``),T=E.useRef(null),ne=E.useRef(!1),O=E.useRef(null),oe=E.useRef(!0),A=E.useRef(null),j=E.useRef(null),se=E.useRef(0),ce=E.useRef(null),M=E.useRef(null),N=E.useRef(!1),P=E.useRef(!1),le=E.useRef(null),ue=E.useRef(null),de=E.useRef(null),F=E.useRef(``),fe=E.useRef(null),pe=E.useRef(!c),me=E.useRef(u),[,he]=E.useReducer(e=>e+1,0),[ge,_e]=E.useReducer(e=>e+1,0);x.current=n,S.current=r;let ve=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c;E.useEffect(()=>{if(!c){pe.current=!0,me.current=u;return}!me.current&&u&&(pe.current=!1),me.current=u},[c,u]);let ye=E.useCallback(()=>{if(!I)return;let e=v.current,t=ce.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=E.useCallback(e=>{if(fe.current===e)return;let t=b.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),fe.current=e;return}t.options&&(t.options.cursorBlink=e,fe.current=e)}catch{}},[]),R=I&&ve,z=E.useCallback((e,t)=>{let n=R?M.current:ce.current,r=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{}}},[R]),B=E.useCallback(()=>{if(I){z(),L(!0);return}b.current?.focus(),L(!0)},[z,L,I]),V=E.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),H=E.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),be=E.useCallback(e=>{if(typeof window>`u`||R)return;de.current!==null&&(window.clearTimeout(de.current),de.current=null);let t=0,n=()=>{de.current=window.setTimeout(()=>{de.current=null;let r=V(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&x.current(a.replace(/\r\n|\r|\n/g,`\r`)),H(e),F.current=``},t===0?0:24)};n()},[H,V,R]);E.useEffect(()=>{let e=v.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}z()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,z]);let U=E.useCallback(()=>{let e=b.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),xe=E.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=v.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),Se=E.useCallback(async()=>{if(typeof document>`u`)return;let e=U()||xe();e.trim()&&await m(e)},[xe,U]),Ce=E.useCallback(()=>U().trim()?!0:!!xe().trim(),[xe,U]);E.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Ce()&&(e.preventDefault(),Se())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[Se,Ce]);let W=E.useCallback(()=>{w.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,ne.current=!1,O.current=null},[]),G=E.useCallback(()=>{let e=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=C.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(C.current=n,S.current(n.cols,n.rows))}catch{}},[]),K=E.useCallback(()=>{if(ne.current)return;let e=b.current;if(!e){W();return}if(!w.current)return;let t=w.current;w.current=``,ne.current=!0,e.write(t,()=>{ne.current=!1,w.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())})},[W]),we=E.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())},[K]),q=E.useCallback(e=>{e&&(w.current+=e,we())},[we]),Te=E.useCallback(()=>{if(A.current?.(),A.current=null,j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),!c){se.current=0;return}let e=v.current;if(!e)return;let t=b.current;if(!t)return;se.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,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){I?z(n.clientX,n.clientY):c&&!pe.current&&(pe.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`,A.current=()=>{m(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.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];I?z(t?.clientX,t?.clientY):c&&!pe.current&&(pe.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`,A.current=()=>{m(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.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,I,z,o]);E.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=I?-1:0,I){let e=m.focus.bind(m),t=m;t.focus=((...e)=>{z()}),f=()=>{t.focus=e}}let h=()=>{L(!0)},g=()=>{L(!1)},_=e=>{let t=e.target;if(t&&m.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),z()},0),L(!1);return}if(c&&!pe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},te=()=>{L(!1)},S=null;return(async()=>{try{let f=await k();if(e)return;let _=re(a,o,i,f,!1),v=new d(_);oe.current=!0,I&&(v.focus=()=>{});let te=v;if(typeof te.scrollToBottom==`function`){let e=te.scrollToBottom.bind(te);te.scrollToBottom=()=>{oe.current&&e()},l=()=>{te.scrollToBottom=e}}let C=new p;if(t=v,b.current=v,ee.current=C,v.loadAddon(C),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}}}_e(),fe.current=!1,S=v.textarea??m.querySelector(`textarea`),S&&(S.addEventListener(`focus`,h),S.addEventListener(`blur`,g)),ye(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ye()}),r.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let w=ae(m);w?(w.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),y.current=w,he()):y.current=null,G();let T=C;typeof T.observeResize==`function`&&T.observeResize(),Te(),s=[v.onData(e=>{x.current(e)}),v.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof v.hasSelection==`function`&&v.hasSelection();oe.current=!t&&e<=.5}}),v.onSelectionChange(()=>{if(typeof v.hasSelection==`function`&&v.hasSelection()){oe.current=!1;return}let e=typeof v.getViewportY==`function`?v.getViewportY():0;oe.current=e<=.5})],n=new ResizeObserver(()=>{G()}),n.observe(m),typeof window<`u`&&window.setTimeout(()=>{G()},0)}catch{}})(),document.addEventListener(`focusin`,_,!0),window.addEventListener(`blur`,te),()=>{e=!0,A.current?.(),A.current=null,document.removeEventListener(`focusin`,_,!0),window.removeEventListener(`blur`,te),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,S&&(S.removeEventListener(`focus`,h),S.removeEventListener(`blur`,g)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),b.current=null,ee.current=null,y.current=null,C.current=null,fe.current=null,W()}},[ye,c,G,z,a,o,Te,i,W,L,I]),E.useEffect(()=>{let e=b.current;e&&(e.reset(),W(),C.current=null,G())},[e,ge,G,W]),E.useEffect(()=>{l&&b.current&&B()},[l,B,e,ge]),E.useEffect(()=>(Te(),()=>{A.current?.(),A.current=null}),[Te,e]),E.useEffect(()=>{let e=b.current;if(!e)return;if(t.length===0){O.current!==null&&(e.reset(),W(),G());return}let n=O.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&q(r.map(e=>e.data).join(``)),O.current=t[t.length-1].id},[t,ge,q,G,W]),E.useImperativeHandle(f,()=>({focus:()=>{B()},clear:()=>{let e=b.current;e&&(e.reset(),W(),G())},fit:()=>{G()}}),[B,G,W]);let J=E.useCallback(e=>{if(!I)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)},[I]),Y=E.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(ue.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){N.current=!0;return}if(!n&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertText`&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertLineBreak`){if(N.current)return;e.preventDefault(),x.current(`\r`),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`deleteContentBackward`){if(N.current)return;e.preventDefault(),x.current(``),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0}},[]),X=E.useCallback(e=>{let t=e.currentTarget;if(ue.current=typeof performance<`u`?performance.now():Date.now(),N.current)return;if(P.current){let e=le.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){P.current=!1,H(t);return}P.current=!1}let n=V(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),F.current=``},[H,V]),Ee=E.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&Ce()){e.preventDefault(),Se();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(String.fromCharCode(t.charCodeAt(0)-64)),H(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(`\x1B`+e.key),H(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),x.current(i),H(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=le.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),x.current(`\r`),H(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;V(a)||x.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=ue.current;t&&s-t<50||(e.preventDefault(),x.current(e.key),P.current=!0,le.current={type:`keydown-text`,at:s})}be(a)},[H,Se,Ce,V,be]),De=E.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||be(t)},[be]),Oe=E.useCallback(e=>{let t=e.currentTarget;N.current=!1;let n=e.data||V(t);if(ue.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),le.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0},[H,V]),ke=E.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=b.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;x.current(n)},[]),Ae={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,D.jsxs)(`div`,{ref:v,className:g(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!Ce()){let t=e.touches?.[0];z(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(Ce())return;z(e.clientX,e.clientY)}else b.current?.focus()},onMouseUp:()=>{!c&&Ce()&&Se()},onTouchEnd:()=>{!c&&Ce()&&Se()},children:[I&&typeof document<`u`?(0,ie.createPortal)((0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{ref:M,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`block`:`none`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke}),(0,D.jsx)(`textarea`,{ref:ce,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":_(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`none`:`block`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke})]}),document.body):null,y.current&&!c?(0,D.jsx)(te,{containerRef:y,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});oe.displayName=`TerminalViewport`;var A=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),j=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,se=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ce=/Serving HTTP on .*? port (\d{2,5})/i,M=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),N=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(M.has(e)){t=t.slice(0,-1);continue}break}return t},P=e=>{let t=N(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},le=e=>{if(!e)return null;let t=e.replace(A,``),n=t.match(ce);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
|
|
2
2
|
`);for(let e of r){if(!se.test(e))continue;let t=Array.from(e.matchAll(j));if(t.length!==0)return P((t.find(e=>{try{return!!new URL(P(e[1])).port}catch{return!1}})??t[0])[1])}return null},ue=async(e,n=1500)=>{if(!e||typeof window>`u`)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!==`http:`&&r.protocol!==`https:`)return!1;let i=r.hostname.toLowerCase();if(i!==`localhost`&&i!==`127.0.0.1`&&i!==`0.0.0.0`&&i!==`::1`&&i!==`::`)return!1;let a=new AbortController,o=window.setTimeout(()=>a.abort(),n);try{let e=await t(`/api/system/probe-url`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:r.toString()}),cache:`no-store`,signal:a.signal});return e.ok?(await e.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(o)}},de={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},F={ctrl:`5`,cmd:`3`},fe={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},pe={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},me=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${F[t]}A`;case`arrow-down`:return`\u001b[1;${F[t]}B`;case`arrow-right`:return`\u001b[1;${F[t]}C`;case`arrow-left`:return`\u001b[1;${F[t]}D`}return de[e]??null},he=()=>{let{t:e}=h(),{terminal:t,runtime:r}=l(),{currentTheme:i}=y(),{monoFont:a}=w(),d=s(e=>e.terminalFontSize),f=s(e=>e.bottomTerminalHeight),p=s(e=>e.isBottomTerminalExpanded),{isMobile:m,isTablet:te,hasTouchOnlyPointer:re}=ee(),ie=m||te,O=(ie||re)&&r.platform===`web`,k=r.platform!==`vscode`,ae=s(e=>e.showTerminalQuickKeysOnDesktop),A=!n()&&(ie||ae),j=v(e=>e.currentSessionId),se=v(e=>e.newSessionDraft),ce=j!==null||se?.open===!0,M=x()??null,N=C(e=>e.sessions),P=C(e=>e.hasHydrated),de=C(e=>e.ensureDirectory),F=C(e=>e.createTab),he=C(e=>e.setActiveTab),ge=C(e=>e.closeTab),_e=C(e=>e.setTabSessionId),ve=C(e=>e.setTabLifecycle),I=C(e=>e.setConnecting),ye=C(e=>e.appendToBuffer),L=C(e=>e.setTabPreviewUrl),R=C(e=>e.clearBuffer),z=s(e=>e.openContextPreview),B=E.useMemo(()=>{if(M)return N.get(M)},[N,M]),V=E.useMemo(()=>B?k?B.activeTabId??B.tabs[0]?.id??null:B.tabs[0]?.id??null:null,[B,k]),H=E.useMemo(()=>{if(B)return V?B.tabs.find(e=>e.id===V)??B.tabs[0]:B.tabs[0]},[B,V]),be=E.useMemo(()=>(B?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?T[t.iconKey]??`terminal`:`terminal`;return(0,D.jsx)(b,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[B?.tabs,e]),U=H?.terminalSessionId??null,xe=H?.lifecycle??`idle`,Se=H?.bufferChunks??[],Ce=H?.isConnecting??!1,W=H?.previewUrl??null,[G,K]=E.useState(null),[we,q]=E.useState(!1),[Te,J]=E.useState(!1),[Y,X]=E.useState(null),[Ee,De]=E.useState(!1),[Oe,ke]=E.useState(0),Ae=E.useRef(null),je=E.useRef(null),Me=E.useRef(V),Ne=E.useRef(U),Pe=E.useRef(M),Fe=E.useRef(null),Ie=E.useRef(null),Le=E.useRef(!1),Re=E.useRef(!1),ze=E.useRef(null),Be=E.useRef(null),Ve=E.useRef(new Set),He=E.useRef(!1),Ue=E.useRef(``),We=E.useRef(new Set),Ge=E.useRef(0),Ke=E.useCallback(()=>{Ue.current=``,We.current.clear(),Ge.current+=1},[]),qe=E.useCallback(()=>{O||typeof document<`u`&&!document.hasFocus()||Fe.current?.focus()},[O]),Je=E.useCallback(()=>{O||Fe.current?.focus()},[O]);E.useEffect(()=>{if(!P||He.current)return;He.current=!0;let e=new Set;for(let[,t]of C.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Ve.current=e},[P]);let Ye=s(e=>e.activeMainTab),Xe=s(e=>e.isBottomTerminalOpen),Ze=s(e=>e.setBottomTerminalOpen),Qe=s(e=>e.setBottomTerminalExpanded),$e=Ye===`terminal`,Z=$e||Xe,[et,tt]=E.useState(Z);E.useEffect(()=>{!Z||r.platform===`vscode`||u()},[Z,r.platform]),E.useEffect(()=>{Z&&tt(!0)},[Z]),E.useEffect(()=>{Re.current=Z},[Z]),E.useEffect(()=>{Ne.current=U},[U]),E.useEffect(()=>{Me.current=V,Ke()},[V,Ke]),E.useEffect(()=>{Pe.current=M},[M]),E.useEffect(()=>{!A&&Y!==null&&X(null)},[A,Y,X]),E.useEffect(()=>{!U&&Y!==null&&X(null)},[U,Y,X]);let Q=E.useCallback(()=>{Ae.current?.(),Ae.current=null,je.current=null,ze.current=null,J(!1)},[]);E.useEffect(()=>()=>{Q(),Ne.current=null},[Q]);let nt=E.useCallback((e,t,n)=>{if(!n)return;let r=`${Ue.current}${n}`.replace(/\r\n|\r/g,`
|
|
3
3
|
`),i=r.split(`
|
|
4
4
|
`),a=r.endsWith(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,t as n,v as r,w as i}from"./runtime-auth-DBn9yahL.js";import{c as a,i as o}from"./runtime-switch-DEZ1K7qW.js";import{n as s}from"./runtime-fetch-D0YWp3FJ.js";import{T as c}from"./desktop-BAmoc_34.js";import{t as l}from"./runtimeAPIRegistry-C2VogTny.js";import{at as u,ot as d,st as f}from"./vendor-base-ui-CzHs0bHY.js";import{v as p}from"./useUIStore-BerIUSLP.js";import{n as m}from"./vendor-react-DlzBev0S.js";import{s as h}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{c as g,f as _,o as v,s as y}from"./runtime-file-resource-BP4P52ry.js";import{a as b,n as x}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as S,t as C}from"./runtime-file-download-D6bwc3Kj.js";import{n as w}from"./platform-sEg2IOLZ.js";import{a as T,i as E}from"./vendor-pierre-diffs-BFiZ3IhI.js";import{i as D}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as O,r as k,t as A}from"./button-C-gRcs_2.js";import{n as j,t as M}from"./useThemeSystem-CNzUUkFn.js";import{l as ee,o as te,s as N,u as P}from"./vendor-framer-motion-DDMKlXiP.js";import{n as F}from"./Icon-OJf0qBKf.js";import{n as I,t as L}from"./dialog-3UseH0hM.js";import{t as R}from"./tap-LkQum5bB.js";import{r as z}from"./themes-BgDJcxRc.js";import{t as B}from"./MobileWindowStack-DGLdgoGr.js";import{t as V}from"./appThemeRegistry-
|
|
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-DBn9yahL.js";import{c as a,i as o}from"./runtime-switch-DEZ1K7qW.js";import{n as s}from"./runtime-fetch-D0YWp3FJ.js";import{T as c}from"./desktop-BAmoc_34.js";import{t as l}from"./runtimeAPIRegistry-C2VogTny.js";import{at as u,ot as d,st as f}from"./vendor-base-ui-CzHs0bHY.js";import{v as p}from"./useUIStore-BerIUSLP.js";import{n as m}from"./vendor-react-DlzBev0S.js";import{s as h}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{c as g,f as _,o as v,s as y}from"./runtime-file-resource-BP4P52ry.js";import{a as b,n as x}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as S,t as C}from"./runtime-file-download-D6bwc3Kj.js";import{n as w}from"./platform-sEg2IOLZ.js";import{a as T,i as E}from"./vendor-pierre-diffs-BFiZ3IhI.js";import{i as D}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as O,r as k,t as A}from"./button-C-gRcs_2.js";import{n as j,t as M}from"./useThemeSystem-CNzUUkFn.js";import{l as ee,o as te,s as N,u as P}from"./vendor-framer-motion-DDMKlXiP.js";import{n as F}from"./Icon-OJf0qBKf.js";import{n as I,t as L}from"./dialog-3UseH0hM.js";import{t as R}from"./tap-LkQum5bB.js";import{r as z}from"./themes-BgDJcxRc.js";import{t as B}from"./MobileWindowStack-DGLdgoGr.js";import{t as V}from"./appThemeRegistry-Bt-gBmVi.js";import{a as ne,n as re}from"./MarkdownRenderer-eLQNc5xA.js";import{a as ie}from"./toolHelpers-iEHVHQ9p.js";import{n as ae}from"./useEffectiveDirectory-bp20IWKE.js";import{a as oe,c as se,i as H,o as ce}from"./image-loading-DKQOYtti.js";import{t as le}from"./ImageLoadingPlaceholder-DlQbo9CM.js";import{c as ue,d as de,f as fe,h as U,l as pe,m as me,n as W,o as G,p as K,t as he,u as ge,y as _e}from"./useWorkerHighlightedLines-DCuDVobw.js";import{t as q}from"./vendor-tanstack-react-virtual-DSFNK3qc.js";import{n as J}from"./markdownTheme-CHNl6tUv.js";import{n as ve}from"./mobileBackNavigation-C9Yye3Qn.js";import{t as ye}from"./touch-gestures-CErgaXZ7.js";var Y=m(),X=e(f(),1),Z=d(),be=80,xe=20,Se=X.memo(e=>{let t=(0,Y.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=J(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(Te).join(`
|
|
2
2
|
`),t[2]=n,t[3]=f);let p=he(f,r);if(!(n.length>be)){let e=d,r;t[4]!==s||t[5]!==e?(r={...e,maxHeight:s,overflow:`auto`},t[4]=s,t[5]=e,t[6]=r):r=t[6];let i;if(t[7]!==p||t[8]!==o||t[9]!==n||t[10]!==c){let e;t[12]!==p||t[13]!==o||t[14]!==c?(e=(e,t)=>(0,Z.jsx)(we,{line:e,html:p?.[t],showLineNumbers:c,style:o?.(e)},t),t[12]=p,t[13]=o,t[14]=c,t[15]=e):e=t[15],i=n.map(e),t[7]=p,t[8]=o,t[9]=n,t[10]=c,t[11]=i}else i=t[11];let a;return t[16]!==r||t[17]!==i?(a=(0,Z.jsx)(`div`,{className:`typography-code font-mono w-full min-w-0`,style:r,children:i}),t[16]=r,t[17]=i,t[18]=a):a=t[18],a}let m;return t[19]!==p||t[20]!==o||t[21]!==n||t[22]!==s||t[23]!==c||t[24]!==d?(m=(0,Z.jsx)(Ce,{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});Se.displayName=`VirtualizedCodeBlock`;var Ce=X.memo(({lines:e,highlighted:t,syntaxVars:n,maxHeight:r,showLineNumbers:i,lineStyles:a})=>{let o=X.useRef(null),s=`min(${e.length*xe}px, ${r})`,c=q({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>xe,overscan:20}),l=c.getVirtualItems();return(0,Z.jsx)(`div`,{ref:o,className:`typography-code font-mono w-full min-w-0`,style:{...n,height:s,maxHeight:r,overflow:`auto`},children:(0,Z.jsx)(`div`,{style:{height:c.getTotalSize(),position:`relative`},children:l.map(n=>{let r=e[n.index];return r?(0,Z.jsx)(`div`,{"data-index":n.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${n.start}px)`},children:(0,Z.jsx)(we,{line:r,html:t?.[n.index],showLineNumbers:i,style:a?.(r)})},n.index):null})})})});Ce.displayName=`VirtualizedRows`;var we=X.memo(e=>{let t=(0,Y.c)(12),{line:n,html:r,showLineNumbers:i,style:a}=e,o;t[0]!==n.isInfo||t[1]!==n.lineNumber||t[2]!==i?(o=i&&(0,Z.jsx)(`span`,{className:`w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5`,style:{color:`var(--tools-edit-line-number)`,borderColor:`var(--tools-border)`},children:!n.isInfo&&n.lineNumber!=null?n.lineNumber:``}),t[0]=n.isInfo,t[1]=n.lineNumber,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n.isInfo||t[6]!==n.text?(s=(0,Z.jsx)(`div`,{className:`flex-1 min-w-0`,children:n.isInfo?(0,Z.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground/70 italic`,children:n.text}):r===void 0?(0,Z.jsx)(`div`,{className:`whitespace-pre`,children:n.text}):(0,Z.jsx)(`div`,{className:`whitespace-pre`,dangerouslySetInnerHTML:{__html:r}})}),t[4]=r,t[5]=n.isInfo,t[6]=n.text,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`typography-code font-mono flex w-full min-w-0`,style:a,children:[o,s]}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c});we.displayName=`VirtualizedCodeBlock.Row`;function Te(e){return e.text}var Ee={maxDepth:50,maxNodes:1e5,initiallyExpandedDepth:2};function De(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`object`:typeof e==`string`?`string`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`null`}function Oe(e){if(e.length===0)return`root`;let t=`root`;for(let n of e)/^\d+$/.test(n)?t+=`[${n}]`:t+=`.${n}`;return t}var ke=0;function Ae(e,t,n,r,i){if(ke>=i.maxNodes)return null;ke++;let a=De(e),o=Oe(n),s=a===`object`||a===`array`,c={id:o,key:t,value:e,type:a,depth:r,path:n,isExpandable:s};if(s&&r<i.maxDepth){let t=a===`array`?e.map((e,t)=>[String(t),e]):Object.entries(e);c.childCount=t.length,c.children=[];for(let[e,a]of t){let t=Ae(a,e,[...n,e],r+1,i);t&&c.children.push(t)}}else s&&(c.childCount=a===`array`?e.length:Object.keys(e).length);return c}function je(e,t){let n={...Ee,...t};ke=0;try{let t=e.trim();return t?Ae(JSON.parse(t),`root`,[],0,n):null}catch{return null}}function Me(e,t){if(!e)return[];let n=[];function r(e){let i=!t.has(e.id);if(n.push({node:e,isExpanded:i}),e.isExpandable&&i&&e.children)for(let t of e.children)r(t)}return r(e),n}function Ne(e){if(!e)return[];let t=[];function n(e){if(e.isExpandable&&(t.push(e.id),e.children))for(let t of e.children)n(t)}return n(e),t}function Pe(e,t){if(!e)return[];let n=[];function r(e){if(e.isExpandable&&e.depth>=t&&n.push(e.id),e.children)for(let t of e.children)r(t)}return r(e),n}var Fe=[`var(--syntax-key)`,`color-mix(in oklch, var(--syntax-key) 85%, var(--syntax-string))`,`color-mix(in oklch, var(--syntax-key) 70%, var(--syntax-number))`,`color-mix(in oklch, var(--syntax-key) 55%, var(--syntax-function))`,`color-mix(in oklch, var(--syntax-key) 40%, var(--syntax-type))`,`color-mix(in oklch, var(--syntax-key) 30%, var(--syntax-keyword))`];function Ie(e){return Fe[e%Fe.length]}function Le(e){switch(e.type){case`string`:return`var(--syntax-string)`;case`number`:return`var(--syntax-number)`;case`boolean`:return`var(--syntax-keyword)`;case`null`:return`var(--syntax-comment)`;default:return`var(--surface-foreground)`}}function Re(e){switch(e.type){case`string`:{let t=e.value;return t.length>60?`"${t.slice(0,57)}..."`:`"${t}"`}case`number`:case`boolean`:return String(e.value);case`null`:return`null`;case`object`:return`{${e.childCount??0} ${e.childCount===1?`item`:`items`}}`;case`array`:return`[${e.childCount??0}]`;default:return String(e.value)}}function ze(e){if(e.type===`object`){let t=e.children?.map(e=>e.key).slice(0,3)??[],n=(e.childCount??0)>3?`, ...`:``;return`{ ${t.map(e=>`"${e}": ...`).join(`, `)}${n} }`}if(e.type===`array`){let t=e.childCount??0;return t<=3?`[${e.children?.map(e=>Re(e)).join(`, `)??``}]`:`[${t} items]`}return Re(e)}var Be=X.memo(e=>{let t=(0,Y.c)(29),{flatNode:n,onToggle:r,onCopyPath:i}=e,{node:a,isExpanded:o}=n,s=a.depth*20,c;t[0]!==a.id||t[1]!==r?(c=()=>{r(a.id)},t[0]=a.id,t[1]=r,t[2]=c):c=t[2];let l=c,u;t[3]!==a.id||t[4]!==i?(u=e=>{i&&(e.preventDefault(),i(a.id))},t[3]=a.id,t[4]=i,t[5]=u):u=t[5];let d=u,f;t[6]===a.depth?f=t[7]:(f=Ie(a.depth),t[6]=a.depth,t[7]=f);let p=f,m;t[8]===a?m=t[9]:(m=Le(a),t[8]=a,t[9]=m);let h=m,g=a.isExpandable&&a.children&&a.children.length>0,_=`${s+8}px`,v;t[10]===_?v=t[11]:(v={paddingLeft:_},t[10]=_,t[11]=v);let y;t[12]!==l||t[13]!==g||t[14]!==o?(y=g?(0,Z.jsx)(`button`,{type:`button`,onClick:l,className:`mr-1 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-[var(--interactive-hover)] text-muted-foreground`,children:o?(0,Z.jsx)(F,{name:`arrow-down-s`,className:`h-3 w-3`}):(0,Z.jsx)(F,{name:`arrow-right-s`,className:`h-3 w-3`})}):(0,Z.jsx)(`span`,{className:`mr-1 w-4`}),t[12]=l,t[13]=g,t[14]=o,t[15]=y):y=t[15];let b;t[16]!==p||t[17]!==a.key?(b=a.key!==`root`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`mr-1 font-semibold`,style:{color:p},children:/^\d+$/.test(a.key)?a.key:`"${a.key}"`}),(0,Z.jsx)(`span`,{className:`mr-1 text-[var(--surface-foreground)]`,children:`:`})]}),t[16]=p,t[17]=a.key,t[18]=b):b=t[18];let x;t[19]!==o||t[20]!==a||t[21]!==h?(x=a.isExpandable?o?(0,Z.jsx)(`span`,{className:`text-[var(--surface-foreground)]`,children:a.type===`object`?`{`:`[`}):(0,Z.jsx)(`span`,{style:{color:`var(--surface-mutedForeground)`},children:ze(a)}):(0,Z.jsx)(`span`,{style:{color:h},children:Re(a)}),t[19]=o,t[20]=a,t[21]=h,t[22]=x):x=t[22];let S;return t[23]!==d||t[24]!==v||t[25]!==y||t[26]!==b||t[27]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center py-0.5 px-2 hover:bg-[var(--surface-hover)] rounded-sm cursor-default font-mono text-xs leading-5 whitespace-nowrap`,style:v,onContextMenu:d,children:[y,b,x]}),t[23]=d,t[24]=v,t[25]=y,t[26]=b,t[27]=x,t[28]=S):S=t[28],S});Be.displayName=`JsonRow`;var Ve=200,He=22,Ue=X.forwardRef(function({data:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2,onCopyPath:i},a){let o=X.useMemo(()=>{try{return JSON.stringify(e)}catch{return null}},[e]),s=X.useMemo(()=>o?je(o):null,[o]),[c,l]=X.useState(()=>s?new Set(Pe(s,r)):new Set),u=X.useMemo(()=>Me(s,c),[s,c]),d=u.length>Ve,f=X.useRef(null),p=q({count:u.length,enabled:d,getScrollElement:()=>f.current,estimateSize:()=>He,overscan:20,getItemKey:e=>u[e]?.node.id??e}),m=X.useCallback(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=X.useCallback(()=>{l(new Set)},[]),g=X.useCallback(()=>{s&&l(new Set(Ne(s)))},[s]);return X.useImperativeHandle(a,()=>({expandAll:h,collapseAll:g}),[h,g]),s?d?(0,Z.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:(0,Z.jsx)(`div`,{style:{height:p.getTotalSize(),position:`relative`},children:p.getVirtualItems().map(e=>{let t=u[e.index];return t?(0,Z.jsx)(`div`,{"data-index":e.index,ref:p.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,Z.jsx)(Be,{flatNode:t,onToggle:m,onCopyPath:i})},t.node.id):null})})}):(0,Z.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:u.map(e=>(0,Z.jsx)(Be,{flatNode:e,onToggle:m,onCopyPath:i},e.node.id))}):null}),We=X.memo(function({jsonString:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2}){let{t:i}=O(),a=X.useRef(null),[o,s]=X.useState(null),c=X.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=X.useCallback(()=>{a.current?.expandAll()},[]),u=X.useCallback(()=>{a.current?.collapseAll()},[]);return o?(0,Z.jsx)(`div`,{className:t,children:(0,Z.jsxs)(`div`,{className:`rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4`,children:[(0,Z.jsx)(`div`,{className:`mb-1 font-medium text-[var(--surface-foreground)]`,children:i(`jsonTreeView.error.invalidJsonTitle`)}),(0,Z.jsx)(`div`,{className:`font-mono text-xs text-[var(--surface-mutedForeground)]`,children:o})]})}):c===null?null:(0,Z.jsxs)(`div`,{className:t,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1`,children:[(0,Z.jsxs)(A,{variant:`ghost`,size:`xs`,onClick:l,className:`gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(F,{name:`arrow-down-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.expandAll`)]}),(0,Z.jsxs)(A,{variant:`ghost`,size:`xs`,onClick:u,className:`gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(F,{name:`arrow-up-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.collapseAll`)]})]}),(0,Z.jsx)(`div`,{className:`bg-[var(--syntax-base-background)] py-1`,style:{maxHeight:n,overflow:`auto`},children:(0,Z.jsx)(Ue,{ref:a,data:c,maxHeight:n,initiallyExpandedDepth:r})})]})}),Ge=class extends Error{key;params;constructor(e,t){super(e),this.name=`MermaidLoadFailure`,this.key=e,this.params=t}},Ke=(e,t)=>new Ge(e,t),qe=e=>e instanceof Ge,Je=e=>e+1,Ye=(e,t)=>e===t,Xe=e=>{let t=e.indexOf(`,`);if(t<0)throw Ke(`chat.toolOutputDialog.mermaid.dataUrlMalformed`);let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1);return n.includes(`;base64`)?atob(r):decodeURIComponent(r)},Ze=e=>Promise.resolve().then(()=>Xe(e)),Qe=1,$e=56,Q=(e,t,n)=>Math.min(n,Math.max(t,e)),et=({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)>=$e&&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`},tt=(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)}},nt=(e,t)=>{let n=t.minScale??Qe,r=t.maxScale??5,i=Q(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:Q(e.x,-a,a),y:Q(e.y,-o,o)}},rt=(e,t,n,r,i)=>{let a=Q(t,i.minScale??Qe,i.maxScale??5),o=a/e.scale;return nt({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)},it=(e,t,n)=>nt({...e,x:e.x+t.x,y:e.y+t.y},n),at=.25,ot=32,st=(e,t)=>({scale:1-Math.min(.45,e/t*.65),opacity:Q(1-e/(t*.55),.15,1)}),ct=(e,t,n,r)=>n?t.y>ot?`y`:r&&Math.abs(t.x)>ot?`x`:null:Math.hypot(e.x,e.y)<=10?null:!r||e.y>0&&e.y>=Math.abs(e.x)*.6?`y`:Math.abs(e.x)>=Math.abs(e.y)?`x`:`y`,lt=(e,t,n,r,i)=>{let a=it(e,t,n),o={x:e.x+t.x-a.x,y:e.y+t.y-a.y},s=e.scale>1.01;r??=ct(t,o,s,i);let c=s?ot:0,l=r===`x`&&i?Math.sign(o.x)*Math.max(0,Math.abs(o.x)-c):0,u=r===`y`?Math.max(0,o.y-c):0,d=st(u,n.viewport.height);return{transform:a,axis:r,galleryX:Q(l,-n.viewport.width,n.viewport.width),dismissY:u,dismissX:u>0?t.x*at:0,dismissScale:d.scale,backdropOpacity:d.opacity}},ut=e=>{let t=e[e.length-1];if(!t)return{x:0,y:0};let n=e.find(e=>t.time-e.time<=100)??t,r=t.time-n.time;return r>0?{x:(t.x-n.x)/r,y:(t.y-n.y)/r}:{x:0,y:0}},dt=280,ft=(e,t)=>R(e,t),pt=(e,t,n)=>{let r=Math.abs(e.galleryX);return r>=Math.min(96,n.width*.22)||r>18&&Math.abs(t.x)>.55&&t.x*e.galleryX>0?e.galleryX<0?`next`:`previous`:e.dismissY>=Math.min(140,n.height*.18)||e.dismissY>48&&t.y>.65?`close`:`none`},mt=(e,t,n,r,i,a)=>{let o=Q(r,a.minScale??Qe,a.maxScale??5),s=o/e.scale;return nt({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)};function ht(e){let t=(0,Y.c)(39),{url:n,directory:r,label:i,active:a,returnToSource:o,sourceElement:s,viewport:c,isMobile:l,position:u,onActiveImage:d}=e,{t:f}=O(),p=ce(n,r,`preview`),m=p.source||s?.currentSrc||``,h=`${p.key}\n${m}`,g=X.useRef(null),[_,v]=X.useState(null),[y,b]=X.useState(null),x;t[0]!==_||t[1]!==h||t[2]!==s?(x=_?.key===h?_.size:s?.naturalWidth&&s.naturalHeight?{width:s.naturalWidth,height:s.naturalHeight}:null,t[0]=_,t[1]=h,t[2]=s,t[3]=x):x=t[3];let S=x,C=!!S,w=!!(p.error||y===h),T=S??c,E=Math.max(1,c.width*(l?1:.8)),D=Math.max(1,c.height*(l?1:.95)),k;t[4]!==T||t[5]!==E||t[6]!==D?(k=tt(T,{width:E,height:D}),t[4]=T,t[5]=E,t[6]=D,t[7]=k):k=t[7];let A=k,j,M;t[8]!==a||t[9]!==w||t[10]!==C||t[11]!==S||t[12]!==d||t[13]!==p.key||t[14]!==m?(j=()=>{a&&d({element:g.current,source:m,resourceKey:p.key,naturalSize:S,loaded:C,error:w})},M=[a,m,p.key,S,C,w,d],t[8]=a,t[9]=w,t[10]=C,t[11]=S,t[12]=d,t[13]=p.key,t[14]=m,t[15]=j,t[16]=M):(j=t[15],M=t[16]),X.useLayoutEffect(j,M);let ee=!a||void 0,te=`translate3d(${u*(c.width+16)}px, 0, 0)`,N;t[17]===te?N=t[18]:(N={transform:te},t[17]=te,t[18]=N);let P;t[19]!==a||t[20]!==w||t[21]!==C?(P=!C&&!w&&(0,Z.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,role:a?`status`:void 0,children:(0,Z.jsx)(le,{className:`aspect-square w-64 max-w-[80vw] rounded-xl`})}),t[19]=a,t[20]=w,t[21]=C,t[22]=P):P=t[22];let F;t[23]!==a||t[24]!==h||t[25]!==w||t[26]!==i||t[27]!==C||t[28]!==o||t[29]!==A||t[30]!==m||t[31]!==f?(F=w?(0,Z.jsx)(`p`,{role:a?`status`:void 0,className:`px-6 text-center typography-ui-label`,children:f(`filesView.error.readFileFailed`)}):(0,Z.jsx)(`img`,{ref:g,"data-preview-transition-target":a?``:void 0,"data-preview-return":o,src:m||void 0,alt:a?i:``,className:`block max-w-none touch-none object-contain will-change-transform ${a?`pointer-events-auto`:``} ${C?`opacity-100`:`opacity-0`}`,style:{width:`${A.width}px`,height:`${A.height}px`},loading:`eager`,draggable:!1,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&v({key:h,size:{width:t.naturalWidth,height:t.naturalHeight}})},onError:()=>b(h)}),t[23]=a,t[24]=h,t[25]=w,t[26]=i,t[27]=C,t[28]=o,t[29]=A,t[30]=m,t[31]=f,t[32]=F):F=t[32];let I;return t[33]!==u||t[34]!==N||t[35]!==P||t[36]!==F||t[37]!==ee?(I=(0,Z.jsxs)(`div`,{"data-image-viewer-slide":u,"aria-hidden":ee,className:`pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden`,style:N,children:[P,F]}),t[33]=u,t[34]=N,t[35]=P,t[36]=F,t[37]=ee,t[38]=I):I=t[38],I}var gt=500,_t=24,vt=(e,t={})=>{let n=t.target??(typeof document>`u`?null:document);if(!n)return()=>{};let r=t.durationMs??gt,i=t.maxDistance??_t,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},yt=(e,t,n={})=>{vt(e,n),t()},bt=e(u(),1);function xt(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 St(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=xt(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 Ct(e){let t=(0,Y.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,Z.jsx)(F,{name:`close`,className:`size-5`}),t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==s?(l=(0,Z.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,Z.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 wt(e){let t=(0,Y.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,Z.jsx)(`div`,{"data-media-preview-toolbar":a,className:o,onPointerDown:Et,onDoubleClick:Tt,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,Z.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 Tt(e){return e.stopPropagation()}function Et(e){return e.stopPropagation()}function Dt(e){let t=(0,Y.c)(30),{open:n,title:r,kind:i,source:a,isMobile:o,onOpenChange:s,children:c}=e,l=X.useRef(null),u=X.useId(),d=X.useRef(null),f=X.useRef(!1),[p,m]=X.useState(!1),h;t[0]!==s||t[1]!==a?(h=()=>{if(f.current)return;f.current=!0,l.current&&(l.current.dataset.mediaPreviewClosing=`true`),d.current?.();let e=l.current?.querySelector(`[data-preview-transition-target]`)??null;d.current=St(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],ve(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;e&&delete e.dataset.mediaPreviewClosing;let t=document.activeElement instanceof HTMLElement?document.activeElement:null,r=o?B.add({id:u,onClose:g},document.body):void 0;return e?.querySelector(`button`)?.focus({preventScroll:!0}),d.current=St(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]),X.useLayoutEffect(b,x),!n||p||typeof document>`u`)return null;let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S={color:`var(--yuri-media-preview-foreground)`},t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{if(f.current){e.preventDefault(),e.stopPropagation();return}d.current?.(),d.current=null},t[16]=C):C=t[16];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=o?`var(--yuri-media-preview-background)`:`color-mix(in srgb, var(--yuri-media-preview-background) ${i===`mermaid`?90:70}%, transparent)`,E;t[19]===T?E=t[20]:(E=(0,Z.jsx)(`div`,{"data-media-preview-backdrop":``,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{backgroundColor:T}}),t[19]=T,t[20]=E);let O;t[21]!==c||t[22]!==g?(O=c(g),t[21]=c,t[22]=g,t[23]=O):O=t[23];let k;return t[24]!==i||t[25]!==E||t[26]!==O||t[27]!==w||t[28]!==r?(k=(0,bt.createPortal)((0,Z.jsxs)(`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:S,onClick:Ot,onPointerDownCapture:C,onKeyDown:w,children:[E,O]}),document.body),t[24]=i,t[25]=E,t[26]=O,t[27]=w,t[28]=r,t[29]=k):k=t[29],k}function Ot(e){e.stopPropagation()}var kt=1048576,$=b(`YuriVideo`),At=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,kt)}`}let n=Number(t[1]),r=t[2]?Number(t[2]):n+kt-1;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r)||r<n)throw Error(`Invalid media range`);return`bytes=${n}-${Math.min(r,n+kt-1)}`},jt=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 Mt(e,n,r){if(!x.isNativePlatform()||x.getPlatform()!==`ios`||!x.isPluginAvailable(`YuriVideo`))return null;let i=o(),c=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:c})])}},m=()=>{p()},h=async t=>{if(t.assetId!==c||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 c=t.method===`HEAD`?`bytes=0-0`:At(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 y({path:f,range:c,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 s(e,{...n,headers:{Range:c},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 b=d.body?.getReader();if(!b)throw Error(`Missing video response body`);let x=new Uint8Array(v),S=0;try{for(;;){let{done:e,value:t}=await b.read();if(e)break;if(S+t.length>v)throw Error(`Oversized video range`);x.set(t,S),S+=t.length}}finally{await b.cancel().catch(()=>{}),b.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`?``:jt(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:c});if(u||r.aborted)throw await $.release({assetId:c}),new DOMException(`Aborted`,`AbortError`);return{url:e,release:p}}catch(e){throw await p(),e}}var Nt=`image/png`,Pt=b(`YuriMedia`),Ft=e=>{let t=e.toLowerCase().split(`;`)[0]?.trim()||Nt;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`},It=(e,t)=>{let n=`${t.startsWith(`video/`)?`video`:`image`}.${Ft(t)}`,r=(((e||``).trim()||n).split(/[\\/]/).pop()||n).replace(/[^\w.\- ()[\]]+/g,`_`).replace(/^\.+/,``);return r?/\.[a-z0-9]{1,8}$/i.test(r)?r:`${r}.${Ft(t)}`:n},Lt=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)}),Rt=async e=>{let t=await Lt(e),n=t.indexOf(`,`);return n>=0?t.slice(n+1):t},zt=(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)},Bt=async(e,t,n)=>{if(e.startsWith(`yuri-asset:`)){let r=await _(e,t,n);if(r)return r;if(w())throw Error(`Image display stream is no longer available`)}return v(e,t,n)},Vt=async(e,t,n)=>g({path:e,signal:t},n),Ht=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)||!H(oe(e.sourceUrl,r))))try{i=await Bt(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 Bt(a,t,n);else{let e=oe(a,r);i=H(e)?await Vt(e.path,t,n):await Bt(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`:``)||Nt).split(`;`)[0].trim()||Nt;return{blob:i,filename:It(e.filename,o),mimeType:o}},Ut=()=>!w()||x===void 0?!1:x.isPluginAvailable(`YuriMedia`),Wt=async(e,t,n)=>{let r=oe(e.sourceUrl,e.effectiveDirectory??``);if(c()&&e.kind===`video`&&!Ut()){let e=l()?.files;if(H(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(H(r)&&!e.prefetchedBlob&&!/^(?:blob|data|yuri-asset):/i.test(e.displayUrl??``)&&!Ut()&&!c())return await C({path:r.path,filename:e.filename,signal:t},n),`downloaded`;let{blob:i,filename:a,mimeType:o}=await Ht(e,t,n);if(t?.throwIfAborted(),Ut()){let n=await Rt(i);if(t?.throwIfAborted(),e.kind===`video`){if((await Pt.saveFile({dataBase64:n,mimeType:o,filename:a}))?.cancelled)throw new DOMException(`Save cancelled`,`AbortError`);return`saved`}return await Pt.saveImage({dataBase64:n,mimeType:o,filename:a}),`saved`}if(c()){let e=l()?.vscode;if(e?.saveImage){let t=await Lt(i);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return zt(i,a),`downloaded`};function Gt(e){let t=(0,Y.c)(34),{target:n,isMobile:r}=e,{t:i}=O(),[a,o]=X.useState(`idle`),[s,c]=X.useState(0),l=X.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]),X.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 Wt(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,Z.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,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`0.25`}),(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,pathLength:`100`,strokeDasharray:`${s??0} 100`,transform:`rotate(-90 12 12)`})]}):h?(0,Z.jsx)(F,{name:`check`,weight:`medium`,className:r?`size-4`:`size-6`}):(0,Z.jsx)(F,{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,Z.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,Z.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,Z.jsxs)(Z.Fragment,{children:[S,w]}),t[31]=w,t[32]=S,t[33]=T):T=t[33],T}function Kt({video:e,onClose:t,isMobile:a}){let{t:o}=O(),s=ae()??``,c=e.directory??s,l=se(),u=oe(e.url,c),d=H(u)?u.path:``,f=/^\/api(?=\/|[?#]|$)/.test(e.url)?e.url:``,p=!!(d||f),m=`${l}\n${c}\n${e.url}`,[_,y]=X.useState();X.useEffect(()=>{if(!p)return;let e=new AbortController,t;return Mt(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,y({key:m,url:n?.url,unsupported:!n})}).catch(()=>{e.signal.aborted||y({key:m,error:!0})}),()=>{e.abort(),t?.()}},[p,d,f,m]);let b=_?.key===m?_:void 0,[x,C]=X.useState(0);X.useEffect(()=>{if(!p||i())return;let e=n(),t=r(()=>C(e=>e+1));return()=>{t(),e()}},[p,l]);let w=h({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 S(f||`/api/fs/raw`,d?{path:d}:void 0);return e.throwIfAborted(),{url:t,blob:void 0}}return{blob:d?await g({path:d,signal:e}):await v(f,e),url:void 0}}}),[T,E]=X.useState(null);X.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]=X.useState(),j=b?.error||w.isError||!!(D&&k===D);return(0,Z.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 p-4`,children:[(0,Z.jsx)(Ct,{onClose:t,isMobile:a}),!D&&!j&&(0,Z.jsx)(`p`,{role:`status`,children:o(`common.loading`)}),j&&(0,Z.jsx)(`p`,{role:`alert`,children:o(`filesView.error.readFileFailed`)}),D&&(0,Z.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,Z.jsx)(wt,{isMobile:a,children:(0,Z.jsx)(Gt,{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 qt=400,Jt=(e,t,n)=>{e&&e.style[t]!==n&&(e.style[t]=n)},Yt=(e,t)=>new Ge(e,t),Xt=e=>{let t=`h-3.5 w-3.5 flex-shrink-0`,n=e.toLowerCase();return n===`reasoning`?(0,Z.jsx)(F,{name:`brain-ai-3`,className:t}):n===`image-preview`?(0,Z.jsx)(F,{name:`file-image`,className:t}):n===`mermaid-preview`?(0,Z.jsx)(F,{name:`file-list-2`,className:t}):n===`edit`||n===`multiedit`||n===`apply_patch`||n===`str_replace`||n===`str_replace_based_edit_tool`?(0,Z.jsx)(F,{name:`pencil-ai`,className:t}):n===`write`||n===`create`||n===`file_write`||n===`read`||n===`view`||n===`file_read`||n===`cat`?(0,Z.jsx)(F,{name:`file-pdf`,className:t}):n===`bash`||n===`shell`||n===`cmd`||n===`terminal`?(0,Z.jsx)(F,{name:`terminal-box`,className:t}):n===`list`||n===`ls`||n===`dir`||n===`list_files`?(0,Z.jsx)(F,{name:`folder-6`,className:t}):n===`search`||n===`grep`||n===`find`||n===`ripgrep`?(0,Z.jsx)(F,{name:`search`,className:t}):n===`glob`?(0,Z.jsx)(F,{name:`file-search`,className:t}):n===`fetch`||n===`curl`||n===`wget`||n===`webfetch`?(0,Z.jsx)(F,{name:`global`,className:t}):n===`web-search`||n===`websearch`||n===`search_web`||n===`google`||n===`bing`||n===`duckduckgo`?(0,Z.jsx)(F,{name:`search`,className:t}):n===`todowrite`||n===`todoread`?(0,Z.jsx)(_e,{className:k(`text-current`,t)}):n.startsWith(`git`)?(0,Z.jsx)(F,{name:`git-branch`,className:t}):(0,Z.jsx)(F,{name:`tools`,className:t})},Zt={style:{background:`transparent`,backgroundColor:`transparent`,fontSize:`inherit`}},Qt={download:!1,copy:!1,showPanZoomControls:!0},$t=`
|
|
3
3
|
[data-diff-header],
|
|
4
4
|
[data-diff] {
|