@kilocode/cli-darwin-arm64 7.5.8 → 7.5.11

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.
@@ -805,7 +805,7 @@ ${e}`,n=A.startsWith(e)?0:sE(A,t,0);if(n===-1)return[A];const i=[];n>0&&i.push(A
805
805
 
806
806
  ${aK}
807
807
 
808
- `;function Z0(A){return{theme:la,themeType:"system",disableLineNumbers:!1,overflow:"wrap",diffStyle:A??"unified",diffIndicators:"bars",lineHoverHighlight:"both",disableBackground:!1,expansionLineCount:20,hunkSeparators:"line-info-basic",lineDiffType:A==="split"?"word-alt":"none",maxLineDiffLength:1e3,maxLineLengthForHighlighting:1e3,disableFileHeader:!0,unsafeCSS:gK}}const t4={"--diffs-font-family":"var(--font-family-mono)","--diffs-font-size":"var(--font-size-small)","--diffs-line-height":"24px","--diffs-tab-size":2,"--diffs-font-features":"var(--font-family-mono--font-feature-settings)","--diffs-header-font-family":"var(--font-family-sans)","--diffs-gap-block":0,"--diffs-min-number-column-width":"4ch"};function n4(A){const e=A.closest("[data-line], [data-alt-line]");if(e instanceof HTMLElement){const n=e.dataset.lineType;if(n==="change-deletion")return"deletions";if(n==="change-addition"||n==="change-additions")return"additions"}const t=A.closest("[data-code]");return t instanceof HTMLElement&&t.hasAttribute("data-deletions")?"deletions":"additions"}function Lc(A,e){const t=e.dataset.lineIndex;if(!t)return;const n=t.split(",").map(i=>parseInt(i,10)).filter(i=>!Number.isNaN(i));if(n.length!==0)return A&&n.length===2?n[1]:n[0]}function ga(A,e,t,n){const i=Array.from(A.querySelectorAll(`[data-line="${t}"], [data-alt-line="${t}"]`)).filter(o=>o instanceof HTMLElement);if(i.length===0)return;const r=n??"additions";for(const o of i)if(n4(o)===r||parseInt(o.dataset.altLine??"",10)===t)return Lc(e,o)}function DE(A,e){if(!e)return e;if(!A)return;const t=A.querySelector("[data-diff]");if(!(t instanceof HTMLElement))return;const n=t.dataset.diffType==="split",i=ga(A,n,e.start,e.side),r=ga(A,n,e.end,e.endSide??e.side);if(i===void 0||r===void 0)return A.querySelector("[data-line], [data-alt-line]")==null?void 0:null;if(i<=r)return e;const o=e.endSide??e.side,s={start:e.end,end:e.start};return o&&(s.side=o),e.endSide&&e.side&&(s.endSide=e.side),s}function i4(A){const e=A.dataset.lineAnnotation?.split(",")[1];if(!e)return;const t=parseInt(e,10);if(!Number.isNaN(t))return t}function r4(A){const e=Array.from(A.querySelectorAll("[data-comment-selected]"));for(const t of e)t instanceof HTMLElement&&t.removeAttribute("data-comment-selected")}function cK(A,e){r4(A);const t=A.querySelector("[data-diff]");if(!(t instanceof HTMLElement))return;const n=t.dataset.diffType==="split",i=Array.from(t.querySelectorAll("[data-line-index]")).filter(o=>o instanceof HTMLElement);if(i.length===0)return;const r=Array.from(t.querySelectorAll("[data-line-annotation]")).filter(o=>o instanceof HTMLElement);for(const o of e){const s=ga(A,n,o.start,o.side);if(s===void 0)continue;const a=o.end===o.start&&(o.endSide==null||o.endSide===o.side)?s:ga(A,n,o.end,o.endSide??o.side);if(a===void 0)continue;const l=Math.min(s,a),c=Math.max(s,a);for(const g of i){const d=Lc(n,g);d===void 0||d<l||d>c||g.setAttribute("data-comment-selected","")}for(const g of r){const d=i4(g);d===void 0||d<l||d>c||g.setAttribute("data-comment-selected","")}}}function dK(A,e){r4(A);const t=Array.from(A.querySelectorAll("[data-line-annotation]")).filter(n=>n instanceof HTMLElement);for(const n of e){const i=Math.max(1,Math.min(n.start,n.end)),r=Math.max(n.start,n.end);for(let o=i;o<=r;o++){const s=Array.from(A.querySelectorAll(`[data-line="${o}"], [data-column-number="${o}"]`));for(const a of s)a instanceof HTMLElement&&a.setAttribute("data-comment-selected","")}for(const o of t){const s=i4(o);s===void 0||s<i||s>r||o.setAttribute("data-comment-selected","")}}}function QK(A,e){const t=new ResizeObserver(A);return DA(t.disconnect.bind(t)),{observe:n=>t.observe(n,e),unobserve:t.unobserve.bind(t)}}function o4(A,e,t){const n=new WeakMap,{observe:i,unobserve:r}=QK(o=>{for(const s of o){const{contentRect:a,target:l}=s,c=Math.round(a.width),g=Math.round(a.height),d=n.get(l);(!d||d.width!==c||d.height!==g)&&(e(a,l,s),n.set(l,{width:c,height:g}))}},t);nA(o=>{const s=qC(xs(iA(A)));return KC(s,o,i,r),s},[])}const ca=new Set;let $t,y1,kE=!1;function BK(A){return A instanceof HTMLElement?A.closest("[data-prevent-autofocus]")||A.isContentEditable?!0:/^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(A.tagName):!1}function bE(A){if(A instanceof Node)for(const e of ca){const t=e.element();if(t&&t.isConnected&&t.contains(A))return e}}function EK(){kE||typeof window>"u"||(kE=!0,window.addEventListener("keydown",A=>{if(A.defaultPrevented||BK(A.target)||!(A.metaKey||A.ctrlKey))return;const t=A.key.toLowerCase();if(t==="g"){const r=y1;if(!r||!r.isOpen())return;A.preventDefault(),A.stopPropagation(),r.next(A.shiftKey?-1:1);return}if(t!=="f")return;const n=y1;if(n&&n.isOpen()){A.preventDefault(),A.stopPropagation(),n.open();return}const i=bE(document.activeElement)??bE(A.target)??$t??Array.from(ca)[0];i&&(A.preventDefault(),A.stopPropagation(),i.open())},{capture:!0}))}function ni(){const A=globalThis.CSS?.highlights;A&&(A.delete("opencode-find"),A.delete("opencode-find-current"))}function vE(){const A=globalThis;return typeof A.Highlight=="function"&&A.CSS?.highlights!=null}function ME(A){let e=A.parentElement;for(;e;){const t=getComputedStyle(e);if(t.overflowY==="auto"||t.overflowY==="scroll")return e;e=e.parentElement}}function CK(A){let e,t,n="overlay",i=[];const[r,o]=T([]),[s,a]=zc({open:!1,query:"",index:0,count:0,pos:{top:8,right:8}}),l=()=>s.open,c=()=>s.query,g=()=>s.index,d=()=>s.count,Q=()=>s.pos,B=()=>{o([])},C=()=>{const S=A.overlay();S&&(t!==void 0&&(cancelAnimationFrame(t),t=void 0),S.innerHTML="")},I=()=>{if(n!=="overlay"){C();return}const S=A.wrapper(),G=A.overlay();if(!S||!G||(C(),i.length===0))return;const q=S.getBoundingClientRect(),K=g(),J=document.createDocumentFragment();for(let P=0;P<i.length;P++){const V=i[P],rA=P===K;for(const sA of Array.from(V.getClientRects())){if(!sA.width||!sA.height)continue;const z=document.createElement("div");z.style.position="absolute",z.style.left=`${Math.round(sA.left-q.left)}px`,z.style.top=`${Math.round(sA.top-q.top)}px`,z.style.width=`${Math.round(sA.width)}px`,z.style.height=`${Math.round(sA.height)}px`,z.style.borderRadius="2px",z.style.backgroundColor=rA?"var(--surface-warning-strong)":"var(--surface-warning-base)",z.style.opacity=rA?"0.55":"0.35",rA&&(z.style.boxShadow="inset 0 0 0 1px var(--border-warning-base)"),J.appendChild(z)}}G.appendChild(J)};function f(){n==="overlay"&&l()&&t===void 0&&(t=requestAnimationFrame(()=>{t=void 0,I()}))}const u=()=>{if(n!=="overlay")return;const S=A.getRoot(),G=S?Array.from(S.querySelectorAll("[data-code]")).filter(K=>K instanceof HTMLElement):[],q=r();G.length===q.length&&G.every((K,J)=>K===q[J])||(B(),o(G))},p=()=>{ni(),C(),B(),i=[],a("count",0),a("index",0)},w=()=>{if(typeof window>"u")return;const S=A.wrapper();if(!S)return;const G=ME(S)??S,q=G.getBoundingClientRect(),K=parseFloat(getComputedStyle(G).getPropertyValue("--session-title-height")),J=Number.isNaN(K)?0:K;a("pos",{top:Math.round(q.top)+J-4,right:Math.round(window.innerWidth-q.right)+8})},m=(S,G)=>{const q=G.toLowerCase(),K=[],J=Array.from(S.querySelectorAll("[data-content] [data-line], [data-column-content]")).filter(P=>P instanceof HTMLElement);for(const P of J){const V=P.textContent;if(!V)continue;const rA=V.toLowerCase();let sA=rA.indexOf(q);if(sA===-1)continue;const z=[],dA=[],oA=document.createTreeWalker(P,NodeFilter.SHOW_TEXT);let lA=oA.nextNode(),EA=0;for(;lA;)lA instanceof Text&&(EA+=lA.data.length,z.push(lA),dA.push(EA)),lA=oA.nextNode();if(z.length===0)continue;const CA=RA=>{let kA=0,bA=dA.length-1;for(;kA<bA;){const ie=kA+bA>>1;dA[ie]>=RA?bA=ie:kA=ie+1}const YA=kA===0?0:dA[kA-1];return{node:z[kA],offset:RA-YA}};for(;sA!==-1;){const RA=CA(sA),kA=CA(sA+G.length),bA=document.createRange();bA.setStart(RA.node,RA.offset),bA.setEnd(kA.node,kA.offset),K.push(bA),sA=rA.indexOf(q,sA+G.length)}}return K},y=S=>{const G=S.startContainer;(G instanceof Element?G:G.parentElement)?.scrollIntoView({block:"center",inline:"center"})},M=(S,G)=>{const q=globalThis.CSS?.highlights,K=globalThis.Highlight;if(!q||typeof K!="function")return!1;q.delete("opencode-find"),q.delete("opencode-find-current");const J=S[G];J&&q.set("opencode-find-current",new K(J));const P=S.filter((V,rA)=>rA!==G);return P.length>0&&q.set("opencode-find",new K(...P)),!0},k=S=>{if(!l())return;const G=c().trim();if(!G){p();return}const q=A.getRoot();if(!q)return;n=vE()?"highlights":"overlay";const K=m(q,G),J=K.length,P=S?.reset?0:g(),V=J?Math.min(P,J-1):0;i=K,a("count",J),a("index",V);const rA=K[V];if(n==="highlights"){C(),B(),M(K,V)||(n="overlay",ni(),u(),f()),S?.scroll&&rA&&y(rA);return}ni(),u(),S?.scroll&&rA&&y(rA),f()},N=()=>{a("open",!1),a("query",""),p(),y1===x&&(y1=void 0)},_=()=>{y1&&y1!==x&&y1.close(),y1=x,$t=x,l()||a("open",!0),requestAnimationFrame(()=>{k({scroll:!0}),e?.focus(),e?.select()})},F=S=>{if(!l())return;const G=d();if(G<=0)return;const q=(g()+S+G)%G;a("index",q);const K=i[q];if(K){if(n==="highlights"){if(!M(i,q)){n="overlay",k({reset:!0,scroll:!0});return}y(K);return}ni(),u(),y(K),f()}},x={element:A.wrapper,isOpen:()=>l(),next:F,open:_,close:N};return nA(()=>{for(const S of r())tn(S,"scroll",f,{passive:!0})}),C1(()=>{n=vE()?"highlights":"overlay",EK(),ca.add(x),$t||($t=x),DA(()=>{ca.delete(x),y1===x&&(y1=void 0,ni()),$t===x&&($t=void 0)})}),nA(()=>{if(!l())return;const S=()=>w();requestAnimationFrame(S),tn(window,"resize",S,{passive:!0});const G=A.wrapper();if(!G)return;const q=ME(G)??G;o4(q,S)}),DA(()=>{B(),C(),y1===x&&(y1=void 0,ni())}),{open:l,query:c,count:d,index:g,pos:Q,setInput:S=>{e=S},setQuery:S=>{a("query",S),a("index",0),k({reset:!0,scroll:!0})},focus:_,close:N,next:F,refresh:S=>k(S),onPointerDown:()=>{$t=x,A.wrapper()?.focus({preventScroll:!0})},onFocus:()=>{$t=x},onInputKeyDown:S=>{if(S.key==="Escape"){S.preventDefault(),N();return}S.key==="Enter"&&(S.preventDefault(),F(S.shiftKey?-1:1))}}}function uK(){return{token:0}}function br(A){A.observer?.disconnect(),A.observer=void 0}function s4(A){if(!A)return;const e=A.querySelector("diffs-container");if(e instanceof HTMLElement)return e}function hK(A){return s4(A)?.shadowRoot??void 0}function _c(A){if(!A||typeof document>"u")return;const e=document.documentElement.dataset.colorScheme;if(e==="dark"||e==="light"){A.dataset.colorScheme=e;return}A.removeAttribute("data-color-scheme")}function IK(A){if(typeof document>"u")return()=>{};if(_c(A()),typeof MutationObserver>"u")return()=>{};const e=document.documentElement,t=new MutationObserver(()=>_c(A()));return t.observe(e,{attributes:!0,attributeFilter:["data-color-scheme"]}),()=>t.disconnect()}function fK(A){br(A.state),A.state.token+=1;const e=A.state.token,t=Math.max(0,A.settleFrames??0),n=()=>{const o=s=>{if(e===A.state.token){if(s<=0){A.onReady();return}requestAnimationFrame(()=>o(s-1))}};requestAnimationFrame(()=>o(t))},i=o=>{if(A.isReady(o)){n();return}typeof MutationObserver>"u"||(br(A.state),A.state.observer=new MutationObserver(()=>{e===A.state.token&&A.isReady(o)&&(br(A.state),n())}),A.state.observer.observe(o,{childList:!0,subtree:!0}))},r=A.getRoot();if(!r){if(typeof MutationObserver>"u")return;A.state.observer=new MutationObserver(()=>{if(e!==A.state.token)return;const o=A.getRoot();o&&i(o)}),A.state.observer.observe(A.container,{childList:!0,subtree:!0});return}i(r)}function pK(A){return A?A.start===A.end&&(A.endSide==null||A.endSide===A.side):!1}function mK(A){if(A instanceof Range)return A;const e=new Range;return e.setStart(A.startContainer,A.startOffset),e.setEnd(A.endContainer,A.endOffset),e}function a4(A,e){!A||!e||requestAnimationFrame(()=>{const t=A.getSelection?.()??window.getSelection();if(t)try{t.removeAllRanges(),t.addRange(e)}catch{}})}function wK(){let A="none",e,t=!1,n=!1;const i=()=>{A="none",e=void 0,t=!1};return{begin(r,o){if(!r){A="text";return}A="numbers",e=o,t=!1},track(r,o){return A!=="numbers"?!1:(r&1)===0?(i(),!0):(o!==void 0&&e!==void 0&&o!==e&&(t=!0),!0)},finish(){const r=A;return n=r==="numbers"&&t,i(),r},consume(r){const o=n&&!pK(r);return n=!1,o},reset(){n=!1,i()}}}function el(A){if(A)return A instanceof HTMLElement?A:A.parentElement??void 0}function yK(A){const e=el(A);if(!e)return;const t=e.closest("[data-line]");if(!(t instanceof HTMLElement))return;const n=parseInt(t.dataset.line??"",10);if(!Number.isNaN(n))return n}function NE(A){const e=el(A);if(!e)return;const t=e.closest("[data-line], [data-alt-line]");if(!(t instanceof HTMLElement))return;const n=parseInt(t.dataset.line??"",10);if(!Number.isNaN(n))return n;const i=parseInt(t.dataset.altLine??"",10);if(!Number.isNaN(i))return i}function DK(A){const e=el(A);if(!e)return;const t=e.closest("[data-code]");if(t instanceof HTMLElement)return t.hasAttribute("data-deletions")?"deletions":"additions"}function l4(A){const e=A.root.getSelection?.()??window.getSelection();if(!e||e.isCollapsed)return;const t=e.getComposedRanges?.({shadowRoots:[A.root]})?.[0]??(e.rangeCount>0?e.getRangeAt(0):void 0),n=t?.startContainer??e.anchorNode,i=t?.endContainer??e.focusNode;if(!n||!i||!A.root.contains(n)||!A.root.contains(i))return;const r=A.lineForNode(n),o=A.lineForNode(i);if(r===void 0||o===void 0)return;const s=A.sideForNode?.(n),a=A.sideForNode?.(i),l=s??a,c={start:r,end:o};return l&&(c.side=l),a&&l&&a!==l&&(c.endSide=a),{range:c,text:A.preserveTextSelection&&t?mK(t).cloneRange():void 0}}const is=new WeakMap,kK={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function bK(A){return A==="auto"||A==="scroll"||A==="overlay"}function SE(A){let e=A.parentElement;for(;e;){const t=getComputedStyle(e);if(bK(t.overflowY))return e;e=e.parentElement}}function vK(A){if(typeof document>"u")return;const e=A.closest("[data-component='session-review']");if(e instanceof HTMLElement){const n=SE(A)??e,i=e.querySelector("[data-slot='session-review-container']");return{key:e,root:n,content:i instanceof HTMLElement?i:void 0}}const t=SE(A);if(t){const n=t.querySelector("[role='log']");return{key:t,root:t,content:n instanceof HTMLElement?n:void 0}}return{key:document,root:document,content:void 0}}function MK(A){const e=vK(A);if(!e)return;let t=is.get(e.key);if(!t){const i=new e4;i.setup(e.root,e.content),t={virtualizer:i,refs:0},is.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,release(){if(n)return;n=!0;const i=is.get(e.key);i&&(i.refs-=1,!(i.refs>0)&&(i.virtualizer.cleanUp(),is.delete(e.key)))}}}function NK(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var cr={exports:{}},SK=cr.exports,xE;function xK(){return xE||(xE=1,(function(A,e){(function(t,n){n(e)})(SK,function(t){const n=Symbol("newer"),i=Symbol("older");class r{constructor(g,d){typeof g!="number"&&(d=g,g=0),this.size=0,this.limit=g,this.oldest=this.newest=void 0,this._keymap=new Map,d&&(this.assign(d),g<1&&(this.limit=this.size))}_markEntryAsUsed(g){g!==this.newest&&(g[n]&&(g===this.oldest&&(this.oldest=g[n]),g[n][i]=g[i]),g[i]&&(g[i][n]=g[n]),g[n]=void 0,g[i]=this.newest,this.newest&&(this.newest[n]=g),this.newest=g)}assign(g){let d,Q=this.limit||Number.MAX_VALUE;this._keymap.clear();let B=g[Symbol.iterator]();for(let C=B.next();!C.done;C=B.next()){let I=new o(C.value[0],C.value[1]);if(this._keymap.set(I.key,I),d?(d[n]=I,I[i]=d):this.oldest=I,d=I,Q--==0)throw new Error("overflow")}this.newest=d,this.size=this._keymap.size}get(g){var d=this._keymap.get(g);return d?(this._markEntryAsUsed(d),d.value):void 0}set(g,d){var Q=this._keymap.get(g);return Q?(Q.value=d,this._markEntryAsUsed(Q),this):(this._keymap.set(g,Q=new o(g,d)),this.newest?(this.newest[n]=Q,Q[i]=this.newest):this.oldest=Q,this.newest=Q,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var g=this.oldest;if(g)return this.oldest[n]?(this.oldest=this.oldest[n],this.oldest[i]=void 0):(this.oldest=void 0,this.newest=void 0),g[n]=g[i]=void 0,this._keymap.delete(g.key),--this.size,[g.key,g.value]}find(g){let d=this._keymap.get(g);return d?d.value:void 0}has(g){return this._keymap.has(g)}delete(g){var d=this._keymap.get(g);return d?(this._keymap.delete(d.key),d[n]&&d[i]?(d[i][n]=d[n],d[n][i]=d[i]):d[n]?(d[n][i]=void 0,this.oldest=d[n]):d[i]?(d[i][n]=void 0,this.newest=d[i]):this.oldest=this.newest=void 0,this.size--,d.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new a(this.oldest)}values(){return new l(this.oldest)}entries(){return this}[Symbol.iterator](){return new s(this.oldest)}forEach(g,d){typeof d!="object"&&(d=this);let Q=this.oldest;for(;Q;)g.call(d,Q.value,Q.key,this),Q=Q[n]}toJSON(){for(var g=new Array(this.size),d=0,Q=this.oldest;Q;)g[d++]={key:Q.key,value:Q.value},Q=Q[n];return g}toString(){for(var g="",d=this.oldest;d;)g+=String(d.key)+":"+d.value,d=d[n],d&&(g+=" < ");return g}}t.LRUMap=r;function o(c,g){this.key=c,this.value=g,this[n]=void 0,this[i]=void 0}function s(c){this.entry=c}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let c=this.entry;return c?(this.entry=c[n],{done:!1,value:[c.key,c.value]}):{done:!0,value:void 0}};function a(c){this.entry=c}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let c=this.entry;return c?(this.entry=c[n],{done:!1,value:c.key}):{done:!0,value:void 0}};function l(c){this.entry=c}l.prototype[Symbol.iterator]=function(){return this},l.prototype.next=function(){let c=this.entry;return c?(this.entry=c[n],{done:!1,value:c.value}):{done:!0,value:void 0}}})})(cr,cr.exports)),cr.exports}var LK=xK();const LE=NK(LK),rs=Symbol("IGNORE_RESPONSE");var Cg=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},_K=class{highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(A,{langs:e,theme:t=Ee,useTokenTransformer:n=!1,lineDiffType:i="word-alt",maxLineDiffLength:r=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s="shiki-js"}){this.options=A,this.preferredHighlighter=s,this.renderOptions={theme:t,useTokenTransformer:n,lineDiffType:i,maxLineDiffLength:r,tokenizeMaxLineLength:o},this.fileCache=new LE.LRUMap(A.totalASTLRUCacheSize??100),this.diffCache=new LE.LRUMap(A.totalASTLRUCacheSize??100),this.queueInitialization(e)}isWorkingPool(){return!this.workersFailed}getFileResultCache(A){return A.cacheKey!=null?this.fileCache.get(A.cacheKey):void 0}getDiffResultCache(A){return A.cacheKey!=null?this.diffCache.get(A.cacheKey):void 0}inspectCaches(){const{fileCache:A,diffCache:e}=this;return{fileCache:A,diffCache:e}}evictFileFromCache(A){try{return this.fileCache.delete(A)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(A){try{return this.diffCache.delete(A)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:A=this.renderOptions.theme??Ee,useTokenTransformer:e=this.renderOptions.useTokenTransformer??!1,lineDiffType:t=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:n=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:r}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(r)&&this.renderOptionsRequestVersion===o;try{const a={theme:A,useTokenTransformer:e,lineDiffType:t,maxLineDiffLength:n,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||Ft(a,this.renderOptions))return;const l=Zr(A);let c=[];if(Gi(a.theme,this.renderOptions.theme)||(bc(l)?c=mE(l):c=await wE(l)),!s())return;if(this.highlighter!=null)kc(c,this.highlighter);else{const d=await na({themes:l,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=d}const g=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const d of this.themeSubscribers)d.onThemeChange();await g}catch(a){if(a instanceof Cg||!s())return;throw a}}getFileRenderOptions(){const{tokenizeMaxLineLength:A,theme:e,useTokenTransformer:t}=this.renderOptions;return{theme:e,useTokenTransformer:t,tokenizeMaxLineLength:A}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(A,e){if(this.workersFailed)return;this.isInitialized()||await this.initialize();const t=[];for(const n of this.workers){if(!n.initialized)throw console.log({managedWorker:n}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");t.push(new Promise((i,r)=>{const o=this.generateRequestId(),s={type:"set-render-options",id:o,request:{type:"set-render-options",id:o,renderOptions:A,resolvedThemes:e},resolve:i,reject:r,requestStart:Date.now()};this.activeTaskById.set(o,s),n.pendingSetupRequestId=o,n.worker.postMessage(s.request)}))}await Promise.all(t)}subscribeToThemeChanges(A){return this.themeSubscribers.add(A),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(A),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(A){this.themeSubscribers.delete(A),this.queueBroadcastStateChanges()}subscribeToStatChanges(A){return this.statSubscribers.add(A),A(this.getStats()),()=>{this.statSubscribers.delete(A)}}queueBroadcastStateChanges(){this._queuedBroadcast==null&&(this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges))}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);const A=this.getStats();for(const e of this.statSubscribers)e(A)};cleanUpTasks(A){this.detachInstanceFromQueuedTasks(A);const e=this.activeRequestByInstance.get(A);if(e!=null){const t=this.activeTaskById.get(e);En(t)?(this.detachInstanceFromRenderTask(t,A),!t.primeCache&&t.instances.size===0&&this.removeActiveTask(t)):this.activeTaskById.delete(e)}this.activeRequestByInstance.delete(A),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(A=[]){if(this.initialized!==!0)if(this.initialized===!1){const{lifecycleGeneration:e}=this;this.initialized=new Promise((t,n)=>{(async()=>{try{const i=Zr(this.renderOptions.theme);let r=[];if(bc(i)?r=mE(i):r=await wE(i),!this.isCurrentLifecycle(e)){t();return}let o=[];if(fE(A)?o=IE(A):o=await pE(A),!this.isCurrentLifecycle(e)){t();return}const[s]=await Promise.all([na({themes:i,langs:["text",...A],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(r,o)]);if(!this.isCurrentLifecycle(e)){this.terminateWorkers(),t();return}this.highlighter=s,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),t()}catch(i){if(i instanceof Cg||!this.isCurrentLifecycle(e)){t();return}this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),n(i)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(A,e){this.workersFailed=!1;const t=[],n=void 0;this.workers.length>0&&this.terminateWorkers();for(let i=0;i<(this.options.poolSize??8);i++){const r=this.options.workerFactory(),o={worker:r,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...e.map(({name:s})=>s)]),customExtensionsVersion:0};r.addEventListener("message",s=>{this.handleWorkerMessage(o,s.data)}),r.addEventListener("error",s=>console.error("Worker error:",s,o)),this.workers.push(o),t.push(new Promise((s,a)=>{const l=this.generateRequestId(),c={type:"initialize",id:l,request:{type:"initialize",id:l,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:A,resolvedLanguages:e,customExtensionsVersion:void 0,customExtensionMap:n},resolve(){o.initialized=!0,s()},reject:a,requestStart:Date.now()};this.activeTaskById.set(l,c),this.executeTask(o,c)}))}await Promise.all(t)}drainQueue=()=>{if(this._queuedDrain=void 0,!(this.initialized!==!0||this.queuedTasks.length===0)){for(let A=0;A<this.queuedTasks.length;){const e=this.queuedTasks[A];if(this.hasActiveRequest(e)){A++;continue}const t=_E(e),n=this.getAvailableWorker(t);if(n==null)break;this.queuedTasks.splice(A,1),this.assignWorkerToTask(e,n),this.resolveLanguagesAndExecuteTask(n,e,t)}this.queueBroadcastStateChanges()}};highlightFileAST(A,e){const t=this.getFileResultCache(e);Xr(e)||t!=null&&An(t.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(A,e)||this.submitTask(A,{type:"file",file:e})}primeFileHighlightCache(A){if(A.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${A.name}".`);return}const e=this.getFileResultCache(A),t=this.getFileHighlightKey(A);if(t==null||Xr(A)||e!=null&&An(e.options,this.getFileRenderOptions()))return;const n=this.getTaskByHighlightKey(t);n!=null?n.primeCache=!0:this.submitCacheTask({type:"file",file:A},t)}getPlainFileAST(A,e,t,n){if(this.highlighter==null){this.queueInitialization();return}return Nf(A,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:e,totalLines:t,lines:n})}highlightDiffAST(A,e){const t=this.getDiffResultCache(e);no(e)||t!=null&&Ft(t.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(A,e)||this.submitTask(A,{type:"diff",diff:e})}primeDiffHighlightCache(A){if(A.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${A.prevName??A.name}" -> "${A.name}".`);return}const e=this.getDiffResultCache(A),t=this.getDiffHighlightKey(A);if(t==null||no(A)||e!=null&&Ft(e.options,this.getDiffRenderOptions()))return;const n=this.getTaskByHighlightKey(t);n!=null?n.primeCache=!0:this.submitCacheTask({type:"diff",diff:A},t)}getPlainDiffAST(A,e,t,n,i){return this.highlighter!=null?Xf(A,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:e,totalLines:t,expandedHunks:n,collapsedContextThreshold:i}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(A){return this.lifecycleGeneration===A}queueInitialization(A){this.initialize(A).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){const A=new Cg;for(const e of this.activeTaskById.values())"reject"in e&&e.reject(A)}terminateWorkers(){for(const A of this.workers)A.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?"waiting":this.initialized!==!0?"initializing":"initialized",totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(A=>A.requestId!=null||A.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(A,e){this.initialized===!1&&this.queueInitialization();const t=this.getHighlightKeyForRequest(e),n=t!=null?this.getTaskByHighlightKey(t):void 0;if(n!=null){this.detachInstanceFromQueuedTasks(A,n),this.addInstanceToTask(n,A),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(A);const i=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set([A]),primeCache:!1,highlightKey:t,renderOptionsVersion:o,requestStart:r};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set([A]),primeCache:!1,highlightKey:t,renderOptionsVersion:o,requestStart:r}}})();this.enqueueRenderTask(s,A)}submitCacheTask(A,e){this.initialized===!1&&this.queueInitialization();const t=this.generateRequestId(),n=Date.now(),{renderOptionsVersion:i}=this,r=(()=>{switch(A.type){case"file":return{type:"file",id:t,request:{...A,id:t},instances:new Set,primeCache:!0,highlightKey:e,renderOptionsVersion:i,requestStart:n};case"diff":return{type:"diff",id:t,request:{...A,id:t},instances:new Set,primeCache:!0,highlightKey:e,renderOptionsVersion:i,requestStart:n}}})();this.enqueueRenderTask(r)}enqueueRenderTask(A,e){this.queuedTasks.push(A),e!=null&&this.queuedTaskByInstance.set(e,A),A.highlightKey!=null&&this.taskByHighlightKey.set(A.highlightKey,A),this.queueDrain()}async resolveLanguagesAndExecuteTask(A,e,t){try{const n=t.filter(i=>!A.langs.has(i));if(n.length>0&&(fE(n)?e.request.resolvedLanguages=IE(n):e.request.resolvedLanguages=await pE(n)),!this.activeTaskById.has(e.id)){A.requestId===e.id&&(this.cleanWorkerAndTask(A,e),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(A,e)}catch{this.cleanWorkerAndTask(A,e),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(A,e){const t=this.activeTaskById.get(e.id);try{if(t==null)throw rs;if(e.type==="error"){const n=new Error(e.error);if(e.stack&&(n.stack=e.stack),"reject"in t)t.reject(n);else if(En(t))this.notifyHighlightError(t,n);else throw new Error("handleWorkerMessage: unknown task type");throw n}else switch(e.requestType){case"initialize":if(t.type!=="initialize")throw new Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(A,t.request),t.resolve();break;case"set-render-options":if(t.type!=="set-render-options")throw new Error("handleWorkerMessage: task/response dont match");t.resolve();break;case"file":{if(t.type!=="file")throw new Error("handleWorkerMessage: task/response dont match");const{result:n,options:i}=e;if(!this.isCurrentRenderTask(t)||!An(i,this.getFileRenderOptions()))throw rs;const{request:r}=t;this.syncCustomExtensionVersion(A,r),r.file.cacheKey!=null&&this.fileCache.set(r.file.cacheKey,{result:n,options:i}),this.notifyFileInstances(t,n,i);break}case"diff":{if(t.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{result:n,options:i}=e;if(!this.isCurrentRenderTask(t)||!Ft(i,this.getDiffRenderOptions()))throw rs;const{request:r}=t;this.syncCustomExtensionVersion(A,r),r.diff.cacheKey!=null&&this.diffCache.set(r.diff.cacheKey,{result:n,options:i}),this.notifyDiffInstances(t,n,i);break}}}catch(n){n!==rs&&console.error(n,t,e)}this.cleanWorkerAndTask(A,t,e.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain==null&&(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(A,e){e.requestId=A.id,En(A)&&(this.clearQueuedInstanceRequests(A),this.trackInstanceRequests(A)),this.activeTaskById.set(A.id,A)}cleanWorkerAndTask(A,e,t=e?.id){A.requestId===t&&(A.requestId=void 0),A.pendingSetupRequestId===t&&(A.pendingSetupRequestId=void 0),e!=null&&(En(e)&&(this.clearInstanceRequests(e),this.clearHighlightKey(e)),this.activeTaskById.delete(e.id))}executeTask(A,e){FK(e.request)&&this.maybeAttachCustomExtensions(A,e.request),this.activeTaskById.has(e.id)||this.assignWorkerToTask(e,A);for(const t of _E(e))A.langs.add(t);try{A.worker.postMessage(e.request)}catch(t){console.error("Failed to post message to worker:",t),En(e)?this.notifyHighlightError(e,t):"reject"in e&&e.reject(t),this.cleanWorkerAndTask(A,e),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(A,e){if(e.customExtensionsVersion!=null)return;const t=EO();A.customExtensionsVersion>=t||(e.customExtensionsVersion=t,e.customExtensionMap=CO())}syncCustomExtensionVersion(A,e){e.customExtensionsVersion!=null&&(A.customExtensionsVersion=e.customExtensionsVersion)}getAvailableWorker(A){let e;for(const t of this.workers){if(t.requestId!=null||t.pendingSetupRequestId!=null||!t.initialized)continue;if(e=t,A.length===0)break;let n=!0;for(const i of A)if(!t.langs.has(i)){n=!1;break}if(n)break}return e}getFileHighlightKey(A){if(A.cacheKey!=null)return`file:${A.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(A){if(A.cacheKey!=null)return`diff:${A.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(A){switch(A.type){case"file":return this.getFileHighlightKey(A.file);case"diff":return this.getDiffHighlightKey(A.diff)}}hasActiveRequest(A){for(const e of Ar(A))if(this.activeRequestByInstance.has(e))return!0;return!1}addInstanceToTask(A,e){A.type,A.instances.add(e),this.activeTaskById.has(A.id)?this.activeRequestByInstance.set(e,A.id):this.queuedTaskByInstance.set(e,A)}detachInstanceFromQueuedTasks(A,e){const t=this.queuedTaskByInstance.get(A);t==null||t===e||(this.queuedTaskByInstance.delete(A),this.detachInstanceFromRenderTask(t,A),!t.primeCache&&t.instances.size===0&&this.removeQueuedTask(t))}detachInstanceFromRenderTask(A,e){A.type,A.instances.delete(e)}removeQueuedTask(A){const e=this.queuedTasks.indexOf(A);e!==-1&&this.queuedTasks.splice(e,1),this.clearQueuedInstanceRequests(A),this.clearHighlightKey(A)}removeActiveTask(A){this.clearInstanceRequests(A),this.clearHighlightKey(A),this.activeTaskById.delete(A.id)}invalidateRenderTasks(){for(let A=this.queuedTasks.length-1;A>=0;A--){const e=this.queuedTasks[A];e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(e)}for(const A of Array.from(this.activeTaskById.values()))En(A)&&A.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(A)}clearQueuedInstanceRequests(A){for(const e of Ar(A))this.queuedTaskByInstance.get(e)===A&&this.queuedTaskByInstance.delete(e)}clearHighlightKey(A){A.highlightKey!=null&&this.taskByHighlightKey.get(A.highlightKey)===A&&this.taskByHighlightKey.delete(A.highlightKey)}trackInstanceRequests(A){for(const e of Ar(A))this.activeRequestByInstance.set(e,A.id)}clearInstanceRequests(A){for(const e of Ar(A))this.activeRequestByInstance.get(e)===A.id&&this.activeRequestByInstance.delete(e)}notifyFileInstances(A,e,t){for(const n of A.instances)this.activeRequestByInstance.get(n)===A.id&&n.onHighlightSuccess(A.request.file,e,t)}notifyDiffInstances(A,e,t){for(const n of A.instances)this.activeRequestByInstance.get(n)===A.id&&n.onHighlightSuccess(A.request.diff,e,t)}notifyHighlightError(A,e){for(const t of Ar(A))this.activeRequestByInstance.get(t)===A.id&&t.onHighlightError(e)}hasMatchingFileInstanceTask(A,e){for(const t of this.iterateRenderTasks())if(t.type==="file"&&this.isCurrentRenderTask(t)&&t.instances.has(A)&&Et(e,t.request.file))return!0;return!1}hasMatchingDiffInstanceTask(A,e){for(const t of this.iterateRenderTasks())if(t.type==="diff"&&this.isCurrentRenderTask(t)&&t.instances.has(A)&&Ei(t.request.diff,e))return!0;return!1}getTaskByHighlightKey(A){const e=this.taskByHighlightKey.get(A);return e!=null&&this.isCurrentRenderTask(e)?e:void 0}isCurrentRenderTask(A){return A.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(const A of this.queuedTasks)yield A;for(const A of this.activeTaskById.values())En(A)&&(yield A)}generateRequestId(){return`req_${++this.nextRequestId}`}};function FK(A){return A.type==="initialize"||A.type==="file"||A.type==="diff"}function _E(A){const e=new Set;if(A.type==="initialize"||A.type==="set-render-options")return[];switch(A.type){case"file":e.add(A.request.file.lang??Pe(A.request.file.name));break;case"diff":e.add(A.request.diff.lang??Pe(A.request.diff.name)),e.add(A.request.diff.lang??Pe(A.request.diff.prevName??"-"));break}return e.delete("text"),Array.from(e)}function En(A){return A?.type==="file"||A?.type==="diff"}function Ar(A){return A.instances}const GK="/console/assets/worker-BVEmEyu5.js";lK();function RK(){return new Worker(GK,{type:"module"})}function FE(A){const e=new _K({workerFactory:RK,poolSize:2},{theme:la,lineDiffType:A,preferredHighlighter:"shiki-wasm"});return e.initialize(),e}let ug,hg;function da(A){if(!(typeof window>"u"))return A==="split"?(hg||(hg=FE("word-alt")),hg):(ug||(ug=FE("none")),ug)}var UK=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),TK=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function OK(A){if(Intl.Locale){const t=new Intl.Locale(A).maximize().script??"";return UK.has(t)}const e=A.split("-")[0];return TK.has(e)}function qK(A){return OK(A)?"rtl":"ltr"}function g4(){let A=typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([A])}catch{A="en-US"}return{locale:A,direction:qK(A)}}var Fc=g4(),dr=new Set;function GE(){Fc=g4();for(const A of dr)A(Fc)}function KK(){const[A,e]=T(Fc),t=R(()=>A());return C1(()=>{dr.size===0&&window.addEventListener("languagechange",GE),dr.add(e),DA(()=>{dr.delete(e),dr.size===0&&window.removeEventListener("languagechange",GE)})}),{locale:()=>t().locale,direction:()=>t().direction}}var JK=A1();function c4(){const A=KK();return Ve(JK)||A}var Ig=new Map;function HK(A){const{locale:e}=c4(),t=R(()=>e()+(A?Object.entries(A).sort((n,i)=>n[0]<i[0]?-1:1).join():""));return R(()=>{const n=t();let i;return Ig.has(n)&&(i=Ig.get(n)),i||(i=new Intl.Collator(e(),A),Ig.set(n,i)),i})}const YK={"ui.sessionReview.title":"Session changes","ui.sessionReview.title.git":"Git changes","ui.sessionReview.title.branch":"Branch changes","ui.sessionReview.title.lastTurn":"Last turn changes","ui.sessionReview.diffStyle.unified":"Unified","ui.sessionReview.diffStyle.split":"Split","ui.sessionReview.expandAll":"Expand all","ui.sessionReview.collapseAll":"Collapse all","ui.sessionReview.change.added":"Added","ui.sessionReview.change.removed":"Removed","ui.sessionReview.change.modified":"Modified","ui.sessionReview.image.loading":"Loading...","ui.sessionReview.image.placeholder":"Image","ui.sessionReview.largeDiff.title":"Diff too large to render","ui.sessionReview.largeDiff.meta":"Limit: {{limit}} changed lines. Current: {{current}} changed lines.","ui.sessionReview.largeDiff.renderAnyway":"Render anyway","ui.sessionReviewV2.expandMode":"Expand or collapse diff","ui.sessionReviewV2.filterFiles":"Filter files","ui.sessionReviewV2.toggleSidebar":"Toggle file tree","ui.sessionReviewV2.showAllLines":"Show all lines","ui.sessionReviewV2.hideNonDiffLines":"Hide non-diff lines","ui.sessionReviewV2.unifiedDiff":"Unified diff","ui.sessionReviewV2.splitDiff":"Split diff","ui.sessionReviewV2.previousFile":"Previous file","ui.sessionReviewV2.nextFile":"Next file","ui.sessionReviewV2.diffView":"Diff view","ui.sessionReviewV2.empty.noGit.title":"No tracked changes","ui.sessionReviewV2.empty.noGit.description":"Track, review, and undo changes in this project","ui.sessionReviewV2.empty.noGit.action":"Create Git repository","ui.sessionReviewV2.empty.noGit.actionLoading":"Creating Git repository...","ui.sessionReviewV2.empty.changes.title":"No file changes yet","ui.sessionReviewV2.empty.changes.description":"Project changes will appear here","ui.sessionReview.openFile":"Open file","ui.sessionReview.selection.line":"line {{line}}","ui.sessionReview.selection.lines":"lines {{start}}-{{end}}","ui.fileMedia.kind.image":"image","ui.fileMedia.kind.audio":"audio","ui.fileMedia.state.removed":"Removed {{kind}} file.","ui.fileMedia.state.loading":"Loading {{kind}}...","ui.fileMedia.state.error":"Unable to load {{kind}}.","ui.fileMedia.state.unavailable":"{{kind}} preview unavailable.","ui.fileMedia.binary.title":"Binary file","ui.fileMedia.binary.description.path":"{{path}} is binary.","ui.fileMedia.binary.description.default":"Binary content","ui.lineComment.label.prefix":"Comment on ","ui.lineComment.label.suffix":"","ui.lineComment.editorLabel.prefix":"Commenting on ","ui.lineComment.editorLabel.suffix":"","ui.lineComment.placeholder":"Add comment","ui.lineComment.contextPlaceholder":"Add context for this change","ui.lineComment.submit":"Comment","ui.lineComment.cancel":"Cancel","ui.sessionTurn.steps.show":"Show steps","ui.sessionTurn.steps.hide":"Hide steps","ui.sessionTurn.summary.response":"Response","ui.sessionTurn.diff.showMore":"Show more changes ({{count}})","ui.sessionTurn.diffs.changed.one":"{{count}} Changed file","ui.sessionTurn.diffs.changed.other":"{{count}} Changed files","ui.sessionTurn.diffs.showAll":"Show all","ui.sessionTurn.diffs.showLess":"Show less","ui.sessionTurn.diffs.more":"+{{count}} more files","ui.sessionTurn.retry.retrying":"retrying","ui.sessionTurn.retry.inSeconds":"in {{seconds}}s","ui.sessionTurn.retry.attempt":"attempt #{{attempt}}","ui.sessionTurn.retry.attemptLine":"{{line}} - attempt #{{attempt}}","ui.sessionTurn.retry.geminiHot":"gemini is way too hot right now","ui.sessionTurn.error.freeUsageExceeded":"Free usage exceeded","ui.sessionTurn.error.addCredits":"Add credits","dialog.usageExceeded.freeTier.title":"Free limit reached","dialog.usageExceeded.freeTier.description":"Subscribe to Kilo Go for reliable access to the best open-source models, starting at $5/month.","dialog.usageExceeded.freeTier.actionLabel":"Subscribe","dialog.usageExceeded.accountRateLimit.title":"Go limit reached","dialog.usageExceeded.accountRateLimit.description":"Usage limit reached. To continue using this model now, enable usage from your available balance","dialog.usageExceeded.accountRateLimit.actionLabel":"Open settings","ui.sessionTurn.status.delegating":"Delegating work","ui.sessionTurn.status.delegatingWaitingPermission":"Subagent waiting for permission","ui.sessionTurn.status.delegatingWaitingQuestion":"Subagent waiting for response","ui.sessionTurn.status.planning":"Planning next steps","ui.sessionTurn.status.gatheringContext":"Exploring","ui.sessionTurn.status.gatheredContext":"Explored","ui.sessionTurn.status.searchingCodebase":"Searching the codebase","ui.sessionTurn.status.searchingWeb":"Searching the web","ui.sessionTurn.status.makingEdits":"Making edits","ui.sessionTurn.status.runningCommands":"Running commands","ui.sessionTurn.status.thinking":"Thinking","ui.sessionTurn.status.thinkingWithTopic":"Thinking - {{topic}}","ui.sessionTurn.status.gatheringThoughts":"Gathering thoughts","ui.sessionTurn.status.consideringNextSteps":"Considering next steps","ui.messagePart.diagnostic.error":"Error","ui.messagePart.mcp.input":"Input","ui.messagePart.mcp.output":"Output","ui.messagePart.title.edit":"Edit","ui.messagePart.title.write":"Write","ui.messagePart.option.typeOwnAnswer":"Type your own answer","ui.messagePart.review.title":"Review your answers","ui.messagePart.questions.dismissed":"Questions dismissed","ui.messagePart.compaction":"Session compacted","ui.messagePart.context.read.one":"{{count}} read","ui.messagePart.context.read.other":"{{count}} reads","ui.messagePart.context.search.one":"{{count}} search","ui.messagePart.context.search.other":"{{count}} searches","ui.messagePart.context.list.one":"{{count}} list","ui.messagePart.context.list.other":"{{count}} lists","ui.list.loading":"Loading","ui.list.empty":"No results","ui.list.clearFilter":"Clear filter","ui.list.emptyWithFilter.prefix":"No results for","ui.list.emptyWithFilter.suffix":"","ui.fileSearch.placeholder":"Find","ui.fileSearch.previousMatch":"Previous match","ui.fileSearch.nextMatch":"Next match","ui.fileSearch.close":"Close search","ui.messageNav.newMessage":"New message","ui.promptInput.noMatchingItems":"No matching items","ui.promptInput.commands":"Commands","ui.promptInput.dropFiles":"Drop files to attach","ui.promptInput.removeAttachment":"Remove attachment","ui.promptInput.label":"Prompt","ui.promptInput.placeholder.shell":"Enter shell command...","ui.promptInput.placeholder.normal":"Ask anything, {{slash}} for commands, {{at}} for context...","ui.promptInput.add":"Add images and files","ui.promptInput.attachments":"Images and files","ui.promptInput.context":"Context","ui.promptInput.shell":"Shell command","ui.promptInput.chooseAgent":"Choose agent","ui.promptInput.chooseModel":"Choose model","ui.promptInput.chooseVariant":"Choose model variant","ui.promptInput.send":"Send","ui.promptInput.stop":"Stop","ui.tabs.close":"Close tab","ui.textField.copyToClipboard":"Copy to clipboard","ui.textField.copyLink":"Copy link","ui.textField.copied":"Copied","ui.imagePreview.alt":"Image preview","ui.mermaid.rendering":"Rendering Mermaid diagram...","ui.mermaid.renderError":"Mermaid render failed: {{message}}","ui.mermaid.errorDefault":"Unable to render Mermaid diagram.","ui.mermaid.errorEmpty":"Mermaid rendered an empty diagram.","ui.mermaid.download":"Download","ui.mermaid.copySource":"Copy Mermaid source","ui.mermaid.copySvg":"Copy SVG","ui.mermaid.copyPng":"Copy PNG","ui.mermaid.downloadSvg":"Download SVG","ui.mermaid.downloadPng":"Download PNG","ui.scrollView.ariaLabel":"scrollable content","ui.tool.read":"Read","ui.tool.loaded":"Loaded","ui.tool.list":"List","ui.tool.glob":"Glob","ui.tool.grep":"Grep","ui.tool.task":"Task","ui.tool.webfetch":"Webfetch","ui.tool.websearch":"Web Search","ui.tool.websearch.provider":"{{provider}} Web Search","ui.tool.shell":"Shell","ui.tool.patch":"Patch","ui.tool.todos":"To-dos","ui.tool.todos.read":"Read to-dos","ui.tool.questions":"Questions","ui.tool.questions.numbered":"Questions {{number}}","ui.tool.agent":"{{type}} Agent","ui.tool.agent.default":"Agent","ui.tool.skill":"Skill","ui.basicTool.called":"Called `{{tool}}`","ui.toolErrorCard.failed":"Failed","ui.toolErrorCard.copyError":"Copy error","ui.common.file.one":"file","ui.common.file.other":"files","ui.common.question.one":"question","ui.common.question.other":"questions","ui.common.add":"Add","ui.common.clear":"Clear","ui.common.file":"File","ui.common.back":"Back","ui.common.cancel":"Cancel","ui.common.confirm":"Confirm","ui.common.dismiss":"Dismiss","ui.common.close":"Close","ui.common.next":"Next","ui.common.submit":"Submit","ui.common.showMore":"Show more","ui.permission.deny":"Deny","ui.permission.allowAlways":"Allow always","ui.permission.allowOnce":"Allow once","ui.message.expand":"Expand message","ui.message.collapse":"Collapse message","ui.message.copy":"Copy","ui.message.copyMessage":"Copy message","ui.message.deleteQueued":"Delete queued message","ui.message.forkMessage":"Fork to new session","ui.message.revertMessage":"Revert to here","ui.message.copyResponse":"Copy response","ui.message.copied":"Copied","ui.message.duration.seconds":"{{count}}s","ui.message.duration.minutesSeconds":"{{minutes}}m {{seconds}}s","ui.message.interrupted":"Interrupted","ui.message.queued":"Queued","ui.message.attachment.alt":"attachment","ui.patch.action.deleted":"Deleted","ui.patch.action.created":"Created","ui.patch.action.moved":"Moved","ui.patch.action.patched":"Patched","ui.patch.action.plan":"Plan","ui.question.subtitle.answered":"{{count}} answered","ui.question.subtitle.dismissed":"{{count}} dismissed","ui.question.answer.none":"(no answer)","ui.question.answer.dismissed":"Dismissed","ui.question.review.notAnswered":"(not answered)","ui.question.multiHint":"Select all answers that apply","ui.question.singleHint":"Select one answer","ui.question.custom.placeholder":"Type your answer..."},er=new Map;function PK(A,e){const t=er.get(A);if(t)return t.select(e);const n=new Intl.PluralRules(A);return er.size>=32&&er.delete(er.keys().next().value),er.set(A,n),n.select(e)}function VK(A,e){return`${A}.${e}`}function jK(A,e){return e?A.replace(/{{\s*([^}]+?)\s*}}/g,(t,n)=>{const i=String(n),r=e[i];return r===void 0?"":String(r)}):A}const Gc={locale:()=>"en",t:(A,e)=>{const t=YK[A]??String(A);return jK(t,e)},plural:(A,e,t)=>Gc.t(VK(A,PK(Gc.locale(),e)),{...t,count:e})},zK=A1(Gc);function tl(){return Ve(zK)}const $K=new Set(["png","jpg","jpeg","gif","webp","avif","bmp","ico","tif","tiff","heic"]),WK=new Set(["mp3","wav","ogg","m4a","aac","flac","opus"]);function nl(A){if(!(!A||typeof A!="object"))return A}function X0(A){if(!A)return;const e=A.split(";",1)[0]?.trim().toLowerCase();if(e)return e==="audio/x-aac"?"audio/aac":e==="audio/x-m4a"?"audio/mp4":e}function ZK(A){if(!A)return"";const e=A.lastIndexOf(".");return e===-1?"":A.slice(e+1).toLowerCase()}function XK(A){const e=ZK(A);if(e==="svg")return"svg";if($K.has(e))return"image";if(WK.has(e))return"audio"}function AJ(A){return nl(A)?.type==="binary"}function eJ(A,e){if(e==="svg")return A.startsWith("data:image/svg+xml")?A:void 0;if(e==="image")return A.startsWith("data:image/")?A:void 0;if(A.startsWith("data:audio/x-aac;"))return A.replace("data:audio/x-aac;","data:audio/aac;");if(A.startsWith("data:audio/x-m4a;"))return A.replace("data:audio/x-m4a;","data:audio/mp4;");if(A.startsWith("data:audio/"))return A}function fg(A,e){if(!A)return;if(typeof A=="string")return eJ(A,e);const t=nl(A);if(!t||typeof t.content!="string")return;const n=X0(typeof t.mimeType=="string"?t.mimeType:void 0);if(n){if(e==="svg")return n!=="image/svg+xml"?void 0:t.encoding==="base64"?`data:image/svg+xml;base64,${t.content}`:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t.content)}`;if(!(e==="image"&&!n.startsWith("image/"))&&!(e==="audio"&&!n.startsWith("audio/"))&&t.encoding==="base64")return`data:${n};base64,${t.content}`}}function tJ(A){if(typeof atob=="function")try{const e=atob(A),t=Uint8Array.from(e,n=>n.charCodeAt(0));return typeof TextDecoder=="function"?new TextDecoder().decode(t):e}catch{}}function nJ(A){const e=nl(A);if(!(!e||typeof e.content!="string"||X0(typeof e.mimeType=="string"?e.mimeType:void 0)!=="image/svg+xml"))return e.encoding==="base64"?tJ(e.content):e.content}function pg(A){if(typeof A=="string")return A.length>0;const e=nl(A);return e?typeof e.content=="string"&&e.content.length>0:!1}var iJ=D('<div class="flex min-h-56 flex-col items-center justify-center gap-2 px-6 py-10 text-center"><div class="text-14-semibold text-text-strong"></div><div class="text-14-regular text-text-weak">'),os=D('<div class="flex min-h-40 items-center justify-center px-6 py-4 text-center text-text-weak">'),rJ=D('<div class="flex justify-center bg-background-stronger px-6 py-4"><img class="max-h-[60vh] max-w-full rounded border border-border-weak-base bg-background-base object-contain">'),oJ=D('<div class="flex justify-center bg-background-stronger px-6 py-4"><audio class="w-full max-w-xl"controls preload=metadata><source>'),sJ=D('<div class="flex flex-col gap-4 px-6 py-4">'),aJ=D('<div class="flex justify-center"><img class="max-h-[60vh] max-w-full rounded border border-border-weak-base bg-background-base object-contain">');function lJ(A,e){return A.current!==void 0?A.current:A.after??A.before}function RE(A){const e=tl(),t=()=>A.media,n=R(()=>{const u=t();if(!(!u||u.mode==="off"))return XK(u.path)}),i=R(()=>{const u=t();return!u||u.mode==="off"||n()?!1:AJ(u.current)}),r=()=>A.media?.onLoad?.(),o=R(()=>{const u=t(),p=n();return!u||!p?!1:u.deleted?!0:p==="svg"||u.current!==void 0?!1:!pg(u.after)&&pg(u.before)}),s=R(()=>{const u=t(),p=n();if(!(!u||p!=="image"&&p!=="audio"))return fg(lJ(u,p),p)}),a=R(()=>{const u=t(),p=n();if(!(!u||p!=="image"&&p!=="audio")&&u.current===void 0&&!o()&&!s()&&!(!u.path||!u.readFile))return{key:`${p}:${u.path}`,kind:p,path:u.path,readFile:u.readFile,onError:u.onError}}),[l]=et(a,async u=>u.readFile(u.path).then(p=>{const w=fg(p,u.kind);return w?{key:u.key,src:w,mime:u.kind==="audio"?X0(p?.mimeType):void 0}:(u.onError?.({kind:u.kind}),{key:u.key,error:!0})},()=>(u.onError?.({kind:u.kind}),{key:u.key,error:!0}))),c=R(()=>{const u=a(),p=l();if(!(!u||!p||p.key!==u.key))return p}),g=R(()=>{const u=c();return s()??(u&&"src"in u?u.src:void 0)}),d=R(()=>s()?"ready":a()?l.loading?"loading":c()?.error?"error":g()?"ready":"idle":"idle"),Q=R(()=>{const u=c();return u&&"mime"in u?u.mime:void 0}),B=R(()=>{const u=t();if(!(!u||n()!=="svg"))return nJ(u.current)}),C=R(()=>{const u=t();if(!(!u||n()!=="svg"))return fg(u.current,"svg")}),I=R(()=>{const u=t();if(!(!u||n()!=="svg")&&B()===void 0&&pg(u.current))return[u.path,u.current]});nA(B1(I,u=>{u&&t()?.onError?.({kind:"svg"})},{defer:!0}));const f=u=>e.t(u==="image"?"ui.fileMedia.kind.image":"ui.fileMedia.kind.audio");return E(xr,{get children(){return[E(Te,{get when(){return n()==="image"||n()==="audio"},get children(){return E(H,{get when(){return g()},get fallback(){const u=t(),p=n();if(!u||p!=="image"&&p!=="audio")return A.fallback();const w=f(p);return o()?(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.removed",{kind:w})),m})():d()==="loading"?(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.loading",{kind:w})),m})():d()==="error"?(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.error",{kind:w})),m})():(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.unavailable",{kind:w})),m})()},children:u=>{const p=n();return p!=="image"&&p!=="audio"?A.fallback():p==="image"?(()=>{var w=rJ(),m=w.firstChild;return m.addEventListener("load",r),Y(y=>{var M=u(),k=t()?.path;return M!==y.e&&j(m,"src",y.e=M),k!==y.t&&j(m,"alt",y.t=k),y},{e:void 0,t:void 0}),w})():(()=>{var w=oJ(),m=w.firstChild,y=m.firstChild;return m.addEventListener("loadedmetadata",r),Y(M=>{var k=u(),N=Q();return k!==M.e&&j(y,"src",M.e=k),N!==M.t&&j(y,"type",M.t=N),M},{e:void 0,t:void 0}),w})()}})}}),E(Te,{get when(){return n()==="svg"},get children(){return B()===void 0&&C()==null?A.fallback():(()=>{var u=sJ();return h(u,E(H,{get when(){return B()!==void 0},get children(){return A.fallback()}}),null),h(u,E(H,{get when(){return C()},children:p=>(()=>{var w=aJ(),m=w.firstChild;return m.addEventListener("load",r),Y(y=>{var M=p(),k=t()?.path;return M!==y.e&&j(m,"src",y.e=M),k!==y.t&&j(m,"alt",y.t=k),y},{e:void 0,t:void 0}),w})()}),null),u})()}}),E(Te,{get when(){return i()},get children(){var u=iJ(),p=u.firstChild,w=p.nextSibling;return h(p,()=>t()?.path?.split("/").pop()??e.t("ui.fileMedia.binary.title")),h(w,()=>{const m=t()?.path;return m?e.t("ui.fileMedia.binary.description.path",{path:m}):e.t("ui.fileMedia.binary.description.default")}),u}}),E(Te,{when:!0,get children(){return A.fallback()}})]}})}var gJ=D('<div class="fixed z-50 flex h-8 items-center gap-2 rounded-md border border-border-base bg-background-base px-3 shadow-md"><input class="w-40 bg-transparent outline-none text-14-regular text-text-strong placeholder:text-text-weak"><div class="shrink-0 text-12-regular text-text-weak tabular-nums text-right"style=width:10ch></div><div class="flex items-center"><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button></div><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong">');function cJ(A){const e=tl();return E(yC,{get children(){var t=gJ(),n=t.firstChild,i=n.nextSibling,r=i.nextSibling,o=r.firstChild,s=o.nextSibling,a=r.nextSibling;t.$$pointerdown=c=>c.stopPropagation(),h(t,E(gi,{name:"magnifying-glass",size:"small",class:"text-text-weak shrink-0"}),n),n.$$keydown=c=>A.onKeyDown(c),n.$$input=c=>A.onInput(c.currentTarget.value);var l=A.setInput;return typeof l=="function"?He(l,n):A.setInput=n,h(i,(()=>{var c=hA(()=>!!A.count());return()=>c()?`${A.index()+1}/${A.count()}`:"0/0"})()),zA(o,"click",A.onPrev,!0),h(o,E(gi,{name:"chevron-down",size:"small",class:"rotate-180"})),zA(s,"click",A.onNext,!0),h(s,E(gi,{name:"chevron-down",size:"small"})),zA(a,"click",A.onClose,!0),h(a,E(gi,{name:"close-small",size:"small"})),Y(c=>{var g=`${A.pos().top}px`,d=`${A.pos().right}px`,Q=e.t("ui.fileSearch.placeholder"),B=A.count()===0,C=e.t("ui.fileSearch.previousMatch"),I=A.count()===0,f=e.t("ui.fileSearch.nextMatch"),u=e.t("ui.fileSearch.close");return g!==c.e&&dt(t,"top",c.e=g),d!==c.t&&dt(t,"right",c.t=d),Q!==c.a&&j(n,"placeholder",c.a=Q),B!==c.o&&(o.disabled=c.o=B),C!==c.i&&j(o,"aria-label",c.i=C),I!==c.n&&(s.disabled=c.n=I),f!==c.s&&j(s,"aria-label",c.s=f),u!==c.h&&j(a,"aria-label",c.h=u),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),Y(()=>n.value=A.query()),t}})}Ae(["pointerdown","input","keydown","click"]);var dJ=D('<div data-component=file class="relative outline-none"tabindex=0><div></div><div class="pointer-events-none absolute inset-0 z-0">');const QJ=5e5,BJ={...Ta,lineHeight:24,spacing:0},d4=["mode","media","class","classList","annotations","selectedLines","commentedLines","search","onLineSelected","onLineSelectionEnd","onLineNumberSelectionEnd","onRendered","preloadedDiff"],EJ=["file",...d4],CJ=["fileDiff","before","after","virtualize",...d4];function uJ(A){let e,t,n,i,r,o,s,a=!1,l=null,c=!1;const g=uK(),d=wK(),[Q,B]=T(0),C=()=>hK(t),I=()=>s4(t),f=CK({wrapper:()=>e,overlay:()=>n,getRoot:C}),u=()=>{i===void 0&&(i=requestAnimationFrame(()=>{i=void 0;const k=c;A.updateSelection(k),c&&(c=!1,A.onLineSelectionEnd(l))}))},p=()=>{r===void 0&&(r=requestAnimationFrame(()=>{r=void 0;const k=A.buildDragSelection();k&&A.setSelectedLines(k)}))},w=k=>{if(!A.enableLineSelection()||k.button!==0)return;const N=A.lineFromMouseEvent(k);if(N.numberColumn){d.begin(!0,N.line);return}N.line!==void 0&&(d.begin(!1,N.line),o=N.line,s=N.line,a=!1,A.onDragStart(N))},m=k=>{if(!A.enableLineSelection())return;const N=A.lineFromMouseEvent(k);if(!d.track(k.buttons,N.line)&&o!==void 0){if((k.buttons&1)===0){o=void 0,s=void 0,a=!1,A.onDragReset(),d.finish();return}N.line!==void 0&&(s=N.line,a=!0,A.onDragMove(N),p())}},y=()=>{if(A.enableLineSelection()&&d.finish()!=="numbers"&&o!==void 0){if(!a){c=!1;const k=A.buildClickSelection();k&&A.setSelectedLines(k),A.onLineSelectionEnd(l),o=void 0,s=void 0,a=!1,A.onDragReset();return}c=!0,p(),u(),o=void 0,s=void 0,a=!1,A.onDragReset()}},M=()=>{if(!A.enableLineSelection()||o===void 0)return;const k=window.getSelection();!k||k.isCollapsed||u()};return C1(()=>{DA(IK(I))}),nA(()=>{Q();const k=A.commentedLines();requestAnimationFrame(()=>{const N=C();N&&A.markCommented(N,k)})}),nA(()=>{A.setSelectedLines(A.selectedLines()??null)}),nA(()=>{A.enableLineSelection()&&(tn(t,"mousedown",w),tn(t,"mousemove",m),tn(window,"mouseup",y),tn(document,"selectionchange",M))}),DA(()=>{br(g),i!==void 0&&cancelAnimationFrame(i),r!==void 0&&cancelAnimationFrame(r),i=void 0,r=void 0,o=void 0,s=void 0,a=!1,d.reset(),l=null,c=!1}),{get wrapper(){return e},set wrapper(k){e=k},get container(){return t},set container(k){t=k},get overlay(){return n},set overlay(k){n=k},get dragStart(){return o},get dragEnd(){return s},get lastSelection(){return l},set lastSelection(k){l=k},ready:g,bridge:d,rendered:Q,setRendered:B,getRoot:C,getHost:I,find:f,scheduleSelectionUpdate:u}}function Q4(A,e){return uJ({enableLineSelection:A.enableLineSelection,selectedLines:A.selectedLines,commentedLines:()=>A.commentedLines()??[],onLineSelectionEnd:A.onLineSelectionEnd,...e})}function B4(A){nA(()=>{const e=A.search();if(!e)return;const t={focus:()=>A.find.focus()};e.register(t),DA(()=>e.register(null))})}function E4(A){const e=t=>{if(!A.normalize)return t;const n=A.normalize(t);return n!==void 0?n:t};return{onLineSelected:t=>{const n=e(t);A.viewer.lastSelection=n,A.onLineSelected?.(n)},onLineSelectionEnd:t=>{const n=e(t);A.viewer.lastSelection=n,A.onLineSelectionEnd?.(n),A.viewer.bridge.consume(n)&&requestAnimationFrame(()=>A.onLineNumberSelectionEnd?.(n))}}}function C4(A){nA(()=>{A.viewer.rendered();const e=A.current();e&&(e.setLineAnnotations(A.annotations()),e.rerender(),requestAnimationFrame(()=>A.viewer.find.refresh({reset:!0})))})}function u4(A){fK({state:A.viewer.ready,container:A.viewer.container,getRoot:A.viewer.getRoot,isReady:A.isReady,settleFrames:A.settleFrames,onReady:A.onReady})}function h4(A){br(A.viewer.ready);const e=A.reset===!0&&A.current!==void 0;e&&A.current?.cleanUp();const t=e||!A.current?A.create():A.current;e||!A.current?(A.viewer.container.innerHTML="",A.assign(t)):A.update?.(t),A.draw(t),_c(A.viewer.getHost()),A.viewer.setRendered(n=>n+1),A.onReady()}function hJ(A){const e=I4(A.wrapper);if(!e)return()=>{};const t=A.container.getBoundingClientRect().height;if(!t)return()=>{};const n=A.wrapper.getBoundingClientRect().top-e.getBoundingClientRect().top,i=A.container.style.minHeight;A.container.style.minHeight=`${Math.ceil(t)}px`;let r=!1;return()=>{if(r)return;r=!0,A.container.style.minHeight=i;const s=A.wrapper.getBoundingClientRect().top-e.getBoundingClientRect().top-n;s&&(e.scrollTop+=s)}}function I4(A){let e=A.parentElement;for(;e;){const t=getComputedStyle(e);if(t.overflowY==="auto"||t.overflowY==="scroll")return e;e=e.parentElement}}function IJ(A,e){let t,n;const i=()=>{t?.cleanUp(),t=void 0,n=void 0};return{get:()=>{if(!e()){i();return}if(typeof document>"u")return;const r=A();if(!r)return;const o=I4(r)??document;return t&&n===o||(i(),t=new e4,n=o,t.setup(o,o instanceof Document?void 0:r)),t},cleanup:i}}function fJ(A,e){let t;const n=()=>{t?.release(),t=void 0};return{get:()=>{if(!e()){n();return}if(t)return t.virtualizer;const i=A();if(!i)return;const r=MK(i);if(r)return t=r,r.virtualizer},cleanup:n}}function pJ(A){if(!A.dataset.line)return;const e=parseInt(A.dataset.line,10);if(!Number.isNaN(e))return e}function f4(A,e,t){const n=A.composedPath();let i=!1,r,o;for(const s of n)if(s instanceof HTMLElement&&(i=i||s.dataset.columnNumber!=null,r===void 0&&(r=e(s)),o===void 0&&t&&(o=t(s)),i&&r!==void 0&&(t==null||o!==void 0)))break;return{line:r,numberColumn:i,side:o}}function mJ(A){const e=A.dataset.lineType;if(e==="change-deletion")return"deletions";if(e==="change-addition"||e==="change-additions")return"additions";if(A.dataset.code!=null)return A.hasAttribute("data-deletions")?"deletions":"additions"}function wJ(A){const e=el(A);if(e)return n4(e)}function p4(A){return(()=>{var e=dJ(),t=e.firstChild,n=t.nextSibling;return zA(e,"focus",A.viewer.find.onFocus),zA(e,"pointerdown",A.viewer.find.onPointerDown,!0),He(i=>A.viewer.wrapper=i,e),h(e,E(H,{get when(){return A.viewer.find.open()},get children(){return E(cJ,{get pos(){return A.viewer.find.pos},get query(){return A.viewer.find.query},get count(){return A.viewer.find.count},get index(){return A.viewer.find.index},get setInput(){return A.viewer.find.setInput},get onInput(){return A.viewer.find.setQuery},get onKeyDown(){return A.viewer.find.onInputKeyDown},get onClose(){return A.viewer.find.close},onPrev:()=>A.viewer.find.next(-1),onNext:()=>A.viewer.find.next(1)})}}),t),He(i=>A.viewer.container=i,t),He(i=>A.viewer.overlay=i,n),Y(i=>{var r=A.mode,o=t4,s={...A.classList,[A.class??""]:!!A.class};return r!==i.e&&j(e,"data-mode",i.e=r),i.t=ao(e,o,i.t),i.a=Ni(e,s,i.a),i},{e:void 0,t:void 0,a:void 0}),e})()}function yJ(A){let e,t;const[n,i]=MA(A,EJ),r=()=>{const f=n.file.contents;return typeof f=="string"?f:Array.isArray(f)?f.join(`
808
+ `;function Z0(A){return{theme:la,themeType:"system",disableLineNumbers:!1,overflow:"wrap",diffStyle:A??"unified",diffIndicators:"bars",lineHoverHighlight:"both",disableBackground:!1,expansionLineCount:20,hunkSeparators:"line-info-basic",lineDiffType:A==="split"?"word-alt":"none",maxLineDiffLength:1e3,maxLineLengthForHighlighting:1e3,disableFileHeader:!0,unsafeCSS:gK}}const t4={"--diffs-font-family":"var(--font-family-mono)","--diffs-font-size":"var(--font-size-small)","--diffs-line-height":"24px","--diffs-tab-size":2,"--diffs-font-features":"var(--font-family-mono--font-feature-settings)","--diffs-header-font-family":"var(--font-family-sans)","--diffs-gap-block":0,"--diffs-min-number-column-width":"4ch"};function n4(A){const e=A.closest("[data-line], [data-alt-line]");if(e instanceof HTMLElement){const n=e.dataset.lineType;if(n==="change-deletion")return"deletions";if(n==="change-addition"||n==="change-additions")return"additions"}const t=A.closest("[data-code]");return t instanceof HTMLElement&&t.hasAttribute("data-deletions")?"deletions":"additions"}function Lc(A,e){const t=e.dataset.lineIndex;if(!t)return;const n=t.split(",").map(i=>parseInt(i,10)).filter(i=>!Number.isNaN(i));if(n.length!==0)return A&&n.length===2?n[1]:n[0]}function ga(A,e,t,n){const i=Array.from(A.querySelectorAll(`[data-line="${t}"], [data-alt-line="${t}"]`)).filter(o=>o instanceof HTMLElement);if(i.length===0)return;const r=n??"additions";for(const o of i)if(n4(o)===r||parseInt(o.dataset.altLine??"",10)===t)return Lc(e,o)}function DE(A,e){if(!e)return e;if(!A)return;const t=A.querySelector("[data-diff]");if(!(t instanceof HTMLElement))return;const n=t.dataset.diffType==="split",i=ga(A,n,e.start,e.side),r=ga(A,n,e.end,e.endSide??e.side);if(i===void 0||r===void 0)return A.querySelector("[data-line], [data-alt-line]")==null?void 0:null;if(i<=r)return e;const o=e.endSide??e.side,s={start:e.end,end:e.start};return o&&(s.side=o),e.endSide&&e.side&&(s.endSide=e.side),s}function i4(A){const e=A.dataset.lineAnnotation?.split(",")[1];if(!e)return;const t=parseInt(e,10);if(!Number.isNaN(t))return t}function r4(A){const e=Array.from(A.querySelectorAll("[data-comment-selected]"));for(const t of e)t instanceof HTMLElement&&t.removeAttribute("data-comment-selected")}function cK(A,e){r4(A);const t=A.querySelector("[data-diff]");if(!(t instanceof HTMLElement))return;const n=t.dataset.diffType==="split",i=Array.from(t.querySelectorAll("[data-line-index]")).filter(o=>o instanceof HTMLElement);if(i.length===0)return;const r=Array.from(t.querySelectorAll("[data-line-annotation]")).filter(o=>o instanceof HTMLElement);for(const o of e){const s=ga(A,n,o.start,o.side);if(s===void 0)continue;const a=o.end===o.start&&(o.endSide==null||o.endSide===o.side)?s:ga(A,n,o.end,o.endSide??o.side);if(a===void 0)continue;const l=Math.min(s,a),c=Math.max(s,a);for(const g of i){const d=Lc(n,g);d===void 0||d<l||d>c||g.setAttribute("data-comment-selected","")}for(const g of r){const d=i4(g);d===void 0||d<l||d>c||g.setAttribute("data-comment-selected","")}}}function dK(A,e){r4(A);const t=Array.from(A.querySelectorAll("[data-line-annotation]")).filter(n=>n instanceof HTMLElement);for(const n of e){const i=Math.max(1,Math.min(n.start,n.end)),r=Math.max(n.start,n.end);for(let o=i;o<=r;o++){const s=Array.from(A.querySelectorAll(`[data-line="${o}"], [data-column-number="${o}"]`));for(const a of s)a instanceof HTMLElement&&a.setAttribute("data-comment-selected","")}for(const o of t){const s=i4(o);s===void 0||s<i||s>r||o.setAttribute("data-comment-selected","")}}}function QK(A,e){const t=new ResizeObserver(A);return DA(t.disconnect.bind(t)),{observe:n=>t.observe(n,e),unobserve:t.unobserve.bind(t)}}function o4(A,e,t){const n=new WeakMap,{observe:i,unobserve:r}=QK(o=>{for(const s of o){const{contentRect:a,target:l}=s,c=Math.round(a.width),g=Math.round(a.height),d=n.get(l);(!d||d.width!==c||d.height!==g)&&(e(a,l,s),n.set(l,{width:c,height:g}))}},t);nA(o=>{const s=qC(xs(iA(A)));return KC(s,o,i,r),s},[])}const ca=new Set;let $t,y1,kE=!1;function BK(A){return A instanceof HTMLElement?A.closest("[data-prevent-autofocus]")||A.isContentEditable?!0:/^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(A.tagName):!1}function bE(A){if(A instanceof Node)for(const e of ca){const t=e.element();if(t&&t.isConnected&&t.contains(A))return e}}function EK(){kE||typeof window>"u"||(kE=!0,window.addEventListener("keydown",A=>{if(A.defaultPrevented||BK(A.target)||!(A.metaKey||A.ctrlKey))return;const t=A.key.toLowerCase();if(t==="g"){const r=y1;if(!r||!r.isOpen())return;A.preventDefault(),A.stopPropagation(),r.next(A.shiftKey?-1:1);return}if(t!=="f")return;const n=y1;if(n&&n.isOpen()){A.preventDefault(),A.stopPropagation(),n.open();return}const i=bE(document.activeElement)??bE(A.target)??$t??Array.from(ca)[0];i&&(A.preventDefault(),A.stopPropagation(),i.open())},{capture:!0}))}function ni(){const A=globalThis.CSS?.highlights;A&&(A.delete("opencode-find"),A.delete("opencode-find-current"))}function vE(){const A=globalThis;return typeof A.Highlight=="function"&&A.CSS?.highlights!=null}function ME(A){let e=A.parentElement;for(;e;){const t=getComputedStyle(e);if(t.overflowY==="auto"||t.overflowY==="scroll")return e;e=e.parentElement}}function CK(A){let e,t,n="overlay",i=[];const[r,o]=T([]),[s,a]=zc({open:!1,query:"",index:0,count:0,pos:{top:8,right:8}}),l=()=>s.open,c=()=>s.query,g=()=>s.index,d=()=>s.count,Q=()=>s.pos,B=()=>{o([])},C=()=>{const S=A.overlay();S&&(t!==void 0&&(cancelAnimationFrame(t),t=void 0),S.innerHTML="")},I=()=>{if(n!=="overlay"){C();return}const S=A.wrapper(),G=A.overlay();if(!S||!G||(C(),i.length===0))return;const q=S.getBoundingClientRect(),K=g(),J=document.createDocumentFragment();for(let P=0;P<i.length;P++){const V=i[P],rA=P===K;for(const sA of Array.from(V.getClientRects())){if(!sA.width||!sA.height)continue;const z=document.createElement("div");z.style.position="absolute",z.style.left=`${Math.round(sA.left-q.left)}px`,z.style.top=`${Math.round(sA.top-q.top)}px`,z.style.width=`${Math.round(sA.width)}px`,z.style.height=`${Math.round(sA.height)}px`,z.style.borderRadius="2px",z.style.backgroundColor=rA?"var(--surface-warning-strong)":"var(--surface-warning-base)",z.style.opacity=rA?"0.55":"0.35",rA&&(z.style.boxShadow="inset 0 0 0 1px var(--border-warning-base)"),J.appendChild(z)}}G.appendChild(J)};function f(){n==="overlay"&&l()&&t===void 0&&(t=requestAnimationFrame(()=>{t=void 0,I()}))}const u=()=>{if(n!=="overlay")return;const S=A.getRoot(),G=S?Array.from(S.querySelectorAll("[data-code]")).filter(K=>K instanceof HTMLElement):[],q=r();G.length===q.length&&G.every((K,J)=>K===q[J])||(B(),o(G))},p=()=>{ni(),C(),B(),i=[],a("count",0),a("index",0)},w=()=>{if(typeof window>"u")return;const S=A.wrapper();if(!S)return;const G=ME(S)??S,q=G.getBoundingClientRect(),K=parseFloat(getComputedStyle(G).getPropertyValue("--session-title-height")),J=Number.isNaN(K)?0:K;a("pos",{top:Math.round(q.top)+J-4,right:Math.round(window.innerWidth-q.right)+8})},m=(S,G)=>{const q=G.toLowerCase(),K=[],J=Array.from(S.querySelectorAll("[data-content] [data-line], [data-column-content]")).filter(P=>P instanceof HTMLElement);for(const P of J){const V=P.textContent;if(!V)continue;const rA=V.toLowerCase();let sA=rA.indexOf(q);if(sA===-1)continue;const z=[],dA=[],oA=document.createTreeWalker(P,NodeFilter.SHOW_TEXT);let lA=oA.nextNode(),EA=0;for(;lA;)lA instanceof Text&&(EA+=lA.data.length,z.push(lA),dA.push(EA)),lA=oA.nextNode();if(z.length===0)continue;const CA=RA=>{let kA=0,bA=dA.length-1;for(;kA<bA;){const ie=kA+bA>>1;dA[ie]>=RA?bA=ie:kA=ie+1}const YA=kA===0?0:dA[kA-1];return{node:z[kA],offset:RA-YA}};for(;sA!==-1;){const RA=CA(sA),kA=CA(sA+G.length),bA=document.createRange();bA.setStart(RA.node,RA.offset),bA.setEnd(kA.node,kA.offset),K.push(bA),sA=rA.indexOf(q,sA+G.length)}}return K},y=S=>{const G=S.startContainer;(G instanceof Element?G:G.parentElement)?.scrollIntoView({block:"center",inline:"center"})},M=(S,G)=>{const q=globalThis.CSS?.highlights,K=globalThis.Highlight;if(!q||typeof K!="function")return!1;q.delete("opencode-find"),q.delete("opencode-find-current");const J=S[G];J&&q.set("opencode-find-current",new K(J));const P=S.filter((V,rA)=>rA!==G);return P.length>0&&q.set("opencode-find",new K(...P)),!0},k=S=>{if(!l())return;const G=c().trim();if(!G){p();return}const q=A.getRoot();if(!q)return;n=vE()?"highlights":"overlay";const K=m(q,G),J=K.length,P=S?.reset?0:g(),V=J?Math.min(P,J-1):0;i=K,a("count",J),a("index",V);const rA=K[V];if(n==="highlights"){C(),B(),M(K,V)||(n="overlay",ni(),u(),f()),S?.scroll&&rA&&y(rA);return}ni(),u(),S?.scroll&&rA&&y(rA),f()},N=()=>{a("open",!1),a("query",""),p(),y1===x&&(y1=void 0)},_=()=>{y1&&y1!==x&&y1.close(),y1=x,$t=x,l()||a("open",!0),requestAnimationFrame(()=>{k({scroll:!0}),e?.focus(),e?.select()})},F=S=>{if(!l())return;const G=d();if(G<=0)return;const q=(g()+S+G)%G;a("index",q);const K=i[q];if(K){if(n==="highlights"){if(!M(i,q)){n="overlay",k({reset:!0,scroll:!0});return}y(K);return}ni(),u(),y(K),f()}},x={element:A.wrapper,isOpen:()=>l(),next:F,open:_,close:N};return nA(()=>{for(const S of r())tn(S,"scroll",f,{passive:!0})}),C1(()=>{n=vE()?"highlights":"overlay",EK(),ca.add(x),$t||($t=x),DA(()=>{ca.delete(x),y1===x&&(y1=void 0,ni()),$t===x&&($t=void 0)})}),nA(()=>{if(!l())return;const S=()=>w();requestAnimationFrame(S),tn(window,"resize",S,{passive:!0});const G=A.wrapper();if(!G)return;const q=ME(G)??G;o4(q,S)}),DA(()=>{B(),C(),y1===x&&(y1=void 0,ni())}),{open:l,query:c,count:d,index:g,pos:Q,setInput:S=>{e=S},setQuery:S=>{a("query",S),a("index",0),k({reset:!0,scroll:!0})},focus:_,close:N,next:F,refresh:S=>k(S),onPointerDown:()=>{$t=x,A.wrapper()?.focus({preventScroll:!0})},onFocus:()=>{$t=x},onInputKeyDown:S=>{if(S.key==="Escape"){S.preventDefault(),N();return}S.key==="Enter"&&(S.preventDefault(),F(S.shiftKey?-1:1))}}}function uK(){return{token:0}}function br(A){A.observer?.disconnect(),A.observer=void 0}function s4(A){if(!A)return;const e=A.querySelector("diffs-container");if(e instanceof HTMLElement)return e}function hK(A){return s4(A)?.shadowRoot??void 0}function _c(A){if(!A||typeof document>"u")return;const e=document.documentElement.dataset.colorScheme;if(e==="dark"||e==="light"){A.dataset.colorScheme=e;return}A.removeAttribute("data-color-scheme")}function IK(A){if(typeof document>"u")return()=>{};if(_c(A()),typeof MutationObserver>"u")return()=>{};const e=document.documentElement,t=new MutationObserver(()=>_c(A()));return t.observe(e,{attributes:!0,attributeFilter:["data-color-scheme"]}),()=>t.disconnect()}function fK(A){br(A.state),A.state.token+=1;const e=A.state.token,t=Math.max(0,A.settleFrames??0),n=()=>{const o=s=>{if(e===A.state.token){if(s<=0){A.onReady();return}requestAnimationFrame(()=>o(s-1))}};requestAnimationFrame(()=>o(t))},i=o=>{if(A.isReady(o)){n();return}typeof MutationObserver>"u"||(br(A.state),A.state.observer=new MutationObserver(()=>{e===A.state.token&&A.isReady(o)&&(br(A.state),n())}),A.state.observer.observe(o,{childList:!0,subtree:!0}))},r=A.getRoot();if(!r){if(typeof MutationObserver>"u")return;A.state.observer=new MutationObserver(()=>{if(e!==A.state.token)return;const o=A.getRoot();o&&i(o)}),A.state.observer.observe(A.container,{childList:!0,subtree:!0});return}i(r)}function pK(A){return A?A.start===A.end&&(A.endSide==null||A.endSide===A.side):!1}function mK(A){if(A instanceof Range)return A;const e=new Range;return e.setStart(A.startContainer,A.startOffset),e.setEnd(A.endContainer,A.endOffset),e}function a4(A,e){!A||!e||requestAnimationFrame(()=>{const t=A.getSelection?.()??window.getSelection();if(t)try{t.removeAllRanges(),t.addRange(e)}catch{}})}function wK(){let A="none",e,t=!1,n=!1;const i=()=>{A="none",e=void 0,t=!1};return{begin(r,o){if(!r){A="text";return}A="numbers",e=o,t=!1},track(r,o){return A!=="numbers"?!1:(r&1)===0?(i(),!0):(o!==void 0&&e!==void 0&&o!==e&&(t=!0),!0)},finish(){const r=A;return n=r==="numbers"&&t,i(),r},consume(r){const o=n&&!pK(r);return n=!1,o},reset(){n=!1,i()}}}function el(A){if(A)return A instanceof HTMLElement?A:A.parentElement??void 0}function yK(A){const e=el(A);if(!e)return;const t=e.closest("[data-line]");if(!(t instanceof HTMLElement))return;const n=parseInt(t.dataset.line??"",10);if(!Number.isNaN(n))return n}function NE(A){const e=el(A);if(!e)return;const t=e.closest("[data-line], [data-alt-line]");if(!(t instanceof HTMLElement))return;const n=parseInt(t.dataset.line??"",10);if(!Number.isNaN(n))return n;const i=parseInt(t.dataset.altLine??"",10);if(!Number.isNaN(i))return i}function DK(A){const e=el(A);if(!e)return;const t=e.closest("[data-code]");if(t instanceof HTMLElement)return t.hasAttribute("data-deletions")?"deletions":"additions"}function l4(A){const e=A.root.getSelection?.()??window.getSelection();if(!e||e.isCollapsed)return;const t=e.getComposedRanges?.({shadowRoots:[A.root]})?.[0]??(e.rangeCount>0?e.getRangeAt(0):void 0),n=t?.startContainer??e.anchorNode,i=t?.endContainer??e.focusNode;if(!n||!i||!A.root.contains(n)||!A.root.contains(i))return;const r=A.lineForNode(n),o=A.lineForNode(i);if(r===void 0||o===void 0)return;const s=A.sideForNode?.(n),a=A.sideForNode?.(i),l=s??a,c={start:r,end:o};return l&&(c.side=l),a&&l&&a!==l&&(c.endSide=a),{range:c,text:A.preserveTextSelection&&t?mK(t).cloneRange():void 0}}const is=new WeakMap,kK={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function bK(A){return A==="auto"||A==="scroll"||A==="overlay"}function SE(A){let e=A.parentElement;for(;e;){const t=getComputedStyle(e);if(bK(t.overflowY))return e;e=e.parentElement}}function vK(A){if(typeof document>"u")return;const e=A.closest("[data-component='session-review']");if(e instanceof HTMLElement){const n=SE(A)??e,i=e.querySelector("[data-slot='session-review-container']");return{key:e,root:n,content:i instanceof HTMLElement?i:void 0}}const t=SE(A);if(t){const n=t.querySelector("[role='log']");return{key:t,root:t,content:n instanceof HTMLElement?n:void 0}}return{key:document,root:document,content:void 0}}function MK(A){const e=vK(A);if(!e)return;let t=is.get(e.key);if(!t){const i=new e4;i.setup(e.root,e.content),t={virtualizer:i,refs:0},is.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,release(){if(n)return;n=!0;const i=is.get(e.key);i&&(i.refs-=1,!(i.refs>0)&&(i.virtualizer.cleanUp(),is.delete(e.key)))}}}function NK(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var cr={exports:{}},SK=cr.exports,xE;function xK(){return xE||(xE=1,(function(A,e){(function(t,n){n(e)})(SK,function(t){const n=Symbol("newer"),i=Symbol("older");class r{constructor(g,d){typeof g!="number"&&(d=g,g=0),this.size=0,this.limit=g,this.oldest=this.newest=void 0,this._keymap=new Map,d&&(this.assign(d),g<1&&(this.limit=this.size))}_markEntryAsUsed(g){g!==this.newest&&(g[n]&&(g===this.oldest&&(this.oldest=g[n]),g[n][i]=g[i]),g[i]&&(g[i][n]=g[n]),g[n]=void 0,g[i]=this.newest,this.newest&&(this.newest[n]=g),this.newest=g)}assign(g){let d,Q=this.limit||Number.MAX_VALUE;this._keymap.clear();let B=g[Symbol.iterator]();for(let C=B.next();!C.done;C=B.next()){let I=new o(C.value[0],C.value[1]);if(this._keymap.set(I.key,I),d?(d[n]=I,I[i]=d):this.oldest=I,d=I,Q--==0)throw new Error("overflow")}this.newest=d,this.size=this._keymap.size}get(g){var d=this._keymap.get(g);return d?(this._markEntryAsUsed(d),d.value):void 0}set(g,d){var Q=this._keymap.get(g);return Q?(Q.value=d,this._markEntryAsUsed(Q),this):(this._keymap.set(g,Q=new o(g,d)),this.newest?(this.newest[n]=Q,Q[i]=this.newest):this.oldest=Q,this.newest=Q,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var g=this.oldest;if(g)return this.oldest[n]?(this.oldest=this.oldest[n],this.oldest[i]=void 0):(this.oldest=void 0,this.newest=void 0),g[n]=g[i]=void 0,this._keymap.delete(g.key),--this.size,[g.key,g.value]}find(g){let d=this._keymap.get(g);return d?d.value:void 0}has(g){return this._keymap.has(g)}delete(g){var d=this._keymap.get(g);return d?(this._keymap.delete(d.key),d[n]&&d[i]?(d[i][n]=d[n],d[n][i]=d[i]):d[n]?(d[n][i]=void 0,this.oldest=d[n]):d[i]?(d[i][n]=void 0,this.newest=d[i]):this.oldest=this.newest=void 0,this.size--,d.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new a(this.oldest)}values(){return new l(this.oldest)}entries(){return this}[Symbol.iterator](){return new s(this.oldest)}forEach(g,d){typeof d!="object"&&(d=this);let Q=this.oldest;for(;Q;)g.call(d,Q.value,Q.key,this),Q=Q[n]}toJSON(){for(var g=new Array(this.size),d=0,Q=this.oldest;Q;)g[d++]={key:Q.key,value:Q.value},Q=Q[n];return g}toString(){for(var g="",d=this.oldest;d;)g+=String(d.key)+":"+d.value,d=d[n],d&&(g+=" < ");return g}}t.LRUMap=r;function o(c,g){this.key=c,this.value=g,this[n]=void 0,this[i]=void 0}function s(c){this.entry=c}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let c=this.entry;return c?(this.entry=c[n],{done:!1,value:[c.key,c.value]}):{done:!0,value:void 0}};function a(c){this.entry=c}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let c=this.entry;return c?(this.entry=c[n],{done:!1,value:c.key}):{done:!0,value:void 0}};function l(c){this.entry=c}l.prototype[Symbol.iterator]=function(){return this},l.prototype.next=function(){let c=this.entry;return c?(this.entry=c[n],{done:!1,value:c.value}):{done:!0,value:void 0}}})})(cr,cr.exports)),cr.exports}var LK=xK();const LE=NK(LK),rs=Symbol("IGNORE_RESPONSE");var Cg=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},_K=class{highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(A,{langs:e,theme:t=Ee,useTokenTransformer:n=!1,lineDiffType:i="word-alt",maxLineDiffLength:r=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s="shiki-js"}){this.options=A,this.preferredHighlighter=s,this.renderOptions={theme:t,useTokenTransformer:n,lineDiffType:i,maxLineDiffLength:r,tokenizeMaxLineLength:o},this.fileCache=new LE.LRUMap(A.totalASTLRUCacheSize??100),this.diffCache=new LE.LRUMap(A.totalASTLRUCacheSize??100),this.queueInitialization(e)}isWorkingPool(){return!this.workersFailed}getFileResultCache(A){return A.cacheKey!=null?this.fileCache.get(A.cacheKey):void 0}getDiffResultCache(A){return A.cacheKey!=null?this.diffCache.get(A.cacheKey):void 0}inspectCaches(){const{fileCache:A,diffCache:e}=this;return{fileCache:A,diffCache:e}}evictFileFromCache(A){try{return this.fileCache.delete(A)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(A){try{return this.diffCache.delete(A)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:A=this.renderOptions.theme??Ee,useTokenTransformer:e=this.renderOptions.useTokenTransformer??!1,lineDiffType:t=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:n=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:r}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(r)&&this.renderOptionsRequestVersion===o;try{const a={theme:A,useTokenTransformer:e,lineDiffType:t,maxLineDiffLength:n,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||Ft(a,this.renderOptions))return;const l=Zr(A);let c=[];if(Gi(a.theme,this.renderOptions.theme)||(bc(l)?c=mE(l):c=await wE(l)),!s())return;if(this.highlighter!=null)kc(c,this.highlighter);else{const d=await na({themes:l,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=d}const g=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const d of this.themeSubscribers)d.onThemeChange();await g}catch(a){if(a instanceof Cg||!s())return;throw a}}getFileRenderOptions(){const{tokenizeMaxLineLength:A,theme:e,useTokenTransformer:t}=this.renderOptions;return{theme:e,useTokenTransformer:t,tokenizeMaxLineLength:A}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(A,e){if(this.workersFailed)return;this.isInitialized()||await this.initialize();const t=[];for(const n of this.workers){if(!n.initialized)throw console.log({managedWorker:n}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");t.push(new Promise((i,r)=>{const o=this.generateRequestId(),s={type:"set-render-options",id:o,request:{type:"set-render-options",id:o,renderOptions:A,resolvedThemes:e},resolve:i,reject:r,requestStart:Date.now()};this.activeTaskById.set(o,s),n.pendingSetupRequestId=o,n.worker.postMessage(s.request)}))}await Promise.all(t)}subscribeToThemeChanges(A){return this.themeSubscribers.add(A),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(A),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(A){this.themeSubscribers.delete(A),this.queueBroadcastStateChanges()}subscribeToStatChanges(A){return this.statSubscribers.add(A),A(this.getStats()),()=>{this.statSubscribers.delete(A)}}queueBroadcastStateChanges(){this._queuedBroadcast==null&&(this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges))}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);const A=this.getStats();for(const e of this.statSubscribers)e(A)};cleanUpTasks(A){this.detachInstanceFromQueuedTasks(A);const e=this.activeRequestByInstance.get(A);if(e!=null){const t=this.activeTaskById.get(e);En(t)?(this.detachInstanceFromRenderTask(t,A),!t.primeCache&&t.instances.size===0&&this.removeActiveTask(t)):this.activeTaskById.delete(e)}this.activeRequestByInstance.delete(A),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(A=[]){if(this.initialized!==!0)if(this.initialized===!1){const{lifecycleGeneration:e}=this;this.initialized=new Promise((t,n)=>{(async()=>{try{const i=Zr(this.renderOptions.theme);let r=[];if(bc(i)?r=mE(i):r=await wE(i),!this.isCurrentLifecycle(e)){t();return}let o=[];if(fE(A)?o=IE(A):o=await pE(A),!this.isCurrentLifecycle(e)){t();return}const[s]=await Promise.all([na({themes:i,langs:["text",...A],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(r,o)]);if(!this.isCurrentLifecycle(e)){this.terminateWorkers(),t();return}this.highlighter=s,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),t()}catch(i){if(i instanceof Cg||!this.isCurrentLifecycle(e)){t();return}this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),n(i)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(A,e){this.workersFailed=!1;const t=[],n=void 0;this.workers.length>0&&this.terminateWorkers();for(let i=0;i<(this.options.poolSize??8);i++){const r=this.options.workerFactory(),o={worker:r,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...e.map(({name:s})=>s)]),customExtensionsVersion:0};r.addEventListener("message",s=>{this.handleWorkerMessage(o,s.data)}),r.addEventListener("error",s=>console.error("Worker error:",s,o)),this.workers.push(o),t.push(new Promise((s,a)=>{const l=this.generateRequestId(),c={type:"initialize",id:l,request:{type:"initialize",id:l,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:A,resolvedLanguages:e,customExtensionsVersion:void 0,customExtensionMap:n},resolve(){o.initialized=!0,s()},reject:a,requestStart:Date.now()};this.activeTaskById.set(l,c),this.executeTask(o,c)}))}await Promise.all(t)}drainQueue=()=>{if(this._queuedDrain=void 0,!(this.initialized!==!0||this.queuedTasks.length===0)){for(let A=0;A<this.queuedTasks.length;){const e=this.queuedTasks[A];if(this.hasActiveRequest(e)){A++;continue}const t=_E(e),n=this.getAvailableWorker(t);if(n==null)break;this.queuedTasks.splice(A,1),this.assignWorkerToTask(e,n),this.resolveLanguagesAndExecuteTask(n,e,t)}this.queueBroadcastStateChanges()}};highlightFileAST(A,e){const t=this.getFileResultCache(e);Xr(e)||t!=null&&An(t.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(A,e)||this.submitTask(A,{type:"file",file:e})}primeFileHighlightCache(A){if(A.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${A.name}".`);return}const e=this.getFileResultCache(A),t=this.getFileHighlightKey(A);if(t==null||Xr(A)||e!=null&&An(e.options,this.getFileRenderOptions()))return;const n=this.getTaskByHighlightKey(t);n!=null?n.primeCache=!0:this.submitCacheTask({type:"file",file:A},t)}getPlainFileAST(A,e,t,n){if(this.highlighter==null){this.queueInitialization();return}return Nf(A,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:e,totalLines:t,lines:n})}highlightDiffAST(A,e){const t=this.getDiffResultCache(e);no(e)||t!=null&&Ft(t.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(A,e)||this.submitTask(A,{type:"diff",diff:e})}primeDiffHighlightCache(A){if(A.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${A.prevName??A.name}" -> "${A.name}".`);return}const e=this.getDiffResultCache(A),t=this.getDiffHighlightKey(A);if(t==null||no(A)||e!=null&&Ft(e.options,this.getDiffRenderOptions()))return;const n=this.getTaskByHighlightKey(t);n!=null?n.primeCache=!0:this.submitCacheTask({type:"diff",diff:A},t)}getPlainDiffAST(A,e,t,n,i){return this.highlighter!=null?Xf(A,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:e,totalLines:t,expandedHunks:n,collapsedContextThreshold:i}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(A){return this.lifecycleGeneration===A}queueInitialization(A){this.initialize(A).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){const A=new Cg;for(const e of this.activeTaskById.values())"reject"in e&&e.reject(A)}terminateWorkers(){for(const A of this.workers)A.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?"waiting":this.initialized!==!0?"initializing":"initialized",totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(A=>A.requestId!=null||A.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(A,e){this.initialized===!1&&this.queueInitialization();const t=this.getHighlightKeyForRequest(e),n=t!=null?this.getTaskByHighlightKey(t):void 0;if(n!=null){this.detachInstanceFromQueuedTasks(A,n),this.addInstanceToTask(n,A),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(A);const i=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set([A]),primeCache:!1,highlightKey:t,renderOptionsVersion:o,requestStart:r};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set([A]),primeCache:!1,highlightKey:t,renderOptionsVersion:o,requestStart:r}}})();this.enqueueRenderTask(s,A)}submitCacheTask(A,e){this.initialized===!1&&this.queueInitialization();const t=this.generateRequestId(),n=Date.now(),{renderOptionsVersion:i}=this,r=(()=>{switch(A.type){case"file":return{type:"file",id:t,request:{...A,id:t},instances:new Set,primeCache:!0,highlightKey:e,renderOptionsVersion:i,requestStart:n};case"diff":return{type:"diff",id:t,request:{...A,id:t},instances:new Set,primeCache:!0,highlightKey:e,renderOptionsVersion:i,requestStart:n}}})();this.enqueueRenderTask(r)}enqueueRenderTask(A,e){this.queuedTasks.push(A),e!=null&&this.queuedTaskByInstance.set(e,A),A.highlightKey!=null&&this.taskByHighlightKey.set(A.highlightKey,A),this.queueDrain()}async resolveLanguagesAndExecuteTask(A,e,t){try{const n=t.filter(i=>!A.langs.has(i));if(n.length>0&&(fE(n)?e.request.resolvedLanguages=IE(n):e.request.resolvedLanguages=await pE(n)),!this.activeTaskById.has(e.id)){A.requestId===e.id&&(this.cleanWorkerAndTask(A,e),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(A,e)}catch{this.cleanWorkerAndTask(A,e),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(A,e){const t=this.activeTaskById.get(e.id);try{if(t==null)throw rs;if(e.type==="error"){const n=new Error(e.error);if(e.stack&&(n.stack=e.stack),"reject"in t)t.reject(n);else if(En(t))this.notifyHighlightError(t,n);else throw new Error("handleWorkerMessage: unknown task type");throw n}else switch(e.requestType){case"initialize":if(t.type!=="initialize")throw new Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(A,t.request),t.resolve();break;case"set-render-options":if(t.type!=="set-render-options")throw new Error("handleWorkerMessage: task/response dont match");t.resolve();break;case"file":{if(t.type!=="file")throw new Error("handleWorkerMessage: task/response dont match");const{result:n,options:i}=e;if(!this.isCurrentRenderTask(t)||!An(i,this.getFileRenderOptions()))throw rs;const{request:r}=t;this.syncCustomExtensionVersion(A,r),r.file.cacheKey!=null&&this.fileCache.set(r.file.cacheKey,{result:n,options:i}),this.notifyFileInstances(t,n,i);break}case"diff":{if(t.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{result:n,options:i}=e;if(!this.isCurrentRenderTask(t)||!Ft(i,this.getDiffRenderOptions()))throw rs;const{request:r}=t;this.syncCustomExtensionVersion(A,r),r.diff.cacheKey!=null&&this.diffCache.set(r.diff.cacheKey,{result:n,options:i}),this.notifyDiffInstances(t,n,i);break}}}catch(n){n!==rs&&console.error(n,t,e)}this.cleanWorkerAndTask(A,t,e.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain==null&&(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(A,e){e.requestId=A.id,En(A)&&(this.clearQueuedInstanceRequests(A),this.trackInstanceRequests(A)),this.activeTaskById.set(A.id,A)}cleanWorkerAndTask(A,e,t=e?.id){A.requestId===t&&(A.requestId=void 0),A.pendingSetupRequestId===t&&(A.pendingSetupRequestId=void 0),e!=null&&(En(e)&&(this.clearInstanceRequests(e),this.clearHighlightKey(e)),this.activeTaskById.delete(e.id))}executeTask(A,e){FK(e.request)&&this.maybeAttachCustomExtensions(A,e.request),this.activeTaskById.has(e.id)||this.assignWorkerToTask(e,A);for(const t of _E(e))A.langs.add(t);try{A.worker.postMessage(e.request)}catch(t){console.error("Failed to post message to worker:",t),En(e)?this.notifyHighlightError(e,t):"reject"in e&&e.reject(t),this.cleanWorkerAndTask(A,e),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(A,e){if(e.customExtensionsVersion!=null)return;const t=EO();A.customExtensionsVersion>=t||(e.customExtensionsVersion=t,e.customExtensionMap=CO())}syncCustomExtensionVersion(A,e){e.customExtensionsVersion!=null&&(A.customExtensionsVersion=e.customExtensionsVersion)}getAvailableWorker(A){let e;for(const t of this.workers){if(t.requestId!=null||t.pendingSetupRequestId!=null||!t.initialized)continue;if(e=t,A.length===0)break;let n=!0;for(const i of A)if(!t.langs.has(i)){n=!1;break}if(n)break}return e}getFileHighlightKey(A){if(A.cacheKey!=null)return`file:${A.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(A){if(A.cacheKey!=null)return`diff:${A.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(A){switch(A.type){case"file":return this.getFileHighlightKey(A.file);case"diff":return this.getDiffHighlightKey(A.diff)}}hasActiveRequest(A){for(const e of Ar(A))if(this.activeRequestByInstance.has(e))return!0;return!1}addInstanceToTask(A,e){A.type,A.instances.add(e),this.activeTaskById.has(A.id)?this.activeRequestByInstance.set(e,A.id):this.queuedTaskByInstance.set(e,A)}detachInstanceFromQueuedTasks(A,e){const t=this.queuedTaskByInstance.get(A);t==null||t===e||(this.queuedTaskByInstance.delete(A),this.detachInstanceFromRenderTask(t,A),!t.primeCache&&t.instances.size===0&&this.removeQueuedTask(t))}detachInstanceFromRenderTask(A,e){A.type,A.instances.delete(e)}removeQueuedTask(A){const e=this.queuedTasks.indexOf(A);e!==-1&&this.queuedTasks.splice(e,1),this.clearQueuedInstanceRequests(A),this.clearHighlightKey(A)}removeActiveTask(A){this.clearInstanceRequests(A),this.clearHighlightKey(A),this.activeTaskById.delete(A.id)}invalidateRenderTasks(){for(let A=this.queuedTasks.length-1;A>=0;A--){const e=this.queuedTasks[A];e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(e)}for(const A of Array.from(this.activeTaskById.values()))En(A)&&A.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(A)}clearQueuedInstanceRequests(A){for(const e of Ar(A))this.queuedTaskByInstance.get(e)===A&&this.queuedTaskByInstance.delete(e)}clearHighlightKey(A){A.highlightKey!=null&&this.taskByHighlightKey.get(A.highlightKey)===A&&this.taskByHighlightKey.delete(A.highlightKey)}trackInstanceRequests(A){for(const e of Ar(A))this.activeRequestByInstance.set(e,A.id)}clearInstanceRequests(A){for(const e of Ar(A))this.activeRequestByInstance.get(e)===A.id&&this.activeRequestByInstance.delete(e)}notifyFileInstances(A,e,t){for(const n of A.instances)this.activeRequestByInstance.get(n)===A.id&&n.onHighlightSuccess(A.request.file,e,t)}notifyDiffInstances(A,e,t){for(const n of A.instances)this.activeRequestByInstance.get(n)===A.id&&n.onHighlightSuccess(A.request.diff,e,t)}notifyHighlightError(A,e){for(const t of Ar(A))this.activeRequestByInstance.get(t)===A.id&&t.onHighlightError(e)}hasMatchingFileInstanceTask(A,e){for(const t of this.iterateRenderTasks())if(t.type==="file"&&this.isCurrentRenderTask(t)&&t.instances.has(A)&&Et(e,t.request.file))return!0;return!1}hasMatchingDiffInstanceTask(A,e){for(const t of this.iterateRenderTasks())if(t.type==="diff"&&this.isCurrentRenderTask(t)&&t.instances.has(A)&&Ei(t.request.diff,e))return!0;return!1}getTaskByHighlightKey(A){const e=this.taskByHighlightKey.get(A);return e!=null&&this.isCurrentRenderTask(e)?e:void 0}isCurrentRenderTask(A){return A.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(const A of this.queuedTasks)yield A;for(const A of this.activeTaskById.values())En(A)&&(yield A)}generateRequestId(){return`req_${++this.nextRequestId}`}};function FK(A){return A.type==="initialize"||A.type==="file"||A.type==="diff"}function _E(A){const e=new Set;if(A.type==="initialize"||A.type==="set-render-options")return[];switch(A.type){case"file":e.add(A.request.file.lang??Pe(A.request.file.name));break;case"diff":e.add(A.request.diff.lang??Pe(A.request.diff.name)),e.add(A.request.diff.lang??Pe(A.request.diff.prevName??"-"));break}return e.delete("text"),Array.from(e)}function En(A){return A?.type==="file"||A?.type==="diff"}function Ar(A){return A.instances}const GK="/console/assets/worker-BVEmEyu5.js";lK();function RK(){return new Worker(GK,{type:"module"})}function FE(A){const e=new _K({workerFactory:RK,poolSize:2},{theme:la,lineDiffType:A,preferredHighlighter:"shiki-wasm"});return e.initialize(),e}let ug,hg;function da(A){if(!(typeof window>"u"))return A==="split"?(hg||(hg=FE("word-alt")),hg):(ug||(ug=FE("none")),ug)}var UK=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),TK=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function OK(A){if(Intl.Locale){const t=new Intl.Locale(A).maximize().script??"";return UK.has(t)}const e=A.split("-")[0];return TK.has(e)}function qK(A){return OK(A)?"rtl":"ltr"}function g4(){let A=typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([A])}catch{A="en-US"}return{locale:A,direction:qK(A)}}var Fc=g4(),dr=new Set;function GE(){Fc=g4();for(const A of dr)A(Fc)}function KK(){const[A,e]=T(Fc),t=R(()=>A());return C1(()=>{dr.size===0&&window.addEventListener("languagechange",GE),dr.add(e),DA(()=>{dr.delete(e),dr.size===0&&window.removeEventListener("languagechange",GE)})}),{locale:()=>t().locale,direction:()=>t().direction}}var JK=A1();function c4(){const A=KK();return Ve(JK)||A}var Ig=new Map;function HK(A){const{locale:e}=c4(),t=R(()=>e()+(A?Object.entries(A).sort((n,i)=>n[0]<i[0]?-1:1).join():""));return R(()=>{const n=t();let i;return Ig.has(n)&&(i=Ig.get(n)),i||(i=new Intl.Collator(e(),A),Ig.set(n,i)),i})}const YK={"ui.sessionReview.title":"Session changes","ui.sessionReview.title.git":"Git changes","ui.sessionReview.title.branch":"Branch changes","ui.sessionReview.title.lastTurn":"Last turn changes","ui.sessionReview.diffStyle.unified":"Unified","ui.sessionReview.diffStyle.split":"Split","ui.sessionReview.expandAll":"Expand all","ui.sessionReview.collapseAll":"Collapse all","ui.sessionReview.change.added":"Added","ui.sessionReview.change.removed":"Removed","ui.sessionReview.change.modified":"Modified","ui.sessionReview.image.loading":"Loading...","ui.sessionReview.image.placeholder":"Image","ui.sessionReview.largeDiff.title":"Diff too large to render","ui.sessionReview.largeDiff.meta":"Limit: {{limit}} changed lines. Current: {{current}} changed lines.","ui.sessionReview.largeDiff.renderAnyway":"Render anyway","ui.sessionReviewV2.expandMode":"Expand or collapse diff","ui.sessionReviewV2.filterFiles":"Filter files","ui.sessionReviewV2.toggleSidebar":"Toggle file tree","ui.sessionReviewV2.showAllLines":"Show all lines","ui.sessionReviewV2.hideNonDiffLines":"Hide non-diff lines","ui.sessionReviewV2.unifiedDiff":"Unified diff","ui.sessionReviewV2.splitDiff":"Split diff","ui.sessionReviewV2.previousFile":"Previous file","ui.sessionReviewV2.nextFile":"Next file","ui.sessionReviewV2.diffView":"Diff view","ui.sessionReviewV2.empty.noGit.title":"No tracked changes","ui.sessionReviewV2.empty.noGit.description":"Track, review, and undo changes in this project","ui.sessionReviewV2.empty.noGit.action":"Create Git repository","ui.sessionReviewV2.empty.noGit.actionLoading":"Creating Git repository...","ui.sessionReviewV2.empty.changes.title":"No file changes yet","ui.sessionReviewV2.empty.changes.description":"Project changes will appear here","ui.sessionReview.openFile":"Open file","ui.sessionReview.selection.line":"line {{line}}","ui.sessionReview.selection.lines":"lines {{start}}-{{end}}","ui.fileMedia.kind.image":"image","ui.fileMedia.kind.audio":"audio","ui.fileMedia.state.removed":"Removed {{kind}} file.","ui.fileMedia.state.loading":"Loading {{kind}}...","ui.fileMedia.state.error":"Unable to load {{kind}}.","ui.fileMedia.state.unavailable":"{{kind}} preview unavailable.","ui.fileMedia.binary.title":"Binary file","ui.fileMedia.binary.description.path":"{{path}} is binary.","ui.fileMedia.binary.description.default":"Binary content","ui.lineComment.label.prefix":"Comment on ","ui.lineComment.label.suffix":"","ui.lineComment.editorLabel.prefix":"Commenting on ","ui.lineComment.editorLabel.suffix":"","ui.lineComment.placeholder":"Add comment","ui.lineComment.contextPlaceholder":"Add context for this change","ui.lineComment.submit":"Comment","ui.lineComment.cancel":"Cancel","ui.sessionTurn.steps.show":"Show steps","ui.sessionTurn.steps.hide":"Hide steps","ui.sessionTurn.summary.response":"Response","ui.sessionTurn.diff.showMore":"Show more changes ({{count}})","ui.sessionTurn.diffs.changed.one":"{{count}} Changed file","ui.sessionTurn.diffs.changed.other":"{{count}} Changed files","ui.sessionTurn.diffs.showAll":"Show all","ui.sessionTurn.diffs.showLess":"Show less","ui.sessionTurn.diffs.more":"+{{count}} more files","ui.sessionTurn.retry.retrying":"retrying","ui.sessionTurn.retry.inSeconds":"in {{seconds}}s","ui.sessionTurn.retry.attempt":"attempt #{{attempt}}","ui.sessionTurn.retry.attemptLine":"{{line}} - attempt #{{attempt}}","ui.sessionTurn.retry.geminiHot":"gemini is way too hot right now","ui.sessionTurn.error.freeUsageExceeded":"Free usage exceeded","ui.sessionTurn.error.addCredits":"Add credits","dialog.usageExceeded.freeTier.title":"Free limit reached","dialog.usageExceeded.freeTier.description":"Subscribe to Kilo Go for reliable access to the best open-source models, starting at $5/month.","dialog.usageExceeded.freeTier.actionLabel":"Subscribe","dialog.usageExceeded.accountRateLimit.title":"Go limit reached","dialog.usageExceeded.accountRateLimit.description":"Usage limit reached. To continue using this model now, enable usage from your available balance","dialog.usageExceeded.accountRateLimit.actionLabel":"Open settings","ui.sessionTurn.status.delegating":"Delegating work","ui.sessionTurn.status.delegatingWaitingPermission":"Subagent waiting for permission","ui.sessionTurn.status.delegatingWaitingQuestion":"Subagent waiting for response","ui.sessionTurn.status.planning":"Planning next steps","ui.sessionTurn.status.gatheringContext":"Exploring","ui.sessionTurn.status.gatheredContext":"Explored","ui.sessionTurn.status.searchingCodebase":"Searching the codebase","ui.sessionTurn.status.searchingWeb":"Searching the web","ui.sessionTurn.status.makingEdits":"Making edits","ui.sessionTurn.status.runningCommands":"Running commands","ui.sessionTurn.status.thinking":"Thinking","ui.sessionTurn.status.thinkingWithTopic":"Thinking - {{topic}}","ui.sessionTurn.status.gatheringThoughts":"Gathering thoughts","ui.sessionTurn.status.consideringNextSteps":"Considering next steps","ui.messagePart.diagnostic.error":"Error","ui.messagePart.mcp.input":"Input","ui.messagePart.mcp.output":"Output","ui.messagePart.board.read":"Read agent messages","ui.messagePart.board.all":"All agents","ui.messagePart.board.primary":"Primary agent","ui.messagePart.board.agent":"Agent","ui.messagePart.board.route":"{{from}} to {{to}}","ui.messagePart.board.empty":"No agent messages","ui.messagePart.board.stored":"Stored only. Delivery and reading are not confirmed.","ui.messagePart.title.edit":"Edit","ui.messagePart.title.write":"Write","ui.messagePart.option.typeOwnAnswer":"Type your own answer","ui.messagePart.review.title":"Review your answers","ui.messagePart.questions.dismissed":"Questions dismissed","ui.messagePart.compaction":"Session compacted","ui.messagePart.context.read.one":"{{count}} read","ui.messagePart.context.read.other":"{{count}} reads","ui.messagePart.context.search.one":"{{count}} search","ui.messagePart.context.search.other":"{{count}} searches","ui.messagePart.context.list.one":"{{count}} list","ui.messagePart.context.list.other":"{{count}} lists","ui.list.loading":"Loading","ui.list.empty":"No results","ui.list.clearFilter":"Clear filter","ui.list.emptyWithFilter.prefix":"No results for","ui.list.emptyWithFilter.suffix":"","ui.fileSearch.placeholder":"Find","ui.fileSearch.previousMatch":"Previous match","ui.fileSearch.nextMatch":"Next match","ui.fileSearch.close":"Close search","ui.messageNav.newMessage":"New message","ui.promptInput.noMatchingItems":"No matching items","ui.promptInput.commands":"Commands","ui.promptInput.dropFiles":"Drop files to attach","ui.promptInput.removeAttachment":"Remove attachment","ui.promptInput.label":"Prompt","ui.promptInput.placeholder.shell":"Enter shell command...","ui.promptInput.placeholder.normal":"Ask anything, {{slash}} for commands, {{at}} for context...","ui.promptInput.add":"Add images and files","ui.promptInput.attachments":"Images and files","ui.promptInput.context":"Context","ui.promptInput.shell":"Shell command","ui.promptInput.chooseAgent":"Choose agent","ui.promptInput.chooseModel":"Choose model","ui.promptInput.chooseVariant":"Choose model variant","ui.promptInput.send":"Send","ui.promptInput.stop":"Stop","ui.tabs.close":"Close tab","ui.textField.copyToClipboard":"Copy to clipboard","ui.textField.copyLink":"Copy link","ui.textField.copied":"Copied","ui.imagePreview.alt":"Image preview","ui.mermaid.rendering":"Rendering Mermaid diagram...","ui.mermaid.renderError":"Mermaid render failed: {{message}}","ui.mermaid.errorDefault":"Unable to render Mermaid diagram.","ui.mermaid.errorEmpty":"Mermaid rendered an empty diagram.","ui.mermaid.download":"Download","ui.mermaid.copySource":"Copy Mermaid source","ui.mermaid.copySvg":"Copy SVG","ui.mermaid.copyPng":"Copy PNG","ui.mermaid.downloadSvg":"Download SVG","ui.mermaid.downloadPng":"Download PNG","ui.scrollView.ariaLabel":"scrollable content","ui.tool.read":"Read","ui.tool.loaded":"Loaded","ui.tool.list":"List","ui.tool.glob":"Glob","ui.tool.grep":"Grep","ui.tool.task":"Task","ui.tool.webfetch":"Webfetch","ui.tool.websearch":"Web Search","ui.tool.websearch.provider":"{{provider}} Web Search","ui.tool.shell":"Shell","ui.tool.patch":"Patch","ui.tool.todos":"To-dos","ui.tool.todos.read":"Read to-dos","ui.tool.questions":"Questions","ui.tool.questions.numbered":"Questions {{number}}","ui.tool.agent":"{{type}} Agent","ui.tool.agent.default":"Agent","ui.tool.skill":"Skill","ui.basicTool.called":"Called `{{tool}}`","ui.toolErrorCard.failed":"Failed","ui.toolErrorCard.copyError":"Copy error","ui.common.file.one":"file","ui.common.file.other":"files","ui.common.question.one":"question","ui.common.question.other":"questions","ui.common.add":"Add","ui.common.clear":"Clear","ui.common.file":"File","ui.common.back":"Back","ui.common.cancel":"Cancel","ui.common.confirm":"Confirm","ui.common.dismiss":"Dismiss","ui.common.close":"Close","ui.common.next":"Next","ui.common.submit":"Submit","ui.common.showMore":"Show more","ui.permission.deny":"Deny","ui.permission.allowAlways":"Allow always","ui.permission.allowOnce":"Allow once","ui.message.expand":"Expand message","ui.message.collapse":"Collapse message","ui.message.copy":"Copy","ui.message.copyMessage":"Copy message","ui.message.deleteQueued":"Delete queued message","ui.message.forkMessage":"Fork to new session","ui.message.revertMessage":"Revert to here","ui.message.copyResponse":"Copy response","ui.message.copied":"Copied","ui.message.duration.seconds":"{{count}}s","ui.message.duration.minutesSeconds":"{{minutes}}m {{seconds}}s","ui.message.interrupted":"Interrupted","ui.message.queued":"Queued","ui.message.attachment.alt":"attachment","ui.patch.action.deleted":"Deleted","ui.patch.action.created":"Created","ui.patch.action.moved":"Moved","ui.patch.action.patched":"Patched","ui.patch.action.plan":"Plan","ui.question.subtitle.answered":"{{count}} answered","ui.question.subtitle.dismissed":"{{count}} dismissed","ui.question.answer.none":"(no answer)","ui.question.answer.dismissed":"Dismissed","ui.question.review.notAnswered":"(not answered)","ui.question.multiHint":"Select all answers that apply","ui.question.singleHint":"Select one answer","ui.question.custom.placeholder":"Type your answer..."},er=new Map;function PK(A,e){const t=er.get(A);if(t)return t.select(e);const n=new Intl.PluralRules(A);return er.size>=32&&er.delete(er.keys().next().value),er.set(A,n),n.select(e)}function VK(A,e){return`${A}.${e}`}function jK(A,e){return e?A.replace(/{{\s*([^}]+?)\s*}}/g,(t,n)=>{const i=String(n),r=e[i];return r===void 0?"":String(r)}):A}const Gc={locale:()=>"en",t:(A,e)=>{const t=YK[A]??String(A);return jK(t,e)},plural:(A,e,t)=>Gc.t(VK(A,PK(Gc.locale(),e)),{...t,count:e})},zK=A1(Gc);function tl(){return Ve(zK)}const $K=new Set(["png","jpg","jpeg","gif","webp","avif","bmp","ico","tif","tiff","heic"]),WK=new Set(["mp3","wav","ogg","m4a","aac","flac","opus"]);function nl(A){if(!(!A||typeof A!="object"))return A}function X0(A){if(!A)return;const e=A.split(";",1)[0]?.trim().toLowerCase();if(e)return e==="audio/x-aac"?"audio/aac":e==="audio/x-m4a"?"audio/mp4":e}function ZK(A){if(!A)return"";const e=A.lastIndexOf(".");return e===-1?"":A.slice(e+1).toLowerCase()}function XK(A){const e=ZK(A);if(e==="svg")return"svg";if($K.has(e))return"image";if(WK.has(e))return"audio"}function AJ(A){return nl(A)?.type==="binary"}function eJ(A,e){if(e==="svg")return A.startsWith("data:image/svg+xml")?A:void 0;if(e==="image")return A.startsWith("data:image/")?A:void 0;if(A.startsWith("data:audio/x-aac;"))return A.replace("data:audio/x-aac;","data:audio/aac;");if(A.startsWith("data:audio/x-m4a;"))return A.replace("data:audio/x-m4a;","data:audio/mp4;");if(A.startsWith("data:audio/"))return A}function fg(A,e){if(!A)return;if(typeof A=="string")return eJ(A,e);const t=nl(A);if(!t||typeof t.content!="string")return;const n=X0(typeof t.mimeType=="string"?t.mimeType:void 0);if(n){if(e==="svg")return n!=="image/svg+xml"?void 0:t.encoding==="base64"?`data:image/svg+xml;base64,${t.content}`:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t.content)}`;if(!(e==="image"&&!n.startsWith("image/"))&&!(e==="audio"&&!n.startsWith("audio/"))&&t.encoding==="base64")return`data:${n};base64,${t.content}`}}function tJ(A){if(typeof atob=="function")try{const e=atob(A),t=Uint8Array.from(e,n=>n.charCodeAt(0));return typeof TextDecoder=="function"?new TextDecoder().decode(t):e}catch{}}function nJ(A){const e=nl(A);if(!(!e||typeof e.content!="string"||X0(typeof e.mimeType=="string"?e.mimeType:void 0)!=="image/svg+xml"))return e.encoding==="base64"?tJ(e.content):e.content}function pg(A){if(typeof A=="string")return A.length>0;const e=nl(A);return e?typeof e.content=="string"&&e.content.length>0:!1}var iJ=D('<div class="flex min-h-56 flex-col items-center justify-center gap-2 px-6 py-10 text-center"><div class="text-14-semibold text-text-strong"></div><div class="text-14-regular text-text-weak">'),os=D('<div class="flex min-h-40 items-center justify-center px-6 py-4 text-center text-text-weak">'),rJ=D('<div class="flex justify-center bg-background-stronger px-6 py-4"><img class="max-h-[60vh] max-w-full rounded border border-border-weak-base bg-background-base object-contain">'),oJ=D('<div class="flex justify-center bg-background-stronger px-6 py-4"><audio class="w-full max-w-xl"controls preload=metadata><source>'),sJ=D('<div class="flex flex-col gap-4 px-6 py-4">'),aJ=D('<div class="flex justify-center"><img class="max-h-[60vh] max-w-full rounded border border-border-weak-base bg-background-base object-contain">');function lJ(A,e){return A.current!==void 0?A.current:A.after??A.before}function RE(A){const e=tl(),t=()=>A.media,n=R(()=>{const u=t();if(!(!u||u.mode==="off"))return XK(u.path)}),i=R(()=>{const u=t();return!u||u.mode==="off"||n()?!1:AJ(u.current)}),r=()=>A.media?.onLoad?.(),o=R(()=>{const u=t(),p=n();return!u||!p?!1:u.deleted?!0:p==="svg"||u.current!==void 0?!1:!pg(u.after)&&pg(u.before)}),s=R(()=>{const u=t(),p=n();if(!(!u||p!=="image"&&p!=="audio"))return fg(lJ(u,p),p)}),a=R(()=>{const u=t(),p=n();if(!(!u||p!=="image"&&p!=="audio")&&u.current===void 0&&!o()&&!s()&&!(!u.path||!u.readFile))return{key:`${p}:${u.path}`,kind:p,path:u.path,readFile:u.readFile,onError:u.onError}}),[l]=et(a,async u=>u.readFile(u.path).then(p=>{const w=fg(p,u.kind);return w?{key:u.key,src:w,mime:u.kind==="audio"?X0(p?.mimeType):void 0}:(u.onError?.({kind:u.kind}),{key:u.key,error:!0})},()=>(u.onError?.({kind:u.kind}),{key:u.key,error:!0}))),c=R(()=>{const u=a(),p=l();if(!(!u||!p||p.key!==u.key))return p}),g=R(()=>{const u=c();return s()??(u&&"src"in u?u.src:void 0)}),d=R(()=>s()?"ready":a()?l.loading?"loading":c()?.error?"error":g()?"ready":"idle":"idle"),Q=R(()=>{const u=c();return u&&"mime"in u?u.mime:void 0}),B=R(()=>{const u=t();if(!(!u||n()!=="svg"))return nJ(u.current)}),C=R(()=>{const u=t();if(!(!u||n()!=="svg"))return fg(u.current,"svg")}),I=R(()=>{const u=t();if(!(!u||n()!=="svg")&&B()===void 0&&pg(u.current))return[u.path,u.current]});nA(B1(I,u=>{u&&t()?.onError?.({kind:"svg"})},{defer:!0}));const f=u=>e.t(u==="image"?"ui.fileMedia.kind.image":"ui.fileMedia.kind.audio");return E(xr,{get children(){return[E(Te,{get when(){return n()==="image"||n()==="audio"},get children(){return E(H,{get when(){return g()},get fallback(){const u=t(),p=n();if(!u||p!=="image"&&p!=="audio")return A.fallback();const w=f(p);return o()?(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.removed",{kind:w})),m})():d()==="loading"?(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.loading",{kind:w})),m})():d()==="error"?(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.error",{kind:w})),m})():(()=>{var m=os();return h(m,()=>e.t("ui.fileMedia.state.unavailable",{kind:w})),m})()},children:u=>{const p=n();return p!=="image"&&p!=="audio"?A.fallback():p==="image"?(()=>{var w=rJ(),m=w.firstChild;return m.addEventListener("load",r),Y(y=>{var M=u(),k=t()?.path;return M!==y.e&&j(m,"src",y.e=M),k!==y.t&&j(m,"alt",y.t=k),y},{e:void 0,t:void 0}),w})():(()=>{var w=oJ(),m=w.firstChild,y=m.firstChild;return m.addEventListener("loadedmetadata",r),Y(M=>{var k=u(),N=Q();return k!==M.e&&j(y,"src",M.e=k),N!==M.t&&j(y,"type",M.t=N),M},{e:void 0,t:void 0}),w})()}})}}),E(Te,{get when(){return n()==="svg"},get children(){return B()===void 0&&C()==null?A.fallback():(()=>{var u=sJ();return h(u,E(H,{get when(){return B()!==void 0},get children(){return A.fallback()}}),null),h(u,E(H,{get when(){return C()},children:p=>(()=>{var w=aJ(),m=w.firstChild;return m.addEventListener("load",r),Y(y=>{var M=p(),k=t()?.path;return M!==y.e&&j(m,"src",y.e=M),k!==y.t&&j(m,"alt",y.t=k),y},{e:void 0,t:void 0}),w})()}),null),u})()}}),E(Te,{get when(){return i()},get children(){var u=iJ(),p=u.firstChild,w=p.nextSibling;return h(p,()=>t()?.path?.split("/").pop()??e.t("ui.fileMedia.binary.title")),h(w,()=>{const m=t()?.path;return m?e.t("ui.fileMedia.binary.description.path",{path:m}):e.t("ui.fileMedia.binary.description.default")}),u}}),E(Te,{when:!0,get children(){return A.fallback()}})]}})}var gJ=D('<div class="fixed z-50 flex h-8 items-center gap-2 rounded-md border border-border-base bg-background-base px-3 shadow-md"><input class="w-40 bg-transparent outline-none text-14-regular text-text-strong placeholder:text-text-weak"><div class="shrink-0 text-12-regular text-text-weak tabular-nums text-right"style=width:10ch></div><div class="flex items-center"><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button></div><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong">');function cJ(A){const e=tl();return E(yC,{get children(){var t=gJ(),n=t.firstChild,i=n.nextSibling,r=i.nextSibling,o=r.firstChild,s=o.nextSibling,a=r.nextSibling;t.$$pointerdown=c=>c.stopPropagation(),h(t,E(gi,{name:"magnifying-glass",size:"small",class:"text-text-weak shrink-0"}),n),n.$$keydown=c=>A.onKeyDown(c),n.$$input=c=>A.onInput(c.currentTarget.value);var l=A.setInput;return typeof l=="function"?He(l,n):A.setInput=n,h(i,(()=>{var c=hA(()=>!!A.count());return()=>c()?`${A.index()+1}/${A.count()}`:"0/0"})()),zA(o,"click",A.onPrev,!0),h(o,E(gi,{name:"chevron-down",size:"small",class:"rotate-180"})),zA(s,"click",A.onNext,!0),h(s,E(gi,{name:"chevron-down",size:"small"})),zA(a,"click",A.onClose,!0),h(a,E(gi,{name:"close-small",size:"small"})),Y(c=>{var g=`${A.pos().top}px`,d=`${A.pos().right}px`,Q=e.t("ui.fileSearch.placeholder"),B=A.count()===0,C=e.t("ui.fileSearch.previousMatch"),I=A.count()===0,f=e.t("ui.fileSearch.nextMatch"),u=e.t("ui.fileSearch.close");return g!==c.e&&dt(t,"top",c.e=g),d!==c.t&&dt(t,"right",c.t=d),Q!==c.a&&j(n,"placeholder",c.a=Q),B!==c.o&&(o.disabled=c.o=B),C!==c.i&&j(o,"aria-label",c.i=C),I!==c.n&&(s.disabled=c.n=I),f!==c.s&&j(s,"aria-label",c.s=f),u!==c.h&&j(a,"aria-label",c.h=u),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),Y(()=>n.value=A.query()),t}})}Ae(["pointerdown","input","keydown","click"]);var dJ=D('<div data-component=file class="relative outline-none"tabindex=0><div></div><div class="pointer-events-none absolute inset-0 z-0">');const QJ=5e5,BJ={...Ta,lineHeight:24,spacing:0},d4=["mode","media","class","classList","annotations","selectedLines","commentedLines","search","onLineSelected","onLineSelectionEnd","onLineNumberSelectionEnd","onRendered","preloadedDiff"],EJ=["file",...d4],CJ=["fileDiff","before","after","virtualize",...d4];function uJ(A){let e,t,n,i,r,o,s,a=!1,l=null,c=!1;const g=uK(),d=wK(),[Q,B]=T(0),C=()=>hK(t),I=()=>s4(t),f=CK({wrapper:()=>e,overlay:()=>n,getRoot:C}),u=()=>{i===void 0&&(i=requestAnimationFrame(()=>{i=void 0;const k=c;A.updateSelection(k),c&&(c=!1,A.onLineSelectionEnd(l))}))},p=()=>{r===void 0&&(r=requestAnimationFrame(()=>{r=void 0;const k=A.buildDragSelection();k&&A.setSelectedLines(k)}))},w=k=>{if(!A.enableLineSelection()||k.button!==0)return;const N=A.lineFromMouseEvent(k);if(N.numberColumn){d.begin(!0,N.line);return}N.line!==void 0&&(d.begin(!1,N.line),o=N.line,s=N.line,a=!1,A.onDragStart(N))},m=k=>{if(!A.enableLineSelection())return;const N=A.lineFromMouseEvent(k);if(!d.track(k.buttons,N.line)&&o!==void 0){if((k.buttons&1)===0){o=void 0,s=void 0,a=!1,A.onDragReset(),d.finish();return}N.line!==void 0&&(s=N.line,a=!0,A.onDragMove(N),p())}},y=()=>{if(A.enableLineSelection()&&d.finish()!=="numbers"&&o!==void 0){if(!a){c=!1;const k=A.buildClickSelection();k&&A.setSelectedLines(k),A.onLineSelectionEnd(l),o=void 0,s=void 0,a=!1,A.onDragReset();return}c=!0,p(),u(),o=void 0,s=void 0,a=!1,A.onDragReset()}},M=()=>{if(!A.enableLineSelection()||o===void 0)return;const k=window.getSelection();!k||k.isCollapsed||u()};return C1(()=>{DA(IK(I))}),nA(()=>{Q();const k=A.commentedLines();requestAnimationFrame(()=>{const N=C();N&&A.markCommented(N,k)})}),nA(()=>{A.setSelectedLines(A.selectedLines()??null)}),nA(()=>{A.enableLineSelection()&&(tn(t,"mousedown",w),tn(t,"mousemove",m),tn(window,"mouseup",y),tn(document,"selectionchange",M))}),DA(()=>{br(g),i!==void 0&&cancelAnimationFrame(i),r!==void 0&&cancelAnimationFrame(r),i=void 0,r=void 0,o=void 0,s=void 0,a=!1,d.reset(),l=null,c=!1}),{get wrapper(){return e},set wrapper(k){e=k},get container(){return t},set container(k){t=k},get overlay(){return n},set overlay(k){n=k},get dragStart(){return o},get dragEnd(){return s},get lastSelection(){return l},set lastSelection(k){l=k},ready:g,bridge:d,rendered:Q,setRendered:B,getRoot:C,getHost:I,find:f,scheduleSelectionUpdate:u}}function Q4(A,e){return uJ({enableLineSelection:A.enableLineSelection,selectedLines:A.selectedLines,commentedLines:()=>A.commentedLines()??[],onLineSelectionEnd:A.onLineSelectionEnd,...e})}function B4(A){nA(()=>{const e=A.search();if(!e)return;const t={focus:()=>A.find.focus()};e.register(t),DA(()=>e.register(null))})}function E4(A){const e=t=>{if(!A.normalize)return t;const n=A.normalize(t);return n!==void 0?n:t};return{onLineSelected:t=>{const n=e(t);A.viewer.lastSelection=n,A.onLineSelected?.(n)},onLineSelectionEnd:t=>{const n=e(t);A.viewer.lastSelection=n,A.onLineSelectionEnd?.(n),A.viewer.bridge.consume(n)&&requestAnimationFrame(()=>A.onLineNumberSelectionEnd?.(n))}}}function C4(A){nA(()=>{A.viewer.rendered();const e=A.current();e&&(e.setLineAnnotations(A.annotations()),e.rerender(),requestAnimationFrame(()=>A.viewer.find.refresh({reset:!0})))})}function u4(A){fK({state:A.viewer.ready,container:A.viewer.container,getRoot:A.viewer.getRoot,isReady:A.isReady,settleFrames:A.settleFrames,onReady:A.onReady})}function h4(A){br(A.viewer.ready);const e=A.reset===!0&&A.current!==void 0;e&&A.current?.cleanUp();const t=e||!A.current?A.create():A.current;e||!A.current?(A.viewer.container.innerHTML="",A.assign(t)):A.update?.(t),A.draw(t),_c(A.viewer.getHost()),A.viewer.setRendered(n=>n+1),A.onReady()}function hJ(A){const e=I4(A.wrapper);if(!e)return()=>{};const t=A.container.getBoundingClientRect().height;if(!t)return()=>{};const n=A.wrapper.getBoundingClientRect().top-e.getBoundingClientRect().top,i=A.container.style.minHeight;A.container.style.minHeight=`${Math.ceil(t)}px`;let r=!1;return()=>{if(r)return;r=!0,A.container.style.minHeight=i;const s=A.wrapper.getBoundingClientRect().top-e.getBoundingClientRect().top-n;s&&(e.scrollTop+=s)}}function I4(A){let e=A.parentElement;for(;e;){const t=getComputedStyle(e);if(t.overflowY==="auto"||t.overflowY==="scroll")return e;e=e.parentElement}}function IJ(A,e){let t,n;const i=()=>{t?.cleanUp(),t=void 0,n=void 0};return{get:()=>{if(!e()){i();return}if(typeof document>"u")return;const r=A();if(!r)return;const o=I4(r)??document;return t&&n===o||(i(),t=new e4,n=o,t.setup(o,o instanceof Document?void 0:r)),t},cleanup:i}}function fJ(A,e){let t;const n=()=>{t?.release(),t=void 0};return{get:()=>{if(!e()){n();return}if(t)return t.virtualizer;const i=A();if(!i)return;const r=MK(i);if(r)return t=r,r.virtualizer},cleanup:n}}function pJ(A){if(!A.dataset.line)return;const e=parseInt(A.dataset.line,10);if(!Number.isNaN(e))return e}function f4(A,e,t){const n=A.composedPath();let i=!1,r,o;for(const s of n)if(s instanceof HTMLElement&&(i=i||s.dataset.columnNumber!=null,r===void 0&&(r=e(s)),o===void 0&&t&&(o=t(s)),i&&r!==void 0&&(t==null||o!==void 0)))break;return{line:r,numberColumn:i,side:o}}function mJ(A){const e=A.dataset.lineType;if(e==="change-deletion")return"deletions";if(e==="change-addition"||e==="change-additions")return"additions";if(A.dataset.code!=null)return A.hasAttribute("data-deletions")?"deletions":"additions"}function wJ(A){const e=el(A);if(e)return n4(e)}function p4(A){return(()=>{var e=dJ(),t=e.firstChild,n=t.nextSibling;return zA(e,"focus",A.viewer.find.onFocus),zA(e,"pointerdown",A.viewer.find.onPointerDown,!0),He(i=>A.viewer.wrapper=i,e),h(e,E(H,{get when(){return A.viewer.find.open()},get children(){return E(cJ,{get pos(){return A.viewer.find.pos},get query(){return A.viewer.find.query},get count(){return A.viewer.find.count},get index(){return A.viewer.find.index},get setInput(){return A.viewer.find.setInput},get onInput(){return A.viewer.find.setQuery},get onKeyDown(){return A.viewer.find.onInputKeyDown},get onClose(){return A.viewer.find.close},onPrev:()=>A.viewer.find.next(-1),onNext:()=>A.viewer.find.next(1)})}}),t),He(i=>A.viewer.container=i,t),He(i=>A.viewer.overlay=i,n),Y(i=>{var r=A.mode,o=t4,s={...A.classList,[A.class??""]:!!A.class};return r!==i.e&&j(e,"data-mode",i.e=r),i.t=ao(e,o,i.t),i.a=Ni(e,s,i.a),i},{e:void 0,t:void 0,a:void 0}),e})()}function yJ(A){let e,t;const[n,i]=MA(A,EJ),r=()=>{const f=n.file.contents;return typeof f=="string"?f:Array.isArray(f)?f.join(`
809
809
  `):f==null?"":String(f)},o=()=>{const f=r(),u=f.split(`
810
810
  `).length-(f.endsWith(`
811
811
  `)?1:0);return Math.max(1,u)},s=R(()=>{const f=n.file.contents;return typeof f=="string"?f.length:Array.isArray(f)?f.reduce((u,p)=>u+(typeof p=="string"?p.length+1:String(p).length+1),0):f==null?0:String(f).length}),a=R(()=>s()>QJ),l=IJ(()=>t.wrapper,a),c=f=>f4(f,pJ),g=f=>{const u=e;if(!u)return!1;if(a())return u.setSelectedLines(f),!0;const p=t.getRoot();if(!p)return!1;const w=o();if(p.querySelectorAll("[data-line]").length<w)return!1;if(!f)return u.setSelectedLines(null),!0;const m=Math.min(f.start,f.end),y=Math.max(f.start,f.end);if(m<1||y>w||!p.querySelector(`[data-line="${m}"]`)||!p.querySelector(`[data-line="${y}"]`))return u.setSelectedLines(null),!0;const M=f.endSide!=null?{start:f.start,end:f.end}:f.side!=="deletions"||p.querySelector("[data-deletions]")!=null?f:{start:f.start,end:f.end};return u.setSelectedLines(M),!0},d=f=>{t.lastSelection=f,g(f)};t=Q4({enableLineSelection:()=>A.enableLineSelection===!0,selectedLines:()=>n.selectedLines,commentedLines:()=>n.commentedLines,onLineSelectionEnd:f=>n.onLineSelectionEnd?.(f)},{lineFromMouseEvent:c,setSelectedLines:d,updateSelection:f=>{const u=t.getRoot();if(!u)return;const p=l4({root:u,lineForNode:yK,sideForNode:DK,preserveTextSelection:f});p&&(d(p.range),!(!f||!p.text)&&a4(u,p.text))},buildDragSelection:()=>{if(!(t.dragStart===void 0||t.dragEnd===void 0))return{start:Math.min(t.dragStart,t.dragEnd),end:Math.max(t.dragStart,t.dragEnd)}},buildClickSelection:()=>{if(t.dragStart!==void 0)return{start:t.dragStart,end:t.dragStart}},onDragStart:()=>{},onDragMove:()=>{},onDragReset:()=>{},markCommented:dK});const B=E4({viewer:t,onLineSelected:f=>n.onLineSelected?.(f),onLineSelectionEnd:f=>n.onLineSelectionEnd?.(f),onLineNumberSelectionEnd:f=>n.onLineNumberSelectionEnd?.(f)}),C=R(()=>({...Z0("unified"),...i,...B})),I=()=>{u4({viewer:t,isReady:f=>a()?f.querySelector("[data-line]")!=null:f.querySelectorAll("[data-line]").length>=o(),onReady:()=>{g(t.lastSelection),t.find.refresh({reset:!0}),n.onRendered?.()}})};return B4({search:()=>n.search,find:t.find}),nA(()=>{const f=C(),u=da("unified"),p=l.get();h4({viewer:t,current:e,reset:e!==void 0,create:()=>p?new jO(f,p,BJ,u):new Vf(f,u),assign:w=>{e=w},draw:w=>{const m=r();w.render({file:typeof n.file.contents=="string"?n.file:{...n.file,contents:m},lineAnnotations:[],containerWrapper:t.container})},onReady:I})}),C4({viewer:t,current:()=>e,annotations:()=>n.annotations??[]}),DA(()=>{e?.cleanUp(),e=void 0,l.cleanup()}),E(p4,{mode:"text",viewer:t,get class(){return n.class},get classList(){return n.classList}})}function DJ(A){let e,t,n,i,r,o,s,a,l,c;const[g,d]=MA(A,CJ),Q=JC("(max-width: 640px)"),B=M=>f4(M,NE,mJ),C=(M,k)=>{const N=e;if(!N)return;const _=DE(c.getRoot(),M);if(_===void 0){c.lastSelection=M;return}c.lastSelection=_,N.setSelectedLines(_),a4(k?.root,k?.text)};c=Q4({enableLineSelection:()=>A.enableLineSelection===!0,selectedLines:()=>g.selectedLines,commentedLines:()=>g.commentedLines,onLineSelectionEnd:M=>g.onLineSelectionEnd?.(M)},{lineFromMouseEvent:B,setSelectedLines:C,updateSelection:M=>{const k=c.getRoot();if(!k)return;const N=l4({root:k,lineForNode:NE,sideForNode:wJ,preserveTextSelection:M});if(N){if(N.text){C(N.range,{root:k,text:N.text});return}C(N.range)}},buildDragSelection:()=>{if(c.dragStart===void 0||c.dragEnd===void 0)return;const M={start:c.dragStart,end:c.dragEnd};return a&&(M.side=a),l&&a&&l!==a&&(M.endSide=l),M},buildClickSelection:()=>{if(c.dragStart===void 0)return;const M={start:c.dragStart,end:c.dragStart};return a&&(M.side=a),M},onDragStart:M=>{a=M.side,l=M.side},onDragMove:M=>{l=M.side},onDragReset:()=>{a=void 0,l=void 0},markCommented:cK});const f=fJ(()=>c.container,()=>g.virtualize!==!1),u=R(()=>{if(g.fileDiff){const N=g.fileDiff.deletionLines.join(""),_=g.fileDiff.additionLines.join("");return Math.max(N.length,_.length)>5e5}const M=typeof g.before?.contents=="string"?g.before.contents:"",k=typeof g.after?.contents=="string"?g.after.contents:"";return Math.max(M.length,k.length)>5e5}),p={lineDiffType:"none",maxLineDiffLength:0,tokenizeMaxLineLength:1},w=E4({viewer:c,normalize:M=>DE(c.getRoot(),M),onLineSelected:M=>g.onLineSelected?.(M),onLineSelectionEnd:M=>g.onLineSelectionEnd?.(M),onLineNumberSelectionEnd:M=>g.onLineNumberSelectionEnd?.(M)}),m=R(()=>{const M={...Z0(A.diffStyle),...d,...w},k=u()?{...M,...p}:M;return Q()?{...k,disableLineNumbers:!0}:k}),y=M=>{u4({viewer:c,isReady:k=>k.querySelector("[data-line]")!=null,settleFrames:1,onReady:()=>{M?.(),C(c.lastSelection),c.find.refresh({reset:!0}),g.onRendered?.()}})};return B4({search:()=>g.search,find:c.find}),nA(()=>{const M=m(),k=u()?da("unified"):da(A.diffStyle),N=f.get(),_=typeof g.before?.contents=="string"?g.before.contents:"",F=typeof g.after?.contents=="string"?g.after.contents:"",x=hJ(c);DA(x);const S=V=>u()?AB(V):AB(V,V.length),G=g.before?{...g.before,contents:_,cacheKey:S(_)}:void 0,q=g.after?{...g.after,contents:F,cacheKey:S(F)}:void 0,K=g.fileDiff!==void 0?r!==g.fileDiff:r!==void 0||G===void 0||q===void 0||o===void 0||s===void 0||!Et(o,G)||!Et(s,q),J=e!==void 0&&(t!==N||n!==k||N!==void 0&&(i!==M.hunkSeparators||K)),P=!J&&e!==void 0&&!N0(e.options,M);h4({viewer:c,current:e,reset:J,create:()=>N?new jq(M,N,kK,k):new W0(M,k),update:V=>V.setOptions(M),assign:V=>{e=V,t=N,n=k,i=N?M.hunkSeparators:void 0,r=g.fileDiff,o=G,s=q},draw:V=>{if(g.fileDiff){V.render({fileDiff:g.fileDiff,forceRender:P,lineAnnotations:[],containerWrapper:c.container});return}!G||!q||V.render({oldFile:G,newFile:q,forceRender:P,lineAnnotations:[],containerWrapper:c.container})},onReady:()=>y(x)})}),C4({viewer:c,current:()=>e,annotations:()=>g.annotations??[]}),DA(()=>{e?.cleanUp(),e=void 0,t=void 0,n=void 0,i=void 0,r=void 0,o=void 0,s=void 0,f.cleanup(),a=void 0,l=void 0}),E(p4,{mode:"diff",viewer:c,get class(){return g.class},get classList(){return g.classList}})}function m4(A){return A.mode==="text"?E(RE,{get media(){return A.media},fallback:()=>yJ(A)}):E(RE,{get media(){return A.media},fallback:()=>DJ(A)})}Ae(["pointerdown"]);const kJ=OC({name:"FileComponent",init:A=>A.component}),bJ=kJ.provider;function w4(A){let e=A.startIndex??0;const t=A.startLevel??0,n=[],i=a=>{if(a==null)return"";const l=A.getKey??"key",c=ri(l)?a[l]:l(a);return c!=null?String(c):""},r=a=>{if(a==null)return"";const l=A.getTextValue??"textValue",c=ri(l)?a[l]:l(a);return c!=null?String(c):""},o=a=>{if(a==null)return!1;const l=A.getDisabled??"disabled";return(ri(l)?a[l]:l(a))??!1},s=a=>{if(a!=null)return ri(A.getSectionChildren)?a[A.getSectionChildren]:A.getSectionChildren?.(a)};for(const a of A.dataSource){if(ri(a)||e2(a)){n.push({type:"item",rawValue:a,key:String(a),textValue:String(a),disabled:o(a),level:t,index:e}),e++;continue}if(s(a)!=null){n.push({type:"section",rawValue:a,key:"",textValue:"",disabled:!1,level:t,index:e}),e++;const l=s(a)??[];if(l.length>0){const c=w4({dataSource:l,getKey:A.getKey,getTextValue:A.getTextValue,getDisabled:A.getDisabled,getSectionChildren:A.getSectionChildren,startIndex:e,startLevel:t+1});n.push(...c),e+=c.length}}else n.push({type:"item",rawValue:a,key:i(a),textValue:r(a),disabled:o(a),level:t,index:e}),e++}return n}function vJ(A,e=[]){return R(()=>{const t=w4({dataSource:iA(A.dataSource),getKey:iA(A.getKey),getTextValue:iA(A.getTextValue),getDisabled:iA(A.getDisabled),getSectionChildren:iA(A.getSectionChildren)});for(let n=0;n<e.length;n++)e[n]();return A.factory(t)})}function il(A){const[e,t]=T(A.defaultValue?.()),n=R(()=>A.value?.()!==void 0),i=R(()=>n()?A.value?.():e());return[i,o=>{le(()=>{const s=Py(o,i());return Object.is(s,i())||(n()||t(s),A.onChange?.(s)),s})}]}function MJ(A){const[e,t]=il(A);return[()=>e()??!1,t]}function NJ(A){const[e,t]=il(A);return[()=>e()??[],t]}var Lt=class y4 extends Set{anchorKey;currentKey;constructor(e,t,n){super(e),e instanceof y4?(this.anchorKey=t||e.anchorKey,this.currentKey=n||e.currentKey):(this.anchorKey=t,this.currentKey=n)}};function SJ(A){const[e,t]=il(A);return[()=>e()??new Lt,t]}function D4(A){return s2()?A.altKey:A.ctrlKey}function li(A){return Zc()?A.metaKey:A.ctrlKey}function UE(A){return new Lt(A)}function xJ(A,e){if(A.size!==e.size)return!1;for(const t of A)if(!e.has(t))return!1;return!0}function LJ(A){const e=pe({selectionMode:"none",selectionBehavior:"toggle"},A),[t,n]=T(!1),[i,r]=T(),o=R(()=>{const C=iA(e.selectedKeys);return C!=null?UE(C):C}),s=R(()=>{const C=iA(e.defaultSelectedKeys);return C!=null?UE(C):new Lt}),[a,l]=SJ({value:o,defaultValue:s,onChange:C=>e.onSelectionChange?.(C)}),[c,g]=T(iA(e.selectionBehavior)),d=()=>iA(e.selectionMode),Q=()=>iA(e.disallowEmptySelection)??!1,B=C=>{(iA(e.allowDuplicateSelectionEvents)||!xJ(C,a()))&&l(C)};return nA(()=>{const C=a();iA(e.selectionBehavior)==="replace"&&c()==="toggle"&&typeof C=="object"&&C.size===0&&g("replace")}),nA(()=>{g(iA(e.selectionBehavior)??"toggle")}),{selectionMode:d,disallowEmptySelection:Q,selectionBehavior:c,setSelectionBehavior:g,isFocused:t,setFocused:n,focusedKey:i,setFocusedKey:r,selectedKeys:a,setSelectedKeys:B}}function _J(A){const[e,t]=T(""),[n,i]=T(-1);return{typeSelectHandlers:{onKeyDown:o=>{if(iA(A.isDisabled))return;const s=iA(A.keyboardDelegate),a=iA(A.selectionManager);if(!s.getKeyForSearch)return;const l=FJ(o.key);if(!l||o.ctrlKey||o.metaKey)return;l===" "&&e().trim().length>0&&(o.preventDefault(),o.stopPropagation());let c=t(d=>d+l),g=s.getKeyForSearch(c,a.focusedKey())??s.getKeyForSearch(c);g==null&&GJ(c)&&(c=c[0],g=s.getKeyForSearch(c,a.focusedKey())??s.getKeyForSearch(c)),g!=null&&(a.setFocusedKey(g),A.onTypeSelect?.(g)),clearTimeout(n()),i(window.setTimeout(()=>t(""),500))}}}}function FJ(A){return A.length===1||!/^[A-Z]/i.test(A)?A:""}function GJ(A){return A.split("").every(e=>e===A[0])}function RJ(A,e,t){const i=IA({selectOnFocus:()=>iA(A.selectionManager).selectionBehavior()==="replace"},A),r=()=>e(),{direction:o}=c4();let s={top:0,left:0};zy(()=>iA(i.isVirtualized)?void 0:r(),"scroll",()=>{const I=r();I&&(s={top:I.scrollTop,left:I.scrollLeft})});const{typeSelectHandlers:a}=_J({isDisabled:()=>iA(i.disallowTypeAhead),keyboardDelegate:()=>iA(i.keyboardDelegate),selectionManager:()=>iA(i.selectionManager)}),l=()=>iA(i.orientation)??"vertical",c=I=>{Z1(I,a.onKeyDown),I.altKey&&I.key==="Tab"&&I.preventDefault();const f=e();if(!f?.contains(I.target))return;const u=iA(i.selectionManager),p=iA(i.selectOnFocus),w=k=>{k!=null&&(u.setFocusedKey(k),I.shiftKey&&u.selectionMode()==="multiple"?u.extendSelection(k):p&&!D4(I)&&u.replaceSelection(k))},m=iA(i.keyboardDelegate),y=iA(i.shouldFocusWrap),M=u.focusedKey();switch(I.key){case(l()==="vertical"?"ArrowDown":"ArrowRight"):{if(m.getKeyBelow){I.preventDefault();let k;M!=null?k=m.getKeyBelow(M):k=m.getFirstKey?.(),k==null&&y&&(k=m.getFirstKey?.(M)),w(k)}break}case(l()==="vertical"?"ArrowUp":"ArrowLeft"):{if(m.getKeyAbove){I.preventDefault();let k;M!=null?k=m.getKeyAbove(M):k=m.getLastKey?.(),k==null&&y&&(k=m.getLastKey?.(M)),w(k)}break}case(l()==="vertical"?"ArrowLeft":"ArrowUp"):{if(m.getKeyLeftOf){I.preventDefault();const k=o()==="rtl";let N;M!=null?N=m.getKeyLeftOf(M):N=k?m.getFirstKey?.():m.getLastKey?.(),w(N)}break}case(l()==="vertical"?"ArrowRight":"ArrowDown"):{if(m.getKeyRightOf){I.preventDefault();const k=o()==="rtl";let N;M!=null?N=m.getKeyRightOf(M):N=k?m.getLastKey?.():m.getFirstKey?.(),w(N)}break}case"Home":if(m.getFirstKey){I.preventDefault();const k=m.getFirstKey(M,li(I));k!=null&&(u.setFocusedKey(k),li(I)&&I.shiftKey&&u.selectionMode()==="multiple"?u.extendSelection(k):p&&u.replaceSelection(k))}break;case"End":if(m.getLastKey){I.preventDefault();const k=m.getLastKey(M,li(I));k!=null&&(u.setFocusedKey(k),li(I)&&I.shiftKey&&u.selectionMode()==="multiple"?u.extendSelection(k):p&&u.replaceSelection(k))}break;case"PageDown":if(m.getKeyPageBelow&&M!=null){I.preventDefault();const k=m.getKeyPageBelow(M);w(k)}break;case"PageUp":if(m.getKeyPageAbove&&M!=null){I.preventDefault();const k=m.getKeyPageAbove(M);w(k)}break;case"a":li(I)&&u.selectionMode()==="multiple"&&iA(i.disallowSelectAll)!==!0&&(I.preventDefault(),u.selectAll());break;case"Escape":I.defaultPrevented||(I.preventDefault(),iA(i.disallowEmptySelection)||u.clearSelection());break;case"Tab":if(!iA(i.allowsTabNavigation)){if(I.shiftKey)f.focus();else{const k=C2(f,{tabbable:!0});let N,_;do _=k.lastChild(),_&&(N=_);while(_);N&&!N.contains(document.activeElement)&&ds(N)}break}}},g=I=>{const f=iA(i.selectionManager),u=iA(i.keyboardDelegate),p=iA(i.selectOnFocus);if(f.isFocused()){I.currentTarget.contains(I.target)||f.setFocused(!1);return}if(I.currentTarget.contains(I.target)){if(f.setFocused(!0),f.focusedKey()==null){const w=y=>{y!=null&&(f.setFocusedKey(y),p&&f.replaceSelection(y))},m=I.relatedTarget;m&&I.currentTarget.compareDocumentPosition(m)&Node.DOCUMENT_POSITION_FOLLOWING?w(f.lastSelectedKey()??u.getLastKey?.()):w(f.firstSelectedKey()??u.getFirstKey?.())}else if(!iA(i.isVirtualized)){const w=r();if(w){w.scrollTop=s.top,w.scrollLeft=s.left;const m=w.querySelector(`[data-key="${f.focusedKey()}"]`);m&&(ds(m),Yd(w,m))}}}},d=I=>{const f=iA(i.selectionManager);I.currentTarget.contains(I.relatedTarget)||f.setFocused(!1)},Q=I=>{r()===I.target&&I.preventDefault()},B=()=>{const I=iA(i.autoFocus);if(!I)return;const f=iA(i.selectionManager),u=iA(i.keyboardDelegate);let p;I==="first"&&(p=u.getFirstKey?.()),I==="last"&&(p=u.getLastKey?.());const w=f.selectedKeys();w.size&&(p=w.values().next().value),f.setFocused(!0),f.setFocusedKey(p);const m=e();m&&p==null&&!iA(i.shouldUseVirtualFocus)&&ds(m)};return C1(()=>{i.deferAutoFocus?setTimeout(B,0):B()}),nA(B1([r,()=>iA(i.isVirtualized),()=>iA(i.selectionManager).focusedKey()],I=>{const[f,u,p]=I;if(u)p&&i.scrollToKey?.(p);else if(p&&f){const w=f.querySelector(`[data-key="${p}"]`);w&&Yd(f,w)}})),{tabIndex:R(()=>{if(!iA(i.shouldUseVirtualFocus))return iA(i.selectionManager).focusedKey()==null?0:-1}),onKeyDown:c,onMouseDown:Q,onFocusIn:g,onFocusOut:d}}function UJ(A,e){const t=()=>iA(A.selectionManager),n=()=>iA(A.key),i=()=>iA(A.shouldUseVirtualFocus),r=u=>{t().selectionMode()!=="none"&&(t().selectionMode()==="single"?t().isSelected(n())&&!t().disallowEmptySelection()?t().toggleSelection(n()):t().replaceSelection(n()):u?.shiftKey?t().extendSelection(n()):t().selectionBehavior()==="toggle"||li(u)||"pointerType"in u&&u.pointerType==="touch"?t().toggleSelection(n()):t().replaceSelection(n()))},o=()=>t().isSelected(n()),s=()=>iA(A.disabled)||t().isDisabled(n()),a=()=>!s()&&t().canSelectItem(n());let l=null;const c=u=>{a()&&(l=u.pointerType,u.pointerType==="mouse"&&u.button===0&&!iA(A.shouldSelectOnPressUp)&&r(u))},g=u=>{a()&&u.pointerType==="mouse"&&u.button===0&&iA(A.shouldSelectOnPressUp)&&iA(A.allowsDifferentPressOrigin)&&r(u)},d=u=>{a()&&(iA(A.shouldSelectOnPressUp)&&!iA(A.allowsDifferentPressOrigin)||l!=="mouse")&&r(u)},Q=u=>{!a()||!["Enter"," "].includes(u.key)||(D4(u)?t().toggleSelection(n()):r(u))},B=u=>{s()&&u.preventDefault()},C=u=>{const p=e();i()||s()||!p||u.target===p&&t().setFocusedKey(n())},I=R(()=>{if(!(i()||s()))return n()===t().focusedKey()?0:-1}),f=R(()=>iA(A.virtualized)?void 0:n());return nA(B1([e,n,i,()=>t().focusedKey(),()=>t().isFocused()],([u,p,w,m,y])=>{u&&p===m&&y&&!w&&document.activeElement!==u&&(A.focus?A.focus():ds(u))})),{isSelected:o,isDisabled:s,allowsSelection:a,tabIndex:I,dataKey:f,onPointerDown:c,onPointerUp:g,onClick:d,onKeyDown:Q,onMouseDown:B,onFocus:C}}var TJ=class{collection;state;constructor(A,e){this.collection=A,this.state=e}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(A){this.state.setSelectionBehavior(A)}isFocused(){return this.state.isFocused()}setFocused(A){this.state.setFocused(A)}focusedKey(){return this.state.focusedKey()}setFocusedKey(A){(A==null||this.collection().getItem(A))&&this.state.setFocusedKey(A)}selectedKeys(){return this.state.selectedKeys()}isSelected(A){if(this.state.selectionMode()==="none")return!1;const e=this.getKey(A);return e==null?!1:this.state.selectedKeys().has(e)}isEmpty(){return this.state.selectedKeys().size===0}isSelectAll(){if(this.isEmpty())return!1;const A=this.state.selectedKeys();return this.getAllSelectableKeys().every(e=>A.has(e))}firstSelectedKey(){let A;for(const e of this.state.selectedKeys()){const t=this.collection().getItem(e),n=t?.index!=null&&A?.index!=null&&t.index<A.index;(!A||n)&&(A=t)}return A?.key}lastSelectedKey(){let A;for(const e of this.state.selectedKeys()){const t=this.collection().getItem(e),n=t?.index!=null&&A?.index!=null&&t.index>A.index;(!A||n)&&(A=t)}return A?.key}extendSelection(A){if(this.selectionMode()==="none")return;if(this.selectionMode()==="single"){this.replaceSelection(A);return}const e=this.getKey(A);if(e==null)return;const t=this.state.selectedKeys(),n=t.anchorKey||e,i=new Lt(t,n,e);for(const r of this.getKeyRange(n,t.currentKey||e))i.delete(r);for(const r of this.getKeyRange(e,n))this.canSelectItem(r)&&i.add(r);this.state.setSelectedKeys(i)}getKeyRange(A,e){const t=this.collection().getItem(A),n=this.collection().getItem(e);return t&&n?t.index!=null&&n.index!=null&&t.index<=n.index?this.getKeyRangeInternal(A,e):this.getKeyRangeInternal(e,A):[]}getKeyRangeInternal(A,e){const t=[];let n=A;for(;n!=null;){const i=this.collection().getItem(n);if(i&&i.type==="item"&&t.push(n),n===e)return t;n=this.collection().getKeyAfter(n)}return[]}getKey(A){const e=this.collection().getItem(A);return e?!e||e.type!=="item"?null:e.key:A}toggleSelection(A){if(this.selectionMode()==="none")return;if(this.selectionMode()==="single"&&!this.isSelected(A)){this.replaceSelection(A);return}const e=this.getKey(A);if(e==null)return;const t=new Lt(this.state.selectedKeys());t.has(e)?t.delete(e):this.canSelectItem(e)&&(t.add(e),t.anchorKey=e,t.currentKey=e),!(this.disallowEmptySelection()&&t.size===0)&&this.state.setSelectedKeys(t)}replaceSelection(A){if(this.selectionMode()==="none")return;const e=this.getKey(A);if(e==null)return;const t=this.canSelectItem(e)?new Lt([e],e,e):new Lt;this.state.setSelectedKeys(t)}setSelectedKeys(A){if(this.selectionMode()==="none")return;const e=new Lt;for(const t of A){const n=this.getKey(t);if(n!=null&&(e.add(n),this.selectionMode()==="single"))break}this.state.setSelectedKeys(e)}selectAll(){this.selectionMode()==="multiple"&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const A=this.state.selectedKeys();!this.disallowEmptySelection()&&A.size>0&&this.state.setSelectedKeys(new Lt)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(A,e){this.selectionMode()!=="none"&&(this.selectionMode()==="single"?this.isSelected(A)&&!this.disallowEmptySelection()?this.toggleSelection(A):this.replaceSelection(A):this.selectionBehavior()==="toggle"||e&&e.pointerType==="touch"?this.toggleSelection(A):this.replaceSelection(A))}isSelectionEqual(A){if(A===this.state.selectedKeys())return!0;const e=this.selectedKeys();if(A.size!==e.size)return!1;for(const t of A)if(!e.has(t))return!1;for(const t of e)if(!A.has(t))return!1;return!0}canSelectItem(A){if(this.state.selectionMode()==="none")return!1;const e=this.collection().getItem(A);return e!=null&&!e.disabled}isDisabled(A){const e=this.collection().getItem(A);return!e||e.disabled}getAllSelectableKeys(){const A=[];return(t=>{for(;t!=null;){if(this.canSelectItem(t)){const n=this.collection().getItem(t);if(!n)continue;n.type==="item"&&A.push(t)}t=this.collection().getKeyAfter(t)}})(this.collection().getFirstKey()),A}},TE=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(A){this.iterable=A;for(const n of A)this.keyMap.set(n.key,n);if(this.keyMap.size===0)return;let e,t=0;for(const[n,i]of this.keyMap)e?(e.nextKey=n,i.prevKey=e.key):(this.firstKey=n,i.prevKey=void 0),i.type==="item"&&(i.index=t++),e=i,e.nextKey=void 0;this.lastKey=e.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(A){return this.keyMap.get(A)?.prevKey}getKeyAfter(A){return this.keyMap.get(A)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(A){return this.keyMap.get(A)}at(A){const e=[...this.getKeys()];return this.getItem(e[A])}};function OJ(A){const e=LJ(A),n=vJ({dataSource:()=>iA(A.dataSource),getKey:()=>iA(A.getKey),getTextValue:()=>iA(A.getTextValue),getDisabled:()=>iA(A.getDisabled),getSectionChildren:()=>iA(A.getSectionChildren),factory:r=>A.filter?new TE(A.filter(r)):new TE(r)},[()=>A.filter]),i=new TJ(n,e);return Ng(()=>{const r=e.focusedKey();r!=null&&!n().getItem(r)&&e.setFocusedKey(void 0)}),{collection:n,selectionManager:()=>i}}var qJ=class{collection;ref;collator;constructor(A,e,t){this.collection=A,this.ref=e,this.collator=t}getKeyBelow(A){let e=this.collection().getKeyAfter(A);for(;e!=null;){const t=this.collection().getItem(e);if(t&&t.type==="item"&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getKeyAbove(A){let e=this.collection().getKeyBefore(A);for(;e!=null;){const t=this.collection().getItem(e);if(t&&t.type==="item"&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getFirstKey(){let A=this.collection().getFirstKey();for(;A!=null;){const e=this.collection().getItem(A);if(e&&e.type==="item"&&!e.disabled)return A;A=this.collection().getKeyAfter(A)}}getLastKey(){let A=this.collection().getLastKey();for(;A!=null;){const e=this.collection().getItem(A);if(e&&e.type==="item"&&!e.disabled)return A;A=this.collection().getKeyBefore(A)}}getItem(A){return this.ref?.()?.querySelector(`[data-key="${A}"]`)??null}getKeyPageAbove(A){const e=this.ref?.();let t=this.getItem(A);if(!e||!t)return;const n=Math.max(0,t.offsetTop+t.offsetHeight-e.offsetHeight);let i=A;for(;i&&t&&t.offsetTop>n;)i=this.getKeyAbove(i),t=i!=null?this.getItem(i):null;return i}getKeyPageBelow(A){const e=this.ref?.();let t=this.getItem(A);if(!e||!t)return;const n=Math.min(e.scrollHeight,t.offsetTop-t.offsetHeight+e.offsetHeight);let i=A;for(;i&&t&&t.offsetTop<n;)i=this.getKeyBelow(i),t=i!=null?this.getItem(i):null;return i}getKeyForSearch(A,e){const t=this.collator?.();if(!t)return;let n=e!=null?this.getKeyBelow(e):this.getFirstKey();for(;n!=null;){const i=this.collection().getItem(n);if(i){const r=i.textValue.slice(0,A.length);if(i.textValue&&t.compare(r,A)===0)return n}n=this.getKeyBelow(n)}}};function KJ(A,e,t){const n=HK({usage:"search",sensitivity:"base"}),i=R(()=>{const r=iA(A.keyboardDelegate);return r||new qJ(A.collection,e,n)});return RJ({selectionManager:()=>iA(A.selectionManager),keyboardDelegate:i,autoFocus:()=>iA(A.autoFocus),deferAutoFocus:()=>iA(A.deferAutoFocus),shouldFocusWrap:()=>iA(A.shouldFocusWrap),disallowEmptySelection:()=>iA(A.disallowEmptySelection),selectOnFocus:()=>iA(A.selectOnFocus),disallowTypeAhead:()=>iA(A.disallowTypeAhead),shouldUseVirtualFocus:()=>iA(A.shouldUseVirtualFocus),allowsTabNavigation:()=>iA(A.allowsTabNavigation),isVirtualized:()=>iA(A.isVirtualized),scrollToKey:r=>iA(A.scrollToKey)?.(r),orientation:()=>iA(A.orientation)},e)}function JJ(A={}){const[e,t]=MJ({value:()=>iA(A.open),defaultValue:()=>!!iA(A.defaultOpen),onChange:o=>A.onOpenChange?.(o)}),n=()=>{t(!0)},i=()=>{t(!1)};return{isOpen:e,setIsOpen:t,open:n,close:i,toggle:()=>{e()?i():n()}}}function Ct(A){return e=>(A(e),()=>A(void 0))}var ss=A=>typeof A=="function"?A():A,HJ=A=>{const e=R(()=>{const o=ss(A.element);if(o)return getComputedStyle(o)}),t=()=>e()?.animationName??"none",[n,i]=T(ss(A.show)?"present":"hidden");let r="none";return nA(o=>{const s=ss(A.show);return le(()=>{if(o===s)return s;const a=r,l=t();s?i("present"):l==="none"||e()?.display==="none"?i("hidden"):i(o===!0&&a!==l?"hiding":"hidden")}),s}),nA(()=>{const o=ss(A.element);if(!o)return;const s=l=>{l.target===o&&(r=t())},a=l=>{const g=t().includes(l.animationName);l.target===o&&g&&n()==="hiding"&&i("hidden")};o.addEventListener("animationstart",s),o.addEventListener("animationcancel",a),o.addEventListener("animationend",a),DA(()=>{o.removeEventListener("animationstart",s),o.removeEventListener("animationcancel",a),o.removeEventListener("animationend",a)})}),{present:()=>n()==="present"||n()==="hiding",state:n,setState:i}},YJ=HJ,k4=YJ,PJ={};fa(PJ,{Collapsible:()=>VJ,Content:()=>Ad,Root:()=>ed,Trigger:()=>td,useCollapsibleContext:()=>po});var b4=A1();function po(){const A=Ve(b4);if(A===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return A}function Ad(A){const[e,t]=T(),n=po(),i=pe({id:n.generateId("content")},A),[r,o]=MA(i,["ref","id","style"]),{present:s}=k4({show:n.shouldMount,element:()=>e()??null}),[a,l]=T(0),[c,g]=T(0);let Q=n.isOpen()||s();return C1(()=>{const B=requestAnimationFrame(()=>{Q=!1});DA(()=>{cancelAnimationFrame(B)})}),nA(B1(s,()=>{if(!e())return;e().style.transitionDuration="0s",e().style.animationName="none";const B=e().getBoundingClientRect();l(B.height),g(B.width),Q||(e().style.transitionDuration="",e().style.animationName="")})),nA(B1(n.isOpen,B=>{!B&&e()&&(e().style.transitionDuration="",e().style.animationName="")},{defer:!0})),nA(()=>DA(n.registerContentId(r.id))),E(H,{get when(){return s()},get children(){return E(Ke,IA({as:"div",ref(B){var C=nt(t,r.ref);typeof C=="function"&&C(B)},get id(){return r.id},get style(){return Ia({"--kb-collapsible-content-height":a()?`${a()}px`:void 0,"--kb-collapsible-content-width":c()?`${c()}px`:void 0},r.style)}},()=>n.dataset(),o))}})}function ed(A){const e=`collapsible-${Jt()}`,t=pe({id:e},A),[n,i]=MA(t,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[r,o]=T(),s=JJ({open:()=>n.open,defaultOpen:()=>n.defaultOpen,onOpenChange:c=>n.onOpenChange?.(c)}),a=R(()=>({"data-expanded":s.isOpen()?"":void 0,"data-closed":s.isOpen()?void 0:"","data-disabled":n.disabled?"":void 0})),l={dataset:a,isOpen:s.isOpen,disabled:()=>n.disabled??!1,shouldMount:()=>n.forceMount||s.isOpen(),contentId:r,toggle:s.toggle,generateId:co(()=>i.id),registerContentId:Ct(o)};return E(b4.Provider,{value:l,get children(){return E(Ke,IA({as:"div"},a,i))}})}function td(A){const e=po(),[t,n]=MA(A,["onClick"]);return E(Xc,IA({get"aria-expanded"(){return e.isOpen()},get"aria-controls"(){return hA(()=>!!e.isOpen())()?e.contentId():void 0},get disabled(){return e.disabled()},onClick:r=>{Z1(r,t.onClick),e.toggle()}},()=>e.dataset(),n))}var VJ=Object.assign(ed,{Content:Ad,Trigger:td}),v4=A1();function jJ(){return Ve(v4)}function zJ(){const A=jJ();if(A===void 0)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return A}function M4(A,e){return!!(e.compareDocumentPosition(A)&Node.DOCUMENT_POSITION_PRECEDING)}function $J(A,e){const t=e.ref();if(!t)return-1;let n=A.length;if(!n)return-1;for(;n--;){const i=A[n]?.ref();if(i&&M4(i,t))return n+1}return 0}function WJ(A){const e=A.map((n,i)=>[i,n]);let t=!1;return e.sort(([n,i],[r,o])=>{const s=i.ref(),a=o.ref();return s===a||!s||!a?0:M4(s,a)?(n>r&&(t=!0),-1):(n<r&&(t=!0),1)}),t?e.map(([n,i])=>i):A}function N4(A,e){const t=WJ(A);A!==t&&e(t)}function ZJ(A){const e=A[0],t=A[A.length-1]?.ref();let n=e?.ref()?.parentElement;for(;n;){if(t&&n.contains(t))return n;n=n.parentElement}return n2(n).body}function XJ(A,e){nA(()=>{const t=setTimeout(()=>{N4(A(),e)});DA(()=>clearTimeout(t))})}function AH(A,e){if(typeof IntersectionObserver!="function"){XJ(A,e);return}let t=[];nA(()=>{const n=()=>{const o=!!t.length;t=A(),o&&N4(A(),e)},i=ZJ(A()),r=new IntersectionObserver(n,{root:i});for(const o of A()){const s=o.ref();s&&r.observe(s)}DA(()=>r.disconnect())})}function eH(A={}){const[e,t]=NJ({value:()=>iA(A.items),onChange:r=>A.onItemsChange?.(r)});AH(e,t);const n=r=>(t(o=>{const s=$J(o,r);return A2(o,r,s)}),()=>{t(o=>{const s=o.filter(a=>a.ref()!==r.ref());return o.length===s.length?o:s})});return{DomCollectionProvider:r=>E(v4.Provider,{value:{registerItem:n},get children(){return r.children}})}}function tH(A){const e=zJ(),t=pe({shouldRegisterItem:!0},A);nA(()=>{if(!t.shouldRegisterItem)return;const n=e.registerItem(t.getItem());DA(n)})}var nH={};fa(nH,{Accordion:()=>Oi,Content:()=>L4,Header:()=>_4,Item:()=>G4,Root:()=>R4,Trigger:()=>U4,useAccordionContext:()=>nd});var S4=A1();function x4(){const A=Ve(S4);if(A===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return A}function L4(A){const e=x4(),t=e.generateId("content"),n=pe({id:t},A),[i,r]=MA(n,["id","style"]);return nA(()=>DA(e.registerContentId(i.id))),E(Ad,IA({role:"region",get"aria-labelledby"(){return e.triggerId()},get style(){return Ia({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},i.style)}},r))}function _4(A){const e=po();return E(Ke,IA({as:"h3"},()=>e.dataset(),A))}var F4=A1();function nd(){const A=Ve(F4);if(A===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return A}function G4(A){const e=nd(),t=`${e.generateId("item")}-${Jt()}`,n=pe({id:t},A),[i,r]=MA(n,["value","disabled"]),[o,s]=T(),[a,l]=T(),c=()=>e.listState().selectionManager(),g=()=>c().isSelected(i.value),d={value:()=>i.value,triggerId:o,contentId:a,generateId:co(()=>r.id),registerTriggerId:Ct(s),registerContentId:Ct(l)};return E(S4.Provider,{value:d,get children(){return E(ed,IA({get open(){return g()},get disabled(){return i.disabled}},r))}})}function R4(A){let e;const t=`accordion-${Jt()}`,n=pe({id:t,multiple:!1,collapsible:!1,shouldFocusWrap:!0},A),[i,r]=MA(n,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[o,s]=T([]),{DomCollectionProvider:a}=eH({items:o,onItemsChange:s}),l=OJ({selectedKeys:()=>i.value,defaultSelectedKeys:()=>i.defaultValue,onSelectionChange:d=>i.onChange?.(Array.from(d)),disallowEmptySelection:()=>!i.multiple&&!i.collapsible,selectionMode:()=>i.multiple?"multiple":"single",dataSource:o});l.selectionManager().setFocusedKey("item-1");const c=KJ({selectionManager:()=>l.selectionManager(),collection:()=>l.collection(),disallowEmptySelection:()=>l.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>i.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>e),g={listState:()=>l,generateId:co(()=>i.id)};return E(a,{get children(){return E(F4.Provider,{value:g,get children(){return E(Ke,IA({as:"div",get id(){return i.id},ref(d){var Q=nt(B=>e=B,i.ref);typeof Q=="function"&&Q(d)},get onKeyDown(){return _t([i.onKeyDown,c.onKeyDown])},get onMouseDown(){return _t([i.onMouseDown,c.onMouseDown])},get onFocusIn(){return _t([i.onFocusIn])},get onFocusOut(){return _t([i.onFocusOut,c.onFocusOut])}},r))}})}})}function U4(A){let e;const t=nd(),n=x4(),i=po(),r=n.generateId("trigger"),o=pe({id:r},A),[s,a]=MA(o,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);tH({getItem:()=>({ref:()=>e,type:"item",key:n.value(),textValue:"",disabled:i.disabled()})});const l=UJ({key:()=>n.value(),selectionManager:()=>t.listState().selectionManager(),disabled:()=>i.disabled(),shouldSelectOnPressUp:!0},()=>e),c=g=>{["Enter"," "].includes(g.key)&&g.preventDefault(),Z1(g,s.onKeyDown),Z1(g,l.onKeyDown)};return nA(()=>DA(n.registerTriggerId(a.id))),E(td,IA({ref(g){var d=nt(Q=>e=Q,s.ref);typeof d=="function"&&d(g)},get"data-key"(){return l.dataKey()},get onPointerDown(){return _t([s.onPointerDown,l.onPointerDown])},get onPointerUp(){return _t([s.onPointerUp,l.onPointerUp])},get onClick(){return _t([s.onClick,l.onClick])},onKeyDown:c,get onMouseDown(){return _t([s.onMouseDown,l.onMouseDown])},get onFocus(){return _t([s.onFocus,l.onFocus])}},a))}var Oi=Object.assign(R4,{Content:L4,Header:_4,Item:G4,Trigger:U4});function iH(A){const[e,t]=MA(A,["class","classList"]);return E(Oi,IA(t,{"data-component":"accordion",get classList(){return{...e.classList,[e.class??""]:!!e.class}}}))}function rH(A){const[e,t]=MA(A,["class","classList"]);return E(Oi.Item,IA(t,{"data-slot":"accordion-item",get classList(){return{...e.classList,[e.class??""]:!!e.class}}}))}function oH(A){const[e,t]=MA(A,["class","classList","children"]);return E(Oi.Header,IA(t,{"data-slot":"accordion-header",get classList(){return{...e.classList,[e.class??""]:!!e.class}},get children(){return e.children}}))}function sH(A){const[e,t]=MA(A,["class","classList","children"]);return E(Oi.Trigger,IA(t,{"data-slot":"accordion-trigger",get classList(){return{...e.classList,[e.class??""]:!!e.class}},get children(){return e.children}}))}function aH(A){const[e,t]=MA(A,["class","classList","children"]);return E(Oi.Content,IA(t,{"data-slot":"accordion-content",get classList(){return{...e.classList,[e.class??""]:!!e.class}},get children(){return e.children}}))}const Qr=Object.assign(iH,{Item:rH,Header:oH,Trigger:sH,Content:aH});function lH(A){const[e,t]=MA(A,["variant","size","icon","class","classList"]);return E(pa,IA(t,{"data-component":"button",get"data-size"(){return e.size||"normal"},get"data-variant"(){return e.variant||"secondary"},get"data-icon"(){return e.icon},get classList(){return{...e.classList,[e.class??""]:!!e.class}},get children(){return[E(H,{get when(){return e.icon},get children(){return E(gi,{get name(){return e.icon},size:"small"})}}),hA(()=>A.children)]}}))}var gH=D('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 18 14"fill=none><g>'),cH=D("<span data-slot=diff-changes-additions>"),dH=D("<span data-slot=diff-changes-deletions>"),QH=D("<div data-component=diff-changes>"),BH=D("<svg><rect width=2 height=14 rx=1></svg>",!1,!0,!1);function OE(A){const e=()=>A.variant??"default",t=R(()=>Array.isArray(A.changes)?A.changes.reduce((c,g)=>c+(g.additions??0),0):A.changes.additions),n=R(()=>Array.isArray(A.changes)?A.changes.reduce((c,g)=>c+(g.deletions??0),0):A.changes.deletions),i=R(()=>(t()??0)+(n()??0)),r=R(()=>{const g=t()??0,d=n()??0;if(g===0&&d===0)return{added:0,deleted:0,neutral:5};const Q=g+d;if(Q<5){const k=g>0?1:0,N=d>0?1:0,_=5-k-N;return{added:k,deleted:N,neutral:_}}const B=g>d?g/d:d/g;let C=5;(Q<20||B<4)&&(C=4);const I=g/Q,f=d/Q,u=I*C,p=f*C;let w=g>0?Math.max(1,Math.round(u)):0,m=d>0?Math.max(1,Math.round(p)):0;g>0&&g<=5&&(w=Math.min(w,1)),g>5&&g<=10&&(w=Math.min(w,2)),d>0&&d<=5&&(m=Math.min(m,1)),d>5&&d<=10&&(m=Math.min(m,2));let y=w+m;y>C&&(u>p?w=C-m:m=C-w,y=w+m);const M=Math.max(0,5-y);return{added:w,deleted:m,neutral:M}}),o="var(--icon-diff-add-base)",s="var(--icon-diff-delete-base)",a="var(--icon-weak-base)",l=R(()=>{const c=r();return[...Array(c.added).fill(o),...Array(c.deleted).fill(s),...Array(c.neutral).fill(a)].slice(0,5)});return E(H,{get when(){return hA(()=>e()==="default")()?i()>0:!0},get children(){var c=QH();return h(c,E(xr,{get children(){return[E(Te,{get when(){return e()==="bars"},get children(){var g=gH(),d=g.firstChild;return h(d,E(uA,{get each(){return l()},children:(Q,B)=>(()=>{var C=BH();return j(C,"fill",Q),Y(()=>j(C,"x",B()*4)),C})()})),g}}),E(Te,{get when(){return e()==="default"},get children(){return[(()=>{var g=cH();return h(g,()=>`+${t()}`),g})(),(()=>{var g=dH();return h(g,()=>`-${n()}`),g})()]}})]}})),Y(g=>{var d=e(),Q={[A.class??""]:!0};return d!==g.e&&j(c,"data-variant",g.e=d),g.t=Ni(c,Q,g.t),g},{e:void 0,t:void 0}),c}})}const qE="/console/assets/sprite-Fb-TFjRY.svg";var EH=D("<svg><defs><mask mask-type=alpha><use></svg>",!1,!0,!1),CH=D("<svg><rect width=100% height=100% fill=currentColor></svg>",!1,!0,!1),uH=D("<svg data-component=file-icon>"),hH=D("<svg><use></svg>",!1,!0,!1);const IH=A=>{const[e,t]=MA(A,["node","class","classList","expanded","mono"]),n=R(()=>yH(e.node.path,e.node.type,e.expanded||!1)),i=`file-icon-mono-${Jt()}`;return(()=>{var r=uH();return e1(r,IA(t,{get classList(){return{...e.classList,[e.class??""]:!!e.class}}}),!0,!0),h(r,E(H,{get when(){return e.mono},get fallback(){return(()=>{var o=hH();return Y(()=>j(o,"href",`${qE}#${n()}`)),o})()},get children(){return[(()=>{var o=EH(),s=o.firstChild,a=s.firstChild;return j(s,"id",i),Y(()=>j(a,"href",`${qE}#${n()}`)),o})(),(()=>{var o=CH();return j(o,"mask",`url(#${i})`),o})()]}})),r})()},ii={fileNames:{"readme.md":"Readme","changelog.md":"Changelog","contributing.md":"Contributing","conduct.md":"Conduct",license:"Certificate",authors:"Authors",credits:"Credits",install:"Installation","package.json":"Nodejs","package-lock.json":"Nodejs","yarn.lock":"Yarn","pnpm-lock.yaml":"Pnpm","bun.lock":"Bun","bun.lockb":"Bun","bunfig.toml":"Bun",".nvmrc":"Nodejs",".node-version":"Nodejs",dockerfile:"Docker","docker-compose.yml":"Docker","docker-compose.yaml":"Docker",".dockerignore":"Docker","jest.config.js":"Jest","jest.config.ts":"Jest","jest.config.mjs":"Jest","vitest.config.js":"Vitest","vitest.config.ts":"Vitest","tailwind.config.js":"Tailwindcss","tailwind.config.ts":"Tailwindcss","turbo.json":"Turborepo","tsconfig.json":"Tsconfig","jsconfig.json":"Jsconfig",".eslintrc":"Eslint",".eslintrc.js":"Eslint",".eslintrc.json":"Eslint",".prettierrc":"Prettier",".prettierrc.js":"Prettier",".prettierrc.json":"Prettier","vite.config.js":"Vite","vite.config.ts":"Vite","webpack.config.js":"Webpack","rollup.config.js":"Rollup","astro.config.mjs":"AstroConfig","astro.config.js":"AstroConfig","next.config.js":"Next","next.config.mjs":"Next","nuxt.config.js":"Nuxt","nuxt.config.ts":"Nuxt","svelte.config.js":"Svelte","gatsby-config.js":"Gatsby","remix.config.js":"Remix","prisma.schema":"Prisma",".gitignore":"Git",".gitattributes":"Git",makefile:"Makefile",cmake:"Cmake","cargo.toml":"Rust","go.mod":"GoMod","go.sum":"GoMod","requirements.txt":"Python","pyproject.toml":"Python",pipfile:"Python","poetry.lock":"Poetry",gemfile:"Gemfile",rakefile:"Ruby","composer.json":"Php","build.gradle":"Gradle","pom.xml":"Maven","deno.json":"Deno","deno.jsonc":"Deno","vercel.json":"Vercel","netlify.toml":"Netlify",".env":"Tune",".env.local":"Tune",".env.development":"Tune",".env.production":"Tune",".env.example":"Tune",".editorconfig":"Editorconfig","robots.txt":"Robots","favicon.ico":"Favicon",browserlist:"Browserlist",".babelrc":"Babel","babel.config.js":"Babel","gulpfile.js":"Gulp","gruntfile.js":"Grunt","capacitor.config.json":"Capacitor","ionic.config.json":"Ionic","angular.json":"Angular",".storybook":"Storybook","storybook.config.js":"Storybook","cypress.config.js":"Cypress","playwright.config.js":"Playwright","puppeteer.config.js":"Puppeteer","wrangler.toml":"Wrangler","firebase.json":"Firebase",supabase:"Supabase",terraform:"Terraform",kubernetes:"Kubernetes",".gitpod.yml":"Gitpod",".devcontainer":"Vscode","travis.yml":"Travis","appveyor.yml":"Appveyor",".circleci":"Circleci","renovate.json":"Renovate","dependabot.yml":"Dependabot","lerna.json":"Lerna","nx.json":"Nx"},fileExtensions:{"spec.ts":"TestTs","test.ts":"TestTs","spec.tsx":"TestJsx","test.tsx":"TestJsx","spec.js":"TestJs","test.js":"TestJs","spec.jsx":"TestJsx","test.jsx":"TestJsx","js.map":"JavascriptMap","d.ts":"TypescriptDef",ts:"Typescript",tsx:"React_ts",js:"Javascript",jsx:"React",mjs:"Javascript",cjs:"Javascript",html:"Html",htm:"Html",css:"Css",scss:"Sass",sass:"Sass",less:"Less",styl:"Stylus",json:"Json",xml:"Xml",yml:"Yaml",yaml:"Yaml",toml:"Toml",hjson:"Hjson",md:"Markdown",mdx:"Mdx",tex:"Tex",py:"Python",pyx:"Python",pyw:"Python",rs:"Rust",go:"Go",java:"Java",kt:"Kotlin",scala:"Scala",php:"Php",rb:"Ruby",cs:"Csharp",vb:"Visualstudio",cpp:"Cpp",cc:"Cpp",cxx:"Cpp",c:"C",h:"H",hpp:"Hpp",swift:"Swift",m:"ObjectiveC",mm:"ObjectiveCpp",dart:"Dart",lua:"Lua",pl:"Perl",r:"R",jl:"Julia",hs:"Haskell",elm:"Elm",ml:"Ocaml",clj:"Clojure",cljs:"Clojure",erl:"Erlang",ex:"Elixir",exs:"Elixir",nim:"Nim",zig:"Zig",v:"Vlang",odin:"Odin",gleam:"Gleam",grain:"Grain",roc:"Rocket",fs:"Fsharp",sh:"Console",bash:"Console",zsh:"Console",fish:"Console",ps1:"Powershell",cfg:"Settings",ini:"Settings",conf:"Settings",properties:"Settings",svg:"Svg",png:"Image",jpg:"Image",jpeg:"Image",gif:"Image",webp:"Image",bmp:"Image",ico:"Favicon",mp4:"Video",mov:"Video",avi:"Video",webm:"Video",mp3:"Audio",wav:"Audio",flac:"Audio",zip:"Zip",tar:"Zip",gz:"Zip",rar:"Zip","7z":"Zip",pdf:"Pdf",doc:"Word",docx:"Word",ppt:"Powerpoint",pptx:"Powerpoint",xls:"Document",xlsx:"Document",sql:"Database",db:"Database",sqlite:"Database",env:"Tune",log:"Log",lock:"Lock",key:"Key",pem:"Certificate",crt:"Certificate",proto:"Proto",graphql:"Graphql",gql:"Graphql",wasm:"Webassembly",dockerfile:"Docker"},folderNames:{src:"FolderSrc",source:"FolderSrc",lib:"FolderLib",libs:"FolderLib",test:"FolderTest",tests:"FolderTest",testing:"FolderTest",spec:"FolderTest",specs:"FolderTest",__tests__:"FolderTest",e2e:"FolderTest",integration:"FolderTest",unit:"FolderTest",cypress:"FolderCypress",node_modules:"FolderNode",vendor:"FolderPackages",packages:"FolderPackages",deps:"FolderPackages",build:"FolderBuildkite",dist:"FolderDist",out:"FolderDist",output:"FolderDist",target:"FolderTarget",config:"FolderConfig",configs:"FolderConfig",configuration:"FolderConfig",settings:"FolderConfig",env:"FolderEnvironment",environments:"FolderEnvironment",docker:"FolderDocker",dockerfiles:"FolderDocker",containers:"FolderDocker",docs:"FolderDocs",doc:"FolderDocs",documentation:"FolderDocs",readme:"FolderDocs",public:"FolderPublic",static:"FolderPublic",assets:"FolderImages",images:"FolderImages",img:"FolderImages",icons:"FolderImages",media:"FolderImages",fonts:"FolderFont",styles:"FolderCss",stylesheets:"FolderCss",css:"FolderCss",sass:"FolderSass",scss:"FolderSass",less:"FolderLess",scripts:"FolderScripts",script:"FolderScripts",tools:"FolderTools",utils:"FolderUtils",utilities:"FolderUtils",helpers:"FolderHelper",components:"FolderComponents",component:"FolderComponents",views:"FolderViews",view:"FolderViews",layouts:"FolderLayout",layout:"FolderLayout",templates:"FolderTemplate",template:"FolderTemplate",hooks:"FolderHook",hook:"FolderHook",store:"FolderStore",stores:"FolderStore",state:"FolderNgrxStore",reducers:"FolderReduxReducer",reducer:"FolderReduxReducer",services:"FolderApi",service:"FolderApi",api:"FolderApi",apis:"FolderApi",routes:"FolderRoutes",route:"FolderRoutes",routing:"FolderRoutes",middleware:"FolderMiddleware",middlewares:"FolderMiddleware",controllers:"FolderController",controller:"FolderController",models:"FolderDatabase",model:"FolderDatabase",schemas:"FolderDatabase",schema:"FolderDatabase",migrations:"FolderDatabase",migration:"FolderDatabase",seeders:"FolderSeeders",seeder:"FolderSeeders",types:"FolderTypescript",typing:"FolderTypescript",typings:"FolderTypescript","@types":"FolderTypescript",interfaces:"FolderInterface",interface:"FolderInterface",android:"FolderAndroid",ios:"FolderIos",mobile:"FolderMobile",flutter:"FolderFlutter",kubernetes:"FolderKubernetes",k8s:"FolderKubernetes",terraform:"FolderTerraform",aws:"FolderAws",azure:"FolderAzurePipelines",firebase:"FolderFirebase",supabase:"FolderSupabase",vercel:"FolderVercel",netlify:"FolderNetlify",".github":"FolderGithub",".gitlab":"FolderGitlab",".circleci":"FolderCircleci",ci:"FolderCi",".ci":"FolderCi",workflows:"FolderGhWorkflows",".git":"FolderGit",".vscode":"FolderVscode",".idea":"FolderIntellij",".cursor":"FolderCursor",".devcontainer":"FolderContainer",".storybook":"FolderStorybook",i18n:"FolderI18n",locales:"FolderI18n",locale:"FolderI18n",lang:"FolderI18n",languages:"FolderI18n",temp:"FolderTemp",tmp:"FolderTemp",logs:"FolderLog",log:"FolderLog",backup:"FolderBackup",backups:"FolderBackup",examples:"FolderExamples",example:"FolderExamples",demo:"FolderExamples",demos:"FolderExamples",samples:"FolderExamples",sample:"FolderExamples",fixtures:"FolderTest",mocks:"FolderMock",mock:"FolderMock",data:"FolderDatabase",database:"FolderDatabase",db:"FolderDatabase",sql:"FolderDatabase",prisma:"FolderPrisma",drizzle:"FolderDrizzle",security:"FolderSecure",auth:"FolderSecure",authentication:"FolderSecure",authorization:"FolderSecure",keys:"FolderKeys",certs:"FolderKeys",certificates:"FolderKeys",content:"FolderContent",posts:"FolderContent",articles:"FolderContent",blog:"FolderContent",functions:"FolderFunctions",function:"FolderFunctions",lambda:"FolderFunctions",lambdas:"FolderFunctions",serverless:"FolderServerless",jobs:"FolderJob",job:"FolderJob",tasks:"FolderTasks",task:"FolderTasks",cron:"FolderTasks",queue:"FolderQueue",queues:"FolderQueue",desktop:"FolderDesktop",windows:"FolderWindows",macos:"FolderMacos",linux:"FolderLinux"},defaults:{file:"Document",folder:"Folder",folderOpen:"FolderOpen"}},fH=A=>A.startsWith("Folder")?A.endsWith("_light")?A.replace("_light","Open_light"):A.endsWith("Open")?A:A+"Open":A,pH=A=>A.split("\\").join("/").split("/").filter(Boolean).pop()??"",mH=A=>{const e=A.toLowerCase();return[e,`.${e}`,`_${e}`,`__${e}__`]},wH=A=>{const e=A.toLowerCase(),t=[];for(let i=0;i<e.length;i++)e[i]==="."&&t.push(i);const n=new Set;n.add(e);for(const i of t)i+1<e.length&&n.add(e.slice(i+1));return Array.from(n).sort((i,r)=>r.length-i.length)};function yH(A,e,t){const i=pH(A).toLowerCase();if(e==="directory"){for(const o of mH(i)){const s=ii.folderNames[o];if(s)return t?fH(s):s}return t?ii.defaults.folderOpen:ii.defaults.folder}const r=ii.fileNames[i];if(r)return r;for(const o of wH(i)){const s=ii.fileExtensions[o];if(s)return s}return ii.defaults.file}var DH=["id","name","validationState","required","disabled","readOnly"];function kH(A){const e=`form-control-${Jt()}`,t=pe({id:e},A),[n,i]=T(),[r,o]=T(),[s,a]=T(),[l,c]=T(),g=(C,I,f)=>{const u=f!=null||n()!=null;return[f,n(),u&&I!=null?C:void 0].filter(Boolean).join(" ")||void 0},d=C=>[s(),l(),C].filter(Boolean).join(" ")||void 0,Q=R(()=>({"data-valid":iA(t.validationState)==="valid"?"":void 0,"data-invalid":iA(t.validationState)==="invalid"?"":void 0,"data-required":iA(t.required)?"":void 0,"data-disabled":iA(t.disabled)?"":void 0,"data-readonly":iA(t.readOnly)?"":void 0}));return{formControlContext:{name:()=>iA(t.name)??iA(t.id),dataset:Q,validationState:()=>iA(t.validationState),isRequired:()=>iA(t.required),isDisabled:()=>iA(t.disabled),isReadOnly:()=>iA(t.readOnly),labelId:n,fieldId:r,descriptionId:s,errorMessageId:l,getAriaLabelledBy:g,getAriaDescribedBy:d,generateId:co(()=>iA(t.id)),registerLabel:Ct(i),registerField:Ct(o),registerDescription:Ct(a),registerErrorMessage:Ct(c)}}}var T4=A1();function mo(){const A=Ve(T4);if(A===void 0)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return A}function id(A){const e=mo(),t=pe({id:e.generateId("description")},A);return nA(()=>DA(e.registerDescription(t.id))),E(Ke,IA({as:"div"},()=>e.dataset(),t))}function bH(A){let e;const t=mo(),n=pe({id:t.generateId("label")},A),[i,r]=MA(n,["ref"]),o=VC(()=>e,()=>"label");return nA(()=>DA(t.registerLabel(r.id))),E(Ke,IA({as:"label",ref(s){var a=nt(l=>e=l,i.ref);typeof a=="function"&&a(s)},get for(){return hA(()=>o()==="label")()?t.fieldId():void 0}},()=>t.dataset(),r))}function O4(A,e){nA(B1(A,t=>{if(t==null)return;const n=vH(t);n!=null&&(n.addEventListener("reset",e,{passive:!0}),DA(()=>{n.removeEventListener("reset",e)}))}))}function vH(A){return MH(A)?A.form:A.closest("form")}function MH(A){return A.matches("textarea, input, select, button")}function rd(A){const e=mo(),t=pe({id:e.generateId("error-message")},A),[n,i]=MA(t,["forceMount"]),r=()=>e.validationState()==="invalid";return nA(()=>{r()&&DA(e.registerErrorMessage(i.id))}),E(H,{get when(){return n.forceMount||r()},get children(){return E(Ke,IA({as:"div"},()=>e.dataset(),i))}})}var NH={};fa(NH,{Description:()=>id,ErrorMessage:()=>rd,Item:()=>J4,ItemControl:()=>od,ItemDescription:()=>sd,ItemIndicator:()=>ad,ItemInput:()=>H4,ItemLabel:()=>ld,Label:()=>gd,RadioGroup:()=>ol,Root:()=>Y4,useRadioGroupContext:()=>rl});var q4=A1();function rl(){const A=Ve(q4);if(A===void 0)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return A}var K4=A1();function qi(){const A=Ve(K4);if(A===void 0)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return A}function J4(A){const e=mo(),t=rl(),n=`${e.generateId("item")}-${Jt()}`,i=pe({id:n},A),[r,o]=MA(i,["value","disabled","onPointerDown"]),[s,a]=T(),[l,c]=T(),[g,d]=T(),[Q,B]=T(),[C,I]=T(!1),f=R(()=>t.isDefaultValue(r.value)),u=R(()=>t.isSelectedValue(r.value)),p=R(()=>r.disabled||e.isDisabled()||!1),w=M=>{Z1(M,r.onPointerDown),C()&&M.preventDefault()},m=R(()=>({...e.dataset(),"data-disabled":p()?"":void 0,"data-checked":u()?"":void 0})),y={value:()=>r.value,dataset:m,isDefault:f,isSelected:u,isDisabled:p,inputId:s,labelId:l,descriptionId:g,inputRef:Q,select:()=>t.setSelectedValue(r.value),generateId:co(()=>o.id),registerInput:Ct(a),registerLabel:Ct(c),registerDescription:Ct(d),setIsFocused:I,setInputRef:B};return E(K4.Provider,{value:y,get children(){return E(Ke,IA({as:"div",role:"group",onPointerDown:w},m,o))}})}function od(A){const e=qi(),t=pe({id:e.generateId("control")},A),[n,i]=MA(t,["onClick","onKeyDown"]);return E(Ke,IA({as:"div",onClick:s=>{Z1(s,n.onClick),e.select(),e.inputRef()?.focus()},onKeyDown:s=>{Z1(s,n.onKeyDown),s.key===HC.Space&&(e.select(),e.inputRef()?.focus())}},()=>e.dataset(),i))}function sd(A){const e=qi(),t=pe({id:e.generateId("description")},A);return nA(()=>DA(e.registerDescription(t.id))),E(Ke,IA({as:"div"},()=>e.dataset(),t))}function ad(A){const e=qi(),t=pe({id:e.generateId("indicator")},A),[n,i]=MA(t,["ref","forceMount"]),[r,o]=T(),{present:s}=k4({show:()=>n.forceMount||e.isSelected(),element:()=>r()??null});return E(H,{get when(){return s()},get children(){return E(Ke,IA({as:"div",ref(a){var l=nt(o,n.ref);typeof l=="function"&&l(a)}},()=>e.dataset(),i))}})}function H4(A){const e=mo(),t=rl(),n=qi(),i=pe({id:n.generateId("input")},A),[r,o]=MA(i,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),s=()=>[r["aria-labelledby"],n.labelId(),r["aria-labelledby"]!=null&&o["aria-label"]!=null?o.id:void 0].filter(Boolean).join(" ")||void 0,a=()=>[r["aria-describedby"],n.descriptionId(),t.ariaDescribedBy()].filter(Boolean).join(" ")||void 0,[l,c]=T(!1),g=B=>{if(Z1(B,r.onChange),B.stopPropagation(),!l()){t.setSelectedValue(n.value());const C=B.target;C.checked=n.isSelected()}c(!1)},d=B=>{Z1(B,r.onFocus),n.setIsFocused(!0)},Q=B=>{Z1(B,r.onBlur),n.setIsFocused(!1)};return nA(B1([()=>n.isSelected(),()=>n.value()],B=>{if(!B[0]&&B[1]===n.value())return;c(!0);const C=n.inputRef();C?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),C?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},{defer:!0})),nA(()=>DA(n.registerInput(o.id))),E(Ke,IA({as:"input",ref(B){var C=nt(n.setInputRef,r.ref);typeof C=="function"&&C(B)},type:"radio",get name(){return e.name()},get value(){return n.value()},get checked(){return n.isSelected()},get required(){return e.isRequired()},get disabled(){return n.isDisabled()},get readonly(){return e.isReadOnly()},get style(){return Ia({...u2},r.style)},get"aria-labelledby"(){return s()},get"aria-describedby"(){return a()},onChange:g,onFocus:d,onBlur:Q},()=>n.dataset(),o))}function ld(A){const e=qi(),t=pe({id:e.generateId("label")},A);return nA(()=>DA(e.registerLabel(t.id))),E(Ke,IA({as:"label",get for(){return e.inputId()}},()=>e.dataset(),t))}function gd(A){return E(bH,IA({as:"span"},A))}function Y4(A){let e;const t=`radiogroup-${Jt()}`,n=pe({id:t,orientation:"vertical"},A),[i,r,o]=MA(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],DH),[s,a]=il({value:()=>i.value,defaultValue:()=>i.defaultValue,onChange:I=>i.onChange?.(I)}),{formControlContext:l}=kH(r);O4(()=>e,()=>a(i.defaultValue??""));const c=()=>l.getAriaLabelledBy(iA(r.id),o["aria-label"],i["aria-labelledby"]),g=()=>l.getAriaDescribedBy(i["aria-describedby"]),d=I=>I===A.defaultValue,Q=I=>I===s(),C={ariaDescribedBy:g,isDefaultValue:d,isSelectedValue:Q,setSelectedValue:I=>{if(!(l.isReadOnly()||l.isDisabled())&&(a(I),e))for(const f of e.querySelectorAll("[type='radio']")){const u=f;u.checked=Q(u.value)}}};return E(T4.Provider,{value:l,get children(){return E(q4.Provider,{value:C,get children(){return E(Ke,IA({as:"div",ref(I){var f=nt(u=>e=u,i.ref);typeof f=="function"&&f(I)},role:"radiogroup",get id(){return iA(r.id)},get"aria-invalid"(){return l.validationState()==="invalid"||void 0},get"aria-required"(){return l.isRequired()||void 0},get"aria-disabled"(){return l.isDisabled()||void 0},get"aria-readonly"(){return l.isReadOnly()||void 0},get"aria-orientation"(){return i.orientation},get"aria-labelledby"(){return c()},get"aria-describedby"(){return g()}},()=>l.dataset(),o))}})}})}var ol=Object.assign(Y4,{Description:id,ErrorMessage:rd,Item:J4,ItemControl:od,ItemDescription:sd,ItemIndicator:ad,ItemInput:H4,ItemLabel:ld,Label:gd});function SH(A,e){const t=new ResizeObserver(A);return DA(t.disconnect.bind(t)),{observe:n=>t.observe(n,e),unobserve:t.unobserve.bind(t)}}function xH(A,e,t){const n=new WeakMap,{observe:i,unobserve:r}=SH(o=>{for(const s of o){const{contentRect:a,target:l}=s,c=Math.round(a.width),g=Math.round(a.height),d=n.get(l);(!d||d.width!==c||d.height!==g)&&(e(a,l,s),n.set(l,{width:c,height:g}))}},t);nA(o=>{const s=qC(xs(iA(A)));return KC(s,o,i,r),s},[])}var P4=A1();function V4(){const A=Ve(P4);if(A===void 0)throw new Error("[kobalte]: `useSegmentedControlContext` must be used within a `SegmentedControl` component");return A}function LH(A){const e=V4(),[t,n]=MA(A,["style"]),[i,r]=T(),[o,s]=T(!1),a=()=>{const c=e.selectedItem();if(!c){r(void 0);return}r({width:`${c.offsetWidth}px`,height:`${c.offsetHeight}px`,transform:l(c),"transition-duration":o()?"0ms":void 0})},l=c=>{const g=getComputedStyle(c.parentElement),d=c.offsetLeft-Number.parseFloat(g.paddingLeft),Q=c.offsetTop-Number.parseFloat(g.paddingTop);return`translate(${d}px, ${Q}px)`};return nA(B1(e.selectedItem,()=>{s(!i()),a(),s(!1)})),xH(e.root,()=>{Yc(()=>{s(!0),a(),s(!1)})}),E(Ke,IA({as:"div",role:"presentation",get style(){return Ia(i(),t.style)},get"data-resizing"(){return o()},get"data-orientation"(){return e.orientation()}},n))}var _H=A=>{const e=rl(),t=V4(),[n,i]=MA(A,["ref"]),[r,o]=T();return nA(()=>{const s=r();s&&e.isSelectedValue(A.value)&&t.setSelectedItem(s)}),E(ol.Item,IA({ref(s){var a=nt(o,n.ref);typeof a=="function"&&a(s)}},i))},FH=A=>{const e=qi(),[t,n]=MA(A,["ref"]),[i,r]=T();return O4(i,()=>{requestAnimationFrame(()=>{e.isDefault()&&e.select()})}),E(ol.ItemInput,IA({ref(o){var s=nt(r,t.ref);typeof s=="function"&&s(o)}},n))},GH=A=>{const e=IA({defaultValue:A.value,orientation:"horizontal"},A),[t,n]=MA(e,["ref"]),[i,r]=T(),[o,s]=T(),a={value:()=>n.value,defaultValue:()=>n.defaultValue,orientation:()=>n.orientation,root:i,selectedItem:o,setSelectedItem:s};return nA(()=>{a.value()||s(void 0)}),E(P4.Provider,{value:a,get children(){return E(ol,IA({ref(l){var c=nt(r,t.ref);typeof c=="function"&&c(l)}},n))}})},tr=Object.assign(GH,{Description:id,ErrorMessage:rd,Indicator:LH,Item:_H,ItemControl:od,ItemDescription:sd,ItemIndicator:ad,ItemInput:FH,ItemLabel:ld,Label:gd}),RH=D("<div role=presentation data-slot=radio-group-wrapper><div role=presentation data-slot=radio-group-items>"),UH=D("<span data-slot=radio-group-item-control>");function TH(A){const[e,t]=MA(A,["class","classList","options","current","defaultValue","value","label","onSelect","size","fill","pad"]),n=o=>e.value?e.value(o):String(o),i=o=>e.label?e.label(o):String(o),r=o=>e.options.find(s=>n(s)===o);return E(tr,IA(t,{"data-component":"radio-group",get"data-size"(){return e.size??"medium"},get"data-fill"(){return e.fill?"":void 0},get"data-pad"(){return e.pad??"normal"},get classList(){return{...e.classList,[e.class??""]:!!e.class}},get value(){return hA(()=>!!e.current)()?n(e.current):void 0},get defaultValue(){return hA(()=>!!e.defaultValue)()?n(e.defaultValue):void 0},onChange:o=>e.onSelect?.(r(o)),get children(){var o=RH(),s=o.firstChild;return h(o,E(tr.Indicator,{"data-slot":"radio-group-indicator"}),s),h(s,E(uA,{get each(){return e.options},children:a=>E(tr.Item,{get value(){return n(a)},"data-slot":"radio-group-item",get"data-value"(){return n(a)},get children(){return[E(tr.ItemInput,{"data-slot":"radio-group-item-input"}),E(tr.ItemLabel,{"data-slot":"radio-group-item-label",get children(){var l=UH();return h(l,()=>i(a)),l}})]}})})),o}}))}function OH(A){return E(Qr.Header,{"data-component":"sticky-accordion-header",get classList(){return{...A.classList,[A.class??""]:!!A.class}},get children(){return A.children}})}const KE=new Map;function qH(A){const[e]=Eq(A),t=[],n=[];if(!e)return{before:"",after:""};for(const i of e.hunks)for(const r of i.lines)r.startsWith("-")?t.push(r.slice(1)):(r.startsWith("+")||t.push(r.slice(1)),n.push(r.slice(1)));return{before:t.join(`