accompany 0.26.0 → 0.27.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/dist/cli.js +31 -31
- package/dist/cli.js.map +4 -4
- package/dist/{index-4ypqm7p0.js → index-164wadhe.js} +31 -31
- package/dist/{index-4ypqm7p0.js.map → index-164wadhe.js.map} +6 -5
- package/dist/{index-9f2snsnm.css → index-e5af4q9z.css} +1 -1
- package/dist/public/index.html +1 -1
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var vs=Object.create;var{getPrototypeOf:ys,defineProperty:$t,getOwnPropertyNames:bs}=Object;var jt=Object.prototype.hasOwnProperty;function Ss(e){return this[e]}var ws,Cs,xs=(e,r,s)=>{var h=e!=null&&typeof e==="object";if(h){var g=r?ws??=new WeakMap:Cs??=new WeakMap,u=g.get(e);if(u)return u}s=e!=null?vs(ys(e)):{};let y=r||!e||!e.__esModule||!jt.call(e,"default")?$t(s,"default",{value:e,enumerable:!0}):s;if(e&&typeof e==="object"||typeof e==="function"){for(let t of bs(e))if(!jt.call(y,t))$t(y,t,{get:Ss.bind(e,t),enumerable:!0})}if(h)g.set(e,y);return y};var Es=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var zt=(e)=>JSON.parse(e);var Lr=Es(function(kr){(()=>{var e={5639:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let f=o(7150),p=o(802);class _ extends f.Disposable{constructor(l){super(),this._maxLength=l,this.onDeleteEmitter=this._register(new p.Emitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new p.Emitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new p.Emitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(l){if(this._maxLength===l)return;let d=Array(l);for(let v=0;v<Math.min(l,this.length);v++)d[v]=this._array[this._getCyclicIndex(v)];this._array=d,this._maxLength=l,this._startIndex=0}get length(){return this._length}set length(l){if(l>this._length)for(let d=this._length;d<l;d++)this._array[d]=void 0;this._length=l}get(l){return this._array[this._getCyclicIndex(l)]}set(l,d){this._array[this._getCyclicIndex(l)]=d}push(l){this._array[this._getCyclicIndex(this._length)]=l,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(l,d,...v){if(d){for(let n=l;n<this._length-d;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+d)];this._length-=d,this.onDeleteEmitter.fire({index:l,amount:d})}for(let n=this._length-1;n>=l;n--)this._array[this._getCyclicIndex(n+v.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<v.length;n++)this._array[this._getCyclicIndex(l+n)]=v[n];if(v.length&&this.onInsertEmitter.fire({index:l,amount:v.length}),this._length+v.length>this._maxLength){let n=this._length+v.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=v.length}trimStart(l){l>this._length&&(l=this._length),this._startIndex+=l,this._length-=l,this.onTrimEmitter.fire(l)}shiftElements(l,d,v){if(!(d<=0)){if(l<0||l>=this._length)throw Error("start argument out of range");if(l+v<0)throw Error("Cannot shift elements in list beyond index 0");if(v>0){for(let i=d-1;i>=0;i--)this.set(l+i+v,this.get(l+i));let n=l+d+v-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<d;n++)this.set(l+n+v,this.get(l+n))}}_getCyclicIndex(l){return(this._startIndex+l)%this._maxLength}}t.CircularList=_},7453:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=function o(f,p=5){if(typeof f!="object")return f;let _=Array.isArray(f)?[]:{};for(let l in f)_[l]=p<=1?f[l]:f[l]&&o(f[l],p-1);return _}},5777:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let f=o(6501),p=o(6025),_=o(7276),l=o(9640),d=o(56),v=o(4071),n=o(7792),i=o(6415),w=o(5746),a=o(5882),m=o(2486),c=o(3562),S=o(8811),C=o(802),T=o(7150),B=!1;class O extends T.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new C.Emitter),this._onScroll.event((A)=>{this._onScrollApi?.fire(A.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(A){for(let M in A)this.optionsService.options[M]=A[M]}constructor(A){super(),this._windowsWrappingHeuristics=this._register(new T.MutableDisposable),this._onBinary=this._register(new C.Emitter),this.onBinary=this._onBinary.event,this._onData=this._register(new C.Emitter),this.onData=this._onData.event,this._onLineFeed=this._register(new C.Emitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new C.Emitter),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new C.Emitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new C.Emitter),this._instantiationService=new p.InstantiationService,this.optionsService=this._register(new d.OptionsService(A)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(l.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this._register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(w.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this._register(new m.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(C.Event.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(C.Event.forward(this._bufferService.onResize,this._onResize)),this._register(C.Event.forward(this.coreService.onData,this._onData)),this._register(C.Event.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new c.WriteBuffer((M,k)=>this._inputHandler.parse(M,k))),this._register(C.Event.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,M){this._writeBuffer.write(A,M)}writeSync(A,M){this._logService.logLevel<=f.LogLevelEnum.WARN&&!B&&(this._logService.warn("writeSync is unreliable and will be removed soon."),B=!0),this._writeBuffer.writeSync(A,M)}input(A,M=!0){this.coreService.triggerDataEvent(A,M)}resize(A,M){isNaN(A)||isNaN(M)||(A=Math.max(A,l.MINIMUM_COLS),M=Math.max(M,l.MINIMUM_ROWS),this._bufferService.resize(A,M))}scroll(A,M=!1){this._bufferService.scroll(A,M)}scrollLines(A,M){this._bufferService.scrollLines(A,M)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(A){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){let M=A-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(A,M){return this._inputHandler.registerEscHandler(A,M)}registerDcsHandler(A,M){return this._inputHandler.registerDcsHandler(A,M)}registerCsiHandler(A,M){return this._inputHandler.registerCsiHandler(A,M)}registerOscHandler(A,M){return this._inputHandler.registerOscHandler(A,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1,M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?A=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let A=[];A.push(this.onLineFeed(a.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},()=>((0,a.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,T.toDisposable)(()=>{for(let M of A)M.dispose()})}}}t.CoreTerminal=O},2486:function(y,t,o){var f=this&&this.__decorate||function(b,x,L,E){var D,H=arguments.length,I=H<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,L):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(b,x,L,E);else for(var N=b.length-1;N>=0;N--)(D=b[N])&&(I=(H<3?D(I):H>3?D(x,L,I):D(x,L))||I);return H>3&&I&&Object.defineProperty(x,L,I),I},p=this&&this.__param||function(b,x){return function(L,E){x(L,E,b)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0,t.isValidColorIndex=F;let _=o(3534),l=o(6760),d=o(6717),v=o(7150),n=o(726),i=o(6107),w=o(8938),a=o(3055),m=o(5451),c=o(6501),S=o(6415),C=o(1346),T=o(9823),B=o(8693),O=o(802),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},M=131072;function k(b,x){if(b>24)return x.setWinLines||!1;switch(b){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var P;(function(b){b[b.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",b[b.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(P||(t.WindowsOptionsReportType=P={}));let W=0;class j extends v.Disposable{getAttrData(){return this._curAttrData}constructor(b,x,L,E,D,H,I,N,z=new d.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=x,this._coreService=L,this._logService=E,this._optionsService=D,this._oscLinkService=H,this._coreMouseService=I,this._unicodeService=N,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new n.StringToUtf32,this._utf8Decoder=new n.Utf8ToUtf32,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this._register(new O.Emitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new O.Emitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new O.Emitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new O.Emitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new O.Emitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new O.Emitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new O.Emitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new O.Emitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new O.Emitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new O.Emitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new O.Emitter),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new O.Emitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new O.Emitter),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 q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((R)=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,G)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:G.toArray()})}),this._parser.setEscHandlerFallback((R)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback((R)=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,G,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:G,data:U})}),this._parser.setDcsHandlerFallback((R,G,U)=>{G==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:G,payload:U})}),this._parser.setPrintHandler((R,G,U)=>this.print(R,G,U)),this._parser.registerCsiHandler({final:"@"},(R)=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(R)=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},(R)=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(R)=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},(R)=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},(R)=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},(R)=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},(R)=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},(R)=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},(R)=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},(R)=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},(R)=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},(R)=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(R)=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},(R)=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(R)=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},(R)=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},(R)=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},(R)=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},(R)=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},(R)=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},(R)=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},(R)=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},(R)=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},(R)=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},(R)=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},(R)=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},(R)=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},(R)=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},(R)=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},(R)=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},(R)=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},(R)=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(R)=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},(R)=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(R)=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},(R)=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},(R)=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(R)=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(R)=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(R)=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},(R)=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},(R)=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},(R)=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},(R)=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(R)=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(R)=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(R)=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(R)=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(R)=>this.requestMode(R,!1)),this._parser.setExecuteHandler(_.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(_.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(_.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(_.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(_.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(_.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(_.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(_.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(_.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_.C1.IND,()=>this.index()),this._parser.setExecuteHandler(_.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler((R)=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new C.OscHandler((R)=>this.setIconName(R))),this._parser.registerOscHandler(2,new C.OscHandler((R)=>this.setTitle(R))),this._parser.registerOscHandler(4,new C.OscHandler((R)=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new C.OscHandler((R)=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new C.OscHandler((R)=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new C.OscHandler((R)=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new C.OscHandler((R)=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new C.OscHandler((R)=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new C.OscHandler((R)=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new C.OscHandler((R)=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new C.OscHandler((R)=>this.restoreCursorColor(R))),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(let R in l.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((R)=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler((R,G)=>this.requestStatusString(R,G)))}_preserveStack(b,x,L,E){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=L,this._parseStack.position=E}_logSlowResolvingAsync(b){this._logService.logLevel<=c.LogLevelEnum.WARN&&Promise.race([b,new Promise((x,L)=>setTimeout(()=>L("#SLOW_TIMEOUT"),5000))]).catch((x)=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,x){let L,E=this._activeBuffer.x,D=this._activeBuffer.y,H=0,I=this._parseStack.paused;if(I){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(L),L;E=this._parseStack.cursorStartX,D=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>M&&(H=this._parseStack.position+M)}if(this._logService.logLevel<=c.LogLevelEnum.DEBUG&&this._logService.debug("parsing data "+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(R)=>String.fromCharCode(R)).join("")}"`)),this._logService.logLevel===c.LogLevelEnum.TRACE&&this._logService.trace("parsing data (codes)",typeof b=="string"?b.split("").map((R)=>R.charCodeAt(0)):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<M&&(this._parseBuffer=new Uint32Array(Math.min(b.length,M))),I||this._dirtyRowTracker.clearRange(),b.length>M)for(let R=H;R<b.length;R+=M){let G=R+M<b.length?R+M:b.length,U=typeof b=="string"?this._stringDecoder.decode(b.substring(R,G),this._parseBuffer):this._utf8Decoder.decode(b.subarray(R,G),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,U))return this._preserveStack(E,D,U,R),this._logSlowResolvingAsync(L),L}else if(!I){let R=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,R))return this._preserveStack(E,D,R,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===E&&this._activeBuffer.y===D||this._onCursorMove.fire();let N=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);z<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(z,this._bufferService.rows-1),end:Math.min(N,this._bufferService.rows-1)})}print(b,x,L){let E,D,H=this._charsetService.charset,I=this._optionsService.rawOptions.screenReaderMode,N=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,G=this._curAttrData,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-x>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,G);let X=this._parser.precedingJoinState;for(let re=x;re<L;++re){if(E=b[re],E<127&&H){let ae=H[String.fromCharCode(E)];ae&&(E=ae.charCodeAt(0))}let se=this._unicodeService.charProperties(E,X);D=S.UnicodeService.extractWidth(se);let ne=S.UnicodeService.extractShouldJoin(se),oe=ne?S.UnicodeService.extractWidth(X):0;if(X=se,I&&this._onA11yChar.fire((0,n.stringFromCodePoint)(E)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+D-oe>N){if(z){let ae=U,ye=this._activeBuffer.x-oe;for(this._activeBuffer.x=oe,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),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&U instanceof i.BufferLine&&U.copyCellsFrom(ae,ye,0,oe,!1);ye<N;)ae.setCellFromCodepoint(ye++,0,1,G)}else if(this._activeBuffer.x=N-1,D===2)continue}if(ne&&this._activeBuffer.x){let ae=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-ae,E,D);for(let ye=D-oe;--ye>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}else if(R&&(U.insertCells(this._activeBuffer.x,D-oe,this._activeBuffer.getNullCell(G)),U.getWidth(N-1)===2&&U.setCellFromCodepoint(N-1,w.NULL_CELL_CODE,w.NULL_CELL_WIDTH,G)),U.setCellFromCodepoint(this._activeBuffer.x++,E,D,G),D>0)for(;--D;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}this._parser.precedingJoinState=X,this._activeBuffer.x<N&&L-x>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,G),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,x){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,x):this._parser.registerCsiHandler(b,(L)=>!k(L.params[0],this._optionsService.rawOptions.windowOptions)||x(L))}registerDcsHandler(b,x){return this._parser.registerDcsHandler(b,new T.DcsHandler(x))}registerEscHandler(b,x){return this._parser.registerEscHandler(b,x)}registerOscHandler(b,x){return this._parser.registerOscHandler(b,new C.OscHandler(x))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,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(b,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=b,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+x)}cursorUp(b){let x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let x=b.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=b.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=b.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let x=b.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,x,L,E=!1,D=!1){let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);H.replaceCells(x,L,this._activeBuffer.getNullCell(this._eraseAttrData()),D),E&&(H.isWrapped=!1)}_resetBufferLine(b,x=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,x=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.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,x);L<this._bufferService.rows;L++)this._resetBufferLine(L,x);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,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,x);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(L=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,L-1);L--;)if(this._activeBuffer.lines.get(this._activeBuffer.ybase+L)?.getTrimmedLength())break;for(;L>=0;L--)this._bufferService.scroll(this._eraseAttrData())}else{for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,x);this._dirtyRowTracker.markDirty(0)}break;case 3:let E=this._activeBuffer.lines.length-this._bufferService.rows;E>0&&(this._activeBuffer.lines.trimStart(E),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-E,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-E,0),this._onScroll.fire(0))}return!0}eraseInLine(b,x=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let x=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,E=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-E+1;for(;x--;)this._activeBuffer.lines.splice(D-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(b){this._restrictCursor();let x=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,E;for(E=this._bufferService.rows-1-this._activeBuffer.scrollBottom,E=this._bufferService.rows-1+this._activeBuffer.ybase-E;x--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(E,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let x=b.params[0]||1;for(;x--;)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(b){let x=b.params[0]||1;for(;x--;)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(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let x=this._parser.precedingJoinState;if(!x)return!0;let L=b.params[0]||1,E=S.UnicodeService.extractWidth(x),D=this._activeBuffer.x-E,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(D),I=new Uint32Array(H.length*L),N=0;for(let R=0;R<H.length;){let G=H.codePointAt(R)||0;I[N++]=G,R+=G>65535?2:1}let z=N;for(let R=1;R<L;++R)I.copyWithin(z,0,N),z+=N;return this.print(I,0,z),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(_.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(_.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(_.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(_.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(_.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,l.DEFAULT_CHARSET),this._charsetService.setgCharset(1,l.DEFAULT_CHARSET),this._charsetService.setgCharset(2,l.DEFAULT_CHARSET),this._charsetService.setgCharset(3,l.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 1000: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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let x=0;x<b.length;x++)switch(b.params[x]){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 1000: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(),b.params[x]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(b,x){let L=this._coreService.decPrivateModes,{activeProtocol:E,activeEncoding:D}=this._coreMouseService,H=this._coreService,{buffers:I,cols:N}=this._bufferService,{active:z,alt:R}=I,G=this._optionsService.rawOptions,U=(ne)=>ne?1:2,X=b.params[0];return re=X,se=x?X===2?4:X===4?U(H.modes.insertMode):X===12?3:X===20?U(G.convertEol):0:X===1?U(L.applicationCursorKeys):X===3?G.windowOptions.setWinLines?N===80?2:N===132?1:0:0:X===6?U(L.origin):X===7?U(L.wraparound):X===8?3:X===9?U(E==="X10"):X===12?U(G.cursorBlink):X===25?U(!H.isCursorHidden):X===45?U(L.reverseWraparound):X===66?U(L.applicationKeypad):X===67?4:X===1000?U(E==="VT200"):X===1002?U(E==="DRAG"):X===1003?U(E==="ANY"):X===1004?U(L.sendFocus):X===1005?4:X===1006?U(D==="SGR"):X===1015?4:X===1016?U(D==="SGR_PIXELS"):X===1048?1:X===47||X===1047||X===1049?U(z===R):X===2004?U(L.bracketedPasteMode):X===2026?U(L.synchronizedOutput):0,H.triggerDataEvent(`${_.C0.ESC}[${x?"":"?"}${re};${se}$y`),!0;var re,se}_updateAttrColor(b,x,L,E,D){return x===2?(b|=50331648,b&=-16777216,b|=m.AttributeData.fromColorRGB([L,E,D])):x===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,x,L){let E=[0,0,-1,0,0,0],D=0,H=0;do{if(E[H+D]=b.params[x+H],b.hasSubParams(x+H)){let I=b.getSubParams(x+H),N=0;do E[1]===5&&(D=1),E[H+N+1+D]=I[N];while(++N<I.length&&N+H+1+D<E.length);break}if(E[1]===5&&H+D>=2||E[1]===2&&H+D>=5)break;E[1]&&(D=1)}while(++H+x<b.length&&H+D<E.length);for(let I=2;I<E.length;++I)E[I]===-1&&(E[I]=0);switch(E[0]){case 38:L.fg=this._updateAttrColor(L.fg,E[1],E[3],E[4],E[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,E[1],E[3],E[4],E[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,E[1],E[3],E[4],E[5])}return H}_processUnderline(b,x){x.extended=x.extended.clone(),(!~b||b>5)&&(b=1),x.extended.underlineStyle=b,x.fg|=268435456,b===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(b){b.fg=i.DEFAULT_ATTR_DATA.fg,b.bg=i.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let x=b.length,L,E=this._curAttrData;for(let D=0;D<x;D++)L=b.params[D],L>=30&&L<=37?(E.fg&=-50331904,E.fg|=16777216|L-30):L>=40&&L<=47?(E.bg&=-50331904,E.bg|=16777216|L-40):L>=90&&L<=97?(E.fg&=-50331904,E.fg|=16777224|L-90):L>=100&&L<=107?(E.bg&=-50331904,E.bg|=16777224|L-100):L===0?this._processSGR0(E):L===1?E.fg|=134217728:L===3?E.bg|=67108864:L===4?(E.fg|=268435456,this._processUnderline(b.hasSubParams(D)?b.getSubParams(D)[0]:1,E)):L===5?E.fg|=536870912:L===7?E.fg|=67108864:L===8?E.fg|=1073741824:L===9?E.fg|=2147483648:L===2?E.bg|=134217728:L===21?this._processUnderline(2,E):L===22?(E.fg&=-134217729,E.bg&=-134217729):L===23?E.bg&=-67108865:L===24?(E.fg&=-268435457,this._processUnderline(0,E)):L===25?E.fg&=-536870913:L===27?E.fg&=-67108865:L===28?E.fg&=-1073741825:L===29?E.fg&=2147483647:L===39?(E.fg&=-67108864,E.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):L===49?(E.bg&=-67108864,E.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?D+=this._extractColor(b,D,E):L===53?E.bg|=1073741824:L===55?E.bg&=-1073741825:L===59?(E.extended=E.extended.clone(),E.extended.underlineColor=-1,E.updateExtended()):L===100?(E.fg&=-67108864,E.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,E.bg&=-67108864,E.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${_.C0.ESC}[0n`);break;case 6:let x=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_.C0.ESC}[${x};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let x=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${_.C0.ESC}[?${x};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.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(b){let x=b.length===0?1:b.params[0];if(x===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(x){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}let L=x%2==1;this._coreService.decPrivateModes.cursorBlink=L}return!0}setScrollRegion(b){let x=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!k(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let x=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:x!==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(`${_.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){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(b){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(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let x=[],L=b.split(";");for(;L.length>1;){let E=L.shift(),D=L.shift();if(/^\d+$/.exec(E)){let H=parseInt(E);if(F(H))if(D==="?")x.push({type:0,index:H});else{let I=(0,B.parseColor)(D);I&&x.push({type:1,index:H,color:I})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(b){let x=b.indexOf(";");if(x===-1)return!0;let L=b.slice(0,x).trim(),E=b.slice(x+1);return E?this._createHyperlink(L,E):!L.trim()&&this._finishHyperlink()}_createHyperlink(b,x){this._getCurrentLinkId()&&this._finishHyperlink();let L=b.split(":"),E,D=L.findIndex((H)=>H.startsWith("id="));return D!==-1&&(E=L[D].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:E,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,x){let L=b.split(";");for(let E=0;E<L.length&&!(x>=this._specialColors.length);++E,++x)if(L[E]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{let D=(0,B.parseColor)(L[E]);D&&this._onColor.fire([{type:1,index:this._specialColors[x],color:D}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let x=[],L=b.split(";");for(let E=0;E<L.length;++E)if(/^\d+$/.exec(L[E])){let D=parseInt(L[E]);F(D)&&x.push({type:2,index:D})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){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,l.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(A[b[0]],l.CHARSETS[b[1]]||l.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){let b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new a.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){let L=this._activeBuffer.ybase+this._activeBuffer.y+x,E=this._activeBuffer.lines.get(L);E&&(E.fill(b),E.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,x){let L=this._bufferService.buffer,E=this._optionsService.rawOptions;return((D)=>(this._coreService.triggerDataEvent(`${_.C0.ESC}${D}${_.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[E.cursorStyle]-(E.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,x){this._dirtyRowTracker.markRangeDirty(b,x)}}t.InputHandler=j;let q=class{constructor(b){this._bufferService=b,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(b){b<this.start?this.start=b:b>this.end&&(this.end=b)}markRangeDirty(b,x){b>x&&(W=b,b=x,x=W),b<this.start&&(this.start=b),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(b){return 0<=b&&b<256}q=f([p(0,c.IBufferService)],q)},701:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.getSafariVersion=function(){if(!t.isSafari)return 0;let p=o.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},t.isNode=typeof process<"u"&&"title"in process;let o=t.isNode?"node":navigator.userAgent,f=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),t.isIpad=f==="iPad",t.isIphone=f==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),t.isLinux=f.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(o)},6168:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let f=o(701);class p{constructor(){this._tasks=[],this._i=0}enqueue(l){this._tasks.push(l),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(l){this._idleCallback=void 0;let d=0,v=0,n=l.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(d=performance.now(),this._tasks[this._i]()||this._i++,d=Math.max(1,performance.now()-d),v=Math.max(d,v),i=l.timeRemaining(),1.5*v>i)return n-d<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-d))}ms`),void this._start();n=i}this.clear()}}class _ extends p{_requestCallback(l){return setTimeout(()=>l(this._createDeadline(16)))}_cancelCallback(l){clearTimeout(l)}_createDeadline(l){let d=performance.now()+l;return{timeRemaining:()=>Math.max(0,d-performance.now())}}}t.PriorityTaskQueue=_,t.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(l){return requestIdleCallback(l)}_cancelCallback(l){cancelIdleCallback(l)}}:_,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(l){this._queue.clear(),this._queue.enqueue(l)}flush(){this._queue.flush()}}},5882:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=function(p){let _=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),l=_?.get(p.cols-1),d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);d&&l&&(d.isWrapped=l[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&l[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)};let f=o(8938)},5451:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){let p=new o;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}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)}isBgDefault(){return!(50331648&this.bg)}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):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):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=o;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){let p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,_=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=_}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=f},1073:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let f=o(5639),p=o(6168),_=o(5451),l=o(6107),d=o(732),v=o(3055),n=o(8938),i=o(8158),w=o(6760);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(a,m,c){this._hasScrollback=a,this._optionsService=m,this._bufferService=c,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=l.DEFAULT_ATTR_DATA.clone(),this.savedCharset=w.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,n.WHITESPACE_CELL_CHAR,n.WHITESPACE_CELL_WIDTH,n.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(a){return a?(this._nullCell.fg=a.fg,this._nullCell.bg=a.bg,this._nullCell.extended=a.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new _.ExtendedAttrs),this._nullCell}getWhitespaceCell(a){return a?(this._whitespaceCell.fg=a.fg,this._whitespaceCell.bg=a.bg,this._whitespaceCell.extended=a.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new _.ExtendedAttrs),this._whitespaceCell}getBlankLine(a,m){return new l.BufferLine(this._bufferService.cols,this.getNullCell(a),m)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let a=this.ybase+this.y-this.ydisp;return a>=0&&a<this._rows}_getCorrectBufferLength(a){if(!this._hasScrollback)return a;let m=a+this._optionsService.rawOptions.scrollback;return m>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:m}fillViewportRows(a){if(this.lines.length===0){a===void 0&&(a=l.DEFAULT_ATTR_DATA);let m=this._rows;for(;m--;)this.lines.push(this.getBlankLine(a))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(a,m){let c=this.getNullCell(l.DEFAULT_ATTR_DATA),S=0,C=this._getCorrectBufferLength(m);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<a)for(let B=0;B<this.lines.length;B++)S+=+this.lines.get(B).resize(a,c);let T=0;if(this._rows<m)for(let B=this._rows;B<m;B++)this.lines.length<m+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new l.BufferLine(a,c)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new l.BufferLine(a,c)));else for(let B=this._rows;B>m;B--)this.lines.length>m+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(C<this.lines.maxLength){let B=this.lines.length-C;B>0&&(this.lines.trimStart(B),this.ybase=Math.max(this.ybase-B,0),this.ydisp=Math.max(this.ydisp-B,0),this.savedY=Math.max(this.savedY-B,0)),this.lines.maxLength=C}this.x=Math.min(this.x,a-1),this.y=Math.min(this.y,m-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,a-1),this.scrollTop=0}if(this.scrollBottom=m-1,this._isReflowEnabled&&(this._reflow(a,m),this._cols>a))for(let T=0;T<this.lines.length;T++)S+=+this.lines.get(T).resize(a,c);this._cols=a,this._rows=m,this._memoryCleanupQueue.clear(),S>0.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let a=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,a=!1);let m=0;for(;this._memoryCleanupPosition<this.lines.length;)if(m+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),m>100)return!0;return a}get _isReflowEnabled(){let a=this._optionsService.rawOptions.windowsPty;return a&&a.buildNumber?this._hasScrollback&&a.backend==="conpty"&&a.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(a,m){this._cols!==a&&(a>this._cols?this._reflowLarger(a,m):this._reflowSmaller(a,m))}_reflowLarger(a,m){let c=this._optionsService.rawOptions.reflowCursorLine,S=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,a,this.ybase+this.y,this.getNullCell(l.DEFAULT_ATTR_DATA),c);if(S.length>0){let C=(0,d.reflowLargerCreateNewLayout)(this.lines,S);(0,d.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(a,m,C.countRemoved)}}_reflowLargerAdjustViewport(a,m,c){let S=this.getNullCell(l.DEFAULT_ATTR_DATA),C=c;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<m&&this.lines.push(new l.BufferLine(a,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-c,0)}_reflowSmaller(a,m){let c=this._optionsService.rawOptions.reflowCursorLine,S=this.getNullCell(l.DEFAULT_ATTR_DATA),C=[],T=0;for(let B=this.lines.length-1;B>=0;B--){let O=this.lines.get(B);if(!O||!O.isWrapped&&O.getTrimmedLength()<=a)continue;let A=[O];for(;O.isWrapped&&B>0;)O=this.lines.get(--B),A.unshift(O);if(!c){let E=this.ybase+this.y;if(E>=B&&E<B+A.length)continue}let M=A[A.length-1].getTrimmedLength(),k=(0,d.reflowSmallerGetNewLineLengths)(A,this._cols,a),P=k.length-A.length,W;W=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);let j=[];for(let E=0;E<P;E++){let D=this.getBlankLine(l.DEFAULT_ATTR_DATA,!0);j.push(D)}j.length>0&&(C.push({start:B+A.length+T,newLines:j}),T+=j.length),A.push(...j);let q=k.length-1,F=k[q];F===0&&(q--,F=k[q]);let b=A.length-P-1,x=M;for(;b>=0;){let E=Math.min(x,F);if(A[q]===void 0)break;if(A[q].copyCellsFrom(A[b],x-E,F-E,E,!0),F-=E,F===0&&(q--,F=k[q]),x-=E,x===0){b--;let D=Math.max(b,0);x=(0,d.getWrappedLineTrimmedLength)(A,D,this._cols)}}for(let E=0;E<A.length;E++)k[E]<a&&A[E].setCell(k[E],S);let L=P-W;for(;L-- >0;)this.ybase===0?this.y<m-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-m&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+m-1)}if(C.length>0){let B=[],O=[];for(let F=0;F<this.lines.length;F++)O.push(this.lines.get(F));let A=this.lines.length,M=A-1,k=0,P=C[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let W=0;for(let F=Math.min(this.lines.maxLength-1,A+T-1);F>=0;F--)if(P&&P.start>M+W){for(let b=P.newLines.length-1;b>=0;b--)this.lines.set(F--,P.newLines[b]);F++,B.push({index:M+1,amount:P.newLines.length}),W+=P.newLines.length,P=C[++k]}else this.lines.set(F,O[M--]);let j=0;for(let F=B.length-1;F>=0;F--)B[F].index+=j,this.lines.onInsertEmitter.fire(B[F]),j+=B[F].amount;let q=Math.max(0,A+T-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(a,m,c=0,S){let C=this.lines.get(a);return C?C.translateToString(m,c,S):""}getWrappedRangeForLine(a){let m=a,c=a;for(;m>0&&this.lines.get(m).isWrapped;)m--;for(;c+1<this.lines.length&&this.lines.get(c+1).isWrapped;)c++;return{first:m,last:c}}setupTabStops(a){for(a!=null?this.tabs[a]||(a=this.prevStop(a)):(this.tabs={},a=0);a<this._cols;a+=this._optionsService.rawOptions.tabStopWidth)this.tabs[a]=!0}prevStop(a){for(a==null&&(a=this.x);!this.tabs[--a]&&a>0;);return a>=this._cols?this._cols-1:a<0?0:a}nextStop(a){for(a==null&&(a=this.x);!this.tabs[++a]&&a<this._cols;);return a>=this._cols?this._cols-1:a<0?0:a}clearMarkers(a){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].line===a&&(this.markers[m].dispose(),this.markers.splice(m--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let a=0;a<this.markers.length;a++)this.markers[a].dispose();this.markers.length=0,this._isClearing=!1}addMarker(a){let m=new i.Marker(a);return this.markers.push(m),m.register(this.lines.onTrim((c)=>{m.line-=c,m.line<0&&m.dispose()})),m.register(this.lines.onInsert((c)=>{m.line>=c.index&&(m.line+=c.amount)})),m.register(this.lines.onDelete((c)=>{m.line>=c.index&&m.line<c.index+c.amount&&m.dispose(),m.line>c.index&&(m.line-=c.amount)})),m.register(m.onDispose(()=>this._removeMarker(m))),m}_removeMarker(a){this._isClearing||this.markers.splice(this.markers.indexOf(a),1)}}},6107:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let f=o(5451),p=o(3055),_=o(8938),l=o(726);t.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let d=0;class v{constructor(n,i,w=!1){this.isWrapped=w,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);let a=i||p.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]);for(let m=0;m<n;++m)this.setCell(m,a);this.length=n}get(n){let i=this._data[3*n+0],w=2097151&i;return[this._data[3*n+1],2097152&i?this._combined[n]:w?(0,l.stringFromCodePoint)(w):"",i>>22,2097152&i?this._combined[n].charCodeAt(this._combined[n].length-1):w]}set(n,i){this._data[3*n+1]=i[_.CHAR_DATA_ATTR_INDEX],i[_.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=i[1],this._data[3*n+0]=2097152|n|i[_.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=i[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[_.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(n){return this._data[3*n+0]>>22}hasWidth(n){return 12582912&this._data[3*n+0]}getFg(n){return this._data[3*n+1]}getBg(n){return this._data[3*n+2]}hasContent(n){return 4194303&this._data[3*n+0]}getCodePoint(n){let i=this._data[3*n+0];return 2097152&i?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&i}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){let i=this._data[3*n+0];return 2097152&i?this._combined[n]:2097151&i?(0,l.stringFromCodePoint)(2097151&i):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,i){return d=3*n,i.content=this._data[d+0],i.fg=this._data[d+1],i.bg=this._data[d+2],2097152&i.content&&(i.combinedData=this._combined[n]),268435456&i.bg&&(i.extended=this._extendedAttrs[n]),i}setCell(n,i){2097152&i.content&&(this._combined[n]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[n]=i.extended),this._data[3*n+0]=i.content,this._data[3*n+1]=i.fg,this._data[3*n+2]=i.bg}setCellFromCodepoint(n,i,w,a){268435456&a.bg&&(this._extendedAttrs[n]=a.extended),this._data[3*n+0]=i|w<<22,this._data[3*n+1]=a.fg,this._data[3*n+2]=a.bg}addCodepointToCell(n,i,w){let a=this._data[3*n+0];2097152&a?this._combined[n]+=(0,l.stringFromCodePoint)(i):2097151&a?(this._combined[n]=(0,l.stringFromCodePoint)(2097151&a)+(0,l.stringFromCodePoint)(i),a&=-2097152,a|=2097152):a=i|4194304,w&&(a&=-12582913,a|=w<<22),this._data[3*n+0]=a}insertCells(n,i,w){if((n%=this.length)&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,w),i<this.length-n){let a=new p.CellData;for(let m=this.length-n-i-1;m>=0;--m)this.setCell(n+i+m,this.loadCell(n+m,a));for(let m=0;m<i;++m)this.setCell(n+m,w)}else for(let a=n;a<this.length;++a)this.setCell(a,w);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,w)}deleteCells(n,i,w){if(n%=this.length,i<this.length-n){let a=new p.CellData;for(let m=0;m<this.length-n-i;++m)this.setCell(n+m,this.loadCell(n+i+m,a));for(let m=this.length-i;m<this.length;++m)this.setCell(m,w)}else for(let a=n;a<this.length;++a)this.setCell(a,w);n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,w),this.getWidth(n)!==0||this.hasContent(n)||this.setCellFromCodepoint(n,0,1,w)}replaceCells(n,i,w,a=!1){if(a)for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodepoint(n-1,0,1,w),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,w);n<i&&n<this.length;)this.isProtected(n)||this.setCell(n,w),n++;else for(n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,w),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,w);n<i&&n<this.length;)this.setCell(n++,w)}resize(n,i){if(n===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let w=3*n;if(n>this.length){if(this._data.buffer.byteLength>=4*w)this._data=new Uint32Array(this._data.buffer,0,w);else{let a=new Uint32Array(w);a.set(this._data),this._data=a}for(let a=this.length;a<n;++a)this.setCell(a,i)}else{this._data=this._data.subarray(0,w);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let S=parseInt(a[c],10);S>=n&&delete this._combined[S]}let m=Object.keys(this._extendedAttrs);for(let c=0;c<m.length;c++){let S=parseInt(m[c],10);S>=n&&delete this._extendedAttrs[S]}}return this.length=n,4*w*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,i=!1){if(i)for(let w=0;w<this.length;++w)this.isProtected(w)||this.setCell(w,n);else{this._combined={},this._extendedAttrs={};for(let w=0;w<this.length;++w)this.setCell(w,n)}}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(let i in n._combined)this._combined[i]=n._combined[i];this._extendedAttrs={};for(let i in n._extendedAttrs)this._extendedAttrs[i]=n._extendedAttrs[i];this.isWrapped=n.isWrapped}clone(){let n=new v(0);n._data=new Uint32Array(this._data),n.length=this.length;for(let i in this._combined)n._combined[i]=this._combined[i];for(let i in this._extendedAttrs)n._extendedAttrs[i]=this._extendedAttrs[i];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0])return n+(this._data[3*n+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0]||50331648&this._data[3*n+2])return n+(this._data[3*n+0]>>22);return 0}copyCellsFrom(n,i,w,a,m){let c=n._data;if(m)for(let C=a-1;C>=0;C--){for(let T=0;T<3;T++)this._data[3*(w+C)+T]=c[3*(i+C)+T];268435456&c[3*(i+C)+2]&&(this._extendedAttrs[w+C]=n._extendedAttrs[i+C])}else for(let C=0;C<a;C++){for(let T=0;T<3;T++)this._data[3*(w+C)+T]=c[3*(i+C)+T];268435456&c[3*(i+C)+2]&&(this._extendedAttrs[w+C]=n._extendedAttrs[i+C])}let S=Object.keys(n._combined);for(let C=0;C<S.length;C++){let T=parseInt(S[C],10);T>=i&&(this._combined[T-i+w]=n._combined[T])}}translateToString(n,i,w,a){i=i??0,w=w??this.length,n&&(w=Math.min(w,this.getTrimmedLength())),a&&(a.length=0);let m="";for(;i<w;){let c=this._data[3*i+0],S=2097151&c,C=2097152&c?this._combined[i]:S?(0,l.stringFromCodePoint)(S):_.WHITESPACE_CELL_CHAR;if(m+=C,a)for(let T=0;T<C.length;++T)a.push(i);i+=c>>22||1}return a&&a.push(i),m}}t.BufferLine=v},732:(y,t)=>{function o(f,p,_){if(p===f.length-1)return f[p].getTrimmedLength();let l=!f[p].hasContent(_-1)&&f[p].getWidth(_-1)===1,d=f[p+1].getWidth(0)===2;return l&&d?_-1:_}Object.defineProperty(t,"__esModule",{value:!0}),t.reflowLargerGetLinesToRemove=function(f,p,_,l,d,v){let n=[];for(let i=0;i<f.length-1;i++){let w=i,a=f.get(++w);if(!a.isWrapped)continue;let m=[f.get(i)];for(;w<f.length&&a.isWrapped;)m.push(a),a=f.get(++w);if(!v&&l>=i&&l<w){i+=m.length-1;continue}let c=0,S=o(m,c,p),C=1,T=0;for(;C<m.length;){let O=o(m,C,p),A=O-T,M=_-S,k=Math.min(A,M);m[c].copyCellsFrom(m[C],T,S,k,!1),S+=k,S===_&&(c++,S=0),T+=k,T===O&&(C++,T=0),S===0&&c!==0&&m[c-1].getWidth(_-1)===2&&(m[c].copyCellsFrom(m[c-1],_-1,S++,1,!1),m[c-1].setCell(_-1,d))}m[c].replaceCells(S,_,d);let B=0;for(let O=m.length-1;O>0&&(O>c||m[O].getTrimmedLength()===0);O--)B++;B>0&&(n.push(i+m.length-B),n.push(B)),i+=m.length-1}return n},t.reflowLargerCreateNewLayout=function(f,p){let _=[],l=0,d=p[l],v=0;for(let n=0;n<f.length;n++)if(d===n){let i=p[++l];f.onDeleteEmitter.fire({index:n-v,amount:i}),n+=i-1,v+=i,d=p[++l]}else _.push(n);return{layout:_,countRemoved:v}},t.reflowLargerApplyNewLayout=function(f,p){let _=[];for(let l=0;l<p.length;l++)_.push(f.get(p[l]));for(let l=0;l<_.length;l++)f.set(l,_[l]);f.length=p.length},t.reflowSmallerGetNewLineLengths=function(f,p,_){let l=[],d=f.map((w,a)=>o(f,a,p)).reduce((w,a)=>w+a),v=0,n=0,i=0;for(;i<d;){if(d-i<_){l.push(d-i);break}v+=_;let w=o(f,n,p);v>w&&(v-=w,n++);let a=f[n].getWidth(v-1)===2;a&&v--;let m=a?_-1:_;l.push(m),i+=m}return l},t.getWrappedLineTrimmedLength=o},4097:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let f=o(7150),p=o(1073),_=o(802);class l extends f.Disposable{constructor(d,v){super(),this._optionsService=d,this._bufferService=v,this._onBufferActivate=this._register(new _.Emitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(d){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(d),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(d,v){this._normal.resize(d,v),this._alt.resize(d,v),this.setupTabStops(d)}setupTabStops(d){this._normal.setupTabStops(d),this._alt.setupTabStops(d)}}t.BufferSet=l},3055:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let f=o(726),p=o(8938),_=o(5451);class l extends _.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _.ExtendedAttrs,this.combinedData=""}static fromCharData(d){let v=new l;return v.setFromCharData(d),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(d){this.fg=d[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(d[p.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(d[p.CHAR_DATA_CHAR_INDEX].length===2){let n=d[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let i=d[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(n-55296)+i-56320+65536|d[p.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=d[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[p.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=d[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|d[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=l},8938:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=t.DEFAULT_COLOR<<9|256,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},8158:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let f=o(802),p=o(7150);class _{get id(){return this._id}constructor(l){this.line=l,this.isDisposed=!1,this._disposables=[],this._id=_._nextId++,this._onDispose=this.register(new f.Emitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.dispose)(this._disposables),this._disposables.length=0)}register(l){return this._disposables.push(l),l}}t.Marker=_,_._nextId=1},6760:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},t.CHARSETS.A={"#":"\xA3"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},t.CHARSETS.C=t.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},t.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},t.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},t.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},t.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},t.CHARSETS.E=t.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},t.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},t.CHARSETS.H=t.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},t.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},3534:(y,t)=>{var o,f,p;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(_){_.NUL="\x00",_.SOH="\x01",_.STX="\x02",_.ETX="\x03",_.EOT="\x04",_.ENQ="\x05",_.ACK="\x06",_.BEL="\x07",_.BS="\b",_.HT="\t",_.LF=`
|
|
4
|
-
`,_.VT="\v",_.FF="\f",_.CR="\r",_.SO="\x0E",_.SI="\x0F",_.DLE="\x10",_.DC1="\x11",_.DC2="\x12",_.DC3="\x13",_.DC4="\x14",_.NAK="\x15",_.SYN="\x16",_.ETB="\x17",_.CAN="\x18",_.EM="\x19",_.SUB="\x1A",_.ESC="\x1B",_.FS="\x1C",_.GS="\x1D",_.RS="\x1E",_.US="\x1F",_.SP=" ",_.DEL="\x7F"}(o||(t.C0=o={})),function(_){_.PAD="\x80",_.HOP="\x81",_.BPH="\x82",_.NBH="\x83",_.IND="\x84",_.NEL="\x85",_.SSA="\x86",_.ESA="\x87",_.HTS="\x88",_.HTJ="\x89",_.VTS="\x8A",_.PLD="\x8B",_.PLU="\x8C",_.RI="\x8D",_.SS2="\x8E",_.SS3="\x8F",_.DCS="\x90",_.PU1="\x91",_.PU2="\x92",_.STS="\x93",_.CCH="\x94",_.MW="\x95",_.SPA="\x96",_.EPA="\x97",_.SOS="\x98",_.SGCI="\x99",_.SCI="\x9A",_.CSI="\x9B",_.ST="\x9C",_.OSC="\x9D",_.PM="\x9E",_.APC="\x9F"}(f||(t.C1=f={})),function(_){_.ST=`${o.ESC}\\`}(p||(t.C1_ESCAPED=p={}))},726:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=void 0,t.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},t.utf32ToString=function(o,f=0,p=o.length){let _="";for(let l=f;l<p;++l){let d=o[l];d>65535?(d-=65536,_+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):_+=String.fromCharCode(d)}return _},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,f){let p=o.length;if(!p)return 0;let _=0,l=0;if(this._interim){let d=o.charCodeAt(l++);56320<=d&&d<=57343?f[_++]=1024*(this._interim-55296)+d-56320+65536:(f[_++]=this._interim,f[_++]=d),this._interim=0}for(let d=l;d<p;++d){let v=o.charCodeAt(d);if(55296<=v&&v<=56319){if(++d>=p)return this._interim=v,_;let n=o.charCodeAt(d);56320<=n&&n<=57343?f[_++]=1024*(v-55296)+n-56320+65536:(f[_++]=v,f[_++]=n)}else v!==65279&&(f[_++]=v)}return _}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,f){let p=o.length;if(!p)return 0;let _,l,d,v,n=0,i=0,w=0;if(this.interim[0]){let c=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let C,T=0;for(;(C=63&this.interim[++T])&&T<4;)S<<=6,S|=C;let B=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,O=B-T;for(;w<O;){if(w>=p)return 0;if(C=o[w++],(192&C)!=128){w--,c=!0;break}this.interim[T++]=C,S<<=6,S|=63&C}c||(B===2?S<128?w--:f[n++]=S:B===3?S<2048||S>=55296&&S<=57343||S===65279||(f[n++]=S):S<65536||S>1114111||(f[n++]=S)),this.interim.fill(0)}let a=p-4,m=w;for(;m<p;){for(;!(!(m<a)||128&(_=o[m])||128&(l=o[m+1])||128&(d=o[m+2])||128&(v=o[m+3]));)f[n++]=_,f[n++]=l,f[n++]=d,f[n++]=v,m+=4;if(_=o[m++],_<128)f[n++]=_;else if((224&_)==192){if(m>=p)return this.interim[0]=_,n;if(l=o[m++],(192&l)!=128){m--;continue}if(i=(31&_)<<6|63&l,i<128){m--;continue}f[n++]=i}else if((240&_)==224){if(m>=p)return this.interim[0]=_,n;if(l=o[m++],(192&l)!=128){m--;continue}if(m>=p)return this.interim[0]=_,this.interim[1]=l,n;if(d=o[m++],(192&d)!=128){m--;continue}if(i=(15&_)<<12|(63&l)<<6|63&d,i<2048||i>=55296&&i<=57343||i===65279)continue;f[n++]=i}else if((248&_)==240){if(m>=p)return this.interim[0]=_,n;if(l=o[m++],(192&l)!=128){m--;continue}if(m>=p)return this.interim[0]=_,this.interim[1]=l,n;if(d=o[m++],(192&d)!=128){m--;continue}if(m>=p)return this.interim[0]=_,this.interim[1]=l,this.interim[2]=d,n;if(v=o[m++],(192&v)!=128){m--;continue}if(i=(7&_)<<18|(63&l)<<12|(63&d)<<6|63&v,i<65536||i>1114111)continue;f[n++]=i}}return n}}},7428:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let f=o(6415),p=[[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]],_=[[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]],l;t.UnicodeV6=class{constructor(){if(this.version="6",!l){l=new Uint8Array(65536),l.fill(1),l[0]=0,l.fill(0,1,32),l.fill(0,127,160),l.fill(2,4352,4448),l[9001]=2,l[9002]=2,l.fill(2,11904,42192),l[12351]=1,l.fill(2,44032,55204),l.fill(2,63744,64256),l.fill(2,65040,65050),l.fill(2,65072,65136),l.fill(2,65280,65377),l.fill(2,65504,65511);for(let d=0;d<p.length;++d)l.fill(0,p[d][0],p[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?l[d]:function(v,n){let i,w=0,a=n.length-1;if(v<n[0][0]||v>n[a][1])return!1;for(;a>=w;)if(i=w+a>>1,v>n[i][1])w=i+1;else{if(!(v<n[i][0]))return!0;a=i-1}return!1}(d,_)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,v){let n=this.wcwidth(d),i=n===0&&v!==0;if(i){let w=f.UnicodeService.extractWidth(v);w===0?i=!1:w>n&&(n=w)}return f.UnicodeService.createPropertyValue(0,n,i)}}},3562:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let f=o(7150),p=o(802);class _ extends f.Disposable{constructor(l){super(),this._action=l,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new p.Emitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(l,d){if(d!==void 0&&this._syncCalls>d)return void(this._syncCalls=0);if(this._pendingData+=l.length,this._writeBuffer.push(l),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(l,d){if(this._pendingData>50000000)throw 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+=l.length,this._writeBuffer.push(l),this._callbacks.push(d),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=l.length,this._writeBuffer.push(l),this._callbacks.push(d)}_innerWrite(l=0,d=!0){let v=l||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],i=this._action(n,d);if(i){let a=(m)=>performance.now()-v>=12?setTimeout(()=>this._innerWrite(0,m)):this._innerWrite(v,m);return void i.catch((m)=>(queueMicrotask(()=>{throw m}),Promise.resolve(!1))).then(a)}let w=this._callbacks[this._bufferOffset];if(w&&w(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-v>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=_},8693:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseColor=function(_){if(!_)return;let l=_.toLowerCase();if(l.indexOf("rgb:")===0){l=l.slice(4);let d=o.exec(l);if(d){let v=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/v*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/v*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/v*255)]}}else if(l.indexOf("#")===0&&(l=l.slice(1),f.exec(l)&&[3,6,9,12].includes(l.length))){let d=l.length/3,v=[0,0,0];for(let n=0;n<3;++n){let i=parseInt(l.slice(d*n,d*n+d),16);v[n]=d===1?i<<4:d===2?i:d===3?i>>4:i>>8}return v}},t.toRgbString=function(_,l=16){let[d,v,n]=_;return`rgb:${p(d,l)}/${p(v,l)}/${p(n,l)}`};let o=/^([\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})$/,f=/^[\da-f]+$/;function p(_,l){let d=_.toString(16),v=d.length<2?"0"+d:d;switch(l){case 4:return d[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}},1263:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},9823:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let f=o(726),p=o(7262),_=o(1263),l=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=l,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}registerHandler(v,n){this._handlers[v]===void 0&&(this._handlers[v]=[]);let i=this._handlers[v];return i.push(n),{dispose:()=>{let w=i.indexOf(n);w!==-1&&i.splice(w,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=l,this._ident=0}hook(v,n){if(this.reset(),this._ident=v,this._active=this._handlers[v]||l,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(n);else this._handlerFb(this._ident,"HOOK",n)}put(v,n,i){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(v,n,i);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(v,n,i))}unhook(v,n=!0){if(this._active.length){let i=!1,w=this._active.length-1,a=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,i=n,a=this._stack.fallThrough,this._stack.paused=!1),!a&&i===!1){for(;w>=0&&(i=this._active[w].unhook(v),i!==!0);w--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,i;w--}for(;w>=0;w--)if(i=this._active[w].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",v);this._active=l,this._ident=0}};let d=new p.Params;d.addParam(0),t.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=d,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():d,this._data="",this._hitLimit=!1}put(v,n,i){this._hitLimit||(this._data+=(0,f.utf32ToString)(v,n,i),this._data.length>_.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let n=!1;if(this._hitLimit)n=!1;else if(v&&(n=this._handler(this._data,this._params),n instanceof Promise))return n.then((i)=>(this._params=d,this._data="",this._hitLimit=!1,i));return this._params=d,this._data="",this._hitLimit=!1,n}}},6717:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let f=o(7150),p=o(7262),_=o(1346),l=o(9823);class d{constructor(i){this.table=new Uint8Array(i)}setDefault(i,w){this.table.fill(i<<4|w)}add(i,w,a,m){this.table[w<<8|i]=a<<4|m}addMany(i,w,a,m){for(let c=0;c<i.length;c++)this.table[w<<8|i[c]]=a<<4|m}}t.TransitionTable=d;let v=160;t.VT500_TRANSITION_TABLE=function(){let i=new d(4095),w=Array.apply(null,Array(256)).map((T,B)=>B),a=(T,B)=>w.slice(T,B),m=a(32,127),c=a(0,24);c.push(25),c.push.apply(c,a(28,32));let S=a(0,14),C;for(C in i.setDefault(1,0),i.addMany(m,0,2,0),S)i.addMany([24,26,153,154],C,3,0),i.addMany(a(128,144),C,3,0),i.addMany(a(144,152),C,3,0),i.add(156,C,0,0),i.add(27,C,11,1),i.add(157,C,4,8),i.addMany([152,158,159],C,0,7),i.add(155,C,11,3),i.add(144,C,11,9);return i.addMany(c,0,3,0),i.addMany(c,1,3,1),i.add(127,1,0,1),i.addMany(c,8,0,8),i.addMany(c,3,3,3),i.add(127,3,0,3),i.addMany(c,4,3,4),i.add(127,4,0,4),i.addMany(c,6,3,6),i.addMany(c,5,3,5),i.add(127,5,0,5),i.addMany(c,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(m,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(a(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(m,7,0,7),i.addMany(c,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(a(64,127),3,7,0),i.addMany(a(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(a(48,60),4,8,4),i.addMany(a(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(a(32,64),6,0,6),i.add(127,6,0,6),i.addMany(a(64,127),6,0,0),i.addMany(a(32,48),3,9,5),i.addMany(a(32,48),5,9,5),i.addMany(a(48,64),5,0,6),i.addMany(a(64,127),5,7,0),i.addMany(a(32,48),4,9,5),i.addMany(a(32,48),1,9,2),i.addMany(a(32,48),2,9,2),i.addMany(a(48,127),2,10,0),i.addMany(a(48,80),1,10,0),i.addMany(a(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(a(96,127),1,10,0),i.add(80,1,11,9),i.addMany(c,9,0,9),i.add(127,9,0,9),i.addMany(a(28,32),9,0,9),i.addMany(a(32,48),9,9,12),i.addMany(a(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(c,11,0,11),i.addMany(a(32,128),11,0,11),i.addMany(a(28,32),11,0,11),i.addMany(c,10,0,10),i.add(127,10,0,10),i.addMany(a(28,32),10,0,10),i.addMany(a(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(a(32,48),10,9,12),i.addMany(c,12,0,12),i.add(127,12,0,12),i.addMany(a(28,32),12,0,12),i.addMany(a(32,48),12,9,12),i.addMany(a(48,64),12,0,11),i.addMany(a(64,127),12,12,13),i.addMany(a(64,127),10,12,13),i.addMany(a(64,127),9,12,13),i.addMany(c,13,13,13),i.addMany(m,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(v,0,2,0),i.add(v,8,5,8),i.add(v,6,0,6),i.add(v,11,0,11),i.add(v,13,13,13),i}();class n extends f.Disposable{constructor(i=t.VT500_TRANSITION_TABLE){super(),this._transitions=i,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(w,a,m)=>{},this._executeHandlerFb=(w)=>{},this._csiHandlerFb=(w,a)=>{},this._escHandlerFb=(w)=>{},this._errorHandlerFb=(w)=>w,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register((0,f.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new _.OscParser),this._dcsParser=this._register(new l.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(i,w=[64,126]){let a=0;if(i.prefix){if(i.prefix.length>1)throw Error("only one byte as prefix supported");if(a=i.prefix.charCodeAt(0),a&&60>a||a>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let c=0;c<i.intermediates.length;++c){let S=i.intermediates.charCodeAt(c);if(32>S||S>47)throw Error("intermediate must be in range 0x20 .. 0x2f");a<<=8,a|=S}}if(i.final.length!==1)throw Error("final must be a single byte");let m=i.final.charCodeAt(0);if(w[0]>m||m>w[1])throw Error(`final must be in range ${w[0]} .. ${w[1]}`);return a<<=8,a|=m,a}identToString(i){let w=[];for(;i;)w.push(String.fromCharCode(255&i)),i>>=8;return w.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,w){let a=this._identifier(i,[48,126]);this._escHandlers[a]===void 0&&(this._escHandlers[a]=[]);let m=this._escHandlers[a];return m.push(w),{dispose:()=>{let c=m.indexOf(w);c!==-1&&m.splice(c,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,w){this._executeHandlers[i.charCodeAt(0)]=w}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,w){let a=this._identifier(i);this._csiHandlers[a]===void 0&&(this._csiHandlers[a]=[]);let m=this._csiHandlers[a];return m.push(w),{dispose:()=>{let c=m.indexOf(w);c!==-1&&m.splice(c,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,w){return this._dcsParser.registerHandler(this._identifier(i),w)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,w){return this._oscParser.registerHandler(i,w)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}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(i,w,a,m,c){this._parseStack.state=i,this._parseStack.handlers=w,this._parseStack.handlerPos=a,this._parseStack.transition=m,this._parseStack.chunkPos=c}parse(i,w,a){let m,c=0,S=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(a===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let T=this._parseStack.handlers,B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(a===!1&&B>-1){for(;B>=0&&(m=T[B](this._params),m!==!0);B--)if(m instanceof Promise)return this._parseStack.handlerPos=B,m}this._parseStack.handlers=[];break;case 4:if(a===!1&&B>-1){for(;B>=0&&(m=T[B](),m!==!0);B--)if(m instanceof Promise)return this._parseStack.handlerPos=B,m}this._parseStack.handlers=[];break;case 6:if(c=i[this._parseStack.chunkPos],m=this._dcsParser.unhook(c!==24&&c!==26,a),m)return m;c===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(c=i[this._parseStack.chunkPos],m=this._oscParser.end(c!==24&&c!==26,a),m)return m;c===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=C;T<w;++T){switch(c=i[T],S=this._transitions.table[this.currentState<<8|(c<160?c:v)],S>>4){case 2:for(let k=T+1;;++k){if(k>=w||(c=i[k])<32||c>126&&c<v){this._printHandler(i,T,k),T=k-1;break}if(++k>=w||(c=i[k])<32||c>126&&c<v){this._printHandler(i,T,k),T=k-1;break}if(++k>=w||(c=i[k])<32||c>126&&c<v){this._printHandler(i,T,k),T=k-1;break}if(++k>=w||(c=i[k])<32||c>126&&c<v){this._printHandler(i,T,k),T=k-1;break}}break;case 3:this._executeHandlers[c]?this._executeHandlers[c]():this._executeHandlerFb(c),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:c,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let B=this._csiHandlers[this._collect<<8|c],O=B?B.length-1:-1;for(;O>=0&&(m=B[O](this._params),m!==!0);O--)if(m instanceof Promise)return this._preserveStack(3,B,O,S,T),m;O<0&&this._csiHandlerFb(this._collect<<8|c,this._params),this.precedingJoinState=0;break;case 8:do switch(c){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(c-48)}while(++T<w&&(c=i[T])>47&&c<60);T--;break;case 9:this._collect<<=8,this._collect|=c;break;case 10:let A=this._escHandlers[this._collect<<8|c],M=A?A.length-1:-1;for(;M>=0&&(m=A[M](),m!==!0);M--)if(m instanceof Promise)return this._preserveStack(4,A,M,S,T),m;M<0&&this._escHandlerFb(this._collect<<8|c),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|c,this._params);break;case 13:for(let k=T+1;;++k)if(k>=w||(c=i[k])===24||c===26||c===27||c>127&&c<v){this._dcsParser.put(i,T,k),T=k-1;break}break;case 14:if(m=this._dcsParser.unhook(c!==24&&c!==26),m)return this._preserveStack(6,[],0,S,T),m;c===27&&(S|=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 k=T+1;;k++)if(k>=w||(c=i[k])<32||c>127&&c<v){this._oscParser.put(i,T,k),T=k-1;break}break;case 6:if(m=this._oscParser.end(c!==24&&c!==26),m)return this._preserveStack(5,[],0,S,T),m;c===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}t.EscapeSequenceParser=n},1346:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let f=o(1263),p=o(726),_=[];t.OscParser=class{constructor(){this._state=0,this._active=_,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(l,d){this._handlers[l]===void 0&&(this._handlers[l]=[]);let v=this._handlers[l];return v.push(d),{dispose:()=>{let n=v.indexOf(d);n!==-1&&v.splice(n,1)}}}clearHandler(l){this._handlers[l]&&delete this._handlers[l]}setHandlerFallback(l){this._handlerFb=l}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}reset(){if(this._state===2)for(let l=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;l>=0;--l)this._active[l].end(!1);this._stack.paused=!1,this._active=_,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||_,this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].start();else this._handlerFb(this._id,"START")}_put(l,d,v){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(l,d,v);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(l,d,v))}start(){this.reset(),this._state=1}put(l,d,v){if(this._state!==3){if(this._state===1)for(;d<v;){let n=l[d++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&v-d>0&&this._put(l,d,v)}}end(l,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,v=d,i=this._stack.fallThrough,this._stack.paused=!1),!i&&v===!1){for(;n>=0&&(v=this._active[n].end(l),v!==!0);n--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,v;n--}for(;n>=0;n--)if(v=this._active[n].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",l);this._active=_,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(l){this._handler=l,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(l,d,v){this._hitLimit||(this._data+=(0,p.utf32ToString)(l,d,v),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(l){let d=!1;if(this._hitLimit)d=!1;else if(l&&(d=this._handler(this._data),d instanceof Promise))return d.then((v)=>(this._data="",this._hitLimit=!1,v));return this._data="",this._hitLimit=!1,d}}},7262:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let o=2147483647;class f{static fromArray(p){let _=new f;if(!p.length)return _;for(let l=Array.isArray(p[0])?1:0;l<p.length;++l){let d=p[l];if(Array.isArray(d))for(let v=0;v<d.length;++v)_.addSubParam(d[v]);else _.addParam(d)}return _}constructor(p=32,_=32){if(this.maxLength=p,this.maxSubParamsLength=_,_>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let p=new f(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){let p=[];for(let _=0;_<this.length;++_){p.push(this.params[_]);let l=this._subParamsIdx[_]>>8,d=255&this._subParamsIdx[_];d-l>0&&p.push(Array.prototype.slice.call(this._subParams,l,d))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>o?o:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>o?o:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){let _=this._subParamsIdx[p]>>8,l=255&this._subParamsIdx[p];return l-_>0?this._subParams.subarray(_,l):null}getSubParamsAll(){let p={};for(let _=0;_<this.length;++_){let l=this._subParamsIdx[_]>>8,d=255&this._subParamsIdx[_];d-l>0&&(p[_]=this._subParams.slice(l,d))}return p}addDigit(p){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let l=this._digitIsSub?this._subParams:this.params,d=l[_-1];l[_-1]=~d?Math.min(10*d+p,o):p}}t.Params=f},3027:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,f){let p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let f=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===o){f=p;break}if(f===-1)throw Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(f,1)}}},3235:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let f=o(793),p=o(3055);t.BufferApiView=class{constructor(_,l){this._buffer=_,this.type=l}init(_){return this._buffer=_,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(_){let l=this._buffer.lines.get(_);if(l)return new f.BufferLineApiView(l)}getNullCell(){return new p.CellData}}},793:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let f=o(3055);t.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,_){if(!(p<0||p>=this._line.length))return _?(this._line.loadCell(p,_),_):this._line.loadCell(p,new f.CellData)}translateToString(p,_,l){return this._line.translateToString(p,_,l)}}},5101:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let f=o(3235),p=o(7150),_=o(802);class l extends p.Disposable{constructor(d){super(),this._core=d,this._onBufferChange=this._register(new _.Emitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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 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)}}t.BufferNamespaceApi=l},6097:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,f){return this._core.registerCsiHandler(o,(p)=>f(p.toArray()))}addCsiHandler(o,f){return this.registerCsiHandler(o,f)}registerDcsHandler(o,f){return this._core.registerDcsHandler(o,(p,_)=>f(p,_.toArray()))}addDcsHandler(o,f){return this.registerDcsHandler(o,f)}registerEscHandler(o,f){return this._core.registerEscHandler(o,f)}addEscHandler(o,f){return this.registerEscHandler(o,f)}registerOscHandler(o,f){return this._core.registerOscHandler(o,f)}addOscHandler(o,f){return this.registerOscHandler(o,f)}}},4335:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},9640:function(y,t,o){var f=this&&this.__decorate||function(i,w,a,m){var c,S=arguments.length,C=S<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,a):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,w,a,m);else for(var T=i.length-1;T>=0;T--)(c=i[T])&&(C=(S<3?c(C):S>3?c(w,a,C):c(w,a))||C);return S>3&&C&&Object.defineProperty(w,a,C),C},p=this&&this.__param||function(i,w){return function(a,m){w(a,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let _=o(7150),l=o(4097),d=o(6501),v=o(802);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let n=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this._register(new v.Emitter),this.onResize=this._onResize.event,this._onScroll=this._register(new v.Emitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this._register(new l.BufferSet(i,this)),this._register(this.buffers.onBufferActivate((w)=>{this._onScroll.fire(w.activeBuffer.ydisp)}))}resize(i,w){let a=this.cols!==i,m=this.rows!==w;this.cols=i,this.rows=w,this.buffers.resize(i,w),this._onResize.fire({cols:i,rows:w,colsChanged:a,rowsChanged:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,w=!1){let a=this.buffer,m;m=this._cachedBlankLine,m&&m.length===this.cols&&m.getFg(0)===i.fg&&m.getBg(0)===i.bg||(m=a.getBlankLine(i,w),this._cachedBlankLine=m),m.isWrapped=w;let c=a.ybase+a.scrollTop,S=a.ybase+a.scrollBottom;if(a.scrollTop===0){let C=a.lines.isFull;S===a.lines.length-1?C?a.lines.recycle().copyFrom(m):a.lines.push(m.clone()):a.lines.splice(S+1,0,m.clone()),C?this.isUserScrolling&&(a.ydisp=Math.max(a.ydisp-1,0)):(a.ybase++,this.isUserScrolling||a.ydisp++)}else{let C=S-c+1;a.lines.shiftElements(c+1,C-1,-1),a.lines.set(S,m.clone())}this.isUserScrolling||(a.ydisp=a.ybase),this._onScroll.fire(a.ydisp)}scrollLines(i,w){let a=this.buffer;if(i<0){if(a.ydisp===0)return;this.isUserScrolling=!0}else i+a.ydisp>=a.ybase&&(this.isUserScrolling=!1);let m=a.ydisp;a.ydisp=Math.max(Math.min(a.ydisp+i,a.ybase),0),m!==a.ydisp&&(w||this._onScroll.fire(a.ydisp))}};t.BufferService=n,t.BufferService=n=f([p(0,d.IOptionsService)],n)},5746:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,f){this._charsets[o]=f,this.glevel===o&&(this.charset=f)}}},7792:function(y,t,o){var f=this&&this.__decorate||function(m,c,S,C){var T,B=arguments.length,O=B<3?c:C===null?C=Object.getOwnPropertyDescriptor(c,S):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(m,c,S,C);else for(var A=m.length-1;A>=0;A--)(T=m[A])&&(O=(B<3?T(O):B>3?T(c,S,O):T(c,S))||O);return B>3&&O&&Object.defineProperty(c,S,O),O},p=this&&this.__param||function(m,c){return function(S,C){c(S,C,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let _=o(6501),l=o(7150),d=o(802),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(m)=>m.button!==4&&m.action===1&&(m.ctrl=!1,m.alt=!1,m.shift=!1,!0)},VT200:{events:19,restrict:(m)=>m.action!==32},DRAG:{events:23,restrict:(m)=>m.action!==32||m.button!==3},ANY:{events:31,restrict:(m)=>!0}};function n(m,c){let S=(m.ctrl?16:0)|(m.shift?4:0)|(m.alt?8:0);return m.button===4?(S|=64,S|=m.action):(S|=3&m.button,4&m.button&&(S|=64),8&m.button&&(S|=128),m.action===32?S|=32:m.action!==0||c||(S|=3)),S}let i=String.fromCharCode,w={DEFAULT:(m)=>{let c=[n(m,!1)+32,m.col+32,m.row+32];return c[0]>255||c[1]>255||c[2]>255?"":`\x1B[M${i(c[0])}${i(c[1])}${i(c[2])}`},SGR:(m)=>{let c=m.action===0&&m.button!==4?"m":"M";return`\x1B[<${n(m,!0)};${m.col};${m.row}${c}`},SGR_PIXELS:(m)=>{let c=m.action===0&&m.button!==4?"m":"M";return`\x1B[<${n(m,!0)};${m.x};${m.y}${c}`}},a=class extends l.Disposable{constructor(m,c,S){super(),this._bufferService=m,this._coreService=c,this._optionsService=S,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new d.Emitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(v))this.addProtocol(C,v[C]);for(let C of Object.keys(w))this.addEncoding(C,w[C]);this.reset()}addProtocol(m,c){this._protocols[m]=c}addEncoding(m,c){this._encodings[m]=c}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(m){if(!this._protocols[m])throw Error(`unknown protocol "${m}"`);this._activeProtocol=m,this._onProtocolChange.fire(this._protocols[m].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(m){if(!this._encodings[m])throw Error(`unknown encoding "${m}"`);this._activeEncoding=m}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(m,c,S){if(m.deltaY===0||m.shiftKey)return 0;if(c===void 0||S===void 0)return 0;let C=c/S,T=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(T/=C+0,Math.abs(m.deltaY)<50&&(T*=0.3),this._wheelPartialScroll+=T,T=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(T*=this._bufferService.rows),T}_applyScrollModifier(m,c){return c.altKey||c.ctrlKey||c.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(m){if(m.col<0||m.col>=this._bufferService.cols||m.row<0||m.row>=this._bufferService.rows)return!1;if(m.button===4&&m.action===32)return!1;if(m.button===3&&m.action!==32)return!1;if(m.button!==4&&(m.action===2||m.action===3))return!1;if(m.col++,m.row++,m.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,m,this._activeEncoding==="SGR_PIXELS"))return!1;if(!this._protocols[this._activeProtocol].restrict(m))return!1;let c=this._encodings[this._activeEncoding](m);return c&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(c):this._coreService.triggerDataEvent(c,!0)),this._lastEvent=m,!0}explainEvents(m){return{down:!!(1&m),up:!!(2&m),drag:!!(4&m),move:!!(8&m),wheel:!!(16&m)}}_equalEvents(m,c,S){if(S){if(m.x!==c.x)return!1;if(m.y!==c.y)return!1}else{if(m.col!==c.col)return!1;if(m.row!==c.row)return!1}return m.button===c.button&&m.action===c.action&&m.ctrl===c.ctrl&&m.alt===c.alt&&m.shift===c.shift}};t.CoreMouseService=a,t.CoreMouseService=a=f([p(0,_.IBufferService),p(1,_.ICoreService),p(2,_.IOptionsService)],a)},4071:function(y,t,o){var f=this&&this.__decorate||function(a,m,c,S){var C,T=arguments.length,B=T<3?m:S===null?S=Object.getOwnPropertyDescriptor(m,c):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(a,m,c,S);else for(var O=a.length-1;O>=0;O--)(C=a[O])&&(B=(T<3?C(B):T>3?C(m,c,B):C(m,c))||B);return T>3&&B&&Object.defineProperty(m,c,B),B},p=this&&this.__param||function(a,m){return function(c,S){m(c,S,a)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let _=o(7453),l=o(7150),d=o(6501),v=o(802),n=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),w=class extends l.Disposable{constructor(a,m,c){super(),this._bufferService=a,this._logService=m,this._optionsService=c,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new v.Emitter),this.onData=this._onData.event,this._onUserInput=this._register(new v.Emitter),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new v.Emitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new v.Emitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,_.clone)(n),this.decPrivateModes=(0,_.clone)(i)}reset(){this.modes=(0,_.clone)(n),this.decPrivateModes=(0,_.clone)(i)}triggerDataEvent(a,m=!1){if(this._optionsService.rawOptions.disableStdin)return;let c=this._bufferService.buffer;m&&this._optionsService.rawOptions.scrollOnUserInput&&c.ybase!==c.ydisp&&this._onRequestScrollToBottom.fire(),m&&this._onUserInput.fire(),this._logService.debug(`sending data "${a}"`),this._logService.trace("sending data (codes)",()=>a.split("").map((S)=>S.charCodeAt(0))),this._onData.fire(a)}triggerBinaryEvent(a){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${a}"`),this._logService.trace("sending binary (codes)",()=>a.split("").map((m)=>m.charCodeAt(0))),this._onBinary.fire(a))}};t.CoreService=w,t.CoreService=w=f([p(0,d.IBufferService),p(1,d.ILogService),p(2,d.IOptionsService)],w)},6025:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let f=o(6501),p=o(6201);class _{constructor(...l){this._entries=new Map;for(let[d,v]of l)this.set(d,v)}set(l,d){let v=this._entries.get(l);return this._entries.set(l,d),v}forEach(l){for(let[d,v]of this._entries.entries())l(d,v)}has(l){return this._entries.has(l)}get(l){return this._entries.get(l)}}t.ServiceCollection=_,t.InstantiationService=class{constructor(){this._services=new _,this._services.set(f.IInstantiationService,this)}setService(l,d){this._services.set(l,d)}getService(l){return this._services.get(l)}createInstance(l,...d){let v=(0,p.getServiceDependencies)(l).sort((w,a)=>w.index-a.index),n=[];for(let w of v){let a=this._services.get(w.id);if(!a)throw Error(`[createInstance] ${l.name} depends on UNKNOWN service ${w.id._id}.`);n.push(a)}let i=v.length>0?v[0].index:d.length;if(d.length!==i)throw Error(`[createInstance] First service dependency of ${l.name} at position ${i+1} conflicts with ${d.length} static arguments`);return new l(...[...d,...n])}}},7276:function(y,t,o){var f=this&&this.__decorate||function(i,w,a,m){var c,S=arguments.length,C=S<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,a):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,w,a,m);else for(var T=i.length-1;T>=0;T--)(c=i[T])&&(C=(S<3?c(C):S>3?c(w,a,C):c(w,a))||C);return S>3&&C&&Object.defineProperty(w,a,C),C},p=this&&this.__param||function(i,w){return function(a,m){w(a,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=void 0,t.setTraceLogger=function(i){v=i},t.traceCall=function(i,w,a){if(typeof a.value!="function")throw Error("not supported");let m=a.value;a.value=function(...c){if(v.logLevel!==l.LogLevelEnum.TRACE)return m.apply(this,c);v.trace(`GlyphRenderer#${m.name}(${c.map((C)=>JSON.stringify(C)).join(", ")})`);let S=m.apply(this,c);return v.trace(`GlyphRenderer#${m.name} return`,S),S}};let _=o(7150),l=o(6501),d={trace:l.LogLevelEnum.TRACE,debug:l.LogLevelEnum.DEBUG,info:l.LogLevelEnum.INFO,warn:l.LogLevelEnum.WARN,error:l.LogLevelEnum.ERROR,off:l.LogLevelEnum.OFF},v,n=class extends _.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=l.LogLevelEnum.OFF,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),v=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let w=0;w<i.length;w++)typeof i[w]=="function"&&(i[w]=i[w]())}_log(i,w,a){this._evalLazyOptionalParams(a),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+w,...a)}trace(i,...w){this._logLevel<=l.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,w)}debug(i,...w){this._logLevel<=l.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,w)}info(i,...w){this._logLevel<=l.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,w)}warn(i,...w){this._logLevel<=l.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,w)}error(i,...w){this._logLevel<=l.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,w)}};t.LogService=n,t.LogService=n=f([p(0,l.IOptionsService)],n)},56:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let f=o(7150),p=o(701),_=o(802);t.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:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}};let l=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends f.Disposable{constructor(v){super(),this._onOptionChange=this._register(new _.Emitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let i in v)if(i in n)try{let w=v[i];n[i]=this._sanitizeAndValidateOption(i,w)}catch(w){console.error(w)}this.rawOptions=n,this.options={...n},this._setupOptions(),this._register((0,f.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(v,n){return this.onOptionChange((i)=>{i===v&&n(this.rawOptions[v])})}onMultipleOptionChange(v,n){return this.onOptionChange((i)=>{v.indexOf(i)!==-1&&n()})}_setupOptions(){let v=(i)=>{if(!(i in t.DEFAULT_OPTIONS))throw Error(`No option with key "${i}"`);return this.rawOptions[i]},n=(i,w)=>{if(!(i in t.DEFAULT_OPTIONS))throw Error(`No option with key "${i}"`);w=this._sanitizeAndValidateOption(i,w),this.rawOptions[i]!==w&&(this.rawOptions[i]=w,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let w={get:v.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this.options,i,w)}}_sanitizeAndValidateOption(v,n){switch(v){case"cursorStyle":if(n||(n=t.DEFAULT_OPTIONS[v]),!function(i){return i==="block"||i==="underline"||i==="bar"}(n))throw Error(`"${n}" is not a valid value for ${v}`);break;case"wordSeparator":n||(n=t.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof n=="number"&&1<=n&&n<=1000)break;n=l.includes(n)?n:t.DEFAULT_OPTIONS[v];break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw Error(`${v} cannot be less than 1, value: ${n}`);break;case"minimumContrastRatio":n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case"scrollback":if((n=Math.min(n,4294967295))<0)throw Error(`${v} cannot be less than 0, value: ${n}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw Error(`${v} cannot be less than or equal to 0, value: ${n}`);break;case"rows":case"cols":if(!n&&n!==0)throw Error(`${v} must be numeric, value: ${n}`);break;case"windowsPty":n=n??{}}return n}}t.OptionsService=d},8811:function(y,t,o){var f=this&&this.__decorate||function(d,v,n,i){var w,a=arguments.length,m=a<3?v:i===null?i=Object.getOwnPropertyDescriptor(v,n):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(d,v,n,i);else for(var c=d.length-1;c>=0;c--)(w=d[c])&&(m=(a<3?w(m):a>3?w(v,n,m):w(v,n))||m);return a>3&&m&&Object.defineProperty(v,n,m),m},p=this&&this.__param||function(d,v){return function(n,i){v(n,i,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let _=o(6501),l=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){let v=this._bufferService.buffer;if(d.id===void 0){let c=v.addMarker(v.ybase+v.y),S={data:d,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(S,c)),this._dataByLinkId.set(S.id,S),S.id}let n=d,i=this._getEntryIdKey(n),w=this._entriesWithId.get(i);if(w)return this.addLineToLink(w.id,v.ybase+v.y),w.id;let a=v.addMarker(v.ybase+v.y),m={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(m,a)),this._entriesWithId.set(m.key,m),this._dataByLinkId.set(m.id,m),m.id}addLineToLink(d,v){let n=this._dataByLinkId.get(d);if(n&&n.lines.every((i)=>i.line!==v)){let i=this._bufferService.buffer.addMarker(v);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(d){return this._dataByLinkId.get(d)?.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,v){let n=d.lines.indexOf(v);n!==-1&&(d.lines.splice(n,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};t.OscLinkService=l,t.OscLinkService=l=f([p(0,_.IBufferService)],l)},6201:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.serviceRegistry=void 0,t.getServiceDependencies=function(p){return p[f]||[]},t.createDecorator=function(p){if(t.serviceRegistry.has(p))return t.serviceRegistry.get(p);let _=function(l,d,v){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");(function(n,i,w){i[o]===i?i[f].push({id:n,index:w}):(i[f]=[{id:n,index:w}],i[o]=i)})(_,l,v)};return _._id=p,t.serviceRegistry.set(p,_),_};let o="di$target",f="di$dependencies";t.serviceRegistry=new Map},6501:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let f=o(6201);var p;t.IBufferService=(0,f.createDecorator)("BufferService"),t.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),t.ICoreService=(0,f.createDecorator)("CoreService"),t.ICharsetService=(0,f.createDecorator)("CharsetService"),t.IInstantiationService=(0,f.createDecorator)("InstantiationService"),function(_){_[_.TRACE=0]="TRACE",_[_.DEBUG=1]="DEBUG",_[_.INFO=2]="INFO",_[_.WARN=3]="WARN",_[_.ERROR=4]="ERROR",_[_.OFF=5]="OFF"}(p||(t.LogLevelEnum=p={})),t.ILogService=(0,f.createDecorator)("LogService"),t.IOptionsService=(0,f.createDecorator)("OptionsService"),t.IOscLinkService=(0,f.createDecorator)("OscLinkService"),t.IUnicodeService=(0,f.createDecorator)("UnicodeService"),t.IDecorationService=(0,f.createDecorator)("DecorationService")},6415:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let f=o(7428),p=o(802);class _{static extractShouldJoin(l){return!!(1&l)}static extractWidth(l){return l>>1&3}static extractCharKind(l){return l>>3}static createPropertyValue(l,d,v=!1){return(16777215&l)<<3|(3&d)<<1|(v?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.Emitter,this.onChange=this._onChange.event;let l=new f.UnicodeV6;this.register(l),this._active=l.version,this._activeProvider=l}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(l){if(!this._providers[l])throw Error(`unknown Unicode version "${l}"`);this._active=l,this._activeProvider=this._providers[l],this._onChange.fire(l)}register(l){this._providers[l.version]=l}wcwidth(l){return this._activeProvider.wcwidth(l)}getStringCellWidth(l){let d=0,v=0,n=l.length;for(let i=0;i<n;++i){let w=l.charCodeAt(i);if(55296<=w&&w<=56319){if(++i>=n)return d+this.wcwidth(w);let c=l.charCodeAt(i);56320<=c&&c<=57343?w=1024*(w-55296)+c-56320+65536:d+=this.wcwidth(c)}let a=this.charProperties(w,v),m=_.extractWidth(a);_.extractShouldJoin(a)&&(m-=_.extractWidth(v)),d+=m,v=a}return d}charProperties(l,d){return this._activeProvider.charProperties(l,d)}}t.UnicodeService=_},5856:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let f=o(6107),p=o(5777),_=o(802);class l extends p.CoreTerminal{constructor(d={}){super(d),this._onBell=this._register(new _.Emitter),this.onBell=this._onBell.event,this._onCursorMove=this._register(new _.Emitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this._register(new _.Emitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this._register(new _.Emitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this._register(new _.Emitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this._register(this._inputHandler.onRequestBell(()=>this.bell())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(_.Event.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(_.Event.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(_.Event.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(_.Event.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(d){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+d)}bell(){this._onBell.fire()}input(d,v=!0){this.coreService.triggerDataEvent(d,v)}resize(d,v){d===this.cols&&v===this.rows||super.resize(d,v)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let d=1;d<this.rows;d++)this.buffer.lines.push(this.buffer.getBlankLine(f.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}t.Terminal=l},3058:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Permutation=t.CallbackIterable=t.ArrayQueue=t.booleanComparator=t.numberComparator=t.CompareResult=void 0,t.tail=function(c,S=0){return c[c.length-(1+S)]},t.tail2=function(c){if(c.length===0)throw Error("Invalid tail call");return[c.slice(0,c.length-1),c[c.length-1]]},t.equals=function(c,S,C=(T,B)=>T===B){if(c===S)return!0;if(!c||!S)return!1;if(c.length!==S.length)return!1;for(let T=0,B=c.length;T<B;T++)if(!C(c[T],S[T]))return!1;return!0},t.removeFastWithoutKeepingOrder=function(c,S){let C=c.length-1;S<C&&(c[S]=c[C]),c.pop()},t.binarySearch=function(c,S,C){return _(c.length,(T)=>C(c[T],S))},t.binarySearch2=_,t.quickSelect=function c(S,C,T){if((S|=0)>=C.length)throw TypeError("invalid index");let B=C[Math.floor(C.length*Math.random())],O=[],A=[],M=[];for(let k of C){let P=T(k,B);P<0?O.push(k):P>0?A.push(k):M.push(k)}return S<O.length?c(S,O,T):S<O.length+M.length?M[0]:c(S-(O.length+M.length),A,T)},t.groupBy=function(c,S){let C=[],T;for(let B of c.slice(0).sort(S))T&&S(T[0],B)===0?T.push(B):(T=[B],C.push(T));return C},t.groupAdjacentBy=function*(c,S){let C,T;for(let B of c)T!==void 0&&S(T,B)?C.push(B):(C&&(yield C),C=[B]),T=B;C&&(yield C)},t.forEachAdjacent=function(c,S){for(let C=0;C<=c.length;C++)S(C===0?void 0:c[C-1],C===c.length?void 0:c[C])},t.forEachWithNeighbors=function(c,S){for(let C=0;C<c.length;C++)S(C===0?void 0:c[C-1],c[C],C+1===c.length?void 0:c[C+1])},t.sortedDiff=l,t.delta=function(c,S,C){let T=l(c,S,C),B=[],O=[];for(let A of T)B.push(...c.slice(A.start,A.start+A.deleteCount)),O.push(...A.toInsert);return{removed:B,added:O}},t.top=function(c,S,C){if(C===0)return[];let T=c.slice(0,C).sort(S);return d(c,S,T,C,c.length),T},t.topAsync=function(c,S,C,T,B){return C===0?Promise.resolve([]):new Promise((O,A)=>{(async()=>{let M=c.length,k=c.slice(0,C).sort(S);for(let P=C,W=Math.min(C+T,M);P<M;P=W,W=Math.min(W+T,M)){if(P>C&&await new Promise((j)=>setTimeout(j)),B&&B.isCancellationRequested)throw new f.CancellationError;d(c,S,k,P,W)}return k})().then(O,A)})},t.coalesce=function(c){return c.filter((S)=>!!S)},t.coalesceInPlace=function(c){let S=0;for(let C=0;C<c.length;C++)c[C]&&(c[S]=c[C],S+=1);c.length=S},t.move=function(c,S,C){c.splice(C,0,c.splice(S,1)[0])},t.isFalsyOrEmpty=function(c){return!Array.isArray(c)||c.length===0},t.isNonEmptyArray=function(c){return Array.isArray(c)&&c.length>0},t.distinct=function(c,S=(C)=>C){let C=new Set;return c.filter((T)=>{let B=S(T);return!C.has(B)&&(C.add(B),!0)})},t.uniqueFilter=function(c){let S=new Set;return(C)=>{let T=c(C);return!S.has(T)&&(S.add(T),!0)}},t.firstOrDefault=function(c,S){return c.length>0?c[0]:S},t.lastOrDefault=function(c,S){return c.length>0?c[c.length-1]:S},t.commonPrefixLength=function(c,S,C=(T,B)=>T===B){let T=0;for(let B=0,O=Math.min(c.length,S.length);B<O&&C(c[B],S[B]);B++)T++;return T},t.range=function(c,S){let C=typeof S=="number"?c:0;typeof S=="number"?C=c:(C=0,S=c);let T=[];if(C<=S)for(let B=C;B<S;B++)T.push(B);else for(let B=C;B>S;B--)T.push(B);return T},t.index=function(c,S,C){return c.reduce((T,B)=>(T[S(B)]=C?C(B):B,T),Object.create(null))},t.insert=function(c,S){return c.push(S),()=>v(c,S)},t.remove=v,t.arrayInsert=function(c,S,C){let T=c.slice(0,S),B=c.slice(S);return T.concat(C,B)},t.shuffle=function(c,S){let C;if(typeof S=="number"){let T=S;C=()=>{let B=179426549*Math.sin(T++);return B-Math.floor(B)}}else C=Math.random;for(let T=c.length-1;T>0;T-=1){let B=Math.floor(C()*(T+1)),O=c[T];c[T]=c[B],c[B]=O}},t.pushToStart=function(c,S){let C=c.indexOf(S);C>-1&&(c.splice(C,1),c.unshift(S))},t.pushToEnd=function(c,S){let C=c.indexOf(S);C>-1&&(c.splice(C,1),c.push(S))},t.pushMany=function(c,S){for(let C of S)c.push(C)},t.mapArrayOrNot=function(c,S){return Array.isArray(c)?c.map(S):S(c)},t.asArray=function(c){return Array.isArray(c)?c:[c]},t.getRandomElement=function(c){return c[Math.floor(Math.random()*c.length)]},t.insertInto=n,t.splice=function(c,S,C,T){let B=i(c,S),O=c.splice(B,C);return O===void 0&&(O=[]),n(c,B,T),O},t.compareBy=function(c,S){return(C,T)=>S(c(C),c(T))},t.tieBreakComparators=function(...c){return(S,C)=>{for(let T of c){let B=T(S,C);if(!w.isNeitherLessOrGreaterThan(B))return B}return w.neitherLessOrGreaterThan}},t.reverseOrder=function(c){return(S,C)=>-c(S,C)};let f=o(9807),p=o(8297);function _(c,S){let C=0,T=c-1;for(;C<=T;){let B=(C+T)/2|0,O=S(B);if(O<0)C=B+1;else{if(!(O>0))return B;T=B-1}}return-(C+1)}function l(c,S,C){let T=[];function B(M,k,P){if(k===0&&P.length===0)return;let W=T[T.length-1];W&&W.start+W.deleteCount===M?(W.deleteCount+=k,W.toInsert.push(...P)):T.push({start:M,deleteCount:k,toInsert:P})}let O=0,A=0;for(;;){if(O===c.length){B(O,0,S.slice(A));break}if(A===S.length){B(O,c.length-O,[]);break}let M=c[O],k=S[A],P=C(M,k);P===0?(O+=1,A+=1):P<0?(B(O,1,[]),O+=1):P>0&&(B(O,0,[k]),A+=1)}return T}function d(c,S,C,T,B){for(let O=C.length;T<B;T++){let A=c[T];if(S(A,C[O-1])<0){C.pop();let M=(0,p.findFirstIdxMonotonousOrArrLen)(C,(k)=>S(A,k)<0);C.splice(M,0,A)}}}function v(c,S){let C=c.indexOf(S);if(C>-1)return c.splice(C,1),S}function n(c,S,C){let T=i(c,S),B=c.length,O=C.length;c.length=B+O;for(let A=B-1;A>=T;A--)c[A+O]=c[A];for(let A=0;A<O;A++)c[A+T]=C[A]}function i(c,S){return S<0?Math.max(S+c.length,0):Math.min(S,c.length)}var w;(function(c){c.isLessThan=function(S){return S<0},c.isLessThanOrEqual=function(S){return S<=0},c.isGreaterThan=function(S){return S>0},c.isNeitherLessOrGreaterThan=function(S){return S===0},c.greaterThan=1,c.lessThan=-1,c.neitherLessOrGreaterThan=0})(w||(t.CompareResult=w={})),t.numberComparator=(c,S)=>c-S,t.booleanComparator=(c,S)=>(0,t.numberComparator)(c?1:0,S?1:0),t.ArrayQueue=class{constructor(c){this.items=c,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(c){let S=this.firstIdx;for(;S<this.items.length&&c(this.items[S]);)S++;let C=S===this.firstIdx?null:this.items.slice(this.firstIdx,S);return this.firstIdx=S,C}takeFromEndWhile(c){let S=this.lastIdx;for(;S>=0&&c(this.items[S]);)S--;let C=S===this.lastIdx?null:this.items.slice(S+1,this.lastIdx+1);return this.lastIdx=S,C}peek(){if(this.length!==0)return this.items[this.firstIdx]}peekLast(){if(this.length!==0)return this.items[this.lastIdx]}dequeue(){let c=this.items[this.firstIdx];return this.firstIdx++,c}removeLast(){let c=this.items[this.lastIdx];return this.lastIdx--,c}takeCount(c){let S=this.items.slice(this.firstIdx,this.firstIdx+c);return this.firstIdx+=c,S}};class a{static{this.empty=new a((c)=>{})}constructor(c){this.iterate=c}forEach(c){this.iterate((S)=>(c(S),!0))}toArray(){let c=[];return this.iterate((S)=>(c.push(S),!0)),c}filter(c){return new a((S)=>this.iterate((C)=>!c(C)||S(C)))}map(c){return new a((S)=>this.iterate((C)=>S(c(C))))}some(c){let S=!1;return this.iterate((C)=>(S=c(C),!S)),S}findFirst(c){let S;return this.iterate((C)=>!c(C)||(S=C,!1)),S}findLast(c){let S;return this.iterate((C)=>(c(C)&&(S=C),!0)),S}findLastMaxBy(c){let S,C=!0;return this.iterate((T)=>((C||w.isGreaterThan(c(T,S)))&&(C=!1,S=T),!0)),S}}t.CallbackIterable=a;class m{constructor(c){this._indexMap=c}static createSortPermutation(c,S){let C=Array.from(c.keys()).sort((T,B)=>S(c[T],c[B]));return new m(C)}apply(c){return c.map((S,C)=>c[this._indexMap[C]])}inverse(){let c=this._indexMap.slice();for(let S=0;S<this._indexMap.length;S++)c[this._indexMap[S]]=S;return new m(c)}}t.Permutation=m},8297:(y,t)=>{function o(d,v,n=d.length-1){for(let i=n;i>=0;i--)if(v(d[i]))return i;return-1}function f(d,v,n=0,i=d.length){let w=n,a=i;for(;w<a;){let m=Math.floor((w+a)/2);v(d[m])?w=m+1:a=m}return w-1}function p(d,v,n=0,i=d.length){let w=n,a=i;for(;w<a;){let m=Math.floor((w+a)/2);v(d[m])?a=m:w=m+1}return w}Object.defineProperty(t,"__esModule",{value:!0}),t.MonotonousArray=void 0,t.findLast=function(d,v){let n=o(d,v);if(n!==-1)return d[n]},t.findLastIdx=o,t.findLastMonotonous=function(d,v){let n=f(d,v);return n===-1?void 0:d[n]},t.findLastIdxMonotonous=f,t.findFirstMonotonous=function(d,v){let n=p(d,v);return n===d.length?void 0:d[n]},t.findFirstIdxMonotonousOrArrLen=p,t.findFirstIdxMonotonous=function(d,v,n=0,i=d.length){let w=p(d,v,n,i);return w===d.length?-1:w},t.findFirstMax=l,t.findLastMax=function(d,v){if(d.length===0)return;let n=d[0];for(let i=1;i<d.length;i++){let w=d[i];v(w,n)>=0&&(n=w)}return n},t.findFirstMin=function(d,v){return l(d,(n,i)=>-v(n,i))},t.findMaxIdx=function(d,v){if(d.length===0)return-1;let n=0;for(let i=1;i<d.length;i++)v(d[i],d[n])>0&&(n=i);return n},t.mapFindFirst=function(d,v){for(let n of d){let i=v(n);if(i!==void 0)return i}};class _{static{this.assertInvariants=!1}constructor(d){this._array=d,this._findLastMonotonousLastIdx=0}findLastMonotonous(d){if(_.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!d(n))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=d}let v=f(this._array,d,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=v+1,v===-1?void 0:this._array[v]}}function l(d,v){if(d.length===0)return;let n=d[0];for(let i=1;i<d.length;i++){let w=d[i];v(w,n)>0&&(n=w)}return n}t.MonotonousArray=_},9087:(y,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.SetWithKey=void 0,t.groupBy=function(p,_){let l=Object.create(null);for(let d of p){let v=_(d),n=l[v];n||(n=l[v]=[]),n.push(d)}return l},t.diffSets=function(p,_){let l=[],d=[];for(let v of p)_.has(v)||l.push(v);for(let v of _)p.has(v)||d.push(v);return{removed:l,added:d}},t.diffMaps=function(p,_){let l=[],d=[];for(let[v,n]of p)_.has(v)||l.push(n);for(let[v,n]of _)p.has(v)||d.push(n);return{removed:l,added:d}},t.intersection=function(p,_){let l=new Set;for(let d of _)p.has(d)&&l.add(d);return l};class f{static{o=Symbol.toStringTag}constructor(p,_){this.toKey=_,this._map=new Map,this[o]="SetWithKey";for(let l of p)this.add(l)}get size(){return this._map.size}add(p){let _=this.toKey(p);return this._map.set(_,p),this}delete(p){return this._map.delete(this.toKey(p))}has(p){return this._map.has(this.toKey(p))}*entries(){for(let p of this._map.values())yield[p,p]}keys(){return this.values()}*values(){for(let p of this._map.values())yield p}clear(){this._map.clear()}forEach(p,_){this._map.forEach((l)=>p.call(_,l,l,this))}[Symbol.iterator](){return this.values()}}t.SetWithKey=f},9807:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BugIndicatingError=t.ErrorNoTelemetry=t.ExpectedError=t.NotSupportedError=t.NotImplementedError=t.ReadonlyError=t.CancellationError=t.errorHandler=t.ErrorHandler=void 0,t.setUnexpectedErrorHandler=function(a){t.errorHandler.setUnexpectedErrorHandler(a)},t.isSigPipeError=function(a){if(!a||typeof a!="object")return!1;let m=a;return m.code==="EPIPE"&&m.syscall?.toUpperCase()==="WRITE"},t.onUnexpectedError=function(a){p(a)||t.errorHandler.onUnexpectedError(a)},t.onUnexpectedExternalError=function(a){p(a)||t.errorHandler.onUnexpectedExternalError(a)},t.transformErrorForSerialization=function(a){if(a instanceof Error){let{name:m,message:c}=a;return{$isError:!0,name:m,message:c,stack:a.stacktrace||a.stack,noTelemetry:i.isErrorNoTelemetry(a)}}return a},t.transformErrorFromSerialization=function(a){let m;return a.noTelemetry?m=new i:(m=Error(),m.name=a.name),m.message=a.message,m.stack=a.stack,m},t.isCancellationError=p,t.canceled=function(){let a=Error(f);return a.name=a.message,a},t.illegalArgument=function(a){return a?Error(`Illegal argument: ${a}`):Error("Illegal argument")},t.illegalState=function(a){return a?Error(`Illegal state: ${a}`):Error("Illegal state")},t.getErrorMessage=function(a){return a?a.message?a.message:a.stack?a.stack.split(`
|
|
5
|
-
`)[0]:String(
|
|
3
|
+
var xs=Object.create;var{getPrototypeOf:Es,defineProperty:Gt,getOwnPropertyNames:As}=Object;var qt=Object.prototype.hasOwnProperty;function ks(e){return this[e]}var Ls,Ts,Rs=(e,r,s)=>{var c=e!=null&&typeof e==="object";if(c){var f=r?Ls??=new WeakMap:Ts??=new WeakMap,a=f.get(e);if(a)return a}s=e!=null?xs(Es(e)):{};let y=r||!e||!e.__esModule||!qt.call(e,"default")?Gt(s,"default",{value:e,enumerable:!0}):s;if(e&&typeof e==="object"||typeof e==="function"){for(let t of As(e))if(!qt.call(y,t))Gt(y,t,{get:ks.bind(e,t),enumerable:!0})}if(c)f.set(e,y);return y};var Bs=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Xt=(e)=>JSON.parse(e);var Br=Bs(function(Rr){(()=>{var e={5639:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let l=n(7150),p=n(802);class g extends l.Disposable{constructor(d){super(),this._maxLength=d,this.onDeleteEmitter=this._register(new p.Emitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new p.Emitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new p.Emitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(d){if(this._maxLength===d)return;let _=Array(d);for(let v=0;v<Math.min(d,this.length);v++)_[v]=this._array[this._getCyclicIndex(v)];this._array=_,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let _=this._length;_<d;_++)this._array[_]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,_){this._array[this._getCyclicIndex(d)]=_}push(d){this._array[this._getCyclicIndex(this._length)]=d,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(d,_,...v){if(_){for(let o=d;o<this._length-_;o++)this._array[this._getCyclicIndex(o)]=this._array[this._getCyclicIndex(o+_)];this._length-=_,this.onDeleteEmitter.fire({index:d,amount:_})}for(let o=this._length-1;o>=d;o--)this._array[this._getCyclicIndex(o+v.length)]=this._array[this._getCyclicIndex(o)];for(let o=0;o<v.length;o++)this._array[this._getCyclicIndex(d+o)]=v[o];if(v.length&&this.onInsertEmitter.fire({index:d,amount:v.length}),this._length+v.length>this._maxLength){let o=this._length+v.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=v.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,_,v){if(!(_<=0)){if(d<0||d>=this._length)throw Error("start argument out of range");if(d+v<0)throw Error("Cannot shift elements in list beyond index 0");if(v>0){for(let i=_-1;i>=0;i--)this.set(d+i+v,this.get(d+i));let o=d+_+v-this._length;if(o>0)for(this._length+=o;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let o=0;o<_;o++)this.set(d+o+v,this.get(d+o))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}t.CircularList=g},7453:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=function n(l,p=5){if(typeof l!="object")return l;let g=Array.isArray(l)?[]:{};for(let d in l)g[d]=p<=1?l[d]:l[d]&&n(l[d],p-1);return g}},5777:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let l=n(6501),p=n(6025),g=n(7276),d=n(9640),_=n(56),v=n(4071),o=n(7792),i=n(6415),w=n(5746),h=n(5882),m=n(2486),u=n(3562),S=n(8811),C=n(802),T=n(7150),B=!1;class O extends T.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new C.Emitter),this._onScroll.event((A)=>{this._onScrollApi?.fire(A.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(A){for(let M in A)this.optionsService.options[M]=A[M]}constructor(A){super(),this._windowsWrappingHeuristics=this._register(new T.MutableDisposable),this._onBinary=this._register(new C.Emitter),this.onBinary=this._onBinary.event,this._onData=this._register(new C.Emitter),this.onData=this._onData.event,this._onLineFeed=this._register(new C.Emitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new C.Emitter),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new C.Emitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new C.Emitter),this._instantiationService=new p.InstantiationService,this.optionsService=this._register(new _.OptionsService(A)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this._register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(w.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this._register(new m.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(C.Event.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(C.Event.forward(this._bufferService.onResize,this._onResize)),this._register(C.Event.forward(this.coreService.onData,this._onData)),this._register(C.Event.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new u.WriteBuffer((M,k)=>this._inputHandler.parse(M,k))),this._register(C.Event.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,M){this._writeBuffer.write(A,M)}writeSync(A,M){this._logService.logLevel<=l.LogLevelEnum.WARN&&!B&&(this._logService.warn("writeSync is unreliable and will be removed soon."),B=!0),this._writeBuffer.writeSync(A,M)}input(A,M=!0){this.coreService.triggerDataEvent(A,M)}resize(A,M){isNaN(A)||isNaN(M)||(A=Math.max(A,d.MINIMUM_COLS),M=Math.max(M,d.MINIMUM_ROWS),this._bufferService.resize(A,M))}scroll(A,M=!1){this._bufferService.scroll(A,M)}scrollLines(A,M){this._bufferService.scrollLines(A,M)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(A){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){let M=A-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(A,M){return this._inputHandler.registerEscHandler(A,M)}registerDcsHandler(A,M){return this._inputHandler.registerDcsHandler(A,M)}registerCsiHandler(A,M){return this._inputHandler.registerCsiHandler(A,M)}registerOscHandler(A,M){return this._inputHandler.registerOscHandler(A,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1,M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?A=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let A=[];A.push(this.onLineFeed(h.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},()=>((0,h.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,T.toDisposable)(()=>{for(let M of A)M.dispose()})}}}t.CoreTerminal=O},2486:function(y,t,n){var l=this&&this.__decorate||function(b,x,L,E){var D,H=arguments.length,I=H<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,L):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(b,x,L,E);else for(var N=b.length-1;N>=0;N--)(D=b[N])&&(I=(H<3?D(I):H>3?D(x,L,I):D(x,L))||I);return H>3&&I&&Object.defineProperty(x,L,I),I},p=this&&this.__param||function(b,x){return function(L,E){x(L,E,b)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0,t.isValidColorIndex=F;let g=n(3534),d=n(6760),_=n(6717),v=n(7150),o=n(726),i=n(6107),w=n(8938),h=n(3055),m=n(5451),u=n(6501),S=n(6415),C=n(1346),T=n(9823),B=n(8693),O=n(802),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},M=131072;function k(b,x){if(b>24)return x.setWinLines||!1;switch(b){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var P;(function(b){b[b.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",b[b.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(P||(t.WindowsOptionsReportType=P={}));let W=0;class z extends v.Disposable{getAttrData(){return this._curAttrData}constructor(b,x,L,E,D,H,I,N,j=new _.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=x,this._coreService=L,this._logService=E,this._optionsService=D,this._oscLinkService=H,this._coreMouseService=I,this._unicodeService=N,this._parser=j,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this._register(new O.Emitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new O.Emitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new O.Emitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new O.Emitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new O.Emitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new O.Emitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new O.Emitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new O.Emitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new O.Emitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new O.Emitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new O.Emitter),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new O.Emitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new O.Emitter),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 q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((R)=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,G)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:G.toArray()})}),this._parser.setEscHandlerFallback((R)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback((R)=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,G,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:G,data:U})}),this._parser.setDcsHandlerFallback((R,G,U)=>{G==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:G,payload:U})}),this._parser.setPrintHandler((R,G,U)=>this.print(R,G,U)),this._parser.registerCsiHandler({final:"@"},(R)=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(R)=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},(R)=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(R)=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},(R)=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},(R)=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},(R)=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},(R)=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},(R)=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},(R)=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},(R)=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},(R)=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},(R)=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(R)=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},(R)=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(R)=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},(R)=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},(R)=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},(R)=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},(R)=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},(R)=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},(R)=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},(R)=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},(R)=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},(R)=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},(R)=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},(R)=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},(R)=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},(R)=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},(R)=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},(R)=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},(R)=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},(R)=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(R)=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},(R)=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(R)=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},(R)=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},(R)=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(R)=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(R)=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(R)=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},(R)=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},(R)=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},(R)=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},(R)=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(R)=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(R)=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(R)=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(R)=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(R)=>this.requestMode(R,!1)),this._parser.setExecuteHandler(g.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(g.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(g.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(g.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(g.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(g.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(g.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(g.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(g.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(g.C1.IND,()=>this.index()),this._parser.setExecuteHandler(g.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(g.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler((R)=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new C.OscHandler((R)=>this.setIconName(R))),this._parser.registerOscHandler(2,new C.OscHandler((R)=>this.setTitle(R))),this._parser.registerOscHandler(4,new C.OscHandler((R)=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new C.OscHandler((R)=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new C.OscHandler((R)=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new C.OscHandler((R)=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new C.OscHandler((R)=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new C.OscHandler((R)=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new C.OscHandler((R)=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new C.OscHandler((R)=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new C.OscHandler((R)=>this.restoreCursorColor(R))),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(let R in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((R)=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler((R,G)=>this.requestStatusString(R,G)))}_preserveStack(b,x,L,E){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=L,this._parseStack.position=E}_logSlowResolvingAsync(b){this._logService.logLevel<=u.LogLevelEnum.WARN&&Promise.race([b,new Promise((x,L)=>setTimeout(()=>L("#SLOW_TIMEOUT"),5000))]).catch((x)=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,x){let L,E=this._activeBuffer.x,D=this._activeBuffer.y,H=0,I=this._parseStack.paused;if(I){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(L),L;E=this._parseStack.cursorStartX,D=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>M&&(H=this._parseStack.position+M)}if(this._logService.logLevel<=u.LogLevelEnum.DEBUG&&this._logService.debug("parsing data "+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(R)=>String.fromCharCode(R)).join("")}"`)),this._logService.logLevel===u.LogLevelEnum.TRACE&&this._logService.trace("parsing data (codes)",typeof b=="string"?b.split("").map((R)=>R.charCodeAt(0)):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<M&&(this._parseBuffer=new Uint32Array(Math.min(b.length,M))),I||this._dirtyRowTracker.clearRange(),b.length>M)for(let R=H;R<b.length;R+=M){let G=R+M<b.length?R+M:b.length,U=typeof b=="string"?this._stringDecoder.decode(b.substring(R,G),this._parseBuffer):this._utf8Decoder.decode(b.subarray(R,G),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,U))return this._preserveStack(E,D,U,R),this._logSlowResolvingAsync(L),L}else if(!I){let R=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,R))return this._preserveStack(E,D,R,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===E&&this._activeBuffer.y===D||this._onCursorMove.fire();let N=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),j=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);j<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(j,this._bufferService.rows-1),end:Math.min(N,this._bufferService.rows-1)})}print(b,x,L){let E,D,H=this._charsetService.charset,I=this._optionsService.rawOptions.screenReaderMode,N=this._bufferService.cols,j=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,G=this._curAttrData,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-x>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,G);let X=this._parser.precedingJoinState;for(let se=x;se<L;++se){if(E=b[se],E<127&&H){let he=H[String.fromCharCode(E)];he&&(E=he.charCodeAt(0))}let ie=this._unicodeService.charProperties(E,X);D=S.UnicodeService.extractWidth(ie);let ae=S.UnicodeService.extractShouldJoin(ie),ce=ae?S.UnicodeService.extractWidth(X):0;if(X=ie,I&&this._onA11yChar.fire((0,o.stringFromCodePoint)(E)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+D-ce>N){if(j){let he=U,Se=this._activeBuffer.x-ce;for(this._activeBuffer.x=ce,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),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ce>0&&U instanceof i.BufferLine&&U.copyCellsFrom(he,Se,0,ce,!1);Se<N;)he.setCellFromCodepoint(Se++,0,1,G)}else if(this._activeBuffer.x=N-1,D===2)continue}if(ae&&this._activeBuffer.x){let he=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-he,E,D);for(let Se=D-ce;--Se>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}else if(R&&(U.insertCells(this._activeBuffer.x,D-ce,this._activeBuffer.getNullCell(G)),U.getWidth(N-1)===2&&U.setCellFromCodepoint(N-1,w.NULL_CELL_CODE,w.NULL_CELL_WIDTH,G)),U.setCellFromCodepoint(this._activeBuffer.x++,E,D,G),D>0)for(;--D;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}this._parser.precedingJoinState=X,this._activeBuffer.x<N&&L-x>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,G),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,x){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,x):this._parser.registerCsiHandler(b,(L)=>!k(L.params[0],this._optionsService.rawOptions.windowOptions)||x(L))}registerDcsHandler(b,x){return this._parser.registerDcsHandler(b,new T.DcsHandler(x))}registerEscHandler(b,x){return this._parser.registerEscHandler(b,x)}registerOscHandler(b,x){return this._parser.registerOscHandler(b,new C.OscHandler(x))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,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(b,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=b,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+x)}cursorUp(b){let x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let x=b.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=b.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=b.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let x=b.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,x,L,E=!1,D=!1){let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);H.replaceCells(x,L,this._activeBuffer.getNullCell(this._eraseAttrData()),D),E&&(H.isWrapped=!1)}_resetBufferLine(b,x=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,x=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.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,x);L<this._bufferService.rows;L++)this._resetBufferLine(L,x);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,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,x);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(L=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,L-1);L--;)if(this._activeBuffer.lines.get(this._activeBuffer.ybase+L)?.getTrimmedLength())break;for(;L>=0;L--)this._bufferService.scroll(this._eraseAttrData())}else{for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,x);this._dirtyRowTracker.markDirty(0)}break;case 3:let E=this._activeBuffer.lines.length-this._bufferService.rows;E>0&&(this._activeBuffer.lines.trimStart(E),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-E,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-E,0),this._onScroll.fire(0))}return!0}eraseInLine(b,x=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let x=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,E=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-E+1;for(;x--;)this._activeBuffer.lines.splice(D-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(b){this._restrictCursor();let x=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,E;for(E=this._bufferService.rows-1-this._activeBuffer.scrollBottom,E=this._bufferService.rows-1+this._activeBuffer.ybase-E;x--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(E,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let x=b.params[0]||1;for(;x--;)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(b){let x=b.params[0]||1;for(;x--;)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(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=b.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);E.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let x=this._parser.precedingJoinState;if(!x)return!0;let L=b.params[0]||1,E=S.UnicodeService.extractWidth(x),D=this._activeBuffer.x-E,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(D),I=new Uint32Array(H.length*L),N=0;for(let R=0;R<H.length;){let G=H.codePointAt(R)||0;I[N++]=G,R+=G>65535?2:1}let j=N;for(let R=1;R<L;++R)I.copyWithin(j,0,N),j+=N;return this.print(I,0,j),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(g.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(g.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(g.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(g.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(g.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.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 1000: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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(b){for(let x=0;x<b.length;x++)switch(b.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let x=0;x<b.length;x++)switch(b.params[x]){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 1000: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(),b.params[x]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(b,x){let L=this._coreService.decPrivateModes,{activeProtocol:E,activeEncoding:D}=this._coreMouseService,H=this._coreService,{buffers:I,cols:N}=this._bufferService,{active:j,alt:R}=I,G=this._optionsService.rawOptions,U=(ae)=>ae?1:2,X=b.params[0];return se=X,ie=x?X===2?4:X===4?U(H.modes.insertMode):X===12?3:X===20?U(G.convertEol):0:X===1?U(L.applicationCursorKeys):X===3?G.windowOptions.setWinLines?N===80?2:N===132?1:0:0:X===6?U(L.origin):X===7?U(L.wraparound):X===8?3:X===9?U(E==="X10"):X===12?U(G.cursorBlink):X===25?U(!H.isCursorHidden):X===45?U(L.reverseWraparound):X===66?U(L.applicationKeypad):X===67?4:X===1000?U(E==="VT200"):X===1002?U(E==="DRAG"):X===1003?U(E==="ANY"):X===1004?U(L.sendFocus):X===1005?4:X===1006?U(D==="SGR"):X===1015?4:X===1016?U(D==="SGR_PIXELS"):X===1048?1:X===47||X===1047||X===1049?U(j===R):X===2004?U(L.bracketedPasteMode):X===2026?U(L.synchronizedOutput):0,H.triggerDataEvent(`${g.C0.ESC}[${x?"":"?"}${se};${ie}$y`),!0;var se,ie}_updateAttrColor(b,x,L,E,D){return x===2?(b|=50331648,b&=-16777216,b|=m.AttributeData.fromColorRGB([L,E,D])):x===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,x,L){let E=[0,0,-1,0,0,0],D=0,H=0;do{if(E[H+D]=b.params[x+H],b.hasSubParams(x+H)){let I=b.getSubParams(x+H),N=0;do E[1]===5&&(D=1),E[H+N+1+D]=I[N];while(++N<I.length&&N+H+1+D<E.length);break}if(E[1]===5&&H+D>=2||E[1]===2&&H+D>=5)break;E[1]&&(D=1)}while(++H+x<b.length&&H+D<E.length);for(let I=2;I<E.length;++I)E[I]===-1&&(E[I]=0);switch(E[0]){case 38:L.fg=this._updateAttrColor(L.fg,E[1],E[3],E[4],E[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,E[1],E[3],E[4],E[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,E[1],E[3],E[4],E[5])}return H}_processUnderline(b,x){x.extended=x.extended.clone(),(!~b||b>5)&&(b=1),x.extended.underlineStyle=b,x.fg|=268435456,b===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(b){b.fg=i.DEFAULT_ATTR_DATA.fg,b.bg=i.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let x=b.length,L,E=this._curAttrData;for(let D=0;D<x;D++)L=b.params[D],L>=30&&L<=37?(E.fg&=-50331904,E.fg|=16777216|L-30):L>=40&&L<=47?(E.bg&=-50331904,E.bg|=16777216|L-40):L>=90&&L<=97?(E.fg&=-50331904,E.fg|=16777224|L-90):L>=100&&L<=107?(E.bg&=-50331904,E.bg|=16777224|L-100):L===0?this._processSGR0(E):L===1?E.fg|=134217728:L===3?E.bg|=67108864:L===4?(E.fg|=268435456,this._processUnderline(b.hasSubParams(D)?b.getSubParams(D)[0]:1,E)):L===5?E.fg|=536870912:L===7?E.fg|=67108864:L===8?E.fg|=1073741824:L===9?E.fg|=2147483648:L===2?E.bg|=134217728:L===21?this._processUnderline(2,E):L===22?(E.fg&=-134217729,E.bg&=-134217729):L===23?E.bg&=-67108865:L===24?(E.fg&=-268435457,this._processUnderline(0,E)):L===25?E.fg&=-536870913:L===27?E.fg&=-67108865:L===28?E.fg&=-1073741825:L===29?E.fg&=2147483647:L===39?(E.fg&=-67108864,E.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):L===49?(E.bg&=-67108864,E.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?D+=this._extractColor(b,D,E):L===53?E.bg|=1073741824:L===55?E.bg&=-1073741825:L===59?(E.extended=E.extended.clone(),E.extended.underlineColor=-1,E.updateExtended()):L===100?(E.fg&=-67108864,E.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,E.bg&=-67108864,E.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${g.C0.ESC}[0n`);break;case 6:let x=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${g.C0.ESC}[${x};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let x=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${g.C0.ESC}[?${x};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.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(b){let x=b.length===0?1:b.params[0];if(x===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(x){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}let L=x%2==1;this._coreService.decPrivateModes.cursorBlink=L}return!0}setScrollRegion(b){let x=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!k(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let x=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:x!==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(`${g.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){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(b){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(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let x=[],L=b.split(";");for(;L.length>1;){let E=L.shift(),D=L.shift();if(/^\d+$/.exec(E)){let H=parseInt(E);if(F(H))if(D==="?")x.push({type:0,index:H});else{let I=(0,B.parseColor)(D);I&&x.push({type:1,index:H,color:I})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(b){let x=b.indexOf(";");if(x===-1)return!0;let L=b.slice(0,x).trim(),E=b.slice(x+1);return E?this._createHyperlink(L,E):!L.trim()&&this._finishHyperlink()}_createHyperlink(b,x){this._getCurrentLinkId()&&this._finishHyperlink();let L=b.split(":"),E,D=L.findIndex((H)=>H.startsWith("id="));return D!==-1&&(E=L[D].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:E,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,x){let L=b.split(";");for(let E=0;E<L.length&&!(x>=this._specialColors.length);++E,++x)if(L[E]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{let D=(0,B.parseColor)(L[E]);D&&this._onColor.fire([{type:1,index:this._specialColors[x],color:D}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let x=[],L=b.split(";");for(let E=0;E<L.length;++E)if(/^\d+$/.exec(L[E])){let D=parseInt(L[E]);F(D)&&x.push({type:2,index:D})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){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,d.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(A[b[0]],d.CHARSETS[b[1]]||d.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){let b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new h.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){let L=this._activeBuffer.ybase+this._activeBuffer.y+x,E=this._activeBuffer.lines.get(L);E&&(E.fill(b),E.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,x){let L=this._bufferService.buffer,E=this._optionsService.rawOptions;return((D)=>(this._coreService.triggerDataEvent(`${g.C0.ESC}${D}${g.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[E.cursorStyle]-(E.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,x){this._dirtyRowTracker.markRangeDirty(b,x)}}t.InputHandler=z;let q=class{constructor(b){this._bufferService=b,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(b){b<this.start?this.start=b:b>this.end&&(this.end=b)}markRangeDirty(b,x){b>x&&(W=b,b=x,x=W),b<this.start&&(this.start=b),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(b){return 0<=b&&b<256}q=l([p(0,u.IBufferService)],q)},701:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.getSafariVersion=function(){if(!t.isSafari)return 0;let p=n.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},t.isNode=typeof process<"u"&&"title"in process;let n=t.isNode?"node":navigator.userAgent,l=t.isNode?"node":navigator.platform;t.isFirefox=n.includes("Firefox"),t.isLegacyEdge=n.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6168:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let l=n(701);class p{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),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(d){this._idleCallback=void 0;let _=0,v=0,o=d.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(_=performance.now(),this._tasks[this._i]()||this._i++,_=Math.max(1,performance.now()-_),v=Math.max(_,v),i=d.timeRemaining(),1.5*v>i)return o-_<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(o-_))}ms`),void this._start();o=i}this.clear()}}class g extends p{_requestCallback(d){return setTimeout(()=>d(this._createDeadline(16)))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){let _=performance.now()+d;return{timeRemaining:()=>Math.max(0,_-performance.now())}}}t.PriorityTaskQueue=g,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:g,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},5882:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=function(p){let g=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),d=g?.get(p.cols-1),_=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);_&&d&&(_.isWrapped=d[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&d[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)};let l=n(8938)},5451:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){let p=new n;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}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)}isBgDefault(){return!(50331648&this.bg)}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):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):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){let p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,g=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=g}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},1073:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let l=n(5639),p=n(6168),g=n(5451),d=n(6107),_=n(732),v=n(3055),o=n(8938),i=n(8158),w=n(6760);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(h,m,u){this._hasScrollback=h,this._optionsService=m,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=w.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new g.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new g.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,m){return new d.BufferLine(this._bufferService.cols,this.getNullCell(h),m)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;let m=h+this._optionsService.rawOptions.scrollback;return m>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:m}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=d.DEFAULT_ATTR_DATA);let m=this._rows;for(;m--;)this.lines.push(this.getBlankLine(h))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(h,m){let u=this.getNullCell(d.DEFAULT_ATTR_DATA),S=0,C=this._getCorrectBufferLength(m);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<h)for(let B=0;B<this.lines.length;B++)S+=+this.lines.get(B).resize(h,u);let T=0;if(this._rows<m)for(let B=this._rows;B<m;B++)this.lines.length<m+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(h,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(h,u)));else for(let B=this._rows;B>m;B--)this.lines.length>m+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(C<this.lines.maxLength){let B=this.lines.length-C;B>0&&(this.lines.trimStart(B),this.ybase=Math.max(this.ybase-B,0),this.ydisp=Math.max(this.ydisp-B,0),this.savedY=Math.max(this.savedY-B,0)),this.lines.maxLength=C}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,m-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=m-1,this._isReflowEnabled&&(this._reflow(h,m),this._cols>h))for(let T=0;T<this.lines.length;T++)S+=+this.lines.get(T).resize(h,u);this._cols=h,this._rows=m,this._memoryCleanupQueue.clear(),S>0.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let m=0;for(;this._memoryCleanupPosition<this.lines.length;)if(m+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),m>100)return!0;return h}get _isReflowEnabled(){let h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,m){this._cols!==h&&(h>this._cols?this._reflowLarger(h,m):this._reflowSmaller(h,m))}_reflowLarger(h,m){let u=this._optionsService.rawOptions.reflowCursorLine,S=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA),u);if(S.length>0){let C=(0,_.reflowLargerCreateNewLayout)(this.lines,S);(0,_.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(h,m,C.countRemoved)}}_reflowLargerAdjustViewport(h,m,u){let S=this.getNullCell(d.DEFAULT_ATTR_DATA),C=u;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<m&&this.lines.push(new d.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(h,m){let u=this._optionsService.rawOptions.reflowCursorLine,S=this.getNullCell(d.DEFAULT_ATTR_DATA),C=[],T=0;for(let B=this.lines.length-1;B>=0;B--){let O=this.lines.get(B);if(!O||!O.isWrapped&&O.getTrimmedLength()<=h)continue;let A=[O];for(;O.isWrapped&&B>0;)O=this.lines.get(--B),A.unshift(O);if(!u){let E=this.ybase+this.y;if(E>=B&&E<B+A.length)continue}let M=A[A.length-1].getTrimmedLength(),k=(0,_.reflowSmallerGetNewLineLengths)(A,this._cols,h),P=k.length-A.length,W;W=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);let z=[];for(let E=0;E<P;E++){let D=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);z.push(D)}z.length>0&&(C.push({start:B+A.length+T,newLines:z}),T+=z.length),A.push(...z);let q=k.length-1,F=k[q];F===0&&(q--,F=k[q]);let b=A.length-P-1,x=M;for(;b>=0;){let E=Math.min(x,F);if(A[q]===void 0)break;if(A[q].copyCellsFrom(A[b],x-E,F-E,E,!0),F-=E,F===0&&(q--,F=k[q]),x-=E,x===0){b--;let D=Math.max(b,0);x=(0,_.getWrappedLineTrimmedLength)(A,D,this._cols)}}for(let E=0;E<A.length;E++)k[E]<h&&A[E].setCell(k[E],S);let L=P-W;for(;L-- >0;)this.ybase===0?this.y<m-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-m&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+m-1)}if(C.length>0){let B=[],O=[];for(let F=0;F<this.lines.length;F++)O.push(this.lines.get(F));let A=this.lines.length,M=A-1,k=0,P=C[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let W=0;for(let F=Math.min(this.lines.maxLength-1,A+T-1);F>=0;F--)if(P&&P.start>M+W){for(let b=P.newLines.length-1;b>=0;b--)this.lines.set(F--,P.newLines[b]);F++,B.push({index:M+1,amount:P.newLines.length}),W+=P.newLines.length,P=C[++k]}else this.lines.set(F,O[M--]);let z=0;for(let F=B.length-1;F>=0;F--)B[F].index+=z,this.lines.onInsertEmitter.fire(B[F]),z+=B[F].amount;let q=Math.max(0,A+T-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(h,m,u=0,S){let C=this.lines.get(h);return C?C.translateToString(m,u,S):""}getWrappedRangeForLine(h){let m=h,u=h;for(;m>0&&this.lines.get(m).isWrapped;)m--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:m,last:u}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].line===h&&(this.markers[m].dispose(),this.markers.splice(m--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose();this.markers.length=0,this._isClearing=!1}addMarker(h){let m=new i.Marker(h);return this.markers.push(m),m.register(this.lines.onTrim((u)=>{m.line-=u,m.line<0&&m.dispose()})),m.register(this.lines.onInsert((u)=>{m.line>=u.index&&(m.line+=u.amount)})),m.register(this.lines.onDelete((u)=>{m.line>=u.index&&m.line<u.index+u.amount&&m.dispose(),m.line>u.index&&(m.line-=u.amount)})),m.register(m.onDispose(()=>this._removeMarker(m))),m}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},6107:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let l=n(5451),p=n(3055),g=n(8938),d=n(726);t.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let _=0;class v{constructor(o,i,w=!1){this.isWrapped=w,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*o);let h=i||p.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]);for(let m=0;m<o;++m)this.setCell(m,h);this.length=o}get(o){let i=this._data[3*o+0],w=2097151&i;return[this._data[3*o+1],2097152&i?this._combined[o]:w?(0,d.stringFromCodePoint)(w):"",i>>22,2097152&i?this._combined[o].charCodeAt(this._combined[o].length-1):w]}set(o,i){this._data[3*o+1]=i[g.CHAR_DATA_ATTR_INDEX],i[g.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[o]=i[1],this._data[3*o+0]=2097152|o|i[g.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*o+0]=i[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[g.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(o){return this._data[3*o+0]>>22}hasWidth(o){return 12582912&this._data[3*o+0]}getFg(o){return this._data[3*o+1]}getBg(o){return this._data[3*o+2]}hasContent(o){return 4194303&this._data[3*o+0]}getCodePoint(o){let i=this._data[3*o+0];return 2097152&i?this._combined[o].charCodeAt(this._combined[o].length-1):2097151&i}isCombined(o){return 2097152&this._data[3*o+0]}getString(o){let i=this._data[3*o+0];return 2097152&i?this._combined[o]:2097151&i?(0,d.stringFromCodePoint)(2097151&i):""}isProtected(o){return 536870912&this._data[3*o+2]}loadCell(o,i){return _=3*o,i.content=this._data[_+0],i.fg=this._data[_+1],i.bg=this._data[_+2],2097152&i.content&&(i.combinedData=this._combined[o]),268435456&i.bg&&(i.extended=this._extendedAttrs[o]),i}setCell(o,i){2097152&i.content&&(this._combined[o]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[o]=i.extended),this._data[3*o+0]=i.content,this._data[3*o+1]=i.fg,this._data[3*o+2]=i.bg}setCellFromCodepoint(o,i,w,h){268435456&h.bg&&(this._extendedAttrs[o]=h.extended),this._data[3*o+0]=i|w<<22,this._data[3*o+1]=h.fg,this._data[3*o+2]=h.bg}addCodepointToCell(o,i,w){let h=this._data[3*o+0];2097152&h?this._combined[o]+=(0,d.stringFromCodePoint)(i):2097151&h?(this._combined[o]=(0,d.stringFromCodePoint)(2097151&h)+(0,d.stringFromCodePoint)(i),h&=-2097152,h|=2097152):h=i|4194304,w&&(h&=-12582913,h|=w<<22),this._data[3*o+0]=h}insertCells(o,i,w){if((o%=this.length)&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o-1,0,1,w),i<this.length-o){let h=new p.CellData;for(let m=this.length-o-i-1;m>=0;--m)this.setCell(o+i+m,this.loadCell(o+m,h));for(let m=0;m<i;++m)this.setCell(o+m,w)}else for(let h=o;h<this.length;++h)this.setCell(h,w);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,w)}deleteCells(o,i,w){if(o%=this.length,i<this.length-o){let h=new p.CellData;for(let m=0;m<this.length-o-i;++m)this.setCell(o+m,this.loadCell(o+i+m,h));for(let m=this.length-i;m<this.length;++m)this.setCell(m,w)}else for(let h=o;h<this.length;++h)this.setCell(h,w);o&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o-1,0,1,w),this.getWidth(o)!==0||this.hasContent(o)||this.setCellFromCodepoint(o,0,1,w)}replaceCells(o,i,w,h=!1){if(h)for(o&&this.getWidth(o-1)===2&&!this.isProtected(o-1)&&this.setCellFromCodepoint(o-1,0,1,w),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,w);o<i&&o<this.length;)this.isProtected(o)||this.setCell(o,w),o++;else for(o&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o-1,0,1,w),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,w);o<i&&o<this.length;)this.setCell(o++,w)}resize(o,i){if(o===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let w=3*o;if(o>this.length){if(this._data.buffer.byteLength>=4*w)this._data=new Uint32Array(this._data.buffer,0,w);else{let h=new Uint32Array(w);h.set(this._data),this._data=h}for(let h=this.length;h<o;++h)this.setCell(h,i)}else{this._data=this._data.subarray(0,w);let h=Object.keys(this._combined);for(let u=0;u<h.length;u++){let S=parseInt(h[u],10);S>=o&&delete this._combined[S]}let m=Object.keys(this._extendedAttrs);for(let u=0;u<m.length;u++){let S=parseInt(m[u],10);S>=o&&delete this._extendedAttrs[S]}}return this.length=o,4*w*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let o=new Uint32Array(this._data.length);return o.set(this._data),this._data=o,1}return 0}fill(o,i=!1){if(i)for(let w=0;w<this.length;++w)this.isProtected(w)||this.setCell(w,o);else{this._combined={},this._extendedAttrs={};for(let w=0;w<this.length;++w)this.setCell(w,o)}}copyFrom(o){this.length!==o.length?this._data=new Uint32Array(o._data):this._data.set(o._data),this.length=o.length,this._combined={};for(let i in o._combined)this._combined[i]=o._combined[i];this._extendedAttrs={};for(let i in o._extendedAttrs)this._extendedAttrs[i]=o._extendedAttrs[i];this.isWrapped=o.isWrapped}clone(){let o=new v(0);o._data=new Uint32Array(this._data),o.length=this.length;for(let i in this._combined)o._combined[i]=this._combined[i];for(let i in this._extendedAttrs)o._extendedAttrs[i]=this._extendedAttrs[i];return o.isWrapped=this.isWrapped,o}getTrimmedLength(){for(let o=this.length-1;o>=0;--o)if(4194303&this._data[3*o+0])return o+(this._data[3*o+0]>>22);return 0}getNoBgTrimmedLength(){for(let o=this.length-1;o>=0;--o)if(4194303&this._data[3*o+0]||50331648&this._data[3*o+2])return o+(this._data[3*o+0]>>22);return 0}copyCellsFrom(o,i,w,h,m){let u=o._data;if(m)for(let C=h-1;C>=0;C--){for(let T=0;T<3;T++)this._data[3*(w+C)+T]=u[3*(i+C)+T];268435456&u[3*(i+C)+2]&&(this._extendedAttrs[w+C]=o._extendedAttrs[i+C])}else for(let C=0;C<h;C++){for(let T=0;T<3;T++)this._data[3*(w+C)+T]=u[3*(i+C)+T];268435456&u[3*(i+C)+2]&&(this._extendedAttrs[w+C]=o._extendedAttrs[i+C])}let S=Object.keys(o._combined);for(let C=0;C<S.length;C++){let T=parseInt(S[C],10);T>=i&&(this._combined[T-i+w]=o._combined[T])}}translateToString(o,i,w,h){i=i??0,w=w??this.length,o&&(w=Math.min(w,this.getTrimmedLength())),h&&(h.length=0);let m="";for(;i<w;){let u=this._data[3*i+0],S=2097151&u,C=2097152&u?this._combined[i]:S?(0,d.stringFromCodePoint)(S):g.WHITESPACE_CELL_CHAR;if(m+=C,h)for(let T=0;T<C.length;++T)h.push(i);i+=u>>22||1}return h&&h.push(i),m}}t.BufferLine=v},732:(y,t)=>{function n(l,p,g){if(p===l.length-1)return l[p].getTrimmedLength();let d=!l[p].hasContent(g-1)&&l[p].getWidth(g-1)===1,_=l[p+1].getWidth(0)===2;return d&&_?g-1:g}Object.defineProperty(t,"__esModule",{value:!0}),t.reflowLargerGetLinesToRemove=function(l,p,g,d,_,v){let o=[];for(let i=0;i<l.length-1;i++){let w=i,h=l.get(++w);if(!h.isWrapped)continue;let m=[l.get(i)];for(;w<l.length&&h.isWrapped;)m.push(h),h=l.get(++w);if(!v&&d>=i&&d<w){i+=m.length-1;continue}let u=0,S=n(m,u,p),C=1,T=0;for(;C<m.length;){let O=n(m,C,p),A=O-T,M=g-S,k=Math.min(A,M);m[u].copyCellsFrom(m[C],T,S,k,!1),S+=k,S===g&&(u++,S=0),T+=k,T===O&&(C++,T=0),S===0&&u!==0&&m[u-1].getWidth(g-1)===2&&(m[u].copyCellsFrom(m[u-1],g-1,S++,1,!1),m[u-1].setCell(g-1,_))}m[u].replaceCells(S,g,_);let B=0;for(let O=m.length-1;O>0&&(O>u||m[O].getTrimmedLength()===0);O--)B++;B>0&&(o.push(i+m.length-B),o.push(B)),i+=m.length-1}return o},t.reflowLargerCreateNewLayout=function(l,p){let g=[],d=0,_=p[d],v=0;for(let o=0;o<l.length;o++)if(_===o){let i=p[++d];l.onDeleteEmitter.fire({index:o-v,amount:i}),o+=i-1,v+=i,_=p[++d]}else g.push(o);return{layout:g,countRemoved:v}},t.reflowLargerApplyNewLayout=function(l,p){let g=[];for(let d=0;d<p.length;d++)g.push(l.get(p[d]));for(let d=0;d<g.length;d++)l.set(d,g[d]);l.length=p.length},t.reflowSmallerGetNewLineLengths=function(l,p,g){let d=[],_=l.map((w,h)=>n(l,h,p)).reduce((w,h)=>w+h),v=0,o=0,i=0;for(;i<_;){if(_-i<g){d.push(_-i);break}v+=g;let w=n(l,o,p);v>w&&(v-=w,o++);let h=l[o].getWidth(v-1)===2;h&&v--;let m=h?g-1:g;d.push(m),i+=m}return d},t.getWrappedLineTrimmedLength=n},4097:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let l=n(7150),p=n(1073),g=n(802);class d extends l.Disposable{constructor(_,v){super(),this._optionsService=_,this._bufferService=v,this._onBufferActivate=this._register(new g.Emitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(_){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(_),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(_,v){this._normal.resize(_,v),this._alt.resize(_,v),this.setupTabStops(_)}setupTabStops(_){this._normal.setupTabStops(_),this._alt.setupTabStops(_)}}t.BufferSet=d},3055:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let l=n(726),p=n(8938),g=n(5451);class d extends g.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new g.ExtendedAttrs,this.combinedData=""}static fromCharData(_){let v=new d;return v.setFromCharData(_),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(_){this.fg=_[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(_[p.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(_[p.CHAR_DATA_CHAR_INDEX].length===2){let o=_[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=o&&o<=56319){let i=_[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(o-55296)+i-56320+65536|_[p.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=_[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[p.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=_[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|_[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=d},8938:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=t.DEFAULT_COLOR<<9|256,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},8158:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let l=n(802),p=n(7150);class g{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=g._nextId++,this._onDispose=this.register(new l.Emitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.dispose)(this._disposables),this._disposables.length=0)}register(d){return this._disposables.push(d),d}}t.Marker=g,g._nextId=1},6760:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},t.CHARSETS.A={"#":"\xA3"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},t.CHARSETS.C=t.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},t.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},t.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},t.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},t.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},t.CHARSETS.E=t.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},t.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},t.CHARSETS.H=t.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},t.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},3534:(y,t)=>{var n,l,p;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(g){g.NUL="\x00",g.SOH="\x01",g.STX="\x02",g.ETX="\x03",g.EOT="\x04",g.ENQ="\x05",g.ACK="\x06",g.BEL="\x07",g.BS="\b",g.HT="\t",g.LF=`
|
|
4
|
+
`,g.VT="\v",g.FF="\f",g.CR="\r",g.SO="\x0E",g.SI="\x0F",g.DLE="\x10",g.DC1="\x11",g.DC2="\x12",g.DC3="\x13",g.DC4="\x14",g.NAK="\x15",g.SYN="\x16",g.ETB="\x17",g.CAN="\x18",g.EM="\x19",g.SUB="\x1A",g.ESC="\x1B",g.FS="\x1C",g.GS="\x1D",g.RS="\x1E",g.US="\x1F",g.SP=" ",g.DEL="\x7F"}(n||(t.C0=n={})),function(g){g.PAD="\x80",g.HOP="\x81",g.BPH="\x82",g.NBH="\x83",g.IND="\x84",g.NEL="\x85",g.SSA="\x86",g.ESA="\x87",g.HTS="\x88",g.HTJ="\x89",g.VTS="\x8A",g.PLD="\x8B",g.PLU="\x8C",g.RI="\x8D",g.SS2="\x8E",g.SS3="\x8F",g.DCS="\x90",g.PU1="\x91",g.PU2="\x92",g.STS="\x93",g.CCH="\x94",g.MW="\x95",g.SPA="\x96",g.EPA="\x97",g.SOS="\x98",g.SGCI="\x99",g.SCI="\x9A",g.CSI="\x9B",g.ST="\x9C",g.OSC="\x9D",g.PM="\x9E",g.APC="\x9F"}(l||(t.C1=l={})),function(g){g.ST=`${n.ESC}\\`}(p||(t.C1_ESCAPED=p={}))},726:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=void 0,t.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},t.utf32ToString=function(n,l=0,p=n.length){let g="";for(let d=l;d<p;++d){let _=n[d];_>65535?(_-=65536,g+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):g+=String.fromCharCode(_)}return g},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,l){let p=n.length;if(!p)return 0;let g=0,d=0;if(this._interim){let _=n.charCodeAt(d++);56320<=_&&_<=57343?l[g++]=1024*(this._interim-55296)+_-56320+65536:(l[g++]=this._interim,l[g++]=_),this._interim=0}for(let _=d;_<p;++_){let v=n.charCodeAt(_);if(55296<=v&&v<=56319){if(++_>=p)return this._interim=v,g;let o=n.charCodeAt(_);56320<=o&&o<=57343?l[g++]=1024*(v-55296)+o-56320+65536:(l[g++]=v,l[g++]=o)}else v!==65279&&(l[g++]=v)}return g}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,l){let p=n.length;if(!p)return 0;let g,d,_,v,o=0,i=0,w=0;if(this.interim[0]){let u=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let C,T=0;for(;(C=63&this.interim[++T])&&T<4;)S<<=6,S|=C;let B=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,O=B-T;for(;w<O;){if(w>=p)return 0;if(C=n[w++],(192&C)!=128){w--,u=!0;break}this.interim[T++]=C,S<<=6,S|=63&C}u||(B===2?S<128?w--:l[o++]=S:B===3?S<2048||S>=55296&&S<=57343||S===65279||(l[o++]=S):S<65536||S>1114111||(l[o++]=S)),this.interim.fill(0)}let h=p-4,m=w;for(;m<p;){for(;!(!(m<h)||128&(g=n[m])||128&(d=n[m+1])||128&(_=n[m+2])||128&(v=n[m+3]));)l[o++]=g,l[o++]=d,l[o++]=_,l[o++]=v,m+=4;if(g=n[m++],g<128)l[o++]=g;else if((224&g)==192){if(m>=p)return this.interim[0]=g,o;if(d=n[m++],(192&d)!=128){m--;continue}if(i=(31&g)<<6|63&d,i<128){m--;continue}l[o++]=i}else if((240&g)==224){if(m>=p)return this.interim[0]=g,o;if(d=n[m++],(192&d)!=128){m--;continue}if(m>=p)return this.interim[0]=g,this.interim[1]=d,o;if(_=n[m++],(192&_)!=128){m--;continue}if(i=(15&g)<<12|(63&d)<<6|63&_,i<2048||i>=55296&&i<=57343||i===65279)continue;l[o++]=i}else if((248&g)==240){if(m>=p)return this.interim[0]=g,o;if(d=n[m++],(192&d)!=128){m--;continue}if(m>=p)return this.interim[0]=g,this.interim[1]=d,o;if(_=n[m++],(192&_)!=128){m--;continue}if(m>=p)return this.interim[0]=g,this.interim[1]=d,this.interim[2]=_,o;if(v=n[m++],(192&v)!=128){m--;continue}if(i=(7&g)<<18|(63&d)<<12|(63&_)<<6|63&v,i<65536||i>1114111)continue;l[o++]=i}}return o}}},7428:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let l=n(6415),p=[[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]],g=[[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]],d;t.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let _=0;_<p.length;++_)d.fill(0,p[_][0],p[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?d[_]:function(v,o){let i,w=0,h=o.length-1;if(v<o[0][0]||v>o[h][1])return!1;for(;h>=w;)if(i=w+h>>1,v>o[i][1])w=i+1;else{if(!(v<o[i][0]))return!0;h=i-1}return!1}(_,g)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,v){let o=this.wcwidth(_),i=o===0&&v!==0;if(i){let w=l.UnicodeService.extractWidth(v);w===0?i=!1:w>o&&(o=w)}return l.UnicodeService.createPropertyValue(0,o,i)}}},3562:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let l=n(7150),p=n(802);class g extends l.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new p.Emitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,_){if(_!==void 0&&this._syncCalls>_)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);let o=this._callbacks.shift();o&&o()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,_){if(this._pendingData>50000000)throw 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+=d.length,this._writeBuffer.push(d),this._callbacks.push(_),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(_)}_innerWrite(d=0,_=!0){let v=d||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let o=this._writeBuffer[this._bufferOffset],i=this._action(o,_);if(i){let h=(m)=>performance.now()-v>=12?setTimeout(()=>this._innerWrite(0,m)):this._innerWrite(v,m);return void i.catch((m)=>(queueMicrotask(()=>{throw m}),Promise.resolve(!1))).then(h)}let w=this._callbacks[this._bufferOffset];if(w&&w(),this._bufferOffset++,this._pendingData-=o.length,performance.now()-v>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=g},8693:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseColor=function(g){if(!g)return;let d=g.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);let _=n.exec(d);if(_){let v=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/v*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/v*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/v*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),l.exec(d)&&[3,6,9,12].includes(d.length))){let _=d.length/3,v=[0,0,0];for(let o=0;o<3;++o){let i=parseInt(d.slice(_*o,_*o+_),16);v[o]=_===1?i<<4:_===2?i:_===3?i>>4:i>>8}return v}},t.toRgbString=function(g,d=16){let[_,v,o]=g;return`rgb:${p(_,d)}/${p(v,d)}/${p(o,d)}`};let n=/^([\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})$/,l=/^[\da-f]+$/;function p(g,d){let _=g.toString(16),v=_.length<2?"0"+_:_;switch(d){case 4:return _[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}},1263:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},9823:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let l=n(726),p=n(7262),g=n(1263),d=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(v,o){this._handlers[v]===void 0&&(this._handlers[v]=[]);let i=this._handlers[v];return i.push(o),{dispose:()=>{let w=i.indexOf(o);w!==-1&&i.splice(w,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(v,o){if(this.reset(),this._ident=v,this._active=this._handlers[v]||d,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(v,o,i){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(v,o,i);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(v,o,i))}unhook(v,o=!0){if(this._active.length){let i=!1,w=this._active.length-1,h=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,i=o,h=this._stack.fallThrough,this._stack.paused=!1),!h&&i===!1){for(;w>=0&&(i=this._active[w].unhook(v),i!==!0);w--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,i;w--}for(;w>=0;w--)if(i=this._active[w].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",v);this._active=d,this._ident=0}};let _=new p.Params;_.addParam(0),t.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=_,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():_,this._data="",this._hitLimit=!1}put(v,o,i){this._hitLimit||(this._data+=(0,l.utf32ToString)(v,o,i),this._data.length>g.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let o=!1;if(this._hitLimit)o=!1;else if(v&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then((i)=>(this._params=_,this._data="",this._hitLimit=!1,i));return this._params=_,this._data="",this._hitLimit=!1,o}}},6717:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let l=n(7150),p=n(7262),g=n(1346),d=n(9823);class _{constructor(i){this.table=new Uint8Array(i)}setDefault(i,w){this.table.fill(i<<4|w)}add(i,w,h,m){this.table[w<<8|i]=h<<4|m}addMany(i,w,h,m){for(let u=0;u<i.length;u++)this.table[w<<8|i[u]]=h<<4|m}}t.TransitionTable=_;let v=160;t.VT500_TRANSITION_TABLE=function(){let i=new _(4095),w=Array.apply(null,Array(256)).map((T,B)=>B),h=(T,B)=>w.slice(T,B),m=h(32,127),u=h(0,24);u.push(25),u.push.apply(u,h(28,32));let S=h(0,14),C;for(C in i.setDefault(1,0),i.addMany(m,0,2,0),S)i.addMany([24,26,153,154],C,3,0),i.addMany(h(128,144),C,3,0),i.addMany(h(144,152),C,3,0),i.add(156,C,0,0),i.add(27,C,11,1),i.add(157,C,4,8),i.addMany([152,158,159],C,0,7),i.add(155,C,11,3),i.add(144,C,11,9);return i.addMany(u,0,3,0),i.addMany(u,1,3,1),i.add(127,1,0,1),i.addMany(u,8,0,8),i.addMany(u,3,3,3),i.add(127,3,0,3),i.addMany(u,4,3,4),i.add(127,4,0,4),i.addMany(u,6,3,6),i.addMany(u,5,3,5),i.add(127,5,0,5),i.addMany(u,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(m,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(h(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(m,7,0,7),i.addMany(u,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(h(64,127),3,7,0),i.addMany(h(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(h(48,60),4,8,4),i.addMany(h(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(h(32,64),6,0,6),i.add(127,6,0,6),i.addMany(h(64,127),6,0,0),i.addMany(h(32,48),3,9,5),i.addMany(h(32,48),5,9,5),i.addMany(h(48,64),5,0,6),i.addMany(h(64,127),5,7,0),i.addMany(h(32,48),4,9,5),i.addMany(h(32,48),1,9,2),i.addMany(h(32,48),2,9,2),i.addMany(h(48,127),2,10,0),i.addMany(h(48,80),1,10,0),i.addMany(h(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(h(96,127),1,10,0),i.add(80,1,11,9),i.addMany(u,9,0,9),i.add(127,9,0,9),i.addMany(h(28,32),9,0,9),i.addMany(h(32,48),9,9,12),i.addMany(h(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(u,11,0,11),i.addMany(h(32,128),11,0,11),i.addMany(h(28,32),11,0,11),i.addMany(u,10,0,10),i.add(127,10,0,10),i.addMany(h(28,32),10,0,10),i.addMany(h(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(h(32,48),10,9,12),i.addMany(u,12,0,12),i.add(127,12,0,12),i.addMany(h(28,32),12,0,12),i.addMany(h(32,48),12,9,12),i.addMany(h(48,64),12,0,11),i.addMany(h(64,127),12,12,13),i.addMany(h(64,127),10,12,13),i.addMany(h(64,127),9,12,13),i.addMany(u,13,13,13),i.addMany(m,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(v,0,2,0),i.add(v,8,5,8),i.add(v,6,0,6),i.add(v,11,0,11),i.add(v,13,13,13),i}();class o extends l.Disposable{constructor(i=t.VT500_TRANSITION_TABLE){super(),this._transitions=i,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(w,h,m)=>{},this._executeHandlerFb=(w)=>{},this._csiHandlerFb=(w,h)=>{},this._escHandlerFb=(w)=>{},this._errorHandlerFb=(w)=>w,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register((0,l.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new g.OscParser),this._dcsParser=this._register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(i,w=[64,126]){let h=0;if(i.prefix){if(i.prefix.length>1)throw Error("only one byte as prefix supported");if(h=i.prefix.charCodeAt(0),h&&60>h||h>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let u=0;u<i.intermediates.length;++u){let S=i.intermediates.charCodeAt(u);if(32>S||S>47)throw Error("intermediate must be in range 0x20 .. 0x2f");h<<=8,h|=S}}if(i.final.length!==1)throw Error("final must be a single byte");let m=i.final.charCodeAt(0);if(w[0]>m||m>w[1])throw Error(`final must be in range ${w[0]} .. ${w[1]}`);return h<<=8,h|=m,h}identToString(i){let w=[];for(;i;)w.push(String.fromCharCode(255&i)),i>>=8;return w.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,w){let h=this._identifier(i,[48,126]);this._escHandlers[h]===void 0&&(this._escHandlers[h]=[]);let m=this._escHandlers[h];return m.push(w),{dispose:()=>{let u=m.indexOf(w);u!==-1&&m.splice(u,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,w){this._executeHandlers[i.charCodeAt(0)]=w}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,w){let h=this._identifier(i);this._csiHandlers[h]===void 0&&(this._csiHandlers[h]=[]);let m=this._csiHandlers[h];return m.push(w),{dispose:()=>{let u=m.indexOf(w);u!==-1&&m.splice(u,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,w){return this._dcsParser.registerHandler(this._identifier(i),w)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,w){return this._oscParser.registerHandler(i,w)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}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(i,w,h,m,u){this._parseStack.state=i,this._parseStack.handlers=w,this._parseStack.handlerPos=h,this._parseStack.transition=m,this._parseStack.chunkPos=u}parse(i,w,h){let m,u=0,S=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(h===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let T=this._parseStack.handlers,B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(h===!1&&B>-1){for(;B>=0&&(m=T[B](this._params),m!==!0);B--)if(m instanceof Promise)return this._parseStack.handlerPos=B,m}this._parseStack.handlers=[];break;case 4:if(h===!1&&B>-1){for(;B>=0&&(m=T[B](),m!==!0);B--)if(m instanceof Promise)return this._parseStack.handlerPos=B,m}this._parseStack.handlers=[];break;case 6:if(u=i[this._parseStack.chunkPos],m=this._dcsParser.unhook(u!==24&&u!==26,h),m)return m;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(u=i[this._parseStack.chunkPos],m=this._oscParser.end(u!==24&&u!==26,h),m)return m;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=C;T<w;++T){switch(u=i[T],S=this._transitions.table[this.currentState<<8|(u<160?u:v)],S>>4){case 2:for(let k=T+1;;++k){if(k>=w||(u=i[k])<32||u>126&&u<v){this._printHandler(i,T,k),T=k-1;break}if(++k>=w||(u=i[k])<32||u>126&&u<v){this._printHandler(i,T,k),T=k-1;break}if(++k>=w||(u=i[k])<32||u>126&&u<v){this._printHandler(i,T,k),T=k-1;break}if(++k>=w||(u=i[k])<32||u>126&&u<v){this._printHandler(i,T,k),T=k-1;break}}break;case 3:this._executeHandlers[u]?this._executeHandlers[u]():this._executeHandlerFb(u),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:u,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let B=this._csiHandlers[this._collect<<8|u],O=B?B.length-1:-1;for(;O>=0&&(m=B[O](this._params),m!==!0);O--)if(m instanceof Promise)return this._preserveStack(3,B,O,S,T),m;O<0&&this._csiHandlerFb(this._collect<<8|u,this._params),this.precedingJoinState=0;break;case 8:do switch(u){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(u-48)}while(++T<w&&(u=i[T])>47&&u<60);T--;break;case 9:this._collect<<=8,this._collect|=u;break;case 10:let A=this._escHandlers[this._collect<<8|u],M=A?A.length-1:-1;for(;M>=0&&(m=A[M](),m!==!0);M--)if(m instanceof Promise)return this._preserveStack(4,A,M,S,T),m;M<0&&this._escHandlerFb(this._collect<<8|u),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|u,this._params);break;case 13:for(let k=T+1;;++k)if(k>=w||(u=i[k])===24||u===26||u===27||u>127&&u<v){this._dcsParser.put(i,T,k),T=k-1;break}break;case 14:if(m=this._dcsParser.unhook(u!==24&&u!==26),m)return this._preserveStack(6,[],0,S,T),m;u===27&&(S|=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 k=T+1;;k++)if(k>=w||(u=i[k])<32||u>127&&u<v){this._oscParser.put(i,T,k),T=k-1;break}break;case 6:if(m=this._oscParser.end(u!==24&&u!==26),m)return this._preserveStack(5,[],0,S,T),m;u===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}t.EscapeSequenceParser=o},1346:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let l=n(1263),p=n(726),g=[];t.OscParser=class{constructor(){this._state=0,this._active=g,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,_){this._handlers[d]===void 0&&(this._handlers[d]=[]);let v=this._handlers[d];return v.push(_),{dispose:()=>{let o=v.indexOf(_);o!==-1&&v.splice(o,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=g,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||g,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,_,v){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(d,_,v);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(d,_,v))}start(){this.reset(),this._state=1}put(d,_,v){if(this._state!==3){if(this._state===1)for(;_<v;){let o=d[_++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&v-_>0&&this._put(d,_,v)}}end(d,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,o=this._active.length-1,i=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,v=_,i=this._stack.fallThrough,this._stack.paused=!1),!i&&v===!1){for(;o>=0&&(v=this._active[o].end(d),v!==!0);o--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,v;o--}for(;o>=0;o--)if(v=this._active[o].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,v}else this._handlerFb(this._id,"END",d);this._active=g,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,_,v){this._hitLimit||(this._data+=(0,p.utf32ToString)(d,_,v),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let _=!1;if(this._hitLimit)_=!1;else if(d&&(_=this._handler(this._data),_ instanceof Promise))return _.then((v)=>(this._data="",this._hitLimit=!1,v));return this._data="",this._hitLimit=!1,_}}},7262:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class l{static fromArray(p){let g=new l;if(!p.length)return g;for(let d=Array.isArray(p[0])?1:0;d<p.length;++d){let _=p[d];if(Array.isArray(_))for(let v=0;v<_.length;++v)g.addSubParam(_[v]);else g.addParam(_)}return g}constructor(p=32,g=32){if(this.maxLength=p,this.maxSubParamsLength=g,g>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let p=new l(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){let p=[];for(let g=0;g<this.length;++g){p.push(this.params[g]);let d=this._subParamsIdx[g]>>8,_=255&this._subParamsIdx[g];_-d>0&&p.push(Array.prototype.slice.call(this._subParams,d,_))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>n?n:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>n?n:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){let g=this._subParamsIdx[p]>>8,d=255&this._subParamsIdx[p];return d-g>0?this._subParams.subarray(g,d):null}getSubParamsAll(){let p={};for(let g=0;g<this.length;++g){let d=this._subParamsIdx[g]>>8,_=255&this._subParamsIdx[g];_-d>0&&(p[g]=this._subParams.slice(d,_))}return p}addDigit(p){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let d=this._digitIsSub?this._subParams:this.params,_=d[g-1];d[g-1]=~_?Math.min(10*_+p,n):p}}t.Params=l},3027:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,l){let p={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(p),l.dispose=()=>this._wrappedAddonDispose(p),l.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let l=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===n){l=p;break}if(l===-1)throw Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(l,1)}}},3235:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let l=n(793),p=n(3055);t.BufferApiView=class{constructor(g,d){this._buffer=g,this.type=d}init(g){return this._buffer=g,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(g){let d=this._buffer.lines.get(g);if(d)return new l.BufferLineApiView(d)}getNullCell(){return new p.CellData}}},793:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let l=n(3055);t.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,g){if(!(p<0||p>=this._line.length))return g?(this._line.loadCell(p,g),g):this._line.loadCell(p,new l.CellData)}translateToString(p,g,d){return this._line.translateToString(p,g,d)}}},5101:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let l=n(3235),p=n(7150),g=n(802);class d extends p.Disposable{constructor(_){super(),this._core=_,this._onBufferChange=this._register(new g.Emitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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 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)}}t.BufferNamespaceApi=d},6097:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,l){return this._core.registerCsiHandler(n,(p)=>l(p.toArray()))}addCsiHandler(n,l){return this.registerCsiHandler(n,l)}registerDcsHandler(n,l){return this._core.registerDcsHandler(n,(p,g)=>l(p,g.toArray()))}addDcsHandler(n,l){return this.registerDcsHandler(n,l)}registerEscHandler(n,l){return this._core.registerEscHandler(n,l)}addEscHandler(n,l){return this.registerEscHandler(n,l)}registerOscHandler(n,l){return this._core.registerOscHandler(n,l)}addOscHandler(n,l){return this.registerOscHandler(n,l)}}},4335:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},9640:function(y,t,n){var l=this&&this.__decorate||function(i,w,h,m){var u,S=arguments.length,C=S<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,w,h,m);else for(var T=i.length-1;T>=0;T--)(u=i[T])&&(C=(S<3?u(C):S>3?u(w,h,C):u(w,h))||C);return S>3&&C&&Object.defineProperty(w,h,C),C},p=this&&this.__param||function(i,w){return function(h,m){w(h,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let g=n(7150),d=n(4097),_=n(6501),v=n(802);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this._register(new v.Emitter),this.onResize=this._onResize.event,this._onScroll=this._register(new v.Emitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this._register(new d.BufferSet(i,this)),this._register(this.buffers.onBufferActivate((w)=>{this._onScroll.fire(w.activeBuffer.ydisp)}))}resize(i,w){let h=this.cols!==i,m=this.rows!==w;this.cols=i,this.rows=w,this.buffers.resize(i,w),this._onResize.fire({cols:i,rows:w,colsChanged:h,rowsChanged:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,w=!1){let h=this.buffer,m;m=this._cachedBlankLine,m&&m.length===this.cols&&m.getFg(0)===i.fg&&m.getBg(0)===i.bg||(m=h.getBlankLine(i,w),this._cachedBlankLine=m),m.isWrapped=w;let u=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let C=h.lines.isFull;S===h.lines.length-1?C?h.lines.recycle().copyFrom(m):h.lines.push(m.clone()):h.lines.splice(S+1,0,m.clone()),C?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let C=S-u+1;h.lines.shiftElements(u+1,C-1,-1),h.lines.set(S,m.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(i,w){let h=this.buffer;if(i<0){if(h.ydisp===0)return;this.isUserScrolling=!0}else i+h.ydisp>=h.ybase&&(this.isUserScrolling=!1);let m=h.ydisp;h.ydisp=Math.max(Math.min(h.ydisp+i,h.ybase),0),m!==h.ydisp&&(w||this._onScroll.fire(h.ydisp))}};t.BufferService=o,t.BufferService=o=l([p(0,_.IOptionsService)],o)},5746:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,l){this._charsets[n]=l,this.glevel===n&&(this.charset=l)}}},7792:function(y,t,n){var l=this&&this.__decorate||function(m,u,S,C){var T,B=arguments.length,O=B<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,S):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(m,u,S,C);else for(var A=m.length-1;A>=0;A--)(T=m[A])&&(O=(B<3?T(O):B>3?T(u,S,O):T(u,S))||O);return B>3&&O&&Object.defineProperty(u,S,O),O},p=this&&this.__param||function(m,u){return function(S,C){u(S,C,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let g=n(6501),d=n(7150),_=n(802),v={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(m)=>m.button!==4&&m.action===1&&(m.ctrl=!1,m.alt=!1,m.shift=!1,!0)},VT200:{events:19,restrict:(m)=>m.action!==32},DRAG:{events:23,restrict:(m)=>m.action!==32||m.button!==3},ANY:{events:31,restrict:(m)=>!0}};function o(m,u){let S=(m.ctrl?16:0)|(m.shift?4:0)|(m.alt?8:0);return m.button===4?(S|=64,S|=m.action):(S|=3&m.button,4&m.button&&(S|=64),8&m.button&&(S|=128),m.action===32?S|=32:m.action!==0||u||(S|=3)),S}let i=String.fromCharCode,w={DEFAULT:(m)=>{let u=[o(m,!1)+32,m.col+32,m.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${i(u[0])}${i(u[1])}${i(u[2])}`},SGR:(m)=>{let u=m.action===0&&m.button!==4?"m":"M";return`\x1B[<${o(m,!0)};${m.col};${m.row}${u}`},SGR_PIXELS:(m)=>{let u=m.action===0&&m.button!==4?"m":"M";return`\x1B[<${o(m,!0)};${m.x};${m.y}${u}`}},h=class extends d.Disposable{constructor(m,u,S){super(),this._bufferService=m,this._coreService=u,this._optionsService=S,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _.Emitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(v))this.addProtocol(C,v[C]);for(let C of Object.keys(w))this.addEncoding(C,w[C]);this.reset()}addProtocol(m,u){this._protocols[m]=u}addEncoding(m,u){this._encodings[m]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(m){if(!this._protocols[m])throw Error(`unknown protocol "${m}"`);this._activeProtocol=m,this._onProtocolChange.fire(this._protocols[m].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(m){if(!this._encodings[m])throw Error(`unknown encoding "${m}"`);this._activeEncoding=m}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(m,u,S){if(m.deltaY===0||m.shiftKey)return 0;if(u===void 0||S===void 0)return 0;let C=u/S,T=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(T/=C+0,Math.abs(m.deltaY)<50&&(T*=0.3),this._wheelPartialScroll+=T,T=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(T*=this._bufferService.rows),T}_applyScrollModifier(m,u){return u.altKey||u.ctrlKey||u.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(m){if(m.col<0||m.col>=this._bufferService.cols||m.row<0||m.row>=this._bufferService.rows)return!1;if(m.button===4&&m.action===32)return!1;if(m.button===3&&m.action!==32)return!1;if(m.button!==4&&(m.action===2||m.action===3))return!1;if(m.col++,m.row++,m.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,m,this._activeEncoding==="SGR_PIXELS"))return!1;if(!this._protocols[this._activeProtocol].restrict(m))return!1;let u=this._encodings[this._activeEncoding](m);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=m,!0}explainEvents(m){return{down:!!(1&m),up:!!(2&m),drag:!!(4&m),move:!!(8&m),wheel:!!(16&m)}}_equalEvents(m,u,S){if(S){if(m.x!==u.x)return!1;if(m.y!==u.y)return!1}else{if(m.col!==u.col)return!1;if(m.row!==u.row)return!1}return m.button===u.button&&m.action===u.action&&m.ctrl===u.ctrl&&m.alt===u.alt&&m.shift===u.shift}};t.CoreMouseService=h,t.CoreMouseService=h=l([p(0,g.IBufferService),p(1,g.ICoreService),p(2,g.IOptionsService)],h)},4071:function(y,t,n){var l=this&&this.__decorate||function(h,m,u,S){var C,T=arguments.length,B=T<3?m:S===null?S=Object.getOwnPropertyDescriptor(m,u):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(h,m,u,S);else for(var O=h.length-1;O>=0;O--)(C=h[O])&&(B=(T<3?C(B):T>3?C(m,u,B):C(m,u))||B);return T>3&&B&&Object.defineProperty(m,u,B),B},p=this&&this.__param||function(h,m){return function(u,S){m(u,S,h)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let g=n(7453),d=n(7150),_=n(6501),v=n(802),o=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),w=class extends d.Disposable{constructor(h,m,u){super(),this._bufferService=h,this._logService=m,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new v.Emitter),this.onData=this._onData.event,this._onUserInput=this._register(new v.Emitter),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new v.Emitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new v.Emitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,g.clone)(o),this.decPrivateModes=(0,g.clone)(i)}reset(){this.modes=(0,g.clone)(o),this.decPrivateModes=(0,g.clone)(i)}triggerDataEvent(h,m=!1){if(this._optionsService.rawOptions.disableStdin)return;let u=this._bufferService.buffer;m&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),m&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`),this._logService.trace("sending data (codes)",()=>h.split("").map((S)=>S.charCodeAt(0))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`),this._logService.trace("sending binary (codes)",()=>h.split("").map((m)=>m.charCodeAt(0))),this._onBinary.fire(h))}};t.CoreService=w,t.CoreService=w=l([p(0,_.IBufferService),p(1,_.ILogService),p(2,_.IOptionsService)],w)},6025:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let l=n(6501),p=n(6201);class g{constructor(...d){this._entries=new Map;for(let[_,v]of d)this.set(_,v)}set(d,_){let v=this._entries.get(d);return this._entries.set(d,_),v}forEach(d){for(let[_,v]of this._entries.entries())d(_,v)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}t.ServiceCollection=g,t.InstantiationService=class{constructor(){this._services=new g,this._services.set(l.IInstantiationService,this)}setService(d,_){this._services.set(d,_)}getService(d){return this._services.get(d)}createInstance(d,..._){let v=(0,p.getServiceDependencies)(d).sort((w,h)=>w.index-h.index),o=[];for(let w of v){let h=this._services.get(w.id);if(!h)throw Error(`[createInstance] ${d.name} depends on UNKNOWN service ${w.id._id}.`);o.push(h)}let i=v.length>0?v[0].index:_.length;if(_.length!==i)throw Error(`[createInstance] First service dependency of ${d.name} at position ${i+1} conflicts with ${_.length} static arguments`);return new d(...[..._,...o])}}},7276:function(y,t,n){var l=this&&this.__decorate||function(i,w,h,m){var u,S=arguments.length,C=S<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,w,h,m);else for(var T=i.length-1;T>=0;T--)(u=i[T])&&(C=(S<3?u(C):S>3?u(w,h,C):u(w,h))||C);return S>3&&C&&Object.defineProperty(w,h,C),C},p=this&&this.__param||function(i,w){return function(h,m){w(h,m,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=void 0,t.setTraceLogger=function(i){v=i},t.traceCall=function(i,w,h){if(typeof h.value!="function")throw Error("not supported");let m=h.value;h.value=function(...u){if(v.logLevel!==d.LogLevelEnum.TRACE)return m.apply(this,u);v.trace(`GlyphRenderer#${m.name}(${u.map((C)=>JSON.stringify(C)).join(", ")})`);let S=m.apply(this,u);return v.trace(`GlyphRenderer#${m.name} return`,S),S}};let g=n(7150),d=n(6501),_={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF},v,o=class extends g.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),v=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let w=0;w<i.length;w++)typeof i[w]=="function"&&(i[w]=i[w]())}_log(i,w,h){this._evalLazyOptionalParams(h),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+w,...h)}trace(i,...w){this._logLevel<=d.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,w)}debug(i,...w){this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,w)}info(i,...w){this._logLevel<=d.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,w)}warn(i,...w){this._logLevel<=d.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,w)}error(i,...w){this._logLevel<=d.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,w)}};t.LogService=o,t.LogService=o=l([p(0,d.IOptionsService)],o)},56:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let l=n(7150),p=n(701),g=n(802);t.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:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}};let d=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends l.Disposable{constructor(v){super(),this._onOptionChange=this._register(new g.Emitter),this.onOptionChange=this._onOptionChange.event;let o={...t.DEFAULT_OPTIONS};for(let i in v)if(i in o)try{let w=v[i];o[i]=this._sanitizeAndValidateOption(i,w)}catch(w){console.error(w)}this.rawOptions=o,this.options={...o},this._setupOptions(),this._register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(v,o){return this.onOptionChange((i)=>{i===v&&o(this.rawOptions[v])})}onMultipleOptionChange(v,o){return this.onOptionChange((i)=>{v.indexOf(i)!==-1&&o()})}_setupOptions(){let v=(i)=>{if(!(i in t.DEFAULT_OPTIONS))throw Error(`No option with key "${i}"`);return this.rawOptions[i]},o=(i,w)=>{if(!(i in t.DEFAULT_OPTIONS))throw Error(`No option with key "${i}"`);w=this._sanitizeAndValidateOption(i,w),this.rawOptions[i]!==w&&(this.rawOptions[i]=w,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let w={get:v.bind(this,i),set:o.bind(this,i)};Object.defineProperty(this.options,i,w)}}_sanitizeAndValidateOption(v,o){switch(v){case"cursorStyle":if(o||(o=t.DEFAULT_OPTIONS[v]),!function(i){return i==="block"||i==="underline"||i==="bar"}(o))throw Error(`"${o}" is not a valid value for ${v}`);break;case"wordSeparator":o||(o=t.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof o=="number"&&1<=o&&o<=1000)break;o=d.includes(o)?o:t.DEFAULT_OPTIONS[v];break;case"cursorWidth":o=Math.floor(o);case"lineHeight":case"tabStopWidth":if(o<1)throw Error(`${v} cannot be less than 1, value: ${o}`);break;case"minimumContrastRatio":o=Math.max(1,Math.min(21,Math.round(10*o)/10));break;case"scrollback":if((o=Math.min(o,4294967295))<0)throw Error(`${v} cannot be less than 0, value: ${o}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(o<=0)throw Error(`${v} cannot be less than or equal to 0, value: ${o}`);break;case"rows":case"cols":if(!o&&o!==0)throw Error(`${v} must be numeric, value: ${o}`);break;case"windowsPty":o=o??{}}return o}}t.OptionsService=_},8811:function(y,t,n){var l=this&&this.__decorate||function(_,v,o,i){var w,h=arguments.length,m=h<3?v:i===null?i=Object.getOwnPropertyDescriptor(v,o):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(_,v,o,i);else for(var u=_.length-1;u>=0;u--)(w=_[u])&&(m=(h<3?w(m):h>3?w(v,o,m):w(v,o))||m);return h>3&&m&&Object.defineProperty(v,o,m),m},p=this&&this.__param||function(_,v){return function(o,i){v(o,i,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let g=n(6501),d=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){let v=this._bufferService.buffer;if(_.id===void 0){let u=v.addMarker(v.ybase+v.y),S={data:_,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(S,u)),this._dataByLinkId.set(S.id,S),S.id}let o=_,i=this._getEntryIdKey(o),w=this._entriesWithId.get(i);if(w)return this.addLineToLink(w.id,v.ybase+v.y),w.id;let h=v.addMarker(v.ybase+v.y),m={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(m,h)),this._entriesWithId.set(m.key,m),this._dataByLinkId.set(m.id,m),m.id}addLineToLink(_,v){let o=this._dataByLinkId.get(_);if(o&&o.lines.every((i)=>i.line!==v)){let i=this._bufferService.buffer.addMarker(v);o.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(o,i))}}getLinkData(_){return this._dataByLinkId.get(_)?.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,v){let o=_.lines.indexOf(v);o!==-1&&(_.lines.splice(o,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};t.OscLinkService=d,t.OscLinkService=d=l([p(0,g.IBufferService)],d)},6201:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.serviceRegistry=void 0,t.getServiceDependencies=function(p){return p[l]||[]},t.createDecorator=function(p){if(t.serviceRegistry.has(p))return t.serviceRegistry.get(p);let g=function(d,_,v){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,i,w){i[n]===i?i[l].push({id:o,index:w}):(i[l]=[{id:o,index:w}],i[n]=i)})(g,d,v)};return g._id=p,t.serviceRegistry.set(p,g),g};let n="di$target",l="di$dependencies";t.serviceRegistry=new Map},6501:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let l=n(6201);var p;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(g){g[g.TRACE=0]="TRACE",g[g.DEBUG=1]="DEBUG",g[g.INFO=2]="INFO",g[g.WARN=3]="WARN",g[g.ERROR=4]="ERROR",g[g.OFF=5]="OFF"}(p||(t.LogLevelEnum=p={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")},6415:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let l=n(7428),p=n(802);class g{static extractShouldJoin(d){return!!(1&d)}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,_,v=!1){return(16777215&d)<<3|(3&_)<<1|(v?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.Emitter,this.onChange=this._onChange.event;let d=new l.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let _=0,v=0,o=d.length;for(let i=0;i<o;++i){let w=d.charCodeAt(i);if(55296<=w&&w<=56319){if(++i>=o)return _+this.wcwidth(w);let u=d.charCodeAt(i);56320<=u&&u<=57343?w=1024*(w-55296)+u-56320+65536:_+=this.wcwidth(u)}let h=this.charProperties(w,v),m=g.extractWidth(h);g.extractShouldJoin(h)&&(m-=g.extractWidth(v)),_+=m,v=h}return _}charProperties(d,_){return this._activeProvider.charProperties(d,_)}}t.UnicodeService=g},5856:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let l=n(6107),p=n(5777),g=n(802);class d extends p.CoreTerminal{constructor(_={}){super(_),this._onBell=this._register(new g.Emitter),this.onBell=this._onBell.event,this._onCursorMove=this._register(new g.Emitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this._register(new g.Emitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this._register(new g.Emitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this._register(new g.Emitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this._register(this._inputHandler.onRequestBell(()=>this.bell())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(g.Event.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(g.Event.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(g.Event.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(g.Event.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(_){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+_)}bell(){this._onBell.fire()}input(_,v=!0){this.coreService.triggerDataEvent(_,v)}resize(_,v){_===this.cols&&v===this.rows||super.resize(_,v)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let _=1;_<this.rows;_++)this.buffer.lines.push(this.buffer.getBlankLine(l.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}t.Terminal=d},3058:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Permutation=t.CallbackIterable=t.ArrayQueue=t.booleanComparator=t.numberComparator=t.CompareResult=void 0,t.tail=function(u,S=0){return u[u.length-(1+S)]},t.tail2=function(u){if(u.length===0)throw Error("Invalid tail call");return[u.slice(0,u.length-1),u[u.length-1]]},t.equals=function(u,S,C=(T,B)=>T===B){if(u===S)return!0;if(!u||!S)return!1;if(u.length!==S.length)return!1;for(let T=0,B=u.length;T<B;T++)if(!C(u[T],S[T]))return!1;return!0},t.removeFastWithoutKeepingOrder=function(u,S){let C=u.length-1;S<C&&(u[S]=u[C]),u.pop()},t.binarySearch=function(u,S,C){return g(u.length,(T)=>C(u[T],S))},t.binarySearch2=g,t.quickSelect=function u(S,C,T){if((S|=0)>=C.length)throw TypeError("invalid index");let B=C[Math.floor(C.length*Math.random())],O=[],A=[],M=[];for(let k of C){let P=T(k,B);P<0?O.push(k):P>0?A.push(k):M.push(k)}return S<O.length?u(S,O,T):S<O.length+M.length?M[0]:u(S-(O.length+M.length),A,T)},t.groupBy=function(u,S){let C=[],T;for(let B of u.slice(0).sort(S))T&&S(T[0],B)===0?T.push(B):(T=[B],C.push(T));return C},t.groupAdjacentBy=function*(u,S){let C,T;for(let B of u)T!==void 0&&S(T,B)?C.push(B):(C&&(yield C),C=[B]),T=B;C&&(yield C)},t.forEachAdjacent=function(u,S){for(let C=0;C<=u.length;C++)S(C===0?void 0:u[C-1],C===u.length?void 0:u[C])},t.forEachWithNeighbors=function(u,S){for(let C=0;C<u.length;C++)S(C===0?void 0:u[C-1],u[C],C+1===u.length?void 0:u[C+1])},t.sortedDiff=d,t.delta=function(u,S,C){let T=d(u,S,C),B=[],O=[];for(let A of T)B.push(...u.slice(A.start,A.start+A.deleteCount)),O.push(...A.toInsert);return{removed:B,added:O}},t.top=function(u,S,C){if(C===0)return[];let T=u.slice(0,C).sort(S);return _(u,S,T,C,u.length),T},t.topAsync=function(u,S,C,T,B){return C===0?Promise.resolve([]):new Promise((O,A)=>{(async()=>{let M=u.length,k=u.slice(0,C).sort(S);for(let P=C,W=Math.min(C+T,M);P<M;P=W,W=Math.min(W+T,M)){if(P>C&&await new Promise((z)=>setTimeout(z)),B&&B.isCancellationRequested)throw new l.CancellationError;_(u,S,k,P,W)}return k})().then(O,A)})},t.coalesce=function(u){return u.filter((S)=>!!S)},t.coalesceInPlace=function(u){let S=0;for(let C=0;C<u.length;C++)u[C]&&(u[S]=u[C],S+=1);u.length=S},t.move=function(u,S,C){u.splice(C,0,u.splice(S,1)[0])},t.isFalsyOrEmpty=function(u){return!Array.isArray(u)||u.length===0},t.isNonEmptyArray=function(u){return Array.isArray(u)&&u.length>0},t.distinct=function(u,S=(C)=>C){let C=new Set;return u.filter((T)=>{let B=S(T);return!C.has(B)&&(C.add(B),!0)})},t.uniqueFilter=function(u){let S=new Set;return(C)=>{let T=u(C);return!S.has(T)&&(S.add(T),!0)}},t.firstOrDefault=function(u,S){return u.length>0?u[0]:S},t.lastOrDefault=function(u,S){return u.length>0?u[u.length-1]:S},t.commonPrefixLength=function(u,S,C=(T,B)=>T===B){let T=0;for(let B=0,O=Math.min(u.length,S.length);B<O&&C(u[B],S[B]);B++)T++;return T},t.range=function(u,S){let C=typeof S=="number"?u:0;typeof S=="number"?C=u:(C=0,S=u);let T=[];if(C<=S)for(let B=C;B<S;B++)T.push(B);else for(let B=C;B>S;B--)T.push(B);return T},t.index=function(u,S,C){return u.reduce((T,B)=>(T[S(B)]=C?C(B):B,T),Object.create(null))},t.insert=function(u,S){return u.push(S),()=>v(u,S)},t.remove=v,t.arrayInsert=function(u,S,C){let T=u.slice(0,S),B=u.slice(S);return T.concat(C,B)},t.shuffle=function(u,S){let C;if(typeof S=="number"){let T=S;C=()=>{let B=179426549*Math.sin(T++);return B-Math.floor(B)}}else C=Math.random;for(let T=u.length-1;T>0;T-=1){let B=Math.floor(C()*(T+1)),O=u[T];u[T]=u[B],u[B]=O}},t.pushToStart=function(u,S){let C=u.indexOf(S);C>-1&&(u.splice(C,1),u.unshift(S))},t.pushToEnd=function(u,S){let C=u.indexOf(S);C>-1&&(u.splice(C,1),u.push(S))},t.pushMany=function(u,S){for(let C of S)u.push(C)},t.mapArrayOrNot=function(u,S){return Array.isArray(u)?u.map(S):S(u)},t.asArray=function(u){return Array.isArray(u)?u:[u]},t.getRandomElement=function(u){return u[Math.floor(Math.random()*u.length)]},t.insertInto=o,t.splice=function(u,S,C,T){let B=i(u,S),O=u.splice(B,C);return O===void 0&&(O=[]),o(u,B,T),O},t.compareBy=function(u,S){return(C,T)=>S(u(C),u(T))},t.tieBreakComparators=function(...u){return(S,C)=>{for(let T of u){let B=T(S,C);if(!w.isNeitherLessOrGreaterThan(B))return B}return w.neitherLessOrGreaterThan}},t.reverseOrder=function(u){return(S,C)=>-u(S,C)};let l=n(9807),p=n(8297);function g(u,S){let C=0,T=u-1;for(;C<=T;){let B=(C+T)/2|0,O=S(B);if(O<0)C=B+1;else{if(!(O>0))return B;T=B-1}}return-(C+1)}function d(u,S,C){let T=[];function B(M,k,P){if(k===0&&P.length===0)return;let W=T[T.length-1];W&&W.start+W.deleteCount===M?(W.deleteCount+=k,W.toInsert.push(...P)):T.push({start:M,deleteCount:k,toInsert:P})}let O=0,A=0;for(;;){if(O===u.length){B(O,0,S.slice(A));break}if(A===S.length){B(O,u.length-O,[]);break}let M=u[O],k=S[A],P=C(M,k);P===0?(O+=1,A+=1):P<0?(B(O,1,[]),O+=1):P>0&&(B(O,0,[k]),A+=1)}return T}function _(u,S,C,T,B){for(let O=C.length;T<B;T++){let A=u[T];if(S(A,C[O-1])<0){C.pop();let M=(0,p.findFirstIdxMonotonousOrArrLen)(C,(k)=>S(A,k)<0);C.splice(M,0,A)}}}function v(u,S){let C=u.indexOf(S);if(C>-1)return u.splice(C,1),S}function o(u,S,C){let T=i(u,S),B=u.length,O=C.length;u.length=B+O;for(let A=B-1;A>=T;A--)u[A+O]=u[A];for(let A=0;A<O;A++)u[A+T]=C[A]}function i(u,S){return S<0?Math.max(S+u.length,0):Math.min(S,u.length)}var w;(function(u){u.isLessThan=function(S){return S<0},u.isLessThanOrEqual=function(S){return S<=0},u.isGreaterThan=function(S){return S>0},u.isNeitherLessOrGreaterThan=function(S){return S===0},u.greaterThan=1,u.lessThan=-1,u.neitherLessOrGreaterThan=0})(w||(t.CompareResult=w={})),t.numberComparator=(u,S)=>u-S,t.booleanComparator=(u,S)=>(0,t.numberComparator)(u?1:0,S?1:0),t.ArrayQueue=class{constructor(u){this.items=u,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(u){let S=this.firstIdx;for(;S<this.items.length&&u(this.items[S]);)S++;let C=S===this.firstIdx?null:this.items.slice(this.firstIdx,S);return this.firstIdx=S,C}takeFromEndWhile(u){let S=this.lastIdx;for(;S>=0&&u(this.items[S]);)S--;let C=S===this.lastIdx?null:this.items.slice(S+1,this.lastIdx+1);return this.lastIdx=S,C}peek(){if(this.length!==0)return this.items[this.firstIdx]}peekLast(){if(this.length!==0)return this.items[this.lastIdx]}dequeue(){let u=this.items[this.firstIdx];return this.firstIdx++,u}removeLast(){let u=this.items[this.lastIdx];return this.lastIdx--,u}takeCount(u){let S=this.items.slice(this.firstIdx,this.firstIdx+u);return this.firstIdx+=u,S}};class h{static{this.empty=new h((u)=>{})}constructor(u){this.iterate=u}forEach(u){this.iterate((S)=>(u(S),!0))}toArray(){let u=[];return this.iterate((S)=>(u.push(S),!0)),u}filter(u){return new h((S)=>this.iterate((C)=>!u(C)||S(C)))}map(u){return new h((S)=>this.iterate((C)=>S(u(C))))}some(u){let S=!1;return this.iterate((C)=>(S=u(C),!S)),S}findFirst(u){let S;return this.iterate((C)=>!u(C)||(S=C,!1)),S}findLast(u){let S;return this.iterate((C)=>(u(C)&&(S=C),!0)),S}findLastMaxBy(u){let S,C=!0;return this.iterate((T)=>((C||w.isGreaterThan(u(T,S)))&&(C=!1,S=T),!0)),S}}t.CallbackIterable=h;class m{constructor(u){this._indexMap=u}static createSortPermutation(u,S){let C=Array.from(u.keys()).sort((T,B)=>S(u[T],u[B]));return new m(C)}apply(u){return u.map((S,C)=>u[this._indexMap[C]])}inverse(){let u=this._indexMap.slice();for(let S=0;S<this._indexMap.length;S++)u[this._indexMap[S]]=S;return new m(u)}}t.Permutation=m},8297:(y,t)=>{function n(_,v,o=_.length-1){for(let i=o;i>=0;i--)if(v(_[i]))return i;return-1}function l(_,v,o=0,i=_.length){let w=o,h=i;for(;w<h;){let m=Math.floor((w+h)/2);v(_[m])?w=m+1:h=m}return w-1}function p(_,v,o=0,i=_.length){let w=o,h=i;for(;w<h;){let m=Math.floor((w+h)/2);v(_[m])?h=m:w=m+1}return w}Object.defineProperty(t,"__esModule",{value:!0}),t.MonotonousArray=void 0,t.findLast=function(_,v){let o=n(_,v);if(o!==-1)return _[o]},t.findLastIdx=n,t.findLastMonotonous=function(_,v){let o=l(_,v);return o===-1?void 0:_[o]},t.findLastIdxMonotonous=l,t.findFirstMonotonous=function(_,v){let o=p(_,v);return o===_.length?void 0:_[o]},t.findFirstIdxMonotonousOrArrLen=p,t.findFirstIdxMonotonous=function(_,v,o=0,i=_.length){let w=p(_,v,o,i);return w===_.length?-1:w},t.findFirstMax=d,t.findLastMax=function(_,v){if(_.length===0)return;let o=_[0];for(let i=1;i<_.length;i++){let w=_[i];v(w,o)>=0&&(o=w)}return o},t.findFirstMin=function(_,v){return d(_,(o,i)=>-v(o,i))},t.findMaxIdx=function(_,v){if(_.length===0)return-1;let o=0;for(let i=1;i<_.length;i++)v(_[i],_[o])>0&&(o=i);return o},t.mapFindFirst=function(_,v){for(let o of _){let i=v(o);if(i!==void 0)return i}};class g{static{this.assertInvariants=!1}constructor(_){this._array=_,this._findLastMonotonousLastIdx=0}findLastMonotonous(_){if(g.assertInvariants){if(this._prevFindLastPredicate){for(let o of this._array)if(this._prevFindLastPredicate(o)&&!_(o))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=_}let v=l(this._array,_,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=v+1,v===-1?void 0:this._array[v]}}function d(_,v){if(_.length===0)return;let o=_[0];for(let i=1;i<_.length;i++){let w=_[i];v(w,o)>0&&(o=w)}return o}t.MonotonousArray=g},9087:(y,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SetWithKey=void 0,t.groupBy=function(p,g){let d=Object.create(null);for(let _ of p){let v=g(_),o=d[v];o||(o=d[v]=[]),o.push(_)}return d},t.diffSets=function(p,g){let d=[],_=[];for(let v of p)g.has(v)||d.push(v);for(let v of g)p.has(v)||_.push(v);return{removed:d,added:_}},t.diffMaps=function(p,g){let d=[],_=[];for(let[v,o]of p)g.has(v)||d.push(o);for(let[v,o]of g)p.has(v)||_.push(o);return{removed:d,added:_}},t.intersection=function(p,g){let d=new Set;for(let _ of g)p.has(_)&&d.add(_);return d};class l{static{n=Symbol.toStringTag}constructor(p,g){this.toKey=g,this._map=new Map,this[n]="SetWithKey";for(let d of p)this.add(d)}get size(){return this._map.size}add(p){let g=this.toKey(p);return this._map.set(g,p),this}delete(p){return this._map.delete(this.toKey(p))}has(p){return this._map.has(this.toKey(p))}*entries(){for(let p of this._map.values())yield[p,p]}keys(){return this.values()}*values(){for(let p of this._map.values())yield p}clear(){this._map.clear()}forEach(p,g){this._map.forEach((d)=>p.call(g,d,d,this))}[Symbol.iterator](){return this.values()}}t.SetWithKey=l},9807:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BugIndicatingError=t.ErrorNoTelemetry=t.ExpectedError=t.NotSupportedError=t.NotImplementedError=t.ReadonlyError=t.CancellationError=t.errorHandler=t.ErrorHandler=void 0,t.setUnexpectedErrorHandler=function(h){t.errorHandler.setUnexpectedErrorHandler(h)},t.isSigPipeError=function(h){if(!h||typeof h!="object")return!1;let m=h;return m.code==="EPIPE"&&m.syscall?.toUpperCase()==="WRITE"},t.onUnexpectedError=function(h){p(h)||t.errorHandler.onUnexpectedError(h)},t.onUnexpectedExternalError=function(h){p(h)||t.errorHandler.onUnexpectedExternalError(h)},t.transformErrorForSerialization=function(h){if(h instanceof Error){let{name:m,message:u}=h;return{$isError:!0,name:m,message:u,stack:h.stacktrace||h.stack,noTelemetry:i.isErrorNoTelemetry(h)}}return h},t.transformErrorFromSerialization=function(h){let m;return h.noTelemetry?m=new i:(m=Error(),m.name=h.name),m.message=h.message,m.stack=h.stack,m},t.isCancellationError=p,t.canceled=function(){let h=Error(l);return h.name=h.message,h},t.illegalArgument=function(h){return h?Error(`Illegal argument: ${h}`):Error("Illegal argument")},t.illegalState=function(h){return h?Error(`Illegal state: ${h}`):Error("Illegal state")},t.getErrorMessage=function(h){return h?h.message?h.message:h.stack?h.stack.split(`
|
|
5
|
+
`)[0]:String(h):"Error"};class n{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(h){setTimeout(()=>{if(h.stack){if(i.isErrorNoTelemetry(h))throw new i(h.message+`
|
|
6
6
|
|
|
7
|
-
`+
|
|
7
|
+
`+h.stack);throw Error(h.message+`
|
|
8
8
|
|
|
9
|
-
`+
|
|
9
|
+
`+h.stack)}throw h},0)}}addListener(h){return this.listeners.push(h),()=>{this._removeListener(h)}}emit(h){this.listeners.forEach((m)=>{m(h)})}_removeListener(h){this.listeners.splice(this.listeners.indexOf(h),1)}setUnexpectedErrorHandler(h){this.unexpectedErrorHandler=h}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(h){this.unexpectedErrorHandler(h),this.emit(h)}onUnexpectedExternalError(h){this.unexpectedErrorHandler(h)}}t.ErrorHandler=n,t.errorHandler=new n;let l="Canceled";function p(h){return h instanceof g||h instanceof Error&&h.name===l&&h.message===l}class g extends Error{constructor(){super(l),this.name=this.message}}t.CancellationError=g;class d extends TypeError{constructor(h){super(h?`${h} is read-only and cannot be changed`:"Cannot change read-only property")}}t.ReadonlyError=d;class _ extends Error{constructor(h){super("NotImplemented"),h&&(this.message=h)}}t.NotImplementedError=_;class v extends Error{constructor(h){super("NotSupported"),h&&(this.message=h)}}t.NotSupportedError=v;class o extends Error{constructor(){super(...arguments),this.isExpected=!0}}t.ExpectedError=o;class i extends Error{constructor(h){super(h),this.name="CodeExpectedError"}static fromError(h){if(h instanceof i)return h;let m=new i;return m.message=h.message,m.stack=h.stack,m}static isErrorNoTelemetry(h){return h.name==="CodeExpectedError"}}t.ErrorNoTelemetry=i;class w extends Error{constructor(h){super(h||"An unexpected bug occurred."),Object.setPrototypeOf(this,w.prototype)}}t.BugIndicatingError=w},802:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueWithChangeEvent=t.Relay=t.EventBufferer=t.DynamicListEventMultiplexer=t.EventMultiplexer=t.MicrotaskEmitter=t.DebounceEmitter=t.PauseableEmitter=t.AsyncEmitter=t.createEventDeliveryQueue=t.Emitter=t.ListenerRefusalError=t.ListenerLeakError=t.EventProfiling=t.Event=void 0,t.setGlobalLeakWarningThreshold=function(k){let P=i;return i=k,{dispose(){i=P}}};let l=n(9807),p=n(8841),g=n(7150),d=n(6317),_=n(9725);var v;(function(k){function P(E){return(D,H=null,I)=>{let N,j=!1;return N=E((R)=>{if(!j)return N?N.dispose():j=!0,D.call(H,R)},null,I),j&&N.dispose(),N}}function W(E,D,H){return q((I,N=null,j)=>E((R)=>I.call(N,D(R)),null,j),H)}function z(E,D,H){return q((I,N=null,j)=>E((R)=>D(R)&&I.call(N,R),null,j),H)}function q(E,D){let H,I=new T({onWillAddFirstListener(){H=E(I.fire,I)},onDidRemoveLastListener(){H?.dispose()}});return D?.add(I),I.event}function F(E,D,H=100,I=!1,N=!1,j,R){let G,U,X,se,ie=0,ae=new T({leakWarningThreshold:j,onWillAddFirstListener(){G=E((ce)=>{ie++,U=D(U,ce),I&&!X&&(ae.fire(U),U=void 0),se=()=>{let he=U;U=void 0,X=void 0,(!I||ie>1)&&ae.fire(he),ie=0},typeof H=="number"?(clearTimeout(X),X=setTimeout(se,H)):X===void 0&&(X=0,queueMicrotask(se))})},onWillRemoveListener(){N&&ie>0&&se?.()},onDidRemoveLastListener(){se=void 0,G.dispose()}});return R?.add(ae),ae.event}k.None=()=>g.Disposable.None,k.defer=function(E,D){return F(E,()=>{},0,void 0,!0,void 0,D)},k.once=P,k.map=W,k.forEach=function(E,D,H){return q((I,N=null,j)=>E((R)=>{D(R),I.call(N,R)},null,j),H)},k.filter=z,k.signal=function(E){return E},k.any=function(...E){return(D,H=null,I)=>{return N=(0,g.combinedDisposable)(...E.map((R)=>R((G)=>D.call(H,G)))),(j=I)instanceof Array?j.push(N):j&&j.add(N),N;var N,j}},k.reduce=function(E,D,H,I){let N=H;return W(E,(j)=>(N=D(N,j),N),I)},k.debounce=F,k.accumulate=function(E,D=0,H){return k.debounce(E,(I,N)=>I?(I.push(N),I):[N],D,void 0,!0,void 0,H)},k.latch=function(E,D=(I,N)=>I===N,H){let I,N=!0;return z(E,(j)=>{let R=N||!D(j,I);return N=!1,I=j,R},H)},k.split=function(E,D,H){return[k.filter(E,D,H),k.filter(E,(I)=>!D(I),H)]},k.buffer=function(E,D=!1,H=[],I){let N=H.slice(),j=E((U)=>{N?N.push(U):G.fire(U)});I&&I.add(j);let R=()=>{N?.forEach((U)=>G.fire(U)),N=null},G=new T({onWillAddFirstListener(){j||(j=E((U)=>G.fire(U)),I&&I.add(j))},onDidAddFirstListener(){N&&(D?setTimeout(R):R())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return I&&I.add(G),G.event},k.chain=function(E,D){return(H,I,N)=>{let j=D(new x);return E(function(R){let G=j.evaluate(R);G!==b&&H.call(I,G)},void 0,N)}};let b=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push((D)=>(E(D),D)),this}filter(E){return this.steps.push((D)=>E(D)?D:b),this}reduce(E,D){let H=D;return this.steps.push((I)=>(H=E(H,I),H)),this}latch(E=(D,H)=>D===H){let D,H=!0;return this.steps.push((I)=>{let N=H||!E(I,D);return H=!1,D=I,N?I:b}),this}evaluate(E){for(let D of this.steps)if((E=D(E))===b)break;return E}}k.fromNodeEventEmitter=function(E,D,H=(I)=>I){let I=(...j)=>N.fire(H(...j)),N=new T({onWillAddFirstListener:()=>E.on(D,I),onDidRemoveLastListener:()=>E.removeListener(D,I)});return N.event},k.fromDOMEventEmitter=function(E,D,H=(I)=>I){let I=(...j)=>N.fire(H(...j)),N=new T({onWillAddFirstListener:()=>E.addEventListener(D,I),onDidRemoveLastListener:()=>E.removeEventListener(D,I)});return N.event},k.toPromise=function(E){return new Promise((D)=>P(E)(D))},k.fromPromise=function(E){let D=new T;return E.then((H)=>{D.fire(H)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event},k.forward=function(E,D){return E((H)=>D.fire(H))},k.runAndSubscribe=function(E,D,H){return D(H),E((I)=>D(I))};class L{constructor(E,D){this._observable=E,this._counter=0,this._hasChanged=!1;let H={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new T(H),D&&D.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,D){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}k.fromObservable=function(E,D){return new L(E,D).emitter.event},k.fromObservableLight=function(E){return(D,H,I)=>{let N=0,j=!1,R={beginUpdate(){N++},endUpdate(){N--,N===0&&(E.reportChanges(),j&&(j=!1,D.call(H)))},handlePossibleChange(){},handleChange(){j=!0}};E.addObserver(R),E.reportChanges();let G={dispose(){E.removeObserver(R)}};return I instanceof g.DisposableStore?I.add(G):Array.isArray(I)&&I.push(G),G}}})(v||(t.Event=v={}));class o{static{this.all=new Set}static{this._idPool=0}constructor(k){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${k}_${o._idPool++}`,o.all.add(this)}start(k){this._stopWatch=new _.StopWatch,this.listenerCount=k}stop(){if(this._stopWatch){let k=this._stopWatch.elapsed();this.durations.push(k),this.elapsedOverall+=k,this.invocationCount+=1,this._stopWatch=void 0}}}t.EventProfiling=o;let i=-1;class w{static{this._idPool=1}constructor(k,P,W=(w._idPool++).toString(16).padStart(3,"0")){this._errorHandler=k,this.threshold=P,this.name=W,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(k,P){let W=this.threshold;if(W<=0||P<W)return;this._stacks||(this._stacks=new Map);let z=this._stacks.get(k.value)||0;if(this._stacks.set(k.value,z+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=0.5*W;let[q,F]=this.getMostFrequentStack(),b=`[${this.name}] potential listener LEAK detected, having ${P} listeners already. MOST frequent listener (${F}):`;console.warn(b),console.warn(q);let x=new m(b,q);this._errorHandler(x)}return()=>{let q=this._stacks.get(k.value)||0;this._stacks.set(k.value,q-1)}}getMostFrequentStack(){if(!this._stacks)return;let k,P=0;for(let[W,z]of this._stacks)(!k||P<z)&&(k=[W,z],P=z);return k}}class h{static create(){let k=Error();return new h(k.stack??"")}constructor(k){this.value=k}print(){console.warn(this.value.split(`
|
|
10
10
|
`).slice(2).join(`
|
|
11
|
-
`))}}class m extends Error{constructor(k,P){super(k),this.name="ListenerLeakError",this.stack=P}}t.ListenerLeakError=m;class c extends Error{constructor(k,P){super(k),this.name="ListenerRefusalError",this.stack=P}}t.ListenerRefusalError=c;let S=0;class C{constructor(k){this.value=k,this.id=S++}}class T{constructor(k){this._size=0,this._options=k,this._leakageMon=i>0||this._options?.leakWarningThreshold?new w(k?.onListenerError??f.onUnexpectedError,this._options?.leakWarningThreshold??i):void 0,this._perfMon=this._options?._profName?new n(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(k,P,W)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let b=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(b);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],L=new c(`${b}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(this._options?.onListenerError||f.onUnexpectedError)(L),_.Disposable.None}if(this._disposed)return _.Disposable.None;P&&(k=k.bind(P));let j=new C(k),q;this._leakageMon&&this._size>=Math.ceil(0.2*this._leakageMon.threshold)&&(j.stack=a.create(),q=this._leakageMon.check(j.stack,this._size+1)),this._listeners?this._listeners instanceof C?(this._deliveryQueue??=new B,this._listeners=[this._listeners,j]):this._listeners.push(j):(this._options?.onWillAddFirstListener?.(this),this._listeners=j,this._options?.onDidAddFirstListener?.(this)),this._size++;let F=(0,_.toDisposable)(()=>{q?.(),this._removeListener(j)});return W instanceof _.DisposableStore?W.add(F):Array.isArray(W)&&W.push(F),F},this._event}_removeListener(k){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1)return this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),void(this._size=0);let P=this._listeners,W=P.indexOf(k);if(W===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,P[W]=void 0;let j=this._deliveryQueue.current===this;if(2*this._size<=P.length){let q=0;for(let F=0;F<P.length;F++)P[F]?P[q++]=P[F]:j&&(this._deliveryQueue.end--,q<this._deliveryQueue.i&&this._deliveryQueue.i--);P.length=q}}_deliver(k,P){if(!k)return;let W=this._options?.onListenerError||f.onUnexpectedError;if(W)try{k.value(P)}catch(j){W(j)}else k.value(P)}_deliverQueue(k){let P=k.current._listeners;for(;k.i<k.end;)this._deliver(P[k.i++],k.value);k.reset()}fire(k){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof C)this._deliver(this._listeners,k);else{let P=this._deliveryQueue;P.enqueue(this,k,this._listeners.length),this._deliverQueue(P)}this._perfMon?.stop()}hasListeners(){return this._size>0}}t.Emitter=T,t.createEventDeliveryQueue=()=>new B;class B{constructor(){this.i=-1,this.end=0}enqueue(k,P,W){this.i=0,this.end=W,this.current=k,this.value=P}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}t.AsyncEmitter=class extends T{async fireAsync(k,P,W){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new l.LinkedList),((j,q)=>{if(j instanceof C)q(j);else for(let F=0;F<j.length;F++){let b=j[F];b&&q(b)}})(this._listeners,(j)=>this._asyncDeliveryQueue.push([j.value,k]));this._asyncDeliveryQueue.size>0&&!P.isCancellationRequested;){let[j,q]=this._asyncDeliveryQueue.shift(),F=[],b={...q,token:P,waitUntil:(x)=>{if(Object.isFrozen(F))throw Error("waitUntil can NOT be called asynchronous");W&&(x=W(x,j)),F.push(x)}};try{j(b)}catch(x){(0,f.onUnexpectedError)(x);continue}Object.freeze(F),await Promise.allSettled(F).then((x)=>{for(let L of x)L.status==="rejected"&&(0,f.onUnexpectedError)(L.reason)})}}};class O extends T{get isPaused(){return this._isPaused!==0}constructor(k){super(k),this._isPaused=0,this._eventQueue=new l.LinkedList,this._mergeFn=k?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused==0)if(this._mergeFn){if(this._eventQueue.size>0){let k=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(k))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(k){this._size&&(this._isPaused!==0?this._eventQueue.push(k):super.fire(k))}}t.PauseableEmitter=O,t.DebounceEmitter=class extends O{constructor(k){super(k),this._delay=k.delay??100}fire(k){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(k)}},t.MicrotaskEmitter=class extends T{constructor(k){super(k),this._queuedEvents=[],this._mergeFn=k?.merge}fire(k){this.hasListeners()&&(this._queuedEvents.push(k),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach((P)=>super.fire(P)),this._queuedEvents=[]}))}};class A{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new T({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(k){let P={event:k,listener:null};return this.events.push(P),this.hasListeners&&this.hook(P),(0,_.toDisposable)((0,p.createSingleCallFunction)(()=>{this.hasListeners&&this.unhook(P);let W=this.events.indexOf(P);this.events.splice(W,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach((k)=>this.hook(k))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach((k)=>this.unhook(k))}hook(k){k.listener=k.event((P)=>this.emitter.fire(P))}unhook(k){k.listener?.dispose(),k.listener=null}dispose(){this.emitter.dispose();for(let k of this.events)k.listener?.dispose();this.events=[]}}t.EventMultiplexer=A,t.DynamicListEventMultiplexer=class{constructor(k,P,W,j){this._store=new _.DisposableStore;let q=this._store.add(new A),F=this._store.add(new _.DisposableMap);function b(x){F.set(x,q.add(j(x)))}for(let x of k)b(x);this._store.add(P((x)=>{b(x)})),this._store.add(W((x)=>{F.deleteAndDispose(x)})),this.event=q.event}dispose(){this._store.dispose()}},t.EventBufferer=class{constructor(){this.data=[]}wrapEvent(k,P,W){return(j,q,F)=>k((b)=>{let x=this.data[this.data.length-1];if(!P)return void(x?x.buffers.push(()=>j.call(q,b)):j.call(q,b));let L=x;L?(L.items??=[],L.items.push(b),L.buffers.length===0&&x.buffers.push(()=>{L.reducedResult??=W?L.items.reduce(P,W):L.items.reduce(P),j.call(q,L.reducedResult)})):j.call(q,P(W,b))},void 0,F)}bufferEvents(k){let P={buffers:[]};this.data.push(P);let W=k();return this.data.pop(),P.buffers.forEach((j)=>j()),W}},t.Relay=class{constructor(){this.listening=!1,this.inputEvent=v.None,this.inputEventListener=_.Disposable.None,this.emitter=new T({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(k){this.inputEvent=k,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=k(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},t.ValueWithChangeEvent=class{static const(k){return new M(k)}constructor(k){this._value=k,this._onDidChange=new T,this.onDidChange=this._onDidChange.event}get value(){return this._value}set value(k){k!==this._value&&(this._value=k,this._onDidChange.fire(void 0))}};class M{constructor(k){this.value=k,this.onDidChange=v.None}}},8841:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSingleCallFunction=function(o,f){let p=this,_,l=!1;return function(){if(l)return _;if(l=!0,f)try{_=o.apply(p,arguments)}finally{f()}else _=o.apply(p,arguments);return _}}},4218:(y,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.Iterable=void 0,function(f){function p(d){return d&&typeof d=="object"&&typeof d[Symbol.iterator]=="function"}f.is=p;let _=Object.freeze([]);function*l(d){yield d}f.empty=function(){return _},f.single=l,f.wrap=function(d){return p(d)?d:l(d)},f.from=function(d){return d||_},f.reverse=function*(d){for(let v=d.length-1;v>=0;v--)yield d[v]},f.isEmpty=function(d){return!d||d[Symbol.iterator]().next().done===!0},f.first=function(d){return d[Symbol.iterator]().next().value},f.some=function(d,v){let n=0;for(let i of d)if(v(i,n++))return!0;return!1},f.find=function(d,v){for(let n of d)if(v(n))return n},f.filter=function*(d,v){for(let n of d)v(n)&&(yield n)},f.map=function*(d,v){let n=0;for(let i of d)yield v(i,n++)},f.flatMap=function*(d,v){let n=0;for(let i of d)yield*v(i,n++)},f.concat=function*(...d){for(let v of d)yield*v},f.reduce=function(d,v,n){let i=n;for(let w of d)i=v(i,w);return i},f.slice=function*(d,v,n=d.length){for(v<0&&(v+=d.length),n<0?n+=d.length:n>d.length&&(n=d.length);v<n;v++)yield d[v]},f.consume=function(d,v=Number.POSITIVE_INFINITY){let n=[];if(v===0)return[n,d];let i=d[Symbol.iterator]();for(let w=0;w<v;w++){let a=i.next();if(a.done)return[n,f.empty()];n.push(a.value)}return[n,{[Symbol.iterator]:()=>i}]},f.asyncToArray=async function(d){let v=[];for await(let n of d)v.push(n);return Promise.resolve(v)}}(o||(t.Iterable=o={}))},7150:(y,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DisposableMap=t.ImmortalReference=t.AsyncReferenceCollection=t.ReferenceCollection=t.SafeDisposable=t.RefCountedDisposable=t.MandatoryMutableDisposable=t.MutableDisposable=t.Disposable=t.DisposableStore=t.DisposableTracker=void 0,t.setDisposableTracker=function(A){v=A},t.trackDisposable=i,t.markAsDisposed=w,t.markAsSingleton=function(A){return v?.markAsSingleton(A),A},t.isDisposable=m,t.dispose=c,t.disposeIfDisposable=function(A){for(let M of A)m(M)&&M.dispose();return[]},t.combinedDisposable=function(...A){let M=S(()=>c(A));return function(k,P){if(v)for(let W of k)v.setParent(W,P)}(A,M),M},t.toDisposable=S,t.disposeOnReturn=function(A){let M=new C;try{A(M)}finally{M.dispose()}};let f=o(3058),p=o(9087),_=o(2608),l=o(8841),d=o(4218),v=null;class n{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(A){let M=this.livingDisposables.get(A);return M||(M={parent:null,source:null,isSingleton:!1,value:A,idx:n.idx++},this.livingDisposables.set(A,M)),M}trackDisposable(A){let M=this.getDisposableData(A);M.source||(M.source=Error().stack)}setParent(A,M){this.getDisposableData(A).parent=M}markAsDisposed(A){this.livingDisposables.delete(A)}markAsSingleton(A){this.getDisposableData(A).isSingleton=!0}getRootParent(A,M){let k=M.get(A);if(k)return k;let P=A.parent?this.getRootParent(this.getDisposableData(A.parent),M):A;return M.set(A,P),P}getTrackedDisposables(){let A=new Map;return[...this.livingDisposables.entries()].filter(([,M])=>M.source!==null&&!this.getRootParent(M,A).isSingleton).flatMap(([M])=>M)}computeLeakingDisposables(A=10,M){let k;if(M)k=M;else{let F=new Map,b=[...this.livingDisposables.values()].filter((L)=>L.source!==null&&!this.getRootParent(L,F).isSingleton);if(b.length===0)return;let x=new Set(b.map((L)=>L.value));if(k=b.filter((L)=>!(L.parent&&x.has(L.parent))),k.length===0)throw Error("There are cyclic diposable chains!")}if(!k)return;function P(F){let b=F.source.split(`
|
|
12
|
-
`).map((x)=>x.trim().replace("at ","")).filter((x)=>x!=="");return function(x,L){for(;x.length>0&&L.some((E)=>typeof E=="string"?E===x[0]:x[0].match(E));)x.shift()}(b,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),b.reverse()}let W=new
|
|
13
|
-
`),F)}k.sort((0,
|
|
11
|
+
`))}}class m extends Error{constructor(k,P){super(k),this.name="ListenerLeakError",this.stack=P}}t.ListenerLeakError=m;class u extends Error{constructor(k,P){super(k),this.name="ListenerRefusalError",this.stack=P}}t.ListenerRefusalError=u;let S=0;class C{constructor(k){this.value=k,this.id=S++}}class T{constructor(k){this._size=0,this._options=k,this._leakageMon=i>0||this._options?.leakWarningThreshold?new w(k?.onListenerError??l.onUnexpectedError,this._options?.leakWarningThreshold??i):void 0,this._perfMon=this._options?._profName?new o(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(k,P,W)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let b=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(b);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],L=new u(`${b}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(this._options?.onListenerError||l.onUnexpectedError)(L),g.Disposable.None}if(this._disposed)return g.Disposable.None;P&&(k=k.bind(P));let z=new C(k),q;this._leakageMon&&this._size>=Math.ceil(0.2*this._leakageMon.threshold)&&(z.stack=h.create(),q=this._leakageMon.check(z.stack,this._size+1)),this._listeners?this._listeners instanceof C?(this._deliveryQueue??=new B,this._listeners=[this._listeners,z]):this._listeners.push(z):(this._options?.onWillAddFirstListener?.(this),this._listeners=z,this._options?.onDidAddFirstListener?.(this)),this._size++;let F=(0,g.toDisposable)(()=>{q?.(),this._removeListener(z)});return W instanceof g.DisposableStore?W.add(F):Array.isArray(W)&&W.push(F),F},this._event}_removeListener(k){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1)return this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),void(this._size=0);let P=this._listeners,W=P.indexOf(k);if(W===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,P[W]=void 0;let z=this._deliveryQueue.current===this;if(2*this._size<=P.length){let q=0;for(let F=0;F<P.length;F++)P[F]?P[q++]=P[F]:z&&(this._deliveryQueue.end--,q<this._deliveryQueue.i&&this._deliveryQueue.i--);P.length=q}}_deliver(k,P){if(!k)return;let W=this._options?.onListenerError||l.onUnexpectedError;if(W)try{k.value(P)}catch(z){W(z)}else k.value(P)}_deliverQueue(k){let P=k.current._listeners;for(;k.i<k.end;)this._deliver(P[k.i++],k.value);k.reset()}fire(k){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof C)this._deliver(this._listeners,k);else{let P=this._deliveryQueue;P.enqueue(this,k,this._listeners.length),this._deliverQueue(P)}this._perfMon?.stop()}hasListeners(){return this._size>0}}t.Emitter=T,t.createEventDeliveryQueue=()=>new B;class B{constructor(){this.i=-1,this.end=0}enqueue(k,P,W){this.i=0,this.end=W,this.current=k,this.value=P}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}t.AsyncEmitter=class extends T{async fireAsync(k,P,W){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new d.LinkedList),((z,q)=>{if(z instanceof C)q(z);else for(let F=0;F<z.length;F++){let b=z[F];b&&q(b)}})(this._listeners,(z)=>this._asyncDeliveryQueue.push([z.value,k]));this._asyncDeliveryQueue.size>0&&!P.isCancellationRequested;){let[z,q]=this._asyncDeliveryQueue.shift(),F=[],b={...q,token:P,waitUntil:(x)=>{if(Object.isFrozen(F))throw Error("waitUntil can NOT be called asynchronous");W&&(x=W(x,z)),F.push(x)}};try{z(b)}catch(x){(0,l.onUnexpectedError)(x);continue}Object.freeze(F),await Promise.allSettled(F).then((x)=>{for(let L of x)L.status==="rejected"&&(0,l.onUnexpectedError)(L.reason)})}}};class O extends T{get isPaused(){return this._isPaused!==0}constructor(k){super(k),this._isPaused=0,this._eventQueue=new d.LinkedList,this._mergeFn=k?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused==0)if(this._mergeFn){if(this._eventQueue.size>0){let k=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(k))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(k){this._size&&(this._isPaused!==0?this._eventQueue.push(k):super.fire(k))}}t.PauseableEmitter=O,t.DebounceEmitter=class extends O{constructor(k){super(k),this._delay=k.delay??100}fire(k){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(k)}},t.MicrotaskEmitter=class extends T{constructor(k){super(k),this._queuedEvents=[],this._mergeFn=k?.merge}fire(k){this.hasListeners()&&(this._queuedEvents.push(k),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach((P)=>super.fire(P)),this._queuedEvents=[]}))}};class A{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new T({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(k){let P={event:k,listener:null};return this.events.push(P),this.hasListeners&&this.hook(P),(0,g.toDisposable)((0,p.createSingleCallFunction)(()=>{this.hasListeners&&this.unhook(P);let W=this.events.indexOf(P);this.events.splice(W,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach((k)=>this.hook(k))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach((k)=>this.unhook(k))}hook(k){k.listener=k.event((P)=>this.emitter.fire(P))}unhook(k){k.listener?.dispose(),k.listener=null}dispose(){this.emitter.dispose();for(let k of this.events)k.listener?.dispose();this.events=[]}}t.EventMultiplexer=A,t.DynamicListEventMultiplexer=class{constructor(k,P,W,z){this._store=new g.DisposableStore;let q=this._store.add(new A),F=this._store.add(new g.DisposableMap);function b(x){F.set(x,q.add(z(x)))}for(let x of k)b(x);this._store.add(P((x)=>{b(x)})),this._store.add(W((x)=>{F.deleteAndDispose(x)})),this.event=q.event}dispose(){this._store.dispose()}},t.EventBufferer=class{constructor(){this.data=[]}wrapEvent(k,P,W){return(z,q,F)=>k((b)=>{let x=this.data[this.data.length-1];if(!P)return void(x?x.buffers.push(()=>z.call(q,b)):z.call(q,b));let L=x;L?(L.items??=[],L.items.push(b),L.buffers.length===0&&x.buffers.push(()=>{L.reducedResult??=W?L.items.reduce(P,W):L.items.reduce(P),z.call(q,L.reducedResult)})):z.call(q,P(W,b))},void 0,F)}bufferEvents(k){let P={buffers:[]};this.data.push(P);let W=k();return this.data.pop(),P.buffers.forEach((z)=>z()),W}},t.Relay=class{constructor(){this.listening=!1,this.inputEvent=v.None,this.inputEventListener=g.Disposable.None,this.emitter=new T({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(k){this.inputEvent=k,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=k(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},t.ValueWithChangeEvent=class{static const(k){return new M(k)}constructor(k){this._value=k,this._onDidChange=new T,this.onDidChange=this._onDidChange.event}get value(){return this._value}set value(k){k!==this._value&&(this._value=k,this._onDidChange.fire(void 0))}};class M{constructor(k){this.value=k,this.onDidChange=v.None}}},8841:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSingleCallFunction=function(n,l){let p=this,g,d=!1;return function(){if(d)return g;if(d=!0,l)try{g=n.apply(p,arguments)}finally{l()}else g=n.apply(p,arguments);return g}}},4218:(y,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Iterable=void 0,function(l){function p(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}l.is=p;let g=Object.freeze([]);function*d(_){yield _}l.empty=function(){return g},l.single=d,l.wrap=function(_){return p(_)?_:d(_)},l.from=function(_){return _||g},l.reverse=function*(_){for(let v=_.length-1;v>=0;v--)yield _[v]},l.isEmpty=function(_){return!_||_[Symbol.iterator]().next().done===!0},l.first=function(_){return _[Symbol.iterator]().next().value},l.some=function(_,v){let o=0;for(let i of _)if(v(i,o++))return!0;return!1},l.find=function(_,v){for(let o of _)if(v(o))return o},l.filter=function*(_,v){for(let o of _)v(o)&&(yield o)},l.map=function*(_,v){let o=0;for(let i of _)yield v(i,o++)},l.flatMap=function*(_,v){let o=0;for(let i of _)yield*v(i,o++)},l.concat=function*(..._){for(let v of _)yield*v},l.reduce=function(_,v,o){let i=o;for(let w of _)i=v(i,w);return i},l.slice=function*(_,v,o=_.length){for(v<0&&(v+=_.length),o<0?o+=_.length:o>_.length&&(o=_.length);v<o;v++)yield _[v]},l.consume=function(_,v=Number.POSITIVE_INFINITY){let o=[];if(v===0)return[o,_];let i=_[Symbol.iterator]();for(let w=0;w<v;w++){let h=i.next();if(h.done)return[o,l.empty()];o.push(h.value)}return[o,{[Symbol.iterator]:()=>i}]},l.asyncToArray=async function(_){let v=[];for await(let o of _)v.push(o);return Promise.resolve(v)}}(n||(t.Iterable=n={}))},7150:(y,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DisposableMap=t.ImmortalReference=t.AsyncReferenceCollection=t.ReferenceCollection=t.SafeDisposable=t.RefCountedDisposable=t.MandatoryMutableDisposable=t.MutableDisposable=t.Disposable=t.DisposableStore=t.DisposableTracker=void 0,t.setDisposableTracker=function(A){v=A},t.trackDisposable=i,t.markAsDisposed=w,t.markAsSingleton=function(A){return v?.markAsSingleton(A),A},t.isDisposable=m,t.dispose=u,t.disposeIfDisposable=function(A){for(let M of A)m(M)&&M.dispose();return[]},t.combinedDisposable=function(...A){let M=S(()=>u(A));return function(k,P){if(v)for(let W of k)v.setParent(W,P)}(A,M),M},t.toDisposable=S,t.disposeOnReturn=function(A){let M=new C;try{A(M)}finally{M.dispose()}};let l=n(3058),p=n(9087),g=n(2608),d=n(8841),_=n(4218),v=null;class o{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(A){let M=this.livingDisposables.get(A);return M||(M={parent:null,source:null,isSingleton:!1,value:A,idx:o.idx++},this.livingDisposables.set(A,M)),M}trackDisposable(A){let M=this.getDisposableData(A);M.source||(M.source=Error().stack)}setParent(A,M){this.getDisposableData(A).parent=M}markAsDisposed(A){this.livingDisposables.delete(A)}markAsSingleton(A){this.getDisposableData(A).isSingleton=!0}getRootParent(A,M){let k=M.get(A);if(k)return k;let P=A.parent?this.getRootParent(this.getDisposableData(A.parent),M):A;return M.set(A,P),P}getTrackedDisposables(){let A=new Map;return[...this.livingDisposables.entries()].filter(([,M])=>M.source!==null&&!this.getRootParent(M,A).isSingleton).flatMap(([M])=>M)}computeLeakingDisposables(A=10,M){let k;if(M)k=M;else{let F=new Map,b=[...this.livingDisposables.values()].filter((L)=>L.source!==null&&!this.getRootParent(L,F).isSingleton);if(b.length===0)return;let x=new Set(b.map((L)=>L.value));if(k=b.filter((L)=>!(L.parent&&x.has(L.parent))),k.length===0)throw Error("There are cyclic diposable chains!")}if(!k)return;function P(F){let b=F.source.split(`
|
|
12
|
+
`).map((x)=>x.trim().replace("at ","")).filter((x)=>x!=="");return function(x,L){for(;x.length>0&&L.some((E)=>typeof E=="string"?E===x[0]:x[0].match(E));)x.shift()}(b,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),b.reverse()}let W=new g.SetMap;for(let F of k){let b=P(F);for(let x=0;x<=b.length;x++)W.add(b.slice(0,x).join(`
|
|
13
|
+
`),F)}k.sort((0,l.compareBy)((F)=>F.idx,l.numberComparator));let z="",q=0;for(let F of k.slice(0,A)){q++;let b=P(F),x=[];for(let L=0;L<b.length;L++){let E=b[L];E=`(shared with ${W.get(b.slice(0,L+1).join(`
|
|
14
14
|
`)).size}/${k.length} leaks) at ${E}`;let D=W.get(b.slice(0,L).join(`
|
|
15
|
-
`)),H=(0,p.groupBy)([...D].map((I)=>P(I)[L]),(I)=>I);delete H[b[L]];for(let[I,N]of Object.entries(H))x.unshift(` - stacktraces of ${N.length} other leaks continue with ${I}`);x.unshift(E)}
|
|
15
|
+
`)),H=(0,p.groupBy)([...D].map((I)=>P(I)[L]),(I)=>I);delete H[b[L]];for(let[I,N]of Object.entries(H))x.unshift(` - stacktraces of ${N.length} other leaks continue with ${I}`);x.unshift(E)}z+=`
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
==================== Leaking disposable ${q}/${k.length}: ${F.value.constructor.name} ====================
|
|
@@ -20,23 +20,23 @@ ${x.join(`
|
|
|
20
20
|
`)}
|
|
21
21
|
============================================================
|
|
22
22
|
|
|
23
|
-
`}return k.length>A&&(
|
|
23
|
+
`}return k.length>A&&(z+=`
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
... and ${k.length-A} more leaking disposables
|
|
27
27
|
|
|
28
|
-
`),{leaks:k,details:j}}}function i(A){return v?.trackDisposable(A),A}function w(A){v?.markAsDisposed(A)}function a(A,M){v?.setParent(A,M)}function m(A){return typeof A=="object"&&A!==null&&typeof A.dispose=="function"&&A.dispose.length===0}function c(A){if(d.Iterable.is(A)){let M=[];for(let k of A)if(k)try{k.dispose()}catch(P){M.push(P)}if(M.length===1)throw M[0];if(M.length>1)throw AggregateError(M,"Encountered errors while disposing of store");return Array.isArray(A)?[]:A}if(A)return A.dispose(),A}function S(A){let M=i({dispose:(0,l.createSingleCallFunction)(()=>{w(M),A()})});return M}t.DisposableTracker=n;class C{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,i(this)}dispose(){this._isDisposed||(w(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{c(this._toDispose)}finally{this._toDispose.clear()}}add(A){if(!A)return A;if(A===this)throw Error("Cannot register a disposable on itself!");return a(A,this),this._isDisposed?C.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(A),A}delete(A){if(A){if(A===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(A),A.dispose()}}deleteAndLeak(A){A&&this._toDispose.has(A)&&(this._toDispose.delete(A),a(A,null))}}t.DisposableStore=C;class T{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new C,i(this),a(this._store,this)}dispose(){w(this),this._store.dispose()}_register(A){if(A===this)throw Error("Cannot register a disposable on itself!");return this._store.add(A)}}t.Disposable=T;class B{constructor(){this._isDisposed=!1,i(this)}get value(){return this._isDisposed?void 0:this._value}set value(A){this._isDisposed||A===this._value||(this._value?.dispose(),A&&a(A,this),this._value=A)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,w(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let A=this._value;return this._value=void 0,A&&a(A,null),A}}t.MutableDisposable=B,t.MandatoryMutableDisposable=class{constructor(A){this._disposable=new B,this._isDisposed=!1,this._disposable.value=A}get value(){return this._disposable.value}set value(A){this._isDisposed||A===this._disposable.value||(this._disposable.value=A)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},t.RefCountedDisposable=class{constructor(A){this._disposable=A,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter==0&&this._disposable.dispose(),this}},t.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,i(this)}set(A){let M=A;return this.unset=()=>M=void 0,this.isset=()=>M!==void 0,this.dispose=()=>{M&&(M(),M=void 0,w(this))},this}},t.ReferenceCollection=class{constructor(){this.references=new Map}acquire(A,...M){let k=this.references.get(A);k||(k={counter:0,object:this.createReferencedObject(A,...M)},this.references.set(A,k));let{object:P}=k,W=(0,l.createSingleCallFunction)(()=>{--k.counter==0&&(this.destroyReferencedObject(A,k.object),this.references.delete(A))});return k.counter++,{object:P,dispose:W}}},t.AsyncReferenceCollection=class{constructor(A){this.referenceCollection=A}async acquire(A,...M){let k=this.referenceCollection.acquire(A,...M);try{return{object:await k.object,dispose:()=>k.dispose()}}catch(P){throw k.dispose(),P}}},t.ImmortalReference=class{constructor(A){this.object=A}dispose(){}};class O{constructor(){this._store=new Map,this._isDisposed=!1,i(this)}dispose(){w(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{c(this._store.values())}finally{this._store.clear()}}has(A){return this._store.has(A)}get size(){return this._store.size}get(A){return this._store.get(A)}set(A,M,k=!1){this._isDisposed&&console.warn(Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),k||this._store.get(A)?.dispose(),this._store.set(A,M)}deleteAndDispose(A){this._store.get(A)?.dispose(),this._store.delete(A)}deleteAndLeak(A){let M=this._store.get(A);return this._store.delete(A),M}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}t.DisposableMap=O},6317:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkedList=void 0;class o{static{this.Undefined=new o(void 0)}constructor(p){this.element=p,this.next=o.Undefined,this.prev=o.Undefined}}class f{constructor(){this._first=o.Undefined,this._last=o.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===o.Undefined}clear(){let p=this._first;for(;p!==o.Undefined;){let _=p.next;p.prev=o.Undefined,p.next=o.Undefined,p=_}this._first=o.Undefined,this._last=o.Undefined,this._size=0}unshift(p){return this._insert(p,!1)}push(p){return this._insert(p,!0)}_insert(p,_){let l=new o(p);if(this._first===o.Undefined)this._first=l,this._last=l;else if(_){let v=this._last;this._last=l,l.prev=v,v.next=l}else{let v=this._first;this._first=l,l.next=v,v.prev=l}this._size+=1;let d=!1;return()=>{d||(d=!0,this._remove(l))}}shift(){if(this._first!==o.Undefined){let p=this._first.element;return this._remove(this._first),p}}pop(){if(this._last!==o.Undefined){let p=this._last.element;return this._remove(this._last),p}}_remove(p){if(p.prev!==o.Undefined&&p.next!==o.Undefined){let _=p.prev;_.next=p.next,p.next.prev=_}else p.prev===o.Undefined&&p.next===o.Undefined?(this._first=o.Undefined,this._last=o.Undefined):p.next===o.Undefined?(this._last=this._last.prev,this._last.next=o.Undefined):p.prev===o.Undefined&&(this._first=this._first.next,this._first.prev=o.Undefined);this._size-=1}*[Symbol.iterator](){let p=this._first;for(;p!==o.Undefined;)yield p.element,p=p.next}}t.LinkedList=f},2608:(y,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.SetMap=t.BidirectionalMap=t.CounterSet=t.Touch=void 0,t.getOrSet=function(f,p,_){let l=f.get(p);return l===void 0&&(l=_,f.set(p,l)),l},t.mapToString=function(f){let p=[];return f.forEach((_,l)=>{p.push(`${l} => ${_}`)}),`Map(${f.size}) {${p.join(", ")}}`},t.setToString=function(f){let p=[];return f.forEach((_)=>{p.push(_)}),`Set(${f.size}) {${p.join(", ")}}`},t.mapsStrictEqualIgnoreOrder=function(f,p){if(f===p)return!0;if(f.size!==p.size)return!1;for(let[_,l]of f)if(!p.has(_)||p.get(_)!==l)return!1;for(let[_]of p)if(!f.has(_))return!1;return!0},function(f){f[f.None=0]="None",f[f.AsOld=1]="AsOld",f[f.AsNew=2]="AsNew"}(o||(t.Touch=o={})),t.CounterSet=class{constructor(){this.map=new Map}add(f){return this.map.set(f,(this.map.get(f)||0)+1),this}delete(f){let p=this.map.get(f)||0;return p!==0&&(p--,p===0?this.map.delete(f):this.map.set(f,p),!0)}has(f){return this.map.has(f)}},t.BidirectionalMap=class{constructor(f){if(this._m1=new Map,this._m2=new Map,f)for(let[p,_]of f)this.set(p,_)}clear(){this._m1.clear(),this._m2.clear()}set(f,p){this._m1.set(f,p),this._m2.set(p,f)}get(f){return this._m1.get(f)}getKey(f){return this._m2.get(f)}delete(f){let p=this._m1.get(f);return p!==void 0&&(this._m1.delete(f),this._m2.delete(p),!0)}forEach(f,p){this._m1.forEach((_,l)=>{f.call(p,_,l,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},t.SetMap=class{constructor(){this.map=new Map}add(f,p){let _=this.map.get(f);_||(_=new Set,this.map.set(f,_)),_.add(p)}delete(f,p){let _=this.map.get(f);_&&(_.delete(p),_.size===0&&this.map.delete(f))}forEach(f,p){let _=this.map.get(f);_&&_.forEach(p)}get(f){return this.map.get(f)||new Set}}},9725:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StopWatch=void 0;let o=globalThis.performance&&typeof globalThis.performance.now=="function";class f{static create(p){return new f(p)}constructor(p){this._now=o&&p===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}t.StopWatch=f}},r={};function s(y){var t=r[y];if(t!==void 0)return t.exports;var o=r[y]={exports:{}};return e[y].call(o.exports,o,o.exports,s),o.exports}var h={};(()=>{var y=h;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;let t=s(5101),o=s(6097),f=s(4335),p=s(5856),_=s(3027),l=s(7150),d=["cols","rows"];class v extends l.Disposable{constructor(n){super(),this._core=this._register(new p.Terminal(n)),this._addonManager=this._register(new _.AddonManager),this._publicOptions={...this._core.options};let i=(a)=>this._core.options[a],w=(a,m)=>{this._checkReadonlyOptions(a),this._core.options[a]=m};for(let a in this._core.options){Object.defineProperty(this._publicOptions,a,{get:()=>this._core.options[a],set:(c)=>{this._checkReadonlyOptions(a),this._core.options[a]=c}});let m={get:i.bind(this,a),set:w.bind(this,a)};Object.defineProperty(this._publicOptions,a,m)}}_checkReadonlyOptions(n){if(d.includes(n))throw Error(`Option "${n}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.allowProposedApi)throw 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 onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new o.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this._register(new t.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let n=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,synchronizedOutputMode:n.synchronizedOutput,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(let i in n)this._publicOptions[i]=n[i]}input(n,i=!0){this._core.input(n,i)}resize(n,i){this._verifyIntegers(n,i),this._core.resize(n,i)}registerMarker(n=0){return this._checkProposedApi(),this._verifyIntegers(n),this._core.addMarker(n)}addMarker(n){return this.registerMarker(n)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,i){this._core.write(n,i)}writeln(n,i){this._core.write(n),this._core.write(`\r
|
|
29
|
-
`,i)}reset(){this._core.reset()}loadAddon(
|
|
30
|
-
`+"`bun upgrade` \u3067 Bun \u3092\u4E0A\u3052\u308B\u304B\u3001Bun \u306E\u8981\u3089\u306A\u3044\u5B9F\u884C\u30D5\u30A1\u30A4\u30EB\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044: "+"https://github.com/itsuki-yamada/accompany/releases"),process.exit(1);var Te=(e)=>("server"in e.env)?e.env.server:e.env;var st=(e)=>{let r=e.split("/");if(r[0]==="")r.shift();return r},Gt=(e)=>{let{groups:r,path:s}=As(e),h=st(s);return ks(h,r)},As=(e)=>{let r=[];return e=e.replace(/\{[^}]+\}/g,(s,h)=>{let g=`@${h}`;return r.push([g,s]),g}),{groups:r,path:e}},ks=(e,r)=>{for(let s=r.length-1;s>=0;s--){let[h]=r[s];for(let g=e.length-1;g>=0;g--)if(e[g].includes(h)){e[g]=e[g].replace(h,r[s][1]);break}}return e},Re={},qt=(e,r)=>{if(e==="*")return"*";let s=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(s){let h=`${e}#${r}`;if(!Re[h])if(s[2])Re[h]=r&&r[0]!==":"&&r[0]!=="*"?[h,s[1],new RegExp(`^${s[2]}(?=/${r})`)]:[e,s[1],new RegExp(`^${s[2]}$`)];else Re[h]=[e,s[1],!0];return Re[h]}return null},Xt=(e,r)=>{try{return r(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(s)=>{try{return r(s)}catch{return s}})}},Vt=(e)=>Xt(e,decodeURI),it=(e)=>{let r=e.url,s=r.indexOf("/",r.indexOf(":")+4),h=s;for(;h<r.length;h++){let g=r.charCodeAt(h);if(g===37){let u=r.indexOf("?",h),y=r.indexOf("#",h),t=u===-1?y===-1?void 0:y:y===-1?u:Math.min(u,y),o=r.slice(s,t);return Vt(o.includes("%25")?o.replace(/%25/g,"%2525"):o)}else if(g===63||g===35)break}return r.slice(s,h)};var Qt=(e)=>{let r=it(e);return r.length>1&&r.at(-1)==="/"?r.slice(0,-1):r},fe=(e,r,...s)=>{if(s.length)r=fe(r,...s);return`${e?.[0]==="/"?"":"/"}${e}${r==="/"?"":`${e?.at(-1)==="/"?"":"/"}${r?.[0]==="/"?r.slice(1):r}`}`},Be=(e)=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let r=e.split("/"),s=[],h="";return r.forEach((g)=>{if(g!==""&&!/\:/.test(g))h+="/"+g;else if(/\:/.test(g))if(g.charCodeAt(g.length-1)===63){if(s.length===0&&h==="")s.push("/");else s.push(h);let u=g.slice(0,-1);h+="/"+u,s.push(h)}else h+="/"+g}),s.filter((g,u,y)=>y.indexOf(g)===u)},De=(e)=>e.indexOf("%")!==-1?Xt(e,Ls):e,rt=(e)=>{if(e.indexOf("+")!==-1)e=e.replace(/\+/g," ");return De(e)},Kt=(e,r,s)=>{let h=e.indexOf("#",8);if(h!==-1)e=e.slice(0,h);let g;if(!s&&r&&r.indexOf("%")===-1&&r.indexOf("+")===-1){let t=e.indexOf("?",8),o=t;if(o===-1)return;if(!e.startsWith(r,o+1))o=e.indexOf(`&${r}`,o+1);while(o!==-1){let f=e.charCodeAt(o+r.length+1);if(f===61||f===38||isNaN(f)){if(o>t&&/(?:^|&)[^=&]*[%+]/.test(e.slice(t+1,o)))break;if(f===61){let p=o+r.length+2,_=e.indexOf("&",p);return rt(e.slice(p,_===-1?void 0:_))}return""}o=e.indexOf(`&${r}`,o+1)}if(g=/[%+]/.test(e),!g)return}let u=Object.create(null);g??=/[%+]/.test(e);let y=e.indexOf("?",8);while(y!==-1){let t=e.indexOf("&",y+1),o=e.indexOf("=",y);if(o>t&&t!==-1)o=-1;let f=e.slice(y+1,o===-1?t===-1?void 0:t:o);if(g)f=rt(f);if(y=t,f==="")continue;let p;if(o===-1)p="";else if(p=e.slice(o+1,t===-1?void 0:t),g)p=rt(p);if(s){if(!(u[f]&&Array.isArray(u[f])))u[f]=[];u[f].push(p)}else u[f]??=p}return r?u[r]:u},Yt=Kt,Jt=(e,r)=>Kt(e,r,!0),Ls=decodeURIComponent;var Ts={br:".br",zstd:".zst",gzip:".gz"},xn=Object.keys(Ts);var Zt=["get","post","put","delete","options","patch","query"],Me="Can not add a route since the matcher is already built.",Pe=class extends Error{};var nt="__COMPOSED_HANDLER";var er="x-hono-disable-ssg",qn=(()=>{try{return new Response("SSG is disabled",{status:404,headers:{[er]:"true"}})}catch{return null}})();var tr={Stringify:1,BeforeStream:2,Stream:3},rr=(e,r)=>{let s=new String(e);return s.isEscaped=!0,s.callbacks=r,s};var ot=async(e,r,s,h,g)=>{if(typeof e==="object"&&!(e instanceof String)){if(!(e instanceof Promise))e=e.toString();if(e instanceof Promise)e=await e}let u=e.callbacks;if(!u?.length)return Promise.resolve(e);if(g)g[0]+=e;else g=[e];let y=Promise.all(u.map((t)=>t({phase:r,buffer:g,context:h}))).then((t)=>Promise.all(t.filter(Boolean).map((o)=>ot(o,r,!1,h,g))).then(()=>g[0]));if(s)return rr(await y,u);else return y};var{write:Ho}=Bun;var sr=class{#e;constructor(e){this.#e=e,this.raw=e.raw,this.url=e.url?new URL(e.url):null,this.protocol=e.protocol??null}send(e,r){this.#e.send(e,r??{})}raw;binaryType="arraybuffer";get readyState(){return this.#e.readyState}url;protocol;close(e,r){this.#e.close(e,r)}},ir=(e)=>new MessageEvent("message",{data:e}),nr=(e)=>(...r)=>{if(typeof r[0]==="function"){let[s,h]=r;return async function(u,y){let t=await e(u,await s(u),h);if(t)return t;await y()}}else{let[s,h,g]=r;return(async()=>{let u=await e(s,h,g);if(!u)throw Error("Failed to upgrade WebSocket");return u})()}};var at=(e)=>new sr({send:(r,s)=>{e.send(r,s?.compress)},raw:e,readyState:e.readyState,url:e.data.url,protocol:e.data.protocol,close(r,s){e.close(r,s)}}),Oe=nr((e,r)=>{let s=Te(e);if(!s)throw TypeError("env has to include the 2nd argument of fetch.");if(s.upgrade(e.req.raw,{data:{events:r,url:new URL(e.req.url),protocol:e.req.header("sec-websocket-protocol")?.split(",")[0]?.trim()??""}}))return new Response(null)}),ct={open(e){let r=e.data.events;if(r.onOpen)r.onOpen(new Event("open"),at(e))},close(e,r,s){let h=e.data.events;if(h.onClose)h.onClose(new CloseEvent("close",{code:r,reason:s}),at(e))},message(e,r){let s=e.data.events;if(s.onMessage){let h=typeof r==="string"?r:r.buffer;s.onMessage(ir(h),at(e))}}};var ht=class extends Error{res;status;constructor(e=500,r){super(r?.message,{cause:r?.cause});this.res=r?.res,this.status=e}getResponse(){if(this.res)return new Response(this.res.body,{status:this.status,headers:this.res.headers});return new Response(this.message,{status:this.status})}};var or=Symbol();var ar=(e,r)=>new Response(e,{headers:{"Content-Type":r.replace(/^[^;]+/,(s)=>s.toLowerCase())}}).formData();var Ms=1e4,Ie=(e)=>("headers"in e),lr=async(e,r=Object.create(null))=>{let{all:s=!1,dot:h=!1}=r,g=(Ie(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(g==="multipart/form-data"||g==="application/x-www-form-urlencoded")return Ps(e,{all:s,dot:h});return{}};async function Ps(e,r){if(!Ie(e)&&e.bodyCache.formData)return cr(await e.bodyCache.formData,r);let s=Ie(e)?e.headers:e.raw.headers,h=await e.arrayBuffer(),g=ar(h,s.get("Content-Type")||"");if(!Ie(e))e.bodyCache.formData=g;let u=await g;if(u)return cr(u,r);return{}}function cr(e,r){let s=Object.create(null),h={count:0};if(e.forEach((g,u)=>{if(!(r.all||u.endsWith("[]")))s[u]=g;else Os(s,u,g)}),r.dot)Object.entries(s).forEach(([g,u])=>{if(g.includes("."))Is(s,g,u,h),delete s[g]});return s}var Os=(e,r,s)=>{if(e[r]!==void 0)if(Array.isArray(e[r]))e[r].push(s);else e[r]=[e[r],s];else if(!r.endsWith("[]"))e[r]=s;else e[r]=[s]},Is=(e,r,s,h)=>{if(/(?:^|\.)__proto__\./.test(r))return;let g=e,u=r.split(".",34);if(u.length>33)hr();u.forEach((y,t)=>{if(t===u.length-1)g[y]=s;else{if(!g[y]||typeof g[y]!=="object"||Array.isArray(g[y])||g[y]instanceof File){if(h.count++>=Ms)hr();g[y]=Object.create(null)}g=g[y]}})},hr=()=>{throw Error("Nesting limit exceeded")};var ur=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,r="/",s=[[]]){this.raw=e,this.path=r,this.#t=s}param(e){return e?this.#r(e):this.#n()}#r(e){let r=this.#t[0][this.routeIndex]?.[1][e],s=this.#s(r);return s&&De(s)}#n(){let e={},r=Object.keys(this.#t[0][this.routeIndex]?.[1]??{});for(let s of r){let h=this.#s(this.#t[0][this.routeIndex][1][s]);if(h!==void 0)e[s]=De(h)}return e}#s(e){return this.#t[1]?this.#t[1][e]:e}query(e){return Yt(this.url,e)}queries(e){return Jt(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let r=Object.create(null);return this.raw.headers.forEach((s,h)=>{r[h]=s}),r}async parseBody(e){return lr(this,e)}#i=(e)=>{let{bodyCache:r,raw:s}=this,h=r[e];if(h)return h;for(let g in r)return r[g].then((u)=>{if(g==="json")u=JSON.stringify(u);let y=g==="formData"?void 0:s.headers.get("content-type");return new Response(u,{headers:y?{"Content-Type":y}:void 0})[e]()});return r[e]=s[e]()};json(){return this.#i("text").then((e)=>JSON.parse(e))}text(){return this.#i("text")}arrayBuffer(){return this.#i("arrayBuffer")}bytes(){return this.#i("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#i("blob")}formData(){return this.#i("formData")}addValidatedData(e,r){(this.#e??={})[e]=r}valid(e){return this.#e?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[or](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};var Hs="text/plain; charset=UTF-8",lt=(e,r)=>({"Content-Type":e,...r}),be=(e,r)=>new Response(e,r),ut=class{#e;#t;env={};#r;finalized=!1;error;#n;#s;#i;#l;#c;#h;#a;#u;#f;constructor(e,r){if(this.#e=e,r)this.#s=r.executionCtx,this.env=r.env,this.#h=r.notFoundHandler,this.#f=r.path,this.#u=r.matchResult}get req(){return this.#t??=new ur(this.#e,this.#f,this.#u),this.#t}get event(){if(this.#s&&"respondWith"in this.#s)return this.#s;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#s)return this.#s;else throw Error("This context has no ExecutionContext")}get res(){return this.#i||=be(null,{headers:this.#a??=new Headers})}set res(e){if(this.#i&&e){e=be(e.body,e);for(let[r,s]of this.#i.headers.entries()){if(r==="content-type")continue;if(r==="set-cookie"){let h=this.#i.headers.getSetCookie();e.headers.delete("set-cookie");for(let g of h)e.headers.append("set-cookie",g)}else e.headers.set(r,s)}}this.#i=e,this.finalized=!0}render=(...e)=>(this.#c??=(r)=>this.html(r),this.#c(...e));setLayout=(e)=>this.#l=e;getLayout=()=>this.#l;setRenderer=(e)=>{this.#c=e};header=(e,r,s)=>{if(this.finalized)this.#i=be(this.#i.body,this.#i);let h=this.#i?this.#i.headers:this.#a??=new Headers;if(r===void 0)h.delete(e);else if(s?.append)h.append(e,r);else h.set(e,r)};status=(e)=>{this.#n=e};set=(e,r)=>{this.#r??=new Map,this.#r.set(e,r)};get=(e)=>this.#r?this.#r.get(e):void 0;get var(){if(!this.#r)return{};return Object.fromEntries(this.#r)}#o(e,r,s){let h=this.#i?new Headers(this.#i.headers):this.#a;if(typeof r==="object"&&r.headers){h??=new Headers;for(let[u,y]of new Headers(r.headers))if(u==="set-cookie")h.append(u,y);else h.set(u,y)}if(s){if(!h){let u=0;for(let y in s)if(++u>1||typeof s[y]!=="string"){h=new Headers;break}}if(h)for(let u in s){let y=s[u];if(typeof y==="string")h.set(u,y);else{h.delete(u);for(let t of y)h.append(u,t)}}}let g=typeof r==="number"?r:r?.status??this.#n;return be(e,{status:g,headers:h??s})}newResponse=(...e)=>this.#o(...e);body=(e,r,s)=>this.#o(e,r,s);text=(e,r,s)=>!this.#a&&!this.#n&&!r&&!s&&!this.finalized?new Response(e):this.#o(e,r,lt(Hs,s));json=(e,r,s)=>this.#o(JSON.stringify(e),r,lt("application/json",s));html=(e,r,s)=>{let h=(g)=>this.#o(g,r,lt("text/html; charset=UTF-8",s));return typeof e==="object"?ot(e,tr.Stringify,!1,{}).then(h):h(e)};redirect=(e,r)=>{let s=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(s)?s:encodeURI(s)),this.newResponse(null,r??302)};notFound=()=>(this.#h??=()=>be(),this.#h(this))};var ft=(e,r,s)=>(h,g)=>{let u=-1;return y(0);async function y(t){if(t<=u)throw Error("next() called multiple times");u=t;let o,f=!1,p;if(e[t])p=e[t][0][0],h.req.routeIndex=t;else p=t===e.length&&g||void 0;if(p)try{o=await p(h,()=>y(t+1))}catch(_){if(_ instanceof Error&&r)h.error=_,o=await r(_,h),f=!0;else throw _}else if(h.finalized===!1&&s)o=await s(h);if(o&&(h.finalized===!1||f))h.res=o;return h}};var Ns=(e)=>e.text("404 Not Found",404),fr=(e,r)=>{if("getResponse"in e){let s=e.getResponse();return r.newResponse(s.body,s)}return console.error(e),r.text("Internal Server Error",500)},dr=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(r={}){[...Zt,"all"].forEach((g)=>{this[g]=(u,...y)=>{let t=g.toUpperCase();if(typeof u==="string")this.#e=u;else this.#n(t,this.#e,u);return y.forEach((o)=>{this.#n(t,this.#e,o)}),this}}),this.on=(g,u,...y)=>{for(let t of[u].flat()){this.#e=t;for(let o of[g].flat()){let f=o.toUpperCase();for(let p of y)this.#n(f,this.#e,p)}}return this},this.use=(g,...u)=>{if(typeof g==="string")this.#e=g;else this.#e="*",u.unshift(g);return u.forEach((y)=>{this.#n("ALL",this.#e,y)}),this};let{strict:s,...h}=r;Object.assign(this,h),this.getPath=s??!0?r.getPath??it:Qt}#t(){let r=new e({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#r=this.#r,r.routes=this.routes,r}#r=Ns;errorHandler=fr;route(r,s){let h=this.basePath(r);return s.routes.map((g)=>{let u;if(s.errorHandler===fr)u=g.handler;else u=async(y,t)=>(await ft([],s.errorHandler)(y,()=>g.handler(y,t))).res,u[nt]=g.handler;h.#n(g.method,g.path,u,g.basePath)}),this}basePath(r){let s=this.#t();return s._basePath=fe(this._basePath,r),s}onError=(r)=>(this.errorHandler=r,this);notFound=(r)=>(this.#r=r,this);mount(r,s,h){let g,u;if(h)if(typeof h==="function")u=h;else if(u=h.optionHandler,h.replaceRequest===!1)g=(o)=>o;else g=h.replaceRequest;let y=u?(o)=>{let f=u(o);return Array.isArray(f)?f:[f]}:(o)=>{let f=void 0;try{f=o.executionCtx}catch{}return[o.env,f]};g||=(()=>{let o=fe(this._basePath,r),f=o==="/"?0:o.length;return(p)=>{let _=new URL(p.url);return _.pathname=this.getPath(p).slice(f)||"/",new Request(_,p)}})();let t=async(o,f)=>{let p=await s(g(o.req.raw),...y(o));if(p)return p;await f()};return this.#n("ALL",fe(r,"*"),t),this}#n(r,s,h,g){s=fe(this._basePath,s);let u={basePath:g!==void 0?fe(this._basePath,g):this._basePath,path:s,method:r,handler:h};this.router.add(r,s,[h,u]),this.routes.push(u)}#s(r,s){if(r instanceof Error)return this.errorHandler(r,s);throw r}#i(r,s,h,g){if(g==="HEAD")return(async()=>new Response(null,await this.#i(r,s,h,"GET")))();let u=this.getPath(r,{env:h}),y=this.router.match(g,u),t=new ut(r,{path:u,matchResult:y,env:h,executionCtx:s,notFoundHandler:this.#r});if(y[0].length===1){let f;try{f=y[0][0][0][0](t,async()=>{t.res=await this.#r(t)})}catch(p){return this.#s(p,t)}return f instanceof Promise?f.then((p)=>p||(t.finalized?t.res:this.#r(t))).catch((p)=>this.#s(p,t)):f??this.#r(t)}let o=ft(y[0],this.errorHandler,this.#r);return(async()=>{try{let f=await o(t);if(!f.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return f.res}catch(f){return this.#s(f,t)}})()}fetch=(r,...s)=>this.#i(r,s[1],s[0],r.method);request=(r,s,h,g)=>{if(r instanceof Request)return this.fetch(s?new Request(r,s):r,h,g);return r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${fe("/",r)}`,s),h,g)};fire=()=>{addEventListener("fetch",(r)=>{r.respondWith(this.#i(r.request,r,void 0,r.request.method))})}};var Q=()=>Object.create(null);var He=[];function dt(e,r){let s=this.buildAllMatchers(),h=(g,u)=>{let y=s[g]||s.ALL,t=y[2][u];if(t)return t;let o=u.match(y[0]);if(!o)return[[],He];let f=o.indexOf("",1);return[y[1][f],o]};return this.match=h,h(e,r)}var pt="[^/]+";var _t="(?:|/.*)",de=Symbol(),pr=new Set(".\\+*[^]$()");function Fs(e,r){if(e.length===1)return r.length===1?e<r?-1:1:-1;if(r.length===1)return 1;if(e===".*"||e==="(?:|/.*)")return r==="(?:|/.*)"?-1:1;else if(r===".*"||r==="(?:|/.*)")return-1;if(e==="[^/]+")return 1;else if(r==="[^/]+")return-1;return e.length===r.length?e<r?-1:1:r.length-e.length}var _r=class e{#e;#t;#r=Q();insert(r,s,h,g,u){let y=this;for(let t=0,o=r.length;t<o;t++){let f=r[t],p=f.length===1?f==="*"?t===o-1?["","",".*"]:["","",pt]:null:f==="/*"?["","",_t]:f.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),_;if(p){let l=p[1],d=p[2]||"[^/]+";if(l&&p[2]){if(d===".*")throw de;if(d=d.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(d))throw de;if(d.length===1&&pr.has(d))throw de}if(_=y.#r[d],!_){if(d!==".*"&&d!=="(?:|/.*)"){for(let v in y.#r)if((d.length>1||v.length>1)&&v!==".*"&&v!=="(?:|/.*)")throw de}_=y.#r[d]=new e}if(l!=="")_.#t??=g.varIndex++,h.push([l,_.#t])}else if(_=y.#r[f],!_){for(let l in y.#r)if(l.length>1&&l!==".*"&&l!=="(?:|/.*)")throw de;_=y.#r[f]=new e}y=_}if(y.#e!==void 0)throw de;y.#e=u?-1:s}buildRegExpStr(){let r=Object.keys(this.#r).sort(Fs).map((s)=>{let h=this.#r[s],g=h.buildRegExpStr();return g===""?"":(typeof h.#t==="number"?`(${s})@${h.#t}`:pr.has(s)?`\\${s}`:s)+g}).filter(Boolean);if(typeof this.#e==="number"&&this.#e!==-1)r.unshift(`#${this.#e}`);if(r.length===0)return"";if(r.length===1)return r[0];return"(?:"+r.join("|")+")"}};var gt=class{#e={varIndex:0};#t=new _r;#r=0;paths=Q();insert(e,r){if(r){this.#t.insert(e.split(""),0,[],this.#e,!0);return}let s=[],h=[],g=e;for(let y=0;;){let t=!1;if(g=g.replace(/\{[^}]+\}/g,(o)=>{let f=`@\\${y}`;return h[y]=[f,o],y++,t=!0,f}),!t)break}let u=g.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let y=h.length-1;y>=0;y--){let[t]=h[y];for(let o=u.length-1;o>=0;o--)if(u[o].indexOf(t)!==-1){u[o]=u[o].replace(t,h[y][1]);break}}this.#t.insert(u,this.#r,s,this.#e,!1),this.paths[e]=[this.#r++,s]}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let r=0,s=[],h=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(g,u,y)=>{if(u!==void 0)return s[++r]=Number(u),"$()";if(y!==void 0)return h[Number(y)]=++r,"";return""}),[new RegExp(`^${e}`),s,h]}};var gr=Q();function mr(e){return gr[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(r,s)=>s?`\\${s}`:r==="/*"?_t:r==="*"?".*":`/:${pt}`)}$`)}function Ne(e,r){for(let s of Object.keys(e).sort((h,g)=>g.length-h.length))if(mr(s).test(r))return[...e[s]]}var Fe=class{name="RegExpRouter";#e;#t;#r;constructor(){this.#e={["ALL"]:Q()},this.#t={["ALL"]:Q()},this.#r={["ALL"]:new gt}}#n(e,r){try{this.#r[e].insert(r,!/\*|\/:/.test(r))}catch(s){throw s===de?new Pe(r):s}}add(e,r,s){let h=this.#e,g=this.#t;if(!h)throw Error(Me);if(!h[e]){this.#r[e]=new gt;for(let t of[h,g]){t[e]=Q();for(let o in t.ALL)t[e][o]=[...t.ALL[o]],this.#n(e,o)}}if(r==="/*")r="*";let u=e==="ALL"?Object.keys(h):[e];if(/\*$/.test(r)){let t=mr(r);for(let o of u)if(!h[o][r])this.#n(o,r),h[o][r]=Ne(h[o],r)||Ne(h.ALL,r)||[];for(let o of[h,g])for(let f of u)for(let p in o[f])t.test(p)&&o[f][p].push([s,r]);return}let y=Be(r)||[r];for(let t of y)for(let o of u){if(!g[o][t])this.#n(o,t),g[o][t]=Ne(h[o],t)||Ne(h.ALL,t)||[];g[o][t].push([s,t])}}match=dt;buildAllMatchers(){let e=Q();for(let r of Object.keys(this.#t))e[r]=this.#s(r);return this.#e=this.#t=this.#r=void 0,gr=Q(),e}#s(e){let r=this.#e[e],s=this.#t[e],h=this.#r[e],g=Q(),u=[],[y,t,o]=h.buildRegExp();for(let f of[r,s])for(let p in f){let _=f[p],l=h.paths[p];if(!l){g[p]=[_.map(([d])=>[d,Q()]),He];continue}u[l[0]]=_.map(([d,v])=>[d,h.paths[v][1].reduceRight((n,[i],w)=>(n[i]=o[l[1][w][1]],n),Q())])}return[y,t.map((f)=>u[f]),g]}};var vr=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,r,s){if(!this.#t)throw Error(Me);this.#t.push([e,r,s])}match(e,r){if(!this.#t)throw Error("Fatal error");let s=this.#e,h=this.#t,g=s.length,u=0,y;for(;u<g;u++){let t=s[u];try{for(let o=0,f=h.length;o<f;o++)t.add(...h[o]);y=t.match(e,r)}catch(o){if(o instanceof Pe)continue;throw o}this.match=t.match.bind(t),this.#e=[t],this.#t=void 0;break}if(u===g)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,y}get activeRouter(){if(this.#t||this.#e.length!==1)throw Error("No active router has been determined yet.");return this.#e[0]}};var mt=Q(),Ws=0,yr=class e{#e=[];#t=Q();#r=[];#n;#s=mt;insert(r,s,h){let g=this,u=Gt(s),y=new Set,t=0;for(let o of u){let f=u[++t],p=qt(o,f)||(f===void 0&&o&&o.indexOf("*")===o.length-1?o:null),_=Array.isArray(p),l=_?p[0]:p||o,d=g.#t[l]||=new e;if(p&&!d.#n)d.#n=p,g.#r.push(d);if(g=d,_)y.add(p[1])}g.#e.push({[r]:{handler:h,possibleKeys:[...y],score:++Ws}})}#i(r,s,h,g,u){for(let y=0,t=s.#e.length;y<t;y++){let o=s.#e[y],f=o[h]||o.ALL;if(f){f.params=Q(),r.push(f);for(let p=0,_=f.possibleKeys.length;p<_;p++){let l=f.possibleKeys[p];f.params[l]=u?.[l]&&!p?u[l]:g[l]??u?.[l]}}}}search(r,s){let h=[];this.#s=mt;let g=[this],u=st(s),y=[],t=u.length,o=null;for(let f=0;f<t;f++){let p=u[f],_=f===t-1,l=[];for(let v=0,n=g.length;v<n;v++){let i=g[v],w=i.#t[p];if(w)if(w.#s=i.#s,_){if(w.#t["*"])this.#i(h,w.#t["*"],r,i.#s);this.#i(h,w,r,i.#s)}else l.push(w);for(let a of i.#r){let m=a.#n,c=i.#s===mt?{}:{...i.#s};if(typeof m==="string"){if(m==="*"||p.startsWith(m.slice(0,-1))){if(this.#i(h,a,r,i.#s),m==="*")a.#s=c,l.push(a)}continue}let[,S,C]=m;if(!p&&C===!0)continue;if(C!==!0){if(!o){o=[];let O=s[0]==="/"?1:0;for(let A=0;A<t;A++)o[A]=O,O+=u[A].length+1}let T=s.slice(o[f]),B=C.exec(T);if(B){if(!Object.hasOwn(c,S))c[S]=B[0];if(this.#i(h,a,r,i.#s,c),B[0].length===T.length&&a.#t["*"])this.#i(h,a.#t["*"],r,i.#s,c);for(let O in a.#t){a.#s=c;let A=B[0].match(/\//g)?.length??0;(y[A]||=[]).push(a);break}continue}}if(C===!0||C.test(p)){if(!Object.hasOwn(c,S))c[S]=p;if(_){if(this.#i(h,a,r,c,i.#s),a.#t["*"])this.#i(h,a.#t["*"],r,c,i.#s)}else a.#s=c,l.push(a)}}}let d=y.shift();g=d?l.concat(d):l}if(h[1])h.sort((f,p)=>f.score-p.score);return[h.map(({handler:f,params:p})=>[f,p])]}};var vt=class{name="TrieRouter";#e=new yr;add(e,r,s){for(let h of Be(r)||[r])this.#e.insert(e,h,s)}match(e,r){return this.#e.search(e,r)}};var We=class extends dr{constructor(e={}){super(e);this.router=e.router??new vr({routers:[new Fe,new vt]})}};var Us="Payload Too Large",br=(e)=>{let r=e.onError||(()=>{let h=new Response(Us,{status:413});throw new ht(413,{res:h})}),s=e.maxSize;return async function(g,u){if(!g.req.raw.body)return u();let y=g.req.raw.headers.has("transfer-encoding");if(g.req.raw.headers.has("content-length")&&!y)return parseInt(g.req.raw.headers.get("content-length")||"0",10)>s?r(g):u();let t=0,o=[],f=g.req.raw.body.getReader();for(;;){let{done:_,value:l}=await f.read();if(_)break;if(t+=l.length,t>s)return r(g);o.push(l)}let p={body:new ReadableStream({start(_){for(let l of o)_.enqueue(l);_.close()}}),duplex:"half"};return g.req.raw=new Request(g.req.raw,p),u()}};var Sr=(e)=>e;var K=0,Y=0,J=0,V=0,ee;((e)=>{function r(g,u,y,t){return t!==void 0?`#${pe(g)}${pe(u)}${pe(y)}${pe(t)}`:`#${pe(g)}${pe(u)}${pe(y)}`}e.toCss=r;function s(g,u,y,t=255){return(g<<24|u<<16|y<<8|t)>>>0}e.toRgba=s;function h(g,u,y,t){return{css:e.toCss(g,u,y,t),rgba:e.toRgba(g,u,y,t)}}e.toColor=h})(ee||={});var $s;((e)=>{function r(o,f){if(V=(f.rgba&255)/255,V===1)return{css:f.css,rgba:f.rgba};let p=f.rgba>>24&255,_=f.rgba>>16&255,l=f.rgba>>8&255,d=o.rgba>>24&255,v=o.rgba>>16&255,n=o.rgba>>8&255;K=d+Math.round((p-d)*V),Y=v+Math.round((_-v)*V),J=n+Math.round((l-n)*V);let i=ee.toCss(K,Y,J),w=ee.toRgba(K,Y,J);return{css:i,rgba:w}}e.blend=r;function s(o){return(o.rgba&255)===255}e.isOpaque=s;function h(o,f,p){let _=Ue.ensureContrastRatio(o.rgba,f.rgba,p);if(_)return ee.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=h;function g(o){let f=(o.rgba|255)>>>0;return[K,Y,J]=Ue.toChannels(f),{css:ee.toCss(K,Y,J),rgba:f}}e.opaque=g;function u(o,f){return V=Math.round(f*255),[K,Y,J]=Ue.toChannels(o.rgba),{css:ee.toCss(K,Y,J,V),rgba:ee.toRgba(K,Y,J,V)}}e.opacity=u;function y(o,f){return V=o.rgba&255,u(o,V*f/255)}e.multiplyOpacity=y;function t(o){return[o.rgba>>24&255,o.rgba>>16&255,o.rgba>>8&255]}e.toColorRGB=t})($s||={});var Z;((e)=>{let r,s;try{let g=document.createElement("canvas");g.width=1,g.height=1;let u=g.getContext("2d",{willReadFrequently:!0});u&&(r=u,r.globalCompositeOperation="copy",s=r.createLinearGradient(0,0,1,1))}catch{}function h(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return K=parseInt(g.slice(1,2).repeat(2),16),Y=parseInt(g.slice(2,3).repeat(2),16),J=parseInt(g.slice(3,4).repeat(2),16),ee.toColor(K,Y,J);case 5:return K=parseInt(g.slice(1,2).repeat(2),16),Y=parseInt(g.slice(2,3).repeat(2),16),J=parseInt(g.slice(3,4).repeat(2),16),V=parseInt(g.slice(4,5).repeat(2),16),ee.toColor(K,Y,J,V);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}let u=g.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(u)return K=parseInt(u[1]),Y=parseInt(u[2]),J=parseInt(u[3]),V=Math.round((u[5]===void 0?1:parseFloat(u[5]))*255),ee.toColor(K,Y,J,V);if(!r||!s)throw Error("css.toColor: Unsupported css format");if(r.fillStyle=s,r.fillStyle=g,typeof r.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(r.fillRect(0,0,1,1),[K,Y,J,V]=r.getImageData(0,0,1,1).data,V!==255)throw Error("css.toColor: Unsupported css format");return{rgba:ee.toRgba(K,Y,J,V),css:g}}e.toColor=h})(Z||={});var te;((e)=>{function r(h){return s(h>>16&255,h>>8&255,h&255)}e.relativeLuminance=r;function s(h,g,u){let y=h/255,t=g/255,o=u/255,f=y<=0.03928?y/12.92:Math.pow((y+0.055)/1.055,2.4),p=t<=0.03928?t/12.92:Math.pow((t+0.055)/1.055,2.4),_=o<=0.03928?o/12.92:Math.pow((o+0.055)/1.055,2.4);return f*0.2126+p*0.7152+_*0.0722}e.relativeLuminance2=s})(te||={});var Ue;((e)=>{function r(y,t){if(V=(t&255)/255,V===1)return t;let o=t>>24&255,f=t>>16&255,p=t>>8&255,_=y>>24&255,l=y>>16&255,d=y>>8&255;return K=_+Math.round((o-_)*V),Y=l+Math.round((f-l)*V),J=d+Math.round((p-d)*V),ee.toRgba(K,Y,J)}e.blend=r;function s(y,t,o){let f=te.relativeLuminance(y>>8),p=te.relativeLuminance(t>>8);if(ce(f,p)<o){if(p<f){let d=h(y,t,o),v=ce(f,te.relativeLuminance(d>>8));if(v<o){let n=g(y,t,o),i=ce(f,te.relativeLuminance(n>>8));return v>i?d:n}return d}let _=g(y,t,o),l=ce(f,te.relativeLuminance(_>>8));if(l<o){let d=h(y,t,o),v=ce(f,te.relativeLuminance(d>>8));return l>v?_:d}return _}}e.ensureContrastRatio=s;function h(y,t,o){let f=y>>24&255,p=y>>16&255,_=y>>8&255,l=t>>24&255,d=t>>16&255,v=t>>8&255,n=ce(te.relativeLuminance2(l,d,v),te.relativeLuminance2(f,p,_));for(;n<o&&(l>0||d>0||v>0);)l-=Math.max(0,Math.ceil(l*0.1)),d-=Math.max(0,Math.ceil(d*0.1)),v-=Math.max(0,Math.ceil(v*0.1)),n=ce(te.relativeLuminance2(l,d,v),te.relativeLuminance2(f,p,_));return(l<<24|d<<16|v<<8|255)>>>0}e.reduceLuminance=h;function g(y,t,o){let f=y>>24&255,p=y>>16&255,_=y>>8&255,l=t>>24&255,d=t>>16&255,v=t>>8&255,n=ce(te.relativeLuminance2(l,d,v),te.relativeLuminance2(f,p,_));for(;n<o&&(l<255||d<255||v<255);)l=Math.min(255,l+Math.ceil((255-l)*0.1)),d=Math.min(255,d+Math.ceil((255-d)*0.1)),v=Math.min(255,v+Math.ceil((255-v)*0.1)),n=ce(te.relativeLuminance2(l,d,v),te.relativeLuminance2(f,p,_));return(l<<24|d<<16|v<<8|255)>>>0}e.increaseLuminance=g;function u(y){return[y>>24&255,y>>16&255,y>>8&255,y&255]}e.toChannels=u})(Ue||={});function pe(e){let r=e.toString(16);return r.length<2?"0"+r:r}function ce(e,r){return e<r?(r+0.05)/(e+0.05):(e+0.05)/(r+0.05)}var js=Object.freeze((()=>{let e=[Z.toColor("#2e3436"),Z.toColor("#cc0000"),Z.toColor("#4e9a06"),Z.toColor("#c4a000"),Z.toColor("#3465a4"),Z.toColor("#75507b"),Z.toColor("#06989a"),Z.toColor("#d3d7cf"),Z.toColor("#555753"),Z.toColor("#ef2929"),Z.toColor("#8ae234"),Z.toColor("#fce94f"),Z.toColor("#729fcf"),Z.toColor("#ad7fa8"),Z.toColor("#34e2e2"),Z.toColor("#eeeeec")],r=[0,95,135,175,215,255];for(let s=0;s<216;s++){let h=r[s/36%6|0],g=r[s/6%6|0],u=r[s%6];e.push({css:ee.toCss(h,g,u),rgba:ee.toRgba(h,g,u)})}for(let s=0;s<24;s++){let h=8+s*10;e.push({css:ee.toCss(h,h,h),rgba:ee.toRgba(h,h,h)})}return e})());function wr(e,r,s){return Math.max(r,Math.min(e,s))}function zs(e){switch(e){case"&":return"&";case"<":return"<"}return e}var Cr=class{constructor(e){this._buffer=e}serialize(e,r){let s=this._buffer.getNullCell(),h=this._buffer.getNullCell(),g=s,u=e.start.y,y=e.end.y,t=e.start.x,o=e.end.x;this._beforeSerialize(y-u,u,y);for(let f=u;f<=y;f++){let p=this._buffer.getLine(f);if(p){let _=f===e.start.y?t:0,l=f===e.end.y?o:p.length;for(let d=_;d<l;d++){let v=p.getCell(d,g===s?h:s);if(!v){console.warn(`Can't get cell at row=${f}, col=${d}`);continue}this._nextCell(v,g,f,d),g=v}}this._rowEnd(f,f===y)}return this._afterSerialize(),this._serializeString(r)}_nextCell(e,r,s,h){}_rowEnd(e,r){}_beforeSerialize(e,r,s){}_afterSerialize(){}_serializeString(e){return""}};function xr(e,r){return e.getFgColorMode()===r.getFgColorMode()&&e.getFgColor()===r.getFgColor()}function he(e,r){return e.getBgColorMode()===r.getBgColorMode()&&e.getBgColor()===r.getBgColor()}function Er(e,r){return e.isInverse()===r.isInverse()&&e.isBold()===r.isBold()&&e.isUnderline()===r.isUnderline()&&e.isOverline()===r.isOverline()&&e.isBlink()===r.isBlink()&&e.isInvisible()===r.isInvisible()&&e.isItalic()===r.isItalic()&&e.isDim()===r.isDim()&&e.isStrikethrough()===r.isStrikethrough()}var Gs=class extends Cr{constructor(e,r){super(e);this._terminal=r,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,r,s){this._allRows=Array(e),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(e,r){this._nullCellCount>0&&!he(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let s="";if(!r){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let h=this._buffer.getLine(e),g=this._buffer.getLine(e+1);if(!g.isWrapped)s=`\r
|
|
31
|
-
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{s="";let
|
|
32
|
-
`).map((
|
|
33
|
-
`;
|
|
34
|
-
`).length;return{text:
|
|
35
|
-
`).find((s)=>s.startsWith("n"))?.slice(1)}var
|
|
36
|
-
\x1B[2m${
|
|
37
|
-
`);this.screen.onTitleChange((t)=>{let
|
|
38
|
-
`)),1e4).replace(/\n+$/,"");if(r.trim()==="")return;return{name:
|
|
39
|
-
`)[0],100),content:r,run:e.run===!0}}import{lstatSync as
|
|
28
|
+
`),{leaks:k,details:z}}}function i(A){return v?.trackDisposable(A),A}function w(A){v?.markAsDisposed(A)}function h(A,M){v?.setParent(A,M)}function m(A){return typeof A=="object"&&A!==null&&typeof A.dispose=="function"&&A.dispose.length===0}function u(A){if(_.Iterable.is(A)){let M=[];for(let k of A)if(k)try{k.dispose()}catch(P){M.push(P)}if(M.length===1)throw M[0];if(M.length>1)throw AggregateError(M,"Encountered errors while disposing of store");return Array.isArray(A)?[]:A}if(A)return A.dispose(),A}function S(A){let M=i({dispose:(0,d.createSingleCallFunction)(()=>{w(M),A()})});return M}t.DisposableTracker=o;class C{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,i(this)}dispose(){this._isDisposed||(w(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{u(this._toDispose)}finally{this._toDispose.clear()}}add(A){if(!A)return A;if(A===this)throw Error("Cannot register a disposable on itself!");return h(A,this),this._isDisposed?C.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(A),A}delete(A){if(A){if(A===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(A),A.dispose()}}deleteAndLeak(A){A&&this._toDispose.has(A)&&(this._toDispose.delete(A),h(A,null))}}t.DisposableStore=C;class T{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new C,i(this),h(this._store,this)}dispose(){w(this),this._store.dispose()}_register(A){if(A===this)throw Error("Cannot register a disposable on itself!");return this._store.add(A)}}t.Disposable=T;class B{constructor(){this._isDisposed=!1,i(this)}get value(){return this._isDisposed?void 0:this._value}set value(A){this._isDisposed||A===this._value||(this._value?.dispose(),A&&h(A,this),this._value=A)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,w(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let A=this._value;return this._value=void 0,A&&h(A,null),A}}t.MutableDisposable=B,t.MandatoryMutableDisposable=class{constructor(A){this._disposable=new B,this._isDisposed=!1,this._disposable.value=A}get value(){return this._disposable.value}set value(A){this._isDisposed||A===this._disposable.value||(this._disposable.value=A)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},t.RefCountedDisposable=class{constructor(A){this._disposable=A,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter==0&&this._disposable.dispose(),this}},t.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,i(this)}set(A){let M=A;return this.unset=()=>M=void 0,this.isset=()=>M!==void 0,this.dispose=()=>{M&&(M(),M=void 0,w(this))},this}},t.ReferenceCollection=class{constructor(){this.references=new Map}acquire(A,...M){let k=this.references.get(A);k||(k={counter:0,object:this.createReferencedObject(A,...M)},this.references.set(A,k));let{object:P}=k,W=(0,d.createSingleCallFunction)(()=>{--k.counter==0&&(this.destroyReferencedObject(A,k.object),this.references.delete(A))});return k.counter++,{object:P,dispose:W}}},t.AsyncReferenceCollection=class{constructor(A){this.referenceCollection=A}async acquire(A,...M){let k=this.referenceCollection.acquire(A,...M);try{return{object:await k.object,dispose:()=>k.dispose()}}catch(P){throw k.dispose(),P}}},t.ImmortalReference=class{constructor(A){this.object=A}dispose(){}};class O{constructor(){this._store=new Map,this._isDisposed=!1,i(this)}dispose(){w(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{u(this._store.values())}finally{this._store.clear()}}has(A){return this._store.has(A)}get size(){return this._store.size}get(A){return this._store.get(A)}set(A,M,k=!1){this._isDisposed&&console.warn(Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),k||this._store.get(A)?.dispose(),this._store.set(A,M)}deleteAndDispose(A){this._store.get(A)?.dispose(),this._store.delete(A)}deleteAndLeak(A){let M=this._store.get(A);return this._store.delete(A),M}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}t.DisposableMap=O},6317:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkedList=void 0;class n{static{this.Undefined=new n(void 0)}constructor(p){this.element=p,this.next=n.Undefined,this.prev=n.Undefined}}class l{constructor(){this._first=n.Undefined,this._last=n.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===n.Undefined}clear(){let p=this._first;for(;p!==n.Undefined;){let g=p.next;p.prev=n.Undefined,p.next=n.Undefined,p=g}this._first=n.Undefined,this._last=n.Undefined,this._size=0}unshift(p){return this._insert(p,!1)}push(p){return this._insert(p,!0)}_insert(p,g){let d=new n(p);if(this._first===n.Undefined)this._first=d,this._last=d;else if(g){let v=this._last;this._last=d,d.prev=v,v.next=d}else{let v=this._first;this._first=d,d.next=v,v.prev=d}this._size+=1;let _=!1;return()=>{_||(_=!0,this._remove(d))}}shift(){if(this._first!==n.Undefined){let p=this._first.element;return this._remove(this._first),p}}pop(){if(this._last!==n.Undefined){let p=this._last.element;return this._remove(this._last),p}}_remove(p){if(p.prev!==n.Undefined&&p.next!==n.Undefined){let g=p.prev;g.next=p.next,p.next.prev=g}else p.prev===n.Undefined&&p.next===n.Undefined?(this._first=n.Undefined,this._last=n.Undefined):p.next===n.Undefined?(this._last=this._last.prev,this._last.next=n.Undefined):p.prev===n.Undefined&&(this._first=this._first.next,this._first.prev=n.Undefined);this._size-=1}*[Symbol.iterator](){let p=this._first;for(;p!==n.Undefined;)yield p.element,p=p.next}}t.LinkedList=l},2608:(y,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SetMap=t.BidirectionalMap=t.CounterSet=t.Touch=void 0,t.getOrSet=function(l,p,g){let d=l.get(p);return d===void 0&&(d=g,l.set(p,d)),d},t.mapToString=function(l){let p=[];return l.forEach((g,d)=>{p.push(`${d} => ${g}`)}),`Map(${l.size}) {${p.join(", ")}}`},t.setToString=function(l){let p=[];return l.forEach((g)=>{p.push(g)}),`Set(${l.size}) {${p.join(", ")}}`},t.mapsStrictEqualIgnoreOrder=function(l,p){if(l===p)return!0;if(l.size!==p.size)return!1;for(let[g,d]of l)if(!p.has(g)||p.get(g)!==d)return!1;for(let[g]of p)if(!l.has(g))return!1;return!0},function(l){l[l.None=0]="None",l[l.AsOld=1]="AsOld",l[l.AsNew=2]="AsNew"}(n||(t.Touch=n={})),t.CounterSet=class{constructor(){this.map=new Map}add(l){return this.map.set(l,(this.map.get(l)||0)+1),this}delete(l){let p=this.map.get(l)||0;return p!==0&&(p--,p===0?this.map.delete(l):this.map.set(l,p),!0)}has(l){return this.map.has(l)}},t.BidirectionalMap=class{constructor(l){if(this._m1=new Map,this._m2=new Map,l)for(let[p,g]of l)this.set(p,g)}clear(){this._m1.clear(),this._m2.clear()}set(l,p){this._m1.set(l,p),this._m2.set(p,l)}get(l){return this._m1.get(l)}getKey(l){return this._m2.get(l)}delete(l){let p=this._m1.get(l);return p!==void 0&&(this._m1.delete(l),this._m2.delete(p),!0)}forEach(l,p){this._m1.forEach((g,d)=>{l.call(p,g,d,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},t.SetMap=class{constructor(){this.map=new Map}add(l,p){let g=this.map.get(l);g||(g=new Set,this.map.set(l,g)),g.add(p)}delete(l,p){let g=this.map.get(l);g&&(g.delete(p),g.size===0&&this.map.delete(l))}forEach(l,p){let g=this.map.get(l);g&&g.forEach(p)}get(l){return this.map.get(l)||new Set}}},9725:(y,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StopWatch=void 0;let n=globalThis.performance&&typeof globalThis.performance.now=="function";class l{static create(p){return new l(p)}constructor(p){this._now=n&&p===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}t.StopWatch=l}},r={};function s(y){var t=r[y];if(t!==void 0)return t.exports;var n=r[y]={exports:{}};return e[y].call(n.exports,n,n.exports,s),n.exports}var c={};(()=>{var y=c;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;let t=s(5101),n=s(6097),l=s(4335),p=s(5856),g=s(3027),d=s(7150),_=["cols","rows"];class v extends d.Disposable{constructor(o){super(),this._core=this._register(new p.Terminal(o)),this._addonManager=this._register(new g.AddonManager),this._publicOptions={...this._core.options};let i=(h)=>this._core.options[h],w=(h,m)=>{this._checkReadonlyOptions(h),this._core.options[h]=m};for(let h in this._core.options){Object.defineProperty(this._publicOptions,h,{get:()=>this._core.options[h],set:(u)=>{this._checkReadonlyOptions(h),this._core.options[h]=u}});let m={get:i.bind(this,h),set:w.bind(this,h)};Object.defineProperty(this._publicOptions,h,m)}}_checkReadonlyOptions(o){if(_.includes(o))throw Error(`Option "${o}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.allowProposedApi)throw 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 onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new n.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this._register(new t.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let o=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:o.applicationCursorKeys,applicationKeypadMode:o.applicationKeypad,bracketedPasteMode:o.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:o.origin,reverseWraparoundMode:o.reverseWraparound,sendFocusMode:o.sendFocus,synchronizedOutputMode:o.synchronizedOutput,wraparoundMode:o.wraparound}}get options(){return this._publicOptions}set options(o){for(let i in o)this._publicOptions[i]=o[i]}input(o,i=!0){this._core.input(o,i)}resize(o,i){this._verifyIntegers(o,i),this._core.resize(o,i)}registerMarker(o=0){return this._checkProposedApi(),this._verifyIntegers(o),this._core.addMarker(o)}addMarker(o){return this.registerMarker(o)}dispose(){super.dispose()}scrollLines(o){this._verifyIntegers(o),this._core.scrollLines(o)}scrollPages(o){this._verifyIntegers(o),this._core.scrollPages(o)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(o){this._verifyIntegers(o),this._core.scrollToLine(o)}clear(){this._core.clear()}write(o,i){this._core.write(o,i)}writeln(o,i){this._core.write(o),this._core.write(`\r
|
|
29
|
+
`,i)}reset(){this._core.reset()}loadAddon(o){this._addonManager.loadAddon(this,o)}_verifyIntegers(...o){for(let i of o)if(i===1/0||isNaN(i)||i%1!=0)throw Error("This API only accepts integers")}}y.Terminal=v})();var f=Rr;for(var a in c)f[a]=c[a];c.__esModule&&Object.defineProperty(f,"__esModule",{value:!0})})()});if(!Bun.semver.satisfies(Bun.version,">=1.4.0"))console.error(`Accompany: Bun ${"1.4.0"} \u4EE5\u4E0A\u304C\u5FC5\u8981\u3067\u3059\uFF08\u3044\u307E\u306E Bun: ${Bun.version}\uFF09\u3002
|
|
30
|
+
`+"`bun upgrade` \u3067 Bun \u3092\u4E0A\u3052\u308B\u304B\u3001Bun \u306E\u8981\u3089\u306A\u3044\u5B9F\u884C\u30D5\u30A1\u30A4\u30EB\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044: "+"https://github.com/itsuki-yamada/accompany/releases"),process.exit(1);var De=(e)=>("server"in e.env)?e.env.server:e.env;var nt=(e)=>{let r=e.split("/");if(r[0]==="")r.shift();return r},Vt=(e)=>{let{groups:r,path:s}=Ds(e),c=nt(s);return Ms(c,r)},Ds=(e)=>{let r=[];return e=e.replace(/\{[^}]+\}/g,(s,c)=>{let f=`@${c}`;return r.push([f,s]),f}),{groups:r,path:e}},Ms=(e,r)=>{for(let s=r.length-1;s>=0;s--){let[c]=r[s];for(let f=e.length-1;f>=0;f--)if(e[f].includes(c)){e[f]=e[f].replace(c,r[s][1]);break}}return e},Me={},Qt=(e,r)=>{if(e==="*")return"*";let s=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(s){let c=`${e}#${r}`;if(!Me[c])if(s[2])Me[c]=r&&r[0]!==":"&&r[0]!=="*"?[c,s[1],new RegExp(`^${s[2]}(?=/${r})`)]:[e,s[1],new RegExp(`^${s[2]}$`)];else Me[c]=[e,s[1],!0];return Me[c]}return null},Kt=(e,r)=>{try{return r(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(s)=>{try{return r(s)}catch{return s}})}},Yt=(e)=>Kt(e,decodeURI),ot=(e)=>{let r=e.url,s=r.indexOf("/",r.indexOf(":")+4),c=s;for(;c<r.length;c++){let f=r.charCodeAt(c);if(f===37){let a=r.indexOf("?",c),y=r.indexOf("#",c),t=a===-1?y===-1?void 0:y:y===-1?a:Math.min(a,y),n=r.slice(s,t);return Yt(n.includes("%25")?n.replace(/%25/g,"%2525"):n)}else if(f===63||f===35)break}return r.slice(s,c)};var Jt=(e)=>{let r=ot(e);return r.length>1&&r.at(-1)==="/"?r.slice(0,-1):r},fe=(e,r,...s)=>{if(s.length)r=fe(r,...s);return`${e?.[0]==="/"?"":"/"}${e}${r==="/"?"":`${e?.at(-1)==="/"?"":"/"}${r?.[0]==="/"?r.slice(1):r}`}`},Pe=(e)=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let r=e.split("/"),s=[],c="";return r.forEach((f)=>{if(f!==""&&!/\:/.test(f))c+="/"+f;else if(/\:/.test(f))if(f.charCodeAt(f.length-1)===63){if(s.length===0&&c==="")s.push("/");else s.push(c);let a=f.slice(0,-1);c+="/"+a,s.push(c)}else c+="/"+f}),s.filter((f,a,y)=>y.indexOf(f)===a)},Oe=(e)=>e.indexOf("%")!==-1?Kt(e,Ps):e,it=(e)=>{if(e.indexOf("+")!==-1)e=e.replace(/\+/g," ");return Oe(e)},Zt=(e,r,s)=>{let c=e.indexOf("#",8);if(c!==-1)e=e.slice(0,c);let f;if(!s&&r&&r.indexOf("%")===-1&&r.indexOf("+")===-1){let t=e.indexOf("?",8),n=t;if(n===-1)return;if(!e.startsWith(r,n+1))n=e.indexOf(`&${r}`,n+1);while(n!==-1){let l=e.charCodeAt(n+r.length+1);if(l===61||l===38||isNaN(l)){if(n>t&&/(?:^|&)[^=&]*[%+]/.test(e.slice(t+1,n)))break;if(l===61){let p=n+r.length+2,g=e.indexOf("&",p);return it(e.slice(p,g===-1?void 0:g))}return""}n=e.indexOf(`&${r}`,n+1)}if(f=/[%+]/.test(e),!f)return}let a=Object.create(null);f??=/[%+]/.test(e);let y=e.indexOf("?",8);while(y!==-1){let t=e.indexOf("&",y+1),n=e.indexOf("=",y);if(n>t&&t!==-1)n=-1;let l=e.slice(y+1,n===-1?t===-1?void 0:t:n);if(f)l=it(l);if(y=t,l==="")continue;let p;if(n===-1)p="";else if(p=e.slice(n+1,t===-1?void 0:t),f)p=it(p);if(s){if(!(a[l]&&Array.isArray(a[l])))a[l]=[];a[l].push(p)}else a[l]??=p}return r?a[r]:a},er=Zt,tr=(e,r)=>Zt(e,r,!0),Ps=decodeURIComponent;var Os={br:".br",zstd:".zst",gzip:".gz"},Bn=Object.keys(Os);var rr=["get","post","put","delete","options","patch","query"],Ie="Can not add a route since the matcher is already built.",He=class extends Error{};var at="__COMPOSED_HANDLER";var sr="x-hono-disable-ssg",Zn=(()=>{try{return new Response("SSG is disabled",{status:404,headers:{[sr]:"true"}})}catch{return null}})();var ir={Stringify:1,BeforeStream:2,Stream:3},nr=(e,r)=>{let s=new String(e);return s.isEscaped=!0,s.callbacks=r,s};var ct=async(e,r,s,c,f)=>{if(typeof e==="object"&&!(e instanceof String)){if(!(e instanceof Promise))e=e.toString();if(e instanceof Promise)e=await e}let a=e.callbacks;if(!a?.length)return Promise.resolve(e);if(f)f[0]+=e;else f=[e];let y=Promise.all(a.map((t)=>t({phase:r,buffer:f,context:c}))).then((t)=>Promise.all(t.filter(Boolean).map((n)=>ct(n,r,!1,c,f))).then(()=>f[0]));if(s)return nr(await y,a);else return y};var{write:jo}=Bun;var or=class{#e;constructor(e){this.#e=e,this.raw=e.raw,this.url=e.url?new URL(e.url):null,this.protocol=e.protocol??null}send(e,r){this.#e.send(e,r??{})}raw;binaryType="arraybuffer";get readyState(){return this.#e.readyState}url;protocol;close(e,r){this.#e.close(e,r)}},ar=(e)=>new MessageEvent("message",{data:e}),cr=(e)=>(...r)=>{if(typeof r[0]==="function"){let[s,c]=r;return async function(a,y){let t=await e(a,await s(a),c);if(t)return t;await y()}}else{let[s,c,f]=r;return(async()=>{let a=await e(s,c,f);if(!a)throw Error("Failed to upgrade WebSocket");return a})()}};var ht=(e)=>new or({send:(r,s)=>{e.send(r,s?.compress)},raw:e,readyState:e.readyState,url:e.data.url,protocol:e.data.protocol,close(r,s){e.close(r,s)}}),Ne=cr((e,r)=>{let s=De(e);if(!s)throw TypeError("env has to include the 2nd argument of fetch.");if(s.upgrade(e.req.raw,{data:{events:r,url:new URL(e.req.url),protocol:e.req.header("sec-websocket-protocol")?.split(",")[0]?.trim()??""}}))return new Response(null)}),lt={open(e){let r=e.data.events;if(r.onOpen)r.onOpen(new Event("open"),ht(e))},close(e,r,s){let c=e.data.events;if(c.onClose)c.onClose(new CloseEvent("close",{code:r,reason:s}),ht(e))},message(e,r){let s=e.data.events;if(s.onMessage){let c=typeof r==="string"?r:r.buffer;s.onMessage(ar(c),ht(e))}}};var ut=class extends Error{res;status;constructor(e=500,r){super(r?.message,{cause:r?.cause});this.res=r?.res,this.status=e}getResponse(){if(this.res)return new Response(this.res.body,{status:this.status,headers:this.res.headers});return new Response(this.message,{status:this.status})}};var hr=Symbol();var lr=(e,r)=>new Response(e,{headers:{"Content-Type":r.replace(/^[^;]+/,(s)=>s.toLowerCase())}}).formData();var Fs=1e4,Fe=(e)=>("headers"in e),dr=async(e,r=Object.create(null))=>{let{all:s=!1,dot:c=!1}=r,f=(Fe(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(f==="multipart/form-data"||f==="application/x-www-form-urlencoded")return Ws(e,{all:s,dot:c});return{}};async function Ws(e,r){if(!Fe(e)&&e.bodyCache.formData)return ur(await e.bodyCache.formData,r);let s=Fe(e)?e.headers:e.raw.headers,c=await e.arrayBuffer(),f=lr(c,s.get("Content-Type")||"");if(!Fe(e))e.bodyCache.formData=f;let a=await f;if(a)return ur(a,r);return{}}function ur(e,r){let s=Object.create(null),c={count:0};if(e.forEach((f,a)=>{if(!(r.all||a.endsWith("[]")))s[a]=f;else Us(s,a,f)}),r.dot)Object.entries(s).forEach(([f,a])=>{if(f.includes("."))$s(s,f,a,c),delete s[f]});return s}var Us=(e,r,s)=>{if(e[r]!==void 0)if(Array.isArray(e[r]))e[r].push(s);else e[r]=[e[r],s];else if(!r.endsWith("[]"))e[r]=s;else e[r]=[s]},$s=(e,r,s,c)=>{if(/(?:^|\.)__proto__\./.test(r))return;let f=e,a=r.split(".",34);if(a.length>33)fr();a.forEach((y,t)=>{if(t===a.length-1)f[y]=s;else{if(!f[y]||typeof f[y]!=="object"||Array.isArray(f[y])||f[y]instanceof File){if(c.count++>=Fs)fr();f[y]=Object.create(null)}f=f[y]}})},fr=()=>{throw Error("Nesting limit exceeded")};var pr=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,r="/",s=[[]]){this.raw=e,this.path=r,this.#t=s}param(e){return e?this.#r(e):this.#n()}#r(e){let r=this.#t[0][this.routeIndex]?.[1][e],s=this.#s(r);return s&&Oe(s)}#n(){let e={},r=Object.keys(this.#t[0][this.routeIndex]?.[1]??{});for(let s of r){let c=this.#s(this.#t[0][this.routeIndex][1][s]);if(c!==void 0)e[s]=Oe(c)}return e}#s(e){return this.#t[1]?this.#t[1][e]:e}query(e){return er(this.url,e)}queries(e){return tr(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let r=Object.create(null);return this.raw.headers.forEach((s,c)=>{r[c]=s}),r}async parseBody(e){return dr(this,e)}#i=(e)=>{let{bodyCache:r,raw:s}=this,c=r[e];if(c)return c;for(let f in r)return r[f].then((a)=>{if(f==="json")a=JSON.stringify(a);let y=f==="formData"?void 0:s.headers.get("content-type");return new Response(a,{headers:y?{"Content-Type":y}:void 0})[e]()});return r[e]=s[e]()};json(){return this.#i("text").then((e)=>JSON.parse(e))}text(){return this.#i("text")}arrayBuffer(){return this.#i("arrayBuffer")}bytes(){return this.#i("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#i("blob")}formData(){return this.#i("formData")}addValidatedData(e,r){(this.#e??={})[e]=r}valid(e){return this.#e?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[hr](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};var zs="text/plain; charset=UTF-8",ft=(e,r)=>({"Content-Type":e,...r}),we=(e,r)=>new Response(e,r),dt=class{#e;#t;env={};#r;finalized=!1;error;#n;#s;#i;#l;#c;#h;#a;#u;#f;constructor(e,r){if(this.#e=e,r)this.#s=r.executionCtx,this.env=r.env,this.#h=r.notFoundHandler,this.#f=r.path,this.#u=r.matchResult}get req(){return this.#t??=new pr(this.#e,this.#f,this.#u),this.#t}get event(){if(this.#s&&"respondWith"in this.#s)return this.#s;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#s)return this.#s;else throw Error("This context has no ExecutionContext")}get res(){return this.#i||=we(null,{headers:this.#a??=new Headers})}set res(e){if(this.#i&&e){e=we(e.body,e);for(let[r,s]of this.#i.headers.entries()){if(r==="content-type")continue;if(r==="set-cookie"){let c=this.#i.headers.getSetCookie();e.headers.delete("set-cookie");for(let f of c)e.headers.append("set-cookie",f)}else e.headers.set(r,s)}}this.#i=e,this.finalized=!0}render=(...e)=>(this.#c??=(r)=>this.html(r),this.#c(...e));setLayout=(e)=>this.#l=e;getLayout=()=>this.#l;setRenderer=(e)=>{this.#c=e};header=(e,r,s)=>{if(this.finalized)this.#i=we(this.#i.body,this.#i);let c=this.#i?this.#i.headers:this.#a??=new Headers;if(r===void 0)c.delete(e);else if(s?.append)c.append(e,r);else c.set(e,r)};status=(e)=>{this.#n=e};set=(e,r)=>{this.#r??=new Map,this.#r.set(e,r)};get=(e)=>this.#r?this.#r.get(e):void 0;get var(){if(!this.#r)return{};return Object.fromEntries(this.#r)}#o(e,r,s){let c=this.#i?new Headers(this.#i.headers):this.#a;if(typeof r==="object"&&r.headers){c??=new Headers;for(let[a,y]of new Headers(r.headers))if(a==="set-cookie")c.append(a,y);else c.set(a,y)}if(s){if(!c){let a=0;for(let y in s)if(++a>1||typeof s[y]!=="string"){c=new Headers;break}}if(c)for(let a in s){let y=s[a];if(typeof y==="string")c.set(a,y);else{c.delete(a);for(let t of y)c.append(a,t)}}}let f=typeof r==="number"?r:r?.status??this.#n;return we(e,{status:f,headers:c??s})}newResponse=(...e)=>this.#o(...e);body=(e,r,s)=>this.#o(e,r,s);text=(e,r,s)=>!this.#a&&!this.#n&&!r&&!s&&!this.finalized?new Response(e):this.#o(e,r,ft(zs,s));json=(e,r,s)=>this.#o(JSON.stringify(e),r,ft("application/json",s));html=(e,r,s)=>{let c=(f)=>this.#o(f,r,ft("text/html; charset=UTF-8",s));return typeof e==="object"?ct(e,ir.Stringify,!1,{}).then(c):c(e)};redirect=(e,r)=>{let s=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(s)?s:encodeURI(s)),this.newResponse(null,r??302)};notFound=()=>(this.#h??=()=>we(),this.#h(this))};var pt=(e,r,s)=>(c,f)=>{let a=-1;return y(0);async function y(t){if(t<=a)throw Error("next() called multiple times");a=t;let n,l=!1,p;if(e[t])p=e[t][0][0],c.req.routeIndex=t;else p=t===e.length&&f||void 0;if(p)try{n=await p(c,()=>y(t+1))}catch(g){if(g instanceof Error&&r)c.error=g,n=await r(g,c),l=!0;else throw g}else if(c.finalized===!1&&s)n=await s(c);if(n&&(c.finalized===!1||l))c.res=n;return c}};var js=(e)=>e.text("404 Not Found",404),_r=(e,r)=>{if("getResponse"in e){let s=e.getResponse();return r.newResponse(s.body,s)}return console.error(e),r.text("Internal Server Error",500)},gr=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(r={}){[...rr,"all"].forEach((f)=>{this[f]=(a,...y)=>{let t=f.toUpperCase();if(typeof a==="string")this.#e=a;else this.#n(t,this.#e,a);return y.forEach((n)=>{this.#n(t,this.#e,n)}),this}}),this.on=(f,a,...y)=>{for(let t of[a].flat()){this.#e=t;for(let n of[f].flat()){let l=n.toUpperCase();for(let p of y)this.#n(l,this.#e,p)}}return this},this.use=(f,...a)=>{if(typeof f==="string")this.#e=f;else this.#e="*",a.unshift(f);return a.forEach((y)=>{this.#n("ALL",this.#e,y)}),this};let{strict:s,...c}=r;Object.assign(this,c),this.getPath=s??!0?r.getPath??ot:Jt}#t(){let r=new e({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#r=this.#r,r.routes=this.routes,r}#r=js;errorHandler=_r;route(r,s){let c=this.basePath(r);return s.routes.map((f)=>{let a;if(s.errorHandler===_r)a=f.handler;else a=async(y,t)=>(await pt([],s.errorHandler)(y,()=>f.handler(y,t))).res,a[at]=f.handler;c.#n(f.method,f.path,a,f.basePath)}),this}basePath(r){let s=this.#t();return s._basePath=fe(this._basePath,r),s}onError=(r)=>(this.errorHandler=r,this);notFound=(r)=>(this.#r=r,this);mount(r,s,c){let f,a;if(c)if(typeof c==="function")a=c;else if(a=c.optionHandler,c.replaceRequest===!1)f=(n)=>n;else f=c.replaceRequest;let y=a?(n)=>{let l=a(n);return Array.isArray(l)?l:[l]}:(n)=>{let l=void 0;try{l=n.executionCtx}catch{}return[n.env,l]};f||=(()=>{let n=fe(this._basePath,r),l=n==="/"?0:n.length;return(p)=>{let g=new URL(p.url);return g.pathname=this.getPath(p).slice(l)||"/",new Request(g,p)}})();let t=async(n,l)=>{let p=await s(f(n.req.raw),...y(n));if(p)return p;await l()};return this.#n("ALL",fe(r,"*"),t),this}#n(r,s,c,f){s=fe(this._basePath,s);let a={basePath:f!==void 0?fe(this._basePath,f):this._basePath,path:s,method:r,handler:c};this.router.add(r,s,[c,a]),this.routes.push(a)}#s(r,s){if(r instanceof Error)return this.errorHandler(r,s);throw r}#i(r,s,c,f){if(f==="HEAD")return(async()=>new Response(null,await this.#i(r,s,c,"GET")))();let a=this.getPath(r,{env:c}),y=this.router.match(f,a),t=new dt(r,{path:a,matchResult:y,env:c,executionCtx:s,notFoundHandler:this.#r});if(y[0].length===1){let l;try{l=y[0][0][0][0](t,async()=>{t.res=await this.#r(t)})}catch(p){return this.#s(p,t)}return l instanceof Promise?l.then((p)=>p||(t.finalized?t.res:this.#r(t))).catch((p)=>this.#s(p,t)):l??this.#r(t)}let n=pt(y[0],this.errorHandler,this.#r);return(async()=>{try{let l=await n(t);if(!l.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#s(l,t)}})()}fetch=(r,...s)=>this.#i(r,s[1],s[0],r.method);request=(r,s,c,f)=>{if(r instanceof Request)return this.fetch(s?new Request(r,s):r,c,f);return r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${fe("/",r)}`,s),c,f)};fire=()=>{addEventListener("fetch",(r)=>{r.respondWith(this.#i(r.request,r,void 0,r.request.method))})}};var Q=()=>Object.create(null);var We=[];function _t(e,r){let s=this.buildAllMatchers(),c=(f,a)=>{let y=s[f]||s.ALL,t=y[2][a];if(t)return t;let n=a.match(y[0]);if(!n)return[[],We];let l=n.indexOf("",1);return[y[1][l],n]};return this.match=c,c(e,r)}var gt="[^/]+";var mt="(?:|/.*)",de=Symbol(),mr=new Set(".\\+*[^]$()");function Gs(e,r){if(e.length===1)return r.length===1?e<r?-1:1:-1;if(r.length===1)return 1;if(e===".*"||e==="(?:|/.*)")return r==="(?:|/.*)"?-1:1;else if(r===".*"||r==="(?:|/.*)")return-1;if(e==="[^/]+")return 1;else if(r==="[^/]+")return-1;return e.length===r.length?e<r?-1:1:r.length-e.length}var vr=class e{#e;#t;#r=Q();insert(r,s,c,f,a){let y=this;for(let t=0,n=r.length;t<n;t++){let l=r[t],p=l.length===1?l==="*"?t===n-1?["","",".*"]:["","",gt]:null:l==="/*"?["","",mt]:l.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),g;if(p){let d=p[1],_=p[2]||"[^/]+";if(d&&p[2]){if(_===".*")throw de;if(_=_.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(_))throw de;if(_.length===1&&mr.has(_))throw de}if(g=y.#r[_],!g){if(_!==".*"&&_!=="(?:|/.*)"){for(let v in y.#r)if((_.length>1||v.length>1)&&v!==".*"&&v!=="(?:|/.*)")throw de}g=y.#r[_]=new e}if(d!=="")g.#t??=f.varIndex++,c.push([d,g.#t])}else if(g=y.#r[l],!g){for(let d in y.#r)if(d.length>1&&d!==".*"&&d!=="(?:|/.*)")throw de;g=y.#r[l]=new e}y=g}if(y.#e!==void 0)throw de;y.#e=a?-1:s}buildRegExpStr(){let r=Object.keys(this.#r).sort(Gs).map((s)=>{let c=this.#r[s],f=c.buildRegExpStr();return f===""?"":(typeof c.#t==="number"?`(${s})@${c.#t}`:mr.has(s)?`\\${s}`:s)+f}).filter(Boolean);if(typeof this.#e==="number"&&this.#e!==-1)r.unshift(`#${this.#e}`);if(r.length===0)return"";if(r.length===1)return r[0];return"(?:"+r.join("|")+")"}};var vt=class{#e={varIndex:0};#t=new vr;#r=0;paths=Q();insert(e,r){if(r){this.#t.insert(e.split(""),0,[],this.#e,!0);return}let s=[],c=[],f=e;for(let y=0;;){let t=!1;if(f=f.replace(/\{[^}]+\}/g,(n)=>{let l=`@\\${y}`;return c[y]=[l,n],y++,t=!0,l}),!t)break}let a=f.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let y=c.length-1;y>=0;y--){let[t]=c[y];for(let n=a.length-1;n>=0;n--)if(a[n].indexOf(t)!==-1){a[n]=a[n].replace(t,c[y][1]);break}}this.#t.insert(a,this.#r,s,this.#e,!1),this.paths[e]=[this.#r++,s]}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let r=0,s=[],c=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(f,a,y)=>{if(a!==void 0)return s[++r]=Number(a),"$()";if(y!==void 0)return c[Number(y)]=++r,"";return""}),[new RegExp(`^${e}`),s,c]}};var yr=Q();function br(e){return yr[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(r,s)=>s?`\\${s}`:r==="/*"?mt:r==="*"?".*":`/:${gt}`)}$`)}function Ue(e,r){for(let s of Object.keys(e).sort((c,f)=>f.length-c.length))if(br(s).test(r))return[...e[s]]}var $e=class{name="RegExpRouter";#e;#t;#r;constructor(){this.#e={["ALL"]:Q()},this.#t={["ALL"]:Q()},this.#r={["ALL"]:new vt}}#n(e,r){try{this.#r[e].insert(r,!/\*|\/:/.test(r))}catch(s){throw s===de?new He(r):s}}add(e,r,s){let c=this.#e,f=this.#t;if(!c)throw Error(Ie);if(!c[e]){this.#r[e]=new vt;for(let t of[c,f]){t[e]=Q();for(let n in t.ALL)t[e][n]=[...t.ALL[n]],this.#n(e,n)}}if(r==="/*")r="*";let a=e==="ALL"?Object.keys(c):[e];if(/\*$/.test(r)){let t=br(r);for(let n of a)if(!c[n][r])this.#n(n,r),c[n][r]=Ue(c[n],r)||Ue(c.ALL,r)||[];for(let n of[c,f])for(let l of a)for(let p in n[l])t.test(p)&&n[l][p].push([s,r]);return}let y=Pe(r)||[r];for(let t of y)for(let n of a){if(!f[n][t])this.#n(n,t),f[n][t]=Ue(c[n],t)||Ue(c.ALL,t)||[];f[n][t].push([s,t])}}match=_t;buildAllMatchers(){let e=Q();for(let r of Object.keys(this.#t))e[r]=this.#s(r);return this.#e=this.#t=this.#r=void 0,yr=Q(),e}#s(e){let r=this.#e[e],s=this.#t[e],c=this.#r[e],f=Q(),a=[],[y,t,n]=c.buildRegExp();for(let l of[r,s])for(let p in l){let g=l[p],d=c.paths[p];if(!d){f[p]=[g.map(([_])=>[_,Q()]),We];continue}a[d[0]]=g.map(([_,v])=>[_,c.paths[v][1].reduceRight((o,[i],w)=>(o[i]=n[d[1][w][1]],o),Q())])}return[y,t.map((l)=>a[l]),f]}};var Sr=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,r,s){if(!this.#t)throw Error(Ie);this.#t.push([e,r,s])}match(e,r){if(!this.#t)throw Error("Fatal error");let s=this.#e,c=this.#t,f=s.length,a=0,y;for(;a<f;a++){let t=s[a];try{for(let n=0,l=c.length;n<l;n++)t.add(...c[n]);y=t.match(e,r)}catch(n){if(n instanceof He)continue;throw n}this.match=t.match.bind(t),this.#e=[t],this.#t=void 0;break}if(a===f)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,y}get activeRouter(){if(this.#t||this.#e.length!==1)throw Error("No active router has been determined yet.");return this.#e[0]}};var yt=Q(),qs=0,wr=class e{#e=[];#t=Q();#r=[];#n;#s=yt;insert(r,s,c){let f=this,a=Vt(s),y=new Set,t=0;for(let n of a){let l=a[++t],p=Qt(n,l)||(l===void 0&&n&&n.indexOf("*")===n.length-1?n:null),g=Array.isArray(p),d=g?p[0]:p||n,_=f.#t[d]||=new e;if(p&&!_.#n)_.#n=p,f.#r.push(_);if(f=_,g)y.add(p[1])}f.#e.push({[r]:{handler:c,possibleKeys:[...y],score:++qs}})}#i(r,s,c,f,a){for(let y=0,t=s.#e.length;y<t;y++){let n=s.#e[y],l=n[c]||n.ALL;if(l){l.params=Q(),r.push(l);for(let p=0,g=l.possibleKeys.length;p<g;p++){let d=l.possibleKeys[p];l.params[d]=a?.[d]&&!p?a[d]:f[d]??a?.[d]}}}}search(r,s){let c=[];this.#s=yt;let f=[this],a=nt(s),y=[],t=a.length,n=null;for(let l=0;l<t;l++){let p=a[l],g=l===t-1,d=[];for(let v=0,o=f.length;v<o;v++){let i=f[v],w=i.#t[p];if(w)if(w.#s=i.#s,g){if(w.#t["*"])this.#i(c,w.#t["*"],r,i.#s);this.#i(c,w,r,i.#s)}else d.push(w);for(let h of i.#r){let m=h.#n,u=i.#s===yt?{}:{...i.#s};if(typeof m==="string"){if(m==="*"||p.startsWith(m.slice(0,-1))){if(this.#i(c,h,r,i.#s),m==="*")h.#s=u,d.push(h)}continue}let[,S,C]=m;if(!p&&C===!0)continue;if(C!==!0){if(!n){n=[];let O=s[0]==="/"?1:0;for(let A=0;A<t;A++)n[A]=O,O+=a[A].length+1}let T=s.slice(n[l]),B=C.exec(T);if(B){if(!Object.hasOwn(u,S))u[S]=B[0];if(this.#i(c,h,r,i.#s,u),B[0].length===T.length&&h.#t["*"])this.#i(c,h.#t["*"],r,i.#s,u);for(let O in h.#t){h.#s=u;let A=B[0].match(/\//g)?.length??0;(y[A]||=[]).push(h);break}continue}}if(C===!0||C.test(p)){if(!Object.hasOwn(u,S))u[S]=p;if(g){if(this.#i(c,h,r,u,i.#s),h.#t["*"])this.#i(c,h.#t["*"],r,u,i.#s)}else h.#s=u,d.push(h)}}}let _=y.shift();f=_?d.concat(_):d}if(c[1])c.sort((l,p)=>l.score-p.score);return[c.map(({handler:l,params:p})=>[l,p])]}};var bt=class{name="TrieRouter";#e=new wr;add(e,r,s){for(let c of Pe(r)||[r])this.#e.insert(e,c,s)}match(e,r){return this.#e.search(e,r)}};var ze=class extends gr{constructor(e={}){super(e);this.router=e.router??new Sr({routers:[new $e,new bt]})}};var Xs="Payload Too Large",Cr=(e)=>{let r=e.onError||(()=>{let c=new Response(Xs,{status:413});throw new ut(413,{res:c})}),s=e.maxSize;return async function(f,a){if(!f.req.raw.body)return a();let y=f.req.raw.headers.has("transfer-encoding");if(f.req.raw.headers.has("content-length")&&!y)return parseInt(f.req.raw.headers.get("content-length")||"0",10)>s?r(f):a();let t=0,n=[],l=f.req.raw.body.getReader();for(;;){let{done:g,value:d}=await l.read();if(g)break;if(t+=d.length,t>s)return r(f);n.push(d)}let p={body:new ReadableStream({start(g){for(let d of n)g.enqueue(d);g.close()}}),duplex:"half"};return f.req.raw=new Request(f.req.raw,p),a()}};var xr=(e)=>e;var K=0,Y=0,J=0,V=0,te;((e)=>{function r(f,a,y,t){return t!==void 0?`#${_e(f)}${_e(a)}${_e(y)}${_e(t)}`:`#${_e(f)}${_e(a)}${_e(y)}`}e.toCss=r;function s(f,a,y,t=255){return(f<<24|a<<16|y<<8|t)>>>0}e.toRgba=s;function c(f,a,y,t){return{css:e.toCss(f,a,y,t),rgba:e.toRgba(f,a,y,t)}}e.toColor=c})(te||={});var Vs;((e)=>{function r(n,l){if(V=(l.rgba&255)/255,V===1)return{css:l.css,rgba:l.rgba};let p=l.rgba>>24&255,g=l.rgba>>16&255,d=l.rgba>>8&255,_=n.rgba>>24&255,v=n.rgba>>16&255,o=n.rgba>>8&255;K=_+Math.round((p-_)*V),Y=v+Math.round((g-v)*V),J=o+Math.round((d-o)*V);let i=te.toCss(K,Y,J),w=te.toRgba(K,Y,J);return{css:i,rgba:w}}e.blend=r;function s(n){return(n.rgba&255)===255}e.isOpaque=s;function c(n,l,p){let g=je.ensureContrastRatio(n.rgba,l.rgba,p);if(g)return te.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=c;function f(n){let l=(n.rgba|255)>>>0;return[K,Y,J]=je.toChannels(l),{css:te.toCss(K,Y,J),rgba:l}}e.opaque=f;function a(n,l){return V=Math.round(l*255),[K,Y,J]=je.toChannels(n.rgba),{css:te.toCss(K,Y,J,V),rgba:te.toRgba(K,Y,J,V)}}e.opacity=a;function y(n,l){return V=n.rgba&255,a(n,V*l/255)}e.multiplyOpacity=y;function t(n){return[n.rgba>>24&255,n.rgba>>16&255,n.rgba>>8&255]}e.toColorRGB=t})(Vs||={});var Z;((e)=>{let r,s;try{let f=document.createElement("canvas");f.width=1,f.height=1;let a=f.getContext("2d",{willReadFrequently:!0});a&&(r=a,r.globalCompositeOperation="copy",s=r.createLinearGradient(0,0,1,1))}catch{}function c(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return K=parseInt(f.slice(1,2).repeat(2),16),Y=parseInt(f.slice(2,3).repeat(2),16),J=parseInt(f.slice(3,4).repeat(2),16),te.toColor(K,Y,J);case 5:return K=parseInt(f.slice(1,2).repeat(2),16),Y=parseInt(f.slice(2,3).repeat(2),16),J=parseInt(f.slice(3,4).repeat(2),16),V=parseInt(f.slice(4,5).repeat(2),16),te.toColor(K,Y,J,V);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}let a=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return K=parseInt(a[1]),Y=parseInt(a[2]),J=parseInt(a[3]),V=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),te.toColor(K,Y,J,V);if(!r||!s)throw Error("css.toColor: Unsupported css format");if(r.fillStyle=s,r.fillStyle=f,typeof r.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(r.fillRect(0,0,1,1),[K,Y,J,V]=r.getImageData(0,0,1,1).data,V!==255)throw Error("css.toColor: Unsupported css format");return{rgba:te.toRgba(K,Y,J,V),css:f}}e.toColor=c})(Z||={});var re;((e)=>{function r(c){return s(c>>16&255,c>>8&255,c&255)}e.relativeLuminance=r;function s(c,f,a){let y=c/255,t=f/255,n=a/255,l=y<=0.03928?y/12.92:Math.pow((y+0.055)/1.055,2.4),p=t<=0.03928?t/12.92:Math.pow((t+0.055)/1.055,2.4),g=n<=0.03928?n/12.92:Math.pow((n+0.055)/1.055,2.4);return l*0.2126+p*0.7152+g*0.0722}e.relativeLuminance2=s})(re||={});var je;((e)=>{function r(y,t){if(V=(t&255)/255,V===1)return t;let n=t>>24&255,l=t>>16&255,p=t>>8&255,g=y>>24&255,d=y>>16&255,_=y>>8&255;return K=g+Math.round((n-g)*V),Y=d+Math.round((l-d)*V),J=_+Math.round((p-_)*V),te.toRgba(K,Y,J)}e.blend=r;function s(y,t,n){let l=re.relativeLuminance(y>>8),p=re.relativeLuminance(t>>8);if(le(l,p)<n){if(p<l){let _=c(y,t,n),v=le(l,re.relativeLuminance(_>>8));if(v<n){let o=f(y,t,n),i=le(l,re.relativeLuminance(o>>8));return v>i?_:o}return _}let g=f(y,t,n),d=le(l,re.relativeLuminance(g>>8));if(d<n){let _=c(y,t,n),v=le(l,re.relativeLuminance(_>>8));return d>v?g:_}return g}}e.ensureContrastRatio=s;function c(y,t,n){let l=y>>24&255,p=y>>16&255,g=y>>8&255,d=t>>24&255,_=t>>16&255,v=t>>8&255,o=le(re.relativeLuminance2(d,_,v),re.relativeLuminance2(l,p,g));for(;o<n&&(d>0||_>0||v>0);)d-=Math.max(0,Math.ceil(d*0.1)),_-=Math.max(0,Math.ceil(_*0.1)),v-=Math.max(0,Math.ceil(v*0.1)),o=le(re.relativeLuminance2(d,_,v),re.relativeLuminance2(l,p,g));return(d<<24|_<<16|v<<8|255)>>>0}e.reduceLuminance=c;function f(y,t,n){let l=y>>24&255,p=y>>16&255,g=y>>8&255,d=t>>24&255,_=t>>16&255,v=t>>8&255,o=le(re.relativeLuminance2(d,_,v),re.relativeLuminance2(l,p,g));for(;o<n&&(d<255||_<255||v<255);)d=Math.min(255,d+Math.ceil((255-d)*0.1)),_=Math.min(255,_+Math.ceil((255-_)*0.1)),v=Math.min(255,v+Math.ceil((255-v)*0.1)),o=le(re.relativeLuminance2(d,_,v),re.relativeLuminance2(l,p,g));return(d<<24|_<<16|v<<8|255)>>>0}e.increaseLuminance=f;function a(y){return[y>>24&255,y>>16&255,y>>8&255,y&255]}e.toChannels=a})(je||={});function _e(e){let r=e.toString(16);return r.length<2?"0"+r:r}function le(e,r){return e<r?(r+0.05)/(e+0.05):(e+0.05)/(r+0.05)}var Qs=Object.freeze((()=>{let e=[Z.toColor("#2e3436"),Z.toColor("#cc0000"),Z.toColor("#4e9a06"),Z.toColor("#c4a000"),Z.toColor("#3465a4"),Z.toColor("#75507b"),Z.toColor("#06989a"),Z.toColor("#d3d7cf"),Z.toColor("#555753"),Z.toColor("#ef2929"),Z.toColor("#8ae234"),Z.toColor("#fce94f"),Z.toColor("#729fcf"),Z.toColor("#ad7fa8"),Z.toColor("#34e2e2"),Z.toColor("#eeeeec")],r=[0,95,135,175,215,255];for(let s=0;s<216;s++){let c=r[s/36%6|0],f=r[s/6%6|0],a=r[s%6];e.push({css:te.toCss(c,f,a),rgba:te.toRgba(c,f,a)})}for(let s=0;s<24;s++){let c=8+s*10;e.push({css:te.toCss(c,c,c),rgba:te.toRgba(c,c,c)})}return e})());function Er(e,r,s){return Math.max(r,Math.min(e,s))}function Ks(e){switch(e){case"&":return"&";case"<":return"<"}return e}var Ar=class{constructor(e){this._buffer=e}serialize(e,r){let s=this._buffer.getNullCell(),c=this._buffer.getNullCell(),f=s,a=e.start.y,y=e.end.y,t=e.start.x,n=e.end.x;this._beforeSerialize(y-a,a,y);for(let l=a;l<=y;l++){let p=this._buffer.getLine(l);if(p){let g=l===e.start.y?t:0,d=l===e.end.y?n:p.length;for(let _=g;_<d;_++){let v=p.getCell(_,f===s?c:s);if(!v){console.warn(`Can't get cell at row=${l}, col=${_}`);continue}this._nextCell(v,f,l,_),f=v}}this._rowEnd(l,l===y)}return this._afterSerialize(),this._serializeString(r)}_nextCell(e,r,s,c){}_rowEnd(e,r){}_beforeSerialize(e,r,s){}_afterSerialize(){}_serializeString(e){return""}};function kr(e,r){return e.getFgColorMode()===r.getFgColorMode()&&e.getFgColor()===r.getFgColor()}function ue(e,r){return e.getBgColorMode()===r.getBgColorMode()&&e.getBgColor()===r.getBgColor()}function Lr(e,r){return e.isInverse()===r.isInverse()&&e.isBold()===r.isBold()&&e.isUnderline()===r.isUnderline()&&e.isOverline()===r.isOverline()&&e.isBlink()===r.isBlink()&&e.isInvisible()===r.isInvisible()&&e.isItalic()===r.isItalic()&&e.isDim()===r.isDim()&&e.isStrikethrough()===r.isStrikethrough()}var Ys=class extends Ar{constructor(e,r){super(e);this._terminal=r,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,r,s){this._allRows=Array(e),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(e,r){this._nullCellCount>0&&!ue(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let s="";if(!r){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let c=this._buffer.getLine(e),f=this._buffer.getLine(e+1);if(!f.isWrapped)s=`\r
|
|
31
|
+
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{s="";let a=c.getCell(c.length-1,this._thisRowLastChar),y=c.getCell(c.length-2,this._thisRowLastSecondChar),t=f.getCell(0,this._nextRowFirstChar),n=t.getWidth()>1,l=!1;(t.getChars()&&n?this._nullCellCount<=1:this._nullCellCount<=0)&&((a.getChars()||a.getWidth()===0)&&ue(a,t)&&(l=!0),n&&(y.getChars()||y.getWidth()===0)&&ue(a,t)&&ue(y,t)&&(l=!0)),l||(s="-".repeat(this._nullCellCount+1),s+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(s+="\x1B[A",s+=`\x1B[${c.length-this._nullCellCount}C`,s+=`\x1B[${this._nullCellCount}X`,s+=`\x1B[${c.length-this._nullCellCount}D`,s+="\x1B[B"),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=s,this._currentRow="",this._nullCellCount=0}_diffStyle(e,r){let s=[],c=!kr(e,r),f=!ue(e,r),a=!Lr(e,r);if(c||f||a)if(e.isAttributeDefault())r.isAttributeDefault()||s.push(0);else{if(c){let y=e.getFgColor();e.isFgRGB()?s.push(38,2,y>>>16&255,y>>>8&255,y&255):e.isFgPalette()?y>=16?s.push(38,5,y):s.push(y&8?90+(y&7):30+(y&7)):s.push(39)}if(f){let y=e.getBgColor();e.isBgRGB()?s.push(48,2,y>>>16&255,y>>>8&255,y&255):e.isBgPalette()?y>=16?s.push(48,5,y):s.push(y&8?100+(y&7):40+(y&7)):s.push(49)}a&&(e.isInverse()!==r.isInverse()&&s.push(e.isInverse()?7:27),e.isBold()!==r.isBold()&&s.push(e.isBold()?1:22),e.isUnderline()!==r.isUnderline()&&s.push(e.isUnderline()?4:24),e.isOverline()!==r.isOverline()&&s.push(e.isOverline()?53:55),e.isBlink()!==r.isBlink()&&s.push(e.isBlink()?5:25),e.isInvisible()!==r.isInvisible()&&s.push(e.isInvisible()?8:28),e.isItalic()!==r.isItalic()&&s.push(e.isItalic()?3:23),e.isDim()!==r.isDim()&&s.push(e.isDim()?2:22),e.isStrikethrough()!==r.isStrikethrough()&&s.push(e.isStrikethrough()?9:29))}return s}_nextCell(e,r,s,c){if(e.getWidth()===0)return;let f=e.getChars()==="",a=this._diffStyle(e,this._cursorStyle);if(f?!ue(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(ue(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=s,this._lastContentCursorCol=this._lastCursorCol=c,this._currentRow+=`\x1B[${a.join(";")}m`;let y=this._buffer.getLine(s);y!==void 0&&(y.getCell(c,this._cursorStyle),this._cursorStyleRow=s,this._cursorStyleCol=c)}f?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(ue(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=s,this._lastContentCursorCol=this._lastCursorCol=c+e.getWidth())}_serializeString(e){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let s="";for(let a=0;a<r;a++)s+=this._allRows[a],a+1<r&&(s+=this._allRowSeparators[a]);if(!e){let a=this._buffer.baseY+this._buffer.cursorY,y=this._buffer.cursorX,t=a!==this._lastCursorRow||y!==this._lastCursorCol,n=(l)=>{l>0?s+=`\x1B[${l}C`:l<0&&(s+=`\x1B[${-l}D`)};t&&(((l)=>{l>0?s+=`\x1B[${l}B`:l<0&&(s+=`\x1B[${-l}A`)})(a-this._lastCursorRow),n(y-this._lastCursorCol))}let c=this._terminal._core._inputHandler._curAttrData,f=this._diffStyle(c,this._cursorStyle);return f.length>0&&(s+=`\x1B[${f.join(";")}m`),s}},Tr=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,r,s){let c=r.length,f=s===void 0?c:Er(s+e.rows,0,c);return this._serializeBufferByRange(e,r,{start:c-f,end:c-1},!1)}_serializeBufferByRange(e,r,s,c){return new Ys(r,e).serialize({start:{x:0,y:typeof s.start=="number"?s.start:s.start.line},end:{x:e.cols,y:typeof s.end=="number"?s.end:s.end.line}},c)}_serializeBufferAsHTML(e,r){let s=e.buffer.active,c=new Js(s,e,r),f=r.onlySelection??!1,a=r.range;if(a)return c.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!f){let t=s.length,n=r.scrollback,l=n===void 0?t:Er(n+e.rows,0,t);return c.serialize({start:{x:0,y:t-l},end:{x:e.cols,y:t-1}})}let y=this._terminal?.getSelectionPosition();return y!==void 0?c.serialize({start:{x:y.start.x,y:y.start.y},end:{x:y.end.x,y:y.end.y}}):""}_serializeModes(e){let r="",s=e.modes;if(s.applicationCursorKeysMode&&(r+="\x1B[?1h"),s.applicationKeypadMode&&(r+="\x1B[?66h"),s.bracketedPasteMode&&(r+="\x1B[?2004h"),s.insertMode&&(r+="\x1B[4h"),s.originMode&&(r+="\x1B[?6h"),s.reverseWraparoundMode&&(r+="\x1B[?45h"),s.sendFocusMode&&(r+="\x1B[?1004h"),s.wraparoundMode===!1&&(r+="\x1B[?7l"),s.mouseTrackingMode!=="none")switch(s.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return r}serialize(e){if(!this._terminal)throw Error("Cannot use addon until it has been loaded");let r=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let s=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${s}`}return e?.excludeModes||(r+=this._serializeModes(this._terminal)),r}serializeAsHTML(e){if(!this._terminal)throw Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},Js=class extends Ar{constructor(e,r,s){super(e);this._terminal=r,this._options=s,this._currentRow="",this._htmlContent="",r._core._themeService?this._ansiColors=r._core._themeService.colors.ansi:this._ansiColors=Qs}_padStart(e,r,s){return r=r>>0,s=s??" ",e.length>r?e:(r-=e.length,r>s.length&&(s+=s.repeat(r/s.length)),s.slice(0,r)+e)}_beforeSerialize(e,r,s){this._htmlContent+="<html><body><!--StartFragment--><pre>";let c="#000000",f="#ffffff";(this._options.includeGlobalBackground??!1)&&(c=this._terminal.options.theme?.foreground??"#ffffff",f=this._terminal.options.theme?.background??"#000000");let a=[];a.push("color: "+c+";"),a.push("background-color: "+f+";"),a.push("font-family: "+this._terminal.options.fontFamily+";"),a.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+a.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(e,r){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(e,r){let s=r?e.getFgColor():e.getBgColor();if(r?e.isFgRGB():e.isBgRGB())return"#"+[s>>16&255,s>>8&255,s&255].map((c)=>this._padStart(c.toString(16),2,"0")).join("");if(r?e.isFgPalette():e.isBgPalette())return this._ansiColors[s].css}_diffStyle(e,r){let s=[],c=!kr(e,r),f=!ue(e,r),a=!Lr(e,r);if(c||f||a){let y=this._getHexColor(e,!0);y&&s.push("color: "+y+";");let t=this._getHexColor(e,!1);return t&&s.push("background-color: "+t+";"),e.isInverse()&&s.push("color: #000000; background-color: #BFBFBF;"),e.isBold()&&s.push("font-weight: bold;"),e.isUnderline()&&e.isOverline()?s.push("text-decoration: overline underline;"):e.isUnderline()?s.push("text-decoration: underline;"):e.isOverline()&&s.push("text-decoration: overline;"),e.isBlink()&&s.push("text-decoration: blink;"),e.isInvisible()&&s.push("visibility: hidden;"),e.isItalic()&&s.push("font-style: italic;"),e.isDim()&&s.push("opacity: 0.5;"),e.isStrikethrough()&&s.push("text-decoration: line-through;"),s}}_nextCell(e,r,s,c){if(e.getWidth()===0)return;let f=e.getChars()==="",a=this._diffStyle(e,r);a&&(this._currentRow+=a.length===0?"</span><span>":"</span><span style='"+a.join(" ")+"'>"),f?this._currentRow+=" ":this._currentRow+=Ks(e.getChars())}_serializeString(){return this._htmlContent}};var Ir=Rs(Br(),1);var Zs=/\x1b\[M[\s\S]{3}|\x1b\[[0-?]*[ -\/]*[@-~]|\x1bO[\s\S]|\x1b[\]P_^X][\s\S]*?(?:\x07|\x1b\\)/g;function ei(e){return/[\r\x20-\x7e\u00a0-\uffff]/.test(e.replace(Zs,""))}class St{onChange;status="idle";lastInput=0;burstStart;idleTimer;disposed=!1;constructor(e){this.onChange=e}input(e){if(!ei(e))return;this.lastInput=Date.now()}output(){let e=Date.now();if(this.disposed||e-this.lastInput<200)return;if(this.burstStart===void 0&&e-this.lastInput>2000)return;if(this.burstStart??=e,clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>this.settle(),2000),this.status==="idle"&&e-this.burstStart>=1000)this.set("working")}reset(){clearTimeout(this.idleTimer),this.lastInput=0,this.burstStart=void 0,this.status="idle"}dispose(){this.disposed=!0,clearTimeout(this.idleTimer)}settle(){this.burstStart=void 0,this.set("idle")}set(e){if(this.status===e)return;this.status=e,this.onChange(e)}}async function Ge(e,r){let s=Bun.spawn(e,{stdout:"pipe",stderr:"ignore"}),c,f=new Promise((a,y)=>{c=setTimeout(()=>{s.kill(),y(Error(`${e[0]} timed out`))},r)});try{let a=Promise.all([new Response(s.stdout).text(),s.exited]).then(([y])=>y);return await Promise.race([a,f])}finally{clearTimeout(c)}}var ti=new Set(["claude","codex","gemini","opencode","aider","cursor-agent","copilot","qwen","amp"]),ri=/^(node|nodejs|bun|deno|python[\d.]*)$/,Dr=(e)=>e.slice(e.lastIndexOf("/")+1).replace(/\.(js|mjs|cjs|ts|py)$/,"");function wt(e){let r=e.trim().split(/\s+/),s=Dr(r[0]??"");if(ri.test(s)){let c=r.slice(1).find((f)=>!f.startsWith("-"));s=c?Dr(c):""}return ti.has(s)}var si=2000;function Mr(e){return Ge(["ps",...e],si)}async function qe(e,r){try{if(r??=(await Mr(["-o","tty=","-p",String(e)])).trim(),!r||r.startsWith("?"))return;let s=(await Mr(["-ww","-o","pgid=,tpgid=,args=","-t",r])).split(`
|
|
32
|
+
`).map((a)=>a.trim().match(/^(\d+)\s+(-?\d+)\s+(.*)$/)).filter((a)=>a!==null).map(([,a,y,t])=>({pgid:Number(a),tpgid:Number(y),args:t})),c=s[0]?.tpgid;if(c===void 0||c<=0)return;let f=s.some((a)=>a.pgid===c&&wt(a.args));return{tty:r,foreground:{pgid:c,agent:f}}}catch{return}}class Ct{terminal;trimmed;integrated=!1;last;running;constructor(e,r){this.terminal=e;this.trimmed=r;e.parser.registerOscHandler(133,(s)=>{if(this.integrated=!0,e.buffer.active.type!=="normal")return!1;let c=s.split(";")[0];if(c==="C")this.running?.marker.dispose(),this.running=this.here();else if((c==="D"||c==="A")&&this.running){let f=this.here();if(f)this.setLast({start:this.running,end:f});else this.running.marker.dispose();this.running=void 0}return!1}),e.parser.registerEscHandler({final:"c"},()=>(this.setLast(void 0),this.running?.marker.dispose(),this.running=void 0,!1))}lastOutput(){let e=this.unavailable(),r=this.last;if(e||!r)return{unavailable:e??"no-command"};let s=r.start.marker.isDisposed?{x:0,y:0}:{x:r.start.x,y:r.start.marker.line},c={x:r.end.x,y:r.end.marker.line},f=this.terminal.buffer.normal,a="";for(let t=s.y;t<=c.y;t++){let n=t===s.y?s.x:0;if(t===c.y&&c.x===0&&t>s.y)break;let l=f.getLine(t);if(!l)break;if(t>s.y&&!l.isWrapped)a+=`
|
|
33
|
+
`;a+=l.translateToString(!0,n,t===c.y?c.x:void 0)}a=a.replace(/\n+$/,"");let y=a===""?0:a.split(`
|
|
34
|
+
`).length;return{text:a,lines:y,start:s,end:c}}unavailable(){if(!this.integrated)return"no-integration";if(this.terminal.buffer.active.type!=="normal")return"alternate";if(!this.last||this.last.end.marker.isDisposed)return"no-command";return}state(){let e=this.trimmed.count,r=(f)=>f&&!f.marker.isDisposed?{x:f.x,y:f.marker.line+e}:void 0,s=r(this.last?.end),c=this.last?.start.marker.isDisposed?{x:0,y:e}:r(this.last?.start);return{integrated:this.integrated,last:c&&s?{start:c,end:s}:void 0,running:r(this.running)}}restore(e){if(this.integrated||=e.integrated,this.terminal.buffer.active.type!=="normal")return;if(!this.last&&e.last){let r=this.place(e.last.start),s=this.place(e.last.end);if(r&&s)this.setLast({start:r,end:s});else r?.marker.dispose(),s?.marker.dispose()}if(!this.running&&e.running)this.running=this.place(e.running)}setLast(e){this.last?.start.marker.dispose(),this.last?.end.marker.dispose(),this.last=e}here(){let e=this.terminal.registerMarker(0);return e&&{x:this.terminal.buffer.active.cursorX,marker:e}}place({x:e,y:r}){if(r<this.trimmed.count)return;let s=this.terminal.buffer.active,c=this.terminal.registerMarker(r-this.trimmed.count-(s.baseY+s.cursorY));return c&&{x:e,marker:c}}}import{readlink as ii,stat as ni}from"fs/promises";var oi=2000;async function xt(e){try{let r=process.platform==="linux"?await ii(`/proc/${e}/cwd`):await ai(e);return r&&(await ni(r)).isDirectory()?r:void 0}catch{return}}async function ai(e){return(await Ge(["lsof","-a","-p",String(e),"-d","cwd","-Fn"],oi)).split(`
|
|
35
|
+
`).find((s)=>s.startsWith("n"))?.slice(1)}var Xe=1000;class Et{count;constructor(e,r=0){this.count=r;let s=e._core._bufferService.buffers,c,f,a=()=>{if(s.normal===c)return;f?.dispose(),c=s.normal,f=c.lines.onTrim((y)=>this.count+=y)};a(),s.onBufferActivate(a)}}var Ce={cols:512,rows:256};function ye({cols:e,rows:r}){return{cols:Math.min(e,Ce.cols),rows:Math.min(r,Ce.rows)}}var Pr=new TextEncoder,ci="\u2500\u2500 Accompany \u3092\u518D\u8D77\u52D5\u3057\u307E\u3057\u305F \u2500\u2500",hi=2000,li=500,ui=1500,fi=200,di=1000,pi=500;function _i(e){try{return process.kill(-e,0),!0}catch(r){return r.code==="EPERM"}}class At{command;onExit;onTitleChange;proc;listeners=new Set;size={cols:80,rows:24};requestedSizes=new Map;screen=new Ir.Terminal({...this.size,scrollback:Xe,allowProposedApi:!0});serializer=new Tr;trimmed=new Et(this.screen);marks=new Ct(this.screen,this.trimmed);cursorHidden=!1;mouseEncoding;title="";activity;onOutput;onStatus;foreground;tty;detectTimer;detecting=!1;detectAgain=!1;killed=!1;startTimer;hangingUp;unseen=!1;startDir;lastCwd;cwdCheckedAt=Number.NEGATIVE_INFINITY;cwdPgid;lastInputAt=Number.NEGATIVE_INFINITY;startedAsAgent;constructor(e,r=()=>{},s=()=>{},c=()=>{},{restored:f,onOutput:a=()=>{},cwd:y}={}){this.command=e;this.onExit=r;this.onTitleChange=s;if(this.startDir=y,this.startedAsAgent=wt(e.join(" ")),this.lastCwd=y,this.onOutput=a,this.onStatus=c,this.activity=new St((t)=>{if(this.unseen=t==="idle",this.foreground?.agent)c()}),this.screen.loadAddon(this.serializer),f)this.size={cols:f.cols,rows:f.rows},this.screen.resize(f.cols,f.rows),this.screen.write(`${f.scrollback}\x1B[0m\r
|
|
36
|
+
\x1B[2m${ci}\x1B[0m\r
|
|
37
|
+
`);this.screen.onTitleChange((t)=>{let n=gi(t);if(n===this.title)return;this.title=n,this.onTitleChange()});for(let[t,n]of[["h",!0],["l",!1]])this.screen.parser.registerCsiHandler({prefix:"?",final:t},(l)=>{if(l.includes(25))this.cursorHidden=!n;for(let p of[1006,1016])if(l.includes(p))this.mouseEncoding=n?p:void 0;return!1});this.screen.parser.registerEscHandler({final:"c"},()=>{if(this.cursorHidden=!1,this.mouseEncoding=void 0,this.title!=="")this.title="",this.onTitleChange();return!1})}attach(e){let r=[],s=!1,c=(f)=>s?e(f):r.push(f);if(this.listeners.add(c),this.screen.write("",()=>{e({type:"resize",size:this.size}),e({type:"trimmed",lines:this.trimmed.count}),e({type:"marks",...this.marks.state()});let f=this.serializer.serialize()+(this.cursorHidden?"\x1B[?25l":"")+(this.mouseEncoding?`\x1B[?${this.mouseEncoding}h`:"");if(f)e({type:"output",data:Pr.encode(f)});e({type:"restored"}),r.forEach(e),s=!0}),!this.proc&&!this.startTimer)this.startTimer=setTimeout(()=>this.start(),hi);return{resize:(f)=>{this.requestedSizes.set(c,f),this.fitToSmallest(),this.start()},detach:()=>{this.listeners.delete(c),this.requestedSizes.delete(c),this.fitToSmallest()}}}start(){if(clearTimeout(this.startTimer),this.proc||this.killed)return;this.proc=this.spawn((e)=>Bun.spawn(this.command,{cwd:e,terminal:{...this.size,data:(r,s)=>{this.screen.write(s),this.activity.output(),this.scheduleDetect(),this.broadcast({type:"output",data:s}),this.onOutput()}}})),this.proc.exited.then(()=>this.onExit())}spawn(e){if(this.startDir)try{return e(this.startDir)}catch{}return e()}async cwd(){let e=this.proc?.pid;if(e===void 0)return this.startDir;let r=await qe(e,this.tty);return(r&&await xt(r.foreground.pgid))??await xt(e)}async savedCwd({refresh:e=!1}={}){if(this.proc===void 0)return this.lastCwd;if(!e){let s=this.lastInputAt>=this.cwdCheckedAt-fi,c=this.foreground?.agent===!0&&this.foreground.pgid===this.cwdPgid;if(!s||c)return this.lastCwd}this.cwdCheckedAt=performance.now(),this.cwdPgid=this.foreground?.pgid;let r=await Promise.race([this.cwd(),Bun.sleep(ui).then(()=>{return})]);if(r)this.lastCwd=r;return this.lastCwd}write(e){this.lastInputAt=performance.now(),this.activity.input(e),this.scheduleDetect(),this.proc?.terminal?.write(e)}reset(){let e=Pr.encode("\x1Bc");this.screen.write(e),this.broadcast({type:"output",data:e})}snapshot(){return new Promise((e)=>this.screen.write("",()=>e({...this.size,scrollback:this.serializer.serialize({excludeAltBuffer:!0,excludeModes:!0})})))}get status(){if(!this.foreground?.agent)return;return this.activity.status==="idle"&&this.unseen?"done":this.activity.status}markSeen(){let e=this.status==="done";return this.unseen=!1,e}kill(){if(this.hangingUp)return this.hangingUp;this.killed=!0,clearTimeout(this.startTimer),clearTimeout(this.detectTimer),this.activity.dispose();let e=this.proc;if(!e||e.exitCode!==null||e.signalCode!==null)return this.hangingUp=Promise.resolve();let r=Bun.sleep(di);return this.hangingUp=(async()=>{let s=await Promise.race([qe(e.pid,this.tty),Bun.sleep(pi)]);if(e.exitCode!==null||e.signalCode!==null)return;let c=[...new Set([e.pid,s?.foreground.pgid])].filter((t)=>t!==void 0&&t>1);for(let t of c)try{process.kill(-t,"SIGHUP")}catch{}let f=c.filter((t)=>t!==e.pid),a=!1,y=(async()=>{await e.exited;while(!a&&f.some(_i))await Bun.sleep(20)})();await Promise.race([y,r]),a=!0})(),this.hangingUp}scheduleDetect(){if(this.detecting){this.detectAgain=!0;return}if(this.detectTimer||this.killed)return;this.detectTimer=setTimeout(()=>{this.detectTimer=void 0,this.detect()},li)}async detect(){let e=this.proc?.pid;if(e===void 0)return;this.detecting=!0,this.detectAgain=!1;let r;try{r=await qe(e,this.tty)}finally{if(this.detecting=!1,this.detectAgain)this.scheduleDetect()}if(this.killed||!r)return;this.tty=r.tty;let s=this.foreground,c=r.foreground;if(this.foreground=c,!c.agent){if(this.unseen=!1,s?.agent)this.onStatus();return}if(!s?.agent||s.pgid!==c.pgid){if(!this.startedAsAgent||c.pgid!==e)this.activity.reset(),this.unseen=!1;this.onStatus()}}fitToSmallest(){let e=[...this.requestedSizes.values()];if(e.length===0)return;let r=(c)=>{let f=e.map((t)=>t.fits[c]),a=e.flatMap((t)=>t.min?[t.min[c]]:[]),y=a.length>0?Math.min(...a):0;return Math.min(Math.max(...f),Math.max(Math.min(...f),y))},s=ye({cols:r("cols"),rows:r("rows")});if(s.cols===this.size.cols&&s.rows===this.size.rows)return;this.size=s,this.screen.resize(s.cols,s.rows),this.proc?.terminal?.resize(s.cols,s.rows),this.broadcast({type:"resize",size:s})}broadcast(e){this.listeners.forEach((r)=>r(e))}}var Or=256;function gi(e){let r=[...kt(e)];return r.length>Or?`${r.slice(0,Or-1).join("")}\u2026`:r.join("")}function kt(e){return e.replace(/[\u2028\u2029\u0085]/g," ").replace(/[\p{Cc}\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/gu,"")}var Hr=32,mi=Hr*32,vi=new Intl.Segmenter(void 0,{granularity:"grapheme"}),yi=/[\p{Default_Ignorable_Code_Point}\s\u2800]/gu;function ge(e){let r=kt(e.slice(0,mi).replace(/[\t\n\v\f\r]/g," ")).replace(/\p{Cs}/gu,"").replace(/\s+/g," ").trim(),s=[...vi.segment(r)].slice(0,Hr).map((c)=>c.segment).join("").trim();return s.replace(yi,"")?s:void 0}function xe(e){return e.normalize("NFKC").replace(/[\p{Default_Ignorable_Code_Point}\p{M}]/gu,"")}var Nr={width:480,height:1080},Ee={width:1920,height:1080};function Ae(e){if(typeof e!=="object"||e===null)return;let{width:r,height:s}=e,c=(f,a)=>Number.isSafeInteger(f)&&f>=0&&f<=a;return c(r,Ee.width)&&c(s,Ee.height)?{width:r,height:s}:void 0}function Fr(e){let r=/^(\d+)x(\d+)$/.exec(e);return r?Ae({width:Number(r[1]),height:Number(r[2])}):void 0}var Ur=100;function Wr(e){return e.replace(/[^\P{Cc}\n\t]|\p{Cf}/gu,"")}function Lt(e,r){return[...e].slice(0,r).join("")}function Ve(e){if(typeof e.content!=="string"||typeof e.name!=="string")return;let r=Lt(Wr(e.content.replace(/\r\n?|[\u2028\u2029\u0085]/g,`
|
|
38
|
+
`)),1e4).replace(/\n+$/,"");if(r.trim()==="")return;return{name:Lt(Wr(e.name.replace(/[\r\n\t\u2028\u2029\u0085]/g," ")).trim(),100)||Lt(r.trim().split(`
|
|
39
|
+
`)[0],100),content:r,run:e.run===!0}}import{lstatSync as bi,mkdirSync as Si,mkdtempSync as wi,rmSync as Ci,writeFileSync as xi}from"fs";import{tmpdir as Ei}from"os";import{join as Tt}from"path";var jr=104857600;class Rt{root=$r();nextId=1;async save(e){let r=await Promise.all(e.map(async(f)=>new Uint8Array(await f.arrayBuffer()))),s=Tt(this.currentRoot(),String(this.nextId++));Si(s,{mode:448});let c=new Set;return e.map((f,a)=>{let y=zr(f.name);for(let n=2;c.has(y);n++)y=`${n}-${zr(f.name)}`;c.add(y);let t=Tt(s,y);return xi(t,r[a],{flag:"wx",mode:384}),t})}remove(){Ci(this.root,{recursive:!0,force:!0})}currentRoot(){if(!Ai(this.root))this.root=$r();return this.root}}function $r(){return wi(Tt(Ei(),"accompany-"))}function Ai(e){try{let r=bi(e);return r.isDirectory()&&r.uid===process.getuid?.()&&(r.mode&63)===0}catch{return!1}}function zr(e){let r=e.split(/[\\/]/).pop()??"";return Array.from(r.replace(/[\x00-\x1f\x7f]/g,"")).slice(-60).join("").replace(/^[.\s-]+/,"")||"file"}var ki=new Set(["localhost","127.0.0.1","[::1]"]),Gr=xr(async(e,r)=>{let s=e.req.header("Host")??"",c=e.req.header("Origin"),f=URL.parse(`http://${s}`)?.hostname??"";if(!ki.has(f)||c!==`http://${s}`)return e.text("Forbidden",403);await r()});function Li(e){let{cols:r,rows:s,minCols:c,minRows:f}=e,a=(t,n)=>Number.isSafeInteger(t)&&t>=n;if(!a(r,1)||!a(s,1))return;let y=ye({cols:r,rows:s});if(c===void 0&&f===void 0)return{fits:y};if(!a(c,0)||!a(f,0))return;return{fits:y,min:ye({cols:c,rows:f})}}var Ti=Xe+Ce.rows;function Ri(e){let{start:r,end:s}=e;if(r===void 0&&s===void 0)return null;let c=(t,n)=>Number.isSafeInteger(t)&&t>=0&&t<=n,f=(t)=>{let{x:n,y:l}=t??{};return c(n,Ce.cols)&&c(l,Number.MAX_SAFE_INTEGER)?{x:n,y:l}:void 0},a=f(r),y=f(s);if(!a||!y||a.y>y.y||a.y===y.y&&a.x>y.x)return;if(y.y-a.y>=Ti)return;return{start:a,end:y}}var Bi=1024;function Bt(e,r){let s=typeof r==="string"?r.length:r.byteLength;e.send(r,{compress:s>=Bi})}function pe(e){if(typeof e.tab==="string")return[e.tab];let{tabs:r}=e;return Array.isArray(r)&&r.every((s)=>typeof s==="string")?r:void 0}var Di=new Set(["left","right","bottom"]);function qr(e){try{return JSON.parse(String(e))}catch{return}}function Xr(e,r){let s=new ze;return s.use("/ws/*",Gr),s.use("/api/*",Gr),s.get("/ws/workspace",Ne(()=>{let c;return{onOpen:(f,a)=>{c=e.join((y)=>Bt(a,JSON.stringify(y)))},onMessage:(f)=>{let a=qr(f.data),y=typeof a?.terminal==="string"?a.terminal:void 0;if(a?.type==="split"&&(a.direction==="row"||a.direction==="column"))c?.split(String(a.terminal),a.direction);else if(a?.type==="move-tab"&&pe(a)&&Number.isSafeInteger(a.index)&&(a.group===void 0||a.group===null||typeof a.group==="string"))e.moveTab(pe(a),a.index,a.group);else if(a?.type==="new-group"&&pe(a))e.newGroup(pe(a));else if(a?.type==="add-to-group"&&pe(a)&&typeof a.group==="string")e.addToGroup(pe(a),a.group);else if(a?.type==="remove-from-group"&&pe(a))e.removeFromGroup(pe(a));else if(a?.type==="move-group"&&typeof a.group==="string"&&Number.isSafeInteger(a.index))e.moveGroup(a.group,a.index);else if(a?.type==="rename-group"&&typeof a.group==="string"&&typeof a.name==="string")e.renameGroup(a.group,ge(a.name));else if(a?.type==="recolor-group"&&typeof a.group==="string"&&typeof a.color==="string")e.recolorGroup(a.group,a.color);else if(a?.type==="ungroup"&&typeof a.group==="string")e.ungroup(a.group);else if(a?.type==="close-group"&&typeof a.group==="string")e.closeGroup(a.group);else if(a?.type==="rename-tab"&&typeof a.tab==="string"&&typeof a.name==="string")e.renameTab(a.tab,ge(a.name));else if(a?.type==="close")e.close(String(a.terminal));else if(a?.type==="resize-split"&&typeof a.ratio==="number")c?.resizeSplit(String(a.split),a.ratio);else if(a?.type==="swap-panes"&&typeof a.tab==="string"&&typeof a.with==="string")c?.swapPanes(a.tab,a.with);else if(a?.type==="flip-split"&&typeof a.split==="string")c?.flipSplit(a.split);else if(a?.type==="rotate-split"&&typeof a.split==="string")c?.rotateSplit(a.split);else if(a?.type==="new-tab")c?.newTab(y);else if(a?.type==="select-tab")c?.selectTab(String(a.tab));else if(a?.type==="add-to-view"&&(a.edge===void 0||Di.has(a.edge)))c?.addToView(String(a.tab),y,a.edge);else if(a?.type==="separate"&&typeof a.tab==="string")c?.separate(a.tab);else if(a?.type==="remove-from-view")c?.removeFromView(String(a.tab));else if(a?.type==="focus")c?.focus(String(a.terminal));else if(a?.type==="select"){let t=Ri(a);if(t!==void 0)c?.select(String(a.terminal),t??void 0)}else if(a?.type==="visibility")c?.visible(a.visible===!0);else if(a?.type==="name"&&typeof a.name==="string")c?.rename(ge(a.name));else if(a?.type==="follow")c?.follow(Number.isSafeInteger(a.member)?a.member:void 0);else if(a?.type==="scroll"&&Number.isSafeInteger(a.offset)&&a.offset>=0){let t=String(a.terminal);if(e.terminal(t))c?.scroll(t,a.offset)}else if(a?.type==="add-command"||a?.type==="update-command"){let t=Ve(a);if(!t)return;if(a.type==="add-command")e.addCommand(t);else e.updateCommand(String(a.id),t)}else if(a?.type==="remove-command")e.removeCommand(String(a.id));else if(a?.type==="set-min-window"){let t=Ae(a);if(t)e.setMinWindow(t)}},onClose:()=>c?.leave()}})),s.get("/ws/terminals/:id",async(c,f)=>e.terminal(c.req.param("id"))?f():c.text("Not Found",404),Ne((c)=>{let f=e.terminal(c.req.param("id")),a;return{onOpen:(y,t)=>{a=f.attach((n)=>n.type==="output"?Bt(t,n.data):Bt(t,JSON.stringify(n.type==="resize"?{type:"resize",...n.size}:n)))},onMessage:(y)=>{let t=qr(y.data);if(t?.type==="input"&&typeof t.data==="string")f.write(t.data);else if(t?.type==="reset")f.reset();else if(t?.type==="resize"){let n=Li(t);if(n)a?.resize(n)}},onClose:()=>a?.detach()}})),s.post("/api/uploads",Cr({maxSize:jr,onError:(c)=>c.text("Payload Too Large",413)}),async(c)=>{let a=(await c.req.formData().catch(()=>{return}))?.getAll("files").filter((y)=>y instanceof File)??[];if(a.length===0)return c.text("Bad Request",400);return c.json({paths:await r.save(a)})}),s}import{parseArgs as Jr}from"util";var Vr="0.27.0";import{basename as Pi}from"path";var Qe=["zsh","bash","fish"];function Qr(e){return Qe.includes(e)}function Kr(e=process.env.SHELL??""){return Pi(e)}var Oi={zsh:`# Accompany \u306E\u30B7\u30A7\u30EB\u306E\u7D71\u5408\uFF08OSC 133\uFF09\u3002~/.zshrc \u306B eval "$(accompany activate zsh)" \u3068\u66F8\u3044\u3066\u8AAD\u307F\u8FBC\u3080
|
|
40
40
|
autoload -Uz add-zsh-hook
|
|
41
41
|
_accompany_hook() {
|
|
42
42
|
local code=$?
|
|
@@ -94,7 +94,7 @@ end
|
|
|
94
94
|
function _accompany_hook --on-event fish_prompt --description 'Accompany: \u30D7\u30ED\u30F3\u30D7\u30C8\u306E\u59CB\u307E\u308A\uFF08OSC 133 A\uFF09'
|
|
95
95
|
printf '\\e]133;A\\a'
|
|
96
96
|
end
|
|
97
|
-
`};function
|
|
97
|
+
`};function Yr(e){return Oi[e]}var Ke=`\u30B7\u30A7\u30EB\u306E\u7D71\u5408\u306E\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u8868\u793A\u3059\u308B
|
|
98
98
|
|
|
99
99
|
\u8868\u793A\u3057\u305F\u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u3001\u30B7\u30A7\u30EB\u3067\u8A55\u4FA1\u3057\u3066\u4F7F\u3046\uFF08\u5B9F\u884C\u3059\u308B\u3060\u3051\u3067\u306F\u8868\u793A\u3059\u308B\u3060\u3051\uFF09\u3002
|
|
100
100
|
\u30B7\u30A7\u30EB\u306E\u7D71\u5408\u3092\u5165\u308C\u308B\u3068\u3001\u30B3\u30DE\u30F3\u30C9\u306E\u533A\u5207\u308A\uFF08OSC 133\uFF09\u304C\u5206\u304B\u308A\u3001\u30BF\u30FC\u30DF\u30CA\u30EB\u306E\u53F3\u4E0B\u306E\u300C\u30B3\u30D4\u30FC\u300D\u3084\u53F3\u30AF\u30EA\u30C3\u30AF\u306E\u30E1\u30CB\u30E5\u30FC\u3067\u3001
|
|
@@ -110,12 +110,12 @@ end
|
|
|
110
110
|
\u4F7F\u3044\u65B9: accompany activate [\u30B7\u30A7\u30EB]
|
|
111
111
|
|
|
112
112
|
\u5F15\u6570:
|
|
113
|
-
[\u30B7\u30A7\u30EB] \u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u51FA\u3059\u30B7\u30A7\u30EB\uFF08${
|
|
113
|
+
[\u30B7\u30A7\u30EB] \u30B9\u30AF\u30EA\u30D7\u30C8\u3092\u51FA\u3059\u30B7\u30A7\u30EB\uFF08${Qe.join("\u30FB")}\uFF09\u3002\u7701\u304F\u3068 $SHELL \u304B\u3089\u6C7A\u3081\u308B
|
|
114
114
|
|
|
115
115
|
\u30AA\u30D7\u30B7\u30E7\u30F3:
|
|
116
116
|
-h, --help \u3053\u306E\u4F7F\u3044\u65B9\u3092\u8868\u793A\u3059\u308B
|
|
117
117
|
|
|
118
|
-
activate \u3068\u3044\u3046\u540D\u524D\u306E\u30B3\u30DE\u30F3\u30C9\u3092\u6700\u521D\u306E\u30BF\u30FC\u30DF\u30CA\u30EB\u3067\u52D5\u304B\u3059\u3068\u304D\u306F\u3001accompany -- activate \u3068\u66F8\u304F`;var
|
|
118
|
+
activate \u3068\u3044\u3046\u540D\u524D\u306E\u30B3\u30DE\u30F3\u30C9\u3092\u6700\u521D\u306E\u30BF\u30FC\u30DF\u30CA\u30EB\u3067\u52D5\u304B\u3059\u3068\u304D\u306F\u3001accompany -- activate \u3068\u66F8\u304F`;var Dt=`\u4F7F\u3044\u65B9: accompany [\u30AA\u30D7\u30B7\u30E7\u30F3] [-- <\u30B3\u30DE\u30F3\u30C9...>]
|
|
119
119
|
|
|
120
120
|
\u30D6\u30E9\u30A6\u30B6\u3067\u958B\u304F\u30BF\u30FC\u30DF\u30CA\u30EB\u3092\u3001\u30DA\u30A2\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u306E\u76F8\u624B\u3068\u5171\u6709\u3059\u308B\u3002
|
|
121
121
|
-- \u306E\u3042\u3068\u306B\u66F8\u3044\u305F\u30B3\u30DE\u30F3\u30C9\u3092\u6700\u521D\u306E\u30BF\u30FC\u30DF\u30CA\u30EB\u3067\u52D5\u304B\u3059\uFF08\u7701\u7565\u3059\u308B\u3068 $SHELL\uFF09
|
|
@@ -130,15 +130,15 @@ activate \u3068\u3044\u3046\u540D\u524D\u306E\u30B3\u30DE\u30F3\u30C9\u3092\u670
|
|
|
130
130
|
--min-window <\u5E45>x<\u9AD8\u3055> \u7AEF\u672B\u306E\u5927\u304D\u3055\u306E\u4E0B\u9650\u3092\u3001\u30A6\u30A3\u30F3\u30C9\u30A6\u306E\u5927\u304D\u3055\uFF08\u30D4\u30AF\u30BB\u30EB\uFF09\u3067\u6307\u5B9A\u3059\u308B\uFF08\u4F8B: 480x1080\u3002\u4FDD\u5B58\u306F\u3057\u306A\u3044\uFF09
|
|
131
131
|
--allow-vscode-webview VS Code \u306E\u62E1\u5F35\u306E\u30D1\u30CD\u30EB\uFF08webview\uFF09\u306E\u4E2D\u306B\u57CB\u3081\u8FBC\u3080\u3053\u3068\u3092\u8A31\u3059\uFF08\u62E1\u5F35\u304C\u8D77\u52D5\u3059\u308B\u3068\u304D\u306B\u4ED8\u3051\u308B\uFF09
|
|
132
132
|
-v, --version \u7248\u3092\u8868\u793A\u3059\u308B
|
|
133
|
-
-h, --help \u3053\u306E\u4F7F\u3044\u65B9\u3092\u8868\u793A\u3059\u308B`;function
|
|
133
|
+
-h, --help \u3053\u306E\u4F7F\u3044\u65B9\u3092\u8868\u793A\u3059\u308B`;function Zr(e=process.argv.slice(2)){if(e[0]==="activate")Ii(e.slice(1));let r;try{r=Jr({args:e,options:{port:{type:"string",default:"3000"},fresh:{type:"boolean",default:!1},"min-window":{type:"string"},"allow-vscode-webview":{type:"boolean",default:!1},version:{type:"boolean",short:"v",default:!1},help:{type:"boolean",short:"h",default:!1}},allowPositionals:!0})}catch(c){console.error(`Accompany: ${es(c)}
|
|
134
134
|
|
|
135
|
-
${
|
|
135
|
+
${Dt}`),process.exit(1)}if(r.values.help)console.log(Dt),process.exit(0);if(r.values.version)console.log(`accompany ${Vr}`),process.exit(0);let s=r.values.port;if(!/^\d+$/.test(s)||Number(s)>ke)console.error(`Accompany: --port \u306F 0\u301C${ke} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${s}
|
|
136
136
|
|
|
137
|
-
${
|
|
137
|
+
${Dt}`),process.exit(1);return r}var ke=65535;function Ii(e){let r;try{r=Jr({args:e,options:{help:{type:"boolean",short:"h",default:!1}},allowPositionals:!0})}catch(f){console.error(`Accompany: ${es(f)}
|
|
138
138
|
|
|
139
|
-
${
|
|
139
|
+
${Ke}`),process.exit(1)}if(r.values.help)console.log(Ke),process.exit(0);if(r.positionals.length>1)console.error(`Accompany: activate \u306B\u6E21\u305B\u308B\u30B7\u30A7\u30EB\u306F 1 \u3064\u3067\u3059: ${r.positionals.join(" ")}
|
|
140
140
|
|
|
141
|
-
${Xe}`),process.exit(1);let s=r.positionals[0],h=s??Xr();if(!qr(h)){let g=`\u5BFE\u5FDC\u3057\u3066\u3044\u308B\u30B7\u30A7\u30EB: ${qe.join("\u30FB")}`;console.error(s===void 0?`Accompany: $SHELL\uFF08${process.env.SHELL??"\u672A\u8A2D\u5B9A"}\uFF09\u306E\u30B7\u30A7\u30EB\u306B\u306F\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002accompany activate zsh \u306E\u3088\u3046\u306B\u30B7\u30A7\u30EB\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${g}\uFF09`:`Accompany: \u77E5\u3089\u306A\u3044\u30B7\u30A7\u30EB\u3067\u3059: ${h}\uFF08${g}\uFF09`),process.exit(1)}process.stdout.write(Vr(h)),process.exit(0)}function Yr(e){let r=e instanceof Error?e.message:String(e),s=e?.code;if(s==="ERR_PARSE_ARGS_UNKNOWN_OPTION"){let h=r.match(/Unknown option '([^']+)'/)?.[1];if(h)return`\u77E5\u3089\u306A\u3044\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3059: ${h}`}if(s==="ERR_PARSE_ARGS_INVALID_OPTION_VALUE"){let h=r.match(/Option '(-[^\s']+)/)?.[1];if(h&&/argument missing|argument is ambiguous/.test(r))return`${h} \u306B\u306F\u5024\u304C\u8981\u308A\u307E\u3059`;if(h&&/does not take an argument/.test(r))return`${h} \u306F\u5024\u3092\u53D6\u308A\u307E\u305B\u3093`}return r}var Jr=zt("{\"index\":\"public/index.html\",\"files\":[{\"input\":\"public/index.html\",\"path\":\"./index-4ypqm7p0.js\",\"loader\":\"js\",\"isEntry\":true,\"headers\":{\"etag\":\"RN4Wt3SnNoA\",\"content-type\":\"text/javascript;charset=utf-8\"}},{\"input\":\"public/index.html\",\"path\":\"public/index.html\",\"loader\":\"html\",\"isEntry\":true,\"headers\":{\"etag\":\"GRvitHl9Z5I\",\"content-type\":\"text/html;charset=utf-8\"}},{\"input\":\"public/index.html\",\"path\":\"./index-9f2snsnm.css\",\"loader\":\"css\",\"isEntry\":true,\"headers\":{\"etag\":\"CW-i2RWZ9dQ\",\"content-type\":\"text/css;charset=utf-8\"}},{\"input\":\"public/favicon.png\",\"path\":\"./favicon-0wwf4h3c.png\",\"loader\":\"file\",\"isEntry\":false,\"headers\":{\"etag\":\"YHwcDyQxo4w\",\"content-type\":\"image/png\"}},{\"input\":\"public/apple-touch-icon.png\",\"path\":\"./apple-touch-icon-ehhpc4a9.png\",\"loader\":\"file\",\"isEntry\":false,\"headers\":{\"etag\":\"LjHRtszkCok\",\"content-type\":\"image/png\"}}]}");import{createHash as Bi}from"crypto";import{chmodSync as Di,mkdirSync as Mi,readFileSync as Pi,renameSync as Oi,rmSync as Zr,writeFileSync as Ii}from"fs";import{homedir as Hi}from"os";import{dirname as Ni,isAbsolute as ts,join as Bt}from"path";var Ae=["blue","red","yellow","green","pink","purple","cyan","grey"];function Ve(e){return typeof e==="string"&&Ae.includes(e)}var es=448,Fi=384;function rs(e=process.env){if(e.ACCOMPANY_STATE_DIR)return e.ACCOMPANY_STATE_DIR;let r=e.XDG_STATE_HOME&&ts(e.XDG_STATE_HOME)?e.XDG_STATE_HOME:Bt(Hi(),".local","state");return Bt(r,"accompany")}class Dt{dir;file;constructor(e,r){this.dir=e;let s=Bi("sha256").update(r).digest("hex").slice(0,16);this.file=Bt(e,"sessions",`${s}.json`)}load(){let e;try{e=Pi(this.file,"utf8")}catch(r){if(r.code!=="ENOENT")console.warn(`Accompany: \u4FDD\u5B58\u3057\u305F\u753B\u9762\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F: ${r}`);return}try{let r=Wi(JSON.parse(e));if(!r)console.warn(`Accompany: \u4FDD\u5B58\u3057\u305F\u753B\u9762\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u306A\u3044\u305F\u3081\u3001\u65B0\u3057\u304F\u59CB\u3081\u307E\u3059: ${this.file}`);return r}catch(r){console.warn(`Accompany: \u4FDD\u5B58\u3057\u305F\u753B\u9762\u3092\u8AAD\u3081\u306A\u3044\u305F\u3081\u3001\u65B0\u3057\u304F\u59CB\u3081\u307E\u3059: ${r}`)}}save(e){let r=Ni(this.file);for(let h of[this.dir,r])Mi(h,{recursive:!0,mode:es}),Di(h,es);let s=`${this.file}.${process.pid}.tmp`;Zr(s,{force:!0});try{Ii(s,JSON.stringify(e),{mode:Fi,flag:"wx"}),Oi(s,this.file)}catch(h){throw Zr(s,{force:!0}),h}}}function Wi(e){if(!ie(e)||!Array.isArray(e.tabs)||e.tabs.length===0)return;let r=e.version===2?$i(e.tabs):e.version===1?ji(e.tabs):void 0;if(!r)return;let s=ie(e.terminals)?e.terminals:{},h={};for(let f of r){let p=s[f];h[f]={...ie(p)&&Gi(p)?me({cols:p.cols,rows:p.rows}):{cols:80,rows:24},scrollback:ie(p)&&typeof p.scrollback==="string"?p.scrollback:"",initial:ie(p)&&p.initial===!0,...ie(p)&&zi(p.cwd)&&{cwd:p.cwd}}}let g=[];for(let f of Array.isArray(e.commands)?e.commands:[]){let p=ie(f)&&Qe(f.id)&&Ge(f);if(p&&!g.some((_)=>_.id===f.id))g.push({id:f.id,...p})}let u=ie(e.names)?e.names:{},y={};for(let f of r){let p=typeof u[f]==="string"?_e(u[f]):void 0;if(p!==void 0)y[f]=p}let t=Ui(e.groups,r),o=xe(e.minWindow);return{version:2,cwd:String(e.cwd??""),tabs:r,names:y,groups:t,terminals:h,commands:g,...o&&{minWindow:o}}}function Ui(e,r){let s=[],h=new Set;for(let g of Array.isArray(e)?e:[]){if(!ie(g)||!Qe(g.id)||!Ve(g.color)||s.some((t)=>t.id===g.id))continue;let u=(Array.isArray(g.tabs)?g.tabs:[]).filter((t)=>typeof t==="string"&&r.includes(t)&&!h.has(t));if(u.length===0)continue;for(let t of u)h.add(t);let y=typeof g.name==="string"?_e(g.name):void 0;s.push({id:g.id,...y!==void 0&&{name:y},color:g.color,tabs:u})}return s}function $i(e){let r=[];for(let s of e){if(!Qe(s)||r.includes(s))return;r.push(s)}return r}function ji(e){let r=new Set,s=[];for(let h of e)if(!ie(h)||!ss(h.layout,r,s,0))return;return s}function ss(e,r,s,h){if(!ie(e)||h>100)return!1;if(e.type==="terminal"){if(!Qe(e.id)||r.has(e.id))return!1;return r.add(e.id),s.push(e.id),!0}if(e.type!=="split"||typeof e.id!=="string"||!/^split-[1-9]\d{0,8}$/.test(e.id))return!1;if(r.has(e.id))return!1;if(r.add(e.id),!Array.isArray(e.children)||e.children.length!==2)return!1;return e.children.every((g)=>ss(g,r,s,h+1))}function ie(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Qe(e){return typeof e==="string"&&/^[1-9]\d{0,8}$/.test(e)}function zi(e){return typeof e==="string"&&ts(e)&&!e.includes("\x00")}function Gi(e){let r=(s)=>Number.isSafeInteger(s)&&s>=1;return r(e.cols)&&r(e.rows)}import{isAbsolute as qi,resolve as Xi}from"path";var Vi=0.9;function as({allowVscodeWebview:e=!1}={}){return`frame-ancestors 'self'${e?" vscode-webview: vscode-file:":""}`}async function cs(e,r){let{files:s}=e;if(s?.some((g)=>!qi(g.path)))return is(Ki(s),r);let h=Bun.serve({hostname:"127.0.0.1",port:0,development:!1,reusePort:!1,routes:{"/":e},fetch:()=>new Response("Not Found",{status:404})});try{return await is(Qi(h.url),r)}finally{h.stop(!0)}}async function is(e,r){let s=ns(await e("/"),r),h=new TextDecoder().decode(s.body),g=new Set([...h.matchAll(/(?:src|href)="(\/[^"]+)"/g)].map((y)=>y[1])),u={"/":os(s)};for(let y of g){let t=ns(await e(y),r);if(!t.headers.has("cache-control"))t.headers.set("cache-control","public, max-age=31536000, immutable");u[y]=os(t)}return u}function Qi(e){return async(r)=>{let s=await fetch(new URL(r,e));if(!s.ok)throw Error(`\u753B\u9762\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u7528\u610F\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${r} (${s.status})`);return{body:new Uint8Array(await s.arrayBuffer()),headers:new Headers(s.headers)}}}function Ki(e){return async(r)=>{let s=r==="/"?e.find((g)=>g.loader==="html"):e.find((g)=>g.loader!=="html"&&`/${g.path.replace(/^\.\//,"")}`===r);if(!s)throw Error(`\u753B\u9762\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u7528\u610F\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${r}\uFF08\u56FA\u3081\u305F JS \u306E\u4E00\u89A7\u306B\u306A\u3044\uFF09`);return{body:await Bun.file(Xi(import.meta.dir,s.path)).bytes(),headers:new Headers(s.headers)}}}function ns({body:e,headers:r},s){let h=new Headers(r);h.delete("content-length"),h.delete("date"),h.set("vary","Accept-Encoding"),h.set("content-security-policy",s);let g=Bun.gzipSync(e,{level:9});return{body:e,headers:h,gzip:g.byteLength<e.byteLength*Vi?g:void 0}}function os({body:e,gzip:r,headers:s}){let h=s.get("etag");return(g)=>{if(h&&g.headers.get("if-none-match")===h)return new Response(null,{status:304,headers:s});let u=/\bgzip\b/.test(g.headers.get("accept-encoding")??"");if(!r||!u)return new Response(e,{headers:s});let y=new Headers(s);return y.set("content-encoding","gzip"),new Response(r,{headers:y})}}var Yi=3,hs=["#4fc3f7","#ffb74d","#81c784","#f06292","#ba68c8","#fff176"];class It{shellCommand;terminals=new Map;order=[];tabNames=new Map;groups=new Map;tabGroups=new Map;nextGroupId=1;members=new Map;views=new Map;chosenNames=new Map;visibleMembers=new Set;nextMemberId=1;nextId=1;nextSplitId=1;titlesQueued=!1;nextCommandId=1;stopping=!1;initialTerminal;commands=[];minWindow;savedMinWindow;onChange=()=>{};constructor(e,r,s,h){this.shellCommand=r;if(this.savedMinWindow=s?.minWindow,this.minWindow=h??s?.minWindow??Or,!s){this.initialTerminal=this.createTerminal(e??r);return}for(let u of s.tabs){let y=s.terminals[u];if(y.initial)this.initialTerminal=u;let t=y.initial&&e!==void 0;this.addTerminal(u,t?e:r,y,t?void 0:y.cwd)}for(let[u,y]of Object.entries(s.names??{}))this.tabNames.set(u,y);for(let u of s.groups??[]){this.groups.set(u.id,{color:u.color,...u.name!==void 0&&{name:u.name}});for(let y of u.tabs)this.tabGroups.set(y,u.id)}this.nextGroupId=Math.max(0,...[...this.groups.keys()].map(Number))+1,this.normalizeGroups(),this.commands=s.commands;let g=(u)=>Math.max(0,...u.map(Number))+1;if(this.nextId=g(this.order),this.nextCommandId=g(this.commands.map((u)=>u.id)),e&&!this.initialTerminal)this.initialTerminal=this.createTerminal(e)}async snapshot(e,{refreshCwd:r=!1}={}){let s={};return await Promise.all([...this.terminals].map(async([h,g])=>{let[u,y]=await Promise.all([g.snapshot(),g.savedCwd({refresh:r})]);s[h]={...u,initial:h===this.initialTerminal,...y&&{cwd:y}}})),{version:2,cwd:e,tabs:[...this.order],names:Object.fromEntries(this.tabNames),groups:[...this.groups].map(([h,{name:g,color:u}])=>({id:h,...g!==void 0&&{name:g},color:u,tabs:this.order.filter((y)=>this.tabGroups.get(y)===h)})),terminals:s,commands:this.commands,...this.savedMinWindow&&{minWindow:this.savedMinWindow}}}terminal(e){return this.terminals.get(e)}join(e){let r=this.nextMemberId++,s={id:r,name:Mt(r),color:hs[(r-1)%hs.length],selections:{}};this.members.set(e,s);let h=this.initialTerminal&&this.terminals.has(this.initialTerminal)?this.initialTerminal:this.order[0];return this.views.set(s,ue(h)),e({type:"welcome",you:r}),e(this.tabsEvent()),e({type:"view",layout:this.views.get(s)}),e(this.titlesEvent()),e({type:"status",statuses:this.statuses()}),e(this.commandsEvent()),e(this.minWindowEvent()),this.notifyPresence(),{newTab:async(g)=>{let u=g??s.terminal,y=u===void 0?void 0:await this.terminals.get(u)?.cwd();if(!this.views.has(s))return;let t=this.createTerminal(this.shellCommand,y);this.notifyTabs(),this.changeView(s,()=>ue(t))},split:async(g,u)=>{if(!this.canAdd(s))return;let y=await this.terminals.get(g)?.cwd();if(!this.canAdd(s))return;let t=this.createTerminal(this.shellCommand,y);this.notifyTabs(),this.changeView(s,(o)=>this.placeBeside(o,ue(t),g,u))},selectTab:(g)=>{if(!this.terminals.has(g))return;this.changeView(s,(u)=>u.type==="terminal"&&u.id===g?void 0:ue(g))},addToView:(g,u)=>{if(!this.terminals.has(g)||!this.canAdd(s))return;this.changeView(s,(y)=>le(y).includes(g)?void 0:this.placeBeside(y,ue(g),u,"row"))},removeFromView:(g)=>{this.changeView(s,(u)=>le(u).length>1&&le(u).includes(g)?Ye(u,g):void 0)},resizeSplit:(g,u)=>{this.changeView(s,(y)=>ke(y,g)?Zi(y,g,Math.min(0.9,Math.max(0.1,u))):void 0)},swapPanes:(g,u)=>{this.changeView(s,(y)=>{let t=le(y);return g!==u&&t.includes(g)&&t.includes(u)?us(y,g,u):void 0})},flipSplit:(g)=>{this.changeView(s,(u)=>ke(u,g)?Je(u,g,(y)=>({...y,ratio:1-y.ratio,children:[y.children[1],y.children[0]]})):void 0)},rotateSplit:(g)=>{this.changeView(s,(u)=>ke(u,g)?Ke(Je(u,g,(y)=>({...y,direction:y.direction==="row"?"column":"row"}))):void 0)},focus:(g)=>{s.terminal=g,this.notifyPresence(),this.updateSeen()},visible:(g)=>{if(g)this.visibleMembers.add(s);else this.visibleMembers.delete(s);this.updateSeen()},select:(g,u)=>{if(u&&this.terminals.has(g))s.selections[g]=u;else if(!u&&Object.hasOwn(s.selections,g))delete s.selections[g];else return;this.notifyPresence()},follow:(g)=>{let u=[...this.members.values()].find((t)=>t.id===g&&t!==s);if(s.following===u?.id)return;let y=s.following;if(s.following=u?.id,this.forgetScroll(y),this.notifyPresence(),u)this.setView(s,this.views.get(u))},scroll:(g,u)=>{if(s.scroll?.terminal===g&&s.scroll.offset===u)return;s.scroll={terminal:g,offset:u},this.notifyPresence()},rename:(g)=>{if(this.chosenNames.get(s)===g)return;if(g===void 0)this.chosenNames.delete(s);else this.chosenNames.set(s,g);this.notifyPresence()},leave:()=>{this.members.delete(e),this.views.delete(s),this.chosenNames.delete(s),this.visibleMembers.delete(s),this.members.forEach((g)=>{if(g.following===s.id)g.following=void 0}),this.forgetScroll(s.following),this.notifyPresence()}}}close(e){if(this.stopping)return;let r=this.order.indexOf(e);if(r<0||this.order.length===1)return;this.order.splice(r,1),this.removeTerminal(e);let s=this.order[Math.min(r,this.order.length-1)];this.notifyTabs();for(let[h,g]of this.members){let u=this.views.get(g);if(!u||!le(u).includes(e))continue;let y=Ye(u,e)??ue(s);this.views.set(g,y),h({type:"view",layout:y})}this.updateSeen()}moveTab(e,r,s){let h=this.order.indexOf(e);if(h<0||!Number.isSafeInteger(r)||r<0||r>=this.order.length)return;if(typeof s==="string"&&!this.groups.has(s))return;let g=r;if(typeof s==="string"){let y=this.order.filter((t)=>t!==e).flatMap((t,o)=>this.tabGroups.get(t)===s?[o]:[]);if(y.length>0)g=Math.min(Math.max(r,y[0]),y.at(-1)+1)}let u=s!==void 0&&(this.tabGroups.get(e)??null)!==s;if(g===h&&!u)return;if(this.order.splice(h,1),this.order.splice(g,0,e),s===null)this.tabGroups.delete(e);else if(s!==void 0)this.tabGroups.set(e,s);this.notifyTabs()}newGroup(e){if(!this.terminals.has(e))return;let r=new Set([...this.groups.values()].map((g)=>g.color)),s=Ae.find((g)=>!r.has(g))??Ae[this.groups.size%Ae.length],h=String(this.nextGroupId++);this.groups.set(h,{color:s}),this.tabGroups.set(e,h),this.notifyTabs()}addToGroup(e,r){if(!this.terminals.has(e)||!this.groups.has(r)||this.tabGroups.get(e)===r)return;this.order.splice(this.order.indexOf(e),1);let s=this.order.findLastIndex((h)=>this.tabGroups.get(h)===r);this.order.splice(s+1,0,e),this.tabGroups.set(e,r),this.notifyTabs()}removeFromGroup(e){let r=this.tabGroups.get(e);if(r===void 0)return;this.tabGroups.delete(e);let s=this.order.indexOf(e);this.order.splice(s,1);let h=this.order.findLastIndex((g)=>this.tabGroups.get(g)===r);this.order.splice(h<0?s:h+1,0,e),this.notifyTabs()}moveGroup(e,r){if(!this.groups.has(e))return;let s=this.order.filter((u)=>this.tabGroups.get(u)===e),h=this.order.filter((u)=>this.tabGroups.get(u)!==e);if(!Number.isSafeInteger(r)||r<0||r>h.length)return;let g=[...h.slice(0,r),...s,...h.slice(r)];if(g.every((u,y)=>u===this.order[y]))return;this.order=g,this.notifyTabs()}renameGroup(e,r){let s=this.groups.get(e);if(!s||s.name===r)return;if(r===void 0)delete s.name;else s.name=r;this.notifyTabs()}recolorGroup(e,r){let s=this.groups.get(e);if(!s||!Ve(r)||s.color===r)return;s.color=r,this.notifyTabs()}ungroup(e){if(!this.groups.delete(e))return;for(let[r,s]of this.tabGroups)if(s===e)this.tabGroups.delete(r);this.notifyTabs()}closeGroup(e){let r=this.order.filter((s)=>this.tabGroups.get(s)===e);if(r.length===0||r.length===this.order.length)return;for(let s of r)this.close(s)}renameTab(e,r){if(!this.terminals.has(e)||this.tabNames.get(e)===r)return;if(r===void 0)this.tabNames.delete(e);else this.tabNames.set(e,r);this.notifyTabs()}addCommand(e){if(this.commands.length>=Nr)return;this.commands.push({id:String(this.nextCommandId++),...e}),this.notifyCommands()}updateCommand(e,r){let s=this.commands.findIndex((h)=>h.id===e);if(s<0)return;this.commands[s]={id:e,...r},this.notifyCommands()}removeCommand(e){let r=this.commands.length;if(this.commands=this.commands.filter((s)=>s.id!==e),this.commands.length!==r)this.notifyCommands()}setMinWindow(e){if(this.savedMinWindow=e,e.width===this.minWindow.width&&e.height===this.minWindow.height)return this.onChange();this.minWindow=e;let r=this.minWindowEvent();this.members.forEach((s,h)=>h(r)),this.onChange()}async killAll(){this.stopping=!0,await Promise.all([...this.terminals.values()].map((e)=>e.kill()))}createTerminal(e,r){let s=String(this.nextId++);return this.addTerminal(s,e,void 0,r),s}addTerminal(e,r,s,h){this.order.push(e),this.terminals.set(e,new xt(r,()=>this.close(e),()=>this.notifyTitles(),()=>this.notifyStatus(),{restored:s,onOutput:()=>this.onChange(),cwd:h}))}removeTerminal(e){this.terminals.get(e)?.kill(),this.terminals.delete(e),this.tabNames.delete(e),this.tabGroups.delete(e);let r=!1;for(let s of this.members.values()){if(!Object.hasOwn(s.selections,e))continue;delete s.selections[e],r=!0}if(r)this.notifyPresence()}canAdd(e){let r=this.views.get(e);return r!==void 0&&le(r).length<Yi}placeBeside(e,r,s,h){let g=(u)=>({type:"split",id:`split-${this.nextSplitId++}`,direction:h,ratio:0.5,children:[u,r]});if(s===void 0||!le(e).includes(s))return Ke(g(e));return Ke(ls(e,s,g(ue(s))))}changeView(e,r){let s=this.views.get(e),h=s&&r(s);if(!h)return;if(e.following!==void 0){let g=e.following;e.following=void 0,this.forgetScroll(g),this.notifyPresence()}this.setView(e,h)}setView(e,r){let s=new Set,h=(g)=>{s.add(g),this.views.set(g,r);for(let[u,y]of this.members)if(y===g)u({type:"view",layout:r});for(let u of this.members.values())if(u.following===g.id&&!s.has(u))h(u)};h(e),this.updateSeen()}tabsEvent(){let e=(g)=>we(g).replace(/\s/g,""),r=new Map(this.order.map((g)=>[g,e(this.tabNames.get(g)??Pt(g))])),s=this.order.map((g)=>{let u=this.tabNames.get(g);if(u===void 0)return{id:g,name:Pt(g)};let y=r.get(g),t=y.match(/^\u30BF\u30FC\u30DF\u30CA\u30EB(\d+)$/),o=t!==null&&t[1]!==g||/\(\u30BF\u30FC\u30DF\u30CA\u30EB\d+\)$/.test(y)||this.order.some((f)=>f!==g&&r.get(f)===y);return{id:g,name:o?`${u}\uFF08${Pt(g)}\uFF09`:u,custom:u}});for(let g of s){let u=this.tabGroups.get(g.id);if(u!==void 0)g.group=u}let h=[];for(let g of new Set(this.order.flatMap((u)=>this.tabGroups.get(u)??[]))){let{name:u,color:y}=this.groups.get(g);h.push({id:g,name:u??Ji(g),...u!==void 0&&{custom:u},color:y})}return{type:"tabs",tabs:s,groups:h}}normalizeGroups(){for(let[h,g]of this.tabGroups)if(!this.groups.has(g)||!this.terminals.has(h))this.tabGroups.delete(h);let e=new Set(this.tabGroups.values());for(let h of this.groups.keys())if(!e.has(h))this.groups.delete(h);let r=new Set,s=[];for(let h of this.order){if(r.has(h))continue;let g=this.tabGroups.get(h),u=g===void 0?[h]:this.order.filter((y)=>this.tabGroups.get(y)===g);for(let y of u)r.add(y),s.push(y)}this.order=s}notifyTabs(){this.normalizeGroups();let e=this.tabsEvent();this.members.forEach((r,s)=>s(e)),this.onChange()}titlesEvent(){let e={};return this.terminals.forEach((r,s)=>{if(r.title)e[s]=r.title}),{type:"titles",titles:e}}notifyTitles(){if(this.titlesQueued)return;this.titlesQueued=!0,queueMicrotask(()=>{this.titlesQueued=!1;let e=this.titlesEvent();this.members.forEach((r,s)=>s(e))})}statuses(){let e={};return this.terminals.forEach((r,s)=>{if(r.status)e[s]=r.status}),e}notifyStatus(){this.clearSeen();let e=this.statuses();this.members.forEach((r,s)=>s({type:"status",statuses:e}))}updateSeen(){if(this.clearSeen())this.notifyStatus()}clearSeen(){let e=!1;for(let r of this.visibleMembers){let s=r.terminal,h=this.views.get(r);if(s&&h&&le(h).includes(s)&&this.terminals.get(s)?.markSeen())e=!0}return e}commandsEvent(){return{type:"commands",commands:this.commands}}minWindowEvent(){return{type:"min-window",...this.minWindow}}notifyCommands(){let e=this.commandsEvent();this.members.forEach((r,s)=>s(e)),this.onChange()}forgetScroll(e){let r=[...this.members.values()],s=r.find((h)=>h.id===e);if(s&&!r.some((h)=>h.following===e))s.scroll=void 0}updateNames(){let e=[...this.members.values()],r=(h)=>this.chosenNames.get(h)??Mt(h.id),s=new Map;for(let h of e)s.set(we(r(h)),(s.get(we(r(h)))??0)+1);for(let h of e){let g=r(h);h.name=s.get(we(g))>1?`${g}\uFF08${Mt(h.id)}\uFF09`:g}}notifyPresence(){this.updateNames();let e=[...this.members.values()];this.members.forEach((r,s)=>s({type:"presence",members:e}))}}function Mt(e){return`\u53C2\u52A0\u8005 ${e}`}function Pt(e){return`\u30BF\u30FC\u30DF\u30CA\u30EB ${e}`}function Ji(e){return`\u30B0\u30EB\u30FC\u30D7 ${e}`}function ue(e){return{type:"terminal",id:e}}function le(e){return e.type==="terminal"?[e.id]:e.children.flatMap(le)}function ke(e,r){if(e.type==="terminal")return;return e.id===r?e:ke(e.children[0],r)??ke(e.children[1],r)}function Ht(e,r){return{...e,children:[r(e.children[0]),r(e.children[1])]}}function ls(e,r,s){if(e.type==="terminal")return e.id===r?s:e;return Ht(e,(h)=>ls(h,r,s))}function Ye(e,r){if(e.type==="terminal")return e.id===r?void 0:e;let s=Ye(e.children[0],r),h=Ye(e.children[1],r);if(!s||!h)return s??h;return{...e,children:[s,h]}}function Zi(e,r,s){return Je(e,r,(h)=>({...h,ratio:s}))}function Je(e,r,s){if(e.type==="terminal")return e;if(e.id===r)return s(e);return Ht(e,(h)=>Je(h,r,s))}function us(e,r,s){if(e.type==="terminal")return e.id===r?ue(s):e.id===s?ue(r):e;return Ht(e,(h)=>us(h,r,s))}function Ke(e){if(e.type==="terminal")return e;let r=e.children.map(Ke),[s,h]=r.map((g)=>Ot(g,e.direction));return{...e,ratio:s/(s+h),children:r}}function Ot(e,r){if(e.type==="terminal"||e.direction!==r)return 1;return Ot(e.children[0],r)+Ot(e.children[1],r)}var{values:tt,positionals:fs}=Kr(),et=tt["min-window"],ds=et===void 0?void 0:Ir(et);if(et!==void 0&&!ds)console.error(`Accompany: --min-window \u306F\u300C\u5E45x\u9AD8\u3055\u300D\uFF08\u4F8B: 480x1080\u3002\u5E45 0\u301C${Ce.width}\u3001\u9AD8\u3055 0\u301C${Ce.height} \u306E\u6574\u6570\uFF09\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${et}`),process.exit(1);var en=[process.env.SHELL??"/bin/sh"],ps=process.cwd(),Wt=new Dt(rs(),ps),_s=tt.fresh?void 0:Wt.load(),Le=new It(fs.length>0?fs:void 0,en,_s,ds),Ut=new Lt,tn=zr(Le,Ut),gs=10,ge=Number(tt.port),rn=await cs(Jr,as({allowVscodeWebview:tt["allow-vscode-webview"]})),ve;for(let e=ge;e<ge+gs&&e<=Ee;e++)try{ve=Bun.serve({hostname:"127.0.0.1",port:e,development:!1,reusePort:!1,routes:rn,fetch:tn.fetch,websocket:{...ct,perMessageDeflate:!0}});break}catch(r){if(r.code!=="EADDRINUSE")throw r}if(!ve){let e=Math.min(ge+gs-1,Ee);console.error(`Accompany: \u30DD\u30FC\u30C8 ${ge}\u301C${e} \u306F\u3059\u3079\u3066\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059\u3002--port \u3067\u5225\u306E\u30DD\u30FC\u30C8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`),await Le.killAll(),Ut.remove(),process.exit(1)}if(ve.port!==ge&&ge!==0)console.log(`Accompany: \u30DD\u30FC\u30C8 ${ge} \u306F\u4F7F\u308F\u308C\u3066\u3044\u308B\u306E\u3067\u3001${ve.port} \u3067\u5F85\u3061\u53D7\u3051\u307E\u3059`);var Nt=!1;async function ms({stopping:e=!1}={}){try{Wt.save(await Le.snapshot(ps,{refreshCwd:e})),Nt=!1}catch(r){if(!Nt)console.warn(`Accompany: \u753B\u9762\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${r}`);Nt=!0}}var sn=1000,Ze,Ft=!1;Le.onChange=()=>{if(Ze||Ft)return;Ze=setTimeout(()=>{Ze=void 0,ms()},sn)};var nn=3000;for(let e of["SIGINT","SIGTERM","SIGHUP"])process.on(e,async()=>{if(Ft)return;Ft=!0,clearTimeout(Ze),await Promise.race([ms({stopping:!0}),Bun.sleep(nn)]),await Le.killAll(),Ut.remove(),process.exit(0)});console.log(`Accompany: http://${ve.hostname}:${ve.port}`);if(_s)console.log(`\u524D\u56DE\u306E\u753B\u9762\u3092\u623B\u3057\u307E\u3057\u305F\uFF08\u65B0\u3057\u304F\u59CB\u3081\u308B\u3068\u304D\u306F --fresh \u3092\u4ED8\u3051\u3066\u8D77\u52D5\u3059\u308B\uFF09: ${Wt.file}`);
|
|
141
|
+
${Ke}`),process.exit(1);let s=r.positionals[0],c=s??Kr();if(!Qr(c)){let f=`\u5BFE\u5FDC\u3057\u3066\u3044\u308B\u30B7\u30A7\u30EB: ${Qe.join("\u30FB")}`;console.error(s===void 0?`Accompany: $SHELL\uFF08${process.env.SHELL??"\u672A\u8A2D\u5B9A"}\uFF09\u306E\u30B7\u30A7\u30EB\u306B\u306F\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002accompany activate zsh \u306E\u3088\u3046\u306B\u30B7\u30A7\u30EB\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08${f}\uFF09`:`Accompany: \u77E5\u3089\u306A\u3044\u30B7\u30A7\u30EB\u3067\u3059: ${c}\uFF08${f}\uFF09`),process.exit(1)}process.stdout.write(Yr(c)),process.exit(0)}function es(e){let r=e instanceof Error?e.message:String(e),s=e?.code;if(s==="ERR_PARSE_ARGS_UNKNOWN_OPTION"){let c=r.match(/Unknown option '([^']+)'/)?.[1];if(c)return`\u77E5\u3089\u306A\u3044\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3059: ${c}`}if(s==="ERR_PARSE_ARGS_INVALID_OPTION_VALUE"){let c=r.match(/Option '(-[^\s']+)/)?.[1];if(c&&/argument missing|argument is ambiguous/.test(r))return`${c} \u306B\u306F\u5024\u304C\u8981\u308A\u307E\u3059`;if(c&&/does not take an argument/.test(r))return`${c} \u306F\u5024\u3092\u53D6\u308A\u307E\u305B\u3093`}return r}var ts=Xt("{\"index\":\"public/index.html\",\"files\":[{\"input\":\"public/index.html\",\"path\":\"./index-164wadhe.js\",\"loader\":\"js\",\"isEntry\":true,\"headers\":{\"etag\":\"Qabk3AqNkS4\",\"content-type\":\"text/javascript;charset=utf-8\"}},{\"input\":\"public/index.html\",\"path\":\"public/index.html\",\"loader\":\"html\",\"isEntry\":true,\"headers\":{\"etag\":\"o1GySbgWT8U\",\"content-type\":\"text/html;charset=utf-8\"}},{\"input\":\"public/index.html\",\"path\":\"./index-e5af4q9z.css\",\"loader\":\"css\",\"isEntry\":true,\"headers\":{\"etag\":\"LgVqL2T3Cb8\",\"content-type\":\"text/css;charset=utf-8\"}},{\"input\":\"public/favicon.png\",\"path\":\"./favicon-0wwf4h3c.png\",\"loader\":\"file\",\"isEntry\":false,\"headers\":{\"etag\":\"YHwcDyQxo4w\",\"content-type\":\"image/png\"}},{\"input\":\"public/apple-touch-icon.png\",\"path\":\"./apple-touch-icon-ehhpc4a9.png\",\"loader\":\"file\",\"isEntry\":false,\"headers\":{\"etag\":\"LjHRtszkCok\",\"content-type\":\"image/png\"}}]}");import{createHash as Ni}from"crypto";import{chmodSync as Fi,mkdirSync as Wi,readFileSync as Ui,renameSync as $i,rmSync as rs,writeFileSync as zi}from"fs";import{homedir as ji}from"os";import{dirname as Gi,isAbsolute as is,join as Mt}from"path";var Le=["blue","red","yellow","green","pink","purple","cyan","grey"];function Ye(e){return typeof e==="string"&&Le.includes(e)}var ss=448,qi=384;function ns(e=process.env){if(e.ACCOMPANY_STATE_DIR)return e.ACCOMPANY_STATE_DIR;let r=e.XDG_STATE_HOME&&is(e.XDG_STATE_HOME)?e.XDG_STATE_HOME:Mt(ji(),".local","state");return Mt(r,"accompany")}class Pt{dir;file;constructor(e,r){this.dir=e;let s=Ni("sha256").update(r).digest("hex").slice(0,16);this.file=Mt(e,"sessions",`${s}.json`)}load(){let e;try{e=Ui(this.file,"utf8")}catch(r){if(r.code!=="ENOENT")console.warn(`Accompany: \u4FDD\u5B58\u3057\u305F\u753B\u9762\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F: ${r}`);return}try{let r=Xi(JSON.parse(e));if(!r)console.warn(`Accompany: \u4FDD\u5B58\u3057\u305F\u753B\u9762\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u306A\u3044\u305F\u3081\u3001\u65B0\u3057\u304F\u59CB\u3081\u307E\u3059: ${this.file}`);return r}catch(r){console.warn(`Accompany: \u4FDD\u5B58\u3057\u305F\u753B\u9762\u3092\u8AAD\u3081\u306A\u3044\u305F\u3081\u3001\u65B0\u3057\u304F\u59CB\u3081\u307E\u3059: ${r}`)}}save(e){let r=Gi(this.file);for(let c of[this.dir,r])Wi(c,{recursive:!0,mode:ss}),Fi(c,ss);let s=`${this.file}.${process.pid}.tmp`;rs(s,{force:!0});try{zi(s,JSON.stringify(e),{mode:qi,flag:"wx"}),$i(s,this.file)}catch(c){throw rs(s,{force:!0}),c}}}function Xi(e){if(!ne(e)||!Array.isArray(e.tabs)||e.tabs.length===0)return;let r=e.version===2?Qi(e.tabs):e.version===1?Ki(e.tabs):void 0;if(!r)return;let s=ne(e.terminals)?e.terminals:{},c={};for(let l of r){let p=s[l];c[l]={...ne(p)&&Ji(p)?ye({cols:p.cols,rows:p.rows}):{cols:80,rows:24},scrollback:ne(p)&&typeof p.scrollback==="string"?p.scrollback:"",initial:ne(p)&&p.initial===!0,...ne(p)&&Yi(p.cwd)&&{cwd:p.cwd}}}let f=[];for(let l of Array.isArray(e.commands)?e.commands:[]){let p=ne(l)&&Je(l.id)&&Ve(l);if(p&&!f.some((g)=>g.id===l.id))f.push({id:l.id,...p})}let a=ne(e.names)?e.names:{},y={};for(let l of r){let p=typeof a[l]==="string"?ge(a[l]):void 0;if(p!==void 0)y[l]=p}let t=Vi(e.groups,r),n=Ae(e.minWindow);return{version:2,cwd:String(e.cwd??""),tabs:r,names:y,groups:t,terminals:c,commands:f,...n&&{minWindow:n}}}function Vi(e,r){let s=[],c=new Set;for(let f of Array.isArray(e)?e:[]){if(!ne(f)||!Je(f.id)||!Ye(f.color)||s.some((t)=>t.id===f.id))continue;let a=(Array.isArray(f.tabs)?f.tabs:[]).filter((t)=>typeof t==="string"&&r.includes(t)&&!c.has(t));if(a.length===0)continue;for(let t of a)c.add(t);let y=typeof f.name==="string"?ge(f.name):void 0;s.push({id:f.id,...y!==void 0&&{name:y},color:f.color,tabs:a})}return s}function Qi(e){let r=[];for(let s of e){if(!Je(s)||r.includes(s))return;r.push(s)}return r}function Ki(e){let r=new Set,s=[];for(let c of e)if(!ne(c)||!os(c.layout,r,s,0))return;return s}function os(e,r,s,c){if(!ne(e)||c>100)return!1;if(e.type==="terminal"){if(!Je(e.id)||r.has(e.id))return!1;return r.add(e.id),s.push(e.id),!0}if(e.type!=="split"||typeof e.id!=="string"||!/^split-[1-9]\d{0,8}$/.test(e.id))return!1;if(r.has(e.id))return!1;if(r.add(e.id),!Array.isArray(e.children)||e.children.length!==2)return!1;return e.children.every((f)=>os(f,r,s,c+1))}function ne(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Je(e){return typeof e==="string"&&/^[1-9]\d{0,8}$/.test(e)}function Yi(e){return typeof e==="string"&&is(e)&&!e.includes("\x00")}function Ji(e){let r=(s)=>Number.isSafeInteger(s)&&s>=1;return r(e.cols)&&r(e.rows)}import{isAbsolute as Zi,resolve as en}from"path";var tn=0.9;function ls({allowVscodeWebview:e=!1}={}){return`frame-ancestors 'self'${e?" vscode-webview: vscode-file:":""}`}async function us(e,r){let{files:s}=e;if(s?.some((f)=>!Zi(f.path)))return as(sn(s),r);let c=Bun.serve({hostname:"127.0.0.1",port:0,development:!1,reusePort:!1,routes:{"/":e},fetch:()=>new Response("Not Found",{status:404})});try{return await as(rn(c.url),r)}finally{c.stop(!0)}}async function as(e,r){let s=cs(await e("/"),r),c=new TextDecoder().decode(s.body),f=new Set([...c.matchAll(/(?:src|href)="(\/[^"]+)"/g)].map((y)=>y[1])),a={"/":hs(s)};for(let y of f){let t=cs(await e(y),r);if(!t.headers.has("cache-control"))t.headers.set("cache-control","public, max-age=31536000, immutable");a[y]=hs(t)}return a}function rn(e){return async(r)=>{let s=await fetch(new URL(r,e));if(!s.ok)throw Error(`\u753B\u9762\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u7528\u610F\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${r} (${s.status})`);return{body:new Uint8Array(await s.arrayBuffer()),headers:new Headers(s.headers)}}}function sn(e){return async(r)=>{let s=r==="/"?e.find((f)=>f.loader==="html"):e.find((f)=>f.loader!=="html"&&`/${f.path.replace(/^\.\//,"")}`===r);if(!s)throw Error(`\u753B\u9762\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u7528\u610F\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${r}\uFF08\u56FA\u3081\u305F JS \u306E\u4E00\u89A7\u306B\u306A\u3044\uFF09`);return{body:await Bun.file(en(import.meta.dir,s.path)).bytes(),headers:new Headers(s.headers)}}}function cs({body:e,headers:r},s){let c=new Headers(r);c.delete("content-length"),c.delete("date"),c.set("vary","Accept-Encoding"),c.set("content-security-policy",s);let f=Bun.gzipSync(e,{level:9});return{body:e,headers:c,gzip:f.byteLength<e.byteLength*tn?f:void 0}}function hs({body:e,gzip:r,headers:s}){let c=s.get("etag");return(f)=>{if(c&&f.headers.get("if-none-match")===c)return new Response(null,{status:304,headers:s});let a=/\bgzip\b/.test(f.headers.get("accept-encoding")??"");if(!r||!a)return new Response(e,{headers:s});let y=new Headers(s);return y.set("content-encoding","gzip"),new Response(r,{headers:y})}}var fs=3,ds=["#4fc3f7","#ffb74d","#81c784","#f06292","#ba68c8","#fff176"];class Ft{shellCommand;terminals=new Map;order=[];tabNames=new Map;groups=new Map;tabGroups=new Map;nextGroupId=1;members=new Map;views=new Map;chosenNames=new Map;visibleMembers=new Set;nextMemberId=1;nextId=1;nextSplitId=1;titlesQueued=!1;nextCommandId=1;stopping=!1;initialTerminal;commands=[];minWindow;savedMinWindow;onChange=()=>{};constructor(e,r,s,c){this.shellCommand=r;if(this.savedMinWindow=s?.minWindow,this.minWindow=c??s?.minWindow??Nr,!s){this.initialTerminal=this.createTerminal(e??r);return}for(let a of s.tabs){let y=s.terminals[a];if(y.initial)this.initialTerminal=a;let t=y.initial&&e!==void 0;this.addTerminal(a,t?e:r,y,t?void 0:y.cwd)}for(let[a,y]of Object.entries(s.names??{}))this.tabNames.set(a,y);for(let a of s.groups??[]){this.groups.set(a.id,{color:a.color,...a.name!==void 0&&{name:a.name}});for(let y of a.tabs)this.tabGroups.set(y,a.id)}this.nextGroupId=Math.max(0,...[...this.groups.keys()].map(Number))+1,this.normalizeGroups(),this.commands=s.commands;let f=(a)=>Math.max(0,...a.map(Number))+1;if(this.nextId=f(this.order),this.nextCommandId=f(this.commands.map((a)=>a.id)),e&&!this.initialTerminal)this.initialTerminal=this.createTerminal(e)}async snapshot(e,{refreshCwd:r=!1}={}){let s={};return await Promise.all([...this.terminals].map(async([c,f])=>{let[a,y]=await Promise.all([f.snapshot(),f.savedCwd({refresh:r})]);s[c]={...a,initial:c===this.initialTerminal,...y&&{cwd:y}}})),{version:2,cwd:e,tabs:[...this.order],names:Object.fromEntries(this.tabNames),groups:[...this.groups].map(([c,{name:f,color:a}])=>({id:c,...f!==void 0&&{name:f},color:a,tabs:this.order.filter((y)=>this.tabGroups.get(y)===c)})),terminals:s,commands:this.commands,...this.savedMinWindow&&{minWindow:this.savedMinWindow}}}terminal(e){return this.terminals.get(e)}join(e){let r=this.nextMemberId++,s={id:r,name:Ot(r),color:ds[(r-1)%ds.length],selections:{}};this.members.set(e,s);let c=this.initialTerminal&&this.terminals.has(this.initialTerminal)?this.initialTerminal:this.order[0];return this.views.set(s,{layout:oe(c),splits:[]}),e({type:"welcome",you:r}),e(this.tabsEvent()),e(Ht(this.views.get(s))),e(this.titlesEvent()),e({type:"status",statuses:this.statuses()}),e(this.commandsEvent()),e(this.minWindowEvent()),this.notifyPresence(),{newTab:async(f)=>{let a=f??s.terminal,y=a===void 0?void 0:await this.terminals.get(a)?.cwd();if(!this.views.has(s))return;let t=this.createTerminal(this.shellCommand,y);this.notifyTabs(),this.changeView(s,(n)=>({layout:oe(t),splits:ps(n)}))},split:async(f,a)=>{if(!this.canAdd(s))return;let y=await this.terminals.get(f)?.cwd();if(!this.canAdd(s))return;let t=this.createTerminal(this.shellCommand,y);this.notifyTabs();let n=this.changeView(s,(l)=>({...l,layout:this.placeBeside(l.layout,oe(t),f,a)}));if(n)this.gather(n.layout,t)},selectTab:(f)=>{if(!this.terminals.has(f))return;this.changeView(s,(a)=>{if(ee(a.layout).includes(f))return;let y=a.splits.find((n)=>ee(n).includes(f)),t=ps(a).filter((n)=>n!==y);return{layout:y??oe(f),splits:t}})},addToView:(f,a,y)=>{if(!this.terminals.has(f)||!this.canAdd(s))return;let t=this.changeView(s,(n)=>{if(ee(n.layout).includes(f))return;return{layout:y?on(n.layout,oe(f),y,`split-${this.nextSplitId++}`):this.placeBeside(n.layout,oe(f),a,"row"),splits:_s(n.splits,f)}});if(t)this.gather(t.layout,f)},removeFromView:(f)=>{this.changeView(s,(a)=>{let y=ee(a.layout);return y.length>1&&y.includes(f)?{...a,layout:Re(a.layout,f)}:void 0})},separate:(f)=>{this.changeView(s,(a)=>{let y=ee(a.layout);if(y.includes(f)){if(y.length<2)return;let n=s.terminal!==void 0&&y.includes(s.terminal)?s.terminal:f;return{...a,layout:oe(n)}}let t=a.splits.find((n)=>ee(n).includes(f));return t?{...a,splits:a.splits.filter((n)=>n!==t)}:void 0})},resizeSplit:(f,a)=>{this.changeView(s,(y)=>Ze(y,(t)=>me(t,f)?an(t,f,Math.min(0.9,Math.max(0.1,a))):void 0))},swapPanes:(f,a)=>{let y=this.changeView(s,(t)=>Ze(t,(n)=>{let l=ee(n);return f!==a&&l.includes(f)&&l.includes(a)?ms(n,f,a):void 0}));if(y)this.gatherSplitOf(y,(t)=>ee(t).includes(f))},flipSplit:(f)=>{let a=this.changeView(s,(y)=>Ze(y,(t)=>me(t,f)?et(t,f,(n)=>({...n,ratio:1-n.ratio,children:[n.children[1],n.children[0]]})):void 0));if(a)this.gatherSplitOf(a,(y)=>me(y,f)!==void 0)},rotateSplit:(f)=>{let a=this.changeView(s,(y)=>Ze(y,(t)=>me(t,f)?Te(et(t,f,(n)=>({...n,direction:n.direction==="row"?"column":"row"}))):void 0));if(a)this.gatherSplitOf(a,(y)=>me(y,f)!==void 0)},focus:(f)=>{s.terminal=f,this.notifyPresence(),this.updateSeen()},visible:(f)=>{if(f)this.visibleMembers.add(s);else this.visibleMembers.delete(s);this.updateSeen()},select:(f,a)=>{if(a&&this.terminals.has(f))s.selections[f]=a;else if(!a&&Object.hasOwn(s.selections,f))delete s.selections[f];else return;this.notifyPresence()},follow:(f)=>{let a=[...this.members.values()].find((t)=>t.id===f&&t!==s);if(s.following===a?.id)return;let y=s.following;if(s.following=a?.id,this.forgetScroll(y),this.notifyPresence(),a)this.setView(s,this.views.get(a))},scroll:(f,a)=>{if(s.scroll?.terminal===f&&s.scroll.offset===a)return;s.scroll={terminal:f,offset:a},this.notifyPresence()},rename:(f)=>{if(this.chosenNames.get(s)===f)return;if(f===void 0)this.chosenNames.delete(s);else this.chosenNames.set(s,f);this.notifyPresence()},leave:()=>{this.members.delete(e),this.views.delete(s),this.chosenNames.delete(s),this.visibleMembers.delete(s),this.members.forEach((f)=>{if(f.following===s.id)f.following=void 0}),this.forgetScroll(s.following),this.notifyPresence()}}}close(e){if(this.stopping)return;let r=this.order.indexOf(e);if(r<0||this.order.length===1)return;this.order.splice(r,1),this.removeTerminal(e);let s=this.order[Math.min(r,this.order.length-1)];this.notifyTabs();for(let[c,f]of this.members){let a=this.views.get(f);if(!a)continue;let y=ee(a.layout).includes(e),t=a.splits.some((g)=>ee(g).includes(e));if(!y&&!t)continue;let n=_s(a.splits,e),l=a.layout;if(y){let g=Re(a.layout,e),d=g?void 0:n.find((_)=>ee(_).includes(s));l=g??d??oe(s),n=n.filter((_)=>_!==d)}let p={layout:l,splits:n};this.views.set(f,p),c(Ht(p))}this.updateSeen()}moveTab(e,r,s){if(!this.validTabs(e))return;let c=this.order.filter((n)=>e.includes(n)),f=this.order.filter((n)=>!e.includes(n));if(!Number.isSafeInteger(r)||r<0||r>f.length)return;if(typeof s==="string"&&!this.groups.has(s))return;let a=r;if(typeof s==="string"){let n=f.flatMap((l,p)=>this.tabGroups.get(l)===s?[p]:[]);if(n.length>0)a=Math.min(Math.max(r,n[0]),n.at(-1)+1)}let y=[...f.slice(0,a),...c,...f.slice(a)];if(!(s!==void 0&&c.some((n)=>(this.tabGroups.get(n)??null)!==s))&&y.every((n,l)=>n===this.order[l]))return;this.order=y;for(let n of c)if(s===null)this.tabGroups.delete(n);else if(s!==void 0)this.tabGroups.set(n,s);this.notifyTabs()}newGroup(e){if(!this.validTabs(e))return;let r=new Set([...this.groups.values()].map((f)=>f.color)),s=Le.find((f)=>!r.has(f))??Le[this.groups.size%Le.length],c=String(this.nextGroupId++);this.groups.set(c,{color:s});for(let f of e)this.tabGroups.set(f,c);this.notifyTabs()}addToGroup(e,r){if(!this.validTabs(e)||!this.groups.has(r)||e.every((f)=>this.tabGroups.get(f)===r))return;let s=this.order.filter((f)=>e.includes(f));this.order=this.order.filter((f)=>!e.includes(f));let c=this.order.findLastIndex((f)=>this.tabGroups.get(f)===r);this.order.splice(c+1,0,...s);for(let f of s)this.tabGroups.set(f,r);this.notifyTabs()}removeFromGroup(e){if(!this.validTabs(e))return;let r=!1;for(let s of this.order.filter((c)=>e.includes(c)).reverse()){let c=this.tabGroups.get(s);if(c===void 0)continue;r=!0,this.tabGroups.delete(s);let f=this.order.indexOf(s);this.order.splice(f,1);let a=this.order.findLastIndex((y)=>this.tabGroups.get(y)===c);this.order.splice(a<0?f:a+1,0,s)}if(r)this.notifyTabs()}moveGroup(e,r){if(!this.groups.has(e))return;let s=this.order.filter((a)=>this.tabGroups.get(a)===e),c=this.order.filter((a)=>this.tabGroups.get(a)!==e);if(!Number.isSafeInteger(r)||r<0||r>c.length)return;let f=[...c.slice(0,r),...s,...c.slice(r)];if(f.every((a,y)=>a===this.order[y]))return;this.order=f,this.notifyTabs()}renameGroup(e,r){let s=this.groups.get(e);if(!s||s.name===r)return;if(r===void 0)delete s.name;else s.name=r;this.notifyTabs()}recolorGroup(e,r){let s=this.groups.get(e);if(!s||!Ye(r)||s.color===r)return;s.color=r,this.notifyTabs()}ungroup(e){if(!this.groups.delete(e))return;for(let[r,s]of this.tabGroups)if(s===e)this.tabGroups.delete(r);this.notifyTabs()}closeGroup(e){let r=this.order.filter((s)=>this.tabGroups.get(s)===e);if(r.length===0||r.length===this.order.length)return;for(let s of r)this.close(s)}renameTab(e,r){if(!this.terminals.has(e)||this.tabNames.get(e)===r)return;if(r===void 0)this.tabNames.delete(e);else this.tabNames.set(e,r);this.notifyTabs()}addCommand(e){if(this.commands.length>=Ur)return;this.commands.push({id:String(this.nextCommandId++),...e}),this.notifyCommands()}updateCommand(e,r){let s=this.commands.findIndex((c)=>c.id===e);if(s<0)return;this.commands[s]={id:e,...r},this.notifyCommands()}removeCommand(e){let r=this.commands.length;if(this.commands=this.commands.filter((s)=>s.id!==e),this.commands.length!==r)this.notifyCommands()}setMinWindow(e){if(this.savedMinWindow=e,e.width===this.minWindow.width&&e.height===this.minWindow.height)return this.onChange();this.minWindow=e;let r=this.minWindowEvent();this.members.forEach((s,c)=>c(r)),this.onChange()}async killAll(){this.stopping=!0,await Promise.all([...this.terminals.values()].map((e)=>e.kill()))}createTerminal(e,r){let s=String(this.nextId++);return this.addTerminal(s,e,void 0,r),s}addTerminal(e,r,s,c){this.order.push(e),this.terminals.set(e,new At(r,()=>this.close(e),()=>this.notifyTitles(),()=>this.notifyStatus(),{restored:s,onOutput:()=>this.onChange(),cwd:c}))}removeTerminal(e){this.terminals.get(e)?.kill(),this.terminals.delete(e),this.tabNames.delete(e),this.tabGroups.delete(e);let r=!1;for(let s of this.members.values()){if(!Object.hasOwn(s.selections,e))continue;delete s.selections[e],r=!0}if(r)this.notifyPresence()}canAdd(e){let r=this.views.get(e);return r!==void 0&&ee(r.layout).length<fs}validTabs(e){return e.length>0&&e.length<=fs&&new Set(e).size===e.length&&e.every((r)=>this.terminals.has(r))}placeBeside(e,r,s,c){let f=(a)=>({type:"split",id:`split-${this.nextSplitId++}`,direction:c,ratio:0.5,children:[a,r]});if(s===void 0||!ee(e).includes(s))return Te(f(e));return Te(gs(e,s,f(oe(s))))}changeView(e,r){let s=this.views.get(e),c=s&&r(s);if(!c)return;if(e.following!==void 0){let f=e.following;e.following=void 0,this.forgetScroll(f),this.notifyPresence()}return this.setView(e,c),c}gather(e,r){let s=ee(e);if(s.length<2)return;let c=this.order.find((n)=>s.includes(n)&&n!==r);if(c===void 0)return;let f=this.tabGroups.get(c),a=this.order.indexOf(c),y=[...this.order.slice(0,a).filter((n)=>!s.includes(n)),...s,...this.order.slice(a).filter((n)=>!s.includes(n))];if(s.every((n)=>this.tabGroups.get(n)===f)&&y.every((n,l)=>n===this.order[l]))return;this.order=y;for(let n of s)if(f===void 0)this.tabGroups.delete(n);else this.tabGroups.set(n,f);this.notifyTabs()}gatherSplitOf(e,r){let s=[e.layout,...e.splits].find(r);if(s)this.gather(s)}setView(e,r){let s=new Set,c=(f)=>{s.add(f),this.views.set(f,r);for(let[a,y]of this.members)if(y===f)a(Ht(r));for(let a of this.members.values())if(a.following===f.id&&!s.has(a))c(a)};c(e),this.updateSeen()}tabsEvent(){let e=(f)=>xe(f).replace(/\s/g,""),r=new Map(this.order.map((f)=>[f,e(this.tabNames.get(f)??It(f))])),s=this.order.map((f)=>{let a=this.tabNames.get(f);if(a===void 0)return{id:f,name:It(f)};let y=r.get(f),t=y.match(/^\u30BF\u30FC\u30DF\u30CA\u30EB(\d+)$/),n=t!==null&&t[1]!==f||/\(\u30BF\u30FC\u30DF\u30CA\u30EB\d+\)$/.test(y)||this.order.some((l)=>l!==f&&r.get(l)===y);return{id:f,name:n?`${a}\uFF08${It(f)}\uFF09`:a,custom:a}});for(let f of s){let a=this.tabGroups.get(f.id);if(a!==void 0)f.group=a}let c=[];for(let f of new Set(this.order.flatMap((a)=>this.tabGroups.get(a)??[]))){let{name:a,color:y}=this.groups.get(f);c.push({id:f,name:a??nn(f),...a!==void 0&&{custom:a},color:y})}return{type:"tabs",tabs:s,groups:c}}normalizeGroups(){for(let[c,f]of this.tabGroups)if(!this.groups.has(f)||!this.terminals.has(c))this.tabGroups.delete(c);let e=new Set(this.tabGroups.values());for(let c of this.groups.keys())if(!e.has(c))this.groups.delete(c);let r=new Set,s=[];for(let c of this.order){if(r.has(c))continue;let f=this.tabGroups.get(c),a=f===void 0?[c]:this.order.filter((y)=>this.tabGroups.get(y)===f);for(let y of a)r.add(y),s.push(y)}this.order=s}notifyTabs(){this.normalizeGroups();let e=this.tabsEvent();this.members.forEach((r,s)=>s(e)),this.onChange()}titlesEvent(){let e={};return this.terminals.forEach((r,s)=>{if(r.title)e[s]=r.title}),{type:"titles",titles:e}}notifyTitles(){if(this.titlesQueued)return;this.titlesQueued=!0,queueMicrotask(()=>{this.titlesQueued=!1;let e=this.titlesEvent();this.members.forEach((r,s)=>s(e))})}statuses(){let e={};return this.terminals.forEach((r,s)=>{if(r.status)e[s]=r.status}),e}notifyStatus(){this.clearSeen();let e=this.statuses();this.members.forEach((r,s)=>s({type:"status",statuses:e}))}updateSeen(){if(this.clearSeen())this.notifyStatus()}clearSeen(){let e=!1;for(let r of this.visibleMembers){let s=r.terminal,c=this.views.get(r)?.layout;if(s&&c&&ee(c).includes(s)&&this.terminals.get(s)?.markSeen())e=!0}return e}commandsEvent(){return{type:"commands",commands:this.commands}}minWindowEvent(){return{type:"min-window",...this.minWindow}}notifyCommands(){let e=this.commandsEvent();this.members.forEach((r,s)=>s(e)),this.onChange()}forgetScroll(e){let r=[...this.members.values()],s=r.find((c)=>c.id===e);if(s&&!r.some((c)=>c.following===e))s.scroll=void 0}updateNames(){let e=[...this.members.values()],r=(c)=>this.chosenNames.get(c)??Ot(c.id),s=new Map;for(let c of e)s.set(xe(r(c)),(s.get(xe(r(c)))??0)+1);for(let c of e){let f=r(c);c.name=s.get(xe(f))>1?`${f}\uFF08${Ot(c.id)}\uFF09`:f}}notifyPresence(){this.updateNames();let e=[...this.members.values()];this.members.forEach((r,s)=>s({type:"presence",members:e}))}}function Ot(e){return`\u53C2\u52A0\u8005 ${e}`}function It(e){return`\u30BF\u30FC\u30DF\u30CA\u30EB ${e}`}function nn(e){return`\u30B0\u30EB\u30FC\u30D7 ${e}`}function Ht(e){return{type:"view",layout:e.layout,splits:e.splits}}function ps(e){return e.layout.type==="split"?[...e.splits,e.layout]:e.splits}function _s(e,r){return e.flatMap((s)=>{if(!ee(s).includes(r))return[s];let c=Re(s,r);return c&&c.type==="split"?[c]:[]})}function Ze(e,r){let s=r(e.layout);if(s)return{...e,layout:s};for(let[c,f]of e.splits.entries()){let a=r(f);if(a)return{...e,splits:e.splits.with(c,a)}}return}function on(e,r,s,c){return Te({type:"split",id:c,direction:s==="bottom"?"column":"row",ratio:0.5,children:s==="left"?[r,e]:[e,r]})}function oe(e){return{type:"terminal",id:e}}function ee(e){return e.type==="terminal"?[e.id]:e.children.flatMap(ee)}function me(e,r){if(e.type==="terminal")return;return e.id===r?e:me(e.children[0],r)??me(e.children[1],r)}function Wt(e,r){return{...e,children:[r(e.children[0]),r(e.children[1])]}}function gs(e,r,s){if(e.type==="terminal")return e.id===r?s:e;return Wt(e,(c)=>gs(c,r,s))}function Re(e,r){if(e.type==="terminal")return e.id===r?void 0:e;let s=Re(e.children[0],r),c=Re(e.children[1],r);if(!s||!c)return s??c;return{...e,children:[s,c]}}function an(e,r,s){return et(e,r,(c)=>({...c,ratio:s}))}function et(e,r,s){if(e.type==="terminal")return e;if(e.id===r)return s(e);return Wt(e,(c)=>et(c,r,s))}function ms(e,r,s){if(e.type==="terminal")return e.id===r?oe(s):e.id===s?oe(r):e;return Wt(e,(c)=>ms(c,r,s))}function Te(e){if(e.type==="terminal")return e;let r=e.children.map(Te),[s,c]=r.map((f)=>Nt(f,e.direction));return{...e,ratio:s/(s+c),children:r}}function Nt(e,r){if(e.type==="terminal"||e.direction!==r)return 1;return Nt(e.children[0],r)+Nt(e.children[1],r)}var{values:st,positionals:vs}=Zr(),rt=st["min-window"],ys=rt===void 0?void 0:Fr(rt);if(rt!==void 0&&!ys)console.error(`Accompany: --min-window \u306F\u300C\u5E45x\u9AD8\u3055\u300D\uFF08\u4F8B: 480x1080\u3002\u5E45 0\u301C${Ee.width}\u3001\u9AD8\u3055 0\u301C${Ee.height} \u306E\u6574\u6570\uFF09\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044: ${rt}`),process.exit(1);var cn=[process.env.SHELL??"/bin/sh"],bs=process.cwd(),zt=new Pt(ns(),bs),Ss=st.fresh?void 0:zt.load(),Be=new Ft(vs.length>0?vs:void 0,cn,Ss,ys),jt=new Rt,hn=Xr(Be,jt),ws=10,ve=Number(st.port),ln=await us(ts,ls({allowVscodeWebview:st["allow-vscode-webview"]})),be;for(let e=ve;e<ve+ws&&e<=ke;e++)try{be=Bun.serve({hostname:"127.0.0.1",port:e,development:!1,reusePort:!1,routes:ln,fetch:hn.fetch,websocket:{...lt,perMessageDeflate:!0}});break}catch(r){if(r.code!=="EADDRINUSE")throw r}if(!be){let e=Math.min(ve+ws-1,ke);console.error(`Accompany: \u30DD\u30FC\u30C8 ${ve}\u301C${e} \u306F\u3059\u3079\u3066\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059\u3002--port \u3067\u5225\u306E\u30DD\u30FC\u30C8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`),await Be.killAll(),jt.remove(),process.exit(1)}if(be.port!==ve&&ve!==0)console.log(`Accompany: \u30DD\u30FC\u30C8 ${ve} \u306F\u4F7F\u308F\u308C\u3066\u3044\u308B\u306E\u3067\u3001${be.port} \u3067\u5F85\u3061\u53D7\u3051\u307E\u3059`);var Ut=!1;async function Cs({stopping:e=!1}={}){try{zt.save(await Be.snapshot(bs,{refreshCwd:e})),Ut=!1}catch(r){if(!Ut)console.warn(`Accompany: \u753B\u9762\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${r}`);Ut=!0}}var un=1000,tt,$t=!1;Be.onChange=()=>{if(tt||$t)return;tt=setTimeout(()=>{tt=void 0,Cs()},un)};var fn=3000;for(let e of["SIGINT","SIGTERM","SIGHUP"])process.on(e,async()=>{if($t)return;$t=!0,clearTimeout(tt),await Promise.race([Cs({stopping:!0}),Bun.sleep(fn)]),await Be.killAll(),jt.remove(),process.exit(0)});console.log(`Accompany: http://${be.hostname}:${be.port}`);if(Ss)console.log(`\u524D\u56DE\u306E\u753B\u9762\u3092\u623B\u3057\u307E\u3057\u305F\uFF08\u65B0\u3057\u304F\u59CB\u3081\u308B\u3068\u304D\u306F --fresh \u3092\u4ED8\u3051\u3066\u8D77\u52D5\u3059\u308B\uFF09: ${zt.file}`);
|
|
142
142
|
|
|
143
|
-
//# debugId=
|
|
143
|
+
//# debugId=7D70FC09EB4E5EC264756E2164756E21
|
|
144
144
|
//# sourceMappingURL=/cli.js.map
|