@tui-sandbox/library 9.1.10 → 9.2.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/CHANGELOG.md +12 -0
- package/dist/browser/assets/{index-pw1tOGNt.js → index-BVkLGLTD.js} +1 -1
- package/dist/browser/index.html +1 -1
- package/dist/src/browser/neovim-client.d.ts +1 -0
- package/dist/src/browser/neovim-client.js +6 -1
- package/dist/src/browser/neovim-client.js.map +1 -1
- package/dist/src/client/terminal-terminal-client.d.ts +3 -1
- package/dist/src/client/terminal-terminal-client.js +4 -0
- package/dist/src/client/terminal-terminal-client.js.map +1 -1
- package/dist/src/server/cypress-support/contents.js +5 -0
- package/dist/src/server/cypress-support/contents.js.map +1 -1
- package/dist/src/server/neovim/index.js +2 -29
- package/dist/src/server/neovim/index.js.map +1 -1
- package/dist/src/server/server.d.ts +15 -0
- package/dist/src/server/server.js +3 -0
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/terminal/index.d.ts +3 -0
- package/dist/src/server/terminal/index.js +11 -0
- package/dist/src/server/terminal/index.js.map +1 -1
- package/dist/src/server/terminal/runBlockingShellCommand.d.ts +4 -0
- package/dist/src/server/terminal/runBlockingShellCommand.js +34 -0
- package/dist/src/server/terminal/runBlockingShellCommand.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/browser/neovim-client.ts +7 -1
- package/src/client/terminal-terminal-client.ts +7 -2
- package/src/server/cypress-support/contents.ts +5 -0
- package/src/server/neovim/index.ts +2 -31
- package/src/server/server.ts +4 -0
- package/src/server/terminal/index.ts +23 -0
- package/src/server/terminal/runBlockingShellCommand.ts +45 -0
|
@@ -6,4 +6,4 @@ WARNING: This link could potentially be dangerous`)){const n=window.open();if(n)
|
|
|
6
6
|
`:`
|
|
7
7
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.isLinux&&g&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(g){const E=this._getMouseBufferCoords(g),T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(T&&B&&E)&&this._areCoordsInSelection(E,T,B)}isCellInSelection(g,E){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!T||!B)&&this._areCoordsInSelection([g,E],T,B)}_areCoordsInSelection(g,E,T){return g[1]>E[1]&&g[1]<T[1]||E[1]===T[1]&&g[1]===E[1]&&g[0]>=E[0]&&g[0]<T[0]||E[1]<T[1]&&g[1]===T[1]&&g[0]<T[0]||E[1]<T[1]&&g[1]===E[1]&&g[0]>=E[0]}_selectWordAtCursor(g,E){var O,D;const T=(D=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:D.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(g);return!!B&&(this._selectWordAt(B,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,E){this._model.clearSelection(),g=Math.max(g,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const E=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(g){let E=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=T?0:(E>T&&(E-=T),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(g){return n.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(g),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const E=this._getMouseBufferCoords(g);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(g){return g.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const B=T.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const E=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const B=(0,p.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,T=!(!g||!E||g[0]===E[0]&&g[1]===E[1]);T?g&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,E,T)):this._oldHasSelection&&this._fireOnSelectionChange(g,E,T)}_fireOnSelectionChange(g,E,T){this._oldSelectionStart=g,this._oldSelectionEnd=E,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(g,E){let T=E;for(let B=0;E>=B;B++){const O=g.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&E!==B&&(T+=O-1)}return T}setSelection(g,E,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,E],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,E,T=!0,B=!0){if(g[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,D=O.lines.get(g[1]);if(!D)return;const P=O.translateBufferLineToString(g[1],!1);let F=this._convertViewportColToCharacterIndex(D,g[0]),$=F;const G=g[0]-F;let U=0,x=0,L=0,A=0;if(P.charAt(F)===" "){for(;F>0&&P.charAt(F-1)===" ";)F--;for(;$<P.length&&P.charAt($+1)===" ";)$++}else{let z=g[0],Y=g[0];D.getWidth(z)===0&&(U++,z--),D.getWidth(Y)===2&&(x++,Y++);const ee=D.getString(Y).length;for(ee>1&&(A+=ee-1,$+=ee-1);z>0&&F>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?(U++,z--):I>1&&(L+=I-1,F-=I-1),F--,z--}for(;Y<D.length&&$+1<P.length&&!this._isCharWordSeparator(D.loadCell(Y+1,this._workCell));){D.loadCell(Y+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,Y++):I>1&&(A+=I-1,$+=I-1),$++,Y++}}$++;let M=F+G-U+L,N=Math.min(this._bufferService.cols,$-F+U+x-L-A);if(E||P.slice(F,$).trim()!==""){if(T&&M===0&&D.getCodePoint(0)!==32){const z=O.lines.get(g[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(Y){const ee=this._bufferService.cols-Y.start;M-=ee,N+=ee}}}if(B&&M+N===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const z=O.lines.get(g[1]+1);if(z!=null&&z.isWrapped&&z.getCodePoint(0)!==32){const Y=this._getWordAt([0,g[1]+1],!1,!1,!0);Y&&(N+=Y.length)}}return{start:M,length:N}}}_selectWordAt(g,E){const T=this._getWordAt(g,E);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[T.start,g[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(g){const E=this._getWordAt(g,!0);if(E){let T=g[1];for(;E.start<0;)E.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,T]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const E=this._bufferService.buffer.getWrappedRangeForLine(g),T={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols)}};t.SelectionService=w=l([_(3,d.IBufferService),_(4,d.ICoreService),_(5,C.IMouseService),_(6,d.IOptionsService),_(7,C.IRenderService),_(8,C.ICoreBrowserService)],w)},4725:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const l=o(8343);t.ICharSizeService=(0,l.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),t.IMouseService=(0,l.createDecorator)("MouseService"),t.IRenderService=(0,l.createDecorator)("RenderService"),t.ISelectionService=(0,l.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,l.createDecorator)("ThemeService"),t.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(k,t,o){var l=this&&this.__decorate||function(w,g,E,T){var B,O=arguments.length,D=O<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(w,g,E,T);else for(var P=w.length-1;P>=0;P--)(B=w[P])&&(D=(O<3?B(D):O>3?B(g,E,D):B(g,E))||D);return O>3&&D&&Object.defineProperty(g,E,D),D},_=this&&this.__param||function(w,g){return function(E,T){g(E,T,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const h=o(7239),p=o(8055),m=o(8460),C=o(844),f=o(2585),i=p.css.toColor("#ffffff"),n=p.css.toColor("#000000"),r=p.css.toColor("#ffffff"),s=p.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const w=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let E=0;E<216;E++){const T=g[E/36%6|0],B=g[E/6%6|0],O=g[E%6];w.push({css:p.channels.toCss(T,B,O),rgba:p.channels.toRgba(T,B,O)})}for(let E=0;E<24;E++){const T=8+10*E;w.push({css:p.channels.toCss(T,T,T),rgba:p.channels.toRgba(T,T,T)})}return w})());let S=t.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(w){super(),this._optionsService=w,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:n,cursor:r,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:p.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:p.color.blend(n,d),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(w={}){const g=this._colors;if(g.foreground=b(w.foreground,i),g.background=b(w.background,n),g.cursor=b(w.cursor,r),g.cursorAccent=b(w.cursorAccent,s),g.selectionBackgroundTransparent=b(w.selectionBackground,d),g.selectionBackgroundOpaque=p.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=b(w.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=p.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=w.selectionForeground?b(w.selectionForeground,p.NULL_COLOR):void 0,g.selectionForeground===p.NULL_COLOR&&(g.selectionForeground=void 0),p.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=p.color.opacity(g.selectionBackgroundTransparent,.3)),p.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=p.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=t.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=b(w.black,t.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=b(w.red,t.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=b(w.green,t.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=b(w.yellow,t.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=b(w.blue,t.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=b(w.magenta,t.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=b(w.cyan,t.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=b(w.white,t.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=b(w.brightBlack,t.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=b(w.brightRed,t.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=b(w.brightGreen,t.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=b(w.brightYellow,t.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=b(w.brightBlue,t.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=b(w.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=b(w.brightCyan,t.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=b(w.brightWhite,t.DEFAULT_ANSI_COLORS[15]),w.extendedAnsi){const E=Math.min(g.ansi.length-16,w.extendedAnsi.length);for(let T=0;T<E;T++)g.ansi[T+16]=b(w.extendedAnsi[T],t.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(w){this._restoreColor(w),this._onChangeColors.fire(this.colors)}_restoreColor(w){if(w!==void 0)switch(w){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[w]=this._restoreColors.ansi[w]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(w){w(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function b(w,g){if(w!==void 0)try{return p.css.toColor(w)}catch{}return g}t.ThemeService=S=l([_(0,f.IOptionsService)],S)},6349:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const l=o(8460),_=o(844);class h extends _.Disposable{constructor(m){super(),this._maxLength=m,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(m){if(this._maxLength===m)return;const C=new Array(m);for(let f=0;f<Math.min(m,this.length);f++)C[f]=this._array[this._getCyclicIndex(f)];this._array=C,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let C=this._length;C<m;C++)this._array[C]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,C){this._array[this._getCyclicIndex(m)]=C}push(m){this._array[this._getCyclicIndex(this._length)]=m,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(m,C,...f){if(C){for(let i=m;i<this._length-C;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+C)];this._length-=C,this.onDeleteEmitter.fire({index:m,amount:C})}for(let i=this._length-1;i>=m;i--)this._array[this._getCyclicIndex(i+f.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<f.length;i++)this._array[this._getCyclicIndex(m+i)]=f[i];if(f.length&&this.onInsertEmitter.fire({index:m,amount:f.length}),this._length+f.length>this._maxLength){const i=this._length+f.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=f.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,C,f){if(!(C<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let n=C-1;n>=0;n--)this.set(m+n+f,this.get(m+n));const i=m+C+f-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<C;i++)this.set(m+i+f,this.get(m+i))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}t.CircularList=h},1439:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function o(l,_=5){if(typeof l!="object")return l;const h=Array.isArray(l)?[]:{};for(const p in l)h[p]=_<=1?l[p]:l[p]&&o(l[p],_-1);return h}},8055:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let o=0,l=0,_=0,h=0;var p,m,C,f,i;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function r(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,S,b,w){return w!==void 0?`#${n(d)}${n(S)}${n(b)}${n(w)}`:`#${n(d)}${n(S)}${n(b)}`},s.toRgba=function(d,S,b,w=255){return(d<<24|S<<16|b<<8|w)>>>0},s.toColor=function(d,S,b,w){return{css:s.toCss(d,S,b,w),rgba:s.toRgba(d,S,b,w)}}}(p||(t.channels=p={})),function(s){function d(S,b){return h=Math.round(255*b),[o,l,_]=i.toChannels(S.rgba),{css:p.toCss(o,l,_,h),rgba:p.toRgba(o,l,_,h)}}s.blend=function(S,b){if(h=(255&b.rgba)/255,h===1)return{css:b.css,rgba:b.rgba};const w=b.rgba>>24&255,g=b.rgba>>16&255,E=b.rgba>>8&255,T=S.rgba>>24&255,B=S.rgba>>16&255,O=S.rgba>>8&255;return o=T+Math.round((w-T)*h),l=B+Math.round((g-B)*h),_=O+Math.round((E-O)*h),{css:p.toCss(o,l,_),rgba:p.toRgba(o,l,_)}},s.isOpaque=function(S){return(255&S.rgba)==255},s.ensureContrastRatio=function(S,b,w){const g=i.ensureContrastRatio(S.rgba,b.rgba,w);if(g)return p.toColor(g>>24&255,g>>16&255,g>>8&255)},s.opaque=function(S){const b=(255|S.rgba)>>>0;return[o,l,_]=i.toChannels(b),{css:p.toCss(o,l,_),rgba:b}},s.opacity=d,s.multiplyOpacity=function(S,b){return h=255&S.rgba,d(S,h*b/255)},s.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}}(m||(t.color=m={})),function(s){let d,S;try{const b=document.createElement("canvas");b.width=1,b.height=1;const w=b.getContext("2d",{willReadFrequently:!0});w&&(d=w,d.globalCompositeOperation="copy",S=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return o=parseInt(b.slice(1,2).repeat(2),16),l=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),p.toColor(o,l,_);case 5:return o=parseInt(b.slice(1,2).repeat(2),16),l=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),h=parseInt(b.slice(4,5).repeat(2),16),p.toColor(o,l,_,h);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}const w=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(w)return o=parseInt(w[1]),l=parseInt(w[2]),_=parseInt(w[3]),h=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),p.toColor(o,l,_,h);if(!d||!S)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=S,d.fillStyle=b,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,l,_,h]=d.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,l,_,h),css:b}}}(C||(t.css=C={})),function(s){function d(S,b,w){const g=S/255,E=b/255,T=w/255;return .2126*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}s.relativeLuminance=function(S){return d(S>>16&255,S>>8&255,255&S)},s.relativeLuminance2=d}(f||(t.rgb=f={})),function(s){function d(b,w,g){const E=b>>24&255,T=b>>16&255,B=b>>8&255;let O=w>>24&255,D=w>>16&255,P=w>>8&255,F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));for(;F<g&&(O>0||D>0||P>0);)O-=Math.max(0,Math.ceil(.1*O)),D-=Math.max(0,Math.ceil(.1*D)),P-=Math.max(0,Math.ceil(.1*P)),F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}function S(b,w,g){const E=b>>24&255,T=b>>16&255,B=b>>8&255;let O=w>>24&255,D=w>>16&255,P=w>>8&255,F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));for(;F<g&&(O<255||D<255||P<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),D=Math.min(255,D+Math.ceil(.1*(255-D))),P=Math.min(255,P+Math.ceil(.1*(255-P))),F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}s.blend=function(b,w){if(h=(255&w)/255,h===1)return w;const g=w>>24&255,E=w>>16&255,T=w>>8&255,B=b>>24&255,O=b>>16&255,D=b>>8&255;return o=B+Math.round((g-B)*h),l=O+Math.round((E-O)*h),_=D+Math.round((T-D)*h),p.toRgba(o,l,_)},s.ensureContrastRatio=function(b,w,g){const E=f.relativeLuminance(b>>8),T=f.relativeLuminance(w>>8);if(r(E,T)<g){if(T<E){const D=d(b,w,g),P=r(E,f.relativeLuminance(D>>8));if(P<g){const F=S(b,w,g);return P>r(E,f.relativeLuminance(F>>8))?D:F}return D}const B=S(b,w,g),O=r(E,f.relativeLuminance(B>>8));if(O<g){const D=d(b,w,g);return O>r(E,f.relativeLuminance(D>>8))?B:D}return B}},s.reduceLuminance=d,s.increaseLuminance=S,s.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}}(i||(t.rgba=i={})),t.toPaddedHex=n,t.contrastRatio=r},8969:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const l=o(844),_=o(2585),h=o(4348),p=o(7866),m=o(744),C=o(7302),f=o(6975),i=o(8460),n=o(1753),r=o(1480),s=o(7994),d=o(9282),S=o(5435),b=o(5981),w=o(2660);let g=!1;class E extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(B=>{var O;(O=this._onScrollApi)==null||O.fire(B.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(B){for(const O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new C.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(f.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new b.WriteBuffer((O,D)=>this._inputHandler.parse(O,D))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=_.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,m.MINIMUM_COLS),O=Math.max(O,m.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,D){this._bufferService.scrollLines(B,O,D)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const O of B)O.dispose()})}}}t.CoreTerminal=E},8460:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===o)return void this._listeners.splice(l,1)}}})),this._event}fire(o,l){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,o,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(o,l){return o(_=>l.fire(_))},t.runAndSubscribe=function(o,l){return l(void 0),o(_=>l(_))}},5435:function(k,t,o){var l=this&&this.__decorate||function(U,x,L,A){var M,N=arguments.length,z=N<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(U,x,L,A);else for(var Y=U.length-1;Y>=0;Y--)(M=U[Y])&&(z=(N<3?M(z):N>3?M(x,L,z):M(x,L))||z);return N>3&&z&&Object.defineProperty(x,L,z),z},_=this&&this.__param||function(U,x){return function(L,A){x(L,A,U)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const h=o(2584),p=o(7116),m=o(2015),C=o(844),f=o(482),i=o(8437),n=o(8460),r=o(643),s=o(511),d=o(3734),S=o(2585),b=o(1480),w=o(6242),g=o(6351),E=o(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O(U,x){if(U>24)return x.setWinLines||!1;switch(U){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 D;(function(U){U[U.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",U[U.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(t.WindowsOptionsReportType=D={}));let P=0;class F extends C.Disposable{getAttrData(){return this._curAttrData}constructor(x,L,A,M,N,z,Y,ee,I=new m.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=L,this._coreService=A,this._logService=M,this._optionsService=N,this._oscLinkService=z,this._coreMouseService=Y,this._unicodeService=ee,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new f.StringToUtf32,this._utf8Decoder=new f.Utf8ToUtf32,this._workCell=new s.CellData,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 n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:W.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,W,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:W,data:H})}),this._parser.setDcsHandlerFallback((R,W,H)=>{W==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:W,payload:H})}),this._parser.setPrintHandler((R,W,H)=>this.print(R,W,H)),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(h.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(h.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(h.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(h.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(h.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(h.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(h.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(h.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(h.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(h.C1.IND,()=>this.index()),this._parser.setExecuteHandler(h.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(h.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new w.OscHandler(R=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new w.OscHandler(R=>this.setIconName(R))),this._parser.registerOscHandler(2,new w.OscHandler(R=>this.setTitle(R))),this._parser.registerOscHandler(4,new w.OscHandler(R=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new w.OscHandler(R=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new w.OscHandler(R=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new w.OscHandler(R=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new w.OscHandler(R=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new w.OscHandler(R=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new w.OscHandler(R=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new w.OscHandler(R=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new w.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(const R in p.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 g.DcsHandler((R,W)=>this.requestStatusString(R,W)))}_preserveStack(x,L,A,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=A,this._parseStack.position=M}_logSlowResolvingAsync(x){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([x,new Promise((L,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,L){let A,M=this._activeBuffer.x,N=this._activeBuffer.y,z=0;const Y=this._parseStack.paused;if(Y){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(A),A;M=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>B&&(z=this._parseStack.position+B)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,R=>String.fromCharCode(R)).join("")}"`),typeof x=="string"?x.split("").map(R=>R.charCodeAt(0)):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(x.length,B))),Y||this._dirtyRowTracker.clearRange(),x.length>B)for(let R=z;R<x.length;R+=B){const W=R+B<x.length?R+B:x.length,H=typeof x=="string"?this._stringDecoder.decode(x.substring(R,W),this._parseBuffer):this._utf8Decoder.decode(x.subarray(R,W),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,N,H,R),this._logSlowResolvingAsync(A),A}else if(!Y){const R=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,R))return this._preserveStack(M,N,R,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===M&&this._activeBuffer.y===N||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(x,L,A){let M,N;const z=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,W=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-L>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let Z=this._parser.precedingJoinState;for(let V=L;V<A;++V){if(M=x[V],M<127&&z){const ue=z[String.fromCharCode(M)];ue&&(M=ue.charCodeAt(0))}const ie=this._unicodeService.charProperties(M,Z);N=b.UnicodeService.extractWidth(ie);const ce=b.UnicodeService.extractShouldJoin(ie),he=ce?b.UnicodeService.extractWidth(Z):0;if(Z=ie,Y&&this._onA11yChar.fire((0,f.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>ee){if(I){const ue=H;let te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&H instanceof i.BufferLine&&H.copyCellsFrom(ue,te,0,he,!1);te<ee;)ue.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=ee-1,N===2)continue}if(ce&&this._activeBuffer.x){const ue=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ue,M,N);for(let te=N-he;--te>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(R&&(H.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(W)),H.getWidth(ee-1)===2&&H.setCellFromCodepoint(ee-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,W)),H.setCellFromCodepoint(this._activeBuffer.x++,M,N,W),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=Z,this._activeBuffer.x<ee&&A-L>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,L){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,L):this._parser.registerCsiHandler(x,A=>!O(A.params[0],this._optionsService.rawOptions.windowOptions)||L(A))}registerDcsHandler(x,L){return this._parser.registerDcsHandler(x,new g.DcsHandler(L))}registerEscHandler(x,L){return this._parser.registerEscHandler(x,L)}registerOscHandler(x,L){return this._parser.registerOscHandler(x,new w.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var x;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&&((x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&x.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const x=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-x),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(x=this._bufferService.cols-1){this._activeBuffer.x=Math.min(x,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(x,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=x,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+L)}cursorUp(x){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,x.params[0]||1)):this._moveCursor(0,x.params[0]||1),!0}cursorForward(x){return this._moveCursor(x.params[0]||1,0),!0}cursorBackward(x){return this._moveCursor(-(x.params[0]||1),0),!0}cursorNextLine(x){return this.cursorDown(x),this._activeBuffer.x=0,!0}cursorPrecedingLine(x){return this.cursorUp(x),this._activeBuffer.x=0,!0}cursorCharAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(x){return this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1),!0}charPosAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(x){return this._moveCursor(x.params[0]||1,0),!0}linePosAbsolute(x){return this._setCursor(this._activeBuffer.x,(x.params[0]||1)-1),!0}vPositionRelative(x){return this._moveCursor(0,x.params[0]||1),!0}hVPosition(x){return this.cursorPosition(x),!0}tabClear(x){const L=x.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const L=x.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,L,A,M=!1,N=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);z.replaceCells(L,A,this._activeBuffer.getNullCell(this._eraseAttrData()),N),M&&(z.isWrapped=!1)}_resetBufferLine(x,L=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),A.isWrapped=!1)}eraseInDisplay(x,L=!1){let A;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);A<this._bufferService.rows;A++)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(x,L=!1){switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;L--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let L=x.params[0]||1;for(;L--;)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(x){let L=x.params[0]||1;for(;L--;)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(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(x.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(x){const L=this._parser.precedingJoinState;if(!L)return!0;const A=x.params[0]||1,M=b.UnicodeService.extractWidth(L),N=this._activeBuffer.x-M,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),Y=new Uint32Array(z.length*A);let ee=0;for(let R=0;R<z.length;){const W=z.codePointAt(R)||0;Y[ee++]=W,R+=W>65535?2:1}let I=ee;for(let R=1;R<A;++R)Y.copyWithin(I,0,ee),I+=ee;return this.print(Y,0,I),!0}sendDeviceAttributesPrimary(x){return x.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(x){return x.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),x.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(x,L){const A=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:N}=this._coreMouseService,z=this._coreService,{buffers:Y,cols:ee}=this._bufferService,{active:I,alt:R}=Y,W=this._optionsService.rawOptions,H=ce=>ce?1:2,Z=x.params[0];return V=Z,ie=L?Z===2?4:Z===4?H(z.modes.insertMode):Z===12?3:Z===20?H(W.convertEol):0:Z===1?H(A.applicationCursorKeys):Z===3?W.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:Z===6?H(A.origin):Z===7?H(A.wraparound):Z===8?3:Z===9?H(M==="X10"):Z===12?H(W.cursorBlink):Z===25?H(!z.isCursorHidden):Z===45?H(A.reverseWraparound):Z===66?H(A.applicationKeypad):Z===67?4:Z===1e3?H(M==="VT200"):Z===1002?H(M==="DRAG"):Z===1003?H(M==="ANY"):Z===1004?H(A.sendFocus):Z===1005?4:Z===1006?H(N==="SGR"):Z===1015?4:Z===1016?H(N==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?H(I===R):Z===2004?H(A.bracketedPasteMode):0,z.triggerDataEvent(`${h.C0.ESC}[${L?"":"?"}${V};${ie}$y`),!0;var V,ie}_updateAttrColor(x,L,A,M,N){return L===2?(x|=50331648,x&=-16777216,x|=d.AttributeData.fromColorRGB([A,M,N])):L===5&&(x&=-50331904,x|=33554432|255&A),x}_extractColor(x,L,A){const M=[0,0,-1,0,0,0];let N=0,z=0;do{if(M[z+N]=x.params[L+z],x.hasSubParams(L+z)){const Y=x.getSubParams(L+z);let ee=0;do M[1]===5&&(N=1),M[z+ee+1+N]=Y[ee];while(++ee<Y.length&&ee+z+1+N<M.length);break}if(M[1]===5&&z+N>=2||M[1]===2&&z+N>=5)break;M[1]&&(N=1)}while(++z+L<x.length&&z+N<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:A.fg=this._updateAttrColor(A.fg,M[1],M[3],M[4],M[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,M[1],M[3],M[4],M[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,M[1],M[3],M[4],M[5])}return z}_processUnderline(x,L){L.extended=L.extended.clone(),(!~x||x>5)&&(x=1),L.extended.underlineStyle=x,L.fg|=268435456,x===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(x){x.fg=i.DEFAULT_ATTR_DATA.fg,x.bg=i.DEFAULT_ATTR_DATA.bg,x.extended=x.extended.clone(),x.extended.underlineStyle=0,x.extended.underlineColor&=-67108864,x.updateExtended()}charAttributes(x){if(x.length===1&&x.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=x.length;let A;const M=this._curAttrData;for(let N=0;N<L;N++)A=x.params[N],A>=30&&A<=37?(M.fg&=-50331904,M.fg|=16777216|A-30):A>=40&&A<=47?(M.bg&=-50331904,M.bg|=16777216|A-40):A>=90&&A<=97?(M.fg&=-50331904,M.fg|=16777224|A-90):A>=100&&A<=107?(M.bg&=-50331904,M.bg|=16777224|A-100):A===0?this._processSGR0(M):A===1?M.fg|=134217728:A===3?M.bg|=67108864:A===4?(M.fg|=268435456,this._processUnderline(x.hasSubParams(N)?x.getSubParams(N)[0]:1,M)):A===5?M.fg|=536870912:A===7?M.fg|=67108864:A===8?M.fg|=1073741824:A===9?M.fg|=2147483648:A===2?M.bg|=134217728:A===21?this._processUnderline(2,M):A===22?(M.fg&=-134217729,M.bg&=-134217729):A===23?M.bg&=-67108865:A===24?(M.fg&=-268435457,this._processUnderline(0,M)):A===25?M.fg&=-536870913:A===27?M.fg&=-67108865:A===28?M.fg&=-1073741825:A===29?M.fg&=2147483647:A===39?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):A===49?(M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?N+=this._extractColor(x,N,M):A===53?M.bg|=1073741824:A===55?M.bg&=-1073741825:A===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):A===100?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${L};${A}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${L};${A}R`)}return!0}softReset(x){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(x){const L=x.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const A=L%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(x){const L=x.params[0]||1;let A;return(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(x){if(!O(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(x){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(x){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(x){return this._windowTitle=x,this._onTitleChange.fire(x),!0}setIconName(x){return this._iconName=x,!0}setOrReportIndexedColor(x){const L=[],A=x.split(";");for(;A.length>1;){const M=A.shift(),N=A.shift();if(/^\d+$/.exec(M)){const z=parseInt(M);if(G(z))if(N==="?")L.push({type:0,index:z});else{const Y=(0,E.parseColor)(N);Y&&L.push({type:1,index:z,color:Y})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(x){const L=x.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(x,L){this._getCurrentLinkId()&&this._finishHyperlink();const A=x.split(":");let M;const N=A.findIndex(z=>z.startsWith("id="));return N!==-1&&(M=A[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,L){const A=x.split(";");for(let M=0;M<A.length&&!(L>=this._specialColors.length);++M,++L)if(A[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const N=(0,E.parseColor)(A[M]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(x){return this._setOrReportSpecialColor(x,0)}setOrReportBgColor(x){return this._setOrReportSpecialColor(x,1)}setOrReportCursorColor(x){return this._setOrReportSpecialColor(x,2)}restoreIndexedColor(x){if(!x)return this._onColor.fire([{type:2}]),!0;const L=[],A=x.split(";");for(let M=0;M<A.length;++M)if(/^\d+$/.exec(A[M])){const N=parseInt(A[M]);G(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(x){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(x){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(x){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,p.DEFAULT_CHARSET),!0}selectCharset(x){return x.length!==2?(this.selectDefaultCharset(),!0):(x[0]==="/"||this._charsetService.setgCharset(T[x[0]],p.CHARSETS[x[1]]||p.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const x=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,x,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(x){return this._charsetService.setgLevel(x),!0}screenAlignmentPattern(){const x=new s.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const A=this._activeBuffer.ybase+this._activeBuffer.y+L,M=this._activeBuffer.lines.get(A);M&&(M.fill(x),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,L){const A=this._bufferService.buffer,M=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${N}${h.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,L){this._dirtyRowTracker.markRangeDirty(x,L)}}t.InputHandler=F;let $=class{constructor(U){this._bufferService=U,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(U){U<this.start?this.start=U:U>this.end&&(this.end=U)}markRangeDirty(U,x){U>x&&(P=U,U=x,x=P),U<this.start&&(this.start=U),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(U){return 0<=U&&U<256}$=l([_(0,S.IBufferService)],$)},844:(k,t)=>{function o(l){for(const _ of l)_.dispose();l.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const _=this._disposables.indexOf(l);_!==-1&&this._disposables.splice(_,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var _;this._isDisposed||l===this._value||((_=this._value)==null||_.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=o,t.getDisposeArrayDisposable=function(l){return{dispose:()=>o(l)}}},1505:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(_,h,p){this._data[_]||(this._data[_]={}),this._data[_][h]=p}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}t.TwoKeyMap=o,t.FourKeyMap=class{constructor(){this._data=new o}set(l,_,h,p,m){this._data.get(l,_)||this._data.set(l,_,new o),this._data.get(l,_).set(h,p,m)}get(l,_,h,p){var m;return(m=this._data.get(l,_))==null?void 0:m.get(h,p)}clear(){this._data.clear()}}},6114:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const o=t.isNode?"node":navigator.userAgent,l=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.getSafariVersion=function(){if(!t.isSafari)return 0;const _=o.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},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(o)},6106:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let o=0;t.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(o=this._search(this._getKey(l)),this._array.splice(o,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const _=this._getKey(l);if(_===void 0||(o=this._search(_),o===-1)||this._getKey(this._array[o])!==_)return!1;do if(this._array[o]===l)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(o=this._search(l),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===l))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===l)}forEachByKey(l,_){if(this._array.length!==0&&(o=this._search(l),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===l))do _(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===l)}values(){return[...this._array].values()}_search(l){let _=0,h=this._array.length-1;for(;h>=_;){let p=_+h>>1;const m=this._getKey(this._array[p]);if(m>l)h=p-1;else{if(!(m<l)){for(;p>0&&this._getKey(this._array[p-1])===l;)p--;return p}_=p+1}}return _}}},7226:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=o(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),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(m){this._idleCallback=void 0;let C=0,f=0,i=m.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),f=Math.max(C,f),n=m.timeRemaining(),1.5*f>n)return i-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-C))}ms`),void this._start();i=n}this.clear()}}class h extends _{_requestCallback(m){return setTimeout(()=>m(this._createDeadline(16)))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){const C=Date.now()+m;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}t.PriorityTaskQueue=h,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:h,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const l=o(643);t.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=h==null?void 0:h.get(_.cols-1),m=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);m&&p&&(m.isWrapped=p[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&p[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(k,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 l}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new o;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=o;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,p=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=p}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},9092:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const l=o(6349),_=o(7226),h=o(3734),p=o(8437),m=o(4634),C=o(511),f=o(643),i=o(4863),n=o(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(r,s,d){this._hasScrollback=r,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,f.WHITESPACE_CELL_CHAR,f.WHITESPACE_CELL_WIDTH,f.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.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(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,s){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows}_getCorrectBufferLength(r){if(!this._hasScrollback)return r;const s=r+this._optionsService.rawOptions.scrollback;return s>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(r))}}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(r,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA);let S=0;const b=this._getCorrectBufferLength(s);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<r)for(let g=0;g<this.lines.length;g++)S+=+this.lines.get(g).resize(r,d);let w=0;if(this._rows<s)for(let g=this._rows;g<s;g++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(r,d)));else for(let g=this._rows;g>s;g--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){const g=this.lines.length-b;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=b}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,s-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(r,s),this._cols>r))for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(r,d);this._cols=r,this._rows=s,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let r=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,r=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return r}get _isReflowEnabled(){const r=this._optionsService.rawOptions.windowsPty;return r&&r.buildNumber?this._hasScrollback&&r.backend==="conpty"&&r.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(r,s){this._cols!==r&&(r>this._cols?this._reflowLarger(r,s):this._reflowSmaller(r,s))}_reflowLarger(r,s){const d=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(d.length>0){const S=(0,m.reflowLargerCreateNewLayout)(this.lines,d);(0,m.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(r,s,S.countRemoved)}}_reflowLargerAdjustViewport(r,s,d){const S=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=d;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new p.BufferLine(r,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(r,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA),S=[];let b=0;for(let w=this.lines.length-1;w>=0;w--){let g=this.lines.get(w);if(!g||!g.isWrapped&&g.getTrimmedLength()<=r)continue;const E=[g];for(;g.isWrapped&&w>0;)g=this.lines.get(--w),E.unshift(g);const T=this.ybase+this.y;if(T>=w&&T<w+E.length)continue;const B=E[E.length-1].getTrimmedLength(),O=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,r),D=O.length-E.length;let P;P=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const F=[];for(let A=0;A<D;A++){const M=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);F.push(M)}F.length>0&&(S.push({start:w+E.length+b,newLines:F}),b+=F.length),E.push(...F);let $=O.length-1,G=O[$];G===0&&($--,G=O[$]);let U=E.length-D-1,x=B;for(;U>=0;){const A=Math.min(x,G);if(E[$]===void 0)break;if(E[$].copyCellsFrom(E[U],x-A,G-A,A,!0),G-=A,G===0&&($--,G=O[$]),x-=A,x===0){U--;const M=Math.max(U,0);x=(0,m.getWrappedLineTrimmedLength)(E,M,this._cols)}}for(let A=0;A<E.length;A++)O[A]<r&&E[A].setCell(O[A],d);let L=D-P;for(;L-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+s-1)}if(S.length>0){const w=[],g=[];for(let $=0;$<this.lines.length;$++)g.push(this.lines.get($));const E=this.lines.length;let T=E-1,B=0,O=S[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let D=0;for(let $=Math.min(this.lines.maxLength-1,E+b-1);$>=0;$--)if(O&&O.start>T+D){for(let G=O.newLines.length-1;G>=0;G--)this.lines.set($--,O.newLines[G]);$++,w.push({index:T+1,amount:O.newLines.length}),D+=O.newLines.length,O=S[++B]}else this.lines.set($,g[T--]);let P=0;for(let $=w.length-1;$>=0;$--)w[$].index+=P,this.lines.onInsertEmitter.fire(w[$]),P+=w[$].amount;const F=Math.max(0,E+b-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(r,s,d=0,S){const b=this.lines.get(r);return b?b.translateToString(s,d,S):""}getWrappedRangeForLine(r){let s=r,d=r;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}setupTabStops(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.rawOptions.tabStopWidth)this.tabs[r]=!0}prevStop(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r}nextStop(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r}clearMarkers(r){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===r&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].dispose(),this.markers.splice(r--,1);this._isClearing=!1}addMarker(r){const s=new i.Marker(r);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},8437:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const l=o(3734),_=o(511),h=o(643),p=o(482);t.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let m=0;class C{constructor(i,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);const s=n||_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let d=0;d<i;++d)this.setCell(d,s);this.length=i}get(i){const n=this._data[3*i+0],r=2097151&n;return[this._data[3*i+1],2097152&n?this._combined[i]:r?(0,p.stringFromCodePoint)(r):"",n>>22,2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):r]}set(i,n){this._data[3*i+1]=n[h.CHAR_DATA_ATTR_INDEX],n[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=n[1],this._data[3*i+0]=2097152|i|n[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=n[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&n}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i]:2097151&n?(0,p.stringFromCodePoint)(2097151&n):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,n){return m=3*i,n.content=this._data[m+0],n.fg=this._data[m+1],n.bg=this._data[m+2],2097152&n.content&&(n.combinedData=this._combined[i]),268435456&n.bg&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){2097152&n.content&&(this._combined[i]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[i]=n.extended),this._data[3*i+0]=n.content,this._data[3*i+1]=n.fg,this._data[3*i+2]=n.bg}setCellFromCodepoint(i,n,r,s){268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=n|r<<22,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}addCodepointToCell(i,n,r){let s=this._data[3*i+0];2097152&s?this._combined[i]+=(0,p.stringFromCodePoint)(n):2097151&s?(this._combined[i]=(0,p.stringFromCodePoint)(2097151&s)+(0,p.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,r&&(s&=-12582913,s|=r<<22),this._data[3*i+0]=s}insertCells(i,n,r){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length-i){const s=new _.CellData;for(let d=this.length-i-n-1;d>=0;--d)this.setCell(i+n+d,this.loadCell(i+d,s));for(let d=0;d<n;++d)this.setCell(i+d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(i,n,r){if(i%=this.length,n<this.length-i){const s=new _.CellData;for(let d=0;d<this.length-i-n;++d)this.setCell(i+d,this.loadCell(i+n+d,s));for(let d=this.length-n;d<this.length;++d)this.setCell(d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,r)}replaceCells(i,n,r,s=!1){if(s)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,r),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.setCell(i++,r)}resize(i,n){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<i;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);const s=Object.keys(this._combined);for(let S=0;S<s.length;S++){const b=parseInt(s[S],10);b>=i&&delete this._combined[b]}const d=Object.keys(this._extendedAttrs);for(let S=0;S<d.length;S++){const b=parseInt(d[S],10);b>=i&&delete this._extendedAttrs[b]}}return this.length=i,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,i);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(const n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(const n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){const i=new C(0);i._data=new Uint32Array(this._data),i.length=this.length;for(const n in this._combined)i._combined[n]=this._combined[n];for(const n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,n,r,s,d){const S=i._data;if(d)for(let w=s-1;w>=0;w--){for(let g=0;g<3;g++)this._data[3*(r+w)+g]=S[3*(n+w)+g];268435456&S[3*(n+w)+2]&&(this._extendedAttrs[r+w]=i._extendedAttrs[n+w])}else for(let w=0;w<s;w++){for(let g=0;g<3;g++)this._data[3*(r+w)+g]=S[3*(n+w)+g];268435456&S[3*(n+w)+2]&&(this._extendedAttrs[r+w]=i._extendedAttrs[n+w])}const b=Object.keys(i._combined);for(let w=0;w<b.length;w++){const g=parseInt(b[w],10);g>=n&&(this._combined[g-n+r]=i._combined[g])}}translateToString(i,n,r,s){n=n??0,r=r??this.length,i&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;n<r;){const S=this._data[3*n+0],b=2097151&S,w=2097152&S?this._combined[n]:b?(0,p.stringFromCodePoint)(b):h.WHITESPACE_CELL_CHAR;if(d+=w,s)for(let g=0;g<w.length;++g)s.push(n);n+=S>>22||1}return s&&s.push(n),d}}t.BufferLine=C},4841:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(o,l){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return l*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(k,t)=>{function o(l,_,h){if(_===l.length-1)return l[_].getTrimmedLength();const p=!l[_].hasContent(h-1)&&l[_].getWidth(h-1)===1,m=l[_+1].getWidth(0)===2;return p&&m?h-1:h}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(l,_,h,p,m){const C=[];for(let f=0;f<l.length-1;f++){let i=f,n=l.get(++i);if(!n.isWrapped)continue;const r=[l.get(f)];for(;i<l.length&&n.isWrapped;)r.push(n),n=l.get(++i);if(p>=f&&p<i){f+=r.length-1;continue}let s=0,d=o(r,s,_),S=1,b=0;for(;S<r.length;){const g=o(r,S,_),E=g-b,T=h-d,B=Math.min(E,T);r[s].copyCellsFrom(r[S],b,d,B,!1),d+=B,d===h&&(s++,d=0),b+=B,b===g&&(S++,b=0),d===0&&s!==0&&r[s-1].getWidth(h-1)===2&&(r[s].copyCellsFrom(r[s-1],h-1,d++,1,!1),r[s-1].setCell(h-1,m))}r[s].replaceCells(d,h,m);let w=0;for(let g=r.length-1;g>0&&(g>s||r[g].getTrimmedLength()===0);g--)w++;w>0&&(C.push(f+r.length-w),C.push(w)),f+=r.length-1}return C},t.reflowLargerCreateNewLayout=function(l,_){const h=[];let p=0,m=_[p],C=0;for(let f=0;f<l.length;f++)if(m===f){const i=_[++p];l.onDeleteEmitter.fire({index:f-C,amount:i}),f+=i-1,C+=i,m=_[++p]}else h.push(f);return{layout:h,countRemoved:C}},t.reflowLargerApplyNewLayout=function(l,_){const h=[];for(let p=0;p<_.length;p++)h.push(l.get(_[p]));for(let p=0;p<h.length;p++)l.set(p,h[p]);l.length=_.length},t.reflowSmallerGetNewLineLengths=function(l,_,h){const p=[],m=l.map((n,r)=>o(l,r,_)).reduce((n,r)=>n+r);let C=0,f=0,i=0;for(;i<m;){if(m-i<h){p.push(m-i);break}C+=h;const n=o(l,f,_);C>n&&(C-=n,f++);const r=l[f].getWidth(C-1)===2;r&&C--;const s=r?h-1:h;p.push(s),i+=s}return p},t.getWrappedLineTrimmedLength=o},5295:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const l=o(8460),_=o(844),h=o(9092);class p extends _.Disposable{constructor(C,f){super(),this._optionsService=C,this._bufferService=f,this._onBufferActivate=this.register(new l.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.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(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),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(C,f){this._normal.resize(C,f),this._alt.resize(C,f),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}t.BufferSet=p},511:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=o(482),_=o(643),h=o(3734);class p extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const f=new p;return f.setFromCharData(C),f}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(C){this.fg=C[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(C[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(C[_.CHAR_DATA_CHAR_INDEX].length===2){const i=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const n=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(i-55296)+n-56320+65536|C[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=C[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=p},643:(k,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=256|t.DEFAULT_COLOR<<9,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},4863:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const l=o(8460),_=o(844);class h{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}t.Marker=h,h._nextId=1},7116:(k,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]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(k,t)=>{var o,l,_;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
|
|
8
8
|
`,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""}(o||(t.C0=o={})),function(h){h.PAD="",h.HOP="",h.BPH="",h.NBH="",h.IND="",h.NEL="
",h.SSA="",h.ESA="",h.HTS="",h.HTJ="",h.VTS="",h.PLD="",h.PLU="",h.RI="",h.SS2="",h.SS3="",h.DCS="",h.PU1="",h.PU2="",h.STS="",h.CCH="",h.MW="",h.SPA="",h.EPA="",h.SOS="",h.SGCI="",h.SCI="",h.CSI="",h.ST="",h.OSC="",h.PM="",h.APC=""}(l||(t.C1=l={})),function(h){h.ST=`${o.ESC}\\`}(_||(t.C1_ESCAPED=_={}))},7399:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const l=o(2584),_={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(h,p,m,C){const f={type:0,cancel:!1,key:void 0},i=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?f.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?f.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?f.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(f.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:f.key=h.ctrlKey?"\b":l.C0.DEL,h.altKey&&(f.key=l.C0.ESC+f.key);break;case 9:if(h.shiftKey){f.key=l.C0.ESC+"[Z";break}f.key=l.C0.HT,f.cancel=!0;break;case 13:f.key=h.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,f.cancel=!0;break;case 27:f.key=l.C0.ESC,h.altKey&&(f.key=l.C0.ESC+l.C0.ESC),f.cancel=!0;break;case 37:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"D",f.key===l.C0.ESC+"[1;3D"&&(f.key=l.C0.ESC+(m?"b":"[1;5D"))):f.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"C",f.key===l.C0.ESC+"[1;3C"&&(f.key=l.C0.ESC+(m?"f":"[1;5C"))):f.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"A",m||f.key!==l.C0.ESC+"[1;3A"||(f.key=l.C0.ESC+"[1;5A")):f.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"B",m||f.key!==l.C0.ESC+"[1;3B"||(f.key=l.C0.ESC+"[1;5B")):f.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(f.key=l.C0.ESC+"[2~");break;case 46:f.key=i?l.C0.ESC+"[3;"+(i+1)+"~":l.C0.ESC+"[3~";break;case 36:f.key=i?l.C0.ESC+"[1;"+(i+1)+"H":p?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:f.key=i?l.C0.ESC+"[1;"+(i+1)+"F":p?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:h.shiftKey?f.type=2:h.ctrlKey?f.key=l.C0.ESC+"[5;"+(i+1)+"~":f.key=l.C0.ESC+"[5~";break;case 34:h.shiftKey?f.type=3:h.ctrlKey?f.key=l.C0.ESC+"[6;"+(i+1)+"~":f.key=l.C0.ESC+"[6~";break;case 112:f.key=i?l.C0.ESC+"[1;"+(i+1)+"P":l.C0.ESC+"OP";break;case 113:f.key=i?l.C0.ESC+"[1;"+(i+1)+"Q":l.C0.ESC+"OQ";break;case 114:f.key=i?l.C0.ESC+"[1;"+(i+1)+"R":l.C0.ESC+"OR";break;case 115:f.key=i?l.C0.ESC+"[1;"+(i+1)+"S":l.C0.ESC+"OS";break;case 116:f.key=i?l.C0.ESC+"[15;"+(i+1)+"~":l.C0.ESC+"[15~";break;case 117:f.key=i?l.C0.ESC+"[17;"+(i+1)+"~":l.C0.ESC+"[17~";break;case 118:f.key=i?l.C0.ESC+"[18;"+(i+1)+"~":l.C0.ESC+"[18~";break;case 119:f.key=i?l.C0.ESC+"[19;"+(i+1)+"~":l.C0.ESC+"[19~";break;case 120:f.key=i?l.C0.ESC+"[20;"+(i+1)+"~":l.C0.ESC+"[20~";break;case 121:f.key=i?l.C0.ESC+"[21;"+(i+1)+"~":l.C0.ESC+"[21~";break;case 122:f.key=i?l.C0.ESC+"[23;"+(i+1)+"~":l.C0.ESC+"[23~";break;case 123:f.key=i?l.C0.ESC+"[24;"+(i+1)+"~":l.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(m&&!C||!h.altKey||h.metaKey)!m||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?f.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(f.key=l.C0.US),h.key==="@"&&(f.key=l.C0.NUL)):h.keyCode===65&&(f.type=1);else{const n=_[h.keyCode],r=n==null?void 0:n[h.shiftKey?1:0];if(r)f.key=l.C0.ESC+r;else if(h.keyCode>=65&&h.keyCode<=90){const s=h.ctrlKey?h.keyCode-64:h.keyCode+32;let d=String.fromCharCode(s);h.shiftKey&&(d=d.toUpperCase()),f.key=l.C0.ESC+d}else if(h.keyCode===32)f.key=l.C0.ESC+(h.ctrlKey?l.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let s=h.code.slice(3,4);h.shiftKey||(s=s.toLowerCase()),f.key=l.C0.ESC+s,f.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?f.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?f.key=l.C0.NUL:h.keyCode>=51&&h.keyCode<=55?f.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?f.key=l.C0.DEL:h.keyCode===219?f.key=l.C0.ESC:h.keyCode===220?f.key=l.C0.FS:h.keyCode===221&&(f.key=l.C0.GS)}return f}},482:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=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,l=0,_=o.length){let h="";for(let p=l;p<_;++p){let m=o[p];m>65535?(m-=65536,h+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):h+=String.fromCharCode(m)}return h},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,l){const _=o.length;if(!_)return 0;let h=0,p=0;if(this._interim){const m=o.charCodeAt(p++);56320<=m&&m<=57343?l[h++]=1024*(this._interim-55296)+m-56320+65536:(l[h++]=this._interim,l[h++]=m),this._interim=0}for(let m=p;m<_;++m){const C=o.charCodeAt(m);if(55296<=C&&C<=56319){if(++m>=_)return this._interim=C,h;const f=o.charCodeAt(m);56320<=f&&f<=57343?l[h++]=1024*(C-55296)+f-56320+65536:(l[h++]=C,l[h++]=f)}else C!==65279&&(l[h++]=C)}return h}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,l){const _=o.length;if(!_)return 0;let h,p,m,C,f=0,i=0,n=0;if(this.interim[0]){let d=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,w=0;for(;(b=63&this.interim[++w])&&w<4;)S<<=6,S|=b;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=g-w;for(;n<E;){if(n>=_)return 0;if(b=o[n++],(192&b)!=128){n--,d=!0;break}this.interim[w++]=b,S<<=6,S|=63&b}d||(g===2?S<128?n--:l[f++]=S:g===3?S<2048||S>=55296&&S<=57343||S===65279||(l[f++]=S):S<65536||S>1114111||(l[f++]=S)),this.interim.fill(0)}const r=_-4;let s=n;for(;s<_;){for(;!(!(s<r)||128&(h=o[s])||128&(p=o[s+1])||128&(m=o[s+2])||128&(C=o[s+3]));)l[f++]=h,l[f++]=p,l[f++]=m,l[f++]=C,s+=4;if(h=o[s++],h<128)l[f++]=h;else if((224&h)==192){if(s>=_)return this.interim[0]=h,f;if(p=o[s++],(192&p)!=128){s--;continue}if(i=(31&h)<<6|63&p,i<128){s--;continue}l[f++]=i}else if((240&h)==224){if(s>=_)return this.interim[0]=h,f;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=_)return this.interim[0]=h,this.interim[1]=p,f;if(m=o[s++],(192&m)!=128){s--;continue}if(i=(15&h)<<12|(63&p)<<6|63&m,i<2048||i>=55296&&i<=57343||i===65279)continue;l[f++]=i}else if((248&h)==240){if(s>=_)return this.interim[0]=h,f;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=_)return this.interim[0]=h,this.interim[1]=p,f;if(m=o[s++],(192&m)!=128){s--;continue}if(s>=_)return this.interim[0]=h,this.interim[1]=p,this.interim[2]=m,f;if(C=o[s++],(192&C)!=128){s--;continue}if(i=(7&h)<<18|(63&p)<<12|(63&m)<<6|63&C,i<65536||i>1114111)continue;l[f++]=i}}return f}}},225:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const l=o(1480),_=[[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]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;t.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let m=0;m<_.length;++m)p.fill(0,_[m][0],_[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?p[m]:function(C,f){let i,n=0,r=f.length-1;if(C<f[0][0]||C>f[r][1])return!1;for(;r>=n;)if(i=n+r>>1,C>f[i][1])n=i+1;else{if(!(C<f[i][0]))return!0;r=i-1}return!1}(m,h)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,C){let f=this.wcwidth(m),i=f===0&&C!==0;if(i){const n=l.UnicodeService.extractWidth(C);n===0?i=!1:n>f&&(f=n)}return l.UnicodeService.createPropertyValue(0,f,i)}}},5981:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const l=o(8460),_=o(844);class h extends _.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let f;for(this._isSyncWriting=!0;f=this._writeBuffer.shift();){this._action(f);const i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,C){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(C),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(C)}_innerWrite(m=0,C=!0){const f=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const i=this._writeBuffer[this._bufferOffset],n=this._action(i,C);if(n){const s=d=>Date.now()-f>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(f,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-f>=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=h},5941:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const 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})$/,l=/^[\da-f]+$/;function _(h,p){const m=h.toString(16),C=m.length<2?"0"+m:m;switch(p){case 4:return m[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}t.parseColor=function(h){if(!h)return;let p=h.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const m=o.exec(p);if(m){const C=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/C*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/C*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/C*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),l.exec(p)&&[3,6,9,12].includes(p.length))){const m=p.length/3,C=[0,0,0];for(let f=0;f<3;++f){const i=parseInt(p.slice(m*f,m*f+m),16);C[f]=m===1?i<<4:m===2?i:m===3?i>>4:i>>8}return C}},t.toRgbString=function(h,p=16){const[m,C,f]=h;return`rgb:${_(m,p)}/${_(C,p)}/${_(f,p)}`}},5770:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const l=o(482),_=o(8742),h=o(5770),p=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(C,f){this._handlers[C]===void 0&&(this._handlers[C]=[]);const i=this._handlers[C];return i.push(f),{dispose:()=>{const n=i.indexOf(f);n!==-1&&i.splice(n,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(C,f){if(this.reset(),this._ident=C,this._active=this._handlers[C]||p,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(f);else this._handlerFb(this._ident,"HOOK",f)}put(C,f,i){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(C,f,i);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(C,f,i))}unhook(C,f=!0){if(this._active.length){let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=f,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(C),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",C);this._active=p,this._ident=0}};const m=new _.Params;m.addParam(0),t.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=m,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():m,this._data="",this._hitLimit=!1}put(C,f,i){this._hitLimit||(this._data+=(0,l.utf32ToString)(C,f,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let f=!1;if(this._hitLimit)f=!1;else if(C&&(f=this._handler(this._data,this._params),f instanceof Promise))return f.then(i=>(this._params=m,this._data="",this._hitLimit=!1,i));return this._params=m,this._data="",this._hitLimit=!1,f}}},2015:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const l=o(844),_=o(8742),h=o(6242),p=o(6351);class m{constructor(n){this.table=new Uint8Array(n)}setDefault(n,r){this.table.fill(n<<4|r)}add(n,r,s,d){this.table[r<<8|n]=s<<4|d}addMany(n,r,s,d){for(let S=0;S<n.length;S++)this.table[r<<8|n[S]]=s<<4|d}}t.TransitionTable=m;const C=160;t.VT500_TRANSITION_TABLE=function(){const i=new m(4095),n=Array.apply(null,Array(256)).map((w,g)=>g),r=(w,g)=>n.slice(w,g),s=r(32,127),d=r(0,24);d.push(25),d.push.apply(d,r(28,32));const S=r(0,14);let b;for(b in i.setDefault(1,0),i.addMany(s,0,2,0),S)i.addMany([24,26,153,154],b,3,0),i.addMany(r(128,144),b,3,0),i.addMany(r(144,152),b,3,0),i.add(156,b,0,0),i.add(27,b,11,1),i.add(157,b,4,8),i.addMany([152,158,159],b,0,7),i.add(155,b,11,3),i.add(144,b,11,9);return i.addMany(d,0,3,0),i.addMany(d,1,3,1),i.add(127,1,0,1),i.addMany(d,8,0,8),i.addMany(d,3,3,3),i.add(127,3,0,3),i.addMany(d,4,3,4),i.add(127,4,0,4),i.addMany(d,6,3,6),i.addMany(d,5,3,5),i.add(127,5,0,5),i.addMany(d,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(r(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(d,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(r(64,127),3,7,0),i.addMany(r(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(r(48,60),4,8,4),i.addMany(r(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(r(32,64),6,0,6),i.add(127,6,0,6),i.addMany(r(64,127),6,0,0),i.addMany(r(32,48),3,9,5),i.addMany(r(32,48),5,9,5),i.addMany(r(48,64),5,0,6),i.addMany(r(64,127),5,7,0),i.addMany(r(32,48),4,9,5),i.addMany(r(32,48),1,9,2),i.addMany(r(32,48),2,9,2),i.addMany(r(48,127),2,10,0),i.addMany(r(48,80),1,10,0),i.addMany(r(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(r(96,127),1,10,0),i.add(80,1,11,9),i.addMany(d,9,0,9),i.add(127,9,0,9),i.addMany(r(28,32),9,0,9),i.addMany(r(32,48),9,9,12),i.addMany(r(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(d,11,0,11),i.addMany(r(32,128),11,0,11),i.addMany(r(28,32),11,0,11),i.addMany(d,10,0,10),i.add(127,10,0,10),i.addMany(r(28,32),10,0,10),i.addMany(r(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(r(32,48),10,9,12),i.addMany(d,12,0,12),i.add(127,12,0,12),i.addMany(r(28,32),12,0,12),i.addMany(r(32,48),12,9,12),i.addMany(r(48,64),12,0,11),i.addMany(r(64,127),12,12,13),i.addMany(r(64,127),10,12,13),i.addMany(r(64,127),9,12,13),i.addMany(d,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(C,0,2,0),i.add(C,8,5,8),i.add(C,6,0,6),i.add(C,11,0,11),i.add(C,13,13,13),i}();class f extends l.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,s,d)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,s)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,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 h.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,r=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<n.intermediates.length;++S){const b=n.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=b}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(r[0]>d||d>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return s<<=8,s|=d,s}identToString(n){const r=[];for(;n;)r.push(String.fromCharCode(255&n)),n>>=8;return r.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,r){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(r),{dispose:()=>{const S=d.indexOf(r);S!==-1&&d.splice(S,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,r){this._executeHandlers[n.charCodeAt(0)]=r}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,r){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(r),{dispose:()=>{const S=d.indexOf(r);S!==-1&&d.splice(S,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,r){return this._dcsParser.registerHandler(this._identifier(n),r)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,r){return this._oscParser.registerHandler(n,r)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,r,s,d,S){this._parseStack.state=n,this._parseStack.handlers=r,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=S}parse(n,r,s){let d,S=0,b=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 6:if(S=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(S!==24&&S!==26,s),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=n[this._parseStack.chunkPos],d=this._oscParser.end(S!==24&&S!==26,s),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let g=w;g<r;++g){switch(S=n[g],b=this._transitions.table[this.currentState<<8|(S<160?S:C)],b>>4){case 2:for(let D=g+1;;++D){if(D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|S];let T=E?E.length-1:-1;for(;T>=0&&(d=E[T](this._params),d!==!0);T--)if(d instanceof Promise)return this._preserveStack(3,E,T,b,g),d;T<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++g<r&&(S=n[g])>47&&S<60);g--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const B=this._escHandlers[this._collect<<8|S];let O=B?B.length-1:-1;for(;O>=0&&(d=B[O](),d!==!0);O--)if(d instanceof Promise)return this._preserveStack(4,B,O,b,g),d;O<0&&this._escHandlerFb(this._collect<<8|S),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|S,this._params);break;case 13:for(let D=g+1;;++D)if(D>=r||(S=n[D])===24||S===26||S===27||S>127&&S<C){this._dcsParser.put(n,g,D),g=D-1;break}break;case 14:if(d=this._dcsParser.unhook(S!==24&&S!==26),d)return this._preserveStack(6,[],0,b,g),d;S===27&&(b|=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 D=g+1;;D++)if(D>=r||(S=n[D])<32||S>127&&S<C){this._oscParser.put(n,g,D),g=D-1;break}break;case 6:if(d=this._oscParser.end(S!==24&&S!==26),d)return this._preserveStack(5,[],0,b,g),d;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}t.EscapeSequenceParser=f},6242:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const l=o(5770),_=o(482),h=[];t.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,m){this._handlers[p]===void 0&&(this._handlers[p]=[]);const C=this._handlers[p];return C.push(m),{dispose:()=>{const f=C.indexOf(m);f!==-1&&C.splice(f,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,m,C){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(p,m,C);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,m,C))}start(){this.reset(),this._state=1}put(p,m,C){if(this._state!==3){if(this._state===1)for(;m<C;){const f=p[m++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&C-m>0&&this._put(p,m,C)}}end(p,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,f=this._active.length-1,i=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,C=m,i=this._stack.fallThrough,this._stack.paused=!1),!i&&C===!1){for(;f>=0&&(C=this._active[f].end(p),C!==!0);f--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,C;f--}for(;f>=0;f--)if(C=this._active[f].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",p);this._active=h,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,m,C){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,m,C),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let m=!1;if(this._hitLimit)m=!1;else if(p&&(m=this._handler(this._data),m instanceof Promise))return m.then(C=>(this._data="",this._hitLimit=!1,C));return this._data="",this._hitLimit=!1,m}}},8742:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const o=2147483647;class l{static fromArray(h){const p=new l;if(!h.length)return p;for(let m=Array.isArray(h[0])?1:0;m<h.length;++m){const C=h[m];if(Array.isArray(C))for(let f=0;f<C.length;++f)p.addSubParam(C[f]);else p.addParam(C)}return p}constructor(h=32,p=32){if(this.maxLength=h,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new l(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let p=0;p<this.length;++p){h.push(this.params[p]);const m=this._subParamsIdx[p]>>8,C=255&this._subParamsIdx[p];C-m>0&&h.push(Array.prototype.slice.call(this._subParams,m,C))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>o?o:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>o?o:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const p=this._subParamsIdx[h]>>8,m=255&this._subParamsIdx[h];return m-p>0?this._subParams.subarray(p,m):null}getSubParamsAll(){const h={};for(let p=0;p<this.length;++p){const m=this._subParamsIdx[p]>>8,C=255&this._subParamsIdx[p];C-m>0&&(h[p]=this._subParams.slice(m,C))}return h}addDigit(h){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const m=this._digitIsSub?this._subParams:this.params,C=m[p-1];m[p-1]=~C?Math.min(10*C+h,o):h}}t.Params=l},5741:(k,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,l){const _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===o){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(l,1)}}},8771:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const l=o(3785),_=o(511);t.BufferApiView=class{constructor(h,p){this._buffer=h,this.type=p}init(h){return this._buffer=h,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(h){const p=this._buffer.lines.get(h);if(p)return new l.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},3785:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const l=o(511);t.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new l.CellData)}translateToString(_,h,p){return this._line.translateToString(_,h,p)}}},8285:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const l=o(8771),_=o(8460),h=o(844);class p extends h.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new _.EventEmitter),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 new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=p},7975:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,l){return this._core.registerCsiHandler(o,_=>l(_.toArray()))}addCsiHandler(o,l){return this.registerCsiHandler(o,l)}registerDcsHandler(o,l){return this._core.registerDcsHandler(o,(_,h)=>l(_,h.toArray()))}addDcsHandler(o,l){return this.registerDcsHandler(o,l)}registerEscHandler(o,l){return this._core.registerEscHandler(o,l)}addEscHandler(o,l){return this.registerEscHandler(o,l)}registerOscHandler(o,l){return this._core.registerOscHandler(o,l)}addOscHandler(o,l){return this.registerOscHandler(o,l)}}},7090:(k,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}}},744:function(k,t,o){var l=this&&this.__decorate||function(i,n,r,s){var d,S=arguments.length,b=S<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,n,r,s);else for(var w=i.length-1;w>=0;w--)(d=i[w])&&(b=(S<3?d(b):S>3?d(n,r,b):d(n,r))||b);return S>3&&b&&Object.defineProperty(n,r,b),b},_=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const h=o(8460),p=o(844),m=o(5295),C=o(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let f=t.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),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 m.BufferSet(i,this))}resize(i,n){this.cols=i,this.rows=n,this.buffers.resize(i,n),this._onResize.fire({cols:i,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,n=!1){const r=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===i.fg&&s.getBg(0)===i.bg||(s=r.getBlankLine(i,n),this._cachedBlankLine=s),s.isWrapped=n;const d=r.ybase+r.scrollTop,S=r.ybase+r.scrollBottom;if(r.scrollTop===0){const b=r.lines.isFull;S===r.lines.length-1?b?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(S+1,0,s.clone()),b?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const b=S-d+1;r.lines.shiftElements(d+1,b-1,-1),r.lines.set(S,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(i,n,r){const s=this.buffer;if(i<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else i+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),d!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};t.BufferService=f=l([_(0,C.IOptionsService)],f)},7994:(k,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,l){this._charsets[o]=l,this.glevel===o&&(this.charset=l)}}},1753:function(k,t,o){var l=this&&this.__decorate||function(s,d,S,b){var w,g=arguments.length,E=g<3?d:b===null?b=Object.getOwnPropertyDescriptor(d,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,S,b);else for(var T=s.length-1;T>=0;T--)(w=s[T])&&(E=(g<3?w(E):g>3?w(d,S,E):w(d,S))||E);return g>3&&E&&Object.defineProperty(d,S,E),E},_=this&&this.__param||function(s,d){return function(S,b){d(S,b,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const h=o(2585),p=o(8460),m=o(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function f(s,d){let S=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(S|=64,S|=s.action):(S|=3&s.button,4&s.button&&(S|=64),8&s.button&&(S|=128),s.action===32?S|=32:s.action!==0||d||(S|=3)),S}const i=String.fromCharCode,n={DEFAULT:s=>{const d=[f(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${i(d[0])}${i(d[1])}${i(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${f(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${f(s,!0)};${s.x};${s.y}${d}`}};let r=t.CoreMouseService=class extends m.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const S of Object.keys(C))this.addProtocol(S,C[S]);for(const S of Object.keys(n))this.addEncoding(S,n[S]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,S){if(S){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=r=l([_(0,h.IBufferService),_(1,h.ICoreService)],r)},6975:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const h=o(1439),p=o(8460),m=o(844),C=o(2585),f=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=t.CoreService=class extends m.Disposable{constructor(r,s,d){super(),this._bufferService=r,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(i)}reset(){this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(i)}triggerDataEvent(r,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,()=>r.split("").map(S=>S.charCodeAt(0))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,()=>r.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(r))}};t.CoreService=n=l([_(0,C.IBufferService),_(1,C.ILogService),_(2,C.IOptionsService)],n)},9074:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const l=o(8055),_=o(8460),h=o(844),p=o(6106);let m=0,C=0;class f extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList(r=>r==null?void 0:r.marker.line),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)(()=>this.reset()))}registerDecoration(r){if(r.marker.isDisposed)return;const s=new i(r);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const r of this._decorations.values())r.dispose();this._decorations.clear()}*getDecorationsAtCell(r,s,d){let S=0,b=0;for(const w of this._decorations.getKeyIterator(s))S=w.options.x??0,b=S+(w.options.width??1),r>=S&&r<b&&(!d||(w.options.layer??"bottom")===d)&&(yield w)}forEachDecorationAtCell(r,s,d,S){this._decorations.forEachByKey(s,b=>{m=b.options.x??0,C=m+(b.options.width??1),r>=m&&r<C&&(!d||(b.options.layer??"bottom")===d)&&S(b)})}}t.DecorationService=f;class i extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(r){super(),this.options=r,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=r.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const l=o(2585),_=o(8343);class h{constructor(...m){this._entries=new Map;for(const[C,f]of m)this.set(C,f)}set(m,C){const f=this._entries.get(m);return this._entries.set(m,C),f}forEach(m){for(const[C,f]of this._entries.entries())m(C,f)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}t.ServiceCollection=h,t.InstantiationService=class{constructor(){this._services=new h,this._services.set(l.IInstantiationService,this)}setService(p,m){this._services.set(p,m)}getService(p){return this._services.get(p)}createInstance(p,...m){const C=(0,_.getServiceDependencies)(p).sort((n,r)=>n.index-r.index),f=[];for(const n of C){const r=this._services.get(n.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${n.id}.`);f.push(r)}const i=C.length>0?C[0].index:m.length;if(m.length!==i)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${i+1} conflicts with ${m.length} static arguments`);return new p(...m,...f)}}},7866:function(k,t,o){var l=this&&this.__decorate||function(i,n,r,s){var d,S=arguments.length,b=S<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,n,r,s);else for(var w=i.length-1;w>=0;w--)(d=i[w])&&(b=(S<3?d(b):S>3?d(n,r,b):d(n,r))||b);return S>3&&b&&Object.defineProperty(n,r,b),b},_=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const h=o(844),p=o(2585),m={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let C,f=t.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let n=0;n<i.length;n++)typeof i[n]=="function"&&(i[n]=i[n]())}_log(i,n,r){this._evalLazyOptionalParams(r),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...r)}trace(i,...n){var r;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,i,n)}debug(i,...n){var r;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,i,n)}info(i,...n){var r;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,i,n)}warn(i,...n){var r;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,i,n)}error(i,...n){var r;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,i,n)}};t.LogService=f=l([_(0,p.IOptionsService)],f),t.setTraceLogger=function(i){C=i},t.traceCall=function(i,n,r){if(typeof r.value!="function")throw new Error("not supported");const s=r.value;r.value=function(...d){if(C.logLevel!==p.LogLevelEnum.TRACE)return s.apply(this,d);C.trace(`GlyphRenderer#${s.name}(${d.map(b=>JSON.stringify(b)).join(", ")})`);const S=s.apply(this,d);return C.trace(`GlyphRenderer#${s.name} return`,S),S}}},7302:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const l=o(8460),_=o(844),h=o(6114);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:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends _.Disposable{constructor(f){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const n in f)if(n in i)try{const r=f[n];i[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,_.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(f,i){return this.onOptionChange(n=>{n===f&&i(this.rawOptions[f])})}onMultipleOptionChange(f,i){return this.onOptionChange(n=>{f.indexOf(n)!==-1&&i()})}_setupOptions(){const f=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,r)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const r={get:f.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(f,i){switch(f){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[f]),!function(n){return n==="block"||n==="underline"||n==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${f}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[f]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=p.includes(i)?i:t.DEFAULT_OPTIONS[f];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${f} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${f} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${f} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${f} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=m},2660:function(k,t,o){var l=this&&this.__decorate||function(m,C,f,i){var n,r=arguments.length,s=r<3?C:i===null?i=Object.getOwnPropertyDescriptor(C,f):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(m,C,f,i);else for(var d=m.length-1;d>=0;d--)(n=m[d])&&(s=(r<3?n(s):r>3?n(C,f,s):n(C,f))||s);return r>3&&s&&Object.defineProperty(C,f,s),s},_=this&&this.__param||function(m,C){return function(f,i){C(f,i,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const h=o(2585);let p=t.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){const C=this._bufferService.buffer;if(m.id===void 0){const d=C.addMarker(C.ybase+C.y),S={data:m,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(S,d)),this._dataByLinkId.set(S.id,S),S.id}const f=m,i=this._getEntryIdKey(f),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,C.ybase+C.y),n.id;const r=C.addMarker(C.ybase+C.y),s={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(s,r)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(m,C){const f=this._dataByLinkId.get(m);if(f&&f.lines.every(i=>i.line!==C)){const i=this._bufferService.buffer.addMarker(C);f.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(f,i))}}getLinkData(m){var C;return(C=this._dataByLinkId.get(m))==null?void 0:C.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,C){const f=m.lines.indexOf(C);f!==-1&&(m.lines.splice(f,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};t.OscLinkService=p=l([_(0,h.IBufferService)],p)},8343:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const o="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(_){return _[l]||[]},t.createDecorator=function(_){if(t.serviceRegistry.has(_))return t.serviceRegistry.get(_);const h=function(p,m,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,i,n){i[o]===i?i[l].push({id:f,index:n}):(i[l]=[{id:f,index:n}],i[o]=i)})(h,p,C)};return h.toString=()=>_,t.serviceRegistry.set(_,h),h}},2585:(k,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;const l=o(8343);var _;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(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"}(_||(t.LogLevelEnum=_={})),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")},1480:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const l=o(8460),_=o(225);class h{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,C,f=!1){return(16777215&m)<<3|(3&C)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const m=new _.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let C=0,f=0;const i=m.length;for(let n=0;n<i;++n){let r=m.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return C+this.wcwidth(r);const S=m.charCodeAt(n);56320<=S&&S<=57343?r=1024*(r-55296)+S-56320+65536:C+=this.wcwidth(S)}const s=this.charProperties(r,f);let d=h.extractWidth(s);h.extractShouldJoin(s)&&(d-=h.extractWidth(f)),C+=d,f=s}return C}charProperties(m,C){return this._activeProvider.charProperties(m,C)}}t.UnicodeService=h}},u={};function v(k){var t=u[k];if(t!==void 0)return t.exports;var o=u[k]={exports:{}};return a[k].call(o.exports,o,o.exports,v),o.exports}var y={};return(()=>{var k=y;Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;const t=v(9042),o=v(3236),l=v(844),_=v(5741),h=v(8285),p=v(7975),m=v(7090),C=["cols","rows"];class f extends l.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const r=d=>this._core.options[d],s=(d,S)=>{this._checkReadonlyOptions(d),this._core.options[d]=S};for(const d in this._core.options){const S={get:r.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,S)}}_checkReadonlyOptions(n){if(C.includes(n))throw new Error(`Option "${n}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let r="none";switch(this._core.coreMouseService.activeProtocol){case"X10":r="x10";break;case"VT200":r="vt200";break;case"DRAG":r="drag";break;case"ANY":r="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const r in n)this._publicOptions[r]=n[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,r=!0){this._core.input(n,r)}resize(n,r){this._verifyIntegers(n,r),this._core.resize(n,r)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,r,s){this._verifyIntegers(n,r,s),this._core.select(n,r,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,r){this._verifyIntegers(n,r),this._core.selectLines(n,r)}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,r){this._core.write(n,r)}writeln(n,r){this._core.write(n),this._core.write(`\r
|
|
9
|
-
`,r)}paste(n){this._core.paste(n)}refresh(n,r){this._verifyIntegers(n,r),this._core.refresh(n,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const r of n)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const r of n)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}k.Terminal=f})(),y})())}(Mt)),Mt.exports}var Hs=Ps(),ne;(function(c){c.assertEqual=v=>v;function e(v){}c.assertIs=e;function a(v){throw new Error}c.assertNever=a,c.arrayToEnum=v=>{const y={};for(const k of v)y[k]=k;return y},c.getValidEnumValues=v=>{const y=c.objectKeys(v).filter(t=>typeof v[v[t]]!="number"),k={};for(const t of y)k[t]=v[t];return c.objectValues(k)},c.objectValues=v=>c.objectKeys(v).map(function(y){return v[y]}),c.objectKeys=typeof Object.keys=="function"?v=>Object.keys(v):v=>{const y=[];for(const k in v)Object.prototype.hasOwnProperty.call(v,k)&&y.push(k);return y},c.find=(v,y)=>{for(const k of v)if(y(k))return k},c.isInteger=typeof Number.isInteger=="function"?v=>Number.isInteger(v):v=>typeof v=="number"&&isFinite(v)&&Math.floor(v)===v;function u(v,y=" | "){return v.map(k=>typeof k=="string"?`'${k}'`:k).join(y)}c.joinValues=u,c.jsonStringifyReplacer=(v,y)=>typeof y=="bigint"?y.toString():y})(ne||(ne={}));var Ht;(function(c){c.mergeShapes=(e,a)=>({...e,...a})})(Ht||(Ht={}));const K=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ke=c=>{switch(typeof c){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(c)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(c)?K.array:c===null?K.null:c.then&&typeof c.then=="function"&&c.catch&&typeof c.catch=="function"?K.promise:typeof Map<"u"&&c instanceof Map?K.map:typeof Set<"u"&&c instanceof Set?K.set:typeof Date<"u"&&c instanceof Date?K.date:K.object;default:return K.unknown}},j=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Fs=c=>JSON.stringify(c,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=u=>{this.issues=[...this.issues,u]},this.addIssues=(u=[])=>{this.issues=[...this.issues,...u]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(y){return y.message},u={_errors:[]},v=y=>{for(const k of y.issues)if(k.code==="invalid_union")k.unionErrors.map(v);else if(k.code==="invalid_return_type")v(k.returnTypeError);else if(k.code==="invalid_arguments")v(k.argumentsError);else if(k.path.length===0)u._errors.push(a(k));else{let t=u,o=0;for(;o<k.path.length;){const l=k.path[o];o===k.path.length-1?(t[l]=t[l]||{_errors:[]},t[l]._errors.push(a(k))):t[l]=t[l]||{_errors:[]},t=t[l],o++}}};return v(this),u}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},u=[];for(const v of this.issues)v.path.length>0?(a[v.path[0]]=a[v.path[0]]||[],a[v.path[0]].push(e(v))):u.push(e(v));return{formErrors:u,fieldErrors:a}}get formErrors(){return this.flatten()}}fe.create=c=>new fe(c);const je=(c,e)=>{let a;switch(c.code){case j.invalid_type:c.received===K.undefined?a="Required":a=`Expected ${c.expected}, received ${c.received}`;break;case j.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(c.expected,ne.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:a=`Unrecognized key(s) in object: ${ne.joinValues(c.keys,", ")}`;break;case j.invalid_union:a="Invalid input";break;case j.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ne.joinValues(c.options)}`;break;case j.invalid_enum_value:a=`Invalid enum value. Expected ${ne.joinValues(c.options)}, received '${c.received}'`;break;case j.invalid_arguments:a="Invalid function arguments";break;case j.invalid_return_type:a="Invalid function return type";break;case j.invalid_date:a="Invalid date";break;case j.invalid_string:typeof c.validation=="object"?"includes"in c.validation?(a=`Invalid input: must include "${c.validation.includes}"`,typeof c.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${c.validation.position}`)):"startsWith"in c.validation?a=`Invalid input: must start with "${c.validation.startsWith}"`:"endsWith"in c.validation?a=`Invalid input: must end with "${c.validation.endsWith}"`:ne.assertNever(c.validation):c.validation!=="regex"?a=`Invalid ${c.validation}`:a="Invalid";break;case j.too_small:c.type==="array"?a=`Array must contain ${c.exact?"exactly":c.inclusive?"at least":"more than"} ${c.minimum} element(s)`:c.type==="string"?a=`String must contain ${c.exact?"exactly":c.inclusive?"at least":"over"} ${c.minimum} character(s)`:c.type==="number"?a=`Number must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${c.minimum}`:c.type==="date"?a=`Date must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(c.minimum))}`:a="Invalid input";break;case j.too_big:c.type==="array"?a=`Array must contain ${c.exact?"exactly":c.inclusive?"at most":"less than"} ${c.maximum} element(s)`:c.type==="string"?a=`String must contain ${c.exact?"exactly":c.inclusive?"at most":"under"} ${c.maximum} character(s)`:c.type==="number"?a=`Number must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="bigint"?a=`BigInt must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="date"?a=`Date must be ${c.exact?"exactly":c.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(c.maximum))}`:a="Invalid input";break;case j.custom:a="Invalid input";break;case j.invalid_intersection_types:a="Intersection results could not be merged";break;case j.not_multiple_of:a=`Number must be a multiple of ${c.multipleOf}`;break;case j.not_finite:a="Number must be finite";break;default:a=e.defaultError,ne.assertNever(c)}return{message:a}};let Er=je;function Ns(c){Er=c}function vt(){return Er}const bt=c=>{const{data:e,path:a,errorMaps:u,issueData:v}=c,y=[...a,...v.path||[]],k={...v,path:y};if(v.message!==void 0)return{...v,path:y,message:v.message};let t="";const o=u.filter(l=>!!l).slice().reverse();for(const l of o)t=l(k,{data:e,defaultError:t}).message;return{...v,path:y,message:t}},Ws=[];function q(c,e){const a=vt(),u=bt({issueData:e,data:c.data,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,a,a===je?void 0:je].filter(v=>!!v)});c.common.issues.push(u)}class le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const u=[];for(const v of a){if(v.status==="aborted")return Q;v.status==="dirty"&&e.dirty(),u.push(v.value)}return{status:e.value,value:u}}static async mergeObjectAsync(e,a){const u=[];for(const v of a){const y=await v.key,k=await v.value;u.push({key:y,value:k})}return le.mergeObjectSync(e,u)}static mergeObjectSync(e,a){const u={};for(const v of a){const{key:y,value:k}=v;if(y.status==="aborted"||k.status==="aborted")return Q;y.status==="dirty"&&e.dirty(),k.status==="dirty"&&e.dirty(),y.value!=="__proto__"&&(typeof k.value<"u"||v.alwaysSet)&&(u[y.value]=k.value)}return{status:e.value,value:u}}}const Q=Object.freeze({status:"aborted"}),Ne=c=>({status:"dirty",value:c}),de=c=>({status:"valid",value:c}),Ft=c=>c.status==="aborted",Nt=c=>c.status==="dirty",Ie=c=>c.status==="valid",Xe=c=>typeof Promise<"u"&&c instanceof Promise;function St(c,e,a,u){if(typeof e=="function"?c!==e||!0:!e.has(c))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(c)}function xr(c,e,a,u,v){if(typeof e=="function"?c!==e||!0:!e.has(c))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(c,a),a}var J;(function(c){c.errToObj=e=>typeof e=="string"?{message:e}:e||{},c.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(J||(J={}));var Ge,Je;class Ce{constructor(e,a,u,v){this._cachedPath=[],this.parent=e,this.data=a,this._path=u,this._key=v}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const er=(c,e)=>{if(Ie(e))return{success:!0,data:e.value};if(!c.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new fe(c.common.issues);return this._error=a,this._error}}};function re(c){if(!c)return{};const{errorMap:e,invalid_type_error:a,required_error:u,description:v}=c;if(e&&(a||u))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:v}:{errorMap:(k,t)=>{var o,l;const{message:_}=c;return k.code==="invalid_enum_value"?{message:_??t.defaultError}:typeof t.data>"u"?{message:(o=_??u)!==null&&o!==void 0?o:t.defaultError}:k.code!=="invalid_type"?{message:t.defaultError}:{message:(l=_??a)!==null&&l!==void 0?l:t.defaultError}},description:v}}class se{get description(){return this._def.description}_getType(e){return ke(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:ke(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:ke(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Xe(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const u=this.safeParse(e,a);if(u.success)return u.data;throw u.error}safeParse(e,a){var u;const v={common:{issues:[],async:(u=a==null?void 0:a.async)!==null&&u!==void 0?u:!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)},y=this._parseSync({data:e,path:v.path,parent:v});return er(v,y)}"~validate"(e){var a,u;const v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)};if(!this["~standard"].async)try{const y=this._parseSync({data:e,path:[],parent:v});return Ie(y)?{value:y.value}:{issues:v.common.issues}}catch(y){!((u=(a=y==null?void 0:y.message)===null||a===void 0?void 0:a.toLowerCase())===null||u===void 0)&&u.includes("encountered")&&(this["~standard"].async=!0),v.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:v}).then(y=>Ie(y)?{value:y.value}:{issues:v.common.issues})}async parseAsync(e,a){const u=await this.safeParseAsync(e,a);if(u.success)return u.data;throw u.error}async safeParseAsync(e,a){const u={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)},v=this._parse({data:e,path:u.path,parent:u}),y=await(Xe(v)?v:Promise.resolve(v));return er(u,y)}refine(e,a){const u=v=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(v):a;return this._refinement((v,y)=>{const k=e(v),t=()=>y.addIssue({code:j.custom,...u(v)});return typeof Promise<"u"&&k instanceof Promise?k.then(o=>o?!0:(t(),!1)):k?!0:(t(),!1)})}refinement(e,a){return this._refinement((u,v)=>e(u)?!0:(v.addIssue(typeof a=="function"?a(u,v):a),!1))}_refinement(e){return new ve({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return ye.create(this,this._def)}nullable(){return Oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return Ue.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return st.create(this,e,this._def)}transform(e){return new ve({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ct({...re(this._def),innerType:this,defaultValue:a,typeName:X.ZodDefault})}brand(){return new Ut({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new ht({...re(this._def),innerType:this,catchValue:a,typeName:X.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return lt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const js=/^c[^\s-]{8,}$/i,$s=/^[0-9a-z]+$/,Us=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qs=/^[a-z0-9_-]{21}$/i,Vs=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zs=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ks=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let It;const Js=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ys=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Xs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ei=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ti=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ri=new RegExp(`^${kr}$`);function Rr(c){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return c.precision?e=`${e}\\.\\d{${c.precision}}`:c.precision==null&&(e=`${e}(\\.\\d+)?`),e}function si(c){return new RegExp(`^${Rr(c)}$`)}function Lr(c){let e=`${kr}T${Rr(c)}`;const a=[];return a.push(c.local?"Z?":"Z"),c.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function ii(c,e){return!!((e==="v4"||!e)&&Js.test(c)||(e==="v6"||!e)&&Xs.test(c))}function ni(c,e){if(!Vs.test(c))return!1;try{const[a]=c.split("."),u=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),v=JSON.parse(atob(u));return!(typeof v!="object"||v===null||!v.typ||!v.alg||e&&v.alg!==e)}catch{return!1}}function oi(c,e){return!!((e==="v4"||!e)&&Ys.test(c)||(e==="v6"||!e)&&Qs.test(c))}class ge extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.string,received:y.parsedType}),Q}const u=new le;let v;for(const y of this._def.checks)if(y.kind==="min")e.data.length<y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="max")e.data.length>y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="length"){const k=e.data.length>y.value,t=e.data.length<y.value;(k||t)&&(v=this._getOrReturnCtx(e,v),k?q(v,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):t&&q(v,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),u.dirty())}else if(y.kind==="email")Ks.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"email",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="emoji")It||(It=new RegExp(Gs,"u")),It.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"emoji",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="uuid")zs.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"uuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="nanoid")qs.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"nanoid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid")js.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"cuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid2")$s.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"cuid2",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="ulid")Us.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"ulid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="url")try{new URL(e.data)}catch{v=this._getOrReturnCtx(e,v),q(v,{validation:"url",code:j.invalid_string,message:y.message}),u.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"regex",code:j.invalid_string,message:y.message}),u.dirty())):y.kind==="trim"?e.data=e.data.trim():y.kind==="includes"?e.data.includes(y.value,y.position)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),u.dirty()):y.kind==="toLowerCase"?e.data=e.data.toLowerCase():y.kind==="toUpperCase"?e.data=e.data.toUpperCase():y.kind==="startsWith"?e.data.startsWith(y.value)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:{startsWith:y.value},message:y.message}),u.dirty()):y.kind==="endsWith"?e.data.endsWith(y.value)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:{endsWith:y.value},message:y.message}),u.dirty()):y.kind==="datetime"?Lr(y).test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:"datetime",message:y.message}),u.dirty()):y.kind==="date"?ri.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:"date",message:y.message}),u.dirty()):y.kind==="time"?si(y).test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:"time",message:y.message}),u.dirty()):y.kind==="duration"?Zs.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"duration",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="ip"?ii(e.data,y.version)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"ip",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="jwt"?ni(e.data,y.alg)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"jwt",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="cidr"?oi(e.data,y.version)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"cidr",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64"?ei.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"base64",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64url"?ti.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"base64url",code:j.invalid_string,message:y.message}),u.dirty()):ne.assertNever(y);return{status:u.value,value:e.data}}_regex(e,a,u){return this.refinement(v=>e.test(v),{validation:a,code:j.invalid_string,...J.errToObj(u)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...J.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...J.errToObj(e)})}datetime(e){var a,u;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(a=e==null?void 0:e.offset)!==null&&a!==void 0?a:!1,local:(u=e==null?void 0:e.local)!==null&&u!==void 0?u:!1,...J.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...J.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...J.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...J.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...J.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...J.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...J.errToObj(a)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ge.create=c=>{var e;return new ge({checks:[],typeName:X.ZodString,coerce:(e=c==null?void 0:c.coerce)!==null&&e!==void 0?e:!1,...re(c)})};function ai(c,e){const a=(c.toString().split(".")[1]||"").length,u=(e.toString().split(".")[1]||"").length,v=a>u?a:u,y=parseInt(c.toFixed(v).replace(".","")),k=parseInt(e.toFixed(v).replace(".",""));return y%k/Math.pow(10,v)}class Te extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.number,received:y.parsedType}),Q}let u;const v=new le;for(const y of this._def.checks)y.kind==="int"?ne.isInteger(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.invalid_type,expected:"integer",received:"float",message:y.message}),v.dirty()):y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="multipleOf"?ai(e.data,y.value)!==0&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):y.kind==="finite"?Number.isFinite(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_finite,message:y.message}),v.dirty()):ne.assertNever(y);return{status:v.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,J.toString(a))}gt(e,a){return this.setLimit("min",e,!1,J.toString(a))}lte(e,a){return this.setLimit("max",e,!0,J.toString(a))}lt(e,a){return this.setLimit("max",e,!1,J.toString(a))}setLimit(e,a,u,v){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:J.toString(v)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const u of this._def.checks){if(u.kind==="finite"||u.kind==="int"||u.kind==="multipleOf")return!0;u.kind==="min"?(a===null||u.value>a)&&(a=u.value):u.kind==="max"&&(e===null||u.value<e)&&(e=u.value)}return Number.isFinite(a)&&Number.isFinite(e)}}Te.create=c=>new Te({checks:[],typeName:X.ZodNumber,coerce:(c==null?void 0:c.coerce)||!1,...re(c)});class Ae extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==K.bigint)return this._getInvalidInput(e);let u;const v=new le;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="multipleOf"?e.data%y.value!==BigInt(0)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):ne.assertNever(y);return{status:v.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.bigint,received:a.parsedType}),Q}gte(e,a){return this.setLimit("min",e,!0,J.toString(a))}gt(e,a){return this.setLimit("min",e,!1,J.toString(a))}lte(e,a){return this.setLimit("max",e,!0,J.toString(a))}lt(e,a){return this.setLimit("max",e,!1,J.toString(a))}setLimit(e,a,u,v){return new Ae({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:J.toString(v)}]})}_addCheck(e){return new Ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Ae.create=c=>{var e;return new Ae({checks:[],typeName:X.ZodBigInt,coerce:(e=c==null?void 0:c.coerce)!==null&&e!==void 0?e:!1,...re(c)})};class Qe extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.boolean,received:u.parsedType}),Q}return de(e.data)}}Qe.create=c=>new Qe({typeName:X.ZodBoolean,coerce:(c==null?void 0:c.coerce)||!1,...re(c)});class Pe extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.date,received:y.parsedType}),Q}if(isNaN(e.data.getTime())){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_date}),Q}const u=new le;let v;for(const y of this._def.checks)y.kind==="min"?e.data.getTime()<y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),u.dirty()):y.kind==="max"?e.data.getTime()>y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),u.dirty()):ne.assertNever(y);return{status:u.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:J.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Pe.create=c=>new Pe({checks:[],coerce:(c==null?void 0:c.coerce)||!1,typeName:X.ZodDate,...re(c)});class yt extends se{_parse(e){if(this._getType(e)!==K.symbol){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.symbol,received:u.parsedType}),Q}return de(e.data)}}yt.create=c=>new yt({typeName:X.ZodSymbol,...re(c)});class et extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.undefined,received:u.parsedType}),Q}return de(e.data)}}et.create=c=>new et({typeName:X.ZodUndefined,...re(c)});class tt extends se{_parse(e){if(this._getType(e)!==K.null){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.null,received:u.parsedType}),Q}return de(e.data)}}tt.create=c=>new tt({typeName:X.ZodNull,...re(c)});class $e extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return de(e.data)}}$e.create=c=>new $e({typeName:X.ZodAny,...re(c)});class Me extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return de(e.data)}}Me.create=c=>new Me({typeName:X.ZodUnknown,...re(c)});class Re extends se{_parse(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.never,received:a.parsedType}),Q}}Re.create=c=>new Re({typeName:X.ZodNever,...re(c)});class Ct extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.void,received:u.parsedType}),Q}return de(e.data)}}Ct.create=c=>new Ct({typeName:X.ZodVoid,...re(c)});class me extends se{_parse(e){const{ctx:a,status:u}=this._processInputParams(e),v=this._def;if(a.parsedType!==K.array)return q(a,{code:j.invalid_type,expected:K.array,received:a.parsedType}),Q;if(v.exactLength!==null){const k=a.data.length>v.exactLength.value,t=a.data.length<v.exactLength.value;(k||t)&&(q(a,{code:k?j.too_big:j.too_small,minimum:t?v.exactLength.value:void 0,maximum:k?v.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:v.exactLength.message}),u.dirty())}if(v.minLength!==null&&a.data.length<v.minLength.value&&(q(a,{code:j.too_small,minimum:v.minLength.value,type:"array",inclusive:!0,exact:!1,message:v.minLength.message}),u.dirty()),v.maxLength!==null&&a.data.length>v.maxLength.value&&(q(a,{code:j.too_big,maximum:v.maxLength.value,type:"array",inclusive:!0,exact:!1,message:v.maxLength.message}),u.dirty()),a.common.async)return Promise.all([...a.data].map((k,t)=>v.type._parseAsync(new Ce(a,k,a.path,t)))).then(k=>le.mergeArray(u,k));const y=[...a.data].map((k,t)=>v.type._parseSync(new Ce(a,k,a.path,t)));return le.mergeArray(u,y)}get element(){return this._def.type}min(e,a){return new me({...this._def,minLength:{value:e,message:J.toString(a)}})}max(e,a){return new me({...this._def,maxLength:{value:e,message:J.toString(a)}})}length(e,a){return new me({...this._def,exactLength:{value:e,message:J.toString(a)}})}nonempty(e){return this.min(1,e)}}me.create=(c,e)=>new me({type:c,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(e)});function Fe(c){if(c instanceof ae){const e={};for(const a in c.shape){const u=c.shape[a];e[a]=ye.create(Fe(u))}return new ae({...c._def,shape:()=>e})}else return c instanceof me?new me({...c._def,type:Fe(c.element)}):c instanceof ye?ye.create(Fe(c.unwrap())):c instanceof Oe?Oe.create(Fe(c.unwrap())):c instanceof we?we.create(c.items.map(e=>Fe(e))):c}class ae extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ne.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==K.object){const l=this._getOrReturnCtx(e);return q(l,{code:j.invalid_type,expected:K.object,received:l.parsedType}),Q}const{status:u,ctx:v}=this._processInputParams(e),{shape:y,keys:k}=this._getCached(),t=[];if(!(this._def.catchall instanceof Re&&this._def.unknownKeys==="strip"))for(const l in v.data)k.includes(l)||t.push(l);const o=[];for(const l of k){const _=y[l],h=v.data[l];o.push({key:{status:"valid",value:l},value:_._parse(new Ce(v,h,v.path,l)),alwaysSet:l in v.data})}if(this._def.catchall instanceof Re){const l=this._def.unknownKeys;if(l==="passthrough")for(const _ of t)o.push({key:{status:"valid",value:_},value:{status:"valid",value:v.data[_]}});else if(l==="strict")t.length>0&&(q(v,{code:j.unrecognized_keys,keys:t}),u.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const _ of t){const h=v.data[_];o.push({key:{status:"valid",value:_},value:l._parse(new Ce(v,h,v.path,_)),alwaysSet:_ in v.data})}}return v.common.async?Promise.resolve().then(async()=>{const l=[];for(const _ of o){const h=await _.key,p=await _.value;l.push({key:h,value:p,alwaysSet:_.alwaysSet})}return l}).then(l=>le.mergeObjectSync(u,l)):le.mergeObjectSync(u,o)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,u)=>{var v,y,k,t;const o=(k=(y=(v=this._def).errorMap)===null||y===void 0?void 0:y.call(v,a,u).message)!==null&&k!==void 0?k:u.defaultError;return a.code==="unrecognized_keys"?{message:(t=J.errToObj(e).message)!==null&&t!==void 0?t:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const a={};return ne.objectKeys(e).forEach(u=>{e[u]&&this.shape[u]&&(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}omit(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{e[u]||(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}deepPartial(){return Fe(this)}partial(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{const v=this.shape[u];e&&!e[u]?a[u]=v:a[u]=v.optional()}),new ae({...this._def,shape:()=>a})}required(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{if(e&&!e[u])a[u]=this.shape[u];else{let y=this.shape[u];for(;y instanceof ye;)y=y._def.innerType;a[u]=y}}),new ae({...this._def,shape:()=>a})}keyof(){return Dr(ne.objectKeys(this.shape))}}ae.create=(c,e)=>new ae({shape:()=>c,unknownKeys:"strip",catchall:Re.create(),typeName:X.ZodObject,...re(e)});ae.strictCreate=(c,e)=>new ae({shape:()=>c,unknownKeys:"strict",catchall:Re.create(),typeName:X.ZodObject,...re(e)});ae.lazycreate=(c,e)=>new ae({shape:c,unknownKeys:"strip",catchall:Re.create(),typeName:X.ZodObject,...re(e)});class rt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=this._def.options;function v(y){for(const t of y)if(t.result.status==="valid")return t.result;for(const t of y)if(t.result.status==="dirty")return a.common.issues.push(...t.ctx.common.issues),t.result;const k=y.map(t=>new fe(t.ctx.common.issues));return q(a,{code:j.invalid_union,unionErrors:k}),Q}if(a.common.async)return Promise.all(u.map(async y=>{const k={...a,common:{...a.common,issues:[]},parent:null};return{result:await y._parseAsync({data:a.data,path:a.path,parent:k}),ctx:k}})).then(v);{let y;const k=[];for(const o of u){const l={...a,common:{...a.common,issues:[]},parent:null},_=o._parseSync({data:a.data,path:a.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!y&&(y={result:_,ctx:l}),l.common.issues.length&&k.push(l.common.issues)}if(y)return a.common.issues.push(...y.ctx.common.issues),y.result;const t=k.map(o=>new fe(o));return q(a,{code:j.invalid_union,unionErrors:t}),Q}}get options(){return this._def.options}}rt.create=(c,e)=>new rt({options:c,typeName:X.ZodUnion,...re(e)});const Ee=c=>c instanceof nt?Ee(c.schema):c instanceof ve?Ee(c.innerType()):c instanceof ot?[c.value]:c instanceof Be?c.options:c instanceof at?ne.objectValues(c.enum):c instanceof ct?Ee(c._def.innerType):c instanceof et?[void 0]:c instanceof tt?[null]:c instanceof ye?[void 0,...Ee(c.unwrap())]:c instanceof Oe?[null,...Ee(c.unwrap())]:c instanceof Ut||c instanceof lt?Ee(c.unwrap()):c instanceof ht?Ee(c._def.innerType):[];class xt extends se{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.object)return q(a,{code:j.invalid_type,expected:K.object,received:a.parsedType}),Q;const u=this.discriminator,v=a.data[u],y=this.optionsMap.get(v);return y?a.common.async?y._parseAsync({data:a.data,path:a.path,parent:a}):y._parseSync({data:a.data,path:a.path,parent:a}):(q(a,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[u]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,u){const v=new Map;for(const y of a){const k=Ee(y.shape[e]);if(!k.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const t of k){if(v.has(t))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(t)}`);v.set(t,y)}}return new xt({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:v,...re(u)})}}function Wt(c,e){const a=ke(c),u=ke(e);if(c===e)return{valid:!0,data:c};if(a===K.object&&u===K.object){const v=ne.objectKeys(e),y=ne.objectKeys(c).filter(t=>v.indexOf(t)!==-1),k={...c,...e};for(const t of y){const o=Wt(c[t],e[t]);if(!o.valid)return{valid:!1};k[t]=o.data}return{valid:!0,data:k}}else if(a===K.array&&u===K.array){if(c.length!==e.length)return{valid:!1};const v=[];for(let y=0;y<c.length;y++){const k=c[y],t=e[y],o=Wt(k,t);if(!o.valid)return{valid:!1};v.push(o.data)}return{valid:!0,data:v}}else return a===K.date&&u===K.date&&+c==+e?{valid:!0,data:c}:{valid:!1}}class st extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e),v=(y,k)=>{if(Ft(y)||Ft(k))return Q;const t=Wt(y.value,k.value);return t.valid?((Nt(y)||Nt(k))&&a.dirty(),{status:a.value,value:t.data}):(q(u,{code:j.invalid_intersection_types}),Q)};return u.common.async?Promise.all([this._def.left._parseAsync({data:u.data,path:u.path,parent:u}),this._def.right._parseAsync({data:u.data,path:u.path,parent:u})]).then(([y,k])=>v(y,k)):v(this._def.left._parseSync({data:u.data,path:u.path,parent:u}),this._def.right._parseSync({data:u.data,path:u.path,parent:u}))}}st.create=(c,e,a)=>new st({left:c,right:e,typeName:X.ZodIntersection,...re(a)});class we extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.array)return q(u,{code:j.invalid_type,expected:K.array,received:u.parsedType}),Q;if(u.data.length<this._def.items.length)return q(u,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&u.data.length>this._def.items.length&&(q(u,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const y=[...u.data].map((k,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new Ce(u,k,u.path,t)):null}).filter(k=>!!k);return u.common.async?Promise.all(y).then(k=>le.mergeArray(a,k)):le.mergeArray(a,y)}get items(){return this._def.items}rest(e){return new we({...this._def,rest:e})}}we.create=(c,e)=>{if(!Array.isArray(c))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:c,typeName:X.ZodTuple,rest:null,...re(e)})};class it extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.object)return q(u,{code:j.invalid_type,expected:K.object,received:u.parsedType}),Q;const v=[],y=this._def.keyType,k=this._def.valueType;for(const t in u.data)v.push({key:y._parse(new Ce(u,t,u.path,t)),value:k._parse(new Ce(u,u.data[t],u.path,t)),alwaysSet:t in u.data});return u.common.async?le.mergeObjectAsync(a,v):le.mergeObjectSync(a,v)}get element(){return this._def.valueType}static create(e,a,u){return a instanceof se?new it({keyType:e,valueType:a,typeName:X.ZodRecord,...re(u)}):new it({keyType:ge.create(),valueType:e,typeName:X.ZodRecord,...re(a)})}}class wt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.map)return q(u,{code:j.invalid_type,expected:K.map,received:u.parsedType}),Q;const v=this._def.keyType,y=this._def.valueType,k=[...u.data.entries()].map(([t,o],l)=>({key:v._parse(new Ce(u,t,u.path,[l,"key"])),value:y._parse(new Ce(u,o,u.path,[l,"value"]))}));if(u.common.async){const t=new Map;return Promise.resolve().then(async()=>{for(const o of k){const l=await o.key,_=await o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}})}else{const t=new Map;for(const o of k){const l=o.key,_=o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}}}}wt.create=(c,e,a)=>new wt({valueType:e,keyType:c,typeName:X.ZodMap,...re(a)});class He extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.set)return q(u,{code:j.invalid_type,expected:K.set,received:u.parsedType}),Q;const v=this._def;v.minSize!==null&&u.data.size<v.minSize.value&&(q(u,{code:j.too_small,minimum:v.minSize.value,type:"set",inclusive:!0,exact:!1,message:v.minSize.message}),a.dirty()),v.maxSize!==null&&u.data.size>v.maxSize.value&&(q(u,{code:j.too_big,maximum:v.maxSize.value,type:"set",inclusive:!0,exact:!1,message:v.maxSize.message}),a.dirty());const y=this._def.valueType;function k(o){const l=new Set;for(const _ of o){if(_.status==="aborted")return Q;_.status==="dirty"&&a.dirty(),l.add(_.value)}return{status:a.value,value:l}}const t=[...u.data.values()].map((o,l)=>y._parse(new Ce(u,o,u.path,l)));return u.common.async?Promise.all(t).then(o=>k(o)):k(t)}min(e,a){return new He({...this._def,minSize:{value:e,message:J.toString(a)}})}max(e,a){return new He({...this._def,maxSize:{value:e,message:J.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}He.create=(c,e)=>new He({valueType:c,minSize:null,maxSize:null,typeName:X.ZodSet,...re(e)});class We extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.function)return q(a,{code:j.invalid_type,expected:K.function,received:a.parsedType}),Q;function u(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,vt(),je].filter(l=>!!l),issueData:{code:j.invalid_arguments,argumentsError:o}})}function v(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,vt(),je].filter(l=>!!l),issueData:{code:j.invalid_return_type,returnTypeError:o}})}const y={errorMap:a.common.contextualErrorMap},k=a.data;if(this._def.returns instanceof Ue){const t=this;return de(async function(...o){const l=new fe([]),_=await t._def.args.parseAsync(o,y).catch(m=>{throw l.addIssue(u(o,m)),l}),h=await Reflect.apply(k,this,_);return await t._def.returns._def.type.parseAsync(h,y).catch(m=>{throw l.addIssue(v(h,m)),l})})}else{const t=this;return de(function(...o){const l=t._def.args.safeParse(o,y);if(!l.success)throw new fe([u(o,l.error)]);const _=Reflect.apply(k,this,l.data),h=t._def.returns.safeParse(_,y);if(!h.success)throw new fe([v(_,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new We({...this._def,args:we.create(e).rest(Me.create())})}returns(e){return new We({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,u){return new We({args:e||we.create([]).rest(Me.create()),returns:a||Me.create(),typeName:X.ZodFunction,...re(u)})}}class nt extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}nt.create=(c,e)=>new nt({getter:c,typeName:X.ZodLazy,...re(e)});class ot extends se{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return q(a,{received:a.data,code:j.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}ot.create=(c,e)=>new ot({value:c,typeName:X.ZodLiteral,...re(e)});function Dr(c,e){return new Be({values:c,typeName:X.ZodEnum,...re(e)})}class Be extends se{constructor(){super(...arguments),Ge.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{expected:ne.joinValues(u),received:a.parsedType,code:j.invalid_type}),Q}if(St(this,Ge)||xr(this,Ge,new Set(this._def.values)),!St(this,Ge).has(e.data)){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{received:a.data,code:j.invalid_enum_value,options:u}),Q}return de(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Be.create(e,{...this._def,...a})}exclude(e,a=this._def){return Be.create(this.options.filter(u=>!e.includes(u)),{...this._def,...a})}}Ge=new WeakMap;Be.create=Dr;class at extends se{constructor(){super(...arguments),Je.set(this,void 0)}_parse(e){const a=ne.getValidEnumValues(this._def.values),u=this._getOrReturnCtx(e);if(u.parsedType!==K.string&&u.parsedType!==K.number){const v=ne.objectValues(a);return q(u,{expected:ne.joinValues(v),received:u.parsedType,code:j.invalid_type}),Q}if(St(this,Je)||xr(this,Je,new Set(ne.getValidEnumValues(this._def.values))),!St(this,Je).has(e.data)){const v=ne.objectValues(a);return q(u,{received:u.data,code:j.invalid_enum_value,options:v}),Q}return de(e.data)}get enum(){return this._def.values}}Je=new WeakMap;at.create=(c,e)=>new at({values:c,typeName:X.ZodNativeEnum,...re(e)});class Ue extends se{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.promise&&a.common.async===!1)return q(a,{code:j.invalid_type,expected:K.promise,received:a.parsedType}),Q;const u=a.parsedType===K.promise?a.data:Promise.resolve(a.data);return de(u.then(v=>this._def.type.parseAsync(v,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ue.create=(c,e)=>new Ue({type:c,typeName:X.ZodPromise,...re(e)});class ve extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:u}=this._processInputParams(e),v=this._def.effect||null,y={addIssue:k=>{q(u,k),k.fatal?a.abort():a.dirty()},get path(){return u.path}};if(y.addIssue=y.addIssue.bind(y),v.type==="preprocess"){const k=v.transform(u.data,y);if(u.common.async)return Promise.resolve(k).then(async t=>{if(a.value==="aborted")return Q;const o=await this._def.schema._parseAsync({data:t,path:u.path,parent:u});return o.status==="aborted"?Q:o.status==="dirty"||a.value==="dirty"?Ne(o.value):o});{if(a.value==="aborted")return Q;const t=this._def.schema._parseSync({data:k,path:u.path,parent:u});return t.status==="aborted"?Q:t.status==="dirty"||a.value==="dirty"?Ne(t.value):t}}if(v.type==="refinement"){const k=t=>{const o=v.refinement(t,y);if(u.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(u.common.async===!1){const t=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});return t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value),{status:a.value,value:t.value})}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(t=>t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value).then(()=>({status:a.value,value:t.value}))))}if(v.type==="transform")if(u.common.async===!1){const k=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});if(!Ie(k))return k;const t=v.transform(k.value,y);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(k=>Ie(k)?Promise.resolve(v.transform(k.value,y)).then(t=>({status:a.value,value:t})):k);ne.assertNever(v)}}ve.create=(c,e,a)=>new ve({schema:c,typeName:X.ZodEffects,effect:e,...re(a)});ve.createWithPreprocess=(c,e,a)=>new ve({schema:e,effect:{type:"preprocess",transform:c},typeName:X.ZodEffects,...re(a)});class ye extends se{_parse(e){return this._getType(e)===K.undefined?de(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ye.create=(c,e)=>new ye({innerType:c,typeName:X.ZodOptional,...re(e)});class Oe extends se{_parse(e){return this._getType(e)===K.null?de(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oe.create=(c,e)=>new Oe({innerType:c,typeName:X.ZodNullable,...re(e)});class ct extends se{_parse(e){const{ctx:a}=this._processInputParams(e);let u=a.data;return a.parsedType===K.undefined&&(u=this._def.defaultValue()),this._def.innerType._parse({data:u,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ct.create=(c,e)=>new ct({innerType:c,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class ht extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u={...a,common:{...a.common,issues:[]}},v=this._def.innerType._parse({data:u.data,path:u.path,parent:{...u}});return Xe(v)?v.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})})):{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})}}removeCatch(){return this._def.innerType}}ht.create=(c,e)=>new ht({innerType:c,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Et extends se{_parse(e){if(this._getType(e)!==K.nan){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.nan,received:u.parsedType}),Q}return{status:"valid",value:e.data}}}Et.create=c=>new Et({typeName:X.ZodNaN,...re(c)});const ci=Symbol("zod_brand");class Ut extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=a.data;return this._def.type._parse({data:u,path:a.path,parent:a})}unwrap(){return this._def.type}}class dt extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:u.data,path:u.path,parent:u});return y.status==="aborted"?Q:y.status==="dirty"?(a.dirty(),Ne(y.value)):this._def.out._parseAsync({data:y.value,path:u.path,parent:u})})();{const v=this._def.in._parseSync({data:u.data,path:u.path,parent:u});return v.status==="aborted"?Q:v.status==="dirty"?(a.dirty(),{status:"dirty",value:v.value}):this._def.out._parseSync({data:v.value,path:u.path,parent:u})}}static create(e,a){return new dt({in:e,out:a,typeName:X.ZodPipeline})}}class lt extends se{_parse(e){const a=this._def.innerType._parse(e),u=v=>(Ie(v)&&(v.value=Object.freeze(v.value)),v);return Xe(a)?a.then(v=>u(v)):u(a)}unwrap(){return this._def.innerType}}lt.create=(c,e)=>new lt({innerType:c,typeName:X.ZodReadonly,...re(e)});function tr(c,e){const a=typeof c=="function"?c(e):typeof c=="string"?{message:c}:c;return typeof a=="string"?{message:a}:a}function Tr(c,e={},a){return c?$e.create().superRefine((u,v)=>{var y,k;const t=c(u);if(t instanceof Promise)return t.then(o=>{var l,_;if(!o){const h=tr(e,u),p=(_=(l=h.fatal)!==null&&l!==void 0?l:a)!==null&&_!==void 0?_:!0;v.addIssue({code:"custom",...h,fatal:p})}});if(!t){const o=tr(e,u),l=(k=(y=o.fatal)!==null&&y!==void 0?y:a)!==null&&k!==void 0?k:!0;v.addIssue({code:"custom",...o,fatal:l})}}):$e.create()}const hi={object:ae.lazycreate};var X;(function(c){c.ZodString="ZodString",c.ZodNumber="ZodNumber",c.ZodNaN="ZodNaN",c.ZodBigInt="ZodBigInt",c.ZodBoolean="ZodBoolean",c.ZodDate="ZodDate",c.ZodSymbol="ZodSymbol",c.ZodUndefined="ZodUndefined",c.ZodNull="ZodNull",c.ZodAny="ZodAny",c.ZodUnknown="ZodUnknown",c.ZodNever="ZodNever",c.ZodVoid="ZodVoid",c.ZodArray="ZodArray",c.ZodObject="ZodObject",c.ZodUnion="ZodUnion",c.ZodDiscriminatedUnion="ZodDiscriminatedUnion",c.ZodIntersection="ZodIntersection",c.ZodTuple="ZodTuple",c.ZodRecord="ZodRecord",c.ZodMap="ZodMap",c.ZodSet="ZodSet",c.ZodFunction="ZodFunction",c.ZodLazy="ZodLazy",c.ZodLiteral="ZodLiteral",c.ZodEnum="ZodEnum",c.ZodEffects="ZodEffects",c.ZodNativeEnum="ZodNativeEnum",c.ZodOptional="ZodOptional",c.ZodNullable="ZodNullable",c.ZodDefault="ZodDefault",c.ZodCatch="ZodCatch",c.ZodPromise="ZodPromise",c.ZodBranded="ZodBranded",c.ZodPipeline="ZodPipeline",c.ZodReadonly="ZodReadonly"})(X||(X={}));const li=(c,e={message:`Input not instance of ${c.name}`})=>Tr(a=>a instanceof c,e),Ar=ge.create,Br=Te.create,di=Et.create,ui=Ae.create,Or=Qe.create,fi=Pe.create,_i=yt.create,pi=et.create,gi=tt.create,mi=$e.create,vi=Me.create,bi=Re.create,Si=Ct.create,yi=me.create,Ci=ae.create,wi=ae.strictCreate,Ei=rt.create,xi=xt.create,ki=st.create,Ri=we.create,Li=it.create,Di=wt.create,Ti=He.create,Ai=We.create,Bi=nt.create,Oi=ot.create,Mi=Be.create,Ii=at.create,Pi=Ue.create,rr=ve.create,Hi=ye.create,Fi=Oe.create,Ni=ve.createWithPreprocess,Wi=dt.create,ji=()=>Ar().optional(),$i=()=>Br().optional(),Ui=()=>Or().optional(),zi={string:c=>ge.create({...c,coerce:!0}),number:c=>Te.create({...c,coerce:!0}),boolean:c=>Qe.create({...c,coerce:!0}),bigint:c=>Ae.create({...c,coerce:!0}),date:c=>Pe.create({...c,coerce:!0})},qi=Q;var Vi=Object.freeze({__proto__:null,defaultErrorMap:je,setErrorMap:Ns,getErrorMap:vt,makeIssue:bt,EMPTY_PATH:Ws,addIssueToContext:q,ParseStatus:le,INVALID:Q,DIRTY:Ne,OK:de,isAborted:Ft,isDirty:Nt,isValid:Ie,isAsync:Xe,get util(){return ne},get objectUtil(){return Ht},ZodParsedType:K,getParsedType:ke,ZodType:se,datetimeRegex:Lr,ZodString:ge,ZodNumber:Te,ZodBigInt:Ae,ZodBoolean:Qe,ZodDate:Pe,ZodSymbol:yt,ZodUndefined:et,ZodNull:tt,ZodAny:$e,ZodUnknown:Me,ZodNever:Re,ZodVoid:Ct,ZodArray:me,ZodObject:ae,ZodUnion:rt,ZodDiscriminatedUnion:xt,ZodIntersection:st,ZodTuple:we,ZodRecord:it,ZodMap:wt,ZodSet:He,ZodFunction:We,ZodLazy:nt,ZodLiteral:ot,ZodEnum:Be,ZodNativeEnum:at,ZodPromise:Ue,ZodEffects:ve,ZodTransformer:ve,ZodOptional:ye,ZodNullable:Oe,ZodDefault:ct,ZodCatch:ht,ZodNaN:Et,BRAND:ci,ZodBranded:Ut,ZodPipeline:dt,ZodReadonly:lt,custom:Tr,Schema:se,ZodSchema:se,late:hi,get ZodFirstPartyTypeKind(){return X},coerce:zi,any:mi,array:yi,bigint:ui,boolean:Or,date:fi,discriminatedUnion:xi,effect:rr,enum:Mi,function:Ai,instanceof:li,intersection:ki,lazy:Bi,literal:Oi,map:Di,nan:di,nativeEnum:Ii,never:bi,null:gi,nullable:Fi,number:Br,object:Ci,oboolean:Ui,onumber:$i,optional:Hi,ostring:ji,pipeline:Wi,preprocess:Ni,promise:Pi,record:Li,set:Ti,strictObject:wi,string:Ar,symbol:_i,transformer:rr,tuple:Ri,undefined:pi,union:Ei,unknown:vi,void:Si,NEVER:qi,ZodIssueCode:j,quotelessJson:Fs,ZodError:fe});function Zi(c){const e=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(c);if(!e)return;if(!e[1]||!e[2]||!e[3]||!e[4])throw new Error(`Mouse event: Invalid match for data ${c}`);const a=parseInt(e[1],10),u=parseInt(e[2],10),v=parseInt(e[3],10),y=e[4]==="m";return console.log(`Mouse event: buttonCode=${a}, column=${u}, row=${v}, isRelease=${y}`),c}function Mr(c,e){const a=new Hs.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),u=Cr.macchiato.colors;a.options.theme={background:u.base.hex,black:u.crust.hex,brightBlack:u.surface2.hex,blue:u.blue.hex,brightBlue:u.blue.hex,brightCyan:u.sky.hex,brightRed:u.maroon.hex,brightYellow:u.yellow.hex,cursor:u.text.hex,cyan:u.sky.hex,foreground:u.text.hex,green:u.green.hex,magenta:u.lavender.hex,red:u.red.hex,white:u.text.hex,yellow:u.yellow.hex};const v=new Is.FitAddon;return a.loadAddon(v),a.open(c),v.fit(),window.addEventListener("resize",()=>{v.fit()}),a.onData(y=>{if(typeof y!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(y)}'`);const k=Zi(y);k&&e.onMouseEvent(k)}),a.onKey(y=>{e.onKeyPress(y)}),a}function Ir(){let c=Vi.string().safeParse(sessionStorage.getItem("tabId")).data;return c||(c=Math.random().toString(36),sessionStorage.setItem("tabId",c)),{tabId:c}}class Ki{constructor(e){Se(this,"ready");Se(this,"tabId");Se(this,"terminal");Se(this,"trpc");const a=gr({links:[Sr({condition:y=>y.type==="subscription",true:yr({url:"/trpc"}),false:br({url:"/trpc"})})]});this.trpc=a,this.tabId=Ir();const u=this.tabId,v=Mr(e,{onMouseEvent(y){a.neovim.sendStdin.mutate({tabId:u,data:y}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(y){a.neovim.sendStdin.mutate({tabId:u,data:y.key})}});this.terminal=v,this.ready=new Promise(y=>{console.log("Subscribing to stdout"),a.neovim.onStdout.subscribe({client:u},{onStarted(){y()},onData(k){v.write(k)},onError(k){console.error("Error from the application",k)}})})}async startNeovim(e){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:e.filename,additionalEnvironmentVariables:e.additionalEnvironmentVariables,startupScriptModifications:e.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(e){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}async runLuaCode(e){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...e,tabId:this.tabId})}async runExCommand(e){return await this.ready,this.trpc.neovim.runExCommand.mutate({...e,tabId:this.tabId})}}class Gi{constructor(e){Se(this,"ready");Se(this,"tabId");Se(this,"terminal");Se(this,"trpc");const a=gr({links:[Sr({condition:y=>y.type==="subscription",true:yr({url:"/trpc"}),false:br({url:"/trpc"})})]});this.trpc=a,this.tabId=Ir();const u=this.tabId,v=Mr(e,{onMouseEvent(y){a.terminal.sendStdin.mutate({tabId:u,data:y}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(y){a.terminal.sendStdin.mutate({tabId:u,data:y.key})}});this.terminal=v,this.ready=new Promise(y=>{console.log("Subscribing to stdout"),a.terminal.onStdout.subscribe({client:u},{onStarted(){y()},onData(k){v.write(k)},onError(k){console.error("Error from the application",k)}})})}async startTerminalApplication(e){return await this.ready,await this.trpc.terminal.start.mutate({tabId:this.tabId,startTerminalArguments:{additionalEnvironmentVariables:e.additionalEnvironmentVariables,commandToRun:e.commandToRun,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}}})}}class Pr{constructor(e){Se(this,"value");this.factory=e}get(){return this.value===void 0&&(this.value=this.factory()),this.value}}const zt=document.querySelector("#app");if(!zt)throw new Error("No app element found");const Ji=new Pr(()=>new Ki(zt)),Yi=new Pr(()=>new Gi(zt));window.startNeovim=async function(c){const e=Ji.get(),a=await e.startNeovim({additionalEnvironmentVariables:c==null?void 0:c.additionalEnvironmentVariables,filename:(c==null?void 0:c.filename)??"initial-file.txt",startupScriptModifications:(c==null?void 0:c.startupScriptModifications)??[]});return{runBlockingShellCommand(v){return e.runBlockingShellCommand(v)},runLuaCode(v){return e.runLuaCode(v)},runExCommand(v){return e.runExCommand(v)},dir:a}};window.startTerminalApplication=async function(c){return{dir:await Yi.get().startTerminalApplication(c)}};
|
|
9
|
+
`,r)}paste(n){this._core.paste(n)}refresh(n,r){this._verifyIntegers(n,r),this._core.refresh(n,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const r of n)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const r of n)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}k.Terminal=f})(),y})())}(Mt)),Mt.exports}var Hs=Ps(),ne;(function(c){c.assertEqual=v=>v;function e(v){}c.assertIs=e;function a(v){throw new Error}c.assertNever=a,c.arrayToEnum=v=>{const y={};for(const k of v)y[k]=k;return y},c.getValidEnumValues=v=>{const y=c.objectKeys(v).filter(t=>typeof v[v[t]]!="number"),k={};for(const t of y)k[t]=v[t];return c.objectValues(k)},c.objectValues=v=>c.objectKeys(v).map(function(y){return v[y]}),c.objectKeys=typeof Object.keys=="function"?v=>Object.keys(v):v=>{const y=[];for(const k in v)Object.prototype.hasOwnProperty.call(v,k)&&y.push(k);return y},c.find=(v,y)=>{for(const k of v)if(y(k))return k},c.isInteger=typeof Number.isInteger=="function"?v=>Number.isInteger(v):v=>typeof v=="number"&&isFinite(v)&&Math.floor(v)===v;function u(v,y=" | "){return v.map(k=>typeof k=="string"?`'${k}'`:k).join(y)}c.joinValues=u,c.jsonStringifyReplacer=(v,y)=>typeof y=="bigint"?y.toString():y})(ne||(ne={}));var Ht;(function(c){c.mergeShapes=(e,a)=>({...e,...a})})(Ht||(Ht={}));const K=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ke=c=>{switch(typeof c){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(c)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(c)?K.array:c===null?K.null:c.then&&typeof c.then=="function"&&c.catch&&typeof c.catch=="function"?K.promise:typeof Map<"u"&&c instanceof Map?K.map:typeof Set<"u"&&c instanceof Set?K.set:typeof Date<"u"&&c instanceof Date?K.date:K.object;default:return K.unknown}},j=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Fs=c=>JSON.stringify(c,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=u=>{this.issues=[...this.issues,u]},this.addIssues=(u=[])=>{this.issues=[...this.issues,...u]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(y){return y.message},u={_errors:[]},v=y=>{for(const k of y.issues)if(k.code==="invalid_union")k.unionErrors.map(v);else if(k.code==="invalid_return_type")v(k.returnTypeError);else if(k.code==="invalid_arguments")v(k.argumentsError);else if(k.path.length===0)u._errors.push(a(k));else{let t=u,o=0;for(;o<k.path.length;){const l=k.path[o];o===k.path.length-1?(t[l]=t[l]||{_errors:[]},t[l]._errors.push(a(k))):t[l]=t[l]||{_errors:[]},t=t[l],o++}}};return v(this),u}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},u=[];for(const v of this.issues)v.path.length>0?(a[v.path[0]]=a[v.path[0]]||[],a[v.path[0]].push(e(v))):u.push(e(v));return{formErrors:u,fieldErrors:a}}get formErrors(){return this.flatten()}}fe.create=c=>new fe(c);const je=(c,e)=>{let a;switch(c.code){case j.invalid_type:c.received===K.undefined?a="Required":a=`Expected ${c.expected}, received ${c.received}`;break;case j.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(c.expected,ne.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:a=`Unrecognized key(s) in object: ${ne.joinValues(c.keys,", ")}`;break;case j.invalid_union:a="Invalid input";break;case j.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ne.joinValues(c.options)}`;break;case j.invalid_enum_value:a=`Invalid enum value. Expected ${ne.joinValues(c.options)}, received '${c.received}'`;break;case j.invalid_arguments:a="Invalid function arguments";break;case j.invalid_return_type:a="Invalid function return type";break;case j.invalid_date:a="Invalid date";break;case j.invalid_string:typeof c.validation=="object"?"includes"in c.validation?(a=`Invalid input: must include "${c.validation.includes}"`,typeof c.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${c.validation.position}`)):"startsWith"in c.validation?a=`Invalid input: must start with "${c.validation.startsWith}"`:"endsWith"in c.validation?a=`Invalid input: must end with "${c.validation.endsWith}"`:ne.assertNever(c.validation):c.validation!=="regex"?a=`Invalid ${c.validation}`:a="Invalid";break;case j.too_small:c.type==="array"?a=`Array must contain ${c.exact?"exactly":c.inclusive?"at least":"more than"} ${c.minimum} element(s)`:c.type==="string"?a=`String must contain ${c.exact?"exactly":c.inclusive?"at least":"over"} ${c.minimum} character(s)`:c.type==="number"?a=`Number must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${c.minimum}`:c.type==="date"?a=`Date must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(c.minimum))}`:a="Invalid input";break;case j.too_big:c.type==="array"?a=`Array must contain ${c.exact?"exactly":c.inclusive?"at most":"less than"} ${c.maximum} element(s)`:c.type==="string"?a=`String must contain ${c.exact?"exactly":c.inclusive?"at most":"under"} ${c.maximum} character(s)`:c.type==="number"?a=`Number must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="bigint"?a=`BigInt must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="date"?a=`Date must be ${c.exact?"exactly":c.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(c.maximum))}`:a="Invalid input";break;case j.custom:a="Invalid input";break;case j.invalid_intersection_types:a="Intersection results could not be merged";break;case j.not_multiple_of:a=`Number must be a multiple of ${c.multipleOf}`;break;case j.not_finite:a="Number must be finite";break;default:a=e.defaultError,ne.assertNever(c)}return{message:a}};let Er=je;function Ns(c){Er=c}function vt(){return Er}const bt=c=>{const{data:e,path:a,errorMaps:u,issueData:v}=c,y=[...a,...v.path||[]],k={...v,path:y};if(v.message!==void 0)return{...v,path:y,message:v.message};let t="";const o=u.filter(l=>!!l).slice().reverse();for(const l of o)t=l(k,{data:e,defaultError:t}).message;return{...v,path:y,message:t}},Ws=[];function q(c,e){const a=vt(),u=bt({issueData:e,data:c.data,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,a,a===je?void 0:je].filter(v=>!!v)});c.common.issues.push(u)}class le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const u=[];for(const v of a){if(v.status==="aborted")return Q;v.status==="dirty"&&e.dirty(),u.push(v.value)}return{status:e.value,value:u}}static async mergeObjectAsync(e,a){const u=[];for(const v of a){const y=await v.key,k=await v.value;u.push({key:y,value:k})}return le.mergeObjectSync(e,u)}static mergeObjectSync(e,a){const u={};for(const v of a){const{key:y,value:k}=v;if(y.status==="aborted"||k.status==="aborted")return Q;y.status==="dirty"&&e.dirty(),k.status==="dirty"&&e.dirty(),y.value!=="__proto__"&&(typeof k.value<"u"||v.alwaysSet)&&(u[y.value]=k.value)}return{status:e.value,value:u}}}const Q=Object.freeze({status:"aborted"}),Ne=c=>({status:"dirty",value:c}),de=c=>({status:"valid",value:c}),Ft=c=>c.status==="aborted",Nt=c=>c.status==="dirty",Ie=c=>c.status==="valid",Xe=c=>typeof Promise<"u"&&c instanceof Promise;function St(c,e,a,u){if(typeof e=="function"?c!==e||!0:!e.has(c))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(c)}function xr(c,e,a,u,v){if(typeof e=="function"?c!==e||!0:!e.has(c))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(c,a),a}var J;(function(c){c.errToObj=e=>typeof e=="string"?{message:e}:e||{},c.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(J||(J={}));var Ge,Je;class Ce{constructor(e,a,u,v){this._cachedPath=[],this.parent=e,this.data=a,this._path=u,this._key=v}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const er=(c,e)=>{if(Ie(e))return{success:!0,data:e.value};if(!c.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new fe(c.common.issues);return this._error=a,this._error}}};function re(c){if(!c)return{};const{errorMap:e,invalid_type_error:a,required_error:u,description:v}=c;if(e&&(a||u))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:v}:{errorMap:(k,t)=>{var o,l;const{message:_}=c;return k.code==="invalid_enum_value"?{message:_??t.defaultError}:typeof t.data>"u"?{message:(o=_??u)!==null&&o!==void 0?o:t.defaultError}:k.code!=="invalid_type"?{message:t.defaultError}:{message:(l=_??a)!==null&&l!==void 0?l:t.defaultError}},description:v}}class se{get description(){return this._def.description}_getType(e){return ke(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:ke(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:ke(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Xe(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const u=this.safeParse(e,a);if(u.success)return u.data;throw u.error}safeParse(e,a){var u;const v={common:{issues:[],async:(u=a==null?void 0:a.async)!==null&&u!==void 0?u:!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)},y=this._parseSync({data:e,path:v.path,parent:v});return er(v,y)}"~validate"(e){var a,u;const v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)};if(!this["~standard"].async)try{const y=this._parseSync({data:e,path:[],parent:v});return Ie(y)?{value:y.value}:{issues:v.common.issues}}catch(y){!((u=(a=y==null?void 0:y.message)===null||a===void 0?void 0:a.toLowerCase())===null||u===void 0)&&u.includes("encountered")&&(this["~standard"].async=!0),v.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:v}).then(y=>Ie(y)?{value:y.value}:{issues:v.common.issues})}async parseAsync(e,a){const u=await this.safeParseAsync(e,a);if(u.success)return u.data;throw u.error}async safeParseAsync(e,a){const u={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ke(e)},v=this._parse({data:e,path:u.path,parent:u}),y=await(Xe(v)?v:Promise.resolve(v));return er(u,y)}refine(e,a){const u=v=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(v):a;return this._refinement((v,y)=>{const k=e(v),t=()=>y.addIssue({code:j.custom,...u(v)});return typeof Promise<"u"&&k instanceof Promise?k.then(o=>o?!0:(t(),!1)):k?!0:(t(),!1)})}refinement(e,a){return this._refinement((u,v)=>e(u)?!0:(v.addIssue(typeof a=="function"?a(u,v):a),!1))}_refinement(e){return new ve({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return ye.create(this,this._def)}nullable(){return Oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return Ue.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return st.create(this,e,this._def)}transform(e){return new ve({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ct({...re(this._def),innerType:this,defaultValue:a,typeName:X.ZodDefault})}brand(){return new Ut({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new ht({...re(this._def),innerType:this,catchValue:a,typeName:X.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return lt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const js=/^c[^\s-]{8,}$/i,$s=/^[0-9a-z]+$/,Us=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qs=/^[a-z0-9_-]{21}$/i,Vs=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zs=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ks=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let It;const Js=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ys=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Xs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ei=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ti=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ri=new RegExp(`^${kr}$`);function Rr(c){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return c.precision?e=`${e}\\.\\d{${c.precision}}`:c.precision==null&&(e=`${e}(\\.\\d+)?`),e}function si(c){return new RegExp(`^${Rr(c)}$`)}function Lr(c){let e=`${kr}T${Rr(c)}`;const a=[];return a.push(c.local?"Z?":"Z"),c.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function ii(c,e){return!!((e==="v4"||!e)&&Js.test(c)||(e==="v6"||!e)&&Xs.test(c))}function ni(c,e){if(!Vs.test(c))return!1;try{const[a]=c.split("."),u=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),v=JSON.parse(atob(u));return!(typeof v!="object"||v===null||!v.typ||!v.alg||e&&v.alg!==e)}catch{return!1}}function oi(c,e){return!!((e==="v4"||!e)&&Ys.test(c)||(e==="v6"||!e)&&Qs.test(c))}class ge extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.string,received:y.parsedType}),Q}const u=new le;let v;for(const y of this._def.checks)if(y.kind==="min")e.data.length<y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="max")e.data.length>y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="length"){const k=e.data.length>y.value,t=e.data.length<y.value;(k||t)&&(v=this._getOrReturnCtx(e,v),k?q(v,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):t&&q(v,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),u.dirty())}else if(y.kind==="email")Ks.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"email",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="emoji")It||(It=new RegExp(Gs,"u")),It.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"emoji",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="uuid")zs.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"uuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="nanoid")qs.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"nanoid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid")js.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"cuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid2")$s.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"cuid2",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="ulid")Us.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"ulid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="url")try{new URL(e.data)}catch{v=this._getOrReturnCtx(e,v),q(v,{validation:"url",code:j.invalid_string,message:y.message}),u.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"regex",code:j.invalid_string,message:y.message}),u.dirty())):y.kind==="trim"?e.data=e.data.trim():y.kind==="includes"?e.data.includes(y.value,y.position)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),u.dirty()):y.kind==="toLowerCase"?e.data=e.data.toLowerCase():y.kind==="toUpperCase"?e.data=e.data.toUpperCase():y.kind==="startsWith"?e.data.startsWith(y.value)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:{startsWith:y.value},message:y.message}),u.dirty()):y.kind==="endsWith"?e.data.endsWith(y.value)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:{endsWith:y.value},message:y.message}),u.dirty()):y.kind==="datetime"?Lr(y).test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:"datetime",message:y.message}),u.dirty()):y.kind==="date"?ri.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:"date",message:y.message}),u.dirty()):y.kind==="time"?si(y).test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{code:j.invalid_string,validation:"time",message:y.message}),u.dirty()):y.kind==="duration"?Zs.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"duration",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="ip"?ii(e.data,y.version)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"ip",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="jwt"?ni(e.data,y.alg)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"jwt",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="cidr"?oi(e.data,y.version)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"cidr",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64"?ei.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"base64",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64url"?ti.test(e.data)||(v=this._getOrReturnCtx(e,v),q(v,{validation:"base64url",code:j.invalid_string,message:y.message}),u.dirty()):ne.assertNever(y);return{status:u.value,value:e.data}}_regex(e,a,u){return this.refinement(v=>e.test(v),{validation:a,code:j.invalid_string,...J.errToObj(u)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...J.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...J.errToObj(e)})}datetime(e){var a,u;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(a=e==null?void 0:e.offset)!==null&&a!==void 0?a:!1,local:(u=e==null?void 0:e.local)!==null&&u!==void 0?u:!1,...J.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...J.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...J.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...J.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...J.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...J.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...J.errToObj(a)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ge.create=c=>{var e;return new ge({checks:[],typeName:X.ZodString,coerce:(e=c==null?void 0:c.coerce)!==null&&e!==void 0?e:!1,...re(c)})};function ai(c,e){const a=(c.toString().split(".")[1]||"").length,u=(e.toString().split(".")[1]||"").length,v=a>u?a:u,y=parseInt(c.toFixed(v).replace(".","")),k=parseInt(e.toFixed(v).replace(".",""));return y%k/Math.pow(10,v)}class Te extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.number,received:y.parsedType}),Q}let u;const v=new le;for(const y of this._def.checks)y.kind==="int"?ne.isInteger(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.invalid_type,expected:"integer",received:"float",message:y.message}),v.dirty()):y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="multipleOf"?ai(e.data,y.value)!==0&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):y.kind==="finite"?Number.isFinite(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_finite,message:y.message}),v.dirty()):ne.assertNever(y);return{status:v.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,J.toString(a))}gt(e,a){return this.setLimit("min",e,!1,J.toString(a))}lte(e,a){return this.setLimit("max",e,!0,J.toString(a))}lt(e,a){return this.setLimit("max",e,!1,J.toString(a))}setLimit(e,a,u,v){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:J.toString(v)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const u of this._def.checks){if(u.kind==="finite"||u.kind==="int"||u.kind==="multipleOf")return!0;u.kind==="min"?(a===null||u.value>a)&&(a=u.value):u.kind==="max"&&(e===null||u.value<e)&&(e=u.value)}return Number.isFinite(a)&&Number.isFinite(e)}}Te.create=c=>new Te({checks:[],typeName:X.ZodNumber,coerce:(c==null?void 0:c.coerce)||!1,...re(c)});class Ae extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==K.bigint)return this._getInvalidInput(e);let u;const v=new le;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="multipleOf"?e.data%y.value!==BigInt(0)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):ne.assertNever(y);return{status:v.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.bigint,received:a.parsedType}),Q}gte(e,a){return this.setLimit("min",e,!0,J.toString(a))}gt(e,a){return this.setLimit("min",e,!1,J.toString(a))}lte(e,a){return this.setLimit("max",e,!0,J.toString(a))}lt(e,a){return this.setLimit("max",e,!1,J.toString(a))}setLimit(e,a,u,v){return new Ae({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:J.toString(v)}]})}_addCheck(e){return new Ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Ae.create=c=>{var e;return new Ae({checks:[],typeName:X.ZodBigInt,coerce:(e=c==null?void 0:c.coerce)!==null&&e!==void 0?e:!1,...re(c)})};class Qe extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.boolean,received:u.parsedType}),Q}return de(e.data)}}Qe.create=c=>new Qe({typeName:X.ZodBoolean,coerce:(c==null?void 0:c.coerce)||!1,...re(c)});class Pe extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.date,received:y.parsedType}),Q}if(isNaN(e.data.getTime())){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_date}),Q}const u=new le;let v;for(const y of this._def.checks)y.kind==="min"?e.data.getTime()<y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),u.dirty()):y.kind==="max"?e.data.getTime()>y.value&&(v=this._getOrReturnCtx(e,v),q(v,{code:j.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),u.dirty()):ne.assertNever(y);return{status:u.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:J.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Pe.create=c=>new Pe({checks:[],coerce:(c==null?void 0:c.coerce)||!1,typeName:X.ZodDate,...re(c)});class yt extends se{_parse(e){if(this._getType(e)!==K.symbol){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.symbol,received:u.parsedType}),Q}return de(e.data)}}yt.create=c=>new yt({typeName:X.ZodSymbol,...re(c)});class et extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.undefined,received:u.parsedType}),Q}return de(e.data)}}et.create=c=>new et({typeName:X.ZodUndefined,...re(c)});class tt extends se{_parse(e){if(this._getType(e)!==K.null){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.null,received:u.parsedType}),Q}return de(e.data)}}tt.create=c=>new tt({typeName:X.ZodNull,...re(c)});class $e extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return de(e.data)}}$e.create=c=>new $e({typeName:X.ZodAny,...re(c)});class Me extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return de(e.data)}}Me.create=c=>new Me({typeName:X.ZodUnknown,...re(c)});class Re extends se{_parse(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.never,received:a.parsedType}),Q}}Re.create=c=>new Re({typeName:X.ZodNever,...re(c)});class Ct extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.void,received:u.parsedType}),Q}return de(e.data)}}Ct.create=c=>new Ct({typeName:X.ZodVoid,...re(c)});class me extends se{_parse(e){const{ctx:a,status:u}=this._processInputParams(e),v=this._def;if(a.parsedType!==K.array)return q(a,{code:j.invalid_type,expected:K.array,received:a.parsedType}),Q;if(v.exactLength!==null){const k=a.data.length>v.exactLength.value,t=a.data.length<v.exactLength.value;(k||t)&&(q(a,{code:k?j.too_big:j.too_small,minimum:t?v.exactLength.value:void 0,maximum:k?v.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:v.exactLength.message}),u.dirty())}if(v.minLength!==null&&a.data.length<v.minLength.value&&(q(a,{code:j.too_small,minimum:v.minLength.value,type:"array",inclusive:!0,exact:!1,message:v.minLength.message}),u.dirty()),v.maxLength!==null&&a.data.length>v.maxLength.value&&(q(a,{code:j.too_big,maximum:v.maxLength.value,type:"array",inclusive:!0,exact:!1,message:v.maxLength.message}),u.dirty()),a.common.async)return Promise.all([...a.data].map((k,t)=>v.type._parseAsync(new Ce(a,k,a.path,t)))).then(k=>le.mergeArray(u,k));const y=[...a.data].map((k,t)=>v.type._parseSync(new Ce(a,k,a.path,t)));return le.mergeArray(u,y)}get element(){return this._def.type}min(e,a){return new me({...this._def,minLength:{value:e,message:J.toString(a)}})}max(e,a){return new me({...this._def,maxLength:{value:e,message:J.toString(a)}})}length(e,a){return new me({...this._def,exactLength:{value:e,message:J.toString(a)}})}nonempty(e){return this.min(1,e)}}me.create=(c,e)=>new me({type:c,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(e)});function Fe(c){if(c instanceof ae){const e={};for(const a in c.shape){const u=c.shape[a];e[a]=ye.create(Fe(u))}return new ae({...c._def,shape:()=>e})}else return c instanceof me?new me({...c._def,type:Fe(c.element)}):c instanceof ye?ye.create(Fe(c.unwrap())):c instanceof Oe?Oe.create(Fe(c.unwrap())):c instanceof we?we.create(c.items.map(e=>Fe(e))):c}class ae extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ne.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==K.object){const l=this._getOrReturnCtx(e);return q(l,{code:j.invalid_type,expected:K.object,received:l.parsedType}),Q}const{status:u,ctx:v}=this._processInputParams(e),{shape:y,keys:k}=this._getCached(),t=[];if(!(this._def.catchall instanceof Re&&this._def.unknownKeys==="strip"))for(const l in v.data)k.includes(l)||t.push(l);const o=[];for(const l of k){const _=y[l],h=v.data[l];o.push({key:{status:"valid",value:l},value:_._parse(new Ce(v,h,v.path,l)),alwaysSet:l in v.data})}if(this._def.catchall instanceof Re){const l=this._def.unknownKeys;if(l==="passthrough")for(const _ of t)o.push({key:{status:"valid",value:_},value:{status:"valid",value:v.data[_]}});else if(l==="strict")t.length>0&&(q(v,{code:j.unrecognized_keys,keys:t}),u.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const _ of t){const h=v.data[_];o.push({key:{status:"valid",value:_},value:l._parse(new Ce(v,h,v.path,_)),alwaysSet:_ in v.data})}}return v.common.async?Promise.resolve().then(async()=>{const l=[];for(const _ of o){const h=await _.key,p=await _.value;l.push({key:h,value:p,alwaysSet:_.alwaysSet})}return l}).then(l=>le.mergeObjectSync(u,l)):le.mergeObjectSync(u,o)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,u)=>{var v,y,k,t;const o=(k=(y=(v=this._def).errorMap)===null||y===void 0?void 0:y.call(v,a,u).message)!==null&&k!==void 0?k:u.defaultError;return a.code==="unrecognized_keys"?{message:(t=J.errToObj(e).message)!==null&&t!==void 0?t:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const a={};return ne.objectKeys(e).forEach(u=>{e[u]&&this.shape[u]&&(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}omit(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{e[u]||(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}deepPartial(){return Fe(this)}partial(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{const v=this.shape[u];e&&!e[u]?a[u]=v:a[u]=v.optional()}),new ae({...this._def,shape:()=>a})}required(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{if(e&&!e[u])a[u]=this.shape[u];else{let y=this.shape[u];for(;y instanceof ye;)y=y._def.innerType;a[u]=y}}),new ae({...this._def,shape:()=>a})}keyof(){return Dr(ne.objectKeys(this.shape))}}ae.create=(c,e)=>new ae({shape:()=>c,unknownKeys:"strip",catchall:Re.create(),typeName:X.ZodObject,...re(e)});ae.strictCreate=(c,e)=>new ae({shape:()=>c,unknownKeys:"strict",catchall:Re.create(),typeName:X.ZodObject,...re(e)});ae.lazycreate=(c,e)=>new ae({shape:c,unknownKeys:"strip",catchall:Re.create(),typeName:X.ZodObject,...re(e)});class rt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=this._def.options;function v(y){for(const t of y)if(t.result.status==="valid")return t.result;for(const t of y)if(t.result.status==="dirty")return a.common.issues.push(...t.ctx.common.issues),t.result;const k=y.map(t=>new fe(t.ctx.common.issues));return q(a,{code:j.invalid_union,unionErrors:k}),Q}if(a.common.async)return Promise.all(u.map(async y=>{const k={...a,common:{...a.common,issues:[]},parent:null};return{result:await y._parseAsync({data:a.data,path:a.path,parent:k}),ctx:k}})).then(v);{let y;const k=[];for(const o of u){const l={...a,common:{...a.common,issues:[]},parent:null},_=o._parseSync({data:a.data,path:a.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!y&&(y={result:_,ctx:l}),l.common.issues.length&&k.push(l.common.issues)}if(y)return a.common.issues.push(...y.ctx.common.issues),y.result;const t=k.map(o=>new fe(o));return q(a,{code:j.invalid_union,unionErrors:t}),Q}}get options(){return this._def.options}}rt.create=(c,e)=>new rt({options:c,typeName:X.ZodUnion,...re(e)});const Ee=c=>c instanceof nt?Ee(c.schema):c instanceof ve?Ee(c.innerType()):c instanceof ot?[c.value]:c instanceof Be?c.options:c instanceof at?ne.objectValues(c.enum):c instanceof ct?Ee(c._def.innerType):c instanceof et?[void 0]:c instanceof tt?[null]:c instanceof ye?[void 0,...Ee(c.unwrap())]:c instanceof Oe?[null,...Ee(c.unwrap())]:c instanceof Ut||c instanceof lt?Ee(c.unwrap()):c instanceof ht?Ee(c._def.innerType):[];class xt extends se{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.object)return q(a,{code:j.invalid_type,expected:K.object,received:a.parsedType}),Q;const u=this.discriminator,v=a.data[u],y=this.optionsMap.get(v);return y?a.common.async?y._parseAsync({data:a.data,path:a.path,parent:a}):y._parseSync({data:a.data,path:a.path,parent:a}):(q(a,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[u]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,u){const v=new Map;for(const y of a){const k=Ee(y.shape[e]);if(!k.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const t of k){if(v.has(t))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(t)}`);v.set(t,y)}}return new xt({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:v,...re(u)})}}function Wt(c,e){const a=ke(c),u=ke(e);if(c===e)return{valid:!0,data:c};if(a===K.object&&u===K.object){const v=ne.objectKeys(e),y=ne.objectKeys(c).filter(t=>v.indexOf(t)!==-1),k={...c,...e};for(const t of y){const o=Wt(c[t],e[t]);if(!o.valid)return{valid:!1};k[t]=o.data}return{valid:!0,data:k}}else if(a===K.array&&u===K.array){if(c.length!==e.length)return{valid:!1};const v=[];for(let y=0;y<c.length;y++){const k=c[y],t=e[y],o=Wt(k,t);if(!o.valid)return{valid:!1};v.push(o.data)}return{valid:!0,data:v}}else return a===K.date&&u===K.date&&+c==+e?{valid:!0,data:c}:{valid:!1}}class st extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e),v=(y,k)=>{if(Ft(y)||Ft(k))return Q;const t=Wt(y.value,k.value);return t.valid?((Nt(y)||Nt(k))&&a.dirty(),{status:a.value,value:t.data}):(q(u,{code:j.invalid_intersection_types}),Q)};return u.common.async?Promise.all([this._def.left._parseAsync({data:u.data,path:u.path,parent:u}),this._def.right._parseAsync({data:u.data,path:u.path,parent:u})]).then(([y,k])=>v(y,k)):v(this._def.left._parseSync({data:u.data,path:u.path,parent:u}),this._def.right._parseSync({data:u.data,path:u.path,parent:u}))}}st.create=(c,e,a)=>new st({left:c,right:e,typeName:X.ZodIntersection,...re(a)});class we extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.array)return q(u,{code:j.invalid_type,expected:K.array,received:u.parsedType}),Q;if(u.data.length<this._def.items.length)return q(u,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&u.data.length>this._def.items.length&&(q(u,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const y=[...u.data].map((k,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new Ce(u,k,u.path,t)):null}).filter(k=>!!k);return u.common.async?Promise.all(y).then(k=>le.mergeArray(a,k)):le.mergeArray(a,y)}get items(){return this._def.items}rest(e){return new we({...this._def,rest:e})}}we.create=(c,e)=>{if(!Array.isArray(c))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:c,typeName:X.ZodTuple,rest:null,...re(e)})};class it extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.object)return q(u,{code:j.invalid_type,expected:K.object,received:u.parsedType}),Q;const v=[],y=this._def.keyType,k=this._def.valueType;for(const t in u.data)v.push({key:y._parse(new Ce(u,t,u.path,t)),value:k._parse(new Ce(u,u.data[t],u.path,t)),alwaysSet:t in u.data});return u.common.async?le.mergeObjectAsync(a,v):le.mergeObjectSync(a,v)}get element(){return this._def.valueType}static create(e,a,u){return a instanceof se?new it({keyType:e,valueType:a,typeName:X.ZodRecord,...re(u)}):new it({keyType:ge.create(),valueType:e,typeName:X.ZodRecord,...re(a)})}}class wt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.map)return q(u,{code:j.invalid_type,expected:K.map,received:u.parsedType}),Q;const v=this._def.keyType,y=this._def.valueType,k=[...u.data.entries()].map(([t,o],l)=>({key:v._parse(new Ce(u,t,u.path,[l,"key"])),value:y._parse(new Ce(u,o,u.path,[l,"value"]))}));if(u.common.async){const t=new Map;return Promise.resolve().then(async()=>{for(const o of k){const l=await o.key,_=await o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}})}else{const t=new Map;for(const o of k){const l=o.key,_=o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}}}}wt.create=(c,e,a)=>new wt({valueType:e,keyType:c,typeName:X.ZodMap,...re(a)});class He extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.set)return q(u,{code:j.invalid_type,expected:K.set,received:u.parsedType}),Q;const v=this._def;v.minSize!==null&&u.data.size<v.minSize.value&&(q(u,{code:j.too_small,minimum:v.minSize.value,type:"set",inclusive:!0,exact:!1,message:v.minSize.message}),a.dirty()),v.maxSize!==null&&u.data.size>v.maxSize.value&&(q(u,{code:j.too_big,maximum:v.maxSize.value,type:"set",inclusive:!0,exact:!1,message:v.maxSize.message}),a.dirty());const y=this._def.valueType;function k(o){const l=new Set;for(const _ of o){if(_.status==="aborted")return Q;_.status==="dirty"&&a.dirty(),l.add(_.value)}return{status:a.value,value:l}}const t=[...u.data.values()].map((o,l)=>y._parse(new Ce(u,o,u.path,l)));return u.common.async?Promise.all(t).then(o=>k(o)):k(t)}min(e,a){return new He({...this._def,minSize:{value:e,message:J.toString(a)}})}max(e,a){return new He({...this._def,maxSize:{value:e,message:J.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}He.create=(c,e)=>new He({valueType:c,minSize:null,maxSize:null,typeName:X.ZodSet,...re(e)});class We extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.function)return q(a,{code:j.invalid_type,expected:K.function,received:a.parsedType}),Q;function u(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,vt(),je].filter(l=>!!l),issueData:{code:j.invalid_arguments,argumentsError:o}})}function v(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,vt(),je].filter(l=>!!l),issueData:{code:j.invalid_return_type,returnTypeError:o}})}const y={errorMap:a.common.contextualErrorMap},k=a.data;if(this._def.returns instanceof Ue){const t=this;return de(async function(...o){const l=new fe([]),_=await t._def.args.parseAsync(o,y).catch(m=>{throw l.addIssue(u(o,m)),l}),h=await Reflect.apply(k,this,_);return await t._def.returns._def.type.parseAsync(h,y).catch(m=>{throw l.addIssue(v(h,m)),l})})}else{const t=this;return de(function(...o){const l=t._def.args.safeParse(o,y);if(!l.success)throw new fe([u(o,l.error)]);const _=Reflect.apply(k,this,l.data),h=t._def.returns.safeParse(_,y);if(!h.success)throw new fe([v(_,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new We({...this._def,args:we.create(e).rest(Me.create())})}returns(e){return new We({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,u){return new We({args:e||we.create([]).rest(Me.create()),returns:a||Me.create(),typeName:X.ZodFunction,...re(u)})}}class nt extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}nt.create=(c,e)=>new nt({getter:c,typeName:X.ZodLazy,...re(e)});class ot extends se{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return q(a,{received:a.data,code:j.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}ot.create=(c,e)=>new ot({value:c,typeName:X.ZodLiteral,...re(e)});function Dr(c,e){return new Be({values:c,typeName:X.ZodEnum,...re(e)})}class Be extends se{constructor(){super(...arguments),Ge.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{expected:ne.joinValues(u),received:a.parsedType,code:j.invalid_type}),Q}if(St(this,Ge)||xr(this,Ge,new Set(this._def.values)),!St(this,Ge).has(e.data)){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{received:a.data,code:j.invalid_enum_value,options:u}),Q}return de(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Be.create(e,{...this._def,...a})}exclude(e,a=this._def){return Be.create(this.options.filter(u=>!e.includes(u)),{...this._def,...a})}}Ge=new WeakMap;Be.create=Dr;class at extends se{constructor(){super(...arguments),Je.set(this,void 0)}_parse(e){const a=ne.getValidEnumValues(this._def.values),u=this._getOrReturnCtx(e);if(u.parsedType!==K.string&&u.parsedType!==K.number){const v=ne.objectValues(a);return q(u,{expected:ne.joinValues(v),received:u.parsedType,code:j.invalid_type}),Q}if(St(this,Je)||xr(this,Je,new Set(ne.getValidEnumValues(this._def.values))),!St(this,Je).has(e.data)){const v=ne.objectValues(a);return q(u,{received:u.data,code:j.invalid_enum_value,options:v}),Q}return de(e.data)}get enum(){return this._def.values}}Je=new WeakMap;at.create=(c,e)=>new at({values:c,typeName:X.ZodNativeEnum,...re(e)});class Ue extends se{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.promise&&a.common.async===!1)return q(a,{code:j.invalid_type,expected:K.promise,received:a.parsedType}),Q;const u=a.parsedType===K.promise?a.data:Promise.resolve(a.data);return de(u.then(v=>this._def.type.parseAsync(v,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ue.create=(c,e)=>new Ue({type:c,typeName:X.ZodPromise,...re(e)});class ve extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:u}=this._processInputParams(e),v=this._def.effect||null,y={addIssue:k=>{q(u,k),k.fatal?a.abort():a.dirty()},get path(){return u.path}};if(y.addIssue=y.addIssue.bind(y),v.type==="preprocess"){const k=v.transform(u.data,y);if(u.common.async)return Promise.resolve(k).then(async t=>{if(a.value==="aborted")return Q;const o=await this._def.schema._parseAsync({data:t,path:u.path,parent:u});return o.status==="aborted"?Q:o.status==="dirty"||a.value==="dirty"?Ne(o.value):o});{if(a.value==="aborted")return Q;const t=this._def.schema._parseSync({data:k,path:u.path,parent:u});return t.status==="aborted"?Q:t.status==="dirty"||a.value==="dirty"?Ne(t.value):t}}if(v.type==="refinement"){const k=t=>{const o=v.refinement(t,y);if(u.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(u.common.async===!1){const t=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});return t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value),{status:a.value,value:t.value})}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(t=>t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value).then(()=>({status:a.value,value:t.value}))))}if(v.type==="transform")if(u.common.async===!1){const k=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});if(!Ie(k))return k;const t=v.transform(k.value,y);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(k=>Ie(k)?Promise.resolve(v.transform(k.value,y)).then(t=>({status:a.value,value:t})):k);ne.assertNever(v)}}ve.create=(c,e,a)=>new ve({schema:c,typeName:X.ZodEffects,effect:e,...re(a)});ve.createWithPreprocess=(c,e,a)=>new ve({schema:e,effect:{type:"preprocess",transform:c},typeName:X.ZodEffects,...re(a)});class ye extends se{_parse(e){return this._getType(e)===K.undefined?de(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ye.create=(c,e)=>new ye({innerType:c,typeName:X.ZodOptional,...re(e)});class Oe extends se{_parse(e){return this._getType(e)===K.null?de(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oe.create=(c,e)=>new Oe({innerType:c,typeName:X.ZodNullable,...re(e)});class ct extends se{_parse(e){const{ctx:a}=this._processInputParams(e);let u=a.data;return a.parsedType===K.undefined&&(u=this._def.defaultValue()),this._def.innerType._parse({data:u,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ct.create=(c,e)=>new ct({innerType:c,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class ht extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u={...a,common:{...a.common,issues:[]}},v=this._def.innerType._parse({data:u.data,path:u.path,parent:{...u}});return Xe(v)?v.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})})):{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})}}removeCatch(){return this._def.innerType}}ht.create=(c,e)=>new ht({innerType:c,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Et extends se{_parse(e){if(this._getType(e)!==K.nan){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.nan,received:u.parsedType}),Q}return{status:"valid",value:e.data}}}Et.create=c=>new Et({typeName:X.ZodNaN,...re(c)});const ci=Symbol("zod_brand");class Ut extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=a.data;return this._def.type._parse({data:u,path:a.path,parent:a})}unwrap(){return this._def.type}}class dt extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:u.data,path:u.path,parent:u});return y.status==="aborted"?Q:y.status==="dirty"?(a.dirty(),Ne(y.value)):this._def.out._parseAsync({data:y.value,path:u.path,parent:u})})();{const v=this._def.in._parseSync({data:u.data,path:u.path,parent:u});return v.status==="aborted"?Q:v.status==="dirty"?(a.dirty(),{status:"dirty",value:v.value}):this._def.out._parseSync({data:v.value,path:u.path,parent:u})}}static create(e,a){return new dt({in:e,out:a,typeName:X.ZodPipeline})}}class lt extends se{_parse(e){const a=this._def.innerType._parse(e),u=v=>(Ie(v)&&(v.value=Object.freeze(v.value)),v);return Xe(a)?a.then(v=>u(v)):u(a)}unwrap(){return this._def.innerType}}lt.create=(c,e)=>new lt({innerType:c,typeName:X.ZodReadonly,...re(e)});function tr(c,e){const a=typeof c=="function"?c(e):typeof c=="string"?{message:c}:c;return typeof a=="string"?{message:a}:a}function Tr(c,e={},a){return c?$e.create().superRefine((u,v)=>{var y,k;const t=c(u);if(t instanceof Promise)return t.then(o=>{var l,_;if(!o){const h=tr(e,u),p=(_=(l=h.fatal)!==null&&l!==void 0?l:a)!==null&&_!==void 0?_:!0;v.addIssue({code:"custom",...h,fatal:p})}});if(!t){const o=tr(e,u),l=(k=(y=o.fatal)!==null&&y!==void 0?y:a)!==null&&k!==void 0?k:!0;v.addIssue({code:"custom",...o,fatal:l})}}):$e.create()}const hi={object:ae.lazycreate};var X;(function(c){c.ZodString="ZodString",c.ZodNumber="ZodNumber",c.ZodNaN="ZodNaN",c.ZodBigInt="ZodBigInt",c.ZodBoolean="ZodBoolean",c.ZodDate="ZodDate",c.ZodSymbol="ZodSymbol",c.ZodUndefined="ZodUndefined",c.ZodNull="ZodNull",c.ZodAny="ZodAny",c.ZodUnknown="ZodUnknown",c.ZodNever="ZodNever",c.ZodVoid="ZodVoid",c.ZodArray="ZodArray",c.ZodObject="ZodObject",c.ZodUnion="ZodUnion",c.ZodDiscriminatedUnion="ZodDiscriminatedUnion",c.ZodIntersection="ZodIntersection",c.ZodTuple="ZodTuple",c.ZodRecord="ZodRecord",c.ZodMap="ZodMap",c.ZodSet="ZodSet",c.ZodFunction="ZodFunction",c.ZodLazy="ZodLazy",c.ZodLiteral="ZodLiteral",c.ZodEnum="ZodEnum",c.ZodEffects="ZodEffects",c.ZodNativeEnum="ZodNativeEnum",c.ZodOptional="ZodOptional",c.ZodNullable="ZodNullable",c.ZodDefault="ZodDefault",c.ZodCatch="ZodCatch",c.ZodPromise="ZodPromise",c.ZodBranded="ZodBranded",c.ZodPipeline="ZodPipeline",c.ZodReadonly="ZodReadonly"})(X||(X={}));const li=(c,e={message:`Input not instance of ${c.name}`})=>Tr(a=>a instanceof c,e),Ar=ge.create,Br=Te.create,di=Et.create,ui=Ae.create,Or=Qe.create,fi=Pe.create,_i=yt.create,pi=et.create,gi=tt.create,mi=$e.create,vi=Me.create,bi=Re.create,Si=Ct.create,yi=me.create,Ci=ae.create,wi=ae.strictCreate,Ei=rt.create,xi=xt.create,ki=st.create,Ri=we.create,Li=it.create,Di=wt.create,Ti=He.create,Ai=We.create,Bi=nt.create,Oi=ot.create,Mi=Be.create,Ii=at.create,Pi=Ue.create,rr=ve.create,Hi=ye.create,Fi=Oe.create,Ni=ve.createWithPreprocess,Wi=dt.create,ji=()=>Ar().optional(),$i=()=>Br().optional(),Ui=()=>Or().optional(),zi={string:c=>ge.create({...c,coerce:!0}),number:c=>Te.create({...c,coerce:!0}),boolean:c=>Qe.create({...c,coerce:!0}),bigint:c=>Ae.create({...c,coerce:!0}),date:c=>Pe.create({...c,coerce:!0})},qi=Q;var Vi=Object.freeze({__proto__:null,defaultErrorMap:je,setErrorMap:Ns,getErrorMap:vt,makeIssue:bt,EMPTY_PATH:Ws,addIssueToContext:q,ParseStatus:le,INVALID:Q,DIRTY:Ne,OK:de,isAborted:Ft,isDirty:Nt,isValid:Ie,isAsync:Xe,get util(){return ne},get objectUtil(){return Ht},ZodParsedType:K,getParsedType:ke,ZodType:se,datetimeRegex:Lr,ZodString:ge,ZodNumber:Te,ZodBigInt:Ae,ZodBoolean:Qe,ZodDate:Pe,ZodSymbol:yt,ZodUndefined:et,ZodNull:tt,ZodAny:$e,ZodUnknown:Me,ZodNever:Re,ZodVoid:Ct,ZodArray:me,ZodObject:ae,ZodUnion:rt,ZodDiscriminatedUnion:xt,ZodIntersection:st,ZodTuple:we,ZodRecord:it,ZodMap:wt,ZodSet:He,ZodFunction:We,ZodLazy:nt,ZodLiteral:ot,ZodEnum:Be,ZodNativeEnum:at,ZodPromise:Ue,ZodEffects:ve,ZodTransformer:ve,ZodOptional:ye,ZodNullable:Oe,ZodDefault:ct,ZodCatch:ht,ZodNaN:Et,BRAND:ci,ZodBranded:Ut,ZodPipeline:dt,ZodReadonly:lt,custom:Tr,Schema:se,ZodSchema:se,late:hi,get ZodFirstPartyTypeKind(){return X},coerce:zi,any:mi,array:yi,bigint:ui,boolean:Or,date:fi,discriminatedUnion:xi,effect:rr,enum:Mi,function:Ai,instanceof:li,intersection:ki,lazy:Bi,literal:Oi,map:Di,nan:di,nativeEnum:Ii,never:bi,null:gi,nullable:Fi,number:Br,object:Ci,oboolean:Ui,onumber:$i,optional:Hi,ostring:ji,pipeline:Wi,preprocess:Ni,promise:Pi,record:Li,set:Ti,strictObject:wi,string:Ar,symbol:_i,transformer:rr,tuple:Ri,undefined:pi,union:Ei,unknown:vi,void:Si,NEVER:qi,ZodIssueCode:j,quotelessJson:Fs,ZodError:fe});function Zi(c){const e=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(c);if(!e)return;if(!e[1]||!e[2]||!e[3]||!e[4])throw new Error(`Mouse event: Invalid match for data ${c}`);const a=parseInt(e[1],10),u=parseInt(e[2],10),v=parseInt(e[3],10),y=e[4]==="m";return console.log(`Mouse event: buttonCode=${a}, column=${u}, row=${v}, isRelease=${y}`),c}function Mr(c,e){const a=new Hs.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),u=Cr.macchiato.colors;a.options.theme={background:u.base.hex,black:u.crust.hex,brightBlack:u.surface2.hex,blue:u.blue.hex,brightBlue:u.blue.hex,brightCyan:u.sky.hex,brightRed:u.maroon.hex,brightYellow:u.yellow.hex,cursor:u.text.hex,cyan:u.sky.hex,foreground:u.text.hex,green:u.green.hex,magenta:u.lavender.hex,red:u.red.hex,white:u.text.hex,yellow:u.yellow.hex};const v=new Is.FitAddon;return a.loadAddon(v),a.open(c),v.fit(),window.addEventListener("resize",()=>{v.fit()}),a.onData(y=>{if(typeof y!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(y)}'`);const k=Zi(y);k&&e.onMouseEvent(k)}),a.onKey(y=>{e.onKeyPress(y)}),a}function Ir(){let c=Vi.string().safeParse(sessionStorage.getItem("tabId")).data;return c||(c=Math.random().toString(36),sessionStorage.setItem("tabId",c)),{tabId:c}}class Ki{constructor(e){Se(this,"ready");Se(this,"tabId");Se(this,"terminal");Se(this,"trpc");const a=gr({links:[Sr({condition:y=>y.type==="subscription",true:yr({url:"/trpc"}),false:br({url:"/trpc"})})]});this.trpc=a,this.tabId=Ir();const u=this.tabId,v=Mr(e,{onMouseEvent(y){a.neovim.sendStdin.mutate({tabId:u,data:y}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(y){a.neovim.sendStdin.mutate({tabId:u,data:y.key})}});this.terminal=v,this.ready=new Promise(y=>{console.log("Subscribing to stdout"),a.neovim.onStdout.subscribe({client:u},{onStarted(){y()},onData(k){v.write(k)},onError(k){console.error("Error from the application",k)}})})}async startNeovim(e){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:e.filename,additionalEnvironmentVariables:e.additionalEnvironmentVariables,startupScriptModifications:e.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(e){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}async runLuaCode(e){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...e,tabId:this.tabId})}async runExCommand(e){return await this.ready,this.trpc.neovim.runExCommand.mutate({...e,tabId:this.tabId})}}class Gi{constructor(e){Se(this,"ready");Se(this,"tabId");Se(this,"terminal");Se(this,"trpc");const a=gr({links:[Sr({condition:y=>y.type==="subscription",true:yr({url:"/trpc"}),false:br({url:"/trpc"})})]});this.trpc=a,this.tabId=Ir();const u=this.tabId,v=Mr(e,{onMouseEvent(y){a.terminal.sendStdin.mutate({tabId:u,data:y}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(y){a.terminal.sendStdin.mutate({tabId:u,data:y.key})}});this.terminal=v,this.ready=new Promise(y=>{console.log("Subscribing to stdout"),a.terminal.onStdout.subscribe({client:u},{onStarted(){y()},onData(k){v.write(k)},onError(k){console.error("Error from the application",k)}})})}async startTerminalApplication(e){return await this.ready,await this.trpc.terminal.start.mutate({tabId:this.tabId,startTerminalArguments:{additionalEnvironmentVariables:e.additionalEnvironmentVariables,commandToRun:e.commandToRun,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}}})}async runBlockingShellCommand(e){return await this.ready,this.trpc.terminal.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}}class Pr{constructor(e){Se(this,"value");this.factory=e}get(){return this.value===void 0&&(this.value=this.factory()),this.value}}const zt=document.querySelector("#app");if(!zt)throw new Error("No app element found");const Ji=new Pr(()=>new Ki(zt)),Yi=new Pr(()=>new Gi(zt));window.startNeovim=async function(c){const e=Ji.get(),a=await e.startNeovim({additionalEnvironmentVariables:c==null?void 0:c.additionalEnvironmentVariables,filename:(c==null?void 0:c.filename)??"initial-file.txt",startupScriptModifications:(c==null?void 0:c.startupScriptModifications)??[]});return{runBlockingShellCommand(v){return e.runBlockingShellCommand(v)},runLuaCode(v){return e.runLuaCode(v)},runExCommand(v){return e.runExCommand(v)},dir:a}};window.startTerminalApplication=async function(c){const e=Yi.get();return{dir:await e.startTerminalApplication(c),runBlockingShellCommand(u){return e.runBlockingShellCommand(u)}}};
|