@openchambery/web 1.19.0-beta.26 → 1.19.0-beta.27
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-CV1_wo-y.js +1 -0
- package/dist/assets/{ChatContainer-PYouy9H8.js → ChatContainer-ehWccWAx.js} +39 -39
- package/dist/assets/ContextPanel-CJ99pWHJ.js +288 -0
- package/dist/assets/{DiagramView-C7XdFTPd.js → DiagramView-mbjxAqZP.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-Cp2Blr66.js → MarkdownRendererImpl-U8cXOC4R.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-k7LpaSMD.js → MobileDetailNavigation-hRuaRUub.js} +1 -1
- package/dist/assets/{MobileShareBridge-CPftdKLA.js → MobileShareBridge-DdmYPKzY.js} +1 -1
- package/dist/assets/{MobileSurface-D2Ot7Cmv.js → MobileSurface-C1rxhEfq.js} +1 -1
- package/dist/assets/{MultiRunWindow-DJpYipUj.js → MultiRunWindow-BIvXp63r.js} +1 -1
- package/dist/assets/{SettingsView-CoH8zmJW.js → SettingsView-D2O435bh.js} +6 -6
- package/dist/assets/{SettingsWindow-sRkEOrjr.js → SettingsWindow-G1QF5i5x.js} +1 -1
- package/dist/assets/{TerminalView-4GuNFrma.js → TerminalView-BEQ9cKdC.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Dgkz0ecA.js → ToolOutputDialog-cpZSAQfF.js} +1 -1
- package/dist/assets/appThemeRegistry-DI6baYf4.js +2 -0
- package/dist/assets/{gitApi-5E8Bk0aK.js → gitApi-hRPDdHvC.js} +3 -3
- package/dist/assets/insertionBoundaries-DpNAsre1.js +4 -0
- package/dist/assets/{main-BhXos6y1.js → main-BDhEkfj8.js} +2 -2
- package/dist/assets/main-a3o2jU3l.js +29 -0
- package/dist/assets/{miniChat-C10JTIQK.js → miniChat-CwAvyEMk.js} +2 -2
- package/dist/assets/{mobile-FSVGoH4d.js → mobile-B0_EeAHo.js} +2 -2
- package/dist/assets/{multirun-Cpcl8Azv.js → multirun-BFLuSXHH.js} +1 -1
- package/dist/assets/{projectMeta-8HtwDMhW.js → projectMeta-DeW64VYQ.js} +2 -2
- package/dist/assets/radio-ChqYKN77.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-BFZjVHLo.js +2 -0
- package/dist/assets/renderMobileApp-BKUK96WG.js +23 -0
- package/dist/assets/{runtimeConfig-XOs5e9au.js → runtimeConfig-clD8y8Zr.js} +1 -1
- package/dist/assets/runtimeEndpointReset-CIpZCgfR.js +4 -0
- package/dist/assets/{shikiHighlight-DApvWKTR.js → shikiHighlight-D95A9dOF.js} +1 -1
- package/dist/assets/{useAppFontEffects-D6FXAM7D.js → useAppFontEffects-DizHtH_g.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-CJBj8Hzt.js → useDesktopWindowControlsLayout-CgzmLvaZ.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-TakIKXcg.js → useEffectiveDirectory-DIAeoAPs.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DGjylwfn.js → useMobileNavigationStore-7w1G5Eip.js} +6 -6
- package/dist/assets/{useSessionAutoCleanup-_HSvJaRl.js → useSessionAutoCleanup-DaZV5I9j.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-CzSR8Itg.js → useWorkerHighlightedLines-e3yI4PGk.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/dist/assets/AssistantView-D0IzIR8O.js +0 -1
- package/dist/assets/ContextPanel-PkBCYbNl.js +0 -288
- package/dist/assets/appThemeRegistry-DBaZM5iw.js +0 -2
- package/dist/assets/insertionBoundaries-DxYdQi8e.js +0 -4
- package/dist/assets/main-BkOYx6Da.js +0 -29
- package/dist/assets/radio-DAi6Xrc-.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-D4-eFRPf.js +0 -2
- package/dist/assets/renderMobileApp-Cl9o7b0k.js +0 -23
- package/dist/assets/runtimeEndpointReset-D8x-ySDF.js +0 -4
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownRendererImpl-Cp2Blr66.js","assets/rolldown-runtime-C0FnF6B9.js","assets/useUIStore-Wyu09VUF.js","assets/vendor-zustand-B4dlGEM2.js","assets/vendor-base-ui-CnHfUmDN.js","assets/persistence-aCOlo6ew.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-ulFAVx1H.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/vendor-reactuses-core-DDoDDyM9.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/clipboard-C7zcAKyC.js","assets/store-upwbPNfx.js","assets/useMobileNavigationStore-DGjylwfn.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/vendor-sonner-DVzioF3d.js","assets/useAssistantUIStore-DxZsjSPQ.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-CJdWZupK.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-DMzWVJaW.js","assets/markdownTheme-DidS-jC5.js","assets/vendor-pierre-diffs-BenIz2TM.js","assets/vendor-hast-util-to-html-B0p1k5Xa.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-DpDied8H.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/url-BQHM4bC4.js","assets/markdown-worker-9Sn2jsDp.js","assets/useEffectiveDirectory-TakIKXcg.js","assets/FadeInOnReveal-BpIMrqet.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-beautiful-mermaid-DykqIK5D.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/vendor-katex-CNGgSigB.js","assets/vendor-dompurify-CeJNOzik.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r,t as i}from"./platform-ulFAVx1H.js";import{a,n as o,o as s}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as c}from"./vendor-react-DLPElpoQ.js";import{n as l}from"./vendor-reactuses-core-DDoDDyM9.js";import{r as u}from"./useMobileNavigationStore-DGjylwfn.js";import{c as d,l as f}from"./dialog-BUQDNX62.js";import{t as p}from"./utils-CJdWZupK.js";import{a as m,c as h,i as g}from"./markdown-worker-9Sn2jsDp.js";import{r as _}from"./vendor-pierre-diffs-BenIz2TM.js";var v=e(n(),1),y=c(),ee=`oc-native-ios-composer`,b=`--oc-native-composer-height`,x=`--oc-native-composer-accessory`,te=33554432,S=`OpenChamberComposer`,C=`#22c55e`,w=32,ne=()=>({open:!1,highlightedIndex:0,rows:[]}),re=a(S),ie=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.isMobile;function ae(e){return typeof window>`u`?!1:ie({isCapacitor:r(),platform:i(),pluginAvailable:o.isPluginAvailable(S),isMobile:e})}var oe=e=>e.classList.contains(`dark`)?`dark`:`light`,se=e=>{let t=e?.height;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:t},ce=(e,t)=>{if(!(t>0)){e.style.removeProperty(b);return}e.style.setProperty(b,`${Math.round(t)}px`)},le=(e,t)=>{if(!(t>0)){e.style.removeProperty(x);return}e.style.setProperty(x,`${Math.round(t)}px`)},T=(e,t)=>{e.classList.toggle(ee,t),t||(e.style.removeProperty(b),e.style.removeProperty(x))},ue=e=>d(e).flat().map(e=>+!!e),de=e=>{if(typeof document>`u`||typeof getComputedStyle>`u`)return C;let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),n=document.createElement(`span`);n.style.color=t||`var(${e})`,document.documentElement.appendChild(n);let r=getComputedStyle(n).color;n.remove();let i=/rgba?\(\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)(?:\s*,\s*|\s+)([\d.]+)/.exec(r);if(!i)return C;let a=e=>Math.max(0,Math.min(255,Math.round(Number(e)))).toString(16).padStart(2,`0`);return`#${a(i[1])}${a(i[2])}${a(i[3])}`},fe=e=>de(f(e).var),pe=(e,t)=>e.text===t.text&&e.placeholder===t.placeholder&&e.modelLabel===t.modelLabel&&e.modelVariantLabel===t.modelVariantLabel&&e.modelIcon===t.modelIcon&&e.canSend===t.canSend&&e.canAbort===t.canAbort&&e.attachmentCount===t.attachmentCount&&D(e.attachmentPreviews,t.attachmentPreviews)&&O(e.citationRanges,t.citationRanges)&&e.appearance===t.appearance&&e.attachAria===t.attachAria&&e.attachTitle===t.attachTitle&&e.attachPhotosLabel===t.attachPhotosLabel&&e.attachFilesLabel===t.attachFilesLabel&&e.attachCancelLabel===t.attachCancelLabel&&e.sendAria===t.sendAria&&e.queueAria===t.queueAria&&e.stopAria===t.stopAria&&e.modelAria===t.modelAria&&e.agentAria===t.agentAria&&e.agentLabel===t.agentLabel&&e.agentColor===t.agentColor&&e.agentIdenticon.join(``)===t.agentIdenticon.join(``)&&e.suppressed===t.suppressed&&e.showScrollToBottom===t.showScrollToBottom&&e.scrollAria===t.scrollAria&&E(e.autocomplete,t.autocomplete),E=(e,t)=>e.open===t.open&&e.highlightedIndex===t.highlightedIndex&&e.rows.length===t.rows.length&&e.rows.every((e,n)=>{let r=t.rows[n];return!!(r&&e.id===r.id&&e.title===r.title&&e.subtitle===r.subtitle&&e.badge===r.badge&&e.iconBase64===r.iconBase64)}),D=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!(r&&e.id===r.id&&e.filename===r.filename&&e.mime===r.mime&&e.thumbnailBase64===r.thumbnailBase64&&e.removeAria===r.removeAria)}),O=(e,t)=>e.length===t.length&&e.every((e,n)=>e.start===t[n]?.start&&e.end===t[n]?.end),me=e=>e.map(e=>`${e.id}:${e.filename}:${e.mimeType}:${e.dataUrl?.length??0}`).join(`|`),he=e=>{let t=e?.id;return typeof t==`string`&&t.trim()?t:``},ge=e=>{let t=e?.selectionStart,n=e?.selectionEnd;return typeof t!=`number`||!Number.isFinite(t)||t<0?null:{start:t,end:typeof n==`number`&&Number.isFinite(n)&&n>=t?n:t}},_e=e=>{let t=e?.index;return typeof t!=`number`||!Number.isFinite(t)||t<0?0:Math.floor(t)},ve=e=>e.echoingNative||e.nextText===e.nativeOwnedText?{omitText:!0,forceText:!1}:{omitText:!1,forceText:!0},ye=e=>setTimeout(e,0),be=e=>{e.applyDocument(e.text),ye(e.submit)},k=(e,t)=>e===t,xe=(e,t,n)=>{if(n.omitText&&e&&pe(e,t))return null;let r={};if(n.omitText||(r.text=t.text,n.forceText&&(r.forceText=!0)),!e){let{text:e,...n}=t;return Object.assign(r,n),r}let i=(n,i)=>{i(e[n],t[n])||(r[n]=t[n])};return i(`placeholder`,k),i(`modelLabel`,k),i(`modelVariantLabel`,k),i(`modelIcon`,k),i(`canSend`,k),i(`canAbort`,k),i(`attachmentCount`,k),i(`attachmentPreviews`,D),i(`citationRanges`,O),i(`appearance`,k),i(`attachAria`,k),i(`attachTitle`,k),i(`attachPhotosLabel`,k),i(`attachFilesLabel`,k),i(`attachCancelLabel`,k),i(`sendAria`,k),i(`queueAria`,k),i(`stopAria`,k),i(`modelAria`,k),i(`agentAria`,k),i(`agentLabel`,k),i(`agentColor`,k),i(`agentIdenticon`,(e,t)=>e.join(``)===t.join(``)),i(`suppressed`,k),i(`showScrollToBottom`,k),i(`scrollAria`,k),i(`autocomplete`,E),Object.keys(r).length===0?null:r},Se=e=>{let t=Array.isArray(e?.skipped)?e.skipped:[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e.name;typeof t==`string`&&t.trim()&&n.push(t)}return n},Ce=e=>{try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch{return null}},we=(e,t=te)=>{let n=Array.isArray(e?.files)?e.files:[],r=[];for(let e of n){if(!e||typeof e!=`object`)continue;let n=e;if(typeof n.dataBase64!=`string`||n.dataBase64.length===0)continue;let i=Ce(n.dataBase64);if(!i||i.byteLength===0||i.byteLength>t)continue;let a=typeof n.name==`string`&&n.name.trim()?n.name:`file`,o=typeof n.mime==`string`&&n.mime.trim()?n.mime:`application/octet-stream`;r.push(new File([new Uint8Array(i)],a,{type:o}))}return r},A=80,Te=e=>typeof document>`u`||!e||!e.startsWith(`data:image/`)?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=A,e.height=A;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,A,A),r.drawImage(n,0,0,A,A);let i=e.toDataURL(`image/jpeg`,.72),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),Ee=e=>typeof document>`u`||!e?Promise.resolve(null):new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=document.createElement(`canvas`);e.width=w,e.height=w;let r=e.getContext(`2d`);if(!r){t(null);return}r.clearRect(0,0,w,w),r.drawImage(n,0,0,w,w);let i=e.toDataURL(`image/png`),a=i.indexOf(`,`);t(a>=0?i.slice(a+1):null)}catch{t(null)}},n.onerror=()=>t(null),n.src=e}),j=()=>re,M=((e=j)=>{let t=0,n=0,r=null,i=[],a=null,o=``,s=!1,c=()=>{r!==null&&(clearTimeout(r),r=null)},l=(e,...t)=>{let n=a;n&&n[e](...t)},u=async()=>{let r=n,a=e(),s=await Promise.all([a.addListener(`textChanged`,e=>{let t=typeof e.text==`string`?e.text:``;o=t,l(`onText`,t,e.composing===!0,ge(e))}),a.addListener(`send`,e=>{let t=typeof e.text==`string`?e.text:o;o=t,l(`onSend`,t)}),a.addListener(`abort`,()=>{l(`onAbort`)}),a.addListener(`attach`,()=>{l(`onAttach`)}),a.addListener(`filesPicked`,t=>{l(`onFiles`,we(t),Se(t)),e().focus()}),a.addListener(`removeAttachment`,e=>{let t=he(e);t&&l(`onRemoveAttachment`,t)}),a.addListener(`openModel`,()=>{l(`onOpenModel`)}),a.addListener(`cycleAgent`,()=>{l(`onCycleAgent`)}),a.addListener(`openAgent`,()=>{l(`onOpenAgent`)}),a.addListener(`heightChanged`,e=>{l(`onHeight`,se(e))}),a.addListener(`scrollToBottom`,()=>{l(`onScrollToBottom`)}),a.addListener(`autocompleteAccept`,e=>{l(`onAutocompleteAccept`,_e(e))}),a.addListener(`autocompleteDismiss`,()=>{l(`onAutocompleteDismiss`)})]);if(n!==r||t===0){for(let e of s)e.remove();return}i=s},d=r=>{if(!(t>0)){n+=1,a=null,s=!1;for(let e of i)e.remove();i=[],T(r,!1),e().dismiss()}};return{bind(e){a=e},rememberText(e){o=e},rememberState(e){o=e.text},conceal(){s||t===0||(s=!0,e().hide())},reveal(){!s||t===0||(s=!1,e().show())},async retain(n,r){c(),t+=1,s=!1,o=r.text,T(n,!0),i.length===0&&await u(),await e().present(r)},release(e){t=Math.max(0,t-1),!(t>0)&&(c(),r=setTimeout(()=>{r=null,d(e)},0))},snapshot(){return{retainCount:t,listenerCount:i.length,hidePending:r!==null,concealed:s}}}})(),De=()=>a(`OpenChamberNavigation`),N=e=>e?.kind===`chat`||e?.kind===`draft`,P=e=>e?e.kind===`draft`||e.kind===`chat`&&e.routes.length<=1:!1,Oe=(e,t)=>N(e)&&!N(t),ke=(e=M)=>{P(u.getState().secondary)&&e.conceal()},Ae=(e=M)=>{let t=u.subscribe((t,n)=>{Oe(n.secondary,t.secondary)&&e.conceal()}),n=[],r=!1;return o.getPlatform()===`ios`&&(async()=>{let t=De(),i=await t.addListener(`backStarted`,()=>{P(u.getState().secondary)&&e.conceal()}),a=await t.addListener(`backCancelled`,()=>{e.reveal()});if(r){i.remove(),a.remove();return}n=[i,a]})(),()=>{r=!0,t();for(let e of n)e.remove();n=[]}},F=`openchamber:chunk-import-reload`,je=250,Me=3e4,Ne=[/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 I(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 L(e){let t=I(e);return Ne.some(e=>e.test(t))}function Pe(e){return`1.19.0-beta.26:${I(e).slice(0,500)}`}function Fe(e){if(typeof window>`u`)return;let t=Date.now(),n=Pe(e),r=null;try{let e=window.sessionStorage.getItem(F);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<Me)){try{window.sessionStorage.setItem(F,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:I(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function Ie(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,!L(e)||t>=n)break;await new Promise(e=>setTimeout(e,je*(t+1)))}throw L(r)&&Fe(r),r}var R=e=>(0,v.lazy)(()=>Ie(e)),z=`__openchamberMobileBackRoute`,Le=()=>typeof window>`u`||r()?null:{currentState:()=>window.history.state&&typeof window.history.state==`object`?window.history.state:null,pushState:e=>window.history.pushState(e,``,window.location.href),back:()=>window.history.back(),subscribe:e=>{let t=t=>e(t.state&&typeof t.state==`object`?t.state:null);return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)}},B=e=>{let t=e?.[z];return typeof t==`number`&&Number.isFinite(t)?t:null},V=new class{routes=[];listeners=new Set;nextToken=1;history;removeHistoryListener=null;programmaticHistoryBackToken=null;pendingHistoryRemovals=new Map;animatedBackDriver=null;presentationCancelDriver=null;constructor(e=Le()){this.history=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getTopRoute=()=>this.routes.at(-1)??null;register=e=>{let t=this.pendingHistoryRemovals.get(e.id);this.pendingHistoryRemovals.delete(e.id);let n=!!(this.history&&t!==void 0&&B(this.history.currentState())===t),r={...e,token:n&&t!==void 0?t:this.nextToken++};this.routes.push(r),this.ensureHistoryListener(),this.history&&!n&&this.history.pushState({...this.history.currentState()??{},[z]:r.token}),this.notify();let i=!0;return()=>{if(!i)return;i=!1;let e=this.routes.indexOf(r);e<0||(this.routes.splice(e,1),this.history&&B(this.history.currentState())===r.token?(this.pendingHistoryRemovals.set(r.id,r.token),queueMicrotask(()=>{if(this.pendingHistoryRemovals.get(r.id)===r.token){if(this.pendingHistoryRemovals.delete(r.id),!this.history||B(this.history.currentState())!==r.token){this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener();return}this.programmaticHistoryBackToken=r.token,this.history.back(),this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener()}})):this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener(),this.notify())}};backImmediately=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:t.onBack()!==!1};requestAnimatedBack=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:this.animatedBackDriver?.(t)?!0:this.backImmediately(e)};setAnimatedBackDriver=e=>(this.animatedBackDriver=e,()=>{this.animatedBackDriver===e&&(this.animatedBackDriver=null)});setPresentationCancelDriver=e=>(this.presentationCancelDriver=e,()=>{this.presentationCancelDriver===e&&(this.presentationCancelDriver=null)});cancelPresentation=()=>{this.presentationCancelDriver?.()};requestBrowserBack=()=>{let e=this.getTopRoute();return e?this.history&&B(this.history.currentState())===e.token?(this.history.back(),!0):e.onBack()!==!1:!1};ensureHistoryListener(){!this.history||this.removeHistoryListener||(this.removeHistoryListener=this.history.subscribe(e=>{if(this.programmaticHistoryBackToken!==null){this.programmaticHistoryBackToken=null;return}let t=this.getTopRoute();t&&B(e)!==t.token&&t.onBack()===!1&&this.history&&this.history.pushState({...this.history.currentState()??{},[z]:t.token})}))}disposeHistoryListener(){this.removeHistoryListener?.(),this.removeHistoryListener=null,this.programmaticHistoryBackToken=null,this.pendingHistoryRemovals.clear()}notify(){this.listeners.forEach(e=>e())}},Re=e=>{let t=(0,y.c)(8),{id:n,active:r,layer:i,onBack:a,surfaceRef:o,underlayRef:s}=e,c=i===void 0?`root`:i,u=l(a),d,f;t[0]!==r||t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==o||t[5]!==s?(d=()=>{if(r)return V.register({id:n,layer:c,onBack:u,getSurface:()=>o.current,getUnderlay:()=>s?.current??null})},f=[r,u,n,c,o,s],t[0]=r,t[1]=u,t[2]=n,t[3]=c,t[4]=o,t[5]=s,t[6]=d,t[7]=f):(d=t[6],f=t[7]),v.useEffect(d,f)},H=a(`OpenChamberNavigation`),U=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),ze=(e,t)=>!e||!t?!1:e.onBack()!==!1,W=e=>{let t=U(e.progress),n=e.commit?1-t:t;if(n<=.001)return 0;let r=Math.max(1,e.viewportWidth??390),i=Math.abs(e.velocityX??0)/r,a=n/Math.max(e.commit?2.4:2.8,i)*1e3,o=e.commit?90:100,s=e.commit?320:260;return Math.round(Math.min(s,Math.max(o,a)))},G=e=>{let{surface:t,underlay:n,surfaceTransition:r,surfaceAnimation:i,underlayTransition:a,underlayAnimation:o}=e;t.style.removeProperty(`transform`),t.style.removeProperty(`opacity`),t.style.removeProperty(`will-change`),t.style.removeProperty(`box-shadow`),t.style.transition=r,t.style.animation=i,n&&(n.style.removeProperty(`transform`),n.style.removeProperty(`opacity`),n.style.removeProperty(`will-change`),n.style.transition=a??``,n.style.animation=o??``)},K=(e,t)=>{let n=U(t),{surface:r}=e;r.style.transform=`translate3d(${n*100}%, 0, 0)`},Be=e=>!e.surfaceConnected||e.topRouteToken!==e.routeToken||e.routeSurface!==e.outgoingSurface,Ve=async(e,t,n,r)=>{if(!r&&typeof e.animate==`function`){let r=e.style.transform||`translate3d(0%, 0, 0)`,i=`translate3d(${t}%, 0, 0)`,a=e.animate([{transform:r},{transform:i}],{duration:n,easing:`cubic-bezier(0.22, 1, 0.36, 1)`,fill:`forwards`}),o=!1;try{await a.finished,o=!0}catch{}finally{o&&(e.style.transform=i),a.cancel()}return}e.style.transform=`translate3d(${t}%, 0, 0)`},He=async(e,t,n=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,r=W({progress:Number.parseFloat(e.style.transform.match(/translate3d\(([-\d.]+)%/)?.[1]??`0`)/100,commit:t}))=>Ve(e,t?100:0,r,n),Ue=class{pending=0;enqueue(){this.pending+=1}take(){return this.pending!==0&&(--this.pending,!0)}clear(){this.pending=0}},We=e=>{let t=(0,y.c)(4),{enabled:n,rootRoutesBlocked:i}=e,a,s;t[0]!==n||t[1]!==i?(a=()=>{if(!n||!r()||o.getPlatform()===`web`)return;let e=!1,t=null,a=null,s=0,c=0,l=0,u=new Ue,d=[],f=e=>!!e&&(!i||e?.layer===`overlay`),p=()=>{let e=f(V.getTopRoute());H.setEnabled({enabled:e}).catch(Ge)},m=()=>{if(V.cancelPresentation(),a)return;let e=V.getTopRoute();if(!f(e))return;let n=e.getSurface();if(!n)return;n.getAnimations().forEach(Ke),a=null;let r=e.layer===`root`?e.getUnderlay():null,i=n.style.transition,o=n.style.animation,s=r?.style.transition??null,c=r?.style.animation??null;r?.getAnimations().forEach(qe),n.style.transition=`none`,n.style.animation=`none`,n.style.willChange=`transform`,r&&(r.style.removeProperty(`transform`),r.style.removeProperty(`will-change`)),l+=1,t={route:e,surface:n,underlay:r,surfaceTransition:i,surfaceAnimation:o,underlayTransition:s,underlayAnimation:c},K(t,0)},h=e=>{c=U(e),!s&&(s=window.requestAnimationFrame(()=>{s=0,t&&K(t,c)}))},g=Je,_=(n,r,i)=>{if(n&&ke(),a)return n&&f(V.getTopRoute())?(u.enqueue(),!0):!1;s&&=(window.cancelAnimationFrame(s),0),t||m(),t&&r!==void 0&&K(t,r);let o=t,d=l;if(t=null,!o){if(!n)return!1;let e=V.getTopRoute();return ze(e,f(e))}a=o;let p=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,h=W({progress:U(r??c),commit:n,velocityX:i,viewportWidth:window.innerWidth});return He(o.surface,n,p,h).then(async()=>{d===l&&(!e&&n&&(o.route.onBack(),await g(o)),d===l&&(G(o),a===o&&(a=null),!e&&u.take()&&_(!0,0,0)))}),!0},v=V.setAnimatedBackDriver(e=>e!==V.getTopRoute()||!f(e)?!1:_(!0,0,0)),y=V.subscribe(p);return(async()=>{let t=await H.addListener(`backStarted`,m),n=await H.addListener(`backProgressed`,e=>h(e.progress??0)),r=await H.addListener(`backCancelled`,e=>_(!1,e.progress,e.velocityX)),i=await H.addListener(`backInvoked`,e=>_(!0,e.progress,e.velocityX));if(e){await Promise.all([t.remove(),n.remove(),r.remove(),i.remove()]);return}d.push(t,n,r,i),p()})().catch(Ye),p(),()=>{e=!0,l+=1,u.clear(),y(),v(),s&&window.cancelAnimationFrame(s),t&&G(t),a&&(a.surface.getAnimations().forEach(Xe),a.underlay?.getAnimations().forEach(Ze),G(a)),t=null,a=null,H.setEnabled({enabled:!1}).catch(Qe),d.forEach($e)}},s=[n,i],t[0]=n,t[1]=i,t[2]=a,t[3]=s):(a=t[2],s=t[3]),v.useEffect(a,s)};function Ge(){}function Ke(e){return e.cancel()}function qe(e){return e.cancel()}function Je(e){return new Promise(t=>{let n=0,r=12,i=!1,a=()=>{i||(i=!0,c(),n&&window.cancelAnimationFrame(n),t())},o=()=>{let t=V.getTopRoute();return Be({surfaceConnected:e.surface.isConnected,routeToken:e.route.token,topRouteToken:t?.token??null,routeSurface:e.route.getSurface(),outgoingSurface:e.surface})},s=()=>{if(o()||r<=0){a();return}--r,n=window.requestAnimationFrame(s)},c=V.subscribe(()=>{o()&&a()});s()})}function Ye(){}function Xe(e){return e.cancel()}function Ze(e){return e.cancel()}function Qe(){}function $e(e){e.remove()}var q=null,J=()=>(q??=s(()=>import(`./MarkdownRendererImpl-Cp2Blr66.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])).catch(e=>{throw q=null,e}),q),et=()=>{J().catch(()=>void 0)},Y=v.createContext(!0),X=()=>v.useContext(Y),Z=t(),tt=R(()=>J().then(e=>({default:e.MarkdownRenderer}))),nt=R(()=>J().then(e=>({default:e.SimpleMarkdownRenderer}))),rt=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,Q=e=>{let t=(0,y.c)(14),n=typeof e.content==`string`?e.content:``,r=typeof e.variant==`string`?e.variant:`assistant`,i;t[0]!==n||t[1]!==e.reserveMeasuredHeight||t[2]!==r?(i=e.reserveMeasuredHeight?m(g(n,r)):void 0,t[0]=n,t[1]=e.reserveMeasuredHeight,t[2]=r,t[3]=i):i=t[3];let a=i,o;t[4]!==e.className||t[5]!==e.variant?(o=p(`relative break-words w-full min-w-0`,rt(e.variant),typeof e.className==`string`?e.className:void 0),t[4]=e.className,t[5]=e.variant,t[6]=o):o=t[6];let s;t[7]!==n||t[8]!==e.animated||t[9]!==a?(s=(0,Z.jsx)(h,{animated:e.animated,content:n,reservedHeight:a}),t[7]=n,t[8]=e.animated,t[9]=a,t[10]=s):s=t[10];let c;return t[11]!==o||t[12]!==s?(c=(0,Z.jsx)(`div`,{className:o,"aria-busy":`true`,"data-markdown-hydration":`deferred`,children:s}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c},it=e=>{let t=(0,y.c)(4);if(!X()&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Q,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,Z.jsx)(v.Suspense,{fallback:(0,Z.jsx)(Q,{...e,reserveMeasuredHeight:!0}),children:(0,Z.jsx)(tt,{...e})}),t[2]=e,t[3]=n),n},at=e=>{let t=(0,y.c)(4);if(!X()){let n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Q,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,Z.jsx)(v.Suspense,{fallback:(0,Z.jsx)(Q,{...e}),children:(0,Z.jsx)(nt,{...e})}),t[2]=e,t[3]=n),n},ot=e=>/^#[0-9a-fA-F]{6}$/.test(e),st=e=>/^#[0-9a-fA-F]{8}$/.test(e),ct=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?ot(e)?`${e}${t}`:st(e)?`${e.slice(0,7)}${t}`:e:e,$=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,lt=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>$(n[e],t);return[{name:`plain`,scope:[`source`,`support.type.property-name.css`],settings:{foreground:t.foreground}},{name:`classes`,scope:[`entity.name.type.class`],settings:{foreground:r(`className`,r(`class`,t.function))}},{name:`interfaces`,scope:[`entity.name.type.interface`,`entity.name.type`],settings:{foreground:r(`interface`,t.type)}},{name:`structs`,scope:[`entity.name.type.struct`],settings:{foreground:r(`struct`,t.function)}},{name:`enums`,scope:[`entity.name.type.enum`],settings:{foreground:r(`enum`,t.function)}},{name:`keys`,scope:[`meta.object-literal.key`,`support.type.property-name`],settings:{foreground:r(`key`,t.function)}},{name:`methods`,scope:[`entity.name.function.method`,`meta.function.method`],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`functions`,scope:[`entity.name.function`,`support.function`,`meta.function-call.generic`],settings:{foreground:t.function,fontStyle:`bold`}},{name:`variables`,scope:[`variable`,`meta.variable`,`variable.other.object.property`],settings:{foreground:t.variable}},{name:`variablesOther`,scope:[`variable.other.object`,`variable.other.readwrite.alias`],settings:{foreground:r(`variableOther`,r(`method`,e.colors.status.success))}},{name:`globalVariables`,scope:[`variable.other.global`,`variable.language.this`],settings:{foreground:r(`variableGlobal`,t.number)}},{name:`localVariables`,scope:[`variable.other.local`],settings:{foreground:r(`variableLocal`,e.colors.surface.elevated)}},{name:`parameters`,scope:[`variable.parameter`,`meta.parameter`],settings:{foreground:r(`parameter`,t.foreground)}},{name:`properties`,scope:[`variable.other.property`,`meta.property`],settings:{foreground:r(`variableProperty`,e.colors.status.info)}},{name:`strings`,scope:[`string`,`string.other.link`,`markup.inline.raw.string.markdown`],settings:{foreground:t.string}},{name:`stringEscapeSequences`,scope:[`constant.character.escape`,`constant.other.placeholder`],settings:{foreground:r(`stringEscape`,t.foreground)}},{name:`keywords`,scope:[`keyword`],settings:{foreground:t.keyword}},{name:`keywordsControl`,scope:[`keyword.control.import`,`keyword.control.from`,`keyword.import`],settings:{foreground:r(`keywordImport`,t.operator)}},{name:`storageModifiers`,scope:[`storage.modifier`,`keyword.modifier`,`storage.type`],settings:{foreground:r(`storageModifier`,t.keyword)}},{name:`comments`,scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:t.comment}},{name:`docComments`,scope:[`comment.documentation`,`comment.line.documentation`],settings:{foreground:r(`commentDoc`,e.colors.surface.mutedForeground)}},{name:`numbers`,scope:[`constant.numeric`],settings:{foreground:t.number}},{name:`booleans`,scope:[`constant.language`],settings:{foreground:r(`boolean`,t.type)}},{name:`operators`,scope:[`keyword.operator`],settings:{foreground:t.operator}},{name:`macros`,scope:[`entity.name.function.preprocessor`,`meta.preprocessor`],settings:{foreground:r(`macro`,t.keyword)}},{name:`preprocessor`,scope:[`meta.preprocessor`],settings:{foreground:r(`preprocessor`,r(`label`,t.number))}},{name:`urls`,scope:[`markup.underline.link`],settings:{foreground:r(`url`,e.colors.status.info)}},{name:`tags`,scope:[`entity.name.tag`],settings:{foreground:r(`tag`,t.keyword)}},{name:`jsxTags`,scope:[`support.class.component`],settings:{foreground:r(`jsxTag`,r(`label`,t.number))}},{name:`attributes`,scope:[`entity.other.attribute-name`,`meta.attribute`],settings:{foreground:r(`tagAttribute`,t.type)}},{name:`types`,scope:[`support.type`],settings:{foreground:t.type}},{name:`constants`,scope:[`variable.other.constant`,`variable.readonly`],settings:{foreground:r(`constant`,t.foreground)}},{name:`labels`,scope:[`entity.name.label`,`punctuation.definition.label`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`namespaces`,scope:[`entity.name.namespace`,`storage.modifier.namespace`,`markup.bold.markdown`],settings:{foreground:r(`namespace`,t.type)}},{name:`modules`,scope:[`entity.name.module`,`storage.modifier.module`],settings:{foreground:r(`module`,t.operator)}},{name:`typeParameters`,scope:[`variable.type.parameter`,`variable.parameter.type`],settings:{foreground:r(`typeParameter`,t.function)}},{name:`exceptions`,scope:[`keyword.control.exception`,`keyword.control.trycatch`],settings:{foreground:r(`exception`,r(`label`,t.number))}},{name:`decorators`,scope:[`meta.decorator`,`punctuation.decorator`,`entity.name.function.decorator`],settings:{foreground:r(`decorator`,t.type)}},{name:`calls`,scope:[`variable.function`],settings:{foreground:t.foreground}},{name:`punctuation`,scope:[`punctuation`,`punctuation.terminator`,`punctuation.definition.tag`,`punctuation.separator`,`punctuation.definition.string`,`punctuation.section.block`],settings:{foreground:r(`punctuation`,t.comment)}},{name:`yellow`,scope:[`storage.type.numeric.go`,`storage.type.byte.go`,`storage.type.boolean.go`,`storage.type.string.go`,`storage.type.uintptr.go`,`storage.type.error.go`,`storage.type.rune.go`,`constant.language.go`,`support.class.dart`,`keyword.other.documentation`,`storage.modifier.import.java`,`punctuation.definition.list.begin.markdown`,`punctuation.definition.quote.begin.markdown`,`meta.separator.markdown`,`entity.name.section.markdown`],settings:{foreground:t.type}},{name:`green`,scope:[],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`cyan`,scope:[`markup.italic.markdown`,`support.type.python`,`variable.legacy.builtin.python`,`support.constant.property-value.css`,`storage.modifier.attribute.swift`],settings:{foreground:t.string}},{name:`blue`,scope:[],settings:{foreground:t.keyword}},{name:`purple`,scope:[`keyword.channel.go`,`keyword.other.platform.os.swift`],settings:{foreground:t.number}},{name:`magenta`,scope:[`punctuation.definition.heading.markdown`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`red`,scope:[],settings:{foreground:t.operator}},{name:`orange`,scope:[],settings:{foreground:t.function}}]},ut=e=>{let t=e.colors.surface,n=e.colors.interactive,r=e.colors.status,i=e.colors.syntax.base,a=e.colors.syntax.highlights??{},o=$(a.diffAddedBackground,r.successBackground),s=$(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":$(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":ct(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":$(n.active,n.borderHover),"notifications.background":t.elevated,"editorInlayHint.typeBackground":t.subtle,"editorInlayHint.typeForeground":t.foreground,"editorWhitespace.foreground":n.borderHover,"editorIndentGuide.background1":t.subtle,"editorHoverWidget.background":t.elevated,"editorLineNumber.activeForeground":$(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":$(a.lineNumber,t.mutedForeground),"editorGutter.background":t.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":t.elevated,"editorBracketMatch.border":t.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":o,"diffEditor.removedTextBackground":s,"editorGroupHeader.tabsBackground":t.background,"editorGroup.border":n.border,"tab.activeBackground":t.background,"tab.inactiveBackground":t.muted,"tab.inactiveForeground":t.mutedForeground,"tab.activeForeground":t.foreground,"tab.hoverBackground":t.subtle,"tab.unfocusedHoverBackground":t.subtle,"tab.border":n.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":t.muted,"editorWidget.border":n.border,"editorSuggestWidget.background":t.background,"editorSuggestWidget.border":n.border,"editorSuggestWidget.foreground":t.foreground,"editorSuggestWidget.highlightForeground":t.mutedForeground,"editorSuggestWidget.selectedBackground":t.subtle,"peekView.border":n.border,"peekViewEditor.background":t.background,"peekViewEditor.matchHighlightBackground":t.subtle,"peekViewResult.background":t.muted,"peekViewResult.fileForeground":t.foreground,"peekViewResult.lineForeground":t.mutedForeground,"peekViewResult.matchHighlightBackground":t.subtle,"peekViewResult.selectionBackground":t.elevated,"peekViewResult.selectionForeground":t.mutedForeground,"peekViewTitle.background":t.subtle,"peekViewTitleDescription.foreground":t.mutedForeground,"peekViewTitleLabel.foreground":t.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":$(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":$(a.diffModified,r.info),"merge.border":n.border,"merge.commonContentBackground":t.subtle,"merge.commonHeaderBackground":t.muted,"panel.background":t.background,"panel.border":n.border,"panelTitle.activeBorder":n.borderHover,"panelTitle.activeForeground":t.foreground,"panelTitle.inactiveForeground":t.mutedForeground,"statusBar.background":t.background,"statusBar.foreground":t.foreground,"statusBar.border":n.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":t.subtle,"statusBar.noFolderForeground":t.mutedForeground,"titleBar.activeBackground":t.background,"titleBar.activeForeground":t.foreground,"titleBar.inactiveBackground":t.muted,"titleBar.inactiveForeground":t.mutedForeground,"titleBar.border":n.border,"menu.foreground":t.foreground,"menu.background":t.background,"menu.selectionForeground":t.foreground,"menu.selectionBackground":t.subtle,"menu.border":n.border,"editorInlayHint.foreground":t.mutedForeground,"editorInlayHint.background":t.subtle,"terminal.foreground":t.foreground,"terminal.background":t.background,"terminalCursor.foreground":t.foreground,"terminalCursor.background":t.background,"terminal.ansiRed":$(a.diffRemoved,r.error),"terminal.ansiGreen":$(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":$(a.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":t.background,"activityBar.foreground":t.foreground,"activityBar.inactiveForeground":t.mutedForeground,"activityBar.activeBorder":t.foreground,"activityBar.border":n.border,"sideBar.background":t.background,"sideBar.foreground":t.foreground,"sideBar.border":n.border,"sideBarTitle.foreground":t.foreground,"sideBarSectionHeader.background":t.muted,"sideBarSectionHeader.foreground":t.foreground,"sideBarSectionHeader.border":n.border,"sideBar.activeBackground":t.subtle,"sideBar.activeForeground":t.foreground,"sideBar.hoverBackground":t.muted,"sideBar.hoverForeground":t.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":t.subtle,"list.activeSelectionBackground":t.elevated,"list.inactiveSelectionForeground":t.foreground,"list.activeSelectionForeground":t.foreground,"list.hoverForeground":t.foreground,"list.hoverBackground":t.muted,"input.background":t.muted,"input.foreground":t.foreground,"input.border":n.border,"input.placeholderForeground":t.mutedForeground,"inputOption.activeBorder":n.border,"inputOption.activeBackground":t.elevated,"inputOption.activeForeground":t.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":t.muted,"dropdown.foreground":t.foreground,"dropdown.border":n.border,"dropdown.listBackground":t.background,"badge.background":e.colors.primary.base,"activityBarBadge.background":e.colors.primary.base,"button.background":e.colors.primary.base,"button.foreground":$(e.colors.primary.foreground,t.background),"badge.foreground":$(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":$(e.colors.primary.foreground,t.background)}};function dt(e){return{name:e.metadata.name,type:e.metadata.variant,colors:ut(e),tokenColors:lt(e)}}var ft=e=>/^#[0-9a-fA-F]{8}$/.test(e),pt=e=>ft(e)?e.slice(0,7):e;function mt(e,t){return Object.defineProperty(e,"toString",{value:()=>t,enumerable:!1,configurable:!0}),Object.defineProperty(e,Symbol.toPrimitive,{value:()=>t,enumerable:!1,configurable:!0}),e}var ht=new Map,gt=new Set,_t=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?pt(n):void 0,a=r?pt(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return mt({...e,name:t,fg:a,bg:i,settings:o},t)},vt=e=>dt(e),yt=e=>{let t=ht.get(e.metadata.id);if(t)return t;let n=_t(vt(e),e.metadata.id);return ht.set(e.metadata.id,n),n},bt=e=>{let t=e.metadata.id;if(gt.has(t))return;let n=yt(e);_(t,async()=>n),gt.add(t)};export{fe as C,Ee as D,Te as E,de as O,pe as S,ue as T,ae as _,Y as a,be as b,Re as c,Ae as d,M as f,xe as g,me as h,at as i,ve as k,We as l,ce as m,yt as n,et as o,le as p,it as r,V as s,bt as t,R as u,ne as v,oe as w,E as x,j as y};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,E as n,b as r,t as i,y as a}from"./useUIStore-Wyu09VUF.js";import{$t as o,D as s,d as c,k as l,ot as u,u as d,xn as f}from"./persistence-aCOlo6ew.js";import{a as p,i as m,r as h}from"./vendor-zustand-B4dlGEM2.js";import{nt as g,rt as _}from"./vendor-base-ui-CnHfUmDN.js";import{B as v,Ct as y,M as b,Mt as x}from"./platform-ulFAVx1H.js";import{n as S}from"./vendor-react-DLPElpoQ.js";import{s as C}from"./vendor-tanstack-react-query-D7pys_c9.js";import{n as ee}from"./vendor-reactuses-core-DDoDDyM9.js";import{n as te}from"./clipboard-C7zcAKyC.js";import{To as w,_ as ne,_r as re,b as ie,co as ae,ct as oe,dt as T,l as E,oa as se,ot as D,pn as ce,rn as le,st as ue,ut as O,wo as de}from"./useMobileNavigationStore-DGjylwfn.js";import{c as fe,t as k}from"./utils-CJdWZupK.js";import{n as A,r as j,t as M}from"./Icon-Bs6GJIoO.js";import{g as N,v as P}from"./gitApi-5E8Bk0aK.js";import{A as pe,M as me,p as he,s as ge}from"./projectMeta-8HtwDMhW.js";var F=e(_(),1),I=S(),L=e=>{switch(e.name){case`new`:return`add`;case`init`:return`file`;case`undo`:return`arrow-go-back`;case`redo`:return`arrow-go-forward`;case`timeline`:return`time`;case`compact`:return`scissors`;case`goal`:return`target`;case`review`:return`search-eye`;case`test`:case`build`:case`run`:return`terminal-box`;default:return e.isBuiltIn?`flashlight`:`command`}},R=()=>`book-open`,_e=e=>{if(e.isDirectory)return`folder-3-fill`;switch(e.extension?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:case`json`:return`code`;case`md`:case`mdx`:return`file`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:return`file-image`;default:return`file-pdf`}},z=()=>`ai-agent`,B=()=>`chat-thread`,V=32,H=(e,t)=>{let n=j[e];return typeof n!=`string`||n.length===0?null:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="${M}" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`},ve=(e,t)=>{let n=H(e,t);return!n||typeof document>`u`?Promise.resolve(null):new Promise(e=>{let t=new Image;t.decoding=`async`,t.onload=()=>{try{let n=document.createElement(`canvas`);n.width=V,n.height=V;let r=n.getContext(`2d`);if(!r){e(null);return}r.clearRect(0,0,V,V),r.drawImage(t,0,0,V,V);let i=n.toDataURL(`image/png`),a=i.indexOf(`,`);e(a>=0?i.slice(a+1):null)}catch{e(null)}},t.onerror=()=>e(null),t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`})},ye=(e,t)=>e.map(e=>{let n=e.isSkill?t.skill:e.isOpenChamber?`OpenChamber`:e.isBuiltIn?t.system:e.scope||e.agent||t.command;return{id:e.id,title:`/${e.name}`,subtitle:e.description,badge:n,iconName:L(e)}}),be=e=>e.map(e=>({id:`${e.name}-${e.scope}`,title:e.name,subtitle:e.description,badge:e.scope,iconName:R()})),xe=({agents:e,sessions:t,recentFiles:n,pathHits:r,untitledSession:i,sessionBadge:a})=>{let o=[];for(let t of e)o.push({id:`agent:${t.name}`,title:`@${t.name}`,subtitle:t.description,iconName:z()});for(let e of t)o.push({id:`session:${e.id}`,title:e.title||i,badge:a,iconName:B()});for(let e of n)o.push({id:`recent:${e.path}`,title:e.relativePath||e.name,iconName:_e(e)});for(let e of r)o.push({id:`file:${e.path}`,title:e.relativePath||e.name,iconName:_e(e)});return o},Se=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=T([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},U=(e,t)=>{if(!e.includes(`/`)||t.size===0)return[];let n=RegExp(`(^|\\s)/(${u})?([A-Za-z0-9][A-Za-z0-9_-]*)(?=$|\\s)`,`g`),r=[],i;for(;(i=n.exec(e))!==null;){let e=i[3]??``;if(!t.has(e.toLowerCase()))continue;let n=i[2]??``,a=i.index+(i[1]?.length??0);r.push({start:a,end:a+1+n.length+e.length,name:e,hasSlot:n.length>0})}return r},W=(e,t,n=e.length)=>{let r=U(e,t).filter(e=>!e.hasSlot);if(r.length===0)return null;let i=e,a=n;for(let e=r.length-1;e>=0;--e){let t=r[e].start+1;i=`${i.slice(0,t)}${u}${i.slice(t)}`,a>t&&(a+=u.length)}return i===e?null:{text:i,caret:a}},G=e=>e.startsWith(u)?e.slice(u.length):e,K=e=>{if(e.inputMode===`shell`)return null;let t=e.text,n=Math.max(0,Math.min(e.cursor,t.length));if(t.startsWith(`/`)){let e=t.indexOf(` `),r=t.indexOf(`
|
|
2
|
-
`),i=Math.min(e===-1?t.length:e,r===-1?t.length:r);if(n<=i&&e===-1)return{kind:`slash-command`,query:G(t.substring(1,i)),tokenStart:0,tokenEnd:i}}let r=t.substring(0,n),i=r.lastIndexOf(`/`);if(i!==-1){let e=i>0?r[i-1]:null,t=G(r.substring(i+1)),a=t.includes(` `)||t.includes(`
|
|
3
|
-
`);if((!e||/\s/.test(e))&&!a)return{kind:`slash-skill`,query:t,tokenStart:i,tokenEnd:n}}let a=r.lastIndexOf(`#`);if(a!==-1){let e=a>0?r[a-1]:null,t=r.substring(a+1);if((!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
4
|
-
`))return{kind:`snippet`,query:t,tokenStart:a,tokenEnd:n}}let o=D({value:t,cursorPosition:n,inputSource:e.mentionInputSource??`manual`,insertedText:e.insertedText});return o===null?null:{kind:`mention`,query:o,tokenStart:r.lastIndexOf(`@`),tokenEnd:n}},q=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},J=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,Y=(e,t)=>{let n=q(t),r=q(e);if(!n||!r)return!1;let i=J(n),a=J(r);return a===i||a.startsWith(`${i}/`)},Ce=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=q(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>q(e)).filter(e=>Y(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>q(e)).filter(e=>Y(e,t)))):[],s=typeof i.selectedPath==`string`?q(i.selectedPath):null,c=s&&Y(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o]));n[t]={openPaths:e,selectedPath:u.selectedPath??c??e[0]??null,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},X=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},we=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Te=p()(h(m((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=q((t||``).trim()),a=q((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!Y(a,i)||e(e=>{let t=e.byRoot[i],n=we(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:X({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=q((t||``).trim()),i=q((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=J(i),a=e=>J(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:X({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=q((t||``).trim()),i=q((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=J(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=J(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:X({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=q((t||``).trim()),i=q((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=J(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=J(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:X({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=q((t||``).trim()),a=n?q(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!Y(a,i)||e(e=>{let t=e.byRoot[i],n=we(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:X({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=q((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=q((t||``).trim()),i=q((n||``).trim());!r||!i||!Y(i,r)||e(e=>{let t=e.byRoot[r],n=we(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:X({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=q((t||``).trim()),i=q((n||``).trim());!r||!i||!Y(i,r)||e(e=>{let t=e.byRoot[r],n=we(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:X({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=q((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>q((e||``).trim())).filter(e=>e&&Y(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=we(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:X({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:a(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Ce(t)}},partialize:e=>({byRoot:Ce(e.byRoot)})}),{name:`files-view-tabs-store`})),Ee=(e,t)=>{let n=(0,I.c)(4),r=t===void 0?200:t,[i,a]=F.useState(e),o,s;return n[0]!==r||n[1]!==e?(o=()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},s=[e,r],n[0]=r,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),F.useEffect(o,s),i},De=()=>{let e=(0,I.c)(17),t=E(Oe),n=ce(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=ie(r),a=E(ke),o=E(Ae),s=w(je),c=w(Me),l=y(Ne);if(t){let r;e[2]===i?r=e[3]:(r=ne(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return l??void 0};function Oe(e){return e.currentSessionId}function ke(e){return e.worktreeMetadata}function Ae(e){return e.newSessionDraft}function je(e){return e.activeProjectId}function Me(e){return e.projects}function Ne(e){return e.currentDirectory}var Pe=.4,Fe=8,Ie=e=>{let t=e.gap??Fe,n=Math.max(0,e.popupBottom-e.boundaryTop-t),r=e.viewportHeight*Pe,i=Math.floor(Math.min(n,r));return n>=120?Math.min(n,Math.max(120,i)):i},Le=(e,t=0)=>{let n=e.closest(`main`);if(!n)return null;let r=(e.closest(`.mobile-chat-screen__content`)?.parentElement??n.parentElement?.closest(`main`)??n).querySelector(`:scope > .oc-mobile-detail-navigation`)?.getBoundingClientRect().bottom,i=n.getBoundingClientRect().top;return Math.max(r===void 0?i:Math.max(r,i),t)},Re=(e,t)=>{let n=(0,I.c)(3),[r,i]=F.useState(void 0),a;return n[0]!==e||n[1]!==t?(a=()=>{if(!t)return;let n=()=>{let t=e.current;if(!t)return;let n=window.visualViewport,r=Le(t,n?.offsetTop??0);if(r===null)return;let a=n?.height??window.innerHeight,o=Ie({popupBottom:t.getBoundingClientRect().bottom,boundaryTop:r,viewportHeight:a});i(e=>e===o?e:o)};return n(),window.addEventListener(`resize`,n),window.addEventListener(`oc:keyboard-settled`,n),window.visualViewport?.addEventListener(`resize`,n),window.visualViewport?.addEventListener(`scroll`,n),()=>{window.removeEventListener(`resize`,n),window.removeEventListener(`oc:keyboard-settled`,n),window.visualViewport?.removeEventListener(`resize`,n),window.visualViewport?.removeEventListener(`scroll`,n)}},n[0]=e,n[1]=t,n[2]=a):a=n[2],F.useLayoutEffect(a),t?r:void 0},ze=()=>{let e=null,t=!1,n=!1;return{pointerDown:(n,r)=>{e={x:n,y:r},t=!1},pointerMove:(n,r)=>{e&&Math.hypot(n-e.x,r-e.y)>6&&(t=!0)},pointerCancel:()=>{e=null,t=!1},pointerUp:r=>{if(!e)return!1;let i=!t;return e=null,t=!1,i?(n=!0,r(),!0):(n=!0,!1)},click:e=>n?(n=!1,!1):(e(),!0)}},Z=g(),Be=F.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSessionSelect:r,onClose:a,style:o,onRowsChange:c},u)=>{let{t:d}=te(),f=De()??``,p=E(e=>e.currentSessionId),m=re(e=>e.activeSessions),h=w(e=>e.activeProjectId),g=w(e=>e.projects),_=F.useMemo(()=>g.find(e=>e.id===h)?.path??null,[h,g]),v=F.useMemo(()=>{let e=_||f;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[_,f]),y=Te(e=>v?e.byRoot[v]:void 0),b=se(e=>e.getVisibleAgents),S=x(e=>e.searchFiles),C=Ee(e,180),ne=l(),ie=s(),[ae,T]=F.useState([]),[D,ce]=F.useState([]),[le,de]=F.useState(!1),[j,M]=F.useState(0),N=F.useRef(0),[P,me]=F.useState(360),[he,ge]=F.useState({}),[I,L]=F.useState({}),R=F.useRef([]),z=F.useRef([]),B=F.useRef([]),V=F.useRef(null),H=F.useRef(null);H.current||=ze();let ve=i(e=>e.isMobile),ye=Re(V,ve),be=(e??``).trim(),Se=F.useMemo(()=>{if(!v||!y)return[];let e=[y.selectedPath,...y.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=be.toLowerCase();return e.filter(e=>{if(t.has(e))return!1;t.add(e);let r=e.startsWith(`${v}/`)?e.slice(v.length+1):e;return!n||r.toLowerCase().includes(n)}).slice(0,6).map(e=>{let t=e.replace(/\\/g,`/`),n=t.split(`/`).filter(Boolean).pop()||t;return{name:n,path:t,relativePath:t.startsWith(`${v}/`)?t.slice(v.length+1):t,extension:n.includes(`.`)?n.split(`.`).pop()?.toLowerCase():void 0}})},[be,v,y]),U=F.useMemo(()=>be.length>0?D:D.slice(0,2),[D,be.length]),W=F.useMemo(()=>r?ue({sessions:m,currentSessionId:p,searchQuery:be}):[],[m,p,be,r]),G=Se,K=ae;F.useEffect(()=>{let e=e=>{let t=e.target;!t||!V.current||V.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),F.useEffect(()=>{if(!f){T([]);return}let e=(C??``).trim(),t=O(e);if(!t){T([]);return}let n=!1;de(!0);let r={includeHidden:ne,respectGitignore:!ie};return Promise.all([S(f,t,80,{...r,type:`file`}),S(f,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Se.map(e=>e.path));T(oe({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||T([])}).finally(()=>{n||de(!1)}),()=>{n=!0}},[f,C,Se,S,ne,ie]),F.useEffect(()=>{let t=b(),n=(e??``).trim().toLowerCase(),r=t.filter(e=>e.mode&&e.mode!==`primary`).filter(e=>!n||`${e.name} ${e.description??``}`.toLowerCase().includes(n)).map(e=>({name:e.name,description:e.description,mode:e.mode})).sort((e,t)=>e.name.localeCompare(t.name));ce(r)},[b,e]),F.useEffect(()=>{M(0),ge({}),L({})},[K,G.length,U.length,W.length]),F.useEffect(()=>{N.current=j},[j]),F.useEffect(()=>{R.current[j]?.scrollIntoView({block:`nearest`})},[j]),F.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};z.current.forEach((n,r)=>{if(!n)return;let i=B.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),ge(e),L(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[K,G]),F.useEffect(()=>{let e=z.current[j];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&me(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[j]);let q=ee(e=>{t(e)}),J=ee(e=>{n?.(e)}),Y=ee(e=>{r?.(e)}),Ce=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&H.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&H.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(H.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>H.current?.pointerCancel(),onClick:()=>{H.current?.click(t)},onMouseMove:()=>M(e)}),X=e=>{let t=U.length+W.length+G.length+K.length;if(t===0)return;let n=(e%t+t)%t;if(n<U.length){let e=U[n];e&&J(e.name);return}let r=n-U.length;if(r<W.length){let e=W[r];e&&Y(e);return}let i=r-W.length,a=i<G.length?G[i]:K[i-G.length];a&&q(a)};F.useEffect(()=>{c?.({rows:xe({agents:U,sessions:W,recentFiles:G,pathHits:K,untitledSession:d(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:d(`chat.fileMentionAutocomplete.sessionType`)}),highlightedIndex:j})},[c,j,d,U,K,G,W]),F.useEffect(()=>()=>{c?.({rows:[],highlightedIndex:0})},[c]),F.useImperativeHandle(u,()=>({acceptIndex:e=>{X(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=U.length+W.length+G.length+K.length;if(t!==0){if(e===`ArrowDown`){M(e=>(e+1)%t);return}if(e===`ArrowUp`){M(e=>(e-1+t)%t);return}(e===`Enter`||e===`Tab`)&&X(N.current)}}}),[K,G,U,W,a,q,J,Y]);let we=e=>(0,Z.jsx)(A,{name:_e(e),className:`h-3.5 w-3.5 text-current`});return(0,Z.jsxs)(`div`,{ref:V,className:`absolute z-[100] min-w-0 w-full max-w-[640px] max-h-64 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:ye===void 0?o:{...o,maxHeight:ye},children:[(0,Z.jsx)(pe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,Z.jsxs)(`div`,{className:`pb-2`,children:[U.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.agents`)}),U.map((e,t)=>(0,Z.jsx)(`div`,{ref:e=>{R.current[t]=e},className:k(`flex items-start gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,ve&&`min-h-11`,j===t&&`bg-interactive-selection text-interactive-selection-foreground`),...Ce(t,()=>J(e.name)),children:(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`font-semibold truncate`,children:[`@`,e.name]}),e.description&&!ve?(0,Z.jsx)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:e.description}):null]})},`agent-${e.name}`)),U.length===2&&be.length===0&&D.length>2&&(0,Z.jsx)(`div`,{className:`px-3 py-1 typography-meta text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.searchMoreAgents`)}),W.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.sessions`)}),W.map((e,t)=>{let n=U.length+t;return(0,Z.jsxs)(`div`,{ref:e=>{R.current[n]=e},className:k(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,ve&&`min-h-11`,j===n&&`bg-interactive-selection text-interactive-selection-foreground`),...Ce(n,()=>Y(e)),children:[(0,Z.jsx)(A,{name:`chat-thread`,className:`h-4 w-4 flex-shrink-0 text-[var(--primary-base)]`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title||d(`chat.fileMentionAutocomplete.untitledSession`),children:e.title||d(`chat.fileMentionAutocomplete.untitledSession`)}),ve?null:(0,Z.jsx)(`span`,{className:`flex-shrink-0 typography-meta text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.sessionType`)})]},`session-${e.id}`)}),G.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.recentFiles`)}),G.map((e,t)=>{let n=U.length+W.length+t,r=e.relativePath||e.name,i=fe(r,{maxLength:60}),a=j===n,o=he[n]??!1,s=I[n]??2.6;return(0,Z.jsxs)(`div`,{ref:e=>{R.current[n]=e},className:k(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,ve&&`min-h-11`,a&&`bg-interactive-selection text-interactive-selection-foreground`),...Ce(n,()=>q(e)),children:[we(e),(0,Z.jsxs)(`span`,{ref:e=>{z.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${P}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,Z.jsx)(`span`,{ref:e=>{B.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,Z.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,Z.jsx)(`span`,{className:`block truncate`,children:i})]})]},`recent-${e.path}`)}),K.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.files`)}),K.map((e,t)=>{let n=U.length+W.length+G.length+t,r=e.relativePath||e.name,i=fe(r,{maxLength:60}),a=j===n,o=he[n]??!1,s=I[n]??2.6;return(0,Z.jsxs)(`div`,{ref:e=>{R.current[n]=e},className:k(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,ve&&`min-h-11`,a&&`bg-interactive-selection text-interactive-selection-foreground`),...Ce(n,()=>q(e)),children:[we(e),(0,Z.jsxs)(`span`,{ref:e=>{z.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${P}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,Z.jsx)(`span`,{ref:e=>{B.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,Z.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,Z.jsx)(`span`,{className:`block truncate`,children:i})]})]},e.path)}),le&&K.length===0?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,Z.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!le&&K.length===0&&G.length===0&&U.length===0&&W.length===0&&(0,Z.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.empty`)})]})}),!ve&&(0,Z.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:d(`chat.autocomplete.keyboardHint`)})]})}),Ve=new Set([`new`,`fork`,`compact`,`undo`,`redo`,`model`,`goal`]),He=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&Ve.has(n))},Ue=(e,t)=>!e||t({name:e}),We=` `,Ge=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===We&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Ke=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,qe=k(Ke,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),Je=k(Ke,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),Ye=k(Ke,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),Xe=k(Ke,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),Ze=(e,t)=>{let n=!!e.sessionID;return{hasSession:n,canStartSessionCommand:n||e.hasNewDraft,canUseReviewHandoffFlow:n&&!t&&!o()}},Qe=F.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:r,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=te(),d=i(e=>e.isMobile),f=E(e=>e.currentSessionId),p=E(e=>!!e.newSessionDraft?.open),m=E(F.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),h=le(f??``,m??void 0),g=F.useMemo(()=>s??{sessionID:f??null,hasMessages:h.length>0,hasNewDraft:p},[s,f,h.length,p]),{hasSession:_,canStartSessionCommand:v,canUseReviewHandoffFlow:y}=F.useMemo(()=>Ze(g,d),[g,d]),b=g.hasMessages,[x,S]=F.useState([]),[C,ee]=F.useState(!1),w=de({directory:r}),ne=F.useMemo(()=>w.data??[],[w.data]),re=w.isFetching,ie=ae({directory:r}),oe=F.useMemo(()=>ie.data??[],[ie.data]),[T,se]=F.useState(0),D=F.useRef(0),ce=F.useRef(!1),ue=F.useRef([]),O=F.useRef(null),fe=Re(O,d),j=F.useRef(!1),M=F.useRef(null),N=F.useRef(!1);F.useEffect(()=>{let e=e=>{let t=e.target;!t||!O.current||O.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),F.useEffect(()=>{(async()=>{ee(re);try{let t=ne.map((e,t)=>({id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,isSkill:e.source===`skill`,scope:e.scope,reference:e.reference})),n=oe.map((e,t)=>({id:`skill:${e.scope}:${e.source??`opencode`}:${e.name}:${t}`,name:e.name,source:`skill`,description:e.description,isSkill:!0,scope:e.scope})),r=[{id:`openchamber:new`,name:`new`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},..._?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...y?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:plan-feature`,name:`plan-feature`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.featurePlanDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:u(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],...v?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[],...t,...n],i=!b,a=r.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0));S(Se(a,e))}catch{let t=!b,n=[{id:`openchamber:new`,name:`new`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},..._?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...y?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:plan-feature`,name:`plan-feature`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.featurePlanDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:u(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],...v?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0));S(Se(n,e))}finally{ee(!1)}})()},[e,b,_,v,y,ne,re,oe,u,o]),F.useEffect(()=>{se(0)},[x]),F.useEffect(()=>{D.current=T},[T]),F.useEffect(()=>{ue.current[T]?.scrollIntoView({block:`nearest`})},[T]),F.useEffect(()=>{c?.({rows:ye(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:T})},[x,c,T,u]),F.useEffect(()=>()=>{c?.({rows:[],highlightedIndex:0})},[c]),F.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,He(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){ce.current=!0,se(e=>(e+1)%r);return}if(e===`ArrowUp`){ce.current=!0,se(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(D.current%r+r)%r,i=x[n];i&&t(i,He(i,e===`Enter`))}}}}),[x,n,t]);let P=e=>{let t=L(e);switch(e.name){case`new`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,Z.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,Z.jsxs)(`div`,{ref:O,className:`absolute z-[100] min-w-0 w-full max-w-[450px] max-h-64 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:fe===void 0?a:{...a,maxHeight:fe},children:[(0,Z.jsx)(pe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:C?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,Z.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,Z.jsxs)(`div`,{children:[x.map((e,n)=>{let r=e.isBuiltIn,i=e.isOpenChamber;return(0,Z.jsxs)(`div`,{ref:e=>{ue.current[n]=e},className:k(`flex gap-2 px-3 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,n===T&&`bg-interactive-selection`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(M.current={x:e.clientX,y:e.clientY},N.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!M.current)return;let t=e.clientX-M.current.x,n=e.clientY-M.current.y;Math.hypot(t,n)>6&&(N.current=!0)},onPointerUp:n=>{if(n.pointerType!==`touch`)return;let r=N.current;M.current=null,N.current=!1,!r&&(n.preventDefault(),n.stopPropagation(),j.current=!0,t(e,He(e,d)))},onPointerCancel:()=>{M.current=null,N.current=!1},onClick:()=>{if(j.current){j.current=!1;return}t(e,He(e,d))},onMouseMove:()=>{ce.current=!1,se(n)},children:[(0,Z.jsx)(`div`,{className:k(!d&&`mt-0.5`),children:P(e)}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,e.name]}),e.isSkill?(0,Z.jsx)(`span`,{className:qe,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,Z.jsx)(`span`,{className:qe,children:u(`chat.commandAutocomplete.badge.command`)}),i?(0,Z.jsx)(`span`,{className:Xe,children:`OpenChamber`}):r?(0,Z.jsx)(`span`,{className:Xe,children:u(`chat.commandAutocomplete.badge.system`)}):e.scope?(0,Z.jsx)(`span`,{className:e.scope===`project`?Ye:Je,children:e.scope}):null,e.agent&&(0,Z.jsx)(`span`,{className:Xe,children:e.agent})]}),e.description&&!d&&(0,Z.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:e.description})]})]},e.id)}),x.length===0&&(0,Z.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,Z.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Qe.displayName=`CommandAutocomplete`;function $e(e){return(e.description||e.content).replace(/\s+/g,` `).trim().slice(0,120)}var et=F.forwardRef((e,t)=>{let n=(0,I.c)(63),{searchQuery:r,onSnippetSelect:a,onClose:o,style:s}=e,{t:c}=te(),l=F.useRef(null),u=i(tt),d=Re(l,u),[f,p]=F.useState(0),m=F.useRef(0),h;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],n[0]=h):h=n[0];let[g,_]=F.useState(h),v;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],n[1]=v):v=n[1];let y=F.useRef(v),b=me(nt),x=me(rt),S=me(it),C=me(at),ee=i(ot),w=i(st),ne,re;n[2]===x?(ne=n[3],re=n[4]):(ne=()=>{x()},re=[x],n[2]=x,n[3]=ne,n[4]=re),F.useEffect(ne,re);let ie,ae;n[5]!==r||n[6]!==b?(ie=()=>{let e=r.trim();if(!e.length){let e=[...b].sort(ct);_(e),p(+!!e.length);return}let t=T(b,e,lt);t.sort(ut);let n=t.map(dt);_(n),p(+!!n.length)},ae=[r,b],n[5]=r,n[6]=b,n[7]=ie,n[8]=ae):(ie=n[7],ae=n[8]),F.useEffect(ie,ae);let oe,E;n[9]===f?(oe=n[10],E=n[11]):(oe=()=>{m.current=f,y.current[f]?.scrollIntoView({block:`nearest`})},E=[f],n[9]=f,n[10]=oe,n[11]=E),F.useEffect(oe,E);let se,D;n[12]===o?(se=n[13],D=n[14]):(D=()=>{let e=e=>{let t=e.target;t&&l.current&&!l.current.contains(t)&&o()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},se=[o],n[12]=o,n[13]=se,n[14]=D),F.useEffect(D,se);let ce;n[15]!==a||n[16]!==r?(ce=e=>{let t=r.trim(),n=e.aliases.includes(t)?t:e.name;a(e,n)},n[15]=a,n[16]=r,n[17]=ce):ce=n[17];let le=ce,ue;n[18]!==o||n[19]!==C||n[20]!==ee||n[21]!==w||n[22]!==S||n[23]!==b?(ue=()=>{let e=new Set(b.map(ft)),t=`new-snippet`,n=1;for(;e.has(t);)t=`new-snippet-${n++}`;S({name:t,scope:`global`}),C(t),w(`snippets`),ee(!0),o()},n[18]=o,n[19]=C,n[20]=ee,n[21]=w,n[22]=S,n[23]=b,n[24]=ue):ue=n[24];let O=ue,de,fe;n[25]!==le||n[26]!==g||n[27]!==o||n[28]!==O?(de=()=>({handleKeyDown:e=>{if(e===`Escape`){o();return}let t=g.length+1;if(e===`ArrowDown`){p(e=>(e+1)%t);return}if(e===`ArrowUp`){p(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){if(m.current===0){O();return}let e=g[m.current-1];e&&le(e)}}}),fe=[le,g,o,O],n[25]=le,n[26]=g,n[27]=o,n[28]=O,n[29]=de,n[30]=fe):(de=n[29],fe=n[30]),F.useImperativeHandle(t,de,fe);let j;n[31]!==d||n[32]!==s?(j=d===void 0?s:{...s,maxHeight:d},n[31]=d,n[32]=s,n[33]=j):j=n[33];let M;n[34]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{y.current[0]=e},n[34]=M):M=n[34];let N=f===0&&`bg-interactive-selection`,P;n[35]===N?P=n[36]:(P=k(`flex items-center gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,N),n[35]=N,n[36]=P);let he,ge;n[37]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>p(0),ge=(0,Z.jsx)(A,{name:`add`,className:`h-3.5 w-3.5 text-muted-foreground`}),n[37]=he,n[38]=ge):(he=n[37],ge=n[38]);let L;n[39]===c?L=n[40]:(L=c(`chat.snippetAutocomplete.action.addNew`),n[39]=c,n[40]=L);let R;n[41]===L?R=n[42]:(R=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:L}),n[41]=L,n[42]=R);let _e;n[43]!==O||n[44]!==P||n[45]!==R?(_e=(0,Z.jsxs)(`div`,{ref:M,className:P,onClick:O,onMouseMove:he,children:[ge,R]}),n[43]=O,n[44]=P,n[45]=R,n[46]=_e):_e=n[46];let z;n[47]!==le||n[48]!==g||n[49]!==u||n[50]!==f||n[51]!==c?(z=g.length?g.map((e,t)=>(0,Z.jsx)(`div`,{ref:e=>{y.current[t+1]=e},className:k(`flex gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,u?`items-center`:`items-start`,t+1===f&&`bg-interactive-selection`),onClick:()=>le(e),onMouseMove:()=>p(t+1),children:(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`font-semibold truncate`,children:[`#`,e.name]}),(0,Z.jsx)(`span`,{className:`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0 bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`,children:c(`snippets.source.${e.source}`)})]}),!u&&(0,Z.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:$e(e)})]})},`${e.source}:${e.filePath}`)):(0,Z.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:c(`chat.snippetAutocomplete.empty`)}),n[47]=le,n[48]=g,n[49]=u,n[50]=f,n[51]=c,n[52]=z):z=n[52];let B;n[53]!==_e||n[54]!==z?(B=(0,Z.jsxs)(pe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:[_e,z]}),n[53]=_e,n[54]=z,n[55]=B):B=n[55];let V;n[56]!==u||n[57]!==c?(V=!u&&(0,Z.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:c(`chat.snippetAutocomplete.footer`)}),n[56]=u,n[57]=c,n[58]=V):V=n[58];let H;return n[59]!==j||n[60]!==B||n[61]!==V?(H=(0,Z.jsxs)(`div`,{ref:l,className:`absolute z-[100] min-w-0 w-full max-w-[450px] max-h-60 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:j,children:[B,V]}),n[59]=j,n[60]=B,n[61]=V,n[62]=H):H=n[62],H});et.displayName=`SnippetAutocomplete`;function tt(e){return e.isMobile}function nt(e){return e.snippets}function rt(e){return e.loadSnippets}function it(e){return e.setSnippetDraft}function at(e){return e.setSelectedSnippet}function ot(e){return e.setSettingsDialogOpen}function st(e){return e.setSettingsPage}function ct(e,t){return e.source===`project`&&t.source!==`project`?-1:e.source!==`project`&&t.source===`project`?1:e.name.localeCompare(t.name)}function lt(e){return[e.name,...e.aliases]}function ut(e,t){return e.score===t.score?e.item.source===`project`&&t.item.source!==`project`?-1:e.item.source!==`project`&&t.item.source===`project`?1:e.item.name.localeCompare(t.item.name):e.score-t.score}function dt(e){return e.item}function ft(e){return e.name}var pt=2,mt=e=>!!e&&typeof e==`object`&&!Array.isArray(e),ht=e=>{let t=e?.trim().replace(/\\/g,`/`);return t?t.length>1?t.replace(/\/+$/,``):t:null},gt=e=>mt(e)&&Array.isArray(e.all)&&e.all.every(e=>typeof e==`string`)&&typeof e.current==`string`&&mt(e.branches),_t=(e,t)=>JSON.stringify([e,t]),vt=e=>`version`in e&&e.version===pt&&mt(e.entries),yt=e=>{if(!e)return null;try{let t=JSON.parse(e);return mt(t)?t.version===pt&&mt(t.entries)?{version:pt,entries:t.entries}:t:null}catch{return null}},bt=(e,t)=>{try{e.setItem(`oc.gitBranchCache`,JSON.stringify(t))}catch{}},xt=(e,t,n)=>{let r=ht(e);if(!r||!t)return null;let i;try{i=n.getItem(`oc.gitBranchCache`)}catch{return null}let a=yt(i);if(!a)return null;if(vt(a))return gt(a.entries[_t(t,r)])?a.entries[_t(t,r)]:null;let o={};for(let[e,n]of Object.entries(a)){let r=ht(e);r&>(n)&&(o[_t(t,r)]=n)}return bt(n,{version:pt,entries:o}),o[_t(t,r)]??null},St=(e,t,n,r)=>{let i=ht(e);if(!i||!t||!gt(n))return;let a=null;try{a=r.getItem(`oc.gitBranchCache`)}catch{return}let o=yt(a);bt(r,{version:pt,entries:{...o&&vt(o)?o.entries:{},[_t(t,i)]:n}})},Ct=3e4,wt=ht,Tt=(e,t=n())=>c.git.branches(wt(e),t),Et=(e,t=n())=>c.git.remotes(wt(e),t),Dt=async(e,t,n)=>{n.throwIfAborted();let r=f()?.git,i=t?.getGitBranches?await t.getGitBranches(e,{signal:n}):r?await r.getGitBranches(e,{signal:n}):await b(e,{signal:n});return n.throwIfAborted(),i},Ot=async(e,t,n)=>{n.throwIfAborted();let r=f()?.git,i=t?.getRemotes?await t.getRemotes(e,{signal:n}):r?await r.getRemotes(e,{signal:n}):await v(e,{signal:n});return n.throwIfAborted(),i},kt=(e,t,i=n(),a=r())=>{let o=wt(e),s=t;return{queryKey:Tt(o,i),queryFn:async({signal:e})=>{if(!o)throw Error(`Git branches require a directory`);let t=await Dt(o,s,e);return St(o,i,t,a),t},staleTime:Ct,gcTime:1/0,initialData:()=>xt(o,i,a)??void 0,initialDataUpdatedAt:0}},At=(e,t,r=n())=>{let i=wt(e),a=t;return{queryKey:Et(i,r),queryFn:({signal:e})=>{if(!i)throw Error(`Git remotes require a directory`);return Ot(i,a,e)},staleTime:Ct,gcTime:1/0}},jt=(e,r,i)=>{let a=(0,I.c)(9),o=i===void 0||i,s=F.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=wt(e),u=C,l=kt(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},Mt=(e,r,i)=>{let a=(0,I.c)(9),o=i===void 0||i,s=F.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=wt(e),u=C,l=At(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},Nt=(e,t,r=d,i=n())=>r.fetchQuery(kt(e,t,i)),Pt=(e,t,r=d,i=n())=>r.fetchQuery({...kt(e,t,i),staleTime:0}),Ft=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,It=1e4,Lt=6e4,Rt=5e3,zt=3e4,Bt=6e4,Vt=25,Ht=40,Ut=2,Wt=15e3,Gt=500,Kt=30,qt=20971520,Jt=new Map,Yt=new Map,Xt=new Map,Zt=new Map,Qt=new Map,$t=(e,t)=>`${t}:${e}`,en=e=>Yt.get(e)??0,tn=e=>{let t=en(e)+1;return Yt.set(e,t),t},nn=e=>{let t=(Xt.get(e)??0)+1;return Xt.set(e,t),t},rn=e=>{let t=Jt.get(e);if(t)return t;let n=new Set;return Jt.set(e,n),n},Q=()=>({isGitRepo:null,status:null,branches:null,branchesTransportIdentity:null,log:null,identity:null,diffCache:new Map,indexRevision:0,lastRepoCheckAt:0,lastStatusFetch:0,lastStatusChange:0,lastLogFetch:0,lastBranchesFetch:0,lastIdentityFetch:0,logMaxCount:25,isLoadingStatus:!1,isLoadingLog:!1,isLoadingBranches:!1,isLoadingIdentity:!1}),an=(e,t=Kt,n=qt)=>{let r=0;for(let t of e.values())r+=(t.original?.length??0)+(t.modified?.length??0);if(e.size<=t&&r<=n)return e;let i=Array.from(e.entries()).sort((e,t)=>e[1].fetchedAt-t[1].fetchedAt),a=new Map,o=0;for(let e=i.length-1;e>=0;e--){let[r,s]=i[e],c=(s.original?.length??0)+(s.modified?.length??0);if(a.size>=t)break;o+c>n&&a.size>0||(a.set(r,s),o+=c)}return a},on=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(!(!n&&!i)&&(!n||!i||n.insertions!==i.insertions||n.deletions!==i.deletions))return!0}return!1},sn=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,cn=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[];if(n.length!==r.length||e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&sn(e.upstreamComparison,t.upstreamComparison))return!0;let i=new Set(n.map(e=>`${e.path}:${e.index}:${e.working_dir}`));for(let e of r)if(!i.has(`${e.path}:${e.index}:${e.working_dir}`))return!0;return!!(t.diffStats!==void 0&&on(e.diffStats,t.diffStats))},ln=(e,t)=>{let n=new Set;if(!t)return n;let r=e?.files??[],i=t.files??[],a=new Map(r.map(e=>[e.path,e])),o=new Map(i.map(e=>[e.path,e])),s=new Set([...a.keys(),...o.keys()]);for(let e of s){let t=a.get(e),r=o.get(e);if(!t||!r){n.add(e);continue}if(t.index!==r.index||t.working_dir!==r.working_dir){n.add(e);continue}}if(t.diffStats!==void 0){let r=e?.diffStats??{},i=t.diffStats??{},a=new Set([...Object.keys(r),...Object.keys(i)]);for(let e of a){let t=r[e],a=i[e];if(!t||!a){n.add(e);continue}(t.insertions!==a.insertions||t.deletions!==a.deletions)&&n.add(e)}}return n},un=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[],i=e=>{let t=e?.trim()??``;return t===`?`?``:t},a=new Map(n.map(e=>[e.path,i(e.index)])),o=new Map(r.map(e=>[e.path,i(e.index)])),s=new Set([...a.keys(),...o.keys()]);for(let e of s)if((a.get(e)??``)!==(o.get(e)??``))return!0;return!1},dn=e=>!e||e.trim().length===0,fn=e=>(e||``).trim()===`U`,pn=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(fn(t)||fn(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},mn=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(fn(t)||fn(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},hn=e=>dn(e.index)&&dn(e.working_dir),$=p()(h((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&tn(r),n&&tn(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Q()),e({activeDirectory:n,directories:t})}else e({activeDirectory:n})},getDirectoryState:e=>t().directories.get(e)??null,fetchStatus:async(n,r,i={})=>{let a=i.mode??`full`,o=$t(n,a),s=Zt.get(o)??(a===`light`?Zt.get($t(n,`full`)):void 0);if(s)return s;let c=(async()=>{let{silent:a=!1}=i,{directories:o}=t(),s=o.get(n);if(s||=Q(),!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!0}),e({directories:r})}let c=!1;try{let a=Date.now(),o=s.isGitRepo!==!0||a-(s.lastRepoCheckAt||0)>Lt,l=s.isGitRepo===!0;if(o&&(l=await r.checkIsGitRepository(n)),!l){let r=new Map(t().directories),i=r.get(n)??s;return r.set(n,{...i,isGitRepo:!1,status:null,isLoadingStatus:!1,lastRepoCheckAt:a,lastStatusFetch:a}),e({directories:r}),!1}let u=await r.getGitStatus(n,i.mode?{mode:i.mode}:void 0);if(cn(s.status,u)){c=!0;let r=new Map(t().directories),i=r.get(n)??Q(),s=ln(i.status,u),l=un(i.status,u),d=new Set((i.status?.files??[]).map(e=>e.path)),f=new Set((u.files??[]).map(e=>e.path)),p=new Map(i.diffCache);for(let e of d)f.has(e)||p.delete(e);for(let e of s)p.delete(e);let m=s.size>0;m&&tn(n);let h={...u,diffStats:u.diffStats===void 0&&i.status?.diffStats!==void 0?i.status.diffStats:u.diffStats,upstreamComparison:u.upstreamComparison===void 0?i.status?.upstreamComparison:u.upstreamComparison};r.set(n,{...i,isGitRepo:!0,status:h,diffCache:p,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:m?Date.now():i.lastStatusChange}),e({directories:r})}else{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isGitRepo:!0,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:i.lastStatusChange}),e({directories:r})}}catch(e){console.error(`Failed to fetch git status:`,e)}finally{if(!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();Zt.set(o,c);try{return await c}finally{Zt.get(o)===c&&Zt.delete(o)}},moveStatusPathsOptimistically:(n,r,i)=>{let a=new Set(r.map(e=>e.trim()).filter(Boolean));if(a.size===0)return null;let{directories:o}=t(),s=o.get(n),c=s?.status??null;if(!s||!c)return c;let l=!1,u=[];for(let e of c.files){if(!a.has(e.path)){u.push(e);continue}let t=i===`stage`?pn(e):mn(e);t!==e&&(l=!0),hn(t)?l=!0:u.push(t)}if(!l)return c;let d=new Map(o);return d.set(n,{...s,status:{...c,files:u,isClean:u.length===0},indexRevision:s.indexRevision+1,lastStatusChange:Date.now()}),e({directories:d}),c},restoreStatus:(n,r)=>{let{directories:i}=t(),a=i.get(n);if(!a)return;let o=new Map(i);o.set(n,{...a,status:r,indexRevision:a.indexRevision+1,lastStatusChange:Date.now()}),e({directories:o})},bumpIndexRevision:n=>{let{directories:r}=t(),i=r.get(n);if(!i)return;let a=new Map(r);a.set(n,{...i,indexRevision:i.indexRevision+1}),e({directories:a})},fetchBranches:async(r,i,a={})=>{let o=n(),s=nn(r);{let n=new Map(t().directories),i=n.get(r)??Q();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await Pt(r,i,void 0,o):await Nt(r,i,void 0,o);if(s!==Xt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Q();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(Ft(i)||console.error(`Failed to fetch git branches:`,i),s!==Xt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Q();a.set(r,{...c,isLoadingBranches:!1}),e({directories:a})}},fetchLog:async(n,r,i)=>{let{directories:a}=t(),o=a.get(n),s=i??o?.logMaxCount??25;{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingLog:!0}),e({directories:r})}try{let i=await r.getGitLog(n,{maxCount:s}),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,log:i,isLoadingLog:!1,lastLogFetch:Date.now(),logMaxCount:s}),e({directories:a})}catch(r){console.error(`Failed to fetch git log:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingIdentity:!0}),e({directories:r})}try{let i=await r.getCurrentGitIdentity(n),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,identity:i,isLoadingIdentity:!1,lastIdentityFetch:Date.now()}),e({directories:a})}catch(r){console.error(`Failed to fetch git identity:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingIdentity:!1}),e({directories:i})}},fetchAll:async(n,r,i={})=>{let{directories:a}=t(),o=a.get(n);if(!o){o=Q();let t=new Map(a);t.set(n,o),e({directories:t})}let{force:s=!1,silentIfCached:c=!1}=i,l=Date.now();await t().fetchStatus(n,r,{silent:c&&!!o?.status});let u=t().directories.get(n);if(!u?.isGitRepo)return;await t().fetchBranches(n,r,{force:s});let d=l-(u.lastLogFetch||0);(s||d>It||!u.log)&&await t().fetchLog(n,r),await t().fetchIdentity(n,r)},getDiff:(e,n)=>t().directories.get(e)?.diffCache.get(n)??null,setDiff:(n,r,i)=>{let a=new Map(t().directories),o=a.get(n)??Q(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=an(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{tn(n);let r=new Map(t().directories),i=r.get(n);i&&(r.set(n,{...i,diffCache:new Map}),e({directories:r}))},fetchAllDiffs:async(e,n)=>{let r=t().directories.get(e);if(!r?.status?.files||r.status.files.length===0)return;let i=r.status.files.map(e=>e.path).slice(0,Vt);await t().prefetchDiffs(e,n,i,{maxFiles:Vt})},prefetchDiffs:async(n,r,i,a={})=>{let o=t().directories.get(n);if(!o?.status?.files||o.status.files.length===0||i.length===0)return;let{maxFiles:s=Ht}=a,c=new Set(o.status.files.map(e=>e.path)),l=o.status.diffStats,u=rn(n),d=[],f=new Set;for(let e of i){if(!e||f.has(e)||(f.add(e),!c.has(e))||o.diffCache.has(e)||u.has(e))continue;let t=l?.[e];t&&t.insertions+t.deletions>Gt||d.push(e)}let p=d.slice(0,Math.max(1,s));if(p.length===0)return;let m=en(n);if(typeof document<`u`&&document.hidden)return;p.forEach(e=>u.add(e));let h=0,g=[],_=()=>{let e=h;return h+=1,e<p.length?p[e]:null},v=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Wt}ms`)),Wt)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},y=async()=>{for(;;){if(m!==en(n))return;let e=_();if(!e)return;try{g.push(await v(e))}catch{}finally{u.delete(e)}}},b=Math.min(Ut,p.length);if(await Promise.allSettled(Array.from({length:b},()=>y())),p.forEach(e=>u.delete(e)),m!==en(n))return;let x=new Map(t().directories),S=x.get(n);if(!S)return;let C=new Map(S.diffCache),ee=Date.now();g.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||C.set(e.path,{...e.diff,fetchedAt:ee})});let te=an(C);x.set(n,{...S,diffCache:te}),e({directories:x})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,logMaxCount:r}),e({directories:i})},ensureStatus:async(e,n)=>{let r=t().directories.get(e),i=Date.now();r?.status&&i-r.lastStatusFetch<Rt||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=Qt.get(e);if(r)return r;let i=(async()=>{let r=t().directories.get(e),i=Date.now();(!r?.status||r.status.diffStats===void 0||i-(r?.lastStatusFetch??0)>=Rt)&&await t().fetchStatus(e,n,{silent:!!r?.status});let a=t().directories.get(e);if(!a?.isGitRepo)return;let o=[];(!a.branches||i-a.lastBranchesFetch>=zt)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=It)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=Bt)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return Qt.set(e,i),i.finally(()=>{Qt.get(e)===i&&Qt.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),gn=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status??null:null,t[0]=e,t[1]=n),$(n)},_n=e=>{let r=(0,I.c)(3),i=F.useSyncExternalStore(t,n,n),a;return r[0]!==e||r[1]!==i?(a=t=>{if(!e)return null;let n=t.directories.get(e);return n?.branchesTransportIdentity===i?n.branches:null},r[0]=e,r[1]=i,r[2]=a):a=r[2],$(a)},vn=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.log??null:null,t[0]=e,t[1]=n),$(n)},yn=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isGitRepo??null:null,t[0]=e,t[1]=n),$(n)},bn=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status?.current?.trim()??null:null,t[0]=e,t[1]=n),$(n)},xn={current:new Map},Sn=()=>$(Dn),Cn=e=>{let t=(0,I.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=F.useRef(n),i;return t[1]===e?i=t[2]:(i=t=>{let n=r.current,i=n.size===e.length;if(i)for(let r of e){let e=t.directories.get(r),a=n.get(r);if(!a||(e?.isGitRepo??null)!==a.isGitRepo||(e?.status?.current??null)!==a.branch){i=!1;break}}if(i)return n;let a=new Map;for(let n of e){let e=t.directories.get(n);a.set(n,{isGitRepo:e?.isGitRepo??null,branch:e?.status?.current??null})}return r.current=a,a},t[1]=e,t[2]=i),$(i)},wn=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingStatus??!1:!1,t[0]=e,t[1]=n),$(n)},Tn=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingLog??!1:!1,t[0]=e,t[1]=n),$(n)},En=e=>{let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingBranches??!1:!1,t[0]=e,t[1]=n),$(n)};function Dn(e){let t=xn.current,n=t.size===e.directories.size;if(n){for(let[r,i]of e.directories)if(t.get(r)!==(i.status?.current??null)){n=!1;break}}if(n)return t;let r=new Map;for(let[t,n]of e.directories)r.set(t,n.status?.current??null);return xn.current=r,r}var On=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},kn=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),An=e=>e.branchName?kn(e.branchName):e.mode===`existing`?kn(e.existingBranch||e.preferredName||``):kn(e.preferredName||``),jn=async e=>{let t=await he(e);try{let n=On((await N(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=On((await P(e)).tracking);if(t?.remote)return t.remote}catch{}return null},Mn=async(e,t)=>{let n=await jn(e),r=kn(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},Nn=async(e,t,n)=>{let r=An(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await Mn(e,r):i&&kn(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:kn(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},Pn=async(e,t,n)=>{let r=await Nn(e.path,t,n);return ge(e,r)},Fn=`oc:lastWorktreeSourceBranch`,In=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,Ln=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t},Rn=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},zn=(e,t,n)=>{let r=Rn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Bn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=zn(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},Vn=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))?[...e]:[...e,t]},Hn=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Re as A,jt as C,Ge as D,Qe as E,W as F,G as I,be as L,Ee as M,Te as N,Ue as O,K as P,ve as R,Pt as S,et as T,vn as _,Fn as a,$ as b,Pn as c,Sn as d,bn as f,wn as g,Tn as h,zn as i,De as j,Be as k,jn as l,En as m,Vn as n,Ln as o,_n as p,Bn as r,In as s,Hn as t,Nn as u,Cn as v,Mt as w,yn as x,gn as y};
|