@dyyz1993/codenomad 0.15.4 → 0.15.6

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.
@@ -1 +1 @@
1
- import{m as Pe,P as Xe,t as _,i as h,a as Ye,d as O,f as Ge}from"./monaco-viewer-YY9yfE-p.js";import{n as d,m as S,b as T,o as k,k as ee,l as te,q as ae,s as M,d as I,c as W,S as J,t as Qe,w as we,a as he,F as ge}from"./git-diff-vendor-CSgooKT_.js";import{I as ce,P as Ze,Q as F,T as re,U as Je,V as et,W as ke,X as Ie,Y as Te,Z as tt,_ as fe,$ as le,a0 as de,a1 as $e,a2 as ne,a3 as oe,a4 as nt,a5 as me,a6 as ot,a7 as st,a8 as A,a9 as be,aa as it,ab as rt,ac as lt,ad as R,ae as at,af as ct,ag as Se,H as dt,ah as pe,ai as ut,aj as gt,ak as ft,al as pt,am as ht}from"./main-Bnnuz06l.js";import{u as mt}from"./index-BCGPLzO4.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const bt=[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]],vt=e=>d(ce,S(e,{name:"BellRing",iconNode:bt})),yt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xt=e=>d(ce,S(e,{name:"Info",iconNode:yt})),Ct=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],wt=e=>d(ce,S(e,{name:"TerminalSquare",iconNode:Ct})),St=[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Pt=e=>d(ce,S(e,{name:"XOctagon",iconNode:St}));var De=ee();function kt(){return te(De)}function It(){const e=kt();if(e===void 0)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}function Oe(e,o){return!!(o.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Tt(e,o){var t;const l=o.ref();if(!l)return-1;let r=e.length;if(!r)return-1;for(;r--;){const n=(t=e[r])==null?void 0:t.ref();if(n&&Oe(n,l))return r+1}return 0}function $t(e){const o=e.map((r,t)=>[t,r]);let l=!1;return o.sort(([r,t],[n,s])=>{const i=t.ref(),c=s.ref();return i===c||!i||!c?0:Oe(i,c)?(r>n&&(l=!0),-1):(r<n&&(l=!0),1)}),l?o.map(([r,t])=>t):e}function _e(e,o){const l=$t(e);e!==l&&o(l)}function Dt(e){var t,n;const o=e[0],l=(t=e[e.length-1])==null?void 0:t.ref();let r=(n=o==null?void 0:o.ref())==null?void 0:n.parentElement;for(;r;){if(l&&r.contains(l))return r;r=r.parentElement}return re(r).body}function Ot(e,o){T(()=>{const l=setTimeout(()=>{_e(e(),o)});k(()=>clearTimeout(l))})}function _t(e,o){if(typeof IntersectionObserver!="function"){Ot(e,o);return}let l=[];T(()=>{const r=()=>{const s=!!l.length;l=e(),s&&_e(e(),o)},t=Dt(e()),n=new IntersectionObserver(r,{root:t});for(const s of e()){const i=s.ref();i&&n.observe(i)}k(()=>n.disconnect())})}function Mt(e={}){const[o,l]=Ze({value:()=>et(e.items),onChange:n=>{var s;return(s=e.onItemsChange)==null?void 0:s.call(e,n)}});_t(o,l);const r=n=>(l(s=>{const i=Tt(s,n);return Je(s,n,i)}),()=>{l(s=>{const i=s.filter(c=>c.ref()!==n.ref());return s.length===i.length?s:i})});return{DomCollectionProvider:n=>d(De.Provider,{value:{registerItem:r},get children(){return n.children}})}}function Et(e){const o=It(),l=F({shouldRegisterItem:!0},e);T(()=>{if(!l.shouldRegisterItem)return;const r=o.registerItem(l.getItem());k(r)})}var At={};be(At,{Arrow:()=>ke,Content:()=>Ee,Portal:()=>Ae,Root:()=>Re,Tooltip:()=>Z,Trigger:()=>Fe,useTooltipContext:()=>ue});var Me=ee();function ue(){const e=te(Me);if(e===void 0)throw new Error("[kobalte]: `useTooltipContext` must be used within a `Tooltip` component");return e}function Ee(e){const o=ue(),l=F({id:o.generateId("content")},e),[r,t]=M(l,["ref","style"]);return T(()=>k(o.registerContentId(t.id))),d(J,{get when(){return o.contentPresent()},get children(){return d($e.Positioner,{get children(){return d(nt,S({ref(n){var s=ne(i=>{o.setContentRef(i)},r.ref);typeof s=="function"&&s(n)},role:"tooltip",disableOutsidePointerEvents:!1,get style(){return me({"--kb-tooltip-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},r.style)},onFocusOutside:n=>n.preventDefault(),onDismiss:()=>o.hideTooltip(!0)},()=>o.dataset(),t))}})}})}function Ae(e){const o=ue();return d(J,{get when(){return o.contentPresent()},get children(){return d(Xe,e)}})}function Rt(e,o,l){const r=e.split("-")[0],t=o.getBoundingClientRect(),n=l.getBoundingClientRect(),s=[],i=t.left+t.width/2,c=t.top+t.height/2;switch(r){case"top":s.push([t.left,c]),s.push([n.left,n.bottom]),s.push([n.left,n.top]),s.push([n.right,n.top]),s.push([n.right,n.bottom]),s.push([t.right,c]);break;case"right":s.push([i,t.top]),s.push([n.left,n.top]),s.push([n.right,n.top]),s.push([n.right,n.bottom]),s.push([n.left,n.bottom]),s.push([i,t.bottom]);break;case"bottom":s.push([t.left,c]),s.push([n.left,n.top]),s.push([n.left,n.bottom]),s.push([n.right,n.bottom]),s.push([n.right,n.top]),s.push([t.right,c]);break;case"left":s.push([i,t.top]),s.push([n.right,n.top]),s.push([n.left,n.top]),s.push([n.left,n.bottom]),s.push([n.right,n.bottom]),s.push([i,t.bottom]);break}return s}var H={},Ft=0,X=!1,E,Q,Y;function Re(e){const o=`tooltip-${ae()}`,l=`${++Ft}`,r=F({id:o,openDelay:700,closeDelay:300,skipDelayDuration:300},e),[t,n]=M(r,["id","open","defaultOpen","onOpenChange","disabled","triggerOnFocusOnly","openDelay","closeDelay","skipDelayDuration","ignoreSafeArea","forceMount"]);let s;const[i,c]=I(),[a,f]=I(),[u,g]=I(),[y,v]=I(n.placement),x=Ie({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:b=>{var P;return(P=t.onOpenChange)==null?void 0:P.call(t,b)}}),{present:$}=Te({show:()=>t.forceMount||x.isOpen(),element:()=>u()??null}),m=()=>{H[l]=C},w=()=>{for(const b in H)b!==l&&(H[b](!0),delete H[b])},C=(b=!1)=>{b||t.closeDelay&&t.closeDelay<=0?(window.clearTimeout(s),s=void 0,x.close()):s||(s=window.setTimeout(()=>{s=void 0,x.close()},t.closeDelay)),window.clearTimeout(E),E=void 0,t.skipDelayDuration&&t.skipDelayDuration>=0&&(Y=window.setTimeout(()=>{window.clearTimeout(Y),Y=void 0},t.skipDelayDuration)),X&&(window.clearTimeout(Q),Q=window.setTimeout(()=>{delete H[l],Q=void 0,X=!1},t.closeDelay))},p=()=>{clearTimeout(s),s=void 0,w(),m(),X=!0,x.open(),window.clearTimeout(E),E=void 0,window.clearTimeout(Q),Q=void 0,window.clearTimeout(Y),Y=void 0},q=()=>{w(),m(),!x.isOpen()&&!E&&!X?E=window.setTimeout(()=>{E=void 0,X=!0,p()},t.openDelay):x.isOpen()||p()},K=(b=!1)=>{!b&&t.openDelay&&t.openDelay>0&&!s&&!Y?q():p()},z=()=>{window.clearTimeout(E),E=void 0,X=!1},B=()=>{window.clearTimeout(s),s=void 0},U=b=>fe(a(),b)||fe(u(),b),D=b=>{const P=a(),N=u();if(!(!P||!N))return Rt(b,P,N)},L=b=>{const P=b.target;if(U(P)){B();return}if(!t.ignoreSafeArea){const N=D(y());if(N&&ot(st(b),N)){B();return}}s||C()};T(()=>{if(!x.isOpen())return;const b=re();b.addEventListener("pointermove",L,!0),k(()=>{b.removeEventListener("pointermove",L,!0)})}),T(()=>{const b=a();if(!b||!x.isOpen())return;const P=ze=>{const Ve=ze.target;fe(Ve,b)&&C(!0)},N=tt();N.addEventListener("scroll",P,{capture:!0}),k(()=>{N.removeEventListener("scroll",P,{capture:!0})})}),k(()=>{clearTimeout(s),H[l]&&delete H[l]});const ie={dataset:W(()=>({"data-expanded":x.isOpen()?"":void 0,"data-closed":x.isOpen()?void 0:""})),isOpen:x.isOpen,isDisabled:()=>t.disabled??!1,triggerOnFocusOnly:()=>t.triggerOnFocusOnly??!1,contentId:i,contentPresent:$,openTooltip:K,hideTooltip:C,cancelOpening:z,generateId:de(()=>r.id),registerContentId:le(c),isTargetOnTooltip:U,setTriggerRef:f,setContentRef:g};return d(Me.Provider,{value:ie,get children(){return d($e,S({anchorRef:a,contentRef:u,onCurrentPlacementChange:v},n))}})}function Fe(e){let o;const l=ue(),[r,t]=M(e,["ref","onPointerEnter","onPointerLeave","onPointerDown","onClick","onFocus","onBlur"]);let n=!1,s=!1,i=!1;const c=()=>{n=!1},a=()=>{!l.isOpen()&&(s||i)&&l.openTooltip(i)},f=m=>{l.isOpen()&&!s&&!i&&l.hideTooltip(m)},u=m=>{A(m,r.onPointerEnter),!(m.pointerType==="touch"||l.triggerOnFocusOnly()||l.isDisabled()||m.defaultPrevented)&&(s=!0,a())},g=m=>{A(m,r.onPointerLeave),m.pointerType!=="touch"&&(s=!1,i=!1,l.isOpen()?f():l.cancelOpening())},y=m=>{A(m,r.onPointerDown),n=!0,re(o).addEventListener("pointerup",c,{once:!0})},v=m=>{A(m,r.onClick),s=!1,i=!1,f(!0)},x=m=>{A(m,r.onFocus),!(l.isDisabled()||m.defaultPrevented||n)&&(i=!0,a())},$=m=>{A(m,r.onBlur);const w=m.relatedTarget;l.isTargetOnTooltip(w)||(s=!1,i=!1,f(!0))};return k(()=>{re(o).removeEventListener("pointerup",c)}),d(oe,S({as:"button",ref(m){var w=ne(C=>{l.setTriggerRef(C),o=C},r.ref);typeof w=="function"&&w(m)},get"aria-describedby"(){return Pe(()=>!!l.isOpen())()?l.contentId():void 0},onPointerEnter:u,onPointerLeave:g,onPointerDown:y,onClick:v,onFocus:x,onBlur:$},()=>l.dataset(),t))}var Z=Object.assign(Re,{Arrow:ke,Content:Ee,Portal:Ae,Trigger:Fe}),Kt={};be(Kt,{Collapsible:()=>Bt,Content:()=>ve,Root:()=>ye,Trigger:()=>xe,useCollapsibleContext:()=>se});var Ke=ee();function se(){const e=te(Ke);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function ve(e){const[o,l]=I(),r=se(),t=F({id:r.generateId("content")},e),[n,s]=M(t,["ref","id","style"]),{present:i}=Te({show:r.shouldMount,element:()=>o()??null}),[c,a]=I(0),[f,u]=I(0);let y=r.isOpen()||i();return Qe(()=>{const v=requestAnimationFrame(()=>{y=!1});k(()=>{cancelAnimationFrame(v)})}),T(we(i,()=>{if(!o())return;o().style.transitionDuration="0s",o().style.animationName="none";const v=o().getBoundingClientRect();a(v.height),u(v.width),y||(o().style.transitionDuration="",o().style.animationName="")})),T(we(r.isOpen,v=>{!v&&o()&&(o().style.transitionDuration="",o().style.animationName="")},{defer:!0})),T(()=>k(r.registerContentId(n.id))),d(J,{get when(){return i()},get children(){return d(oe,S({as:"div",ref(v){var x=ne(l,n.ref);typeof x=="function"&&x(v)},get id(){return n.id},get style(){return me({"--kb-collapsible-content-height":c()?`${c()}px`:void 0,"--kb-collapsible-content-width":f()?`${f()}px`:void 0},n.style)}},()=>r.dataset(),s))}})}function ye(e){const o=`collapsible-${ae()}`,l=F({id:o},e),[r,t]=M(l,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[n,s]=I(),i=Ie({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:f=>{var u;return(u=r.onOpenChange)==null?void 0:u.call(r,f)}}),c=W(()=>({"data-expanded":i.isOpen()?"":void 0,"data-closed":i.isOpen()?void 0:"","data-disabled":r.disabled?"":void 0})),a={dataset:c,isOpen:i.isOpen,disabled:()=>r.disabled??!1,shouldMount:()=>r.forceMount||i.isOpen(),contentId:n,toggle:i.toggle,generateId:de(()=>t.id),registerContentId:le(s)};return d(Ke.Provider,{value:a,get children(){return d(oe,S({as:"div"},c,t))}})}function xe(e){const o=se(),[l,r]=M(e,["onClick"]);return d(it,S({get"aria-expanded"(){return o.isOpen()},get"aria-controls"(){return Pe(()=>!!o.isOpen())()?o.contentId():void 0},get disabled(){return o.disabled()},onClick:n=>{A(n,l.onClick),o.toggle()}},()=>o.dataset(),r))}var Bt=Object.assign(ye,{Content:ve,Trigger:xe}),G={};be(G,{Accordion:()=>Lt,Content:()=>Ne,Header:()=>Ue,Item:()=>je,Root:()=>We,Trigger:()=>qe,useAccordionContext:()=>Ce});var Be=ee();function Le(){const e=te(Be);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function Ne(e){const o=Le(),l=o.generateId("content"),r=F({id:l},e),[t,n]=M(r,["id","style"]);return T(()=>k(o.registerContentId(t.id))),d(ve,S({role:"region",get"aria-labelledby"(){return o.triggerId()},get style(){return me({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},t.style)}},n))}function Ue(e){const o=se();return d(oe,S({as:"h3"},()=>o.dataset(),e))}var He=ee();function Ce(){const e=te(He);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function je(e){const o=Ce(),l=`${o.generateId("item")}-${ae()}`,r=F({id:l},e),[t,n]=M(r,["value","disabled"]),[s,i]=I(),[c,a]=I(),f=()=>o.listState().selectionManager(),u=()=>f().isSelected(t.value),g={value:()=>t.value,triggerId:s,contentId:c,generateId:de(()=>n.id),registerTriggerId:le(i),registerContentId:le(a)};return d(Be.Provider,{value:g,get children(){return d(ye,S({get open(){return u()},get disabled(){return t.disabled}},n))}})}function We(e){let o;const l=`accordion-${ae()}`,r=F({id:l,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[t,n]=M(r,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,i]=I([]),{DomCollectionProvider:c}=Mt({items:s,onItemsChange:i}),a=rt({selectedKeys:()=>t.value,defaultSelectedKeys:()=>t.defaultValue,onSelectionChange:g=>{var y;return(y=t.onChange)==null?void 0:y.call(t,Array.from(g))},disallowEmptySelection:()=>!t.multiple&&!t.collapsible,selectionMode:()=>t.multiple?"multiple":"single",dataSource:s});a.selectionManager().setFocusedKey("item-1");const f=lt({selectionManager:()=>a.selectionManager(),collection:()=>a.collection(),disallowEmptySelection:()=>a.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>t.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>o),u={listState:()=>a,generateId:de(()=>t.id)};return d(c,{get children(){return d(He.Provider,{value:u,get children(){return d(oe,S({as:"div",get id(){return t.id},ref(g){var y=ne(v=>o=v,t.ref);typeof y=="function"&&y(g)},get onKeyDown(){return R([t.onKeyDown,f.onKeyDown])},get onMouseDown(){return R([t.onMouseDown,f.onMouseDown])},get onFocusIn(){return R([t.onFocusIn])},get onFocusOut(){return R([t.onFocusOut,f.onFocusOut])}},n))}})}})}function qe(e){let o;const l=Ce(),r=Le(),t=se(),n=r.generateId("trigger"),s=F({id:n},e),[i,c]=M(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);Et({getItem:()=>({ref:()=>o,type:"item",key:r.value(),textValue:"",disabled:t.disabled()})});const a=at({key:()=>r.value(),selectionManager:()=>l.listState().selectionManager(),disabled:()=>t.disabled(),shouldSelectOnPressUp:!0},()=>o),f=u=>{["Enter"," "].includes(u.key)&&u.preventDefault(),A(u,i.onKeyDown),A(u,a.onKeyDown)};return T(()=>k(r.registerTriggerId(c.id))),d(xe,S({ref(u){var g=ne(y=>o=y,i.ref);typeof g=="function"&&g(u)},get"data-key"(){return a.dataKey()},get onPointerDown(){return R([i.onPointerDown,a.onPointerDown])},get onPointerUp(){return R([i.onPointerUp,a.onPointerUp])},get onClick(){return R([i.onClick,a.onClick])},onKeyDown:f,get onMouseDown(){return R([i.onMouseDown,a.onMouseDown])},get onFocus(){return R([i.onFocus,a.onFocus])}},c))}var Lt=Object.assign(We,{Content:Ne,Header:Ue,Item:je,Trigger:qe}),Nt=_('<div><div class="flex flex-wrap items-center gap-2 text-xs text-primary"><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">');const Ut=e=>{const{t:o}=mt(),l=W(()=>ct(e.instanceId,e.sessionId)??{cost:0,contextWindow:0,isSubscriptionModel:!1,inputTokens:0,outputTokens:0,reasoningTokens:0,actualUsageTokens:0,modelOutputLimit:0,contextAvailableTokens:null}),r=W(()=>l().inputTokens??0),t=W(()=>l().outputTokens??0),n=W(()=>{const i=l().isSubscriptionModel?0:l().cost;return i>0?i:0}),s=W(()=>`$${n().toFixed(2)}`);return(()=>{var i=Nt(),c=i.firstChild,a=c.firstChild,f=a.firstChild,u=f.nextSibling,g=a.nextSibling,y=g.firstChild,v=y.nextSibling,x=g.nextSibling,$=x.firstChild,m=$.nextSibling;return h(f,()=>o("contextUsagePanel.labels.input")),h(u,()=>Se(r())),h(y,()=>o("contextUsagePanel.labels.output")),h(v,()=>Se(t())),h($,()=>o("contextUsagePanel.labels.cost")),h(m,s),he(()=>Ye(i,`session-context-panel px-4 py-2 ${e.class??""}`)),i})()};var j=_('<div class="right-panel-empty right-panel-empty--left"><span class=text-xs>'),Ht=_('<div class="rounded-md border border-base bg-surface-secondary px-3 py-2"><div class="flex items-start justify-between gap-3"><div class=min-w-0><div class="text-sm font-medium text-primary"></div><p class="mt-1 text-xs text-secondary">'),jt=_('<div class="flex flex-col gap-3 min-h-0"><div class="flex items-center justify-between gap-2 text-[11px] text-secondary"><span></span><span class="flex items-center gap-2"><span style=color:var(--session-status-idle-fg)></span><span style=color:var(--session-status-working-fg)></span></span></div><div class="rounded-md border border-base bg-surface-secondary p-2 max-h-[40vh] overflow-y-auto"><div class="flex flex-col">'),Wt=_('<button type=button class="border-b border-base last:border-b-0 text-left hover:bg-surface-muted rounded-sm"><div class="flex items-center justify-between gap-3"><div class="text-xs font-mono text-primary min-w-0 flex-1 overflow-hidden whitespace-nowrap"style=text-overflow:ellipsis;direction:rtl;text-align:left;unicode-bidi:plaintext></div><div class="flex items-center gap-2 text-[11px] flex-shrink-0"><span style=color:var(--session-status-idle-fg)></span><span style=color:var(--session-status-working-fg)>'),qt=_('<div class="flex flex-col gap-2">'),zt=_("<span>"),Vt=_('<div class=status-process-card><div class=status-process-header><span class=status-process-title></span><div class=status-process-meta><span></span><span></span></div></div><div class=status-process-actions><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center">'),Xt=_("<div class=status-tab-container>"),Yt=_("<span class=section-left><span class=section-label>");const nn=e=>{const o=i=>e.expandedItems().includes(i),s=[{id:"yolo-mode",labelKey:"instanceShell.rightPanel.sections.yoloMode",tooltipKey:"instanceShell.rightPanel.sections.yoloMode.tooltip",render:()=>{const i=e.activeSession();return i?(()=>{var c=Ht(),a=c.firstChild,f=a.firstChild,u=f.firstChild,g=u.nextSibling;return h(u,()=>e.t("instanceShell.yoloMode.title")),h(g,()=>e.t("instanceShell.yoloMode.description")),h(a,d(ft,{get checked(){return gt(e.instanceId,i.id)},color:"warning",size:"small",get inputProps(){return{"aria-label":e.t("instanceShell.yoloMode.title")}},onChange:()=>ut(e.instanceId,i.id)}),null),c})():(()=>{var c=j(),a=c.firstChild;return h(a,()=>e.t("instanceShell.yoloMode.noSessionSelected")),c})()}},{id:"session-changes",labelKey:"instanceShell.rightPanel.sections.sessionChanges",tooltipKey:"instanceShell.rightPanel.sections.sessionChanges.tooltip",render:()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.noSessionSelected")),u})();const c=e.activeSessionDiffs();if(c===void 0)return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.loading")),u})();if(!Array.isArray(c)||c.length===0)return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.empty")),u})();const a=[...c].sort((u,g)=>String(u.file||"").localeCompare(String(g.file||""))),f=a.reduce((u,g)=>(u.additions+=typeof g.additions=="number"?g.additions:0,u.deletions+=typeof g.deletions=="number"?g.deletions:0,u),{additions:0,deletions:0});return(()=>{var u=jt(),g=u.firstChild,y=g.firstChild,v=y.nextSibling,x=v.firstChild,$=x.nextSibling,m=g.nextSibling,w=m.firstChild;return h(y,()=>e.t("instanceShell.sessionChanges.filesChanged",{count:a.length})),h(x,()=>`+${f.additions}`),h($,()=>`-${f.deletions}`),h(w,d(ge,{each:a,children:C=>(()=>{var p=Wt(),q=p.firstChild,K=q.firstChild,z=K.nextSibling,B=z.firstChild,U=B.nextSibling;return p.$$click=()=>e.onOpenChangesTab(C.file),h(K,()=>C.file),h(B,()=>`+${C.additions}`),h(U,()=>`-${C.deletions}`),he(D=>{var L=e.t("instanceShell.sessionChanges.actions.show"),V=C.file;return L!==D.e&&O(p,"title",D.e=L),V!==D.t&&O(K,"title",D.t=V),D},{e:void 0,t:void 0}),p})()})),u})()}},{id:"plan",labelKey:"instanceShell.rightPanel.sections.plan",tooltipKey:"instanceShell.rightPanel.sections.plan.tooltip",render:()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var a=j(),f=a.firstChild;return h(f,()=>e.t("instanceShell.plan.noSessionSelected")),a})();const c=e.latestTodoState();return c?d(pt,{state:c,get emptyLabel(){return e.t("instanceShell.plan.empty")},showStatusLabel:!1}):(()=>{var a=j(),f=a.firstChild;return h(f,()=>e.t("instanceShell.plan.empty")),a})()}},{id:"background-processes",labelKey:"instanceShell.rightPanel.sections.backgroundProcesses",tooltipKey:"instanceShell.rightPanel.sections.backgroundProcesses.tooltip",render:()=>{const i=e.backgroundProcessList();return i.length===0?(()=>{var c=j(),a=c.firstChild;return h(a,()=>e.t("instanceShell.backgroundProcesses.empty")),c})():(()=>{var c=qt();return h(c,d(ge,{each:i,children:a=>(()=>{var f=Vt(),u=f.firstChild,g=u.firstChild,y=g.nextSibling,v=y.firstChild,x=v.nextSibling,$=u.nextSibling,m=$.firstChild,w=m.nextSibling,C=w.nextSibling;return h(g,()=>a.title),h(v,d(vt,{class:"h-3.5 w-3.5"})),h(x,()=>e.t("instanceShell.backgroundProcesses.status",{status:a.status})),h(y,d(J,{get when(){return typeof a.outputSizeBytes=="number"},get children(){var p=zt();return h(p,()=>e.t("instanceShell.backgroundProcesses.output",{sizeKb:Math.round((a.outputSizeBytes??0)/1024)})),p}}),null),m.$$click=()=>e.onOpenBackgroundOutput(a),h(m,d(wt,{class:"h-4 w-4"})),w.$$click=()=>e.onStopBackgroundProcess(a.id),h(w,d(Pt,{class:"h-4 w-4"})),C.$$click=()=>e.onTerminateBackgroundProcess(a.id),h(C,d(ht,{class:"h-4 w-4"})),he(p=>{var q=!!a.notifyEnabled,K=!a.notifyEnabled,z=e.t(a.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),B=e.t(a.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),U=e.t("instanceShell.backgroundProcesses.actions.output"),D=e.t("instanceShell.backgroundProcesses.actions.output"),L=a.status!=="running",V=e.t("instanceShell.backgroundProcesses.actions.stop"),ie=e.t("instanceShell.backgroundProcesses.actions.stop"),b=e.t("instanceShell.backgroundProcesses.actions.terminate"),P=e.t("instanceShell.backgroundProcesses.actions.terminate");return q!==p.e&&v.classList.toggle("text-success",p.e=q),K!==p.t&&v.classList.toggle("text-tertiary",p.t=K),z!==p.a&&O(v,"aria-label",p.a=z),B!==p.o&&O(v,"title",p.o=B),U!==p.i&&O(m,"aria-label",p.i=U),D!==p.n&&O(m,"title",p.n=D),L!==p.s&&(w.disabled=p.s=L),V!==p.h&&O(w,"aria-label",p.h=V),ie!==p.r&&O(w,"title",p.r=ie),b!==p.d&&O(C,"aria-label",p.d=b),P!==p.l&&O(C,"title",p.l=P),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),f})()})),c})()}},{id:"mcp",labelKey:"instanceShell.rightPanel.sections.mcp",tooltipKey:"instanceShell.rightPanel.sections.mcp.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["mcp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"lsp",labelKey:"instanceShell.rightPanel.sections.lsp",tooltipKey:"instanceShell.rightPanel.sections.lsp.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["lsp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"plugins",labelKey:"instanceShell.rightPanel.sections.plugins",tooltipKey:"instanceShell.rightPanel.sections.plugins.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["plugins"],showSectionHeadings:!1,class:"space-y-2"})}];return(()=>{var i=Xt();return h(i,d(J,{get when(){return e.activeSession()},children:c=>d(Ut,{get instanceId(){return e.instanceId},get sessionId(){return c().id},class:"status-tab-context-panel"})}),null),h(i,d(G.Root,{class:"right-panel-accordion",collapsible:!0,multiple:!0,get value(){return e.expandedItems()},get onChange(){return e.onExpandedItemsChange},get children(){return d(ge,{each:s,children:c=>d(G.Item,{get value(){return c.id},class:"right-panel-accordion-item",get children(){return[d(G.Header,{class:"right-panel-accordion-header-row",get children(){return[d(G.Trigger,{class:"right-panel-accordion-trigger",get children(){return[(()=>{var a=Yt(),f=a.firstChild;return h(f,()=>e.t(c.labelKey)),a})(),d(dt,{get class(){return`right-panel-accordion-chevron ${o(c.id)?"right-panel-accordion-chevron-expanded":""}`}})]}}),d(Z,{openDelay:200,gutter:4,placement:"top",get children(){return[d(Z.Trigger,{as:"button",type:"button",class:"section-info-trigger",get"aria-label"(){return e.t(c.tooltipKey)},get children(){return d(xt,{class:"section-info-icon"})}}),d(Z.Portal,{get children(){return d(Z.Content,{class:"section-info-tooltip",get children(){return e.t(c.tooltipKey)}})}})]}})]}}),d(G.Content,{class:"right-panel-accordion-content",get children(){return c.render()}})]}})})}}),null),i})()};Ge(["click"]);export{nn as default};
1
+ import{m as Pe,P as Xe,t as _,i as h,a as Ye,d as O,f as Ge}from"./monaco-viewer-YY9yfE-p.js";import{n as d,m as S,b as T,o as k,k as ee,l as te,q as ae,s as M,d as I,c as W,S as J,t as Qe,w as we,a as he,F as ge}from"./git-diff-vendor-CSgooKT_.js";import{I as ce,P as Ze,Q as F,T as re,U as Je,V as et,W as ke,X as Ie,Y as Te,Z as tt,_ as fe,$ as le,a0 as de,a1 as $e,a2 as ne,a3 as oe,a4 as nt,a5 as me,a6 as ot,a7 as st,a8 as A,a9 as be,aa as it,ab as rt,ac as lt,ad as R,ae as at,af as ct,ag as Se,H as dt,ah as pe,ai as ut,aj as gt,ak as ft,al as pt,am as ht}from"./main-2ELpIX7K.js";import{u as mt}from"./index-BCGPLzO4.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const bt=[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]],vt=e=>d(ce,S(e,{name:"BellRing",iconNode:bt})),yt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xt=e=>d(ce,S(e,{name:"Info",iconNode:yt})),Ct=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],wt=e=>d(ce,S(e,{name:"TerminalSquare",iconNode:Ct})),St=[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Pt=e=>d(ce,S(e,{name:"XOctagon",iconNode:St}));var De=ee();function kt(){return te(De)}function It(){const e=kt();if(e===void 0)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}function Oe(e,o){return!!(o.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Tt(e,o){var t;const l=o.ref();if(!l)return-1;let r=e.length;if(!r)return-1;for(;r--;){const n=(t=e[r])==null?void 0:t.ref();if(n&&Oe(n,l))return r+1}return 0}function $t(e){const o=e.map((r,t)=>[t,r]);let l=!1;return o.sort(([r,t],[n,s])=>{const i=t.ref(),c=s.ref();return i===c||!i||!c?0:Oe(i,c)?(r>n&&(l=!0),-1):(r<n&&(l=!0),1)}),l?o.map(([r,t])=>t):e}function _e(e,o){const l=$t(e);e!==l&&o(l)}function Dt(e){var t,n;const o=e[0],l=(t=e[e.length-1])==null?void 0:t.ref();let r=(n=o==null?void 0:o.ref())==null?void 0:n.parentElement;for(;r;){if(l&&r.contains(l))return r;r=r.parentElement}return re(r).body}function Ot(e,o){T(()=>{const l=setTimeout(()=>{_e(e(),o)});k(()=>clearTimeout(l))})}function _t(e,o){if(typeof IntersectionObserver!="function"){Ot(e,o);return}let l=[];T(()=>{const r=()=>{const s=!!l.length;l=e(),s&&_e(e(),o)},t=Dt(e()),n=new IntersectionObserver(r,{root:t});for(const s of e()){const i=s.ref();i&&n.observe(i)}k(()=>n.disconnect())})}function Mt(e={}){const[o,l]=Ze({value:()=>et(e.items),onChange:n=>{var s;return(s=e.onItemsChange)==null?void 0:s.call(e,n)}});_t(o,l);const r=n=>(l(s=>{const i=Tt(s,n);return Je(s,n,i)}),()=>{l(s=>{const i=s.filter(c=>c.ref()!==n.ref());return s.length===i.length?s:i})});return{DomCollectionProvider:n=>d(De.Provider,{value:{registerItem:r},get children(){return n.children}})}}function Et(e){const o=It(),l=F({shouldRegisterItem:!0},e);T(()=>{if(!l.shouldRegisterItem)return;const r=o.registerItem(l.getItem());k(r)})}var At={};be(At,{Arrow:()=>ke,Content:()=>Ee,Portal:()=>Ae,Root:()=>Re,Tooltip:()=>Z,Trigger:()=>Fe,useTooltipContext:()=>ue});var Me=ee();function ue(){const e=te(Me);if(e===void 0)throw new Error("[kobalte]: `useTooltipContext` must be used within a `Tooltip` component");return e}function Ee(e){const o=ue(),l=F({id:o.generateId("content")},e),[r,t]=M(l,["ref","style"]);return T(()=>k(o.registerContentId(t.id))),d(J,{get when(){return o.contentPresent()},get children(){return d($e.Positioner,{get children(){return d(nt,S({ref(n){var s=ne(i=>{o.setContentRef(i)},r.ref);typeof s=="function"&&s(n)},role:"tooltip",disableOutsidePointerEvents:!1,get style(){return me({"--kb-tooltip-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},r.style)},onFocusOutside:n=>n.preventDefault(),onDismiss:()=>o.hideTooltip(!0)},()=>o.dataset(),t))}})}})}function Ae(e){const o=ue();return d(J,{get when(){return o.contentPresent()},get children(){return d(Xe,e)}})}function Rt(e,o,l){const r=e.split("-")[0],t=o.getBoundingClientRect(),n=l.getBoundingClientRect(),s=[],i=t.left+t.width/2,c=t.top+t.height/2;switch(r){case"top":s.push([t.left,c]),s.push([n.left,n.bottom]),s.push([n.left,n.top]),s.push([n.right,n.top]),s.push([n.right,n.bottom]),s.push([t.right,c]);break;case"right":s.push([i,t.top]),s.push([n.left,n.top]),s.push([n.right,n.top]),s.push([n.right,n.bottom]),s.push([n.left,n.bottom]),s.push([i,t.bottom]);break;case"bottom":s.push([t.left,c]),s.push([n.left,n.top]),s.push([n.left,n.bottom]),s.push([n.right,n.bottom]),s.push([n.right,n.top]),s.push([t.right,c]);break;case"left":s.push([i,t.top]),s.push([n.right,n.top]),s.push([n.left,n.top]),s.push([n.left,n.bottom]),s.push([n.right,n.bottom]),s.push([i,t.bottom]);break}return s}var H={},Ft=0,X=!1,E,Q,Y;function Re(e){const o=`tooltip-${ae()}`,l=`${++Ft}`,r=F({id:o,openDelay:700,closeDelay:300,skipDelayDuration:300},e),[t,n]=M(r,["id","open","defaultOpen","onOpenChange","disabled","triggerOnFocusOnly","openDelay","closeDelay","skipDelayDuration","ignoreSafeArea","forceMount"]);let s;const[i,c]=I(),[a,f]=I(),[u,g]=I(),[y,v]=I(n.placement),x=Ie({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:b=>{var P;return(P=t.onOpenChange)==null?void 0:P.call(t,b)}}),{present:$}=Te({show:()=>t.forceMount||x.isOpen(),element:()=>u()??null}),m=()=>{H[l]=C},w=()=>{for(const b in H)b!==l&&(H[b](!0),delete H[b])},C=(b=!1)=>{b||t.closeDelay&&t.closeDelay<=0?(window.clearTimeout(s),s=void 0,x.close()):s||(s=window.setTimeout(()=>{s=void 0,x.close()},t.closeDelay)),window.clearTimeout(E),E=void 0,t.skipDelayDuration&&t.skipDelayDuration>=0&&(Y=window.setTimeout(()=>{window.clearTimeout(Y),Y=void 0},t.skipDelayDuration)),X&&(window.clearTimeout(Q),Q=window.setTimeout(()=>{delete H[l],Q=void 0,X=!1},t.closeDelay))},p=()=>{clearTimeout(s),s=void 0,w(),m(),X=!0,x.open(),window.clearTimeout(E),E=void 0,window.clearTimeout(Q),Q=void 0,window.clearTimeout(Y),Y=void 0},q=()=>{w(),m(),!x.isOpen()&&!E&&!X?E=window.setTimeout(()=>{E=void 0,X=!0,p()},t.openDelay):x.isOpen()||p()},K=(b=!1)=>{!b&&t.openDelay&&t.openDelay>0&&!s&&!Y?q():p()},z=()=>{window.clearTimeout(E),E=void 0,X=!1},B=()=>{window.clearTimeout(s),s=void 0},U=b=>fe(a(),b)||fe(u(),b),D=b=>{const P=a(),N=u();if(!(!P||!N))return Rt(b,P,N)},L=b=>{const P=b.target;if(U(P)){B();return}if(!t.ignoreSafeArea){const N=D(y());if(N&&ot(st(b),N)){B();return}}s||C()};T(()=>{if(!x.isOpen())return;const b=re();b.addEventListener("pointermove",L,!0),k(()=>{b.removeEventListener("pointermove",L,!0)})}),T(()=>{const b=a();if(!b||!x.isOpen())return;const P=ze=>{const Ve=ze.target;fe(Ve,b)&&C(!0)},N=tt();N.addEventListener("scroll",P,{capture:!0}),k(()=>{N.removeEventListener("scroll",P,{capture:!0})})}),k(()=>{clearTimeout(s),H[l]&&delete H[l]});const ie={dataset:W(()=>({"data-expanded":x.isOpen()?"":void 0,"data-closed":x.isOpen()?void 0:""})),isOpen:x.isOpen,isDisabled:()=>t.disabled??!1,triggerOnFocusOnly:()=>t.triggerOnFocusOnly??!1,contentId:i,contentPresent:$,openTooltip:K,hideTooltip:C,cancelOpening:z,generateId:de(()=>r.id),registerContentId:le(c),isTargetOnTooltip:U,setTriggerRef:f,setContentRef:g};return d(Me.Provider,{value:ie,get children(){return d($e,S({anchorRef:a,contentRef:u,onCurrentPlacementChange:v},n))}})}function Fe(e){let o;const l=ue(),[r,t]=M(e,["ref","onPointerEnter","onPointerLeave","onPointerDown","onClick","onFocus","onBlur"]);let n=!1,s=!1,i=!1;const c=()=>{n=!1},a=()=>{!l.isOpen()&&(s||i)&&l.openTooltip(i)},f=m=>{l.isOpen()&&!s&&!i&&l.hideTooltip(m)},u=m=>{A(m,r.onPointerEnter),!(m.pointerType==="touch"||l.triggerOnFocusOnly()||l.isDisabled()||m.defaultPrevented)&&(s=!0,a())},g=m=>{A(m,r.onPointerLeave),m.pointerType!=="touch"&&(s=!1,i=!1,l.isOpen()?f():l.cancelOpening())},y=m=>{A(m,r.onPointerDown),n=!0,re(o).addEventListener("pointerup",c,{once:!0})},v=m=>{A(m,r.onClick),s=!1,i=!1,f(!0)},x=m=>{A(m,r.onFocus),!(l.isDisabled()||m.defaultPrevented||n)&&(i=!0,a())},$=m=>{A(m,r.onBlur);const w=m.relatedTarget;l.isTargetOnTooltip(w)||(s=!1,i=!1,f(!0))};return k(()=>{re(o).removeEventListener("pointerup",c)}),d(oe,S({as:"button",ref(m){var w=ne(C=>{l.setTriggerRef(C),o=C},r.ref);typeof w=="function"&&w(m)},get"aria-describedby"(){return Pe(()=>!!l.isOpen())()?l.contentId():void 0},onPointerEnter:u,onPointerLeave:g,onPointerDown:y,onClick:v,onFocus:x,onBlur:$},()=>l.dataset(),t))}var Z=Object.assign(Re,{Arrow:ke,Content:Ee,Portal:Ae,Trigger:Fe}),Kt={};be(Kt,{Collapsible:()=>Bt,Content:()=>ve,Root:()=>ye,Trigger:()=>xe,useCollapsibleContext:()=>se});var Ke=ee();function se(){const e=te(Ke);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function ve(e){const[o,l]=I(),r=se(),t=F({id:r.generateId("content")},e),[n,s]=M(t,["ref","id","style"]),{present:i}=Te({show:r.shouldMount,element:()=>o()??null}),[c,a]=I(0),[f,u]=I(0);let y=r.isOpen()||i();return Qe(()=>{const v=requestAnimationFrame(()=>{y=!1});k(()=>{cancelAnimationFrame(v)})}),T(we(i,()=>{if(!o())return;o().style.transitionDuration="0s",o().style.animationName="none";const v=o().getBoundingClientRect();a(v.height),u(v.width),y||(o().style.transitionDuration="",o().style.animationName="")})),T(we(r.isOpen,v=>{!v&&o()&&(o().style.transitionDuration="",o().style.animationName="")},{defer:!0})),T(()=>k(r.registerContentId(n.id))),d(J,{get when(){return i()},get children(){return d(oe,S({as:"div",ref(v){var x=ne(l,n.ref);typeof x=="function"&&x(v)},get id(){return n.id},get style(){return me({"--kb-collapsible-content-height":c()?`${c()}px`:void 0,"--kb-collapsible-content-width":f()?`${f()}px`:void 0},n.style)}},()=>r.dataset(),s))}})}function ye(e){const o=`collapsible-${ae()}`,l=F({id:o},e),[r,t]=M(l,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[n,s]=I(),i=Ie({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:f=>{var u;return(u=r.onOpenChange)==null?void 0:u.call(r,f)}}),c=W(()=>({"data-expanded":i.isOpen()?"":void 0,"data-closed":i.isOpen()?void 0:"","data-disabled":r.disabled?"":void 0})),a={dataset:c,isOpen:i.isOpen,disabled:()=>r.disabled??!1,shouldMount:()=>r.forceMount||i.isOpen(),contentId:n,toggle:i.toggle,generateId:de(()=>t.id),registerContentId:le(s)};return d(Ke.Provider,{value:a,get children(){return d(oe,S({as:"div"},c,t))}})}function xe(e){const o=se(),[l,r]=M(e,["onClick"]);return d(it,S({get"aria-expanded"(){return o.isOpen()},get"aria-controls"(){return Pe(()=>!!o.isOpen())()?o.contentId():void 0},get disabled(){return o.disabled()},onClick:n=>{A(n,l.onClick),o.toggle()}},()=>o.dataset(),r))}var Bt=Object.assign(ye,{Content:ve,Trigger:xe}),G={};be(G,{Accordion:()=>Lt,Content:()=>Ne,Header:()=>Ue,Item:()=>je,Root:()=>We,Trigger:()=>qe,useAccordionContext:()=>Ce});var Be=ee();function Le(){const e=te(Be);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function Ne(e){const o=Le(),l=o.generateId("content"),r=F({id:l},e),[t,n]=M(r,["id","style"]);return T(()=>k(o.registerContentId(t.id))),d(ve,S({role:"region",get"aria-labelledby"(){return o.triggerId()},get style(){return me({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},t.style)}},n))}function Ue(e){const o=se();return d(oe,S({as:"h3"},()=>o.dataset(),e))}var He=ee();function Ce(){const e=te(He);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function je(e){const o=Ce(),l=`${o.generateId("item")}-${ae()}`,r=F({id:l},e),[t,n]=M(r,["value","disabled"]),[s,i]=I(),[c,a]=I(),f=()=>o.listState().selectionManager(),u=()=>f().isSelected(t.value),g={value:()=>t.value,triggerId:s,contentId:c,generateId:de(()=>n.id),registerTriggerId:le(i),registerContentId:le(a)};return d(Be.Provider,{value:g,get children(){return d(ye,S({get open(){return u()},get disabled(){return t.disabled}},n))}})}function We(e){let o;const l=`accordion-${ae()}`,r=F({id:l,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[t,n]=M(r,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,i]=I([]),{DomCollectionProvider:c}=Mt({items:s,onItemsChange:i}),a=rt({selectedKeys:()=>t.value,defaultSelectedKeys:()=>t.defaultValue,onSelectionChange:g=>{var y;return(y=t.onChange)==null?void 0:y.call(t,Array.from(g))},disallowEmptySelection:()=>!t.multiple&&!t.collapsible,selectionMode:()=>t.multiple?"multiple":"single",dataSource:s});a.selectionManager().setFocusedKey("item-1");const f=lt({selectionManager:()=>a.selectionManager(),collection:()=>a.collection(),disallowEmptySelection:()=>a.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>t.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>o),u={listState:()=>a,generateId:de(()=>t.id)};return d(c,{get children(){return d(He.Provider,{value:u,get children(){return d(oe,S({as:"div",get id(){return t.id},ref(g){var y=ne(v=>o=v,t.ref);typeof y=="function"&&y(g)},get onKeyDown(){return R([t.onKeyDown,f.onKeyDown])},get onMouseDown(){return R([t.onMouseDown,f.onMouseDown])},get onFocusIn(){return R([t.onFocusIn])},get onFocusOut(){return R([t.onFocusOut,f.onFocusOut])}},n))}})}})}function qe(e){let o;const l=Ce(),r=Le(),t=se(),n=r.generateId("trigger"),s=F({id:n},e),[i,c]=M(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);Et({getItem:()=>({ref:()=>o,type:"item",key:r.value(),textValue:"",disabled:t.disabled()})});const a=at({key:()=>r.value(),selectionManager:()=>l.listState().selectionManager(),disabled:()=>t.disabled(),shouldSelectOnPressUp:!0},()=>o),f=u=>{["Enter"," "].includes(u.key)&&u.preventDefault(),A(u,i.onKeyDown),A(u,a.onKeyDown)};return T(()=>k(r.registerTriggerId(c.id))),d(xe,S({ref(u){var g=ne(y=>o=y,i.ref);typeof g=="function"&&g(u)},get"data-key"(){return a.dataKey()},get onPointerDown(){return R([i.onPointerDown,a.onPointerDown])},get onPointerUp(){return R([i.onPointerUp,a.onPointerUp])},get onClick(){return R([i.onClick,a.onClick])},onKeyDown:f,get onMouseDown(){return R([i.onMouseDown,a.onMouseDown])},get onFocus(){return R([i.onFocus,a.onFocus])}},c))}var Lt=Object.assign(We,{Content:Ne,Header:Ue,Item:je,Trigger:qe}),Nt=_('<div><div class="flex flex-wrap items-center gap-2 text-xs text-primary"><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">');const Ut=e=>{const{t:o}=mt(),l=W(()=>ct(e.instanceId,e.sessionId)??{cost:0,contextWindow:0,isSubscriptionModel:!1,inputTokens:0,outputTokens:0,reasoningTokens:0,actualUsageTokens:0,modelOutputLimit:0,contextAvailableTokens:null}),r=W(()=>l().inputTokens??0),t=W(()=>l().outputTokens??0),n=W(()=>{const i=l().isSubscriptionModel?0:l().cost;return i>0?i:0}),s=W(()=>`$${n().toFixed(2)}`);return(()=>{var i=Nt(),c=i.firstChild,a=c.firstChild,f=a.firstChild,u=f.nextSibling,g=a.nextSibling,y=g.firstChild,v=y.nextSibling,x=g.nextSibling,$=x.firstChild,m=$.nextSibling;return h(f,()=>o("contextUsagePanel.labels.input")),h(u,()=>Se(r())),h(y,()=>o("contextUsagePanel.labels.output")),h(v,()=>Se(t())),h($,()=>o("contextUsagePanel.labels.cost")),h(m,s),he(()=>Ye(i,`session-context-panel px-4 py-2 ${e.class??""}`)),i})()};var j=_('<div class="right-panel-empty right-panel-empty--left"><span class=text-xs>'),Ht=_('<div class="rounded-md border border-base bg-surface-secondary px-3 py-2"><div class="flex items-start justify-between gap-3"><div class=min-w-0><div class="text-sm font-medium text-primary"></div><p class="mt-1 text-xs text-secondary">'),jt=_('<div class="flex flex-col gap-3 min-h-0"><div class="flex items-center justify-between gap-2 text-[11px] text-secondary"><span></span><span class="flex items-center gap-2"><span style=color:var(--session-status-idle-fg)></span><span style=color:var(--session-status-working-fg)></span></span></div><div class="rounded-md border border-base bg-surface-secondary p-2 max-h-[40vh] overflow-y-auto"><div class="flex flex-col">'),Wt=_('<button type=button class="border-b border-base last:border-b-0 text-left hover:bg-surface-muted rounded-sm"><div class="flex items-center justify-between gap-3"><div class="text-xs font-mono text-primary min-w-0 flex-1 overflow-hidden whitespace-nowrap"style=text-overflow:ellipsis;direction:rtl;text-align:left;unicode-bidi:plaintext></div><div class="flex items-center gap-2 text-[11px] flex-shrink-0"><span style=color:var(--session-status-idle-fg)></span><span style=color:var(--session-status-working-fg)>'),qt=_('<div class="flex flex-col gap-2">'),zt=_("<span>"),Vt=_('<div class=status-process-card><div class=status-process-header><span class=status-process-title></span><div class=status-process-meta><span></span><span></span></div></div><div class=status-process-actions><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center">'),Xt=_("<div class=status-tab-container>"),Yt=_("<span class=section-left><span class=section-label>");const nn=e=>{const o=i=>e.expandedItems().includes(i),s=[{id:"yolo-mode",labelKey:"instanceShell.rightPanel.sections.yoloMode",tooltipKey:"instanceShell.rightPanel.sections.yoloMode.tooltip",render:()=>{const i=e.activeSession();return i?(()=>{var c=Ht(),a=c.firstChild,f=a.firstChild,u=f.firstChild,g=u.nextSibling;return h(u,()=>e.t("instanceShell.yoloMode.title")),h(g,()=>e.t("instanceShell.yoloMode.description")),h(a,d(ft,{get checked(){return gt(e.instanceId,i.id)},color:"warning",size:"small",get inputProps(){return{"aria-label":e.t("instanceShell.yoloMode.title")}},onChange:()=>ut(e.instanceId,i.id)}),null),c})():(()=>{var c=j(),a=c.firstChild;return h(a,()=>e.t("instanceShell.yoloMode.noSessionSelected")),c})()}},{id:"session-changes",labelKey:"instanceShell.rightPanel.sections.sessionChanges",tooltipKey:"instanceShell.rightPanel.sections.sessionChanges.tooltip",render:()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.noSessionSelected")),u})();const c=e.activeSessionDiffs();if(c===void 0)return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.loading")),u})();if(!Array.isArray(c)||c.length===0)return(()=>{var u=j(),g=u.firstChild;return h(g,()=>e.t("instanceShell.sessionChanges.empty")),u})();const a=[...c].sort((u,g)=>String(u.file||"").localeCompare(String(g.file||""))),f=a.reduce((u,g)=>(u.additions+=typeof g.additions=="number"?g.additions:0,u.deletions+=typeof g.deletions=="number"?g.deletions:0,u),{additions:0,deletions:0});return(()=>{var u=jt(),g=u.firstChild,y=g.firstChild,v=y.nextSibling,x=v.firstChild,$=x.nextSibling,m=g.nextSibling,w=m.firstChild;return h(y,()=>e.t("instanceShell.sessionChanges.filesChanged",{count:a.length})),h(x,()=>`+${f.additions}`),h($,()=>`-${f.deletions}`),h(w,d(ge,{each:a,children:C=>(()=>{var p=Wt(),q=p.firstChild,K=q.firstChild,z=K.nextSibling,B=z.firstChild,U=B.nextSibling;return p.$$click=()=>e.onOpenChangesTab(C.file),h(K,()=>C.file),h(B,()=>`+${C.additions}`),h(U,()=>`-${C.deletions}`),he(D=>{var L=e.t("instanceShell.sessionChanges.actions.show"),V=C.file;return L!==D.e&&O(p,"title",D.e=L),V!==D.t&&O(K,"title",D.t=V),D},{e:void 0,t:void 0}),p})()})),u})()}},{id:"plan",labelKey:"instanceShell.rightPanel.sections.plan",tooltipKey:"instanceShell.rightPanel.sections.plan.tooltip",render:()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var a=j(),f=a.firstChild;return h(f,()=>e.t("instanceShell.plan.noSessionSelected")),a})();const c=e.latestTodoState();return c?d(pt,{state:c,get emptyLabel(){return e.t("instanceShell.plan.empty")},showStatusLabel:!1}):(()=>{var a=j(),f=a.firstChild;return h(f,()=>e.t("instanceShell.plan.empty")),a})()}},{id:"background-processes",labelKey:"instanceShell.rightPanel.sections.backgroundProcesses",tooltipKey:"instanceShell.rightPanel.sections.backgroundProcesses.tooltip",render:()=>{const i=e.backgroundProcessList();return i.length===0?(()=>{var c=j(),a=c.firstChild;return h(a,()=>e.t("instanceShell.backgroundProcesses.empty")),c})():(()=>{var c=qt();return h(c,d(ge,{each:i,children:a=>(()=>{var f=Vt(),u=f.firstChild,g=u.firstChild,y=g.nextSibling,v=y.firstChild,x=v.nextSibling,$=u.nextSibling,m=$.firstChild,w=m.nextSibling,C=w.nextSibling;return h(g,()=>a.title),h(v,d(vt,{class:"h-3.5 w-3.5"})),h(x,()=>e.t("instanceShell.backgroundProcesses.status",{status:a.status})),h(y,d(J,{get when(){return typeof a.outputSizeBytes=="number"},get children(){var p=zt();return h(p,()=>e.t("instanceShell.backgroundProcesses.output",{sizeKb:Math.round((a.outputSizeBytes??0)/1024)})),p}}),null),m.$$click=()=>e.onOpenBackgroundOutput(a),h(m,d(wt,{class:"h-4 w-4"})),w.$$click=()=>e.onStopBackgroundProcess(a.id),h(w,d(Pt,{class:"h-4 w-4"})),C.$$click=()=>e.onTerminateBackgroundProcess(a.id),h(C,d(ht,{class:"h-4 w-4"})),he(p=>{var q=!!a.notifyEnabled,K=!a.notifyEnabled,z=e.t(a.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),B=e.t(a.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),U=e.t("instanceShell.backgroundProcesses.actions.output"),D=e.t("instanceShell.backgroundProcesses.actions.output"),L=a.status!=="running",V=e.t("instanceShell.backgroundProcesses.actions.stop"),ie=e.t("instanceShell.backgroundProcesses.actions.stop"),b=e.t("instanceShell.backgroundProcesses.actions.terminate"),P=e.t("instanceShell.backgroundProcesses.actions.terminate");return q!==p.e&&v.classList.toggle("text-success",p.e=q),K!==p.t&&v.classList.toggle("text-tertiary",p.t=K),z!==p.a&&O(v,"aria-label",p.a=z),B!==p.o&&O(v,"title",p.o=B),U!==p.i&&O(m,"aria-label",p.i=U),D!==p.n&&O(m,"title",p.n=D),L!==p.s&&(w.disabled=p.s=L),V!==p.h&&O(w,"aria-label",p.h=V),ie!==p.r&&O(w,"title",p.r=ie),b!==p.d&&O(C,"aria-label",p.d=b),P!==p.l&&O(C,"title",p.l=P),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),f})()})),c})()}},{id:"mcp",labelKey:"instanceShell.rightPanel.sections.mcp",tooltipKey:"instanceShell.rightPanel.sections.mcp.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["mcp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"lsp",labelKey:"instanceShell.rightPanel.sections.lsp",tooltipKey:"instanceShell.rightPanel.sections.lsp.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["lsp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"plugins",labelKey:"instanceShell.rightPanel.sections.plugins",tooltipKey:"instanceShell.rightPanel.sections.plugins.tooltip",render:()=>d(pe,{get initialInstance(){return e.instance},sections:["plugins"],showSectionHeadings:!1,class:"space-y-2"})}];return(()=>{var i=Xt();return h(i,d(J,{get when(){return e.activeSession()},children:c=>d(Ut,{get instanceId(){return e.instanceId},get sessionId(){return c().id},class:"status-tab-context-panel"})}),null),h(i,d(G.Root,{class:"right-panel-accordion",collapsible:!0,multiple:!0,get value(){return e.expandedItems()},get onChange(){return e.onExpandedItemsChange},get children(){return d(ge,{each:s,children:c=>d(G.Item,{get value(){return c.id},class:"right-panel-accordion-item",get children(){return[d(G.Header,{class:"right-panel-accordion-header-row",get children(){return[d(G.Trigger,{class:"right-panel-accordion-trigger",get children(){return[(()=>{var a=Yt(),f=a.firstChild;return h(f,()=>e.t(c.labelKey)),a})(),d(dt,{get class(){return`right-panel-accordion-chevron ${o(c.id)?"right-panel-accordion-chevron-expanded":""}`}})]}}),d(Z,{openDelay:200,gutter:4,placement:"top",get children(){return[d(Z.Trigger,{as:"button",type:"button",class:"section-info-trigger",get"aria-label"(){return e.t(c.tooltipKey)},get children(){return d(xt,{class:"section-info-icon"})}}),d(Z.Portal,{get children(){return d(Z.Content,{class:"section-info-tooltip",get children(){return e.t(c.tooltipKey)}})}})]}})]}}),d(G.Content,{class:"right-panel-accordion-content",get children(){return c.render()}})]}})})}}),null),i})()};Ge(["click"]);export{nn as default};
@@ -1 +1 @@
1
- import{I as n}from"./main-Bnnuz06l.js";import{n as o,m as y}from"./git-diff-vendor-CSgooKT_.js";const i=[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["line",{x1:"3",x2:"21",y1:"18",y2:"18",key:"kwyyxn"}]],t=e=>o(n,y(e,{name:"AlignJustify",iconNode:i}));export{t as A};
1
+ import{I as n}from"./main-2ELpIX7K.js";import{n as o,m as y}from"./git-diff-vendor-CSgooKT_.js";const i=[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["line",{x1:"3",x2:"21",y1:"18",y2:"18",key:"kwyyxn"}]],t=e=>o(n,y(e,{name:"AlignJustify",iconNode:i}));export{t as A};
@@ -1 +1 @@
1
- import{ac as _,t as b,i as x,u as E,m as V,k as B}from"./monaco-viewer-YY9yfE-p.js";import{c as L,b as F,n as p,a as D,S as q,E as z,D as G,C as T,G as U}from"./git-diff-vendor-CSgooKT_.js";import{ap as N,aq as K}from"./main-Bnnuz06l.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./index-BCGPLzO4.js";var $=b("<div>"),O=b("<div class=tool-call-diff-viewer>"),P=b("<pre class=tool-call-diff-fallback>");const j=B("session");U();function I(e,s,o){const a=window.getComputedStyle(o),i=document.createElement("span");i.textContent=s||"",i.style.position="absolute",i.style.visibility="hidden",i.style.pointerEvents="none",i.style.display="inline-block",i.style.width="auto",i.style.maxWidth="none",i.style.whiteSpace="nowrap",i.style.fontFamily=a.fontFamily,i.style.fontSize=a.fontSize,i.style.fontWeight=a.fontWeight,i.style.fontStyle=a.fontStyle,i.style.letterSpacing=a.letterSpacing,i.style.fontVariant=a.fontVariant,i.style.textTransform=a.textTransform,i.style.lineHeight=a.lineHeight,e.appendChild(i);const f=Math.ceil(i.getBoundingClientRect().width);return i.remove(),f}function M(e,s,o=40){const a=s.reduce((l,n)=>Math.max(l,I(e,n.text,n.source)),0),i=s.reduce((l,n)=>Math.max(l,n.text.length),1),f=Math.round(i*7+4);return Math.max(2,Math.min(o,a>0?a+2:f))}function J(e,s){const o=e.querySelector(".unified-diff-table-wrapper"),a=e.querySelector(".unified-diff-table"),i=e.querySelector(".unified-diff-table-num-col"),f=e.querySelectorAll(".diff-line-num"),l=e.querySelectorAll(".diff-line-hunk-action, .diff-line-widget-wrapper, .diff-line-extend-wrapper"),n=[];a&&(s?(a.classList.add("table-fixed"),a.style.tableLayout="fixed",a.style.width="100%",a.style.minWidth="100%"):(a.classList.remove("table-fixed"),a.style.tableLayout="auto",a.style.width="max-content",a.style.minWidth="100%")),f.forEach(r=>{var v,k;const c=r.querySelector("[data-line-old-num]"),m=r.querySelector("[data-line-new-num]"),W=r.querySelector(".shrink-0"),S=r.querySelector(":scope > .flex"),C=r.querySelector(":scope > .tool-call-diff-compact-line-number"),y=((v=c==null?void 0:c.textContent)==null?void 0:v.trim())??"",w=((k=m==null?void 0:m.textContent)==null?void 0:k.trim())??"",H=w.length>0&&w!=="0",R=y.length>0&&y!=="0",g=H?w:R?y:w||y;S&&(S.style.display="none"),W&&(W.style.display="none"),c&&(c.style.display="none",c.style.width="auto"),m&&(m.style.display="none",m.style.width="auto"),r.style.paddingLeft="1px",r.style.paddingRight="1px",r.style.textAlign="left";const u=C??document.createElement("span");u.className="tool-call-diff-compact-line-number",u.textContent=g,u.setAttribute("aria-hidden",g?"false":"true"),C||r.appendChild(u),n.push({gutter:r,label:u,text:g})});const t=M(e,n.map(r=>({text:r.text,source:r.label}))),d=`${t}px`,h=`${Math.max(8,t-10)}px`;o&&(o.style.setProperty("--diff-aside-width",h),o.style.setProperty("--diff-aside-width--",h)),i&&(i.style.width=d),n.forEach(({gutter:r,label:c})=>{r.style.width=d,r.style.minWidth=d,r.style.maxWidth=d,c.style.width="auto",c.style.maxWidth="none"}),l.forEach(r=>{r.style.width=d,r.style.minWidth=d,r.style.maxWidth=d,r.style.paddingLeft="0",r.style.paddingRight="0"})}function Q(e){const s=e.querySelector(".old-diff-table-wrapper"),o=e.querySelector(".new-diff-table-wrapper"),a=Array.from(e.querySelectorAll(".diff-line-old-num, .diff-line-new-num")),i=Array.from(e.querySelectorAll(".diff-line-hunk-action, .diff-line-widget-wrapper, .diff-line-extend-wrapper")),f=a.map(t=>({cell:t,span:t.querySelector("[data-line-num]")})).filter(t=>!!t.span),n=`${M(e,f.map(({span:t})=>{var d;return{text:((d=t.textContent)==null?void 0:d.trim())??"",source:t}}),64)}px`;[s,o].forEach(t=>{t&&t.style.setProperty("--diff-aside-width",n)}),a.forEach(t=>{t.style.width=n,t.style.minWidth=n,t.style.maxWidth=n,t.style.paddingLeft="2px",t.style.paddingRight="2px",t.style.textAlign="left",t.style.whiteSpace="nowrap",t.style.overflowWrap="normal",t.style.wordBreak="normal"}),f.forEach(({span:t})=>{t.style.whiteSpace="nowrap",t.style.overflowWrap="normal",t.style.wordBreak="normal"}),i.forEach(t=>{t.style.width=n,t.style.minWidth=n,t.style.maxWidth=n,t.style.paddingLeft="0",t.style.paddingRight="0"})}function A(e,s,o=!1){if(s==="unified"){J(e,o);return}s==="split"&&Q(e)}function ne(e){const s=L(()=>{const f=_(e.diffText);if(!f)return null;const l=N(e.filePath)||"text",n=e.filePath||"diff";return{oldFile:{fileName:n,fileLang:l},newFile:{fileName:n,fileLang:l},hunks:[f]}});let o,a;const i=L(()=>s()?`${e.theme}|${e.mode}|${e.wrap?"wrap":"nowrap"}|${e.diffText}`:"");return F(()=>{var n;if(e.cachedHtml){o&&A(o,e.mode,!!e.wrap),(n=e.onRendered)==null||n.call(e);return}const l=i();l&&o&&a!==l&&requestAnimationFrame(()=>{var d;if(!o)return;A(o,e.mode,!!e.wrap);const t=o.innerHTML;t&&(a=l,e.cacheEntryParams&&K(e.cacheEntryParams,{text:e.diffText,html:t,theme:e.theme,mode:e.mode,wrap:e.wrap}),(d=e.onRendered)==null||d.call(e))})}),(()=>{var f=O();return x(f,p(q,{get when(){return e.cachedHtml},get fallback(){return(()=>{var l=$(),n=o;return typeof n=="function"?E(n,l):o=l,x(l,p(q,{get when(){return s()},get fallback(){return(()=>{var t=P();return x(t,()=>e.diffText),t})()},children:t=>p(z,{fallback:d=>(j.warn("Failed to render diff view",d),(()=>{var h=P();return x(h,()=>e.diffText),h})()),get children(){return p(G,{get data(){return t()},get diffViewMode(){return V(()=>e.mode==="split")()?T.Split:T.Unified},get diffViewTheme(){return e.theme},diffViewHighlight:!0,get diffViewWrap(){return!!e.wrap},diffViewFontSize:13})}})})),l})()},get children(){var l=$(),n=o;return typeof n=="function"?E(n,l):o=l,D(()=>l.innerHTML=e.cachedHtml),l}})),f})()}export{ne as ToolCallDiffViewer};
1
+ import{ac as _,t as b,i as x,u as E,m as V,k as B}from"./monaco-viewer-YY9yfE-p.js";import{c as L,b as F,n as p,a as D,S as q,E as z,D as G,C as T,G as U}from"./git-diff-vendor-CSgooKT_.js";import{ap as N,aq as K}from"./main-2ELpIX7K.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./index-BCGPLzO4.js";var $=b("<div>"),O=b("<div class=tool-call-diff-viewer>"),P=b("<pre class=tool-call-diff-fallback>");const j=B("session");U();function I(e,s,o){const a=window.getComputedStyle(o),i=document.createElement("span");i.textContent=s||"",i.style.position="absolute",i.style.visibility="hidden",i.style.pointerEvents="none",i.style.display="inline-block",i.style.width="auto",i.style.maxWidth="none",i.style.whiteSpace="nowrap",i.style.fontFamily=a.fontFamily,i.style.fontSize=a.fontSize,i.style.fontWeight=a.fontWeight,i.style.fontStyle=a.fontStyle,i.style.letterSpacing=a.letterSpacing,i.style.fontVariant=a.fontVariant,i.style.textTransform=a.textTransform,i.style.lineHeight=a.lineHeight,e.appendChild(i);const f=Math.ceil(i.getBoundingClientRect().width);return i.remove(),f}function M(e,s,o=40){const a=s.reduce((l,n)=>Math.max(l,I(e,n.text,n.source)),0),i=s.reduce((l,n)=>Math.max(l,n.text.length),1),f=Math.round(i*7+4);return Math.max(2,Math.min(o,a>0?a+2:f))}function J(e,s){const o=e.querySelector(".unified-diff-table-wrapper"),a=e.querySelector(".unified-diff-table"),i=e.querySelector(".unified-diff-table-num-col"),f=e.querySelectorAll(".diff-line-num"),l=e.querySelectorAll(".diff-line-hunk-action, .diff-line-widget-wrapper, .diff-line-extend-wrapper"),n=[];a&&(s?(a.classList.add("table-fixed"),a.style.tableLayout="fixed",a.style.width="100%",a.style.minWidth="100%"):(a.classList.remove("table-fixed"),a.style.tableLayout="auto",a.style.width="max-content",a.style.minWidth="100%")),f.forEach(r=>{var v,k;const c=r.querySelector("[data-line-old-num]"),m=r.querySelector("[data-line-new-num]"),W=r.querySelector(".shrink-0"),S=r.querySelector(":scope > .flex"),C=r.querySelector(":scope > .tool-call-diff-compact-line-number"),y=((v=c==null?void 0:c.textContent)==null?void 0:v.trim())??"",w=((k=m==null?void 0:m.textContent)==null?void 0:k.trim())??"",H=w.length>0&&w!=="0",R=y.length>0&&y!=="0",g=H?w:R?y:w||y;S&&(S.style.display="none"),W&&(W.style.display="none"),c&&(c.style.display="none",c.style.width="auto"),m&&(m.style.display="none",m.style.width="auto"),r.style.paddingLeft="1px",r.style.paddingRight="1px",r.style.textAlign="left";const u=C??document.createElement("span");u.className="tool-call-diff-compact-line-number",u.textContent=g,u.setAttribute("aria-hidden",g?"false":"true"),C||r.appendChild(u),n.push({gutter:r,label:u,text:g})});const t=M(e,n.map(r=>({text:r.text,source:r.label}))),d=`${t}px`,h=`${Math.max(8,t-10)}px`;o&&(o.style.setProperty("--diff-aside-width",h),o.style.setProperty("--diff-aside-width--",h)),i&&(i.style.width=d),n.forEach(({gutter:r,label:c})=>{r.style.width=d,r.style.minWidth=d,r.style.maxWidth=d,c.style.width="auto",c.style.maxWidth="none"}),l.forEach(r=>{r.style.width=d,r.style.minWidth=d,r.style.maxWidth=d,r.style.paddingLeft="0",r.style.paddingRight="0"})}function Q(e){const s=e.querySelector(".old-diff-table-wrapper"),o=e.querySelector(".new-diff-table-wrapper"),a=Array.from(e.querySelectorAll(".diff-line-old-num, .diff-line-new-num")),i=Array.from(e.querySelectorAll(".diff-line-hunk-action, .diff-line-widget-wrapper, .diff-line-extend-wrapper")),f=a.map(t=>({cell:t,span:t.querySelector("[data-line-num]")})).filter(t=>!!t.span),n=`${M(e,f.map(({span:t})=>{var d;return{text:((d=t.textContent)==null?void 0:d.trim())??"",source:t}}),64)}px`;[s,o].forEach(t=>{t&&t.style.setProperty("--diff-aside-width",n)}),a.forEach(t=>{t.style.width=n,t.style.minWidth=n,t.style.maxWidth=n,t.style.paddingLeft="2px",t.style.paddingRight="2px",t.style.textAlign="left",t.style.whiteSpace="nowrap",t.style.overflowWrap="normal",t.style.wordBreak="normal"}),f.forEach(({span:t})=>{t.style.whiteSpace="nowrap",t.style.overflowWrap="normal",t.style.wordBreak="normal"}),i.forEach(t=>{t.style.width=n,t.style.minWidth=n,t.style.maxWidth=n,t.style.paddingLeft="0",t.style.paddingRight="0"})}function A(e,s,o=!1){if(s==="unified"){J(e,o);return}s==="split"&&Q(e)}function ne(e){const s=L(()=>{const f=_(e.diffText);if(!f)return null;const l=N(e.filePath)||"text",n=e.filePath||"diff";return{oldFile:{fileName:n,fileLang:l},newFile:{fileName:n,fileLang:l},hunks:[f]}});let o,a;const i=L(()=>s()?`${e.theme}|${e.mode}|${e.wrap?"wrap":"nowrap"}|${e.diffText}`:"");return F(()=>{var n;if(e.cachedHtml){o&&A(o,e.mode,!!e.wrap),(n=e.onRendered)==null||n.call(e);return}const l=i();l&&o&&a!==l&&requestAnimationFrame(()=>{var d;if(!o)return;A(o,e.mode,!!e.wrap);const t=o.innerHTML;t&&(a=l,e.cacheEntryParams&&K(e.cacheEntryParams,{text:e.diffText,html:t,theme:e.theme,mode:e.mode,wrap:e.wrap}),(d=e.onRendered)==null||d.call(e))})}),(()=>{var f=O();return x(f,p(q,{get when(){return e.cachedHtml},get fallback(){return(()=>{var l=$(),n=o;return typeof n=="function"?E(n,l):o=l,x(l,p(q,{get when(){return s()},get fallback(){return(()=>{var t=P();return x(t,()=>e.diffText),t})()},children:t=>p(z,{fallback:d=>(j.warn("Failed to render diff view",d),(()=>{var h=P();return x(h,()=>e.diffText),h})()),get children(){return p(G,{get data(){return t()},get diffViewMode(){return V(()=>e.mode==="split")()?T.Split:T.Unified},get diffViewTheme(){return e.theme},diffViewHighlight:!0,get diffViewWrap(){return!!e.wrap},diffViewFontSize:13})}})})),l})()},get children(){var l=$(),n=o;return typeof n=="function"?E(n,l):o=l,D(()=>l.innerHTML=e.cachedHtml),l}})),f})()}export{ne as ToolCallDiffViewer};