aegis-bridge 2.6.4 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{index-G8fziBeQ.js → index-SoKhTCVa.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/hook-settings.d.ts +12 -3
- package/dist/hook-settings.js +59 -2
- package/dist/server.js +87 -3
- package/dist/session.d.ts +6 -0
- package/dist/session.js +22 -1
- package/dist/tool-registry.d.ts +40 -0
- package/dist/tool-registry.js +83 -0
- package/dist/validation.d.ts +36 -0
- package/dist/validation.js +15 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-9Hkkvm_I.css +0 -32
- package/dist/dashboard/assets/index-G8fziBeQ.js +0 -262
- package/dist/dashboard/index.html +0 -14
|
@@ -259,4 +259,4 @@ WARNING: This link could potentially be dangerous`)){const p=window.open();if(p)
|
|
|
259
259
|
`:`
|
|
260
260
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),p.isLinux&&A&&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(A){const B=this._getMouseBufferCoords(A),$=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!($&&I&&B)&&this._areCoordsInSelection(B,$,I)}isCellInSelection(A,B){const $=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!$||!I)&&this._areCoordsInSelection([A,B],$,I)}_areCoordsInSelection(A,B,$){return A[1]>B[1]&&A[1]<$[1]||B[1]===$[1]&&A[1]===B[1]&&A[0]>=B[0]&&A[0]<$[0]||B[1]<$[1]&&A[1]===$[1]&&A[0]<$[0]||B[1]<$[1]&&A[1]===B[1]&&A[0]>=B[0]}_selectWordAtCursor(A,B){var q,P;const $=(P=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:P.range;if($)return this._model.selectionStart=[$.start.x-1,$.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)($,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const I=this._getMouseBufferCoords(A);return!!I&&(this._selectWordAt(I,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,B){this._model.clearSelection(),A=Math.max(A,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const B=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(A){let B=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const $=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=$?0:(B>$&&(B-=$),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(A){return p.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),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(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const B=this._getMouseBufferCoords(A);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(A){return A.altKey&&!(p.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const B=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!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(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const $=this._bufferService.buffer;if(this._model.selectionEnd[1]<$.lines.length){const I=$.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}B&&B[0]===this._model.selectionEnd[0]&&B[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 A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const B=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const $=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if($&&$[0]!==void 0&&$[1]!==void 0){const I=(0,C.moveToCellSequence)($[0]-1,$[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,$=!(!A||!B||A[0]===B[0]&&A[1]===B[1]);$?A&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,B,$)):this._oldHasSelection&&this._fireOnSelectionChange(A,B,$)}_fireOnSelectionChange(A,B,$){this._oldSelectionStart=A,this._oldSelectionEnd=B,this._oldHasSelection=$,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(A,B){let $=B;for(let I=0;B>=I;I++){const q=A.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?$--:q>1&&B!==I&&($+=q-1)}return $}setSelection(A,B,$){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,B],this._model.selectionStartLength=$,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,B,$=!0,I=!0){if(A[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,P=q.lines.get(A[1]);if(!P)return;const Q=q.translateBufferLineToString(A[1],!1);let se=this._convertViewportColToCharacterIndex(P,A[0]),G=se;const K=A[0]-se;let ee=0,N=0,U=0,L=0;if(Q.charAt(se)===" "){for(;se>0&&Q.charAt(se-1)===" ";)se--;for(;G<Q.length&&Q.charAt(G+1)===" ";)G++}else{let ne=A[0],he=A[0];P.getWidth(ne)===0&&(ee++,ne--),P.getWidth(he)===2&&(N++,he++);const me=P.getString(he).length;for(me>1&&(L+=me-1,G+=me-1);ne>0&&se>0&&!this._isCharWordSeparator(P.loadCell(ne-1,this._workCell));){P.loadCell(ne-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,ne--):Y>1&&(U+=Y-1,se-=Y-1),se--,ne--}for(;he<P.length&&G+1<Q.length&&!this._isCharWordSeparator(P.loadCell(he+1,this._workCell));){P.loadCell(he+1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(N++,he++):Y>1&&(L+=Y-1,G+=Y-1),G++,he++}}G++;let H=se+K-ee+U,X=Math.min(this._bufferService.cols,G-se+ee+N-U-L);if(B||Q.slice(se,G).trim()!==""){if($&&H===0&&P.getCodePoint(0)!==32){const ne=q.lines.get(A[1]-1);if(ne&&P.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const he=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(he){const me=this._bufferService.cols-he.start;H-=me,X+=me}}}if(I&&H+X===this._bufferService.cols&&P.getCodePoint(this._bufferService.cols-1)!==32){const ne=q.lines.get(A[1]+1);if(ne!=null&&ne.isWrapped&&ne.getCodePoint(0)!==32){const he=this._getWordAt([0,A[1]+1],!1,!1,!0);he&&(X+=he.length)}}return{start:H,length:X}}}_selectWordAt(A,B){const $=this._getWordAt(A,B);if($){for(;$.start<0;)$.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[$.start,A[1]],this._model.selectionStartLength=$.length}}_selectToWordAt(A){const B=this._getWordAt(A,!0);if(B){let $=A[1];for(;B.start<0;)B.start+=this._bufferService.cols,$--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,$++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,$]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const B=this._bufferService.buffer.getWrappedRangeForLine(A),$={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)($,this._bufferService.cols)}};c.SelectionService=M=u([y(3,S.IBufferService),y(4,S.ICoreService),y(5,E.IMouseService),y(6,S.IOptionsService),y(7,E.IRenderService),y(8,E.ICoreBrowserService)],M)},4725:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const u=h(8343);c.ICharSizeService=(0,u.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),c.IMouseService=(0,u.createDecorator)("MouseService"),c.IRenderService=(0,u.createDecorator)("RenderService"),c.ISelectionService=(0,u.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,u.createDecorator)("ThemeService"),c.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(T,c,h){var u=this&&this.__decorate||function(M,A,B,$){var I,q=arguments.length,P=q<3?A:$===null?$=Object.getOwnPropertyDescriptor(A,B):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(M,A,B,$);else for(var Q=M.length-1;Q>=0;Q--)(I=M[Q])&&(P=(q<3?I(P):q>3?I(A,B,P):I(A,B))||P);return q>3&&P&&Object.defineProperty(A,B,P),P},y=this&&this.__param||function(M,A){return function(B,$){A(B,$,M)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),C=h(8055),w=h(8460),E=h(844),b=h(2585),d=C.css.toColor("#ffffff"),p=C.css.toColor("#000000"),f=C.css.toColor("#ffffff"),v=C.css.toColor("#000000"),S={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const M=[C.css.toColor("#2e3436"),C.css.toColor("#cc0000"),C.css.toColor("#4e9a06"),C.css.toColor("#c4a000"),C.css.toColor("#3465a4"),C.css.toColor("#75507b"),C.css.toColor("#06989a"),C.css.toColor("#d3d7cf"),C.css.toColor("#555753"),C.css.toColor("#ef2929"),C.css.toColor("#8ae234"),C.css.toColor("#fce94f"),C.css.toColor("#729fcf"),C.css.toColor("#ad7fa8"),C.css.toColor("#34e2e2"),C.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let B=0;B<216;B++){const $=A[B/36%6|0],I=A[B/6%6|0],q=A[B%6];M.push({css:C.channels.toCss($,I,q),rgba:C.channels.toRgba($,I,q)})}for(let B=0;B<24;B++){const $=8+10*B;M.push({css:C.channels.toCss($,$,$),rgba:C.channels.toRgba($,$,$)})}return M})());let R=c.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(M){super(),this._optionsService=M,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d,background:p,cursor:f,cursorAccent:v,selectionForeground:void 0,selectionBackgroundTransparent:S,selectionBackgroundOpaque:C.color.blend(p,S),selectionInactiveBackgroundTransparent:S,selectionInactiveBackgroundOpaque:C.color.blend(p,S),ansi:c.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(M={}){const A=this._colors;if(A.foreground=D(M.foreground,d),A.background=D(M.background,p),A.cursor=D(M.cursor,f),A.cursorAccent=D(M.cursorAccent,v),A.selectionBackgroundTransparent=D(M.selectionBackground,S),A.selectionBackgroundOpaque=C.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=D(M.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=C.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=M.selectionForeground?D(M.selectionForeground,C.NULL_COLOR):void 0,A.selectionForeground===C.NULL_COLOR&&(A.selectionForeground=void 0),C.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=C.color.opacity(A.selectionBackgroundTransparent,.3)),C.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=C.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=c.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=D(M.black,c.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=D(M.red,c.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=D(M.green,c.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=D(M.yellow,c.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=D(M.blue,c.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=D(M.magenta,c.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=D(M.cyan,c.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=D(M.white,c.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=D(M.brightBlack,c.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=D(M.brightRed,c.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=D(M.brightGreen,c.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=D(M.brightYellow,c.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=D(M.brightBlue,c.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=D(M.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=D(M.brightCyan,c.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=D(M.brightWhite,c.DEFAULT_ANSI_COLORS[15]),M.extendedAnsi){const B=Math.min(A.ansi.length-16,M.extendedAnsi.length);for(let $=0;$<B;$++)A.ansi[$+16]=D(M.extendedAnsi[$],c.DEFAULT_ANSI_COLORS[$+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(M){this._restoreColor(M),this._onChangeColors.fire(this.colors)}_restoreColor(M){if(M!==void 0)switch(M){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[M]=this._restoreColors.ansi[M]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(M){M(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 D(M,A){if(M!==void 0)try{return C.css.toColor(M)}catch{}return A}c.ThemeService=R=u([y(0,b.IOptionsService)],R)},6349:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const u=h(8460),y=h(844);class m extends y.Disposable{constructor(w){super(),this._maxLength=w,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.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(w){if(this._maxLength===w)return;const E=new Array(w);for(let b=0;b<Math.min(w,this.length);b++)E[b]=this._array[this._getCyclicIndex(b)];this._array=E,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let E=this._length;E<w;E++)this._array[E]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,E){this._array[this._getCyclicIndex(w)]=E}push(w){this._array[this._getCyclicIndex(this._length)]=w,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(w,E,...b){if(E){for(let d=w;d<this._length-E;d++)this._array[this._getCyclicIndex(d)]=this._array[this._getCyclicIndex(d+E)];this._length-=E,this.onDeleteEmitter.fire({index:w,amount:E})}for(let d=this._length-1;d>=w;d--)this._array[this._getCyclicIndex(d+b.length)]=this._array[this._getCyclicIndex(d)];for(let d=0;d<b.length;d++)this._array[this._getCyclicIndex(w+d)]=b[d];if(b.length&&this.onInsertEmitter.fire({index:w,amount:b.length}),this._length+b.length>this._maxLength){const d=this._length+b.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=b.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,E,b){if(!(E<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(let p=E-1;p>=0;p--)this.set(w+p+b,this.get(w+p));const d=w+E+b-this._length;if(d>0)for(this._length+=d;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let d=0;d<E;d++)this.set(w+d+b,this.get(w+d))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}c.CircularList=m},1439:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function h(u,y=5){if(typeof u!="object")return u;const m=Array.isArray(u)?[]:{};for(const C in u)m[C]=y<=1?u[C]:u[C]&&h(u[C],y-1);return m}},8055:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let h=0,u=0,y=0,m=0;var C,w,E,b,d;function p(v){const S=v.toString(16);return S.length<2?"0"+S:S}function f(v,S){return v<S?(S+.05)/(v+.05):(v+.05)/(S+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(v){v.toCss=function(S,R,D,M){return M!==void 0?`#${p(S)}${p(R)}${p(D)}${p(M)}`:`#${p(S)}${p(R)}${p(D)}`},v.toRgba=function(S,R,D,M=255){return(S<<24|R<<16|D<<8|M)>>>0},v.toColor=function(S,R,D,M){return{css:v.toCss(S,R,D,M),rgba:v.toRgba(S,R,D,M)}}})(C||(c.channels=C={})),(function(v){function S(R,D){return m=Math.round(255*D),[h,u,y]=d.toChannels(R.rgba),{css:C.toCss(h,u,y,m),rgba:C.toRgba(h,u,y,m)}}v.blend=function(R,D){if(m=(255&D.rgba)/255,m===1)return{css:D.css,rgba:D.rgba};const M=D.rgba>>24&255,A=D.rgba>>16&255,B=D.rgba>>8&255,$=R.rgba>>24&255,I=R.rgba>>16&255,q=R.rgba>>8&255;return h=$+Math.round((M-$)*m),u=I+Math.round((A-I)*m),y=q+Math.round((B-q)*m),{css:C.toCss(h,u,y),rgba:C.toRgba(h,u,y)}},v.isOpaque=function(R){return(255&R.rgba)==255},v.ensureContrastRatio=function(R,D,M){const A=d.ensureContrastRatio(R.rgba,D.rgba,M);if(A)return C.toColor(A>>24&255,A>>16&255,A>>8&255)},v.opaque=function(R){const D=(255|R.rgba)>>>0;return[h,u,y]=d.toChannels(D),{css:C.toCss(h,u,y),rgba:D}},v.opacity=S,v.multiplyOpacity=function(R,D){return m=255&R.rgba,S(R,m*D/255)},v.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(w||(c.color=w={})),(function(v){let S,R;try{const D=document.createElement("canvas");D.width=1,D.height=1;const M=D.getContext("2d",{willReadFrequently:!0});M&&(S=M,S.globalCompositeOperation="copy",R=S.createLinearGradient(0,0,1,1))}catch{}v.toColor=function(D){if(D.match(/#[\da-f]{3,8}/i))switch(D.length){case 4:return h=parseInt(D.slice(1,2).repeat(2),16),u=parseInt(D.slice(2,3).repeat(2),16),y=parseInt(D.slice(3,4).repeat(2),16),C.toColor(h,u,y);case 5:return h=parseInt(D.slice(1,2).repeat(2),16),u=parseInt(D.slice(2,3).repeat(2),16),y=parseInt(D.slice(3,4).repeat(2),16),m=parseInt(D.slice(4,5).repeat(2),16),C.toColor(h,u,y,m);case 7:return{css:D,rgba:(parseInt(D.slice(1),16)<<8|255)>>>0};case 9:return{css:D,rgba:parseInt(D.slice(1),16)>>>0}}const M=D.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return h=parseInt(M[1]),u=parseInt(M[2]),y=parseInt(M[3]),m=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),C.toColor(h,u,y,m);if(!S||!R)throw new Error("css.toColor: Unsupported css format");if(S.fillStyle=R,S.fillStyle=D,typeof S.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(S.fillRect(0,0,1,1),[h,u,y,m]=S.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:C.toRgba(h,u,y,m),css:D}}})(E||(c.css=E={})),(function(v){function S(R,D,M){const A=R/255,B=D/255,$=M/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*($<=.03928?$/12.92:Math.pow(($+.055)/1.055,2.4))}v.relativeLuminance=function(R){return S(R>>16&255,R>>8&255,255&R)},v.relativeLuminance2=S})(b||(c.rgb=b={})),(function(v){function S(D,M,A){const B=D>>24&255,$=D>>16&255,I=D>>8&255;let q=M>>24&255,P=M>>16&255,Q=M>>8&255,se=f(b.relativeLuminance2(q,P,Q),b.relativeLuminance2(B,$,I));for(;se<A&&(q>0||P>0||Q>0);)q-=Math.max(0,Math.ceil(.1*q)),P-=Math.max(0,Math.ceil(.1*P)),Q-=Math.max(0,Math.ceil(.1*Q)),se=f(b.relativeLuminance2(q,P,Q),b.relativeLuminance2(B,$,I));return(q<<24|P<<16|Q<<8|255)>>>0}function R(D,M,A){const B=D>>24&255,$=D>>16&255,I=D>>8&255;let q=M>>24&255,P=M>>16&255,Q=M>>8&255,se=f(b.relativeLuminance2(q,P,Q),b.relativeLuminance2(B,$,I));for(;se<A&&(q<255||P<255||Q<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),P=Math.min(255,P+Math.ceil(.1*(255-P))),Q=Math.min(255,Q+Math.ceil(.1*(255-Q))),se=f(b.relativeLuminance2(q,P,Q),b.relativeLuminance2(B,$,I));return(q<<24|P<<16|Q<<8|255)>>>0}v.blend=function(D,M){if(m=(255&M)/255,m===1)return M;const A=M>>24&255,B=M>>16&255,$=M>>8&255,I=D>>24&255,q=D>>16&255,P=D>>8&255;return h=I+Math.round((A-I)*m),u=q+Math.round((B-q)*m),y=P+Math.round(($-P)*m),C.toRgba(h,u,y)},v.ensureContrastRatio=function(D,M,A){const B=b.relativeLuminance(D>>8),$=b.relativeLuminance(M>>8);if(f(B,$)<A){if($<B){const P=S(D,M,A),Q=f(B,b.relativeLuminance(P>>8));if(Q<A){const se=R(D,M,A);return Q>f(B,b.relativeLuminance(se>>8))?P:se}return P}const I=R(D,M,A),q=f(B,b.relativeLuminance(I>>8));if(q<A){const P=S(D,M,A);return q>f(B,b.relativeLuminance(P>>8))?I:P}return I}},v.reduceLuminance=S,v.increaseLuminance=R,v.toChannels=function(D){return[D>>24&255,D>>16&255,D>>8&255,255&D]}})(d||(c.rgba=d={})),c.toPaddedHex=p,c.contrastRatio=f},8969:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const u=h(844),y=h(2585),m=h(4348),C=h(7866),w=h(744),E=h(7302),b=h(6975),d=h(8460),p=h(1753),f=h(1480),v=h(7994),S=h(9282),R=h(5435),D=h(5981),M=h(2660);let A=!1;class B extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new d.EventEmitter),this._onScroll.event((I=>{var q;(q=this._onScrollApi)==null||q.fire(I.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(I){for(const q in I)this.optionsService.options[q]=I[q]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new d.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new E.OptionsService(I)),this._instantiationService.setService(y.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(y.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(C.LogService)),this._instantiationService.setService(y.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(b.CoreService)),this._instantiationService.setService(y.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(p.CoreMouseService)),this._instantiationService.setService(y.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(y.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(v.CharsetService),this._instantiationService.setService(y.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(M.OscLinkService),this._instantiationService.setService(y.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new R.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,d.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,d.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,d.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,d.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((q=>{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((q=>{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 D.WriteBuffer(((q,P)=>this._inputHandler.parse(q,P)))),this.register((0,d.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,q){this._writeBuffer.write(I,q)}writeSync(I,q){this._logService.logLevel<=y.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(I,q)}input(I,q=!0){this.coreService.triggerDataEvent(I,q)}resize(I,q){isNaN(I)||isNaN(q)||(I=Math.max(I,w.MINIMUM_COLS),q=Math.max(q,w.MINIMUM_ROWS),this._bufferService.resize(I,q))}scroll(I,q=!1){this._bufferService.scroll(I,q)}scrollLines(I,q,P){this._bufferService.scrollLines(I,q,P)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){const q=I-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(I,q){return this._inputHandler.registerEscHandler(I,q)}registerDcsHandler(I,q){return this._inputHandler.registerDcsHandler(I,q)}registerCsiHandler(I,q){return this._inputHandler.registerCsiHandler(I,q)}registerOscHandler(I,q){return this._inputHandler.registerOscHandler(I,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?I=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const I=[];I.push(this.onLineFeed(S.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,S.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const q of I)q.dispose()}))}}}c.CoreTerminal=B},8460:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===h)return void this._listeners.splice(u,1)}}})),this._event}fire(h,u){const y=[];for(let m=0;m<this._listeners.length;m++)y.push(this._listeners[m]);for(let m=0;m<y.length;m++)y[m].call(void 0,h,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,u){return h((y=>u.fire(y)))},c.runAndSubscribe=function(h,u){return u(void 0),h((y=>u(y)))}},5435:function(T,c,h){var u=this&&this.__decorate||function(ee,N,U,L){var H,X=arguments.length,ne=X<3?N:L===null?L=Object.getOwnPropertyDescriptor(N,U):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(ee,N,U,L);else for(var he=ee.length-1;he>=0;he--)(H=ee[he])&&(ne=(X<3?H(ne):X>3?H(N,U,ne):H(N,U))||ne);return X>3&&ne&&Object.defineProperty(N,U,ne),ne},y=this&&this.__param||function(ee,N){return function(U,L){N(U,L,ee)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=h(2584),C=h(7116),w=h(2015),E=h(844),b=h(482),d=h(8437),p=h(8460),f=h(643),v=h(511),S=h(3734),R=h(2585),D=h(1480),M=h(6242),A=h(6351),B=h(5941),$={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function q(ee,N){if(ee>24)return N.setWinLines||!1;switch(ee){case 1:return!!N.restoreWin;case 2:return!!N.minimizeWin;case 3:return!!N.setWinPosition;case 4:return!!N.setWinSizePixels;case 5:return!!N.raiseWin;case 6:return!!N.lowerWin;case 7:return!!N.refreshWin;case 8:return!!N.setWinSizeChars;case 9:return!!N.maximizeWin;case 10:return!!N.fullscreenWin;case 11:return!!N.getWinState;case 13:return!!N.getWinPosition;case 14:return!!N.getWinSizePixels;case 15:return!!N.getScreenSizePixels;case 16:return!!N.getCellSizePixels;case 18:return!!N.getWinSizeChars;case 19:return!!N.getScreenSizeChars;case 20:return!!N.getIconTitle;case 21:return!!N.getWinTitle;case 22:return!!N.pushTitle;case 23:return!!N.popTitle;case 24:return!!N.setWinLines}return!1}var P;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(P||(c.WindowsOptionsReportType=P={}));let Q=0;class se extends E.Disposable{getAttrData(){return this._curAttrData}constructor(N,U,L,H,X,ne,he,me,Y=new w.EscapeSequenceParser){super(),this._bufferService=N,this._charsetService=U,this._coreService=L,this._logService=H,this._optionsService=X,this._oscLinkService=ne,this._coreMouseService=he,this._unicodeService=me,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new b.StringToUtf32,this._utf8Decoder=new b.Utf8ToUtf32,this._workCell=new v.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new p.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new p.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new p.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new p.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new p.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new p.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new p.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new p.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new p.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new p.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new p.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new p.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((j=>this._activeBuffer=j.activeBuffer))),this._parser.setCsiHandlerFallback(((j,ce)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(j),params:ce.toArray()})})),this._parser.setEscHandlerFallback((j=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(j)})})),this._parser.setExecuteHandlerFallback((j=>{this._logService.debug("Unknown EXECUTE code: ",{code:j})})),this._parser.setOscHandlerFallback(((j,ce,oe)=>{this._logService.debug("Unknown OSC code: ",{identifier:j,action:ce,data:oe})})),this._parser.setDcsHandlerFallback(((j,ce,oe)=>{ce==="HOOK"&&(oe=oe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(j),action:ce,payload:oe})})),this._parser.setPrintHandler(((j,ce,oe)=>this.print(j,ce,oe))),this._parser.registerCsiHandler({final:"@"},(j=>this.insertChars(j))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(j=>this.scrollLeft(j))),this._parser.registerCsiHandler({final:"A"},(j=>this.cursorUp(j))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(j=>this.scrollRight(j))),this._parser.registerCsiHandler({final:"B"},(j=>this.cursorDown(j))),this._parser.registerCsiHandler({final:"C"},(j=>this.cursorForward(j))),this._parser.registerCsiHandler({final:"D"},(j=>this.cursorBackward(j))),this._parser.registerCsiHandler({final:"E"},(j=>this.cursorNextLine(j))),this._parser.registerCsiHandler({final:"F"},(j=>this.cursorPrecedingLine(j))),this._parser.registerCsiHandler({final:"G"},(j=>this.cursorCharAbsolute(j))),this._parser.registerCsiHandler({final:"H"},(j=>this.cursorPosition(j))),this._parser.registerCsiHandler({final:"I"},(j=>this.cursorForwardTab(j))),this._parser.registerCsiHandler({final:"J"},(j=>this.eraseInDisplay(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(j=>this.eraseInDisplay(j,!0))),this._parser.registerCsiHandler({final:"K"},(j=>this.eraseInLine(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(j=>this.eraseInLine(j,!0))),this._parser.registerCsiHandler({final:"L"},(j=>this.insertLines(j))),this._parser.registerCsiHandler({final:"M"},(j=>this.deleteLines(j))),this._parser.registerCsiHandler({final:"P"},(j=>this.deleteChars(j))),this._parser.registerCsiHandler({final:"S"},(j=>this.scrollUp(j))),this._parser.registerCsiHandler({final:"T"},(j=>this.scrollDown(j))),this._parser.registerCsiHandler({final:"X"},(j=>this.eraseChars(j))),this._parser.registerCsiHandler({final:"Z"},(j=>this.cursorBackwardTab(j))),this._parser.registerCsiHandler({final:"`"},(j=>this.charPosAbsolute(j))),this._parser.registerCsiHandler({final:"a"},(j=>this.hPositionRelative(j))),this._parser.registerCsiHandler({final:"b"},(j=>this.repeatPrecedingCharacter(j))),this._parser.registerCsiHandler({final:"c"},(j=>this.sendDeviceAttributesPrimary(j))),this._parser.registerCsiHandler({prefix:">",final:"c"},(j=>this.sendDeviceAttributesSecondary(j))),this._parser.registerCsiHandler({final:"d"},(j=>this.linePosAbsolute(j))),this._parser.registerCsiHandler({final:"e"},(j=>this.vPositionRelative(j))),this._parser.registerCsiHandler({final:"f"},(j=>this.hVPosition(j))),this._parser.registerCsiHandler({final:"g"},(j=>this.tabClear(j))),this._parser.registerCsiHandler({final:"h"},(j=>this.setMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(j=>this.setModePrivate(j))),this._parser.registerCsiHandler({final:"l"},(j=>this.resetMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(j=>this.resetModePrivate(j))),this._parser.registerCsiHandler({final:"m"},(j=>this.charAttributes(j))),this._parser.registerCsiHandler({final:"n"},(j=>this.deviceStatus(j))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(j=>this.deviceStatusPrivate(j))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(j=>this.softReset(j))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(j=>this.setCursorStyle(j))),this._parser.registerCsiHandler({final:"r"},(j=>this.setScrollRegion(j))),this._parser.registerCsiHandler({final:"s"},(j=>this.saveCursor(j))),this._parser.registerCsiHandler({final:"t"},(j=>this.windowOptions(j))),this._parser.registerCsiHandler({final:"u"},(j=>this.restoreCursor(j))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(j=>this.insertColumns(j))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(j=>this.deleteColumns(j))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(j=>this.selectProtected(j))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(j=>this.requestMode(j,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(j=>this.requestMode(j,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new M.OscHandler((j=>(this.setTitle(j),this.setIconName(j),!0)))),this._parser.registerOscHandler(1,new M.OscHandler((j=>this.setIconName(j)))),this._parser.registerOscHandler(2,new M.OscHandler((j=>this.setTitle(j)))),this._parser.registerOscHandler(4,new M.OscHandler((j=>this.setOrReportIndexedColor(j)))),this._parser.registerOscHandler(8,new M.OscHandler((j=>this.setHyperlink(j)))),this._parser.registerOscHandler(10,new M.OscHandler((j=>this.setOrReportFgColor(j)))),this._parser.registerOscHandler(11,new M.OscHandler((j=>this.setOrReportBgColor(j)))),this._parser.registerOscHandler(12,new M.OscHandler((j=>this.setOrReportCursorColor(j)))),this._parser.registerOscHandler(104,new M.OscHandler((j=>this.restoreIndexedColor(j)))),this._parser.registerOscHandler(110,new M.OscHandler((j=>this.restoreFgColor(j)))),this._parser.registerOscHandler(111,new M.OscHandler((j=>this.restoreBgColor(j)))),this._parser.registerOscHandler(112,new M.OscHandler((j=>this.restoreCursorColor(j)))),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 j in C.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:j},(()=>this.selectCharset("("+j))),this._parser.registerEscHandler({intermediates:")",final:j},(()=>this.selectCharset(")"+j))),this._parser.registerEscHandler({intermediates:"*",final:j},(()=>this.selectCharset("*"+j))),this._parser.registerEscHandler({intermediates:"+",final:j},(()=>this.selectCharset("+"+j))),this._parser.registerEscHandler({intermediates:"-",final:j},(()=>this.selectCharset("-"+j))),this._parser.registerEscHandler({intermediates:".",final:j},(()=>this.selectCharset("."+j))),this._parser.registerEscHandler({intermediates:"/",final:j},(()=>this.selectCharset("/"+j)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((j=>(this._logService.error("Parsing error: ",j),j))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((j,ce)=>this.requestStatusString(j,ce))))}_preserveStack(N,U,L,H){this._parseStack.paused=!0,this._parseStack.cursorStartX=N,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=L,this._parseStack.position=H}_logSlowResolvingAsync(N){this._logService.logLevel<=R.LogLevelEnum.WARN&&Promise.race([N,new Promise(((U,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((U=>{if(U!=="#SLOW_TIMEOUT")throw U;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(N,U){let L,H=this._activeBuffer.x,X=this._activeBuffer.y,ne=0;const he=this._parseStack.paused;if(he){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync(L),L;H=this._parseStack.cursorStartX,X=this._parseStack.cursorStartY,this._parseStack.paused=!1,N.length>I&&(ne=this._parseStack.position+I)}if(this._logService.logLevel<=R.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof N=="string"?` "${N}"`:` "${Array.prototype.map.call(N,(j=>String.fromCharCode(j))).join("")}"`),typeof N=="string"?N.split("").map((j=>j.charCodeAt(0))):N),this._parseBuffer.length<N.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(N.length,I))),he||this._dirtyRowTracker.clearRange(),N.length>I)for(let j=ne;j<N.length;j+=I){const ce=j+I<N.length?j+I:N.length,oe=typeof N=="string"?this._stringDecoder.decode(N.substring(j,ce),this._parseBuffer):this._utf8Decoder.decode(N.subarray(j,ce),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,oe))return this._preserveStack(H,X,oe,j),this._logSlowResolvingAsync(L),L}else if(!he){const j=typeof N=="string"?this._stringDecoder.decode(N,this._parseBuffer):this._utf8Decoder.decode(N,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,j))return this._preserveStack(H,X,j,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===H&&this._activeBuffer.y===X||this._onCursorMove.fire();const me=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Y=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Y<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Y,this._bufferService.rows-1),Math.min(me,this._bufferService.rows-1))}print(N,U,L){let H,X;const ne=this._charsetService.charset,he=this._optionsService.rawOptions.screenReaderMode,me=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,j=this._coreService.modes.insertMode,ce=this._curAttrData;let oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-U>0&&oe.getWidth(this._activeBuffer.x-1)===2&&oe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ce);let ve=this._parser.precedingJoinState;for(let pe=U;pe<L;++pe){if(H=N[pe],H<127&&ne){const ct=ne[String.fromCharCode(H)];ct&&(H=ct.charCodeAt(0))}const Te=this._unicodeService.charProperties(H,ve);X=D.UnicodeService.extractWidth(Te);const je=D.UnicodeService.extractShouldJoin(Te),Ue=je?D.UnicodeService.extractWidth(ve):0;if(ve=Te,he&&this._onA11yChar.fire((0,b.stringFromCodePoint)(H)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+X-Ue>me){if(Y){const ct=oe;let Ee=this._activeBuffer.x-Ue;for(this._activeBuffer.x=Ue,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),oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ue>0&&oe instanceof d.BufferLine&&oe.copyCellsFrom(ct,Ee,0,Ue,!1);Ee<me;)ct.setCellFromCodepoint(Ee++,0,1,ce)}else if(this._activeBuffer.x=me-1,X===2)continue}if(je&&this._activeBuffer.x){const ct=oe.getWidth(this._activeBuffer.x-1)?1:2;oe.addCodepointToCell(this._activeBuffer.x-ct,H,X);for(let Ee=X-Ue;--Ee>=0;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ce)}else if(j&&(oe.insertCells(this._activeBuffer.x,X-Ue,this._activeBuffer.getNullCell(ce)),oe.getWidth(me-1)===2&&oe.setCellFromCodepoint(me-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,ce)),oe.setCellFromCodepoint(this._activeBuffer.x++,H,X,ce),X>0)for(;--X;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ce)}this._parser.precedingJoinState=ve,this._activeBuffer.x<me&&L-U>0&&oe.getWidth(this._activeBuffer.x)===0&&!oe.hasContent(this._activeBuffer.x)&&oe.setCellFromCodepoint(this._activeBuffer.x,0,1,ce),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(N,U){return N.final!=="t"||N.prefix||N.intermediates?this._parser.registerCsiHandler(N,U):this._parser.registerCsiHandler(N,(L=>!q(L.params[0],this._optionsService.rawOptions.windowOptions)||U(L)))}registerDcsHandler(N,U){return this._parser.registerDcsHandler(N,new A.DcsHandler(U))}registerEscHandler(N,U){return this._parser.registerEscHandler(N,U)}registerOscHandler(N,U){return this._parser.registerOscHandler(N,new M.OscHandler(U))}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 N;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&&((N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&N.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const N=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-N),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(N=this._bufferService.cols-1){this._activeBuffer.x=Math.min(N,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(N,U){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=N,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=N,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(N,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+N,this._activeBuffer.y+U)}cursorUp(N){const U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,N.params[0]||1)):this._moveCursor(0,-(N.params[0]||1)),!0}cursorDown(N){const U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,N.params[0]||1)):this._moveCursor(0,N.params[0]||1),!0}cursorForward(N){return this._moveCursor(N.params[0]||1,0),!0}cursorBackward(N){return this._moveCursor(-(N.params[0]||1),0),!0}cursorNextLine(N){return this.cursorDown(N),this._activeBuffer.x=0,!0}cursorPrecedingLine(N){return this.cursorUp(N),this._activeBuffer.x=0,!0}cursorCharAbsolute(N){return this._setCursor((N.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(N){return this._setCursor(N.length>=2?(N.params[1]||1)-1:0,(N.params[0]||1)-1),!0}charPosAbsolute(N){return this._setCursor((N.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(N){return this._moveCursor(N.params[0]||1,0),!0}linePosAbsolute(N){return this._setCursor(this._activeBuffer.x,(N.params[0]||1)-1),!0}vPositionRelative(N){return this._moveCursor(0,N.params[0]||1),!0}hVPosition(N){return this.cursorPosition(N),!0}tabClear(N){const U=N.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(N){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=N.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(N){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=N.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(N){const U=N.params[0];return U===1&&(this._curAttrData.bg|=536870912),U!==2&&U!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(N,U,L,H=!1,X=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);ne.replaceCells(U,L,this._activeBuffer.getNullCell(this._eraseAttrData()),X),H&&(ne.isWrapped=!1)}_resetBufferLine(N,U=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),U),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+N),L.isWrapped=!1)}eraseInDisplay(N,U=!1){let L;switch(this._restrictCursor(this._bufferService.cols),N.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);L<this._bufferService.rows;L++)this._resetBufferLine(L,U);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,U),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,U);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,U);this._dirtyRowTracker.markDirty(0);break;case 3:const H=this._activeBuffer.lines.length-this._bufferService.rows;H>0&&(this._activeBuffer.lines.trimStart(H),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-H,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-H,0),this._onScroll.fire(0))}return!0}eraseInLine(N,U=!1){switch(this._restrictCursor(this._bufferService.cols),N.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,U);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,U)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(N){this._restrictCursor();let U=N.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y,H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,X=this._bufferService.rows-1+this._activeBuffer.ybase-H+1;for(;U--;)this._activeBuffer.lines.splice(X-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(N){this._restrictCursor();let U=N.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y;let H;for(H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-H;U--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(N){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,N.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(N){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,N.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(N){let U=N.params[0]||1;for(;U--;)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(N){let U=N.params[0]||1;for(;U--;)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(d.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=N.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);H.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=N.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);H.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=N.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);H.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=N.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);H.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(N){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(N.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(N){const U=this._parser.precedingJoinState;if(!U)return!0;const L=N.params[0]||1,H=D.UnicodeService.extractWidth(U),X=this._activeBuffer.x-H,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(X),he=new Uint32Array(ne.length*L);let me=0;for(let j=0;j<ne.length;){const ce=ne.codePointAt(j)||0;he[me++]=ce,j+=ce>65535?2:1}let Y=me;for(let j=1;j<L;++j)he.copyWithin(Y,0,me),Y+=me;return this.print(he,0,Y),!0}sendDeviceAttributesPrimary(N){return N.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(N){return N.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(N.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(N){return(this._optionsService.rawOptions.termName+"").indexOf(N)===0}setMode(N){for(let U=0;U<N.length;U++)switch(N.params[U]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(N){for(let U=0;U<N.length;U++)switch(N.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,C.DEFAULT_CHARSET),this._charsetService.setgCharset(1,C.DEFAULT_CHARSET),this._charsetService.setgCharset(2,C.DEFAULT_CHARSET),this._charsetService.setgCharset(3,C.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(N){for(let U=0;U<N.length;U++)switch(N.params[U]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(N){for(let U=0;U<N.length;U++)switch(N.params[U]){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(),N.params[U]===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(N,U){const L=this._coreService.decPrivateModes,{activeProtocol:H,activeEncoding:X}=this._coreMouseService,ne=this._coreService,{buffers:he,cols:me}=this._bufferService,{active:Y,alt:j}=he,ce=this._optionsService.rawOptions,oe=je=>je?1:2,ve=N.params[0];return pe=ve,Te=U?ve===2?4:ve===4?oe(ne.modes.insertMode):ve===12?3:ve===20?oe(ce.convertEol):0:ve===1?oe(L.applicationCursorKeys):ve===3?ce.windowOptions.setWinLines?me===80?2:me===132?1:0:0:ve===6?oe(L.origin):ve===7?oe(L.wraparound):ve===8?3:ve===9?oe(H==="X10"):ve===12?oe(ce.cursorBlink):ve===25?oe(!ne.isCursorHidden):ve===45?oe(L.reverseWraparound):ve===66?oe(L.applicationKeypad):ve===67?4:ve===1e3?oe(H==="VT200"):ve===1002?oe(H==="DRAG"):ve===1003?oe(H==="ANY"):ve===1004?oe(L.sendFocus):ve===1005?4:ve===1006?oe(X==="SGR"):ve===1015?4:ve===1016?oe(X==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?oe(Y===j):ve===2004?oe(L.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${U?"":"?"}${pe};${Te}$y`),!0;var pe,Te}_updateAttrColor(N,U,L,H,X){return U===2?(N|=50331648,N&=-16777216,N|=S.AttributeData.fromColorRGB([L,H,X])):U===5&&(N&=-50331904,N|=33554432|255&L),N}_extractColor(N,U,L){const H=[0,0,-1,0,0,0];let X=0,ne=0;do{if(H[ne+X]=N.params[U+ne],N.hasSubParams(U+ne)){const he=N.getSubParams(U+ne);let me=0;do H[1]===5&&(X=1),H[ne+me+1+X]=he[me];while(++me<he.length&&me+ne+1+X<H.length);break}if(H[1]===5&&ne+X>=2||H[1]===2&&ne+X>=5)break;H[1]&&(X=1)}while(++ne+U<N.length&&ne+X<H.length);for(let he=2;he<H.length;++he)H[he]===-1&&(H[he]=0);switch(H[0]){case 38:L.fg=this._updateAttrColor(L.fg,H[1],H[3],H[4],H[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,H[1],H[3],H[4],H[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,H[1],H[3],H[4],H[5])}return ne}_processUnderline(N,U){U.extended=U.extended.clone(),(!~N||N>5)&&(N=1),U.extended.underlineStyle=N,U.fg|=268435456,N===0&&(U.fg&=-268435457),U.updateExtended()}_processSGR0(N){N.fg=d.DEFAULT_ATTR_DATA.fg,N.bg=d.DEFAULT_ATTR_DATA.bg,N.extended=N.extended.clone(),N.extended.underlineStyle=0,N.extended.underlineColor&=-67108864,N.updateExtended()}charAttributes(N){if(N.length===1&&N.params[0]===0)return this._processSGR0(this._curAttrData),!0;const U=N.length;let L;const H=this._curAttrData;for(let X=0;X<U;X++)L=N.params[X],L>=30&&L<=37?(H.fg&=-50331904,H.fg|=16777216|L-30):L>=40&&L<=47?(H.bg&=-50331904,H.bg|=16777216|L-40):L>=90&&L<=97?(H.fg&=-50331904,H.fg|=16777224|L-90):L>=100&&L<=107?(H.bg&=-50331904,H.bg|=16777224|L-100):L===0?this._processSGR0(H):L===1?H.fg|=134217728:L===3?H.bg|=67108864:L===4?(H.fg|=268435456,this._processUnderline(N.hasSubParams(X)?N.getSubParams(X)[0]:1,H)):L===5?H.fg|=536870912:L===7?H.fg|=67108864:L===8?H.fg|=1073741824:L===9?H.fg|=2147483648:L===2?H.bg|=134217728:L===21?this._processUnderline(2,H):L===22?(H.fg&=-134217729,H.bg&=-134217729):L===23?H.bg&=-67108865:L===24?(H.fg&=-268435457,this._processUnderline(0,H)):L===25?H.fg&=-536870913:L===27?H.fg&=-67108865:L===28?H.fg&=-1073741825:L===29?H.fg&=2147483647:L===39?(H.fg&=-67108864,H.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):L===49?(H.bg&=-67108864,H.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?X+=this._extractColor(N,X,H):L===53?H.bg|=1073741824:L===55?H.bg&=-1073741825:L===59?(H.extended=H.extended.clone(),H.extended.underlineColor=-1,H.updateExtended()):L===100?(H.fg&=-67108864,H.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,H.bg&=-67108864,H.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(N){switch(N.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const U=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${U};${L}R`)}return!0}deviceStatusPrivate(N){if(N.params[0]===6){const U=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${U};${L}R`)}return!0}softReset(N){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.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(N){const U=N.params[0]||1;switch(U){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 L=U%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(N){const U=N.params[0]||1;let L;return(N.length<2||(L=N.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>U&&(this._activeBuffer.scrollTop=U-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(N){if(!q(N.params[0],this._optionsService.rawOptions.windowOptions))return!0;const U=N.length>1?N.params[1]:0;switch(N.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(P.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(P.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:U!==0&&U!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),U!==0&&U!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:U!==0&&U!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),U!==0&&U!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(N){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(N){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(N){return this._windowTitle=N,this._onTitleChange.fire(N),!0}setIconName(N){return this._iconName=N,!0}setOrReportIndexedColor(N){const U=[],L=N.split(";");for(;L.length>1;){const H=L.shift(),X=L.shift();if(/^\d+$/.exec(H)){const ne=parseInt(H);if(K(ne))if(X==="?")U.push({type:0,index:ne});else{const he=(0,B.parseColor)(X);he&&U.push({type:1,index:ne,color:he})}}}return U.length&&this._onColor.fire(U),!0}setHyperlink(N){const U=N.split(";");return!(U.length<2)&&(U[1]?this._createHyperlink(U[0],U[1]):!U[0]&&this._finishHyperlink())}_createHyperlink(N,U){this._getCurrentLinkId()&&this._finishHyperlink();const L=N.split(":");let H;const X=L.findIndex((ne=>ne.startsWith("id=")));return X!==-1&&(H=L[X].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:H,uri:U}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(N,U){const L=N.split(";");for(let H=0;H<L.length&&!(U>=this._specialColors.length);++H,++U)if(L[H]==="?")this._onColor.fire([{type:0,index:this._specialColors[U]}]);else{const X=(0,B.parseColor)(L[H]);X&&this._onColor.fire([{type:1,index:this._specialColors[U],color:X}])}return!0}setOrReportFgColor(N){return this._setOrReportSpecialColor(N,0)}setOrReportBgColor(N){return this._setOrReportSpecialColor(N,1)}setOrReportCursorColor(N){return this._setOrReportSpecialColor(N,2)}restoreIndexedColor(N){if(!N)return this._onColor.fire([{type:2}]),!0;const U=[],L=N.split(";");for(let H=0;H<L.length;++H)if(/^\d+$/.exec(L[H])){const X=parseInt(L[H]);K(X)&&U.push({type:2,index:X})}return U.length&&this._onColor.fire(U),!0}restoreFgColor(N){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(N){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(N){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,C.DEFAULT_CHARSET),!0}selectCharset(N){return N.length!==2?(this.selectDefaultCharset(),!0):(N[0]==="/"||this._charsetService.setgCharset($[N[0]],C.CHARSETS[N[1]]||C.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 N=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,N,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=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(N){return this._charsetService.setgLevel(N),!0}screenAlignmentPattern(){const N=new v.CellData;N.content=4194373,N.fg=this._curAttrData.fg,N.bg=this._curAttrData.bg,this._setCursor(0,0);for(let U=0;U<this._bufferService.rows;++U){const L=this._activeBuffer.ybase+this._activeBuffer.y+U,H=this._activeBuffer.lines.get(L);H&&(H.fill(N),H.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(N,U){const L=this._bufferService.buffer,H=this._optionsService.rawOptions;return(X=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${X}${m.C0.ESC}\\`),!0))(N==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:N==='"p'?'P1$r61;1"p':N==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:N==="m"?"P1$r0m":N===" q"?`P1$r${{block:2,underline:4,bar:6}[H.cursorStyle]-(H.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(N,U){this._dirtyRowTracker.markRangeDirty(N,U)}}c.InputHandler=se;let G=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,N){ee>N&&(Q=ee,ee=N,N=Q),ee<this.start&&(this.start=ee),N>this.end&&(this.end=N)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(ee){return 0<=ee&&ee<256}G=u([y(0,R.IBufferService)],G)},844:(T,c)=>{function h(u){for(const y of u)y.dispose();u.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const y=this._disposables.indexOf(u);y!==-1&&this._disposables.splice(y,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var y;this._isDisposed||u===this._value||((y=this._value)==null||y.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},c.toDisposable=function(u){return{dispose:u}},c.disposeArray=h,c.getDisposeArrayDisposable=function(u){return{dispose:()=>h(u)}}},1505:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(y,m,C){this._data[y]||(this._data[y]={}),this._data[y][m]=C}get(y,m){return this._data[y]?this._data[y][m]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(u,y,m,C,w){this._data.get(u,y)||this._data.set(u,y,new h),this._data.get(u,y).set(m,C,w)}get(u,y,m,C){var w;return(w=this._data.get(u,y))==null?void 0:w.get(m,C)}clear(){this._data.clear()}}},6114:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const h=c.isNode?"node":navigator.userAgent,u=c.isNode?"node":navigator.platform;c.isFirefox=h.includes("Firefox"),c.isLegacyEdge=h.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(h),c.getSafariVersion=function(){if(!c.isSafari)return 0;const y=h.match(/Version\/(\d+)/);return y===null||y.length<2?0:parseInt(y[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),c.isIpad=u==="iPad",c.isIphone=u==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),c.isLinux=u.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(h)},6106:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let h=0;c.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(h=this._search(this._getKey(u)),this._array.splice(h,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const y=this._getKey(u);if(y===void 0||(h=this._search(y),h===-1)||this._getKey(this._array[h])!==y)return!1;do if(this._array[h]===u)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===y);return!1}*getKeyIterator(u){if(this._array.length!==0&&(h=this._search(u),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===u))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===u)}forEachByKey(u,y){if(this._array.length!==0&&(h=this._search(u),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===u))do y(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===u)}values(){return[...this._array].values()}_search(u){let y=0,m=this._array.length-1;for(;m>=y;){let C=y+m>>1;const w=this._getKey(this._array[C]);if(w>u)m=C-1;else{if(!(w<u)){for(;C>0&&this._getKey(this._array[C-1])===u;)C--;return C}y=C+1}}return y}}},7226:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const u=h(6114);class y{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let E=0,b=0,d=w.timeRemaining(),p=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),b=Math.max(E,b),p=w.timeRemaining(),1.5*b>p)return d-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-E))}ms`),void this._start();d=p}this.clear()}}class m extends y{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const E=Date.now()+w;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends y{_requestCallback(C){return requestIdleCallback(C)}_cancelCallback(C){cancelIdleCallback(C)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(C){this._queue.clear(),this._queue.enqueue(C)}flush(){this._queue.flush()}}},9282:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const u=h(643);c.updateWindowsModeWrappedState=function(y){const m=y.buffer.lines.get(y.buffer.ybase+y.buffer.y-1),C=m==null?void 0:m.get(y.cols-1),w=y.buffer.lines.get(y.buffer.ybase+y.buffer.y);w&&C&&(w.isWrapped=C[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&C[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new h;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}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}}c.AttributeData=h;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,C=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=C}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=u},9092:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const u=h(6349),y=h(7226),m=h(3734),C=h(8437),w=h(4634),E=h(511),b=h(643),d=h(4863),p=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(f,v,S){this._hasScrollback=f,this._optionsService=v,this._bufferService=S,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=C.DEFAULT_ATTR_DATA.clone(),this.savedCharset=p.DEFAULT_CHARSET,this.markers=[],this._nullCell=E.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),this._whitespaceCell=E.CellData.fromCharData([0,b.WHITESPACE_CELL_CHAR,b.WHITESPACE_CELL_WIDTH,b.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new y.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(f){return f?(this._nullCell.fg=f.fg,this._nullCell.bg=f.bg,this._nullCell.extended=f.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(f){return f?(this._whitespaceCell.fg=f.fg,this._whitespaceCell.bg=f.bg,this._whitespaceCell.extended=f.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(f,v){return new C.BufferLine(this._bufferService.cols,this.getNullCell(f),v)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const f=this.ybase+this.y-this.ydisp;return f>=0&&f<this._rows}_getCorrectBufferLength(f){if(!this._hasScrollback)return f;const v=f+this._optionsService.rawOptions.scrollback;return v>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:v}fillViewportRows(f){if(this.lines.length===0){f===void 0&&(f=C.DEFAULT_ATTR_DATA);let v=this._rows;for(;v--;)this.lines.push(this.getBlankLine(f))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(f,v){const S=this.getNullCell(C.DEFAULT_ATTR_DATA);let R=0;const D=this._getCorrectBufferLength(v);if(D>this.lines.maxLength&&(this.lines.maxLength=D),this.lines.length>0){if(this._cols<f)for(let A=0;A<this.lines.length;A++)R+=+this.lines.get(A).resize(f,S);let M=0;if(this._rows<v)for(let A=this._rows;A<v;A++)this.lines.length<v+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new C.BufferLine(f,S)):this.ybase>0&&this.lines.length<=this.ybase+this.y+M+1?(this.ybase--,M++,this.ydisp>0&&this.ydisp--):this.lines.push(new C.BufferLine(f,S)));else for(let A=this._rows;A>v;A--)this.lines.length>v+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(D<this.lines.maxLength){const A=this.lines.length-D;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=D}this.x=Math.min(this.x,f-1),this.y=Math.min(this.y,v-1),M&&(this.y+=M),this.savedX=Math.min(this.savedX,f-1),this.scrollTop=0}if(this.scrollBottom=v-1,this._isReflowEnabled&&(this._reflow(f,v),this._cols>f))for(let M=0;M<this.lines.length;M++)R+=+this.lines.get(M).resize(f,S);this._cols=f,this._rows=v,this._memoryCleanupQueue.clear(),R>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let f=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,f=!1);let v=0;for(;this._memoryCleanupPosition<this.lines.length;)if(v+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),v>100)return!0;return f}get _isReflowEnabled(){const f=this._optionsService.rawOptions.windowsPty;return f&&f.buildNumber?this._hasScrollback&&f.backend==="conpty"&&f.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(f,v){this._cols!==f&&(f>this._cols?this._reflowLarger(f,v):this._reflowSmaller(f,v))}_reflowLarger(f,v){const S=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,f,this.ybase+this.y,this.getNullCell(C.DEFAULT_ATTR_DATA));if(S.length>0){const R=(0,w.reflowLargerCreateNewLayout)(this.lines,S);(0,w.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(f,v,R.countRemoved)}}_reflowLargerAdjustViewport(f,v,S){const R=this.getNullCell(C.DEFAULT_ATTR_DATA);let D=S;for(;D-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<v&&this.lines.push(new C.BufferLine(f,R))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-S,0)}_reflowSmaller(f,v){const S=this.getNullCell(C.DEFAULT_ATTR_DATA),R=[];let D=0;for(let M=this.lines.length-1;M>=0;M--){let A=this.lines.get(M);if(!A||!A.isWrapped&&A.getTrimmedLength()<=f)continue;const B=[A];for(;A.isWrapped&&M>0;)A=this.lines.get(--M),B.unshift(A);const $=this.ybase+this.y;if($>=M&&$<M+B.length)continue;const I=B[B.length-1].getTrimmedLength(),q=(0,w.reflowSmallerGetNewLineLengths)(B,this._cols,f),P=q.length-B.length;let Q;Q=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+P):Math.max(0,this.lines.length-this.lines.maxLength+P);const se=[];for(let L=0;L<P;L++){const H=this.getBlankLine(C.DEFAULT_ATTR_DATA,!0);se.push(H)}se.length>0&&(R.push({start:M+B.length+D,newLines:se}),D+=se.length),B.push(...se);let G=q.length-1,K=q[G];K===0&&(G--,K=q[G]);let ee=B.length-P-1,N=I;for(;ee>=0;){const L=Math.min(N,K);if(B[G]===void 0)break;if(B[G].copyCellsFrom(B[ee],N-L,K-L,L,!0),K-=L,K===0&&(G--,K=q[G]),N-=L,N===0){ee--;const H=Math.max(ee,0);N=(0,w.getWrappedLineTrimmedLength)(B,H,this._cols)}}for(let L=0;L<B.length;L++)q[L]<f&&B[L].setCell(q[L],S);let U=P-Q;for(;U-- >0;)this.ybase===0?this.y<v-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+D)-v&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+v-1)}if(R.length>0){const M=[],A=[];for(let G=0;G<this.lines.length;G++)A.push(this.lines.get(G));const B=this.lines.length;let $=B-1,I=0,q=R[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+D);let P=0;for(let G=Math.min(this.lines.maxLength-1,B+D-1);G>=0;G--)if(q&&q.start>$+P){for(let K=q.newLines.length-1;K>=0;K--)this.lines.set(G--,q.newLines[K]);G++,M.push({index:$+1,amount:q.newLines.length}),P+=q.newLines.length,q=R[++I]}else this.lines.set(G,A[$--]);let Q=0;for(let G=M.length-1;G>=0;G--)M[G].index+=Q,this.lines.onInsertEmitter.fire(M[G]),Q+=M[G].amount;const se=Math.max(0,B+D-this.lines.maxLength);se>0&&this.lines.onTrimEmitter.fire(se)}}translateBufferLineToString(f,v,S=0,R){const D=this.lines.get(f);return D?D.translateToString(v,S,R):""}getWrappedRangeForLine(f){let v=f,S=f;for(;v>0&&this.lines.get(v).isWrapped;)v--;for(;S+1<this.lines.length&&this.lines.get(S+1).isWrapped;)S++;return{first:v,last:S}}setupTabStops(f){for(f!=null?this.tabs[f]||(f=this.prevStop(f)):(this.tabs={},f=0);f<this._cols;f+=this._optionsService.rawOptions.tabStopWidth)this.tabs[f]=!0}prevStop(f){for(f==null&&(f=this.x);!this.tabs[--f]&&f>0;);return f>=this._cols?this._cols-1:f<0?0:f}nextStop(f){for(f==null&&(f=this.x);!this.tabs[++f]&&f<this._cols;);return f>=this._cols?this._cols-1:f<0?0:f}clearMarkers(f){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].line===f&&(this.markers[v].dispose(),this.markers.splice(v--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let f=0;f<this.markers.length;f++)this.markers[f].dispose(),this.markers.splice(f--,1);this._isClearing=!1}addMarker(f){const v=new d.Marker(f);return this.markers.push(v),v.register(this.lines.onTrim((S=>{v.line-=S,v.line<0&&v.dispose()}))),v.register(this.lines.onInsert((S=>{v.line>=S.index&&(v.line+=S.amount)}))),v.register(this.lines.onDelete((S=>{v.line>=S.index&&v.line<S.index+S.amount&&v.dispose(),v.line>S.index&&(v.line-=S.amount)}))),v.register(v.onDispose((()=>this._removeMarker(v)))),v}_removeMarker(f){this._isClearing||this.markers.splice(this.markers.indexOf(f),1)}}},8437:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const u=h(3734),y=h(511),m=h(643),C=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let w=0;class E{constructor(d,p,f=!1){this.isWrapped=f,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*d);const v=p||y.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let S=0;S<d;++S)this.setCell(S,v);this.length=d}get(d){const p=this._data[3*d+0],f=2097151&p;return[this._data[3*d+1],2097152&p?this._combined[d]:f?(0,C.stringFromCodePoint)(f):"",p>>22,2097152&p?this._combined[d].charCodeAt(this._combined[d].length-1):f]}set(d,p){this._data[3*d+1]=p[m.CHAR_DATA_ATTR_INDEX],p[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[d]=p[1],this._data[3*d+0]=2097152|d|p[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*d+0]=p[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(d){return this._data[3*d+0]>>22}hasWidth(d){return 12582912&this._data[3*d+0]}getFg(d){return this._data[3*d+1]}getBg(d){return this._data[3*d+2]}hasContent(d){return 4194303&this._data[3*d+0]}getCodePoint(d){const p=this._data[3*d+0];return 2097152&p?this._combined[d].charCodeAt(this._combined[d].length-1):2097151&p}isCombined(d){return 2097152&this._data[3*d+0]}getString(d){const p=this._data[3*d+0];return 2097152&p?this._combined[d]:2097151&p?(0,C.stringFromCodePoint)(2097151&p):""}isProtected(d){return 536870912&this._data[3*d+2]}loadCell(d,p){return w=3*d,p.content=this._data[w+0],p.fg=this._data[w+1],p.bg=this._data[w+2],2097152&p.content&&(p.combinedData=this._combined[d]),268435456&p.bg&&(p.extended=this._extendedAttrs[d]),p}setCell(d,p){2097152&p.content&&(this._combined[d]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[d]=p.extended),this._data[3*d+0]=p.content,this._data[3*d+1]=p.fg,this._data[3*d+2]=p.bg}setCellFromCodepoint(d,p,f,v){268435456&v.bg&&(this._extendedAttrs[d]=v.extended),this._data[3*d+0]=p|f<<22,this._data[3*d+1]=v.fg,this._data[3*d+2]=v.bg}addCodepointToCell(d,p,f){let v=this._data[3*d+0];2097152&v?this._combined[d]+=(0,C.stringFromCodePoint)(p):2097151&v?(this._combined[d]=(0,C.stringFromCodePoint)(2097151&v)+(0,C.stringFromCodePoint)(p),v&=-2097152,v|=2097152):v=p|4194304,f&&(v&=-12582913,v|=f<<22),this._data[3*d+0]=v}insertCells(d,p,f){if((d%=this.length)&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,f),p<this.length-d){const v=new y.CellData;for(let S=this.length-d-p-1;S>=0;--S)this.setCell(d+p+S,this.loadCell(d+S,v));for(let S=0;S<p;++S)this.setCell(d+S,f)}else for(let v=d;v<this.length;++v)this.setCell(v,f);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,f)}deleteCells(d,p,f){if(d%=this.length,p<this.length-d){const v=new y.CellData;for(let S=0;S<this.length-d-p;++S)this.setCell(d+S,this.loadCell(d+p+S,v));for(let S=this.length-p;S<this.length;++S)this.setCell(S,f)}else for(let v=d;v<this.length;++v)this.setCell(v,f);d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,f),this.getWidth(d)!==0||this.hasContent(d)||this.setCellFromCodepoint(d,0,1,f)}replaceCells(d,p,f,v=!1){if(v)for(d&&this.getWidth(d-1)===2&&!this.isProtected(d-1)&&this.setCellFromCodepoint(d-1,0,1,f),p<this.length&&this.getWidth(p-1)===2&&!this.isProtected(p)&&this.setCellFromCodepoint(p,0,1,f);d<p&&d<this.length;)this.isProtected(d)||this.setCell(d,f),d++;else for(d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,f),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodepoint(p,0,1,f);d<p&&d<this.length;)this.setCell(d++,f)}resize(d,p){if(d===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const f=3*d;if(d>this.length){if(this._data.buffer.byteLength>=4*f)this._data=new Uint32Array(this._data.buffer,0,f);else{const v=new Uint32Array(f);v.set(this._data),this._data=v}for(let v=this.length;v<d;++v)this.setCell(v,p)}else{this._data=this._data.subarray(0,f);const v=Object.keys(this._combined);for(let R=0;R<v.length;R++){const D=parseInt(v[R],10);D>=d&&delete this._combined[D]}const S=Object.keys(this._extendedAttrs);for(let R=0;R<S.length;R++){const D=parseInt(S[R],10);D>=d&&delete this._extendedAttrs[D]}}return this.length=d,4*f*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const d=new Uint32Array(this._data.length);return d.set(this._data),this._data=d,1}return 0}fill(d,p=!1){if(p)for(let f=0;f<this.length;++f)this.isProtected(f)||this.setCell(f,d);else{this._combined={},this._extendedAttrs={};for(let f=0;f<this.length;++f)this.setCell(f,d)}}copyFrom(d){this.length!==d.length?this._data=new Uint32Array(d._data):this._data.set(d._data),this.length=d.length,this._combined={};for(const p in d._combined)this._combined[p]=d._combined[p];this._extendedAttrs={};for(const p in d._extendedAttrs)this._extendedAttrs[p]=d._extendedAttrs[p];this.isWrapped=d.isWrapped}clone(){const d=new E(0);d._data=new Uint32Array(this._data),d.length=this.length;for(const p in this._combined)d._combined[p]=this._combined[p];for(const p in this._extendedAttrs)d._extendedAttrs[p]=this._extendedAttrs[p];return d.isWrapped=this.isWrapped,d}getTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0])return d+(this._data[3*d+0]>>22);return 0}getNoBgTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0]||50331648&this._data[3*d+2])return d+(this._data[3*d+0]>>22);return 0}copyCellsFrom(d,p,f,v,S){const R=d._data;if(S)for(let M=v-1;M>=0;M--){for(let A=0;A<3;A++)this._data[3*(f+M)+A]=R[3*(p+M)+A];268435456&R[3*(p+M)+2]&&(this._extendedAttrs[f+M]=d._extendedAttrs[p+M])}else for(let M=0;M<v;M++){for(let A=0;A<3;A++)this._data[3*(f+M)+A]=R[3*(p+M)+A];268435456&R[3*(p+M)+2]&&(this._extendedAttrs[f+M]=d._extendedAttrs[p+M])}const D=Object.keys(d._combined);for(let M=0;M<D.length;M++){const A=parseInt(D[M],10);A>=p&&(this._combined[A-p+f]=d._combined[A])}}translateToString(d,p,f,v){p=p??0,f=f??this.length,d&&(f=Math.min(f,this.getTrimmedLength())),v&&(v.length=0);let S="";for(;p<f;){const R=this._data[3*p+0],D=2097151&R,M=2097152&R?this._combined[p]:D?(0,C.stringFromCodePoint)(D):m.WHITESPACE_CELL_CHAR;if(S+=M,v)for(let A=0;A<M.length;++A)v.push(p);p+=R>>22||1}return v&&v.push(p),S}}c.BufferLine=E},4841:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(h,u){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return u*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(T,c)=>{function h(u,y,m){if(y===u.length-1)return u[y].getTrimmedLength();const C=!u[y].hasContent(m-1)&&u[y].getWidth(m-1)===1,w=u[y+1].getWidth(0)===2;return C&&w?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(u,y,m,C,w){const E=[];for(let b=0;b<u.length-1;b++){let d=b,p=u.get(++d);if(!p.isWrapped)continue;const f=[u.get(b)];for(;d<u.length&&p.isWrapped;)f.push(p),p=u.get(++d);if(C>=b&&C<d){b+=f.length-1;continue}let v=0,S=h(f,v,y),R=1,D=0;for(;R<f.length;){const A=h(f,R,y),B=A-D,$=m-S,I=Math.min(B,$);f[v].copyCellsFrom(f[R],D,S,I,!1),S+=I,S===m&&(v++,S=0),D+=I,D===A&&(R++,D=0),S===0&&v!==0&&f[v-1].getWidth(m-1)===2&&(f[v].copyCellsFrom(f[v-1],m-1,S++,1,!1),f[v-1].setCell(m-1,w))}f[v].replaceCells(S,m,w);let M=0;for(let A=f.length-1;A>0&&(A>v||f[A].getTrimmedLength()===0);A--)M++;M>0&&(E.push(b+f.length-M),E.push(M)),b+=f.length-1}return E},c.reflowLargerCreateNewLayout=function(u,y){const m=[];let C=0,w=y[C],E=0;for(let b=0;b<u.length;b++)if(w===b){const d=y[++C];u.onDeleteEmitter.fire({index:b-E,amount:d}),b+=d-1,E+=d,w=y[++C]}else m.push(b);return{layout:m,countRemoved:E}},c.reflowLargerApplyNewLayout=function(u,y){const m=[];for(let C=0;C<y.length;C++)m.push(u.get(y[C]));for(let C=0;C<m.length;C++)u.set(C,m[C]);u.length=y.length},c.reflowSmallerGetNewLineLengths=function(u,y,m){const C=[],w=u.map(((p,f)=>h(u,f,y))).reduce(((p,f)=>p+f));let E=0,b=0,d=0;for(;d<w;){if(w-d<m){C.push(w-d);break}E+=m;const p=h(u,b,y);E>p&&(E-=p,b++);const f=u[b].getWidth(E-1)===2;f&&E--;const v=f?m-1:m;C.push(v),d+=v}return C},c.getWrappedLineTrimmedLength=h},5295:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const u=h(8460),y=h(844),m=h(9092);class C extends y.Disposable{constructor(E,b){super(),this._optionsService=E,this._bufferService=b,this._onBufferActivate=this.register(new u.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 m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.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(E){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(E),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(E,b){this._normal.resize(E,b),this._alt.resize(E,b),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}c.BufferSet=C},511:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const u=h(482),y=h(643),m=h(3734);class C extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const b=new C;return b.setFromCharData(E),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(E){this.fg=E[y.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(E[y.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(E[y.CHAR_DATA_CHAR_INDEX].length===2){const d=E[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=d&&d<=56319){const p=E[y.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(d-55296)+p-56320+65536|E[y.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=E[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[y.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=E[y.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[y.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=C},643:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const u=h(8460),y=h(844);class m{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,y.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}c.Marker=m,m._nextId=1},7116:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.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:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(T,c)=>{var h,u,y;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
|
|
261
261
|
`,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(h||(c.C0=h={})),(function(m){m.PAD="",m.HOP="",m.BPH="",m.NBH="",m.IND="",m.NEL="
",m.SSA="",m.ESA="",m.HTS="",m.HTJ="",m.VTS="",m.PLD="",m.PLU="",m.RI="",m.SS2="",m.SS3="",m.DCS="",m.PU1="",m.PU2="",m.STS="",m.CCH="",m.MW="",m.SPA="",m.EPA="",m.SOS="",m.SGCI="",m.SCI="",m.CSI="",m.ST="",m.OSC="",m.PM="",m.APC=""})(u||(c.C1=u={})),(function(m){m.ST=`${h.ESC}\\`})(y||(c.C1_ESCAPED=y={}))},7399:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const u=h(2584),y={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:["'",'"']};c.evaluateKeyboardEvent=function(m,C,w,E){const b={type:0,cancel:!1,key:void 0},d=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?b.key=C?u.C0.ESC+"OA":u.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?b.key=C?u.C0.ESC+"OD":u.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?b.key=C?u.C0.ESC+"OC":u.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(b.key=C?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:b.key=m.ctrlKey?"\b":u.C0.DEL,m.altKey&&(b.key=u.C0.ESC+b.key);break;case 9:if(m.shiftKey){b.key=u.C0.ESC+"[Z";break}b.key=u.C0.HT,b.cancel=!0;break;case 13:b.key=m.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,b.cancel=!0;break;case 27:b.key=u.C0.ESC,m.altKey&&(b.key=u.C0.ESC+u.C0.ESC),b.cancel=!0;break;case 37:if(m.metaKey)break;d?(b.key=u.C0.ESC+"[1;"+(d+1)+"D",b.key===u.C0.ESC+"[1;3D"&&(b.key=u.C0.ESC+(w?"b":"[1;5D"))):b.key=C?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(m.metaKey)break;d?(b.key=u.C0.ESC+"[1;"+(d+1)+"C",b.key===u.C0.ESC+"[1;3C"&&(b.key=u.C0.ESC+(w?"f":"[1;5C"))):b.key=C?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(m.metaKey)break;d?(b.key=u.C0.ESC+"[1;"+(d+1)+"A",w||b.key!==u.C0.ESC+"[1;3A"||(b.key=u.C0.ESC+"[1;5A")):b.key=C?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(m.metaKey)break;d?(b.key=u.C0.ESC+"[1;"+(d+1)+"B",w||b.key!==u.C0.ESC+"[1;3B"||(b.key=u.C0.ESC+"[1;5B")):b.key=C?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(b.key=u.C0.ESC+"[2~");break;case 46:b.key=d?u.C0.ESC+"[3;"+(d+1)+"~":u.C0.ESC+"[3~";break;case 36:b.key=d?u.C0.ESC+"[1;"+(d+1)+"H":C?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:b.key=d?u.C0.ESC+"[1;"+(d+1)+"F":C?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:m.shiftKey?b.type=2:m.ctrlKey?b.key=u.C0.ESC+"[5;"+(d+1)+"~":b.key=u.C0.ESC+"[5~";break;case 34:m.shiftKey?b.type=3:m.ctrlKey?b.key=u.C0.ESC+"[6;"+(d+1)+"~":b.key=u.C0.ESC+"[6~";break;case 112:b.key=d?u.C0.ESC+"[1;"+(d+1)+"P":u.C0.ESC+"OP";break;case 113:b.key=d?u.C0.ESC+"[1;"+(d+1)+"Q":u.C0.ESC+"OQ";break;case 114:b.key=d?u.C0.ESC+"[1;"+(d+1)+"R":u.C0.ESC+"OR";break;case 115:b.key=d?u.C0.ESC+"[1;"+(d+1)+"S":u.C0.ESC+"OS";break;case 116:b.key=d?u.C0.ESC+"[15;"+(d+1)+"~":u.C0.ESC+"[15~";break;case 117:b.key=d?u.C0.ESC+"[17;"+(d+1)+"~":u.C0.ESC+"[17~";break;case 118:b.key=d?u.C0.ESC+"[18;"+(d+1)+"~":u.C0.ESC+"[18~";break;case 119:b.key=d?u.C0.ESC+"[19;"+(d+1)+"~":u.C0.ESC+"[19~";break;case 120:b.key=d?u.C0.ESC+"[20;"+(d+1)+"~":u.C0.ESC+"[20~";break;case 121:b.key=d?u.C0.ESC+"[21;"+(d+1)+"~":u.C0.ESC+"[21~";break;case 122:b.key=d?u.C0.ESC+"[23;"+(d+1)+"~":u.C0.ESC+"[23~";break;case 123:b.key=d?u.C0.ESC+"[24;"+(d+1)+"~":u.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(w&&!E||!m.altKey||m.metaKey)!w||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?b.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(b.key=u.C0.US),m.key==="@"&&(b.key=u.C0.NUL)):m.keyCode===65&&(b.type=1);else{const p=y[m.keyCode],f=p==null?void 0:p[m.shiftKey?1:0];if(f)b.key=u.C0.ESC+f;else if(m.keyCode>=65&&m.keyCode<=90){const v=m.ctrlKey?m.keyCode-64:m.keyCode+32;let S=String.fromCharCode(v);m.shiftKey&&(S=S.toUpperCase()),b.key=u.C0.ESC+S}else if(m.keyCode===32)b.key=u.C0.ESC+(m.ctrlKey?u.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let v=m.code.slice(3,4);m.shiftKey||(v=v.toLowerCase()),b.key=u.C0.ESC+v,b.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?b.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?b.key=u.C0.NUL:m.keyCode>=51&&m.keyCode<=55?b.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?b.key=u.C0.DEL:m.keyCode===219?b.key=u.C0.ESC:m.keyCode===220?b.key=u.C0.FS:m.keyCode===221&&(b.key=u.C0.GS)}return b}},482:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},c.utf32ToString=function(h,u=0,y=h.length){let m="";for(let C=u;C<y;++C){let w=h[C];w>65535?(w-=65536,m+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):m+=String.fromCharCode(w)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,u){const y=h.length;if(!y)return 0;let m=0,C=0;if(this._interim){const w=h.charCodeAt(C++);56320<=w&&w<=57343?u[m++]=1024*(this._interim-55296)+w-56320+65536:(u[m++]=this._interim,u[m++]=w),this._interim=0}for(let w=C;w<y;++w){const E=h.charCodeAt(w);if(55296<=E&&E<=56319){if(++w>=y)return this._interim=E,m;const b=h.charCodeAt(w);56320<=b&&b<=57343?u[m++]=1024*(E-55296)+b-56320+65536:(u[m++]=E,u[m++]=b)}else E!==65279&&(u[m++]=E)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,u){const y=h.length;if(!y)return 0;let m,C,w,E,b=0,d=0,p=0;if(this.interim[0]){let S=!1,R=this.interim[0];R&=(224&R)==192?31:(240&R)==224?15:7;let D,M=0;for(;(D=63&this.interim[++M])&&M<4;)R<<=6,R|=D;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=A-M;for(;p<B;){if(p>=y)return 0;if(D=h[p++],(192&D)!=128){p--,S=!0;break}this.interim[M++]=D,R<<=6,R|=63&D}S||(A===2?R<128?p--:u[b++]=R:A===3?R<2048||R>=55296&&R<=57343||R===65279||(u[b++]=R):R<65536||R>1114111||(u[b++]=R)),this.interim.fill(0)}const f=y-4;let v=p;for(;v<y;){for(;!(!(v<f)||128&(m=h[v])||128&(C=h[v+1])||128&(w=h[v+2])||128&(E=h[v+3]));)u[b++]=m,u[b++]=C,u[b++]=w,u[b++]=E,v+=4;if(m=h[v++],m<128)u[b++]=m;else if((224&m)==192){if(v>=y)return this.interim[0]=m,b;if(C=h[v++],(192&C)!=128){v--;continue}if(d=(31&m)<<6|63&C,d<128){v--;continue}u[b++]=d}else if((240&m)==224){if(v>=y)return this.interim[0]=m,b;if(C=h[v++],(192&C)!=128){v--;continue}if(v>=y)return this.interim[0]=m,this.interim[1]=C,b;if(w=h[v++],(192&w)!=128){v--;continue}if(d=(15&m)<<12|(63&C)<<6|63&w,d<2048||d>=55296&&d<=57343||d===65279)continue;u[b++]=d}else if((248&m)==240){if(v>=y)return this.interim[0]=m,b;if(C=h[v++],(192&C)!=128){v--;continue}if(v>=y)return this.interim[0]=m,this.interim[1]=C,b;if(w=h[v++],(192&w)!=128){v--;continue}if(v>=y)return this.interim[0]=m,this.interim[1]=C,this.interim[2]=w,b;if(E=h[v++],(192&E)!=128){v--;continue}if(d=(7&m)<<18|(63&C)<<12|(63&w)<<6|63&E,d<65536||d>1114111)continue;u[b++]=d}}return b}}},225:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const u=h(1480),y=[[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]],m=[[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 C;c.UnicodeV6=class{constructor(){if(this.version="6",!C){C=new Uint8Array(65536),C.fill(1),C[0]=0,C.fill(0,1,32),C.fill(0,127,160),C.fill(2,4352,4448),C[9001]=2,C[9002]=2,C.fill(2,11904,42192),C[12351]=1,C.fill(2,44032,55204),C.fill(2,63744,64256),C.fill(2,65040,65050),C.fill(2,65072,65136),C.fill(2,65280,65377),C.fill(2,65504,65511);for(let w=0;w<y.length;++w)C.fill(0,y[w][0],y[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?C[w]:(function(E,b){let d,p=0,f=b.length-1;if(E<b[0][0]||E>b[f][1])return!1;for(;f>=p;)if(d=p+f>>1,E>b[d][1])p=d+1;else{if(!(E<b[d][0]))return!0;f=d-1}return!1})(w,m)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,E){let b=this.wcwidth(w),d=b===0&&E!==0;if(d){const p=u.UnicodeService.extractWidth(E);p===0?d=!1:p>b&&(b=p)}return u.UnicodeService.createPropertyValue(0,b,d)}}},5981:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const u=h(8460),y=h(844);class m extends y.Disposable{constructor(w){super(),this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(w,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);const d=this._callbacks.shift();d&&d()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,E){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+=w.length,this._writeBuffer.push(w),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(E)}_innerWrite(w=0,E=!0){const b=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const d=this._writeBuffer[this._bufferOffset],p=this._action(d,E);if(p){const v=S=>Date.now()-b>=12?setTimeout((()=>this._innerWrite(0,S))):this._innerWrite(b,S);return void p.catch((S=>(queueMicrotask((()=>{throw S})),Promise.resolve(!1)))).then(v)}const f=this._callbacks[this._bufferOffset];if(f&&f(),this._bufferOffset++,this._pendingData-=d.length,Date.now()-b>=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()}}c.WriteBuffer=m},5941:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const h=/^([\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})$/,u=/^[\da-f]+$/;function y(m,C){const w=m.toString(16),E=w.length<2?"0"+w:w;switch(C){case 4:return w[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}c.parseColor=function(m){if(!m)return;let C=m.toLowerCase();if(C.indexOf("rgb:")===0){C=C.slice(4);const w=h.exec(C);if(w){const E=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/E*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/E*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/E*255)]}}else if(C.indexOf("#")===0&&(C=C.slice(1),u.exec(C)&&[3,6,9,12].includes(C.length))){const w=C.length/3,E=[0,0,0];for(let b=0;b<3;++b){const d=parseInt(C.slice(w*b,w*b+w),16);E[b]=w===1?d<<4:w===2?d:w===3?d>>4:d>>8}return E}},c.toRgbString=function(m,C=16){const[w,E,b]=m;return`rgb:${y(w,C)}/${y(E,C)}/${y(b,C)}`}},5770:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const u=h(482),y=h(8742),m=h(5770),C=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=C,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=C}registerHandler(E,b){this._handlers[E]===void 0&&(this._handlers[E]=[]);const d=this._handlers[E];return d.push(b),{dispose:()=>{const p=d.indexOf(b);p!==-1&&d.splice(p,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=C,this._ident=0}hook(E,b){if(this.reset(),this._ident=E,this._active=this._handlers[E]||C,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].hook(b);else this._handlerFb(this._ident,"HOOK",b)}put(E,b,d){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(E,b,d);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(E,b,d))}unhook(E,b=!0){if(this._active.length){let d=!1,p=this._active.length-1,f=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,d=b,f=this._stack.fallThrough,this._stack.paused=!1),!f&&d===!1){for(;p>=0&&(d=this._active[p].unhook(E),d!==!0);p--)if(d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,d;p--}for(;p>=0;p--)if(d=this._active[p].unhook(!1),d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,d}else this._handlerFb(this._ident,"UNHOOK",E);this._active=C,this._ident=0}};const w=new y.Params;w.addParam(0),c.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=w,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():w,this._data="",this._hitLimit=!1}put(E,b,d){this._hitLimit||(this._data+=(0,u.utf32ToString)(E,b,d),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(E){let b=!1;if(this._hitLimit)b=!1;else if(E&&(b=this._handler(this._data,this._params),b instanceof Promise))return b.then((d=>(this._params=w,this._data="",this._hitLimit=!1,d)));return this._params=w,this._data="",this._hitLimit=!1,b}}},2015:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const u=h(844),y=h(8742),m=h(6242),C=h(6351);class w{constructor(p){this.table=new Uint8Array(p)}setDefault(p,f){this.table.fill(p<<4|f)}add(p,f,v,S){this.table[f<<8|p]=v<<4|S}addMany(p,f,v,S){for(let R=0;R<p.length;R++)this.table[f<<8|p[R]]=v<<4|S}}c.TransitionTable=w;const E=160;c.VT500_TRANSITION_TABLE=(function(){const d=new w(4095),p=Array.apply(null,Array(256)).map(((M,A)=>A)),f=(M,A)=>p.slice(M,A),v=f(32,127),S=f(0,24);S.push(25),S.push.apply(S,f(28,32));const R=f(0,14);let D;for(D in d.setDefault(1,0),d.addMany(v,0,2,0),R)d.addMany([24,26,153,154],D,3,0),d.addMany(f(128,144),D,3,0),d.addMany(f(144,152),D,3,0),d.add(156,D,0,0),d.add(27,D,11,1),d.add(157,D,4,8),d.addMany([152,158,159],D,0,7),d.add(155,D,11,3),d.add(144,D,11,9);return d.addMany(S,0,3,0),d.addMany(S,1,3,1),d.add(127,1,0,1),d.addMany(S,8,0,8),d.addMany(S,3,3,3),d.add(127,3,0,3),d.addMany(S,4,3,4),d.add(127,4,0,4),d.addMany(S,6,3,6),d.addMany(S,5,3,5),d.add(127,5,0,5),d.addMany(S,2,3,2),d.add(127,2,0,2),d.add(93,1,4,8),d.addMany(v,8,5,8),d.add(127,8,5,8),d.addMany([156,27,24,26,7],8,6,0),d.addMany(f(28,32),8,0,8),d.addMany([88,94,95],1,0,7),d.addMany(v,7,0,7),d.addMany(S,7,0,7),d.add(156,7,0,0),d.add(127,7,0,7),d.add(91,1,11,3),d.addMany(f(64,127),3,7,0),d.addMany(f(48,60),3,8,4),d.addMany([60,61,62,63],3,9,4),d.addMany(f(48,60),4,8,4),d.addMany(f(64,127),4,7,0),d.addMany([60,61,62,63],4,0,6),d.addMany(f(32,64),6,0,6),d.add(127,6,0,6),d.addMany(f(64,127),6,0,0),d.addMany(f(32,48),3,9,5),d.addMany(f(32,48),5,9,5),d.addMany(f(48,64),5,0,6),d.addMany(f(64,127),5,7,0),d.addMany(f(32,48),4,9,5),d.addMany(f(32,48),1,9,2),d.addMany(f(32,48),2,9,2),d.addMany(f(48,127),2,10,0),d.addMany(f(48,80),1,10,0),d.addMany(f(81,88),1,10,0),d.addMany([89,90,92],1,10,0),d.addMany(f(96,127),1,10,0),d.add(80,1,11,9),d.addMany(S,9,0,9),d.add(127,9,0,9),d.addMany(f(28,32),9,0,9),d.addMany(f(32,48),9,9,12),d.addMany(f(48,60),9,8,10),d.addMany([60,61,62,63],9,9,10),d.addMany(S,11,0,11),d.addMany(f(32,128),11,0,11),d.addMany(f(28,32),11,0,11),d.addMany(S,10,0,10),d.add(127,10,0,10),d.addMany(f(28,32),10,0,10),d.addMany(f(48,60),10,8,10),d.addMany([60,61,62,63],10,0,11),d.addMany(f(32,48),10,9,12),d.addMany(S,12,0,12),d.add(127,12,0,12),d.addMany(f(28,32),12,0,12),d.addMany(f(32,48),12,9,12),d.addMany(f(48,64),12,0,11),d.addMany(f(64,127),12,12,13),d.addMany(f(64,127),10,12,13),d.addMany(f(64,127),9,12,13),d.addMany(S,13,13,13),d.addMany(v,13,13,13),d.add(127,13,0,13),d.addMany([27,156,24,26],13,14,0),d.add(E,0,2,0),d.add(E,8,5,8),d.add(E,6,0,6),d.add(E,11,0,11),d.add(E,13,13,13),d})();class b extends u.Disposable{constructor(p=c.VT500_TRANSITION_TABLE){super(),this._transitions=p,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new y.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(f,v,S)=>{},this._executeHandlerFb=f=>{},this._csiHandlerFb=(f,v)=>{},this._escHandlerFb=f=>{},this._errorHandlerFb=f=>f,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new C.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(p,f=[64,126]){let v=0;if(p.prefix){if(p.prefix.length>1)throw new Error("only one byte as prefix supported");if(v=p.prefix.charCodeAt(0),v&&60>v||v>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(p.intermediates){if(p.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let R=0;R<p.intermediates.length;++R){const D=p.intermediates.charCodeAt(R);if(32>D||D>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");v<<=8,v|=D}}if(p.final.length!==1)throw new Error("final must be a single byte");const S=p.final.charCodeAt(0);if(f[0]>S||S>f[1])throw new Error(`final must be in range ${f[0]} .. ${f[1]}`);return v<<=8,v|=S,v}identToString(p){const f=[];for(;p;)f.push(String.fromCharCode(255&p)),p>>=8;return f.reverse().join("")}setPrintHandler(p){this._printHandler=p}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(p,f){const v=this._identifier(p,[48,126]);this._escHandlers[v]===void 0&&(this._escHandlers[v]=[]);const S=this._escHandlers[v];return S.push(f),{dispose:()=>{const R=S.indexOf(f);R!==-1&&S.splice(R,1)}}}clearEscHandler(p){this._escHandlers[this._identifier(p,[48,126])]&&delete this._escHandlers[this._identifier(p,[48,126])]}setEscHandlerFallback(p){this._escHandlerFb=p}setExecuteHandler(p,f){this._executeHandlers[p.charCodeAt(0)]=f}clearExecuteHandler(p){this._executeHandlers[p.charCodeAt(0)]&&delete this._executeHandlers[p.charCodeAt(0)]}setExecuteHandlerFallback(p){this._executeHandlerFb=p}registerCsiHandler(p,f){const v=this._identifier(p);this._csiHandlers[v]===void 0&&(this._csiHandlers[v]=[]);const S=this._csiHandlers[v];return S.push(f),{dispose:()=>{const R=S.indexOf(f);R!==-1&&S.splice(R,1)}}}clearCsiHandler(p){this._csiHandlers[this._identifier(p)]&&delete this._csiHandlers[this._identifier(p)]}setCsiHandlerFallback(p){this._csiHandlerFb=p}registerDcsHandler(p,f){return this._dcsParser.registerHandler(this._identifier(p),f)}clearDcsHandler(p){this._dcsParser.clearHandler(this._identifier(p))}setDcsHandlerFallback(p){this._dcsParser.setHandlerFallback(p)}registerOscHandler(p,f){return this._oscParser.registerHandler(p,f)}clearOscHandler(p){this._oscParser.clearHandler(p)}setOscHandlerFallback(p){this._oscParser.setHandlerFallback(p)}setErrorHandler(p){this._errorHandler=p}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(p,f,v,S,R){this._parseStack.state=p,this._parseStack.handlers=f,this._parseStack.handlerPos=v,this._parseStack.transition=S,this._parseStack.chunkPos=R}parse(p,f,v){let S,R=0,D=0,M=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,M=this._parseStack.chunkPos+1;else{if(v===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(v===!1&&B>-1){for(;B>=0&&(S=A[B](this._params),S!==!0);B--)if(S instanceof Promise)return this._parseStack.handlerPos=B,S}this._parseStack.handlers=[];break;case 4:if(v===!1&&B>-1){for(;B>=0&&(S=A[B](),S!==!0);B--)if(S instanceof Promise)return this._parseStack.handlerPos=B,S}this._parseStack.handlers=[];break;case 6:if(R=p[this._parseStack.chunkPos],S=this._dcsParser.unhook(R!==24&&R!==26,v),S)return S;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(R=p[this._parseStack.chunkPos],S=this._oscParser.end(R!==24&&R!==26,v),S)return S;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,M=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=M;A<f;++A){switch(R=p[A],D=this._transitions.table[this.currentState<<8|(R<160?R:E)],D>>4){case 2:for(let P=A+1;;++P){if(P>=f||(R=p[P])<32||R>126&&R<E){this._printHandler(p,A,P),A=P-1;break}if(++P>=f||(R=p[P])<32||R>126&&R<E){this._printHandler(p,A,P),A=P-1;break}if(++P>=f||(R=p[P])<32||R>126&&R<E){this._printHandler(p,A,P),A=P-1;break}if(++P>=f||(R=p[P])<32||R>126&&R<E){this._printHandler(p,A,P),A=P-1;break}}break;case 3:this._executeHandlers[R]?this._executeHandlers[R]():this._executeHandlerFb(R),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:R,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const B=this._csiHandlers[this._collect<<8|R];let $=B?B.length-1:-1;for(;$>=0&&(S=B[$](this._params),S!==!0);$--)if(S instanceof Promise)return this._preserveStack(3,B,$,D,A),S;$<0&&this._csiHandlerFb(this._collect<<8|R,this._params),this.precedingJoinState=0;break;case 8:do switch(R){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(R-48)}while(++A<f&&(R=p[A])>47&&R<60);A--;break;case 9:this._collect<<=8,this._collect|=R;break;case 10:const I=this._escHandlers[this._collect<<8|R];let q=I?I.length-1:-1;for(;q>=0&&(S=I[q](),S!==!0);q--)if(S instanceof Promise)return this._preserveStack(4,I,q,D,A),S;q<0&&this._escHandlerFb(this._collect<<8|R),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|R,this._params);break;case 13:for(let P=A+1;;++P)if(P>=f||(R=p[P])===24||R===26||R===27||R>127&&R<E){this._dcsParser.put(p,A,P),A=P-1;break}break;case 14:if(S=this._dcsParser.unhook(R!==24&&R!==26),S)return this._preserveStack(6,[],0,D,A),S;R===27&&(D|=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 P=A+1;;P++)if(P>=f||(R=p[P])<32||R>127&&R<E){this._oscParser.put(p,A,P),A=P-1;break}break;case 6:if(S=this._oscParser.end(R!==24&&R!==26),S)return this._preserveStack(5,[],0,D,A),S;R===27&&(D|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&D}}}c.EscapeSequenceParser=b},6242:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const u=h(5770),y=h(482),m=[];c.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(C,w){this._handlers[C]===void 0&&(this._handlers[C]=[]);const E=this._handlers[C];return E.push(w),{dispose:()=>{const b=E.indexOf(w);b!==-1&&E.splice(b,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].start();else this._handlerFb(this._id,"START")}_put(C,w,E){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(C,w,E);else this._handlerFb(this._id,"PUT",(0,y.utf32ToString)(C,w,E))}start(){this.reset(),this._state=1}put(C,w,E){if(this._state!==3){if(this._state===1)for(;w<E;){const b=C[w++];if(b===59){this._state=2,this._start();break}if(b<48||57<b)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+b-48}this._state===2&&E-w>0&&this._put(C,w,E)}}end(C,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let E=!1,b=this._active.length-1,d=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,E=w,d=this._stack.fallThrough,this._stack.paused=!1),!d&&E===!1){for(;b>=0&&(E=this._active[b].end(C),E!==!0);b--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,E;b--}for(;b>=0;b--)if(E=this._active[b].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",C);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(C){this._handler=C,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(C,w,E){this._hitLimit||(this._data+=(0,y.utf32ToString)(C,w,E),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(C){let w=!1;if(this._hitLimit)w=!1;else if(C&&(w=this._handler(this._data),w instanceof Promise))return w.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,w}}},8742:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const h=2147483647;class u{static fromArray(m){const C=new u;if(!m.length)return C;for(let w=Array.isArray(m[0])?1:0;w<m.length;++w){const E=m[w];if(Array.isArray(E))for(let b=0;b<E.length;++b)C.addSubParam(E[b]);else C.addParam(E)}return C}constructor(m=32,C=32){if(this.maxLength=m,this.maxSubParamsLength=C,C>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(C),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new u(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let C=0;C<this.length;++C){m.push(this.params[C]);const w=this._subParamsIdx[C]>>8,E=255&this._subParamsIdx[C];E-w>0&&m.push(Array.prototype.slice.call(this._subParams,w,E))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>h?h:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>h?h:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const C=this._subParamsIdx[m]>>8,w=255&this._subParamsIdx[m];return w-C>0?this._subParams.subarray(C,w):null}getSubParamsAll(){const m={};for(let C=0;C<this.length;++C){const w=this._subParamsIdx[C]>>8,E=255&this._subParamsIdx[C];E-w>0&&(m[C]=this._subParams.slice(w,E))}return m}addDigit(m){let C;if(this._rejectDigits||!(C=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,E=w[C-1];w[C-1]=~E?Math.min(10*E+m,h):m}}c.Params=u},5741:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,u){const y={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(y),u.dispose=()=>this._wrappedAddonDispose(y),u.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let u=-1;for(let y=0;y<this._addons.length;y++)if(this._addons[y]===h){u=y;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(u,1)}}},8771:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const u=h(3785),y=h(511);c.BufferApiView=class{constructor(m,C){this._buffer=m,this.type=C}init(m){return this._buffer=m,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(m){const C=this._buffer.lines.get(m);if(C)return new u.BufferLineApiView(C)}getNullCell(){return new y.CellData}}},3785:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const u=h(511);c.BufferLineApiView=class{constructor(y){this._line=y}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(y,m){if(!(y<0||y>=this._line.length))return m?(this._line.loadCell(y,m),m):this._line.loadCell(y,new u.CellData)}translateToString(y,m,C){return this._line.translateToString(y,m,C)}}},8285:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const u=h(8771),y=h(8460),m=h(844);class C extends m.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new y.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.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)}}c.BufferNamespaceApi=C},7975:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,u){return this._core.registerCsiHandler(h,(y=>u(y.toArray())))}addCsiHandler(h,u){return this.registerCsiHandler(h,u)}registerDcsHandler(h,u){return this._core.registerDcsHandler(h,((y,m)=>u(y,m.toArray())))}addDcsHandler(h,u){return this.registerDcsHandler(h,u)}registerEscHandler(h,u){return this._core.registerEscHandler(h,u)}addEscHandler(h,u){return this.registerEscHandler(h,u)}registerOscHandler(h,u){return this._core.registerOscHandler(h,u)}addOscHandler(h,u){return this.registerOscHandler(h,u)}}},7090:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(T,c,h){var u=this&&this.__decorate||function(d,p,f,v){var S,R=arguments.length,D=R<3?p:v===null?v=Object.getOwnPropertyDescriptor(p,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(d,p,f,v);else for(var M=d.length-1;M>=0;M--)(S=d[M])&&(D=(R<3?S(D):R>3?S(p,f,D):S(p,f))||D);return R>3&&D&&Object.defineProperty(p,f,D),D},y=this&&this.__param||function(d,p){return function(f,v){p(f,v,d)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=h(8460),C=h(844),w=h(5295),E=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let b=c.BufferService=class extends C.Disposable{get buffer(){return this.buffers.active}constructor(d){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(d.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(d.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(d,this))}resize(d,p){this.cols=d,this.rows=p,this.buffers.resize(d,p),this._onResize.fire({cols:d,rows:p})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(d,p=!1){const f=this.buffer;let v;v=this._cachedBlankLine,v&&v.length===this.cols&&v.getFg(0)===d.fg&&v.getBg(0)===d.bg||(v=f.getBlankLine(d,p),this._cachedBlankLine=v),v.isWrapped=p;const S=f.ybase+f.scrollTop,R=f.ybase+f.scrollBottom;if(f.scrollTop===0){const D=f.lines.isFull;R===f.lines.length-1?D?f.lines.recycle().copyFrom(v):f.lines.push(v.clone()):f.lines.splice(R+1,0,v.clone()),D?this.isUserScrolling&&(f.ydisp=Math.max(f.ydisp-1,0)):(f.ybase++,this.isUserScrolling||f.ydisp++)}else{const D=R-S+1;f.lines.shiftElements(S+1,D-1,-1),f.lines.set(R,v.clone())}this.isUserScrolling||(f.ydisp=f.ybase),this._onScroll.fire(f.ydisp)}scrollLines(d,p,f){const v=this.buffer;if(d<0){if(v.ydisp===0)return;this.isUserScrolling=!0}else d+v.ydisp>=v.ybase&&(this.isUserScrolling=!1);const S=v.ydisp;v.ydisp=Math.max(Math.min(v.ydisp+d,v.ybase),0),S!==v.ydisp&&(p||this._onScroll.fire(v.ydisp))}};c.BufferService=b=u([y(0,E.IOptionsService)],b)},7994:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,u){this._charsets[h]=u,this.glevel===h&&(this.charset=u)}}},1753:function(T,c,h){var u=this&&this.__decorate||function(v,S,R,D){var M,A=arguments.length,B=A<3?S:D===null?D=Object.getOwnPropertyDescriptor(S,R):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(v,S,R,D);else for(var $=v.length-1;$>=0;$--)(M=v[$])&&(B=(A<3?M(B):A>3?M(S,R,B):M(S,R))||B);return A>3&&B&&Object.defineProperty(S,R,B),B},y=this&&this.__param||function(v,S){return function(R,D){S(R,D,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=h(2585),C=h(8460),w=h(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:v=>v.button!==4&&v.action===1&&(v.ctrl=!1,v.alt=!1,v.shift=!1,!0)},VT200:{events:19,restrict:v=>v.action!==32},DRAG:{events:23,restrict:v=>v.action!==32||v.button!==3},ANY:{events:31,restrict:v=>!0}};function b(v,S){let R=(v.ctrl?16:0)|(v.shift?4:0)|(v.alt?8:0);return v.button===4?(R|=64,R|=v.action):(R|=3&v.button,4&v.button&&(R|=64),8&v.button&&(R|=128),v.action===32?R|=32:v.action!==0||S||(R|=3)),R}const d=String.fromCharCode,p={DEFAULT:v=>{const S=[b(v,!1)+32,v.col+32,v.row+32];return S[0]>255||S[1]>255||S[2]>255?"":`\x1B[M${d(S[0])}${d(S[1])}${d(S[2])}`},SGR:v=>{const S=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${b(v,!0)};${v.col};${v.row}${S}`},SGR_PIXELS:v=>{const S=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${b(v,!0)};${v.x};${v.y}${S}`}};let f=c.CoreMouseService=class extends w.Disposable{constructor(v,S){super(),this._bufferService=v,this._coreService=S,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new C.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const R of Object.keys(E))this.addProtocol(R,E[R]);for(const R of Object.keys(p))this.addEncoding(R,p[R]);this.reset()}addProtocol(v,S){this._protocols[v]=S}addEncoding(v,S){this._encodings[v]=S}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(v){if(!this._protocols[v])throw new Error(`unknown protocol "${v}"`);this._activeProtocol=v,this._onProtocolChange.fire(this._protocols[v].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(v){if(!this._encodings[v])throw new Error(`unknown encoding "${v}"`);this._activeEncoding=v}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(v){if(v.col<0||v.col>=this._bufferService.cols||v.row<0||v.row>=this._bufferService.rows||v.button===4&&v.action===32||v.button===3&&v.action!==32||v.button!==4&&(v.action===2||v.action===3)||(v.col++,v.row++,v.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,v,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(v))return!1;const S=this._encodings[this._activeEncoding](v);return S&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(S):this._coreService.triggerDataEvent(S,!0)),this._lastEvent=v,!0}explainEvents(v){return{down:!!(1&v),up:!!(2&v),drag:!!(4&v),move:!!(8&v),wheel:!!(16&v)}}_equalEvents(v,S,R){if(R){if(v.x!==S.x||v.y!==S.y)return!1}else if(v.col!==S.col||v.row!==S.row)return!1;return v.button===S.button&&v.action===S.action&&v.ctrl===S.ctrl&&v.alt===S.alt&&v.shift===S.shift}};c.CoreMouseService=f=u([y(0,m.IBufferService),y(1,m.ICoreService)],f)},6975:function(T,c,h){var u=this&&this.__decorate||function(f,v,S,R){var D,M=arguments.length,A=M<3?v:R===null?R=Object.getOwnPropertyDescriptor(v,S):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(f,v,S,R);else for(var B=f.length-1;B>=0;B--)(D=f[B])&&(A=(M<3?D(A):M>3?D(v,S,A):D(v,S))||A);return M>3&&A&&Object.defineProperty(v,S,A),A},y=this&&this.__param||function(f,v){return function(S,R){v(S,R,f)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=h(1439),C=h(8460),w=h(844),E=h(2585),b=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let p=c.CoreService=class extends w.Disposable{constructor(f,v,S){super(),this._bufferService=f,this._logService=v,this._optionsService=S,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new C.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new C.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new C.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new C.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(b),this.decPrivateModes=(0,m.clone)(d)}reset(){this.modes=(0,m.clone)(b),this.decPrivateModes=(0,m.clone)(d)}triggerDataEvent(f,v=!1){if(this._optionsService.rawOptions.disableStdin)return;const S=this._bufferService.buffer;v&&this._optionsService.rawOptions.scrollOnUserInput&&S.ybase!==S.ydisp&&this._onRequestScrollToBottom.fire(),v&&this._onUserInput.fire(),this._logService.debug(`sending data "${f}"`,(()=>f.split("").map((R=>R.charCodeAt(0))))),this._onData.fire(f)}triggerBinaryEvent(f){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${f}"`,(()=>f.split("").map((v=>v.charCodeAt(0))))),this._onBinary.fire(f))}};c.CoreService=p=u([y(0,E.IBufferService),y(1,E.ILogService),y(2,E.IOptionsService)],p)},9074:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const u=h(8055),y=h(8460),m=h(844),C=h(6106);let w=0,E=0;class b extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new C.SortedList((f=>f==null?void 0:f.marker.line)),this._onDecorationRegistered=this.register(new y.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new y.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(f){if(f.marker.isDisposed)return;const v=new d(f);if(v){const S=v.marker.onDispose((()=>v.dispose()));v.onDispose((()=>{v&&(this._decorations.delete(v)&&this._onDecorationRemoved.fire(v),S.dispose())})),this._decorations.insert(v),this._onDecorationRegistered.fire(v)}return v}reset(){for(const f of this._decorations.values())f.dispose();this._decorations.clear()}*getDecorationsAtCell(f,v,S){let R=0,D=0;for(const M of this._decorations.getKeyIterator(v))R=M.options.x??0,D=R+(M.options.width??1),f>=R&&f<D&&(!S||(M.options.layer??"bottom")===S)&&(yield M)}forEachDecorationAtCell(f,v,S,R){this._decorations.forEachByKey(v,(D=>{w=D.options.x??0,E=w+(D.options.width??1),f>=w&&f<E&&(!S||(D.options.layer??"bottom")===S)&&R(D)}))}}c.DecorationService=b;class d extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(f){super(),this.options=f,this.onRenderEmitter=this.register(new y.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new y.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=f.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const u=h(2585),y=h(8343);class m{constructor(...w){this._entries=new Map;for(const[E,b]of w)this.set(E,b)}set(w,E){const b=this._entries.get(w);return this._entries.set(w,E),b}forEach(w){for(const[E,b]of this._entries.entries())w(E,b)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(u.IInstantiationService,this)}setService(C,w){this._services.set(C,w)}getService(C){return this._services.get(C)}createInstance(C,...w){const E=(0,y.getServiceDependencies)(C).sort(((p,f)=>p.index-f.index)),b=[];for(const p of E){const f=this._services.get(p.id);if(!f)throw new Error(`[createInstance] ${C.name} depends on UNKNOWN service ${p.id}.`);b.push(f)}const d=E.length>0?E[0].index:w.length;if(w.length!==d)throw new Error(`[createInstance] First service dependency of ${C.name} at position ${d+1} conflicts with ${w.length} static arguments`);return new C(...w,...b)}}},7866:function(T,c,h){var u=this&&this.__decorate||function(d,p,f,v){var S,R=arguments.length,D=R<3?p:v===null?v=Object.getOwnPropertyDescriptor(p,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(d,p,f,v);else for(var M=d.length-1;M>=0;M--)(S=d[M])&&(D=(R<3?S(D):R>3?S(p,f,D):S(p,f))||D);return R>3&&D&&Object.defineProperty(p,f,D),D},y=this&&this.__param||function(d,p){return function(f,v){p(f,v,d)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=h(844),C=h(2585),w={trace:C.LogLevelEnum.TRACE,debug:C.LogLevelEnum.DEBUG,info:C.LogLevelEnum.INFO,warn:C.LogLevelEnum.WARN,error:C.LogLevelEnum.ERROR,off:C.LogLevelEnum.OFF};let E,b=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(d){super(),this._optionsService=d,this._logLevel=C.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(d){for(let p=0;p<d.length;p++)typeof d[p]=="function"&&(d[p]=d[p]())}_log(d,p,f){this._evalLazyOptionalParams(f),d.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+p,...f)}trace(d,...p){var f;this._logLevel<=C.LogLevelEnum.TRACE&&this._log(((f=this._optionsService.options.logger)==null?void 0:f.trace.bind(this._optionsService.options.logger))??console.log,d,p)}debug(d,...p){var f;this._logLevel<=C.LogLevelEnum.DEBUG&&this._log(((f=this._optionsService.options.logger)==null?void 0:f.debug.bind(this._optionsService.options.logger))??console.log,d,p)}info(d,...p){var f;this._logLevel<=C.LogLevelEnum.INFO&&this._log(((f=this._optionsService.options.logger)==null?void 0:f.info.bind(this._optionsService.options.logger))??console.info,d,p)}warn(d,...p){var f;this._logLevel<=C.LogLevelEnum.WARN&&this._log(((f=this._optionsService.options.logger)==null?void 0:f.warn.bind(this._optionsService.options.logger))??console.warn,d,p)}error(d,...p){var f;this._logLevel<=C.LogLevelEnum.ERROR&&this._log(((f=this._optionsService.options.logger)==null?void 0:f.error.bind(this._optionsService.options.logger))??console.error,d,p)}};c.LogService=b=u([y(0,C.IOptionsService)],b),c.setTraceLogger=function(d){E=d},c.traceCall=function(d,p,f){if(typeof f.value!="function")throw new Error("not supported");const v=f.value;f.value=function(...S){if(E.logLevel!==C.LogLevelEnum.TRACE)return v.apply(this,S);E.trace(`GlyphRenderer#${v.name}(${S.map((D=>JSON.stringify(D))).join(", ")})`);const R=v.apply(this,S);return E.trace(`GlyphRenderer#${v.name} return`,R),R}}},7302:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const u=h(8460),y=h(844),m=h(6114);c.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:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const C=["normal","bold","100","200","300","400","500","600","700","800","900"];class w extends y.Disposable{constructor(b){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const d={...c.DEFAULT_OPTIONS};for(const p in b)if(p in d)try{const f=b[p];d[p]=this._sanitizeAndValidateOption(p,f)}catch(f){console.error(f)}this.rawOptions=d,this.options={...d},this._setupOptions(),this.register((0,y.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(b,d){return this.onOptionChange((p=>{p===b&&d(this.rawOptions[b])}))}onMultipleOptionChange(b,d){return this.onOptionChange((p=>{b.indexOf(p)!==-1&&d()}))}_setupOptions(){const b=p=>{if(!(p in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);return this.rawOptions[p]},d=(p,f)=>{if(!(p in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);f=this._sanitizeAndValidateOption(p,f),this.rawOptions[p]!==f&&(this.rawOptions[p]=f,this._onOptionChange.fire(p))};for(const p in this.rawOptions){const f={get:b.bind(this,p),set:d.bind(this,p)};Object.defineProperty(this.options,p,f)}}_sanitizeAndValidateOption(b,d){switch(b){case"cursorStyle":if(d||(d=c.DEFAULT_OPTIONS[b]),!(function(p){return p==="block"||p==="underline"||p==="bar"})(d))throw new Error(`"${d}" is not a valid value for ${b}`);break;case"wordSeparator":d||(d=c.DEFAULT_OPTIONS[b]);break;case"fontWeight":case"fontWeightBold":if(typeof d=="number"&&1<=d&&d<=1e3)break;d=C.includes(d)?d:c.DEFAULT_OPTIONS[b];break;case"cursorWidth":d=Math.floor(d);case"lineHeight":case"tabStopWidth":if(d<1)throw new Error(`${b} cannot be less than 1, value: ${d}`);break;case"minimumContrastRatio":d=Math.max(1,Math.min(21,Math.round(10*d)/10));break;case"scrollback":if((d=Math.min(d,4294967295))<0)throw new Error(`${b} cannot be less than 0, value: ${d}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(d<=0)throw new Error(`${b} cannot be less than or equal to 0, value: ${d}`);break;case"rows":case"cols":if(!d&&d!==0)throw new Error(`${b} must be numeric, value: ${d}`);break;case"windowsPty":d=d??{}}return d}}c.OptionsService=w},2660:function(T,c,h){var u=this&&this.__decorate||function(w,E,b,d){var p,f=arguments.length,v=f<3?E:d===null?d=Object.getOwnPropertyDescriptor(E,b):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(w,E,b,d);else for(var S=w.length-1;S>=0;S--)(p=w[S])&&(v=(f<3?p(v):f>3?p(E,b,v):p(E,b))||v);return f>3&&v&&Object.defineProperty(E,b,v),v},y=this&&this.__param||function(w,E){return function(b,d){E(b,d,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=h(2585);let C=c.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const E=this._bufferService.buffer;if(w.id===void 0){const S=E.addMarker(E.ybase+E.y),R={data:w,id:this._nextId++,lines:[S]};return S.onDispose((()=>this._removeMarkerFromLink(R,S))),this._dataByLinkId.set(R.id,R),R.id}const b=w,d=this._getEntryIdKey(b),p=this._entriesWithId.get(d);if(p)return this.addLineToLink(p.id,E.ybase+E.y),p.id;const f=E.addMarker(E.ybase+E.y),v={id:this._nextId++,key:this._getEntryIdKey(b),data:b,lines:[f]};return f.onDispose((()=>this._removeMarkerFromLink(v,f))),this._entriesWithId.set(v.key,v),this._dataByLinkId.set(v.id,v),v.id}addLineToLink(w,E){const b=this._dataByLinkId.get(w);if(b&&b.lines.every((d=>d.line!==E))){const d=this._bufferService.buffer.addMarker(E);b.lines.push(d),d.onDispose((()=>this._removeMarkerFromLink(b,d)))}}getLinkData(w){var E;return(E=this._dataByLinkId.get(w))==null?void 0:E.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,E){const b=w.lines.indexOf(E);b!==-1&&(w.lines.splice(b,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};c.OscLinkService=C=u([y(0,m.IBufferService)],C)},8343:(T,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const h="di$target",u="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(y){return y[u]||[]},c.createDecorator=function(y){if(c.serviceRegistry.has(y))return c.serviceRegistry.get(y);const m=function(C,w,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,d,p){d[h]===d?d[u].push({id:b,index:p}):(d[u]=[{id:b,index:p}],d[h]=d)})(m,C,E)};return m.toString=()=>y,c.serviceRegistry.set(y,m),m}},2585:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const u=h(8343);var y;c.IBufferService=(0,u.createDecorator)("BufferService"),c.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),c.ICoreService=(0,u.createDecorator)("CoreService"),c.ICharsetService=(0,u.createDecorator)("CharsetService"),c.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(y||(c.LogLevelEnum=y={})),c.ILogService=(0,u.createDecorator)("LogService"),c.IOptionsService=(0,u.createDecorator)("OptionsService"),c.IOscLinkService=(0,u.createDecorator)("OscLinkService"),c.IUnicodeService=(0,u.createDecorator)("UnicodeService"),c.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(T,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const u=h(8460),y=h(225);class m{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,E,b=!1){return(16777215&w)<<3|(3&E)<<1|(b?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const w=new y.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let E=0,b=0;const d=w.length;for(let p=0;p<d;++p){let f=w.charCodeAt(p);if(55296<=f&&f<=56319){if(++p>=d)return E+this.wcwidth(f);const R=w.charCodeAt(p);56320<=R&&R<=57343?f=1024*(f-55296)+R-56320+65536:E+=this.wcwidth(R)}const v=this.charProperties(f,b);let S=m.extractWidth(v);m.extractShouldJoin(v)&&(S-=m.extractWidth(b)),E+=S,b=v}return E}charProperties(w,E){return this._activeProvider.charProperties(w,E)}}c.UnicodeService=m}},o={};function g(T){var c=o[T];if(c!==void 0)return c.exports;var h=o[T]={exports:{}};return a[T].call(h.exports,h,h.exports,g),h.exports}var x={};return(()=>{var T=x;Object.defineProperty(T,"__esModule",{value:!0}),T.Terminal=void 0;const c=g(9042),h=g(3236),u=g(844),y=g(5741),m=g(8285),C=g(7975),w=g(7090),E=["cols","rows"];class b extends u.Disposable{constructor(p){super(),this._core=this.register(new h.Terminal(p)),this._addonManager=this.register(new y.AddonManager),this._publicOptions={...this._core.options};const f=S=>this._core.options[S],v=(S,R)=>{this._checkReadonlyOptions(S),this._core.options[S]=R};for(const S in this._core.options){const R={get:f.bind(this,S),set:v.bind(this,S)};Object.defineProperty(this._publicOptions,S,R)}}_checkReadonlyOptions(p){if(E.includes(p))throw new Error(`Option "${p}" 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 C.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w.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 m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const p=this._core.coreService.decPrivateModes;let f="none";switch(this._core.coreMouseService.activeProtocol){case"X10":f="x10";break;case"VT200":f="vt200";break;case"DRAG":f="drag";break;case"ANY":f="any"}return{applicationCursorKeysMode:p.applicationCursorKeys,applicationKeypadMode:p.applicationKeypad,bracketedPasteMode:p.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:f,originMode:p.origin,reverseWraparoundMode:p.reverseWraparound,sendFocusMode:p.sendFocus,wraparoundMode:p.wraparound}}get options(){return this._publicOptions}set options(p){for(const f in p)this._publicOptions[f]=p[f]}blur(){this._core.blur()}focus(){this._core.focus()}input(p,f=!0){this._core.input(p,f)}resize(p,f){this._verifyIntegers(p,f),this._core.resize(p,f)}open(p){this._core.open(p)}attachCustomKeyEventHandler(p){this._core.attachCustomKeyEventHandler(p)}attachCustomWheelEventHandler(p){this._core.attachCustomWheelEventHandler(p)}registerLinkProvider(p){return this._core.registerLinkProvider(p)}registerCharacterJoiner(p){return this._checkProposedApi(),this._core.registerCharacterJoiner(p)}deregisterCharacterJoiner(p){this._checkProposedApi(),this._core.deregisterCharacterJoiner(p)}registerMarker(p=0){return this._verifyIntegers(p),this._core.registerMarker(p)}registerDecoration(p){return this._checkProposedApi(),this._verifyPositiveIntegers(p.x??0,p.width??0,p.height??0),this._core.registerDecoration(p)}hasSelection(){return this._core.hasSelection()}select(p,f,v){this._verifyIntegers(p,f,v),this._core.select(p,f,v)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(p,f){this._verifyIntegers(p,f),this._core.selectLines(p,f)}dispose(){super.dispose()}scrollLines(p){this._verifyIntegers(p),this._core.scrollLines(p)}scrollPages(p){this._verifyIntegers(p),this._core.scrollPages(p)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(p){this._verifyIntegers(p),this._core.scrollToLine(p)}clear(){this._core.clear()}write(p,f){this._core.write(p,f)}writeln(p,f){this._core.write(p),this._core.write(`\r
|
|
262
|
-
`,f)}paste(p){this._core.paste(p)}refresh(p,f){this._verifyIntegers(p,f),this._core.refresh(p,f)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(p){this._addonManager.loadAddon(this,p)}static get strings(){return c}_verifyIntegers(...p){for(const f of p)if(f===1/0||isNaN(f)||f%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...p){for(const f of p)if(f&&(f===1/0||isNaN(f)||f%1!=0||f<0))throw new Error("This API only accepts positive integers")}}T.Terminal=b})(),x})()))})(Yu)),Yu.exports}var j2=z2(),Vu={exports:{}},up;function H2(){return up||(up=1,(function(i,r){(function(a,o){i.exports=o()})(self,(()=>(()=>{var a={};return(()=>{var o=a;Object.defineProperty(o,"__esModule",{value:!0}),o.FitAddon=void 0,o.FitAddon=class{activate(g){this._terminal=g}dispose(){}fit(){const g=this.proposeDimensions();if(!g||!this._terminal||isNaN(g.cols)||isNaN(g.rows))return;const x=this._terminal._core;this._terminal.rows===g.rows&&this._terminal.cols===g.cols||(x._renderService.clear(),this._terminal.resize(g.cols,g.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const g=this._terminal._core,x=g._renderService.dimensions;if(x.css.cell.width===0||x.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:g.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),u=Math.max(0,parseInt(c.getPropertyValue("width"))),y=window.getComputedStyle(this._terminal.element),m=h-(parseInt(y.getPropertyValue("padding-top"))+parseInt(y.getPropertyValue("padding-bottom"))),C=u-(parseInt(y.getPropertyValue("padding-right"))+parseInt(y.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(C/x.css.cell.width)),rows:Math.max(1,Math.floor(m/x.css.cell.height))}}}})(),a})()))})(Vu)),Vu.exports}var U2=H2();const I2=3e4,P2=300*1e3;class $2{constructor(r,a,o){wt(this,"ws",null);wt(this,"consecutiveFailures",0);wt(this,"failStartTime",null);wt(this,"destroyed",!1);wt(this,"reconnectTimer",null);wt(this,"url");wt(this,"authToken");wt(this,"callbacks");this.url=r,this.authToken=o,this.callbacks=a,this.connect()}connect(){if(!this.destroyed){try{this.ws=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws.onopen=()=>{var r,a,o;this.destroyed||(this.consecutiveFailures=0,this.failStartTime=null,this.authToken&&((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"auth",token:this.authToken})),(o=(a=this.callbacks).onOpen)==null||o.call(a))},this.ws.onmessage=r=>{if(!this.destroyed)try{this.callbacks.onMessage(JSON.parse(r.data))}catch{}},this.ws.onclose=()=>{this.destroyed||(this.ws=null,this.scheduleReconnect())},this.ws.onerror=()=>{this.destroyed}}}scheduleReconnect(){var a,o,g,x,T,c;if(this.destroyed)return;if(this.failStartTime===null&&(this.failStartTime=Date.now()),Date.now()-this.failStartTime>=P2){(o=(a=this.callbacks).onGiveUp)==null||o.call(a),(x=(g=this.callbacks).onClose)==null||x.call(g);return}this.consecutiveFailures++;const r=Math.min(I2,1e3*Math.pow(2,this.consecutiveFailures-1));(c=(T=this.callbacks).onReconnecting)==null||c.call(T,this.consecutiveFailures,r),this.reconnectTimer=setTimeout(()=>this.connect(),r)}send(r){var a;((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(r))}close(){var r;this.destroyed=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(r=this.ws)==null||r.close(),this.ws=null}}function F2({sessionId:i,status:r}){const a=Et(d=>d.token),o=F.useRef(null),g=F.useRef(null),x=F.useRef(null),T=F.useRef(null),c=F.useRef(r),h=F.useRef("");F.useEffect(()=>{c.current=r},[r]);const[u,y]=F.useState("connecting"),[m,C]=F.useState(null),w=F.useCallback(()=>{const d=window.location.origin,p=`/v1/sessions/${encodeURIComponent(i)}/terminal`;return`${d.replace(/^http/,"ws")}${p}`},[i]);F.useEffect(()=>{if(!o.current)return;const d=new j2.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace',theme:{background:"#000000",foreground:"#00ff88",cursor:"#00ff88",cursorAccent:"#000000",selectionBackground:"#00e5ff40"},convertEol:!0,scrollback:1e3}),p=new U2.FitAddon;d.loadAddon(p),d.open(o.current),p.fit(),g.current=d,x.current=p;const f=new ResizeObserver(()=>{var R;p.fit();const{cols:v,rows:S}=d;(R=T.current)==null||R.send({type:"resize",cols:v,rows:S})});return f.observe(o.current),()=>{f.disconnect(),d.dispose(),g.current=null,x.current=null}},[]),F.useEffect(()=>{const d=w(),p=new $2(d,{onMessage:f=>{const v=f,S=g.current;if(S)switch(v.type){case"pane":{const R=h.current,D=v.content;R&&D.startsWith(R)?S.write(D.slice(R.length)):(S.reset(),S.write(D)),h.current=D,C(null);break}case"status":break;case"error":C(v.message);break}},onOpen:()=>{var v;y("connected"),C(null);const f=g.current;x.current&&f&&((v=T.current)==null||v.send({type:"resize",cols:f.cols,rows:f.rows}))},onReconnecting:()=>{y("reconnecting")},onGiveUp:()=>{y("disconnected")},onClose:()=>{y("disconnected")}},a??void 0);return T.current=p,()=>{T.current=null,p.close()}},[w,a]),F.useEffect(()=>{const d=g.current;if(!d)return;const p=d.onData(f=>{var v;(v=T.current)==null||v.send({type:"input",text:f})});return()=>{p.dispose()}},[]);const E=r==="working",b=u==="connected";return O.jsxs("div",{className:"bg-[#111118] border border-[#1a1a2e] rounded-lg overflow-hidden",children:[O.jsxs("div",{className:"flex items-center justify-between px-4 py-2 text-xs border-b border-[#1a1a2e]",children:[O.jsx("div",{className:"flex items-center gap-2",children:O.jsx("span",{className:"font-mono text-[#888]",children:"Terminal"})}),O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsxs("div",{className:"flex items-center gap-1.5",children:[O.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:b?"#00e5ff":u==="reconnecting"?"#ffaa00":"#666",boxShadow:b?"0 0 4px #00e5ff40":"none",animation:u==="reconnecting"?"pulse 1s ease-in-out infinite":"none"}}),O.jsx("span",{className:"text-[10px] text-[#555] uppercase",children:u==="connecting"?"connecting…":u==="reconnecting"?"reconnecting…":u==="connected"?"ws live":"disconnected"})]}),O.jsxs("div",{className:"flex items-center gap-1.5",children:[O.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:E?"#00ff88":"#888",boxShadow:E?"0 0 4px #00ff88":"none"}}),O.jsx("span",{className:"text-[10px] text-[#555] uppercase",children:E?"active":"idle"})]})]})]}),m&&O.jsx("div",{className:"px-4 py-2 text-xs text-[#ff3366] bg-[#ff336610] border-b border-[#ff336620]",children:m}),O.jsx("div",{ref:o,className:"h-[calc(100vh-420px)] sm:h-[calc(100vh-460px)] min-h-[250px] sm:min-h-[300px]"})]})}function Z2({metrics:i,loading:r}){if(r||!i)return O.jsx("div",{className:"flex items-center justify-center h-48 text-[#555] text-sm animate-pulse",children:"Loading metrics…"});const a=[{label:"Duration",value:WE(i.durationSec*1e3),icon:"⏱",color:"#00e5ff"},{label:"Messages",value:i.messages.toString(),icon:"💬",color:"#00e5ff"},{label:"Tool Calls",value:i.toolCalls.toString(),icon:"🔧",color:"#00e5ff"},{label:"Approvals",value:i.approvals.toString(),icon:"✅",color:"#00ff88"},{label:"Auto-approvals",value:i.autoApprovals.toString(),icon:"⚡",color:"#ffaa00"},{label:"Status Changes",value:i.statusChanges.length.toString(),icon:"🔄",color:"#8888ff"}];return O.jsxs("div",{className:"space-y-4",children:[O.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:a.map(o=>O.jsxs("div",{className:"rounded-lg border border-[#1a1a2e] bg-[#111118] p-4 transition-colors duration-150 hover:border-[#00e5ff]/30",children:[O.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[O.jsx("span",{className:"text-base",children:o.icon}),O.jsx("span",{className:"text-[10px] text-[#888] uppercase tracking-wider",children:o.label})]}),O.jsx("div",{className:"text-2xl font-semibold font-mono tabular-nums",style:{color:o.color},children:o.value})]},o.label))}),i.statusChanges.length>0&&O.jsxs("div",{className:"bg-[#111118] border border-[#1a1a2e] rounded-lg p-4",children:[O.jsx("h3",{className:"text-xs text-[#888] uppercase tracking-wider mb-3",children:"Status Changes"}),O.jsx("div",{className:"flex flex-wrap gap-2",children:i.statusChanges.map((o,g)=>O.jsx("div",{className:"text-xs font-mono text-[#555] bg-[#0a0a0f] px-2 py-1 rounded border border-[#1a1a2e]",children:o},g))})]})]})}const q2=new Set(["bypassPermissions","dontAsk","acceptEdits","plan","auto"]);function G2({prompt:i,permissionMode:r,onApprove:a,onReject:o}){const[g,x]=F.useState(!1);return r&&r!=="default"&&q2.has(r)?O.jsx("div",{className:"flex items-center gap-2 px-4 py-2 bg-[#003322]/50 border border-[#00ff88]/30 rounded-lg text-sm",children:O.jsxs("span",{className:"text-[#00ff88] font-semibold text-xs uppercase tracking-wider",children:["AUTO-APPROVED (",r,")"]})}):O.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 px-3 sm:px-4 py-3 bg-[#1a1a00]/60 border border-[#ffaa00]/40 rounded-lg",children:[O.jsxs("div",{className:"flex items-center gap-3 sm:gap-2 min-w-0",children:[O.jsx("span",{className:"text-[#ffaa00] text-lg shrink-0",children:"⚠"}),O.jsxs("div",{className:"flex-1 min-w-0",children:[O.jsx("div",{className:"text-xs text-[#ffaa00] font-semibold uppercase tracking-wider mb-0.5",children:"Permission Required"}),O.jsxs("div",{className:`text-sm text-[#e0e0e0] font-mono cursor-pointer ${g?"":"truncate"}`,onClick:()=>x(!g),title:g?void 0:"Click to expand",children:[i,!g&&i.length>60&&O.jsx("span",{className:"text-[#888] ml-1",children:"..."})]})]})]}),O.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[O.jsx("button",{onClick:a,className:"min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#003322] hover:bg-[#004433] text-[#00ff88] border border-[#00ff88]/30 transition-colors",children:"Approve"}),O.jsx("button",{onClick:o,className:"min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#331111] hover:bg-[#442222] text-[#ff3366] border border-[#ff3366]/30 transition-colors",children:"Reject"})]})]})}const W2=[{id:"transcript",label:"Transcript"},{id:"terminal",label:"Terminal"},{id:"metrics",label:"Metrics"}];function Y2(){const{id:i}=xp(),r=ul(),[a,o]=F.useState("transcript"),{session:g,health:x,notFound:T,loading:c,metrics:h,metricsLoading:u}=s2(i??""),[y,m]=F.useState(""),[C,w]=F.useState(!1),E=F.useRef(null),b=F.useRef(!1),d=Xs(I=>I.addToast);if(c)return O.jsx("div",{className:"min-h-screen bg-[#0a0a0f] flex items-center justify-center text-[#555] text-sm",children:O.jsx("div",{className:"animate-pulse",children:"Loading session…"})});if(T||!g||!x)return O.jsxs("div",{className:"min-h-screen bg-[#0a0a0f] flex flex-col items-center justify-center text-[#555]",children:[O.jsx("div",{className:"text-6xl mb-4",children:"404"}),O.jsx("div",{className:"text-lg mb-6 text-[#e0e0e0]",children:"Session not found"}),O.jsx(Hi,{to:"/",className:"text-sm text-[#00e5ff] hover:underline",children:"← Back to Overview"})]});const p=g,f=x,v=f.status==="permission_prompt"||f.status==="bash_approval";function S(){mv(p.id).catch(I=>d("error","Approve failed",I instanceof Error?I.message:void 0))}function R(){DE(p.id).catch(I=>d("error","Reject failed",I instanceof Error?I.message:void 0))}function D(){pv(p.id).catch(I=>d("error","Interrupt failed",I instanceof Error?I.message:void 0))}function M(){kE(p.id).catch(I=>d("error","Escape failed",I instanceof Error?I.message:void 0))}async function A(){try{await _v(p.id),r("/")}catch(I){d("error","Failed to kill session",I instanceof Error?I.message:void 0)}}async function B(){var q;const I=y.trim();if(I&&!b.current){b.current=!0,w(!0);try{await RE(p.id,I),m("")}catch(P){d("error","Failed to send message",P instanceof Error?P.message:void 0)}finally{w(!1),b.current=!1,(q=E.current)==null||q.focus()}}}function $(I){I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),B())}return O.jsx("div",{className:"min-h-screen bg-[#0a0a0f]",children:O.jsxs("div",{className:"max-w-6xl mx-auto px-3 sm:px-4 py-3 sm:py-4 space-y-3 sm:space-y-4",children:[O.jsxs("nav",{className:"text-xs text-[#555] flex items-center gap-1",children:[O.jsx(Hi,{to:"/",className:"hover:text-[#00e5ff] transition-colors",children:"Overview"}),O.jsx("span",{className:"text-[#333]",children:"/"}),O.jsx("span",{className:"text-[#e0e0e0] truncate max-w-[160px] sm:max-w-xs",children:p.windowName||p.id})]}),O.jsx(n2,{session:p,health:f,onApprove:S,onReject:R,onInterrupt:D,onKill:A}),O.jsx("div",{className:"flex border-b border-[#1a1a2e]",role:"tablist",children:W2.map(I=>O.jsxs("button",{id:`tab-${I.id}`,onClick:()=>o(I.id),role:"tab","aria-selected":a===I.id,"aria-controls":`panel-${I.id}`,tabIndex:a===I.id?0:-1,className:`flex-1 min-h-[44px] text-sm font-medium transition-colors relative ${a===I.id?"text-[#00e5ff]":"text-[#555] hover:text-[#888]"}`,children:[I.label,a===I.id&&O.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-[#00e5ff]"})]},I.id))}),O.jsxs("div",{className:"bg-[#0a0a0f] rounded-lg min-h-[300px] sm:min-h-[400px]",children:[v&&O.jsx("div",{className:"p-3 sm:p-4 pb-0",children:O.jsx(G2,{sessionId:p.id,prompt:f.details,permissionMode:p.permissionMode,onApprove:S,onReject:R})}),a==="transcript"&&O.jsx("div",{id:"panel-transcript",role:"tabpanel","aria-labelledby":"tab-transcript",tabIndex:0,className:"h-[calc(100vh-380px)] sm:h-[calc(100vh-420px)] min-h-[250px] sm:min-h-[300px]",children:O.jsx(B2,{sessionId:p.id})}),a==="terminal"&&O.jsx("div",{id:"panel-terminal",role:"tabpanel","aria-labelledby":"tab-terminal",tabIndex:0,children:O.jsx(F2,{sessionId:p.id,status:f.status})}),a==="metrics"&&O.jsx("div",{id:"panel-metrics",role:"tabpanel","aria-labelledby":"tab-metrics",tabIndex:0,className:"p-3 sm:p-4",children:O.jsx(Z2,{metrics:h,loading:u})})]}),O.jsxs("div",{className:"bg-[#111118] border border-[#1a1a2e] rounded-lg p-3",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("input",{ref:E,type:"text",value:y,onChange:I=>m(I.target.value),onKeyDown:$,placeholder:"Send a message to Claude…",disabled:C||!f.alive,className:"flex-1 min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff] font-mono disabled:opacity-50"}),O.jsx("button",{onClick:B,disabled:C||!y.trim()||!f.alive,className:"min-h-[44px] min-w-[44px] flex items-center justify-center p-2.5 rounded bg-[#00e5ff]/10 hover:bg-[#00e5ff]/20 text-[#00e5ff] border border-[#00e5ff]/30 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:"Send message",children:O.jsx(eb,{className:"h-4 w-4"})})]}),O.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#1a1a2e]/50",children:[O.jsxs("button",{onClick:D,className:"flex items-center gap-1.5 min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#1a1a2e] hover:bg-[#2a2a3e] text-gray-300 border border-[#1a1a2e] transition-colors",title:"Interrupt (Ctrl+C)",children:[O.jsx(GS,{className:"h-3.5 w-3.5"}),"Interrupt"]}),O.jsxs("button",{onClick:M,className:"flex items-center gap-1.5 min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#1a1a2e] hover:bg-[#2a2a3e] text-gray-300 border border-[#1a1a2e] transition-colors",title:"Send Escape",children:[O.jsx(jS,{className:"h-3.5 w-3.5"}),"Escape"]})]})]})]})})}const V2={running:"bg-cyan/10 text-cyan border-cyan/30",completed:"bg-emerald-400/10 text-emerald-400 border-emerald-400/30",failed:"bg-red-400/10 text-red-400 border-red-400/30",pending:"bg-gray-500/10 text-gray-400 border-gray-500/30"},K2=new Set(["running"]);function wv({status:i}){const r=V2[i]??"bg-gray-500/10 text-gray-500 border-gray-500/30",a=K2.has(i);return O.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium ${r}`,children:[a&&O.jsxs("span",{className:"relative flex h-2 w-2",children:[O.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75 bg-current"}),O.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]}),i]})}let X2=0;function pa(){return{workDir:"",name:"",prompt:"",_key:X2++}}function J2({open:i,onClose:r}){const a=ul(),o=F.useRef(null),g=F.useRef(null),[x,T]=F.useState(""),[c,h]=F.useState([pa(),pa()]),[u,y]=F.useState(!1),[m,C]=F.useState(null),w=F.useCallback(()=>{E(),r()},[r]);function E(){T(""),h([pa(),pa()]),y(!1),C(null)}F.useEffect(()=>{if(!i)return;const S=R=>{R.key==="Escape"&&w()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[i,w]),F.useEffect(()=>{if(!i)return;const S=o.current;if(!S)return;const R='input, textarea, select, button, [tabindex]:not([tabindex="-1"])',D=M=>{if(M.key!=="Tab")return;const A=Array.from(S.querySelectorAll(R));if(A.length===0)return;const B=A[0],$=A[A.length-1];M.shiftKey?document.activeElement===B&&(M.preventDefault(),$.focus()):document.activeElement===$&&(M.preventDefault(),B.focus())};return S.addEventListener("keydown",D),()=>S.removeEventListener("keydown",D)},[i]),F.useEffect(()=>{if(i){const S=setTimeout(()=>{var R;return(R=g.current)==null?void 0:R.focus()},50);return()=>clearTimeout(S)}},[i]);function b(){c.length>=10||h([...c,pa()])}function d(S){c.length<=1||h(c.filter((R,D)=>D!==S))}function p(S,R,D){h(c.map((M,A)=>A===S?{...M,[R]:D}:M))}async function f(S){S.preventDefault(),C(null);const R=c.filter(D=>D.workDir.trim());if(!x.trim()){C("Pipeline name is required");return}if(R.length===0){C("At least one step with a working directory is required");return}y(!0);try{const D=await NE({name:x.trim(),workDir:R[0].workDir.trim(),stages:R.map(M=>({workDir:M.workDir.trim(),name:M.name.trim()||void 0,prompt:M.prompt.trim()||void 0}))});E(),r(),a(`/pipelines/${D.id}`)}catch(D){C(D instanceof Error?D.message:"Failed to create pipeline")}finally{y(!1)}}if(!i)return null;const v=x.trim()&&c.some(S=>S.workDir.trim());return O.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[O.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:w}),O.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":"Create new pipeline",className:"relative w-full max-w-2xl mx-4 bg-[#111118] border border-[#1a1a2e] rounded-lg shadow-2xl max-h-[90vh] overflow-y-auto",children:[O.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 border-b border-[#1a1a2e]",children:[O.jsx("h2",{className:"text-sm font-semibold text-gray-100",children:"New Pipeline"}),O.jsx("button",{onClick:w,className:"min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-500 hover:text-gray-300 transition-colors",children:O.jsx(dl,{className:"h-4 w-4"})})]}),O.jsxs("form",{onSubmit:f,className:"p-4 sm:p-5 space-y-4",children:[O.jsxs("div",{children:[O.jsxs("label",{className:"block text-xs font-medium text-gray-400 mb-1.5",children:["Pipeline Name ",O.jsx("span",{className:"text-[#ff3366]",children:"*"})]}),O.jsx("input",{type:"text",ref:g,value:x,onChange:S=>T(S.target.value),placeholder:"my-pipeline","aria-label":"Pipeline Name",className:"w-full min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff]"})]}),O.jsxs("div",{className:"grid grid-cols-[1fr_120px_1fr_44px] gap-2 text-xs font-medium text-gray-500 px-1",children:[O.jsxs("span",{children:["Working Directory ",O.jsx("span",{className:"text-[#ff3366]",children:"*"})]}),O.jsx("span",{children:"Name"}),O.jsx("span",{children:"Prompt"}),O.jsx("span",{})]}),O.jsx("div",{className:"space-y-2",children:c.map((S,R)=>O.jsxs("div",{className:"grid grid-cols-[1fr_120px_1fr_44px] gap-2 items-start",children:[O.jsx("input",{type:"text",value:S.workDir,onChange:D=>p(R,"workDir",D.target.value),placeholder:"/home/user/project",className:"min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff] font-mono"}),O.jsx("input",{type:"text",value:S.name,onChange:D=>p(R,"name",D.target.value),placeholder:"name",className:"min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff]"}),O.jsx("input",{type:"text",value:S.prompt,onChange:D=>p(R,"prompt",D.target.value),placeholder:"Initial prompt...",className:"min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff]"}),O.jsx("button",{type:"button",onClick:()=>d(R),disabled:c.length<=1,"aria-label":`Remove step ${R+1}`,className:"min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-500 hover:text-[#ff3366] transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:O.jsx(Np,{className:"h-3.5 w-3.5"})})]},S._key))}),c.length<10&&O.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-gray-300 transition-colors",children:[O.jsx(fl,{className:"h-3.5 w-3.5"}),"Add Step"]}),m&&O.jsx("div",{className:"text-xs text-[#ff3366] bg-[#ff3366]/10 border border-[#ff3366]/20 rounded px-3 py-2",children:m}),O.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[O.jsx("button",{type:"button",onClick:w,className:"min-h-[44px] px-4 py-2.5 text-xs font-medium rounded bg-[#1a1a2e] hover:bg-[#2a2a3e] text-gray-300 transition-colors",children:"Cancel"}),O.jsxs("button",{type:"submit",disabled:u||!v,className:"min-h-[44px] flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium rounded bg-[#00e5ff]/10 hover:bg-[#00e5ff]/20 text-[#00e5ff] border border-[#00e5ff]/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[u&&O.jsx(Ju,{className:"h-3 w-3 animate-spin"}),"Create Pipeline"]})]})]})]})]})}function Q2(){const[i,r]=F.useState([]),[a,o]=F.useState(!0),[g,x]=F.useState(!1),T=Xs(u=>u.addToast),c=F.useCallback(async()=>{try{const u=await BE();r(u)}catch(u){T("error","Failed to fetch pipelines",u instanceof Error?u.message:void 0)}finally{o(!1)}},[T]);F.useEffect(()=>{c();const u=setInterval(c,5e3);return()=>clearInterval(u)},[c]);const h={total:i.length,running:i.filter(u=>u.status==="running").length,completed:i.filter(u=>u.status==="completed").length,failed:i.filter(u=>u.status==="failed").length};return a?O.jsx("div",{className:"flex items-center justify-center min-h-[50vh] text-gray-500 text-sm",children:O.jsx("div",{className:"animate-pulse",children:"Loading pipelines…"})}):O.jsxs("div",{className:"flex flex-col gap-6",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{children:[O.jsx("h2",{className:"text-2xl font-bold text-gray-100",children:"Pipelines"}),O.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Manage and monitor session pipelines"})]}),O.jsxs("button",{onClick:()=>x(!0),className:"flex items-center gap-1.5 px-3 py-2 text-xs font-medium rounded bg-[#00e5ff]/10 hover:bg-[#00e5ff]/20 text-[#00e5ff] border border-[#00e5ff]/30 transition-colors",children:[O.jsx(fl,{className:"h-3.5 w-3.5"}),"New Pipeline"]})]}),O.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[O.jsx(qs,{label:"Total",value:h.total}),O.jsx(qs,{label:"Running",value:h.running}),O.jsx(qs,{label:"Completed",value:h.completed}),O.jsx(qs,{label:"Failed",value:h.failed})]}),i.length===0?O.jsxs("div",{className:"rounded-lg border border-void-lighter bg-[#111118] p-12 text-center",children:[O.jsx("p",{className:"text-gray-500",children:"No pipelines yet"}),O.jsx("p",{className:"mt-1 text-xs text-gray-600",children:"Create a pipeline to run sessions in sequence"})]}):O.jsx("div",{className:"space-y-3",children:i.map(u=>O.jsx(Hi,{to:`/pipelines/${u.id}`,className:"block rounded-lg border border-[#1a1a2e] bg-[#111118] p-4 hover:border-[#00e5ff]/30 transition-colors",children:O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[O.jsx("span",{className:"font-medium text-gray-200 truncate",children:u.name}),O.jsx(wv,{status:u.status})]}),O.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 shrink-0 ml-4",children:[O.jsxs("span",{children:[u.stages.length," step",u.stages.length!==1?"s":""]}),O.jsx("span",{children:sn(u.createdAt)})]})]})},u.id))}),O.jsx(J2,{open:g,onClose:()=>x(!1)})]})}function eT(){const{id:i}=xp(),[r,a]=F.useState(null),[o,g]=F.useState(!0),[x,T]=F.useState(!1),c=Xs(u=>u.addToast),h=F.useCallback(async()=>{if(i)try{const u=await zE(i);a(u),T(!1)}catch(u){const y=u;y.statusCode===404?T(!0):c("error","Failed to fetch pipeline",y.message)}finally{g(!1)}},[i,c]);return F.useEffect(()=>{h();const u=setInterval(h,3e3);return()=>clearInterval(u)},[h]),o?O.jsx("div",{className:"flex items-center justify-center min-h-[50vh] text-gray-500 text-sm",children:O.jsx("div",{className:"animate-pulse",children:"Loading pipeline…"})}):x||!r?O.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[50vh] text-gray-500",children:[O.jsx("div",{className:"text-6xl mb-4",children:"404"}),O.jsx("div",{className:"text-lg mb-6 text-gray-200",children:"Pipeline not found"}),O.jsx(Hi,{to:"/pipelines",className:"text-sm text-[#00e5ff] hover:underline",children:"← Back to Pipelines"})]}):O.jsxs("div",{className:"flex flex-col gap-6",children:[O.jsxs("nav",{className:"text-xs text-gray-500 flex items-center gap-1",children:[O.jsx(Hi,{to:"/pipelines",className:"hover:text-[#00e5ff] transition-colors",children:"Pipelines"}),O.jsx("span",{className:"text-gray-700",children:"/"}),O.jsx("span",{className:"text-gray-200 truncate max-w-xs",children:r.name})]}),O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsx("h2",{className:"text-2xl font-bold text-gray-100",children:r.name}),O.jsx(wv,{status:r.status})]}),O.jsxs("div",{className:"text-xs text-gray-500",children:["Created ",sn(r.createdAt)]})]}),O.jsxs("div",{className:"rounded-lg border border-void-lighter bg-[#111118]",children:[O.jsx("div",{className:"px-4 py-3 border-b border-void-lighter",children:O.jsxs("h3",{className:"text-sm font-semibold text-gray-200",children:["Steps (",r.stages.length,")"]})}),r.stages.length===0?O.jsx("div",{className:"p-8 text-center text-gray-500 text-sm",children:"No steps yet"}):O.jsxs("table",{className:"w-full text-left text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"border-b border-void-lighter text-gray-600",children:[O.jsx("th",{className:"px-4 py-3 font-medium w-16",children:"#"}),O.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),O.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),O.jsx("th",{className:"px-4 py-3 font-medium",children:"Session"})]})}),O.jsx("tbody",{children:r.stages.map((u,y)=>O.jsxs("tr",{className:"border-b border-void-lighter/50 transition-colors hover:border-l-2 hover:border-l-cyan",children:[O.jsxs("td",{className:"px-4 py-3 text-gray-500 font-mono text-xs",children:["#",y+1]}),O.jsx("td",{className:"px-4 py-3",children:O.jsx(ll,{status:u.status})}),O.jsx("td",{className:"px-4 py-3",children:u.sessionId?O.jsx(Hi,{to:`/sessions/${encodeURIComponent(u.sessionId)}`,className:"font-medium text-gray-200 hover:text-cyan transition-colors",children:u.name}):O.jsx("span",{className:"font-medium text-gray-200",children:u.name})}),O.jsx("td",{className:"px-4 py-3 font-mono text-xs text-gray-400",children:u.sessionId??"—"})]},u.name))})]})]})]})}function tT(){return O.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 text-center",children:[O.jsx("h1",{className:"text-6xl font-bold text-gray-500",children:"404"}),O.jsx("p",{className:"text-lg text-gray-400",children:"Page not found"}),O.jsx(Hi,{to:"/",className:"mt-2 rounded-lg bg-cyan px-4 py-2 text-sm font-medium text-void transition-colors hover:bg-cyan/80",children:"Back to Dashboard"})]})}function iT(){return O.jsx(wS,{children:O.jsx(qy,{children:O.jsxs(pr,{element:O.jsx(qE,{}),children:[O.jsx(pr,{path:"/",element:O.jsx(i2,{})}),O.jsx(pr,{path:"/sessions/:id",element:O.jsx(Y2,{})}),O.jsx(pr,{path:"/pipelines",element:O.jsx(Q2,{})}),O.jsx(pr,{path:"/pipelines/:id",element:O.jsx(eT,{})}),O.jsx(pr,{path:"*",element:O.jsx(tT,{})})]})})})}q0.createRoot(document.getElementById("root")).render(O.jsx(va.StrictMode,{children:O.jsx(mS,{basename:"/dashboard",children:O.jsx(iT,{})})}));
|
|
262
|
+
`,f)}paste(p){this._core.paste(p)}refresh(p,f){this._verifyIntegers(p,f),this._core.refresh(p,f)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(p){this._addonManager.loadAddon(this,p)}static get strings(){return c}_verifyIntegers(...p){for(const f of p)if(f===1/0||isNaN(f)||f%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...p){for(const f of p)if(f&&(f===1/0||isNaN(f)||f%1!=0||f<0))throw new Error("This API only accepts positive integers")}}T.Terminal=b})(),x})()))})(Yu)),Yu.exports}var j2=z2(),Vu={exports:{}},up;function H2(){return up||(up=1,(function(i,r){(function(a,o){i.exports=o()})(self,(()=>(()=>{var a={};return(()=>{var o=a;Object.defineProperty(o,"__esModule",{value:!0}),o.FitAddon=void 0,o.FitAddon=class{activate(g){this._terminal=g}dispose(){}fit(){const g=this.proposeDimensions();if(!g||!this._terminal||isNaN(g.cols)||isNaN(g.rows))return;const x=this._terminal._core;this._terminal.rows===g.rows&&this._terminal.cols===g.cols||(x._renderService.clear(),this._terminal.resize(g.cols,g.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const g=this._terminal._core,x=g._renderService.dimensions;if(x.css.cell.width===0||x.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:g.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),u=Math.max(0,parseInt(c.getPropertyValue("width"))),y=window.getComputedStyle(this._terminal.element),m=h-(parseInt(y.getPropertyValue("padding-top"))+parseInt(y.getPropertyValue("padding-bottom"))),C=u-(parseInt(y.getPropertyValue("padding-right"))+parseInt(y.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(C/x.css.cell.width)),rows:Math.max(1,Math.floor(m/x.css.cell.height))}}}})(),a})()))})(Vu)),Vu.exports}var U2=H2();const I2=3e4,P2=300*1e3;class $2{constructor(r,a,o){wt(this,"ws",null);wt(this,"consecutiveFailures",0);wt(this,"failStartTime",null);wt(this,"destroyed",!1);wt(this,"reconnectTimer",null);wt(this,"url");wt(this,"authToken");wt(this,"callbacks");this.url=r,this.authToken=o,this.callbacks=a,this.connect()}connect(){if(!this.destroyed){try{this.ws=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws.onopen=()=>{var r,a,o;this.destroyed||(this.consecutiveFailures=0,this.failStartTime=null,this.authToken&&((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"auth",token:this.authToken})),(o=(a=this.callbacks).onOpen)==null||o.call(a))},this.ws.onmessage=r=>{if(!this.destroyed)try{this.callbacks.onMessage(JSON.parse(r.data))}catch{}},this.ws.onclose=()=>{this.destroyed||(this.ws=null,this.scheduleReconnect())},this.ws.onerror=()=>{this.destroyed}}}scheduleReconnect(){var a,o,g,x,T,c;if(this.destroyed)return;if(this.failStartTime===null&&(this.failStartTime=Date.now()),Date.now()-this.failStartTime>=P2){(o=(a=this.callbacks).onGiveUp)==null||o.call(a),(x=(g=this.callbacks).onClose)==null||x.call(g);return}this.consecutiveFailures++;const r=Math.min(I2,1e3*Math.pow(2,this.consecutiveFailures-1));(c=(T=this.callbacks).onReconnecting)==null||c.call(T,this.consecutiveFailures,r),this.reconnectTimer=setTimeout(()=>this.connect(),r)}send(r){var a;((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(r))}close(){var r;this.destroyed=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(r=this.ws)==null||r.close(),this.ws=null}}function F2({sessionId:i,status:r}){const a=Et(d=>d.token),o=F.useRef(null),g=F.useRef(null),x=F.useRef(null),T=F.useRef(null),c=F.useRef(r),h=F.useRef("");F.useEffect(()=>{c.current=r},[r]);const[u,y]=F.useState("connecting"),[m,C]=F.useState(null),w=F.useCallback(()=>{const d=window.location.origin,p=`/v1/sessions/${encodeURIComponent(i)}/terminal`;return`${d.replace(/^http/,"ws")}${p}`},[i]);F.useEffect(()=>{if(!o.current)return;const d=new j2.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace',theme:{background:"#000000",foreground:"#00ff88",cursor:"#00ff88",cursorAccent:"#000000",selectionBackground:"#00e5ff40"},convertEol:!0,scrollback:1e3}),p=new U2.FitAddon;d.loadAddon(p),d.open(o.current),p.fit(),g.current=d,x.current=p;const f=new ResizeObserver(()=>{var R;p.fit();const{cols:v,rows:S}=d;(R=T.current)==null||R.send({type:"resize",cols:v,rows:S})});return f.observe(o.current),()=>{f.disconnect(),d.dispose(),g.current=null,x.current=null}},[]),F.useEffect(()=>{const d=w(),p=new $2(d,{onMessage:f=>{const v=f,S=g.current;if(S)switch(v.type){case"pane":{const R=h.current,D=v.content;R&&D.startsWith(R)?S.write(D.slice(R.length)):(S.reset(),S.write(D)),h.current=D,C(null);break}case"status":break;case"error":C(v.message);break}},onOpen:()=>{var v;y("connected"),C(null);const f=g.current;x.current&&f&&((v=T.current)==null||v.send({type:"resize",cols:f.cols,rows:f.rows}))},onReconnecting:()=>{y("reconnecting")},onGiveUp:()=>{y("disconnected")},onClose:()=>{y("disconnected")}},a??void 0);return T.current=p,()=>{T.current=null,p.close()}},[w,a]),F.useEffect(()=>{const d=g.current;if(!d)return;const p=d.onData(f=>{var v;(v=T.current)==null||v.send({type:"input",text:f})});return()=>{p.dispose()}},[]);const E=r==="working",b=u==="connected";return O.jsxs("div",{className:"bg-[#111118] border border-[#1a1a2e] rounded-lg overflow-hidden",children:[O.jsxs("div",{className:"flex items-center justify-between px-4 py-2 text-xs border-b border-[#1a1a2e]",children:[O.jsx("div",{className:"flex items-center gap-2",children:O.jsx("span",{className:"font-mono text-[#888]",children:"Terminal"})}),O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsxs("div",{className:"flex items-center gap-1.5",children:[O.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:b?"#00e5ff":u==="reconnecting"?"#ffaa00":"#666",boxShadow:b?"0 0 4px #00e5ff40":"none",animation:u==="reconnecting"?"pulse 1s ease-in-out infinite":"none"}}),O.jsx("span",{className:"text-[10px] text-[#555] uppercase",children:u==="connecting"?"connecting…":u==="reconnecting"?"reconnecting…":u==="connected"?"ws live":"disconnected"})]}),O.jsxs("div",{className:"flex items-center gap-1.5",children:[O.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:E?"#00ff88":"#888",boxShadow:E?"0 0 4px #00ff88":"none"}}),O.jsx("span",{className:"text-[10px] text-[#555] uppercase",children:E?"active":"idle"})]})]})]}),m&&O.jsx("div",{className:"px-4 py-2 text-xs text-[#ff3366] bg-[#ff336610] border-b border-[#ff336620]",children:m}),O.jsx("div",{ref:o,className:"h-[calc(100vh-420px)] sm:h-[calc(100vh-460px)] min-h-[250px] sm:min-h-[300px]"})]})}function Z2({metrics:i,loading:r}){if(r||!i)return O.jsx("div",{className:"flex items-center justify-center h-48 text-[#555] text-sm animate-pulse",children:"Loading metrics…"});const a=[{label:"Duration",value:WE(i.durationSec*1e3),icon:"⏱",color:"#00e5ff"},{label:"Messages",value:i.messages.toString(),icon:"💬",color:"#00e5ff"},{label:"Tool Calls",value:i.toolCalls.toString(),icon:"🔧",color:"#00e5ff"},{label:"Approvals",value:i.approvals.toString(),icon:"✅",color:"#00ff88"},{label:"Auto-approvals",value:i.autoApprovals.toString(),icon:"⚡",color:"#ffaa00"},{label:"Status Changes",value:i.statusChanges.length.toString(),icon:"🔄",color:"#8888ff"}];return O.jsxs("div",{className:"space-y-4",children:[O.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:a.map(o=>O.jsxs("div",{className:"rounded-lg border border-[#1a1a2e] bg-[#111118] p-4 transition-colors duration-150 hover:border-[#00e5ff]/30",children:[O.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[O.jsx("span",{className:"text-base",children:o.icon}),O.jsx("span",{className:"text-[10px] text-[#888] uppercase tracking-wider",children:o.label})]}),O.jsx("div",{className:"text-2xl font-semibold font-mono tabular-nums",style:{color:o.color},children:o.value})]},o.label))}),i.statusChanges.length>0&&O.jsxs("div",{className:"bg-[#111118] border border-[#1a1a2e] rounded-lg p-4",children:[O.jsx("h3",{className:"text-xs text-[#888] uppercase tracking-wider mb-3",children:"Status Changes"}),O.jsx("div",{className:"flex flex-wrap gap-2",children:i.statusChanges.map((o,g)=>O.jsx("div",{className:"text-xs font-mono text-[#555] bg-[#0a0a0f] px-2 py-1 rounded border border-[#1a1a2e]",children:o},g))})]})]})}const q2=new Set(["bypassPermissions","dontAsk","acceptEdits","plan","auto"]);function G2({prompt:i,permissionMode:r,onApprove:a,onReject:o}){const[g,x]=F.useState(!1);return r&&r!=="default"&&q2.has(r)?O.jsx("div",{className:"flex items-center gap-2 px-4 py-2 bg-[#003322]/50 border border-[#00ff88]/30 rounded-lg text-sm",children:O.jsxs("span",{className:"text-[#00ff88] font-semibold text-xs uppercase tracking-wider",children:["AUTO-APPROVED (",r,")"]})}):O.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 px-3 sm:px-4 py-3 bg-[#1a1a00]/60 border border-[#ffaa00]/40 rounded-lg",children:[O.jsxs("div",{className:"flex items-center gap-3 sm:gap-2 min-w-0",children:[O.jsx("span",{className:"text-[#ffaa00] text-lg shrink-0",children:"⚠"}),O.jsxs("div",{className:"flex-1 min-w-0",children:[O.jsx("div",{className:"text-xs text-[#ffaa00] font-semibold uppercase tracking-wider mb-0.5",children:"Permission Required"}),O.jsxs("div",{className:`text-sm text-[#e0e0e0] font-mono cursor-pointer ${g?"":"truncate"}`,onClick:()=>x(!g),title:g?void 0:"Click to expand",children:[i,!g&&i.length>60&&O.jsx("span",{className:"text-[#888] ml-1",children:"..."})]})]})]}),O.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[O.jsx("button",{onClick:a,className:"min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#003322] hover:bg-[#004433] text-[#00ff88] border border-[#00ff88]/30 transition-colors",children:"Approve"}),O.jsx("button",{onClick:o,className:"min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#331111] hover:bg-[#442222] text-[#ff3366] border border-[#ff3366]/30 transition-colors",children:"Reject"})]})]})}const W2=[{id:"transcript",label:"Transcript"},{id:"terminal",label:"Terminal"},{id:"metrics",label:"Metrics"}];function Y2(){const{id:i}=xp(),r=ul(),[a,o]=F.useState("transcript"),{session:g,health:x,notFound:T,loading:c,metrics:h,metricsLoading:u}=s2(i??""),[y,m]=F.useState(""),[C,w]=F.useState(!1),E=F.useRef(null),b=F.useRef(!1),d=Xs(I=>I.addToast);if(c)return O.jsx("div",{className:"min-h-screen bg-[#0a0a0f] flex items-center justify-center text-[#555] text-sm",children:O.jsx("div",{className:"animate-pulse",children:"Loading session…"})});if(T||!g||!x)return O.jsxs("div",{className:"min-h-screen bg-[#0a0a0f] flex flex-col items-center justify-center text-[#555]",children:[O.jsx("div",{className:"text-6xl mb-4",children:"404"}),O.jsx("div",{className:"text-lg mb-6 text-[#e0e0e0]",children:"Session not found"}),O.jsx(Hi,{to:"/",className:"text-sm text-[#00e5ff] hover:underline",children:"← Back to Overview"})]});const p=g,f=x,v=f.status==="permission_prompt"||f.status==="bash_approval";function S(){mv(p.id).catch(I=>d("error","Approve failed",I instanceof Error?I.message:void 0))}function R(){DE(p.id).catch(I=>d("error","Reject failed",I instanceof Error?I.message:void 0))}function D(){pv(p.id).catch(I=>d("error","Interrupt failed",I instanceof Error?I.message:void 0))}function M(){kE(p.id).catch(I=>d("error","Escape failed",I instanceof Error?I.message:void 0))}async function A(){try{await _v(p.id),r("/")}catch(I){d("error","Failed to kill session",I instanceof Error?I.message:void 0)}}async function B(){var q;const I=y.trim();if(I&&!b.current){b.current=!0,w(!0);try{await RE(p.id,I),m("")}catch(P){d("error","Failed to send message",P instanceof Error?P.message:void 0)}finally{w(!1),b.current=!1,(q=E.current)==null||q.focus()}}}function $(I){I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),B())}return O.jsx("div",{className:"min-h-screen bg-[#0a0a0f]",children:O.jsxs("div",{className:"max-w-6xl mx-auto px-3 sm:px-4 py-3 sm:py-4 space-y-3 sm:space-y-4",children:[O.jsxs("nav",{className:"text-xs text-[#555] flex items-center gap-1",children:[O.jsx(Hi,{to:"/",className:"hover:text-[#00e5ff] transition-colors",children:"Overview"}),O.jsx("span",{className:"text-[#333]",children:"/"}),O.jsx("span",{className:"text-[#e0e0e0] truncate max-w-[160px] sm:max-w-xs",children:p.windowName||p.id})]}),O.jsx(n2,{session:p,health:f,onApprove:S,onReject:R,onInterrupt:D,onKill:A}),O.jsx("div",{className:"flex border-b border-[#1a1a2e]",role:"tablist",children:W2.map(I=>O.jsxs("button",{id:`tab-${I.id}`,onClick:()=>o(I.id),role:"tab","aria-selected":a===I.id,"aria-controls":`panel-${I.id}`,tabIndex:a===I.id?0:-1,className:`flex-1 min-h-[44px] text-sm font-medium transition-colors relative ${a===I.id?"text-[#00e5ff]":"text-[#555] hover:text-[#888]"}`,children:[I.label,a===I.id&&O.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-[#00e5ff]"})]},I.id))}),O.jsxs("div",{className:"bg-[#0a0a0f] rounded-lg min-h-[300px] sm:min-h-[400px]",children:[v&&O.jsx("div",{className:"p-3 sm:p-4 pb-0",children:O.jsx(G2,{prompt:f.details,permissionMode:p.permissionMode,onApprove:S,onReject:R})}),a==="transcript"&&O.jsx("div",{id:"panel-transcript",role:"tabpanel","aria-labelledby":"tab-transcript",tabIndex:0,className:"h-[calc(100vh-380px)] sm:h-[calc(100vh-420px)] min-h-[250px] sm:min-h-[300px]",children:O.jsx(B2,{sessionId:p.id})}),a==="terminal"&&O.jsx("div",{id:"panel-terminal",role:"tabpanel","aria-labelledby":"tab-terminal",tabIndex:0,children:O.jsx(F2,{sessionId:p.id,status:f.status})}),a==="metrics"&&O.jsx("div",{id:"panel-metrics",role:"tabpanel","aria-labelledby":"tab-metrics",tabIndex:0,className:"p-3 sm:p-4",children:O.jsx(Z2,{metrics:h,loading:u})})]}),O.jsxs("div",{className:"bg-[#111118] border border-[#1a1a2e] rounded-lg p-3",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("input",{ref:E,type:"text",value:y,onChange:I=>m(I.target.value),onKeyDown:$,placeholder:"Send a message to Claude…",disabled:C||!f.alive,className:"flex-1 min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff] font-mono disabled:opacity-50"}),O.jsx("button",{onClick:B,disabled:C||!y.trim()||!f.alive,className:"min-h-[44px] min-w-[44px] flex items-center justify-center p-2.5 rounded bg-[#00e5ff]/10 hover:bg-[#00e5ff]/20 text-[#00e5ff] border border-[#00e5ff]/30 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:"Send message",children:O.jsx(eb,{className:"h-4 w-4"})})]}),O.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#1a1a2e]/50",children:[O.jsxs("button",{onClick:D,className:"flex items-center gap-1.5 min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#1a1a2e] hover:bg-[#2a2a3e] text-gray-300 border border-[#1a1a2e] transition-colors",title:"Interrupt (Ctrl+C)",children:[O.jsx(GS,{className:"h-3.5 w-3.5"}),"Interrupt"]}),O.jsxs("button",{onClick:M,className:"flex items-center gap-1.5 min-h-[44px] px-3 py-2 text-xs font-medium rounded bg-[#1a1a2e] hover:bg-[#2a2a3e] text-gray-300 border border-[#1a1a2e] transition-colors",title:"Send Escape",children:[O.jsx(jS,{className:"h-3.5 w-3.5"}),"Escape"]})]})]})]})})}const V2={running:"bg-cyan/10 text-cyan border-cyan/30",completed:"bg-emerald-400/10 text-emerald-400 border-emerald-400/30",failed:"bg-red-400/10 text-red-400 border-red-400/30",pending:"bg-gray-500/10 text-gray-400 border-gray-500/30"},K2=new Set(["running"]);function wv({status:i}){const r=V2[i]??"bg-gray-500/10 text-gray-500 border-gray-500/30",a=K2.has(i);return O.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium ${r}`,children:[a&&O.jsxs("span",{className:"relative flex h-2 w-2",children:[O.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75 bg-current"}),O.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]}),i]})}let X2=0;function pa(){return{workDir:"",name:"",prompt:"",_key:X2++}}function J2({open:i,onClose:r}){const a=ul(),o=F.useRef(null),g=F.useRef(null),[x,T]=F.useState(""),[c,h]=F.useState([pa(),pa()]),[u,y]=F.useState(!1),[m,C]=F.useState(null),w=F.useCallback(()=>{E(),r()},[r]);function E(){T(""),h([pa(),pa()]),y(!1),C(null)}F.useEffect(()=>{if(!i)return;const S=R=>{R.key==="Escape"&&w()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[i,w]),F.useEffect(()=>{if(!i)return;const S=o.current;if(!S)return;const R='input, textarea, select, button, [tabindex]:not([tabindex="-1"])',D=M=>{if(M.key!=="Tab")return;const A=Array.from(S.querySelectorAll(R));if(A.length===0)return;const B=A[0],$=A[A.length-1];M.shiftKey?document.activeElement===B&&(M.preventDefault(),$.focus()):document.activeElement===$&&(M.preventDefault(),B.focus())};return S.addEventListener("keydown",D),()=>S.removeEventListener("keydown",D)},[i]),F.useEffect(()=>{if(i){const S=setTimeout(()=>{var R;return(R=g.current)==null?void 0:R.focus()},50);return()=>clearTimeout(S)}},[i]);function b(){c.length>=10||h([...c,pa()])}function d(S){c.length<=1||h(c.filter((R,D)=>D!==S))}function p(S,R,D){h(c.map((M,A)=>A===S?{...M,[R]:D}:M))}async function f(S){S.preventDefault(),C(null);const R=c.filter(D=>D.workDir.trim());if(!x.trim()){C("Pipeline name is required");return}if(R.length===0){C("At least one step with a working directory is required");return}y(!0);try{const D=await NE({name:x.trim(),workDir:R[0].workDir.trim(),stages:R.map(M=>({workDir:M.workDir.trim(),name:M.name.trim()||void 0,prompt:M.prompt.trim()||void 0}))});E(),r(),a(`/pipelines/${D.id}`)}catch(D){C(D instanceof Error?D.message:"Failed to create pipeline")}finally{y(!1)}}if(!i)return null;const v=x.trim()&&c.some(S=>S.workDir.trim());return O.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[O.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:w}),O.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":"Create new pipeline",className:"relative w-full max-w-2xl mx-4 bg-[#111118] border border-[#1a1a2e] rounded-lg shadow-2xl max-h-[90vh] overflow-y-auto",children:[O.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 border-b border-[#1a1a2e]",children:[O.jsx("h2",{className:"text-sm font-semibold text-gray-100",children:"New Pipeline"}),O.jsx("button",{onClick:w,className:"min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-500 hover:text-gray-300 transition-colors",children:O.jsx(dl,{className:"h-4 w-4"})})]}),O.jsxs("form",{onSubmit:f,className:"p-4 sm:p-5 space-y-4",children:[O.jsxs("div",{children:[O.jsxs("label",{className:"block text-xs font-medium text-gray-400 mb-1.5",children:["Pipeline Name ",O.jsx("span",{className:"text-[#ff3366]",children:"*"})]}),O.jsx("input",{type:"text",ref:g,value:x,onChange:S=>T(S.target.value),placeholder:"my-pipeline","aria-label":"Pipeline Name",className:"w-full min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff]"})]}),O.jsxs("div",{className:"grid grid-cols-[1fr_120px_1fr_44px] gap-2 text-xs font-medium text-gray-500 px-1",children:[O.jsxs("span",{children:["Working Directory ",O.jsx("span",{className:"text-[#ff3366]",children:"*"})]}),O.jsx("span",{children:"Name"}),O.jsx("span",{children:"Prompt"}),O.jsx("span",{})]}),O.jsx("div",{className:"space-y-2",children:c.map((S,R)=>O.jsxs("div",{className:"grid grid-cols-[1fr_120px_1fr_44px] gap-2 items-start",children:[O.jsx("input",{type:"text",value:S.workDir,onChange:D=>p(R,"workDir",D.target.value),placeholder:"/home/user/project",className:"min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff] font-mono"}),O.jsx("input",{type:"text",value:S.name,onChange:D=>p(R,"name",D.target.value),placeholder:"name",className:"min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff]"}),O.jsx("input",{type:"text",value:S.prompt,onChange:D=>p(R,"prompt",D.target.value),placeholder:"Initial prompt...",className:"min-h-[44px] px-3 py-2.5 text-sm bg-[#0a0a0f] border border-[#1a1a2e] rounded text-gray-200 placeholder-gray-600 focus:outline-none focus:border-[#00e5ff]"}),O.jsx("button",{type:"button",onClick:()=>d(R),disabled:c.length<=1,"aria-label":`Remove step ${R+1}`,className:"min-h-[44px] min-w-[44px] flex items-center justify-center text-gray-500 hover:text-[#ff3366] transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:O.jsx(Np,{className:"h-3.5 w-3.5"})})]},S._key))}),c.length<10&&O.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-gray-300 transition-colors",children:[O.jsx(fl,{className:"h-3.5 w-3.5"}),"Add Step"]}),m&&O.jsx("div",{className:"text-xs text-[#ff3366] bg-[#ff3366]/10 border border-[#ff3366]/20 rounded px-3 py-2",children:m}),O.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[O.jsx("button",{type:"button",onClick:w,className:"min-h-[44px] px-4 py-2.5 text-xs font-medium rounded bg-[#1a1a2e] hover:bg-[#2a2a3e] text-gray-300 transition-colors",children:"Cancel"}),O.jsxs("button",{type:"submit",disabled:u||!v,className:"min-h-[44px] flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium rounded bg-[#00e5ff]/10 hover:bg-[#00e5ff]/20 text-[#00e5ff] border border-[#00e5ff]/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[u&&O.jsx(Ju,{className:"h-3 w-3 animate-spin"}),"Create Pipeline"]})]})]})]})]})}function Q2(){const[i,r]=F.useState([]),[a,o]=F.useState(!0),[g,x]=F.useState(!1),T=Xs(u=>u.addToast),c=F.useCallback(async()=>{try{const u=await BE();r(u)}catch(u){T("error","Failed to fetch pipelines",u instanceof Error?u.message:void 0)}finally{o(!1)}},[T]);F.useEffect(()=>{c();const u=setInterval(c,5e3);return()=>clearInterval(u)},[c]);const h={total:i.length,running:i.filter(u=>u.status==="running").length,completed:i.filter(u=>u.status==="completed").length,failed:i.filter(u=>u.status==="failed").length};return a?O.jsx("div",{className:"flex items-center justify-center min-h-[50vh] text-gray-500 text-sm",children:O.jsx("div",{className:"animate-pulse",children:"Loading pipelines…"})}):O.jsxs("div",{className:"flex flex-col gap-6",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{children:[O.jsx("h2",{className:"text-2xl font-bold text-gray-100",children:"Pipelines"}),O.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Manage and monitor session pipelines"})]}),O.jsxs("button",{onClick:()=>x(!0),className:"flex items-center gap-1.5 px-3 py-2 text-xs font-medium rounded bg-[#00e5ff]/10 hover:bg-[#00e5ff]/20 text-[#00e5ff] border border-[#00e5ff]/30 transition-colors",children:[O.jsx(fl,{className:"h-3.5 w-3.5"}),"New Pipeline"]})]}),O.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[O.jsx(qs,{label:"Total",value:h.total}),O.jsx(qs,{label:"Running",value:h.running}),O.jsx(qs,{label:"Completed",value:h.completed}),O.jsx(qs,{label:"Failed",value:h.failed})]}),i.length===0?O.jsxs("div",{className:"rounded-lg border border-void-lighter bg-[#111118] p-12 text-center",children:[O.jsx("p",{className:"text-gray-500",children:"No pipelines yet"}),O.jsx("p",{className:"mt-1 text-xs text-gray-600",children:"Create a pipeline to run sessions in sequence"})]}):O.jsx("div",{className:"space-y-3",children:i.map(u=>O.jsx(Hi,{to:`/pipelines/${u.id}`,className:"block rounded-lg border border-[#1a1a2e] bg-[#111118] p-4 hover:border-[#00e5ff]/30 transition-colors",children:O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[O.jsx("span",{className:"font-medium text-gray-200 truncate",children:u.name}),O.jsx(wv,{status:u.status})]}),O.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 shrink-0 ml-4",children:[O.jsxs("span",{children:[u.stages.length," step",u.stages.length!==1?"s":""]}),O.jsx("span",{children:sn(u.createdAt)})]})]})},u.id))}),O.jsx(J2,{open:g,onClose:()=>x(!1)})]})}function eT(){const{id:i}=xp(),[r,a]=F.useState(null),[o,g]=F.useState(!0),[x,T]=F.useState(!1),c=Xs(u=>u.addToast),h=F.useCallback(async()=>{if(i)try{const u=await zE(i);a(u),T(!1)}catch(u){const y=u;y.statusCode===404?T(!0):c("error","Failed to fetch pipeline",y.message)}finally{g(!1)}},[i,c]);return F.useEffect(()=>{h();const u=setInterval(h,3e3);return()=>clearInterval(u)},[h]),o?O.jsx("div",{className:"flex items-center justify-center min-h-[50vh] text-gray-500 text-sm",children:O.jsx("div",{className:"animate-pulse",children:"Loading pipeline…"})}):x||!r?O.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[50vh] text-gray-500",children:[O.jsx("div",{className:"text-6xl mb-4",children:"404"}),O.jsx("div",{className:"text-lg mb-6 text-gray-200",children:"Pipeline not found"}),O.jsx(Hi,{to:"/pipelines",className:"text-sm text-[#00e5ff] hover:underline",children:"← Back to Pipelines"})]}):O.jsxs("div",{className:"flex flex-col gap-6",children:[O.jsxs("nav",{className:"text-xs text-gray-500 flex items-center gap-1",children:[O.jsx(Hi,{to:"/pipelines",className:"hover:text-[#00e5ff] transition-colors",children:"Pipelines"}),O.jsx("span",{className:"text-gray-700",children:"/"}),O.jsx("span",{className:"text-gray-200 truncate max-w-xs",children:r.name})]}),O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsx("h2",{className:"text-2xl font-bold text-gray-100",children:r.name}),O.jsx(wv,{status:r.status})]}),O.jsxs("div",{className:"text-xs text-gray-500",children:["Created ",sn(r.createdAt)]})]}),O.jsxs("div",{className:"rounded-lg border border-void-lighter bg-[#111118]",children:[O.jsx("div",{className:"px-4 py-3 border-b border-void-lighter",children:O.jsxs("h3",{className:"text-sm font-semibold text-gray-200",children:["Steps (",r.stages.length,")"]})}),r.stages.length===0?O.jsx("div",{className:"p-8 text-center text-gray-500 text-sm",children:"No steps yet"}):O.jsxs("table",{className:"w-full text-left text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"border-b border-void-lighter text-gray-600",children:[O.jsx("th",{className:"px-4 py-3 font-medium w-16",children:"#"}),O.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),O.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),O.jsx("th",{className:"px-4 py-3 font-medium",children:"Session"})]})}),O.jsx("tbody",{children:r.stages.map((u,y)=>O.jsxs("tr",{className:"border-b border-void-lighter/50 transition-colors hover:border-l-2 hover:border-l-cyan",children:[O.jsxs("td",{className:"px-4 py-3 text-gray-500 font-mono text-xs",children:["#",y+1]}),O.jsx("td",{className:"px-4 py-3",children:O.jsx(ll,{status:u.status})}),O.jsx("td",{className:"px-4 py-3",children:u.sessionId?O.jsx(Hi,{to:`/sessions/${encodeURIComponent(u.sessionId)}`,className:"font-medium text-gray-200 hover:text-cyan transition-colors",children:u.name}):O.jsx("span",{className:"font-medium text-gray-200",children:u.name})}),O.jsx("td",{className:"px-4 py-3 font-mono text-xs text-gray-400",children:u.sessionId??"—"})]},u.name))})]})]})]})}function tT(){return O.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 text-center",children:[O.jsx("h1",{className:"text-6xl font-bold text-gray-500",children:"404"}),O.jsx("p",{className:"text-lg text-gray-400",children:"Page not found"}),O.jsx(Hi,{to:"/",className:"mt-2 rounded-lg bg-cyan px-4 py-2 text-sm font-medium text-void transition-colors hover:bg-cyan/80",children:"Back to Dashboard"})]})}function iT(){return O.jsx(wS,{children:O.jsx(qy,{children:O.jsxs(pr,{element:O.jsx(qE,{}),children:[O.jsx(pr,{path:"/",element:O.jsx(i2,{})}),O.jsx(pr,{path:"/sessions/:id",element:O.jsx(Y2,{})}),O.jsx(pr,{path:"/pipelines",element:O.jsx(Q2,{})}),O.jsx(pr,{path:"/pipelines/:id",element:O.jsx(eT,{})}),O.jsx(pr,{path:"*",element:O.jsx(tT,{})})]})})})}q0.createRoot(document.getElementById("root")).render(O.jsx(va.StrictMode,{children:O.jsx(mS,{basename:"/dashboard",children:O.jsx(iT,{})})}));
|