@yuriai/web 0.2.8-beta.3 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AssistantView-Bf19-qvJ.js → AssistantView-CaLm2pDU.js} +3 -3
- package/dist/assets/{DiagramView-UvYyjtWA.js → DiagramView-Bh_Y3wjs.js} +1 -1
- package/dist/assets/{GuiPluginSurface-DNzJNcMh.js → GuiPluginSurface-qGOqnbF5.js} +1 -1
- package/dist/assets/MarkdownRenderer-CniMrVC7.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-tHItN1IG.js → MarkdownRendererImpl-BoMHV8l0.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-Dh13e1UE.js → MarkstreamRendererImpl-BXEZlJGP.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-CSxBgVuQ.js → MobileDetailNavigation-B6Ohvu93.js} +1 -1
- package/dist/assets/{MobileShareBridge-7SAELdqu.js → MobileShareBridge-DRx1mbUO.js} +1 -1
- package/dist/assets/MobileTabPageHeader-CHXNz-XU.js +2 -0
- package/dist/assets/{MultiRunWindow-DbI9KTph.js → MultiRunWindow-CWwawp5s.js} +1 -1
- package/dist/assets/{SettingsView-C1AQoEIQ.js → SettingsView-q2q_C3kF.js} +1 -1
- package/dist/assets/{SettingsWindow-6M0ssWHM.js → SettingsWindow-BO4fG8ON.js} +1 -1
- package/dist/assets/{TerminalView-bhL6Ccen.js → TerminalView-OVVhfpeZ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-BaLKI3Yc.js → ToolOutputDialog-CqirE_Q0.js} +1 -1
- package/dist/assets/{appThemeRegistry-Bk_N8btz.js → appThemeRegistry-Dg6MpoKd.js} +1 -1
- package/dist/assets/{capgoAdapter-DqHX7fkj.js → capgoAdapter-B7ToX3Rx.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-C16Q21Ht.js → fileMentionTouchSelection-CHBe_36a.js} +1 -1
- package/dist/assets/{gitApi-_yKaBF0a.js → gitApi-CesLpypb.js} +1 -1
- package/dist/assets/{insertionBoundaries-CHqJLwJg.js → insertionBoundaries-BLxQiOvC.js} +1 -1
- package/dist/assets/{main-Bja5DG1P.js → main-DlTR1Jke.js} +2 -2
- package/dist/assets/{main-njE9rVzm.js → main-Z6Jwv7Aw.js} +4 -4
- package/dist/assets/{mcpQueries-uM1Chfdc.js → mcpQueries-CZLOskV8.js} +1 -1
- package/dist/assets/{miniChat-DAwBa-3U.js → miniChat-SzvTUnN9.js} +2 -2
- package/dist/assets/{mobile-BQmrdXmD.js → mobile-dh54OsZj.js} +2 -2
- package/dist/assets/{mobileBackNavigation-DsU3qQ8W.js → mobileBackNavigation-D9_5Uqi3.js} +1 -1
- package/dist/assets/{multirun-DRL1Wf-K.js → multirun-J_f9gEPw.js} +1 -1
- package/dist/assets/{native-config-BMflOjo8.js → native-config-Bohk_yve.js} +1 -1
- package/dist/assets/{projectMeta-DK-kl6vM.js → projectMeta-BH9vbJqs.js} +1 -1
- package/dist/assets/{readiness-CMHDs1YN.js → readiness-D1Glg4WD.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-CkSP0eQz.js → renderElectronMiniChatApp-DM5OW4_M.js} +2 -2
- package/dist/assets/{renderMobileApp-wELnHLDT.js → renderMobileApp-CvDZu5Qx.js} +4 -4
- package/dist/assets/{runtimeConfig-KpW0l510.js → runtimeConfig-CwEhy80T.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BBxpXfkE.js → runtimeEndpointReset-CFELYYml.js} +3 -3
- package/dist/assets/{sessionChangeSummary-Bb7dqAie.js → sessionChangeSummary-DnCiwEhi.js} +1 -1
- package/dist/assets/{sessionLookup-D_P3C7rX.js → sessionLookup-BxXJcGxg.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BSBjx3wG.js → speechSettingsQueries-7aN_QCn_.js} +1 -1
- package/dist/assets/src-BJ51FtVW.css +2 -0
- package/dist/assets/types-Dzzdq2e0.js +2 -0
- package/dist/assets/{useAppFontEffects-DZ1W3_cy.js → useAppFontEffects-Ql6SjWay.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-D_1DLCOD.js → useDesktopWindowControlsLayout-DpovjCsM.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-joUiryc3.js → useEffectiveDirectory-CjXQBqAr.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-BaQ7TIpx.js → useMobileNavigationStore-BTJNY1Yo.js} +3 -3
- package/dist/assets/{useWorkerHighlightedLines-CiU1xPjX.js → useWorkerHighlightedLines-cS9vGi9t.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/dist/assets/MarkdownRenderer-GuwP9qiJ.js +0 -2
- package/dist/assets/MobileTabPageHeader-Bbb36BtD.js +0 -2
- package/dist/assets/src-CbY9YJrh.css +0 -2
- package/dist/assets/types-rJezumB4.js +0 -2
package/dist/assets/{useWorkerHighlightedLines-CiU1xPjX.js → useWorkerHighlightedLines-cS9vGi9t.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-Dodw6LWV.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-Cy25fgQb.js";import{i as u,n as d,t as f}from"./tooltip-BmKpb74n.js";import{n as p}from"./MarkdownRenderer-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-Dodw6LWV.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-Cy25fgQb.js";import{i as u,n as d,t as f}from"./tooltip-BmKpb74n.js";import{n as p}from"./MarkdownRenderer-CniMrVC7.js";import{n as m,r as h}from"./toolHelpers-DL452NVK.js";import{t as g}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as _}from"./markdownTheme-DHoKvD6O.js";import{n as v,t as y}from"./markdown-worker-oBGEB9Eg.js";var b=e(t(),1),x=i(),S=n(),C=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,w={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},T=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,E=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,D=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,O=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,k=`${O} max-h-[min(22rem,50vh)] overflow-y-auto`,A=`${O} w-full`,ee={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},j=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,M=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,te=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ne=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,re=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ie={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},ae={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},N=e=>{let t=(0,x.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:s}=a(),c=oe.has(n.status)?n.status:`pending`,p=ae[c],m;t[0]!==s||t[1]!==p?(m=s(p),t[0]=s,t[1]=p,t[2]=m):m=t[2];let h=m,g;t[3]===c?g=t[4]:(g=c===`in_progress`?(0,S.jsx)(l,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):c===`completed`?(0,S.jsx)(l,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,S.jsx)(l,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=c,t[4]=g);let _=g,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=o(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,j,y),t[5]=y,t[6]=b);let C;t[7]!==_||t[8]!==h?(C=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":h,children:_})}),t[7]=_,t[8]=h,t[9]=C):C=t[9];let w;t[10]===h?w=t[11]:(w=(0,S.jsx)(d,{side:`left`,sideOffset:6,children:h}),t[10]=h,t[11]=w);let T;t[12]!==C||t[13]!==w?(T=(0,S.jsxs)(f,{children:[C,w]}),t[12]=C,t[13]=w,t[14]=T):T=t[14];let E=ie[c],D;t[15]===E?D=t[16]:(D=o(`block whitespace-normal break-words`,E),t[15]=E,t[16]=D);let O;t[17]!==D||t[18]!==n.content?(O=(0,S.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`span`,{className:D,children:n.content})}),t[17]=D,t[18]=n.content,t[19]=O):O=t[19];let k;return t[20]!==i||t[21]!==O||t[22]!==v||t[23]!==b||t[24]!==T?(k=(0,S.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[T,O]}),t[20]=i,t[21]=O,t[22]=v,t[23]=b,t[24]=T,t[25]=k):k=t[25],k},oe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),P=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),F=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,I=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=F(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},L=e=>`<pre><code>${P(e)}</code></pre>`,R=e=>{let t=(0,x.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=b.useRef(null),p;t[0]===d?p=t[1]:(p=_(d),t[0]=d,t[1]=p);let m=p,h,g;t[2]!==n||t[3]!==s||t[4]!==u?(h=()=>{let e=f.current;e&&(e.innerHTML=L(n),I(e,u,s))},g=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=h,t[6]=g):(h=t[5],g=t[6]),b.useLayoutEffect(h,g);let v,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(v=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return y(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,I(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=v,t[12]=C):(v=t[11],C=t[12]),b.useEffect(v,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=m,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,S.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},z=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},B=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},V=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,H=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,U=(e,t)=>!e||typeof e!=`object`?String(e):h(e,t||``),W=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},G=e=>{if(!e||typeof e!=`object`)return;let t=W(e.patch)??W(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=W(e.patch)??W(e.diff);if(t)return t}},K=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},q=(e,t,n)=>{let r=z(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&V(r)&&(r=H(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=G(n);if(e)return e}return r},se=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},ce=(e,t)=>{try{let n=e.trim().split(`
|
|
4
4
|
`).filter(Boolean);if(n.length===0)return null;let i=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,S.jsx)(`div`,{className:o(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:r.tool.popup,children:i.map((e,t)=>(0,S.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,S.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,S.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},le={backgroundColor:`var(--status-info)`,opacity:.6},ue=(e,t,n)=>{try{let i=e.trim().split(`
|
package/dist/index.html
CHANGED
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
opacity: 0.72;
|
|
561
561
|
}
|
|
562
562
|
</style>
|
|
563
|
-
<script type="module" crossorigin src="/assets/main-
|
|
563
|
+
<script type="module" crossorigin src="/assets/main-DlTR1Jke.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -591,11 +591,11 @@
|
|
|
591
591
|
<link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
|
|
592
592
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
|
|
593
593
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
|
|
594
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
595
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
596
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
597
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
598
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Dzzdq2e0.js">
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B7ToX3Rx.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bohk_yve.js">
|
|
597
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CwEhy80T.js">
|
|
598
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BJ51FtVW.css">
|
|
599
599
|
</head>
|
|
600
600
|
<body class="h-full bg-background text-foreground">
|
|
601
601
|
<!-- Keep the startup layer outside #root. React replaces every child of
|
package/dist/mini-chat.html
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
.dark #initial-loading img { filter: invert(1); }
|
|
78
78
|
</style>
|
|
79
79
|
|
|
80
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
80
|
+
<script type="module" crossorigin src="/assets/miniChat-SzvTUnN9.js"></script>
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -108,11 +108,11 @@
|
|
|
108
108
|
<link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
|
|
109
109
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
|
|
110
110
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
|
|
111
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
112
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
113
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
114
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
115
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
111
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Dzzdq2e0.js">
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B7ToX3Rx.js">
|
|
113
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bohk_yve.js">
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CwEhy80T.js">
|
|
115
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BJ51FtVW.css">
|
|
116
116
|
</head>
|
|
117
117
|
<body class="h-full bg-background text-foreground">
|
|
118
118
|
<div id="root" class="h-full">
|
package/dist/mobile.html
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
|
|
67
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
67
|
+
<script type="module" crossorigin src="/assets/mobile-dh54OsZj.js"></script>
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
102
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/types-Dzzdq2e0.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B7ToX3Rx.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bohk_yve.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-CwEhy80T.js">
|
|
102
|
+
<link rel="stylesheet" crossorigin href="/assets/src-BJ51FtVW.css">
|
|
103
103
|
</head>
|
|
104
104
|
<body class="h-full bg-background text-foreground">
|
|
105
105
|
<div id="root" class="h-full">
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-Dh13e1UE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-NMQx_cnG.js","assets/runtime-switch-CAZiOV2G.js","assets/runtime-auth-ef9W7A43.js","assets/vendor-zustand-o69pgTEK.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-BP2cRVqX.js","assets/fileQueries-DbUx7NwP.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/queryRuntime-BuRnpVtK.js","assets/runtime-fetch-BAN5Gnnp.js","assets/vendor-markstream-react-Bm0cO70Z.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-BpfIZ1tg.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-Dodw6LWV.js","assets/desktop-dp2Z0toS.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/store-FxBFwq--.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useMobileNavigationStore-BaQ7TIpx.js","assets/platform-DXeTzJHG.js","assets/vendor-opencode-client-fxfj4IA_.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-BfjCXjLZ.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-D3k0hKDj.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-D7JZlg_Q.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/useThemeSystem-8jhE4Zyk.js","assets/tooltip-BmKpb74n.js","assets/image-loading-FUFYiO1j.js","assets/image-loading-D9Z_BASK.css","assets/url-MRa-FtQa.js","assets/useEffectiveDirectory-joUiryc3.js","assets/LoadingImage-2pPdTFHh.js","assets/ImageLoadingPlaceholder-DGRjdn_K.js","assets/markdownHeightCache-BQiIj0aM.js","assets/dualLimitLru-D8Sphgua.js","assets/MarkdownRendererImpl-tHItN1IG.js","assets/vendor-katex-DNVSTX6g.js","assets/FadeInOnReveal-NAFOww9Y.js","assets/markdownTheme-DHoKvD6O.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-No7p4Kdo.js","assets/toolHelpers-DL452NVK.js","assets/fileReferenceParser-1HHDBUum.js","assets/MarkstreamRendererImpl-EpBnVy9J.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-o69pgTEK.js";import{it as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as o}from"./button-Dodw6LWV.js";import{t as s}from"./useEffectiveDirectory-joUiryc3.js";import{i as c,n as l,t as u}from"./markdownHeightCache-BQiIj0aM.js";var d=i(),f=e(n(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.8-beta.3:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-Dh13e1UE.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-tHItN1IG.js`).then(e=>e.n),__vite__mapDeps([53,1,4,5,24,25,2,30,14,6,31,32,7,8,3,33,9,13,12,34,35,36,10,11,37,38,16,54,20,21,22,23,26,27,28,29,39,40,41,42,52,43,45,46,47,48,55,51,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=r(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,n as r,o as i}from"./runtime-switch-CAZiOV2G.js";import{n as a}from"./runtime-fetch-BAN5Gnnp.js";import{C as o,E as s,I as c,T as l,b as u,n as d,r as f,w as p,x as m,y as h}from"./desktop-dp2Z0toS.js";import{t as g}from"./runtimeAPIRegistry-C2VogTny.js";import{a as _,i as v,r as y}from"./vendor-zustand-o69pgTEK.js";import{it as b,nt as x,rt as S}from"./vendor-base-ui-CdzJ6My_.js";import{Ct as C,Nt as w,n as T,t as E}from"./platform-DXeTzJHG.js";import{b as D,n as O}from"./useUIStore-NMQx_cnG.js";import{$ as k,d as A,i as j}from"./persistence-BfjCXjLZ.js";import{n as M}from"./vendor-react-BP2cRVqX.js";import{l as N,n as P,o as F,s as I}from"./vendor-tanstack-react-query-CdqCAt40.js";import{a as L,o as R,r as z,t as ee}from"./queryRuntime-BuRnpVtK.js";import{o as te}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as B}from"./pathNormalization-ewtPqJWn.js";import{a as V,t as H}from"./types-rJezumB4.js";import{$ as ne,A as U,B as W,G,H as K,J as re,L as ie,P as q,T as ae,U as oe,W as se,X as ce,Y as le,a as ue,at as de,dt as fe,f as pe,ft as me,g as he,l as ge,pt as _e,st as ve,z as J}from"./vendor-codemirror-autocomplete-7c2L_4dM.js";import{c as ye,o as be,r as xe}from"./vendor-codemirror-lang-angular-DXOgWEVj.js";import{n as Se,r as Ce}from"./vendor-codemirror-lang-json-mLulNbwB.js";import{n as we}from"./vendor-codemirror-lang-markdown-CV1IO6Qs.js";import{n as Te}from"./vendor-codemirror-lang-python-YM2WVLHF.js";import{O as Ee}from"./vendor-codemirror-legacy-modes-DwltVFbT.js";import{n as De}from"./vendor-reactuses-core-BpfIZ1tg.js";import{a as Oe,d as ke,f as Ae,p as je,r as Y,t as Me}from"./button-Dodw6LWV.js";import{Pr as Ne,Rr as Pe,bi as Fe,d as Ie,er as Le,fo as Re,hi as ze,ir as Be,jr as Ve,nr as He,or as Ue,rr as We,so as Ge,sr as Ke,vn as qe,wr as Je}from"./useMobileNavigationStore-BaQ7TIpx.js";import{n as Ye}from"./useThemeSystem-8jhE4Zyk.js";import{n as X}from"./Icon-Cy25fgQb.js";import{a as Xe,n as Ze,o as Qe,r as $e,t as et}from"./dialog-D0bq7nr2.js";import{L as tt,_ as nt,b as rt,c as it,n as at,s as ot,u as st}from"./gitApi-_yKaBF0a.js";import{A as ct,_ as lt,a as ut,b as dt,c as ft,h as pt,m as mt,n as ht,r as gt,t as _t,x as vt}from"./projectMeta-DK-kl6vM.js";import{t as yt}from"./input-HddqDhRi.js";import{i as bt,n as xt,t as St}from"./tooltip-BmKpb74n.js";import{F as Ct,G as wt,Gt as Tt,J as Et,Jt as Dt,Kt as Ot,M as kt,P as At,Qt as jt,U as Mt,W as Nt,Wt as Pt,Yt as Ft,a as It,it as Lt,k as Rt,q as zt,qt as Bt,rn as Vt,rt as Ht,ut as Ut,v as Wt}from"./speechSettingsQueries-BSBjx3wG.js";import{r as Gt,t as Kt}from"./device-B7GyZCPd.js";import{n as qt}from"./MarkdownRenderer-GuwP9qiJ.js";import{n as Jt,t as Yt}from"./textarea-BvfW0tsL.js";import{a as Xt}from"./url-MRa-FtQa.js";import{r as Zt}from"./markdown-worker-oBGEB9Eg.js";import{i as Qt,n as $t,o as en}from"./mcpQueries-uM1Chfdc.js";import{n as tn,r as nn,t as rn}from"./collapsible-C9kOfVDe.js";import{a as an,d as on,o as sn,s as cn}from"./vendor-codemirror-commands-B8KrBQ9B.js";import{a as ln,c as un,i as dn,o as fn,r as pn,s as mn}from"./vendor-codemirror-search-ZqtrPLjU.js";import{n as hn,t as gn}from"./vendor-replit-codemirror-vim-DDj0dSVY.js";import{t as _n}from"./vendor-codemirror-language-data-Ctd4WxgW.js";import{i as vn,n as yn,r as bn,t as xn}from"./projectActions-BX0cjZoq.js";var Sn=[{id:`claude`,name:`Claude`},{id:`codex`,name:`Codex`},{id:`cursor`,name:`Cursor`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`google`,name:`Google`},{id:`kimi-for-coding`,name:`Kimi for Coding`},{id:`nano-gpt`,name:`NanoGPT`},{id:`openrouter`,name:`OpenRouter`},{id:`zai-coding-plan`,name:`z.ai`},{id:`zhipuai-coding-plan`,name:`Zhipu AI Coding Plan`},{id:`minimax-cn-coding-plan`,name:`MiniMax Coding Plan (minimaxi.com)`},{id:`minimax-coding-plan`,name:`MiniMax Coding Plan (minimax.io)`},{id:`ollama-cloud`,name:`Ollama Cloud`},{id:`wafer`,name:`Wafer.ai`},{id:`opencode-go`,name:`OpenCode Go`},{id:`xai`,name:`Grok`}],Cn=e=>[...Sn,...e.filter(e=>e.source===`magpie`).map(e=>({id:e.providerId,name:e.providerName}))],Z=M(),Q=S();function wn(e){let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`path`,{d:`M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z`}),r=(0,Q.jsx)(`path`,{d:`M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`0.5`,fillRule:`evenodd`,viewBox:`-0.5 -0.5 25 25`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var Tn={},En=(e,t=n())=>JSON.stringify([t,$t(e)]),Dn=(e,t,n)=>{if(!e[t]?.[n])return e;let r={...e[t]};return delete r[n],{...e,[t]:r}},On=e=>{let t=$t(e);return t?w.getScopedApiClient(t):w.getApiClient()},kn=e=>e?{location:{directory:e}}:void 0,An=new Map,jn=(e,t)=>JSON.stringify([r(),En(t),e]),Mn=async(e,t,n)=>{let r=(await e.mcp.list(kn(n))).data.find(e=>e.name===t)?.integrationID;if(!r)throw Error(`MCP server "${t}" has no authentication integration`);return(await e.integration.get({integrationID:r,...kn(n)})).data},Nn=e=>$t(e===void 0?C.getState().currentDirectory:e),Pn=_()(y((e,t)=>({diagnosticsByDirectory:{},getDiagnosticForDirectory:e=>{let n=En(Nn(e));return t().diagnosticsByDirectory[n]??Tn},clearDiagnostic:(t,n,r)=>{let i=En(Nn(n),r);e(e=>({diagnosticsByDirectory:Dn(e.diagnosticsByDirectory,i,t)}))},connect:async(t,r)=>{let i=Nn(r),a=n(),o=En(i,a),s=On(i);try{await s.mcp.connect({server:t,...kn(i)})}catch(n){let r=n instanceof Error?n.message:`Connection failed`;throw e(e=>({diagnosticsByDirectory:{...e.diagnosticsByDirectory,[o]:{...e.diagnosticsByDirectory[o]??{},[t]:{status:`failed`,error:r}}}})),n}await en(L,i,a),e(e=>({diagnosticsByDirectory:Dn(e.diagnosticsByDirectory,o,t)}))},disconnect:async(t,r)=>{let i=Nn(r),a=n(),o=En(i,a);await On(i).mcp.disconnect({server:t,...kn(i)}),await en(L,i,a),e(e=>({diagnosticsByDirectory:Dn(e.diagnosticsByDirectory,o,t)}))},startAuth:async(e,t)=>{let n=Nn(t),r=jn(e,n),i=On(n),a=await Mn(i,e,n),o=a.methods.find(e=>e.type===`oauth`);if(!o)throw Error(`MCP server "${e}" has no OAuth method`);if(r!==jn(e,n))throw Error(`MCP authorization runtime changed`);let s=An.get(r);if(s&&(await i.integration.oauth.cancel({integrationID:s.integrationID,attemptID:s.attempt.attemptID,...kn(n)}),An.delete(r)),r!==jn(e,n))throw Error(`MCP authorization runtime changed`);let{data:c}=await i.integration.oauth.connect({integrationID:a.id,methodID:o.id,...kn(n)});if(r!==jn(e,n))throw Error(`MCP authorization runtime changed`);for(let[e,t]of An)t.attempt.time.expires<=Date.now()&&An.delete(e);return An.set(r,{integrationID:a.id,attempt:c}),c},authStatus:async(e,t)=>{let n=Nn(t),r=jn(e,n),i=An.get(r);if(!i)throw Error(`MCP authorization attempt not found`);let{data:a}=await On(n).integration.oauth.status({integrationID:i.integrationID,attemptID:i.attempt.attemptID,...kn(n)});if(r!==jn(e,n))throw Error(`MCP authorization runtime changed`);return a.status!==`pending`&&An.get(r)===i&&An.delete(r),a},completeAuth:async(e,t,r)=>{let i=Nn(r),a=n(),o=jn(e,i),s=An.get(o);if(!s||s.attempt.mode!==`code`)throw Error(`MCP authorization requires the browser callback`);if(!t.trim())throw Error(`MCP authorization code is empty`);if(await On(i).integration.oauth.complete({integrationID:s.integrationID,attemptID:s.attempt.attemptID,code:t.trim(),...kn(i)}),An.get(o)===s&&An.delete(o),o!==jn(e,i))throw Error(`MCP authorization runtime changed`);await en(L,i,a)},clearAuth:async(e,t)=>{let r=Nn(t),i=n(),a=jn(e,r),o=On(r),s=await Mn(o,e,r);if(a!==jn(e,r))throw Error(`MCP authorization runtime changed`);let c=An.get(a);c&&(await o.integration.oauth.cancel({integrationID:c.integrationID,attemptID:c.attempt.attemptID,...kn(r)}),An.delete(a));let l=new Set(s.connections.flatMap(e=>e.type===`credential`?[e.id]:[]));for(let t of l){if(a!==jn(e,r))throw Error(`MCP authorization runtime changed`);await o.credential.remove({credentialID:t})}if(a!==jn(e,r))throw Error(`MCP authorization runtime changed`);await en(L,r,i)},testConnection:async(t,r)=>{let i=Nn(r),a=n(),o=En(i,a),s=On(i),c=Qt(L,i,a)[t]?.status===`connected`,l,u;try{await s.mcp.connect({server:t,...kn(i)})}catch(n){l=n instanceof Error?n.message:`Connection failed`,e(e=>({diagnosticsByDirectory:{...e.diagnosticsByDirectory,[o]:{...e.diagnosticsByDirectory[o]??{},[t]:{status:`failed`,error:l??`Connection failed`}}}}))}let d=(await en(L,i,a))[t],f=d;if(!c&&d?.status===`connected`){try{await s.mcp.disconnect({server:t,...kn(i)})}catch(e){u=`Connection test succeeded, but cleanup disconnect failed: ${e instanceof Error?e.message:`Disconnect failed`}`}await en(L,i,a)}return l||e(e=>({diagnosticsByDirectory:Dn(e.diagnosticsByDirectory,o,t)})),{status:f??Qt(L,i,a)[t],error:l,warning:u}}}))),$=e(b(),1),Fn=`https://yuri-updates.xiaobe.top/v1/update/check`,In=`https://yuri-origin.xiaobe.top/v1/update/check`,Ln=`https://github.com/yee94/yuri/releases/latest`,Rn=`https://github.com/yee94/yuri/releases`,zn=`https://testflight.apple.com/join/pN5SSHeg`,Bn=1e4;function Vn(e){let t=String(e||``).replace(/^v/,``).split(`+`)[0]??``,n=t.indexOf(`-`);return{parts:(n>=0?t.slice(0,n):t).split(`.`).map(e=>{let t=Number.parseInt(e||`0`,10);return Number.isFinite(t)?t:0}),prerelease:n>=0}}function Hn(e,t){let n=Vn(e),r=Vn(t),i=Math.max(n.parts.length,r.parts.length);for(let e=0;e<i;e+=1){let t=(n.parts[e]||0)-(r.parts[e]||0);if(t!==0)return t}return n.prerelease===r.prerelease?0:n.prerelease?-1:1}function Un(){return[Fn,In]}function Wn(e,t,n=Date.now){let r=e-n();return r<=0||t<=0?null:Math.max(1,Math.ceil(r/t))}function Gn(e){return{appType:`mobile-capacitor`,deviceClass:e.deviceClass||`mobile`,platform:e.platform===`ios`||e.platform===`android`?e.platform:`android`,arch:e.arch||`unknown`,channel:`stable`,currentVersion:e.currentVersion,instanceMode:`remote`,reportUsage:e.reportUsage===!0}}async function Kn(e,t,n,r){try{if(T())try{let{CapacitorHttp:r}=await te(async()=>{let{CapacitorHttp:e}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{CapacitorHttp:e}},__vite__mapDeps([0,1])),i=Object.fromEntries(new Headers(t.headers).entries()),a;if(typeof t.body==`string`)try{a=JSON.parse(t.body)}catch{a=t.body}let o=await Promise.race([r.request({url:e,method:t.method||`GET`,headers:i,data:a,connectTimeout:n,readTimeout:n}),new Promise(e=>{window.setTimeout(()=>e(null),n)})]);return o?{ok:o.status>=200&&o.status<300,status:o.status,url:typeof o.url==`string`?o.url:e,json:async()=>{if(typeof o.data==`string`)try{return JSON.parse(o.data)}catch{return o.data}return o.data}}:null}catch{}let i=await r(e,{...t,signal:AbortSignal.timeout(n)});return{ok:i.ok,status:i.status,url:i.url,json:()=>i.json()}}catch{return null}}function qn(e,t){return e===`ios`?zn:`${Rn}/download/v${t}/app-release.apk`}function Jn(e,t,n){if(typeof e.latestVersion!=`string`||e.latestVersion.trim().length===0)return null;let r=e.latestVersion.trim(),i=Hn(r,t);if(i<0)return null;let a=typeof e.releaseNotesUrl==`string`&&e.releaseNotesUrl.trim().length>0?e.releaseNotesUrl.trim():`${Rn}/tag/v${r}`,o=typeof e.downloadUrl==`string`&&e.downloadUrl.trim().length>0?e.downloadUrl.trim():typeof e.download?.url==`string`&&e.download.url.trim().length>0?e.download.url.trim():qn(n,r);return{available:!!e.updateAvailable&&i>0,version:r,currentVersion:t,body:typeof e.releaseNotes==`string`?e.releaseNotes:void 0,releaseUrl:a,downloadUrl:o,nextSuggestedCheckInSec:typeof e.nextSuggestedCheckInSec==`number`&&Number.isFinite(e.nextSuggestedCheckInSec)?e.nextSuggestedCheckInSec:void 0}}async function Yn(e,t,n,r){let i=await Kn(e,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(Gn(t))},n,r);if(!i?.ok)return null;let a;try{a=await i.json()}catch{return null}return Jn(a,t.currentVersion,t.platform)}async function Xn(e,t,n,r){let i=await Kn(Ln,{method:`GET`,headers:{Accept:`text/html`},redirect:`follow`},n,r);if(!i?.ok)return null;let a=typeof i.url==`string`&&i.url.length>0?i.url:Ln,o=null;try{o=new URL(a).pathname.match(/\/releases\/tag\/v(\d+\.\d+\.\d+(?:-[\w.]+)?)/)}catch{return null}if(!o?.[1])return null;let s=o[1],c=Hn(s,e),l=`${Rn}/tag/v${s}`;return{available:c>0,version:s,currentVersion:e,releaseUrl:l,downloadUrl:qn(t,s)}}async function Zn(e){let t=e.currentVersion?.trim()||`unknown`;if(t===`unknown`)return{available:!1,currentVersion:t,error:`Unable to check for mobile updates`};let n=e.fetchImpl??fetch,r=e.now??Date.now,i=Un(),a=r()+Bn;for(let[t,o]of i.entries()){let s=Wn(a,i.length-t+1,r);if(s===null)break;let c=await Yn(o,e,s,n);if(c)return c}let o=Wn(a,1,r);if(o!==null){let r=await Xn(t,e.platform,o,n);if(r)return r}return{available:!1,currentVersion:t,error:`Unable to check for mobile updates`}}function Qn(){if(typeof window>`u`)return`unknown`;try{let{deviceType:e}=Kt();return e}catch{return`unknown`}}function $n(){let e=typeof window<`u`?window.__VSCODE_CONFIG__?.arch?.toLowerCase?.():void 0;if(e===`arm64`||e===`aarch64`)return`arm64`;if(e===`x64`||e===`amd64`||e===`x86_64`)return`x64`;let t=(typeof navigator<`u`?navigator.userAgentData:void 0)?.architecture?.toLowerCase?.();if(t===`arm`||t===`arm64`||t===`aarch64`)return`arm64`;if(t===`x86`||t===`x64`||t===`amd64`)return`x64`;let n=typeof navigator<`u`?navigator.userAgent.toLowerCase():``;return n.includes(`aarch64`)||n.includes(`arm64`)||n.includes(`armv`)?`arm64`:n.includes(`x86_64`)||n.includes(`x64`)||n.includes(`amd64`)||n.includes(`win64`)?`x64`:`unknown`}function er(){let e=E();if(e===`android`||e===`ios`)return e;if(typeof navigator>`u`)return`web`;let t=(navigator.platform||``).toLowerCase();return t.includes(`mac`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)?`linux`:`web`}function tr(e){let t=O.getState().reportUsage,n=new URLSearchParams({reportUsage:t?`true`:`false`});return n.set(`deviceClass`,Qn()),n.set(`arch`,$n()),n.set(`platform`,er()),e===`desktop`?(n.set(`appType`,`desktop-electron`),n.set(`instanceMode`,h()?`local`:`remote`),n):e===`vscode`?(n.set(`appType`,`vscode`),n.set(`instanceMode`,`local`),n):e===`mobile`?(n.set(`appType`,`mobile-capacitor`),n.set(`instanceMode`,`remote`),n):(n.set(`appType`,`web`),n.set(`instanceMode`,`unknown`),n)}async function nr(e,t){let n=t??`unknown`;try{let r=tr(e),i=typeof window<`u`?window.__VSCODE_CONFIG__?.extensionVersion:void 0;t?r.set(`currentVersion`,t):e===`vscode`&&i&&r.set(`currentVersion`,i);let o=await a(`/api/yuri/update-check?${r.toString()}`,{method:`GET`,headers:{Accept:`application/json`}}),s=null;try{s=await o.json()}catch{s=null}if(!o.ok)return{available:!1,currentVersion:n,error:typeof s?.error==`string`&&s.error.trim().length>0?s.error.trim():`Server responded with ${o.status}`};if(!s)return{available:!1,currentVersion:n,error:`Update check returned an invalid response`};let c=typeof s.error==`string`&&s.error.trim().length>0?s.error.trim():void 0;return{available:s.available===!0,version:typeof s.version==`string`?s.version:void 0,currentVersion:typeof s.currentVersion==`string`?s.currentVersion:n,body:typeof s.body==`string`?s.body:void 0,releaseUrl:typeof s.releaseUrl==`string`?s.releaseUrl:void 0,downloadUrl:typeof s.downloadUrl==`string`?s.downloadUrl:void 0,nextSuggestedCheckInSec:typeof s.nextSuggestedCheckInSec==`number`&&Number.isFinite(s.nextSuggestedCheckInSec)?s.nextSuggestedCheckInSec:void 0,packageManager:typeof s.packageManager==`string`?s.packageManager:void 0,updateCommand:typeof s.updateCommand==`string`?s.updateCommand:void 0,error:c}}catch(e){return console.warn(`Failed to check for updates:`,e),{available:!1,currentVersion:n,error:e instanceof Error?e.message:`Failed to check for updates`}}}function rr(){return T()?`mobile`:m()?`desktop`:o()?`vscode`:p()?`web`:null}var ir={checking:!1,available:!1,downloading:!1,downloaded:!1,info:null,progress:null,error:null,runtimeType:null,lastChecked:null,nextCheckInSec:null,otaDecision:null,otaPhase:`idle`,otaDownloadSkipped:!1,lastOtaChannelOverride:null};function ar(e,t){let n=e.isChannelRollback===!0?{isChannelRollback:!0}:{};if(e.primaryAction===`apply_ota`&&e.ota.bundle)return e.ota.bundle.releaseVersion===t?{available:!1,otaPhase:`idle`,info:{available:!1,currentVersion:t,nextSuggestedCheckInSec:e.nextCheckInSec,...n}}:{available:!0,otaPhase:`available`,info:{available:!0,version:e.ota.bundle.releaseVersion,currentVersion:t,downloadUrl:e.ota.bundle.url,nextSuggestedCheckInSec:e.nextCheckInSec,inAppApply:!0,...e.releaseNotes?{body:e.releaseNotes}:{},...n}};if(e.primaryAction===`install_native_required`){if(!e.native.version?.trim()||!e.native.installUrl?.trim())throw Error(`Native update required, but the update service supplied no complete installation target`);return{available:e.native.state===`required`||e.native.state===`available`,otaPhase:`idle`,info:{available:e.native.state===`required`||e.native.state===`available`,version:e.native.version,currentVersion:t,downloadUrl:e.native.installUrl,nextSuggestedCheckInSec:e.nextCheckInSec,manualUpdate:!0,...e.releaseNotes?{body:e.releaseNotes}:{},...n}}}return{available:!1,otaPhase:`idle`,info:{available:!1,currentVersion:t,nextSuggestedCheckInSec:e.nextCheckInSec,...n}}}var or=0,sr=_()((e,t)=>({...ir,checkForUpdates:async()=>{let n=rr();if(!n)return null;let r=++or;e({checking:!0,error:null,runtimeType:n});try{let i=null,a=null;if(n===`desktop`){let n=O.getState().otaChannelOverride;t().lastOtaChannelOverride!==n&&e({downloaded:!1,downloading:!1,available:!1,info:null,otaDecision:null,progress:null,otaPhase:`checking`});let i=await d(n);if(r!==or||O.getState().otaChannelOverride!==n)return null;let a=i?.downloaded===!0;return e({checking:!1,available:i?.available??!1,downloaded:a,...a?{downloading:!1,progress:null}:{},info:i,error:null,lastChecked:Date.now(),nextCheckInSec:i?.nextSuggestedCheckInSec??null,otaDecision:i?.otaDecision??null,otaPhase:a?`pending_restart`:i?.inAppApply?`available`:`idle`,lastOtaChannelOverride:n}),i?.nextSuggestedCheckInSec??null}if(n===`web`)i=await nr(`web`),a=i?.nextSuggestedCheckInSec??null;else if(n===`vscode`)a=(await nr(`vscode`))?.nextSuggestedCheckInSec??null;else if(n===`mobile`){let n=await V()??`unknown`,r=T()?g()?.mobileUpdates:void 0,o=O.getState().otaChannelOverride;if(r)try{let i=t().lastOtaChannelOverride!==o;e(i?{otaDecision:null,otaPhase:`checking`,downloaded:!1,otaDownloadSkipped:!1,progress:null,available:!1,info:null}:{otaPhase:`checking`});let a=await r.checkForOtaUpdate(o===`beta`||o===`stable`?{channelOverride:o}:void 0),s=ar(a,n),c=(i?void 0:t().otaDecision?.ota.bundle?.bundleId)!==a.ota.bundle?.bundleId,l=!i&&t().downloaded&&!c;return e({checking:!1,available:s.available,info:s.info,error:s.info.error??null,lastChecked:Date.now(),nextCheckInSec:a.nextCheckInSec,otaDecision:a,otaPhase:l?`pending_restart`:s.otaPhase,lastOtaChannelOverride:o,...c||i?{downloaded:!1,otaDownloadSkipped:!1,progress:null}:{}}),a.nextCheckInSec}catch(t){if(!(t instanceof H)){let r=t instanceof Error?t.message:`Mobile OTA check failed`;return e({checking:!1,available:!1,info:{available:!1,currentVersion:n},error:r,lastChecked:Date.now(),otaDecision:null,otaPhase:`error`,lastOtaChannelOverride:o}),null}}return i=await Zn({currentVersion:n,platform:er()===`ios`?`ios`:`android`,deviceClass:Qn(),arch:$n(),reportUsage:O.getState().reportUsage}),a=i?.nextSuggestedCheckInSec??null,e({checking:!1,available:i?.available??!1,info:i,error:i?.error??null,lastChecked:Date.now(),nextCheckInSec:a,otaDecision:null,otaPhase:`idle`}),a}return e({checking:!1,available:n===`vscode`?!1:i?.available??!1,info:n===`vscode`?null:i,error:n===`vscode`?null:i?.error??null,lastChecked:Date.now(),nextCheckInSec:a}),a}catch(i){return r===or&&e({checking:!1,error:i instanceof Error?i.message:`Failed to check for updates`,...n===`desktop`&&!t().downloaded?{otaPhase:`error`}:{}}),null}},downloadUpdate:async()=>{let{available:n,runtimeType:r,otaDecision:i,downloading:a,downloaded:o}=t();if(r===`mobile`&&i?.primaryAction===`apply_ota`&&i.ota.bundle){if(a||o)return;let t=g()?.mobileUpdates;if(!t){e({error:`Mobile OTA updates are unavailable in this runtime`,otaPhase:`error`});return}e({downloading:!0,error:null,progress:null,otaPhase:`downloading`,otaDownloadSkipped:!1});try{let{skipped:n}=await t.downloadOtaUpdate(i.ota.bundle);await t.queueOtaUpdateForNextLaunch(),e({downloading:!1,downloaded:!0,progress:null,otaPhase:`pending_restart`,otaDownloadSkipped:n})}catch(t){e({downloading:!1,error:t instanceof Error?t.message:`Failed to download update`,otaPhase:`error`})}return}if(!(r!==`desktop`||!n)){e({downloading:!0,error:null,progress:null});try{let n=O.getState().otaChannelOverride,r=await d(n);if(n!==O.getState().otaChannelOverride)throw Error(`OTA channel changed`);if(!r?.available||r.manualUpdate)throw Error(`Update detected, but desktop package is not ready yet. Retry in a moment.`);if(e(e=>({info:e.info?{...e.info,...r,body:r.body||e.info.body,available:e.info.available}:r})),r.downloaded||t().downloaded){e({downloading:!1,downloaded:!0,progress:null});return}if(r.downloading&&e({downloading:!0,progress:r.progress??{downloaded:0}}),!await f(t=>{e({progress:t})}))throw Error(`Failed to download update`);e({downloading:!1,downloaded:!0,progress:null,otaPhase:`pending_restart`})}catch(t){e({downloading:!1,error:t instanceof Error?t.message:`Failed to download update`})}}},subscribeDesktopUpdateEvents:async()=>{if(!m())return()=>{};let n=[],r=await l(n=>{let r=n.event,i=n.data??null;if(r===`Started`){if(!t().downloading)return;e({error:null,progress:{downloaded:0,total:typeof i?.contentLength==`number`?i.contentLength:void 0}});return}if(r===`Progress`){if(!t().downloading)return;e({progress:{downloaded:typeof i?.downloaded==`number`?i.downloaded:0,total:typeof i?.total==`number`?i.total:void 0}});return}r===`Finished`&&e({downloading:!1,downloaded:!0,progress:null})});r&&n.push(r);let i=await s(t=>{t.downloaded&&e({downloading:!1,downloaded:!0,available:!0,progress:null})});return i&&n.push(i),async()=>{for(let e of n)try{let t=e();t instanceof Promise&&await t}catch{}}},restartToUpdate:async()=>{let{downloaded:n,runtimeType:r,otaDecision:i}=t();if(r===`mobile`&&i?.primaryAction===`apply_ota`){if(!n)return;let t=g()?.mobileUpdates;if(!t){e({error:`Mobile OTA updates are unavailable in this runtime`,otaPhase:`error`});return}try{await t.applyOtaUpdateNow()}catch(t){e({error:t instanceof Error?t.message:`Failed to restart`,otaPhase:`error`})}return}if(!(r!==`desktop`||!n))try{if(!await c())throw Error(`Failed to restart`)}catch(t){e({error:t instanceof Error?t.message:`Failed to restart`})}},setOtaPhase:(t,n=null)=>{e({otaPhase:t,...n===void 0?{}:{error:n}})},setOtaDownloadPercent:n=>{if(!Number.isFinite(n)||n<0||n>100)return;let r=t();if(!r.downloading)return;let i=Math.round(n);if((r.progress?.total?Math.round(r.progress.downloaded/r.progress.total*100):null)===i)return;let a=r.otaDecision?.ota.bundle?.size;if(typeof a==`number`&&Number.isFinite(a)&&a>0){e({progress:{downloaded:Math.round(a*n/100),total:a}});return}e({progress:{downloaded:n,total:100}})},setOtaDownloadFailed:t=>{e({downloading:!1,downloaded:!1,error:t??`Failed to download update`,otaPhase:`error`})},dismiss:()=>{t().otaPhase!==`pending_restart`&&e({available:!1,downloaded:!1,info:null,otaDecision:null,otaPhase:`idle`,otaDownloadSkipped:!1})},reset:()=>{e(ir)}})),cr=8e3,lr=e=>!!(e&&![`succeeded`,`failed`].includes(e.status));function ur(e,t){if(e!==n()||t!==r())throw Error(`Stale update runtime`)}var dr=(e=n(),t=r(),i)=>({queryKey:[e,`host-update`,t,i??`current`],queryFn:async({signal:n})=>{ur(e,t);let r=new AbortController,o=()=>r.abort();n.addEventListener(`abort`,o,{once:!0});let s;try{return await Promise.race([(async()=>{let n=await a(`/api/system/update${i?`?channel=${i}`:``}`,{headers:{Accept:`application/json`},signal:r.signal});if([404,501].includes(n.status))throw Error(`host_update_unsupported`);let o=await n.json();if(ur(e,t),!n.ok&&n.status!==502||typeof o.serverId!=`string`||typeof o.supported!=`boolean`||![`cli`,`electron`].includes(o.host))throw Error(`Host update check failed`);return o})(),new Promise((e,t)=>{s=setTimeout(()=>{r.abort(),t(Error(`host_update_timeout`))},cr)})])}finally{s!==void 0&&clearTimeout(s),n.removeEventListener(`abort`,o)}},staleTime:6e4,retry:!1}),fr=(e=n(),t=r(),i)=>L.getQueryData(dr(e,t,i).queryKey),pr=(e=n(),t=r(),i)=>{let a=fr(e,t,i);return L.fetchQuery({...dr(e,t,i),staleTime:a?.checkError||lr(a?.operation)?0:6e4})},mr=(e=n(),t=r(),i)=>L.fetchQuery({...dr(e,t,i),staleTime:0}),hr=(e,t,n)=>{let r=(0,Z.c)(6),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=dr(e,t,n),r[0]=n,r[1]=t,r[2]=e,r[3]=i):i=r[3];let a;return r[4]===i?a=r[5]:(a={...i,refetchInterval:_r,refetchIntervalInBackground:!1},r[4]=i,r[5]=a),I(a)};async function gr(e,t,n){if(ur(t,n),!e.update)throw Error(`No update plan`);let r=await a(`/api/system/update`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({version:e.update.version,channel:e.channel,planId:e.update.planId,allowDowngrade:e.update.rollback===!0})});if(ur(t,n),!r.ok)throw Error(`Host update was not accepted`);let i=await r.json();if(typeof i.operation?.id!=`string`)throw Error(`Invalid update operation`);return i.operation}function _r(e){return lr(e.state.data?.operation)?2e3:e.state.error?.message===`host_update_unsupported`?!1:e.state.error?15e3:3e5}function vr(e){let t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(je(),{year:`numeric`,month:`short`,day:`numeric`}).format(t)}function yr(e){return e.replace(/^## \[[^\]]+\] - \d{4}-\d{2}-\d{2}\s*\n?/,``).trim()}function br(e){return e.replace(/(^|[^a-zA-Z0-9])@([a-zA-Z0-9-]+)/g,`$1[@$2](https://github.com/$2)`)}function xr(e,t){let n=e.split(`.`).map(e=>Number.parseInt(e,10)),r=t.split(`.`).map(e=>Number.parseInt(e,10));for(let e=0;e<3;e+=1){let t=Number.isFinite(n[e])?n[e]:0,i=Number.isFinite(r[e])?r[e]:0;if(t!==i)return i-t}return 0}function Sr(e){let t=/^## \[(\d+\.\d+\.\d+)\] - (\d{4}-\d{2}-\d{2})\s*$/gm,n=[],r;for(;(r=t.exec(e))!==null;)n.push({version:r[1]??``,date:r[2]??``,start:r.index});return n.map((t,r)=>{let i=n[r+1]?.start??e.length;return{version:t.version,date:t.date,start:t.start,end:i,raw:e.slice(t.start,i).trim()}})}function Cr(e){let t=(0,Z.c)(69),{open:n,onOpenChange:r,model:i,onAction:a}=e,{t:o}=Ae(),[s,c]=(0,$.useState)(!1),l=De(Tr),u;t[0]===l?u=t[1]:(u=e=>{let t=e.target.closest(`a`);t?.href&&(e.preventDefault(),e.stopPropagation(),l(t.href))},t[0]=l,t[1]=u);let d=De(u),f;t[2]===i.fallbackCommand?f=t[3]:(f=async()=>{i.fallbackCommand&&(await ke(i.fallbackCommand)).ok&&(c(!0),setTimeout(()=>c(!1),2e3))},t[2]=i.fallbackCommand,t[3]=f);let p=De(f),m;if(t[4]!==i.body||t[5]!==o){bb0:{let e=i.body?.trim();if(!e){m=null;break bb0}let n=Sr(e);if(!n.length){m={kind:`raw`,title:o(`updateDialog.changelog.title`),content:br(e)};break bb0}let r;t[7]===o?r=t[8]:(r=o(`updateDialog.changelog.title`),t[7]=o,t[8]=r),m={kind:`sections`,title:r,sections:[...n].sort(wr).map(t=>({version:t.version,dateLabel:vr(t.date),content:br(yr(t.raw)||e)}))}}t[4]=i.body,t[5]=o,t[6]=m}else m=t[6];let h=m,g=i.dismissible===!1?void 0:r,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(X,{name:`download-cloud`,className:`h-5 w-5 text-[var(--primary-base)]`}),t[9]=_):_=t[9];let v;t[10]===i.title?v=t[11]:(v=(0,Q.jsxs)(Qe,{className:`flex items-center gap-2`,children:[_,(0,Q.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.title})]}),t[10]=i.title,t[11]=v);let y;t[12]!==i.currentVersion||t[13]!==i.methodLabel||t[14]!==i.version?(y=(i.currentVersion||i.version)&&(0,Q.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5 pl-7 font-mono text-[11px] leading-4 tracking-[-0.01em] tabular-nums sm:text-xs`,children:[i.currentVersion&&(0,Q.jsx)(`span`,{className:`text-muted-foreground/75`,children:i.currentVersion}),i.currentVersion&&i.version&&(0,Q.jsx)(`span`,{className:`text-muted-foreground/40`,children:`→`}),i.version&&(0,Q.jsx)(`span`,{className:`font-medium text-[var(--primary-base)]`,children:i.version}),i.methodLabel&&(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,i.methodLabel]})]}),t[12]=i.currentVersion,t[13]=i.methodLabel,t[14]=i.version,t[15]=y):y=t[15];let b;t[16]===i.description?b=t[17]:(b=i.description&&(0,Q.jsx)($e,{className:`mt-2`,children:i.description}),t[16]=i.description,t[17]=b);let x;t[18]!==v||t[19]!==y||t[20]!==b?(x=(0,Q.jsxs)(`div`,{className:`mb-3 pr-8 sm:mb-4`,children:[v,y,b]}),t[18]=v,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]===i.message?S=t[23]:(S=i.message&&(0,Q.jsx)(`p`,{role:`status`,className:`typography-ui-label text-muted-foreground`,children:i.message}),t[22]=i.message,t[23]=S);let C;t[24]===i.warning?C=t[25]:(C=i.warning&&(0,Q.jsx)(`p`,{className:`typography-meta text-[var(--status-warning)]`,children:i.warning}),t[24]=i.warning,t[25]=C);let w;t[26]!==h||t[27]!==d||t[28]!==i.hideChangelog?(w=h&&!i.hideChangelog&&(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-[var(--surface-subtle)] bg-[var(--surface-elevated)]/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--surface-subtle)] px-3.5 py-2.5 sm:px-4 sm:py-3`,children:[(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--primary-base)]`,"aria-hidden":`true`}),(0,Q.jsx)(`h3`,{className:`typography-ui-caption font-medium text-muted-foreground`,children:h.title})]}),(0,Q.jsx)(Jt,{className:`max-h-[min(42dvh,22rem)] p-0 sm:max-h-[400px]`,fillContainer:!1,children:h.kind===`raw`?(0,Q.jsx)(`div`,{className:`break-words p-3.5 text-[13px] leading-[1.65] text-foreground sm:p-4 sm:text-sm [&_.markdown-content]:leading-[1.65] [&_a]:!text-[var(--primary-base)] [&_a]:!no-underline [&_a:hover]:!underline`,onClickCapture:d,children:(0,Q.jsx)(qt,{content:h.content,disableLinkSafety:!0,enableFileReferences:!1})}):(0,Q.jsx)(`div`,{className:`divide-y divide-[var(--surface-subtle)]`,children:h.sections.map(e=>(0,Q.jsxs)(`div`,{className:`p-3.5 sm:p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-2 gap-y-1 sm:mb-3`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-[var(--primary-base)]/10 px-1.5 py-0.5 font-mono text-[11px] font-medium leading-4 text-[var(--primary-base)] tabular-nums sm:text-xs`,children:[`v`,e.version]}),(0,Q.jsx)(`span`,{className:`text-[11px] leading-4 text-muted-foreground/75 sm:text-xs`,children:e.dateLabel})]}),(0,Q.jsx)(`div`,{className:`break-words text-[13px] leading-[1.65] text-foreground sm:text-sm [&_.markdown-content]:leading-[1.65] [&_a]:!text-[var(--primary-base)] [&_a]:!no-underline [&_a:hover]:!underline`,onClickCapture:d,children:(0,Q.jsx)(qt,{content:e.content,disableLinkSafety:!0,enableFileReferences:!1})})]},e.version))})})]}),t[26]=h,t[27]=d,t[28]=i.hideChangelog,t[29]=w):w=t[29];let T;t[30]!==s||t[31]!==p||t[32]!==i.fallbackCommand||t[33]!==o?(T=i.fallbackCommand&&(0,Q.jsxs)(`div`,{className:`space-y-2 mt-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 typography-meta text-muted-foreground`,children:[(0,Q.jsx)(X,{name:`terminal`,className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:o(`updateDialog.fallback.updateViaTerminal`)})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 p-1 pl-3 bg-[var(--surface-elevated)]/50 rounded-md border border-[var(--surface-subtle)]`,children:[(0,Q.jsx)(`code`,{className:`flex-1 font-mono text-sm text-foreground overflow-x-auto whitespace-nowrap`,children:i.fallbackCommand}),(0,Q.jsx)(`button`,{onClick:p,className:Y(`flex items-center justify-center p-2 rounded`,`text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]`,`transition-colors`,s&&`text-[var(--status-success)]`),title:o(s?`updateDialog.actions.copied`:`updateDialog.actions.copyCommand`),children:(0,Q.jsx)(X,{name:s?`check`:`clipboard`,className:`h-4 w-4`})})]})]}),t[30]=s,t[31]=p,t[32]=i.fallbackCommand,t[33]=o,t[34]=T):T=t[34];let E;t[35]===i.status?E=t[36]:(E=i.status&&(0,Q.jsxs)(`div`,{role:`status`,className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex h-5 items-center justify-between gap-3`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-muted-foreground sm:text-[13px]`,children:[i.status.kind===`activity`&&(0,Q.jsx)(X,{name:`loader`,className:`h-3.5 w-3.5 shrink-0 animate-spin text-[var(--primary-base)]`}),(0,Q.jsx)(`span`,{className:`truncate`,children:i.status.label})]}),i.status.progress!=null&&(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] leading-4 text-foreground tabular-nums sm:text-xs`,children:[Math.round(i.status.progress),`%`]})]}),(0,Q.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-[var(--surface-subtle)] sm:h-1.5`,children:i.status.progress==null?(0,Q.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-[var(--primary-base)]/60`}):(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-[var(--primary-base)] transition-[width] duration-500`,style:{width:`${i.status.progress}%`}})}),(0,Q.jsx)(`p`,{className:`min-h-4 text-xs leading-4 text-muted-foreground`,children:i.status.detail})]}),t[35]=i.status,t[36]=E);let D;t[37]===i.error?D=t[38]:(D=i.error&&(0,Q.jsx)(`div`,{role:`alert`,className:`p-3 mt-4 bg-[var(--status-error-background)] border border-[var(--status-error-border)] rounded-lg`,children:(0,Q.jsx)(`p`,{className:`text-sm text-[var(--status-error)]`,children:i.error})}),t[37]=i.error,t[38]=D);let O;t[39]!==S||t[40]!==C||t[41]!==w||t[42]!==T||t[43]!==E||t[44]!==D?(O=(0,Q.jsxs)(`div`,{className:`space-y-3 sm:space-y-4`,children:[S,C,w,T,E,D]}),t[39]=S,t[40]=C,t[41]=w,t[42]=T,t[43]=E,t[44]=D,t[45]=O):O=t[45];let k;t[46]===i.notice?k=t[47]:(k=i.notice&&(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg border border-[var(--status-success-border)] bg-[var(--status-success-background)] px-3 py-2.5 text-sm text-[var(--status-success)]`,children:[(0,Q.jsx)(X,{name:`check`,className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:i.notice})]}),t[46]=i.notice,t[47]=k);let A;t[48]===i.releaseLink?A=t[49]:(A=i.releaseLink?(0,Q.jsxs)(`a`,{href:i.releaseLink.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 typography-ui-label text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:[(0,Q.jsx)(X,{name:`external-link`,className:`h-4 w-4`}),i.releaseLink.label]}):(0,Q.jsx)(`span`,{}),t[48]=i.releaseLink,t[49]=A);let j;if(t[50]!==i.actions||t[51]!==a){let e;t[53]===a?e=t[54]:(e=e=>(0,Q.jsxs)(Me,{onClick:()=>a(e.id),disabled:e.disabled,variant:e.variant??`default`,size:`default`,children:[e.icon&&(0,Q.jsx)(X,{name:e.icon,className:Y(`h-4 w-4`,e.loading&&`animate-spin`)}),e.label]},e.id),t[53]=a,t[54]=e),j=i.actions.map(e),t[50]=i.actions,t[51]=a,t[52]=j}else j=t[52];let M;t[55]===j?M=t[56]:(M=(0,Q.jsx)(`div`,{className:`flex flex-1 flex-wrap items-center justify-end gap-2`,children:j}),t[55]=j,t[56]=M);let N;t[57]!==A||t[58]!==M?(N=(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[A,M]}),t[57]=A,t[58]=M,t[59]=N):N=t[59];let P;t[60]!==O||t[61]!==k||t[62]!==N||t[63]!==x?(P=(0,Q.jsxs)(Ze,{className:`max-w-4xl gap-0 p-4 sm:p-5 bg-background border-[var(--interactive-border)]`,showCloseButton:!0,children:[x,O,k,N]}),t[60]=O,t[61]=k,t[62]=N,t[63]=x,t[64]=P):P=t[64];let F;return t[65]!==n||t[66]!==P||t[67]!==g?(F=(0,Q.jsx)(et,{open:n,onOpenChange:g,children:P}),t[65]=n,t[66]=P,t[67]=g,t[68]=F):F=t[68],F}function wr(e,t){return xr(e.version,t.version)}function Tr(e){Xt(e)}var Er=`https://github.com/yee94/yuri/releases`,Dr=2e3,Or=6e5,kr=e=>e.transport===n()&&e.generation===r();async function Ar(e,t){try{if(!kr(t))return{success:!1};let n=await pr(t.transport,t.generation);return!kr(t)||!e||!n.supported||n.update?.version!==e||n.update.rollback?{success:!1}:(await gr(n,t.transport,t.generation),{success:!0,autoRestart:!0})}catch(e){return{success:!1,error:e instanceof Error?e.message:void 0}}}async function jr(e,t,n=Math.ceil(Or/Dr),r=Dr){for(let i=0;i<n;i++){if(!kr(t))return!1;try{let n=await mr(t.transport,t.generation);if(n.operation?.status===`failed`)return!1;if(n.currentVersion===e&&n.operation?.status===`succeeded`&&kr(t))return!0}catch{}await new Promise(e=>setTimeout(e,r))}return!1}var Mr=e=>{let t=(0,Z.c)(108),{open:i,onOpenChange:a,info:o,downloading:s,downloaded:c,progress:l,error:u,onDownload:d,onRestart:f,runtimeType:p}=e,m=p===void 0?`desktop`:p,{t:h}=Ae(),[g,_]=(0,$.useState)(`idle`),[v,y]=(0,$.useState)(null),b=sr(Nr),x=o?.releaseUrl||(o?.version?`${Er}/tag/v${o.version}`:Er),S=o?.downloadUrl,C=m===`web`,w=m===`mobile`,T=w&&o?.manualUpdate===!0&&!!S,E=w&&o?.inAppApply===!0,D=m===`desktop`&&o?.manualUpdate===!0,O=g!==`idle`&&g!==`error`,k=w?S:x,A;t[0]!==c||t[1]!==E||t[2]!==a?(A=e=>{!e&&E&&c&&sr.getState().dismiss(),a(e)},t[0]=c,t[1]=E,t[2]=a,t[3]=A):A=t[3];let j=De(A),M,N;t[4]===i?(M=t[5],N=t[6]):(M=()=>{i||(_(`idle`),y(null))},N=[i],t[4]=i,t[5]=M,t[6]=N),(0,$.useEffect)(M,N);let P;t[7]!==o?.version||t[8]!==h?(P=async()=>{let e={transport:n(),generation:r()};_(`updating`),y(null);let t=await Ar(o?.version,e);if(!kr(e))return;if(!t.success){_(`error`),y(t.error||h(`updateDialog.error.updateFailed`));return}t.autoRestart&&(_(`restarting`),await new Promise(Pr)),_(`reconnecting`);let i=await jr(o?.version,e);kr(e)&&(i?window.location.reload():(_(`error`),y(h(`updateDialog.error.takingLonger`))))},t[7]=o?.version,t[8]=h,t[9]=P):P=t[9];let F=De(P),I;t[10]!==F||t[11]!==w||t[12]!==d||t[13]!==a||t[14]!==f||t[15]!==S||t[16]!==x||t[17]!==m?(I=e=>{bb107:switch(e){case`download`:d(),m===`desktop`&&a(!1);break bb107;case`restart`:f();break bb107;case`later`:sr.getState().dismiss(),a(!1);break bb107;case`open-external`:{let e=w?S:x;e&&Xt(e);break bb107}case`web-update`:F()}},t[10]=F,t[11]=w,t[12]=d,t[13]=a,t[14]=f,t[15]=S,t[16]=x,t[17]=m,t[18]=I):I=t[18];let L=De(I),R;if(t[19]!==c||t[20]!==s||t[21]!==E||t[22]!==D||t[23]!==w||t[24]!==C||t[25]!==O||t[26]!==T||t[27]!==h){if(R=[],!C&&(!w||E)){if(!D&&!c&&!s){let e;t[29]!==E||t[30]!==h?(e=h(E?`updateDialog.actions.applyOtaNow`:`updateDialog.actions.downloadUpdate`),t[29]=E,t[30]=h,t[31]=e):e=t[31];let n;t[32]===e?n=t[33]:(n={id:`download`,icon:`download`,label:e},t[32]=e,t[33]=n),R.push(n)}if(D&&!c&&!s){let e;t[34]===h?e=t[35]:(e=h(`updateDialog.actions.openMobileUpdate`),t[34]=h,t[35]=e);let n;t[36]===e?n=t[37]:(n={id:`open-external`,icon:`external-link`,label:e},t[36]=e,t[37]=n),R.push(n)}if(s){let e;t[38]===h?e=t[39]:(e=h(`updateDialog.status.downloading`),t[38]=h,t[39]=e);let n;t[40]===e?n=t[41]:(n={id:`downloading`,icon:`loader`,loading:!0,disabled:!0,label:e},t[40]=e,t[41]=n),R.push(n)}if(c){if(E){let e;t[42]===h?e=t[43]:(e=h(`updateDialog.actions.later`),t[42]=h,t[43]=e);let n;t[44]===e?n=t[45]:(n={id:`later`,variant:`ghost`,label:e},t[44]=e,t[45]=n),R.push(n)}let e;t[46]===h?e=t[47]:(e=h(`updateDialog.actions.restartToUpdate`),t[46]=h,t[47]=e);let n;t[48]===e?n=t[49]:(n={id:`restart`,icon:`restart`,label:e},t[48]=e,t[49]=n),R.push(n)}}if(w&&!E&&T){let e;t[50]===h?e=t[51]:(e=h(`updateDialog.actions.openMobileUpdate`),t[50]=h,t[51]=e);let n;t[52]===e?n=t[53]:(n={id:`open-external`,icon:`external-link`,label:e},t[52]=e,t[53]=n),R.push(n)}if(C){let e;t[54]!==O||t[55]!==h?(e=O?{id:`updating`,icon:`loader`,loading:!0,disabled:!0,label:h(`updateDialog.status.updating`)}:{id:`web-update`,icon:`download`,label:h(`updateDialog.actions.updateNow`)},t[54]=O,t[55]=h,t[56]=e):e=t[56],R.push(e)}t[19]=c,t[20]=s,t[21]=E,t[22]=D,t[23]=w,t[24]=C,t[25]=O,t[26]=T,t[27]=h,t[28]=R}else R=t[28];let z;t[57]!==h||t[58]!==g?(z=h(g===`restarting`||g===`reconnecting`?`updateDialog.header.updating`:`updateDialog.header.updateAvailable`),t[57]=h,t[58]=g,t[59]=z):z=t[59];let ee=o?.currentVersion,te=o?.version,B=o?.body,V=!O,H=u||v,ne=C&&g===`error`?o?.updateCommand||`yuri update`:void 0,U;t[60]!==c||t[61]!==E||t[62]!==b||t[63]!==h?(U=E&&c&&b?h(`updateDialog.status.otaBundleReused`):void 0,t[60]=c,t[61]=E,t[62]=b,t[63]=h,t[64]=U):U=t[64];let W;t[65]!==w||t[66]!==k||t[67]!==T?(W=(!w||T)&&k?{url:k,label:`GitHub`}:void 0,t[65]=w,t[66]=k,t[67]=T,t[68]=W):W=t[68];let G;if(t[69]!==R||t[70]!==s||t[71]!==E||t[72]!==w||t[73]!==C||t[74]!==O||t[75]!==l||t[76]!==h||t[77]!==B||t[78]!==V||t[79]!==H||t[80]!==ne||t[81]!==U||t[82]!==W||t[83]!==z||t[84]!==ee||t[85]!==te||t[86]!==g){if(G={title:z,currentVersion:ee,version:te,body:B,hideChangelog:O,dismissible:V,error:H,fallbackCommand:ne,notice:U,releaseLink:W,actions:R},C&&O){let e;t[88]!==h||t[89]!==g?(e=h(g===`updating`?`updateDialog.status.installingUpdate`:g===`restarting`?`updateDialog.status.serverRestarting`:`updateDialog.status.waitingForServer`),t[88]=h,t[89]=g,t[90]=e):e=t[90];let n;t[91]===h?n=t[92]:(n=h(`updateDialog.status.autoReloadHint`),t[91]=h,t[92]=n);let r;t[93]!==e||t[94]!==n?(r={kind:`activity`,label:e,detail:n},t[93]=e,t[94]=n,t[95]=r):r=t[95],G.status=r}if(!C&&(!w||E)&&s){let e;t[96]===h?e=t[97]:(e=h(`updateDialog.status.downloadingPayload`),t[96]=h,t[97]=e);let n;t[98]===l?n=t[99]:(n=l?.total?Math.round(l.downloaded/l.total*100):0,t[98]=l,t[99]=n);let r;t[100]!==e||t[101]!==n?(r={kind:`download`,label:e,progress:n},t[100]=e,t[101]=n,t[102]=r):r=t[102],G.status=r}t[69]=R,t[70]=s,t[71]=E,t[72]=w,t[73]=C,t[74]=O,t[75]=l,t[76]=h,t[77]=B,t[78]=V,t[79]=H,t[80]=ne,t[81]=U,t[82]=W,t[83]=z,t[84]=ee,t[85]=te,t[86]=g,t[87]=G}else G=t[87];let K;return t[103]!==L||t[104]!==j||t[105]!==G||t[106]!==i?(K=(0,Q.jsx)(Cr,{open:i,onOpenChange:j,model:G,onAction:L}),t[103]=L,t[104]=j,t[105]=G,t[106]=i,t[107]=K):K=t[107],K};function Nr(e){return e.otaDownloadSkipped}function Pr(e){return setTimeout(e,2e3)}var Fr=e(x(),1);function Ir(e){let t=(0,Z.c)(10),{children:n,actions:r,className:i}=e,a;t[0]===i?a=t[1]:(a=Y(`sticky top-0 z-10 flex shrink-0 items-center justify-between gap-3 bg-background py-3`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,Q.jsx)(`div`,{className:`flex max-w-[70%] shrink-0 flex-wrap items-center justify-end gap-2 [&_button]:max-w-full [&_button]:whitespace-normal`,children:r}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`header`,{"data-settings-action-header":``,className:a,children:[o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Lr(e){let t=(0,Z.c)(21),{label:n,actions:r,children:i,description:a,itemId:o,ariaLabel:s,className:c,cardClassName:l,cardId:u}=e,d=typeof n==`string`&&/^[\p{Script=Latin}\p{Number}\p{Punctuation}\p{Separator}]+$/u.test(n)?`latin`:void 0,f;t[0]===c?f=t[1]:(f=Y(`yuri-settings-group`,c),t[0]=c,t[1]=f);let p;t[2]!==r||t[3]!==n||t[4]!==d?(p=r?(0,Q.jsx)(Ir,{actions:r,children:n?(0,Q.jsx)(`div`,{className:`yuri-settings-group-label`,"data-settings-label-script":d,children:n}):null}):n?(0,Q.jsx)(`div`,{className:`yuri-settings-group-label`,"data-settings-label-script":d,children:n}):null,t[2]=r,t[3]=n,t[4]=d,t[5]=p):p=t[5];let m;t[6]===l?m=t[7]:(m=Y(`yuri-settings-group-card`,l),t[6]=l,t[7]=m);let h;t[8]!==u||t[9]!==i||t[10]!==o||t[11]!==m?(h=(0,Q.jsx)(`div`,{id:u,"data-settings-item":o,className:m,children:i}),t[8]=u,t[9]=i,t[10]=o,t[11]=m,t[12]=h):h=t[12];let g;t[13]===a?g=t[14]:(g=a?(0,Q.jsx)(`p`,{className:`yuri-settings-group-description text-muted-foreground`,children:a}):null,t[13]=a,t[14]=g);let _;return t[15]!==s||t[16]!==f||t[17]!==p||t[18]!==h||t[19]!==g?(_=(0,Q.jsxs)(`section`,{className:f,"aria-label":s,children:[p,h,g]}),t[15]=s,t[16]=f,t[17]=p,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function Rr(e){let t=(0,Z.c)(20),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({label:s,description:a,descriptionPlacement:l,ariaLabel:n,groupClassName:o,cardClassName:r,children:i,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`inside`:l,d=u===`outside`?a:void 0,f=u===`inside`?a:void 0,p;t[9]!==i||t[10]!==s||t[11]!==c||t[12]!==f?(p=(0,Q.jsx)(zr,{label:s,description:f,...c,children:i}),t[9]=i,t[10]=s,t[11]=c,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==n||t[15]!==r||t[16]!==o||t[17]!==d||t[18]!==p?(m=(0,Q.jsx)(Lr,{ariaLabel:n,className:o,cardClassName:r,description:d,children:p}),t[14]=n,t[15]=r,t[16]=o,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function zr(e){let t=(0,Z.c)(22),{label:n,children:r,description:i,itemId:a,className:o,copyClassName:s,controlClassName:c}=e,l;t[0]===o?l=t[1]:(l=Y(`yuri-settings-group-row yuri-settings-split-row`,o),t[0]=o,t[1]=l);let u;t[2]===s?u=t[3]:(u=Y(`yuri-settings-split-row-copy`,s),t[2]=s,t[3]=u);let d;t[4]===n?d=t[5]:(d=n?(0,Q.jsx)(`div`,{className:`typography-ui-label text-foreground`,children:n}):null,t[4]=n,t[5]=d);let f;t[6]===i?f=t[7]:(f=i?(0,Q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:i}):null,t[6]=i,t[7]=f);let p;t[8]!==u||t[9]!==d||t[10]!==f?(p=(0,Q.jsxs)(`div`,{className:u,children:[d,f]}),t[8]=u,t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===c?m=t[13]:(m=Y(`yuri-settings-split-row-control`,c),t[12]=c,t[13]=m);let h;t[14]!==r||t[15]!==m?(h=(0,Q.jsx)(`div`,{"data-settings-value":``,className:m,children:r}),t[14]=r,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==a||t[18]!==l||t[19]!==p||t[20]!==h?(g=(0,Q.jsxs)(`div`,{"data-settings-item":a,className:l,children:[p,h]}),t[17]=a,t[18]=l,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}function Br(e){let t=(0,Z.c)(32),{checked:n,onChange:r,label:i,ariaLabel:a,description:o,itemId:s,disabled:c,className:l}=e,u=c!==void 0&&c,d;t[0]!==n||t[1]!==u||t[2]!==r?(d=()=>{u||r(!n)},t[0]=n,t[1]=u,t[2]=r,t[3]=d):d=t[3];let f=d,p=Vr,m=u?`cursor-not-allowed`:`cursor-pointer`,h;t[4]!==l||t[5]!==m?(h=Y(`yuri-settings-group-row yuri-settings-split-row group`,m,l),t[4]=l,t[5]=m,t[6]=h):h=t[6];let g=u?-1:0,_=u||void 0,v,y;t[7]===f?(v=t[8],y=t[9]):(v=e=>{p(e.target)||f()},y=e=>{p(e.target)||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),f())},t[7]=f,t[8]=v,t[9]=y);let b;t[10]===i?b=t[11]:(b=(0,Q.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:i}),t[10]=i,t[11]=b);let x;t[12]===o?x=t[13]:(x=o?(0,Q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:o}):null,t[12]=o,t[13]=x);let S;t[14]!==x||t[15]!==b?(S=(0,Q.jsxs)(`div`,{className:`yuri-settings-split-row-copy`,children:[b,x]}),t[14]=x,t[15]=b,t[16]=S):S=t[16];let C;t[17]!==a||t[18]!==n||t[19]!==u||t[20]!==r?(C=(0,Q.jsx)(`div`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,Q.jsx)(ct,{checked:n,onChange:r,disabled:u,ariaLabel:a})}),t[17]=a,t[18]=n,t[19]=u,t[20]=r,t[21]=C):C=t[21];let w;return t[22]!==n||t[23]!==s||t[24]!==S||t[25]!==C||t[26]!==h||t[27]!==g||t[28]!==_||t[29]!==v||t[30]!==y?(w=(0,Q.jsxs)(`div`,{"data-settings-item":s,className:h,role:`button`,tabIndex:g,"aria-pressed":n,"aria-disabled":_,onClick:v,onKeyDown:y,children:[S,C]}),t[22]=n,t[23]=s,t[24]=S,t[25]=C,t[26]=h,t[27]=g,t[28]=_,t[29]=v,t[30]=y,t[31]=w):w=t[31],w}function Vr(e){return e instanceof HTMLElement&&e.closest(`button, a, input, select, textarea`)!==null}function Hr(e,t){return e===`checking`?5:e===`downloading`?5+Math.min(Math.max(t??0,0),100)*.75:e===`installing`?85:e===`restarting`?95:100}function Ur(e,t,n){let r=e?.operation,i=e?.update,a=lr(r),o=e?.supported===!1||t.failure===`unsupported`,s={title:n(`settings.yuri.about.hostUpdate.title`),description:n(`settings.yuri.about.hostUpdate.description`),currentVersion:e?.currentVersion??t.versionFallback,version:i?.version??r?.version,methodLabel:i?n(`settings.yuri.about.hostUpdate.kind.${i.kind}`):void 0,body:i?i.releaseNotes||n(`settings.yuri.about.hostUpdate.noNotes`):void 0,warning:!a&&i?.rollback?n(`settings.yuri.about.hostUpdate.downgrade`):void 0,actions:[{id:`check`,variant:`ghost`,label:n(`settings.yuri.about.actions.checkForUpdates`),disabled:!!t.checking},{id:`confirm`,icon:a||t.submitting?`loader`:`download`,loading:a||t.submitting,label:n(`settings.yuri.about.hostUpdate.confirm`),disabled:!i||!e?.supported||a||t.submitting||!!t.failure||!!t.checking}]};return a&&r?(s.hideChangelog=!0,s.status={kind:r.status===`downloading`?`download`:`activity`,label:n(`settings.yuri.about.hostUpdate.status.${r.status}`),progress:Hr(r.status,r.progress),detail:t.failure===`disconnected`?n(`settings.yuri.about.hostUpdate.reconnecting`):void 0}):t.completed&&!i?(s.hideChangelog=!0,s.status={kind:`download`,label:n(`settings.yuri.about.hostUpdate.status.succeeded`),progress:100}):t.submitting?(s.hideChangelog=!0,s.status={kind:`activity`,label:n(`settings.yuri.about.state.checking`),progress:0}):t.checking===`initial`?s.status={kind:`activity`,label:n(`settings.yuri.about.state.checking`)}:o?s.message=n(`settings.yuri.about.hostUpdate.unsupported`):t.failure?s.error=n(t.failure===`disconnected`?`settings.yuri.about.hostUpdate.reconnecting`:`settings.yuri.about.toast.checkFailed`):!i&&e?.supported&&(s.message=r?.status===`succeeded`?n(`settings.yuri.about.hostUpdate.status.succeeded`):n(`settings.yuri.about.toast.latestVersion`)),r?.status===`failed`&&(s.error=n(`settings.yuri.about.hostUpdate.status.failed`)),s}function Wr(){let e=(0,Z.c)(7),{t:i}=Ae(),a=$.useSyncExternalStore(t,n,n),o=$.useSyncExternalStore(t,r,r),s=`${a}:${o}`,c;e[0]===i?c=e[1]:(c=i(`settings.yuri.about.state.unknown`),e[0]=i,e[1]=c);let l;return e[2]!==o||e[3]!==s||e[4]!==c||e[5]!==a?(l=(0,Q.jsx)(Gr,{transport:a,generation:o,version:c},s),e[2]=o,e[3]=s,e[4]=c,e[5]=a,e[6]=l):l=e[6],l}function Gr(e){let t=(0,Z.c)(59),{version:i,transport:a,generation:o,itemId:s,channel:c}=e,{t:l}=Ae(),u=N(),[d,f]=$.useState(!1),p=O(Kr),m=c??p??void 0,h=hr(a,o,m),g=h.data,_=g?.operation,v;t[0]===_?v=t[1]:(v=lr(_),t[0]=_,t[1]=v);let y=v,b;t[2]!==o||t[3]!==a?(b=e=>{let{plan:t}=e;return gr(t,a,o)},t[2]=o,t[3]=a,t[4]=b):b=t[4];let x,S;t[5]!==u||t[6]!==o||t[7]!==a?(x=(e,t)=>{a===n()&&o===r()&&u.setQueryData(dr(a,o,t.channel).queryKey,t=>t&&{...t,operation:e})},S=(e,t,i)=>{a===n()&&o===r()&&u.invalidateQueries({queryKey:dr(a,o,i.channel).queryKey,exact:!0})},t[5]=u,t[6]=o,t[7]=a,t[8]=x,t[9]=S):(x=t[8],S=t[9]);let C;t[10]!==b||t[11]!==x||t[12]!==S?(C={mutationFn:b,onSuccess:x,onSettled:S},t[10]=b,t[11]=x,t[12]=S,t[13]=C):C=t[13];let w=P(C),[T,E]=$.useState(null);y&&_&&_.id!==T&&E(_.id);let D;t[14]===h?D=t[15]:(D=()=>{f(!0),h.refetch()},t[14]=h,t[15]=D);let k=De(D),A=g?.supported===!1||!y&&h.error?.message===`host_update_unsupported`,j=h.isError||!!g?.checkError,M=w.isError&&w.variables?.channel===m,F=h.isPending?`initial`:h.isFetching?`refresh`:!1,I=A?`unsupported`:h.isError&&(y||M)?`disconnected`:j||M?`check`:null,L=_?.status===`succeeded`&&_.id===T,R;t[16]!==w.isPending||t[17]!==g||t[18]!==l||t[19]!==F||t[20]!==I||t[21]!==L||t[22]!==i?(R=Ur(g,{versionFallback:i,checking:F,submitting:w.isPending,failure:I,completed:L},l),t[16]=w.isPending,t[17]=g,t[18]=l,t[19]=F,t[20]=I,t[21]=L,t[22]=i,t[23]=R):R=t[23];let z=R,ee;t[24]!==m||t[25]!==w||t[26]!==h||t[27]!==g?(ee=e=>{e===`check`&&h.refetch(),e===`confirm`&&g?.update&&w.mutate({plan:g,channel:m})},t[24]=m,t[25]=w,t[26]=h,t[27]=g,t[28]=ee):ee=t[28];let te=De(ee),B=g?.currentVersion??i,V;t[29]!==y||t[30]!==g?.update||t[31]!==l?(V=g?.update&&!y&&(0,Q.jsx)(`span`,{"aria-label":l(`settings.yuri.about.hostUpdate.available`),className:`absolute -right-1.5 -top-0.5 size-1.5 rounded-full bg-[var(--status-error)]`}),t[29]=y,t[30]=g?.update,t[31]=l,t[32]=V):V=t[32];let H;t[33]!==B||t[34]!==V?(H=(0,Q.jsxs)(`span`,{className:`relative typography-ui-label font-mono text-foreground text-right`,children:[B,V]}),t[33]=B,t[34]=V,t[35]=H):H=t[35];let ne;t[36]===l?ne=t[37]:(ne=l(`settings.yuri.about.hostUpdate.title`),t[36]=l,t[37]=ne);let U;t[38]===l?U=t[39]:(U=l(`settings.yuri.about.hostUpdate.title`),t[38]=l,t[39]=U);let W=y||h.isFetching?`loader`:g?.update?`download`:`refresh`,G=y||h.isFetching?`size-4 animate-spin`:`size-4`,K;t[40]!==W||t[41]!==G?(K=(0,Q.jsx)(X,{name:W,className:G}),t[40]=W,t[41]=G,t[42]=K):K=t[42];let re;t[43]!==k||t[44]!==ne||t[45]!==U||t[46]!==K?(re=(0,Q.jsx)(Me,{type:`button`,size:`icon`,variant:`ghost`,onClick:k,"aria-label":ne,title:U,children:K}),t[43]=k,t[44]=ne,t[45]=U,t[46]=K,t[47]=re):re=t[47];let ie;t[48]!==s||t[49]!==H||t[50]!==re?(ie=(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,"data-settings-item":s,children:[H,re]}),t[48]=s,t[49]=H,t[50]=re,t[51]=ie):ie=t[51];let q;t[52]!==te||t[53]!==z||t[54]!==d?(q=(0,Q.jsx)(Cr,{open:d,onOpenChange:f,model:z,onAction:te}),t[52]=te,t[53]=z,t[54]=d,t[55]=q):q=t[55];let ae;return t[56]!==ie||t[57]!==q?(ae=(0,Q.jsxs)(Q.Fragment,{children:[ie,q]}),t[56]=ie,t[57]=q,t[58]=ae):ae=t[58],ae}function Kr(e){return e.otaChannelOverride}var qr=`/mcp/oauth/callback`,Jr=e=>{if(typeof window>`u`)return null;try{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4==0?``:`=`.repeat(4-t.length%4),r=window.atob(t+n),i=Uint8Array.from(r,e=>e.charCodeAt(0));return new TextDecoder().decode(i)}catch{return null}},Yr=e=>{let t=Zr(e.get(`state`));if(t)return t;let n=e.get(`server`);if(typeof n!=`string`||!n.trim())return null;let r=e.get(`directory`);return{name:n.trim(),directory:typeof r==`string`&&r.trim()?r.trim():null}},Xr=e=>{let t=e.get(`state`);return typeof t==`string`&&t.trim()||null},Zr=e=>{if(typeof e!=`string`||!e.trim())return null;let t=Jr(e.trim());if(!t)return null;try{let e=JSON.parse(t);return e?.v!==1||typeof e.n!=`string`||!e.n.trim()?null:{name:e.n.trim(),directory:typeof e.d==`string`&&e.d.trim()?e.d.trim():null}}catch{return null}},Qr=e=>typeof e==`object`&&!!e&&`updateStatus`in e&&typeof e.updateStatus==`function`,$r=e=>{let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=gn(e);if(!n)return{top:!1,dom:t};n.state.statusbar=t;let r=n.state.vimPlugin;return Qr(r)&&r.updateStatus(),{top:!1,dom:t,destroy(){n.state.statusbar===t&&(n.state.statusbar=null)}}};function ei(e){return e?[hn(),ne.of($r),G()]:[]}var ti={next:`Next match`,prev:`Previous match`,select:`Select all matches`,replace:`Replace`,replaceAll:`Replace all`,close:`Close`},ni={case:`Match case`,re:`Regular expression`,word:`Match whole word`};function ri(e){let t=e.querySelector(`.cm-search`);if(t){for(let[e,n]of Object.entries(ti)){let r=t.querySelector(`button[name="${e}"]`);r&&!r.title&&(r.title=n)}for(let[e,n]of Object.entries(ni)){let r=t.querySelector(`input[name="${e}"]`)?.parentElement;r&&!r.title&&(r.title=n)}}}var ii=new WeakMap;function ai(e,t){let n=dn(e.state);if(!n.valid)return ii.delete(e),0;let r=ii.get(e);if(!t&&r?.doc===e.state.doc&&r.query.eq(n))return r.total;let i=n.getCursor(e.state),a=0;for(let e=i.next();!e.done;e=i.next())a+=1;return ii.set(e,{query:n,doc:e.state.doc,total:a}),a}function oi(e){let t=dn(e.state);if(!t.valid)return 0;let n=e.state.selection.main,r=t.getCursor(e.state),i=0,a=0;for(let e=r.next();!e.done;e=r.next()){let t=e.value;if(i+=1,a===0&&(a=i),n.from===t.from&&n.to===t.to||n.from<t.to&&n.to>t.from||t.from>=n.head)return i}return a}function si(e,t,n=!1){let r=e.querySelector(`.cm-search`);if(!r)return;let i=r.querySelector(`.cm-search-message`);if(!i){i=document.createElement(`span`),i.className=`cm-search-message`,i.setAttribute(`aria-live`,`polite`);let e=r.querySelector(`button[name="next"]`),t=e?.parentNode===r?e:r.firstChild;r.insertBefore(i,t)}let a=ai(t,n),o=a===0?0:oi(t);i.textContent=a===0?``:`${o}/${a}`}var ci=new de,li=new de,ui=new de,di=new de,fi=new de,pi=new de,mi=new de,hi=e=>e,gi=ae,_i=ln,vi=pn,yi=class extends se{id;containerMap;constructor(e,t){super(),this.id=e,this.containerMap=t}toDOM(){let e=this.containerMap.get(this.id);return e||(e=document.createElement(`div`),e.className=`yuri-block-widget`,e.dataset.widgetId=this.id,this.containerMap.set(this.id,e)),e}eq(e){return e.id===this.id}destroy(){}},bi=(e,t)=>!e||e.length===0?[]:_e.define({create(n){let r=new fe,i=[...e].sort((e,t)=>e.afterLine-t.afterLine);for(let e of i){let i=n.doc.lines;if(e.afterLine>i)continue;let a=n.doc.line(e.afterLine);r.add(a.to,a.to,W.widget({widget:new yi(e.id,t),block:!0,side:1}))}return r.finish()},update(e,t){return e.map(t.changes)},provide:e=>K.decorations.from(e)}),xi=e=>{if(!e)return[];let t=Math.max(1,e.start),n=Math.max(t,e.end);return oe.fromClass(class{decorations;constructor(e){this.decorations=this.build(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=this.build(e.view))}build(e){let r=new fe;for(let i=t;i<=n&&i<=e.state.doc.lines;i+=1){let t=e.state.doc.line(i);r.add(t.from,t.from,W.line({class:`yuri-cm-selected-line`}))}return r.finish()}},{decorations:e=>e.decorations})};function Si({value:e,onChange:t,extensions:n,className:r,readOnly:i,lineNumbersConfig:a,highlightLines:o,onViewReady:s,onViewDestroy:c,blockWidgets:l,enableSearch:u,searchOpen:d,onSearchOpenChange:f,vimMode:p}){let m=$.useRef(null),h=$.useRef(null),g=$.useRef(e),_=$.useRef(t),v=$.useRef(s),y=$.useRef(c),b=$.useRef(f),x=$.useRef(l),S=$.useRef(p),C=$.useRef(new Map),[w,T]=$.useState([]),E=$.useCallback(e=>{let t=(e??[]).map(e=>{let t=C.current.get(e.id);return t?{id:e.id,content:e.content,container:t}:null}).filter(e=>e!==null);T(e=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.id===r.id&&e.content===r.content&&e.container===r.container})?e:t)},[]),D=$.useCallback(e=>{let t=m.current,n=e??h.current;if(!t||!n)return;let r=n.dom.querySelector(`.cm-gutters`),i=r instanceof HTMLElement?r.getBoundingClientRect().width:0;t.style.setProperty(`--yuri-editor-gutter-width`,`${i}px`)},[]);return $.useEffect(()=>{g.current=e},[e]),$.useEffect(()=>{_.current=t},[t]),$.useEffect(()=>{v.current=s,y.current=c},[s,c]),$.useEffect(()=>{b.current=f},[f]),$.useEffect(()=>{x.current=l,E(l)},[l,E]),$.useEffect(()=>{if(!m.current)return;let e=(()=>{if(typeof document>`u`)return null;let e=document.querySelector(`meta[name="csp-nonce"]`)?.getAttribute(`content`);if(e)return e;let t=window.__YURI_CSP_NONCE__;return typeof t==`string`&&t.length>0?t:null})(),t=ve.create({doc:g.current,extensions:[...e?[K.cspNonce.of(e)]:[],re({fixed:!0}),ci.of(ce(a)),sn(),U.of(` `),mi.of(ei(p)),le.of([on,...an,...cn]),K.updateListener.of(e=>{D(e.view),(e.viewportChanged||e.geometryChanged)&&E(x.current);let t=un(e.startState),n=un(e.state);t!==n&&b.current?.(n);let r=!dn(e.startState).eq(dn(e.state));if(n&&(t!==n||r||e.docChanged||e.selectionSet)&&si(e.view.dom,e.view,t!==n||r||e.docChanged),!e.docChanged)return;let i=e.state.doc.toString();g.current=i,_.current(i),E(x.current)}),li.of(K.editable.of(!i)),ui.of(n??[]),di.of(xi(o)),fi.of(bi(l,C.current)),pi.of(u?[fn({top:!0}),le.of(hi(mn))]:[])]});return h.current=new K({state:t,parent:m.current}),gi(h.current,h.current.state.doc.length,200),h.current.requestMeasure(),requestAnimationFrame(()=>{D(h.current),E(x.current)}),h.current&&v.current?.(h.current),()=>{y.current?.(),h.current?.destroy(),h.current=null,T([])}},[x,D,E]),$.useEffect(()=>{let e=h.current;e&&(e.dispatch({effects:[ci.reconfigure(ce(a)),li.reconfigure(K.editable.of(!i)),ui.reconfigure(n??[]),di.reconfigure(xi(o)),fi.reconfigure(bi(l,C.current)),pi.reconfigure(u?[fn({top:!0}),le.of(hi(mn))]:[])]}),gi(e,e.state.doc.length,200),e.requestMeasure(),requestAnimationFrame(()=>{D(e),E(x.current)}))},[n,o,a,i,l,u,D,E]),$.useEffect(()=>{let e=h.current;if(!e){S.current=p;return}S.current!==p&&(S.current=p,e.dispatch({effects:mi.reconfigure(ei(p))}))},[p]),$.useEffect(()=>{let e=h.current;!e||u===!1||(d?(_i(e),requestAnimationFrame(()=>{ri(e.dom),si(e.dom,e,!0)})):vi(e))},[d,u]),$.useEffect(()=>{let t=h.current;if(!t)return;let n=t.state.doc.toString();n!==e&&(t.dispatch({changes:{from:0,to:n.length,insert:e}}),gi(t,t.state.doc.length,300),t.requestMeasure(),requestAnimationFrame(()=>D(t)))},[e,D]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:m,className:Y(`h-full w-full`,`[&_.cm-editor]:h-full [&_.cm-editor]:w-full`,`[&_.cm-scroller]:font-mono [&_.cm-scroller]:text-[var(--text-code)] [&_.cm-scroller]:leading-6`,`[&_.cm-lineNumbers]:text-[var(--tools-edit-line-number)]`,r)}),w.map(e=>(0,Fr.createPortal)(e.content,e.container,e.id))]})}var Ci=pe.define(Ee),wi=Ce.data.of({commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}}});function Ti(e){let t=e.trim().toLowerCase();switch(t){case`bash`:case`sh`:case`zsh`:case`shell`:case`shellsession`:case`console`:return Ci;case`json`:case`jsonc`:case`json5`:return Se().language;case`js`:case`javascript`:return be().language;case`jsx`:return be({jsx:!0}).language;case`ts`:case`typescript`:return be({typescript:!0}).language;case`tsx`:return be({typescript:!0,jsx:!0}).language;case`html`:return xe().language;case`css`:return ye().language;case`py`:case`python`:return Te().language;case`md`:case`markdown`:case`mdown`:case`mkd`:return we().language;case`heex`:case`eex`:case`leex`:return xe().language;default:return ge.matchLanguageName(_n,t,!0)}}var Ei=e=>e.split(`/`).pop()?.toLowerCase()??``,Di=e=>{let t=Ei(e);return t?ge.matchFilename(_n,t):null},Oi=()=>q(ue.define([{tag:[J.heading1,J.heading2,J.heading3,J.heading4,J.heading5,J.heading6],fontWeight:`600`},{tag:J.strong,fontWeight:`600`},{tag:J.emphasis,fontStyle:`italic`},{tag:J.strikethrough,textDecoration:`line-through`},{tag:[J.link,J.url],color:`var(--markdown-link, currentColor)`,textDecoration:`underline`},{tag:J.monospace,color:`var(--markdown-inline-code, currentColor)`,backgroundColor:`var(--markdown-inline-code-bg, transparent)`},{tag:J.quote,color:`var(--markdown-blockquote, currentColor)`,fontStyle:`italic`},{tag:J.list,color:`color-mix(in srgb, var(--muted-foreground) 40%, var(--foreground) 60%)`},{tag:J.heading,color:`var(--markdown-heading1, currentColor)`}]));function ki(e){let t=e.toLowerCase();switch(Ei(t)){case`makefile`:case`gnumakefile`:return Ci}let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1):``;switch(r){case`ts`:case`tsx`:case`mts`:case`cts`:return be({typescript:!0,jsx:r===`tsx`});case`js`:case`jsx`:case`mjs`:case`cjs`:return be({typescript:!1,jsx:r===`jsx`});case`jsonc`:case`json5`:return[Se(),wi];case`json`:case`jsonl`:case`ndjson`:case`geojson`:return Se();case`css`:case`scss`:case`sass`:case`less`:return ye();case`html`:case`htm`:case`xml`:case`drawio`:case`dio`:return xe();case`md`:case`mdx`:case`markdown`:case`mdown`:case`mkd`:return[we({codeLanguages:Ti}),Oi()];case`sh`:case`bash`:case`zsh`:case`fish`:case`env`:return Ci;case`py`:case`pyw`:case`pyi`:return Te();default:return null}}async function Ai(e){let t=Di(e);if(!t)return null;if(t.support)return t.support;try{return await t.load()}catch{return null}}function ji(e,t){let n=e.metadata.variant===`dark`,r=e.config?.fonts?.mono||`monospace`,i=e.colors.syntax.highlights||{},a=e.colors.syntax.tokens||{},o=t?.fontSize?`${t.fontSize}px`:`var(--text-code)`,s=K.theme({"&":{backgroundColor:`var(--background)`,color:e.colors.syntax.base.foreground,fontSize:o,lineHeight:`1.5`,position:`relative`},".cm-scroller":{fontFamily:r,backgroundColor:`var(--background)`},".cm-comment":{color:e.colors.syntax.base.comment},".cm-keyword":{color:e.colors.syntax.base.keyword},".cm-string":{color:e.colors.syntax.base.string},".cm-string-2":{color:a.stringEscape||e.colors.syntax.base.string},".cm-number":{color:e.colors.syntax.base.number},".cm-operator":{color:e.colors.syntax.base.operator},".cm-punctuation":{color:a.punctuation||e.colors.syntax.base.comment},".cm-atom":{color:a.boolean||e.colors.syntax.base.number},".cm-builtin":{color:a.functionCall||e.colors.syntax.base.function},".cm-def":{color:a.variableGlobal||e.colors.syntax.base.variable},".cm-attribute":{color:a.variableOther||a.variableProperty||e.colors.syntax.base.operator},".cm-meta":{color:e.colors.syntax.base.comment},".cm-property":{color:a.variableProperty||e.colors.syntax.base.keyword},".cm-variable":{color:e.colors.syntax.base.variable},".cm-variable-2":{color:a.variableOther||e.colors.syntax.base.function},".cm-variable-3":{color:a.variableGlobal||e.colors.syntax.base.type},".cm-tag":{color:a.tag||e.colors.syntax.base.keyword},".cm-link":{color:a.url||e.colors.syntax.base.keyword,textDecoration:`underline`},".cm-content":{caretColor:e.colors.interactive.cursor},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.colors.interactive.cursor},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:e.colors.interactive.selection},".cm-gutters":{backgroundColor:`var(--background)`,color:i.lineNumber||e.colors.syntax.base.comment,borderRight:`1px solid ${e.colors.interactive.border}`,position:`sticky`,paddingRight:`8px`,left:0,zIndex:2,boxShadow:`0 0 0 var(--background)`},".cm-gutter":{backgroundColor:`var(--background)`},".cm-gutterElement":{backgroundColor:`var(--background)`},".cm-lineNumbers":{backgroundColor:`var(--background)`},".cm-lineNumbers .cm-gutterElement":{paddingLeft:`8px`,paddingRight:`8px`,minWidth:`42px`},".cm-activeLineGutter":{color:i.lineNumberActive||e.colors.syntax.base.foreground},".cm-activeLine":{backgroundColor:e.colors.surface.overlay},".cm-panels":{backgroundColor:`transparent`,color:e.colors.surface.foreground,position:`absolute`,top:`0`,right:`0`,left:`auto`,width:`auto`,zIndex:10,pointerEvents:`none`},".cm-panels-top":{borderBottom:`none`,position:`absolute`,top:`6px`,right:`14px`,left:`auto`,width:`auto`},".cm-panels-bottom":{position:`static`,width:`100%`,pointerEvents:`auto`},".cm-panels-bottom .cm-vim-panel":{borderTop:`1px solid ${e.colors.interactive.border}`,backgroundColor:e.colors.surface.elevated,color:e.colors.surface.mutedForeground,fontFamily:`var(--font-mono)`,fontSize:`12px`,minHeight:`22px`,padding:`2px 8px`},".cm-panel.cm-search":{pointerEvents:`auto`,padding:`4px`,backgroundColor:`color-mix(in srgb, ${e.colors.surface.elevated} 85%, transparent)`,border:`1px solid ${e.colors.interactive.border}`,borderRadius:`10px`,boxShadow:`0 2px 8px color-mix(in srgb, ${e.colors.surface.background} 60%, transparent)`,width:`auto`,minWidth:`360px`,maxWidth:`480px`},".cm-search":{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`0`,width:`100%`,color:e.colors.surface.foreground,fontFamily:`inherit`,fontSize:`13px`,lineHeight:`1`},".cm-search br":{display:`none`},".cm-search .cm-textfield":{appearance:`none`,height:`26px`,margin:0,padding:`0 8px`,borderRadius:`6px !important`,border:`1px solid ${e.colors.interactive.border}`,backgroundColor:e.colors.surface.background,color:e.colors.surface.foreground,fontFamily:`inherit`,fontSize:`12px`,lineHeight:`1`,outline:`none`,transition:`border-color 150ms ease`},".cm-search .cm-textfield::placeholder":{color:e.colors.surface.mutedForeground,opacity:1},".cm-search .cm-textfield:focus":{borderColor:e.colors.primary.base},'.cm-search .cm-textfield[name="search"]':{order:1,flex:`1 1 120px`,maxWidth:`calc(100% - 142px)`,minWidth:`100px`},".cm-search label":{order:2,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`26px`,height:`26px`,minWidth:`26px`,flexShrink:`0`,margin:0,marginLeft:`1px`,padding:0,borderRadius:`4px`,border:`1px solid transparent`,backgroundColor:`transparent`,color:`transparent`,cursor:`pointer`,userSelect:`none`,fontSize:`1px`,lineHeight:`0`,overflow:`hidden`,position:`relative`,transition:`background-color 120ms ease, border-color 120ms ease`},".cm-search label:hover":{backgroundColor:e.colors.interactive.hover},'.cm-search label:has(input[type="checkbox"]:checked)':{backgroundColor:e.colors.interactive.hover,borderColor:e.colors.interactive.border},'.cm-search [type="checkbox"]':{appearance:`none`,WebkitAppearance:`none`,width:`0`,height:`0`,margin:`0`,padding:`0`,border:`none`,position:`absolute`,opacity:`0`,pointerEvents:`none`},".cm-search label::after":{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,fontSize:`13px`,fontWeight:`600`,lineHeight:`1`,fontFamily:`inherit`,color:e.colors.surface.mutedForeground,pointerEvents:`none`},".cm-search label:hover::after":{color:e.colors.surface.foreground},'.cm-search label:has(input[type="checkbox"]:checked)::after':{color:e.colors.surface.foreground},'.cm-search label:has(input[name="case"])::after':{content:`"Aa"`,fontSize:`12px`,letterSpacing:`-0.5px`},'.cm-search label:has(input[name="re"])::after':{content:`".*"`,fontSize:`13px`,fontFamily:`monospace`},'.cm-search label:has(input[name="word"])::after':{content:`"ab"`,fontSize:`12px`,textDecoration:`underline`,textUnderlineOffset:`2px`},".cm-search .cm-search-message":{order:3,color:e.colors.surface.mutedForeground,backgroundColor:`transparent`,border:`none`,borderRadius:`0`,padding:`0 6px`,fontSize:`11px`,whiteSpace:`nowrap`,lineHeight:`26px`},".cm-search .cm-button":{appearance:`none`,WebkitAppearance:`none`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`26px`,height:`26px`,minWidth:`26px`,flexShrink:`0`,margin:0,marginLeft:`1px`,padding:0,borderRadius:`4px`,border:`none`,backgroundColor:`transparent`,backgroundImage:`none`,color:`transparent`,cursor:`pointer`,fontSize:`1px`,fontWeight:`400`,lineHeight:`0`,overflow:`hidden`,position:`relative`,boxShadow:`none`,transition:`background-color 120ms ease`},".cm-search .cm-button::after":{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,fontSize:`15px`,lineHeight:`1`,color:e.colors.surface.mutedForeground,pointerEvents:`none`},".cm-search .cm-button:hover":{backgroundColor:e.colors.interactive.hover},".cm-search .cm-button:hover::after":{color:e.colors.surface.foreground},".cm-search .cm-button:active":{backgroundColor:e.colors.interactive.active},".cm-search .cm-button:focus-visible":{outline:`none`,boxShadow:`0 0 0 1px ${e.colors.interactive.focusRing}`},".cm-search .cm-button:disabled":{opacity:.4,cursor:`default`,pointerEvents:`none`},'.cm-search .cm-button[name="prev"]':{order:21,marginTop:`2px`},'.cm-search .cm-button[name="prev"]::after':{content:`"↑"`},'.cm-search .cm-button[name="next"]':{order:22,marginTop:`2px`},'.cm-search .cm-button[name="next"]::after':{content:`"↓"`},'.cm-search .cm-button[name="select"]':{order:23,marginTop:`2px`},'.cm-search .cm-button[name="select"]::after':{content:`"≡"`,fontSize:`17px`},'.cm-panel.cm-search button[name="close"]':{order:5,appearance:`none`,WebkitAppearance:`none`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`26px`,height:`26px`,minWidth:`26px`,flexShrink:`0`,margin:`0 0 0 auto`,padding:`0`,borderRadius:`4px`,border:`none`,backgroundColor:`transparent`,backgroundImage:`none`,color:e.colors.surface.mutedForeground,cursor:`pointer`,fontSize:`16px`,lineHeight:`1`,boxShadow:`none`,position:`relative`,overflow:`visible`,transition:`background-color 120ms ease, color 120ms ease`},'.cm-panel.cm-search button[name="close"]:hover':{backgroundColor:e.colors.interactive.hover,color:e.colors.surface.foreground},'.cm-search .cm-button[name="replace"]':{order:24,marginTop:`2px`},'.cm-search .cm-button[name="replace"]::after':{content:`"⇄"`},'.cm-search .cm-button[name="replaceAll"], .cm-search .cm-button[name="replace-all"]':{order:25,marginTop:`2px`},'.cm-search .cm-button[name="replaceAll"]::after, .cm-search .cm-button[name="replace-all"]::after':{content:`"⇉"`},'.cm-search .cm-textfield[name="replace"]':{order:20,flex:`1 1 100%`,maxWidth:`calc(100% - 142px)`,minWidth:`80px`,marginTop:`2px`},".cm-searchMatch":{backgroundColor:e.colors.status.infoBackground,boxShadow:`inset 0 0 0 1px ${e.colors.status.infoBorder}`,borderRadius:`2px`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:e.colors.interactive.selection,color:e.colors.interactive.selectionForeground,boxShadow:`inset 0 0 0 1px ${e.colors.interactive.borderFocus}`},"&.cm-focused":{outline:`none`}},{dark:n}),c=ue.define([{tag:[J.comment,J.docComment,J.meta,J.documentMeta],class:`cm-comment`},{tag:[J.keyword,J.controlKeyword,J.moduleKeyword,J.definitionKeyword,J.modifier],class:`cm-keyword`},{tag:[J.operatorKeyword,J.operator,J.derefOperator,J.updateOperator,J.definitionOperator,J.typeOperator,J.controlOperator,J.logicOperator,J.bitwiseOperator,J.arithmeticOperator,J.compareOperator],class:`cm-operator`},{tag:[J.punctuation,J.separator,J.bracket,J.paren,J.brace,J.squareBracket,J.angleBracket],class:`cm-punctuation`},{tag:[J.string,J.regexp,J.attributeValue,J.special(J.string),J.monospace],class:`cm-string`},{tag:J.escape,class:`cm-string-2`},{tag:[J.number,J.bool,J.atom,J.null,J.self],class:`cm-number`},{tag:[J.function(J.variableName),J.function(J.definition(J.variableName)),J.function(J.propertyName),J.standard(J.variableName),J.special(J.variableName)],class:`cm-builtin`},{tag:J.definition(J.variableName),class:`cm-def`},{tag:[J.variableName,J.local(J.variableName),J.constant(J.variableName),J.literal],class:`cm-variable`},{tag:J.propertyName,class:`cm-property`},{tag:J.attributeName,class:`cm-attribute`},{tag:[J.className,J.typeName,J.namespace],class:`cm-variable-3`},{tag:[J.tagName,J.labelName,J.annotation,J.macroName],class:`cm-tag`},{tag:J.link,class:`cm-link`},{tag:[J.heading,J.heading1,J.heading2,J.heading3,J.heading4,J.heading5,J.heading6],class:`cm-keyword`}]),l=ue.define([{tag:[J.comment,J.docComment,J.meta,J.documentMeta],color:e.colors.syntax.base.comment},{tag:[J.keyword,J.controlKeyword,J.moduleKeyword,J.definitionKeyword,J.modifier],color:e.colors.syntax.base.keyword},{tag:[J.operatorKeyword,J.operator,J.derefOperator,J.updateOperator,J.definitionOperator,J.typeOperator,J.controlOperator,J.logicOperator,J.bitwiseOperator,J.arithmeticOperator,J.compareOperator],color:e.colors.syntax.base.operator},{tag:[J.string,J.regexp,J.attributeValue,J.special(J.string),J.monospace],color:e.colors.syntax.base.string},{tag:J.escape,color:a.stringEscape||e.colors.syntax.base.string},{tag:[J.number,J.bool,J.atom,J.null,J.self],color:e.colors.syntax.base.number},{tag:[J.function(J.variableName),J.function(J.definition(J.variableName)),J.function(J.propertyName),J.standard(J.variableName),J.special(J.variableName)],color:e.colors.syntax.base.function},{tag:J.definition(J.variableName),color:a.variableGlobal||e.colors.syntax.base.variable},{tag:[J.variableName,J.local(J.variableName),J.constant(J.variableName),J.literal],color:e.colors.syntax.base.variable},{tag:J.propertyName,color:a.variableProperty||e.colors.syntax.base.variable},{tag:J.attributeName,color:a.variableOther||e.colors.syntax.base.variable},{tag:[J.className,J.typeName,J.namespace],color:e.colors.syntax.base.type},{tag:[J.tagName,J.labelName,J.annotation,J.macroName],color:a.tag||e.colors.syntax.base.keyword},{tag:J.link,color:a.url||e.colors.syntax.base.function,textDecoration:`underline`},{tag:[J.punctuation,J.separator,J.bracket,J.paren,J.brace,J.squareBracket,J.angleBracket],color:a.punctuation||e.colors.syntax.base.comment}]);return t?.syntaxColors===!1?[s]:[s,q(he,{fallback:!0}),q(ie),q(c),q(l)]}var Mi=180,Ni=me.define(),Pi=1,Fi=2,Ii=4,Li=new Map,Ri=(e,t)=>{let n=`${e}|${t}`,r=Li.get(n);if(r)return r;let i=``;e&&(i+=`color:${e};`),t&Pi&&(i+=`font-style:italic;`),t&Fi&&(i+=`font-weight:bold;`),t&Ii&&(i+=`text-decoration:underline;`);let a=W.mark({attributes:{style:i}});return Li.set(n,a),a},zi=(e,t)=>{let n=new fe,r=e.state.doc,i=Math.min(t.length,r.lines);for(let e=0;e<i;e+=1){let i=t[e];if(!i||i.length===0)continue;let a=r.line(e+1),o=a.from;for(let[e,t,r]of i){if(e<=0)continue;let i=o,s=Math.min(o+e,a.to);o+=e,!(s<=i)&&(!t&&!r||n.add(i,s,Ri(t,r)))}}return n.finish()},Bi=_e.define({create(){return W.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(Ni)&&(n=e.value);return n},provide:e=>K.decorations.from(e)}),Vi=e=>oe.fromClass(class{timer;generation=0;abortController;constructor(e){this.tokenize(e)}update(e){e.docChanged&&this.schedule(e.view)}schedule(e){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.tokenize(e)},Mi)}async tokenize(t){let n=++this.generation;this.abortController?.abort();let r=new AbortController;this.abortController=r;let i=t.state.doc.toString(),a=await Zt(i,e.language,e.themeName,e.theme,{signal:r.signal,priority:`visible`});a&&(r.signal.aborted||n===this.generation&&t.state.doc.length===i.length&&t.dispatch({effects:Ni.of(zi(t,a))}))}destroy(){this.timer&&clearTimeout(this.timer),this.abortController?.abort(),this.abortController=void 0}}),Hi=e=>[Bi,Vi(e)],Ui=e=>{let t=(0,Z.c)(11),{currentMode:n,onToggle:r}=e,i=n===`preview`,a=i?`Switch to edit mode`:`Switch to preview mode`,o=i?`Edit`:`Preview`,s;t[0]===i?s=t[1]:(s=i?(0,Q.jsx)(X,{name:`eye`,className:`size-4`,"aria-hidden":`true`}):(0,Q.jsx)(X,{name:`eye-off`,className:`size-4`,"aria-hidden":`true`}),t[0]=i,t[1]=s);let c;t[2]!==a||t[3]!==r||t[4]!==s?(c=(0,Q.jsx)(bt,{asChild:!0,children:(0,Q.jsx)(Me,{variant:`ghost`,size:`sm`,onClick:r,"aria-label":a,className:`h-5 w-5 p-0`,children:s})}),t[2]=a,t[3]=r,t[4]=s,t[5]=c):c=t[5];let l;t[6]===o?l=t[7]:(l=(0,Q.jsx)(xt,{sideOffset:8,children:o}),t[6]=o,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,Q.jsxs)(St,{children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u},Wi=_()(y(v((e,t)=>({selectedProfileId:null,defaultGitIdentityId:null,profiles:[],globalIdentity:null,discoveredCredentials:[],isLoading:!1,setSelectedProfile:t=>{e({selectedProfileId:t})},loadProfiles:async()=>{e({isLoading:!0});let n=t().profiles;try{return e({profiles:await nt(),isLoading:!1}),!0}catch(t){return console.error(`Failed to load git identity profiles:`,t),e({profiles:n,isLoading:!1}),!1}},loadGlobalIdentity:async()=>{try{let t=await rt();return t&&t.userName&&t.userEmail?e({globalIdentity:{id:`global`,name:`Global Identity`,userName:t.userName,userEmail:t.userEmail,authType:t.sshCommand?`ssh`:void 0,sshKey:t.sshCommand?t.sshCommand.replace(`ssh -i `,``):null,color:`info`,icon:`house`}}):e({globalIdentity:null}),!0}catch(t){return console.error(`Failed to load global git identity:`,t),e({globalIdentity:null}),!1}},loadDiscoveredCredentials:async()=>{try{return e({discoveredCredentials:await st()}),!0}catch(t){return console.error(`Failed to discover git credentials:`,t),e({discoveredCredentials:[]}),!1}},loadDefaultGitIdentityId:async()=>{let t=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null};try{let n=null;if(n===null){let e=g()?.settings;if(e)try{n=t(((await e.load())?.settings||{}).defaultGitIdentityId)}catch{}}if(n===null)try{let e=await a(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});e.ok&&(n=t((await e.json().catch(()=>null))?.defaultGitIdentityId))}catch{}return e({defaultGitIdentityId:n}),!0}catch(e){return console.error(`Failed to load default git identity setting:`,e),!1}},setDefaultGitIdentityId:async t=>{try{let n=typeof t==`string`?t.trim():``,r=n.length>0?n:``;return await j({defaultGitIdentityId:r}),e({defaultGitIdentityId:r.length>0?r:null}),!0}catch(e){return console.error(`Failed to save default git identity setting:`,e),!1}},createProfile:async e=>{try{let n={...e,id:e.id||`profile-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,color:e.color||`keyword`,icon:e.icon||`branch`};return await ot(n),await t().loadProfiles(),!0}catch(e){return console.error(`Failed to create git identity profile:`,e),!1}},updateProfile:async(e,n)=>{try{let r=t().profiles.find(t=>t.id===e);if(!r)throw Error(`Profile not found`);let i={...r,...n};return await tt(e,i),await t().loadProfiles(),!0}catch(e){return console.error(`Failed to update git identity profile:`,e),!1}},deleteProfile:async n=>{try{return await it(n),t().selectedProfileId===n&&e({selectedProfileId:null}),await t().loadProfiles(),!0}catch(e){return console.error(`Failed to delete git identity profile:`,e),!1}},getProfileById:e=>{let{profiles:n,globalIdentity:r}=t();return e===`global`?r||void 0:n.find(t=>t.id===e)},getUnimportedCredentials:()=>{let{profiles:e,discoveredCredentials:n}=t();return n.filter(t=>!e.some(e=>e.authType===`token`&&e.host===t.host))}}),{name:`git-identities-store`,storage:D(),partialize:e=>({selectedProfileId:e.selectedProfileId})}),{name:`git-identities-store`}));typeof window<`u`&&(window.__zustand_git_identities_store__=Wi);var Gi=`w-full max-w-[30rem]`,Ki=e=>{let t=(0,Z.c)(23),{title:n,description:r,settingsItem:i,titleAccessory:a,headerAction:o,children:s,className:c,contentClassName:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`span`,{className:`truncate`,children:n}),t[0]=n,t[1]=u);let d;t[2]!==u||t[3]!==a?(d=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[u,a]}),t[2]=u,t[3]=a,t[4]=d):d=t[4];let f;t[5]===o?f=t[6]:(f=o?(0,Q.jsx)(`div`,{className:`shrink-0`,children:o}):null,t[5]=o,t[6]=f);let p;t[7]!==d||t[8]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]===l?m=t[11]:(m=Y(`yuri-settings-group-row`,l),t[10]=l,t[11]=m);let h;t[12]!==s||t[13]!==m?(h=(0,Q.jsx)(`div`,{className:m,children:s}),t[12]=s,t[13]=m,t[14]=h):h=t[14];let g;t[15]!==r||t[16]!==p||t[17]!==h?(g=(0,Q.jsx)(Lr,{className:`yuri-settings-detail-group`,label:p,description:r,children:h}),t[15]=r,t[16]=p,t[17]=h,t[18]=g):g=t[18];let _;return t[19]!==c||t[20]!==i||t[21]!==g?(_=(0,Q.jsx)(`div`,{"data-settings-item":i,className:c,children:g}),t[19]=c,t[20]=i,t[21]=g,t[22]=_):_=t[22],_},qi=450,Ji=({projectRef:e=null})=>{let{t}=Ae(),{isMobile:n,isTablet:r}=Gt(),i=n||r,a=Re(e=>e.getActiveProject()),o=e?.path??a?.path??null,s=Ie(e=>e.getWorktreeMetadata),c=qe(),l=C(e=>e.homeDirectory),[u,d]=$.useState([]),[f,p]=$.useState(!1),[m,h]=$.useState(!1),[g,_]=$.useState(null),[v,y]=$.useState(null),[b,x]=$.useState([]),[S,w]=$.useState(!1),T=$.useRef(!1),E=$.useMemo(()=>e?.id&&e?.path?{id:e.id,path:e.path}:!a?.id||!o?null:{id:a.id,path:o},[a?.id,o,e?.id,e?.path]),D=$.useCallback(async()=>{if(!(!E||v===!1))try{let e=await ft(E);x(e)}catch{}},[E,v]);$.useEffect(()=>{if(!o)return;let e=!1;return y(null),(async()=>{try{let t=await at(o);if(e)return;y(t)}catch{}})(),()=>{e=!0}},[o]),$.useEffect(()=>{if(!E){x([]),w(!1);return}if(v===!1){x([]),w(!1);return}let e=!1;return w(!0),x([]),(async()=>{try{let t=await ft(E);if(e)return;x(t)}catch{}finally{e||w(!1)}})(),()=>{e=!0}},[E,v]),$.useEffect(()=>{if(!E)return;let e=!1;return h(!0),(async()=>{try{let[t,n]=await Promise.all([He(E),We(E)]);if(!e){let e=t.length>0?t:[``];d(e),_(JSON.stringify(e)),p(n)}}catch{e||(d([``]),_(JSON.stringify([``])),p(!1))}finally{e||h(!1)}})(),()=>{e=!0}},[E]);let O=$.useCallback(async e=>{if(!E)return!1;let n=e.filter(e=>e.trim().length>0);try{return await Ue(E,n)?(_(JSON.stringify(e)),!0):(Pe.error(t(`settings.yuri.worktrees.setup.toast.saveFailed`)),!1)}catch{return Pe.error(t(`settings.yuri.worktrees.setup.toast.saveFailed`)),!1}},[E,t]),k=$.useMemo(()=>g!==null&&g!==JSON.stringify(u),[g,u]);$.useEffect(()=>{if(!k||m||T.current)return;let e=window.setTimeout(()=>{T.current||(T.current=!0,(async()=>{try{await O(u)}finally{T.current=!1}})())},qi);return()=>{window.clearTimeout(e)}},[k,m,O,u]);let A=$.useCallback((e,t)=>{d(n=>{let r=[...n];return r[e]=t,r})},[]),j=$.useCallback(()=>{d(e=>[...e,``])},[]),M=$.useCallback(e=>{d(t=>{let n=t.filter((t,n)=>n!==e);return n.length>0?n:[``]})},[]),N=$.useCallback(()=>{!k||T.current||(T.current=!0,(async()=>{try{await O(u)}finally{T.current=!1}})())},[k,O,u]),P=$.useCallback(e=>{p(e),E&&Ke(E,e)},[E]),F=$.useCallback(e=>{let t=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),n=t(e.path),r=c.filter(e=>{let r=s(e.id);if(r?.path&&t(r.path)===n)return!0;let i=e.directory;return!!(i&&t(i)===n)}),i=new Set(r.map(e=>e.id)),a=[...Ne.getState().activeSessions,...Ne.getState().archivedSessions],o=e=>{let t=a.filter(t=>{let n=t.parentID;return n&&e.has(n)});if(t.length===0)return[];let n=new Set(t.map(e=>e.id));return[...t,...o(n)]},l=o(i),u=new Set,d=[...r,...l].filter(e=>!u.has(e.id)&&(u.add(e.id),!0));Fe.requestDelete({sessions:d,mode:`worktree`,worktree:e})},[c,s]),I=$.useMemo(()=>c.map(e=>e.id).join(`,`),[c]);$.useEffect(()=>{v&&o&&D()},[I,v,o,D]);let L=(0,Q.jsxs)(St,{children:[(0,Q.jsx)(bt,{asChild:!0,children:(0,Q.jsx)(X,{name:`information`,className:`h-3.5 w-3.5 text-muted-foreground/60 cursor-help`})}),(0,Q.jsxs)(xt,{sideOffset:8,className:`max-w-xs`,children:[t(`settings.yuri.worktrees.setup.tooltipPrefix`),` `,(0,Q.jsx)(`code`,{className:`font-mono text-xs bg-sidebar-accent/50 px-1 rounded`,children:`$ROOT_PROJECT_PATH`}),` `,t(`settings.yuri.worktrees.setup.tooltipSuffix`)]})]}),R=(0,Q.jsxs)(St,{children:[(0,Q.jsx)(bt,{asChild:!0,children:(0,Q.jsx)(X,{name:`information`,className:`h-3.5 w-3.5 text-muted-foreground/60 cursor-help`})}),(0,Q.jsx)(xt,{sideOffset:8,className:`max-w-xs`,children:t(`settings.yuri.worktrees.list.tooltip`)})]});return o?v===!1?(0,Q.jsx)(Ki,{title:t(`settings.projects.page.section.worktree`),settingsItem:`projects.worktree`,children:(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.yuri.worktrees.state.gitOnly`)})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ki,{title:t(`settings.projects.page.section.worktree`),settingsItem:`projects.worktree`,titleAccessory:L,children:m?(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.yuri.worktrees.setup.loading`)}):(0,Q.jsxs)(`div`,{className:Y(`flex flex-col gap-2`,Gi),children:[u.map((e,n)=>(0,Q.jsxs)(`div`,{className:`yuri-settings-group-row flex w-full items-center gap-2`,children:[(0,Q.jsx)(yt,{value:e,onChange:e=>A(n,e.target.value),onBlur:N,placeholder:t(`settings.yuri.worktrees.setup.commandPlaceholder`),className:`min-w-0 flex-1 font-mono text-xs`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>M(n),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,"aria-label":t(`settings.yuri.worktrees.setup.removeCommandAria`),children:(0,Q.jsx)(X,{name:`close`,className:`h-4 w-4`})})]},n)),(0,Q.jsxs)(Me,{type:`button`,variant:`ghost`,size:`xs`,className:`!font-normal`,onClick:j,children:[(0,Q.jsx)(X,{name:`add`,className:`h-3.5 w-3.5`}),t(`settings.yuri.worktrees.setup.addCommand`)]}),(0,Q.jsxs)(`label`,{"data-settings-item":`projects.worktree.setup.wait`,className:`flex cursor-pointer items-center gap-2 py-1`,children:[(0,Q.jsx)(ct,{checked:f,onChange:P,ariaLabel:t(`settings.yuri.worktrees.setup.waitForCommandsAria`)}),(0,Q.jsx)(`span`,{className:Y(`typography-ui-label font-normal`,f?`text-foreground`:`text-foreground/60`),children:t(`settings.yuri.worktrees.setup.waitForCommands`)})]})]})}),(0,Q.jsx)(Ki,{title:t(`settings.yuri.worktrees.list.title`),titleAccessory:R,children:S?(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.yuri.worktrees.list.loading`)}):b.length===0?(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground/70`,children:t(`settings.yuri.worktrees.list.empty`)}):(0,Q.jsx)(`div`,{className:Y(`space-y-1`,Gi),children:b.map(e=>(0,Q.jsxs)(`div`,{className:`group flex w-full items-center gap-2 py-1.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`typography-meta min-w-0 truncate text-foreground`,children:e.label||e.branch||t(`settings.yuri.worktrees.list.detachedHead`)}),(0,Q.jsx)(`span`,{className:`typography-micro flex-shrink-0 self-center rounded bg-sidebar-accent/40 px-1.5 py-[1px] leading-none text-muted-foreground/60`,children:`OpenCode`})]}),(0,Q.jsx)(`p`,{className:`typography-micro truncate text-muted-foreground/60`,children:Oe(e.path,l)})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:Y(`flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground/50 transition-opacity hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,i?`opacity-100`:`opacity-0 group-hover:opacity-100`),"aria-label":t(`settings.yuri.worktrees.list.deleteWorktreeAria`,{name:e.branch||e.label||e.path}),children:(0,Q.jsx)(X,{name:`delete-bin`,className:`h-4 w-4`})})]},e.path))})})]}):(0,Q.jsx)(Ki,{title:t(`settings.projects.page.section.worktree`),settingsItem:`projects.worktree`,children:(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.yuri.worktrees.state.selectProject`)})})},Yi=(e,t)=>t.updatedAtMs-e.updatedAtMs,Xi=_((e,t)=>({instances:[],statusesById:{},importCandidates:[],isLoading:!1,isSaving:!1,isImportsLoading:!1,initialized:!1,listenerReady:!1,error:null,load:async()=>{if(!t().isLoading){e({isLoading:!0,error:null});try{let[n,r]=await Promise.all([Dt(),jt()]),i={};for(let e of r.sort(Yi))i[e.id]=e;t().listenerReady||await Vt(t=>{e(e=>({statusesById:{...e.statusesById,[t.id]:t}}))}),e({instances:n.instances,statusesById:i,isLoading:!1,initialized:!0,listenerReady:!0})}catch(t){e({isLoading:!1,error:t instanceof Error?t.message:String(t)})}}},loadImports:async()=>{if(!t().isImportsLoading){e({isImportsLoading:!0,error:null});try{e({importCandidates:await Bt(),isImportsLoading:!1})}catch(t){e({isImportsLoading:!1,error:t instanceof Error?t.message:String(t)})}}},refreshStatuses:async()=>{try{let t=await jt(),n={};for(let e of t.sort(Yi))n[e.id]=e;e({statusesById:n})}catch(t){e({error:t instanceof Error?t.message:String(t)})}},setInstances:async n=>{e({isSaving:!0,error:null});try{await Ft({instances:n}),e({instances:n,isSaving:!1}),await t().refreshStatuses()}catch(t){throw e({isSaving:!1,error:t instanceof Error?t.message:String(t)}),t}},upsertInstance:async e=>{let n=t().instances,r=n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[e,...n];await t().setInstances(r)},createFromCommand:async(e,n,r)=>{let i=Pt(e,n);r&&r.trim()&&(i.nickname=r.trim()),await t().upsertInstance(i)},removeInstance:async n=>{await Ot(n).catch(()=>void 0);let r=t().instances.filter(e=>e.id!==n);await t().setInstances(r),e(e=>{let t={...e.statusesById};return delete t[n],{statusesById:t}})},connect:async n=>{e({error:null});try{await Tt(n),await t().refreshStatuses()}catch(t){throw e({error:t instanceof Error?t.message:String(t)}),t}},disconnect:async n=>{e({error:null});try{await Ot(n),await t().refreshStatuses()}catch(t){throw e({error:t instanceof Error?t.message:String(t)}),t}},retry:async e=>{await t().connect(e)},getStatus:e=>t().statusesById[e]||null,clearError:()=>e({error:null})})),Zi=450,Qi=()=>k(),$i=()=>({id:Qi(),name:``,command:``,icon:`play`}),ea=({projectRef:e})=>{let{t}=Ae(),n=$.useMemo(()=>u(),[]),r=Xi(e=>e.instances),i=Xi(e=>e.load),[a,o]=$.useState([]),[s,c]=$.useState(!1),[l,d]=$.useState(null),[f,p]=$.useState({}),m=$.useRef(!1),h=$.useRef(null);$.useEffect(()=>{n&&i().catch(()=>void 0)},[n,i]),$.useEffect(()=>{let t=!1;return c(!0),(async()=>{try{let n=await Le(e);if(t)return;o(n.actions),d(JSON.stringify({actions:n.actions}))}catch{if(t)return;o([]),d(JSON.stringify({actions:[]}))}finally{t||c(!1)}})(),()=>{t=!0}},[e]);let g=$.useMemo(()=>n?vn(r):[],[r,n]),_=$.useMemo(()=>a.some(e=>e.name.trim().length===0||e.command.trim().length===0)?t(`settings.projects.actions.validation.fillNameAndCommand`):null,[a,t]),v=$.useMemo(()=>l!==null&&l!==JSON.stringify({actions:a}),[a,l]),y=$.useCallback(async n=>await Be(e,{actions:n,primaryActionId:null})?(d(JSON.stringify({actions:n})),typeof window<`u`&&window.dispatchEvent(new CustomEvent(xn,{detail:{projectId:e.id}})),!0):(Pe.error(t(`settings.projects.actions.toast.saveFailed`)),!1),[e,t]);$.useEffect(()=>{if(!v||s||_||m.current)return;let e=window.setTimeout(()=>{m.current||(m.current=!0,(async()=>{try{await y(a)}finally{m.current=!1}})())},Zi);return()=>{window.clearTimeout(e)}},[a,v,s,y,_]),$.useEffect(()=>{if(!v||!_||s){_||(h.current=null);return}let e=window.setTimeout(()=>{h.current!==_&&(h.current=_,Pe.error(_))},1e3);return()=>{window.clearTimeout(e)}},[v,s,_]);let b=$.useCallback(()=>{let e=$i();o(t=>[...t,e]),p(t=>({...t,[e.id]:!0}))},[]),x=$.useCallback(e=>{o(t=>t.filter(t=>t.id!==e)),p(t=>{let n={...t};return delete n[e],n})},[]),S=$.useCallback((e,t)=>{o(n=>n.map(n=>n.id===e?t(n):n))},[]);return(0,Q.jsxs)(Ki,{title:t(`settings.projects.actions.title`),description:t(`settings.projects.actions.description`),settingsItem:`projects.actions`,headerAction:(0,Q.jsxs)(Me,{type:`button`,variant:`outline`,size:`xs`,className:`!font-normal`,onClick:b,children:[(0,Q.jsx)(X,{name:`add`,className:`h-3.5 w-3.5`}),t(`settings.projects.actions.actions.add`)]}),contentClassName:`space-y-0`,children:[s?(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.projects.actions.state.loading`)}):a.length===0?(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.projects.actions.state.empty`)}):(0,Q.jsx)(`div`,{className:Y(`space-y-0`,Gi),children:a.map(e=>{let r=e.icon||`play`,i=bn[r]||`play`,a=f[e.id]??!1,o=e.name.trim()||t(`settings.projects.actions.state.untitled`);return(0,Q.jsxs)(rn,{open:a,onOpenChange:t=>{p(n=>({...n,[e.id]:t}))},className:`py-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsxs)(nn,{className:`group flex-1 justify-start gap-2 rounded-md px-0 pr-1 py-1 hover:bg-[var(--interactive-hover)] focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,children:[a?(0,Q.jsx)(X,{name:`arrow-down-s`,className:`h-4 w-4 text-muted-foreground`}):(0,Q.jsx)(X,{name:`arrow-right-s`,className:`h-4 w-4 text-muted-foreground`}),(0,Q.jsx)(X,{name:i,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(`span`,{className:`typography-ui-label text-foreground truncate`,children:o})})]}),(0,Q.jsx)(Me,{type:`button`,variant:`ghost`,size:`xs`,className:`!font-normal h-7 w-7 px-0 text-muted-foreground hover:text-[var(--status-error)]`,onClick:()=>x(e.id),children:(0,Q.jsx)(X,{name:`delete-bin`,className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(tn,{className:`pt-1.5`,children:(0,Q.jsxs)(`div`,{className:`space-y-2 pb-4 pl-3 pr-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,Q.jsxs)(Ht,{children:[(0,Q.jsx)(Ut,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-[var(--interactive-border)] text-foreground hover:bg-[var(--interactive-hover)]`,"aria-label":t(`settings.projects.actions.field.selectIconAria`),children:(0,Q.jsx)(X,{name:i,className:`h-4 w-4`})})}),(0,Q.jsx)(Lt,{align:`start`,className:`w-56 p-2`,children:(0,Q.jsx)(`div`,{className:`grid grid-cols-6 gap-1`,children:yn.map(n=>{let r=n.Icon,i=(e.icon||`play`)===n.key;return(0,Q.jsx)(`button`,{type:`button`,onClick:()=>S(e.id,e=>({...e,icon:n.key})),className:Y(`inline-flex h-8 w-8 items-center justify-center rounded-md border border-transparent text-foreground hover:bg-[var(--interactive-hover)]`,i&&`border-[var(--primary-base)] bg-[var(--primary-base)]/10 text-[var(--primary-base)]`),"aria-label":t(`settings.projects.actions.field.iconAria`,{icon:n.label}),children:(0,Q.jsx)(X,{name:r,className:`h-4 w-4`})},n.key)})})})]}),(0,Q.jsx)(yt,{value:e.name,onChange:t=>S(e.id,e=>({...e,name:t.target.value})),placeholder:t(`settings.projects.actions.field.actionNamePlaceholder`),className:`h-7 flex-1 min-w-0`})]}),(0,Q.jsxs)(`div`,{className:`py-1`,children:[(0,Q.jsx)(`p`,{className:`typography-meta mb-0.5 text-muted-foreground`,children:t(`settings.projects.actions.field.command`)}),(0,Q.jsx)(Yt,{embedded:!0,value:e.command,onChange:t=>S(e.id,e=>({...e,command:t.target.value})),placeholder:t(`settings.projects.actions.field.commandPlaceholder`),className:`min-h-[88px] w-full font-mono text-xs`})]}),(0,Q.jsxs)(`div`,{className:`py-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:t(`settings.projects.actions.field.autoOpenUrl`)}),(0,Q.jsxs)(`div`,{className:`group flex cursor-pointer items-center gap-2`,role:`button`,tabIndex:0,"aria-pressed":e.autoOpenUrl===!0,onClick:()=>S(e.id,e=>({...e,...e.autoOpenUrl===!0?{autoOpenUrl:void 0}:{autoOpenUrl:!0}})),onKeyDown:t=>{(t.key===` `||t.key===`Enter`)&&(t.preventDefault(),S(e.id,e=>({...e,...e.autoOpenUrl===!0?{autoOpenUrl:void 0}:{autoOpenUrl:!0}})))},children:[(0,Q.jsx)(ct,{checked:e.autoOpenUrl===!0,onChange:t=>S(e.id,e=>({...e,...t?{autoOpenUrl:!0}:{autoOpenUrl:void 0}})),ariaLabel:t(`settings.projects.actions.field.autoOpenUrlForAria`,{title:o})}),(0,Q.jsx)(`span`,{className:`typography-ui-label font-normal text-foreground/80`,children:t(`settings.projects.actions.field.autoOpenUrlDescription`)})]})]}),e.autoOpenUrl===!0?(0,Q.jsxs)(`div`,{className:`mt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(yt,{value:e.openUrl||``,onChange:t=>S(e.id,e=>({...e,openUrl:t.target.value})),placeholder:t(`settings.projects.actions.field.overrideUrlPlaceholder`),className:`h-7 w-full max-w-[24rem]`}),(0,Q.jsxs)(St,{children:[(0,Q.jsx)(bt,{asChild:!0,children:(0,Q.jsx)(X,{name:`information`,className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60 cursor-help`})}),(0,Q.jsx)(xt,{sideOffset:8,className:`max-w-xs`,children:t(`settings.projects.actions.field.overrideUrlTooltip`)})]})]}),n?(0,Q.jsxs)(`div`,{className:`mt-2`,children:[(0,Q.jsx)(`p`,{className:`typography-meta mb-0.5 text-muted-foreground`,children:t(`settings.projects.actions.field.desktopSshForward`)}),g.length>0?(0,Q.jsxs)(mt,{value:e.desktopOpenSshForward&&g.some(t=>t.id===e.desktopOpenSshForward)?e.desktopOpenSshForward:`__none__`,onValueChange:t=>{S(e.id,e=>({...e,...t===`__none__`?{desktopOpenSshForward:void 0}:{desktopOpenSshForward:t}}))},children:[(0,Q.jsx)(dt,{className:`h-7 w-full`,children:(0,Q.jsx)(vt,{placeholder:t(`settings.projects.actions.field.useOutputManualUrl`)})}),(0,Q.jsxs)(pt,{children:[(0,Q.jsx)(lt,{value:`__none__`,children:t(`settings.projects.actions.field.useOutputManualUrl`)}),g.map(e=>(0,Q.jsx)(lt,{value:e.id,children:e.label},e.id))]})]}):(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.projects.actions.state.noDesktopSshForwards`)})]}):null]}):null]})]})})]},e.id)})}),_&&a.length>0?(0,Q.jsx)(`p`,{className:`typography-meta text-[var(--status-warning)]`,children:_}):null]})},ta=e=>{let t=(0,Z.c)(123),{form:n}=e,{t:r}=Ae(),{currentTheme:i}=Ye(),{name:a,setName:o,icon:s,setIcon:c,color:l,setColor:u,iconBackground:d,setIconBackground:f,parsedDefaultModel:p,handleDefaultModelChange:m,isUploadingIcon:h,isRemovingCustomIcon:g,isDiscoveringIcon:_,pendingRemoveImageIcon:v,setPendingRemoveImageIcon:y,pendingUploadIconPreviewUrl:b,setPreviewImageFailed:x,hasPendingUploadImageIcon:S,hasCustomIcon:C,effectiveHasImageIcon:w,hasRemovableImageIcon:T,showImagePreview:E,fileInputRef:D,handleUploadIcon:O,handleRemoveImageIcon:k,handleDiscoverIcon:A,currentIconImage:j,project:M}=n;if(!M)return null;let N=l?ht[l]??null:null,P;t[0]===r?P=t[1]:(P=r(`settings.projects.page.field.projectName`),t[0]=r,t[1]=P);let F;t[2]===o?F=t[3]:(F=e=>o(e.target.value),t[2]=o,t[3]=F);let I;t[4]===r?I=t[5]:(I=r(`settings.projects.page.field.projectNamePlaceholder`),t[4]=r,t[5]=I);let L;t[6]!==a||t[7]!==F||t[8]!==I?(L=(0,Q.jsx)(yt,{value:a,onChange:F,placeholder:I}),t[6]=a,t[7]=F,t[8]=I,t[9]=L):L=t[9];let R;t[10]!==P||t[11]!==L?(R=(0,Q.jsx)(Rr,{label:P,itemId:`projects.name`,children:L}),t[10]=P,t[11]=L,t[12]=R):R=t[12];let z;t[13]===r?z=t[14]:(z=r(`settings.projects.page.field.defaultModel`),t[13]=r,t[14]=z);let ee;t[15]===r?ee=t[16]:(ee=r(`settings.projects.page.field.defaultModelDescription`),t[15]=r,t[16]=ee);let te;t[17]!==m||t[18]!==p.modelId||t[19]!==p.providerId?(te=(0,Q.jsx)(Et,{providerId:p.providerId,modelId:p.modelId,onChange:m,className:`yuri-settings-inline-value`}),t[17]=m,t[18]=p.modelId,t[19]=p.providerId,t[20]=te):te=t[20];let B;t[21]!==z||t[22]!==ee||t[23]!==te?(B=(0,Q.jsx)(Rr,{label:z,description:ee,descriptionPlacement:`outside`,itemId:`projects.default-model`,children:te}),t[21]=z,t[22]=ee,t[23]=te,t[24]=B):B=t[24];let V;t[25]===r?V=t[26]:(V=r(`settings.projects.page.field.accentColor`),t[25]=r,t[26]=V);let H;t[27]===u?H=t[28]:(H=()=>u(null),t[27]=u,t[28]=H);let ne=l===null?`border-2 border-foreground bg-[var(--primary-base)]/10`:`border-border/40 hover:border-border hover:bg-[var(--surface-muted)]`,U;t[29]===ne?U=t[30]:(U=Y(`h-7 w-7 rounded-md border transition-colors flex items-center justify-center`,ne),t[29]=ne,t[30]=U);let W;t[31]===r?W=t[32]:(W=r(`settings.projects.page.field.none`),t[31]=r,t[32]=W);let G;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(X,{name:`close`,className:`h-4 w-4 text-muted-foreground`}),t[33]=G):G=t[33];let K;t[34]!==H||t[35]!==U||t[36]!==W?(K=(0,Q.jsx)(`button`,{type:`button`,onClick:H,className:U,title:W,children:G}),t[34]=H,t[35]=U,t[36]=W,t[37]=K):K=t[37];let re;t[38]!==l||t[39]!==u?(re=_t.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>u(e.key),className:Y(`h-7 w-7 rounded-md border transition-colors`,l===e.key?`border-2 border-foreground ring-1 ring-[var(--primary-base)]/40`:`border-transparent hover:border-border/70`),style:{backgroundColor:e.cssVar},title:e.label},e.key)),t[38]=l,t[39]=u,t[40]=re):re=t[40];let ie;t[41]!==K||t[42]!==re?(ie=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[K,re]}),t[41]=K,t[42]=re,t[43]=ie):ie=t[43];let q;t[44]!==V||t[45]!==ie?(q=(0,Q.jsx)(Rr,{label:V,itemId:`projects.accent-color`,children:ie}),t[44]=V,t[45]=ie,t[46]=q):q=t[46];let ae;t[47]===r?ae=t[48]:(ae=r(`settings.projects.page.field.projectIcon`),t[47]=r,t[48]=ae);let oe;t[49]===O?oe=t[50]:(oe=e=>{let t=e.target.files?.[0]??null;O(t),e.currentTarget.value=``},t[49]=O,t[50]=oe);let se;t[51]!==D||t[52]!==oe?(se=(0,Q.jsx)(`input`,{ref:D,type:`file`,accept:`image/png,image/jpeg,image/svg+xml,.png,.jpg,.jpeg,.svg`,className:`hidden`,onChange:oe}),t[51]=D,t[52]=oe,t[53]=se):se=t[53];let ce;t[54]===c?ce=t[55]:(ce=()=>c(null),t[54]=c,t[55]=ce);let le=s===null?`border-2 border-foreground bg-[var(--primary-base)]/10`:`border-border/40 hover:border-border hover:bg-[var(--surface-muted)]`,ue;t[56]===le?ue=t[57]:(ue=Y(`h-7 w-7 rounded-md border transition-colors flex items-center justify-center`,le),t[56]=le,t[57]=ue);let de;t[58]===r?de=t[59]:(de=r(`settings.projects.page.field.none`),t[58]=r,t[59]=de);let fe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Q.jsx)(X,{name:`close`,className:`h-4 w-4 text-muted-foreground`}),t[60]=fe):fe=t[60];let pe;t[61]!==ce||t[62]!==ue||t[63]!==de?(pe=(0,Q.jsx)(`button`,{type:`button`,onClick:ce,className:ue,title:de,children:fe}),t[61]=ce,t[62]=ue,t[63]=de,t[64]=pe):pe=t[64];let me;t[65]!==N||t[66]!==s||t[67]!==c?(me=gt.map(e=>{let t=e.Icon;return(0,Q.jsx)(`button`,{type:`button`,onClick:()=>c(e.key),className:Y(`h-7 w-7 rounded-md border transition-colors flex items-center justify-center`,s===e.key?`border-2 border-foreground bg-[var(--primary-base)]/10`:`border-transparent hover:border-border hover:bg-[var(--surface-muted)]`),title:e.label,children:(0,Q.jsx)(X,{name:t,className:`w-4 h-4`,style:N&&s===e.key?{color:N}:void 0})},e.key)}),t[65]=N,t[66]=s,t[67]=c,t[68]=me):me=t[68];let he;t[69]!==pe||t[70]!==me?(he=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[pe,me]}),t[69]=pe,t[70]=me,t[71]=he):he=t[71];let ge;t[72]!==j||t[73]!==i||t[74]!==w||t[75]!==S||t[76]!==d||t[77]!==b||t[78]!==M||t[79]!==x||t[80]!==E||t[81]!==r?(ge=w&&E&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:r(`settings.projects.page.field.preview`)}),(0,Q.jsx)(`span`,{className:`inline-flex h-7 w-7 items-center justify-center rounded-md border border-border/60 bg-[var(--surface-elevated)] p-1`,children:(0,Q.jsx)(`span`,{className:`inline-flex h-4 w-4 items-center justify-center overflow-hidden rounded-[2px]`,style:d?{backgroundColor:d}:void 0,children:S&&b?(0,Q.jsx)(`img`,{src:b,alt:``,className:`h-full w-full object-contain`,draggable:!1,onError:()=>x(!0)}):(0,Q.jsx)(ut,{project:{...M,iconImage:j??M.iconImage},options:{themeVariant:i.metadata.variant,iconColor:i.colors.surface.foreground},className:`h-full w-full object-contain`,onError:()=>x(!0)})})})]}),t[72]=j,t[73]=i,t[74]=w,t[75]=S,t[76]=d,t[77]=b,t[78]=M,t[79]=x,t[80]=E,t[81]=r,t[82]=ge):ge=t[82];let _e;t[83]!==w||t[84]!==d||t[85]!==f||t[86]!==r?(_e=w&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsx)(`input`,{type:`color`,value:d??`#000000`,onChange:e=>f(e.target.value),className:`h-7 w-9 cursor-pointer rounded border border-border bg-transparent p-1`,"aria-label":r(`settings.projects.page.field.projectIconBackgroundAria`)}),(0,Q.jsx)(yt,{value:d??``,onChange:e=>f(e.target.value),placeholder:`#000000`,className:`h-7 w-[8rem]`}),(0,Q.jsx)(Me,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>f(null),className:`h-7 w-7 p-0`,"aria-label":r(`settings.projects.page.field.clearIconBackgroundAria`),title:r(`settings.projects.page.field.clearBackground`),disabled:!d,children:(0,Q.jsx)(X,{name:`close`,className:`h-3.5 w-3.5`})})]}),t[83]=w,t[84]=d,t[85]=f,t[86]=r,t[87]=_e):_e=t[87];let ve;t[88]!==D||t[89]!==A||t[90]!==C||t[91]!==_||t[92]!==h||t[93]!==r?(ve=!C&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Me,{size:`xs`,className:`h-6 !font-normal`,onClick:()=>D.current?.click(),disabled:h,children:r(h?`settings.projects.page.actions.uploading`:`settings.projects.page.actions.uploadIcon`)}),(0,Q.jsx)(Me,{size:`xs`,className:`h-6 !font-normal`,variant:`outline`,onClick:()=>void A(),disabled:_,children:r(_?`settings.projects.page.actions.discovering`:`settings.projects.page.actions.discoverFavicon`)})]}),t[88]=D,t[89]=A,t[90]=C,t[91]=_,t[92]=h,t[93]=r,t[94]=ve):ve=t[94];let J;t[95]!==k||t[96]!==T||t[97]!==g||t[98]!==r?(J=T&&(0,Q.jsx)(Me,{size:`xs`,className:`!font-normal`,variant:`outline`,onClick:()=>void k(),disabled:g,children:r(g?`settings.projects.page.actions.removing`:`settings.projects.page.actions.removeProjectIcon`)}),t[95]=k,t[96]=T,t[97]=g,t[98]=r,t[99]=J):J=t[99];let ye;t[100]!==g||t[101]!==v||t[102]!==y||t[103]!==r?(ye=v&&(0,Q.jsx)(Me,{size:`xs`,className:`!font-normal`,variant:`outline`,onClick:()=>y(!1),disabled:g,children:r(`settings.projects.page.actions.undoRemove`)}),t[100]=g,t[101]=v,t[102]=y,t[103]=r,t[104]=ye):ye=t[104];let be;t[105]!==ve||t[106]!==J||t[107]!==ye?(be=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[ve,J,ye]}),t[105]=ve,t[106]=J,t[107]=ye,t[108]=be):be=t[108];let xe;t[109]!==se||t[110]!==he||t[111]!==ge||t[112]!==_e||t[113]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex w-full flex-col items-end gap-2`,children:[se,he,ge,_e,be]}),t[109]=se,t[110]=he,t[111]=ge,t[112]=_e,t[113]=be,t[114]=xe):xe=t[114];let Se;t[115]!==ae||t[116]!==xe?(Se=(0,Q.jsx)(Rr,{label:ae,itemId:`projects.icon`,children:xe}),t[115]=ae,t[116]=xe,t[117]=Se):Se=t[117];let Ce;return t[118]!==q||t[119]!==Se||t[120]!==R||t[121]!==B?(Ce=(0,Q.jsxs)(`div`,{className:`yuri-settings-section-stack`,children:[R,B,q,Se]}),t[118]=q,t[119]=Se,t[120]=R,t[121]=B,t[122]=Ce):Ce=t[122],Ce},na=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/,ra=e=>{if(!e)return null;let t=e.trim();return t&&na.test(t)?t.toLowerCase():null},ia=e=>{let{t}=Ae(),n=Re(e=>e.uploadProjectIcon),r=Re(e=>e.removeProjectIcon),i=Re(e=>e.discoverProjectIcon),a=Re(t=>e?t.projects.find(t=>t.id===e.id)?.iconImage??null:null),[o,s]=$.useState(``),[c,l]=$.useState(null),[u,d]=$.useState(null),[f,p]=$.useState(null),[m,h]=$.useState(void 0),[g,_]=$.useState(!1),[v,y]=$.useState(!1),[b,x]=$.useState(!1),[S,C]=$.useState(!1),[w,T]=$.useState(null),[E,D]=$.useState(null),[O,k]=$.useState(!1),A=$.useRef(null),j=$.useCallback(()=>{T(null),D(e=>(e&&URL.revokeObjectURL(e),null))},[]),M=e?.id??null;$.useEffect(()=>{if(!e){s(``),l(null),d(null),p(null),h(void 0);return}s(e.label??``),l(e.icon??null),d(e.color??null),p(e.iconBackground??null),h(e.defaultModel),C(!1),j(),k(!1)},[e,j]),$.useEffect(()=>()=>{j()},[j]);let N=$.useMemo(()=>Ge(m)??{providerId:``,modelId:``},[m]),P=!!e?.iconImage,F=!!(w&&E),I=e?.iconImage?.source===`custom`,L=P&&!S||F,R=L,z=!!(e&&P&&!S),ee=!O&&(F||z),te=!!e&&(o.trim()!==(e?.label??``).trim()||c!==(e?.icon??null)||u!==(e?.color??null)||f!==(e?.iconBackground??null)||(m??void 0)!==(e?.defaultModel??void 0)||S||!!w),B=$.useCallback((e,t)=>{h(e&&t?`${e}/${t}`:void 0)},[]),V=$.useCallback(t=>{!e||!t||g||(C(!1),k(!1),T(t),D(e=>(e&&URL.revokeObjectURL(e),URL.createObjectURL(t))))},[g,e]),H=$.useCallback(()=>{!e||!R||v||(F&&j(),C(!!P),k(!1))},[j,F,R,P,v,e]),ne=$.useCallback(async()=>{if(!(!e||b)){j(),C(!1),k(!1),x(!0);try{let n=await i(e.id);if(!n.ok){Pe.error(n.error||t(`settings.projects.page.toast.discoverIconFailed`));return}if(n.skipped){Pe.success(t(`settings.projects.page.toast.customIconAlreadySet`));return}Pe.success(t(`settings.projects.page.toast.iconDiscovered`))}finally{x(!1)}}},[j,i,b,e,t]),U=$.useCallback(async i=>{let a=i?.silent===!0;if(!e)return null;let s=o.trim();if(!s)return null;if(w){_(!0);let r=await n(e.id,w);if(_(!1),!r.ok)return Pe.error(r.error||t(`settings.projects.page.toast.uploadIconFailed`)),null;a||Pe.success(t(`settings.projects.page.toast.iconUpdated`)),j(),C(!1)}let l=S&&!!e.iconImage;if(l){y(!0);let n=await r(e.id);if(y(!1),!n.ok)return Pe.error(n.error||t(`settings.projects.page.toast.removeIconFailed`)),null;a||Pe.success(t(`settings.projects.page.toast.iconRemoved`)),C(!1),p(null)}return{label:s,icon:c,color:u,iconBackground:ra(l?null:f),defaultModel:m??null}},[j,u,m,c,f,o,S,w,e,r,t,n]);return $.useEffect(()=>{k(!1)},[M,a?.updatedAt]),{name:o,setName:s,icon:c,setIcon:l,color:u,setColor:d,iconBackground:f,setIconBackground:p,defaultModel:m,parsedDefaultModel:N,handleDefaultModelChange:B,isUploadingIcon:g,isRemovingCustomIcon:v,isDiscoveringIcon:b,pendingRemoveImageIcon:S,setPendingRemoveImageIcon:C,pendingUploadIconFile:w,pendingUploadIconPreviewUrl:E,previewImageFailed:O,setPreviewImageFailed:k,hasStoredImageIcon:P,hasPendingUploadImageIcon:F,hasCustomIcon:I,effectiveHasImageIcon:L,hasRemovableImageIcon:R,showStoredImagePreview:z,showImagePreview:ee,fileInputRef:A,clearPendingUploadIcon:j,handleUploadIcon:V,handleRemoveImageIcon:H,handleDiscoverIcon:ne,hasChanges:te,prepareSaveData:U,currentIconImage:a,project:e}},aa=450,oa=(e,t)=>{let{t:n}=Ae(),{hasChanges:r,name:i,icon:a,color:o,iconBackground:s,defaultModel:c,pendingRemoveImageIcon:l,pendingUploadIconFile:u,isUploadingIcon:d,isRemovingCustomIcon:f,prepareSaveData:p}=e,m=$.useRef(!1);$.useEffect(()=>{if(!r||!i.trim()||d||f||m.current)return;let e=window.setTimeout(()=>{m.current||(m.current=!0,(async()=>{try{let e=await p({silent:!0});if(e)try{await t(e)}catch{Pe.error(n(`settings.projects.page.toast.saveFailed`))}}finally{m.current=!1}})())},aa);return()=>{window.clearTimeout(e)}},[o,c,r,a,s,f,d,i,t,l,u,p,n])},sa=e=>{let t=(0,Z.c)(25),{project:n,onIdentitySave:r}=e,{t:i}=Ae(),a=ia(n),o;bb0:{if(!n){o=null;break bb0}let e;t[0]!==n.id||t[1]!==n.path?(e={id:n.id,path:n.path},t[0]=n.id,t[1]=n.path,t[2]=e):e=t[2],o=e}let s=o,c;if(t[3]===r?c=t[4]:(c=async e=>{await r(e)},t[3]=r,t[4]=c),oa(a,c),!n||!s)return null;let l;t[5]!==n.path||t[6]!==i?(l=n.path.split(/[\\/]/).filter(Boolean).at(-1)??i(`settings.projects.page.title.default`),t[5]=n.path,t[6]=i,t[7]=l):l=t[7];let u=l,d;t[8]===u?d=t[9]:(d=(0,Q.jsx)(`h2`,{className:`typography-ui-header font-semibold text-foreground truncate`,children:u}),t[8]=u,t[9]=d);let f;t[10]===n.path?f=t[11]:(f=(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground truncate`,title:n.path,children:n.path}),t[10]=n.path,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`div`,{className:`px-1`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===a?m=t[16]:(m=(0,Q.jsx)(ta,{form:a}),t[15]=a,t[16]=m);let h,g;t[17]===s?(h=t[18],g=t[19]):(h=(0,Q.jsx)(ea,{projectRef:s}),g=(0,Q.jsx)(Ji,{projectRef:s}),t[17]=s,t[18]=h,t[19]=g);let _;return t[20]!==p||t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,Q.jsxs)(`div`,{className:`yuri-settings-section-stack`,children:[p,m,h,g]}),t[20]=p,t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24],_};function ca(e,t,n){return Math.min(n,Math.max(t,e))}function la(e){if(!Number.isFinite(e))return 0;let t=String(e);if(t.includes(`e-`)){let[,e]=t.split(`e-`);return Number(e)||0}let n=t.split(`.`);return n.length===2?n[1].length:0}function ua(e,t){let n=la(t);return n<=0?e:Number(e.toFixed(n))}var da=$.forwardRef(({value:e,onValueChange:t,min:n=-1/0,max:r=1/0,step:i=1,className:a,containerClassName:o,onBlur:s,disabled:c,fallbackValue:l,onClear:u,emptyLabel:d=`—`,...f},p)=>{let{t:m}=Ae(),[h,g]=$.useState(()=>e===void 0?``:String(e)),{isMobile:_}=Gt(),v=$.useRef(!1),y=$.useRef(null),b=$.useCallback(()=>{if(typeof document>`u`||typeof window>`u`)return;y.current?.();let e=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation?.(),y.current?.()},t=window.setTimeout(()=>{y.current?.()},700);y.current=()=>{window.clearTimeout(t),document.removeEventListener(`click`,e,!0),y.current=null},document.addEventListener(`click`,e,!0)},[]);$.useEffect(()=>()=>{y.current?.()},[]),$.useEffect(()=>{g(e===void 0?``:String(e))},[e]);let x=$.useMemo(()=>e===void 0?l===void 0?Number.isFinite(n)?n:0:l:e,[l,n,e]),S=$.useRef(x);$.useEffect(()=>{S.current=x},[x]);let C=$.useCallback(e=>{let a=ua(ca(e,n,r),i);S.current=a,t(a)},[r,n,t,i]),w=$.useCallback(e=>{let t=e.target.value;if(g(t),t.trim()===``){u?.();return}let n=Number(t);Number.isFinite(n)&&C(n)},[C,u]),T=$.useCallback(t=>{if(h.trim()===``){u||g(e===void 0?``:String(e)),s?.(t);return}let a=Number(h);if(!Number.isFinite(a))g(e===void 0?``:String(e));else{let t=ua(ca(a,n,r),i);t===e?S.current=t:C(a),g(String(t))}s?.(t)},[C,h,r,n,s,u,i,e]),E=!!(c||x>=r),D=!!(c||x<=n),O=()=>{D||C(S.current-i)},k=()=>{E||C(S.current+i)},A=e=>t=>{t.preventDefault(),t.stopPropagation(),v.current=!0,b(),e()},j=e=>t=>{if(v.current){v.current=!1,t.preventDefault(),t.stopPropagation();return}e()};return _?(0,Q.jsxs)(`div`,{"data-slot":`number-input`,className:Y(`flex h-9 shrink-0 items-stretch overflow-x-hidden overflow-y-hidden rounded-lg border border-border bg-transparent select-none overscroll-contain`,`[-webkit-user-select:none] [-webkit-touch-callout:none]`,`disabled:pointer-events-none disabled:opacity-50`,o),children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":m(`numberInput.actions.decreaseAria`),disabled:D,onTouchStart:A(O),onClick:j(O),className:Y(`grid h-full min-h-0 w-9 place-items-center overflow-x-hidden overflow-y-hidden border-r border-border p-0 leading-none touch-none`,`text-muted-foreground`,`disabled:pointer-events-none disabled:opacity-50`,!D&&`active:bg-interactive-hover`),children:(0,Q.jsx)(X,{name:`subtract`,className:`block h-4 w-4`})}),(0,Q.jsx)(`div`,{"data-slot":`number-input-value`,className:Y(`flex h-full min-w-0 w-14 items-center justify-center bg-transparent px-1.5`,`text-center text-[16px] leading-none text-foreground [font-variant-numeric:tabular-nums]`,a),"aria-live":`polite`,children:e===void 0?d:h}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":m(`numberInput.actions.increaseAria`),disabled:E,onTouchStart:A(k),onClick:j(k),className:Y(`grid h-full min-h-0 w-9 place-items-center overflow-x-hidden overflow-y-hidden border-l border-border p-0 leading-none touch-none`,`text-muted-foreground`,`disabled:pointer-events-none disabled:opacity-50`,!E&&`active:bg-interactive-hover`),children:(0,Q.jsx)(X,{name:`add`,className:`block h-4 w-4`})})]}):(0,Q.jsxs)(`div`,{"data-slot":`number-input`,className:Y(`flex h-7 shrink-0 items-stretch overflow-x-hidden overflow-y-hidden rounded-lg border border-border bg-transparent`,`disabled:pointer-events-none disabled:opacity-50`,o),children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":m(`numberInput.actions.decreaseAria`),disabled:D,onClick:()=>C(S.current-i),className:Y(`flex h-full w-7 items-center justify-center overflow-x-hidden overflow-y-hidden border-r border-border p-0 leading-none touch-manipulation`,`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`,`disabled:pointer-events-none disabled:opacity-50`),children:(0,Q.jsx)(X,{name:`subtract`,className:`block h-3.5 w-3.5`})}),(0,Q.jsx)(`input`,{...f,"data-slot":`number-input-value`,ref:p,type:`text`,inputMode:f.inputMode??`numeric`,value:h,onChange:w,onBlur:T,disabled:c,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,className:Y(`h-full min-w-0 w-14 bg-transparent px-1.5 text-center typography-ui-label leading-none text-foreground [font-variant-numeric:tabular-nums]`,`placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground`,`appearance-none outline-none [appearance:textfield] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,`disabled:pointer-events-none disabled:cursor-not-allowed`,a)}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":m(`numberInput.actions.increaseAria`),disabled:E,onClick:()=>C(S.current+i),className:Y(`flex h-full w-7 items-center justify-center overflow-x-hidden overflow-y-hidden border-l border-border p-0 leading-none touch-manipulation`,`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`,`disabled:pointer-events-none disabled:opacity-50`),children:(0,Q.jsx)(X,{name:`add`,className:`block h-3.5 w-3.5`})})]})});da.displayName=`NumberInput`;function fa(e){let t=e.indexOf(`/`);if(t!==-1){let n=e.substring(0,t);if(n===`gemini`||n===`antigravity`)return e.substring(t+1)}return e}var pa={google:[{id:`gemini-auth`,label:`Gemini`,matcher:e=>e.startsWith(`gemini/`),order:1},{id:`antigravity-auth`,label:`Antigravity`,matcher:e=>e.startsWith(`antigravity/`),order:2}]};function ma(e,t){let n=pa[t]??[];for(let t of n)if(t.matcher(e))return t;return null}function ha(e){return pa[e]??[]}function ga(e){return[...e].sort((e,t)=>e.order-t.order)}function _a(e,t){let n=new Map;for(let r of Object.keys(e)){let e=ma(r,t)?.id??null;n.has(e)||n.set(e,[]),n.get(e).push(r)}return n}function va(e,t,n){let r=new Map;for(let i of e){let e=ma(t(i),n)?.id??null;r.has(e)||r.set(e,[]),r.get(e).push(i)}return r}function ya(e,t){return t.filter(e=>{let t=e.toLowerCase(),n=t.includes(`/`)?t.split(`/`)[1]:t;return!!(n.startsWith(`gemini-3-`)||n.startsWith(`claude-`))})}var ba=(e,t=``,n=!1)=>F({queryKey:R.scoped(`magpie-quotas`,e,t,n),staleTime:0,retry:!1,queryFn:async({signal:t})=>{let r=await a(`/api/quota/magpie`,{signal:t,query:{...e?{directory:e}:{},...n?{refresh:`1`}:{}}});if(!r.ok)throw Error(`Unable to discover Magpie quota sources`);let i=await r.json();if(!i||!Array.isArray(i.sources)||!i.sources.every(e=>e&&typeof e.id==`string`&&typeof e.name==`string`&&Array.isArray(e.results)&&e.results.every(t=>z(t)&&t.source===`magpie`&&t.sourceId===e.id&&t.providerId.startsWith(`magpie:${e.id}:`))))throw Error(`Invalid Magpie quota response`);return i}}),xa=6e4,Sa=0,Ca=0,wa,Ta=0,Ea=0,Da=0,Oa=new Map,ka=e=>{let t=Sn.map(e=>e.id),n=typeof e?.usageAutoRefresh==`boolean`&&e.usageAutoRefresh,r=typeof e?.usageRefreshIntervalMs==`number`&&Number.isFinite(e.usageRefreshIntervalMs)?Math.max(3e4,Math.min(3e5,Math.round(e.usageRefreshIntervalMs))):xa,i=e?.usageDisplayMode===`remaining`?`remaining`:`usage`,a=typeof e?.usageShowPredValues==`boolean`&&e.usageShowPredValues,o=Array.isArray(e?.usageDropdownProviders)?e?.usageDropdownProviders:null,s=o?o.filter(e=>typeof e==`string`&&(e.startsWith(`magpie:`)||t.includes(e))):t,c={},l=e?.usageSelectedModels;if(l&&typeof l==`object`)for(let[e,t]of Object.entries(l))Array.isArray(t)&&(c[e]=t.filter(e=>typeof e==`string`));let u={},d=e?.usageExpandedFamilies;if(d&&typeof d==`object`)for(let[e,t]of Object.entries(d))Array.isArray(t)&&(u[e]=t.filter(e=>typeof e==`string`));return{magpieUsageUrl:typeof e?.magpieUsageUrl==`string`?e.magpieUsageUrl:``,magpieHiddenProviders:Array.isArray(e?.magpieHiddenProviders)?e.magpieHiddenProviders.filter(e=>typeof e==`string`&&e.startsWith(`magpie:`)):[],autoRefresh:n,refreshIntervalMs:r,displayMode:i,showPredValues:a,dropdownProviderIds:s,selectedModels:c,expandedFamilies:u}},Aa=async()=>{let e=g()?.settings;if(e)try{let t=(await e.load())?.settings;return ka(t??null)}catch{}if(!o()){let e=await a(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(e.ok)return ka(await e.json().catch(()=>null))}return{magpieUsageUrl:``,magpieHiddenProviders:[],autoRefresh:!1,refreshIntervalMs:xa,displayMode:`usage`,showPredValues:!1,dropdownProviderIds:Sn.map(e=>e.id),selectedModels:{},expandedFamilies:{}}},ja=(e,t,n)=>{let r=e.filter(e=>e?.providerId&&e.providerId!==t);return z(n)&&r.push(n),r},Ma=async(e,t)=>{let n=Ca;Oa.set(e,(Oa.get(e)??0)+1),t(t=>({isFetchingProvider:{...t.isFetchingProvider,[e]:!0}}));try{let r=await L.fetchQuery({queryKey:R.quota(e),queryFn:({signal:t})=>ee(e,t),staleTime:0,retry:!1});if(n!==Ca)return{providerId:e,stale:!0};if(!z(r))throw Error(`Invalid quota response`);return t(t=>({results:ja(t.results,e,r)})),{providerId:e,result:r}}catch(r){return n===Ca?(t(e=>e.results.every(e=>e?.providerId)?{}:{results:e.results.filter(e=>e?.providerId)}),{providerId:e,error:r instanceof Error?r.message:`Failed to fetch quota`}):{providerId:e,stale:!0}}finally{if(n===Ca){let n=(Oa.get(e)??1)-1;n>0?Oa.set(e,n):Oa.delete(e),t(t=>({isFetchingProvider:{...t.isFetchingProvider,[e]:n>0}}))}}},Na=()=>{wa=void 0,Ta+=1,Ca+=1,Sa+=1,Oa.clear(),Pa.setState({magpieUsageUrl:``,magpieHiddenProviders:[],magpieSources:[],magpieError:null,results:[],isLoading:!1,isFetchingProvider:{},lastUpdated:null,error:null})},Pa=_()(y((e,t)=>({magpieSources:[],magpieError:null,magpieHiddenProviders:[],magpieUsageUrl:``,results:[],selectedProviderId:null,isLoading:!1,isFetchingProvider:{},lastUpdated:null,error:null,autoRefresh:!1,refreshIntervalMs:xa,displayMode:`usage`,showPredValues:!1,dropdownProviderIds:Sn.map(e=>e.id),selectedModels:{},expandedFamilies:{},loadSettings:async()=>{let t=Ca;try{let n=await Aa();if(t!==Ca)return;e(e=>({...n,dropdownProviderIds:[...n.dropdownProviderIds.filter(e=>!e.startsWith(`magpie:`)),...e.results.filter(e=>e.source===`magpie`&&!n.magpieHiddenProviders.includes(e.providerId)).map(e=>e.providerId)]}))}catch(e){console.warn(`Failed to load usage settings:`,e)}},fetchAllQuotas:async()=>{let n=++Sa;e({isLoading:!0,error:null});let r=Sn.map(e=>e.id),[i]=await Promise.all([Promise.all(r.map(t=>Ma(t,e))),t().fetchMagpieQuotas(!0)]);if(n===Sa){let t=i.find(e=>`error`in e);e({isLoading:!1,...i.some(e=>`result`in e)?{lastUpdated:Date.now()}:{},error:t?.error??null})}},fetchProviderQuota:async n=>{if(n.startsWith(`magpie:`))return t().fetchMagpieQuotas(!0);let r=await Ma(n,e);`stale`in r||e({error:`error`in r?r.error:null})},fetchMagpieQuotas:async(n=!1)=>{let r=Ca,i=C.getState().currentDirectory,a=t().magpieUsageUrl,o=JSON.stringify([i,a]);wa!==o&&(wa=o,Ta+=1,e(e=>({results:e.results.filter(e=>e?.source!==`magpie`),magpieSources:[],magpieError:null})));let s=Ta,c=++Ea;try{let{sources:o,incomplete:l}=await L.fetchQuery(ba(i,a,n));if(r!==Ca||s!==Ta||c<Da||i!==C.getState().currentDirectory||a!==t().magpieUsageUrl)return;Da=c,e(e=>{let t=new Map(o.filter(e=>e.error&&!e.clearPrevious&&e.results.length===0).map(e=>[e.id,e.error]));if(l){let n=new Set(o.map(e=>e.id));for(let r of e.results)r.sourceId&&!n.has(r.sourceId)&&t.set(r.sourceId,`Magpie discovery is incomplete`)}let n=e.results.filter(e=>e?.providerId&&(e.source!==`magpie`||t.has(e.sourceId??``))).map(e=>e.source===`magpie`&&t.has(e.sourceId??``)?{...e,ok:!1,error:t.get(e.sourceId??``)}:e);n.push(...o.flatMap(e=>e.results));let r=n.filter(e=>e.source===`magpie`).map(e=>e.providerId);return{results:n,magpieSources:o,magpieError:null,dropdownProviderIds:[...e.dropdownProviderIds.filter(e=>!e.startsWith(`magpie:`)),...r.filter(t=>!e.magpieHiddenProviders.includes(t))]}})}catch(n){if(r!==Ca||s!==Ta||c<Da||i!==C.getState().currentDirectory||a!==t().magpieUsageUrl)return;Da=c,e({magpieError:n instanceof Error?n.message:`Unable to read Magpie quotas`})}},setSelectedProvider:t=>e({selectedProviderId:t}),setAutoRefresh:t=>e({autoRefresh:t}),setRefreshInterval:t=>{e({refreshIntervalMs:Math.max(3e4,Math.min(3e5,Math.round(t)))})},setDisplayMode:t=>e({displayMode:t}),setShowPredValues:t=>e({showPredValues:t}),setDropdownProviderIds:n=>{let r=t().results.filter(e=>e.source===`magpie`),i=new Set(r.map(e=>e.providerId));e({dropdownProviderIds:n,magpieHiddenProviders:[...t().magpieHiddenProviders.filter(e=>!i.has(e)),...r.filter(e=>!n.includes(e.providerId)).map(e=>e.providerId)]})},setSelectedModels:(t,n)=>{e(e=>({selectedModels:{...e.selectedModels,[t]:n}}))},toggleModelSelected:(t,n)=>{e(e=>{let r=e.selectedModels[t]??[],i=r.includes(n)?r.filter(e=>e!==n):[...r,n];return{selectedModels:{...e.selectedModels,[t]:i}}})},setExpandedFamilies:(n,r)=>{e(e=>({expandedFamilies:{...e.expandedFamilies,[n]:r}})),j({usageExpandedFamilies:t().expandedFamilies})},toggleFamilyExpanded:(n,r)=>{e(e=>{let t=e.expandedFamilies[n]??[],i=t.includes(r)?t.filter(e=>e!==r):[...t,r];return{expandedFamilies:{...e.expandedFamilies,[n]:i}}}),j({usageExpandedFamilies:t().expandedFamilies})},applyDefaultSelections:(n,r)=>{if((t().selectedModels[n]?.length??0)>0)return;let i=ya(n,r);i.length!==0&&(e(e=>({selectedModels:{...e.selectedModels,[n]:i}})),j({usageSelectedModels:t().selectedModels}))}}),{name:`quota-store`})),Fa=()=>{let e=(0,Z.c)(11),t=C(Ia),n=Pa(La),r=Pa(Ra),i;e[0]===r?i=e[1]:(i=()=>{r()},e[0]=r,e[1]=i);let a;e[2]!==t||e[3]!==r||e[4]!==n?(a=[t,n,r],e[2]=t,e[3]=r,e[4]=n,e[5]=a):a=e[5],$.useEffect(i,a);let o=Pa(za),s=Pa(Ba),c=Pa(Va),l,u;e[6]!==o||e[7]!==c||e[8]!==s?(l=()=>{if(!o)return;let e=window.setInterval(()=>{c()},s);return()=>window.clearInterval(e)},u=[o,s,c],e[6]=o,e[7]=c,e[8]=s,e[9]=l,e[10]=u):(l=e[9],u=e[10]),$.useEffect(l,u)};function Ia(e){return e.currentDirectory}function La(e){return e.magpieUsageUrl}function Ra(e){return e.fetchMagpieQuotas}function za(e){return e.autoRefresh}function Ba(e){return e.refreshIntervalMs}function Va(e){return e.fetchAllQuotas}var Ha=e=>{let t=(0,Z.c)(20),{percent:n,tonePercent:r,className:i,expectedMarkerPercent:a}=e,o;t[0]===n?o=t[1]:(o=Rt(n)??0,t[0]=n,t[1]=o);let s=o,c=r??n,l;t[2]===c?l=t[3]:(l=Ct(c),t[2]=c,t[3]=l);let u=l,d=a==null?null:Math.max(0,Math.min(100,a)),f;t[4]===u?f=t[5]:(f=u===`critical`?{backgroundColor:`var(--status-error)`}:u===`warn`?{backgroundColor:`var(--status-warning)`}:{backgroundColor:`var(--status-success)`},t[4]=u,t[5]=f);let p=f,m;t[6]===i?m=t[7]:(m=Y(`relative h-2.5 rounded-full bg-[var(--interactive-border)] overflow-hidden`,i),t[6]=i,t[7]=m);let h=`${s}%`,g;t[8]!==p||t[9]!==h?(g={...p,width:h},t[8]=p,t[9]=h,t[10]=g):g=t[10];let _;t[11]!==s||t[12]!==g?(_=(0,Q.jsx)(`div`,{className:`h-full transition-all duration-300`,style:g,role:`progressbar`,"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100}),t[11]=s,t[12]=g,t[13]=_):_=t[13];let v;t[14]===d?v=t[15]:(v=d!=null&&d>0&&d<100&&(0,Q.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-foreground`,style:{left:`${d}%`},title:`Expected usage if spread evenly: ${Math.round(d)}% of quota`,"aria-hidden":`true`}),t[14]=d,t[15]=v);let y;return t[16]!==m||t[17]!==_||t[18]!==v?(y=(0,Q.jsxs)(`div`,{className:m,children:[_,v]}),t[16]=m,t[17]=_,t[18]=v,t[19]=y):y=t[19],y},Ua=e=>{let t=(0,Z.c)(67),{paceInfo:n,className:r,compact:i}=e,a=i!==void 0&&i,{t:o}=Ae(),s;t[0]===n.status?s=t[1]:(s=At(n.status),t[0]=n.status,t[1]=s);let c=s,l;bb0:{switch(n.status){case`on-track`:{let e;t[2]===o?e=t[3]:(e=o(`settings.usage.pace.status.onTrack`),t[2]=o,t[3]=e),l=e;break bb0}case`slightly-fast`:{let e;t[4]===o?e=t[5]:(e=o(`settings.usage.pace.status.slightlyFast`),t[4]=o,t[5]=e),l=e;break bb0}case`too-fast`:{let e;t[6]===o?e=t[7]:(e=o(`settings.usage.pace.status.tooFast`),t[6]=o,t[7]=e),l=e;break bb0}case`exhausted`:{let e;t[8]===o?e=t[9]:(e=o(`settings.usage.pace.status.usedUp`),t[8]=o,t[9]=e),l=e;break bb0}}l=void 0}let u=l,d;t[10]!==n.predictText||t[11]!==o?(d=o(`settings.usage.pace.predictionTooltip`,{prediction:n.predictText}),t[10]=n.predictText,t[11]=o,t[12]=d):d=t[12];let f=d;if(a){let e;t[13]===r?e=t[14]:(e=Y(`flex items-center gap-1.5`,r),t[13]=r,t[14]=e);let i;t[15]===c?i=t[16]:(i={backgroundColor:c},t[15]=c,t[16]=i);let a;t[17]!==u||t[18]!==i?(a=(0,Q.jsx)(`div`,{className:`h-2 w-2 rounded-full flex-shrink-0`,style:i,title:u}),t[17]=u,t[18]=i,t[19]=a):a=t[19];let s;t[20]===c?s=t[21]:(s={color:c},t[20]=c,t[21]=s);let l=n.isExhausted?void 0:f,d;t[22]!==n.isExhausted||t[23]!==n.predictText||t[24]!==n.remainingSeconds||t[25]!==o?(d=n.isExhausted?(0,Q.jsx)(Q.Fragment,{children:o(`settings.usage.pace.wait`,{duration:kt(n.remainingSeconds)})}):(0,Q.jsx)(Q.Fragment,{children:o(`settings.usage.pace.prediction`,{prediction:n.predictText})}),t[22]=n.isExhausted,t[23]=n.predictText,t[24]=n.remainingSeconds,t[25]=o,t[26]=d):d=t[26];let p;t[27]!==d||t[28]!==s||t[29]!==l?(p=(0,Q.jsx)(`span`,{className:`typography-micro tabular-nums`,style:s,title:l,children:d}),t[27]=d,t[28]=s,t[29]=l,t[30]=p):p=t[30];let m;return t[31]!==p||t[32]!==e||t[33]!==a?(m=(0,Q.jsxs)(`div`,{className:e,children:[a,p]}),t[31]=p,t[32]=e,t[33]=a,t[34]=m):m=t[34],m}let p;t[35]===r?p=t[36]:(p=Y(`flex items-center justify-between gap-2`,r),t[35]=r,t[36]=p);let m;t[37]!==n.isExhausted||t[38]!==n.paceRateText||t[39]!==o?(m=!n.isExhausted&&(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:o(`settings.usage.pace.rate`,{rate:n.paceRateText})}),t[37]=n.isExhausted,t[38]=n.paceRateText,t[39]=o,t[40]=m):m=t[40];let h;t[41]===m?h=t[42]:(h=(0,Q.jsx)(`div`,{className:`flex items-center gap-1.5`,children:m}),t[41]=m,t[42]=h);let g;t[43]===c?g=t[44]:(g={color:c},t[43]=c,t[44]=g);let _;t[45]!==n.isExhausted||t[46]!==n.predictText||t[47]!==n.remainingSeconds||t[48]!==f||t[49]!==u||t[50]!==o?(_=n.isExhausted?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:u}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:o(`settings.usage.pace.waitSeparator`)}),(0,Q.jsx)(`span`,{className:`font-medium`,children:kt(n.remainingSeconds)})]}):(0,Q.jsxs)(`span`,{title:f,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:o(`settings.usage.pace.predictionLabel`)}),(0,Q.jsx)(`span`,{className:`font-medium`,children:n.predictText})]}),t[45]=n.isExhausted,t[46]=n.predictText,t[47]=n.remainingSeconds,t[48]=f,t[49]=u,t[50]=o,t[51]=_):_=t[51];let v;t[52]!==g||t[53]!==_?(v=(0,Q.jsx)(`span`,{className:`typography-micro tabular-nums`,style:g,children:_}),t[52]=g,t[53]=_,t[54]=v):v=t[54];let y;t[55]===c?y=t[56]:(y={backgroundColor:c},t[55]=c,t[56]=y);let b;t[57]!==u||t[58]!==y?(b=(0,Q.jsx)(`div`,{className:`h-2 w-2 rounded-full flex-shrink-0`,style:y,title:u}),t[57]=u,t[58]=y,t[59]=b):b=t[59];let x;t[60]!==v||t[61]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[v,b]}),t[60]=v,t[61]=b,t[62]=x):x=t[62];let S;return t[63]!==x||t[64]!==p||t[65]!==h?(S=(0,Q.jsxs)(`div`,{className:p,children:[h,x]}),t[63]=x,t[64]=p,t[65]=h,t[66]=S):S=t[66],S},Wa=e=>e instanceof Error&&e.name===`CancelledError`,Ga=_(()=>({setStatus:e=>wt(L,e),refreshStatus:async(e,t)=>{let r=n();t?.force&&await L.cancelQueries({queryKey:R.github.auth(r),exact:!0});try{return await Nt(L,e,r)}catch(e){if(Wa(e))return Mt(L,r);throw e}}})),Ka={displayMode:`browser`,installed:!1,browserTab:!0},qa=new Set,Ja=Ka,Ya=!1,Xa,Za=()=>{let e=It();return{displayMode:e,installed:e!==`browser`,browserTab:e===`browser`}},Qa=()=>(!Ya&&typeof window<`u`&&(Ja=Za(),Ya=!0),Ja),$a=()=>{let e=Za();Ya=!0,e.displayMode!==Ja.displayMode&&(Ja=e,qa.forEach(e=>e()))},eo=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=[window.matchMedia(`(display-mode: standalone)`),window.matchMedia(`(display-mode: minimal-ui)`),window.matchMedia(`(display-mode: fullscreen)`),window.matchMedia(`(display-mode: window-controls-overlay)`)];for(let t of e)typeof t.addEventListener==`function`?t.addEventListener(`change`,$a):typeof t.addListener==`function`&&t.addListener($a);return window.addEventListener(`appinstalled`,$a),window.addEventListener(`focus`,$a),()=>{for(let t of e)typeof t.removeEventListener==`function`?t.removeEventListener(`change`,$a):typeof t.removeListener==`function`&&t.removeListener($a);window.removeEventListener(`appinstalled`,$a),window.removeEventListener(`focus`,$a)}},to=e=>(qa.add(e),Xa??=eo(),$a(),()=>{qa.delete(e),qa.size===0&&(Xa?.(),Xa=void 0)}),no=()=>$.useSyncExternalStore(to,Qa,ro);function ro(){return Ka}var io=`Yuri`,ao=_()(v(e=>({sidebarBrandName:io,setSidebarBrandName:t=>{let n=t.slice(0,64);e(e=>e.sidebarBrandName===n?e:{sidebarBrandName:n})}}),{name:`sidebar-brand-store`,storage:A(),version:3,migrate:(e,t)=>{if(!e||typeof e!=`object`)return e;let n={...e};return t<1&&n.sidebarBrandName===`YEE CODE`&&(n.sidebarBrandName=io),t<2&&n.sidebarBrandName===`Open Chamber`&&(n.sidebarBrandName=io),t<3&&(n.sidebarBrandName===`OPEN CHAMBER`||n.sidebarBrandName===`Open Chamber`)&&(n.sidebarBrandName=io),n}}));typeof window<`u`&&t(e=>{i(e)&&ao.persist.rehydrate()});var oo=(e,t)=>e?t.kind===e.kind?t.projectRoot.length===e.projectRoot.length?t.projectId.localeCompare(e.projectId)<0:t.projectRoot.length>e.projectRoot.length:t.kind===`project`:!0,so=(e,t,n)=>{oo(e.get(t),n)&&e.set(t,n)},co=e=>{let t=e;return B(t.directory)??B(t.project?.worktree)},lo=e=>{if(e===`/`||/^[A-Z]:$/.test(e))return null;let t=e.lastIndexOf(`/`);return t<0?null:t===0?`/`:t===2&&/^[A-Z]:\//.test(e)?e.slice(0,2):e.slice(0,t)},uo=(e,t,n,r,i=[])=>{let a=new Map,o=new Map;for(let e of t){let t=B(e.normalizedPath);if(!t)continue;let n=o.get(t);(!n||e.id.localeCompare(n.id)<0)&&o.set(t,e),so(a,t,{projectId:e.id,projectRoot:t,scopeDirectory:t,kind:`project`})}if(!r)for(let[e,t]of n){let n=B(e),r=n?o.get(n):void 0;if(!(!r||!n))for(let e of t){let t=B(e.path);t&&so(a,t,{projectId:r.id,projectRoot:n,scopeDirectory:t,kind:`worktree`})}}let s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=e=>{if(!e)return null;if(s.has(e))return s.get(e)??null;if(r){let t=a.get(e)??null;return s.set(e,t),t}let t=[],n=e,i=null;for(;n;){if(s.has(n)){i=s.get(n)??null;break}if(t.push(n),i=a.get(n)??null,i)break;n=lo(n)}for(let e of t)s.set(e,i);return i},p=(e,t,n)=>{for(let r of e){let e=f(co(r));if(!e)continue;c.set(r.id,e);let i=t.get(e.projectId);if(i?i.push(r):t.set(e.projectId,[r]),!n)continue;let a=n.get(e.scopeDirectory);a?a.add(r.id):n.set(e.scopeDirectory,new Set([r.id]))}};return p(e,l,d),p(i,u),{bySessionId:c,sessionsByProject:l,archivedSessionsByProject:u,sessionsByScope:d,directoryResolutions:s.size}},fo=`__other__`;function po(e){return e.time?.updated??e.time?.archived??e.time?.created??0}function mo({mode:e=`dialog`}){let{t}=Ae(),{isMobile:n,isTablet:r,hasTouchInput:i}=Gt(),a=n||r||i,s=e===`page`,c=O(e=>e.isArchivedSessionsDialogOpen),l=O(e=>e.setArchivedSessionsDialogOpen),u=s||c,d=Re(e=>e.projects),f=Ne(e=>e.archivedSessions),p=Ie(e=>e.setCurrentSession),m=O(e=>e.setSettingsDialogOpen),[h,g]=$.useState(!1),[_,v]=$.useState(null),[y,b]=$.useState(null);$.useEffect(()=>{if(!u){v(null),b(null);return}let e=!1;return g(!0),Je().catch(()=>{e||Pe.error(t(`settings.yuri.archivedSessions.toast.loadFailed`))}).finally(()=>{e||g(!1)}),()=>{e=!0}},[u,t]);let x=$.useMemo(()=>{let e=uo([],d.map(e=>({id:e.id,normalizedPath:e.path})),new Map,o(),f),n=new Map;for(let[t,r]of e.archivedSessionsByProject)n.set(t,[...r].sort((e,t)=>po(t)-po(e)));let r=new Set;for(let e of n.values())for(let t of e)r.add(t.id);let i=f.filter(e=>!r.has(e.id)).sort((e,t)=>po(t)-po(e));i.length>0&&n.set(fo,i);let a=[];for(let e of d){let t=n.get(e.id)??[];t.length!==0&&a.push({projectId:e.id,label:e.label||e.path,path:e.path,sessions:t})}let s=n.get(fo);return s&&s.length>0&&a.push({projectId:fo,label:t(`settings.yuri.archivedSessions.otherProjects`),path:null,sessions:s}),a.sort((e,t)=>t.sessions.length-e.sessions.length||e.label.localeCompare(t.label)),a},[f,d,t]),S=f.length,C=_?x.find(e=>e.projectId===_)??null:null,w=$.useCallback(async e=>{b(e.id);try{await ze(e.id)?Pe.success(t(`settings.yuri.archivedSessions.toast.restored`)):Pe.error(t(`settings.yuri.archivedSessions.toast.restoreFailed`))}finally{b(null)}},[t]),T=$.useCallback(e=>{let t=Ve(e);p(e.id,t),l(!1),m(!1)},[p,l,m]),E=C?C.label:t(`settings.yuri.archivedSessions.dialog.title`),D=C?C.sessions.length===1?t(`settings.yuri.archivedSessions.dialog.sessionCountSingle`,{count:C.sessions.length}):t(`settings.yuri.archivedSessions.dialog.sessionCountPlural`,{count:C.sessions.length}):t(`settings.yuri.archivedSessions.dialog.description`),k=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[C?(0,Q.jsxs)(Me,{type:`button`,variant:`ghost`,size:`sm`,className:`!h-7 !px-2 !font-normal text-muted-foreground`,onClick:()=>v(null),children:[(0,Q.jsx)(X,{name:`arrow-left-s`,className:`mr-1 h-4 w-4`}),t(`settings.yuri.archivedSessions.dialog.backToProjects`)]}):null,h?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 typography-meta text-muted-foreground py-6`,children:[(0,Q.jsx)(X,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),t(`settings.yuri.archivedSessions.dialog.loading`)]}):C?C.sessions.length===0?(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-border p-4 typography-meta text-muted-foreground`,children:t(`settings.yuri.archivedSessions.dialog.emptyProject`)}):(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:C.sessions.map(e=>{let n=Ve(e),r=po(e),i=y===e.id;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-border/60 px-3 py-2.5 sm:flex-row sm:items-center sm:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`typography-ui-label font-medium text-foreground truncate`,children:e.title||t(`sessions.sidebar.session.untitled`)}),(0,Q.jsxs)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:[r>0?Wt(r):null,r>0&&n?` · `:null,n?Oe(n):null]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,Q.jsx)(Me,{type:`button`,variant:`outline`,size:`xs`,className:`!font-normal`,disabled:i,onClick:()=>T(e),children:t(`settings.yuri.archivedSessions.actions.preview`)}),(0,Q.jsxs)(Me,{type:`button`,variant:`default`,size:`xs`,className:`!font-normal`,disabled:i,onClick:()=>void w(e),children:[i?(0,Q.jsx)(X,{name:`loader-4`,className:`mr-1 h-3.5 w-3.5 animate-spin`}):(0,Q.jsx)(X,{name:`inbox-unarchive`,className:`mr-1 h-3.5 w-3.5`}),t(`settings.yuri.archivedSessions.actions.restore`)]})]})]},e.id)})}):x.length===0?(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-border p-4 typography-meta text-muted-foreground`,children:t(`settings.yuri.archivedSessions.dialog.empty`)}):(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:x.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>v(e.projectId),className:Y(`flex w-full items-center gap-3 rounded-lg border border-border/60 px-3 py-2.5 text-left`,`hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`),children:[(0,Q.jsx)(X,{name:`folder`,className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`typography-ui-label font-medium text-foreground truncate`,children:e.label}),e.path?(0,Q.jsx)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:Oe(e.path)}):null]}),(0,Q.jsx)(`span`,{className:`typography-meta tabular-nums text-muted-foreground shrink-0`,children:e.sessions.length===1?t(`settings.yuri.archivedSessions.dialog.sessionCountSingle`,{count:e.sessions.length}):t(`settings.yuri.archivedSessions.dialog.sessionCountPlural`,{count:e.sessions.length})}),(0,Q.jsx)(X,{name:`arrow-right-s`,className:`h-4 w-4 shrink-0 text-muted-foreground`})]},e.projectId))}),!C&&!h&&S>0?(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(S===1?`settings.yuri.archivedSessions.summarySingle`:`settings.yuri.archivedSessions.summaryPlural`,{count:S})}):null]});return s?(0,Q.jsxs)(`div`,{"data-settings-item":`archived-sessions.manage`,className:`yuri-settings-section-stack`,children:[(0,Q.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:t(`settings.yuri.archivedSessions.description`)}),k]}):a?(0,Q.jsx)(zt,{open:c,title:E,onClose:()=>l(!1),contentMaxHeightClassName:`max-h-[min(80vh,640px)]`,renderHeader:e=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-border/40 px-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:E}),e]}),(0,Q.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:D})]}),children:k}):(0,Q.jsx)(et,{open:c,onOpenChange:l,children:(0,Q.jsxs)(Ze,{className:`max-h-[85vh] max-w-2xl overflow-y-auto`,children:[(0,Q.jsxs)(Xe,{children:[(0,Q.jsx)(Qe,{children:E}),(0,Q.jsx)($e,{children:D})]}),k]})})}function ho(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(mo,{mode:`dialog`}),e[0]=t):t=e[0],t}var go=48;function _o({title:e,eyebrow:t,trailing:n,className:r}){let i=(0,$.useRef)(null),a=(0,$.useRef)(null),o=(0,$.useRef)(null),s=(0,$.useRef)(null),c=(0,$.useRef)(null),l=De(()=>{s.current=null;let e=i.current,t=a.current;if(!e||!t)return;let n=Math.min(1,Math.max(0,t.scrollTop/go)),r=o.current?.matches?Number(n>=.5):n;c.current!==null&&Math.abs(c.current-r)<.001||(c.current=r,e.style.setProperty(`--yuri-mobile-title-collapse`,r.toFixed(4)))}),u=De(()=>{s.current===null&&(s.current=window.requestAnimationFrame(l))});return(0,$.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.closest(`.yuri-mobile-settings-root-surface, [role="tabpanel"]`);if(!t)return;let n=window.matchMedia(`(prefers-reduced-motion: reduce)`);return a.current=t,o.current=n,c.current=null,t.addEventListener(`scroll`,u,{passive:!0}),n.addEventListener(`change`,u),l(),()=>{t.removeEventListener(`scroll`,u),n.removeEventListener(`change`,u),s.current!==null&&window.cancelAnimationFrame(s.current),s.current=null,a.current=null,o.current=null,c.current=null}},[]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`header`,{ref:i,className:Y(`yuri-mobile-collapsing-header flex shrink-0 items-start gap-4`,r),children:(0,Q.jsxs)(`div`,{className:`yuri-mobile-collapsing-header-inner`,children:[(0,Q.jsxs)(`div`,{className:`yuri-mobile-collapsing-header-title-block min-w-0 flex-1`,children:[t?(0,Q.jsx)(`p`,{className:`yuri-mobile-collapsing-header-eyebrow truncate typography-micro font-medium text-muted-foreground`,children:t}):null,(0,Q.jsx)(`h1`,{className:`yuri-mobile-root-page-title truncate font-semibold text-foreground`,children:e})]}),n?(0,Q.jsx)(`div`,{className:`yuri-mobile-collapsing-header-trailing flex min-h-10 shrink-0 items-center gap-3.5`,children:n}):null]})}),(0,Q.jsx)(`div`,{className:`yuri-mobile-collapsing-header-spacer`,"aria-hidden":`true`})]})}export{Xr as A,Pn as B,Hi as C,Si as D,Ai as E,zr as F,Sn as H,Br as I,Ir as L,Gr as M,Rr as N,qr as O,Lr as P,Mr as R,Ui as S,ki as T,Cn as U,wn as V,ga as _,ao as a,Xi as b,Ua as c,Fa as d,Pa as f,va as g,_a as h,uo as i,Wr as j,Yr as k,Ha as l,fa as m,ho as n,no as o,ha as p,mo as r,Ga as s,_o as t,Na as u,da as v,ji as w,Wi as x,sa as y,sr as z};
|