@tencent-ai/codebuddy-code 2.109.3 → 2.110.0-dev.f3c5b2f.202606251637

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.
@@ -638,12 +638,12 @@ WARNING: This link could potentially be dangerous`)){const f=window.open();if(f)
638
638
  `:`
639
639
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&k&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(k){const N=this._getMouseBufferCoords(k),L=this._model.finalSelectionStart,$=this._model.finalSelectionEnd;return!!(L&&$&&N)&&this._areCoordsInSelection(N,L,$)}isCellInSelection(k,N){const L=this._model.finalSelectionStart,$=this._model.finalSelectionEnd;return!(!L||!$)&&this._areCoordsInSelection([k,N],L,$)}_areCoordsInSelection(k,N,L){return k[1]>N[1]&&k[1]<L[1]||N[1]===L[1]&&k[1]===N[1]&&k[0]>=N[0]&&k[0]<L[0]||N[1]<L[1]&&k[1]===L[1]&&k[0]<L[0]||N[1]<L[1]&&k[1]===N[1]&&k[0]>=N[0]}_selectWordAtCursor(k,N){var M,O;const L=(O=(M=this._linkifier.currentLink)==null?void 0:M.link)==null?void 0:O.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const $=this._getMouseBufferCoords(k);return!!$&&(this._selectWordAt($,N),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,N){this._model.clearSelection(),k=Math.max(k,0),N=Math.min(N,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,N],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const N=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(N)return N[0]--,N[1]--,N[1]+=this._bufferService.buffer.ydisp,N}_getMouseEventScrollAmount(k){let N=(0,p.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return N>=0&&N<=L?0:(N>L&&(N-=L),N=Math.min(Math.max(N,-50),50),N/=50,N/Math.abs(N)+Math.round(14*N))}shouldForceSelection(k){return f.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const N=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);N&&N.length!==this._model.selectionStart[0]&&N.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const N=this._getMouseBufferCoords(k);N&&(this._activeSelectionMode=2,this._selectLineAt(N[1]))}shouldColumnSelect(k){return k.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const N=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const $=L.lines.get(this._model.selectionEnd[1]);$&&$.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}N&&N[0]===this._model.selectionEnd[0]&&N[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const N=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&N<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const $=(0,g.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent($,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,N=this._model.finalSelectionEnd,L=!(!k||!N||k[0]===N[0]&&k[1]===N[1]);L?k&&N&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&N[0]===this._oldSelectionEnd[0]&&N[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,N,L)):this._oldHasSelection&&this._fireOnSelectionChange(k,N,L)}_fireOnSelectionChange(k,N,L){this._oldSelectionStart=k,this._oldSelectionEnd=N,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((N=>this._handleTrim(N)))}_convertViewportColToCharacterIndex(k,N){let L=N;for(let $=0;N>=$;$++){const M=k.loadCell($,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:M>1&&N!==$&&(L+=M-1)}return L}setSelection(k,N,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,N],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,N,L=!0,$=!0){if(k[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,O=M.lines.get(k[1]);if(!O)return;const W=M.translateBufferLineToString(k[1],!1);let H=this._convertViewportColToCharacterIndex(O,k[0]),V=H;const J=k[0]-H;let ee=0,I=0,T=0,A=0;if(W.charAt(H)===" "){for(;H>0&&W.charAt(H-1)===" ";)H--;for(;V<W.length&&W.charAt(V+1)===" ";)V++}else{let P=k[0],U=k[0];O.getWidth(P)===0&&(ee++,P--),O.getWidth(U)===2&&(I++,U++);const F=O.getString(U).length;for(F>1&&(A+=F-1,V+=F-1);P>0&&H>0&&!this._isCharWordSeparator(O.loadCell(P-1,this._workCell));){O.loadCell(P-1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,P--):B>1&&(T+=B-1,H-=B-1),H--,P--}for(;U<O.length&&V+1<W.length&&!this._isCharWordSeparator(O.loadCell(U+1,this._workCell));){O.loadCell(U+1,this._workCell);const B=this._workCell.getChars().length;this._workCell.getWidth()===2?(I++,U++):B>1&&(A+=B-1,V+=B-1),V++,U++}}V++;let R=H+J-ee+T,j=Math.min(this._bufferService.cols,V-H+ee+I-T-A);if(N||W.slice(H,V).trim()!==""){if(L&&R===0&&O.getCodePoint(0)!==32){const P=M.lines.get(k[1]-1);if(P&&O.isWrapped&&P.getCodePoint(this._bufferService.cols-1)!==32){const U=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(U){const F=this._bufferService.cols-U.start;R-=F,j+=F}}}if($&&R+j===this._bufferService.cols&&O.getCodePoint(this._bufferService.cols-1)!==32){const P=M.lines.get(k[1]+1);if(P!=null&&P.isWrapped&&P.getCodePoint(0)!==32){const U=this._getWordAt([0,k[1]+1],!1,!1,!0);U&&(j+=U.length)}}return{start:R,length:j}}}_selectWordAt(k,N){const L=this._getWordAt(k,N);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[L.start,k[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(k){const N=this._getWordAt(k,!0);if(N){let L=k[1];for(;N.start<0;)N.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;N.start+N.length>this._bufferService.cols;)N.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?N.start:N.start+N.length,L]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const N=this._bufferService.buffer.getWrappedRangeForLine(k),L={start:{x:0,y:N.first},end:{x:this._bufferService.cols-1,y:N.last}};this._model.selectionStart=[0,N.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(L,this._bufferService.cols)}};a.SelectionService=w=d([u(3,x.IBufferService),u(4,x.ICoreService),u(5,S.IMouseService),u(6,x.IOptionsService),u(7,S.IRenderService),u(8,S.ICoreBrowserService)],w)},4725:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const d=l(8343);a.ICharSizeService=(0,d.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,d.createDecorator)("CoreBrowserService"),a.IMouseService=(0,d.createDecorator)("MouseService"),a.IRenderService=(0,d.createDecorator)("RenderService"),a.ISelectionService=(0,d.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,d.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,d.createDecorator)("ThemeService"),a.ILinkProviderService=(0,d.createDecorator)("LinkProviderService")},6731:function(c,a,l){var d=this&&this.__decorate||function(w,k,N,L){var $,M=arguments.length,O=M<3?k:L===null?L=Object.getOwnPropertyDescriptor(k,N):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(w,k,N,L);else for(var W=w.length-1;W>=0;W--)($=w[W])&&(O=(M<3?$(O):M>3?$(k,N,O):$(k,N))||O);return M>3&&O&&Object.defineProperty(k,N,O),O},u=this&&this.__param||function(w,k){return function(N,L){k(N,L,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const p=l(7239),g=l(8055),y=l(8460),S=l(844),v=l(2585),m=g.css.toColor("#ffffff"),f=g.css.toColor("#000000"),h=g.css.toColor("#ffffff"),b=g.css.toColor("#000000"),x={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const w=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let N=0;N<216;N++){const L=k[N/36%6|0],$=k[N/6%6|0],M=k[N%6];w.push({css:g.channels.toCss(L,$,M),rgba:g.channels.toRgba(L,$,M)})}for(let N=0;N<24;N++){const L=8+10*N;w.push({css:g.channels.toCss(L,L,L),rgba:g.channels.toRgba(L,L,L)})}return w})());let C=a.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(w){super(),this._optionsService=w,this._contrastCache=new p.ColorContrastCache,this._halfContrastCache=new p.ColorContrastCache,this._onChangeColors=this.register(new y.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:m,background:f,cursor:h,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:x,selectionBackgroundOpaque:g.color.blend(f,x),selectionInactiveBackgroundTransparent:x,selectionInactiveBackgroundOpaque:g.color.blend(f,x),ansi:a.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(w={}){const k=this._colors;if(k.foreground=_(w.foreground,m),k.background=_(w.background,f),k.cursor=_(w.cursor,h),k.cursorAccent=_(w.cursorAccent,b),k.selectionBackgroundTransparent=_(w.selectionBackground,x),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=_(w.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=w.selectionForeground?_(w.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=a.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=_(w.black,a.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=_(w.red,a.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=_(w.green,a.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=_(w.yellow,a.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=_(w.blue,a.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=_(w.magenta,a.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=_(w.cyan,a.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=_(w.white,a.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=_(w.brightBlack,a.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=_(w.brightRed,a.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=_(w.brightGreen,a.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=_(w.brightYellow,a.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=_(w.brightBlue,a.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=_(w.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=_(w.brightCyan,a.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=_(w.brightWhite,a.DEFAULT_ANSI_COLORS[15]),w.extendedAnsi){const N=Math.min(k.ansi.length-16,w.extendedAnsi.length);for(let L=0;L<N;L++)k.ansi[L+16]=_(w.extendedAnsi[L],a.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(w){this._restoreColor(w),this._onChangeColors.fire(this.colors)}_restoreColor(w){if(w!==void 0)switch(w){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[w]=this._restoreColors.ansi[w]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(w){w(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function _(w,k){if(w!==void 0)try{return g.css.toColor(w)}catch{}return k}a.ThemeService=C=d([u(0,v.IOptionsService)],C)},6349:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const d=l(8460),u=l(844);class p extends u.Disposable{constructor(y){super(),this._maxLength=y,this.onDeleteEmitter=this.register(new d.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new d.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new d.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(y){if(this._maxLength===y)return;const S=new Array(y);for(let v=0;v<Math.min(y,this.length);v++)S[v]=this._array[this._getCyclicIndex(v)];this._array=S,this._maxLength=y,this._startIndex=0}get length(){return this._length}set length(y){if(y>this._length)for(let S=this._length;S<y;S++)this._array[S]=void 0;this._length=y}get(y){return this._array[this._getCyclicIndex(y)]}set(y,S){this._array[this._getCyclicIndex(y)]=S}push(y){this._array[this._getCyclicIndex(this._length)]=y,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(y,S,...v){if(S){for(let m=y;m<this._length-S;m++)this._array[this._getCyclicIndex(m)]=this._array[this._getCyclicIndex(m+S)];this._length-=S,this.onDeleteEmitter.fire({index:y,amount:S})}for(let m=this._length-1;m>=y;m--)this._array[this._getCyclicIndex(m+v.length)]=this._array[this._getCyclicIndex(m)];for(let m=0;m<v.length;m++)this._array[this._getCyclicIndex(y+m)]=v[m];if(v.length&&this.onInsertEmitter.fire({index:y,amount:v.length}),this._length+v.length>this._maxLength){const m=this._length+v.length-this._maxLength;this._startIndex+=m,this._length=this._maxLength,this.onTrimEmitter.fire(m)}else this._length+=v.length}trimStart(y){y>this._length&&(y=this._length),this._startIndex+=y,this._length-=y,this.onTrimEmitter.fire(y)}shiftElements(y,S,v){if(!(S<=0)){if(y<0||y>=this._length)throw new Error("start argument out of range");if(y+v<0)throw new Error("Cannot shift elements in list beyond index 0");if(v>0){for(let f=S-1;f>=0;f--)this.set(y+f+v,this.get(y+f));const m=y+S+v-this._length;if(m>0)for(this._length+=m;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let m=0;m<S;m++)this.set(y+m+v,this.get(y+m))}}_getCyclicIndex(y){return(this._startIndex+y)%this._maxLength}}a.CircularList=p},1439:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(d,u=5){if(typeof d!="object")return d;const p=Array.isArray(d)?[]:{};for(const g in d)p[g]=u<=1?d[g]:d[g]&&l(d[g],u-1);return p}},8055:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,d=0,u=0,p=0;var g,y,S,v,m;function f(b){const x=b.toString(16);return x.length<2?"0"+x:x}function h(b,x){return b<x?(x+.05)/(b+.05):(b+.05)/(x+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(x,C,_,w){return w!==void 0?`#${f(x)}${f(C)}${f(_)}${f(w)}`:`#${f(x)}${f(C)}${f(_)}`},b.toRgba=function(x,C,_,w=255){return(x<<24|C<<16|_<<8|w)>>>0},b.toColor=function(x,C,_,w){return{css:b.toCss(x,C,_,w),rgba:b.toRgba(x,C,_,w)}}})(g||(a.channels=g={})),(function(b){function x(C,_){return p=Math.round(255*_),[l,d,u]=m.toChannels(C.rgba),{css:g.toCss(l,d,u,p),rgba:g.toRgba(l,d,u,p)}}b.blend=function(C,_){if(p=(255&_.rgba)/255,p===1)return{css:_.css,rgba:_.rgba};const w=_.rgba>>24&255,k=_.rgba>>16&255,N=_.rgba>>8&255,L=C.rgba>>24&255,$=C.rgba>>16&255,M=C.rgba>>8&255;return l=L+Math.round((w-L)*p),d=$+Math.round((k-$)*p),u=M+Math.round((N-M)*p),{css:g.toCss(l,d,u),rgba:g.toRgba(l,d,u)}},b.isOpaque=function(C){return(255&C.rgba)==255},b.ensureContrastRatio=function(C,_,w){const k=m.ensureContrastRatio(C.rgba,_.rgba,w);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},b.opaque=function(C){const _=(255|C.rgba)>>>0;return[l,d,u]=m.toChannels(_),{css:g.toCss(l,d,u),rgba:_}},b.opacity=x,b.multiplyOpacity=function(C,_){return p=255&C.rgba,x(C,p*_/255)},b.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(y||(a.color=y={})),(function(b){let x,C;try{const _=document.createElement("canvas");_.width=1,_.height=1;const w=_.getContext("2d",{willReadFrequently:!0});w&&(x=w,x.globalCompositeOperation="copy",C=x.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(_){if(_.match(/#[\da-f]{3,8}/i))switch(_.length){case 4:return l=parseInt(_.slice(1,2).repeat(2),16),d=parseInt(_.slice(2,3).repeat(2),16),u=parseInt(_.slice(3,4).repeat(2),16),g.toColor(l,d,u);case 5:return l=parseInt(_.slice(1,2).repeat(2),16),d=parseInt(_.slice(2,3).repeat(2),16),u=parseInt(_.slice(3,4).repeat(2),16),p=parseInt(_.slice(4,5).repeat(2),16),g.toColor(l,d,u,p);case 7:return{css:_,rgba:(parseInt(_.slice(1),16)<<8|255)>>>0};case 9:return{css:_,rgba:parseInt(_.slice(1),16)>>>0}}const w=_.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(w)return l=parseInt(w[1]),d=parseInt(w[2]),u=parseInt(w[3]),p=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),g.toColor(l,d,u,p);if(!x||!C)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=C,x.fillStyle=_,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[l,d,u,p]=x.getImageData(0,0,1,1).data,p!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(l,d,u,p),css:_}}})(S||(a.css=S={})),(function(b){function x(C,_,w){const k=C/255,N=_/255,L=w/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}b.relativeLuminance=function(C){return x(C>>16&255,C>>8&255,255&C)},b.relativeLuminance2=x})(v||(a.rgb=v={})),(function(b){function x(_,w,k){const N=_>>24&255,L=_>>16&255,$=_>>8&255;let M=w>>24&255,O=w>>16&255,W=w>>8&255,H=h(v.relativeLuminance2(M,O,W),v.relativeLuminance2(N,L,$));for(;H<k&&(M>0||O>0||W>0);)M-=Math.max(0,Math.ceil(.1*M)),O-=Math.max(0,Math.ceil(.1*O)),W-=Math.max(0,Math.ceil(.1*W)),H=h(v.relativeLuminance2(M,O,W),v.relativeLuminance2(N,L,$));return(M<<24|O<<16|W<<8|255)>>>0}function C(_,w,k){const N=_>>24&255,L=_>>16&255,$=_>>8&255;let M=w>>24&255,O=w>>16&255,W=w>>8&255,H=h(v.relativeLuminance2(M,O,W),v.relativeLuminance2(N,L,$));for(;H<k&&(M<255||O<255||W<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),O=Math.min(255,O+Math.ceil(.1*(255-O))),W=Math.min(255,W+Math.ceil(.1*(255-W))),H=h(v.relativeLuminance2(M,O,W),v.relativeLuminance2(N,L,$));return(M<<24|O<<16|W<<8|255)>>>0}b.blend=function(_,w){if(p=(255&w)/255,p===1)return w;const k=w>>24&255,N=w>>16&255,L=w>>8&255,$=_>>24&255,M=_>>16&255,O=_>>8&255;return l=$+Math.round((k-$)*p),d=M+Math.round((N-M)*p),u=O+Math.round((L-O)*p),g.toRgba(l,d,u)},b.ensureContrastRatio=function(_,w,k){const N=v.relativeLuminance(_>>8),L=v.relativeLuminance(w>>8);if(h(N,L)<k){if(L<N){const O=x(_,w,k),W=h(N,v.relativeLuminance(O>>8));if(W<k){const H=C(_,w,k);return W>h(N,v.relativeLuminance(H>>8))?O:H}return O}const $=C(_,w,k),M=h(N,v.relativeLuminance($>>8));if(M<k){const O=x(_,w,k);return M>h(N,v.relativeLuminance(O>>8))?$:O}return $}},b.reduceLuminance=x,b.increaseLuminance=C,b.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]}})(m||(a.rgba=m={})),a.toPaddedHex=f,a.contrastRatio=h},8969:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const d=l(844),u=l(2585),p=l(4348),g=l(7866),y=l(744),S=l(7302),v=l(6975),m=l(8460),f=l(1753),h=l(1480),b=l(7994),x=l(9282),C=l(5435),_=l(5981),w=l(2660);let k=!1;class N extends d.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new m.EventEmitter),this._onScroll.event(($=>{var M;(M=this._onScrollApi)==null||M.fire($.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options($){for(const M in $)this.optionsService.options[M]=$[M]}constructor($){super(),this._windowsWrappingHeuristics=this.register(new d.MutableDisposable),this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new m.EventEmitter),this._instantiationService=new p.InstantiationService,this.optionsService=this.register(new S.OptionsService($)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(y.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,m.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,m.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,m.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,m.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new _.WriteBuffer(((M,O)=>this._inputHandler.parse(M,O)))),this.register((0,m.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write($,M){this._writeBuffer.write($,M)}writeSync($,M){this._logService.logLevel<=u.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync($,M)}input($,M=!0){this.coreService.triggerDataEvent($,M)}resize($,M){isNaN($)||isNaN(M)||($=Math.max($,y.MINIMUM_COLS),M=Math.max(M,y.MINIMUM_ROWS),this._bufferService.resize($,M))}scroll($,M=!1){this._bufferService.scroll($,M)}scrollLines($,M,O){this._bufferService.scrollLines($,M,O)}scrollPages($){this.scrollLines($*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine($){const M=$-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler($,M){return this._inputHandler.registerEscHandler($,M)}registerDcsHandler($,M){return this._inputHandler.registerDcsHandler($,M)}registerCsiHandler($,M){return this._inputHandler.registerCsiHandler($,M)}registerOscHandler($,M){return this._inputHandler.registerOscHandler($,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let $=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?$=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&($=!0),$?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const $=[];$.push(this.onLineFeed(x.updateWindowsModeWrappedState.bind(null,this._bufferService))),$.push(this.registerCsiHandler({final:"H"},(()=>((0,x.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,d.toDisposable)((()=>{for(const M of $)M.dispose()}))}}}a.CoreTerminal=N},8460:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let d=0;d<this._listeners.length;d++)if(this._listeners[d]===l)return void this._listeners.splice(d,1)}}})),this._event}fire(l,d){const u=[];for(let p=0;p<this._listeners.length;p++)u.push(this._listeners[p]);for(let p=0;p<u.length;p++)u[p].call(void 0,l,d)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,d){return l((u=>d.fire(u)))},a.runAndSubscribe=function(l,d){return d(void 0),l((u=>d(u)))}},5435:function(c,a,l){var d=this&&this.__decorate||function(ee,I,T,A){var R,j=arguments.length,P=j<3?I:A===null?A=Object.getOwnPropertyDescriptor(I,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(ee,I,T,A);else for(var U=ee.length-1;U>=0;U--)(R=ee[U])&&(P=(j<3?R(P):j>3?R(I,T,P):R(I,T))||P);return j>3&&P&&Object.defineProperty(I,T,P),P},u=this&&this.__param||function(ee,I){return function(T,A){I(T,A,ee)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const p=l(2584),g=l(7116),y=l(2015),S=l(844),v=l(482),m=l(8437),f=l(8460),h=l(643),b=l(511),x=l(3734),C=l(2585),_=l(1480),w=l(6242),k=l(6351),N=l(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},$=131072;function M(ee,I){if(ee>24)return I.setWinLines||!1;switch(ee){case 1:return!!I.restoreWin;case 2:return!!I.minimizeWin;case 3:return!!I.setWinPosition;case 4:return!!I.setWinSizePixels;case 5:return!!I.raiseWin;case 6:return!!I.lowerWin;case 7:return!!I.refreshWin;case 8:return!!I.setWinSizeChars;case 9:return!!I.maximizeWin;case 10:return!!I.fullscreenWin;case 11:return!!I.getWinState;case 13:return!!I.getWinPosition;case 14:return!!I.getWinSizePixels;case 15:return!!I.getScreenSizePixels;case 16:return!!I.getCellSizePixels;case 18:return!!I.getWinSizeChars;case 19:return!!I.getScreenSizeChars;case 20:return!!I.getIconTitle;case 21:return!!I.getWinTitle;case 22:return!!I.pushTitle;case 23:return!!I.popTitle;case 24:return!!I.setWinLines}return!1}var O;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(O||(a.WindowsOptionsReportType=O={}));let W=0;class H extends S.Disposable{getAttrData(){return this._curAttrData}constructor(I,T,A,R,j,P,U,F,B=new y.EscapeSequenceParser){super(),this._bufferService=I,this._charsetService=T,this._coreService=A,this._logService=R,this._optionsService=j,this._oscLinkService=P,this._coreMouseService=U,this._unicodeService=F,this._parser=B,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v.StringToUtf32,this._utf8Decoder=new v.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new V(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._parser.setCsiHandlerFallback(((D,Y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:Y.toArray()})})),this._parser.setEscHandlerFallback((D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})})),this._parser.setExecuteHandlerFallback((D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})})),this._parser.setOscHandlerFallback(((D,Y,X)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:Y,data:X})})),this._parser.setDcsHandlerFallback(((D,Y,X)=>{Y==="HOOK"&&(X=X.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:Y,payload:X})})),this._parser.setPrintHandler(((D,Y,X)=>this.print(D,Y,X))),this._parser.registerCsiHandler({final:"@"},(D=>this.insertChars(D))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(D=>this.scrollLeft(D))),this._parser.registerCsiHandler({final:"A"},(D=>this.cursorUp(D))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(D=>this.scrollRight(D))),this._parser.registerCsiHandler({final:"B"},(D=>this.cursorDown(D))),this._parser.registerCsiHandler({final:"C"},(D=>this.cursorForward(D))),this._parser.registerCsiHandler({final:"D"},(D=>this.cursorBackward(D))),this._parser.registerCsiHandler({final:"E"},(D=>this.cursorNextLine(D))),this._parser.registerCsiHandler({final:"F"},(D=>this.cursorPrecedingLine(D))),this._parser.registerCsiHandler({final:"G"},(D=>this.cursorCharAbsolute(D))),this._parser.registerCsiHandler({final:"H"},(D=>this.cursorPosition(D))),this._parser.registerCsiHandler({final:"I"},(D=>this.cursorForwardTab(D))),this._parser.registerCsiHandler({final:"J"},(D=>this.eraseInDisplay(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(D=>this.eraseInDisplay(D,!0))),this._parser.registerCsiHandler({final:"K"},(D=>this.eraseInLine(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(D=>this.eraseInLine(D,!0))),this._parser.registerCsiHandler({final:"L"},(D=>this.insertLines(D))),this._parser.registerCsiHandler({final:"M"},(D=>this.deleteLines(D))),this._parser.registerCsiHandler({final:"P"},(D=>this.deleteChars(D))),this._parser.registerCsiHandler({final:"S"},(D=>this.scrollUp(D))),this._parser.registerCsiHandler({final:"T"},(D=>this.scrollDown(D))),this._parser.registerCsiHandler({final:"X"},(D=>this.eraseChars(D))),this._parser.registerCsiHandler({final:"Z"},(D=>this.cursorBackwardTab(D))),this._parser.registerCsiHandler({final:"`"},(D=>this.charPosAbsolute(D))),this._parser.registerCsiHandler({final:"a"},(D=>this.hPositionRelative(D))),this._parser.registerCsiHandler({final:"b"},(D=>this.repeatPrecedingCharacter(D))),this._parser.registerCsiHandler({final:"c"},(D=>this.sendDeviceAttributesPrimary(D))),this._parser.registerCsiHandler({prefix:">",final:"c"},(D=>this.sendDeviceAttributesSecondary(D))),this._parser.registerCsiHandler({final:"d"},(D=>this.linePosAbsolute(D))),this._parser.registerCsiHandler({final:"e"},(D=>this.vPositionRelative(D))),this._parser.registerCsiHandler({final:"f"},(D=>this.hVPosition(D))),this._parser.registerCsiHandler({final:"g"},(D=>this.tabClear(D))),this._parser.registerCsiHandler({final:"h"},(D=>this.setMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(D=>this.setModePrivate(D))),this._parser.registerCsiHandler({final:"l"},(D=>this.resetMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(D=>this.resetModePrivate(D))),this._parser.registerCsiHandler({final:"m"},(D=>this.charAttributes(D))),this._parser.registerCsiHandler({final:"n"},(D=>this.deviceStatus(D))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(D=>this.deviceStatusPrivate(D))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(D=>this.softReset(D))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(D=>this.setCursorStyle(D))),this._parser.registerCsiHandler({final:"r"},(D=>this.setScrollRegion(D))),this._parser.registerCsiHandler({final:"s"},(D=>this.saveCursor(D))),this._parser.registerCsiHandler({final:"t"},(D=>this.windowOptions(D))),this._parser.registerCsiHandler({final:"u"},(D=>this.restoreCursor(D))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(D=>this.insertColumns(D))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(D=>this.deleteColumns(D))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(D=>this.selectProtected(D))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(D=>this.requestMode(D,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(D=>this.requestMode(D,!1))),this._parser.setExecuteHandler(p.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(p.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(p.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(p.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(p.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(p.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(p.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(p.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(p.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new w.OscHandler((D=>(this.setTitle(D),this.setIconName(D),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((D=>this.setIconName(D)))),this._parser.registerOscHandler(2,new w.OscHandler((D=>this.setTitle(D)))),this._parser.registerOscHandler(4,new w.OscHandler((D=>this.setOrReportIndexedColor(D)))),this._parser.registerOscHandler(8,new w.OscHandler((D=>this.setHyperlink(D)))),this._parser.registerOscHandler(10,new w.OscHandler((D=>this.setOrReportFgColor(D)))),this._parser.registerOscHandler(11,new w.OscHandler((D=>this.setOrReportBgColor(D)))),this._parser.registerOscHandler(12,new w.OscHandler((D=>this.setOrReportCursorColor(D)))),this._parser.registerOscHandler(104,new w.OscHandler((D=>this.restoreIndexedColor(D)))),this._parser.registerOscHandler(110,new w.OscHandler((D=>this.restoreFgColor(D)))),this._parser.registerOscHandler(111,new w.OscHandler((D=>this.restoreBgColor(D)))),this._parser.registerOscHandler(112,new w.OscHandler((D=>this.restoreCursorColor(D)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const D in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},(()=>this.selectCharset("("+D))),this._parser.registerEscHandler({intermediates:")",final:D},(()=>this.selectCharset(")"+D))),this._parser.registerEscHandler({intermediates:"*",final:D},(()=>this.selectCharset("*"+D))),this._parser.registerEscHandler({intermediates:"+",final:D},(()=>this.selectCharset("+"+D))),this._parser.registerEscHandler({intermediates:"-",final:D},(()=>this.selectCharset("-"+D))),this._parser.registerEscHandler({intermediates:".",final:D},(()=>this.selectCharset("."+D))),this._parser.registerEscHandler({intermediates:"/",final:D},(()=>this.selectCharset("/"+D)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((D=>(this._logService.error("Parsing error: ",D),D))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((D,Y)=>this.requestStatusString(D,Y))))}_preserveStack(I,T,A,R){this._parseStack.paused=!0,this._parseStack.cursorStartX=I,this._parseStack.cursorStartY=T,this._parseStack.decodedLength=A,this._parseStack.position=R}_logSlowResolvingAsync(I){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([I,new Promise(((T,A)=>setTimeout((()=>A("#SLOW_TIMEOUT")),5e3)))]).catch((T=>{if(T!=="#SLOW_TIMEOUT")throw T;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(I,T){let A,R=this._activeBuffer.x,j=this._activeBuffer.y,P=0;const U=this._parseStack.paused;if(U){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,T))return this._logSlowResolvingAsync(A),A;R=this._parseStack.cursorStartX,j=this._parseStack.cursorStartY,this._parseStack.paused=!1,I.length>$&&(P=this._parseStack.position+$)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof I=="string"?` "${I}"`:` "${Array.prototype.map.call(I,(D=>String.fromCharCode(D))).join("")}"`),typeof I=="string"?I.split("").map((D=>D.charCodeAt(0))):I),this._parseBuffer.length<I.length&&this._parseBuffer.length<$&&(this._parseBuffer=new Uint32Array(Math.min(I.length,$))),U||this._dirtyRowTracker.clearRange(),I.length>$)for(let D=P;D<I.length;D+=$){const Y=D+$<I.length?D+$:I.length,X=typeof I=="string"?this._stringDecoder.decode(I.substring(D,Y),this._parseBuffer):this._utf8Decoder.decode(I.subarray(D,Y),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,X))return this._preserveStack(R,j,X,D),this._logSlowResolvingAsync(A),A}else if(!U){const D=typeof I=="string"?this._stringDecoder.decode(I,this._parseBuffer):this._utf8Decoder.decode(I,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,D))return this._preserveStack(R,j,D,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===R&&this._activeBuffer.y===j||this._onCursorMove.fire();const F=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),B=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);B<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(B,this._bufferService.rows-1),Math.min(F,this._bufferService.rows-1))}print(I,T,A){let R,j;const P=this._charsetService.charset,U=this._optionsService.rawOptions.screenReaderMode,F=this._bufferService.cols,B=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,Y=this._curAttrData;let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-T>0&&X.getWidth(this._activeBuffer.x-1)===2&&X.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Y);let te=this._parser.precedingJoinState;for(let ne=T;ne<A;++ne){if(R=I[ne],R<127&&P){const ge=P[String.fromCharCode(R)];ge&&(R=ge.charCodeAt(0))}const se=this._unicodeService.charProperties(R,te);j=_.UnicodeService.extractWidth(se);const be=_.UnicodeService.extractShouldJoin(se),me=be?_.UnicodeService.extractWidth(te):0;if(te=se,U&&this._onA11yChar.fire((0,v.stringFromCodePoint)(R)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+j-me>F){if(B){const ge=X;let ue=this._activeBuffer.x-me;for(this._activeBuffer.x=me,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),me>0&&X instanceof m.BufferLine&&X.copyCellsFrom(ge,ue,0,me,!1);ue<F;)ge.setCellFromCodepoint(ue++,0,1,Y)}else if(this._activeBuffer.x=F-1,j===2)continue}if(be&&this._activeBuffer.x){const ge=X.getWidth(this._activeBuffer.x-1)?1:2;X.addCodepointToCell(this._activeBuffer.x-ge,R,j);for(let ue=j-me;--ue>=0;)X.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}else if(D&&(X.insertCells(this._activeBuffer.x,j-me,this._activeBuffer.getNullCell(Y)),X.getWidth(F-1)===2&&X.setCellFromCodepoint(F-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,Y)),X.setCellFromCodepoint(this._activeBuffer.x++,R,j,Y),j>0)for(;--j;)X.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}this._parser.precedingJoinState=te,this._activeBuffer.x<F&&A-T>0&&X.getWidth(this._activeBuffer.x)===0&&!X.hasContent(this._activeBuffer.x)&&X.setCellFromCodepoint(this._activeBuffer.x,0,1,Y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(I,T){return I.final!=="t"||I.prefix||I.intermediates?this._parser.registerCsiHandler(I,T):this._parser.registerCsiHandler(I,(A=>!M(A.params[0],this._optionsService.rawOptions.windowOptions)||T(A)))}registerDcsHandler(I,T){return this._parser.registerDcsHandler(I,new k.DcsHandler(T))}registerEscHandler(I,T){return this._parser.registerEscHandler(I,T)}registerOscHandler(I,T){return this._parser.registerOscHandler(I,new w.OscHandler(T))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var I;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&I.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);T.hasWidth(this._activeBuffer.x)&&!T.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const I=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-I),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(I=this._bufferService.cols-1){this._activeBuffer.x=Math.min(I,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(I,T){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=I,this._activeBuffer.y=this._activeBuffer.scrollTop+T):(this._activeBuffer.x=I,this._activeBuffer.y=T),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(I,T){this._restrictCursor(),this._setCursor(this._activeBuffer.x+I,this._activeBuffer.y+T)}cursorUp(I){const T=this._activeBuffer.y-this._activeBuffer.scrollTop;return T>=0?this._moveCursor(0,-Math.min(T,I.params[0]||1)):this._moveCursor(0,-(I.params[0]||1)),!0}cursorDown(I){const T=this._activeBuffer.scrollBottom-this._activeBuffer.y;return T>=0?this._moveCursor(0,Math.min(T,I.params[0]||1)):this._moveCursor(0,I.params[0]||1),!0}cursorForward(I){return this._moveCursor(I.params[0]||1,0),!0}cursorBackward(I){return this._moveCursor(-(I.params[0]||1),0),!0}cursorNextLine(I){return this.cursorDown(I),this._activeBuffer.x=0,!0}cursorPrecedingLine(I){return this.cursorUp(I),this._activeBuffer.x=0,!0}cursorCharAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(I){return this._setCursor(I.length>=2?(I.params[1]||1)-1:0,(I.params[0]||1)-1),!0}charPosAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(I){return this._moveCursor(I.params[0]||1,0),!0}linePosAbsolute(I){return this._setCursor(this._activeBuffer.x,(I.params[0]||1)-1),!0}vPositionRelative(I){return this._moveCursor(0,I.params[0]||1),!0}hVPosition(I){return this.cursorPosition(I),!0}tabClear(I){const T=I.params[0];return T===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:T===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let T=I.params[0]||1;for(;T--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let T=I.params[0]||1;for(;T--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(I){const T=I.params[0];return T===1&&(this._curAttrData.bg|=536870912),T!==2&&T!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(I,T,A,R=!1,j=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);P.replaceCells(T,A,this._activeBuffer.getNullCell(this._eraseAttrData()),j),R&&(P.isWrapped=!1)}_resetBufferLine(I,T=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),T),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+I),A.isWrapped=!1)}eraseInDisplay(I,T=!1){let A;switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,T);A<this._bufferService.rows;A++)this._resetBufferLine(A,T);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,T),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,T);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,T);this._dirtyRowTracker.markDirty(0);break;case 3:const R=this._activeBuffer.lines.length-this._bufferService.rows;R>0&&(this._activeBuffer.lines.trimStart(R),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-R,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-R,0),this._onScroll.fire(0))}return!0}eraseInLine(I,T=!1){switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,T);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,T);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,T)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(I){this._restrictCursor();let T=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,j=this._bufferService.rows-1+this._activeBuffer.ybase-R+1;for(;T--;)this._activeBuffer.lines.splice(j-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(I){this._restrictCursor();let T=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let R;for(R=this._bufferService.rows-1-this._activeBuffer.scrollBottom,R=this._bufferService.rows-1+this._activeBuffer.ybase-R;T--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(I){this._restrictCursor();const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.insertCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(I){this._restrictCursor();const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.deleteCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(I){let T=I.params[0]||1;for(;T--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(I){let T=I.params[0]||1;for(;T--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(m.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=I.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);R.deleteCells(0,T,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=I.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);R.insertCells(0,T,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=I.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);R.insertCells(this._activeBuffer.x,T,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=I.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);R.deleteCells(this._activeBuffer.x,T,this._activeBuffer.getNullCell(this._eraseAttrData())),R.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(I){this._restrictCursor();const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(I.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(I){const T=this._parser.precedingJoinState;if(!T)return!0;const A=I.params[0]||1,R=_.UnicodeService.extractWidth(T),j=this._activeBuffer.x-R,P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(j),U=new Uint32Array(P.length*A);let F=0;for(let D=0;D<P.length;){const Y=P.codePointAt(D)||0;U[F++]=Y,D+=Y>65535?2:1}let B=F;for(let D=1;D<A;++D)U.copyWithin(B,0,F),B+=F;return this.print(U,0,B),!0}sendDeviceAttributesPrimary(I){return I.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(p.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(p.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(I){return I.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(p.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(p.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(I.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(p.C0.ESC+"[>83;40003;0c")),!0}_is(I){return(this._optionsService.rawOptions.termName+"").indexOf(I)===0}setMode(I){for(let T=0;T<I.length;T++)switch(I.params[T]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(I){for(let T=0;T<I.length;T++)switch(I.params[T]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(I){for(let T=0;T<I.length;T++)switch(I.params[T]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(I){for(let T=0;T<I.length;T++)switch(I.params[T]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),I.params[T]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(I,T){const A=this._coreService.decPrivateModes,{activeProtocol:R,activeEncoding:j}=this._coreMouseService,P=this._coreService,{buffers:U,cols:F}=this._bufferService,{active:B,alt:D}=U,Y=this._optionsService.rawOptions,X=be=>be?1:2,te=I.params[0];return ne=te,se=T?te===2?4:te===4?X(P.modes.insertMode):te===12?3:te===20?X(Y.convertEol):0:te===1?X(A.applicationCursorKeys):te===3?Y.windowOptions.setWinLines?F===80?2:F===132?1:0:0:te===6?X(A.origin):te===7?X(A.wraparound):te===8?3:te===9?X(R==="X10"):te===12?X(Y.cursorBlink):te===25?X(!P.isCursorHidden):te===45?X(A.reverseWraparound):te===66?X(A.applicationKeypad):te===67?4:te===1e3?X(R==="VT200"):te===1002?X(R==="DRAG"):te===1003?X(R==="ANY"):te===1004?X(A.sendFocus):te===1005?4:te===1006?X(j==="SGR"):te===1015?4:te===1016?X(j==="SGR_PIXELS"):te===1048?1:te===47||te===1047||te===1049?X(B===D):te===2004?X(A.bracketedPasteMode):0,P.triggerDataEvent(`${p.C0.ESC}[${T?"":"?"}${ne};${se}$y`),!0;var ne,se}_updateAttrColor(I,T,A,R,j){return T===2?(I|=50331648,I&=-16777216,I|=x.AttributeData.fromColorRGB([A,R,j])):T===5&&(I&=-50331904,I|=33554432|255&A),I}_extractColor(I,T,A){const R=[0,0,-1,0,0,0];let j=0,P=0;do{if(R[P+j]=I.params[T+P],I.hasSubParams(T+P)){const U=I.getSubParams(T+P);let F=0;do R[1]===5&&(j=1),R[P+F+1+j]=U[F];while(++F<U.length&&F+P+1+j<R.length);break}if(R[1]===5&&P+j>=2||R[1]===2&&P+j>=5)break;R[1]&&(j=1)}while(++P+T<I.length&&P+j<R.length);for(let U=2;U<R.length;++U)R[U]===-1&&(R[U]=0);switch(R[0]){case 38:A.fg=this._updateAttrColor(A.fg,R[1],R[3],R[4],R[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,R[1],R[3],R[4],R[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,R[1],R[3],R[4],R[5])}return P}_processUnderline(I,T){T.extended=T.extended.clone(),(!~I||I>5)&&(I=1),T.extended.underlineStyle=I,T.fg|=268435456,I===0&&(T.fg&=-268435457),T.updateExtended()}_processSGR0(I){I.fg=m.DEFAULT_ATTR_DATA.fg,I.bg=m.DEFAULT_ATTR_DATA.bg,I.extended=I.extended.clone(),I.extended.underlineStyle=0,I.extended.underlineColor&=-67108864,I.updateExtended()}charAttributes(I){if(I.length===1&&I.params[0]===0)return this._processSGR0(this._curAttrData),!0;const T=I.length;let A;const R=this._curAttrData;for(let j=0;j<T;j++)A=I.params[j],A>=30&&A<=37?(R.fg&=-50331904,R.fg|=16777216|A-30):A>=40&&A<=47?(R.bg&=-50331904,R.bg|=16777216|A-40):A>=90&&A<=97?(R.fg&=-50331904,R.fg|=16777224|A-90):A>=100&&A<=107?(R.bg&=-50331904,R.bg|=16777224|A-100):A===0?this._processSGR0(R):A===1?R.fg|=134217728:A===3?R.bg|=67108864:A===4?(R.fg|=268435456,this._processUnderline(I.hasSubParams(j)?I.getSubParams(j)[0]:1,R)):A===5?R.fg|=536870912:A===7?R.fg|=67108864:A===8?R.fg|=1073741824:A===9?R.fg|=2147483648:A===2?R.bg|=134217728:A===21?this._processUnderline(2,R):A===22?(R.fg&=-134217729,R.bg&=-134217729):A===23?R.bg&=-67108865:A===24?(R.fg&=-268435457,this._processUnderline(0,R)):A===25?R.fg&=-536870913:A===27?R.fg&=-67108865:A===28?R.fg&=-1073741825:A===29?R.fg&=2147483647:A===39?(R.fg&=-67108864,R.fg|=16777215&m.DEFAULT_ATTR_DATA.fg):A===49?(R.bg&=-67108864,R.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?j+=this._extractColor(I,j,R):A===53?R.bg|=1073741824:A===55?R.bg&=-1073741825:A===59?(R.extended=R.extended.clone(),R.extended.underlineColor=-1,R.updateExtended()):A===100?(R.fg&=-67108864,R.fg|=16777215&m.DEFAULT_ATTR_DATA.fg,R.bg&=-67108864,R.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(I){switch(I.params[0]){case 5:this._coreService.triggerDataEvent(`${p.C0.ESC}[0n`);break;case 6:const T=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[${T};${A}R`)}return!0}deviceStatusPrivate(I){if(I.params[0]===6){const T=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[?${T};${A}R`)}return!0}softReset(I){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(I){const T=I.params[0]||1;switch(T){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const A=T%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(I){const T=I.params[0]||1;let A;return(I.length<2||(A=I.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>T&&(this._activeBuffer.scrollTop=T-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(I){if(!M(I.params[0],this._optionsService.rawOptions.windowOptions))return!0;const T=I.length>1?I.params[1]:0;switch(I.params[0]){case 14:T!==2&&this._onRequestWindowsOptionsReport.fire(O.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(O.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${p.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:T!==0&&T!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),T!==0&&T!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:T!==0&&T!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),T!==0&&T!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(I){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(I){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(I){return this._windowTitle=I,this._onTitleChange.fire(I),!0}setIconName(I){return this._iconName=I,!0}setOrReportIndexedColor(I){const T=[],A=I.split(";");for(;A.length>1;){const R=A.shift(),j=A.shift();if(/^\d+$/.exec(R)){const P=parseInt(R);if(J(P))if(j==="?")T.push({type:0,index:P});else{const U=(0,N.parseColor)(j);U&&T.push({type:1,index:P,color:U})}}}return T.length&&this._onColor.fire(T),!0}setHyperlink(I){const T=I.split(";");return!(T.length<2)&&(T[1]?this._createHyperlink(T[0],T[1]):!T[0]&&this._finishHyperlink())}_createHyperlink(I,T){this._getCurrentLinkId()&&this._finishHyperlink();const A=I.split(":");let R;const j=A.findIndex((P=>P.startsWith("id=")));return j!==-1&&(R=A[j].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:R,uri:T}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(I,T){const A=I.split(";");for(let R=0;R<A.length&&!(T>=this._specialColors.length);++R,++T)if(A[R]==="?")this._onColor.fire([{type:0,index:this._specialColors[T]}]);else{const j=(0,N.parseColor)(A[R]);j&&this._onColor.fire([{type:1,index:this._specialColors[T],color:j}])}return!0}setOrReportFgColor(I){return this._setOrReportSpecialColor(I,0)}setOrReportBgColor(I){return this._setOrReportSpecialColor(I,1)}setOrReportCursorColor(I){return this._setOrReportSpecialColor(I,2)}restoreIndexedColor(I){if(!I)return this._onColor.fire([{type:2}]),!0;const T=[],A=I.split(";");for(let R=0;R<A.length;++R)if(/^\d+$/.exec(A[R])){const j=parseInt(A[R]);J(j)&&T.push({type:2,index:j})}return T.length&&this._onColor.fire(T),!0}restoreFgColor(I){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(I){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(I){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),!0}selectCharset(I){return I.length!==2?(this.selectDefaultCharset(),!0):(I[0]==="/"||this._charsetService.setgCharset(L[I[0]],g.CHARSETS[I[1]]||g.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const I=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,I,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(I){return this._charsetService.setgLevel(I),!0}screenAlignmentPattern(){const I=new b.CellData;I.content=4194373,I.fg=this._curAttrData.fg,I.bg=this._curAttrData.bg,this._setCursor(0,0);for(let T=0;T<this._bufferService.rows;++T){const A=this._activeBuffer.ybase+this._activeBuffer.y+T,R=this._activeBuffer.lines.get(A);R&&(R.fill(I),R.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(I,T){const A=this._bufferService.buffer,R=this._optionsService.rawOptions;return(j=>(this._coreService.triggerDataEvent(`${p.C0.ESC}${j}${p.C0.ESC}\\`),!0))(I==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:I==='"p'?'P1$r61;1"p':I==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:I==="m"?"P1$r0m":I===" q"?`P1$r${{block:2,underline:4,bar:6}[R.cursorStyle]-(R.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(I,T){this._dirtyRowTracker.markRangeDirty(I,T)}}a.InputHandler=H;let V=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){ee<this.start?this.start=ee:ee>this.end&&(this.end=ee)}markRangeDirty(ee,I){ee>I&&(W=ee,ee=I,I=W),ee<this.start&&(this.start=ee),I>this.end&&(this.end=I)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function J(ee){return 0<=ee&&ee<256}V=d([u(0,C.IBufferService)],V)},844:(c,a)=>{function l(d){for(const u of d)u.dispose();d.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const d of this._disposables)d.dispose();this._disposables.length=0}register(d){return this._disposables.push(d),d}unregister(d){const u=this._disposables.indexOf(d);u!==-1&&this._disposables.splice(u,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(d){var u;this._isDisposed||d===this._value||((u=this._value)==null||u.dispose(),this._value=d)}clear(){this.value=void 0}dispose(){var d;this._isDisposed=!0,(d=this._value)==null||d.dispose(),this._value=void 0}},a.toDisposable=function(d){return{dispose:d}},a.disposeArray=l,a.getDisposeArrayDisposable=function(d){return{dispose:()=>l(d)}}},1505:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(u,p,g){this._data[u]||(this._data[u]={}),this._data[u][p]=g}get(u,p){return this._data[u]?this._data[u][p]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(d,u,p,g,y){this._data.get(d,u)||this._data.set(d,u,new l),this._data.get(d,u).set(p,g,y)}get(d,u,p,g){var y;return(y=this._data.get(d,u))==null?void 0:y.get(p,g)}clear(){this._data.clear()}}},6114:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,d=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const u=l.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),a.isIpad=d==="iPad",a.isIphone=d==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),a.isLinux=d.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(d){this._getKey=d,this._array=[]}clear(){this._array.length=0}insert(d){this._array.length!==0?(l=this._search(this._getKey(d)),this._array.splice(l,0,d)):this._array.push(d)}delete(d){if(this._array.length===0)return!1;const u=this._getKey(d);if(u===void 0||(l=this._search(u),l===-1)||this._getKey(this._array[l])!==u)return!1;do if(this._array[l]===d)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===u);return!1}*getKeyIterator(d){if(this._array.length!==0&&(l=this._search(d),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===d))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===d)}forEachByKey(d,u){if(this._array.length!==0&&(l=this._search(d),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===d))do u(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===d)}values(){return[...this._array].values()}_search(d){let u=0,p=this._array.length-1;for(;p>=u;){let g=u+p>>1;const y=this._getKey(this._array[g]);if(y>d)p=g-1;else{if(!(y<d)){for(;g>0&&this._getKey(this._array[g-1])===d;)g--;return g}u=g+1}}return u}}},7226:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const d=l(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(y){this._tasks.push(y),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(y){this._idleCallback=void 0;let S=0,v=0,m=y.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),v=Math.max(S,v),f=y.timeRemaining(),1.5*v>f)return m-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(m-S))}ms`),void this._start();m=f}this.clear()}}class p extends u{_requestCallback(y){return setTimeout((()=>y(this._createDeadline(16))))}_cancelCallback(y){clearTimeout(y)}_createDeadline(y){const S=Date.now()+y;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}a.PriorityTaskQueue=p,a.IdleTaskQueue=!d.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:p,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const d=l(643);a.updateWindowsModeWrappedState=function(u){const p=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),g=p==null?void 0:p.get(u.cols-1),y=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);y&&g&&(y.isWrapped=g[d.CHAR_DATA_CODE_INDEX]!==d.NULL_CELL_CODE&&g[d.CHAR_DATA_CODE_INDEX]!==d.WHITESPACE_CELL_CODE)}},3734:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new d}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){const p=new l;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}a.AttributeData=l;class d{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){const p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,g=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=g}clone(){return new d(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=d},9092:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const d=l(6349),u=l(7226),p=l(3734),g=l(8437),y=l(4634),S=l(511),v=l(643),m=l(4863),f=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(h,b,x){this._hasScrollback=h,this._optionsService=b,this._bufferService=x,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,v.WHITESPACE_CELL_CHAR,v.WHITESPACE_CELL_WIDTH,v.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new p.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new p.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,b){return new g.BufferLine(this._bufferService.cols,this.getNullCell(h),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;const b=h+this._optionsService.rawOptions.scrollback;return b>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:b}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=g.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(h))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(h,b){const x=this.getNullCell(g.DEFAULT_ATTR_DATA);let C=0;const _=this._getCorrectBufferLength(b);if(_>this.lines.maxLength&&(this.lines.maxLength=_),this.lines.length>0){if(this._cols<h)for(let k=0;k<this.lines.length;k++)C+=+this.lines.get(k).resize(h,x);let w=0;if(this._rows<b)for(let k=this._rows;k<b;k++)this.lines.length<b+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new g.BufferLine(h,x)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(h,x)));else for(let k=this._rows;k>b;k--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(_<this.lines.maxLength){const k=this.lines.length-_;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=_}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,b-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(h,b),this._cols>h))for(let w=0;w<this.lines.length;w++)C+=+this.lines.get(w).resize(h,x);this._cols=h,this._rows=b,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return h}get _isReflowEnabled(){const h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,b){this._cols!==h&&(h>this._cols?this._reflowLarger(h,b):this._reflowSmaller(h,b))}_reflowLarger(h,b){const x=(0,y.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(x.length>0){const C=(0,y.reflowLargerCreateNewLayout)(this.lines,x);(0,y.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(h,b,C.countRemoved)}}_reflowLargerAdjustViewport(h,b,x){const C=this.getNullCell(g.DEFAULT_ATTR_DATA);let _=x;for(;_-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new g.BufferLine(h,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-x,0)}_reflowSmaller(h,b){const x=this.getNullCell(g.DEFAULT_ATTR_DATA),C=[];let _=0;for(let w=this.lines.length-1;w>=0;w--){let k=this.lines.get(w);if(!k||!k.isWrapped&&k.getTrimmedLength()<=h)continue;const N=[k];for(;k.isWrapped&&w>0;)k=this.lines.get(--w),N.unshift(k);const L=this.ybase+this.y;if(L>=w&&L<w+N.length)continue;const $=N[N.length-1].getTrimmedLength(),M=(0,y.reflowSmallerGetNewLineLengths)(N,this._cols,h),O=M.length-N.length;let W;W=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+O):Math.max(0,this.lines.length-this.lines.maxLength+O);const H=[];for(let A=0;A<O;A++){const R=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);H.push(R)}H.length>0&&(C.push({start:w+N.length+_,newLines:H}),_+=H.length),N.push(...H);let V=M.length-1,J=M[V];J===0&&(V--,J=M[V]);let ee=N.length-O-1,I=$;for(;ee>=0;){const A=Math.min(I,J);if(N[V]===void 0)break;if(N[V].copyCellsFrom(N[ee],I-A,J-A,A,!0),J-=A,J===0&&(V--,J=M[V]),I-=A,I===0){ee--;const R=Math.max(ee,0);I=(0,y.getWrappedLineTrimmedLength)(N,R,this._cols)}}for(let A=0;A<N.length;A++)M[A]<h&&N[A].setCell(M[A],x);let T=O-W;for(;T-- >0;)this.ybase===0?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+_)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+O,this.ybase+b-1)}if(C.length>0){const w=[],k=[];for(let V=0;V<this.lines.length;V++)k.push(this.lines.get(V));const N=this.lines.length;let L=N-1,$=0,M=C[$];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+_);let O=0;for(let V=Math.min(this.lines.maxLength-1,N+_-1);V>=0;V--)if(M&&M.start>L+O){for(let J=M.newLines.length-1;J>=0;J--)this.lines.set(V--,M.newLines[J]);V++,w.push({index:L+1,amount:M.newLines.length}),O+=M.newLines.length,M=C[++$]}else this.lines.set(V,k[L--]);let W=0;for(let V=w.length-1;V>=0;V--)w[V].index+=W,this.lines.onInsertEmitter.fire(w[V]),W+=w[V].amount;const H=Math.max(0,N+_-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(h,b,x=0,C){const _=this.lines.get(h);return _?_.translateToString(b,x,C):""}getWrappedRangeForLine(h){let b=h,x=h;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;x+1<this.lines.length&&this.lines.get(x+1).isWrapped;)x++;return{first:b,last:x}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===h&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){const b=new m.Marker(h);return this.markers.push(b),b.register(this.lines.onTrim((x=>{b.line-=x,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((x=>{b.line>=x.index&&(b.line+=x.amount)}))),b.register(this.lines.onDelete((x=>{b.line>=x.index&&b.line<x.index+x.amount&&b.dispose(),b.line>x.index&&(b.line-=x.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const d=l(3734),u=l(511),p=l(643),g=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new d.AttributeData);let y=0;class S{constructor(m,f,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);const b=f||u.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]);for(let x=0;x<m;++x)this.setCell(x,b);this.length=m}get(m){const f=this._data[3*m+0],h=2097151&f;return[this._data[3*m+1],2097152&f?this._combined[m]:h?(0,g.stringFromCodePoint)(h):"",f>>22,2097152&f?this._combined[m].charCodeAt(this._combined[m].length-1):h]}set(m,f){this._data[3*m+1]=f[p.CHAR_DATA_ATTR_INDEX],f[p.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=f[1],this._data[3*m+0]=2097152|m|f[p.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=f[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[p.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(m){return this._data[3*m+0]>>22}hasWidth(m){return 12582912&this._data[3*m+0]}getFg(m){return this._data[3*m+1]}getBg(m){return this._data[3*m+2]}hasContent(m){return 4194303&this._data[3*m+0]}getCodePoint(m){const f=this._data[3*m+0];return 2097152&f?this._combined[m].charCodeAt(this._combined[m].length-1):2097151&f}isCombined(m){return 2097152&this._data[3*m+0]}getString(m){const f=this._data[3*m+0];return 2097152&f?this._combined[m]:2097151&f?(0,g.stringFromCodePoint)(2097151&f):""}isProtected(m){return 536870912&this._data[3*m+2]}loadCell(m,f){return y=3*m,f.content=this._data[y+0],f.fg=this._data[y+1],f.bg=this._data[y+2],2097152&f.content&&(f.combinedData=this._combined[m]),268435456&f.bg&&(f.extended=this._extendedAttrs[m]),f}setCell(m,f){2097152&f.content&&(this._combined[m]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[m]=f.extended),this._data[3*m+0]=f.content,this._data[3*m+1]=f.fg,this._data[3*m+2]=f.bg}setCellFromCodepoint(m,f,h,b){268435456&b.bg&&(this._extendedAttrs[m]=b.extended),this._data[3*m+0]=f|h<<22,this._data[3*m+1]=b.fg,this._data[3*m+2]=b.bg}addCodepointToCell(m,f,h){let b=this._data[3*m+0];2097152&b?this._combined[m]+=(0,g.stringFromCodePoint)(f):2097151&b?(this._combined[m]=(0,g.stringFromCodePoint)(2097151&b)+(0,g.stringFromCodePoint)(f),b&=-2097152,b|=2097152):b=f|4194304,h&&(b&=-12582913,b|=h<<22),this._data[3*m+0]=b}insertCells(m,f,h){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,h),f<this.length-m){const b=new u.CellData;for(let x=this.length-m-f-1;x>=0;--x)this.setCell(m+f+x,this.loadCell(m+x,b));for(let x=0;x<f;++x)this.setCell(m+x,h)}else for(let b=m;b<this.length;++b)this.setCell(b,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(m,f,h){if(m%=this.length,f<this.length-m){const b=new u.CellData;for(let x=0;x<this.length-m-f;++x)this.setCell(m+x,this.loadCell(m+f+x,b));for(let x=this.length-f;x<this.length;++x)this.setCell(x,h)}else for(let b=m;b<this.length;++b)this.setCell(b,h);m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,h),this.getWidth(m)!==0||this.hasContent(m)||this.setCellFromCodepoint(m,0,1,h)}replaceCells(m,f,h,b=!1){if(b)for(m&&this.getWidth(m-1)===2&&!this.isProtected(m-1)&&this.setCellFromCodepoint(m-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,h);m<f&&m<this.length;)this.isProtected(m)||this.setCell(m,h),m++;else for(m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,h);m<f&&m<this.length;)this.setCell(m++,h)}resize(m,f){if(m===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const h=3*m;if(m>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{const b=new Uint32Array(h);b.set(this._data),this._data=b}for(let b=this.length;b<m;++b)this.setCell(b,f)}else{this._data=this._data.subarray(0,h);const b=Object.keys(this._combined);for(let C=0;C<b.length;C++){const _=parseInt(b[C],10);_>=m&&delete this._combined[_]}const x=Object.keys(this._extendedAttrs);for(let C=0;C<x.length;C++){const _=parseInt(x[C],10);_>=m&&delete this._extendedAttrs[_]}}return this.length=m,4*h*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const m=new Uint32Array(this._data.length);return m.set(this._data),this._data=m,1}return 0}fill(m,f=!1){if(f)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,m);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,m)}}copyFrom(m){this.length!==m.length?this._data=new Uint32Array(m._data):this._data.set(m._data),this.length=m.length,this._combined={};for(const f in m._combined)this._combined[f]=m._combined[f];this._extendedAttrs={};for(const f in m._extendedAttrs)this._extendedAttrs[f]=m._extendedAttrs[f];this.isWrapped=m.isWrapped}clone(){const m=new S(0);m._data=new Uint32Array(this._data),m.length=this.length;for(const f in this._combined)m._combined[f]=this._combined[f];for(const f in this._extendedAttrs)m._extendedAttrs[f]=this._extendedAttrs[f];return m.isWrapped=this.isWrapped,m}getTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0])return m+(this._data[3*m+0]>>22);return 0}getNoBgTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0]||50331648&this._data[3*m+2])return m+(this._data[3*m+0]>>22);return 0}copyCellsFrom(m,f,h,b,x){const C=m._data;if(x)for(let w=b-1;w>=0;w--){for(let k=0;k<3;k++)this._data[3*(h+w)+k]=C[3*(f+w)+k];268435456&C[3*(f+w)+2]&&(this._extendedAttrs[h+w]=m._extendedAttrs[f+w])}else for(let w=0;w<b;w++){for(let k=0;k<3;k++)this._data[3*(h+w)+k]=C[3*(f+w)+k];268435456&C[3*(f+w)+2]&&(this._extendedAttrs[h+w]=m._extendedAttrs[f+w])}const _=Object.keys(m._combined);for(let w=0;w<_.length;w++){const k=parseInt(_[w],10);k>=f&&(this._combined[k-f+h]=m._combined[k])}}translateToString(m,f,h,b){f=f??0,h=h??this.length,m&&(h=Math.min(h,this.getTrimmedLength())),b&&(b.length=0);let x="";for(;f<h;){const C=this._data[3*f+0],_=2097151&C,w=2097152&C?this._combined[f]:_?(0,g.stringFromCodePoint)(_):p.WHITESPACE_CELL_CHAR;if(x+=w,b)for(let k=0;k<w.length;++k)b.push(f);f+=C>>22||1}return b&&b.push(f),x}}a.BufferLine=S},4841:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,d){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return d*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(c,a)=>{function l(d,u,p){if(u===d.length-1)return d[u].getTrimmedLength();const g=!d[u].hasContent(p-1)&&d[u].getWidth(p-1)===1,y=d[u+1].getWidth(0)===2;return g&&y?p-1:p}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(d,u,p,g,y){const S=[];for(let v=0;v<d.length-1;v++){let m=v,f=d.get(++m);if(!f.isWrapped)continue;const h=[d.get(v)];for(;m<d.length&&f.isWrapped;)h.push(f),f=d.get(++m);if(g>=v&&g<m){v+=h.length-1;continue}let b=0,x=l(h,b,u),C=1,_=0;for(;C<h.length;){const k=l(h,C,u),N=k-_,L=p-x,$=Math.min(N,L);h[b].copyCellsFrom(h[C],_,x,$,!1),x+=$,x===p&&(b++,x=0),_+=$,_===k&&(C++,_=0),x===0&&b!==0&&h[b-1].getWidth(p-1)===2&&(h[b].copyCellsFrom(h[b-1],p-1,x++,1,!1),h[b-1].setCell(p-1,y))}h[b].replaceCells(x,p,y);let w=0;for(let k=h.length-1;k>0&&(k>b||h[k].getTrimmedLength()===0);k--)w++;w>0&&(S.push(v+h.length-w),S.push(w)),v+=h.length-1}return S},a.reflowLargerCreateNewLayout=function(d,u){const p=[];let g=0,y=u[g],S=0;for(let v=0;v<d.length;v++)if(y===v){const m=u[++g];d.onDeleteEmitter.fire({index:v-S,amount:m}),v+=m-1,S+=m,y=u[++g]}else p.push(v);return{layout:p,countRemoved:S}},a.reflowLargerApplyNewLayout=function(d,u){const p=[];for(let g=0;g<u.length;g++)p.push(d.get(u[g]));for(let g=0;g<p.length;g++)d.set(g,p[g]);d.length=u.length},a.reflowSmallerGetNewLineLengths=function(d,u,p){const g=[],y=d.map(((f,h)=>l(d,h,u))).reduce(((f,h)=>f+h));let S=0,v=0,m=0;for(;m<y;){if(y-m<p){g.push(y-m);break}S+=p;const f=l(d,v,u);S>f&&(S-=f,v++);const h=d[v].getWidth(S-1)===2;h&&S--;const b=h?p-1:p;g.push(b),m+=b}return g},a.getWrappedLineTrimmedLength=l},5295:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const d=l(8460),u=l(844),p=l(9092);class g extends u.Disposable{constructor(S,v){super(),this._optionsService=S,this._bufferService=v,this._onBufferActivate=this.register(new d.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(S,v){this._normal.resize(S,v),this._alt.resize(S,v),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}a.BufferSet=g},511:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const d=l(482),u=l(643),p=l(3734);class g extends p.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new p.ExtendedAttrs,this.combinedData=""}static fromCharData(S){const v=new g;return v.setFromCharData(S),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,d.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(S[u.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(S[u.CHAR_DATA_CHAR_INDEX].length===2){const m=S[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=m&&m<=56319){const f=S[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(m-55296)+f-56320+65536|S[u.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=S[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[u.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=S[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=g},643:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const d=l(8460),u=l(844);class p{get id(){return this._id}constructor(y){this.line=y,this.isDisposed=!1,this._disposables=[],this._id=p._nextId++,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,u.disposeArray)(this._disposables),this._disposables.length=0)}register(y){return this._disposables.push(y),y}}a.Marker=p,p._nextId=1},7116:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,a)=>{var l,d,u;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(p){p.NUL="\0",p.SOH="",p.STX="",p.ETX="",p.EOT="",p.ENQ="",p.ACK="",p.BEL="\x07",p.BS="\b",p.HT=" ",p.LF=`
640
640
  `,p.VT="\v",p.FF="\f",p.CR="\r",p.SO="",p.SI="",p.DLE="",p.DC1="",p.DC2="",p.DC3="",p.DC4="",p.NAK="",p.SYN="",p.ETB="",p.CAN="",p.EM="",p.SUB="",p.ESC="\x1B",p.FS="",p.GS="",p.RS="",p.US="",p.SP=" ",p.DEL=""})(l||(a.C0=l={})),(function(p){p.PAD="€",p.HOP="",p.BPH="‚",p.NBH="ƒ",p.IND="„",p.NEL="…",p.SSA="†",p.ESA="‡",p.HTS="ˆ",p.HTJ="‰",p.VTS="Š",p.PLD="‹",p.PLU="Œ",p.RI="",p.SS2="Ž",p.SS3="",p.DCS="",p.PU1="‘",p.PU2="’",p.STS="“",p.CCH="”",p.MW="•",p.SPA="–",p.EPA="—",p.SOS="˜",p.SGCI="™",p.SCI="š",p.CSI="›",p.ST="œ",p.OSC="",p.PM="ž",p.APC="Ÿ"})(d||(a.C1=d={})),(function(p){p.ST=`${l.ESC}\\`})(u||(a.C1_ESCAPED=u={}))},7399:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const d=l(2584),u={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};a.evaluateKeyboardEvent=function(p,g,y,S){const v={type:0,cancel:!1,key:void 0},m=(p.shiftKey?1:0)|(p.altKey?2:0)|(p.ctrlKey?4:0)|(p.metaKey?8:0);switch(p.keyCode){case 0:p.key==="UIKeyInputUpArrow"?v.key=g?d.C0.ESC+"OA":d.C0.ESC+"[A":p.key==="UIKeyInputLeftArrow"?v.key=g?d.C0.ESC+"OD":d.C0.ESC+"[D":p.key==="UIKeyInputRightArrow"?v.key=g?d.C0.ESC+"OC":d.C0.ESC+"[C":p.key==="UIKeyInputDownArrow"&&(v.key=g?d.C0.ESC+"OB":d.C0.ESC+"[B");break;case 8:v.key=p.ctrlKey?"\b":d.C0.DEL,p.altKey&&(v.key=d.C0.ESC+v.key);break;case 9:if(p.shiftKey){v.key=d.C0.ESC+"[Z";break}v.key=d.C0.HT,v.cancel=!0;break;case 13:v.key=p.altKey?d.C0.ESC+d.C0.CR:d.C0.CR,v.cancel=!0;break;case 27:v.key=d.C0.ESC,p.altKey&&(v.key=d.C0.ESC+d.C0.ESC),v.cancel=!0;break;case 37:if(p.metaKey)break;m?(v.key=d.C0.ESC+"[1;"+(m+1)+"D",v.key===d.C0.ESC+"[1;3D"&&(v.key=d.C0.ESC+(y?"b":"[1;5D"))):v.key=g?d.C0.ESC+"OD":d.C0.ESC+"[D";break;case 39:if(p.metaKey)break;m?(v.key=d.C0.ESC+"[1;"+(m+1)+"C",v.key===d.C0.ESC+"[1;3C"&&(v.key=d.C0.ESC+(y?"f":"[1;5C"))):v.key=g?d.C0.ESC+"OC":d.C0.ESC+"[C";break;case 38:if(p.metaKey)break;m?(v.key=d.C0.ESC+"[1;"+(m+1)+"A",y||v.key!==d.C0.ESC+"[1;3A"||(v.key=d.C0.ESC+"[1;5A")):v.key=g?d.C0.ESC+"OA":d.C0.ESC+"[A";break;case 40:if(p.metaKey)break;m?(v.key=d.C0.ESC+"[1;"+(m+1)+"B",y||v.key!==d.C0.ESC+"[1;3B"||(v.key=d.C0.ESC+"[1;5B")):v.key=g?d.C0.ESC+"OB":d.C0.ESC+"[B";break;case 45:p.shiftKey||p.ctrlKey||(v.key=d.C0.ESC+"[2~");break;case 46:v.key=m?d.C0.ESC+"[3;"+(m+1)+"~":d.C0.ESC+"[3~";break;case 36:v.key=m?d.C0.ESC+"[1;"+(m+1)+"H":g?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:v.key=m?d.C0.ESC+"[1;"+(m+1)+"F":g?d.C0.ESC+"OF":d.C0.ESC+"[F";break;case 33:p.shiftKey?v.type=2:p.ctrlKey?v.key=d.C0.ESC+"[5;"+(m+1)+"~":v.key=d.C0.ESC+"[5~";break;case 34:p.shiftKey?v.type=3:p.ctrlKey?v.key=d.C0.ESC+"[6;"+(m+1)+"~":v.key=d.C0.ESC+"[6~";break;case 112:v.key=m?d.C0.ESC+"[1;"+(m+1)+"P":d.C0.ESC+"OP";break;case 113:v.key=m?d.C0.ESC+"[1;"+(m+1)+"Q":d.C0.ESC+"OQ";break;case 114:v.key=m?d.C0.ESC+"[1;"+(m+1)+"R":d.C0.ESC+"OR";break;case 115:v.key=m?d.C0.ESC+"[1;"+(m+1)+"S":d.C0.ESC+"OS";break;case 116:v.key=m?d.C0.ESC+"[15;"+(m+1)+"~":d.C0.ESC+"[15~";break;case 117:v.key=m?d.C0.ESC+"[17;"+(m+1)+"~":d.C0.ESC+"[17~";break;case 118:v.key=m?d.C0.ESC+"[18;"+(m+1)+"~":d.C0.ESC+"[18~";break;case 119:v.key=m?d.C0.ESC+"[19;"+(m+1)+"~":d.C0.ESC+"[19~";break;case 120:v.key=m?d.C0.ESC+"[20;"+(m+1)+"~":d.C0.ESC+"[20~";break;case 121:v.key=m?d.C0.ESC+"[21;"+(m+1)+"~":d.C0.ESC+"[21~";break;case 122:v.key=m?d.C0.ESC+"[23;"+(m+1)+"~":d.C0.ESC+"[23~";break;case 123:v.key=m?d.C0.ESC+"[24;"+(m+1)+"~":d.C0.ESC+"[24~";break;default:if(!p.ctrlKey||p.shiftKey||p.altKey||p.metaKey)if(y&&!S||!p.altKey||p.metaKey)!y||p.altKey||p.ctrlKey||p.shiftKey||!p.metaKey?p.key&&!p.ctrlKey&&!p.altKey&&!p.metaKey&&p.keyCode>=48&&p.key.length===1?v.key=p.key:p.key&&p.ctrlKey&&(p.key==="_"&&(v.key=d.C0.US),p.key==="@"&&(v.key=d.C0.NUL)):p.keyCode===65&&(v.type=1);else{const f=u[p.keyCode],h=f==null?void 0:f[p.shiftKey?1:0];if(h)v.key=d.C0.ESC+h;else if(p.keyCode>=65&&p.keyCode<=90){const b=p.ctrlKey?p.keyCode-64:p.keyCode+32;let x=String.fromCharCode(b);p.shiftKey&&(x=x.toUpperCase()),v.key=d.C0.ESC+x}else if(p.keyCode===32)v.key=d.C0.ESC+(p.ctrlKey?d.C0.NUL:" ");else if(p.key==="Dead"&&p.code.startsWith("Key")){let b=p.code.slice(3,4);p.shiftKey||(b=b.toLowerCase()),v.key=d.C0.ESC+b,v.cancel=!0}}else p.keyCode>=65&&p.keyCode<=90?v.key=String.fromCharCode(p.keyCode-64):p.keyCode===32?v.key=d.C0.NUL:p.keyCode>=51&&p.keyCode<=55?v.key=String.fromCharCode(p.keyCode-51+27):p.keyCode===56?v.key=d.C0.DEL:p.keyCode===219?v.key=d.C0.ESC:p.keyCode===220?v.key=d.C0.FS:p.keyCode===221&&(v.key=d.C0.GS)}return v}},482:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,d=0,u=l.length){let p="";for(let g=d;g<u;++g){let y=l[g];y>65535?(y-=65536,p+=String.fromCharCode(55296+(y>>10))+String.fromCharCode(y%1024+56320)):p+=String.fromCharCode(y)}return p},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,d){const u=l.length;if(!u)return 0;let p=0,g=0;if(this._interim){const y=l.charCodeAt(g++);56320<=y&&y<=57343?d[p++]=1024*(this._interim-55296)+y-56320+65536:(d[p++]=this._interim,d[p++]=y),this._interim=0}for(let y=g;y<u;++y){const S=l.charCodeAt(y);if(55296<=S&&S<=56319){if(++y>=u)return this._interim=S,p;const v=l.charCodeAt(y);56320<=v&&v<=57343?d[p++]=1024*(S-55296)+v-56320+65536:(d[p++]=S,d[p++]=v)}else S!==65279&&(d[p++]=S)}return p}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,d){const u=l.length;if(!u)return 0;let p,g,y,S,v=0,m=0,f=0;if(this.interim[0]){let x=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let _,w=0;for(;(_=63&this.interim[++w])&&w<4;)C<<=6,C|=_;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,N=k-w;for(;f<N;){if(f>=u)return 0;if(_=l[f++],(192&_)!=128){f--,x=!0;break}this.interim[w++]=_,C<<=6,C|=63&_}x||(k===2?C<128?f--:d[v++]=C:k===3?C<2048||C>=55296&&C<=57343||C===65279||(d[v++]=C):C<65536||C>1114111||(d[v++]=C)),this.interim.fill(0)}const h=u-4;let b=f;for(;b<u;){for(;!(!(b<h)||128&(p=l[b])||128&(g=l[b+1])||128&(y=l[b+2])||128&(S=l[b+3]));)d[v++]=p,d[v++]=g,d[v++]=y,d[v++]=S,b+=4;if(p=l[b++],p<128)d[v++]=p;else if((224&p)==192){if(b>=u)return this.interim[0]=p,v;if(g=l[b++],(192&g)!=128){b--;continue}if(m=(31&p)<<6|63&g,m<128){b--;continue}d[v++]=m}else if((240&p)==224){if(b>=u)return this.interim[0]=p,v;if(g=l[b++],(192&g)!=128){b--;continue}if(b>=u)return this.interim[0]=p,this.interim[1]=g,v;if(y=l[b++],(192&y)!=128){b--;continue}if(m=(15&p)<<12|(63&g)<<6|63&y,m<2048||m>=55296&&m<=57343||m===65279)continue;d[v++]=m}else if((248&p)==240){if(b>=u)return this.interim[0]=p,v;if(g=l[b++],(192&g)!=128){b--;continue}if(b>=u)return this.interim[0]=p,this.interim[1]=g,v;if(y=l[b++],(192&y)!=128){b--;continue}if(b>=u)return this.interim[0]=p,this.interim[1]=g,this.interim[2]=y,v;if(S=l[b++],(192&S)!=128){b--;continue}if(m=(7&p)<<18|(63&g)<<12|(63&y)<<6|63&S,m<65536||m>1114111)continue;d[v++]=m}}return v}}},225:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const d=l(1480),u=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],p=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let g;a.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let y=0;y<u.length;++y)g.fill(0,u[y][0],u[y][1]+1)}}wcwidth(y){return y<32?0:y<127?1:y<65536?g[y]:(function(S,v){let m,f=0,h=v.length-1;if(S<v[0][0]||S>v[h][1])return!1;for(;h>=f;)if(m=f+h>>1,S>v[m][1])f=m+1;else{if(!(S<v[m][0]))return!0;h=m-1}return!1})(y,p)?0:y>=131072&&y<=196605||y>=196608&&y<=262141?2:1}charProperties(y,S){let v=this.wcwidth(y),m=v===0&&S!==0;if(m){const f=d.UnicodeService.extractWidth(S);f===0?m=!1:f>v&&(v=f)}return d.UnicodeService.createPropertyValue(0,v,m)}}},5981:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const d=l(8460),u=l(844);class p extends u.Disposable{constructor(y){super(),this._action=y,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(y,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);const m=this._callbacks.shift();m&&m()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(y,S){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(S)}_innerWrite(y=0,S=!0){const v=y||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const m=this._writeBuffer[this._bufferOffset],f=this._action(m,S);if(f){const b=x=>Date.now()-v>=12?setTimeout((()=>this._innerWrite(0,x))):this._innerWrite(v,x);return void f.catch((x=>(queueMicrotask((()=>{throw x})),Promise.resolve(!1)))).then(b)}const h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=m.length,Date.now()-v>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}a.WriteBuffer=p},5941:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,d=/^[\da-f]+$/;function u(p,g){const y=p.toString(16),S=y.length<2?"0"+y:y;switch(g){case 4:return y[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}a.parseColor=function(p){if(!p)return;let g=p.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const y=l.exec(g);if(y){const S=y[1]?15:y[4]?255:y[7]?4095:65535;return[Math.round(parseInt(y[1]||y[4]||y[7]||y[10],16)/S*255),Math.round(parseInt(y[2]||y[5]||y[8]||y[11],16)/S*255),Math.round(parseInt(y[3]||y[6]||y[9]||y[12],16)/S*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),d.exec(g)&&[3,6,9,12].includes(g.length))){const y=g.length/3,S=[0,0,0];for(let v=0;v<3;++v){const m=parseInt(g.slice(y*v,y*v+y),16);S[v]=y===1?m<<4:y===2?m:y===3?m>>4:m>>8}return S}},a.toRgbString=function(p,g=16){const[y,S,v]=p;return`rgb:${u(y,g)}/${u(S,g)}/${u(v,g)}`}},5770:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const d=l(482),u=l(8742),p=l(5770),g=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(S,v){this._handlers[S]===void 0&&(this._handlers[S]=[]);const m=this._handlers[S];return m.push(v),{dispose:()=>{const f=m.indexOf(v);f!==-1&&m.splice(f,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(S,v){if(this.reset(),this._ident=S,this._active=this._handlers[S]||g,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].hook(v);else this._handlerFb(this._ident,"HOOK",v)}put(S,v,m){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(S,v,m);else this._handlerFb(this._ident,"PUT",(0,d.utf32ToString)(S,v,m))}unhook(S,v=!0){if(this._active.length){let m=!1,f=this._active.length-1,h=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,m=v,h=this._stack.fallThrough,this._stack.paused=!1),!h&&m===!1){for(;f>=0&&(m=this._active[f].unhook(S),m!==!0);f--)if(m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,m;f--}for(;f>=0;f--)if(m=this._active[f].unhook(!1),m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,m}else this._handlerFb(this._ident,"UNHOOK",S);this._active=g,this._ident=0}};const y=new u.Params;y.addParam(0),a.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=y,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():y,this._data="",this._hitLimit=!1}put(S,v,m){this._hitLimit||(this._data+=(0,d.utf32ToString)(S,v,m),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let v=!1;if(this._hitLimit)v=!1;else if(S&&(v=this._handler(this._data,this._params),v instanceof Promise))return v.then((m=>(this._params=y,this._data="",this._hitLimit=!1,m)));return this._params=y,this._data="",this._hitLimit=!1,v}}},2015:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const d=l(844),u=l(8742),p=l(6242),g=l(6351);class y{constructor(f){this.table=new Uint8Array(f)}setDefault(f,h){this.table.fill(f<<4|h)}add(f,h,b,x){this.table[h<<8|f]=b<<4|x}addMany(f,h,b,x){for(let C=0;C<f.length;C++)this.table[h<<8|f[C]]=b<<4|x}}a.TransitionTable=y;const S=160;a.VT500_TRANSITION_TABLE=(function(){const m=new y(4095),f=Array.apply(null,Array(256)).map(((w,k)=>k)),h=(w,k)=>f.slice(w,k),b=h(32,127),x=h(0,24);x.push(25),x.push.apply(x,h(28,32));const C=h(0,14);let _;for(_ in m.setDefault(1,0),m.addMany(b,0,2,0),C)m.addMany([24,26,153,154],_,3,0),m.addMany(h(128,144),_,3,0),m.addMany(h(144,152),_,3,0),m.add(156,_,0,0),m.add(27,_,11,1),m.add(157,_,4,8),m.addMany([152,158,159],_,0,7),m.add(155,_,11,3),m.add(144,_,11,9);return m.addMany(x,0,3,0),m.addMany(x,1,3,1),m.add(127,1,0,1),m.addMany(x,8,0,8),m.addMany(x,3,3,3),m.add(127,3,0,3),m.addMany(x,4,3,4),m.add(127,4,0,4),m.addMany(x,6,3,6),m.addMany(x,5,3,5),m.add(127,5,0,5),m.addMany(x,2,3,2),m.add(127,2,0,2),m.add(93,1,4,8),m.addMany(b,8,5,8),m.add(127,8,5,8),m.addMany([156,27,24,26,7],8,6,0),m.addMany(h(28,32),8,0,8),m.addMany([88,94,95],1,0,7),m.addMany(b,7,0,7),m.addMany(x,7,0,7),m.add(156,7,0,0),m.add(127,7,0,7),m.add(91,1,11,3),m.addMany(h(64,127),3,7,0),m.addMany(h(48,60),3,8,4),m.addMany([60,61,62,63],3,9,4),m.addMany(h(48,60),4,8,4),m.addMany(h(64,127),4,7,0),m.addMany([60,61,62,63],4,0,6),m.addMany(h(32,64),6,0,6),m.add(127,6,0,6),m.addMany(h(64,127),6,0,0),m.addMany(h(32,48),3,9,5),m.addMany(h(32,48),5,9,5),m.addMany(h(48,64),5,0,6),m.addMany(h(64,127),5,7,0),m.addMany(h(32,48),4,9,5),m.addMany(h(32,48),1,9,2),m.addMany(h(32,48),2,9,2),m.addMany(h(48,127),2,10,0),m.addMany(h(48,80),1,10,0),m.addMany(h(81,88),1,10,0),m.addMany([89,90,92],1,10,0),m.addMany(h(96,127),1,10,0),m.add(80,1,11,9),m.addMany(x,9,0,9),m.add(127,9,0,9),m.addMany(h(28,32),9,0,9),m.addMany(h(32,48),9,9,12),m.addMany(h(48,60),9,8,10),m.addMany([60,61,62,63],9,9,10),m.addMany(x,11,0,11),m.addMany(h(32,128),11,0,11),m.addMany(h(28,32),11,0,11),m.addMany(x,10,0,10),m.add(127,10,0,10),m.addMany(h(28,32),10,0,10),m.addMany(h(48,60),10,8,10),m.addMany([60,61,62,63],10,0,11),m.addMany(h(32,48),10,9,12),m.addMany(x,12,0,12),m.add(127,12,0,12),m.addMany(h(28,32),12,0,12),m.addMany(h(32,48),12,9,12),m.addMany(h(48,64),12,0,11),m.addMany(h(64,127),12,12,13),m.addMany(h(64,127),10,12,13),m.addMany(h(64,127),9,12,13),m.addMany(x,13,13,13),m.addMany(b,13,13,13),m.add(127,13,0,13),m.addMany([27,156,24,26],13,14,0),m.add(S,0,2,0),m.add(S,8,5,8),m.add(S,6,0,6),m.add(S,11,0,11),m.add(S,13,13,13),m})();class v extends d.Disposable{constructor(f=a.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,b,x)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,b)=>{},this._escHandlerFb=h=>{},this._errorHandlerFb=h=>h,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,d.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new p.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,h=[64,126]){let b=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=f.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<f.intermediates.length;++C){const _=f.intermediates.charCodeAt(C);if(32>_||_>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=_}}if(f.final.length!==1)throw new Error("final must be a single byte");const x=f.final.charCodeAt(0);if(h[0]>x||x>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return b<<=8,b|=x,b}identToString(f){const h=[];for(;f;)h.push(String.fromCharCode(255&f)),f>>=8;return h.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,h){const b=this._identifier(f,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const x=this._escHandlers[b];return x.push(h),{dispose:()=>{const C=x.indexOf(h);C!==-1&&x.splice(C,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,h){this._executeHandlers[f.charCodeAt(0)]=h}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,h){const b=this._identifier(f);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const x=this._csiHandlers[b];return x.push(h),{dispose:()=>{const C=x.indexOf(h);C!==-1&&x.splice(C,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,h){return this._dcsParser.registerHandler(this._identifier(f),h)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,h){return this._oscParser.registerHandler(f,h)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(f,h,b,x,C){this._parseStack.state=f,this._parseStack.handlers=h,this._parseStack.handlerPos=b,this._parseStack.transition=x,this._parseStack.chunkPos=C}parse(f,h,b){let x,C=0,_=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const k=this._parseStack.handlers;let N=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&N>-1){for(;N>=0&&(x=k[N](this._params),x!==!0);N--)if(x instanceof Promise)return this._parseStack.handlerPos=N,x}this._parseStack.handlers=[];break;case 4:if(b===!1&&N>-1){for(;N>=0&&(x=k[N](),x!==!0);N--)if(x instanceof Promise)return this._parseStack.handlerPos=N,x}this._parseStack.handlers=[];break;case 6:if(C=f[this._parseStack.chunkPos],x=this._dcsParser.unhook(C!==24&&C!==26,b),x)return x;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=f[this._parseStack.chunkPos],x=this._oscParser.end(C!==24&&C!==26,b),x)return x;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=w;k<h;++k){switch(C=f[k],_=this._transitions.table[this.currentState<<8|(C<160?C:S)],_>>4){case 2:for(let O=k+1;;++O){if(O>=h||(C=f[O])<32||C>126&&C<S){this._printHandler(f,k,O),k=O-1;break}if(++O>=h||(C=f[O])<32||C>126&&C<S){this._printHandler(f,k,O),k=O-1;break}if(++O>=h||(C=f[O])<32||C>126&&C<S){this._printHandler(f,k,O),k=O-1;break}if(++O>=h||(C=f[O])<32||C>126&&C<S){this._printHandler(f,k,O),k=O-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const N=this._csiHandlers[this._collect<<8|C];let L=N?N.length-1:-1;for(;L>=0&&(x=N[L](this._params),x!==!0);L--)if(x instanceof Promise)return this._preserveStack(3,N,L,_,k),x;L<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++k<h&&(C=f[k])>47&&C<60);k--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const $=this._escHandlers[this._collect<<8|C];let M=$?$.length-1:-1;for(;M>=0&&(x=$[M](),x!==!0);M--)if(x instanceof Promise)return this._preserveStack(4,$,M,_,k),x;M<0&&this._escHandlerFb(this._collect<<8|C),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|C,this._params);break;case 13:for(let O=k+1;;++O)if(O>=h||(C=f[O])===24||C===26||C===27||C>127&&C<S){this._dcsParser.put(f,k,O),k=O-1;break}break;case 14:if(x=this._dcsParser.unhook(C!==24&&C!==26),x)return this._preserveStack(6,[],0,_,k),x;C===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let O=k+1;;O++)if(O>=h||(C=f[O])<32||C>127&&C<S){this._oscParser.put(f,k,O),k=O-1;break}break;case 6:if(x=this._oscParser.end(C!==24&&C!==26),x)return this._preserveStack(5,[],0,_,k),x;C===27&&(_|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&_}}}a.EscapeSequenceParser=v},6242:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const d=l(5770),u=l(482),p=[];a.OscParser=class{constructor(){this._state=0,this._active=p,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,y){this._handlers[g]===void 0&&(this._handlers[g]=[]);const S=this._handlers[g];return S.push(y),{dispose:()=>{const v=S.indexOf(y);v!==-1&&S.splice(v,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=p,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||p,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,y,S){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(g,y,S);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(g,y,S))}start(){this.reset(),this._state=1}put(g,y,S){if(this._state!==3){if(this._state===1)for(;y<S;){const v=g[y++];if(v===59){this._state=2,this._start();break}if(v<48||57<v)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+v-48}this._state===2&&S-y>0&&this._put(g,y,S)}}end(g,y=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,v=this._active.length-1,m=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,S=y,m=this._stack.fallThrough,this._stack.paused=!1),!m&&S===!1){for(;v>=0&&(S=this._active[v].end(g),S!==!0);v--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,S;v--}for(;v>=0;v--)if(S=this._active[v].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",g);this._active=p,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,y,S){this._hitLimit||(this._data+=(0,u.utf32ToString)(g,y,S),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let y=!1;if(this._hitLimit)y=!1;else if(g&&(y=this._handler(this._data),y instanceof Promise))return y.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,y}}},8742:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class d{static fromArray(p){const g=new d;if(!p.length)return g;for(let y=Array.isArray(p[0])?1:0;y<p.length;++y){const S=p[y];if(Array.isArray(S))for(let v=0;v<S.length;++v)g.addSubParam(S[v]);else g.addParam(S)}return g}constructor(p=32,g=32){if(this.maxLength=p,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const p=new d(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){const p=[];for(let g=0;g<this.length;++g){p.push(this.params[g]);const y=this._subParamsIdx[g]>>8,S=255&this._subParamsIdx[g];S-y>0&&p.push(Array.prototype.slice.call(this._subParams,y,S))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>l?l:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>l?l:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){const g=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];return y-g>0?this._subParams.subarray(g,y):null}getSubParamsAll(){const p={};for(let g=0;g<this.length;++g){const y=this._subParamsIdx[g]>>8,S=255&this._subParamsIdx[g];S-y>0&&(p[g]=this._subParams.slice(y,S))}return p}addDigit(p){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const y=this._digitIsSub?this._subParams:this.params,S=y[g-1];y[g-1]=~S?Math.min(10*S+p,l):p}}a.Params=d},5741:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,d){const u={instance:d,dispose:d.dispose,isDisposed:!1};this._addons.push(u),d.dispose=()=>this._wrappedAddonDispose(u),d.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let d=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===l){d=u;break}if(d===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(d,1)}}},8771:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const d=l(3785),u=l(511);a.BufferApiView=class{constructor(p,g){this._buffer=p,this.type=g}init(p){return this._buffer=p,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(p){const g=this._buffer.lines.get(p);if(g)return new d.BufferLineApiView(g)}getNullCell(){return new u.CellData}}},3785:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const d=l(511);a.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,p){if(!(u<0||u>=this._line.length))return p?(this._line.loadCell(u,p),p):this._line.loadCell(u,new d.CellData)}translateToString(u,p,g){return this._line.translateToString(u,p,g)}}},8285:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const d=l(8771),u=l(8460),p=l(844);class g extends p.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new u.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new d.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new d.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}a.BufferNamespaceApi=g},7975:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,d){return this._core.registerCsiHandler(l,(u=>d(u.toArray())))}addCsiHandler(l,d){return this.registerCsiHandler(l,d)}registerDcsHandler(l,d){return this._core.registerDcsHandler(l,((u,p)=>d(u,p.toArray())))}addDcsHandler(l,d){return this.registerDcsHandler(l,d)}registerEscHandler(l,d){return this._core.registerEscHandler(l,d)}addEscHandler(l,d){return this.registerEscHandler(l,d)}registerOscHandler(l,d){return this._core.registerOscHandler(l,d)}addOscHandler(l,d){return this.registerOscHandler(l,d)}}},7090:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(c,a,l){var d=this&&this.__decorate||function(m,f,h,b){var x,C=arguments.length,_=C<3?f:b===null?b=Object.getOwnPropertyDescriptor(f,h):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(m,f,h,b);else for(var w=m.length-1;w>=0;w--)(x=m[w])&&(_=(C<3?x(_):C>3?x(f,h,_):x(f,h))||_);return C>3&&_&&Object.defineProperty(f,h,_),_},u=this&&this.__param||function(m,f){return function(h,b){f(h,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const p=l(8460),g=l(844),y=l(5295),S=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let v=a.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(m){super(),this.isUserScrolling=!1,this._onResize=this.register(new p.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(m.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(m.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new y.BufferSet(m,this))}resize(m,f){this.cols=m,this.rows=f,this.buffers.resize(m,f),this._onResize.fire({cols:m,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(m,f=!1){const h=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===m.fg&&b.getBg(0)===m.bg||(b=h.getBlankLine(m,f),this._cachedBlankLine=b),b.isWrapped=f;const x=h.ybase+h.scrollTop,C=h.ybase+h.scrollBottom;if(h.scrollTop===0){const _=h.lines.isFull;C===h.lines.length-1?_?h.lines.recycle().copyFrom(b):h.lines.push(b.clone()):h.lines.splice(C+1,0,b.clone()),_?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{const _=C-x+1;h.lines.shiftElements(x+1,_-1,-1),h.lines.set(C,b.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(m,f,h){const b=this.buffer;if(m<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else m+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const x=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+m,b.ybase),0),x!==b.ydisp&&(f||this._onScroll.fire(b.ydisp))}};a.BufferService=v=d([u(0,S.IOptionsService)],v)},7994:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,d){this._charsets[l]=d,this.glevel===l&&(this.charset=d)}}},1753:function(c,a,l){var d=this&&this.__decorate||function(b,x,C,_){var w,k=arguments.length,N=k<3?x:_===null?_=Object.getOwnPropertyDescriptor(x,C):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,x,C,_);else for(var L=b.length-1;L>=0;L--)(w=b[L])&&(N=(k<3?w(N):k>3?w(x,C,N):w(x,C))||N);return k>3&&N&&Object.defineProperty(x,C,N),N},u=this&&this.__param||function(b,x){return function(C,_){x(C,_,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const p=l(2585),g=l(8460),y=l(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function v(b,x){let C=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(C|=64,C|=b.action):(C|=3&b.button,4&b.button&&(C|=64),8&b.button&&(C|=128),b.action===32?C|=32:b.action!==0||x||(C|=3)),C}const m=String.fromCharCode,f={DEFAULT:b=>{const x=[v(b,!1)+32,b.col+32,b.row+32];return x[0]>255||x[1]>255||x[2]>255?"":`\x1B[M${m(x[0])}${m(x[1])}${m(x[2])}`},SGR:b=>{const x=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${v(b,!0)};${b.col};${b.row}${x}`},SGR_PIXELS:b=>{const x=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${v(b,!0)};${b.x};${b.y}${x}`}};let h=a.CoreMouseService=class extends y.Disposable{constructor(b,x){super(),this._bufferService=b,this._coreService=x,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const C of Object.keys(S))this.addProtocol(C,S[C]);for(const C of Object.keys(f))this.addEncoding(C,f[C]);this.reset()}addProtocol(b,x){this._protocols[b]=x}addEncoding(b,x){this._encodings[b]=x}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const x=this._encodings[this._activeEncoding](b);return x&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(x):this._coreService.triggerDataEvent(x,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,x,C){if(C){if(b.x!==x.x||b.y!==x.y)return!1}else if(b.col!==x.col||b.row!==x.row)return!1;return b.button===x.button&&b.action===x.action&&b.ctrl===x.ctrl&&b.alt===x.alt&&b.shift===x.shift}};a.CoreMouseService=h=d([u(0,p.IBufferService),u(1,p.ICoreService)],h)},6975:function(c,a,l){var d=this&&this.__decorate||function(h,b,x,C){var _,w=arguments.length,k=w<3?b:C===null?C=Object.getOwnPropertyDescriptor(b,x):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(h,b,x,C);else for(var N=h.length-1;N>=0;N--)(_=h[N])&&(k=(w<3?_(k):w>3?_(b,x,k):_(b,x))||k);return w>3&&k&&Object.defineProperty(b,x,k),k},u=this&&this.__param||function(h,b){return function(x,C){b(x,C,h)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const p=l(1439),g=l(8460),y=l(844),S=l(2585),v=Object.freeze({insertMode:!1}),m=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let f=a.CoreService=class extends y.Disposable{constructor(h,b,x){super(),this._bufferService=h,this._logService=b,this._optionsService=x,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,p.clone)(v),this.decPrivateModes=(0,p.clone)(m)}reset(){this.modes=(0,p.clone)(v),this.decPrivateModes=(0,p.clone)(m)}triggerDataEvent(h,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const x=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&x.ybase!==x.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`,(()=>h.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(h))}};a.CoreService=f=d([u(0,S.IBufferService),u(1,S.ILogService),u(2,S.IOptionsService)],f)},9074:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const d=l(8055),u=l(8460),p=l(844),g=l(6106);let y=0,S=0;class v extends p.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((h=>h==null?void 0:h.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,p.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;const b=new m(h);if(b){const x=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),x.dispose())})),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,b,x){let C=0,_=0;for(const w of this._decorations.getKeyIterator(b))C=w.options.x??0,_=C+(w.options.width??1),h>=C&&h<_&&(!x||(w.options.layer??"bottom")===x)&&(yield w)}forEachDecorationAtCell(h,b,x,C){this._decorations.forEachByKey(b,(_=>{y=_.options.x??0,S=y+(_.options.width??1),h>=y&&h<S&&(!x||(_.options.layer??"bottom")===x)&&C(_)}))}}a.DecorationService=v;class m extends p.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=d.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=d.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(h){super(),this.options=h,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=h.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const d=l(2585),u=l(8343);class p{constructor(...y){this._entries=new Map;for(const[S,v]of y)this.set(S,v)}set(y,S){const v=this._entries.get(y);return this._entries.set(y,S),v}forEach(y){for(const[S,v]of this._entries.entries())y(S,v)}has(y){return this._entries.has(y)}get(y){return this._entries.get(y)}}a.ServiceCollection=p,a.InstantiationService=class{constructor(){this._services=new p,this._services.set(d.IInstantiationService,this)}setService(g,y){this._services.set(g,y)}getService(g){return this._services.get(g)}createInstance(g,...y){const S=(0,u.getServiceDependencies)(g).sort(((f,h)=>f.index-h.index)),v=[];for(const f of S){const h=this._services.get(f.id);if(!h)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${f.id}.`);v.push(h)}const m=S.length>0?S[0].index:y.length;if(y.length!==m)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${m+1} conflicts with ${y.length} static arguments`);return new g(...y,...v)}}},7866:function(c,a,l){var d=this&&this.__decorate||function(m,f,h,b){var x,C=arguments.length,_=C<3?f:b===null?b=Object.getOwnPropertyDescriptor(f,h):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(m,f,h,b);else for(var w=m.length-1;w>=0;w--)(x=m[w])&&(_=(C<3?x(_):C>3?x(f,h,_):x(f,h))||_);return C>3&&_&&Object.defineProperty(f,h,_),_},u=this&&this.__param||function(m,f){return function(h,b){f(h,b,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const p=l(844),g=l(2585),y={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let S,v=a.LogService=class extends p.Disposable{get logLevel(){return this._logLevel}constructor(m){super(),this._optionsService=m,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(m){for(let f=0;f<m.length;f++)typeof m[f]=="function"&&(m[f]=m[f]())}_log(m,f,h){this._evalLazyOptionalParams(h),m.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...h)}trace(m,...f){var h;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((h=this._optionsService.options.logger)==null?void 0:h.trace.bind(this._optionsService.options.logger))??console.log,m,f)}debug(m,...f){var h;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((h=this._optionsService.options.logger)==null?void 0:h.debug.bind(this._optionsService.options.logger))??console.log,m,f)}info(m,...f){var h;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((h=this._optionsService.options.logger)==null?void 0:h.info.bind(this._optionsService.options.logger))??console.info,m,f)}warn(m,...f){var h;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((h=this._optionsService.options.logger)==null?void 0:h.warn.bind(this._optionsService.options.logger))??console.warn,m,f)}error(m,...f){var h;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((h=this._optionsService.options.logger)==null?void 0:h.error.bind(this._optionsService.options.logger))??console.error,m,f)}};a.LogService=v=d([u(0,g.IOptionsService)],v),a.setTraceLogger=function(m){S=m},a.traceCall=function(m,f,h){if(typeof h.value!="function")throw new Error("not supported");const b=h.value;h.value=function(...x){if(S.logLevel!==g.LogLevelEnum.TRACE)return b.apply(this,x);S.trace(`GlyphRenderer#${b.name}(${x.map((_=>JSON.stringify(_))).join(", ")})`);const C=b.apply(this,x);return S.trace(`GlyphRenderer#${b.name} return`,C),C}}},7302:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const d=l(8460),u=l(844),p=l(6114);a.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class y extends u.Disposable{constructor(v){super(),this._onOptionChange=this.register(new d.EventEmitter),this.onOptionChange=this._onOptionChange.event;const m={...a.DEFAULT_OPTIONS};for(const f in v)if(f in m)try{const h=v[f];m[f]=this._sanitizeAndValidateOption(f,h)}catch(h){console.error(h)}this.rawOptions=m,this.options={...m},this._setupOptions(),this.register((0,u.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(v,m){return this.onOptionChange((f=>{f===v&&m(this.rawOptions[v])}))}onMultipleOptionChange(v,m){return this.onOptionChange((f=>{v.indexOf(f)!==-1&&m()}))}_setupOptions(){const v=f=>{if(!(f in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},m=(f,h)=>{if(!(f in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);h=this._sanitizeAndValidateOption(f,h),this.rawOptions[f]!==h&&(this.rawOptions[f]=h,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const h={get:v.bind(this,f),set:m.bind(this,f)};Object.defineProperty(this.options,f,h)}}_sanitizeAndValidateOption(v,m){switch(v){case"cursorStyle":if(m||(m=a.DEFAULT_OPTIONS[v]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(m))throw new Error(`"${m}" is not a valid value for ${v}`);break;case"wordSeparator":m||(m=a.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof m=="number"&&1<=m&&m<=1e3)break;m=g.includes(m)?m:a.DEFAULT_OPTIONS[v];break;case"cursorWidth":m=Math.floor(m);case"lineHeight":case"tabStopWidth":if(m<1)throw new Error(`${v} cannot be less than 1, value: ${m}`);break;case"minimumContrastRatio":m=Math.max(1,Math.min(21,Math.round(10*m)/10));break;case"scrollback":if((m=Math.min(m,4294967295))<0)throw new Error(`${v} cannot be less than 0, value: ${m}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(m<=0)throw new Error(`${v} cannot be less than or equal to 0, value: ${m}`);break;case"rows":case"cols":if(!m&&m!==0)throw new Error(`${v} must be numeric, value: ${m}`);break;case"windowsPty":m=m??{}}return m}}a.OptionsService=y},2660:function(c,a,l){var d=this&&this.__decorate||function(y,S,v,m){var f,h=arguments.length,b=h<3?S:m===null?m=Object.getOwnPropertyDescriptor(S,v):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(y,S,v,m);else for(var x=y.length-1;x>=0;x--)(f=y[x])&&(b=(h<3?f(b):h>3?f(S,v,b):f(S,v))||b);return h>3&&b&&Object.defineProperty(S,v,b),b},u=this&&this.__param||function(y,S){return function(v,m){S(v,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const p=l(2585);let g=a.OscLinkService=class{constructor(y){this._bufferService=y,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(y){const S=this._bufferService.buffer;if(y.id===void 0){const x=S.addMarker(S.ybase+S.y),C={data:y,id:this._nextId++,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(C,x))),this._dataByLinkId.set(C.id,C),C.id}const v=y,m=this._getEntryIdKey(v),f=this._entriesWithId.get(m);if(f)return this.addLineToLink(f.id,S.ybase+S.y),f.id;const h=S.addMarker(S.ybase+S.y),b={id:this._nextId++,key:this._getEntryIdKey(v),data:v,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(b,h))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(y,S){const v=this._dataByLinkId.get(y);if(v&&v.lines.every((m=>m.line!==S))){const m=this._bufferService.buffer.addMarker(S);v.lines.push(m),m.onDispose((()=>this._removeMarkerFromLink(v,m)))}}getLinkData(y){var S;return(S=this._dataByLinkId.get(y))==null?void 0:S.data}_getEntryIdKey(y){return`${y.id};;${y.uri}`}_removeMarkerFromLink(y,S){const v=y.lines.indexOf(S);v!==-1&&(y.lines.splice(v,1),y.lines.length===0&&(y.data.id!==void 0&&this._entriesWithId.delete(y.key),this._dataByLinkId.delete(y.id)))}};a.OscLinkService=g=d([u(0,p.IBufferService)],g)},8343:(c,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",d="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(u){return u[d]||[]},a.createDecorator=function(u){if(a.serviceRegistry.has(u))return a.serviceRegistry.get(u);const p=function(g,y,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,m,f){m[l]===m?m[d].push({id:v,index:f}):(m[d]=[{id:v,index:f}],m[l]=m)})(p,g,S)};return p.toString=()=>u,a.serviceRegistry.set(u,p),p}},2585:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const d=l(8343);var u;a.IBufferService=(0,d.createDecorator)("BufferService"),a.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),a.ICoreService=(0,d.createDecorator)("CoreService"),a.ICharsetService=(0,d.createDecorator)("CharsetService"),a.IInstantiationService=(0,d.createDecorator)("InstantiationService"),(function(p){p[p.TRACE=0]="TRACE",p[p.DEBUG=1]="DEBUG",p[p.INFO=2]="INFO",p[p.WARN=3]="WARN",p[p.ERROR=4]="ERROR",p[p.OFF=5]="OFF"})(u||(a.LogLevelEnum=u={})),a.ILogService=(0,d.createDecorator)("LogService"),a.IOptionsService=(0,d.createDecorator)("OptionsService"),a.IOscLinkService=(0,d.createDecorator)("OscLinkService"),a.IUnicodeService=(0,d.createDecorator)("UnicodeService"),a.IDecorationService=(0,d.createDecorator)("DecorationService")},1480:(c,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const d=l(8460),u=l(225);class p{static extractShouldJoin(y){return(1&y)!=0}static extractWidth(y){return y>>1&3}static extractCharKind(y){return y>>3}static createPropertyValue(y,S,v=!1){return(16777215&y)<<3|(3&S)<<1|(v?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new d.EventEmitter,this.onChange=this._onChange.event;const y=new u.UnicodeV6;this.register(y),this._active=y.version,this._activeProvider=y}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(y){if(!this._providers[y])throw new Error(`unknown Unicode version "${y}"`);this._active=y,this._activeProvider=this._providers[y],this._onChange.fire(y)}register(y){this._providers[y.version]=y}wcwidth(y){return this._activeProvider.wcwidth(y)}getStringCellWidth(y){let S=0,v=0;const m=y.length;for(let f=0;f<m;++f){let h=y.charCodeAt(f);if(55296<=h&&h<=56319){if(++f>=m)return S+this.wcwidth(h);const C=y.charCodeAt(f);56320<=C&&C<=57343?h=1024*(h-55296)+C-56320+65536:S+=this.wcwidth(C)}const b=this.charProperties(h,v);let x=p.extractWidth(b);p.extractShouldJoin(b)&&(x-=p.extractWidth(v)),S+=x,v=b}return S}charProperties(y,S){return this._activeProvider.charProperties(y,S)}}a.UnicodeService=p}},r={};function s(c){var a=r[c];if(a!==void 0)return a.exports;var l=r[c]={exports:{}};return n[c].call(l.exports,l,l.exports,s),l.exports}var o={};return(()=>{var c=o;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const a=s(9042),l=s(3236),d=s(844),u=s(5741),p=s(8285),g=s(7975),y=s(7090),S=["cols","rows"];class v extends d.Disposable{constructor(f){super(),this._core=this.register(new l.Terminal(f)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};const h=x=>this._core.options[x],b=(x,C)=>{this._checkReadonlyOptions(x),this._core.options[x]=C};for(const x in this._core.options){const C={get:h.bind(this,x),set:b.bind(this,x)};Object.defineProperty(this._publicOptions,x,C)}}_checkReadonlyOptions(f){if(S.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new y.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new p.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const f=this._core.coreService.decPrivateModes;let h="none";switch(this._core.coreMouseService.activeProtocol){case"X10":h="x10";break;case"VT200":h="vt200";break;case"DRAG":h="drag";break;case"ANY":h="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const h in f)this._publicOptions[h]=f[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,h=!0){this._core.input(f,h)}resize(f,h){this._verifyIntegers(f,h),this._core.resize(f,h)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,h,b){this._verifyIntegers(f,h,b),this._core.select(f,h,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,h){this._verifyIntegers(f,h),this._core.selectLines(f,h)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,h){this._core.write(f,h)}writeln(f,h){this._core.write(f),this._core.write(`\r
641
- `,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return a}_verifyIntegers(...f){for(const h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}c.Terminal=v})(),o})()))})(Ga)),Ga.exports}var vk=xk();const yb="codebuddy-locale";function xb(){if(typeof navigator>"u")return"en";const e=[];Array.isArray(navigator.languages)&&navigator.languages.length>0&&e.push(...navigator.languages),navigator.language&&e.push(navigator.language);try{const t=Intl.DateTimeFormat().resolvedOptions().locale;t&&e.push(t)}catch{}for(const t of e)if(t.toLowerCase().startsWith("zh"))return"zh";return"en"}function Wa(e){return e==="system"?xb():e}function _k(){try{const e=localStorage.getItem(yb);if(e){const t=JSON.parse(e),n=(t==null?void 0:t.mode)??e;if(["zh","en","system"].includes(n))return n}}catch{}return"system"}const Hi=rt()(Hs((e,t)=>{const n=_k(),r=Wa(n);return typeof window<"u"&&window.addEventListener("languagechange",()=>{const s=Hi.getState();if(s.mode==="system"){const o=xb();o!==s.resolved&&Hi.setState({resolved:o})}}),{mode:n,resolved:r,setLocale:s=>{const o=Wa(s);e({mode:s,resolved:o})},toggle:()=>{const s=t().mode,o=s==="zh"?"en":s==="en"?"system":"zh";t().setLocale(o)}}},{namespace:"locale",fields:["mode"],scope:"global",debounceMs:300,localStorageKey:yb,onLoad:(e,t)=>{if(e.mode){const n=Wa(e.mode);t({mode:e.mode,resolved:n})}}})),Nm={zh:{"app.connecting":"正在连接 CodeBuddy Code...","app.connectFailed":"连接失败","app.retry":"重试","app.pwa.newVersion":"检测到 Web UI 新版本","app.pwa.reloadNow":"立即刷新","app.pwa.reloadLater":"稍后","app.pwa.reloadedAfterIdle":"已切换到新版本","chat.empty.title":"CodeBuddy Code","chat.empty.subtitle":"今天有什么可以帮到你?","chat.empty.slogan":"Claw Your Ideas . Into Reality","chat.empty.tag.slides":"幻灯片生成","chat.empty.tag.research":"深度研究","chat.empty.tag.docs":"文档处理","chat.empty.tag.data":"数据分析","chat.thinking":"思考中","chat.waitingPermission":"等待权限确认","chat.waitingUser":"等待用户回答","chat.error":"错误","chat.sessionEnded":"会话已结束","chat.stopped":"已停止","chat.scrollToLatest":"跳到最新","chat.error.refusal":"Agent 拒绝继续执行。这可能是由于内容策略限制或其他限制。","chat.error.network":"网络连接异常或服务暂时不可用,请稍后重试。","chat.error.auth":"身份验证失败或权限不足,请重新登录后再试。","chat.error.quota":"已达到配额上限或请求过于频繁,请稍后再试。","chat.error.modelService":"模型服务返回异常,请重试或稍后再试。","chat.error.cancelled":"请求已被取消,可能由系统休眠或网络中断导致,请重试。","chat.error.maxTokens":"响应因达到最大 token 限制而被截断。您可以继续对话或要求更简洁的回复。","chat.error.maxTurnRequests":"已超过单轮对话允许的最大模型请求次数。您可以发送新消息以继续。","chat.newChat":"新对话","chat.disclaimer":"回答由 AI 生成,仅供参考","chat.compacted":"已精简历史对话","chat.compacting":"正在精简历史对话...","chat.compactCancelled":"历史对话精简已取消","phase.preparing":"准备中","phase.modelRequesting":"等待模型响应","phase.modelStreaming":"接收中","phase.modelDone":"处理中","phase.toolExecuting":"执行工具","phase.modelStreamingTool":"正在写入","phase.retrying":"重试中","progress.compacting":"压缩上下文中","input.placeholder":"从一个想法开始...","input.placeholderRunning":"消息将排队等待处理...","input.placeholderPending":"请先处理权限请求...","input.send":"发送 (Enter)","input.stop":"停止","input.thinking":"思考中","input.deepThinking":"深度思考","input.promptFailed":"发送失败","input.sendQueued":"发送排队消息 (Enter)","input.dropHint":"拖拽文件到这里","input.addImage":"添加图片","input.addFile":"添加文件","input.imageTooLarge":"图片不能超过 10MB","input.tooManyImages":"最多添加 5 张图片","input.fileTooLarge":"文件不能超过 1MB","input.tooManyFiles":"最多添加 10 个文件","input.menu.image":"图片","input.menu.file":"文件","input.menu.mode":"模式","input.menu.model":"模型","input.modeSelector":"模式","input.modelSelector":"模型","input.deepThinkingDesc":"让模型在回答前进行更深入的推理","input.modelHeader":"模型","mode.default":"默认","mode.default.desc":"每次首次使用工具时都请求权限","mode.acceptEdits":"自动通过编辑","mode.acceptEdits.desc":"本会话自动通过文件编辑权限","mode.plan":"规划模式","mode.plan.desc":"只分析、不修改文件或执行命令","mode.bypassPermissions":"跳过权限确认","mode.bypassPermissions.desc":"跳过所有权限确认","input.newline":"换行","input.contextMenu.newline":"换行","input.contextMenu.send":"发送","queue.more":" 条消息排队中","status.running":"运行中","tool.writeFile":"写入文件","tool.readFile":"读取文件","tool.execute":"执行指令","tool.searchFiles":"搜索文件","tool.searchContent":"搜索内容","tool.fetchWeb":"获取网页","tool.searchWeb":"搜索网络","tool.defaultName":"工具","tool.moreItems":"... 还有 {count} 项","interruption.title":"需要授权","interruption.tool":"工具","interruption.allow":"允许","interruption.allowAll":"全部允许","interruption.deny":"拒绝","interruption.approved":"已允许","interruption.denied":"已拒绝","interruption.edits":"{count} 处编辑","interruption.yes":"是","interruption.keepPlanning":"继续规划","interruption.exitPlanMode":"退出计划模式","interruption.readyToCode":"准备好开始编码了吗?","theme.light":"浅色","theme.dark":"深色","theme.system":"跟随系统","locale.zh":"中文","locale.en":"English","locale.system":"跟随系统","sidebar.nav.plugins":"插件","sidebar.nav.tasks":"任务","sidebar.search.placeholder":"搜索...","sidebar.chatHistory":"对话历史","sidebar.workspace":"工作区","sidebar.connectionStatus":"连接状态","sidebar.status":"状态","sidebar.sessionId":"会话ID","sidebar.notConnected":"未连接","sidebar.modelSelection":"模型选择","sidebar.noModels":"暂无可用模型","sidebar.environment":"环境信息","sidebar.cwd":"工作目录","sidebar.os":"操作系统","sidebar.nodeVersion":"Node.js","sidebar.gatewayMode":"网关模式","sidebar.tunnelUrl":"Tunnel 地址","sidebar.clickToCopy":"点击复制","sidebar.copied":"已复制","sidebar.permissionMode":"权限模式","sidebar.noModes":"暂无可用模式","sidebar.preferences":"设置","sidebar.keybindings":"快捷键","sidebar.group.workspace":"工作区","sidebar.group.observability":"可观测","sidebar.group.preferences":"配置","bottomSheet.attachments":"添加","bottomSheet.navigation":"导航","sidebar.theme":"界面主题","sidebar.language":"界面语言","sidebar.user":"用户","sidebar.authMethod":"密码认证","sidebar.noAuth":"无认证","sidebar.version":"Remote UI v1.0","connection.connected":"已连接","connection.connecting":"连接中","connection.disconnected":"未连接","connection.error":"连接错误","message.copyToClipboard":"复制到剪贴板","message.copied":"已复制","message.copy":"复制","message.assistantName":"CodeBuddy Code","thinking.title":"思考过程","thinking.thinking":"思考中","thinking.done":"已思考","thinking.seconds":"(用时 {n} 秒)","thinking.expand":"展开","thinking.collapse":"收起","diff.noChanges":"无变更","login.title":"CodeBuddy Remote Control","login.subtitle":"请输入终端中显示的密码","login.placeholder":"密码","login.submit":"登录","login.error.incorrect":"密码错误","login.error.rateLimit":"登录尝试次数过多,请稍后再试","login.error.required":"请输入密码","login.hint.password":"提示:密码在服务启动时显示在终端中。","login.hint.urlAuth":"也可以使用 <code>?password=xxx</code> 自动登录。","login.hint.disable":'或在 CodeBuddy 配置目录(默认 <code>~/.codebuddy</code>,可通过 <code>CODEBUDDY_CONFIG_DIR</code> 环境变量覆盖)下的 <code>settings.json</code> 中设置 <code>gateway.auth: "none"</code> 来禁用认证。',"login.slogan":"Claw Your Ideas . Into Reality","login.tagline":"Triggered Anywhere, Completed Locally.","login.privacy":"隐私政策","login.terms":"服务条款","sidebar.interactionMode":"交互模式","sidebar.chatMode":"对话","sidebar.terminalMode":"终端","sidebar.canvas":"画布","canvas.title":"无限画布","canvas.addTerminal":"添加终端","canvas.zoomIn":"放大","canvas.zoomOut":"缩小","canvas.fitView":"适应视图","canvas.resetView":"重置视图","canvas.empty":"点击工具栏 + 按钮添加终端","canvas.openStandalone":"在新窗口打开画布","canvas.tileMenu.close":"关闭","canvas.tileMenu.duplicate":"复刻终端","canvas.tileMenu.maximize":"最大化","canvas.tileMenu.minimize":"最小化","canvas.tileMenu.restore":"还原","canvas.tileMenu.openStandalone":"在新窗口打开","canvas.standalone.missingPaneId":"未指定终端 ID","canvas.defaultTitle":"终端","terminal.connecting":"终端连接中...","terminal.title":"终端","terminal.disconnected":"终端已断开","terminal.error":"终端连接失败","terminal.reconnect":"重新连接","terminal.splitHorizontal":"左右分屏","terminal.splitVertical":"上下分屏","terminal.closePane":"关闭终端","terminal.maxPanes":"已达最大面板数","sidebar.instances":"实例","sidebar.activeInstances":"个活跃实例","sidebar.manageInstances":"管理实例","sidebar.remoteControl":"远程控制","instance.title":"实例列表","instance.switch":"实例","instance.switchTitle":"切换实例","instance.current":"当前实例","instance.manual":"手动添加","instance.switchTo":"切换到此实例","instance.manage":"管理实例","instance.managerTitle":"实例管理","instance.addInstance":"添加实例","instance.name":"实例名称","instance.namePlaceholder":"自定义实例名称(可选,默认为目录名)","instance.url":"实例地址","instance.urlPlaceholder":"https://example.trycloudflare.com","instance.password":"密码","instance.optional":"可选","instance.passwordPlaceholder":"访问密码","instance.cancel":"取消","instance.add":"添加","instance.remove":"删除此实例","instance.noInstances":"暂无其他实例","instance.noInstancesHint":"启动更多 CodeBuddy Code 实例,或手动添加远程实例","instance.cwd":"工作目录","instance.topic":"当前话题","instance.startedAt":"启动于","instance.local":"本地","instance.tunnel":"隧道","instance.uptime.days":"天前","instance.uptime.hours":"小时前","instance.uptime.minutes":"分钟前","instance.uptime.justNow":"刚刚","instance.addError":"添加实例失败","instance.removeError":"删除实例失败","instance.copyUrl":"复制链接","instance.copied":"已复制","instance.subtitle":"管理和切换工作实例","instance.refresh":"刷新","instance.refreshed":"已刷新","instance.loading":"加载实例中...","instance.error":"加载实例列表失败","instance.retry":"重试","question.multiple":"多选","question.customAnswer":"或输入自定义答案...","question.reviewAnswers":"审核答案","question.singleTitle":"问题","question.titleWithCount":"问题({count})","question.reviewTab":"审核","question.next":"下一步","question.submit":"提交","question.cancel":"取消","question.answered":"已回答","question.cancelled":"问题已取消","todo.title":"任务清单","todo.executing":"任务{n}正在执行中","todo.untitled":"未命名","history.title":"会话历史","history.description":"点击会话可切换到该对话","history.noData":"暂无会话历史","history.noDataHint":"开始一段新对话吧","history.backToChat":"返回对话","history.loading":"加载中...","history.loadError":"加载失败","history.retry":"重试","history.current":"当前","history.messages":"{count} 条消息","history.delete":"删除","history.deleteConfirm":"确定要删除这个会话吗?","history.deleteCancel":"取消","history.deleteOk":"删除","history.rename":"重命名","history.renameTitle":"重命名会话","history.renamePlaceholder":"输入新名称","history.renameCancel":"取消","history.renameOk":"确定","history.cannotDeleteCurrent":"无法删除当前会话","settings.title":"设置","settings.appearance":"外观","settings.model":"模型选择","settings.mode":"权限模式","settings.systemInfo":"系统信息","settings.backToChat":"返回对话","settings.tab.user":"用户级","settings.tab.project":"工作空间级","settings.group.modelAndReasoning":"模型与推理","settings.group.behavior":"行为","settings.group.memory":"记忆","settings.group.language":"语言","settings.group.advanced":"高级","settings.group.sandbox":"安全沙箱","settings.item.model":"默认模型","settings.item.model.desc":"设置默认使用的 AI 模型","settings.item.reasoningEffort":"推理努力级别","settings.item.reasoningEffort.desc":"控制模型的推理深度","settings.item.alwaysThinkingEnabled":"始终启用深度思考","settings.item.autoCompactEnabled":"自动压缩上下文","settings.item.includeCoAuthoredBy":"提交包含 Co-authored-by","settings.item.fileCheckpointingEnabled":"文件检查点","settings.item.fileCheckpointingEnabled.desc":"启用文件版本回退功能","settings.item.promptSuggestionEnabled":"提示建议","settings.item.ignoreGitIgnore":"忽略 .gitignore","settings.item.ignoreGitIgnore.desc":"搜索文件时忽略 .gitignore 规则","settings.item.deferToolLoading":"延迟加载工具","settings.item.hookOutputCollapsed":"折叠 Hook 输出","settings.item.memory.enabled":"启用记忆功能","settings.item.memory.autoMemoryEnabled":"自动记忆","settings.item.memory.autoMemoryEnabled.desc":"自动保存重要信息到记忆库","settings.item.language":"响应语言","settings.item.language.desc":"设置 AI 回复使用的语言","settings.item.cleanupPeriodDays":"聊天记录保留天数","settings.item.imageHistoryRetainRounds":"图片保留轮数","settings.item.imageHistoryRetainRounds.desc":"对话历史中保留图片的最近轮数","settings.item.env":"环境变量","settings.item.env.desc":"应用于每个会话的环境变量 (JSON)","settings.item.sandbox.enabled":"启用安全沙箱","settings.item.sandbox.enabled.desc":"在沙箱中运行 Bash 命令,限制文件和网络访问","settings.item.sandbox.autoAllowBashIfSandboxed":"沙箱内自动批准命令","settings.item.sandbox.autoAllowBashIfSandboxed.desc":"命令在沙箱中运行时自动批准","settings.loading":"加载中...","settings.saved":"已保存","settings.saveFailed":"保存失败","settings.notSet":"未设置","settings.default":"默认","settings.reset":"重置","settings.noProjectSettings":"当前工作空间暂无可配置项","settings.effort.minimal":"最小","settings.effort.low":"低","settings.effort.medium":"中","settings.effort.high":"高","settings.effort.xhigh":"极高","settings.effort.max":"最大","page.title":"CodeBuddy Code","tool.processExited":"[进程已退出]","tool.itemsCount":"{count} 项","tool.showAllItems":"显示全部 {count} 项","tool.moreLinesCount":"... 还有 {count} 行","tool.generatedImage":"生成的图片","tool.editedImage":"编辑后的图片","tool.imageGen":"图片生成","tool.imageEdit":"图片编辑","tool.toolSearch":"工具搜索","tool.teamCreate":"创建团队","tool.teamDelete":"删除团队","tool.taskCreate":"创建任务","tool.taskUpdate":"更新任务","tool.taskList":"任务列表","tool.taskGet":"获取任务","tool.sendMessage":"发送消息","tool.shutdown":"关闭","tool.taskCompleted":"任务完成","tool.shutdownRejected":"关闭被拒绝","tool.planResponse":"计划回复","tool.approved":"已批准","tool.rejected":"已拒绝","tool.userRejectedResult":"用户已拒绝执行此操作","tool.webSearch":"网络搜索","tool.webFetch":"网页获取","tool.saveMemory":"保存记忆","tool.askUserQuestion":"询问用户","tool.enterPlanMode":"进入计划模式","tool.exitPlanMode":"退出计划模式","tool.allowedActions":"允许的操作:","tool.skill":"技能","tool.agent":"代理","tool.failed":"失败","tool.completed":"完成","tool.toolsCount":"{count} 个工具","tool.background":"后台","tool.permissionsCount":"{count} 项权限","terminal.unknownError":"未知错误","terminal.processExited":"[进程已退出]","terminal.connectionLost":"连接已断开","terminal.wsConnectionFailed":"WebSocket 连接失败","terminal.createSessionFailed":"创建终端会话失败","terminal.reconnectFailed":"重连失败","team.title":"团队","team.activeCount":"{count} 个活跃","team.doneCount":"{count} 个完成","team.waitingForTeammates":"等待 {count} 个成员完成…","team.backToMain":"返回主对话","team.loadingHistory":"加载对话历史…","team.noHistory":"暂无对话历史","team.agentRunning":"正在运行…","team.delivered":"已送达","team.showLess":"收起","team.moreLines":"… ({count} 更多行)","team.tools":"{count} 工具","team.tokens":"{count} tokens","instance.tunnelMode":"隧道","instance.localMode":"本地","workspace.searchPlaceholder":"搜索目录...","workspace.switch":"切换","workspace.switchHere":"切换到此目录","workspace.switching":"切换中...","workspace.noResults":"没有匹配的目录","workspace.emptyDir":"此目录为空","workspace.pathPlaceholder":"输入路径或目录名...","workspace.selectDir":"在此目录创建机器人","workspace.filterPlaceholder":"过滤子目录...","workspace.recent.title":"最近工作区","workspace.recent.daysAgo":"天前","workspace.recent.hoursAgo":"小时前","workspace.recent.minutesAgo":"分钟前","workspace.recent.justNow":"刚刚","workspace.recent.remove":"移除","workspace.browseTitle":"浏览工作区","workspace.recentWorkspaces":"最近工作区","workspace.createNew":"创建新机器人","workspace.browseDir":"浏览目录","workspace.instanceLocal":"本地","workspace.instanceTunnel":"隧道","workspace.instanceCurrent":"当前","workspace.switchInstance":"切换","workspace.switchingInstance":"切换中...","workspace.switchingWithGateway":"正在准备切换...","workspace.instanceStarted":"启动于","workspace.noWorkspaces":"暂无活跃的工作区","workspace.noWorkspacesHint":"浏览目录创建新机器人","workspace.instanceCount":"{count} 个机器人","question.multiLabel":"多选","tasks.title":"推荐模版","tasks.subtitle":"选择一个模版快速创建定时任务","tasks.loading":"正在获取推荐模版...","tasks.error":"获取模版失败","tasks.retry":"重试","tasks.refresh":"刷新推荐","tasks.refreshed":"已刷新","tasks.empty":"暂无推荐模版","tasks.interval":"每 {value}","tasks.interval.1d":"每天","tasks.interval.2d":"每 2 天","tasks.interval.3d":"每 3 天","tasks.interval.1w":"每周","tasks.interval.2w":"每 2 周","tasks.interval.1m":"每月","scheduled.title":"定时任务","scheduled.subtitle":"当前会话中的活跃定时任务","scheduled.loading":"加载中...","scheduled.empty":"暂无定时任务","scheduled.emptyHint":"在对话中使用 /loop 或 CronCreate 创建","scheduled.create":"创建任务","scheduled.creating":"创建中...","scheduled.delete":"删除","scheduled.cron":"Cron 表达式","scheduled.prompt":"执行内容","scheduled.promptPlaceholder":"定时触发时要执行的提示词...","scheduled.recurring":"循环","scheduled.oneShot":"一次性","scheduled.durable":"持久化","scheduled.sessionOnly":"仅会话","scheduled.lastFired":"上次触发","plugins.title":"插件管理","plugins.installedPlugins":"已安装插件","plugins.browseMarketplace":"浏览市场","plugins.marketplaces":"插件市场","plugins.enabled":"已启用","plugins.disabled":"已禁用","plugins.enable":"启用","plugins.disable":"禁用","plugins.uninstall":"卸载","plugins.install":"安装","plugins.confirmUninstall":"确定要卸载此插件吗?","plugins.marketplace":"市场","plugins.addMarketplace":"添加市场","plugins.removeMarketplace":"移除","plugins.confirmRemoveMarketplace":"确定要移除此市场吗?","plugins.noPlugins":"暂无已安装的插件","plugins.noPluginsHint":"通过插件市场安装插件来扩展功能","plugins.noMarketplaces":"暂无配置的市场","plugins.noMarketplacesHint":"添加一个插件市场来浏览和安装插件","plugins.selectMarketplace":"选择市场","plugins.selectMarketplaceHint":"选择一个市场来浏览可用插件","plugins.marketplaceNotFound":"市场不存在","plugins.noAvailablePlugins":"该市场暂无可用插件","plugins.noAvailablePluginsHint":"请尝试添加其他市场或稍后再试","plugins.installed":"已安装","plugins.browsingMarketplace":"浏览中...","plugins.loading":"加载中...","plugins.error":"加载插件失败","plugins.retry":"重试","plugins.sourcePlaceholder":"市场地址(Git URL 或本地路径)","plugins.namePlaceholder":"市场名称(可选)","plugins.cancel":"取消","plugins.add":"添加","plugins.version":"版本","plugins.operationFailed":"操作失败","plugins.searchPlaceholder":"搜索插件...","plugins.allMarketplaces":"全部市场","plugins.noSearchResults":"没有找到匹配的插件","plugins.totalCount":"个插件","plugins.refresh":"刷新","plugins.installedLabel":"已安装","plugins.category":"分类","plugins.author":"作者","plugins.license":"许可证","plugins.homepage":"主页","plugins.repository":"仓库","plugins.source":"来源","plugins.keywords":"关键词","plugins.features":"功能","plugins.scope":"范围","plugins.scope.user":"用户","plugins.scope.project":"项目","plugins.scope.project-local":"本地","plugins.installScope.user":"为你安装(用户级)","plugins.installScope.project":"为所有协作者安装(项目级)","plugins.installScope.local":"仅在此仓库为你安装(本地级)","plugins.policyCannotRemove":"不可卸载","plugins.policyCannotSwitchoff":"不可禁用","plugins.policyCannotEdit":"不可编辑","channel.from":"来自","channel.group":"群聊","channel.replyTo":"回复来自 {source}","channel.wechat":"微信","channel.wecom":"企业微信","channel.wecomBot":"企微机器人","remoteControl.title":"远程控制","remoteControl.subtitle":"管理渠道连接","remoteControl.connectedChannels":"已连接渠道","remoteControl.noChannels":"暂无已连接渠道","remoteControl.noChannelsHint":"添加微信或企业微信渠道,或从插件市场安装更多","remoteControl.addWeChat":"添加微信机器人","remoteControl.addWeCom":"添加企微机器人","remoteControl.connect":"连接","remoteControl.disconnect":"断开","remoteControl.delete":"删除","remoteControl.add":"添加","remoteControl.connected":"已连接","remoteControl.disconnected":"未连接","remoteControl.connecting":"连接中...","remoteControl.installMore":"安装更多渠道","remoteControl.installMoreHint":"浏览插件市场,安装第三方渠道插件","remoteControl.browseMarketplace":"浏览插件市场","remoteControl.builtIn":"内置","remoteControl.plugin":"插件","remoteControl.rebind":"重新绑定","remoteControl.unbind":"解绑","remoteControl.bot":"机器人","remoteControl.default":"默认","remoteControl.next":"下一步","remoteControl.cancel":"取消","remoteControl.wecomBotIdHint":"从企业微信管理后台 → 应用管理 → AI 助手获取","remoteControl.wecomSecretHint":"输入 Secret 后按回车或点“连接”","remoteControl.fetchingQr":"正在获取二维码...","remoteControl.scanQr":"请用微信扫描二维码","sidebar.docs":"文档","docs.title":"文档中心","docs.search.placeholder":"搜索文档...","docs.search.noResults":"未找到相关文档","docs.search.resultsCount":"{count} 个结果","docs.loading":"加载中...","docs.loadError":"文档加载失败","docs.notFound":"未找到该文档","docs.apiReference":"API 文档","docs.toc":"目录","docs.retry":"重试","docs.backToList":"返回文档列表","docs.expandAll":"展开全部","docs.collapseAll":"收起全部","docs.openStandalone":"独立窗口打开","sidebar.stats":"统计","stats.title":"统计","stats.loading":"正在加载统计数据...","stats.refresh":"刷新","stats.noData":"暂无统计数据","stats.tab.overview":"概览","stats.tab.models":"模型","stats.tab.tools":"工具","stats.sessions":"会话数","stats.messages":"消息数","stats.activeDays":"活跃天数","stats.currentStreak":"当前连续","stats.longestStreak":"最长连续","stats.peakHour":"高峰时段","stats.longestSession":"最长会话","stats.favoriteModel":"最常用模型","stats.totalTokens":"总 Token","stats.timeRange":"统计范围: 最近 {days} 天","stats.heatmap.less":"少","stats.heatmap.more":"多","stats.days":"天","stats.tokensPerDay":"每日 Token 趋势","stats.allModels":"所有模型","stats.input":"输入","stats.output":"输出","stats.cacheRead":"缓存读取","stats.cacheHitRate":"缓存命中率","stats.cost":"成本","stats.topTools":"工具使用排行","stats.session.title":"当前会话","stats.session.apiDuration":"API 时长","stats.session.wallTime":"总时长","stats.session.linesAdded":"新增行","stats.session.linesDeleted":"删除行","stats.session.tokens":"Token","stats.na":"N/A","stats.heatmap.messages":"条消息","stats.funFact.moreTokens":"你已使用约 {times} 倍于《{book}》的 Token 量","stats.funFact.sameTokens":"你使用的 Token 量约等于一本《{book}》","stats.funFact.longerSession":"你最长的会话时长约为「{activity}」的 {times} 倍","sidebar.traces":"链路","traces.title":"链路追踪","traces.loading":"加载中...","traces.refresh":"刷新","traces.clear":"清空","traces.clearConfirm":"确定清空所有链路数据?","traces.noData":"暂无链路数据,发送一条消息后将自动收集","traces.selectWorker":"选择 Worker","traces.current":"当前","traces.spanCount":"{count} spans","traces.duration":"耗时","traces.status.ok":"成功","traces.status.error":"错误","traces.status.running":"运行中","traces.status.cancelled":"已取消","traces.bottleneck":"瓶颈","traces.bottleneckTip":"耗时最长,占总时间 {pct}%","traces.spanDetail":"Span 详情","traces.spanDetail.type":"类型","traces.spanDetail.duration":"耗时","traces.spanDetail.model":"模型","traces.spanDetail.tokens":"Token","traces.spanDetail.input":"输入","traces.spanDetail.output":"输出","traces.spanDetail.error":"错误","traces.spanDetail.cancelReason":"取消原因","traces.spanDetail.attributes":"属性","traces.legend.agent":"Agent","traces.legend.generation":"模型调用","traces.legend.function":"工具","traces.legend.handoff":"切换","traces.legend.guardrail":"防护","traces.back":"返回","traces.tab.timeline":"时间线","traces.tab.tree":"树形","traces.tab.flame":"火焰图","traces.tab.graph":"依赖图","traces.expandAll":"全部展开","traces.collapseAll":"全部收起","traces.search":"搜索 span...","traces.selfTime":"自身耗时","traces.spanDetail.overview":"概览","traces.spanDetail.io":"输入/输出","traces.noSpans":"无 span 数据","traces.noSpansFiltered":"当前筛选下无 span。","traces.clearFilter":"清除筛选","traces.auto":"自动","traces.auxiliaryCount":"{count} 个辅助 trace(memory、title 等)","traces.noIO":"无输入/输出数据","traces.noAttrs":"无属性","traces.io.expand":"展开","traces.io.collapse":"收起","traces.io.messages":"消息","traces.io.less":"收起","traces.io.moreChars":"+{count} 字符","traces.fit":"适应","traces.allSessions":"所有会话","traces.allInstances":"所有实例","traces.llmCalls":"{count} 次 LLM","traces.errors":"错误","traces.noErrors":"没有失败的 trace","traces.errorBanner":"检测到 {count} 个失败的 trace","traces.errorBannerCta":"点击仅查看错误 →","traces.errorSummaryTitle":"本次共有 {count} 处错误","traces.jumpToFirstError":"跳转到首个错误 span","traces.copyError":"复制错误","traces.onlyErrors":"仅错误","traces.filter.all":"全部","traces.filter.error":"错误","traces.filter.running":"运行中","traces.filter.cancelled":"已取消","traces.filter.ok":"成功","sidebar.metrics":"监控","metrics.title":"系统监控","metrics.loading":"加载指标数据...","metrics.refresh":"刷新","metrics.cpu":"CPU","metrics.memory":"内存","metrics.disk":"磁盘","metrics.cores":"核心","metrics.workers":"Workers","metrics.noWorkers":"暂无运行中的 Worker","metrics.current":"当前","metrics.uptime":"运行时长","metrics.version":"版本","sidebar.editor":"文件","editor.title":"代码编辑器","editor.loading":"加载中...","editor.loadError":"加载失败","editor.noFile":"选择一个文件开始编辑","editor.unsaved":"未保存","editor.save":"保存","editor.saveAll":"全部保存","editor.close":"关闭","editor.closeOthers":"关闭其他","editor.closeAll":"关闭全部","editor.newFile":"新建文件","editor.newFolder":"新建文件夹","editor.rename":"重命名","editor.delete":"删除","editor.refresh":"刷新","editor.emptyFolder":"空文件夹","editor.explorer":"资源管理器","editor.toggleSidebar":"切换侧边栏","editor.collapseAll":"全部折叠","editor.openFolder":"打开目录","editor.openFolderPlaceholder":"输入目录路径...","editor.parentFolder":"上级目录","editor.pin":"固定","editor.unpin":"取消固定","editor.copyPath":"复制路径","editor.copyRelativePath":"复制相对路径","editor.revealInExplorer":"在文件树中定位","editor.closeToRight":"关闭右侧","editor.closeSaved":"关闭已保存","editor.quickOpen":"快速打开文件","editor.focusExplorer":"聚焦资源管理器","editor.recentFiles":"最近文件","editor.quickOpenPlaceholder":"输入文件名以搜索...","editor.quickOpenEmpty":"没有匹配的文件","editor.quickOpenLoading":"正在加载文件列表...","editor.selected":"已选","editor.lines":"行","editor.preview":"切换到预览","editor.source":"切换到源码","sidebar.workers":"实例","workers.title":"Agent 实例管理","workers.refresh":"刷新","workers.active":"活跃 Workers","workers.empty":"没有活跃的 worker 进程","workers.daemon":"Daemon 服务","workers.daemon.running":"运行中","workers.daemon.stopped":"已停止","workers.daemon.start":"启动","workers.daemon.starting":"启动中...","workers.daemon.stop":"停止","workers.daemon.restart":"重启","workers.action.logs":"查看日志","workers.action.open":"打开","workers.action.kill":"终止","workers.action.kill.confirm":"确定要终止这个 worker 进程吗?","sidebar.logs":"日志","logs.title":"日志查看器","logs.selectWorker":"选择 Worker","logs.current":"当前","logs.search":"搜索日志...","logs.autoRefresh":"自动刷新","logs.refresh":"刷新","logs.empty":"暂无日志内容","command.btw.description":"快速提问,不打断主要 Agent 工作","command.clear.description":"开始新的对话(之前的对话仍可通过 /resume 访问)","command.context.description":"计算并显示上下文 Token 分布","command.cost.description":"显示当前会话的总费用和持续时间","command.doctor.description":"诊断和验证 CodeBuddy 的安装和设置","command.feedback.description":"打开反馈页面以报告问题或提出建议","command.gateway.description":'管理远程控制网关。子命令: "status" 查看状态, "stop" 停止网关, "token" 重新生成访问令牌, "tunnel" 启动隧道',"command.remote-control.description":"管理远程控制长连接客户端(start, stop, status, list)","command.login.description":"切换腾讯云 CodeBuddy 账号","command.logout.description":"退出 CodeBuddy Code 账号","command.plan.description":"预览当前计划文件内容","command.pr-comments.description":"获取 GitHub Pull Request 的评论","command.release-notes.description":"查看更新日志","command.review.description":"审查 Pull Request","command.skills.description":"列出可用的技能","command.todos.description":"显示当前会话的任务清单","command.reload-plugins.description":"重新加载所有插件、技能、代理、钩子和 MCP/LSP 服务器(无需重启)","command.plugin-validate.description":"验证插件目录结构和清单文件","command.init.description":"正在分析你的代码库…","command.compact.description":"清除对话历史但保留摘要在上下文中。可选: /compact [摘要指令]","command.upgrade.description":"在浏览器中打开升级页面","command.statusline.description":"设置 CodeBuddy Code 的状态栏 UI","command.security-review.description":"对当前分支的待提交变更进行安全审查","command.insights.description":"生成 AI 驱动的 CodeBuddy Code 使用模式和活动洞察","command.loop.description":"按固定间隔运行提示或斜杠命令(例如 /loop 5m /foo,默认 10m)","command.task-manager.description":"团队任务管理 - 智能任务录入、分配、追踪和分析","sidebar.changes":"变更","fileChanges.title":"变更","fileChanges.changesSection":"文件变更","fileChanges.empty":"暂无文件变更","fileChanges.showChanges":"显示文件变更","fileChanges.hideChanges":"隐藏文件变更","fileChanges.revertAll":"撤回全部","fileChanges.revertCode":"回退代码","fileChanges.revertChat":"回退对话","fileChanges.revertCodeAndChat":"回退全部","fileChanges.checkpoints":"回退点","fileChanges.noCheckpoints":"暂无回退点","filePreview.binaryNotSupported":"该文件无法在编辑器中预览","filePreview.download":"下载文件","error.viewCrashed":"页面加载出错","error.appCrashed":"应用遇到了问题","error.newChatFailed":"创建新对话失败,请重试","error.switchSessionFailed":"切换会话失败,请重试","commandPalette.placeholder":"输入命令...","commandPalette.commands":"命令","commandPalette.views":"视图","commandPalette.actions":"操作","commandPalette.noResults":"没有匹配的命令","commandPalette.newChat":"新建对话","commandPalette.toggleTheme":"切换主题","commandPalette.toggleLocale":"切换语言","commandPalette.tip":"打开命令面板","app.confirm":"确定","app.cancel":"取消","tool.toolSingular":"个工具已执行","tool.toolPlural":"个工具已执行","tool.mcpAppLoadHint":"点击加载交互式界面","keybindings.title":"快捷键","keybindings.search.placeholder":"搜索快捷键... (如 submit, ctrl+enter)","keybindings.source.default":"默认","keybindings.source.user":"自定义","keybindings.record.title":"录制快捷键","keybindings.record.hint":"请按下快捷键组合...","keybindings.record.conflict":"冲突","keybindings.action.edit":"编辑","keybindings.action.reset":"重置","keybindings.action.unbind":"解绑","keybindings.reset.all":"重置全部","keybindings.noResults":"没有匹配的快捷键","keybindings.empty":"暂无快捷键","keybindings.loading":"加载中...","keybindings.ctx.Global":"全局","keybindings.ctx.Chat":"聊天输入","keybindings.ctx.InputBox":"文本输入","keybindings.ctx.Terminal":"终端","keybindings.ctx.Autocomplete":"自动补全","keybindings.ctx.Confirmation":"确认对话框","keybindings.ctx.HistorySearch":"历史搜索","keybindings.ctx.Task":"任务运行中","keybindings.ctx.Settings":"设置","keybindings.ctx.CommandPalette":"命令面板","keybindings.ctx.Select":"选择列表","keybindings.ctx.PermissionDialog":"权限对话框","keybindings.ctx.Help":"帮助","keybindings.ctx.Plugin":"插件","keybindings.ctx.DiffDialog":"Diff 对话框","keybindings.ctx.MessageSelector":"消息选择器","keybindings.ctxDesc.Global":"在任何位置都生效","keybindings.ctxDesc.Chat":"聊天输入框获得焦点时","keybindings.ctxDesc.InputBox":"文本输入框处于活跃状态时","keybindings.ctxDesc.Terminal":"终端视图处于活跃状态时","keybindings.ctxDesc.Autocomplete":"自动补全菜单显示时","keybindings.ctxDesc.Confirmation":"确认/权限对话框显示时","keybindings.ctxDesc.HistorySearch":"搜索命令历史时 (ctrl+r)","keybindings.ctxDesc.Task":"任务/代理在前台运行时","keybindings.ctxDesc.Settings":"设置面板打开时","keybindings.ctxDesc.CommandPalette":"命令面板打开时","keybindings.ctxDesc.Select":"选择/列表组件获得焦点时","keybindings.ctxDesc.PermissionDialog":"工具权限对话框显示时","keybindings.ctxDesc.Help":"帮助页面打开时","keybindings.ctxDesc.Plugin":"插件对话框打开时","keybindings.ctxDesc.DiffDialog":"Diff 对话框打开时","keybindings.ctxDesc.MessageSelector":"消息选择器 (rewind) 打开时","keybindings.act.app:interrupt":"中断","keybindings.act.app:exit":"退出","keybindings.act.app:redraw":"刷新屏幕","keybindings.act.app:toggleTodos":"切换待办事项","keybindings.act.app:toggleTranscript":"切换转录","keybindings.act.app:toggleSidebar":"切换侧边栏","keybindings.act.app:toggleTerminal":"切换终端","keybindings.act.app:commandPalette":"命令面板","keybindings.act.app:newChat":"新对话","keybindings.act.app:settings":"设置","keybindings.act.app:focusInput":"聚焦输入框","keybindings.act.app:keybindings":"快捷键设置","keybindings.act.history:search":"搜索历史","keybindings.act.history:previous":"上一条历史","keybindings.act.history:next":"下一条历史","keybindings.act.history:open":"打开历史","keybindings.act.chat:cancel":"取消","keybindings.act.chat:submit":"发送","keybindings.act.chat:newline":"换行","keybindings.act.chat:killAgents":"终止代理","keybindings.act.chat:cycleMode":"切换模式","keybindings.act.chat:modelPicker":"选择模型","keybindings.act.chat:thinkingToggle":"切换思考","keybindings.act.chat:undo":"撤销","keybindings.act.chat:externalEditor":"外部编辑器","keybindings.act.chat:stash":"暂存","keybindings.act.chat:imagePaste":"粘贴图片","keybindings.act.autocomplete:accept":"接受补全","keybindings.act.autocomplete:dismiss":"关闭补全","keybindings.act.autocomplete:previous":"上一项","keybindings.act.autocomplete:next":"下一项","keybindings.act.confirm:yes":"确认","keybindings.act.confirm:no":"取消","keybindings.act.confirm:previous":"上一项","keybindings.act.confirm:next":"下一项","keybindings.act.confirm:toggle":"切换选中","keybindings.act.confirm:toggleExplanation":"切换说明","keybindings.act.task:background":"后台运行","keybindings.act.historySearch:next":"下一条","keybindings.act.historySearch:accept":"接受","keybindings.act.historySearch:cancel":"取消","keybindings.act.historySearch:execute":"执行","keybindings.act.settings:close":"关闭设置","keybindings.act.settings:search":"搜索设置","keybindings.act.select:previous":"上一项","keybindings.act.select:next":"下一项","keybindings.act.select:accept":"选择","keybindings.act.select:cancel":"取消","keybindings.act.commandPalette:close":"关闭面板","keybindings.act.commandPalette:execute":"执行命令","keybindings.act.commandPalette:previous":"上一项","keybindings.act.commandPalette:next":"下一项","keybindings.act.permission:toggleDebug":"切换调试","keybindings.act.diff:dismiss":"关闭 Diff","keybindings.act.diff:previousFile":"上一个文件","keybindings.act.diff:nextFile":"下一个文件","keybindings.act.diff:viewDetails":"查看详情","keybindings.act.plugin:toggle":"切换插件","keybindings.act.plugin:install":"安装插件","keybindings.act.help:dismiss":"关闭帮助","keybindings.act.transcript:exit":"退出转录","keybindings.act.transcript:toggleShowAll":"显示全部","keybindings.act.messageSelector:up":"向上","keybindings.act.messageSelector:down":"向下","keybindings.act.messageSelector:top":"到顶部","keybindings.act.messageSelector:bottom":"到底部","keybindings.act.messageSelector:select":"选择","common.close":"关闭","changes.revert":"还原","changes.revertDirectory":"还原目录","message.clickToEnlarge":"点击放大","channel.botIdPlaceholder":"输入 Bot ID","channel.secretPlaceholder":"输入 Secret","filePreview.zoomOut":"缩小","filePreview.zoomIn":"放大","filePreview.fitToWindow":"适应窗口","filePreview.actualSize":"实际大小 (1:1)","filePreview.pdfPreview":"PDF 预览","goal.status.usage":`用法:/goal <条件>
642
- 示例:/goal 所有测试通过`,"goal.status.tooLong":"目标条件长度上限 {max} 字符(当前 {actual})","goal.status.hooksDisabled":"/goal 在 Hooks 被禁用时不可用(settings 中关闭了 disableAllHooks 或 allowManagedHooksOnly)。","goal.status.set":"已设置目标:{condition}","goal.status.setReplaced":"替换目标:{prev} → {condition}","goal.status.cleared":"已清除目标:{prev}","goal.status.noGoal":"当前无目标","goal.status.active":"当前目标:{condition}","goal.progress.title":"目标尚未达成… 继续","goal.progress.expand":"点击展开","goal.progress.condition":"目标","goal.progress.reason":"原因","goal.recap.active":"当前活跃目标","goal.recap.achieved":"目标已达成","goal.recap.impossible":"目标无法达成","goal.recap.empty.title":"暂未设置目标","goal.recap.empty.hint":"使用 /goal <条件> 设置一个会话级停止条件。","goal.recap.empty.example":"示例:/goal 所有测试通过","goal.recap.footer.setAnother":"/goal <条件>","goal.recap.footer.toSetAnother":" 设置新目标 · ","goal.recap.footer.escDismiss":"关闭","goal.recap.stats.turn":"轮","goal.recap.stats.turns":"轮","goal.recap.stats.token":"token","goal.recap.stats.tokens":"tokens"},en:{"app.connecting":"Connecting to CodeBuddy Code...","app.connectFailed":"Connection failed","app.retry":"Retry","app.pwa.newVersion":"A new Web UI version is available","app.pwa.reloadNow":"Reload now","app.pwa.reloadLater":"Later","app.pwa.reloadedAfterIdle":"Updated to new version","chat.empty.title":"CodeBuddy Code","chat.empty.subtitle":"How can I help you today?","chat.empty.slogan":"Claw Your Ideas . Into Reality","chat.empty.tag.slides":"Slide Generation","chat.empty.tag.research":"Deep Research","chat.empty.tag.docs":"Document Processing","chat.empty.tag.data":"Data Analysis","chat.thinking":"Thinking","chat.waitingPermission":"Waiting for permission","chat.waitingUser":"Waiting for user","chat.error":"Error","chat.sessionEnded":"Session ended","chat.stopped":"Stopped","chat.scrollToLatest":"Scroll to latest","chat.error.refusal":"The agent refused to continue execution. This may be due to content policy restrictions or other limitations.","chat.error.network":"Network connection failed or the service is temporarily unavailable. Please try again later.","chat.error.auth":"Authentication failed or insufficient permissions. Please sign in again and retry.","chat.error.quota":"Quota limit reached or too many requests. Please try again later.","chat.error.modelService":"The model service returned an error. Please retry or try again later.","chat.error.cancelled":"Request was cancelled. This can happen after system sleep or network interruption. Please try again.","chat.error.maxTokens":"Response was truncated due to reaching the maximum token limit. You may continue the conversation or ask for a more concise response.","chat.error.maxTurnRequests":"The maximum number of model requests per turn has been exceeded. You may send a new message to continue.","chat.newChat":"New Chat","chat.disclaimer":"Answers generated by AI are for reference only","chat.compacted":"Conversation compacted","chat.compacting":"Compacting conversation...","chat.compactCancelled":"Compaction cancelled","phase.preparing":"Preparing","phase.modelRequesting":"Waiting for model","phase.modelStreaming":"Streaming","phase.modelDone":"Processing","phase.toolExecuting":"Running tool","phase.modelStreamingTool":"Writing","phase.retrying":"Retrying","progress.compacting":"Compacting context","input.placeholder":"Start from an idea...","input.placeholderRunning":"Messages will be queued...","input.placeholderPending":"Please handle the permission request first...","input.send":"Send (Enter)","input.stop":"Stop","input.thinking":"Thinking","input.deepThinking":"Deep Thinking","input.promptFailed":"Prompt failed","input.sendQueued":"Send queued (Enter)","input.dropHint":"Drop files here","input.addImage":"Add image","input.addFile":"Add file","input.imageTooLarge":"Image must be under 10MB","input.tooManyImages":"Up to 5 images allowed","input.fileTooLarge":"File must be under 1MB","input.tooManyFiles":"Up to 10 files allowed","input.menu.image":"Image","input.menu.file":"File","input.menu.mode":"Mode","input.menu.model":"Model","input.modeSelector":"Mode","input.modelSelector":"Model","input.deepThinkingDesc":"Let the model reason more deeply before answering","input.modelHeader":"Model","mode.default":"Default","mode.default.desc":"Prompts for permission on first use of each tool","mode.acceptEdits":"Accept Edits","mode.acceptEdits.desc":"Automatically accepts file edit permissions for the session","mode.plan":"Plan","mode.plan.desc":"Can analyze but not modify files or execute commands","mode.bypassPermissions":"Bypass Permissions","mode.bypassPermissions.desc":"Skips all permission prompts","input.newline":"New line","input.contextMenu.newline":"New line","input.contextMenu.send":"Send","queue.more":" more queued","status.running":"Running","tool.writeFile":"Write file","tool.readFile":"Read file","tool.execute":"Execute","tool.searchFiles":"Search files","tool.searchContent":"Search content","tool.fetchWeb":"Fetch web","tool.searchWeb":"Search web","tool.defaultName":"Tool","tool.moreItems":"... {count} more","interruption.title":"Permission Required","interruption.tool":"Tool","interruption.allow":"Allow","interruption.allowAll":"Allow All","interruption.deny":"Deny","interruption.approved":"Approved","interruption.denied":"Denied","interruption.edits":"{count} edits","interruption.yes":"Yes","interruption.keepPlanning":"No, keep planning","interruption.exitPlanMode":"Exit plan mode","interruption.readyToCode":"Ready to code?","theme.light":"Light","theme.dark":"Dark","theme.system":"System","locale.zh":"Chinese","locale.en":"English","locale.system":"System","sidebar.nav.plugins":"Plugins","sidebar.nav.tasks":"Tasks","sidebar.search.placeholder":"Search...","sidebar.chatHistory":"Chat History","sidebar.workspace":"Workspace","sidebar.connectionStatus":"Connection Status","sidebar.status":"Status","sidebar.sessionId":"Session ID","sidebar.notConnected":"Not connected","sidebar.modelSelection":"Model Selection","sidebar.noModels":"No models available","sidebar.environment":"Environment","sidebar.cwd":"Working Directory","sidebar.os":"OS","sidebar.nodeVersion":"Node.js","sidebar.gatewayMode":"Gateway Mode","sidebar.tunnelUrl":"Tunnel URL","sidebar.clickToCopy":"Click to copy","sidebar.copied":"Copied","sidebar.permissionMode":"Permission Mode","sidebar.noModes":"No modes available","sidebar.preferences":"Preferences","sidebar.keybindings":"Keybindings","sidebar.group.workspace":"Workspace","sidebar.group.observability":"Observability","sidebar.group.preferences":"Preferences","bottomSheet.attachments":"Attach","bottomSheet.navigation":"Navigate","sidebar.theme":"Theme","sidebar.language":"Language","sidebar.user":"User","sidebar.authMethod":"Password","sidebar.noAuth":"No Auth","sidebar.version":"Remote UI v1.0","connection.connected":"Connected","connection.connecting":"Connecting","connection.disconnected":"Disconnected","connection.error":"Error","message.copyToClipboard":"Copy to clipboard","message.copied":"Copied","message.copy":"Copy","message.assistantName":"CodeBuddy Code","thinking.title":"Thinking Process","thinking.thinking":"Thinking","thinking.done":"Thought for","thinking.seconds":" {n}s","thinking.expand":"Expand","thinking.collapse":"Collapse","diff.noChanges":"No changes","login.title":"CodeBuddy Remote Control","login.subtitle":"Enter the password shown in your terminal","login.placeholder":"Password","login.submit":"Login","login.error.incorrect":"Incorrect password","login.error.rateLimit":"Too many login attempts. Please try again later.","login.error.required":"Password is required","login.hint.password":"Tip: The password is displayed when the server starts.","login.hint.urlAuth":"You can also use <code>?password=xxx</code> to login automatically.","login.hint.disable":'Or set <code>gateway.auth: "none"</code> in <code>settings.json</code> under the CodeBuddy config directory (defaults to <code>~/.codebuddy</code>; override via the <code>CODEBUDDY_CONFIG_DIR</code> environment variable) to disable.',"login.slogan":"Claw Your Ideas . Into Reality","login.tagline":"Triggered Anywhere, Completed Locally.","login.privacy":"Privacy Policy","login.terms":"Terms of Service","sidebar.interactionMode":"Interaction Mode","sidebar.chatMode":"Chat","sidebar.terminalMode":"Terminal","sidebar.canvas":"Canvas","canvas.title":"Infinite Canvas","canvas.addTerminal":"Add Terminal","canvas.zoomIn":"Zoom In","canvas.zoomOut":"Zoom Out","canvas.fitView":"Fit View","canvas.resetView":"Reset View","canvas.empty":"Click the + button in the toolbar to add a terminal","canvas.openStandalone":"Open canvas in new window","canvas.tileMenu.close":"Close","canvas.tileMenu.duplicate":"Duplicate Terminal","canvas.tileMenu.maximize":"Maximize","canvas.tileMenu.minimize":"Minimize","canvas.tileMenu.restore":"Restore","canvas.tileMenu.openStandalone":"Open in new window","canvas.standalone.missingPaneId":"Missing pane ID","canvas.defaultTitle":"Terminal","terminal.connecting":"Connecting terminal...","terminal.title":"Terminal","terminal.disconnected":"Terminal disconnected","terminal.error":"Terminal connection failed","terminal.reconnect":"Reconnect","terminal.splitHorizontal":"Split Right","terminal.splitVertical":"Split Down","terminal.closePane":"Close Terminal","terminal.maxPanes":"Max panes reached","sidebar.instances":"Instances","sidebar.activeInstances":"active instances","sidebar.manageInstances":"Manage Instances","sidebar.remoteControl":"Channels","instance.title":"Instance List","instance.switch":"Instance","instance.switchTitle":"Switch Instance","instance.current":"Current","instance.manual":"Manual","instance.switchTo":"Switch to this instance","instance.manage":"Manage Instances","instance.managerTitle":"Instance Manager","instance.addInstance":"Add Instance","instance.name":"Instance Name","instance.namePlaceholder":"Custom instance name (optional, defaults to directory name)","instance.url":"Instance URL","instance.urlPlaceholder":"https://example.trycloudflare.com","instance.password":"Password","instance.optional":"Optional","instance.passwordPlaceholder":"Access password","instance.cancel":"Cancel","instance.add":"Add","instance.remove":"Remove this instance","instance.noInstances":"No other instances","instance.noInstancesHint":"Start more CodeBuddy Code instances or add remote instances manually","instance.cwd":"Working Directory","instance.topic":"Topic","instance.startedAt":"Started at","instance.local":"Local","instance.tunnel":"Tunnel","instance.uptime.days":"d ago","instance.uptime.hours":"h ago","instance.uptime.minutes":"m ago","instance.uptime.justNow":"Just now","instance.addError":"Failed to add instance","instance.removeError":"Failed to remove instance","instance.copyUrl":"Copy URL","instance.copied":"Copied","instance.subtitle":"Manage and switch between instances","instance.refresh":"Refresh","instance.refreshed":"Refreshed","instance.loading":"Loading instances...","instance.error":"Failed to load instances","instance.retry":"Retry","question.multiple":"multiple","question.customAnswer":"Or type a custom answer...","question.reviewAnswers":"Review answers","question.singleTitle":"Question","question.titleWithCount":"Questions ({count})","question.reviewTab":"Review","question.next":"Next","question.submit":"Submit","question.cancel":"Cancel","question.answered":"Answered","question.cancelled":"Question cancelled","todo.title":"Tasks","todo.executing":"Task {n} executing","todo.untitled":"Untitled","history.title":"Sessions","history.description":"Click a session to switch to that conversation","history.noData":"No sessions","history.noDataHint":"Start a new conversation","history.backToChat":"Back to Chat","history.loading":"Loading...","history.loadError":"Failed to load","history.retry":"Retry","history.current":"Current","history.messages":"{count} messages","history.delete":"Delete","history.deleteConfirm":"Are you sure you want to delete this session?","history.deleteCancel":"Cancel","history.deleteOk":"Delete","history.rename":"Rename","history.renameTitle":"Rename Session","history.renamePlaceholder":"Enter new name","history.renameCancel":"Cancel","history.renameOk":"OK","history.cannotDeleteCurrent":"Cannot delete current session","settings.title":"Preferences","settings.appearance":"Appearance","settings.model":"Model Selection","settings.mode":"Permission Mode","settings.systemInfo":"System Info","settings.backToChat":"Back to Chat","settings.tab.user":"User","settings.tab.project":"Project","settings.group.modelAndReasoning":"Model & Reasoning","settings.group.behavior":"Behavior","settings.group.memory":"Memory","settings.group.language":"Language","settings.group.advanced":"Advanced","settings.group.sandbox":"Security Sandbox","settings.item.model":"Default Model","settings.item.model.desc":"Set the default AI model","settings.item.reasoningEffort":"Reasoning Effort","settings.item.reasoningEffort.desc":"Control model reasoning depth","settings.item.alwaysThinkingEnabled":"Always Enable Thinking","settings.item.autoCompactEnabled":"Auto Compact Context","settings.item.includeCoAuthoredBy":"Include Co-authored-by","settings.item.fileCheckpointingEnabled":"File Checkpointing","settings.item.fileCheckpointingEnabled.desc":"Enable file version rollback","settings.item.promptSuggestionEnabled":"Prompt Suggestions","settings.item.ignoreGitIgnore":"Ignore .gitignore","settings.item.ignoreGitIgnore.desc":"Ignore .gitignore rules when searching","settings.item.deferToolLoading":"Defer Tool Loading","settings.item.hookOutputCollapsed":"Collapse Hook Output","settings.item.memory.enabled":"Enable Memory","settings.item.memory.autoMemoryEnabled":"Auto Memory","settings.item.memory.autoMemoryEnabled.desc":"Auto-save important info to memory","settings.item.language":"Response Language","settings.item.language.desc":"Language for AI responses","settings.item.cleanupPeriodDays":"Chat History Retention (days)","settings.item.imageHistoryRetainRounds":"Image Retention Rounds","settings.item.imageHistoryRetainRounds.desc":"Rounds to retain images in history","settings.item.env":"Environment Variables","settings.item.env.desc":"Variables applied to each session (JSON)","settings.item.sandbox.enabled":"Enable Sandbox","settings.item.sandbox.enabled.desc":"Run Bash commands in sandbox, restrict file and network access","settings.item.sandbox.autoAllowBashIfSandboxed":"Auto-approve in Sandbox","settings.item.sandbox.autoAllowBashIfSandboxed.desc":"Auto-approve commands when running in sandbox","settings.loading":"Loading...","settings.saved":"Saved","settings.saveFailed":"Save failed","settings.notSet":"Not set","settings.default":"Default","settings.reset":"Reset","settings.noProjectSettings":"No project-level settings available","settings.effort.minimal":"Minimal","settings.effort.low":"Low","settings.effort.medium":"Medium","settings.effort.high":"High","settings.effort.xhigh":"Extra High","settings.effort.max":"Max","page.title":"CodeBuddy Code","tool.processExited":"[Process exited]","tool.itemsCount":"{count} items","tool.showAllItems":"Show all {count} items","tool.moreLinesCount":"... {count} more lines","tool.generatedImage":"Generated image","tool.editedImage":"Edited image","tool.imageGen":"ImageGen","tool.imageEdit":"ImageEdit","tool.toolSearch":"ToolSearch","tool.teamCreate":"TeamCreate","tool.teamDelete":"TeamDelete","tool.taskCreate":"TaskCreate","tool.taskUpdate":"TaskUpdate","tool.taskList":"TaskList","tool.taskGet":"TaskGet","tool.sendMessage":"SendMessage","tool.shutdown":"Shutdown","tool.taskCompleted":"Task completed","tool.shutdownRejected":"Shutdown rejected","tool.planResponse":"Plan response","tool.approved":"approved","tool.rejected":"rejected","tool.userRejectedResult":"User rejected this tool use","tool.webSearch":"WebSearch","tool.webFetch":"WebFetch","tool.saveMemory":"SaveMemory","tool.askUserQuestion":"AskUserQuestion","tool.enterPlanMode":"Enter Plan Mode","tool.exitPlanMode":"Exit Plan Mode","tool.allowedActions":"Allowed actions:","tool.skill":"Skill","tool.agent":"Agent","tool.failed":"failed","tool.completed":"completed","tool.toolsCount":"{count} tools","tool.background":"background","tool.permissionsCount":"{count} permissions","terminal.unknownError":"Unknown error","terminal.processExited":"[Process exited]","terminal.connectionLost":"Connection lost","terminal.wsConnectionFailed":"WebSocket connection failed","terminal.createSessionFailed":"Failed to create terminal session","terminal.reconnectFailed":"Reconnect failed","team.title":"Team","team.activeCount":"{count} active","team.doneCount":"{count} done","team.waitingForTeammates":"Waiting for {count} teammate{s}…","team.backToMain":"Back to main chat","team.loadingHistory":"Loading conversation…","team.noHistory":"No conversation history yet","team.agentRunning":"Agent is running…","team.delivered":"Delivered","team.showLess":"Show less","team.moreLines":"… ({count} more lines)","team.tools":"{count} tools","team.tokens":"{count} tokens","instance.tunnelMode":"Tunnel","instance.localMode":"Local","workspace.searchPlaceholder":"Search directories...","workspace.switch":"Switch","workspace.switchHere":"Switch to this directory","workspace.switching":"Switching...","workspace.noResults":"No matching directories","workspace.emptyDir":"This directory is empty","workspace.pathPlaceholder":"Enter path or directory name...","workspace.selectDir":"Create bot in this directory","workspace.filterPlaceholder":"Filter subdirectories...","workspace.recent.title":"Recent Workspaces","workspace.recent.daysAgo":"d ago","workspace.recent.hoursAgo":"h ago","workspace.recent.minutesAgo":"m ago","workspace.recent.justNow":"Just now","workspace.recent.remove":"Remove","workspace.browseTitle":"Browse Workspaces","workspace.recentWorkspaces":"Recent Workspaces","workspace.createNew":"Create New Bot","workspace.browseDir":"Browse Directory","workspace.instanceLocal":"Local","workspace.instanceTunnel":"Tunnel","workspace.instanceCurrent":"Current","workspace.switchInstance":"Switch","workspace.switchingInstance":"Switching...","workspace.switchingWithGateway":"Preparing to switch...","workspace.instanceStarted":"Started","workspace.noWorkspaces":"No active workspaces","workspace.noWorkspacesHint":"Browse directories to create a new bot","workspace.instanceCount":"{count} bots","question.multiLabel":"multi","tasks.title":"Recommended Templates","tasks.subtitle":"Select a template to create a scheduled task","tasks.loading":"Loading recommended templates...","tasks.error":"Failed to load templates","tasks.retry":"Retry","tasks.refresh":"Refresh","tasks.refreshed":"Refreshed","tasks.empty":"No templates available","tasks.interval":"Every {value}","tasks.interval.1d":"Daily","tasks.interval.2d":"Every 2 days","tasks.interval.3d":"Every 3 days","tasks.interval.1w":"Weekly","tasks.interval.2w":"Every 2 weeks","tasks.interval.1m":"Monthly","scheduled.title":"Scheduled Tasks","scheduled.subtitle":"Active scheduled tasks in the current session","scheduled.loading":"Loading...","scheduled.empty":"No scheduled tasks","scheduled.emptyHint":"Use /loop or CronCreate in chat to create one","scheduled.create":"Create Task","scheduled.creating":"Creating...","scheduled.delete":"Delete","scheduled.cron":"Cron Expression","scheduled.prompt":"Prompt","scheduled.promptPlaceholder":"Prompt to execute on each fire...","scheduled.recurring":"Recurring","scheduled.oneShot":"One-shot","scheduled.durable":"Durable","scheduled.sessionOnly":"Session-only","scheduled.lastFired":"Last fired","plugins.title":"Plugins","plugins.installedPlugins":"Installed Plugins","plugins.browseMarketplace":"Browse Marketplace","plugins.marketplaces":"Marketplaces","plugins.enabled":"Enabled","plugins.disabled":"Disabled","plugins.enable":"Enable","plugins.disable":"Disable","plugins.uninstall":"Uninstall","plugins.install":"Install","plugins.confirmUninstall":"Are you sure you want to uninstall this plugin?","plugins.marketplace":"Marketplace","plugins.addMarketplace":"Add Marketplace","plugins.removeMarketplace":"Remove","plugins.confirmRemoveMarketplace":"Are you sure you want to remove this marketplace?","plugins.noPlugins":"No plugins installed","plugins.noPluginsHint":"Install plugins from a marketplace to extend functionality","plugins.noMarketplaces":"No marketplaces configured","plugins.noMarketplacesHint":"Add a plugin marketplace to browse and install plugins","plugins.selectMarketplace":"Select Marketplace","plugins.selectMarketplaceHint":"Select a marketplace to browse available plugins","plugins.marketplaceNotFound":"Marketplace not found","plugins.noAvailablePlugins":"No available plugins in this marketplace","plugins.noAvailablePluginsHint":"Try adding other marketplaces or check back later","plugins.installed":"Installed","plugins.browsingMarketplace":"Loading...","plugins.loading":"Loading...","plugins.error":"Failed to load plugins","plugins.retry":"Retry","plugins.sourcePlaceholder":"Marketplace URL (Git URL or local path)","plugins.namePlaceholder":"Marketplace name (optional)","plugins.cancel":"Cancel","plugins.add":"Add","plugins.version":"Version","plugins.operationFailed":"Operation failed","plugins.searchPlaceholder":"Search plugins...","plugins.allMarketplaces":"All Marketplaces","plugins.noSearchResults":"No matching plugins found","plugins.totalCount":"plugins","plugins.refresh":"Refresh","plugins.installedLabel":"Installed","plugins.category":"Category","plugins.author":"Author","plugins.license":"License","plugins.homepage":"Homepage","plugins.repository":"Repository","plugins.source":"Source","plugins.keywords":"Keywords","plugins.features":"Features","plugins.scope":"Scope","plugins.scope.user":"User","plugins.scope.project":"Project","plugins.scope.project-local":"Local","plugins.installScope.user":"Install for you (user scope)","plugins.installScope.project":"Install for all collaborators (project scope)","plugins.installScope.local":"Install for you, in this repo only (local scope)","plugins.policyCannotRemove":"Cannot be uninstalled","plugins.policyCannotSwitchoff":"Cannot be disabled","plugins.policyCannotEdit":"Cannot be edited","channel.from":"From","channel.group":"Group","channel.replyTo":"Reply to {source}","channel.wechat":"WeChat","channel.wecom":"WeCom","channel.wecomBot":"WeCom Bot","remoteControl.title":"Remote Control","remoteControl.subtitle":"Manage channel connections","remoteControl.connectedChannels":"Connected Channels","remoteControl.noChannels":"No channels connected","remoteControl.noChannelsHint":"Add a WeChat or WeCom channel, or install more from the marketplace","remoteControl.addWeChat":"Add WeChat Bot","remoteControl.addWeCom":"Add WeCom Bot","remoteControl.connect":"Connect","remoteControl.disconnect":"Disconnect","remoteControl.delete":"Delete","remoteControl.add":"Add","remoteControl.connected":"Connected","remoteControl.disconnected":"Disconnected","remoteControl.connecting":"Connecting...","remoteControl.installMore":"Install More Channels","remoteControl.installMoreHint":"Browse the plugin marketplace for third-party channel plugins","remoteControl.browseMarketplace":"Browse Marketplace","remoteControl.builtIn":"Built-in","remoteControl.plugin":"Plugin","remoteControl.rebind":"Rebind","remoteControl.unbind":"Unbind","remoteControl.bot":" Bot","remoteControl.default":"Default ","remoteControl.next":"Next","remoteControl.cancel":"Cancel","remoteControl.wecomBotIdHint":"From: WeCom Admin → Apps → AI Assistant","remoteControl.wecomSecretHint":"Enter Secret and press Enter or click Connect","remoteControl.fetchingQr":"Fetching QR code...","remoteControl.scanQr":"Scan QR code with WeChat","sidebar.docs":"Docs","docs.title":"Documentation","docs.search.placeholder":"Search docs...","docs.search.noResults":"No matching documents found","docs.search.resultsCount":"{count} results","docs.loading":"Loading...","docs.loadError":"Failed to load document","docs.notFound":"Document not found","docs.apiReference":"API Reference","docs.toc":"On this page","docs.retry":"Retry","docs.backToList":"Back to docs","docs.expandAll":"Expand all","docs.collapseAll":"Collapse all","docs.openStandalone":"Open in new window","sidebar.stats":"Statistics","stats.title":"Statistics","stats.loading":"Loading statistics...","stats.refresh":"Refresh","stats.noData":"No statistics available","stats.tab.overview":"Overview","stats.tab.models":"Models","stats.tab.tools":"Tools","stats.sessions":"Sessions","stats.messages":"Messages","stats.activeDays":"Active Days","stats.currentStreak":"Current Streak","stats.longestStreak":"Longest Streak","stats.peakHour":"Peak Hour","stats.longestSession":"Longest Session","stats.favoriteModel":"Favorite Model","stats.totalTokens":"Total Tokens","stats.timeRange":"Stats from the last {days} days","stats.heatmap.less":"Less","stats.heatmap.more":"More","stats.days":"days","stats.tokensPerDay":"Tokens per Day","stats.allModels":"All Models","stats.input":"Input","stats.output":"Output","stats.cacheRead":"Cache Read","stats.cacheHitRate":"Cache Hit Rate","stats.cost":"Cost","stats.topTools":"Top Tools","stats.session.title":"Current Session","stats.session.apiDuration":"API Duration","stats.session.wallTime":"Wall Time","stats.session.linesAdded":"Lines Added","stats.session.linesDeleted":"Lines Deleted","stats.session.tokens":"Tokens","stats.na":"N/A","stats.heatmap.messages":"messages","stats.funFact.moreTokens":"You've used ~{times}x more tokens than {book}","stats.funFact.sameTokens":"You've used the same number of tokens as {book}","stats.funFact.longerSession":"Your longest session is ~{times}x longer than {activity}","sidebar.traces":"Traces","traces.title":"Traces","traces.loading":"Loading...","traces.refresh":"Refresh","traces.clear":"Clear","traces.clearConfirm":"Clear all trace data?","traces.noData":"No trace data yet. Send a message and traces will be collected automatically.","traces.selectWorker":"Select Worker","traces.current":"current","traces.spanCount":"{count} spans","traces.duration":"Duration","traces.status.ok":"OK","traces.status.error":"Error","traces.status.running":"Running","traces.status.cancelled":"Cancelled","traces.bottleneck":"Bottleneck","traces.bottleneckTip":"Slowest span, {pct}% of total","traces.spanDetail":"Span Detail","traces.spanDetail.type":"Type","traces.spanDetail.duration":"Duration","traces.spanDetail.model":"Model","traces.spanDetail.tokens":"Tokens","traces.spanDetail.input":"Input","traces.spanDetail.output":"Output","traces.spanDetail.error":"Error","traces.spanDetail.cancelReason":"Cancel reason","traces.spanDetail.attributes":"Attributes","traces.legend.agent":"Agent","traces.legend.generation":"Generation","traces.legend.function":"Function","traces.legend.handoff":"Handoff","traces.legend.guardrail":"Guardrail","traces.back":"Back","traces.tab.timeline":"Timeline","traces.tab.tree":"Tree","traces.tab.flame":"Flame","traces.tab.graph":"Graph","traces.expandAll":"Expand All","traces.collapseAll":"Collapse All","traces.search":"Search spans...","traces.selfTime":"Self Time","traces.spanDetail.overview":"Overview","traces.spanDetail.io":"Input/Output","traces.noSpans":"No spans","traces.noSpansFiltered":"No spans match the current filter.","traces.clearFilter":"Clear filter","traces.auto":"auto","traces.auxiliaryCount":"{count} auxiliary traces (memory, title, etc.)","traces.noIO":"No input/output data","traces.noAttrs":"No attributes","traces.io.expand":"Expand","traces.io.collapse":"Collapse","traces.io.messages":"Messages","traces.io.less":"Less","traces.io.moreChars":"+{count} chars","traces.fit":"Fit","traces.allSessions":"All sessions","traces.allInstances":"All instances","traces.llmCalls":"{count} LLM","traces.errors":"errors","traces.noErrors":"No failed traces","traces.errorBanner":"{count} failed trace(s) detected","traces.errorBannerCta":"Show only errors →","traces.errorSummaryTitle":"{count} error(s) in this trace","traces.jumpToFirstError":"Jump to first error span","traces.copyError":"Copy","traces.onlyErrors":"Errors only","traces.filter.all":"All","traces.filter.error":"Error","traces.filter.running":"Running","traces.filter.cancelled":"Cancelled","traces.filter.ok":"OK","sidebar.metrics":"Metrics","metrics.title":"System Metrics","metrics.loading":"Loading metrics...","metrics.refresh":"Refresh","metrics.cpu":"CPU","metrics.memory":"Memory","metrics.disk":"Disk","metrics.cores":"cores","metrics.workers":"Workers","metrics.noWorkers":"No running workers","metrics.current":"Current","metrics.uptime":"Uptime","metrics.version":"Version","sidebar.editor":"Files","editor.title":"Code Editor","editor.loading":"Loading...","editor.loadError":"Failed to load","editor.noFile":"Select a file to start editing","editor.unsaved":"Unsaved","editor.save":"Save","editor.saveAll":"Save All","editor.close":"Close","editor.closeOthers":"Close Others","editor.closeAll":"Close All","editor.newFile":"New File","editor.newFolder":"New Folder","editor.rename":"Rename","editor.delete":"Delete","editor.refresh":"Refresh","editor.emptyFolder":"Empty folder","editor.explorer":"EXPLORER","editor.toggleSidebar":"Toggle Sidebar","editor.collapseAll":"Collapse All","editor.openFolder":"Open Folder","editor.openFolderPlaceholder":"Enter directory path...","editor.parentFolder":"Parent Folder","editor.pin":"Pin","editor.unpin":"Unpin","editor.copyPath":"Copy Path","editor.copyRelativePath":"Copy Relative Path","editor.revealInExplorer":"Reveal in Explorer","editor.closeToRight":"Close to the Right","editor.closeSaved":"Close Saved","editor.quickOpen":"Quick Open File","editor.focusExplorer":"Focus Explorer","editor.recentFiles":"Recent Files","editor.quickOpenPlaceholder":"Type filename to search...","editor.quickOpenEmpty":"No matching files","editor.quickOpenLoading":"Loading file list...","editor.selected":"selected","editor.lines":"lines","editor.preview":"Switch to Preview","editor.source":"Switch to Source","sidebar.workers":"Workers","workers.title":"Worker Processes","workers.refresh":"Refresh","workers.active":"Active Workers","workers.empty":"No active worker processes","workers.daemon":"Daemon","workers.daemon.running":"Running","workers.daemon.stopped":"Stopped","workers.daemon.start":"Start","workers.daemon.starting":"Starting...","workers.daemon.stop":"Stop","workers.daemon.restart":"Restart","workers.action.logs":"Logs","workers.action.open":"Open","workers.action.kill":"Kill","workers.action.kill.confirm":"Are you sure you want to kill this worker process?","sidebar.logs":"Logs","logs.title":"Log Viewer","logs.selectWorker":"Select Worker","logs.current":"current","logs.search":"Search logs...","logs.autoRefresh":"Auto Refresh","logs.refresh":"Refresh","logs.empty":"No log content","command.btw.description":"Ask a quick side question without interrupting the main Agent work","command.clear.description":"Start a fresh conversation (previous chats remain accessible via /resume)","command.context.description":"Calculate and display context token distribution","command.cost.description":"Show the total cost and duration of the current session","command.doctor.description":"Diagnose and verify your CodeBuddy installation and settings","command.feedback.description":"Open the issue feedback page to report bugs or suggest features","command.gateway.description":'Manage the remote control gateway. Subcommands: "status" to show current status, "stop" to stop the gateway, "token" to regenerate access token, "tunnel" to start with tunnel',"command.remote-control.description":"Manage remote control long connection clients (start, stop, status, list)","command.login.description":"Switch Tencent Cloud CodeBuddy accounts","command.logout.description":"Sign out from your CodeBuddy Code account","command.plan.description":"Preview the current plan file content","command.pr-comments.description":"Get comments from a GitHub pull request","command.release-notes.description":"View release notes","command.review.description":"Review a pull request","command.skills.description":"List available skills","command.todos.description":"Display the current session's todo list","command.reload-plugins.description":"Reload all plugins, skills, agents, hooks, and MCP/LSP servers without restarting","command.plugin-validate.description":"Validate a plugin directory structure and manifest","command.init.description":"Analyzing your codebase…","command.compact.description":"Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]","command.upgrade.description":"Open upgrade page in browser","command.statusline.description":"Set up Codebuddy Code's status line UI","command.security-review.description":"Complete a security review of the pending changes on the current branch","command.insights.description":"Generate AI-powered insights about your CodeBuddy Code usage patterns and activity","command.loop.description":"Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)","command.task-manager.description":"Team task management - Smart task entry, assignment, tracking and analysis","sidebar.changes":"Changes","fileChanges.title":"Changes","fileChanges.changesSection":"FILE CHANGES","fileChanges.empty":"No file changes","fileChanges.showChanges":"Show file changes","fileChanges.hideChanges":"Hide file changes","fileChanges.revertAll":"Revert all","fileChanges.revertCode":"Revert code","fileChanges.revertChat":"Revert chat","fileChanges.revertCodeAndChat":"Revert all","fileChanges.checkpoints":"Checkpoints","fileChanges.noCheckpoints":"No checkpoints","filePreview.binaryNotSupported":"This file cannot be previewed in the editor","filePreview.download":"Download","error.viewCrashed":"This view encountered an error","error.appCrashed":"Something went wrong","error.newChatFailed":"Failed to create new chat, please try again","error.switchSessionFailed":"Failed to switch session, please try again","commandPalette.placeholder":"Type a command...","commandPalette.commands":"Commands","commandPalette.views":"Views","commandPalette.actions":"Actions","commandPalette.noResults":"No matching commands","commandPalette.newChat":"New Chat","commandPalette.toggleTheme":"Toggle Theme","commandPalette.toggleLocale":"Toggle Language","commandPalette.tip":"Open command palette","app.confirm":"Confirm","app.cancel":"Cancel","tool.toolSingular":"tool executed","tool.toolPlural":"tools executed","tool.mcpAppLoadHint":"Click to load interactive UI","keybindings.title":"Keybindings","keybindings.search.placeholder":"Search keybindings... (e.g. submit, ctrl+enter)","keybindings.source.default":"Default","keybindings.source.user":"User","keybindings.record.title":"Record Shortcut","keybindings.record.hint":"Press desired key combination...","keybindings.record.conflict":"Conflicts with","keybindings.action.edit":"Edit","keybindings.action.reset":"Reset","keybindings.action.unbind":"Unbind","keybindings.reset.all":"Reset all","keybindings.noResults":"No matching keybindings","keybindings.empty":"No keybindings","keybindings.loading":"Loading...","keybindings.ctx.Global":"Global","keybindings.ctx.Chat":"Chat Input","keybindings.ctx.InputBox":"Text Input","keybindings.ctx.Terminal":"Terminal","keybindings.ctx.Autocomplete":"Autocomplete","keybindings.ctx.Confirmation":"Confirmation","keybindings.ctx.HistorySearch":"History Search","keybindings.ctx.Task":"Task Running","keybindings.ctx.Settings":"Settings","keybindings.ctx.CommandPalette":"Command Palette","keybindings.ctx.Select":"Select List","keybindings.ctx.PermissionDialog":"Permission Dialog","keybindings.ctx.Help":"Help","keybindings.ctx.Plugin":"Plugin","keybindings.ctx.DiffDialog":"Diff Dialog","keybindings.ctx.MessageSelector":"Message Selector","keybindings.ctxDesc.Global":"Active everywhere, regardless of focus","keybindings.ctxDesc.Chat":"When the chat input is focused","keybindings.ctxDesc.InputBox":"When a text input is active","keybindings.ctxDesc.Terminal":"When the terminal view is active","keybindings.ctxDesc.Autocomplete":"When autocomplete menu is visible","keybindings.ctxDesc.Confirmation":"When a confirmation/permission dialog is shown","keybindings.ctxDesc.HistorySearch":"When searching command history (ctrl+r)","keybindings.ctxDesc.Task":"When a task/agent is running in the foreground","keybindings.ctxDesc.Settings":"When the settings panel is open","keybindings.ctxDesc.CommandPalette":"When the command palette is open","keybindings.ctxDesc.Select":"When a select/list component is focused","keybindings.ctxDesc.PermissionDialog":"When a tool permission dialog is shown","keybindings.ctxDesc.Help":"When the help overlay is open","keybindings.ctxDesc.Plugin":"When the plugin dialog is open","keybindings.ctxDesc.DiffDialog":"When the diff dialog is open","keybindings.ctxDesc.MessageSelector":"When the message selector (rewind) is open","keybindings.act.app:interrupt":"Interrupt","keybindings.act.app:exit":"Exit","keybindings.act.app:redraw":"Redraw Screen","keybindings.act.app:toggleTodos":"Toggle Todos","keybindings.act.app:toggleTranscript":"Toggle Transcript","keybindings.act.app:toggleSidebar":"Toggle Sidebar","keybindings.act.app:toggleTerminal":"Toggle Terminal","keybindings.act.app:commandPalette":"Command Palette","keybindings.act.app:newChat":"New Chat","keybindings.act.app:settings":"Settings","keybindings.act.app:focusInput":"Focus Input","keybindings.act.app:keybindings":"Keybinding Settings","keybindings.act.history:search":"Search History","keybindings.act.history:previous":"Previous History","keybindings.act.history:next":"Next History","keybindings.act.history:open":"Open History","keybindings.act.chat:cancel":"Cancel","keybindings.act.chat:submit":"Submit","keybindings.act.chat:newline":"New Line","keybindings.act.chat:killAgents":"Kill Agents","keybindings.act.chat:cycleMode":"Cycle Mode","keybindings.act.chat:modelPicker":"Model Picker","keybindings.act.chat:thinkingToggle":"Toggle Thinking","keybindings.act.chat:undo":"Undo","keybindings.act.chat:externalEditor":"External Editor","keybindings.act.chat:stash":"Stash","keybindings.act.chat:imagePaste":"Paste Image","keybindings.act.autocomplete:accept":"Accept","keybindings.act.autocomplete:dismiss":"Dismiss","keybindings.act.autocomplete:previous":"Previous","keybindings.act.autocomplete:next":"Next","keybindings.act.confirm:yes":"Confirm","keybindings.act.confirm:no":"Cancel","keybindings.act.confirm:previous":"Previous","keybindings.act.confirm:next":"Next","keybindings.act.confirm:toggle":"Toggle","keybindings.act.confirm:toggleExplanation":"Toggle Explanation","keybindings.act.task:background":"Run in Background","keybindings.act.historySearch:next":"Next","keybindings.act.historySearch:accept":"Accept","keybindings.act.historySearch:cancel":"Cancel","keybindings.act.historySearch:execute":"Execute","keybindings.act.settings:close":"Close Settings","keybindings.act.settings:search":"Search Settings","keybindings.act.select:previous":"Previous","keybindings.act.select:next":"Next","keybindings.act.select:accept":"Select","keybindings.act.select:cancel":"Cancel","keybindings.act.commandPalette:close":"Close Palette","keybindings.act.commandPalette:execute":"Execute Command","keybindings.act.commandPalette:previous":"Previous","keybindings.act.commandPalette:next":"Next","keybindings.act.permission:toggleDebug":"Toggle Debug","keybindings.act.diff:dismiss":"Close Diff","keybindings.act.diff:previousFile":"Previous File","keybindings.act.diff:nextFile":"Next File","keybindings.act.diff:viewDetails":"View Details","keybindings.act.plugin:toggle":"Toggle Plugin","keybindings.act.plugin:install":"Install Plugin","keybindings.act.help:dismiss":"Close Help","keybindings.act.transcript:exit":"Exit Transcript","keybindings.act.transcript:toggleShowAll":"Show All","keybindings.act.messageSelector:up":"Up","keybindings.act.messageSelector:down":"Down","keybindings.act.messageSelector:top":"Top","keybindings.act.messageSelector:bottom":"Bottom","keybindings.act.messageSelector:select":"Select","common.close":"Close","changes.revert":"Revert","changes.revertDirectory":"Revert directory","message.clickToEnlarge":"Click to enlarge","channel.botIdPlaceholder":"Enter Bot ID","channel.secretPlaceholder":"Enter Secret","filePreview.zoomOut":"Zoom Out","filePreview.zoomIn":"Zoom In","filePreview.fitToWindow":"Fit to Window","filePreview.actualSize":"Actual Size (1:1)","filePreview.pdfPreview":"PDF Preview","goal.status.usage":`Usage: /goal <condition>
641
+ `,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return a}_verifyIntegers(...f){for(const h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}c.Terminal=v})(),o})()))})(Ga)),Ga.exports}var vk=xk();const yb="codebuddy-locale";function xb(){if(typeof navigator>"u")return"en";const e=[];Array.isArray(navigator.languages)&&navigator.languages.length>0&&e.push(...navigator.languages),navigator.language&&e.push(navigator.language);try{const t=Intl.DateTimeFormat().resolvedOptions().locale;t&&e.push(t)}catch{}for(const t of e)if(t.toLowerCase().startsWith("zh"))return"zh";return"en"}function Wa(e){return e==="system"?xb():e}function _k(){try{const e=localStorage.getItem(yb);if(e){const t=JSON.parse(e),n=(t==null?void 0:t.mode)??e;if(["zh","en","system"].includes(n))return n}}catch{}return"system"}const Hi=rt()(Hs((e,t)=>{const n=_k(),r=Wa(n);return typeof window<"u"&&window.addEventListener("languagechange",()=>{const s=Hi.getState();if(s.mode==="system"){const o=xb();o!==s.resolved&&Hi.setState({resolved:o})}}),{mode:n,resolved:r,setLocale:s=>{const o=Wa(s);e({mode:s,resolved:o})},toggle:()=>{const s=t().mode,o=s==="zh"?"en":s==="en"?"system":"zh";t().setLocale(o)}}},{namespace:"locale",fields:["mode"],scope:"global",debounceMs:300,localStorageKey:yb,onLoad:(e,t)=>{if(e.mode){const n=Wa(e.mode);t({mode:e.mode,resolved:n})}}})),Nm={zh:{"app.connecting":"正在连接 CodeBuddy Code...","app.connectFailed":"连接失败","app.retry":"重试","app.pwa.newVersion":"检测到 Web UI 新版本","app.pwa.reloadNow":"立即刷新","app.pwa.reloadLater":"稍后","app.pwa.reloadedAfterIdle":"已切换到新版本","chat.empty.title":"CodeBuddy Code","chat.empty.subtitle":"今天有什么可以帮到你?","chat.empty.slogan":"Claw Your Ideas . Into Reality","chat.empty.tag.slides":"幻灯片生成","chat.empty.tag.research":"深度研究","chat.empty.tag.docs":"文档处理","chat.empty.tag.data":"数据分析","chat.thinking":"思考中","chat.waitingPermission":"等待权限确认","chat.waitingUser":"等待用户回答","chat.error":"错误","chat.sessionEnded":"会话已结束","chat.stopped":"已停止","chat.scrollToLatest":"跳到最新","chat.error.refusal":"Agent 拒绝继续执行。这可能是由于内容策略限制或其他限制。","chat.error.network":"网络连接异常或服务暂时不可用,请稍后重试。","chat.error.auth":"身份验证失败或权限不足,请重新登录后再试。","chat.error.quota":"已达到配额上限或请求过于频繁,请稍后再试。","chat.error.modelService":"模型服务返回异常,请重试或稍后再试。","chat.error.cancelled":"请求已被取消,可能由系统休眠或网络中断导致,请重试。","chat.error.maxTokens":"响应因达到最大 token 限制而被截断。您可以继续对话或要求更简洁的回复。","chat.error.maxTurnRequests":"已超过单轮对话允许的最大模型请求次数。您可以发送新消息以继续。","chat.newChat":"新对话","chat.disclaimer":"回答由 AI 生成,仅供参考","chat.compacted":"已精简历史对话","chat.compacting":"正在精简历史对话...","chat.compactCancelled":"历史对话精简已取消","phase.preparing":"准备中","phase.modelRequesting":"等待模型响应","phase.modelStreaming":"接收中","phase.modelDone":"处理中","phase.toolExecuting":"执行工具","phase.modelStreamingTool":"正在写入","phase.retrying":"重试中","progress.compacting":"压缩上下文中","input.placeholder":"从一个想法开始...","input.placeholderRunning":"消息将排队等待处理...","input.placeholderPending":"请先处理权限请求...","input.send":"发送 (Enter)","input.stop":"停止","input.thinking":"思考中","input.deepThinking":"深度思考","input.promptFailed":"发送失败","input.sendQueued":"发送排队消息 (Enter)","input.dropHint":"拖拽文件到这里","input.addImage":"添加图片","input.addFile":"添加文件","input.imageTooLarge":"图片不能超过 10MB","input.tooManyImages":"最多添加 5 张图片","input.fileTooLarge":"文件不能超过 1MB","input.tooManyFiles":"最多添加 10 个文件","input.menu.image":"图片","input.menu.file":"文件","input.menu.mode":"模式","input.menu.model":"模型","input.modeSelector":"模式","input.modelSelector":"模型","input.deepThinkingDesc":"让模型在回答前进行更深入的推理","input.modelHeader":"模型","mode.default":"默认","mode.default.desc":"每次首次使用工具时都请求权限","mode.acceptEdits":"自动通过编辑","mode.acceptEdits.desc":"本会话自动通过文件编辑权限","mode.plan":"规划模式","mode.plan.desc":"只分析、不修改文件或执行命令","mode.auto":"自动","mode.auto.desc":"AI 分类器审查操作:安全的自动通过,高风险的拒绝。分类器不可用时回退为弹窗确认(或拒绝)","mode.dontAsk":"免打扰","mode.dontAsk.desc":"不弹出权限确认;执行预批准和安全操作,拒绝需要审批的操作","mode.bypassPermissions":"跳过权限确认","mode.bypassPermissions.desc":"跳过所有权限确认","input.newline":"换行","input.contextMenu.newline":"换行","input.contextMenu.send":"发送","queue.more":" 条消息排队中","status.running":"运行中","tool.writeFile":"写入文件","tool.readFile":"读取文件","tool.execute":"执行指令","tool.searchFiles":"搜索文件","tool.searchContent":"搜索内容","tool.fetchWeb":"获取网页","tool.searchWeb":"搜索网络","tool.defaultName":"工具","tool.moreItems":"... 还有 {count} 项","interruption.title":"需要授权","interruption.tool":"工具","interruption.allow":"允许","interruption.allowAll":"全部允许","interruption.deny":"拒绝","interruption.approved":"已允许","interruption.denied":"已拒绝","interruption.edits":"{count} 处编辑","interruption.yes":"是","interruption.keepPlanning":"继续规划","interruption.exitPlanMode":"退出计划模式","interruption.readyToCode":"准备好开始编码了吗?","theme.light":"浅色","theme.dark":"深色","theme.system":"跟随系统","locale.zh":"中文","locale.en":"English","locale.system":"跟随系统","sidebar.nav.plugins":"插件","sidebar.nav.tasks":"任务","sidebar.search.placeholder":"搜索...","sidebar.chatHistory":"对话历史","sidebar.workspace":"工作区","sidebar.connectionStatus":"连接状态","sidebar.status":"状态","sidebar.sessionId":"会话ID","sidebar.notConnected":"未连接","sidebar.modelSelection":"模型选择","sidebar.noModels":"暂无可用模型","sidebar.environment":"环境信息","sidebar.cwd":"工作目录","sidebar.os":"操作系统","sidebar.nodeVersion":"Node.js","sidebar.gatewayMode":"网关模式","sidebar.tunnelUrl":"Tunnel 地址","sidebar.clickToCopy":"点击复制","sidebar.copied":"已复制","sidebar.permissionMode":"权限模式","sidebar.noModes":"暂无可用模式","sidebar.preferences":"设置","sidebar.keybindings":"快捷键","sidebar.group.workspace":"工作区","sidebar.group.observability":"可观测","sidebar.group.preferences":"配置","bottomSheet.attachments":"添加","bottomSheet.navigation":"导航","sidebar.theme":"界面主题","sidebar.language":"界面语言","sidebar.user":"用户","sidebar.authMethod":"密码认证","sidebar.noAuth":"无认证","sidebar.version":"Remote UI v1.0","connection.connected":"已连接","connection.connecting":"连接中","connection.disconnected":"未连接","connection.error":"连接错误","message.copyToClipboard":"复制到剪贴板","message.copied":"已复制","message.copy":"复制","message.assistantName":"CodeBuddy Code","thinking.title":"思考过程","thinking.thinking":"思考中","thinking.done":"已思考","thinking.seconds":"(用时 {n} 秒)","thinking.expand":"展开","thinking.collapse":"收起","diff.noChanges":"无变更","login.title":"CodeBuddy Remote Control","login.subtitle":"请输入终端中显示的密码","login.placeholder":"密码","login.submit":"登录","login.error.incorrect":"密码错误","login.error.rateLimit":"登录尝试次数过多,请稍后再试","login.error.required":"请输入密码","login.hint.password":"提示:密码在服务启动时显示在终端中。","login.hint.urlAuth":"也可以使用 <code>?password=xxx</code> 自动登录。","login.hint.disable":'或在 CodeBuddy 配置目录(默认 <code>~/.codebuddy</code>,可通过 <code>CODEBUDDY_CONFIG_DIR</code> 环境变量覆盖)下的 <code>settings.json</code> 中设置 <code>gateway.auth: "none"</code> 来禁用认证。',"login.slogan":"Claw Your Ideas . Into Reality","login.tagline":"Triggered Anywhere, Completed Locally.","login.privacy":"隐私政策","login.terms":"服务条款","sidebar.interactionMode":"交互模式","sidebar.chatMode":"对话","sidebar.terminalMode":"终端","sidebar.canvas":"画布","canvas.title":"无限画布","canvas.addTerminal":"添加终端","canvas.zoomIn":"放大","canvas.zoomOut":"缩小","canvas.fitView":"适应视图","canvas.resetView":"重置视图","canvas.empty":"点击工具栏 + 按钮添加终端","canvas.openStandalone":"在新窗口打开画布","canvas.tileMenu.close":"关闭","canvas.tileMenu.duplicate":"复刻终端","canvas.tileMenu.maximize":"最大化","canvas.tileMenu.minimize":"最小化","canvas.tileMenu.restore":"还原","canvas.tileMenu.openStandalone":"在新窗口打开","canvas.standalone.missingPaneId":"未指定终端 ID","canvas.defaultTitle":"终端","terminal.connecting":"终端连接中...","terminal.title":"终端","terminal.disconnected":"终端已断开","terminal.error":"终端连接失败","terminal.reconnect":"重新连接","terminal.splitHorizontal":"左右分屏","terminal.splitVertical":"上下分屏","terminal.closePane":"关闭终端","terminal.maxPanes":"已达最大面板数","sidebar.instances":"实例","sidebar.activeInstances":"个活跃实例","sidebar.manageInstances":"管理实例","sidebar.remoteControl":"远程控制","instance.title":"实例列表","instance.switch":"实例","instance.switchTitle":"切换实例","instance.current":"当前实例","instance.manual":"手动添加","instance.switchTo":"切换到此实例","instance.manage":"管理实例","instance.managerTitle":"实例管理","instance.addInstance":"添加实例","instance.name":"实例名称","instance.namePlaceholder":"自定义实例名称(可选,默认为目录名)","instance.url":"实例地址","instance.urlPlaceholder":"https://example.trycloudflare.com","instance.password":"密码","instance.optional":"可选","instance.passwordPlaceholder":"访问密码","instance.cancel":"取消","instance.add":"添加","instance.remove":"删除此实例","instance.noInstances":"暂无其他实例","instance.noInstancesHint":"启动更多 CodeBuddy Code 实例,或手动添加远程实例","instance.cwd":"工作目录","instance.topic":"当前话题","instance.startedAt":"启动于","instance.local":"本地","instance.tunnel":"隧道","instance.uptime.days":"天前","instance.uptime.hours":"小时前","instance.uptime.minutes":"分钟前","instance.uptime.justNow":"刚刚","instance.addError":"添加实例失败","instance.removeError":"删除实例失败","instance.copyUrl":"复制链接","instance.copied":"已复制","instance.subtitle":"管理和切换工作实例","instance.refresh":"刷新","instance.refreshed":"已刷新","instance.loading":"加载实例中...","instance.error":"加载实例列表失败","instance.retry":"重试","question.multiple":"多选","question.customAnswer":"或输入自定义答案...","question.reviewAnswers":"审核答案","question.singleTitle":"问题","question.titleWithCount":"问题({count})","question.reviewTab":"审核","question.next":"下一步","question.submit":"提交","question.cancel":"取消","question.answered":"已回答","question.cancelled":"问题已取消","todo.title":"任务清单","todo.executing":"任务{n}正在执行中","todo.untitled":"未命名","history.title":"会话历史","history.description":"点击会话可切换到该对话","history.noData":"暂无会话历史","history.noDataHint":"开始一段新对话吧","history.backToChat":"返回对话","history.loading":"加载中...","history.loadError":"加载失败","history.retry":"重试","history.current":"当前","history.messages":"{count} 条消息","history.delete":"删除","history.deleteConfirm":"确定要删除这个会话吗?","history.deleteCancel":"取消","history.deleteOk":"删除","history.rename":"重命名","history.renameTitle":"重命名会话","history.renamePlaceholder":"输入新名称","history.renameCancel":"取消","history.renameOk":"确定","history.cannotDeleteCurrent":"无法删除当前会话","settings.title":"设置","settings.appearance":"外观","settings.model":"模型选择","settings.mode":"权限模式","settings.systemInfo":"系统信息","settings.backToChat":"返回对话","settings.tab.user":"用户级","settings.tab.project":"工作空间级","settings.group.modelAndReasoning":"模型与推理","settings.group.behavior":"行为","settings.group.memory":"记忆","settings.group.language":"语言","settings.group.advanced":"高级","settings.group.sandbox":"安全沙箱","settings.item.model":"默认模型","settings.item.model.desc":"设置默认使用的 AI 模型","settings.item.reasoningEffort":"推理努力级别","settings.item.reasoningEffort.desc":"控制模型的推理深度","settings.item.alwaysThinkingEnabled":"始终启用深度思考","settings.item.autoCompactEnabled":"自动压缩上下文","settings.item.includeCoAuthoredBy":"提交包含 Co-authored-by","settings.item.fileCheckpointingEnabled":"文件检查点","settings.item.fileCheckpointingEnabled.desc":"启用文件版本回退功能","settings.item.promptSuggestionEnabled":"提示建议","settings.item.ignoreGitIgnore":"忽略 .gitignore","settings.item.ignoreGitIgnore.desc":"搜索文件时忽略 .gitignore 规则","settings.item.deferToolLoading":"延迟加载工具","settings.item.hookOutputCollapsed":"折叠 Hook 输出","settings.item.memory.enabled":"启用记忆功能","settings.item.memory.autoMemoryEnabled":"自动记忆","settings.item.memory.autoMemoryEnabled.desc":"自动保存重要信息到记忆库","settings.item.language":"响应语言","settings.item.language.desc":"设置 AI 回复使用的语言","settings.item.cleanupPeriodDays":"聊天记录保留天数","settings.item.imageHistoryRetainRounds":"图片保留轮数","settings.item.imageHistoryRetainRounds.desc":"对话历史中保留图片的最近轮数","settings.item.env":"环境变量","settings.item.env.desc":"应用于每个会话的环境变量 (JSON)","settings.item.sandbox.enabled":"启用安全沙箱","settings.item.sandbox.enabled.desc":"在沙箱中运行 Bash 命令,限制文件和网络访问","settings.item.sandbox.autoAllowBashIfSandboxed":"沙箱内自动批准命令","settings.item.sandbox.autoAllowBashIfSandboxed.desc":"命令在沙箱中运行时自动批准","settings.loading":"加载中...","settings.saved":"已保存","settings.saveFailed":"保存失败","settings.notSet":"未设置","settings.default":"默认","settings.reset":"重置","settings.noProjectSettings":"当前工作空间暂无可配置项","settings.effort.minimal":"最小","settings.effort.low":"低","settings.effort.medium":"中","settings.effort.high":"高","settings.effort.xhigh":"极高","settings.effort.max":"最大","page.title":"CodeBuddy Code","tool.processExited":"[进程已退出]","tool.itemsCount":"{count} 项","tool.showAllItems":"显示全部 {count} 项","tool.moreLinesCount":"... 还有 {count} 行","tool.generatedImage":"生成的图片","tool.editedImage":"编辑后的图片","tool.imageGen":"图片生成","tool.imageEdit":"图片编辑","tool.toolSearch":"工具搜索","tool.teamCreate":"创建团队","tool.teamDelete":"删除团队","tool.taskCreate":"创建任务","tool.taskUpdate":"更新任务","tool.taskList":"任务列表","tool.taskGet":"获取任务","tool.sendMessage":"发送消息","tool.shutdown":"关闭","tool.taskCompleted":"任务完成","tool.shutdownRejected":"关闭被拒绝","tool.planResponse":"计划回复","tool.approved":"已批准","tool.rejected":"已拒绝","tool.userRejectedResult":"用户已拒绝执行此操作","tool.webSearch":"网络搜索","tool.webFetch":"网页获取","tool.saveMemory":"保存记忆","tool.askUserQuestion":"询问用户","tool.enterPlanMode":"进入计划模式","tool.exitPlanMode":"退出计划模式","tool.allowedActions":"允许的操作:","tool.skill":"技能","tool.agent":"代理","tool.failed":"失败","tool.completed":"完成","tool.toolsCount":"{count} 个工具","tool.background":"后台","tool.permissionsCount":"{count} 项权限","terminal.unknownError":"未知错误","terminal.processExited":"[进程已退出]","terminal.connectionLost":"连接已断开","terminal.wsConnectionFailed":"WebSocket 连接失败","terminal.createSessionFailed":"创建终端会话失败","terminal.reconnectFailed":"重连失败","team.title":"团队","team.activeCount":"{count} 个活跃","team.doneCount":"{count} 个完成","team.waitingForTeammates":"等待 {count} 个成员完成…","team.backToMain":"返回主对话","team.loadingHistory":"加载对话历史…","team.noHistory":"暂无对话历史","team.agentRunning":"正在运行…","team.delivered":"已送达","team.showLess":"收起","team.moreLines":"… ({count} 更多行)","team.tools":"{count} 工具","team.tokens":"{count} tokens","instance.tunnelMode":"隧道","instance.localMode":"本地","workspace.searchPlaceholder":"搜索目录...","workspace.switch":"切换","workspace.switchHere":"切换到此目录","workspace.switching":"切换中...","workspace.noResults":"没有匹配的目录","workspace.emptyDir":"此目录为空","workspace.pathPlaceholder":"输入路径或目录名...","workspace.selectDir":"在此目录创建机器人","workspace.filterPlaceholder":"过滤子目录...","workspace.recent.title":"最近工作区","workspace.recent.daysAgo":"天前","workspace.recent.hoursAgo":"小时前","workspace.recent.minutesAgo":"分钟前","workspace.recent.justNow":"刚刚","workspace.recent.remove":"移除","workspace.browseTitle":"浏览工作区","workspace.recentWorkspaces":"最近工作区","workspace.createNew":"创建新机器人","workspace.browseDir":"浏览目录","workspace.instanceLocal":"本地","workspace.instanceTunnel":"隧道","workspace.instanceCurrent":"当前","workspace.switchInstance":"切换","workspace.switchingInstance":"切换中...","workspace.switchingWithGateway":"正在准备切换...","workspace.instanceStarted":"启动于","workspace.noWorkspaces":"暂无活跃的工作区","workspace.noWorkspacesHint":"浏览目录创建新机器人","workspace.instanceCount":"{count} 个机器人","question.multiLabel":"多选","tasks.title":"推荐模版","tasks.subtitle":"选择一个模版快速创建定时任务","tasks.loading":"正在获取推荐模版...","tasks.error":"获取模版失败","tasks.retry":"重试","tasks.refresh":"刷新推荐","tasks.refreshed":"已刷新","tasks.empty":"暂无推荐模版","tasks.interval":"每 {value}","tasks.interval.1d":"每天","tasks.interval.2d":"每 2 天","tasks.interval.3d":"每 3 天","tasks.interval.1w":"每周","tasks.interval.2w":"每 2 周","tasks.interval.1m":"每月","scheduled.title":"定时任务","scheduled.subtitle":"当前会话中的活跃定时任务","scheduled.loading":"加载中...","scheduled.empty":"暂无定时任务","scheduled.emptyHint":"在对话中使用 /loop 或 CronCreate 创建","scheduled.create":"创建任务","scheduled.creating":"创建中...","scheduled.delete":"删除","scheduled.cron":"Cron 表达式","scheduled.prompt":"执行内容","scheduled.promptPlaceholder":"定时触发时要执行的提示词...","scheduled.recurring":"循环","scheduled.oneShot":"一次性","scheduled.durable":"持久化","scheduled.sessionOnly":"仅会话","scheduled.lastFired":"上次触发","plugins.title":"插件管理","plugins.installedPlugins":"已安装插件","plugins.browseMarketplace":"浏览市场","plugins.marketplaces":"插件市场","plugins.enabled":"已启用","plugins.disabled":"已禁用","plugins.enable":"启用","plugins.disable":"禁用","plugins.uninstall":"卸载","plugins.install":"安装","plugins.confirmUninstall":"确定要卸载此插件吗?","plugins.marketplace":"市场","plugins.addMarketplace":"添加市场","plugins.removeMarketplace":"移除","plugins.confirmRemoveMarketplace":"确定要移除此市场吗?","plugins.noPlugins":"暂无已安装的插件","plugins.noPluginsHint":"通过插件市场安装插件来扩展功能","plugins.noMarketplaces":"暂无配置的市场","plugins.noMarketplacesHint":"添加一个插件市场来浏览和安装插件","plugins.selectMarketplace":"选择市场","plugins.selectMarketplaceHint":"选择一个市场来浏览可用插件","plugins.marketplaceNotFound":"市场不存在","plugins.noAvailablePlugins":"该市场暂无可用插件","plugins.noAvailablePluginsHint":"请尝试添加其他市场或稍后再试","plugins.installed":"已安装","plugins.browsingMarketplace":"浏览中...","plugins.loading":"加载中...","plugins.error":"加载插件失败","plugins.retry":"重试","plugins.sourcePlaceholder":"市场地址(Git URL 或本地路径)","plugins.namePlaceholder":"市场名称(可选)","plugins.cancel":"取消","plugins.add":"添加","plugins.version":"版本","plugins.operationFailed":"操作失败","plugins.searchPlaceholder":"搜索插件...","plugins.allMarketplaces":"全部市场","plugins.noSearchResults":"没有找到匹配的插件","plugins.totalCount":"个插件","plugins.refresh":"刷新","plugins.installedLabel":"已安装","plugins.category":"分类","plugins.author":"作者","plugins.license":"许可证","plugins.homepage":"主页","plugins.repository":"仓库","plugins.source":"来源","plugins.keywords":"关键词","plugins.features":"功能","plugins.scope":"范围","plugins.scope.user":"用户","plugins.scope.project":"项目","plugins.scope.project-local":"本地","plugins.installScope.user":"为你安装(用户级)","plugins.installScope.project":"为所有协作者安装(项目级)","plugins.installScope.local":"仅在此仓库为你安装(本地级)","plugins.policyCannotRemove":"不可卸载","plugins.policyCannotSwitchoff":"不可禁用","plugins.policyCannotEdit":"不可编辑","channel.from":"来自","channel.group":"群聊","channel.replyTo":"回复来自 {source}","channel.wechat":"微信","channel.wecom":"企业微信","channel.wecomBot":"企微机器人","remoteControl.title":"远程控制","remoteControl.subtitle":"管理渠道连接","remoteControl.connectedChannels":"已连接渠道","remoteControl.noChannels":"暂无已连接渠道","remoteControl.noChannelsHint":"添加微信或企业微信渠道,或从插件市场安装更多","remoteControl.addWeChat":"添加微信机器人","remoteControl.addWeCom":"添加企微机器人","remoteControl.connect":"连接","remoteControl.disconnect":"断开","remoteControl.delete":"删除","remoteControl.add":"添加","remoteControl.connected":"已连接","remoteControl.disconnected":"未连接","remoteControl.connecting":"连接中...","remoteControl.installMore":"安装更多渠道","remoteControl.installMoreHint":"浏览插件市场,安装第三方渠道插件","remoteControl.browseMarketplace":"浏览插件市场","remoteControl.builtIn":"内置","remoteControl.plugin":"插件","remoteControl.rebind":"重新绑定","remoteControl.unbind":"解绑","remoteControl.bot":"机器人","remoteControl.default":"默认","remoteControl.next":"下一步","remoteControl.cancel":"取消","remoteControl.wecomBotIdHint":"从企业微信管理后台 → 应用管理 → AI 助手获取","remoteControl.wecomSecretHint":"输入 Secret 后按回车或点“连接”","remoteControl.fetchingQr":"正在获取二维码...","remoteControl.scanQr":"请用微信扫描二维码","sidebar.docs":"文档","docs.title":"文档中心","docs.search.placeholder":"搜索文档...","docs.search.noResults":"未找到相关文档","docs.search.resultsCount":"{count} 个结果","docs.loading":"加载中...","docs.loadError":"文档加载失败","docs.notFound":"未找到该文档","docs.apiReference":"API 文档","docs.toc":"目录","docs.retry":"重试","docs.backToList":"返回文档列表","docs.expandAll":"展开全部","docs.collapseAll":"收起全部","docs.openStandalone":"独立窗口打开","sidebar.stats":"统计","stats.title":"统计","stats.loading":"正在加载统计数据...","stats.refresh":"刷新","stats.noData":"暂无统计数据","stats.tab.overview":"概览","stats.tab.models":"模型","stats.tab.tools":"工具","stats.sessions":"会话数","stats.messages":"消息数","stats.activeDays":"活跃天数","stats.currentStreak":"当前连续","stats.longestStreak":"最长连续","stats.peakHour":"高峰时段","stats.longestSession":"最长会话","stats.favoriteModel":"最常用模型","stats.totalTokens":"总 Token","stats.timeRange":"统计范围: 最近 {days} 天","stats.heatmap.less":"少","stats.heatmap.more":"多","stats.days":"天","stats.tokensPerDay":"每日 Token 趋势","stats.allModels":"所有模型","stats.input":"输入","stats.output":"输出","stats.cacheRead":"缓存读取","stats.cacheHitRate":"缓存命中率","stats.cost":"成本","stats.topTools":"工具使用排行","stats.session.title":"当前会话","stats.session.apiDuration":"API 时长","stats.session.wallTime":"总时长","stats.session.linesAdded":"新增行","stats.session.linesDeleted":"删除行","stats.session.tokens":"Token","stats.na":"N/A","stats.heatmap.messages":"条消息","stats.funFact.moreTokens":"你已使用约 {times} 倍于《{book}》的 Token 量","stats.funFact.sameTokens":"你使用的 Token 量约等于一本《{book}》","stats.funFact.longerSession":"你最长的会话时长约为「{activity}」的 {times} 倍","sidebar.traces":"链路","traces.title":"链路追踪","traces.loading":"加载中...","traces.refresh":"刷新","traces.clear":"清空","traces.clearConfirm":"确定清空所有链路数据?","traces.noData":"暂无链路数据,发送一条消息后将自动收集","traces.selectWorker":"选择 Worker","traces.current":"当前","traces.spanCount":"{count} spans","traces.duration":"耗时","traces.status.ok":"成功","traces.status.error":"错误","traces.status.running":"运行中","traces.status.cancelled":"已取消","traces.bottleneck":"瓶颈","traces.bottleneckTip":"耗时最长,占总时间 {pct}%","traces.spanDetail":"Span 详情","traces.spanDetail.type":"类型","traces.spanDetail.duration":"耗时","traces.spanDetail.model":"模型","traces.spanDetail.tokens":"Token","traces.spanDetail.input":"输入","traces.spanDetail.output":"输出","traces.spanDetail.error":"错误","traces.spanDetail.cancelReason":"取消原因","traces.spanDetail.attributes":"属性","traces.legend.agent":"Agent","traces.legend.generation":"模型调用","traces.legend.function":"工具","traces.legend.handoff":"切换","traces.legend.guardrail":"防护","traces.back":"返回","traces.tab.timeline":"时间线","traces.tab.tree":"树形","traces.tab.flame":"火焰图","traces.tab.graph":"依赖图","traces.expandAll":"全部展开","traces.collapseAll":"全部收起","traces.search":"搜索 span...","traces.selfTime":"自身耗时","traces.spanDetail.overview":"概览","traces.spanDetail.io":"输入/输出","traces.noSpans":"无 span 数据","traces.noSpansFiltered":"当前筛选下无 span。","traces.clearFilter":"清除筛选","traces.auto":"自动","traces.auxiliaryCount":"{count} 个辅助 trace(memory、title 等)","traces.noIO":"无输入/输出数据","traces.noAttrs":"无属性","traces.io.expand":"展开","traces.io.collapse":"收起","traces.io.messages":"消息","traces.io.less":"收起","traces.io.moreChars":"+{count} 字符","traces.fit":"适应","traces.allSessions":"所有会话","traces.allInstances":"所有实例","traces.llmCalls":"{count} 次 LLM","traces.errors":"错误","traces.noErrors":"没有失败的 trace","traces.errorBanner":"检测到 {count} 个失败的 trace","traces.errorBannerCta":"点击仅查看错误 →","traces.errorSummaryTitle":"本次共有 {count} 处错误","traces.jumpToFirstError":"跳转到首个错误 span","traces.copyError":"复制错误","traces.onlyErrors":"仅错误","traces.filter.all":"全部","traces.filter.error":"错误","traces.filter.running":"运行中","traces.filter.cancelled":"已取消","traces.filter.ok":"成功","sidebar.metrics":"监控","metrics.title":"系统监控","metrics.loading":"加载指标数据...","metrics.refresh":"刷新","metrics.cpu":"CPU","metrics.memory":"内存","metrics.disk":"磁盘","metrics.cores":"核心","metrics.workers":"Workers","metrics.noWorkers":"暂无运行中的 Worker","metrics.current":"当前","metrics.uptime":"运行时长","metrics.version":"版本","sidebar.editor":"文件","editor.title":"代码编辑器","editor.loading":"加载中...","editor.loadError":"加载失败","editor.noFile":"选择一个文件开始编辑","editor.unsaved":"未保存","editor.save":"保存","editor.saveAll":"全部保存","editor.close":"关闭","editor.closeOthers":"关闭其他","editor.closeAll":"关闭全部","editor.newFile":"新建文件","editor.newFolder":"新建文件夹","editor.rename":"重命名","editor.delete":"删除","editor.refresh":"刷新","editor.emptyFolder":"空文件夹","editor.explorer":"资源管理器","editor.toggleSidebar":"切换侧边栏","editor.collapseAll":"全部折叠","editor.openFolder":"打开目录","editor.openFolderPlaceholder":"输入目录路径...","editor.parentFolder":"上级目录","editor.pin":"固定","editor.unpin":"取消固定","editor.copyPath":"复制路径","editor.copyRelativePath":"复制相对路径","editor.revealInExplorer":"在文件树中定位","editor.closeToRight":"关闭右侧","editor.closeSaved":"关闭已保存","editor.quickOpen":"快速打开文件","editor.focusExplorer":"聚焦资源管理器","editor.recentFiles":"最近文件","editor.quickOpenPlaceholder":"输入文件名以搜索...","editor.quickOpenEmpty":"没有匹配的文件","editor.quickOpenLoading":"正在加载文件列表...","editor.selected":"已选","editor.lines":"行","editor.preview":"切换到预览","editor.source":"切换到源码","sidebar.workers":"实例","workers.title":"Agent 实例管理","workers.refresh":"刷新","workers.active":"活跃 Workers","workers.empty":"没有活跃的 worker 进程","workers.daemon":"Daemon 服务","workers.daemon.running":"运行中","workers.daemon.stopped":"已停止","workers.daemon.start":"启动","workers.daemon.starting":"启动中...","workers.daemon.stop":"停止","workers.daemon.restart":"重启","workers.action.logs":"查看日志","workers.action.open":"打开","workers.action.kill":"终止","workers.action.kill.confirm":"确定要终止这个 worker 进程吗?","sidebar.logs":"日志","logs.title":"日志查看器","logs.selectWorker":"选择 Worker","logs.current":"当前","logs.search":"搜索日志...","logs.autoRefresh":"自动刷新","logs.refresh":"刷新","logs.empty":"暂无日志内容","command.btw.description":"快速提问,不打断主要 Agent 工作","command.clear.description":"开始新的对话(之前的对话仍可通过 /resume 访问)","command.context.description":"计算并显示上下文 Token 分布","command.cost.description":"显示当前会话的总费用和持续时间","command.doctor.description":"诊断和验证 CodeBuddy 的安装和设置","command.feedback.description":"打开反馈页面以报告问题或提出建议","command.gateway.description":'管理远程控制网关。子命令: "status" 查看状态, "stop" 停止网关, "token" 重新生成访问令牌, "tunnel" 启动隧道',"command.remote-control.description":"管理远程控制长连接客户端(start, stop, status, list)","command.login.description":"切换腾讯云 CodeBuddy 账号","command.logout.description":"退出 CodeBuddy Code 账号","command.plan.description":"预览当前计划文件内容","command.pr-comments.description":"获取 GitHub Pull Request 的评论","command.release-notes.description":"查看更新日志","command.review.description":"审查 Pull Request","command.skills.description":"列出可用的技能","command.todos.description":"显示当前会话的任务清单","command.reload-plugins.description":"重新加载所有插件、技能、代理、钩子和 MCP/LSP 服务器(无需重启)","command.plugin-validate.description":"验证插件目录结构和清单文件","command.init.description":"正在分析你的代码库…","command.compact.description":"清除对话历史但保留摘要在上下文中。可选: /compact [摘要指令]","command.upgrade.description":"在浏览器中打开升级页面","command.statusline.description":"设置 CodeBuddy Code 的状态栏 UI","command.security-review.description":"对当前分支的待提交变更进行安全审查","command.insights.description":"生成 AI 驱动的 CodeBuddy Code 使用模式和活动洞察","command.loop.description":"按固定间隔运行提示或斜杠命令(例如 /loop 5m /foo,默认 10m)","command.task-manager.description":"团队任务管理 - 智能任务录入、分配、追踪和分析","sidebar.changes":"变更","fileChanges.title":"变更","fileChanges.changesSection":"文件变更","fileChanges.empty":"暂无文件变更","fileChanges.showChanges":"显示文件变更","fileChanges.hideChanges":"隐藏文件变更","fileChanges.revertAll":"撤回全部","fileChanges.revertCode":"回退代码","fileChanges.revertChat":"回退对话","fileChanges.revertCodeAndChat":"回退全部","fileChanges.checkpoints":"回退点","fileChanges.noCheckpoints":"暂无回退点","filePreview.binaryNotSupported":"该文件无法在编辑器中预览","filePreview.download":"下载文件","error.viewCrashed":"页面加载出错","error.appCrashed":"应用遇到了问题","error.newChatFailed":"创建新对话失败,请重试","error.switchSessionFailed":"切换会话失败,请重试","commandPalette.placeholder":"输入命令...","commandPalette.commands":"命令","commandPalette.views":"视图","commandPalette.actions":"操作","commandPalette.noResults":"没有匹配的命令","commandPalette.newChat":"新建对话","commandPalette.toggleTheme":"切换主题","commandPalette.toggleLocale":"切换语言","commandPalette.tip":"打开命令面板","app.confirm":"确定","app.cancel":"取消","tool.toolSingular":"个工具已执行","tool.toolPlural":"个工具已执行","tool.mcpAppLoadHint":"点击加载交互式界面","keybindings.title":"快捷键","keybindings.search.placeholder":"搜索快捷键... (如 submit, ctrl+enter)","keybindings.source.default":"默认","keybindings.source.user":"自定义","keybindings.record.title":"录制快捷键","keybindings.record.hint":"请按下快捷键组合...","keybindings.record.conflict":"冲突","keybindings.action.edit":"编辑","keybindings.action.reset":"重置","keybindings.action.unbind":"解绑","keybindings.reset.all":"重置全部","keybindings.noResults":"没有匹配的快捷键","keybindings.empty":"暂无快捷键","keybindings.loading":"加载中...","keybindings.ctx.Global":"全局","keybindings.ctx.Chat":"聊天输入","keybindings.ctx.InputBox":"文本输入","keybindings.ctx.Terminal":"终端","keybindings.ctx.Autocomplete":"自动补全","keybindings.ctx.Confirmation":"确认对话框","keybindings.ctx.HistorySearch":"历史搜索","keybindings.ctx.Task":"任务运行中","keybindings.ctx.Settings":"设置","keybindings.ctx.CommandPalette":"命令面板","keybindings.ctx.Select":"选择列表","keybindings.ctx.PermissionDialog":"权限对话框","keybindings.ctx.Help":"帮助","keybindings.ctx.Plugin":"插件","keybindings.ctx.DiffDialog":"Diff 对话框","keybindings.ctx.MessageSelector":"消息选择器","keybindings.ctxDesc.Global":"在任何位置都生效","keybindings.ctxDesc.Chat":"聊天输入框获得焦点时","keybindings.ctxDesc.InputBox":"文本输入框处于活跃状态时","keybindings.ctxDesc.Terminal":"终端视图处于活跃状态时","keybindings.ctxDesc.Autocomplete":"自动补全菜单显示时","keybindings.ctxDesc.Confirmation":"确认/权限对话框显示时","keybindings.ctxDesc.HistorySearch":"搜索命令历史时 (ctrl+r)","keybindings.ctxDesc.Task":"任务/代理在前台运行时","keybindings.ctxDesc.Settings":"设置面板打开时","keybindings.ctxDesc.CommandPalette":"命令面板打开时","keybindings.ctxDesc.Select":"选择/列表组件获得焦点时","keybindings.ctxDesc.PermissionDialog":"工具权限对话框显示时","keybindings.ctxDesc.Help":"帮助页面打开时","keybindings.ctxDesc.Plugin":"插件对话框打开时","keybindings.ctxDesc.DiffDialog":"Diff 对话框打开时","keybindings.ctxDesc.MessageSelector":"消息选择器 (rewind) 打开时","keybindings.act.app:interrupt":"中断","keybindings.act.app:exit":"退出","keybindings.act.app:redraw":"刷新屏幕","keybindings.act.app:toggleTodos":"切换待办事项","keybindings.act.app:toggleTranscript":"切换转录","keybindings.act.app:toggleSidebar":"切换侧边栏","keybindings.act.app:toggleTerminal":"切换终端","keybindings.act.app:commandPalette":"命令面板","keybindings.act.app:newChat":"新对话","keybindings.act.app:settings":"设置","keybindings.act.app:focusInput":"聚焦输入框","keybindings.act.app:keybindings":"快捷键设置","keybindings.act.history:search":"搜索历史","keybindings.act.history:previous":"上一条历史","keybindings.act.history:next":"下一条历史","keybindings.act.history:open":"打开历史","keybindings.act.chat:cancel":"取消","keybindings.act.chat:submit":"发送","keybindings.act.chat:newline":"换行","keybindings.act.chat:killAgents":"终止代理","keybindings.act.chat:cycleMode":"切换模式","keybindings.act.chat:modelPicker":"选择模型","keybindings.act.chat:thinkingToggle":"切换思考","keybindings.act.chat:undo":"撤销","keybindings.act.chat:externalEditor":"外部编辑器","keybindings.act.chat:stash":"暂存","keybindings.act.chat:imagePaste":"粘贴图片","keybindings.act.autocomplete:accept":"接受补全","keybindings.act.autocomplete:dismiss":"关闭补全","keybindings.act.autocomplete:previous":"上一项","keybindings.act.autocomplete:next":"下一项","keybindings.act.confirm:yes":"确认","keybindings.act.confirm:no":"取消","keybindings.act.confirm:previous":"上一项","keybindings.act.confirm:next":"下一项","keybindings.act.confirm:toggle":"切换选中","keybindings.act.confirm:toggleExplanation":"切换说明","keybindings.act.task:background":"后台运行","keybindings.act.historySearch:next":"下一条","keybindings.act.historySearch:accept":"接受","keybindings.act.historySearch:cancel":"取消","keybindings.act.historySearch:execute":"执行","keybindings.act.settings:close":"关闭设置","keybindings.act.settings:search":"搜索设置","keybindings.act.select:previous":"上一项","keybindings.act.select:next":"下一项","keybindings.act.select:accept":"选择","keybindings.act.select:cancel":"取消","keybindings.act.commandPalette:close":"关闭面板","keybindings.act.commandPalette:execute":"执行命令","keybindings.act.commandPalette:previous":"上一项","keybindings.act.commandPalette:next":"下一项","keybindings.act.permission:toggleDebug":"切换调试","keybindings.act.diff:dismiss":"关闭 Diff","keybindings.act.diff:previousFile":"上一个文件","keybindings.act.diff:nextFile":"下一个文件","keybindings.act.diff:viewDetails":"查看详情","keybindings.act.plugin:toggle":"切换插件","keybindings.act.plugin:install":"安装插件","keybindings.act.help:dismiss":"关闭帮助","keybindings.act.transcript:exit":"退出转录","keybindings.act.transcript:toggleShowAll":"显示全部","keybindings.act.messageSelector:up":"向上","keybindings.act.messageSelector:down":"向下","keybindings.act.messageSelector:top":"到顶部","keybindings.act.messageSelector:bottom":"到底部","keybindings.act.messageSelector:select":"选择","common.close":"关闭","changes.revert":"还原","changes.revertDirectory":"还原目录","message.clickToEnlarge":"点击放大","channel.botIdPlaceholder":"输入 Bot ID","channel.secretPlaceholder":"输入 Secret","filePreview.zoomOut":"缩小","filePreview.zoomIn":"放大","filePreview.fitToWindow":"适应窗口","filePreview.actualSize":"实际大小 (1:1)","filePreview.pdfPreview":"PDF 预览","goal.status.usage":`用法:/goal <条件>
642
+ 示例:/goal 所有测试通过`,"goal.status.tooLong":"目标条件长度上限 {max} 字符(当前 {actual})","goal.status.hooksDisabled":"/goal 在 Hooks 被禁用时不可用(settings 中关闭了 disableAllHooks 或 allowManagedHooksOnly)。","goal.status.set":"已设置目标:{condition}","goal.status.setReplaced":"替换目标:{prev} → {condition}","goal.status.cleared":"已清除目标:{prev}","goal.status.noGoal":"当前无目标","goal.status.active":"当前目标:{condition}","goal.progress.title":"目标尚未达成… 继续","goal.progress.expand":"点击展开","goal.progress.condition":"目标","goal.progress.reason":"原因","goal.recap.active":"当前活跃目标","goal.recap.achieved":"目标已达成","goal.recap.impossible":"目标无法达成","goal.recap.empty.title":"暂未设置目标","goal.recap.empty.hint":"使用 /goal <条件> 设置一个会话级停止条件。","goal.recap.empty.example":"示例:/goal 所有测试通过","goal.recap.footer.setAnother":"/goal <条件>","goal.recap.footer.toSetAnother":" 设置新目标 · ","goal.recap.footer.escDismiss":"关闭","goal.recap.stats.turn":"轮","goal.recap.stats.turns":"轮","goal.recap.stats.token":"token","goal.recap.stats.tokens":"tokens"},en:{"app.connecting":"Connecting to CodeBuddy Code...","app.connectFailed":"Connection failed","app.retry":"Retry","app.pwa.newVersion":"A new Web UI version is available","app.pwa.reloadNow":"Reload now","app.pwa.reloadLater":"Later","app.pwa.reloadedAfterIdle":"Updated to new version","chat.empty.title":"CodeBuddy Code","chat.empty.subtitle":"How can I help you today?","chat.empty.slogan":"Claw Your Ideas . Into Reality","chat.empty.tag.slides":"Slide Generation","chat.empty.tag.research":"Deep Research","chat.empty.tag.docs":"Document Processing","chat.empty.tag.data":"Data Analysis","chat.thinking":"Thinking","chat.waitingPermission":"Waiting for permission","chat.waitingUser":"Waiting for user","chat.error":"Error","chat.sessionEnded":"Session ended","chat.stopped":"Stopped","chat.scrollToLatest":"Scroll to latest","chat.error.refusal":"The agent refused to continue execution. This may be due to content policy restrictions or other limitations.","chat.error.network":"Network connection failed or the service is temporarily unavailable. Please try again later.","chat.error.auth":"Authentication failed or insufficient permissions. Please sign in again and retry.","chat.error.quota":"Quota limit reached or too many requests. Please try again later.","chat.error.modelService":"The model service returned an error. Please retry or try again later.","chat.error.cancelled":"Request was cancelled. This can happen after system sleep or network interruption. Please try again.","chat.error.maxTokens":"Response was truncated due to reaching the maximum token limit. You may continue the conversation or ask for a more concise response.","chat.error.maxTurnRequests":"The maximum number of model requests per turn has been exceeded. You may send a new message to continue.","chat.newChat":"New Chat","chat.disclaimer":"Answers generated by AI are for reference only","chat.compacted":"Conversation compacted","chat.compacting":"Compacting conversation...","chat.compactCancelled":"Compaction cancelled","phase.preparing":"Preparing","phase.modelRequesting":"Waiting for model","phase.modelStreaming":"Streaming","phase.modelDone":"Processing","phase.toolExecuting":"Running tool","phase.modelStreamingTool":"Writing","phase.retrying":"Retrying","progress.compacting":"Compacting context","input.placeholder":"Start from an idea...","input.placeholderRunning":"Messages will be queued...","input.placeholderPending":"Please handle the permission request first...","input.send":"Send (Enter)","input.stop":"Stop","input.thinking":"Thinking","input.deepThinking":"Deep Thinking","input.promptFailed":"Prompt failed","input.sendQueued":"Send queued (Enter)","input.dropHint":"Drop files here","input.addImage":"Add image","input.addFile":"Add file","input.imageTooLarge":"Image must be under 10MB","input.tooManyImages":"Up to 5 images allowed","input.fileTooLarge":"File must be under 1MB","input.tooManyFiles":"Up to 10 files allowed","input.menu.image":"Image","input.menu.file":"File","input.menu.mode":"Mode","input.menu.model":"Model","input.modeSelector":"Mode","input.modelSelector":"Model","input.deepThinkingDesc":"Let the model reason more deeply before answering","input.modelHeader":"Model","mode.default":"Default","mode.default.desc":"Prompts for permission on first use of each tool","mode.acceptEdits":"Accept Edits","mode.acceptEdits.desc":"Automatically accepts file edit permissions for the session","mode.plan":"Plan","mode.plan.desc":"Can analyze but not modify files or execute commands","mode.auto":"Auto","mode.auto.desc":"An AI classifier reviews actions: safe ones are auto-approved, risky ones are denied. Falls back to prompting if unavailable","mode.dontAsk":"Don't Ask","mode.dontAsk.desc":"Never shows permission prompts; runs pre-approved and safe actions, denies anything requiring approval","mode.bypassPermissions":"Bypass Permissions","mode.bypassPermissions.desc":"Skips all permission prompts","input.newline":"New line","input.contextMenu.newline":"New line","input.contextMenu.send":"Send","queue.more":" more queued","status.running":"Running","tool.writeFile":"Write file","tool.readFile":"Read file","tool.execute":"Execute","tool.searchFiles":"Search files","tool.searchContent":"Search content","tool.fetchWeb":"Fetch web","tool.searchWeb":"Search web","tool.defaultName":"Tool","tool.moreItems":"... {count} more","interruption.title":"Permission Required","interruption.tool":"Tool","interruption.allow":"Allow","interruption.allowAll":"Allow All","interruption.deny":"Deny","interruption.approved":"Approved","interruption.denied":"Denied","interruption.edits":"{count} edits","interruption.yes":"Yes","interruption.keepPlanning":"No, keep planning","interruption.exitPlanMode":"Exit plan mode","interruption.readyToCode":"Ready to code?","theme.light":"Light","theme.dark":"Dark","theme.system":"System","locale.zh":"Chinese","locale.en":"English","locale.system":"System","sidebar.nav.plugins":"Plugins","sidebar.nav.tasks":"Tasks","sidebar.search.placeholder":"Search...","sidebar.chatHistory":"Chat History","sidebar.workspace":"Workspace","sidebar.connectionStatus":"Connection Status","sidebar.status":"Status","sidebar.sessionId":"Session ID","sidebar.notConnected":"Not connected","sidebar.modelSelection":"Model Selection","sidebar.noModels":"No models available","sidebar.environment":"Environment","sidebar.cwd":"Working Directory","sidebar.os":"OS","sidebar.nodeVersion":"Node.js","sidebar.gatewayMode":"Gateway Mode","sidebar.tunnelUrl":"Tunnel URL","sidebar.clickToCopy":"Click to copy","sidebar.copied":"Copied","sidebar.permissionMode":"Permission Mode","sidebar.noModes":"No modes available","sidebar.preferences":"Preferences","sidebar.keybindings":"Keybindings","sidebar.group.workspace":"Workspace","sidebar.group.observability":"Observability","sidebar.group.preferences":"Preferences","bottomSheet.attachments":"Attach","bottomSheet.navigation":"Navigate","sidebar.theme":"Theme","sidebar.language":"Language","sidebar.user":"User","sidebar.authMethod":"Password","sidebar.noAuth":"No Auth","sidebar.version":"Remote UI v1.0","connection.connected":"Connected","connection.connecting":"Connecting","connection.disconnected":"Disconnected","connection.error":"Error","message.copyToClipboard":"Copy to clipboard","message.copied":"Copied","message.copy":"Copy","message.assistantName":"CodeBuddy Code","thinking.title":"Thinking Process","thinking.thinking":"Thinking","thinking.done":"Thought for","thinking.seconds":" {n}s","thinking.expand":"Expand","thinking.collapse":"Collapse","diff.noChanges":"No changes","login.title":"CodeBuddy Remote Control","login.subtitle":"Enter the password shown in your terminal","login.placeholder":"Password","login.submit":"Login","login.error.incorrect":"Incorrect password","login.error.rateLimit":"Too many login attempts. Please try again later.","login.error.required":"Password is required","login.hint.password":"Tip: The password is displayed when the server starts.","login.hint.urlAuth":"You can also use <code>?password=xxx</code> to login automatically.","login.hint.disable":'Or set <code>gateway.auth: "none"</code> in <code>settings.json</code> under the CodeBuddy config directory (defaults to <code>~/.codebuddy</code>; override via the <code>CODEBUDDY_CONFIG_DIR</code> environment variable) to disable.',"login.slogan":"Claw Your Ideas . Into Reality","login.tagline":"Triggered Anywhere, Completed Locally.","login.privacy":"Privacy Policy","login.terms":"Terms of Service","sidebar.interactionMode":"Interaction Mode","sidebar.chatMode":"Chat","sidebar.terminalMode":"Terminal","sidebar.canvas":"Canvas","canvas.title":"Infinite Canvas","canvas.addTerminal":"Add Terminal","canvas.zoomIn":"Zoom In","canvas.zoomOut":"Zoom Out","canvas.fitView":"Fit View","canvas.resetView":"Reset View","canvas.empty":"Click the + button in the toolbar to add a terminal","canvas.openStandalone":"Open canvas in new window","canvas.tileMenu.close":"Close","canvas.tileMenu.duplicate":"Duplicate Terminal","canvas.tileMenu.maximize":"Maximize","canvas.tileMenu.minimize":"Minimize","canvas.tileMenu.restore":"Restore","canvas.tileMenu.openStandalone":"Open in new window","canvas.standalone.missingPaneId":"Missing pane ID","canvas.defaultTitle":"Terminal","terminal.connecting":"Connecting terminal...","terminal.title":"Terminal","terminal.disconnected":"Terminal disconnected","terminal.error":"Terminal connection failed","terminal.reconnect":"Reconnect","terminal.splitHorizontal":"Split Right","terminal.splitVertical":"Split Down","terminal.closePane":"Close Terminal","terminal.maxPanes":"Max panes reached","sidebar.instances":"Instances","sidebar.activeInstances":"active instances","sidebar.manageInstances":"Manage Instances","sidebar.remoteControl":"Channels","instance.title":"Instance List","instance.switch":"Instance","instance.switchTitle":"Switch Instance","instance.current":"Current","instance.manual":"Manual","instance.switchTo":"Switch to this instance","instance.manage":"Manage Instances","instance.managerTitle":"Instance Manager","instance.addInstance":"Add Instance","instance.name":"Instance Name","instance.namePlaceholder":"Custom instance name (optional, defaults to directory name)","instance.url":"Instance URL","instance.urlPlaceholder":"https://example.trycloudflare.com","instance.password":"Password","instance.optional":"Optional","instance.passwordPlaceholder":"Access password","instance.cancel":"Cancel","instance.add":"Add","instance.remove":"Remove this instance","instance.noInstances":"No other instances","instance.noInstancesHint":"Start more CodeBuddy Code instances or add remote instances manually","instance.cwd":"Working Directory","instance.topic":"Topic","instance.startedAt":"Started at","instance.local":"Local","instance.tunnel":"Tunnel","instance.uptime.days":"d ago","instance.uptime.hours":"h ago","instance.uptime.minutes":"m ago","instance.uptime.justNow":"Just now","instance.addError":"Failed to add instance","instance.removeError":"Failed to remove instance","instance.copyUrl":"Copy URL","instance.copied":"Copied","instance.subtitle":"Manage and switch between instances","instance.refresh":"Refresh","instance.refreshed":"Refreshed","instance.loading":"Loading instances...","instance.error":"Failed to load instances","instance.retry":"Retry","question.multiple":"multiple","question.customAnswer":"Or type a custom answer...","question.reviewAnswers":"Review answers","question.singleTitle":"Question","question.titleWithCount":"Questions ({count})","question.reviewTab":"Review","question.next":"Next","question.submit":"Submit","question.cancel":"Cancel","question.answered":"Answered","question.cancelled":"Question cancelled","todo.title":"Tasks","todo.executing":"Task {n} executing","todo.untitled":"Untitled","history.title":"Sessions","history.description":"Click a session to switch to that conversation","history.noData":"No sessions","history.noDataHint":"Start a new conversation","history.backToChat":"Back to Chat","history.loading":"Loading...","history.loadError":"Failed to load","history.retry":"Retry","history.current":"Current","history.messages":"{count} messages","history.delete":"Delete","history.deleteConfirm":"Are you sure you want to delete this session?","history.deleteCancel":"Cancel","history.deleteOk":"Delete","history.rename":"Rename","history.renameTitle":"Rename Session","history.renamePlaceholder":"Enter new name","history.renameCancel":"Cancel","history.renameOk":"OK","history.cannotDeleteCurrent":"Cannot delete current session","settings.title":"Preferences","settings.appearance":"Appearance","settings.model":"Model Selection","settings.mode":"Permission Mode","settings.systemInfo":"System Info","settings.backToChat":"Back to Chat","settings.tab.user":"User","settings.tab.project":"Project","settings.group.modelAndReasoning":"Model & Reasoning","settings.group.behavior":"Behavior","settings.group.memory":"Memory","settings.group.language":"Language","settings.group.advanced":"Advanced","settings.group.sandbox":"Security Sandbox","settings.item.model":"Default Model","settings.item.model.desc":"Set the default AI model","settings.item.reasoningEffort":"Reasoning Effort","settings.item.reasoningEffort.desc":"Control model reasoning depth","settings.item.alwaysThinkingEnabled":"Always Enable Thinking","settings.item.autoCompactEnabled":"Auto Compact Context","settings.item.includeCoAuthoredBy":"Include Co-authored-by","settings.item.fileCheckpointingEnabled":"File Checkpointing","settings.item.fileCheckpointingEnabled.desc":"Enable file version rollback","settings.item.promptSuggestionEnabled":"Prompt Suggestions","settings.item.ignoreGitIgnore":"Ignore .gitignore","settings.item.ignoreGitIgnore.desc":"Ignore .gitignore rules when searching","settings.item.deferToolLoading":"Defer Tool Loading","settings.item.hookOutputCollapsed":"Collapse Hook Output","settings.item.memory.enabled":"Enable Memory","settings.item.memory.autoMemoryEnabled":"Auto Memory","settings.item.memory.autoMemoryEnabled.desc":"Auto-save important info to memory","settings.item.language":"Response Language","settings.item.language.desc":"Language for AI responses","settings.item.cleanupPeriodDays":"Chat History Retention (days)","settings.item.imageHistoryRetainRounds":"Image Retention Rounds","settings.item.imageHistoryRetainRounds.desc":"Rounds to retain images in history","settings.item.env":"Environment Variables","settings.item.env.desc":"Variables applied to each session (JSON)","settings.item.sandbox.enabled":"Enable Sandbox","settings.item.sandbox.enabled.desc":"Run Bash commands in sandbox, restrict file and network access","settings.item.sandbox.autoAllowBashIfSandboxed":"Auto-approve in Sandbox","settings.item.sandbox.autoAllowBashIfSandboxed.desc":"Auto-approve commands when running in sandbox","settings.loading":"Loading...","settings.saved":"Saved","settings.saveFailed":"Save failed","settings.notSet":"Not set","settings.default":"Default","settings.reset":"Reset","settings.noProjectSettings":"No project-level settings available","settings.effort.minimal":"Minimal","settings.effort.low":"Low","settings.effort.medium":"Medium","settings.effort.high":"High","settings.effort.xhigh":"Extra High","settings.effort.max":"Max","page.title":"CodeBuddy Code","tool.processExited":"[Process exited]","tool.itemsCount":"{count} items","tool.showAllItems":"Show all {count} items","tool.moreLinesCount":"... {count} more lines","tool.generatedImage":"Generated image","tool.editedImage":"Edited image","tool.imageGen":"ImageGen","tool.imageEdit":"ImageEdit","tool.toolSearch":"ToolSearch","tool.teamCreate":"TeamCreate","tool.teamDelete":"TeamDelete","tool.taskCreate":"TaskCreate","tool.taskUpdate":"TaskUpdate","tool.taskList":"TaskList","tool.taskGet":"TaskGet","tool.sendMessage":"SendMessage","tool.shutdown":"Shutdown","tool.taskCompleted":"Task completed","tool.shutdownRejected":"Shutdown rejected","tool.planResponse":"Plan response","tool.approved":"approved","tool.rejected":"rejected","tool.userRejectedResult":"User rejected this tool use","tool.webSearch":"WebSearch","tool.webFetch":"WebFetch","tool.saveMemory":"SaveMemory","tool.askUserQuestion":"AskUserQuestion","tool.enterPlanMode":"Enter Plan Mode","tool.exitPlanMode":"Exit Plan Mode","tool.allowedActions":"Allowed actions:","tool.skill":"Skill","tool.agent":"Agent","tool.failed":"failed","tool.completed":"completed","tool.toolsCount":"{count} tools","tool.background":"background","tool.permissionsCount":"{count} permissions","terminal.unknownError":"Unknown error","terminal.processExited":"[Process exited]","terminal.connectionLost":"Connection lost","terminal.wsConnectionFailed":"WebSocket connection failed","terminal.createSessionFailed":"Failed to create terminal session","terminal.reconnectFailed":"Reconnect failed","team.title":"Team","team.activeCount":"{count} active","team.doneCount":"{count} done","team.waitingForTeammates":"Waiting for {count} teammate{s}…","team.backToMain":"Back to main chat","team.loadingHistory":"Loading conversation…","team.noHistory":"No conversation history yet","team.agentRunning":"Agent is running…","team.delivered":"Delivered","team.showLess":"Show less","team.moreLines":"… ({count} more lines)","team.tools":"{count} tools","team.tokens":"{count} tokens","instance.tunnelMode":"Tunnel","instance.localMode":"Local","workspace.searchPlaceholder":"Search directories...","workspace.switch":"Switch","workspace.switchHere":"Switch to this directory","workspace.switching":"Switching...","workspace.noResults":"No matching directories","workspace.emptyDir":"This directory is empty","workspace.pathPlaceholder":"Enter path or directory name...","workspace.selectDir":"Create bot in this directory","workspace.filterPlaceholder":"Filter subdirectories...","workspace.recent.title":"Recent Workspaces","workspace.recent.daysAgo":"d ago","workspace.recent.hoursAgo":"h ago","workspace.recent.minutesAgo":"m ago","workspace.recent.justNow":"Just now","workspace.recent.remove":"Remove","workspace.browseTitle":"Browse Workspaces","workspace.recentWorkspaces":"Recent Workspaces","workspace.createNew":"Create New Bot","workspace.browseDir":"Browse Directory","workspace.instanceLocal":"Local","workspace.instanceTunnel":"Tunnel","workspace.instanceCurrent":"Current","workspace.switchInstance":"Switch","workspace.switchingInstance":"Switching...","workspace.switchingWithGateway":"Preparing to switch...","workspace.instanceStarted":"Started","workspace.noWorkspaces":"No active workspaces","workspace.noWorkspacesHint":"Browse directories to create a new bot","workspace.instanceCount":"{count} bots","question.multiLabel":"multi","tasks.title":"Recommended Templates","tasks.subtitle":"Select a template to create a scheduled task","tasks.loading":"Loading recommended templates...","tasks.error":"Failed to load templates","tasks.retry":"Retry","tasks.refresh":"Refresh","tasks.refreshed":"Refreshed","tasks.empty":"No templates available","tasks.interval":"Every {value}","tasks.interval.1d":"Daily","tasks.interval.2d":"Every 2 days","tasks.interval.3d":"Every 3 days","tasks.interval.1w":"Weekly","tasks.interval.2w":"Every 2 weeks","tasks.interval.1m":"Monthly","scheduled.title":"Scheduled Tasks","scheduled.subtitle":"Active scheduled tasks in the current session","scheduled.loading":"Loading...","scheduled.empty":"No scheduled tasks","scheduled.emptyHint":"Use /loop or CronCreate in chat to create one","scheduled.create":"Create Task","scheduled.creating":"Creating...","scheduled.delete":"Delete","scheduled.cron":"Cron Expression","scheduled.prompt":"Prompt","scheduled.promptPlaceholder":"Prompt to execute on each fire...","scheduled.recurring":"Recurring","scheduled.oneShot":"One-shot","scheduled.durable":"Durable","scheduled.sessionOnly":"Session-only","scheduled.lastFired":"Last fired","plugins.title":"Plugins","plugins.installedPlugins":"Installed Plugins","plugins.browseMarketplace":"Browse Marketplace","plugins.marketplaces":"Marketplaces","plugins.enabled":"Enabled","plugins.disabled":"Disabled","plugins.enable":"Enable","plugins.disable":"Disable","plugins.uninstall":"Uninstall","plugins.install":"Install","plugins.confirmUninstall":"Are you sure you want to uninstall this plugin?","plugins.marketplace":"Marketplace","plugins.addMarketplace":"Add Marketplace","plugins.removeMarketplace":"Remove","plugins.confirmRemoveMarketplace":"Are you sure you want to remove this marketplace?","plugins.noPlugins":"No plugins installed","plugins.noPluginsHint":"Install plugins from a marketplace to extend functionality","plugins.noMarketplaces":"No marketplaces configured","plugins.noMarketplacesHint":"Add a plugin marketplace to browse and install plugins","plugins.selectMarketplace":"Select Marketplace","plugins.selectMarketplaceHint":"Select a marketplace to browse available plugins","plugins.marketplaceNotFound":"Marketplace not found","plugins.noAvailablePlugins":"No available plugins in this marketplace","plugins.noAvailablePluginsHint":"Try adding other marketplaces or check back later","plugins.installed":"Installed","plugins.browsingMarketplace":"Loading...","plugins.loading":"Loading...","plugins.error":"Failed to load plugins","plugins.retry":"Retry","plugins.sourcePlaceholder":"Marketplace URL (Git URL or local path)","plugins.namePlaceholder":"Marketplace name (optional)","plugins.cancel":"Cancel","plugins.add":"Add","plugins.version":"Version","plugins.operationFailed":"Operation failed","plugins.searchPlaceholder":"Search plugins...","plugins.allMarketplaces":"All Marketplaces","plugins.noSearchResults":"No matching plugins found","plugins.totalCount":"plugins","plugins.refresh":"Refresh","plugins.installedLabel":"Installed","plugins.category":"Category","plugins.author":"Author","plugins.license":"License","plugins.homepage":"Homepage","plugins.repository":"Repository","plugins.source":"Source","plugins.keywords":"Keywords","plugins.features":"Features","plugins.scope":"Scope","plugins.scope.user":"User","plugins.scope.project":"Project","plugins.scope.project-local":"Local","plugins.installScope.user":"Install for you (user scope)","plugins.installScope.project":"Install for all collaborators (project scope)","plugins.installScope.local":"Install for you, in this repo only (local scope)","plugins.policyCannotRemove":"Cannot be uninstalled","plugins.policyCannotSwitchoff":"Cannot be disabled","plugins.policyCannotEdit":"Cannot be edited","channel.from":"From","channel.group":"Group","channel.replyTo":"Reply to {source}","channel.wechat":"WeChat","channel.wecom":"WeCom","channel.wecomBot":"WeCom Bot","remoteControl.title":"Remote Control","remoteControl.subtitle":"Manage channel connections","remoteControl.connectedChannels":"Connected Channels","remoteControl.noChannels":"No channels connected","remoteControl.noChannelsHint":"Add a WeChat or WeCom channel, or install more from the marketplace","remoteControl.addWeChat":"Add WeChat Bot","remoteControl.addWeCom":"Add WeCom Bot","remoteControl.connect":"Connect","remoteControl.disconnect":"Disconnect","remoteControl.delete":"Delete","remoteControl.add":"Add","remoteControl.connected":"Connected","remoteControl.disconnected":"Disconnected","remoteControl.connecting":"Connecting...","remoteControl.installMore":"Install More Channels","remoteControl.installMoreHint":"Browse the plugin marketplace for third-party channel plugins","remoteControl.browseMarketplace":"Browse Marketplace","remoteControl.builtIn":"Built-in","remoteControl.plugin":"Plugin","remoteControl.rebind":"Rebind","remoteControl.unbind":"Unbind","remoteControl.bot":" Bot","remoteControl.default":"Default ","remoteControl.next":"Next","remoteControl.cancel":"Cancel","remoteControl.wecomBotIdHint":"From: WeCom Admin → Apps → AI Assistant","remoteControl.wecomSecretHint":"Enter Secret and press Enter or click Connect","remoteControl.fetchingQr":"Fetching QR code...","remoteControl.scanQr":"Scan QR code with WeChat","sidebar.docs":"Docs","docs.title":"Documentation","docs.search.placeholder":"Search docs...","docs.search.noResults":"No matching documents found","docs.search.resultsCount":"{count} results","docs.loading":"Loading...","docs.loadError":"Failed to load document","docs.notFound":"Document not found","docs.apiReference":"API Reference","docs.toc":"On this page","docs.retry":"Retry","docs.backToList":"Back to docs","docs.expandAll":"Expand all","docs.collapseAll":"Collapse all","docs.openStandalone":"Open in new window","sidebar.stats":"Statistics","stats.title":"Statistics","stats.loading":"Loading statistics...","stats.refresh":"Refresh","stats.noData":"No statistics available","stats.tab.overview":"Overview","stats.tab.models":"Models","stats.tab.tools":"Tools","stats.sessions":"Sessions","stats.messages":"Messages","stats.activeDays":"Active Days","stats.currentStreak":"Current Streak","stats.longestStreak":"Longest Streak","stats.peakHour":"Peak Hour","stats.longestSession":"Longest Session","stats.favoriteModel":"Favorite Model","stats.totalTokens":"Total Tokens","stats.timeRange":"Stats from the last {days} days","stats.heatmap.less":"Less","stats.heatmap.more":"More","stats.days":"days","stats.tokensPerDay":"Tokens per Day","stats.allModels":"All Models","stats.input":"Input","stats.output":"Output","stats.cacheRead":"Cache Read","stats.cacheHitRate":"Cache Hit Rate","stats.cost":"Cost","stats.topTools":"Top Tools","stats.session.title":"Current Session","stats.session.apiDuration":"API Duration","stats.session.wallTime":"Wall Time","stats.session.linesAdded":"Lines Added","stats.session.linesDeleted":"Lines Deleted","stats.session.tokens":"Tokens","stats.na":"N/A","stats.heatmap.messages":"messages","stats.funFact.moreTokens":"You've used ~{times}x more tokens than {book}","stats.funFact.sameTokens":"You've used the same number of tokens as {book}","stats.funFact.longerSession":"Your longest session is ~{times}x longer than {activity}","sidebar.traces":"Traces","traces.title":"Traces","traces.loading":"Loading...","traces.refresh":"Refresh","traces.clear":"Clear","traces.clearConfirm":"Clear all trace data?","traces.noData":"No trace data yet. Send a message and traces will be collected automatically.","traces.selectWorker":"Select Worker","traces.current":"current","traces.spanCount":"{count} spans","traces.duration":"Duration","traces.status.ok":"OK","traces.status.error":"Error","traces.status.running":"Running","traces.status.cancelled":"Cancelled","traces.bottleneck":"Bottleneck","traces.bottleneckTip":"Slowest span, {pct}% of total","traces.spanDetail":"Span Detail","traces.spanDetail.type":"Type","traces.spanDetail.duration":"Duration","traces.spanDetail.model":"Model","traces.spanDetail.tokens":"Tokens","traces.spanDetail.input":"Input","traces.spanDetail.output":"Output","traces.spanDetail.error":"Error","traces.spanDetail.cancelReason":"Cancel reason","traces.spanDetail.attributes":"Attributes","traces.legend.agent":"Agent","traces.legend.generation":"Generation","traces.legend.function":"Function","traces.legend.handoff":"Handoff","traces.legend.guardrail":"Guardrail","traces.back":"Back","traces.tab.timeline":"Timeline","traces.tab.tree":"Tree","traces.tab.flame":"Flame","traces.tab.graph":"Graph","traces.expandAll":"Expand All","traces.collapseAll":"Collapse All","traces.search":"Search spans...","traces.selfTime":"Self Time","traces.spanDetail.overview":"Overview","traces.spanDetail.io":"Input/Output","traces.noSpans":"No spans","traces.noSpansFiltered":"No spans match the current filter.","traces.clearFilter":"Clear filter","traces.auto":"auto","traces.auxiliaryCount":"{count} auxiliary traces (memory, title, etc.)","traces.noIO":"No input/output data","traces.noAttrs":"No attributes","traces.io.expand":"Expand","traces.io.collapse":"Collapse","traces.io.messages":"Messages","traces.io.less":"Less","traces.io.moreChars":"+{count} chars","traces.fit":"Fit","traces.allSessions":"All sessions","traces.allInstances":"All instances","traces.llmCalls":"{count} LLM","traces.errors":"errors","traces.noErrors":"No failed traces","traces.errorBanner":"{count} failed trace(s) detected","traces.errorBannerCta":"Show only errors →","traces.errorSummaryTitle":"{count} error(s) in this trace","traces.jumpToFirstError":"Jump to first error span","traces.copyError":"Copy","traces.onlyErrors":"Errors only","traces.filter.all":"All","traces.filter.error":"Error","traces.filter.running":"Running","traces.filter.cancelled":"Cancelled","traces.filter.ok":"OK","sidebar.metrics":"Metrics","metrics.title":"System Metrics","metrics.loading":"Loading metrics...","metrics.refresh":"Refresh","metrics.cpu":"CPU","metrics.memory":"Memory","metrics.disk":"Disk","metrics.cores":"cores","metrics.workers":"Workers","metrics.noWorkers":"No running workers","metrics.current":"Current","metrics.uptime":"Uptime","metrics.version":"Version","sidebar.editor":"Files","editor.title":"Code Editor","editor.loading":"Loading...","editor.loadError":"Failed to load","editor.noFile":"Select a file to start editing","editor.unsaved":"Unsaved","editor.save":"Save","editor.saveAll":"Save All","editor.close":"Close","editor.closeOthers":"Close Others","editor.closeAll":"Close All","editor.newFile":"New File","editor.newFolder":"New Folder","editor.rename":"Rename","editor.delete":"Delete","editor.refresh":"Refresh","editor.emptyFolder":"Empty folder","editor.explorer":"EXPLORER","editor.toggleSidebar":"Toggle Sidebar","editor.collapseAll":"Collapse All","editor.openFolder":"Open Folder","editor.openFolderPlaceholder":"Enter directory path...","editor.parentFolder":"Parent Folder","editor.pin":"Pin","editor.unpin":"Unpin","editor.copyPath":"Copy Path","editor.copyRelativePath":"Copy Relative Path","editor.revealInExplorer":"Reveal in Explorer","editor.closeToRight":"Close to the Right","editor.closeSaved":"Close Saved","editor.quickOpen":"Quick Open File","editor.focusExplorer":"Focus Explorer","editor.recentFiles":"Recent Files","editor.quickOpenPlaceholder":"Type filename to search...","editor.quickOpenEmpty":"No matching files","editor.quickOpenLoading":"Loading file list...","editor.selected":"selected","editor.lines":"lines","editor.preview":"Switch to Preview","editor.source":"Switch to Source","sidebar.workers":"Workers","workers.title":"Worker Processes","workers.refresh":"Refresh","workers.active":"Active Workers","workers.empty":"No active worker processes","workers.daemon":"Daemon","workers.daemon.running":"Running","workers.daemon.stopped":"Stopped","workers.daemon.start":"Start","workers.daemon.starting":"Starting...","workers.daemon.stop":"Stop","workers.daemon.restart":"Restart","workers.action.logs":"Logs","workers.action.open":"Open","workers.action.kill":"Kill","workers.action.kill.confirm":"Are you sure you want to kill this worker process?","sidebar.logs":"Logs","logs.title":"Log Viewer","logs.selectWorker":"Select Worker","logs.current":"current","logs.search":"Search logs...","logs.autoRefresh":"Auto Refresh","logs.refresh":"Refresh","logs.empty":"No log content","command.btw.description":"Ask a quick side question without interrupting the main Agent work","command.clear.description":"Start a fresh conversation (previous chats remain accessible via /resume)","command.context.description":"Calculate and display context token distribution","command.cost.description":"Show the total cost and duration of the current session","command.doctor.description":"Diagnose and verify your CodeBuddy installation and settings","command.feedback.description":"Open the issue feedback page to report bugs or suggest features","command.gateway.description":'Manage the remote control gateway. Subcommands: "status" to show current status, "stop" to stop the gateway, "token" to regenerate access token, "tunnel" to start with tunnel',"command.remote-control.description":"Manage remote control long connection clients (start, stop, status, list)","command.login.description":"Switch Tencent Cloud CodeBuddy accounts","command.logout.description":"Sign out from your CodeBuddy Code account","command.plan.description":"Preview the current plan file content","command.pr-comments.description":"Get comments from a GitHub pull request","command.release-notes.description":"View release notes","command.review.description":"Review a pull request","command.skills.description":"List available skills","command.todos.description":"Display the current session's todo list","command.reload-plugins.description":"Reload all plugins, skills, agents, hooks, and MCP/LSP servers without restarting","command.plugin-validate.description":"Validate a plugin directory structure and manifest","command.init.description":"Analyzing your codebase…","command.compact.description":"Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]","command.upgrade.description":"Open upgrade page in browser","command.statusline.description":"Set up Codebuddy Code's status line UI","command.security-review.description":"Complete a security review of the pending changes on the current branch","command.insights.description":"Generate AI-powered insights about your CodeBuddy Code usage patterns and activity","command.loop.description":"Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)","command.task-manager.description":"Team task management - Smart task entry, assignment, tracking and analysis","sidebar.changes":"Changes","fileChanges.title":"Changes","fileChanges.changesSection":"FILE CHANGES","fileChanges.empty":"No file changes","fileChanges.showChanges":"Show file changes","fileChanges.hideChanges":"Hide file changes","fileChanges.revertAll":"Revert all","fileChanges.revertCode":"Revert code","fileChanges.revertChat":"Revert chat","fileChanges.revertCodeAndChat":"Revert all","fileChanges.checkpoints":"Checkpoints","fileChanges.noCheckpoints":"No checkpoints","filePreview.binaryNotSupported":"This file cannot be previewed in the editor","filePreview.download":"Download","error.viewCrashed":"This view encountered an error","error.appCrashed":"Something went wrong","error.newChatFailed":"Failed to create new chat, please try again","error.switchSessionFailed":"Failed to switch session, please try again","commandPalette.placeholder":"Type a command...","commandPalette.commands":"Commands","commandPalette.views":"Views","commandPalette.actions":"Actions","commandPalette.noResults":"No matching commands","commandPalette.newChat":"New Chat","commandPalette.toggleTheme":"Toggle Theme","commandPalette.toggleLocale":"Toggle Language","commandPalette.tip":"Open command palette","app.confirm":"Confirm","app.cancel":"Cancel","tool.toolSingular":"tool executed","tool.toolPlural":"tools executed","tool.mcpAppLoadHint":"Click to load interactive UI","keybindings.title":"Keybindings","keybindings.search.placeholder":"Search keybindings... (e.g. submit, ctrl+enter)","keybindings.source.default":"Default","keybindings.source.user":"User","keybindings.record.title":"Record Shortcut","keybindings.record.hint":"Press desired key combination...","keybindings.record.conflict":"Conflicts with","keybindings.action.edit":"Edit","keybindings.action.reset":"Reset","keybindings.action.unbind":"Unbind","keybindings.reset.all":"Reset all","keybindings.noResults":"No matching keybindings","keybindings.empty":"No keybindings","keybindings.loading":"Loading...","keybindings.ctx.Global":"Global","keybindings.ctx.Chat":"Chat Input","keybindings.ctx.InputBox":"Text Input","keybindings.ctx.Terminal":"Terminal","keybindings.ctx.Autocomplete":"Autocomplete","keybindings.ctx.Confirmation":"Confirmation","keybindings.ctx.HistorySearch":"History Search","keybindings.ctx.Task":"Task Running","keybindings.ctx.Settings":"Settings","keybindings.ctx.CommandPalette":"Command Palette","keybindings.ctx.Select":"Select List","keybindings.ctx.PermissionDialog":"Permission Dialog","keybindings.ctx.Help":"Help","keybindings.ctx.Plugin":"Plugin","keybindings.ctx.DiffDialog":"Diff Dialog","keybindings.ctx.MessageSelector":"Message Selector","keybindings.ctxDesc.Global":"Active everywhere, regardless of focus","keybindings.ctxDesc.Chat":"When the chat input is focused","keybindings.ctxDesc.InputBox":"When a text input is active","keybindings.ctxDesc.Terminal":"When the terminal view is active","keybindings.ctxDesc.Autocomplete":"When autocomplete menu is visible","keybindings.ctxDesc.Confirmation":"When a confirmation/permission dialog is shown","keybindings.ctxDesc.HistorySearch":"When searching command history (ctrl+r)","keybindings.ctxDesc.Task":"When a task/agent is running in the foreground","keybindings.ctxDesc.Settings":"When the settings panel is open","keybindings.ctxDesc.CommandPalette":"When the command palette is open","keybindings.ctxDesc.Select":"When a select/list component is focused","keybindings.ctxDesc.PermissionDialog":"When a tool permission dialog is shown","keybindings.ctxDesc.Help":"When the help overlay is open","keybindings.ctxDesc.Plugin":"When the plugin dialog is open","keybindings.ctxDesc.DiffDialog":"When the diff dialog is open","keybindings.ctxDesc.MessageSelector":"When the message selector (rewind) is open","keybindings.act.app:interrupt":"Interrupt","keybindings.act.app:exit":"Exit","keybindings.act.app:redraw":"Redraw Screen","keybindings.act.app:toggleTodos":"Toggle Todos","keybindings.act.app:toggleTranscript":"Toggle Transcript","keybindings.act.app:toggleSidebar":"Toggle Sidebar","keybindings.act.app:toggleTerminal":"Toggle Terminal","keybindings.act.app:commandPalette":"Command Palette","keybindings.act.app:newChat":"New Chat","keybindings.act.app:settings":"Settings","keybindings.act.app:focusInput":"Focus Input","keybindings.act.app:keybindings":"Keybinding Settings","keybindings.act.history:search":"Search History","keybindings.act.history:previous":"Previous History","keybindings.act.history:next":"Next History","keybindings.act.history:open":"Open History","keybindings.act.chat:cancel":"Cancel","keybindings.act.chat:submit":"Submit","keybindings.act.chat:newline":"New Line","keybindings.act.chat:killAgents":"Kill Agents","keybindings.act.chat:cycleMode":"Cycle Mode","keybindings.act.chat:modelPicker":"Model Picker","keybindings.act.chat:thinkingToggle":"Toggle Thinking","keybindings.act.chat:undo":"Undo","keybindings.act.chat:externalEditor":"External Editor","keybindings.act.chat:stash":"Stash","keybindings.act.chat:imagePaste":"Paste Image","keybindings.act.autocomplete:accept":"Accept","keybindings.act.autocomplete:dismiss":"Dismiss","keybindings.act.autocomplete:previous":"Previous","keybindings.act.autocomplete:next":"Next","keybindings.act.confirm:yes":"Confirm","keybindings.act.confirm:no":"Cancel","keybindings.act.confirm:previous":"Previous","keybindings.act.confirm:next":"Next","keybindings.act.confirm:toggle":"Toggle","keybindings.act.confirm:toggleExplanation":"Toggle Explanation","keybindings.act.task:background":"Run in Background","keybindings.act.historySearch:next":"Next","keybindings.act.historySearch:accept":"Accept","keybindings.act.historySearch:cancel":"Cancel","keybindings.act.historySearch:execute":"Execute","keybindings.act.settings:close":"Close Settings","keybindings.act.settings:search":"Search Settings","keybindings.act.select:previous":"Previous","keybindings.act.select:next":"Next","keybindings.act.select:accept":"Select","keybindings.act.select:cancel":"Cancel","keybindings.act.commandPalette:close":"Close Palette","keybindings.act.commandPalette:execute":"Execute Command","keybindings.act.commandPalette:previous":"Previous","keybindings.act.commandPalette:next":"Next","keybindings.act.permission:toggleDebug":"Toggle Debug","keybindings.act.diff:dismiss":"Close Diff","keybindings.act.diff:previousFile":"Previous File","keybindings.act.diff:nextFile":"Next File","keybindings.act.diff:viewDetails":"View Details","keybindings.act.plugin:toggle":"Toggle Plugin","keybindings.act.plugin:install":"Install Plugin","keybindings.act.help:dismiss":"Close Help","keybindings.act.transcript:exit":"Exit Transcript","keybindings.act.transcript:toggleShowAll":"Show All","keybindings.act.messageSelector:up":"Up","keybindings.act.messageSelector:down":"Down","keybindings.act.messageSelector:top":"Top","keybindings.act.messageSelector:bottom":"Bottom","keybindings.act.messageSelector:select":"Select","common.close":"Close","changes.revert":"Revert","changes.revertDirectory":"Revert directory","message.clickToEnlarge":"Click to enlarge","channel.botIdPlaceholder":"Enter Bot ID","channel.secretPlaceholder":"Enter Secret","filePreview.zoomOut":"Zoom Out","filePreview.zoomIn":"Zoom In","filePreview.fitToWindow":"Fit to Window","filePreview.actualSize":"Actual Size (1:1)","filePreview.pdfPreview":"PDF Preview","goal.status.usage":`Usage: /goal <condition>
643
643
  Example: /goal all tests pass`,"goal.status.tooLong":"Goal condition is limited to {max} characters (got {actual})","goal.status.hooksDisabled":"/goal cannot run while hooks are disabled (disableAllHooks or allowManagedHooksOnly is set).","goal.status.set":"Goal set: {condition}","goal.status.setReplaced":"Goal replaced: {prev} → {condition}","goal.status.cleared":"Goal cleared: {prev}","goal.status.noGoal":"No goal set","goal.status.active":"Goal active: {condition}","goal.progress.title":"Goal not yet met… continuing","goal.progress.expand":"click to expand","goal.progress.condition":"Goal","goal.progress.reason":"Reason","goal.recap.active":"Goal active","goal.recap.achieved":"Goal achieved","goal.recap.impossible":"Goal could not be achieved","goal.recap.empty.title":"No goal set yet","goal.recap.empty.hint":"Use /goal <condition> to set a session-scoped stop hook.","goal.recap.empty.example":"Example: /goal all tests pass","goal.recap.footer.setAnother":"/goal <condition>","goal.recap.footer.toSetAnother":" to set another · ","goal.recap.footer.escDismiss":"to dismiss","goal.recap.stats.turn":"turn","goal.recap.stats.turns":"turns","goal.recap.stats.token":"token","goal.recap.stats.tokens":"tokens"}};function Rm(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s==null?n:String(s)}):e}function de(){const{mode:e,resolved:t,setLocale:n,toggle:r}=Hi();function s(c,a){const l=Nm[t][c]??c;return Rm(l,a)}function o(c,a){const l=Nm[t][c];if(l!==void 0)return Rm(l,a)}return{t:s,tryT:o,locale:e,resolved:t,setLocale:n,toggleLocale:r}}const vb=4;let wk=0;function Sk(){return`pane-${Date.now()}-${++wk}`}function _b(e){return{id:Sk(),ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}}function Vr(e){return e.type==="leaf"?1:Vr(e.children[0])+Vr(e.children[1])}function Gi(e){return e.type==="leaf"?[e.paneId]:[...Gi(e.children[0]),...Gi(e.children[1])]}function Co(e,t,n,r){return e.type==="leaf"?e.paneId===t?{type:"split",direction:n,children:[{type:"leaf",paneId:t},{type:"leaf",paneId:r}],ratio:.5}:e:{...e,children:[Co(e.children[0],t,n,r),Co(e.children[1],t,n,r)]}}function To(e,t){if(e.type==="leaf")return e.paneId===t?null:e;const n=To(e.children[0],t),r=To(e.children[1],t);return n===null?r:r===null?n:{...e,children:[n,r]}}function wb(e,t,n){if(t.length===0)return e.type==="split"?{...e,ratio:n}:e;if(e.type==="split"){const[r,...s]=t,o=[...e.children];return o[r]=wb(o[r],s,n),{...e,children:o}}return e}function Im(e){const t=_e({"Content-Type":"application/json"});fetch(`/api/v1/pty/${e}`,{method:"DELETE",headers:t}).catch(()=>{})}function Sb(){const e=_b();return{panes:{[e.id]:e},layout:{type:"leaf",paneId:e.id},activePaneId:e.id}}const qa=Sb(),Ae=rt()(Hs((e,t)=>({mode:"chat",mainView:"chat",terminalTitle:null,panes:qa.panes,layout:qa.layout,activePaneId:qa.activePaneId,setMode:n=>{e({mode:n,mainView:n==="terminal"?"terminal":"chat"})},setMainView:n=>{e({mainView:n,mode:n==="terminal"?"terminal":"chat"})},setTerminalTitle:n=>e({terminalTitle:n}),splitPane:(n,r)=>{const s=t(),o=r??s.activePaneId;if(Vr(s.layout)>=vb)return;const c=_b(),a=Co(s.layout,o,n,c.id),l={...s.panes,[c.id]:c};e({layout:a,panes:l,activePaneId:c.id})},closePane:n=>{const r=t();if(Vr(r.layout)<=1)return;const s=To(r.layout,n);if(!s)return;const o=r.panes[n];o!=null&&o.ptySessionId&&Im(o.ptySessionId);const c={...r.panes};delete c[n];const a=Gi(s),l=a.includes(r.activePaneId)?r.activePaneId:a[0];e({layout:s,panes:c,activePaneId:l})},setActivePaneId:n=>e({activePaneId:n}),setRatio:(n,r)=>{const s=Math.max(.1,Math.min(.9,r)),o=wb(t().layout,n,s);e({layout:o})},setPaneSession:(n,r)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],ptySessionId:r},e({panes:s}))},setPaneStatus:(n,r)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],ptyStatus:r},e({panes:s}))},setPaneError:(n,r)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],errorMessage:r},e({panes:s}))},setPaneTitle:(n,r)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],title:r},e({panes:s}))},reset:()=>{const n=t().panes;for(const s of Object.values(n))s.ptySessionId&&Im(s.ptySessionId);const r=Sb();e({panes:r.panes,layout:r.layout,activePaneId:r.activePaneId})}}),{namespace:"terminal",fields:["layout","panes"],scope:"workspace",debounceMs:500,onLoad:(e,t)=>{if(e.layout&&e.panes){const n=e.layout,r=e.panes,s=Gi(n);if(s.every(o=>o in r)){const o=Ae.getState().panes,c={};for(const a of s){const l=o[a],d=r[a];c[a]={...d,ptySessionId:(l==null?void 0:l.ptySessionId)??d.ptySessionId??null,ptyStatus:"disconnected",errorMessage:null}}t({layout:n,panes:c,activePaneId:s[0]})}}}})),kb="/assets/dark-claw-cat-D_ew_BKV.png",Eb="/assets/light-claw-cat-BgBWmnmi.png",Cb="/assets/red-claw-cat--t2EuBIB.png",Tb={small:{container:"w-20 h-20",text:"text-[12px]"},medium:{container:"w-32 h-32",text:"text-[14px]"},large:{container:"w-40 h-40",text:"text-[16px]"}};function Nb({size:e="medium",className:t=""}){const r=Ct(o=>o.resolved)==="dark"?kb:Eb,s=Tb[e];return i.jsxs("div",{className:`relative ${s.container} ${t}`,children:[i.jsx("img",{src:r,alt:"",className:"cat-loading-layer cat-loading-layer-base absolute inset-0 w-full h-full object-contain",decoding:"async",loading:"eager"}),i.jsx("img",{src:Cb,alt:"",className:"cat-loading-layer cat-loading-layer-color absolute inset-0 w-full h-full object-contain",decoding:"async",loading:"eager"})]})}function _n({size:e="medium",text:t="Loading...",className:n=""}){const r=Tb[e];return i.jsxs("div",{className:`flex flex-col items-center justify-center gap-4 ${n}`,children:[i.jsx(Nb,{size:e}),t&&i.jsx("div",{className:`text-text-secondary ${r.text} font-medium animate-pulse`,children:t})]})}function kk({size:e="medium",className:t=""}){return i.jsx(Nb,{size:e,className:t})}const pi={background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",cursorAccent:"#ffffff",selectionBackground:"#add6ff80",black:"#000000",red:"#cd3131",green:"#00bc00",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},hi={background:"#121212",foreground:"#cccccc",cursor:"#cccccc",cursorAccent:"#121212",selectionBackground:"#264f7880",black:"#000000",red:"#f44747",green:"#6a9955",yellow:"#d7ba7d",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#6a9955",brightYellow:"#d7ba7d",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#e5e5e5"},Ek=2e3;function as(){return _e({"Content-Type":"application/json"})}function Ck(e){const t=ca(),n=t?`?password=${encodeURIComponent(t)}`:"";return`/api/v1/pty/${e}/output${n}`}async function Tk(e,t){try{await fetch(`/api/v1/pty/${e}/input/send`,{method:"POST",headers:as(),body:JSON.stringify({data:t})})}catch{}}async function Am(e,t,n){try{await fetch(`/api/v1/pty/${e}/resize`,{method:"POST",headers:as(),body:JSON.stringify({cols:t,rows:n})})}catch{}}async function Lm(e){try{return(await fetch(`/api/v1/pty/${e}`,{headers:as()})).ok}catch{return!1}}async function $m(e,t,n){const r={cols:e,rows:t};n&&(r.cwd=n);const s=await fetch("/api/v1/pty",{method:"POST",headers:as(),body:JSON.stringify(r)});if(!s.ok){const a=await s.json().catch(()=>null),l=typeof(a==null?void 0:a.error)=="string"?a.error:typeof(a==null?void 0:a.message)=="string"?a.message:`HTTP ${s.status}`;throw new Error(l)}const o=await s.json(),c=o.data??o;return{sessionId:c.sessionId,cwd:typeof c.cwd=="string"?c.cwd:""}}async function Om(e){try{const t=await fetch(`/api/v1/pty/${e}`,{headers:as()});if(!t.ok)return null;const n=await t.json(),r=n.data??n;return{cwd:typeof(r==null?void 0:r.cwd)=="string"?r.cwd:""}}catch{return null}}async function Nk(){try{const e=await fetch("/api/v1/pty",{headers:as()});if(!e.ok)return[];const t=await e.json();return(t.data??t).sessions||[]}catch{return[]}}function Rk(e){const t=Ae.getState().panes,n=new Set;for(const[r,s]of Object.entries(t))r!==e&&s.ptySessionId&&n.add(s.ptySessionId);return n}function Ik(e,t){const n=[];let r="",s="",o=t;for(;o<e.length;){const c=e.indexOf(`
644
- `,o);if(c===-1)break;const a=e.substring(o,c);o=c+1,a===""?(s&&n.push({event:r||"message",data:s}),r="",s=""):a.startsWith("event: ")?r=a.substring(7):a.startsWith("data: ")&&(s=a.substring(6))}return{events:n,newIndex:o}}function yl({paneId:e,initialCwd:t,onPtyCreated:n}){const{t:r}=de(),{resolved:s}=Ct(),o=Ae(T=>T.panes[e]),c=Ae(T=>T.activePaneId),a=Ae(T=>T.layout),l=Ae(T=>T.mainView),d=Ae(T=>T.setActivePaneId),u=Ae(T=>T.closePane),p=Ae(T=>T.setPaneSession),g=Ae(T=>T.setPaneStatus),y=Ae(T=>T.setPaneError),S=Ae(T=>T.setPaneTitle),v=Ae(T=>T.setTerminalTitle),m=c===e,f=Vr(a),h=E.useRef(null),b=E.useRef(null),x=E.useRef(null),C=E.useRef(null),_=E.useRef(!0),w=E.useRef(!1),k=E.useRef(!1),N=E.useRef(null),L=E.useRef(null),$=E.useRef(t);$.current=t;const M=E.useRef(n);M.current=n;const O=E.useCallback(()=>{const T=C.current;T&&(T.abort(),C.current=null)},[]),W=E.useCallback((T,A)=>{O(),g(e,"connecting"),L.current=A;const R=new XMLHttpRequest;C.current=R;let j=0;R.open("GET",Ck(A)),R.setRequestHeader(En,$n);const P=ca();P&&R.setRequestHeader("Authorization",`Bearer ${P}`),R.onreadystatechange=()=>{if(R.readyState===XMLHttpRequest.HEADERS_RECEIVED)if(R.status===200){if(!_.current)return;g(e,"connected"),y(e,null);const D=x.current;if(D)try{D.fit(),Am(A,T.cols,T.rows)}catch{}T.focus()}else{if(!_.current)return;g(e,"error"),y(e,`HTTP ${R.status}`)}},R.onprogress=()=>{if(!_.current)return;const{events:D,newIndex:Y}=Ik(R.responseText,j);j=Y;let X="";for(const te of D)try{const ne=JSON.parse(te.data);switch(te.event){case"output":X+=ne.data;break;case"exit":X&&(T.write(X),X=""),p(e,null),g(e,"disconnected"),k.current=!1,L.current=null,T.write(`\r
644
+ `,o);if(c===-1)break;const a=e.substring(o,c);o=c+1,a===""?(s&&n.push({event:r||"message",data:s}),r="",s=""):a.startsWith("event: ")?r=a.substring(7):a.startsWith("data: ")&&(s=a.substring(6))}return{events:n,newIndex:o}}function yl({paneId:e,initialCwd:t,onPtyCreated:n}){const{t:r}=de(),{resolved:s}=Ct(),o=Ae(T=>T.panes[e]),c=Ae(T=>T.activePaneId),a=Ae(T=>T.layout),l=Ae(T=>T.mainView),d=Ae(T=>T.setActivePaneId),u=Ae(T=>T.closePane),p=Ae(T=>T.setPaneSession),g=Ae(T=>T.setPaneStatus),y=Ae(T=>T.setPaneError),S=Ae(T=>T.setPaneTitle),v=Ae(T=>T.setTerminalTitle),m=c===e,f=Vr(a),h=E.useRef(null),b=E.useRef(null),x=E.useRef(null),C=E.useRef(null),_=E.useRef(!0),w=E.useRef(!1),k=E.useRef(!1),N=E.useRef(null),L=E.useRef(null),$=E.useRef(t);$.current=t;const M=E.useRef(n);M.current=n;const O=E.useCallback(()=>{const T=C.current;T&&(T.abort(),C.current=null)},[]),W=E.useCallback((T,A)=>{O(),g(e,"connecting"),L.current=A;const R=new XMLHttpRequest;C.current=R;let j=0;R.open("GET",Ck(A)),R.setRequestHeader(En,$n);const P=ca();P&&R.setRequestHeader("Authorization",`Bearer ${P}`),R.onreadystatechange=()=>{if(R.readyState===XMLHttpRequest.HEADERS_RECEIVED)if(R.status===200){if(!_.current)return;g(e,"connected"),y(e,null),requestAnimationFrame(()=>{if(!_.current)return;const D=x.current;if(D)try{D.fit(),Am(A,T.cols,T.rows)}catch{}}),T.focus()}else{if(!_.current)return;g(e,"error"),y(e,`HTTP ${R.status}`)}},R.onprogress=()=>{if(!_.current)return;const{events:D,newIndex:Y}=Ik(R.responseText,j);j=Y;let X="";for(const te of D)try{const ne=JSON.parse(te.data);switch(te.event){case"output":X+=ne.data;break;case"exit":X&&(T.write(X),X=""),p(e,null),g(e,"disconnected"),k.current=!1,L.current=null,T.write(`\r
645
645
  ${r("terminal.processExited")}\r
646
- `);break;case"keepalive":break}}catch{}X&&T.write(X)},R.onerror=()=>{_.current&&(g(e,"error"),y(e,r("terminal.connectionLost")))},R.onloadend=()=>{var Y;if(!_.current)return;((Y=Ae.getState().panes[e])==null?void 0:Y.ptyStatus)==="connected"&&(g(e,"error"),y(e,r("terminal.connectionLost")))},R.send();const U=T.onData(D=>{L.current&&Tk(L.current,D)}),F=T.onResize(({cols:D,rows:Y})=>{L.current&&Am(L.current,D,Y)});k.current=!0;const B=()=>{U.dispose(),F.dispose(),O(),L.current=null};return N.current=B,B},[O,e,p,g,y]),H=E.useCallback(()=>{const T=h.current;if(!T||w.current)return;const A=s==="dark"?hi:pi;for(;T.firstChild;)T.removeChild(T.firstChild);const R=new vk.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:A,allowProposedApi:!0,scrollback:1e4}),j=new yk.FitAddon;R.loadAddon(j),R.open(T);const P=T.querySelector(".xterm-helper-textarea");P&&(P.setAttribute("autocomplete","off"),P.setAttribute("autocorrect","off"),P.setAttribute("autocapitalize","off"),P.setAttribute("spellcheck","false"),P.setAttribute("unselectable","on")),b.current=R,x.current=j,w.current=!0;const U=R.onTitleChange(Y=>{_.current&&(v(Y||null),S(e,Y||null))});let F=null;const B=()=>{F&&clearTimeout(F),F=setTimeout(()=>{if(_.current)try{j.fit()}catch{}},50)},D=new ResizeObserver(B);return D.observe(T),window.addEventListener("resize",B),()=>{U.dispose(),D.disconnect(),window.removeEventListener("resize",B),F&&clearTimeout(F)}},[]),V=E.useCallback(async()=>{var U,F;const T=b.current,A=x.current;if(!T||!A||!_.current||k.current)return;try{A.fit()}catch{}const R=T.cols||80,j=T.rows||24,P=(U=Ae.getState().panes[e])==null?void 0:U.ptySessionId;if(P&&await Lm(P)&&_.current){if(W(T,P),M.current){const D=await Om(P);D&&_.current&&M.current({sessionId:P,cwd:D.cwd})}return}if(_.current){if(!P){const B=Rk(e),Y=(await Nk()).find(X=>!X.hasClient&&!B.has(X.id));if(Y&&_.current){if(p(e,Y.id),W(T,Y.id),M.current){const X=await Om(Y.id);X&&_.current&&M.current({sessionId:Y.id,cwd:X.cwd})}return}}if(_.current){g(e,"connecting");try{const B=$.current||void 0,{sessionId:D,cwd:Y}=await $m(R,j,B);if(!_.current)return;p(e,D),W(T,D),(F=M.current)==null||F.call(M,{sessionId:D,cwd:Y})}catch(B){if(!_.current)return;g(e,"error"),y(e,B.message||r("terminal.createSessionFailed"))}}}},[W,e,p,g,y]),J=E.useRef(null);E.useEffect(()=>{_.current=!0;const T=h.current;if(!T)return;const A=()=>{if(!_.current)return;const{clientWidth:j,clientHeight:P}=T;if(!(j===0||P===0)&&(w.current||(J.current=H()||null),b.current&&x.current)){try{x.current.fit()}catch{}k.current||V()}};if(T.clientWidth>0&&T.clientHeight>0){const j=requestAnimationFrame(A);return()=>cancelAnimationFrame(j)}const R=new ResizeObserver(j=>{for(const P of j){const{width:U,height:F}=P.contentRect;if(U>0&&F>0){R.disconnect(),A();break}}});return R.observe(T),()=>R.disconnect()},[H,V]),E.useEffect(()=>()=>{var T,A,R;_.current=!1,(T=N.current)==null||T.call(N),(A=J.current)==null||A.call(J),(R=b.current)==null||R.dispose(),b.current=null,x.current=null,w.current=!1,k.current=!1},[]),E.useEffect(()=>{const T=b.current;if(T){const A=s==="dark"?hi:pi;T.options.theme=A;try{T.refresh(0,T.rows-1)}catch{}}},[s,l]);const ee=E.useCallback(async()=>{var A,R,j;if(O(),k.current=!1,g(e,"connecting"),y(e,null),await new Promise(P=>setTimeout(P,Ek)),!_.current)return;const T=b.current;if(T)try{T.clear();try{(A=x.current)==null||A.fit()}catch{}const P=T.cols||80,U=T.rows||24,F=(R=Ae.getState().panes[e])==null?void 0:R.ptySessionId;if(F&&await Lm(F)&&_.current){W(T,F);return}if(!_.current)return;const B=$.current||void 0,{sessionId:D,cwd:Y}=await $m(P,U,B);if(!_.current)return;p(e,D),W(T,D),(j=M.current)==null||j.call(M,{sessionId:D,cwd:Y})}catch(P){if(!_.current)return;g(e,"error"),y(e,P.message||r("terminal.reconnectFailed"))}},[O,W,e,p,g,y]),I=E.useCallback(()=>{var T;m||d(e),(T=b.current)==null||T.focus()},[m,e,d]);return o?i.jsxs("div",{className:`terminal-pane flex flex-col h-full w-full ${m&&f>1?"active":""}`,style:{backgroundColor:s==="dark"?hi.background:pi.background},onClick:I,children:[f>1&&i.jsx("div",{className:"terminal-pane-toolbar",children:i.jsx("button",{onClick:T=>{T.stopPropagation(),u(e)},className:"w-6 h-6 flex items-center justify-center rounded bg-bg-tertiary/80 text-text-secondary hover:text-text-primary hover:bg-bg-hover transition-colors",title:r("terminal.closePane"),children:i.jsx(it,{size:14})})}),i.jsx("div",{ref:h,className:"flex-1 w-full",style:{overflow:"hidden",padding:"4px"}}),o.ptyStatus==="connecting"&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{backgroundColor:s==="dark"?`${hi.background}cc`:`${pi.background}cc`},children:i.jsx(_n,{size:"small",text:r("terminal.connecting")})}),o.ptyStatus==="error"&&i.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-between px-4 py-2 bg-accent-red/10 border-t border-accent-red/30 z-10",children:[i.jsxs("div",{className:"flex items-center gap-2 text-accent-red text-xs",children:[i.jsx(P_,{size:14}),i.jsx("span",{children:o.errorMessage||r("terminal.error")})]}),i.jsxs("button",{onClick:ee,className:"flex items-center gap-1.5 px-3 py-1 rounded-md bg-bg-secondary border border-border-muted text-text-primary text-xs hover:bg-bg-hover transition-colors",children:[i.jsx(Et,{size:12}),i.jsx("span",{children:r("terminal.reconnect")})]})]})]}):i.jsx("div",{})}const Ak="chat",Dm=new Set(["chat","tasks","plugins","terminal","canvas","canvas-pane","remote-control","settings","docs","editor","changes","metrics","workers","logs","keybindings","stats","traces"]);function xl(){let t=window.location.hash.slice(1);t.startsWith("/")&&(t=t.slice(1));const n=t.split("?")[0]||"";if(Dm.has(n))return n;const r=n.split("/")[0];return Dm.has(r)?r:Ak}function jm(e){const t=new URLSearchParams(window.location.search),n=window.location.hash.slice(1),r=n.indexOf("?");r!==-1&&new URLSearchParams(n.slice(r+1)).forEach((a,l)=>{t.has(l)||t.set(l,a)});const s=t.toString(),o=s?`#/${e}?${s}`:`#/${e}`;window.location.hash=o}function Lk(e){const t=()=>{const n=xl();e(n)};return window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}}function Wi(){const t=window.location.hash.slice(1).replace(/^\//,"").split("?")[0],n=t.indexOf("/");return n>0?t.slice(n+1):void 0}function ws(e,t){const r=new URLSearchParams(window.location.search).toString(),s=r?`#/${e}/${t}?${r}`:`#/${e}/${t}`;window.location.hash=s}function qi(){const e=window.location.hash.slice(1),t=e.indexOf("?");return t>=0?new URLSearchParams(e.slice(t+1)):new URLSearchParams}function Rb(e){const t=new URLSearchParams(window.location.search);t.set("path",e),window.location.hash=`#/editor?${t.toString()}`}const Mm=400,Pm=300,Va=200,Ka=150,Za=.1,Ya=5,kn=20,Fm=3,Ib=8,$k=10,Ab=32,Ok=Ab;function Lb(){return _e({"Content-Type":"application/json"})}async function Dk(e){try{const t=await fetch(`/api/v1/pty/${e}`,{headers:Lb()});if(!t.ok)return null;const n=await t.json(),r=n.data??n;return typeof(r==null?void 0:r.cwd)=="string"?r.cwd:null}catch{return null}}function $b(e){const t=Object.values(e);if(t.length===0)return;const r={...Ae.getState().panes};let s=!1;for(const o of t){const c=r[o.paneId];c?o.ptySessionId&&c.ptySessionId!==o.ptySessionId&&(r[o.paneId]={...c,ptySessionId:o.ptySessionId},s=!0):(r[o.paneId]={id:o.paneId,ptySessionId:o.ptySessionId??null,ptyStatus:"disconnected",errorMessage:null},s=!0)}s&&Ae.setState({panes:r})}const Qe=rt()(Hs((e,t)=>({viewport:{panX:0,panY:0,zoom:1},tiles:{},nextZIndex:1,selectedTileIds:[],setViewport:n=>{e({viewport:n})},addTile:()=>{const n=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,r=`canvas-pane-${n}`,{nextZIndex:s,viewport:o}=t(),c=o.zoom||1,a=(-o.panX+window.innerWidth/2)/c-Mm/2,l=(-o.panY+window.innerHeight/2)/c-Pm/2,d=Math.round(a/kn)*kn,u=Math.round(l/kn)*kn,p={id:n,type:"terminal",x:d,y:u,width:Mm,height:Pm,zIndex:s,paneId:r,windowState:"normal",ptySessionId:null,cwd:null},g=Ae.getState();if(!g.panes[r]){const y={...g.panes,[r]:{id:r,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}};Ae.setState({panes:y})}return e(y=>({tiles:{...y.tiles,[n]:p},nextZIndex:y.nextZIndex+1})),n},duplicateTile:n=>{var h,b,x,C;const r=t().tiles[n];if(!r)return null;const s=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,o=`canvas-pane-${s}`,{nextZIndex:c}=t(),a=((h=r.prevBounds)==null?void 0:h.width)??r.width,l=((b=r.prevBounds)==null?void 0:b.height)??r.height,d=((x=r.prevBounds)==null?void 0:x.x)??r.x,u=((C=r.prevBounds)==null?void 0:C.y)??r.y,p=kn*2,g=Math.round((d+p)/kn)*kn,y=Math.round((u+p)/kn)*kn,S={id:s,type:"terminal",x:g,y,width:a,height:l,zIndex:c,paneId:o,windowState:"normal",ptySessionId:null,cwd:r.cwd??null},v=Ae.getState();v.panes[o]||Ae.setState({panes:{...v.panes,[o]:{id:o,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}}}),e(_=>({tiles:{..._.tiles,[s]:S},nextZIndex:_.nextZIndex+1}));const m=Ae.getState().panes[r.paneId],f=m==null?void 0:m.ptySessionId;return f&&Dk(f).then(_=>{_&&(t().updateTile(r.id,{cwd:_}),t().updateTile(s,{cwd:_}))}),s},removeTile:n=>{const r=t().tiles[n];if(r){const s=Ae.getState(),o=s.panes[r.paneId];if(o!=null&&o.ptySessionId&&fetch(`/api/v1/pty/${o.ptySessionId}`,{method:"DELETE",headers:Lb()}).catch(()=>{}),s.panes[r.paneId]){const{[r.paneId]:c,...a}=s.panes;Ae.setState({panes:a})}}e(s=>{const{[n]:o,...c}=s.tiles;return{tiles:c,selectedTileIds:s.selectedTileIds.filter(a=>a!==n)}})},updateTile:(n,r)=>{e(s=>{const o=s.tiles[n];return o?{tiles:{...s.tiles,[n]:{...o,...r}}}:s})},selectTile:n=>e({selectedTileIds:[n]}),deselectAll:()=>e({selectedTileIds:[]}),selectTiles:n=>e({selectedTileIds:n}),bringToFront:n=>{e(r=>{const s=r.tiles[n];return s?{tiles:{...r.tiles,[n]:{...s,zIndex:r.nextZIndex}},nextZIndex:r.nextZIndex+1}:r})},maximizeTile:n=>{e(r=>{const s=r.tiles[n];if(!s)return r;const o=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...r.tiles,[n]:{...s,windowState:"maximized",prevBounds:o,zIndex:r.nextZIndex}},nextZIndex:r.nextZIndex+1}})},minimizeTile:n=>{e(r=>{const s=r.tiles[n];if(!s)return r;const o=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...r.tiles,[n]:{...s,height:Ok,windowState:"minimized",prevBounds:o}}}})},restoreTile:n=>{e(r=>{const s=r.tiles[n];return!s||!s.prevBounds?s?{tiles:{...r.tiles,[n]:{...s,windowState:"normal"}}}:r:{tiles:{...r.tiles,[n]:{...s,x:s.prevBounds.x,y:s.prevBounds.y,width:s.prevBounds.width,height:s.prevBounds.height,windowState:"normal",prevBounds:void 0}}}})},toggleMaximize:n=>{const r=t().tiles[n];r&&(r.windowState==="maximized"?t().restoreTile(n):t().maximizeTile(n))},toggleMinimize:n=>{const r=t().tiles[n];r&&(r.windowState==="minimized"?t().restoreTile(n):t().minimizeTile(n))},setTilePty:(n,r,s)=>{let o=null;if(e(c=>{const a=c.tiles[n];if(!a)return c;o=a.paneId;const l={...a,ptySessionId:r};return s!==void 0&&(l.cwd=s),{tiles:{...c.tiles,[n]:l}}}),o){const c=Ae.getState(),a=c.panes[o];a&&a.ptySessionId!==r&&Ae.setState({panes:{...c.panes,[o]:{...a,ptySessionId:r}}})}},loadFromStorage:()=>{}}),{namespace:"canvas",fields:["viewport","tiles","nextZIndex"],scope:"workspace",debounceMs:1e3,onLoad:(e,t)=>{const n={};e.viewport&&(n.viewport=e.viewport),e.tiles&&(n.tiles=e.tiles),e.nextZIndex!==void 0&&(n.nextZIndex=e.nextZIndex),Object.keys(n).length>0&&(t(n),n.tiles&&$b(n.tiles))}}));$b(Qe.getState().tiles);function jk(){const{t:e}=de(),[t,n]=E.useState(()=>qi().get("paneId")||"");E.useEffect(()=>{const a=()=>{n(qi().get("paneId")||"")};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]);const r=Qe(a=>Object.values(a.tiles).find(l=>l.paneId===t)??null),s=Ae(a=>{var l;return t?(l=a.panes[t])==null?void 0:l.title:null}),o=Qe(a=>a.setTilePty),c=E.useCallback(a=>{r&&o(r.id,a.sessionId,a.cwd||null)},[r,o]);return E.useEffect(()=>{if(!t)return;const a=Ae.getState();a.panes[t]||Ae.setState({panes:{...a.panes,[t]:{id:t,ptySessionId:(r==null?void 0:r.ptySessionId)??null,ptyStatus:"disconnected",errorMessage:null}}})},[t,r==null?void 0:r.ptySessionId]),t?i.jsxs("div",{className:"flex flex-col h-full w-full bg-bg-primary",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",borderBottom:"1px solid var(--color-border-default)"},children:[i.jsx(ss,{size:14,style:{opacity:.6}}),i.jsx("span",{className:"text-xs truncate",style:{fontSize:12,fontWeight:500},children:s||e("canvas.defaultTitle")})]}),i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(yl,{paneId:t,initialCwd:(r==null?void 0:r.cwd)??null,onPtyCreated:c})})]}):i.jsx("div",{className:"flex items-center justify-center h-full w-full bg-bg-primary text-text-secondary text-sm",children:e("canvas.standalone.missingPaneId")})}class Ri{constructor(){pe(this,"panX",0);pe(this,"panY",0);pe(this,"zoom",1)}getState(){return{panX:this.panX,panY:this.panY,zoom:this.zoom}}setState(t){this.panX=t.panX,this.panY=t.panY,this.zoom=Math.max(Za,Math.min(Ya,t.zoom))}screenToWorld(t,n){return this.zoom===0?{x:0,y:0}:{x:(t-this.panX)/this.zoom,y:(n-this.panY)/this.zoom}}worldToScreen(t,n){return{x:t*this.zoom+this.panX,y:n*this.zoom+this.panY}}applyZoom(t,n,r){const s=this.zoom,o=Math.exp(-t*.6/100),c=Math.max(Za,Math.min(Ya,s*o));if(s===0)return this.zoom=c,this.getState();const a=c/s-1;return this.panX-=(n-this.panX)*a,this.panY-=(r-this.panY)*a,this.zoom=c,this.getState()}applyPan(t,n){return this.panX+=t,this.panY+=n,this.getState()}fitTiles(t,n,r,s=40){if(t.length===0)return this.resetView();let o=1/0,c=1/0,a=-1/0,l=-1/0;for(const m of t)o=Math.min(o,m.x),c=Math.min(c,m.y),a=Math.max(a,m.x+m.width),l=Math.max(l,m.y+m.height);const d=a-o,u=l-c;if(d<=0||u<=0)return this.resetView();const p=n-s*2,g=r-s*2;if(p<=0||g<=0)return this.resetView();const y=Math.max(Za,Math.min(Ya,Math.min(p/d,g/u))),S=(n-d*y)/2-o*y,v=(r-u*y)/2-c*y;return this.panX=S,this.panY=v,this.zoom=y,this.getState()}resetView(){return this.panX=0,this.panY=0,this.zoom=1,this.getState()}}const Bm=120;function Mk(){const{t:e}=de(),t=Qe(f=>f.viewport),n=Qe(f=>f.tiles),r=Qe(f=>f.setViewport),s=Qe(f=>f.addTile),o=E.useRef(null),c=Math.round(t.zoom*100),a=typeof window<"u"&&window.location.hash.includes("standalone");if(Object.values(n).some(f=>f.windowState==="maximized"))return null;const d=()=>{var h;const f=(h=o.current)==null?void 0:h.parentElement;return{w:(f==null?void 0:f.clientWidth)??window.innerWidth,h:(f==null?void 0:f.clientHeight)??window.innerHeight}},u=()=>{const f=new Ri;f.setState(t);const{w:h,h:b}=d(),x=f.applyZoom(-Bm,h/2,b/2);r(x)},p=()=>{const f=new Ri;f.setState(t);const{w:h,h:b}=d(),x=f.applyZoom(Bm,h/2,b/2);r(x)},g=()=>{const f=new Ri;f.setState(t);const{w:h,h:b}=d(),x=Object.values(n);x.length===0?r(f.resetView()):r(f.fitTiles(x,h,b,60))},y=()=>{s()},S=()=>{const f=new URLSearchParams(window.location.search),h=new URLSearchParams;h.set("standalone","1"),f.forEach((x,C)=>{h.has(C)||h.set(C,x)});const b=`${window.location.pathname}${window.location.search}#/canvas?${h.toString()}`;window.open(b,"canvas-standalone","noopener,noreferrer")},v="w-8 h-8 flex items-center justify-center rounded-lg transition-colors",m={border:"none",background:"transparent",color:"var(--color-text-secondary)",cursor:"pointer"};return i.jsxs("div",{ref:o,className:"canvas-toolbar fixed bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-1 px-2 py-1 rounded-xl",style:{background:"var(--color-bg-card)",border:"1px solid var(--color-border-default)",boxShadow:"0 2px 12px rgba(0,0,0,0.12)",zIndex:1e4},children:[i.jsx("button",{className:v,style:m,onClick:y,title:e("canvas.addTerminal"),children:i.jsx(gn,{size:16})}),i.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),i.jsx("button",{className:v,style:m,onClick:p,title:e("canvas.zoomOut"),children:i.jsx(gk,{size:16})}),i.jsxs("span",{className:"text-xs tabular-nums select-none",style:{minWidth:40,textAlign:"center",color:"var(--color-text-secondary)"},children:[c,"%"]}),i.jsx("button",{className:v,style:m,onClick:u,title:e("canvas.zoomIn"),children:i.jsx(mk,{size:16})}),i.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),i.jsx("button",{className:v,style:m,onClick:g,title:e("canvas.fitView"),children:i.jsx(eS,{size:16})}),!a&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),i.jsx("button",{className:v,style:m,onClick:S,title:e("canvas.openStandalone"),children:i.jsx(mn,{size:16})})]})]})}function Cr(e,t=kn,n=$k){const r=(e%t+t)%t;return r<=n?e-r:t-r<=n?e+(t-r):e}function Pk(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}class Fk{constructor(){pe(this,"dragState",null);pe(this,"spacePressed",!1);pe(this,"callbacks",null);pe(this,"keydownHandler",null);pe(this,"keyupHandler",null);pe(this,"dragStarted",!1);pe(this,"panSamples",[])}attach(t){this.callbacks=t,this.keydownHandler=n=>{if(n.code==="Space"&&!n.repeat){if(Pk(n.target))return;this.spacePressed=!0,n.preventDefault()}},this.keyupHandler=n=>{n.code==="Space"&&(this.spacePressed=!1)},window.addEventListener("keydown",this.keydownHandler),window.addEventListener("keyup",this.keyupHandler)}detach(){this.keydownHandler&&(window.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.keyupHandler&&(window.removeEventListener("keyup",this.keyupHandler),this.keyupHandler=null),this.callbacks=null,this.dragState=null}get isSpacePressed(){return this.spacePressed}get isDragging(){return this.dragState!==null&&this.dragStarted}get currentDrag(){return this.dragState}handlePointerDown(t,n,r,s){var l,d,u;const o=t.clientX,c=t.clientY;this.dragStarted=!1,this.panSamples=[],(d=(l=this.callbacks)==null?void 0:l.onInteractionStart)==null||d.call(l);const a=(u=this.callbacks)==null?void 0:u.getViewport();if(this.spacePressed||!n&&!r){const p=t.shiftKey||t.ctrlKey||t.metaKey;!this.spacePressed&&p?this.dragState={type:"select",startScreenX:o,startScreenY:c}:(this.dragState={type:"pan",startScreenX:o,startScreenY:c,initialViewport:a?{...a}:void 0},this.panSamples=[{t:performance.now(),x:o,y:c}]);return}if(n&&r){const p=s[n];if(!p)return;this.dragState={type:"resize",startScreenX:o,startScreenY:c,tileId:n,handle:r,initialTiles:{[n]:{x:p.x,y:p.y,width:p.width,height:p.height}}};return}if(n){const p=s[n];if(!p)return;const g={};g[n]={x:p.x,y:p.y,width:p.width,height:p.height},this.dragState={type:"move",startScreenX:o,startScreenY:c,tileId:n,initialTiles:g}}}handlePointerMove(t){var o,c;if(!this.dragState||!this.callbacks)return;const n=t.clientX-this.dragState.startScreenX,r=t.clientY-this.dragState.startScreenY;if(!this.dragStarted){if(Math.abs(n)<Fm&&Math.abs(r)<Fm)return;this.dragStarted=!0}const s=this.callbacks.getViewport();switch(this.dragState.type){case"pan":{const a=this.dragState.initialViewport;if(a){const u=n,p=r;this.callbacks.onViewportPan(a.panX+u-s.panX,a.panY+p-s.panY)}const l=performance.now();this.panSamples.push({t:l,x:t.clientX,y:t.clientY});const d=l-100;for(;this.panSamples.length>2&&this.panSamples[0].t<d;)this.panSamples.shift();break}case"move":{if(this.dragState.tileId&&s.zoom!==0){const a=n/s.zoom,l=r/s.zoom,d=(o=this.dragState.initialTiles)==null?void 0:o[this.dragState.tileId];d&&this.callbacks.onTileMove(this.dragState.tileId,Cr(d.x+a),Cr(d.y+l))}break}case"resize":{if(this.dragState.tileId&&this.dragState.handle&&s.zoom!==0){const a=(c=this.dragState.initialTiles)==null?void 0:c[this.dragState.tileId];if(a){const l=n/s.zoom,d=r/s.zoom,u=this.applyResize(this.dragState.handle,a,l,d);this.callbacks.onTileResize(this.dragState.tileId,u)}}break}case"select":{const a={x:Math.min(this.dragState.startScreenX,t.clientX),y:Math.min(this.dragState.startScreenY,t.clientY),width:Math.abs(n),height:Math.abs(r)};this.callbacks.onSelectionBox(a);break}}}handlePointerUp(t){var s,o,c,a;if(!this.callbacks){this.dragState=null;return}const n=((s=this.dragState)==null?void 0:s.type)==="pan",r=this.dragStarted;if(this.dragStarted?((a=this.dragState)==null?void 0:a.type)==="select"&&(this.callbacks.onSelectionBox(null),this.callbacks.onBoxSelectEnd([])):(o=this.dragState)!=null&&o.tileId?this.callbacks.onTileClick(this.dragState.tileId):((c=this.dragState)==null?void 0:c.type)==="select"&&this.callbacks.onCanvasClick(),n&&r&&this.panSamples.length>=2&&this.callbacks.onPanInertiaStart){const l=this.panSamples[this.panSamples.length-1],d=this.panSamples[0],u=l.t-d.t;if(u>0){const p=(l.x-d.x)/u,g=(l.y-d.y)/u;Math.hypot(p,g)>.05&&this.callbacks.onPanInertiaStart(p,g)}}this.dragState=null,this.dragStarted=!1,this.panSamples=[]}getSelectedTileIds(t,n){const r=[],s=t.x,o=t.y,c=t.width,a=t.height;for(const l of Object.values(n))l.x<s+c&&l.x+l.width>s&&l.y<o+a&&l.y+l.height>o&&r.push(l.id);return r}getResizeHandle(t,n,r,s=Ib){const{x:o,y:c,width:a,height:l}=t,d=o+a/2,u=c+l/2,p=o+a,g=c+l;return this.hitTest(n,r,o,c,s)?"nw":this.hitTest(n,r,p,c,s)?"ne":this.hitTest(n,r,o,g,s)?"sw":this.hitTest(n,r,p,g,s)?"se":this.hitTest(n,r,d,c,s)?"n":this.hitTest(n,r,d,g,s)?"s":this.hitTest(n,r,o,u,s)?"w":this.hitTest(n,r,p,u,s)?"e":null}applyResize(t,n,r,s){let{x:o,y:c,width:a,height:l}=n;switch(t){case"n":c=n.y+s,l=n.height-s;break;case"s":l=n.height+s;break;case"w":o=n.x+r,a=n.width-r;break;case"e":a=n.width+r;break;case"nw":o=n.x+r,c=n.y+s,a=n.width-r,l=n.height-s;break;case"ne":c=n.y+s,a=n.width+r,l=n.height-s;break;case"sw":o=n.x+r,a=n.width-r,l=n.height+s;break;case"se":a=n.width+r,l=n.height+s;break}return a<Va&&((t==="w"||t==="nw"||t==="sw")&&(o=n.x+n.width-Va),a=Va),l<Ka&&((t==="n"||t==="nw"||t==="ne")&&(c=n.y+n.height-Ka),l=Ka),o=Cr(o),c=Cr(c),a=Cr(a),l=Cr(l),{x:o,y:c,width:a,height:l}}isInTileHeader(t,n,r,s){const o=Ab*s;return n>=t.x&&n<=t.x+t.width&&r>=t.y&&r<=t.y+o}hitTest(t,n,r,s,o){return Math.abs(t-r)<=o&&Math.abs(n-s)<=o}}const Bk=[{position:"n",cursor:"ns-resize",className:"top-0 left-2 right-2 h-1.5 -translate-y-1/2"},{position:"s",cursor:"ns-resize",className:"bottom-0 left-2 right-2 h-1.5 translate-y-1/2"},{position:"e",cursor:"ew-resize",className:"right-0 top-2 bottom-2 w-1.5 translate-x-1/2"},{position:"w",cursor:"ew-resize",className:"left-0 top-2 bottom-2 w-1.5 -translate-x-1/2"},{position:"nw",cursor:"nwse-resize",className:"top-0 left-0 w-3 h-3 -translate-x-1/2 -translate-y-1/2"},{position:"ne",cursor:"nesw-resize",className:"top-0 right-0 w-3 h-3 translate-x-1/2 -translate-y-1/2"},{position:"sw",cursor:"nesw-resize",className:"bottom-0 left-0 w-3 h-3 -translate-x-1/2 translate-y-1/2"},{position:"se",cursor:"nwse-resize",className:"bottom-0 right-0 w-3 h-3 translate-x-1/2 translate-y-1/2"}];function zk({tile:e,viewport:t,isSelected:n}){const{t:r}=de(),s=Qe(T=>T.removeTile),o=Qe(T=>T.duplicateTile),c=Qe(T=>T.toggleMaximize),a=Qe(T=>T.toggleMinimize),l=Qe(T=>T.setTilePty),d=Qe(T=>T.selectTile),u=Qe(T=>T.bringToFront),p=Ae(T=>{var A;return(A=T.panes[e.paneId])==null?void 0:A.title}),{panX:g,panY:y,zoom:S}=t,v=e.x*S+g,m=e.y*S+y,f=e.windowState==="maximized",h=e.windowState==="minimized",b=n?"var(--color-canvas-tile-border-selected)":"var(--color-canvas-tile-border)",x=E.useCallback(()=>{c(e.id)},[e.id,c]),C=E.useCallback(()=>{a(e.id)},[e.id,a]),_=E.useCallback(()=>{o(e.id)},[e.id,o]),w=E.useCallback(T=>{T.target.closest("button")||(T.stopPropagation(),h?a(e.id):c(e.id))},[e.id,h,c,a]),k=E.useCallback(T=>{l(e.id,T.sessionId,T.cwd||null)},[e.id,l]),N=E.useRef(null),[L,$]=E.useState(!1);E.useEffect(()=>{const T=A=>{$(A.shiftKey||A.altKey)};return window.addEventListener("keydown",T),window.addEventListener("keyup",T),()=>{window.removeEventListener("keydown",T),window.removeEventListener("keyup",T)}},[]);const M=n||L,O=E.useRef(null),W=E.useCallback(T=>{O.current={x:T.clientX,y:T.clientY,id:T.pointerId}},[]),H=E.useCallback(T=>{O.current=null},[]),V=E.useCallback(T=>{var j;if(T.ctrlKey||T.metaKey||T.shiftKey||!n)return;const R=(j=N.current)==null?void 0:j.querySelector(".xterm-viewport");R&&(R.scrollTop+=T.deltaY,T.stopPropagation())},[n]),J=E.useCallback(()=>{const T=new URLSearchParams(window.location.search),A=new URLSearchParams;A.set("paneId",e.paneId),T.forEach((j,P)=>{A.has(P)||A.set(P,j)});const R=`${window.location.pathname}${window.location.search}#/canvas-pane?${A.toString()}`;window.open(R,`canvas-pane-${e.paneId}`,"noopener,noreferrer")},[e.paneId]),ee=f?{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",transform:"none",pointerEvents:"auto",zIndex:9999,borderRadius:0,border:"none",overflow:"hidden",boxShadow:"none"}:{transform:`translate(${v}px, ${m}px) scale(${S})`,transformOrigin:"top left",width:e.width,height:e.height,willChange:"transform",pointerEvents:"auto",zIndex:e.zIndex,borderRadius:8,border:`1px solid ${b}`,overflow:"hidden",boxShadow:n?"0 0 0 1px var(--color-canvas-tile-border-selected)":"0 2px 8px rgba(0,0,0,0.08)"},I=E.useCallback(T=>{var P;if(T.button!==0)return;d(e.id),u(e.id);const A=(P=N.current)==null?void 0:P.querySelector(".xterm-helper-textarea");if(!A)return;const R=()=>{try{A.focus()}catch{}};R();const j=()=>{window.removeEventListener("pointerup",j,!0),R()};window.addEventListener("pointerup",j,!0)},[e.id,d,u]);return i.jsxs("div",{className:f?"canvas-tile":"absolute canvas-tile",style:ee,onPointerDownCapture:I,children:[i.jsxs("div",{className:"canvas-tile-header flex items-center gap-1.5 px-2 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",cursor:"grab",borderBottom:h?"none":"1px solid var(--color-canvas-tile-border)"},onDoubleClick:w,children:[i.jsx(ss,{size:13,style:{opacity:.5,flexShrink:0}}),i.jsx("span",{className:"flex-1 text-xs truncate",style:{fontSize:12,fontWeight:500},children:p||r("canvas.defaultTitle")}),i.jsx("button",{onClick:T=>{T.stopPropagation(),_()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r("canvas.tileMenu.duplicate"),children:i.jsx($s,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),J()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r("canvas.tileMenu.openStandalone"),children:i.jsx(mn,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),C()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r(h?"canvas.tileMenu.restore":"canvas.tileMenu.minimize"),children:h?i.jsx(bl,{size:12}):i.jsx(lb,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),x()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r(f?"canvas.tileMenu.restore":"canvas.tileMenu.maximize"),children:f?i.jsx(ob,{size:12}):i.jsx(pa,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),s(e.id)},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r("canvas.tileMenu.close"),children:i.jsx(it,{size:12})})]}),!h&&i.jsxs("div",{ref:N,className:"flex-1 relative",style:{height:"calc(100% - 32px)",overflow:"hidden"},children:[i.jsx(yl,{paneId:e.paneId,initialCwd:e.cwd??null,onPtyCreated:k}),i.jsx("div",{className:"absolute inset-0","data-canvas-tile-focused":n?"true":"false",style:{zIndex:5,pointerEvents:M?"none":"auto",background:"transparent"},onPointerDown:W,onPointerUp:H,onWheel:V})]}),!h&&Bk.map(T=>i.jsx("div",{className:`absolute ${T.className}`,style:{cursor:T.cursor,zIndex:10,opacity:0},"data-resize-handle":T.position},T.position))]})}function Uk({rect:e}){return i.jsx("div",{className:"absolute pointer-events-none",style:{left:e.x,top:e.y,width:e.width,height:e.height,background:"var(--color-canvas-selection-fill)",border:"1px solid var(--color-canvas-selection-stroke)",borderRadius:2,zIndex:999}})}function Hk(){const e=E.useRef(null),t=E.useRef(new Ri),n=E.useRef(new Fk),r=Qe(T=>T.tiles),s=Qe(T=>T.viewport),o=Qe(T=>T.selectedTileIds),c=Qe(T=>T.setViewport),a=Qe(T=>T.updateTile),l=Qe(T=>T.selectTile),d=Qe(T=>T.selectTiles),u=Qe(T=>T.deselectAll),p=Qe(T=>T.bringToFront),[g,y]=E.useState(null),[S,v]=E.useState(!1),[m,f]=E.useState(!1),[h,b]=E.useState(null);E.useEffect(()=>{t.current.setState(s)},[s]);const x=E.useMemo(()=>Object.values(r).sort((T,A)=>T.zIndex-A.zIndex),[r]),C=E.useMemo(()=>new Set(o),[o]),_=E.useRef(s);_.current=s;const w=E.useRef({setViewport:c,updateTile:a,selectTile:l,deselectAll:u,bringToFront:p,selectTiles:d});w.current={setViewport:c,updateTile:a,selectTile:l,deselectAll:u,bringToFront:p,selectTiles:d};const k=.92,N=.01,L=3.5,$=E.useRef(null),M=E.useRef({vx:0,vy:0,last:0}),O=E.useCallback(()=>{$.current!==null&&(cancelAnimationFrame($.current),$.current=null)},[]),W=E.useCallback((T,A)=>{O();const R=Math.hypot(T,A);if(R>L){const P=L/R;T*=P,A*=P}M.current={vx:T,vy:A,last:performance.now()};const j=()=>{const P=performance.now(),U=M.current,F=Math.min(32,P-U.last);U.last=P;const D=t.current.applyPan(U.vx*F,U.vy*F);w.current.setViewport(D);const Y=Math.pow(k,F/16.67);if(U.vx*=Y,U.vy*=Y,Math.hypot(U.vx,U.vy)<N){$.current=null;return}$.current=requestAnimationFrame(j)};$.current=requestAnimationFrame(j)},[O]);E.useEffect(()=>()=>O(),[O]),E.useEffect(()=>{const T=n.current,A={onViewportPan:(R,j)=>{const U=t.current.applyPan(R,j);w.current.setViewport(U)},onTileMove:(R,j,P)=>{w.current.updateTile(R,{x:j,y:P})},onTileResize:(R,j)=>{w.current.updateTile(R,j)},onTileSelect:R=>{w.current.selectTile(R),w.current.bringToFront(R)},onSelectionBox:R=>{if(R){const j=e.current,P=j==null?void 0:j.getBoundingClientRect();y(P?{x:R.x-P.left,y:R.y-P.top,width:R.width,height:R.height}:R)}else y(null)},onBoxSelectEnd:()=>{},onTileClick:R=>{w.current.selectTile(R),w.current.bringToFront(R)},onCanvasClick:()=>{w.current.deselectAll()},onInteractionStart:()=>{O()},onPanInertiaStart:(R,j)=>{W(R,j)},getViewport:()=>_.current};return T.attach(A),()=>T.detach()},[]),E.useEffect(()=>{const T=e.current;if(!T)return;const A=t.current,R=U=>{const F=U.target,B=!!(F&&F.closest('.xterm, .xterm-screen, .xterm-viewport, input, textarea, [contenteditable="true"], [contenteditable=""]')),D=!!(F&&F.closest('[data-canvas-tile-focused="true"]')),Y=U.ctrlKey||U.metaKey;if((B||D)&&!Y&&!U.shiftKey)return;U.preventDefault();const X=T.getBoundingClientRect(),te=U.clientX-X.left,ne=U.clientY-X.top;if(Y){const ue=A.applyZoom(U.deltaY,te,ne);c(ue);return}let se=-U.deltaX,be=-U.deltaY;U.shiftKey&&se===0&&(se=-U.deltaY,be=0);const me=U.deltaMode===1?16:U.deltaMode===2?100:1,ge=A.applyPan(se*me,be*me);c(ge)},j=U=>{if(!(U.ctrlKey||U.metaKey))return;const F=U.target;if(F){const B=F.tagName;if(B==="INPUT"||B==="TEXTAREA"||B==="SELECT"||F.isContentEditable)return}if(U.key==="+"||U.key==="="||U.key==="-"||U.key==="_"||U.key==="0"){U.preventDefault();const B=T.clientWidth,D=T.clientHeight;if(U.key==="0")c(A.resetView());else if(U.key==="-"||U.key==="_"){const Y=A.applyZoom(120,B/2,D/2);c(Y)}else{const Y=A.applyZoom(-120,B/2,D/2);c(Y)}}},P=U=>{U.preventDefault()};return T.addEventListener("wheel",R,{passive:!1}),window.addEventListener("keydown",j),T.addEventListener("gesturestart",P),T.addEventListener("gesturechange",P),T.addEventListener("gestureend",P),()=>{T.removeEventListener("wheel",R),window.removeEventListener("keydown",j),T.removeEventListener("gesturestart",P),T.removeEventListener("gesturechange",P),T.removeEventListener("gestureend",P)}},[c]);const H=E.useCallback(T=>{const A=e.current;if(!A)return;const R=T.button===1||T.button===2,j=n.current.isSpacePressed,P=A.getBoundingClientRect(),U=T.clientX-P.left,F=T.clientY-P.top,B=n.current;let D=null,Y=null,X=null;if(!R&&!j){const me=[...Object.values(r)].sort((ge,ue)=>ue.zIndex-ge.zIndex);for(const ge of me){const ue=ge.x*s.zoom+s.panX,Ne=ge.y*s.zoom+s.panY,Te=ge.width*s.zoom,ce=ge.height*s.zoom,ke={x:ue,y:Ne,width:Te,height:ce},Ue=B.getResizeHandle(ke,U,F,Ib);if(Ue){D=ge.id,Y=Ue,X=ge.id;break}if(B.isInTileHeader(ke,U,F,s.zoom)){D=ge.id,X=ge.id;break}if(U>=ue&&U<=ue+Te&&F>=Ne&&F<=Ne+ce){X=ge.id;break}}}const te=T.target;if(!R&&!j&&Y===null&&X&&C.has(X)&&te&&te.closest(".xterm, .xterm-screen, .xterm-viewport, .xterm-rows"))return;const ne=T.target;if(ne&&!(R||j||Y!==null)&&(ne.closest("button")||ne.closest("input, textarea:not(.xterm-helper-textarea), select")||ne.closest('[contenteditable="true"], [contenteditable=""]')))return;if(R&&T.preventDefault(),!X&&!Y){const me=document.activeElement;me&&typeof me.blur=="function"&&me.blur(),u()}const be=T.nativeEvent;B.handlePointerDown(be,D,Y,r),X?(l(X),p(X)):(T.shiftKey||T.ctrlKey||T.metaKey)&&u(),A.setPointerCapture(T.pointerId),v(B.isSpacePressed)},[r,s,l,u,p,C]),V=E.useCallback(T=>{var R;const A=n.current;A.handlePointerMove(T.nativeEvent),v(A.isSpacePressed),f(A.isDragging),b(((R=A.currentDrag)==null?void 0:R.type)??null)},[]),J=E.useCallback(T=>{var j;const A=n.current;if(((j=A.currentDrag)==null?void 0:j.type)==="select"&&A.isDragging&&g){const P=s.zoom||1,U={x:(g.x-s.panX)/P,y:(g.y-s.panY)/P,width:g.width/P,height:g.height/P},F=A.getSelectedTileIds(U,r);d(F)}A.handlePointerUp(T.nativeEvent);const R=e.current;R&&R.releasePointerCapture(T.pointerId),f(!1),b(null),y(null)},[s,r,d,g]),I=m&&h==="pan"?"grabbing":S?"grab":"default";return i.jsxs("div",{ref:e,className:"absolute inset-0",style:{cursor:I,touchAction:"none",overscrollBehavior:"contain"},onPointerDown:H,onPointerMove:V,onPointerUp:J,onContextMenu:T=>T.preventDefault(),children:[i.jsx("div",{className:"absolute inset-0",style:{pointerEvents:"none"},children:x.map(T=>i.jsx(zk,{tile:T,viewport:s,isSelected:C.has(T.id)},T.id))}),g&&i.jsx(Uk,{rect:g})]})}function zm(){const e=Qe(r=>r.tiles),{t}=de(),n=Object.keys(e).length>0;return i.jsxs("div",{className:"relative w-full h-full overflow-hidden bg-bg-primary",children:[i.jsx(Hk,{}),i.jsx(Mk,{}),!n&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:i.jsx("p",{className:"text-text-tertiary text-sm",children:t("canvas.empty")})})]})}function Um(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gk(e){if(Array.isArray(e))return e}function Wk(e,t,n){return(t=Jk(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qk(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,c,a=[],l=!0,d=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){d=!0,s=u}finally{try{if(!l&&n.return!=null&&(c=n.return(),Object(c)!==c))return}finally{if(d)throw s}}return a}}function Vk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
646
+ `);break;case"keepalive":break}}catch{}X&&T.write(X)},R.onerror=()=>{_.current&&(g(e,"error"),y(e,r("terminal.connectionLost")))},R.onloadend=()=>{var Y;if(!_.current)return;((Y=Ae.getState().panes[e])==null?void 0:Y.ptyStatus)==="connected"&&(g(e,"error"),y(e,r("terminal.connectionLost")))},R.send();const U=T.onData(D=>{L.current&&Tk(L.current,D)}),F=T.onResize(({cols:D,rows:Y})=>{L.current&&Am(L.current,D,Y)});k.current=!0;const B=()=>{U.dispose(),F.dispose(),O(),L.current=null};return N.current=B,B},[O,e,p,g,y]),H=E.useCallback(()=>{const T=h.current;if(!T||w.current)return;const A=s==="dark"?hi:pi;for(;T.firstChild;)T.removeChild(T.firstChild);const R=new vk.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:A,allowProposedApi:!0,scrollback:1e4}),j=new yk.FitAddon;R.loadAddon(j),R.open(T);const P=T.querySelector(".xterm-helper-textarea");P&&(P.setAttribute("autocomplete","off"),P.setAttribute("autocorrect","off"),P.setAttribute("autocapitalize","off"),P.setAttribute("spellcheck","false"),P.setAttribute("unselectable","on")),b.current=R,x.current=j,w.current=!0;const U=R.onTitleChange(X=>{_.current&&(v(X||null),S(e,X||null))});let F=null;const B=()=>{F&&clearTimeout(F),F=setTimeout(()=>{if(_.current)try{j.fit(),R.refresh(0,R.rows-1)}catch{}},50)},D=new ResizeObserver(B);D.observe(T),window.addEventListener("resize",B);const Y=()=>{document.visibilityState==="visible"&&B()};return document.addEventListener("visibilitychange",Y),()=>{U.dispose(),D.disconnect(),window.removeEventListener("resize",B),document.removeEventListener("visibilitychange",Y),F&&clearTimeout(F)}},[]),V=E.useCallback(async()=>{var U,F;const T=b.current,A=x.current;if(!T||!A||!_.current||k.current)return;try{A.fit()}catch{}const R=T.cols||80,j=T.rows||24,P=(U=Ae.getState().panes[e])==null?void 0:U.ptySessionId;if(P&&await Lm(P)&&_.current){if(W(T,P),M.current){const D=await Om(P);D&&_.current&&M.current({sessionId:P,cwd:D.cwd})}return}if(_.current){if(!P){const B=Rk(e),Y=(await Nk()).find(X=>!X.hasClient&&!B.has(X.id));if(Y&&_.current){if(p(e,Y.id),W(T,Y.id),M.current){const X=await Om(Y.id);X&&_.current&&M.current({sessionId:Y.id,cwd:X.cwd})}return}}if(_.current){g(e,"connecting");try{const B=$.current||void 0,{sessionId:D,cwd:Y}=await $m(R,j,B);if(!_.current)return;p(e,D),W(T,D),(F=M.current)==null||F.call(M,{sessionId:D,cwd:Y})}catch(B){if(!_.current)return;g(e,"error"),y(e,B.message||r("terminal.createSessionFailed"))}}}},[W,e,p,g,y]),J=E.useRef(null);E.useEffect(()=>{_.current=!0;const T=h.current;if(!T)return;const A=()=>{if(!_.current)return;const{clientWidth:j,clientHeight:P}=T;if(!(j===0||P===0)&&(w.current||(J.current=H()||null),b.current&&x.current)){try{x.current.fit()}catch{}k.current||V()}};if(T.clientWidth>0&&T.clientHeight>0){const j=requestAnimationFrame(A);return()=>cancelAnimationFrame(j)}const R=new ResizeObserver(j=>{for(const P of j){const{width:U,height:F}=P.contentRect;if(U>0&&F>0){R.disconnect(),A();break}}});return R.observe(T),()=>R.disconnect()},[H,V]),E.useEffect(()=>()=>{var T,A,R;_.current=!1,(T=N.current)==null||T.call(N),(A=J.current)==null||A.call(J),(R=b.current)==null||R.dispose(),b.current=null,x.current=null,w.current=!1,k.current=!1},[]),E.useEffect(()=>{const T=b.current;if(T){const A=s==="dark"?hi:pi;T.options.theme=A;try{T.refresh(0,T.rows-1)}catch{}}},[s,l]);const ee=E.useCallback(async()=>{var A,R,j;if(O(),k.current=!1,g(e,"connecting"),y(e,null),await new Promise(P=>setTimeout(P,Ek)),!_.current)return;const T=b.current;if(T)try{T.clear();try{(A=x.current)==null||A.fit()}catch{}const P=T.cols||80,U=T.rows||24,F=(R=Ae.getState().panes[e])==null?void 0:R.ptySessionId;if(F&&await Lm(F)&&_.current){W(T,F);return}if(!_.current)return;const B=$.current||void 0,{sessionId:D,cwd:Y}=await $m(P,U,B);if(!_.current)return;p(e,D),W(T,D),(j=M.current)==null||j.call(M,{sessionId:D,cwd:Y})}catch(P){if(!_.current)return;g(e,"error"),y(e,P.message||r("terminal.reconnectFailed"))}},[O,W,e,p,g,y]),I=E.useCallback(()=>{var T;m||d(e),(T=b.current)==null||T.focus()},[m,e,d]);return o?i.jsxs("div",{className:`terminal-pane flex flex-col h-full w-full ${m&&f>1?"active":""}`,style:{backgroundColor:s==="dark"?hi.background:pi.background},onClick:I,children:[f>1&&i.jsx("div",{className:"terminal-pane-toolbar",children:i.jsx("button",{onClick:T=>{T.stopPropagation(),u(e)},className:"w-6 h-6 flex items-center justify-center rounded bg-bg-tertiary/80 text-text-secondary hover:text-text-primary hover:bg-bg-hover transition-colors",title:r("terminal.closePane"),children:i.jsx(it,{size:14})})}),i.jsx("div",{ref:h,className:"flex-1 w-full",style:{overflow:"hidden",padding:"4px"}}),o.ptyStatus==="connecting"&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{backgroundColor:s==="dark"?`${hi.background}cc`:`${pi.background}cc`},children:i.jsx(_n,{size:"small",text:r("terminal.connecting")})}),o.ptyStatus==="error"&&i.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-between px-4 py-2 bg-accent-red/10 border-t border-accent-red/30 z-10",children:[i.jsxs("div",{className:"flex items-center gap-2 text-accent-red text-xs",children:[i.jsx(P_,{size:14}),i.jsx("span",{children:o.errorMessage||r("terminal.error")})]}),i.jsxs("button",{onClick:ee,className:"flex items-center gap-1.5 px-3 py-1 rounded-md bg-bg-secondary border border-border-muted text-text-primary text-xs hover:bg-bg-hover transition-colors",children:[i.jsx(Et,{size:12}),i.jsx("span",{children:r("terminal.reconnect")})]})]})]}):i.jsx("div",{})}const Ak="chat",Dm=new Set(["chat","tasks","plugins","terminal","canvas","canvas-pane","remote-control","settings","docs","editor","changes","metrics","workers","logs","keybindings","stats","traces"]);function xl(){let t=window.location.hash.slice(1);t.startsWith("/")&&(t=t.slice(1));const n=t.split("?")[0]||"";if(Dm.has(n))return n;const r=n.split("/")[0];return Dm.has(r)?r:Ak}function jm(e){const t=new URLSearchParams(window.location.search),n=window.location.hash.slice(1),r=n.indexOf("?");r!==-1&&new URLSearchParams(n.slice(r+1)).forEach((a,l)=>{t.has(l)||t.set(l,a)});const s=t.toString(),o=s?`#/${e}?${s}`:`#/${e}`;window.location.hash=o}function Lk(e){const t=()=>{const n=xl();e(n)};return window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}}function Wi(){const t=window.location.hash.slice(1).replace(/^\//,"").split("?")[0],n=t.indexOf("/");return n>0?t.slice(n+1):void 0}function ws(e,t){const r=new URLSearchParams(window.location.search).toString(),s=r?`#/${e}/${t}?${r}`:`#/${e}/${t}`;window.location.hash=s}function qi(){const e=window.location.hash.slice(1),t=e.indexOf("?");return t>=0?new URLSearchParams(e.slice(t+1)):new URLSearchParams}function Rb(e){const t=new URLSearchParams(window.location.search);t.set("path",e),window.location.hash=`#/editor?${t.toString()}`}const Mm=400,Pm=300,Va=200,Ka=150,Za=.1,Ya=5,kn=20,Fm=3,Ib=8,$k=10,Ab=32,Ok=Ab;function Lb(){return _e({"Content-Type":"application/json"})}async function Dk(e){try{const t=await fetch(`/api/v1/pty/${e}`,{headers:Lb()});if(!t.ok)return null;const n=await t.json(),r=n.data??n;return typeof(r==null?void 0:r.cwd)=="string"?r.cwd:null}catch{return null}}function $b(e){const t=Object.values(e);if(t.length===0)return;const r={...Ae.getState().panes};let s=!1;for(const o of t){const c=r[o.paneId];c?o.ptySessionId&&c.ptySessionId!==o.ptySessionId&&(r[o.paneId]={...c,ptySessionId:o.ptySessionId},s=!0):(r[o.paneId]={id:o.paneId,ptySessionId:o.ptySessionId??null,ptyStatus:"disconnected",errorMessage:null},s=!0)}s&&Ae.setState({panes:r})}const Qe=rt()(Hs((e,t)=>({viewport:{panX:0,panY:0,zoom:1},tiles:{},nextZIndex:1,selectedTileIds:[],setViewport:n=>{e({viewport:n})},addTile:()=>{const n=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,r=`canvas-pane-${n}`,{nextZIndex:s,viewport:o}=t(),c=o.zoom||1,a=(-o.panX+window.innerWidth/2)/c-Mm/2,l=(-o.panY+window.innerHeight/2)/c-Pm/2,d=Math.round(a/kn)*kn,u=Math.round(l/kn)*kn,p={id:n,type:"terminal",x:d,y:u,width:Mm,height:Pm,zIndex:s,paneId:r,windowState:"normal",ptySessionId:null,cwd:null},g=Ae.getState();if(!g.panes[r]){const y={...g.panes,[r]:{id:r,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}};Ae.setState({panes:y})}return e(y=>({tiles:{...y.tiles,[n]:p},nextZIndex:y.nextZIndex+1})),n},duplicateTile:n=>{var h,b,x,C;const r=t().tiles[n];if(!r)return null;const s=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,o=`canvas-pane-${s}`,{nextZIndex:c}=t(),a=((h=r.prevBounds)==null?void 0:h.width)??r.width,l=((b=r.prevBounds)==null?void 0:b.height)??r.height,d=((x=r.prevBounds)==null?void 0:x.x)??r.x,u=((C=r.prevBounds)==null?void 0:C.y)??r.y,p=kn*2,g=Math.round((d+p)/kn)*kn,y=Math.round((u+p)/kn)*kn,S={id:s,type:"terminal",x:g,y,width:a,height:l,zIndex:c,paneId:o,windowState:"normal",ptySessionId:null,cwd:r.cwd??null},v=Ae.getState();v.panes[o]||Ae.setState({panes:{...v.panes,[o]:{id:o,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}}}),e(_=>({tiles:{..._.tiles,[s]:S},nextZIndex:_.nextZIndex+1}));const m=Ae.getState().panes[r.paneId],f=m==null?void 0:m.ptySessionId;return f&&Dk(f).then(_=>{_&&(t().updateTile(r.id,{cwd:_}),t().updateTile(s,{cwd:_}))}),s},removeTile:n=>{const r=t().tiles[n];if(r){const s=Ae.getState(),o=s.panes[r.paneId];if(o!=null&&o.ptySessionId&&fetch(`/api/v1/pty/${o.ptySessionId}`,{method:"DELETE",headers:Lb()}).catch(()=>{}),s.panes[r.paneId]){const{[r.paneId]:c,...a}=s.panes;Ae.setState({panes:a})}}e(s=>{const{[n]:o,...c}=s.tiles;return{tiles:c,selectedTileIds:s.selectedTileIds.filter(a=>a!==n)}})},updateTile:(n,r)=>{e(s=>{const o=s.tiles[n];return o?{tiles:{...s.tiles,[n]:{...o,...r}}}:s})},selectTile:n=>e({selectedTileIds:[n]}),deselectAll:()=>e({selectedTileIds:[]}),selectTiles:n=>e({selectedTileIds:n}),bringToFront:n=>{e(r=>{const s=r.tiles[n];return s?{tiles:{...r.tiles,[n]:{...s,zIndex:r.nextZIndex}},nextZIndex:r.nextZIndex+1}:r})},maximizeTile:n=>{e(r=>{const s=r.tiles[n];if(!s)return r;const o=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...r.tiles,[n]:{...s,windowState:"maximized",prevBounds:o,zIndex:r.nextZIndex}},nextZIndex:r.nextZIndex+1}})},minimizeTile:n=>{e(r=>{const s=r.tiles[n];if(!s)return r;const o=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...r.tiles,[n]:{...s,height:Ok,windowState:"minimized",prevBounds:o}}}})},restoreTile:n=>{e(r=>{const s=r.tiles[n];return!s||!s.prevBounds?s?{tiles:{...r.tiles,[n]:{...s,windowState:"normal"}}}:r:{tiles:{...r.tiles,[n]:{...s,x:s.prevBounds.x,y:s.prevBounds.y,width:s.prevBounds.width,height:s.prevBounds.height,windowState:"normal",prevBounds:void 0}}}})},toggleMaximize:n=>{const r=t().tiles[n];r&&(r.windowState==="maximized"?t().restoreTile(n):t().maximizeTile(n))},toggleMinimize:n=>{const r=t().tiles[n];r&&(r.windowState==="minimized"?t().restoreTile(n):t().minimizeTile(n))},setTilePty:(n,r,s)=>{let o=null;if(e(c=>{const a=c.tiles[n];if(!a)return c;o=a.paneId;const l={...a,ptySessionId:r};return s!==void 0&&(l.cwd=s),{tiles:{...c.tiles,[n]:l}}}),o){const c=Ae.getState(),a=c.panes[o];a&&a.ptySessionId!==r&&Ae.setState({panes:{...c.panes,[o]:{...a,ptySessionId:r}}})}},loadFromStorage:()=>{}}),{namespace:"canvas",fields:["viewport","tiles","nextZIndex"],scope:"workspace",debounceMs:1e3,onLoad:(e,t)=>{const n={};e.viewport&&(n.viewport=e.viewport),e.tiles&&(n.tiles=e.tiles),e.nextZIndex!==void 0&&(n.nextZIndex=e.nextZIndex),Object.keys(n).length>0&&(t(n),n.tiles&&$b(n.tiles))}}));$b(Qe.getState().tiles);function jk(){const{t:e}=de(),[t,n]=E.useState(()=>qi().get("paneId")||"");E.useEffect(()=>{const a=()=>{n(qi().get("paneId")||"")};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]);const r=Qe(a=>Object.values(a.tiles).find(l=>l.paneId===t)??null),s=Ae(a=>{var l;return t?(l=a.panes[t])==null?void 0:l.title:null}),o=Qe(a=>a.setTilePty),c=E.useCallback(a=>{r&&o(r.id,a.sessionId,a.cwd||null)},[r,o]);return E.useEffect(()=>{if(!t)return;const a=Ae.getState();a.panes[t]||Ae.setState({panes:{...a.panes,[t]:{id:t,ptySessionId:(r==null?void 0:r.ptySessionId)??null,ptyStatus:"disconnected",errorMessage:null}}})},[t,r==null?void 0:r.ptySessionId]),t?i.jsxs("div",{className:"flex flex-col h-full w-full bg-bg-primary",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",borderBottom:"1px solid var(--color-border-default)"},children:[i.jsx(ss,{size:14,style:{opacity:.6}}),i.jsx("span",{className:"text-xs truncate",style:{fontSize:12,fontWeight:500},children:s||e("canvas.defaultTitle")})]}),i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(yl,{paneId:t,initialCwd:(r==null?void 0:r.cwd)??null,onPtyCreated:c})})]}):i.jsx("div",{className:"flex items-center justify-center h-full w-full bg-bg-primary text-text-secondary text-sm",children:e("canvas.standalone.missingPaneId")})}class Ri{constructor(){pe(this,"panX",0);pe(this,"panY",0);pe(this,"zoom",1)}getState(){return{panX:this.panX,panY:this.panY,zoom:this.zoom}}setState(t){this.panX=t.panX,this.panY=t.panY,this.zoom=Math.max(Za,Math.min(Ya,t.zoom))}screenToWorld(t,n){return this.zoom===0?{x:0,y:0}:{x:(t-this.panX)/this.zoom,y:(n-this.panY)/this.zoom}}worldToScreen(t,n){return{x:t*this.zoom+this.panX,y:n*this.zoom+this.panY}}applyZoom(t,n,r){const s=this.zoom,o=Math.exp(-t*.6/100),c=Math.max(Za,Math.min(Ya,s*o));if(s===0)return this.zoom=c,this.getState();const a=c/s-1;return this.panX-=(n-this.panX)*a,this.panY-=(r-this.panY)*a,this.zoom=c,this.getState()}applyPan(t,n){return this.panX+=t,this.panY+=n,this.getState()}fitTiles(t,n,r,s=40){if(t.length===0)return this.resetView();let o=1/0,c=1/0,a=-1/0,l=-1/0;for(const m of t)o=Math.min(o,m.x),c=Math.min(c,m.y),a=Math.max(a,m.x+m.width),l=Math.max(l,m.y+m.height);const d=a-o,u=l-c;if(d<=0||u<=0)return this.resetView();const p=n-s*2,g=r-s*2;if(p<=0||g<=0)return this.resetView();const y=Math.max(Za,Math.min(Ya,Math.min(p/d,g/u))),S=(n-d*y)/2-o*y,v=(r-u*y)/2-c*y;return this.panX=S,this.panY=v,this.zoom=y,this.getState()}resetView(){return this.panX=0,this.panY=0,this.zoom=1,this.getState()}}const Bm=120;function Mk(){const{t:e}=de(),t=Qe(f=>f.viewport),n=Qe(f=>f.tiles),r=Qe(f=>f.setViewport),s=Qe(f=>f.addTile),o=E.useRef(null),c=Math.round(t.zoom*100),a=typeof window<"u"&&window.location.hash.includes("standalone");if(Object.values(n).some(f=>f.windowState==="maximized"))return null;const d=()=>{var h;const f=(h=o.current)==null?void 0:h.parentElement;return{w:(f==null?void 0:f.clientWidth)??window.innerWidth,h:(f==null?void 0:f.clientHeight)??window.innerHeight}},u=()=>{const f=new Ri;f.setState(t);const{w:h,h:b}=d(),x=f.applyZoom(-Bm,h/2,b/2);r(x)},p=()=>{const f=new Ri;f.setState(t);const{w:h,h:b}=d(),x=f.applyZoom(Bm,h/2,b/2);r(x)},g=()=>{const f=new Ri;f.setState(t);const{w:h,h:b}=d(),x=Object.values(n);x.length===0?r(f.resetView()):r(f.fitTiles(x,h,b,60))},y=()=>{s()},S=()=>{const f=new URLSearchParams(window.location.search),h=new URLSearchParams;h.set("standalone","1"),f.forEach((x,C)=>{h.has(C)||h.set(C,x)});const b=`${window.location.pathname}${window.location.search}#/canvas?${h.toString()}`;window.open(b,"canvas-standalone","noopener,noreferrer")},v="w-8 h-8 flex items-center justify-center rounded-lg transition-colors",m={border:"none",background:"transparent",color:"var(--color-text-secondary)",cursor:"pointer"};return i.jsxs("div",{ref:o,className:"canvas-toolbar fixed bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-1 px-2 py-1 rounded-xl",style:{background:"var(--color-bg-card)",border:"1px solid var(--color-border-default)",boxShadow:"0 2px 12px rgba(0,0,0,0.12)",zIndex:1e4},children:[i.jsx("button",{className:v,style:m,onClick:y,title:e("canvas.addTerminal"),children:i.jsx(gn,{size:16})}),i.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),i.jsx("button",{className:v,style:m,onClick:p,title:e("canvas.zoomOut"),children:i.jsx(gk,{size:16})}),i.jsxs("span",{className:"text-xs tabular-nums select-none",style:{minWidth:40,textAlign:"center",color:"var(--color-text-secondary)"},children:[c,"%"]}),i.jsx("button",{className:v,style:m,onClick:u,title:e("canvas.zoomIn"),children:i.jsx(mk,{size:16})}),i.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),i.jsx("button",{className:v,style:m,onClick:g,title:e("canvas.fitView"),children:i.jsx(eS,{size:16})}),!a&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),i.jsx("button",{className:v,style:m,onClick:S,title:e("canvas.openStandalone"),children:i.jsx(mn,{size:16})})]})]})}function Cr(e,t=kn,n=$k){const r=(e%t+t)%t;return r<=n?e-r:t-r<=n?e+(t-r):e}function Pk(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}class Fk{constructor(){pe(this,"dragState",null);pe(this,"spacePressed",!1);pe(this,"callbacks",null);pe(this,"keydownHandler",null);pe(this,"keyupHandler",null);pe(this,"dragStarted",!1);pe(this,"panSamples",[])}attach(t){this.callbacks=t,this.keydownHandler=n=>{if(n.code==="Space"&&!n.repeat){if(Pk(n.target))return;this.spacePressed=!0,n.preventDefault()}},this.keyupHandler=n=>{n.code==="Space"&&(this.spacePressed=!1)},window.addEventListener("keydown",this.keydownHandler),window.addEventListener("keyup",this.keyupHandler)}detach(){this.keydownHandler&&(window.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.keyupHandler&&(window.removeEventListener("keyup",this.keyupHandler),this.keyupHandler=null),this.callbacks=null,this.dragState=null}get isSpacePressed(){return this.spacePressed}get isDragging(){return this.dragState!==null&&this.dragStarted}get currentDrag(){return this.dragState}handlePointerDown(t,n,r,s){var l,d,u;const o=t.clientX,c=t.clientY;this.dragStarted=!1,this.panSamples=[],(d=(l=this.callbacks)==null?void 0:l.onInteractionStart)==null||d.call(l);const a=(u=this.callbacks)==null?void 0:u.getViewport();if(this.spacePressed||!n&&!r){const p=t.shiftKey||t.ctrlKey||t.metaKey;!this.spacePressed&&p?this.dragState={type:"select",startScreenX:o,startScreenY:c}:(this.dragState={type:"pan",startScreenX:o,startScreenY:c,initialViewport:a?{...a}:void 0},this.panSamples=[{t:performance.now(),x:o,y:c}]);return}if(n&&r){const p=s[n];if(!p)return;this.dragState={type:"resize",startScreenX:o,startScreenY:c,tileId:n,handle:r,initialTiles:{[n]:{x:p.x,y:p.y,width:p.width,height:p.height}}};return}if(n){const p=s[n];if(!p)return;const g={};g[n]={x:p.x,y:p.y,width:p.width,height:p.height},this.dragState={type:"move",startScreenX:o,startScreenY:c,tileId:n,initialTiles:g}}}handlePointerMove(t){var o,c;if(!this.dragState||!this.callbacks)return;const n=t.clientX-this.dragState.startScreenX,r=t.clientY-this.dragState.startScreenY;if(!this.dragStarted){if(Math.abs(n)<Fm&&Math.abs(r)<Fm)return;this.dragStarted=!0}const s=this.callbacks.getViewport();switch(this.dragState.type){case"pan":{const a=this.dragState.initialViewport;if(a){const u=n,p=r;this.callbacks.onViewportPan(a.panX+u-s.panX,a.panY+p-s.panY)}const l=performance.now();this.panSamples.push({t:l,x:t.clientX,y:t.clientY});const d=l-100;for(;this.panSamples.length>2&&this.panSamples[0].t<d;)this.panSamples.shift();break}case"move":{if(this.dragState.tileId&&s.zoom!==0){const a=n/s.zoom,l=r/s.zoom,d=(o=this.dragState.initialTiles)==null?void 0:o[this.dragState.tileId];d&&this.callbacks.onTileMove(this.dragState.tileId,Cr(d.x+a),Cr(d.y+l))}break}case"resize":{if(this.dragState.tileId&&this.dragState.handle&&s.zoom!==0){const a=(c=this.dragState.initialTiles)==null?void 0:c[this.dragState.tileId];if(a){const l=n/s.zoom,d=r/s.zoom,u=this.applyResize(this.dragState.handle,a,l,d);this.callbacks.onTileResize(this.dragState.tileId,u)}}break}case"select":{const a={x:Math.min(this.dragState.startScreenX,t.clientX),y:Math.min(this.dragState.startScreenY,t.clientY),width:Math.abs(n),height:Math.abs(r)};this.callbacks.onSelectionBox(a);break}}}handlePointerUp(t){var s,o,c,a;if(!this.callbacks){this.dragState=null;return}const n=((s=this.dragState)==null?void 0:s.type)==="pan",r=this.dragStarted;if(this.dragStarted?((a=this.dragState)==null?void 0:a.type)==="select"&&(this.callbacks.onSelectionBox(null),this.callbacks.onBoxSelectEnd([])):(o=this.dragState)!=null&&o.tileId?this.callbacks.onTileClick(this.dragState.tileId):((c=this.dragState)==null?void 0:c.type)==="select"&&this.callbacks.onCanvasClick(),n&&r&&this.panSamples.length>=2&&this.callbacks.onPanInertiaStart){const l=this.panSamples[this.panSamples.length-1],d=this.panSamples[0],u=l.t-d.t;if(u>0){const p=(l.x-d.x)/u,g=(l.y-d.y)/u;Math.hypot(p,g)>.05&&this.callbacks.onPanInertiaStart(p,g)}}this.dragState=null,this.dragStarted=!1,this.panSamples=[]}getSelectedTileIds(t,n){const r=[],s=t.x,o=t.y,c=t.width,a=t.height;for(const l of Object.values(n))l.x<s+c&&l.x+l.width>s&&l.y<o+a&&l.y+l.height>o&&r.push(l.id);return r}getResizeHandle(t,n,r,s=Ib){const{x:o,y:c,width:a,height:l}=t,d=o+a/2,u=c+l/2,p=o+a,g=c+l;return this.hitTest(n,r,o,c,s)?"nw":this.hitTest(n,r,p,c,s)?"ne":this.hitTest(n,r,o,g,s)?"sw":this.hitTest(n,r,p,g,s)?"se":this.hitTest(n,r,d,c,s)?"n":this.hitTest(n,r,d,g,s)?"s":this.hitTest(n,r,o,u,s)?"w":this.hitTest(n,r,p,u,s)?"e":null}applyResize(t,n,r,s){let{x:o,y:c,width:a,height:l}=n;switch(t){case"n":c=n.y+s,l=n.height-s;break;case"s":l=n.height+s;break;case"w":o=n.x+r,a=n.width-r;break;case"e":a=n.width+r;break;case"nw":o=n.x+r,c=n.y+s,a=n.width-r,l=n.height-s;break;case"ne":c=n.y+s,a=n.width+r,l=n.height-s;break;case"sw":o=n.x+r,a=n.width-r,l=n.height+s;break;case"se":a=n.width+r,l=n.height+s;break}return a<Va&&((t==="w"||t==="nw"||t==="sw")&&(o=n.x+n.width-Va),a=Va),l<Ka&&((t==="n"||t==="nw"||t==="ne")&&(c=n.y+n.height-Ka),l=Ka),o=Cr(o),c=Cr(c),a=Cr(a),l=Cr(l),{x:o,y:c,width:a,height:l}}isInTileHeader(t,n,r,s){const o=Ab*s;return n>=t.x&&n<=t.x+t.width&&r>=t.y&&r<=t.y+o}hitTest(t,n,r,s,o){return Math.abs(t-r)<=o&&Math.abs(n-s)<=o}}const Bk=[{position:"n",cursor:"ns-resize",className:"top-0 left-2 right-2 h-1.5 -translate-y-1/2"},{position:"s",cursor:"ns-resize",className:"bottom-0 left-2 right-2 h-1.5 translate-y-1/2"},{position:"e",cursor:"ew-resize",className:"right-0 top-2 bottom-2 w-1.5 translate-x-1/2"},{position:"w",cursor:"ew-resize",className:"left-0 top-2 bottom-2 w-1.5 -translate-x-1/2"},{position:"nw",cursor:"nwse-resize",className:"top-0 left-0 w-3 h-3 -translate-x-1/2 -translate-y-1/2"},{position:"ne",cursor:"nesw-resize",className:"top-0 right-0 w-3 h-3 translate-x-1/2 -translate-y-1/2"},{position:"sw",cursor:"nesw-resize",className:"bottom-0 left-0 w-3 h-3 -translate-x-1/2 translate-y-1/2"},{position:"se",cursor:"nwse-resize",className:"bottom-0 right-0 w-3 h-3 translate-x-1/2 translate-y-1/2"}];function zk({tile:e,viewport:t,isSelected:n}){const{t:r}=de(),s=Qe(T=>T.removeTile),o=Qe(T=>T.duplicateTile),c=Qe(T=>T.toggleMaximize),a=Qe(T=>T.toggleMinimize),l=Qe(T=>T.setTilePty),d=Qe(T=>T.selectTile),u=Qe(T=>T.bringToFront),p=Ae(T=>{var A;return(A=T.panes[e.paneId])==null?void 0:A.title}),{panX:g,panY:y,zoom:S}=t,v=e.x*S+g,m=e.y*S+y,f=e.windowState==="maximized",h=e.windowState==="minimized",b=n?"var(--color-canvas-tile-border-selected)":"var(--color-canvas-tile-border)",x=E.useCallback(()=>{c(e.id)},[e.id,c]),C=E.useCallback(()=>{a(e.id)},[e.id,a]),_=E.useCallback(()=>{o(e.id)},[e.id,o]),w=E.useCallback(T=>{T.target.closest("button")||(T.stopPropagation(),h?a(e.id):c(e.id))},[e.id,h,c,a]),k=E.useCallback(T=>{l(e.id,T.sessionId,T.cwd||null)},[e.id,l]),N=E.useRef(null),[L,$]=E.useState(!1);E.useEffect(()=>{const T=A=>{$(A.shiftKey||A.altKey)};return window.addEventListener("keydown",T),window.addEventListener("keyup",T),()=>{window.removeEventListener("keydown",T),window.removeEventListener("keyup",T)}},[]);const M=n||L,O=E.useRef(null),W=E.useCallback(T=>{O.current={x:T.clientX,y:T.clientY,id:T.pointerId}},[]),H=E.useCallback(T=>{O.current=null},[]),V=E.useCallback(T=>{var j;if(T.ctrlKey||T.metaKey||T.shiftKey||!n)return;const R=(j=N.current)==null?void 0:j.querySelector(".xterm-viewport");R&&(R.scrollTop+=T.deltaY,T.stopPropagation())},[n]),J=E.useCallback(()=>{const T=new URLSearchParams(window.location.search),A=new URLSearchParams;A.set("paneId",e.paneId),T.forEach((j,P)=>{A.has(P)||A.set(P,j)});const R=`${window.location.pathname}${window.location.search}#/canvas-pane?${A.toString()}`;window.open(R,`canvas-pane-${e.paneId}`,"noopener,noreferrer")},[e.paneId]),ee=f?{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",transform:"none",pointerEvents:"auto",zIndex:9999,borderRadius:0,border:"none",overflow:"hidden",boxShadow:"none"}:{transform:`translate(${v}px, ${m}px) scale(${S})`,transformOrigin:"top left",width:e.width,height:e.height,willChange:"transform",pointerEvents:"auto",zIndex:e.zIndex,borderRadius:8,border:`1px solid ${b}`,overflow:"hidden",boxShadow:n?"0 0 0 1px var(--color-canvas-tile-border-selected)":"0 2px 8px rgba(0,0,0,0.08)"},I=E.useCallback(T=>{var P;if(T.button!==0)return;d(e.id),u(e.id);const A=(P=N.current)==null?void 0:P.querySelector(".xterm-helper-textarea");if(!A)return;const R=()=>{try{A.focus()}catch{}};R();const j=()=>{window.removeEventListener("pointerup",j,!0),R()};window.addEventListener("pointerup",j,!0)},[e.id,d,u]);return i.jsxs("div",{className:f?"canvas-tile":"absolute canvas-tile",style:ee,onPointerDownCapture:I,children:[i.jsxs("div",{className:"canvas-tile-header flex items-center gap-1.5 px-2 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",cursor:"grab",borderBottom:h?"none":"1px solid var(--color-canvas-tile-border)"},onDoubleClick:w,children:[i.jsx(ss,{size:13,style:{opacity:.5,flexShrink:0}}),i.jsx("span",{className:"flex-1 text-xs truncate",style:{fontSize:12,fontWeight:500},children:p||r("canvas.defaultTitle")}),i.jsx("button",{onClick:T=>{T.stopPropagation(),_()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r("canvas.tileMenu.duplicate"),children:i.jsx($s,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),J()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r("canvas.tileMenu.openStandalone"),children:i.jsx(mn,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),C()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r(h?"canvas.tileMenu.restore":"canvas.tileMenu.minimize"),children:h?i.jsx(bl,{size:12}):i.jsx(lb,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),x()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r(f?"canvas.tileMenu.restore":"canvas.tileMenu.maximize"),children:f?i.jsx(ob,{size:12}):i.jsx(pa,{size:12})}),i.jsx("button",{onClick:T=>{T.stopPropagation(),s(e.id)},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:r("canvas.tileMenu.close"),children:i.jsx(it,{size:12})})]}),!h&&i.jsxs("div",{ref:N,className:"flex-1 relative",style:{height:"calc(100% - 32px)",overflow:"hidden"},children:[i.jsx(yl,{paneId:e.paneId,initialCwd:e.cwd??null,onPtyCreated:k}),i.jsx("div",{className:"absolute inset-0","data-canvas-tile-focused":n?"true":"false",style:{zIndex:5,pointerEvents:M?"none":"auto",background:"transparent"},onPointerDown:W,onPointerUp:H,onWheel:V})]}),!h&&Bk.map(T=>i.jsx("div",{className:`absolute ${T.className}`,style:{cursor:T.cursor,zIndex:10,opacity:0},"data-resize-handle":T.position},T.position))]})}function Uk({rect:e}){return i.jsx("div",{className:"absolute pointer-events-none",style:{left:e.x,top:e.y,width:e.width,height:e.height,background:"var(--color-canvas-selection-fill)",border:"1px solid var(--color-canvas-selection-stroke)",borderRadius:2,zIndex:999}})}function Hk(){const e=E.useRef(null),t=E.useRef(new Ri),n=E.useRef(new Fk),r=Qe(T=>T.tiles),s=Qe(T=>T.viewport),o=Qe(T=>T.selectedTileIds),c=Qe(T=>T.setViewport),a=Qe(T=>T.updateTile),l=Qe(T=>T.selectTile),d=Qe(T=>T.selectTiles),u=Qe(T=>T.deselectAll),p=Qe(T=>T.bringToFront),[g,y]=E.useState(null),[S,v]=E.useState(!1),[m,f]=E.useState(!1),[h,b]=E.useState(null);E.useEffect(()=>{t.current.setState(s)},[s]);const x=E.useMemo(()=>Object.values(r).sort((T,A)=>T.zIndex-A.zIndex),[r]),C=E.useMemo(()=>new Set(o),[o]),_=E.useRef(s);_.current=s;const w=E.useRef({setViewport:c,updateTile:a,selectTile:l,deselectAll:u,bringToFront:p,selectTiles:d});w.current={setViewport:c,updateTile:a,selectTile:l,deselectAll:u,bringToFront:p,selectTiles:d};const k=.92,N=.01,L=3.5,$=E.useRef(null),M=E.useRef({vx:0,vy:0,last:0}),O=E.useCallback(()=>{$.current!==null&&(cancelAnimationFrame($.current),$.current=null)},[]),W=E.useCallback((T,A)=>{O();const R=Math.hypot(T,A);if(R>L){const P=L/R;T*=P,A*=P}M.current={vx:T,vy:A,last:performance.now()};const j=()=>{const P=performance.now(),U=M.current,F=Math.min(32,P-U.last);U.last=P;const D=t.current.applyPan(U.vx*F,U.vy*F);w.current.setViewport(D);const Y=Math.pow(k,F/16.67);if(U.vx*=Y,U.vy*=Y,Math.hypot(U.vx,U.vy)<N){$.current=null;return}$.current=requestAnimationFrame(j)};$.current=requestAnimationFrame(j)},[O]);E.useEffect(()=>()=>O(),[O]),E.useEffect(()=>{const T=n.current,A={onViewportPan:(R,j)=>{const U=t.current.applyPan(R,j);w.current.setViewport(U)},onTileMove:(R,j,P)=>{w.current.updateTile(R,{x:j,y:P})},onTileResize:(R,j)=>{w.current.updateTile(R,j)},onTileSelect:R=>{w.current.selectTile(R),w.current.bringToFront(R)},onSelectionBox:R=>{if(R){const j=e.current,P=j==null?void 0:j.getBoundingClientRect();y(P?{x:R.x-P.left,y:R.y-P.top,width:R.width,height:R.height}:R)}else y(null)},onBoxSelectEnd:()=>{},onTileClick:R=>{w.current.selectTile(R),w.current.bringToFront(R)},onCanvasClick:()=>{w.current.deselectAll()},onInteractionStart:()=>{O()},onPanInertiaStart:(R,j)=>{W(R,j)},getViewport:()=>_.current};return T.attach(A),()=>T.detach()},[]),E.useEffect(()=>{const T=e.current;if(!T)return;const A=t.current,R=U=>{const F=U.target,B=!!(F&&F.closest('.xterm, .xterm-screen, .xterm-viewport, input, textarea, [contenteditable="true"], [contenteditable=""]')),D=!!(F&&F.closest('[data-canvas-tile-focused="true"]')),Y=U.ctrlKey||U.metaKey;if((B||D)&&!Y&&!U.shiftKey)return;U.preventDefault();const X=T.getBoundingClientRect(),te=U.clientX-X.left,ne=U.clientY-X.top;if(Y){const ue=A.applyZoom(U.deltaY,te,ne);c(ue);return}let se=-U.deltaX,be=-U.deltaY;U.shiftKey&&se===0&&(se=-U.deltaY,be=0);const me=U.deltaMode===1?16:U.deltaMode===2?100:1,ge=A.applyPan(se*me,be*me);c(ge)},j=U=>{if(!(U.ctrlKey||U.metaKey))return;const F=U.target;if(F){const B=F.tagName;if(B==="INPUT"||B==="TEXTAREA"||B==="SELECT"||F.isContentEditable)return}if(U.key==="+"||U.key==="="||U.key==="-"||U.key==="_"||U.key==="0"){U.preventDefault();const B=T.clientWidth,D=T.clientHeight;if(U.key==="0")c(A.resetView());else if(U.key==="-"||U.key==="_"){const Y=A.applyZoom(120,B/2,D/2);c(Y)}else{const Y=A.applyZoom(-120,B/2,D/2);c(Y)}}},P=U=>{U.preventDefault()};return T.addEventListener("wheel",R,{passive:!1}),window.addEventListener("keydown",j),T.addEventListener("gesturestart",P),T.addEventListener("gesturechange",P),T.addEventListener("gestureend",P),()=>{T.removeEventListener("wheel",R),window.removeEventListener("keydown",j),T.removeEventListener("gesturestart",P),T.removeEventListener("gesturechange",P),T.removeEventListener("gestureend",P)}},[c]);const H=E.useCallback(T=>{const A=e.current;if(!A)return;const R=T.button===1||T.button===2,j=n.current.isSpacePressed,P=A.getBoundingClientRect(),U=T.clientX-P.left,F=T.clientY-P.top,B=n.current;let D=null,Y=null,X=null;if(!R&&!j){const me=[...Object.values(r)].sort((ge,ue)=>ue.zIndex-ge.zIndex);for(const ge of me){const ue=ge.x*s.zoom+s.panX,Ne=ge.y*s.zoom+s.panY,Te=ge.width*s.zoom,ce=ge.height*s.zoom,ke={x:ue,y:Ne,width:Te,height:ce},Ue=B.getResizeHandle(ke,U,F,Ib);if(Ue){D=ge.id,Y=Ue,X=ge.id;break}if(B.isInTileHeader(ke,U,F,s.zoom)){D=ge.id,X=ge.id;break}if(U>=ue&&U<=ue+Te&&F>=Ne&&F<=Ne+ce){X=ge.id;break}}}const te=T.target;if(!R&&!j&&Y===null&&X&&C.has(X)&&te&&te.closest(".xterm, .xterm-screen, .xterm-viewport, .xterm-rows"))return;const ne=T.target;if(ne&&!(R||j||Y!==null)&&(ne.closest("button")||ne.closest("input, textarea:not(.xterm-helper-textarea), select")||ne.closest('[contenteditable="true"], [contenteditable=""]')))return;if(R&&T.preventDefault(),!X&&!Y){const me=document.activeElement;me&&typeof me.blur=="function"&&me.blur(),u()}const be=T.nativeEvent;B.handlePointerDown(be,D,Y,r),X?(l(X),p(X)):(T.shiftKey||T.ctrlKey||T.metaKey)&&u(),A.setPointerCapture(T.pointerId),v(B.isSpacePressed)},[r,s,l,u,p,C]),V=E.useCallback(T=>{var R;const A=n.current;A.handlePointerMove(T.nativeEvent),v(A.isSpacePressed),f(A.isDragging),b(((R=A.currentDrag)==null?void 0:R.type)??null)},[]),J=E.useCallback(T=>{var j;const A=n.current;if(((j=A.currentDrag)==null?void 0:j.type)==="select"&&A.isDragging&&g){const P=s.zoom||1,U={x:(g.x-s.panX)/P,y:(g.y-s.panY)/P,width:g.width/P,height:g.height/P},F=A.getSelectedTileIds(U,r);d(F)}A.handlePointerUp(T.nativeEvent);const R=e.current;R&&R.releasePointerCapture(T.pointerId),f(!1),b(null),y(null)},[s,r,d,g]),I=m&&h==="pan"?"grabbing":S?"grab":"default";return i.jsxs("div",{ref:e,className:"absolute inset-0",style:{cursor:I,touchAction:"none",overscrollBehavior:"contain"},onPointerDown:H,onPointerMove:V,onPointerUp:J,onContextMenu:T=>T.preventDefault(),children:[i.jsx("div",{className:"absolute inset-0",style:{pointerEvents:"none"},children:x.map(T=>i.jsx(zk,{tile:T,viewport:s,isSelected:C.has(T.id)},T.id))}),g&&i.jsx(Uk,{rect:g})]})}function zm(){const e=Qe(r=>r.tiles),{t}=de(),n=Object.keys(e).length>0;return i.jsxs("div",{className:"relative w-full h-full overflow-hidden bg-bg-primary",children:[i.jsx(Hk,{}),i.jsx(Mk,{}),!n&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:i.jsx("p",{className:"text-text-tertiary text-sm",children:t("canvas.empty")})})]})}function Um(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gk(e){if(Array.isArray(e))return e}function Wk(e,t,n){return(t=Jk(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qk(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,c,a=[],l=!0,d=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){d=!0,s=u}finally{try{if(!l&&n.return!=null&&(c=n.return(),Object(c)!==c))return}finally{if(d)throw s}}return a}}function Vk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
647
647
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Gm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hm(Object(n),!0).forEach(function(r){Wk(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hm(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kk(e,t){if(e==null)return{};var n,r,s=Zk(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function Zk(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Yk(e,t){return Gk(e)||qk(e,t)||Qk(e,t)||Vk()}function Xk(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jk(e){var t=Xk(e,"string");return typeof t=="symbol"?t:t+""}function Qk(e,t){if(e){if(typeof e=="string")return Um(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Um(e,t):void 0}}function e0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function qm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wm(Object(n),!0).forEach(function(r){e0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wm(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function t0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(s,o){return o(s)},r)}}function Ss(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var c=arguments.length,a=new Array(c),l=0;l<c;l++)a[l]=arguments[l];return t.apply(n,[].concat(s,a))}}}function Vi(e){return{}.toString.call(e).includes("Object")}function n0(e){return!Object.keys(e).length}function Os(e){return typeof e=="function"}function r0(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function s0(e,t){return Vi(t)||Yn("changeType"),Object.keys(t).some(function(n){return!r0(e,n)})&&Yn("changeField"),t}function i0(e){Os(e)||Yn("selectorType")}function a0(e){Os(e)||Vi(e)||Yn("handlerType"),Vi(e)&&Object.values(e).some(function(t){return!Os(t)})&&Yn("handlersType")}function o0(e){e||Yn("initialIsRequired"),Vi(e)||Yn("initialType"),n0(e)&&Yn("initialContent")}function l0(e,t){throw new Error(e[t]||e.default)}var c0={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Yn=Ss(l0)(c0),mi={changes:s0,selector:i0,handler:a0,initial:o0};function d0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};mi.initial(e),mi.handler(t);var n={current:e},r=Ss(h0)(n,t),s=Ss(p0)(n),o=Ss(mi.changes)(e),c=Ss(u0)(n);function a(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return mi.selector(d),d(n.current)}function l(d){t0(r,s,o,c)(d)}return[a,l]}function u0(e,t){return Os(t)?t(e.current):t}function p0(e,t){return e.current=qm(qm({},e.current),t),t}function h0(e,t,n){return Os(t)?t(e.current):Object.keys(n).forEach(function(r){var s;return(s=t[r])===null||s===void 0?void 0:s.call(t,e.current[r])}),n}var m0={create:d0},f0={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function g0(e){return function t(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=e.length?e.apply(this,s):function(){for(var c=arguments.length,a=new Array(c),l=0;l<c;l++)a[l]=arguments[l];return t.apply(n,[].concat(s,a))}}}function b0(e){return{}.toString.call(e).includes("Object")}function y0(e){return e||Vm("configIsRequired"),b0(e)||Vm("configType"),e.urls?(x0(),{paths:{vs:e.urls.monacoBase}}):e}function x0(){console.warn(Ob.deprecation)}function v0(e,t){throw new Error(e[t]||e.default)}var Ob={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
648
648
  You are using deprecated way of configuration.
649
649
 
@@ -856,4 +856,4 @@ ${n("tool.moreLinesCount").replace("{count}",String(s.length-t))}`})]})}function
856
856
  hover:text-text-primary hover:bg-bg-hover rounded-lg transition-colors`,title:e("workers.refresh"),children:[i.jsx(Et,{size:14,className:r?"animate-spin":""}),i.jsx("span",{children:e("workers.refresh")})]})]}),s&&i.jsx("div",{className:"mb-4 p-3 rounded-xl error-banner text-sm",children:s}),i.jsx(Yj,{daemon:n,onStart:()=>l(),onStop:d,onRestart:u}),i.jsx(Xj,{workers:t,onViewLogs:g,onKill:v})]})}function Yj({daemon:e,onStart:t,onStop:n,onRestart:r}){const{t:s}=de(),o=(e==null?void 0:e.status)==="running",[c,a]=E.useState(null),l=E.useCallback(async(d,u)=>{a(d);try{await u()}finally{a(null)}},[]);return i.jsx("div",{className:`bg-bg-secondary rounded-xl p-4 md:p-5 border mb-6 transition-colors worker-card-hover ${o?"border-green-400/40 ring-1 ring-green-400/10":"border-border-default"}`,children:i.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(zi,{size:18,className:o?"text-green-500":"text-text-tertiary"}),i.jsx("span",{className:"text-base font-semibold text-text-primary",children:s("workers.daemon")}),(e==null?void 0:e.pid)&&i.jsxs("span",{className:"text-xs text-text-tertiary font-mono bg-bg-tertiary px-2 py-0.5 rounded-md ml-2 border border-border-default/50",children:["PID ",e.pid]})]}),i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[o&&i.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),i.jsx("span",{className:`relative inline-flex rounded-full h-2.5 w-2.5 ${o?"bg-green-500":"bg-gray-400"}`})]}),i.jsx("span",{className:"text-sm font-medium text-text-secondary",children:s(o?"workers.daemon.running":"workers.daemon.stopped")})]}),(e==null?void 0:e.endpoint)&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-border-primary",children:"|"}),i.jsx(mn,{size:14,className:"text-text-tertiary ml-1"}),i.jsx("a",{href:e.endpoint,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-brand hover:underline",children:e.endpoint})]})]})]}),i.jsx("div",{className:"flex items-center gap-2 mt-2 md:mt-0",children:o?i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>l("stop",n),disabled:c!==null,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg border border-border-default
857
857
  bg-bg-primary text-text-secondary daemon-stop-btn transition-all disabled:opacity-50`,children:[c==="stop"?i.jsx(Ke,{size:14,className:"animate-spin"}):i.jsx(bl,{size:14}),s("workers.daemon.stop")]}),i.jsxs("button",{onClick:()=>l("restart",r),disabled:c!==null,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg border border-border-default
858
858
  bg-bg-primary text-text-secondary hover:text-text-primary hover:bg-bg-hover transition-all disabled:opacity-50`,children:[c==="restart"?i.jsx(Ke,{size:14,className:"animate-spin"}):i.jsx(ko,{size:14}),s("workers.daemon.restart")]})]}):i.jsxs("button",{onClick:()=>l("start",t),disabled:c!==null,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg shadow-sm
859
- daemon-start-btn transition-all disabled:opacity-70`,children:[c==="start"?i.jsx(Ke,{size:14,className:"animate-spin"}):i.jsx(_S,{size:14}),s(c==="start"?"workers.daemon.starting":"workers.daemon.start")]})})]})})}function Xj({workers:e,onViewLogs:t,onKill:n}){const{t:r}=de();return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(_r,{size:18,className:"text-text-secondary"}),i.jsxs("h2",{className:"text-base font-medium text-text-primary",children:[r("workers.active")," (",e.length,")"]})]}),e.length===0?i.jsx("div",{className:"text-center py-12 text-text-tertiary",children:r("workers.empty")}):i.jsx("div",{className:"space-y-4",children:[...e].sort((s,o)=>(o.isCurrent?1:0)-(s.isCurrent?1:0)).map(s=>i.jsx(Qj,{worker:s,onViewLogs:t,onKill:n},`${s.pid}-${s.hostname}`))})]})}const Jj={interactive:"kind-badge kind-badge-blue",bg:"kind-badge kind-badge-purple",daemon:"kind-badge kind-badge-green","daemon-worker":"kind-badge kind-badge-orange"};function Qj({worker:e,onViewLogs:t,onKill:n}){const{t:r}=de();return i.jsxs("div",{className:"group bg-bg-secondary rounded-xl p-4 md:p-5 border border-border-default transition-colors worker-card-hover",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("span",{className:`inline-block px-2.5 py-0.5 text-xs font-medium rounded-md ${Jj[e.kind]||"bg-gray-100 text-gray-600"}`,children:e.kind}),e.isCurrent&&i.jsx("span",{className:"text-[10px] uppercase font-bold tracking-wider px-1.5 py-0.5 rounded current-badge",children:"current"}),i.jsxs("span",{className:"text-xs text-text-tertiary font-mono",children:["PID ",e.pid]}),e.name&&e.name!=="-"&&i.jsx("span",{className:"text-sm font-medium text-text-primary",children:e.name})]}),i.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.url&&i.jsx("a",{href:Dg(e),target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded-md text-text-tertiary hover:text-accent-brand hover:bg-bg-hover transition-colors",title:r("workers.action.open"),children:i.jsx(mn,{size:14})}),!e.manual&&i.jsx("button",{onClick:()=>t(e),className:"p-1.5 rounded-md text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",title:r("workers.action.logs"),children:i.jsx(vn,{size:14})}),!e.isCurrent&&i.jsx("button",{onClick:()=>n(e),className:"p-1.5 rounded-md text-text-tertiary daemon-kill-btn transition-colors",title:r("workers.action.kill"),children:i.jsx(pb,{size:14})})]})]}),i.jsxs("div",{className:"flex flex-col md:flex-row md:items-start justify-between gap-3 md:gap-6",children:[i.jsxs("div",{className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[i.jsx(Dn,{path:e.cwd,displayMode:"basename",className:"text-[13px] text-text-secondary font-mono truncate max-w-full"}),e.url&&i.jsxs("a",{href:Dg(e),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-text-tertiary hover:text-accent-brand truncate inline-flex items-center gap-1",title:e.url,children:[i.jsx(mn,{size:10,className:"flex-none"}),e.url]})]}),i.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-3 shrink-0",children:[i.jsx(xo,{icon:i.jsx(Jn,{size:14}),label:"Started",value:tM(e.startedAt)}),e.version&&i.jsx(xo,{icon:i.jsx(_r,{size:14}),label:"Version",value:e.version}),e.hostname&&i.jsx(xo,{icon:i.jsx(zi,{size:14}),label:"Host",value:e.hostname})]})]})]})}function xo({icon:e,label:t,value:n,valueClassName:r}){return i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-text-tertiary",children:[e,i.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider",children:t})]}),i.jsx("div",{className:`text-sm font-semibold text-text-primary ${r||""}`,children:n})]})}function eM(e){try{const t=new URL(e).hostname;return t==="127.0.0.1"||t==="localhost"||t==="::1"}catch{return!1}}function Dg(e){if(!e.url)return"#";const t=qj(e.url);if(eM(t))return t;const n=ID(String(e.pid));if(!n)return t;try{const r=new URL(t);return r.searchParams.set("password",n),r.toString()}catch(r){return console.warn("Failed to build worker URL with password:",t,r),t}}function tM(e){const t=Math.floor((Date.now()-e)/1e3);if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function nM(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:s,onRegisteredSW:o,onRegisterError:c}=e;let a,l,d;const u=async(g=!0)=>{await l,d==null||d()};async function p(){if("serviceWorker"in navigator){if(a=await Dr(async()=>{const{Workbox:g}=await import("./workbox-window.prod.es5-BBnX5xw4.js");return{Workbox:g}},[]).then(({Workbox:g})=>new g("/sw.js",{scope:"/",type:"classic"})).catch(g=>{c==null||c(g)}),!a)return;d=()=>{a==null||a.messageSkipWaiting()};{let g=!1;const y=()=>{g=!0,a==null||a.addEventListener("controlling",S=>{S.isUpdate&&window.location.reload()}),n==null||n()};a.addEventListener("installed",S=>{typeof S.isUpdate>"u"?typeof S.isExternal<"u"&&S.isExternal?y():!g&&(r==null||r()):S.isUpdate||r==null||r()}),a.addEventListener("waiting",y)}a.register({immediate:t}).then(g=>{o?o("/sw.js",g):s==null||s(g)}).catch(g=>{c==null||c(g)})}}return l=p(),u}function rM(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:s,onRegisteredSW:o,onRegisterError:c}=e,[a,l]=E.useState(!1),[d,u]=E.useState(!1),[p]=E.useState(()=>nM({immediate:t,onOfflineReady(){u(!0),r==null||r()},onNeedRefresh(){l(!0),n==null||n()},onRegistered:s,onRegisteredSW:o,onRegisterError:c}));return{needRefresh:[a,l],offlineReady:[d,u],updateServiceWorker:p}}const sM=900*1e3,iM="pwa-new-version";function aM(){const{t:e}=de(),t=E.useRef(null),n=E.useRef(!1),{updateServiceWorker:r}=rM({onRegisteredSW(c,a){a&&setInterval(()=>{a.update().catch(()=>{})},sM)},onNeedRefresh(){if(n.current=!0,!bt.getState().isAgentRunning){s();return}o()}});E.useEffect(()=>{t.current=r},[r]),E.useEffect(()=>bt.subscribe((a,l)=>{n.current&&l.isAgentRunning&&!a.isAgentRunning&&s()}),[]);function s(){n.current=!1;const c=t.current;return c?c(!0).catch(()=>{}):Promise.resolve()}function o(){Fo.info(e("app.pwa.newVersion"),{id:iM,durationMs:0,action:{label:e("app.pwa.reloadNow"),onClick:()=>(s(),!0)}})}}function oM(){aM();const{viewState:e,checkAuth:t}=zg(),{status:n,sessionId:r,topic:s,setPromptSuggestion:o,setTopic:c}=Tt(),{connect:a}=d_(),{clearChat:l}=bt(),d=Mt(H=>H.focusedMemberName),{t:u,resolved:p}=de(),[g,y]=E.useState(()=>{try{const H=sessionStorage.getItem("codebuddy_sidebar_open");return H!==null?window.innerWidth>=768?H==="true":!1:window.innerWidth>=768}catch{return window.innerWidth>=768}}),S=E.useRef(g),[v,m]=E.useState(!1),[f,h]=E.useState(!1),[b,x]=E.useState(!1),{splitPane:C,mainView:_,setMainView:w}=Ae(),k=E.useCallback(H=>{y(V=>{const J=typeof H=="function"?H(V):H;S.current=J;try{sessionStorage.setItem("codebuddy_sidebar_open",String(J))}catch{}return J})},[]);E.useEffect(()=>{const H=window.matchMedia("(min-width: 768px)"),V=J=>{J.matches?y(S.current):y(!1)};return H.addEventListener("change",V),()=>H.removeEventListener("change",V)},[]),E.useEffect(()=>{const H=V=>Ot.handleKeyDown(V);return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[]),E.useEffect(()=>{n==="connected"&&rm.getState().loadBindings()},[n]);const N=E.useCallback(H=>{C(H)},[C]),L=E.useCallback(async()=>{if(r){try{await je().prompt(r,"/clear")}catch{Fo.error(u("error.newChatFailed"))}l(),c(null),o(null),w("chat"),window.location.hash="/chat"}},[r,l,c,o,w]),$=E.useCallback(async H=>{if(r){try{await je().prompt(r,`/resume ${H}`)}catch{Fo.error(u("error.switchSessionFailed"))}w("chat"),window.location.hash="/chat"}},[r,w]),M=E.useCallback(H=>{w(H),window.location.hash=`/${H}`,window.innerWidth<768&&y(!1)},[w]);if(E.useEffect(()=>{const H=[Ot.register({id:"commandPalette.toggle",key:"p",meta:!0,shift:!0,handler:()=>x(V=>!V)}),Ot.register({id:"sidebar.toggle",key:"b",meta:!0,handler:()=>k(V=>!V)}),Ot.register({id:"terminal.toggle",key:"j",meta:!0,handler:()=>{const V=_==="terminal"?"chat":"terminal";w(V),window.location.hash="/"+V}}),Ot.register({id:"newChat",key:"n",meta:!0,handler:()=>L()}),Ot.register({id:"settings",key:",",meta:!0,handler:()=>{w("settings"),window.location.hash="/settings"}}),Ot.registerAction("app:commandPalette",()=>x(V=>!V)),Ot.registerAction("app:toggleSidebar",()=>k(V=>!V)),Ot.registerAction("app:toggleTerminal",()=>{const V=_==="terminal"?"chat":"terminal";w(V),window.location.hash="/"+V}),Ot.registerAction("app:newChat",()=>L()),Ot.registerAction("app:settings",()=>{w("settings"),window.location.hash="/settings"}),Ot.registerAction("app:focusInput",()=>{const V=document.querySelector("textarea");V==null||V.focus()}),Ot.registerAction("app:keybindings",()=>{w("keybindings"),window.location.hash="/keybindings"})];return()=>H.forEach(V=>V())},[_,L,w,k]),E.useEffect(()=>{const H=new URLSearchParams(window.location.search),V=H.get("password"),J=H.get("token");if(V||J){Bg(V||J),H.delete("password"),H.delete("token");const ee=H.toString()?`${window.location.pathname}?${H.toString()}`:window.location.pathname;window.history.replaceState({},"",ee)}t()},[t]),E.useEffect(()=>{if(e==="authenticated"){const H=xl();w(H),(!window.location.hash||window.location.hash==="#")&&(window.location.hash=`/${H}`)}},[e,w]),E.useEffect(()=>Lk(V=>{w(V)}),[w]),E.useEffect(()=>{if(e==="authenticated"){const H=ca()||void 0;a({token:H,continue:!0})}},[e,a]),E.useEffect(()=>{document.documentElement.lang=p,document.title=s?`${s} - CodeBuddy Code`:u("page.title")},[p,u,s]),e==="loading")return i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx(_n,{size:"large",text:u("app.connecting")})})});if(e==="login")return i.jsx(TD,{});const O=()=>{if(n==="connecting")return i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx(_n,{size:"large",text:u("app.connecting")})});if(n!=="connected"&&_!=="settings"&&_!=="docs")return i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-text-secondary mb-4 font-medium",children:u("app.connectFailed")}),i.jsx("button",{onClick:()=>a(),className:["px-6 py-2.5 bg-accent-brand text-white rounded-full","text-sm font-medium transition-all hover:bg-accent-brand/90","hover:scale-105 active:scale-95 shadow-sm"].join(" "),children:u("app.retry")})]})});switch(_){case"chat":return i.jsx(St,{viewName:"chat",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 overflow-hidden w-full relative",children:d?i.jsx(bj,{}):i.jsx(U$,{onClickCloseBottomSheet:()=>h(!1)})}),i.jsx(Tj,{}),i.jsx("div",{className:"flex-none bg-bg-primary",children:i.jsx(wD,{onNavigate:M,onNewChat:L,onHistory:()=>m(!0),mainView:_,showBottomSheet:f,setShowBottomSheet:h})})]})});case"tasks":return i.jsx(St,{viewName:"tasks",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(pv,{})});case"plugins":return i.jsx(St,{viewName:"plugins",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(cv,{})});case"terminal":return null;case"canvas":return i.jsx(St,{viewName:"canvas",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(zm,{})});case"canvas-pane":return null;case"remote-control":return i.jsx(St,{viewName:"remote-control",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(VD,{onNavigate:M})});case"editor":return i.jsx(St,{viewName:"editor",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(qO,{onMenuClick:()=>k(H=>!H)})});case"changes":return i.jsx(St,{viewName:"changes",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(Wb,{onMenuClick:()=>k(H=>!H)})});case"settings":return i.jsx(St,{viewName:"settings",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(uv,{})});case"keybindings":return i.jsx(St,{viewName:"keybindings",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(kD,{})});case"metrics":return i.jsx(St,{viewName:"metrics",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(UD,{})});case"stats":return i.jsx(St,{viewName:"stats",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(lj,{})});case"traces":return i.jsx(St,{viewName:"traces",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(Rj,{})});case"workers":return i.jsx(St,{viewName:"workers",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(Zj,{})});case"logs":return i.jsx(St,{viewName:"logs",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(OD,{})});case"docs":return i.jsx(St,{viewName:"docs",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(dg,{})});default:return null}};return _==="docs"&&window.location.hash.includes("standalone")?i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx(dg,{})}):_==="canvas-pane"?i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx(jk,{})}):_==="canvas"&&window.location.hash.includes("standalone")?i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx(zm,{})}):i.jsxs("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:[i.jsx(QD,{isOpen:g,onClose:()=>k(!1),mainView:_,onNavigate:M}),i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative transition-all duration-300 h-full",children:[_!=="editor"&&_!=="changes"&&i.jsx(fj,{onMenuClick:()=>k(H=>!H),onNewChat:L,onSplitTerminal:N,onHistory:()=>m(!0)}),i.jsxs("div",{className:"flex-1 flex flex-col w-full overflow-hidden relative",children:[i.jsx("div",{className:"flex-1 flex flex-col w-full",style:{display:_==="terminal"?"flex":"none"},children:i.jsx(hv,{})}),_!=="terminal"&&O()]}),i.jsx(JO,{isOpen:v,onClose:()=>m(!1),onSwitchSession:$})]}),i.jsx(_j,{}),i.jsx(Q$,{isOpen:b,onClose:()=>x(!1),onNavigate:M,onNewChat:L}),i.jsx(ZO,{})]})}a_.createRoot(document.getElementById("root")).render(i.jsx(E.StrictMode,{children:i.jsx(St,{children:i.jsx(oM,{})})}));
859
+ daemon-start-btn transition-all disabled:opacity-70`,children:[c==="start"?i.jsx(Ke,{size:14,className:"animate-spin"}):i.jsx(_S,{size:14}),s(c==="start"?"workers.daemon.starting":"workers.daemon.start")]})})]})})}function Xj({workers:e,onViewLogs:t,onKill:n}){const{t:r}=de();return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(_r,{size:18,className:"text-text-secondary"}),i.jsxs("h2",{className:"text-base font-medium text-text-primary",children:[r("workers.active")," (",e.length,")"]})]}),e.length===0?i.jsx("div",{className:"text-center py-12 text-text-tertiary",children:r("workers.empty")}):i.jsx("div",{className:"space-y-4",children:[...e].sort((s,o)=>(o.isCurrent?1:0)-(s.isCurrent?1:0)).map(s=>i.jsx(Qj,{worker:s,onViewLogs:t,onKill:n},`${s.pid}-${s.hostname}`))})]})}const Jj={interactive:"kind-badge kind-badge-blue",bg:"kind-badge kind-badge-purple",daemon:"kind-badge kind-badge-green","daemon-worker":"kind-badge kind-badge-orange"};function Qj({worker:e,onViewLogs:t,onKill:n}){const{t:r}=de();return i.jsxs("div",{className:"group bg-bg-secondary rounded-xl p-4 md:p-5 border border-border-default transition-colors worker-card-hover",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("span",{className:`inline-block px-2.5 py-0.5 text-xs font-medium rounded-md ${Jj[e.kind]||"bg-gray-100 text-gray-600"}`,children:e.kind}),e.isCurrent&&i.jsx("span",{className:"text-[10px] uppercase font-bold tracking-wider px-1.5 py-0.5 rounded current-badge",children:"current"}),i.jsxs("span",{className:"text-xs text-text-tertiary font-mono",children:["PID ",e.pid]}),e.name&&e.name!=="-"&&i.jsx("span",{className:"text-sm font-medium text-text-primary",children:e.name})]}),i.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.url&&i.jsx("a",{href:Dg(e),target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded-md text-text-tertiary hover:text-accent-brand hover:bg-bg-hover transition-colors",title:r("workers.action.open"),children:i.jsx(mn,{size:14})}),!e.manual&&i.jsx("button",{onClick:()=>t(e),className:"p-1.5 rounded-md text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",title:r("workers.action.logs"),children:i.jsx(vn,{size:14})}),!e.isCurrent&&i.jsx("button",{onClick:()=>n(e),className:"p-1.5 rounded-md text-text-tertiary daemon-kill-btn transition-colors",title:r("workers.action.kill"),children:i.jsx(pb,{size:14})})]})]}),i.jsxs("div",{className:"flex flex-col md:flex-row md:items-start justify-between gap-3 md:gap-6",children:[i.jsxs("div",{className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[i.jsx(Dn,{path:e.cwd,displayMode:"basename",className:"text-[13px] text-text-secondary font-mono truncate max-w-full"}),e.url&&i.jsxs("a",{href:Dg(e),target:"_blank",rel:"noopener noreferrer",className:"text-xs text-text-tertiary hover:text-accent-brand truncate inline-flex items-center gap-1",title:e.url,children:[i.jsx(mn,{size:10,className:"flex-none"}),e.url]})]}),i.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-3 shrink-0",children:[i.jsx(xo,{icon:i.jsx(Jn,{size:14}),label:"Started",value:tM(e.startedAt)}),e.version&&i.jsx(xo,{icon:i.jsx(_r,{size:14}),label:"Version",value:e.version}),e.hostname&&i.jsx(xo,{icon:i.jsx(zi,{size:14}),label:"Host",value:e.hostname})]})]})]})}function xo({icon:e,label:t,value:n,valueClassName:r}){return i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-text-tertiary",children:[e,i.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider",children:t})]}),i.jsx("div",{className:`text-sm font-semibold text-text-primary ${r||""}`,children:n})]})}function eM(e){try{const t=new URL(e).hostname;return t==="127.0.0.1"||t==="localhost"||t==="::1"}catch{return!1}}function Dg(e){if(!e.url)return"#";const t=qj(e.url);if(eM(t))return t;const n=ID(String(e.pid));if(!n)return t;try{const r=new URL(t);return r.searchParams.set("password",n),r.toString()}catch(r){return console.warn("Failed to build worker URL with password:",t,r),t}}function tM(e){const t=Math.floor((Date.now()-e)/1e3);if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function nM(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:s,onRegisteredSW:o,onRegisterError:c}=e;let a,l,d;const u=async(g=!0)=>{await l,d==null||d()};async function p(){if("serviceWorker"in navigator){if(a=await Dr(async()=>{const{Workbox:g}=await import("./workbox-window.prod.es5-BBnX5xw4.js");return{Workbox:g}},[]).then(({Workbox:g})=>new g("/sw.js",{scope:"/",type:"classic"})).catch(g=>{c==null||c(g)}),!a)return;d=()=>{a==null||a.messageSkipWaiting()};{let g=!1;const y=()=>{g=!0,a==null||a.addEventListener("controlling",S=>{S.isUpdate&&window.location.reload()}),n==null||n()};a.addEventListener("installed",S=>{typeof S.isUpdate>"u"?typeof S.isExternal<"u"&&S.isExternal?y():!g&&(r==null||r()):S.isUpdate||r==null||r()}),a.addEventListener("waiting",y)}a.register({immediate:t}).then(g=>{o?o("/sw.js",g):s==null||s(g)}).catch(g=>{c==null||c(g)})}}return l=p(),u}function rM(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:s,onRegisteredSW:o,onRegisterError:c}=e,[a,l]=E.useState(!1),[d,u]=E.useState(!1),[p]=E.useState(()=>nM({immediate:t,onOfflineReady(){u(!0),r==null||r()},onNeedRefresh(){l(!0),n==null||n()},onRegistered:s,onRegisteredSW:o,onRegisterError:c}));return{needRefresh:[a,l],offlineReady:[d,u],updateServiceWorker:p}}const sM=900*1e3,iM="pwa-new-version";function aM(){const{t:e}=de(),t=E.useRef(null),n=E.useRef(!1),{updateServiceWorker:r}=rM({onRegisteredSW(c,a){a&&setInterval(()=>{a.update().catch(()=>{})},sM)},onNeedRefresh(){if(n.current=!0,!bt.getState().isAgentRunning){s();return}o()}});E.useEffect(()=>{t.current=r},[r]),E.useEffect(()=>bt.subscribe((a,l)=>{n.current&&l.isAgentRunning&&!a.isAgentRunning&&s()}),[]);function s(){n.current=!1;const c=t.current;return c?c(!0).catch(()=>{}):Promise.resolve()}function o(){Fo.info(e("app.pwa.newVersion"),{id:iM,durationMs:0,action:{label:e("app.pwa.reloadNow"),onClick:()=>(s(),!0)}})}}function oM(){aM();const{viewState:e,checkAuth:t}=zg(),{status:n,sessionId:r,topic:s,setPromptSuggestion:o,setTopic:c}=Tt(),{connect:a}=d_(),{clearChat:l}=bt(),d=Mt(H=>H.focusedMemberName),{t:u,resolved:p}=de(),[g,y]=E.useState(()=>{try{const H=sessionStorage.getItem("codebuddy_sidebar_open");return H!==null?window.innerWidth>=768?H==="true":!1:window.innerWidth>=768}catch{return window.innerWidth>=768}}),S=E.useRef(g),[v,m]=E.useState(!1),[f,h]=E.useState(!1),[b,x]=E.useState(!1),{splitPane:C,mainView:_,setMainView:w}=Ae(),k=E.useCallback(H=>{y(V=>{const J=typeof H=="function"?H(V):H;S.current=J;try{sessionStorage.setItem("codebuddy_sidebar_open",String(J))}catch{}return J})},[]);E.useEffect(()=>{const H=window.matchMedia("(min-width: 768px)"),V=J=>{J.matches?y(S.current):y(!1)};return H.addEventListener("change",V),()=>H.removeEventListener("change",V)},[]),E.useEffect(()=>{const H=V=>Ot.handleKeyDown(V);return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[]),E.useEffect(()=>{n==="connected"&&rm.getState().loadBindings()},[n]);const N=E.useCallback(H=>{C(H)},[C]),L=E.useCallback(async()=>{if(r){try{await je().prompt(r,"/clear")}catch{Fo.error(u("error.newChatFailed"))}l(),c(null),o(null),w("chat"),window.location.hash="/chat"}},[r,l,c,o,w]),$=E.useCallback(async H=>{if(r){try{await je().prompt(r,`/resume ${H}`)}catch{Fo.error(u("error.switchSessionFailed"))}w("chat"),window.location.hash="/chat"}},[r,w]),M=E.useCallback(H=>{w(H),window.location.hash=`/${H}`,window.innerWidth<768&&y(!1)},[w]);if(E.useEffect(()=>{const H=[Ot.register({id:"commandPalette.toggle",key:"p",meta:!0,shift:!0,handler:()=>x(V=>!V)}),Ot.register({id:"sidebar.toggle",key:"b",meta:!0,handler:()=>k(V=>!V)}),Ot.register({id:"terminal.toggle",key:"j",meta:!0,handler:()=>{const V=_==="terminal"?"chat":"terminal";w(V),window.location.hash="/"+V}}),Ot.register({id:"newChat",key:"n",meta:!0,handler:()=>L()}),Ot.register({id:"settings",key:",",meta:!0,handler:()=>{w("settings"),window.location.hash="/settings"}}),Ot.registerAction("app:commandPalette",()=>x(V=>!V)),Ot.registerAction("app:toggleSidebar",()=>k(V=>!V)),Ot.registerAction("app:toggleTerminal",()=>{const V=_==="terminal"?"chat":"terminal";w(V),window.location.hash="/"+V}),Ot.registerAction("app:newChat",()=>L()),Ot.registerAction("app:settings",()=>{w("settings"),window.location.hash="/settings"}),Ot.registerAction("app:focusInput",()=>{const V=document.querySelector("textarea");V==null||V.focus()}),Ot.registerAction("app:keybindings",()=>{w("keybindings"),window.location.hash="/keybindings"})];return()=>H.forEach(V=>V())},[_,L,w,k]),E.useEffect(()=>{const H=new URLSearchParams(window.location.search),V=H.get("password"),J=H.get("token");if(V||J){Bg(V||J),H.delete("password"),H.delete("token");const ee=H.toString()?`${window.location.pathname}?${H.toString()}`:window.location.pathname;window.history.replaceState({},"",ee)}t()},[t]),E.useEffect(()=>{if(e==="authenticated"){const H=xl();w(H),(!window.location.hash||window.location.hash==="#")&&(window.location.hash=`/${H}`)}},[e,w]),E.useEffect(()=>Lk(V=>{w(V)}),[w]),E.useEffect(()=>{if(e==="authenticated"){const H=ca()||void 0;a({token:H,continue:!0})}},[e,a]),E.useEffect(()=>{document.documentElement.lang=p,document.title=s?`${s} - CodeBuddy Code`:u("page.title")},[p,u,s]),e==="loading")return i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx(_n,{size:"large",text:u("app.connecting")})})});if(e==="login")return i.jsx(TD,{});const O=()=>{if(n==="connecting")return i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx(_n,{size:"large",text:u("app.connecting")})});if(n!=="connected"&&_!=="settings"&&_!=="docs")return i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-text-secondary mb-4 font-medium",children:u("app.connectFailed")}),i.jsx("button",{onClick:()=>a(),className:["px-6 py-2.5 bg-accent-brand text-white rounded-full","text-sm font-medium transition-all hover:bg-accent-brand/90","hover:scale-105 active:scale-95 shadow-sm"].join(" "),children:u("app.retry")})]})});switch(_){case"chat":return i.jsx(St,{viewName:"chat",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 overflow-hidden w-full relative",children:d?i.jsx(bj,{}):i.jsx(U$,{onClickCloseBottomSheet:()=>h(!1)})}),i.jsx(Tj,{}),i.jsx("div",{className:"flex-none bg-bg-primary",children:i.jsx(wD,{onNavigate:M,onNewChat:L,onHistory:()=>m(!0),mainView:_,showBottomSheet:f,setShowBottomSheet:h})})]})});case"tasks":return i.jsx(St,{viewName:"tasks",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(pv,{})});case"plugins":return i.jsx(St,{viewName:"plugins",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(cv,{})});case"terminal":return null;case"canvas":return null;case"canvas-pane":return null;case"remote-control":return i.jsx(St,{viewName:"remote-control",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(VD,{onNavigate:M})});case"editor":return i.jsx(St,{viewName:"editor",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(qO,{onMenuClick:()=>k(H=>!H)})});case"changes":return i.jsx(St,{viewName:"changes",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(Wb,{onMenuClick:()=>k(H=>!H)})});case"settings":return i.jsx(St,{viewName:"settings",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(uv,{})});case"keybindings":return i.jsx(St,{viewName:"keybindings",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(kD,{})});case"metrics":return i.jsx(St,{viewName:"metrics",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(UD,{})});case"stats":return i.jsx(St,{viewName:"stats",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(lj,{})});case"traces":return i.jsx(St,{viewName:"traces",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(Rj,{})});case"workers":return i.jsx(St,{viewName:"workers",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(Zj,{})});case"logs":return i.jsx(St,{viewName:"logs",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(OD,{})});case"docs":return i.jsx(St,{viewName:"docs",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(dg,{})});default:return null}};return _==="docs"&&window.location.hash.includes("standalone")?i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx(dg,{})}):_==="canvas-pane"?i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx(jk,{})}):_==="canvas"&&window.location.hash.includes("standalone")?i.jsx("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:i.jsx(zm,{})}):i.jsxs("div",{className:"flex h-screen h-[100dvh] bg-bg-primary text-text-primary transition-colors duration-200 font-sans overflow-hidden",children:[i.jsx(QD,{isOpen:g,onClose:()=>k(!1),mainView:_,onNavigate:M}),i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative transition-all duration-300 h-full",children:[_!=="editor"&&_!=="changes"&&i.jsx(fj,{onMenuClick:()=>k(H=>!H),onNewChat:L,onSplitTerminal:N,onHistory:()=>m(!0)}),i.jsxs("div",{className:"flex-1 flex flex-col w-full overflow-hidden relative",children:[i.jsx("div",{className:"flex-1 flex flex-col w-full",style:{display:_==="terminal"?"flex":"none"},children:i.jsx(hv,{})}),i.jsx("div",{className:"flex-1 flex flex-col w-full",style:{display:_==="canvas"?"flex":"none"},children:i.jsx(St,{viewName:"canvas",errorTitle:u("error.viewCrashed"),retryLabel:u("app.retry"),children:i.jsx(zm,{})})}),_!=="terminal"&&_!=="canvas"&&O()]}),i.jsx(JO,{isOpen:v,onClose:()=>m(!1),onSwitchSession:$})]}),i.jsx(_j,{}),i.jsx(Q$,{isOpen:b,onClose:()=>x(!1),onNavigate:M,onNewChat:L}),i.jsx(ZO,{})]})}a_.createRoot(document.getElementById("root")).render(i.jsx(E.StrictMode,{children:i.jsx(St,{children:i.jsx(oM,{})})}));