@runmedev/react-components 3.15.12 → 3.15.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app/index.js CHANGED
@@ -146,25 +146,7 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
146
146
  * @license
147
147
  * Copyright 2017 Google LLC
148
148
  * SPDX-License-Identifier: BSD-3-Clause
149
- */function jH(e){return dt({...e,state:!0,attribute:!1})}/**
150
- * @license
151
- * Copyright 2021 Google LLC
152
- * SPDX-License-Identifier: BSD-3-Clause
153
- */function Rn(e,t,n){return e?t(e):n==null?void 0:n(e)}var r5={exports:{}},i5;function zH(){return i5||(i5=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const h=d(9042),g=d(9924),b=d(844),x=d(4725),E=d(2585),v=d(3656);let y=l.AccessibilityManager=class extends b.Disposable{constructor(_,S,N,I){super(),this._terminal=_,this._coreBrowserService=N,this._renderService=I,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
154
- `)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,b.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(_){for(let S=0;S<_;S++)this._handleChar(" ")}_handleChar(_){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==_&&(this._charsToAnnounce+=_):this._charsToAnnounce+=_,_===`
155
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(_){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(_)||this._charsToConsume.push(_)}_refreshRows(_,S){this._liveRegionDebouncer.refresh(_,S,this._terminal.rows)}_renderRows(_,S){const N=this._terminal.buffer,I=N.lines.length.toString();for(let R=_;R<=S;R++){const B=N.lines.get(N.ydisp+R),k=[],L=(B==null?void 0:B.translateToString(!0,void 0,void 0,k))||"",z=(N.ydisp+R+1).toString(),G=this._rowElements[R];G&&(L.length===0?(G.innerText=" ",this._rowColumns.set(G,[0,1])):(G.textContent=L,this._rowColumns.set(G,k)),G.setAttribute("aria-posinset",z),G.setAttribute("aria-setsize",I))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(_,S){const N=_.target,I=this._rowElements[S===0?1:this._rowElements.length-2];if(N.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||_.relatedTarget!==I)return;let R,B;if(S===0?(R=N,B=this._rowElements.pop(),this._rowContainer.removeChild(B)):(R=this._rowElements.shift(),B=N,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),B.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),_.preventDefault(),_.stopImmediatePropagation()}_handleSelectionChange(){var _;if(this._rowElements.length===0)return;const S=document.getSelection();if(!S)return;if(S.isCollapsed)return void(this._rowContainer.contains(S.anchorNode)&&this._terminal.clearSelection());if(!S.anchorNode||!S.focusNode)return void console.error("anchorNode and/or focusNode are null");let N={node:S.anchorNode,offset:S.anchorOffset},I={node:S.focusNode,offset:S.focusOffset};if((N.node.compareDocumentPosition(I.node)&Node.DOCUMENT_POSITION_PRECEDING||N.node===I.node&&N.offset>I.offset)&&([N,I]=[I,N]),N.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(N={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(N.node))return;const R=this._rowElements.slice(-1)[0];if(I.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(I={node:R,offset:((_=R.textContent)==null?void 0:_.length)??0}),!this._rowContainer.contains(I.node))return;const B=({node:z,offset:G})=>{const K=z instanceof Text?z.parentNode:z;let Z=parseInt(K==null?void 0:K.getAttribute("aria-posinset"),10)-1;if(isNaN(Z))return console.warn("row is invalid. Race condition?"),null;const te=this._rowColumns.get(K);if(!te)return console.warn("columns is null. Race condition?"),null;let re=G<te.length?te[G]:te.slice(-1)[0]+1;return re>=this._terminal.cols&&(++Z,re=0),{row:Z,column:re}},k=B(N),L=B(I);if(k&&L){if(k.row>L.row||k.row===L.row&&k.column>=L.column)throw new Error("invalid range");this._terminal.select(k.column,k.row,(L.row-k.row)*this._terminal.cols-k.column+L.column)}}_handleResize(_){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>_;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const _=this._coreBrowserService.mainDocument.createElement("div");return _.setAttribute("role","listitem"),_.tabIndex=-1,this._refreshRowDimensions(_),_}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let _=0;_<this._terminal.rows;_++)this._refreshRowDimensions(this._rowElements[_])}}_refreshRowDimensions(_){_.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=y=f([p(1,E.IInstantiationService),p(2,x.ICoreBrowserService),p(3,x.IRenderService)],y)},3614:(c,l)=>{function d(g){return g.replace(/\r?\n/g,"\r")}function f(g,b){return b?"\x1B[200~"+g+"\x1B[201~":g}function p(g,b,x,E){g=f(g=d(g),x.decPrivateModes.bracketedPasteMode&&E.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(g,!0),b.value=""}function h(g,b,x){const E=x.getBoundingClientRect(),v=g.clientX-E.left-10,y=g.clientY-E.top-10;b.style.width="20px",b.style.height="20px",b.style.left=`${v}px`,b.style.top=`${y}px`,b.style.zIndex="1000",b.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=f,l.copyHandler=function(g,b){g.clipboardData&&g.clipboardData.setData("text/plain",b.selectionText),g.preventDefault()},l.handlePasteEvent=function(g,b,x,E){g.stopPropagation(),g.clipboardData&&p(g.clipboardData.getData("text/plain"),b,x,E)},l.paste=p,l.moveTextAreaUnderMouseCursor=h,l.rightClickHandler=function(g,b,x,E,v){h(g,b,x),v&&E.rightClickSelect(g),b.value=E.selectionText,b.select()}},7239:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=d(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,h,g){this._css.set(p,h,g)}getCss(p,h){return this._css.get(p,h)}setColor(p,h,g){this._color.set(p,h,g)}getColor(p,h){return this._color.get(p,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,f,p,h){d.addEventListener(f,p,h);let g=!1;return{dispose:()=>{g||(g=!0,d.removeEventListener(f,p,h))}}}},3551:function(c,l,d){var f=this&&this.__decorate||function(y,_,S,N){var I,R=arguments.length,B=R<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,_,S,N);else for(var k=y.length-1;k>=0;k--)(I=y[k])&&(B=(R<3?I(B):R>3?I(_,S,B):I(_,S))||B);return R>3&&B&&Object.defineProperty(_,S,B),B},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const h=d(3656),g=d(8460),b=d(844),x=d(2585),E=d(4725);let v=l.Linkifier=class extends b.Disposable{get currentLink(){return this._currentLink}constructor(y,_,S,N,I){super(),this._element=y,this._mouseService=_,this._renderService=S,this._bufferService=N,this._linkProviderService=I,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,b.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,b.toDisposable)((()=>{var R;this._lastMouseEvent=void 0,(R=this._activeProviderReplies)==null||R.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(y){this._lastMouseEvent=y;const _=this._positionFromMouseEvent(y,this._element,this._mouseService);if(!_)return;this._isMouseOut=!1;const S=y.composedPath();for(let N=0;N<S.length;N++){const I=S[N];if(I.classList.contains("xterm"))break;if(I.classList.contains("xterm-hover"))return}this._lastBufferCell&&_.x===this._lastBufferCell.x&&_.y===this._lastBufferCell.y||(this._handleHover(_),this._lastBufferCell=_)}_handleHover(y){if(this._activeLine!==y.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(y,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,y)||(this._clearCurrentLink(),this._askForLink(y,!0))}_askForLink(y,_){var S,N;this._activeProviderReplies&&_||((S=this._activeProviderReplies)==null||S.forEach((R=>{R==null||R.forEach((B=>{B.link.dispose&&B.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=y.y);let I=!1;for(const[R,B]of this._linkProviderService.linkProviders.entries())_?(N=this._activeProviderReplies)!=null&&N.get(R)&&(I=this._checkLinkProviderResult(R,y,I)):B.provideLinks(y.y,(k=>{var L,z;if(this._isMouseOut)return;const G=k==null?void 0:k.map((K=>({link:K})));(L=this._activeProviderReplies)==null||L.set(R,G),I=this._checkLinkProviderResult(R,y,I),((z=this._activeProviderReplies)==null?void 0:z.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(y.y,this._activeProviderReplies)}))}_removeIntersectingLinks(y,_){const S=new Set;for(let N=0;N<_.size;N++){const I=_.get(N);if(I)for(let R=0;R<I.length;R++){const B=I[R],k=B.link.range.start.y<y?0:B.link.range.start.x,L=B.link.range.end.y>y?this._bufferService.cols:B.link.range.end.x;for(let z=k;z<=L;z++){if(S.has(z)){I.splice(R--,1);break}S.add(z)}}}}_checkLinkProviderResult(y,_,S){var N;if(!this._activeProviderReplies)return S;const I=this._activeProviderReplies.get(y);let R=!1;for(let B=0;B<y;B++)this._activeProviderReplies.has(B)&&!this._activeProviderReplies.get(B)||(R=!0);if(!R&&I){const B=I.find((k=>this._linkAtPosition(k.link,_)));B&&(S=!0,this._handleNewLink(B))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let B=0;B<this._activeProviderReplies.size;B++){const k=(N=this._activeProviderReplies.get(B))==null?void 0:N.find((L=>this._linkAtPosition(L.link,_)));if(k){S=!0,this._handleNewLink(k);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(y){if(!this._currentLink)return;const _=this._positionFromMouseEvent(y,this._element,this._mouseService);_&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,_)&&this._currentLink.link.activate(y,this._currentLink.link.text)}_clearCurrentLink(y,_){this._currentLink&&this._lastMouseEvent&&(!y||!_||this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=_)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,b.disposeArray)(this._linkCacheDisposables))}_handleNewLink(y){if(!this._lastMouseEvent)return;const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._linkAtPosition(y.link,_)&&(this._currentLink=y,this._currentLink.state={decorations:{underline:y.link.decorations===void 0||y.link.decorations.underline,pointerCursor:y.link.decorations===void 0||y.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,y.link,this._lastMouseEvent),y.link.decorations={},Object.defineProperties(y.link.decorations,{pointerCursor:{get:()=>{var S,N;return(N=(S=this._currentLink)==null?void 0:S.state)==null?void 0:N.decorations.pointerCursor},set:S=>{var N;(N=this._currentLink)!=null&&N.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,N;return(N=(S=this._currentLink)==null?void 0:S.state)==null?void 0:N.decorations.underline},set:S=>{var N,I,R;(N=this._currentLink)!=null&&N.state&&((R=(I=this._currentLink)==null?void 0:I.state)==null?void 0:R.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(y.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const N=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,I=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=N&&this._currentLink.link.range.end.y<=I&&(this._clearCurrentLink(N,I),this._lastMouseEvent)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(y,_,S){var N;(N=this._currentLink)!=null&&N.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!0),this._currentLink.state.decorations.pointerCursor&&y.classList.add("xterm-cursor-pointer")),_.hover&&_.hover(S,_.text)}_fireUnderlineEvent(y,_){const S=y.range,N=this._bufferService.buffer.ydisp,I=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-N-1,S.end.x,S.end.y-N-1,void 0);(_?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(I)}_linkLeave(y,_,S){var N;(N=this._currentLink)!=null&&N.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!1),this._currentLink.state.decorations.pointerCursor&&y.classList.remove("xterm-cursor-pointer")),_.leave&&_.leave(S,_.text)}_linkAtPosition(y,_){const S=y.range.start.y*this._bufferService.cols+y.range.start.x,N=y.range.end.y*this._bufferService.cols+y.range.end.x,I=_.y*this._bufferService.cols+_.x;return S<=I&&I<=N}_positionFromMouseEvent(y,_,S){const N=S.getCoords(y,_,this._bufferService.cols,this._bufferService.rows);if(N)return{x:N[0],y:N[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(y,_,S,N,I){return{x1:y,y1:_,x2:S,y2:N,cols:this._bufferService.cols,fg:I}}};l.Linkifier=v=f([p(1,E.IMouseService),p(2,E.IRenderService),p(3,x.IBufferService),p(4,E.ILinkProviderService)],v)},9042:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,l,d){var f=this&&this.__decorate||function(E,v,y,_){var S,N=arguments.length,I=N<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(E,v,y,_);else for(var R=E.length-1;R>=0;R--)(S=E[R])&&(I=(N<3?S(I):N>3?S(v,y,I):S(v,y))||I);return N>3&&I&&Object.defineProperty(v,y,I),I},p=this&&this.__param||function(E,v){return function(y,_){v(y,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const h=d(511),g=d(2585);let b=l.OscLinkProvider=class{constructor(E,v,y){this._bufferService=E,this._optionsService=v,this._oscLinkService=y}provideLinks(E,v){var y;const _=this._bufferService.buffer.lines.get(E-1);if(!_)return void v(void 0);const S=[],N=this._optionsService.rawOptions.linkHandler,I=new h.CellData,R=_.getTrimmedLength();let B=-1,k=-1,L=!1;for(let z=0;z<R;z++)if(k!==-1||_.hasContent(z)){if(_.loadCell(z,I),I.hasExtendedAttrs()&&I.extended.urlId){if(k===-1){k=z,B=I.extended.urlId;continue}L=I.extended.urlId!==B}else k!==-1&&(L=!0);if(L||k!==-1&&z===R-1){const G=(y=this._oscLinkService.getLinkData(B))==null?void 0:y.uri;if(G){const K={start:{x:k+1,y:E},end:{x:z+(L||z!==R-1?0:1),y:E}};let Z=!1;if(!(N!=null&&N.allowNonHttpProtocols))try{const te=new URL(G);["http:","https:"].includes(te.protocol)||(Z=!0)}catch{Z=!0}Z||S.push({text:G,range:K,activate:(te,re)=>N?N.activate(te,re,K):x(0,re),hover:(te,re)=>{var Q;return(Q=N==null?void 0:N.hover)==null?void 0:Q.call(N,te,re,K)},leave:(te,re)=>{var Q;return(Q=N==null?void 0:N.leave)==null?void 0:Q.call(N,te,re,K)}})}L=!1,I.hasExtendedAttrs()&&I.extended.urlId?(k=z,B=I.extended.urlId):(k=-1,B=-1)}}v(S)}};function x(E,v){if(confirm(`Do you want to navigate to ${v}?
156
-
157
- WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=b=f([p(0,g.IBufferService),p(1,g.IOptionsService),p(2,g.IOscLinkService)],b)},6193:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,f){this._renderCallback=d,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,f,p){this._rowCount=p,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=d(3614),p=d(3656),h=d(3551),g=d(9042),b=d(3730),x=d(1680),E=d(3107),v=d(5744),y=d(2950),_=d(1296),S=d(428),N=d(4269),I=d(5114),R=d(8934),B=d(3230),k=d(9312),L=d(4725),z=d(6731),G=d(8055),K=d(8969),Z=d(8460),te=d(844),re=d(6114),Q=d(8437),de=d(2584),ee=d(7399),P=d(5941),M=d(9074),V=d(2585),$=d(5435),H=d(4567),ye=d(779);class Ae extends K.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(ie={}){super(ie),this.browser=re,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new te.MutableDisposable),this._onCursorMove=this.register(new Z.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new Z.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new Z.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new Z.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new Z.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new Z.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new Z.EventEmitter),this._onBlur=this.register(new Z.EventEmitter),this._onA11yCharEmitter=this.register(new Z.EventEmitter),this._onA11yTabEmitter=this.register(new Z.EventEmitter),this._onWillOpen=this.register(new Z.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(V.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ye.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(b.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((J,fe)=>this.refresh(J,fe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((J=>this._reportWindowsOptions(J)))),this.register(this._inputHandler.onColor((J=>this._handleColorEvent(J)))),this.register((0,Z.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,Z.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,Z.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,Z.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((J=>this._afterResize(J.cols,J.rows)))),this.register((0,te.toDisposable)((()=>{var J,fe;this._customKeyEventHandler=void 0,(fe=(J=this.element)==null?void 0:J.parentNode)==null||fe.removeChild(this.element)})))}_handleColorEvent(ie){if(this._themeService)for(const J of ie){let fe,Te="";switch(J.index){case 256:fe="foreground",Te="10";break;case 257:fe="background",Te="11";break;case 258:fe="cursor",Te="12";break;default:fe="ansi",Te="4;"+J.index}switch(J.type){case 0:const We=G.color.toColorRGB(fe==="ansi"?this._themeService.colors.ansi[J.index]:this._themeService.colors[fe]);this.coreService.triggerDataEvent(`${de.C0.ESC}]${Te};${(0,P.toRgbString)(We)}${de.C1_ESCAPED.ST}`);break;case 1:if(fe==="ansi")this._themeService.modifyColors((Me=>Me.ansi[J.index]=G.channels.toColor(...J.color)));else{const Me=fe;this._themeService.modifyColors((it=>it[Me]=G.channels.toColor(...J.color)))}break;case 2:this._themeService.restoreColor(J.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(ie){ie?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(ie){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var ie;return(ie=this.textarea)==null?void 0:ie.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const ie=this.buffer.ybase+this.buffer.y,J=this.buffer.lines.get(ie);if(!J)return;const fe=Math.min(this.buffer.x,this.cols-1),Te=this._renderService.dimensions.css.cell.height,We=J.getWidth(fe),Me=this._renderService.dimensions.css.cell.width*We,it=this.buffer.y*this._renderService.dimensions.css.cell.height,Ct=fe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ct+"px",this.textarea.style.top=it+"px",this.textarea.style.width=Me+"px",this.textarea.style.height=Te+"px",this.textarea.style.lineHeight=Te+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(J=>{this.hasSelection()&&(0,f.copyHandler)(J,this._selectionService)})));const ie=J=>(0,f.handlePasteEvent)(J,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",ie)),this.register((0,p.addDisposableDomListener)(this.element,"paste",ie)),re.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(J=>{J.button===2&&(0,f.rightClickHandler)(J,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(J=>{(0,f.rightClickHandler)(J,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),re.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(J=>{J.button===1&&(0,f.moveTextAreaUnderMouseCursor)(J,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(ie=>this._keyUp(ie)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(ie=>this._keyDown(ie)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(ie=>this._keyPress(ie)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(ie=>this._compositionHelper.compositionupdate(ie)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(ie=>this._inputEvent(ie)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(ie){var J;if(!ie)throw new Error("Terminal requires a parent element.");if(ie.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((J=this.element)==null?void 0:J.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=ie.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),ie.appendChild(this.element);const fe=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),fe.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(Te=>this.updateCursorStyle(Te)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),fe.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),re.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(I.CoreBrowserService,this.textarea,ie.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(Te=>this._handleTextAreaFocus(Te)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(N.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(B.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Te=>this._onRender.fire(Te)))),this.onResize((Te=>this._renderService.resize(Te.cols,Te.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(fe);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Te=>this.scrollLines(Te.amount,Te.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Te=>this.scrollLines(Te.amount,Te.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Te=>this._renderService.handleSelectionChanged(Te.start,Te.end,Te.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Te=>{this.textarea.value=Te,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Te=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(E.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(Te=>this._selectionService.handleMouseDown(Te)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Te=>this._handleScreenReaderModeOptionChange(Te)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Te=>{!this._overviewRulerRenderer&&Te&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const ie=this,J=this.element;function fe(Me){const it=ie._mouseService.getMouseReportCoords(Me,ie.screenElement);if(!it)return!1;let Ct,St;switch(Me.overrideType||Me.type){case"mousemove":St=32,Me.buttons===void 0?(Ct=3,Me.button!==void 0&&(Ct=Me.button<3?Me.button:3)):Ct=1&Me.buttons?0:4&Me.buttons?1:2&Me.buttons?2:3;break;case"mouseup":St=0,Ct=Me.button<3?Me.button:3;break;case"mousedown":St=1,Ct=Me.button<3?Me.button:3;break;case"wheel":if(ie._customWheelEventHandler&&ie._customWheelEventHandler(Me)===!1||ie.viewport.getLinesScrolled(Me)===0)return!1;St=Me.deltaY<0?0:1,Ct=4;break;default:return!1}return!(St===void 0||Ct===void 0||Ct>4)&&ie.coreMouseService.triggerMouseEvent({col:it.col,row:it.row,x:it.x,y:it.y,button:Ct,action:St,ctrl:Me.ctrlKey,alt:Me.altKey,shift:Me.shiftKey})}const Te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},We={mouseup:Me=>(fe(Me),Me.buttons||(this._document.removeEventListener("mouseup",Te.mouseup),Te.mousedrag&&this._document.removeEventListener("mousemove",Te.mousedrag)),this.cancel(Me)),wheel:Me=>(fe(Me),this.cancel(Me,!0)),mousedrag:Me=>{Me.buttons&&fe(Me)},mousemove:Me=>{Me.buttons||fe(Me)}};this.register(this.coreMouseService.onProtocolChange((Me=>{Me?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Me)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Me?Te.mousemove||(J.addEventListener("mousemove",We.mousemove),Te.mousemove=We.mousemove):(J.removeEventListener("mousemove",Te.mousemove),Te.mousemove=null),16&Me?Te.wheel||(J.addEventListener("wheel",We.wheel,{passive:!1}),Te.wheel=We.wheel):(J.removeEventListener("wheel",Te.wheel),Te.wheel=null),2&Me?Te.mouseup||(Te.mouseup=We.mouseup):(this._document.removeEventListener("mouseup",Te.mouseup),Te.mouseup=null),4&Me?Te.mousedrag||(Te.mousedrag=We.mousedrag):(this._document.removeEventListener("mousemove",Te.mousedrag),Te.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(J,"mousedown",(Me=>{if(Me.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Me))return fe(Me),Te.mouseup&&this._document.addEventListener("mouseup",Te.mouseup),Te.mousedrag&&this._document.addEventListener("mousemove",Te.mousedrag),this.cancel(Me)}))),this.register((0,p.addDisposableDomListener)(J,"wheel",(Me=>{if(!Te.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Me)===!1)return!1;if(!this.buffer.hasScrollback){const it=this.viewport.getLinesScrolled(Me);if(it===0)return;const Ct=de.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Me.deltaY<0?"A":"B");let St="";for(let en=0;en<Math.abs(it);en++)St+=Ct;return this.coreService.triggerDataEvent(St,!0),this.cancel(Me,!0)}return this.viewport.handleWheel(Me)?this.cancel(Me):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(J,"touchstart",(Me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Me),this.cancel(Me)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(J,"touchmove",(Me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Me)?void 0:this.cancel(Me)}),{passive:!1}))}refresh(ie,J){var fe;(fe=this._renderService)==null||fe.refreshRows(ie,J)}updateCursorStyle(ie){var J;(J=this._selectionService)!=null&&J.shouldColumnSelect(ie)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(ie,J,fe=0){var Te;fe===1?(super.scrollLines(ie,J,fe),this.refresh(0,this.rows-1)):(Te=this.viewport)==null||Te.scrollLines(ie)}paste(ie){(0,f.paste)(ie,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(ie){this._customKeyEventHandler=ie}attachCustomWheelEventHandler(ie){this._customWheelEventHandler=ie}registerLinkProvider(ie){return this._linkProviderService.registerLinkProvider(ie)}registerCharacterJoiner(ie){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const J=this._characterJoinerService.register(ie);return this.refresh(0,this.rows-1),J}deregisterCharacterJoiner(ie){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ie)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(ie){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ie)}registerDecoration(ie){return this._decorationService.registerDecoration(ie)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(ie,J,fe){this._selectionService.setSelection(ie,J,fe)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var ie;(ie=this._selectionService)==null||ie.clearSelection()}selectAll(){var ie;(ie=this._selectionService)==null||ie.selectAll()}selectLines(ie,J){var fe;(fe=this._selectionService)==null||fe.selectLines(ie,J)}_keyDown(ie){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(ie)===!1)return!1;const J=this.browser.isMac&&this.options.macOptionIsMeta&&ie.altKey;if(!J&&!this._compositionHelper.keydown(ie))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;J||ie.key!=="Dead"&&ie.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const fe=(0,ee.evaluateKeyboardEvent)(ie,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ie),fe.type===3||fe.type===2){const Te=this.rows-1;return this.scrollLines(fe.type===2?-Te:Te),this.cancel(ie,!0)}return fe.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ie)||(fe.cancel&&this.cancel(ie,!0),!fe.key||!!(ie.key&&!ie.ctrlKey&&!ie.altKey&&!ie.metaKey&&ie.key.length===1&&ie.key.charCodeAt(0)>=65&&ie.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(fe.key!==de.C0.ETX&&fe.key!==de.C0.CR||(this.textarea.value=""),this._onKey.fire({key:fe.key,domEvent:ie}),this._showCursor(),this.coreService.triggerDataEvent(fe.key,!0),!this.optionsService.rawOptions.screenReaderMode||ie.altKey||ie.ctrlKey?this.cancel(ie,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(ie,J){const fe=ie.isMac&&!this.options.macOptionIsMeta&&J.altKey&&!J.ctrlKey&&!J.metaKey||ie.isWindows&&J.altKey&&J.ctrlKey&&!J.metaKey||ie.isWindows&&J.getModifierState("AltGraph");return J.type==="keypress"?fe:fe&&(!J.keyCode||J.keyCode>47)}_keyUp(ie){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ie)===!1||((function(J){return J.keyCode===16||J.keyCode===17||J.keyCode===18})(ie)||this.focus(),this.updateCursorStyle(ie),this._keyPressHandled=!1)}_keyPress(ie){let J;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ie)===!1)return!1;if(this.cancel(ie),ie.charCode)J=ie.charCode;else if(ie.which===null||ie.which===void 0)J=ie.keyCode;else{if(ie.which===0||ie.charCode===0)return!1;J=ie.which}return!(!J||(ie.altKey||ie.ctrlKey||ie.metaKey)&&!this._isThirdLevelShift(this.browser,ie)||(J=String.fromCharCode(J),this._onKey.fire({key:J,domEvent:ie}),this._showCursor(),this.coreService.triggerDataEvent(J,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(ie){if(ie.data&&ie.inputType==="insertText"&&(!ie.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const J=ie.data;return this.coreService.triggerDataEvent(J,!0),this.cancel(ie),!0}return!1}resize(ie,J){ie!==this.cols||J!==this.rows?super.resize(ie,J):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(ie,J){var fe,Te;(fe=this._charSizeService)==null||fe.measure(),(Te=this.viewport)==null||Te.syncScrollArea(!0)}clear(){var ie;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let J=1;J<this.rows;J++)this.buffer.lines.push(this.buffer.getBlankLine(Q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(ie=this.viewport)==null||ie.reset(),this.refresh(0,this.rows-1)}}reset(){var ie,J;this.options.rows=this.rows,this.options.cols=this.cols;const fe=this._customKeyEventHandler;this._setup(),super.reset(),(ie=this._selectionService)==null||ie.reset(),this._decorationService.reset(),(J=this.viewport)==null||J.reset(),this._customKeyEventHandler=fe,this.refresh(0,this.rows-1)}clearTextureAtlas(){var ie;(ie=this._renderService)==null||ie.clearTextureAtlas()}_reportFocus(){var ie;(ie=this.element)!=null&&ie.classList.contains("focus")?this.coreService.triggerDataEvent(de.C0.ESC+"[I"):this.coreService.triggerDataEvent(de.C0.ESC+"[O")}_reportWindowsOptions(ie){if(this._renderService)switch(ie){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const J=this._renderService.dimensions.css.canvas.width.toFixed(0),fe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${de.C0.ESC}[4;${fe};${J}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Te=this._renderService.dimensions.css.cell.width.toFixed(0),We=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${de.C0.ESC}[6;${We};${Te}t`)}}cancel(ie,J){if(this.options.cancelEvents||J)return ie.preventDefault(),ie.stopPropagation(),!1}}l.Terminal=Ae},9924:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,f=1e3){this._renderCallback=d,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,f,p){this._rowCount=p,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=h-this._lastRefreshMs,b=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),b)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f)}}},1680:function(c,l,d){var f=this&&this.__decorate||function(y,_,S,N){var I,R=arguments.length,B=R<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,_,S,N);else for(var k=y.length-1;k>=0;k--)(I=y[k])&&(B=(R<3?I(B):R>3?I(_,S,B):I(_,S))||B);return R>3&&B&&Object.defineProperty(_,S,B),B},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const h=d(3656),g=d(4725),b=d(8460),x=d(844),E=d(2585);let v=l.Viewport=class extends x.Disposable{constructor(y,_,S,N,I,R,B,k){super(),this._viewportElement=y,this._scrollArea=_,this._bufferService=S,this._optionsService=N,this._charSizeService=I,this._renderService=R,this._coreBrowserService=B,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(y){if(y)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const _=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==_&&(this._lastRecordedBufferHeight=_,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const _=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(y,_){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(_<0&&this._viewportElement.scrollTop!==0||_>0&&S<this._lastRecordedBufferHeight)||(y.cancelable&&y.preventDefault(),!1)}handleWheel(y){const _=this._getPixelsScrolled(y);return _!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+_:this._smoothScrollState.target+=_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=_,this._bubbleScroll(y,_))}scrollLines(y){if(y!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const _=y*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!1})}_getPixelsScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let _=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_LINE?_*=this._currentRowHeight:y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._currentRowHeight*this._bufferService.rows),_}getBufferElements(y,_){var S;let N,I="";const R=[],B=_??this._bufferService.buffer.lines.length,k=this._bufferService.buffer.lines;for(let L=y;L<B;L++){const z=k.get(L);if(!z)continue;const G=(S=k.get(L+1))==null?void 0:S.isWrapped;if(I+=z.translateToString(!G),!G||L===k.length-1){const K=document.createElement("div");K.textContent=I,R.push(K),I.length>0&&(N=K),I=""}}return{bufferElements:R,cursorElement:N}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let _=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(_/=this._currentRowHeight+0,this._wheelPartialScroll+=_,_=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._bufferService.rows),_}_applyScrollModifier(y,_){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&_.altKey||S==="ctrl"&&_.ctrlKey||S==="shift"&&_.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const _=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,_!==0&&(this._viewportElement.scrollTop+=_,this._bubbleScroll(y,_))}};l.Viewport=v=f([p(2,E.IBufferService),p(3,E.IOptionsService),p(4,g.ICharSizeService),p(5,g.IRenderService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],v)},3107:function(c,l,d){var f=this&&this.__decorate||function(E,v,y,_){var S,N=arguments.length,I=N<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(E,v,y,_);else for(var R=E.length-1;R>=0;R--)(S=E[R])&&(I=(N<3?S(I):N>3?S(v,y,I):S(v,y))||I);return N>3&&I&&Object.defineProperty(v,y,I),I},p=this&&this.__param||function(E,v){return function(y,_){v(y,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const h=d(4725),g=d(844),b=d(2585);let x=l.BufferDecorationRenderer=class extends g.Disposable{constructor(E,v,y,_,S){super(),this._screenElement=E,this._bufferService=v,this._coreBrowserService=y,this._decorationService=_,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((N=>this._removeDecoration(N)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const E of this._decorationService.decorations)this._renderDecoration(E);this._dimensionsChanged=!1}_renderDecoration(E){this._refreshStyle(E),this._dimensionsChanged&&this._refreshXPosition(E)}_createElement(E){var v;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((v=E==null?void 0:E.options)==null?void 0:v.layer)==="top"),y.style.width=`${Math.round((E.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(E.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(E.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=E.options.x??0;return _&&_>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(E,y),y}_refreshStyle(E){const v=E.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)E.element&&(E.element.style.display="none",E.onRenderEmitter.fire(E.element));else{let y=this._decorationElements.get(E);y||(y=this._createElement(E),E.element=y,this._decorationElements.set(E,y),this._container.appendChild(y),E.onDispose((()=>{this._decorationElements.delete(E),y.remove()}))),y.style.top=v*this._renderService.dimensions.css.cell.height+"px",y.style.display=this._altBufferIsActive?"none":"block",E.onRenderEmitter.fire(y)}}_refreshXPosition(E,v=E.element){if(!v)return;const y=E.options.x??0;(E.options.anchor||"left")==="right"?v.style.right=y?y*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=y?y*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(E){var v;(v=this._decorationElements.get(E))==null||v.remove(),this._decorationElements.delete(E),E.dispose()}};l.BufferDecorationRenderer=x=f([p(1,b.IBufferService),p(2,h.ICoreBrowserService),p(3,b.IDecorationService),p(4,h.IRenderService)],x)},5871:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const f of this._zones)if(f.color===d.options.overviewRulerOptions.color&&f.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,d.marker.line))return;if(this._lineAdjacentToZone(f,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(f,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,f){return f>=d.startBufferLine&&f<=d.endBufferLine}_lineAdjacentToZone(d,f,p){return f>=d.startBufferLine-this._linePadding[p||"full"]&&f<=d.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(c,l,d){var f=this&&this.__decorate||function(S,N,I,R){var B,k=arguments.length,L=k<3?N:R===null?R=Object.getOwnPropertyDescriptor(N,I):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,I,R);else for(var z=S.length-1;z>=0;z--)(B=S[z])&&(L=(k<3?B(L):k>3?B(N,I,L):B(N,I))||L);return k>3&&L&&Object.defineProperty(N,I,L),L},p=this&&this.__param||function(S,N){return function(I,R){N(I,R,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const h=d(5871),g=d(4725),b=d(844),x=d(2585),E={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0};let _=l.OverviewRulerRenderer=class extends b.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,N,I,R,B,k,L){var z;super(),this._viewportElement=S,this._screenElement=N,this._bufferService=I,this._decorationService=R,this._renderService=B,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(z=this._viewportElement.parentElement)==null||z.insertBefore(this._canvas,this._viewportElement);const G=this._canvas.getContext("2d");if(!G)throw new Error("Ctx cannot be null");this._ctx=G,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,b.toDisposable)((()=>{var K;(K=this._canvas)==null||K.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),N=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=S,v.center=N,v.right=S,this._refreshDrawHeightConstants(),y.full=0,y.left=0,y.center=v.left,y.right=v.left+v.center}_refreshDrawHeightConstants(){E.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,N=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);E.left=N,E.center=N,E.right=N}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const N of this._decorationService.decorations)this._colorZoneStore.addDecoration(N);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const N of S)N.position!=="full"&&this._renderColorZone(N);for(const N of S)N.position==="full"&&this._renderColorZone(N);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(y[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-E[S.position||"full"]/2),v[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+E[S.position||"full"]))}_queueRefresh(S,N){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=N||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=_=f([p(2,x.IBufferService),p(3,x.IDecorationService),p(4,g.IRenderService),p(5,x.IOptionsService),p(6,g.ICoreBrowserService)],_)},2950:function(c,l,d){var f=this&&this.__decorate||function(E,v,y,_){var S,N=arguments.length,I=N<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(E,v,y,_);else for(var R=E.length-1;R>=0;R--)(S=E[R])&&(I=(N<3?S(I):N>3?S(v,y,I):S(v,y))||I);return N>3&&I&&Object.defineProperty(v,y,I),I},p=this&&this.__param||function(E,v){return function(y,_){v(y,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const h=d(4725),g=d(2585),b=d(2584);let x=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(E,v,y,_,S,N){this._textarea=E,this._compositionView=v,this._bufferService=y,this._optionsService=_,this._coreService=S,this._renderService=N,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(E){this._compositionView.textContent=E.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(E){if(this._isComposing||this._isSendingComposition){if(E.keyCode===229||E.keyCode===16||E.keyCode===17||E.keyCode===18)return!1;this._finalizeComposition(!1)}return E.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(E){if(this._compositionView.classList.remove("active"),this._isComposing=!1,E){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),y.length>0&&this._coreService.triggerDataEvent(y,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const E=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,y=v.replace(E,"");this._dataAlreadySent=y,v.length>E.length?this._coreService.triggerDataEvent(y,!0):v.length<E.length?this._coreService.triggerDataEvent(`${b.C0.DEL}`,!0):v.length===E.length&&v!==E&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(E){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._renderService.dimensions.css.cell.height,_=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=_+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const N=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=_+"px",this._textarea.style.width=Math.max(N.width,1)+"px",this._textarea.style.height=Math.max(N.height,1)+"px",this._textarea.style.lineHeight=N.height+"px"}E||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=x=f([p(2,g.IBufferService),p(3,g.IOptionsService),p(4,g.ICoreService),p(5,h.IRenderService)],x)},9806:(c,l)=>{function d(f,p,h){const g=h.getBoundingClientRect(),b=f.getComputedStyle(h),x=parseInt(b.getPropertyValue("padding-left")),E=parseInt(b.getPropertyValue("padding-top"));return[p.clientX-g.left-x,p.clientY-g.top-E]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(f,p,h,g,b,x,E,v,y){if(!x)return;const _=d(f,p,h);return _?(_[0]=Math.ceil((_[0]+(y?E/2:0))/E),_[1]=Math.ceil(_[1]/v),_[0]=Math.min(Math.max(_[0],1),g+(y?1:0)),_[1]=Math.min(Math.max(_[1],1),b),_):void 0}},9504:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=d(2584);function p(v,y,_,S){const N=v-h(v,_),I=y-h(y,_),R=Math.abs(N-I)-(function(B,k,L){let z=0;const G=B-h(B,L),K=k-h(k,L);for(let Z=0;Z<Math.abs(G-K);Z++){const te=g(B,k)==="A"?-1:1,re=L.buffer.lines.get(G+te*Z);re!=null&&re.isWrapped&&z++}return z})(v,y,_);return E(R,x(g(v,y),S))}function h(v,y){let _=0,S=y.buffer.lines.get(v),N=S==null?void 0:S.isWrapped;for(;N&&v>=0&&v<y.rows;)_++,S=y.buffer.lines.get(--v),N=S==null?void 0:S.isWrapped;return _}function g(v,y){return v>y?"A":"B"}function b(v,y,_,S,N,I){let R=v,B=y,k="";for(;R!==_||B!==S;)R+=N?1:-1,N&&R>I.cols-1?(k+=I.buffer.translateBufferLineToString(B,!1,v,R),R=0,v=0,B++):!N&&R<0&&(k+=I.buffer.translateBufferLineToString(B,!1,0,v+1),R=I.cols-1,v=R,B--);return k+I.buffer.translateBufferLineToString(B,!1,v,R)}function x(v,y){const _=y?"O":"[";return f.C0.ESC+_+v}function E(v,y){v=Math.floor(v);let _="";for(let S=0;S<v;S++)_+=y;return _}l.moveToCellSequence=function(v,y,_,S){const N=_.buffer.x,I=_.buffer.y;if(!_.buffer.hasScrollback)return(function(k,L,z,G,K,Z){return p(L,G,K,Z).length===0?"":E(b(k,L,k,L-h(L,K),!1,K).length,x("D",Z))})(N,I,0,y,_,S)+p(I,y,_,S)+(function(k,L,z,G,K,Z){let te;te=p(L,G,K,Z).length>0?G-h(G,K):L;const re=G,Q=(function(de,ee,P,M,V,$){let H;return H=p(P,M,V,$).length>0?M-h(M,V):ee,de<P&&H<=M||de>=P&&H<M?"C":"D"})(k,L,z,G,K,Z);return E(b(k,te,z,re,Q==="C",K).length,x(Q,Z))})(N,I,v,y,_,S);let R;if(I===y)return R=N>v?"D":"C",E(Math.abs(N-v),x(R,S));R=I>y?"D":"C";const B=Math.abs(I-y);return E((function(k,L){return L.cols-k})(I>y?v:N,_)+(B-1)*_.cols+1+((I>y?N:v)-1),x(R,S))}},1296:function(c,l,d){var f=this&&this.__decorate||function(Z,te,re,Q){var de,ee=arguments.length,P=ee<3?te:Q===null?Q=Object.getOwnPropertyDescriptor(te,re):Q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(Z,te,re,Q);else for(var M=Z.length-1;M>=0;M--)(de=Z[M])&&(P=(ee<3?de(P):ee>3?de(te,re,P):de(te,re))||P);return ee>3&&P&&Object.defineProperty(te,re,P),P},p=this&&this.__param||function(Z,te){return function(re,Q){te(re,Q,Z)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const h=d(3787),g=d(2550),b=d(2223),x=d(6171),E=d(6052),v=d(4725),y=d(8055),_=d(8460),S=d(844),N=d(2585),I="xterm-dom-renderer-owner-",R="xterm-rows",B="xterm-fg-",k="xterm-bg-",L="xterm-focus",z="xterm-selection";let G=1,K=l.DomRenderer=class extends S.Disposable{constructor(Z,te,re,Q,de,ee,P,M,V,$,H,ye,Ae){super(),this._terminal=Z,this._document=te,this._element=re,this._screenElement=Q,this._viewportElement=de,this._helperContainer=ee,this._linkifier2=P,this._charSizeService=V,this._optionsService=$,this._bufferService=H,this._coreBrowserService=ye,this._themeService=Ae,this._terminalClass=G++,this._rowElements=[],this._selectionRenderModel=(0,E.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new _.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Ne=>this._injectCss(Ne)))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(I+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Ne=>this._handleLinkHover(Ne)))),this.register(this._linkifier2.onHideLinkUnderline((Ne=>this._handleLinkLeave(Ne)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(I+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const Z=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*Z,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*Z),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/Z),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/Z),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const re of this._rowElements)re.style.width=`${this.dimensions.css.canvas.width}px`,re.style.height=`${this.dimensions.css.cell.height}px`,re.style.lineHeight=`${this.dimensions.css.cell.height}px`,re.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const te=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=te,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(Z){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let te=`${this._terminalSelector} .${R} { color: ${Z.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;te+=`${this._terminalSelector} .${R} .xterm-dim { color: ${y.color.multiplyOpacity(Z.foreground,.5).css};}`,te+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const re=`blink_underline_${this._terminalClass}`,Q=`blink_bar_${this._terminalClass}`,de=`blink_block_${this._terminalClass}`;te+=`@keyframes ${re} { 50% { border-bottom-style: hidden; }}`,te+=`@keyframes ${Q} { 50% { box-shadow: none; }}`,te+=`@keyframes ${de} { 0% { background-color: ${Z.cursor.css}; color: ${Z.cursorAccent.css}; } 50% { background-color: inherit; color: ${Z.cursor.css}; }}`,te+=`${this._terminalSelector} .${R}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${re} 1s step-end infinite;}${this._terminalSelector} .${R}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${R}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${de} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${Z.cursor.css}; color: ${Z.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${Z.cursor.css} !important; color: ${Z.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${Z.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${Z.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${Z.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,te+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${Z.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${Z.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,P]of Z.ansi.entries())te+=`${this._terminalSelector} .${B}${ee} { color: ${P.css}; }${this._terminalSelector} .${B}${ee}.xterm-dim { color: ${y.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${k}${ee} { background-color: ${P.css}; }`;te+=`${this._terminalSelector} .${B}${b.INVERTED_DEFAULT_COLOR} { color: ${y.color.opaque(Z.background).css}; }${this._terminalSelector} .${B}${b.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${y.color.multiplyOpacity(y.color.opaque(Z.background),.5).css}; }${this._terminalSelector} .${k}${b.INVERTED_DEFAULT_COLOR} { background-color: ${Z.foreground.css}; }`,this._themeStyleElement.textContent=te}_setDefaultSpacing(){const Z=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${Z}px`,this._rowFactory.defaultSpacing=Z}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(Z,te){for(let re=this._rowElements.length;re<=te;re++){const Q=this._document.createElement("div");this._rowContainer.appendChild(Q),this._rowElements.push(Q)}for(;this._rowElements.length>te;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(Z,te){this._refreshRowElements(Z,te),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(Z,te,re){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(Z,te,re),this.renderRows(0,this._bufferService.rows-1),!Z||!te)return;this._selectionRenderModel.update(this._terminal,Z,te,re);const Q=this._selectionRenderModel.viewportStartRow,de=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,P=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||P<0)return;const M=this._document.createDocumentFragment();if(re){const V=Z[0]>te[0];M.appendChild(this._createSelectionElement(ee,V?te[0]:Z[0],V?Z[0]:te[0],P-ee+1))}else{const V=Q===ee?Z[0]:0,$=ee===de?te[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(ee,V,$));const H=P-ee-1;if(M.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,H)),ee!==P){const ye=de===P?te[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(P,0,ye))}}this._selectionContainer.appendChild(M)}_createSelectionElement(Z,te,re,Q=1){const de=this._document.createElement("div"),ee=te*this.dimensions.css.cell.width;let P=this.dimensions.css.cell.width*(re-te);return ee+P>this.dimensions.css.canvas.width&&(P=this.dimensions.css.canvas.width-ee),de.style.height=Q*this.dimensions.css.cell.height+"px",de.style.top=Z*this.dimensions.css.cell.height+"px",de.style.left=`${ee}px`,de.style.width=`${P}px`,de}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const Z of this._rowElements)Z.replaceChildren()}renderRows(Z,te){const re=this._bufferService.buffer,Q=re.ybase+re.y,de=Math.min(re.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=Z;V<=te;V++){const $=V+re.ydisp,H=this._rowElements[V],ye=re.lines.get($);if(!H||!ye)break;H.replaceChildren(...this._rowFactory.createRow(ye,$,$===Q,P,M,de,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${I}${this._terminalClass}`}_handleLinkHover(Z){this._setCellUnderline(Z.x1,Z.x2,Z.y1,Z.y2,Z.cols,!0)}_handleLinkLeave(Z){this._setCellUnderline(Z.x1,Z.x2,Z.y1,Z.y2,Z.cols,!1)}_setCellUnderline(Z,te,re,Q,de,ee){re<0&&(Z=0),Q<0&&(te=0);const P=this._bufferService.rows-1;re=Math.max(Math.min(re,P),0),Q=Math.max(Math.min(Q,P),0),de=Math.min(de,this._bufferService.cols);const M=this._bufferService.buffer,V=M.ybase+M.y,$=Math.min(M.x,de-1),H=this._optionsService.rawOptions.cursorBlink,ye=this._optionsService.rawOptions.cursorStyle,Ae=this._optionsService.rawOptions.cursorInactiveStyle;for(let Ne=re;Ne<=Q;++Ne){const ie=Ne+M.ydisp,J=this._rowElements[Ne],fe=M.lines.get(ie);if(!J||!fe)break;J.replaceChildren(...this._rowFactory.createRow(fe,ie,ie===V,ye,Ae,$,H,this.dimensions.css.cell.width,this._widthCache,ee?Ne===re?Z:0:-1,ee?(Ne===Q?te:de)-1:-1))}}};l.DomRenderer=K=f([p(7,N.IInstantiationService),p(8,v.ICharSizeService),p(9,N.IOptionsService),p(10,N.IBufferService),p(11,v.ICoreBrowserService),p(12,v.IThemeService)],K)},3787:function(c,l,d){var f=this&&this.__decorate||function(R,B,k,L){var z,G=arguments.length,K=G<3?B:L===null?L=Object.getOwnPropertyDescriptor(B,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(R,B,k,L);else for(var Z=R.length-1;Z>=0;Z--)(z=R[Z])&&(K=(G<3?z(K):G>3?z(B,k,K):z(B,k))||K);return G>3&&K&&Object.defineProperty(B,k,K),K},p=this&&this.__param||function(R,B){return function(k,L){B(k,L,R)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const h=d(2223),g=d(643),b=d(511),x=d(2585),E=d(8055),v=d(4725),y=d(4269),_=d(6171),S=d(3734);let N=l.DomRendererRowFactory=class{constructor(R,B,k,L,z,G,K){this._document=R,this._characterJoinerService=B,this._optionsService=k,this._coreBrowserService=L,this._coreService=z,this._decorationService=G,this._themeService=K,this._workCell=new b.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,B,k){this._selectionStart=R,this._selectionEnd=B,this._columnSelectMode=k}createRow(R,B,k,L,z,G,K,Z,te,re,Q){const de=[],ee=this._characterJoinerService.getJoinedCharacters(B),P=this._themeService.colors;let M,V=R.getNoBgTrimmedLength();k&&V<G+1&&(V=G+1);let $=0,H="",ye=0,Ae=0,Ne=0,ie=!1,J=0,fe=!1,Te=0;const We=[],Me=re!==-1&&Q!==-1;for(let it=0;it<V;it++){R.loadCell(it,this._workCell);let Ct=this._workCell.getWidth();if(Ct===0)continue;let St=!1,en=it,rt=this._workCell;if(ee.length>0&&it===ee[0][0]){St=!0;const vt=ee.shift();rt=new y.JoinedCellData(this._workCell,R.translateToString(!0,vt[0],vt[1]),vt[1]-vt[0]),en=vt[1]-1,Ct=rt.getWidth()}const Tr=this._isCellInSelection(it,B),er=k&&it===G,Nr=Me&&it>=re&&it<=Q;let Bn=!1;this._decorationService.forEachDecorationAtCell(it,B,void 0,(vt=>{Bn=!0}));let Ti=rt.getChars()||g.WHITESPACE_CELL_CHAR;if(Ti===" "&&(rt.isUnderline()||rt.isOverline())&&(Ti=" "),Te=Ct*Z-te.get(Ti,rt.isBold(),rt.isItalic()),M){if($&&(Tr&&fe||!Tr&&!fe&&rt.bg===ye)&&(Tr&&fe&&P.selectionForeground||rt.fg===Ae)&&rt.extended.ext===Ne&&Nr===ie&&Te===J&&!er&&!St&&!Bn){rt.isInvisible()?H+=g.WHITESPACE_CELL_CHAR:H+=Ti,$++;continue}$&&(M.textContent=H),M=this._document.createElement("span"),$=0,H=""}else M=this._document.createElement("span");if(ye=rt.bg,Ae=rt.fg,Ne=rt.extended.ext,ie=Nr,J=Te,fe=Tr,St&&G>=it&&G<=en&&(G=it),!this._coreService.isCursorHidden&&er&&this._coreService.isCursorInitialized){if(We.push("xterm-cursor"),this._coreBrowserService.isFocused)K&&We.push("xterm-cursor-blink"),We.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":We.push("xterm-cursor-outline");break;case"block":We.push("xterm-cursor-block");break;case"bar":We.push("xterm-cursor-bar");break;case"underline":We.push("xterm-cursor-underline")}}if(rt.isBold()&&We.push("xterm-bold"),rt.isItalic()&&We.push("xterm-italic"),rt.isDim()&&We.push("xterm-dim"),H=rt.isInvisible()?g.WHITESPACE_CELL_CHAR:rt.getChars()||g.WHITESPACE_CELL_CHAR,rt.isUnderline()&&(We.push(`xterm-underline-${rt.extended.underlineStyle}`),H===" "&&(H=" "),!rt.isUnderlineColorDefault()))if(rt.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(rt.getUnderlineColor()).join(",")})`;else{let vt=rt.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&rt.isBold()&&vt<8&&(vt+=8),M.style.textDecorationColor=P.ansi[vt].css}rt.isOverline()&&(We.push("xterm-overline"),H===" "&&(H=" ")),rt.isStrikethrough()&&We.push("xterm-strikethrough"),Nr&&(M.style.textDecoration="underline");let yn=rt.getFgColor(),ln=rt.getFgColorMode(),Dn=rt.getBgColor(),ke=rt.getBgColorMode();const Ve=!!rt.isInverse();if(Ve){const vt=yn;yn=Dn,Dn=vt;const _n=ln;ln=ke,ke=_n}let qe,st,ht,cn=!1;switch(this._decorationService.forEachDecorationAtCell(it,B,void 0,(vt=>{vt.options.layer!=="top"&&cn||(vt.backgroundColorRGB&&(ke=50331648,Dn=vt.backgroundColorRGB.rgba>>8&16777215,qe=vt.backgroundColorRGB),vt.foregroundColorRGB&&(ln=50331648,yn=vt.foregroundColorRGB.rgba>>8&16777215,st=vt.foregroundColorRGB),cn=vt.options.layer==="top")})),!cn&&Tr&&(qe=this._coreBrowserService.isFocused?P.selectionBackgroundOpaque:P.selectionInactiveBackgroundOpaque,Dn=qe.rgba>>8&16777215,ke=50331648,cn=!0,P.selectionForeground&&(ln=50331648,yn=P.selectionForeground.rgba>>8&16777215,st=P.selectionForeground)),cn&&We.push("xterm-decoration-top"),ke){case 16777216:case 33554432:ht=P.ansi[Dn],We.push(`xterm-bg-${Dn}`);break;case 50331648:ht=E.channels.toColor(Dn>>16,Dn>>8&255,255&Dn),this._addStyle(M,`background-color:#${I((Dn>>>0).toString(16),"0",6)}`);break;default:Ve?(ht=P.foreground,We.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):ht=P.background}switch(qe||rt.isDim()&&(qe=E.color.multiplyOpacity(ht,.5)),ln){case 16777216:case 33554432:rt.isBold()&&yn<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(yn+=8),this._applyMinimumContrast(M,ht,P.ansi[yn],rt,qe,void 0)||We.push(`xterm-fg-${yn}`);break;case 50331648:const vt=E.channels.toColor(yn>>16&255,yn>>8&255,255&yn);this._applyMinimumContrast(M,ht,vt,rt,qe,st)||this._addStyle(M,`color:#${I(yn.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,ht,P.foreground,rt,qe,st)||Ve&&We.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}We.length&&(M.className=We.join(" "),We.length=0),er||St||Bn?M.textContent=H:$++,Te!==this.defaultSpacing&&(M.style.letterSpacing=`${Te}px`),de.push(M),it=en}return M&&$&&(M.textContent=H),de}_applyMinimumContrast(R,B,k,L,z,G){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,_.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const K=this._getContrastCache(L);let Z;if(z||G||(Z=K.getColor(B.rgba,k.rgba)),Z===void 0){const te=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);Z=E.color.ensureContrastRatio(z||B,G||k,te),K.setColor((z||B).rgba,(G||k).rgba,Z??null)}return!!Z&&(this._addStyle(R,`color:${Z.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,B){R.setAttribute("style",`${R.getAttribute("style")||""}${B};`)}_isCellInSelection(R,B){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?R>=k[0]&&B>=k[1]&&R<L[0]&&B<=L[1]:R<k[0]&&B>=k[1]&&R>=L[0]&&B<=L[1]:B>k[1]&&B<L[1]||k[1]===L[1]&&B===k[1]&&R>=k[0]&&R<L[0]||k[1]<L[1]&&B===L[1]&&R<L[0]||k[1]<L[1]&&B===k[1]&&R>=k[0])}};function I(R,B,k){for(;R.length<k;)R=B+R;return R}l.DomRendererRowFactory=N=f([p(1,v.ICharacterJoinerService),p(2,x.IOptionsService),p(3,v.ICoreBrowserService),p(4,x.ICoreService),p(5,x.IDecorationService),p(6,v.IThemeService)],N)},2550:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const p=d.createElement("span");p.classList.add("xterm-char-measure-element");const h=d.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const g=d.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const b=d.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontWeight="bold",b.style.fontStyle="italic",this._measureElements=[p,h,g,b],this._container.appendChild(p),this._container.appendChild(h),this._container.appendChild(g),this._container.appendChild(b),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,f,p,h){d===this._font&&f===this._fontSize&&p===this._weight&&h===this._weightBold||(this._font=d,this._fontSize=f,this._weight=p,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(d,f,p){let h=0;if(!f&&!p&&d.length===1&&(h=d.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const x=this._measure(d,0);return x>0&&(this._flat[h]=x),x}let g=d;f&&(g+="B"),p&&(g+="I");let b=this._holey.get(g);if(b===void 0){let x=0;f&&(x|=1),p&&(x|=2),b=this._measure(d,x),b>0&&this._holey.set(g,b)}return b}_measure(d,f){const p=this._measureElements[f];return p.textContent=d.repeat(32),p.offsetWidth/32}}},2223:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(c,l)=>{function d(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},l.isEmoji=f,l.allowRescaling=function(p,h,g,b){return h===1&&g>Math.ceil(1.5*b)&&p!==void 0&&p>255&&!f(p)&&!d(p)&&!(function(x){return 57344<=x&&x<=63743})(p)},l.treatGlyphAsBackgroundColor=function(p){return d(p)||(function(h){return 9472<=h&&h<=9631})(p)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(p,h,g=0){return(p-(2*Math.round(h)-g))%(2*Math.round(h))}},6052:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,h,g,b=!1){if(this.selectionStart=h,this.selectionEnd=g,!h||!g||h[0]===g[0]&&h[1]===g[1])return void this.clear();const x=p.buffers.active.ydisp,E=h[1]-x,v=g[1]-x,y=Math.max(E,0),_=Math.min(v,p.rows-1);y>=p.rows||_<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=b,this.viewportStartRow=E,this.viewportEndRow=v,this.viewportCappedStartRow=y,this.viewportCappedEndRow=_,this.startCol=h[0],this.endCol=g[0])}isCellSelected(p,h,g){return!!this.hasSelection&&(g-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&g>=this.viewportCappedStartRow&&h<this.endCol&&g<=this.viewportCappedEndRow:h<this.startCol&&g>=this.viewportCappedStartRow&&h>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&g===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportStartRow&&h>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,f=this.selectionEnd;return!(!d||!f)&&(d[1]>f[1]||d[1]===f[1]&&d[0]>f[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const h=d(2585),g=d(8460),b=d(844);let x=l.CharSizeService=class extends b.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(_,S,N){super(),this._optionsService=N,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new y(this._optionsService))}catch{this._measureStrategy=this.register(new v(_,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const _=this._measureStrategy.measure();_.width===this.width&&_.height===this.height||(this.width=_.width,this.height=_.height,this._onCharSizeChange.fire())}};l.CharSizeService=x=f([p(2,h.IOptionsService)],x);class E extends b.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,N){S!==void 0&&S>0&&N!==void 0&&N>0&&(this._result.width=S,this._result.height=N)}}class v extends E{constructor(S,N,I){super(),this._document=S,this._parentElement=N,this._optionsService=I,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class y extends E{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const N=this._ctx.measureText("W");if(!("width"in N&&"fontBoundingBoxAscent"in N&&"fontBoundingBoxDescent"in N))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(c,l,d){var f=this&&this.__decorate||function(y,_,S,N){var I,R=arguments.length,B=R<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,_,S,N);else for(var k=y.length-1;k>=0;k--)(I=y[k])&&(B=(R<3?I(B):R>3?I(_,S,B):I(_,S))||B);return R>3&&B&&Object.defineProperty(_,S,B),B},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const h=d(3734),g=d(643),b=d(511),x=d(2585);class E extends h.AttributeData{constructor(_,S,N){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=S,this._width=N}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=E;let v=l.CharacterJoinerService=class ek{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new b.CellData}register(_){const S={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(S),S.id}deregister(_){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===_)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(_){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(_);if(!S||S.length===0)return[];const N=[],I=S.translateToString(!0);let R=0,B=0,k=0,L=S.getFg(0),z=S.getBg(0);for(let G=0;G<S.getTrimmedLength();G++)if(S.loadCell(G,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==z){if(G-R>1){const K=this._getJoinedRanges(I,k,B,S,R);for(let Z=0;Z<K.length;Z++)N.push(K[Z])}R=G,k=B,L=this._workCell.fg,z=this._workCell.bg}B+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const G=this._getJoinedRanges(I,k,B,S,R);for(let K=0;K<G.length;K++)N.push(G[K])}return N}_getJoinedRanges(_,S,N,I,R){const B=_.substring(S,N);let k=[];try{k=this._characterJoiners[0].handler(B)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const z=this._characterJoiners[L].handler(B);for(let G=0;G<z.length;G++)ek._mergeRanges(k,z[G])}catch(z){console.error(z)}return this._stringRangesToCellRanges(k,I,R),k}_stringRangesToCellRanges(_,S,N){let I=0,R=!1,B=0,k=_[I];if(k){for(let L=N;L<this._bufferService.cols;L++){const z=S.getWidth(L),G=S.getString(L).length||g.WHITESPACE_CELL_CHAR.length;if(z!==0){if(!R&&k[0]<=B&&(k[0]=L,R=!0),k[1]<=B){if(k[1]=L,k=_[++I],!k)break;k[0]<=B?(k[0]=L,R=!0):R=!1}B+=G}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(_,S){let N=!1;for(let I=0;I<_.length;I++){const R=_[I];if(N){if(S[1]<=R[0])return _[I-1][1]=S[1],_;if(S[1]<=R[1])return _[I-1][1]=Math.max(S[1],R[1]),_.splice(I,1),_;_.splice(I,1),I--}else{if(S[1]<=R[0])return _.splice(I,0,S),_;if(S[1]<=R[1])return R[0]=Math.min(S[0],R[0]),_;S[0]<R[1]&&(R[0]=Math.min(S[0],R[0]),N=!0)}}return N?_[_.length-1][1]=S[1]:_.push(S),_}};l.CharacterJoinerService=v=f([p(0,x.IBufferService)],v)},5114:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=d(844),p=d(8460),h=d(3656);class g extends f.Disposable{constructor(E,v,y){super(),this._textarea=E,this._window=v,this.mainDocument=y,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new b(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((_=>this._screenDprMonitor.setWindow(_)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(E){this._window!==E&&(this._window=E,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=g;class b extends f.Disposable{constructor(E){super(),this._parentWindow=E,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(E){this._parentWindow=E,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var E;this._outerListener&&((E=this._resolutionMediaMatchList)==null||E.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=d(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{const b=this.linkProviders.indexOf(g);b!==-1&&this.linkProviders.splice(b,1)}}}}l.LinkProviderService=p},8934:function(c,l,d){var f=this&&this.__decorate||function(x,E,v,y){var _,S=arguments.length,N=S<3?E:y===null?y=Object.getOwnPropertyDescriptor(E,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,E,v,y);else for(var I=x.length-1;I>=0;I--)(_=x[I])&&(N=(S<3?_(N):S>3?_(E,v,N):_(E,v))||N);return S>3&&N&&Object.defineProperty(E,v,N),N},p=this&&this.__param||function(x,E){return function(v,y){E(v,y,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const h=d(4725),g=d(9806);let b=l.MouseService=class{constructor(x,E){this._renderService=x,this._charSizeService=E}getCoords(x,E,v,y,_){return(0,g.getCoords)(window,x,E,v,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,_)}getMouseReportCoords(x,E){const v=(0,g.getCoordsRelativeToElement)(window,x,E);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};l.MouseService=b=f([p(0,h.IRenderService),p(1,h.ICharSizeService)],b)},3230:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const h=d(6193),g=d(4725),b=d(8460),x=d(844),E=d(7226),v=d(2585);let y=l.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(_,S,N,I,R,B,k,L){super(),this._rowCount=_,this._charSizeService=I,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new E.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new b.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new b.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new b.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((z,G)=>this._renderRows(z,G)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(B.onResize((()=>this._fullRefresh()))),this.register(B.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(N.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(N.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(B.cols,B.rows),this._fullRefresh()}))),this.register(N.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(B.buffer.y,B.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,S),this.register(k.onWindowChange((z=>this._registerIntersectionObserver(z,S))))}_registerIntersectionObserver(_,S){if("IntersectionObserver"in _){const N=new _.IntersectionObserver((I=>this._handleIntersectionChange(I[I.length-1])),{threshold:0});N.observe(S),this._observerDisposable.value=(0,x.toDisposable)((()=>N.disconnect()))}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(_,S,N=!1){this._isPaused?this._needsFullRefresh=!0:(N||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,S,this._rowCount))}_renderRows(_,S){this._renderer.value&&(_=Math.min(_,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(_,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:S}),this._onRender.fire({start:_,end:S}),this._isNextRenderRedrawOnly=!0)}resize(_,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(_){this._renderer.value=_,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var _,S;this._renderer.value&&((S=(_=this._renderer.value).clearTextureAtlas)==null||S.call(_),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(_,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var N;return(N=this._renderer.value)==null?void 0:N.handleResize(_,S)})):this._renderer.value.handleResize(_,S),this._fullRefresh())}handleCharSizeChanged(){var _;(_=this._renderer.value)==null||_.handleCharSizeChanged()}handleBlur(){var _;(_=this._renderer.value)==null||_.handleBlur()}handleFocus(){var _;(_=this._renderer.value)==null||_.handleFocus()}handleSelectionChanged(_,S,N){var I;this._selectionState.start=_,this._selectionState.end=S,this._selectionState.columnSelectMode=N,(I=this._renderer.value)==null||I.handleSelectionChanged(_,S,N)}handleCursorMove(){var _;(_=this._renderer.value)==null||_.handleCursorMove()}clear(){var _;(_=this._renderer.value)==null||_.clear()}};l.RenderService=y=f([p(2,v.IOptionsService),p(3,g.ICharSizeService),p(4,v.IDecorationService),p(5,v.IBufferService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],y)},9312:function(c,l,d){var f=this&&this.__decorate||function(k,L,z,G){var K,Z=arguments.length,te=Z<3?L:G===null?G=Object.getOwnPropertyDescriptor(L,z):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(k,L,z,G);else for(var re=k.length-1;re>=0;re--)(K=k[re])&&(te=(Z<3?K(te):Z>3?K(L,z,te):K(L,z))||te);return Z>3&&te&&Object.defineProperty(L,z,te),te},p=this&&this.__param||function(k,L){return function(z,G){L(z,G,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const h=d(9806),g=d(9504),b=d(456),x=d(4725),E=d(8460),v=d(844),y=d(6114),_=d(4841),S=d(511),N=d(2585),I=" ",R=new RegExp(I,"g");let B=l.SelectionService=class extends v.Disposable{constructor(k,L,z,G,K,Z,te,re,Q){super(),this._element=k,this._screenElement=L,this._linkifier=z,this._bufferService=G,this._coreService=K,this._mouseService=Z,this._optionsService=te,this._renderService=re,this._coreBrowserService=Q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new E.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new E.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=de=>this._handleMouseMove(de),this._mouseUpListener=de=>this._handleMouseUp(de),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((de=>this._handleTrim(de))),this.register(this._bufferService.buffers.onBufferActivate((de=>this._handleBufferActivate(de)))),this.enable(),this._model=new b.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!k||!L||k[0]===L[0]&&k[1]===L[1])}get selectionText(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!k||!L)return"";const z=this._bufferService.buffer,G=[];if(this._activeSelectionMode===3){if(k[0]===L[0])return"";const K=k[0]<L[0]?k[0]:L[0],Z=k[0]<L[0]?L[0]:k[0];for(let te=k[1];te<=L[1];te++){const re=z.translateBufferLineToString(te,!0,K,Z);G.push(re)}}else{const K=k[1]===L[1]?L[0]:void 0;G.push(z.translateBufferLineToString(k[1],!0,k[0],K));for(let Z=k[1]+1;Z<=L[1]-1;Z++){const te=z.lines.get(Z),re=z.translateBufferLineToString(Z,!0);te!=null&&te.isWrapped?G[G.length-1]+=re:G.push(re)}if(k[1]!==L[1]){const Z=z.lines.get(L[1]),te=z.translateBufferLineToString(L[1],!0,0,L[0]);Z&&Z.isWrapped?G[G.length-1]+=te:G.push(te)}}return G.map((K=>K.replace(R," "))).join(y.isWindows?`\r
158
- `:`
159
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),y.isLinux&&k&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(k){const L=this._getMouseBufferCoords(k),z=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!!(z&&G&&L)&&this._areCoordsInSelection(L,z,G)}isCellInSelection(k,L){const z=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!(!z||!G)&&this._areCoordsInSelection([k,L],z,G)}_areCoordsInSelection(k,L,z){return k[1]>L[1]&&k[1]<z[1]||L[1]===z[1]&&k[1]===L[1]&&k[0]>=L[0]&&k[0]<z[0]||L[1]<z[1]&&k[1]===z[1]&&k[0]<z[0]||L[1]<z[1]&&k[1]===L[1]&&k[0]>=L[0]}_selectWordAtCursor(k,L){var z,G;const K=(G=(z=this._linkifier.currentLink)==null?void 0:z.link)==null?void 0:G.range;if(K)return this._model.selectionStart=[K.start.x-1,K.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(K,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const Z=this._getMouseBufferCoords(k);return!!Z&&(this._selectWordAt(Z,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,L){this._model.clearSelection(),k=Math.max(k,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const L=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(k){let L=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=z?0:(L>z&&(L-=z),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(k){return y.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const L=this._getMouseBufferCoords(k);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(k){return k.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]<z.lines.length){const G=z.lines.get(this._model.selectionEnd[1]);G&&G.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const L=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const G=(0,g.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(G,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,z=!(!k||!L||k[0]===L[0]&&k[1]===L[1]);z?k&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,L,z)):this._oldHasSelection&&this._fireOnSelectionChange(k,L,z)}_fireOnSelectionChange(k,L,z){this._oldSelectionStart=k,this._oldSelectionEnd=L,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(k,L){let z=L;for(let G=0;L>=G;G++){const K=k.loadCell(G,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:K>1&&L!==G&&(z+=K-1)}return z}setSelection(k,L,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,L],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,L,z=!0,G=!0){if(k[0]>=this._bufferService.cols)return;const K=this._bufferService.buffer,Z=K.lines.get(k[1]);if(!Z)return;const te=K.translateBufferLineToString(k[1],!1);let re=this._convertViewportColToCharacterIndex(Z,k[0]),Q=re;const de=k[0]-re;let ee=0,P=0,M=0,V=0;if(te.charAt(re)===" "){for(;re>0&&te.charAt(re-1)===" ";)re--;for(;Q<te.length&&te.charAt(Q+1)===" ";)Q++}else{let ye=k[0],Ae=k[0];Z.getWidth(ye)===0&&(ee++,ye--),Z.getWidth(Ae)===2&&(P++,Ae++);const Ne=Z.getString(Ae).length;for(Ne>1&&(V+=Ne-1,Q+=Ne-1);ye>0&&re>0&&!this._isCharWordSeparator(Z.loadCell(ye-1,this._workCell));){Z.loadCell(ye-1,this._workCell);const ie=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,ye--):ie>1&&(M+=ie-1,re-=ie-1),re--,ye--}for(;Ae<Z.length&&Q+1<te.length&&!this._isCharWordSeparator(Z.loadCell(Ae+1,this._workCell));){Z.loadCell(Ae+1,this._workCell);const ie=this._workCell.getChars().length;this._workCell.getWidth()===2?(P++,Ae++):ie>1&&(V+=ie-1,Q+=ie-1),Q++,Ae++}}Q++;let $=re+de-ee+M,H=Math.min(this._bufferService.cols,Q-re+ee+P-M-V);if(L||te.slice(re,Q).trim()!==""){if(z&&$===0&&Z.getCodePoint(0)!==32){const ye=K.lines.get(k[1]-1);if(ye&&Z.isWrapped&&ye.getCodePoint(this._bufferService.cols-1)!==32){const Ae=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(Ae){const Ne=this._bufferService.cols-Ae.start;$-=Ne,H+=Ne}}}if(G&&$+H===this._bufferService.cols&&Z.getCodePoint(this._bufferService.cols-1)!==32){const ye=K.lines.get(k[1]+1);if(ye!=null&&ye.isWrapped&&ye.getCodePoint(0)!==32){const Ae=this._getWordAt([0,k[1]+1],!1,!1,!0);Ae&&(H+=Ae.length)}}return{start:$,length:H}}}_selectWordAt(k,L){const z=this._getWordAt(k,L);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[z.start,k[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(k){const L=this._getWordAt(k,!0);if(L){let z=k[1];for(;L.start<0;)L.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,z]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const L=this._bufferService.buffer.getWrappedRangeForLine(k),z={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(z,this._bufferService.cols)}};l.SelectionService=B=f([p(3,N.IBufferService),p(4,N.ICoreService),p(5,x.IMouseService),p(6,N.IOptionsService),p(7,x.IRenderService),p(8,x.ICoreBrowserService)],B)},4725:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=d(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(c,l,d){var f=this&&this.__decorate||function(B,k,L,z){var G,K=arguments.length,Z=K<3?k:z===null?z=Object.getOwnPropertyDescriptor(k,L):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(B,k,L,z);else for(var te=B.length-1;te>=0;te--)(G=B[te])&&(Z=(K<3?G(Z):K>3?G(k,L,Z):G(k,L))||Z);return K>3&&Z&&Object.defineProperty(k,L,Z),Z},p=this&&this.__param||function(B,k){return function(L,z){k(L,z,B)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const h=d(7239),g=d(8055),b=d(8460),x=d(844),E=d(2585),v=g.css.toColor("#ffffff"),y=g.css.toColor("#000000"),_=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),N={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const B=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const z=k[L/36%6|0],G=k[L/6%6|0],K=k[L%6];B.push({css:g.channels.toCss(z,G,K),rgba:g.channels.toRgba(z,G,K)})}for(let L=0;L<24;L++){const z=8+10*L;B.push({css:g.channels.toCss(z,z,z),rgba:g.channels.toRgba(z,z,z)})}return B})());let I=l.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(B){super(),this._optionsService=B,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new b.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:y,cursor:_,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:N,selectionBackgroundOpaque:g.color.blend(y,N),selectionInactiveBackgroundTransparent:N,selectionInactiveBackgroundOpaque:g.color.blend(y,N),ansi:l.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(B={}){const k=this._colors;if(k.foreground=R(B.foreground,v),k.background=R(B.background,y),k.cursor=R(B.cursor,_),k.cursorAccent=R(B.cursorAccent,S),k.selectionBackgroundTransparent=R(B.selectionBackground,N),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=R(B.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=B.selectionForeground?R(B.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=l.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=R(B.black,l.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=R(B.red,l.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=R(B.green,l.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=R(B.yellow,l.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=R(B.blue,l.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=R(B.magenta,l.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=R(B.cyan,l.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=R(B.white,l.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=R(B.brightBlack,l.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=R(B.brightRed,l.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=R(B.brightGreen,l.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=R(B.brightYellow,l.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=R(B.brightBlue,l.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=R(B.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=R(B.brightCyan,l.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=R(B.brightWhite,l.DEFAULT_ANSI_COLORS[15]),B.extendedAnsi){const L=Math.min(k.ansi.length-16,B.extendedAnsi.length);for(let z=0;z<L;z++)k.ansi[z+16]=R(B.extendedAnsi[z],l.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(B){this._restoreColor(B),this._onChangeColors.fire(this.colors)}_restoreColor(B){if(B!==void 0)switch(B){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[B]=this._restoreColors.ansi[B]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(B){B(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 R(B,k){if(B!==void 0)try{return g.css.toColor(B)}catch{}return k}l.ThemeService=I=f([p(0,E.IOptionsService)],I)},6349:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=d(8460),p=d(844);class h extends p.Disposable{constructor(b){super(),this._maxLength=b,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(b){if(this._maxLength===b)return;const x=new Array(b);for(let E=0;E<Math.min(b,this.length);E++)x[E]=this._array[this._getCyclicIndex(E)];this._array=x,this._maxLength=b,this._startIndex=0}get length(){return this._length}set length(b){if(b>this._length)for(let x=this._length;x<b;x++)this._array[x]=void 0;this._length=b}get(b){return this._array[this._getCyclicIndex(b)]}set(b,x){this._array[this._getCyclicIndex(b)]=x}push(b){this._array[this._getCyclicIndex(this._length)]=b,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(b,x,...E){if(x){for(let v=b;v<this._length-x;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+x)];this._length-=x,this.onDeleteEmitter.fire({index:b,amount:x})}for(let v=this._length-1;v>=b;v--)this._array[this._getCyclicIndex(v+E.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<E.length;v++)this._array[this._getCyclicIndex(b+v)]=E[v];if(E.length&&this.onInsertEmitter.fire({index:b,amount:E.length}),this._length+E.length>this._maxLength){const v=this._length+E.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=E.length}trimStart(b){b>this._length&&(b=this._length),this._startIndex+=b,this._length-=b,this.onTrimEmitter.fire(b)}shiftElements(b,x,E){if(!(x<=0)){if(b<0||b>=this._length)throw new Error("start argument out of range");if(b+E<0)throw new Error("Cannot shift elements in list beyond index 0");if(E>0){for(let y=x-1;y>=0;y--)this.set(b+y+E,this.get(b+y));const v=b+x+E-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<x;v++)this.set(b+v+E,this.get(b+v))}}_getCyclicIndex(b){return(this._startIndex+b)%this._maxLength}}l.CircularList=h},1439:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(f,p=5){if(typeof f!="object")return f;const h=Array.isArray(f)?[]:{};for(const g in f)h[g]=p<=1?f[g]:f[g]&&d(f[g],p-1);return h}},8055:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,f=0,p=0,h=0;var g,b,x,E,v;function y(S){const N=S.toString(16);return N.length<2?"0"+N:N}function _(S,N){return S<N?(N+.05)/(S+.05):(S+.05)/(N+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(N,I,R,B){return B!==void 0?`#${y(N)}${y(I)}${y(R)}${y(B)}`:`#${y(N)}${y(I)}${y(R)}`},S.toRgba=function(N,I,R,B=255){return(N<<24|I<<16|R<<8|B)>>>0},S.toColor=function(N,I,R,B){return{css:S.toCss(N,I,R,B),rgba:S.toRgba(N,I,R,B)}}})(g||(l.channels=g={})),(function(S){function N(I,R){return h=Math.round(255*R),[d,f,p]=v.toChannels(I.rgba),{css:g.toCss(d,f,p,h),rgba:g.toRgba(d,f,p,h)}}S.blend=function(I,R){if(h=(255&R.rgba)/255,h===1)return{css:R.css,rgba:R.rgba};const B=R.rgba>>24&255,k=R.rgba>>16&255,L=R.rgba>>8&255,z=I.rgba>>24&255,G=I.rgba>>16&255,K=I.rgba>>8&255;return d=z+Math.round((B-z)*h),f=G+Math.round((k-G)*h),p=K+Math.round((L-K)*h),{css:g.toCss(d,f,p),rgba:g.toRgba(d,f,p)}},S.isOpaque=function(I){return(255&I.rgba)==255},S.ensureContrastRatio=function(I,R,B){const k=v.ensureContrastRatio(I.rgba,R.rgba,B);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},S.opaque=function(I){const R=(255|I.rgba)>>>0;return[d,f,p]=v.toChannels(R),{css:g.toCss(d,f,p),rgba:R}},S.opacity=N,S.multiplyOpacity=function(I,R){return h=255&I.rgba,N(I,h*R/255)},S.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(b||(l.color=b={})),(function(S){let N,I;try{const R=document.createElement("canvas");R.width=1,R.height=1;const B=R.getContext("2d",{willReadFrequently:!0});B&&(N=B,N.globalCompositeOperation="copy",I=N.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),g.toColor(d,f,p);case 5:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),h=parseInt(R.slice(4,5).repeat(2),16),g.toColor(d,f,p,h);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const B=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(B)return d=parseInt(B[1]),f=parseInt(B[2]),p=parseInt(B[3]),h=Math.round(255*(B[5]===void 0?1:parseFloat(B[5]))),g.toColor(d,f,p,h);if(!N||!I)throw new Error("css.toColor: Unsupported css format");if(N.fillStyle=I,N.fillStyle=R,typeof N.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(N.fillRect(0,0,1,1),[d,f,p,h]=N.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(d,f,p,h),css:R}}})(x||(l.css=x={})),(function(S){function N(I,R,B){const k=I/255,L=R/255,z=B/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(I){return N(I>>16&255,I>>8&255,255&I)},S.relativeLuminance2=N})(E||(l.rgb=E={})),(function(S){function N(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K>0||Z>0||te>0);)K-=Math.max(0,Math.ceil(.1*K)),Z-=Math.max(0,Math.ceil(.1*Z)),te-=Math.max(0,Math.ceil(.1*te)),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}function I(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K<255||Z<255||te<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),Z=Math.min(255,Z+Math.ceil(.1*(255-Z))),te=Math.min(255,te+Math.ceil(.1*(255-te))),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}S.blend=function(R,B){if(h=(255&B)/255,h===1)return B;const k=B>>24&255,L=B>>16&255,z=B>>8&255,G=R>>24&255,K=R>>16&255,Z=R>>8&255;return d=G+Math.round((k-G)*h),f=K+Math.round((L-K)*h),p=Z+Math.round((z-Z)*h),g.toRgba(d,f,p)},S.ensureContrastRatio=function(R,B,k){const L=E.relativeLuminance(R>>8),z=E.relativeLuminance(B>>8);if(_(L,z)<k){if(z<L){const Z=N(R,B,k),te=_(L,E.relativeLuminance(Z>>8));if(te<k){const re=I(R,B,k);return te>_(L,E.relativeLuminance(re>>8))?Z:re}return Z}const G=I(R,B,k),K=_(L,E.relativeLuminance(G>>8));if(K<k){const Z=N(R,B,k);return K>_(L,E.relativeLuminance(Z>>8))?G:Z}return G}},S.reduceLuminance=N,S.increaseLuminance=I,S.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(v||(l.rgba=v={})),l.toPaddedHex=y,l.contrastRatio=_},8969:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=d(844),p=d(2585),h=d(4348),g=d(7866),b=d(744),x=d(7302),E=d(6975),v=d(8460),y=d(1753),_=d(1480),S=d(7994),N=d(9282),I=d(5435),R=d(5981),B=d(2660);let k=!1;class L extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((G=>{var K;(K=this._onScrollApi)==null||K.fire(G.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(G){for(const K in G)this.optionsService.options[K]=G[K]}constructor(G){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new x.OptionsService(G)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(b.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(E.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(B.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new I.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.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((K=>{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((K=>{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 R.WriteBuffer(((K,Z)=>this._inputHandler.parse(K,Z)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(G,K){this._writeBuffer.write(G,K)}writeSync(G,K){this._logService.logLevel<=p.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(G,K)}input(G,K=!0){this.coreService.triggerDataEvent(G,K)}resize(G,K){isNaN(G)||isNaN(K)||(G=Math.max(G,b.MINIMUM_COLS),K=Math.max(K,b.MINIMUM_ROWS),this._bufferService.resize(G,K))}scroll(G,K=!1){this._bufferService.scroll(G,K)}scrollLines(G,K,Z){this._bufferService.scrollLines(G,K,Z)}scrollPages(G){this.scrollLines(G*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(G){const K=G-this._bufferService.buffer.ydisp;K!==0&&this.scrollLines(K)}registerEscHandler(G,K){return this._inputHandler.registerEscHandler(G,K)}registerDcsHandler(G,K){return this._inputHandler.registerDcsHandler(G,K)}registerCsiHandler(G,K){return this._inputHandler.registerCsiHandler(G,K)}registerOscHandler(G,K){return this._inputHandler.registerOscHandler(G,K)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let G=!1;const K=this.optionsService.rawOptions.windowsPty;K&&K.buildNumber!==void 0&&K.buildNumber!==void 0?G=K.backend==="conpty"&&K.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(G=!0),G?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const G=[];G.push(this.onLineFeed(N.updateWindowsModeWrappedState.bind(null,this._bufferService))),G.push(this.registerCsiHandler({final:"H"},(()=>((0,N.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const K of G)K.dispose()}))}}}l.CoreTerminal=L},8460:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let h=0;h<this._listeners.length;h++)p.push(this._listeners[h]);for(let h=0;h<p.length;h++)p[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((p=>f.fire(p)))},l.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},5435:function(c,l,d){var f=this&&this.__decorate||function(ee,P,M,V){var $,H=arguments.length,ye=H<3?P:V===null?V=Object.getOwnPropertyDescriptor(P,M):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ye=Reflect.decorate(ee,P,M,V);else for(var Ae=ee.length-1;Ae>=0;Ae--)($=ee[Ae])&&(ye=(H<3?$(ye):H>3?$(P,M,ye):$(P,M))||ye);return H>3&&ye&&Object.defineProperty(P,M,ye),ye},p=this&&this.__param||function(ee,P){return function(M,V){P(M,V,ee)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const h=d(2584),g=d(7116),b=d(2015),x=d(844),E=d(482),v=d(8437),y=d(8460),_=d(643),S=d(511),N=d(3734),I=d(2585),R=d(1480),B=d(6242),k=d(6351),L=d(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},G=131072;function K(ee,P){if(ee>24)return P.setWinLines||!1;switch(ee){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var Z;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(Z||(l.WindowsOptionsReportType=Z={}));let te=0;class re extends x.Disposable{getAttrData(){return this._curAttrData}constructor(P,M,V,$,H,ye,Ae,Ne,ie=new b.EscapeSequenceParser){super(),this._bufferService=P,this._charsetService=M,this._coreService=V,this._logService=$,this._optionsService=H,this._oscLinkService=ye,this._coreMouseService=Ae,this._unicodeService=Ne,this._parser=ie,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new E.StringToUtf32,this._utf8Decoder=new E.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.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 Q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((J=>this._activeBuffer=J.activeBuffer))),this._parser.setCsiHandlerFallback(((J,fe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(J),params:fe.toArray()})})),this._parser.setEscHandlerFallback((J=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(J)})})),this._parser.setExecuteHandlerFallback((J=>{this._logService.debug("Unknown EXECUTE code: ",{code:J})})),this._parser.setOscHandlerFallback(((J,fe,Te)=>{this._logService.debug("Unknown OSC code: ",{identifier:J,action:fe,data:Te})})),this._parser.setDcsHandlerFallback(((J,fe,Te)=>{fe==="HOOK"&&(Te=Te.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(J),action:fe,payload:Te})})),this._parser.setPrintHandler(((J,fe,Te)=>this.print(J,fe,Te))),this._parser.registerCsiHandler({final:"@"},(J=>this.insertChars(J))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(J=>this.scrollLeft(J))),this._parser.registerCsiHandler({final:"A"},(J=>this.cursorUp(J))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(J=>this.scrollRight(J))),this._parser.registerCsiHandler({final:"B"},(J=>this.cursorDown(J))),this._parser.registerCsiHandler({final:"C"},(J=>this.cursorForward(J))),this._parser.registerCsiHandler({final:"D"},(J=>this.cursorBackward(J))),this._parser.registerCsiHandler({final:"E"},(J=>this.cursorNextLine(J))),this._parser.registerCsiHandler({final:"F"},(J=>this.cursorPrecedingLine(J))),this._parser.registerCsiHandler({final:"G"},(J=>this.cursorCharAbsolute(J))),this._parser.registerCsiHandler({final:"H"},(J=>this.cursorPosition(J))),this._parser.registerCsiHandler({final:"I"},(J=>this.cursorForwardTab(J))),this._parser.registerCsiHandler({final:"J"},(J=>this.eraseInDisplay(J,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(J=>this.eraseInDisplay(J,!0))),this._parser.registerCsiHandler({final:"K"},(J=>this.eraseInLine(J,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(J=>this.eraseInLine(J,!0))),this._parser.registerCsiHandler({final:"L"},(J=>this.insertLines(J))),this._parser.registerCsiHandler({final:"M"},(J=>this.deleteLines(J))),this._parser.registerCsiHandler({final:"P"},(J=>this.deleteChars(J))),this._parser.registerCsiHandler({final:"S"},(J=>this.scrollUp(J))),this._parser.registerCsiHandler({final:"T"},(J=>this.scrollDown(J))),this._parser.registerCsiHandler({final:"X"},(J=>this.eraseChars(J))),this._parser.registerCsiHandler({final:"Z"},(J=>this.cursorBackwardTab(J))),this._parser.registerCsiHandler({final:"`"},(J=>this.charPosAbsolute(J))),this._parser.registerCsiHandler({final:"a"},(J=>this.hPositionRelative(J))),this._parser.registerCsiHandler({final:"b"},(J=>this.repeatPrecedingCharacter(J))),this._parser.registerCsiHandler({final:"c"},(J=>this.sendDeviceAttributesPrimary(J))),this._parser.registerCsiHandler({prefix:">",final:"c"},(J=>this.sendDeviceAttributesSecondary(J))),this._parser.registerCsiHandler({final:"d"},(J=>this.linePosAbsolute(J))),this._parser.registerCsiHandler({final:"e"},(J=>this.vPositionRelative(J))),this._parser.registerCsiHandler({final:"f"},(J=>this.hVPosition(J))),this._parser.registerCsiHandler({final:"g"},(J=>this.tabClear(J))),this._parser.registerCsiHandler({final:"h"},(J=>this.setMode(J))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(J=>this.setModePrivate(J))),this._parser.registerCsiHandler({final:"l"},(J=>this.resetMode(J))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(J=>this.resetModePrivate(J))),this._parser.registerCsiHandler({final:"m"},(J=>this.charAttributes(J))),this._parser.registerCsiHandler({final:"n"},(J=>this.deviceStatus(J))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(J=>this.deviceStatusPrivate(J))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(J=>this.softReset(J))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(J=>this.setCursorStyle(J))),this._parser.registerCsiHandler({final:"r"},(J=>this.setScrollRegion(J))),this._parser.registerCsiHandler({final:"s"},(J=>this.saveCursor(J))),this._parser.registerCsiHandler({final:"t"},(J=>this.windowOptions(J))),this._parser.registerCsiHandler({final:"u"},(J=>this.restoreCursor(J))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(J=>this.insertColumns(J))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(J=>this.deleteColumns(J))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(J=>this.selectProtected(J))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(J=>this.requestMode(J,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(J=>this.requestMode(J,!1))),this._parser.setExecuteHandler(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 B.OscHandler((J=>(this.setTitle(J),this.setIconName(J),!0)))),this._parser.registerOscHandler(1,new B.OscHandler((J=>this.setIconName(J)))),this._parser.registerOscHandler(2,new B.OscHandler((J=>this.setTitle(J)))),this._parser.registerOscHandler(4,new B.OscHandler((J=>this.setOrReportIndexedColor(J)))),this._parser.registerOscHandler(8,new B.OscHandler((J=>this.setHyperlink(J)))),this._parser.registerOscHandler(10,new B.OscHandler((J=>this.setOrReportFgColor(J)))),this._parser.registerOscHandler(11,new B.OscHandler((J=>this.setOrReportBgColor(J)))),this._parser.registerOscHandler(12,new B.OscHandler((J=>this.setOrReportCursorColor(J)))),this._parser.registerOscHandler(104,new B.OscHandler((J=>this.restoreIndexedColor(J)))),this._parser.registerOscHandler(110,new B.OscHandler((J=>this.restoreFgColor(J)))),this._parser.registerOscHandler(111,new B.OscHandler((J=>this.restoreBgColor(J)))),this._parser.registerOscHandler(112,new B.OscHandler((J=>this.restoreCursorColor(J)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const J in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:J},(()=>this.selectCharset("("+J))),this._parser.registerEscHandler({intermediates:")",final:J},(()=>this.selectCharset(")"+J))),this._parser.registerEscHandler({intermediates:"*",final:J},(()=>this.selectCharset("*"+J))),this._parser.registerEscHandler({intermediates:"+",final:J},(()=>this.selectCharset("+"+J))),this._parser.registerEscHandler({intermediates:"-",final:J},(()=>this.selectCharset("-"+J))),this._parser.registerEscHandler({intermediates:".",final:J},(()=>this.selectCharset("."+J))),this._parser.registerEscHandler({intermediates:"/",final:J},(()=>this.selectCharset("/"+J)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((J=>(this._logService.error("Parsing error: ",J),J))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((J,fe)=>this.requestStatusString(J,fe))))}_preserveStack(P,M,V,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=P,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=V,this._parseStack.position=$}_logSlowResolvingAsync(P){this._logService.logLevel<=I.LogLevelEnum.WARN&&Promise.race([P,new Promise(((M,V)=>setTimeout((()=>V("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(P,M){let V,$=this._activeBuffer.x,H=this._activeBuffer.y,ye=0;const Ae=this._parseStack.paused;if(Ae){if(V=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(V),V;$=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,P.length>G&&(ye=this._parseStack.position+G)}if(this._logService.logLevel<=I.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof P=="string"?` "${P}"`:` "${Array.prototype.map.call(P,(J=>String.fromCharCode(J))).join("")}"`),typeof P=="string"?P.split("").map((J=>J.charCodeAt(0))):P),this._parseBuffer.length<P.length&&this._parseBuffer.length<G&&(this._parseBuffer=new Uint32Array(Math.min(P.length,G))),Ae||this._dirtyRowTracker.clearRange(),P.length>G)for(let J=ye;J<P.length;J+=G){const fe=J+G<P.length?J+G:P.length,Te=typeof P=="string"?this._stringDecoder.decode(P.substring(J,fe),this._parseBuffer):this._utf8Decoder.decode(P.subarray(J,fe),this._parseBuffer);if(V=this._parser.parse(this._parseBuffer,Te))return this._preserveStack($,H,Te,J),this._logSlowResolvingAsync(V),V}else if(!Ae){const J=typeof P=="string"?this._stringDecoder.decode(P,this._parseBuffer):this._utf8Decoder.decode(P,this._parseBuffer);if(V=this._parser.parse(this._parseBuffer,J))return this._preserveStack($,H,J,0),this._logSlowResolvingAsync(V),V}this._activeBuffer.x===$&&this._activeBuffer.y===H||this._onCursorMove.fire();const Ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),ie=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);ie<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(ie,this._bufferService.rows-1),Math.min(Ne,this._bufferService.rows-1))}print(P,M,V){let $,H;const ye=this._charsetService.charset,Ae=this._optionsService.rawOptions.screenReaderMode,Ne=this._bufferService.cols,ie=this._coreService.decPrivateModes.wraparound,J=this._coreService.modes.insertMode,fe=this._curAttrData;let Te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&V-M>0&&Te.getWidth(this._activeBuffer.x-1)===2&&Te.setCellFromCodepoint(this._activeBuffer.x-1,0,1,fe);let We=this._parser.precedingJoinState;for(let Me=M;Me<V;++Me){if($=P[Me],$<127&&ye){const en=ye[String.fromCharCode($)];en&&($=en.charCodeAt(0))}const it=this._unicodeService.charProperties($,We);H=R.UnicodeService.extractWidth(it);const Ct=R.UnicodeService.extractShouldJoin(it),St=Ct?R.UnicodeService.extractWidth(We):0;if(We=it,Ae&&this._onA11yChar.fire((0,E.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-St>Ne){if(ie){const en=Te;let rt=this._activeBuffer.x-St;for(this._activeBuffer.x=St,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),Te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),St>0&&Te instanceof v.BufferLine&&Te.copyCellsFrom(en,rt,0,St,!1);rt<Ne;)en.setCellFromCodepoint(rt++,0,1,fe)}else if(this._activeBuffer.x=Ne-1,H===2)continue}if(Ct&&this._activeBuffer.x){const en=Te.getWidth(this._activeBuffer.x-1)?1:2;Te.addCodepointToCell(this._activeBuffer.x-en,$,H);for(let rt=H-St;--rt>=0;)Te.setCellFromCodepoint(this._activeBuffer.x++,0,0,fe)}else if(J&&(Te.insertCells(this._activeBuffer.x,H-St,this._activeBuffer.getNullCell(fe)),Te.getWidth(Ne-1)===2&&Te.setCellFromCodepoint(Ne-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,fe)),Te.setCellFromCodepoint(this._activeBuffer.x++,$,H,fe),H>0)for(;--H;)Te.setCellFromCodepoint(this._activeBuffer.x++,0,0,fe)}this._parser.precedingJoinState=We,this._activeBuffer.x<Ne&&V-M>0&&Te.getWidth(this._activeBuffer.x)===0&&!Te.hasContent(this._activeBuffer.x)&&Te.setCellFromCodepoint(this._activeBuffer.x,0,1,fe),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(P,M){return P.final!=="t"||P.prefix||P.intermediates?this._parser.registerCsiHandler(P,M):this._parser.registerCsiHandler(P,(V=>!K(V.params[0],this._optionsService.rawOptions.windowOptions)||M(V)))}registerDcsHandler(P,M){return this._parser.registerDcsHandler(P,new k.DcsHandler(M))}registerEscHandler(P,M){return this._parser.registerEscHandler(P,M)}registerOscHandler(P,M){return this._parser.registerOscHandler(P,new B.OscHandler(M))}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 P;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&&(P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&P.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const P=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-P),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(P=this._bufferService.cols-1){this._activeBuffer.x=Math.min(P,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(P,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=P,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=P,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(P,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+P,this._activeBuffer.y+M)}cursorUp(P){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,P.params[0]||1)):this._moveCursor(0,-(P.params[0]||1)),!0}cursorDown(P){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,P.params[0]||1)):this._moveCursor(0,P.params[0]||1),!0}cursorForward(P){return this._moveCursor(P.params[0]||1,0),!0}cursorBackward(P){return this._moveCursor(-(P.params[0]||1),0),!0}cursorNextLine(P){return this.cursorDown(P),this._activeBuffer.x=0,!0}cursorPrecedingLine(P){return this.cursorUp(P),this._activeBuffer.x=0,!0}cursorCharAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(P){return this._setCursor(P.length>=2?(P.params[1]||1)-1:0,(P.params[0]||1)-1),!0}charPosAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(P){return this._moveCursor(P.params[0]||1,0),!0}linePosAbsolute(P){return this._setCursor(this._activeBuffer.x,(P.params[0]||1)-1),!0}vPositionRelative(P){return this._moveCursor(0,P.params[0]||1),!0}hVPosition(P){return this.cursorPosition(P),!0}tabClear(P){const M=P.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=P.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=P.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(P){const M=P.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(P,M,V,$=!1,H=!1){const ye=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);ye.replaceCells(M,V,this._activeBuffer.getNullCell(this._eraseAttrData()),H),$&&(ye.isWrapped=!1)}_resetBufferLine(P,M=!1){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);V&&(V.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+P),V.isWrapped=!1)}eraseInDisplay(P,M=!1){let V;switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:for(V=this._activeBuffer.y,this._dirtyRowTracker.markDirty(V),this._eraseInBufferLine(V++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);V<this._bufferService.rows;V++)this._resetBufferLine(V,M);this._dirtyRowTracker.markDirty(V);break;case 1:for(V=this._activeBuffer.y,this._dirtyRowTracker.markDirty(V),this._eraseInBufferLine(V,0,this._activeBuffer.x+1,!0,M),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(V+1).isWrapped=!1);V--;)this._resetBufferLine(V,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(V=this._bufferService.rows,this._dirtyRowTracker.markDirty(V-1);V--;)this._resetBufferLine(V,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(P,M=!1){switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(P){this._restrictCursor();let M=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const V=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;M--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(P){this._restrictCursor();let M=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const V=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;M--;)this._activeBuffer.lines.splice(V,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(P){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.insertCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(P){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.deleteCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(P){let M=P.params[0]||1;for(;M--;)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(P){let M=P.params[0]||1;for(;M--;)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(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.deleteCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.insertCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.insertCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.deleteCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(P){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(P.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(P){const M=this._parser.precedingJoinState;if(!M)return!0;const V=P.params[0]||1,$=R.UnicodeService.extractWidth(M),H=this._activeBuffer.x-$,ye=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),Ae=new Uint32Array(ye.length*V);let Ne=0;for(let J=0;J<ye.length;){const fe=ye.codePointAt(J)||0;Ae[Ne++]=fe,J+=fe>65535?2:1}let ie=Ne;for(let J=1;J<V;++J)Ae.copyWithin(ie,0,Ne),ie+=Ne;return this.print(Ae,0,ie),!0}sendDeviceAttributesPrimary(P){return P.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(P){return P.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(P.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(P){return(this._optionsService.rawOptions.termName+"").indexOf(P)===0}setMode(P){for(let M=0;M<P.length;M++)switch(P.params[M]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(P){for(let M=0;M<P.length;M++)switch(P.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(P){for(let M=0;M<P.length;M++)switch(P.params[M]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(P){for(let M=0;M<P.length;M++)switch(P.params[M]){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(),P.params[M]===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(P,M){const V=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:H}=this._coreMouseService,ye=this._coreService,{buffers:Ae,cols:Ne}=this._bufferService,{active:ie,alt:J}=Ae,fe=this._optionsService.rawOptions,Te=Ct=>Ct?1:2,We=P.params[0];return Me=We,it=M?We===2?4:We===4?Te(ye.modes.insertMode):We===12?3:We===20?Te(fe.convertEol):0:We===1?Te(V.applicationCursorKeys):We===3?fe.windowOptions.setWinLines?Ne===80?2:Ne===132?1:0:0:We===6?Te(V.origin):We===7?Te(V.wraparound):We===8?3:We===9?Te($==="X10"):We===12?Te(fe.cursorBlink):We===25?Te(!ye.isCursorHidden):We===45?Te(V.reverseWraparound):We===66?Te(V.applicationKeypad):We===67?4:We===1e3?Te($==="VT200"):We===1002?Te($==="DRAG"):We===1003?Te($==="ANY"):We===1004?Te(V.sendFocus):We===1005?4:We===1006?Te(H==="SGR"):We===1015?4:We===1016?Te(H==="SGR_PIXELS"):We===1048?1:We===47||We===1047||We===1049?Te(ie===J):We===2004?Te(V.bracketedPasteMode):0,ye.triggerDataEvent(`${h.C0.ESC}[${M?"":"?"}${Me};${it}$y`),!0;var Me,it}_updateAttrColor(P,M,V,$,H){return M===2?(P|=50331648,P&=-16777216,P|=N.AttributeData.fromColorRGB([V,$,H])):M===5&&(P&=-50331904,P|=33554432|255&V),P}_extractColor(P,M,V){const $=[0,0,-1,0,0,0];let H=0,ye=0;do{if($[ye+H]=P.params[M+ye],P.hasSubParams(M+ye)){const Ae=P.getSubParams(M+ye);let Ne=0;do $[1]===5&&(H=1),$[ye+Ne+1+H]=Ae[Ne];while(++Ne<Ae.length&&Ne+ye+1+H<$.length);break}if($[1]===5&&ye+H>=2||$[1]===2&&ye+H>=5)break;$[1]&&(H=1)}while(++ye+M<P.length&&ye+H<$.length);for(let Ae=2;Ae<$.length;++Ae)$[Ae]===-1&&($[Ae]=0);switch($[0]){case 38:V.fg=this._updateAttrColor(V.fg,$[1],$[3],$[4],$[5]);break;case 48:V.bg=this._updateAttrColor(V.bg,$[1],$[3],$[4],$[5]);break;case 58:V.extended=V.extended.clone(),V.extended.underlineColor=this._updateAttrColor(V.extended.underlineColor,$[1],$[3],$[4],$[5])}return ye}_processUnderline(P,M){M.extended=M.extended.clone(),(!~P||P>5)&&(P=1),M.extended.underlineStyle=P,M.fg|=268435456,P===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(P){P.fg=v.DEFAULT_ATTR_DATA.fg,P.bg=v.DEFAULT_ATTR_DATA.bg,P.extended=P.extended.clone(),P.extended.underlineStyle=0,P.extended.underlineColor&=-67108864,P.updateExtended()}charAttributes(P){if(P.length===1&&P.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=P.length;let V;const $=this._curAttrData;for(let H=0;H<M;H++)V=P.params[H],V>=30&&V<=37?($.fg&=-50331904,$.fg|=16777216|V-30):V>=40&&V<=47?($.bg&=-50331904,$.bg|=16777216|V-40):V>=90&&V<=97?($.fg&=-50331904,$.fg|=16777224|V-90):V>=100&&V<=107?($.bg&=-50331904,$.bg|=16777224|V-100):V===0?this._processSGR0($):V===1?$.fg|=134217728:V===3?$.bg|=67108864:V===4?($.fg|=268435456,this._processUnderline(P.hasSubParams(H)?P.getSubParams(H)[0]:1,$)):V===5?$.fg|=536870912:V===7?$.fg|=67108864:V===8?$.fg|=1073741824:V===9?$.fg|=2147483648:V===2?$.bg|=134217728:V===21?this._processUnderline(2,$):V===22?($.fg&=-134217729,$.bg&=-134217729):V===23?$.bg&=-67108865:V===24?($.fg&=-268435457,this._processUnderline(0,$)):V===25?$.fg&=-536870913:V===27?$.fg&=-67108865:V===28?$.fg&=-1073741825:V===29?$.fg&=2147483647:V===39?($.fg&=-67108864,$.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):V===49?($.bg&=-67108864,$.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):V===38||V===48||V===58?H+=this._extractColor(P,H,$):V===53?$.bg|=1073741824:V===55?$.bg&=-1073741825:V===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):V===100?($.fg&=-67108864,$.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",V);return!0}deviceStatus(P){switch(P.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,V=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${M};${V}R`)}return!0}deviceStatusPrivate(P){if(P.params[0]===6){const M=this._activeBuffer.y+1,V=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${M};${V}R`)}return!0}softReset(P){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.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(P){const M=P.params[0]||1;switch(M){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 V=M%2==1;return this._optionsService.options.cursorBlink=V,!0}setScrollRegion(P){const M=P.params[0]||1;let V;return(P.length<2||(V=P.params[1])>this._bufferService.rows||V===0)&&(V=this._bufferService.rows),V>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=V-1,this._setCursor(0,0)),!0}windowOptions(P){if(!K(P.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=P.length>1?P.params[1]:0;switch(P.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(Z.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(Z.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:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(P){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(P){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(P){return this._windowTitle=P,this._onTitleChange.fire(P),!0}setIconName(P){return this._iconName=P,!0}setOrReportIndexedColor(P){const M=[],V=P.split(";");for(;V.length>1;){const $=V.shift(),H=V.shift();if(/^\d+$/.exec($)){const ye=parseInt($);if(de(ye))if(H==="?")M.push({type:0,index:ye});else{const Ae=(0,L.parseColor)(H);Ae&&M.push({type:1,index:ye,color:Ae})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(P){const M=P.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(P,M){this._getCurrentLinkId()&&this._finishHyperlink();const V=P.split(":");let $;const H=V.findIndex((ye=>ye.startsWith("id=")));return H!==-1&&($=V[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(P,M){const V=P.split(";");for(let $=0;$<V.length&&!(M>=this._specialColors.length);++$,++M)if(V[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const H=(0,L.parseColor)(V[$]);H&&this._onColor.fire([{type:1,index:this._specialColors[M],color:H}])}return!0}setOrReportFgColor(P){return this._setOrReportSpecialColor(P,0)}setOrReportBgColor(P){return this._setOrReportSpecialColor(P,1)}setOrReportCursorColor(P){return this._setOrReportSpecialColor(P,2)}restoreIndexedColor(P){if(!P)return this._onColor.fire([{type:2}]),!0;const M=[],V=P.split(";");for(let $=0;$<V.length;++$)if(/^\d+$/.exec(V[$])){const H=parseInt(V[$]);de(H)&&M.push({type:2,index:H})}return M.length&&this._onColor.fire(M),!0}restoreFgColor(P){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(P){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(P){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),!0}selectCharset(P){return P.length!==2?(this.selectDefaultCharset(),!0):(P[0]==="/"||this._charsetService.setgCharset(z[P[0]],g.CHARSETS[P[1]]||g.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const P=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,P,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=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(P){return this._charsetService.setgLevel(P),!0}screenAlignmentPattern(){const P=new S.CellData;P.content=4194373,P.fg=this._curAttrData.fg,P.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M<this._bufferService.rows;++M){const V=this._activeBuffer.ybase+this._activeBuffer.y+M,$=this._activeBuffer.lines.get(V);$&&($.fill(P),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(P,M){const V=this._bufferService.buffer,$=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${H}${h.C0.ESC}\\`),!0))(P==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:P==='"p'?'P1$r61;1"p':P==="r"?`P1$r${V.scrollTop+1};${V.scrollBottom+1}r`:P==="m"?"P1$r0m":P===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(P,M){this._dirtyRowTracker.markRangeDirty(P,M)}}l.InputHandler=re;let Q=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){ee<this.start?this.start=ee:ee>this.end&&(this.end=ee)}markRangeDirty(ee,P){ee>P&&(te=ee,ee=P,P=te),ee<this.start&&(this.start=ee),P>this.end&&(this.end=P)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function de(ee){return 0<=ee&&ee<256}Q=f([p(0,I.IBufferService)],Q)},844:(c,l)=>{function d(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=d,l.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(p,h,g){this._data[p]||(this._data[p]={}),this._data[p][h]=g}get(p,h){return this._data[p]?this._data[p][h]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(f,p,h,g,b){this._data.get(f,p)||this._data.set(f,p,new d),this._data.get(f,p).set(h,g,b)}get(f,p,h,g){var b;return(b=this._data.get(f,p))==null?void 0:b.get(h,g)}clear(){this._data.clear()}}},6114:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const d=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const p=d.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(d)},6106:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(d=this._search(this._getKey(f)),this._array.splice(d,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(d=this._search(p),d===-1)||this._getKey(this._array[d])!==p)return!1;do if(this._array[d]===f)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===p);return!1}*getKeyIterator(f){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===f)}forEachByKey(f,p){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do p(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===f)}values(){return[...this._array].values()}_search(f){let p=0,h=this._array.length-1;for(;h>=p;){let g=p+h>>1;const b=this._getKey(this._array[g]);if(b>f)h=g-1;else{if(!(b<f)){for(;g>0&&this._getKey(this._array[g-1])===f;)g--;return g}p=g+1}}return p}}},7226:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=d(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(b){this._tasks.push(b),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(b){this._idleCallback=void 0;let x=0,E=0,v=b.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(x=Date.now(),this._tasks[this._i]()||this._i++,x=Math.max(1,Date.now()-x),E=Math.max(x,E),y=b.timeRemaining(),1.5*E>y)return v-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-x))}ms`),void this._start();v=y}this.clear()}}class h extends p{_requestCallback(b){return setTimeout((()=>b(this._createDeadline(16))))}_cancelCallback(b){clearTimeout(b)}_createDeadline(b){const x=Date.now()+b;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}l.PriorityTaskQueue=h,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:h,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=d(643);l.updateWindowsModeWrappedState=function(p){const h=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),g=h==null?void 0:h.get(p.cols-1),b=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);b&&g&&(b.isWrapped=g[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&g[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 d;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}}l.AttributeData=d;class f{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,g=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=g}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=d(6349),p=d(7226),h=d(3734),g=d(8437),b=d(4634),x=d(511),E=d(643),v=d(4863),y=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(_,S,N){this._hasScrollback=_,this._optionsService=S,this._bufferService=N,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,E.NULL_CELL_CHAR,E.NULL_CELL_WIDTH,E.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,E.WHITESPACE_CELL_CHAR,E.WHITESPACE_CELL_WIDTH,E.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg,this._nullCell.extended=_.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg,this._whitespaceCell.extended=_.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(_,S){return new g.BufferLine(this._bufferService.cols,this.getNullCell(_),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const _=this.ybase+this.y-this.ydisp;return _>=0&&_<this._rows}_getCorrectBufferLength(_){if(!this._hasScrollback)return _;const S=_+this._optionsService.rawOptions.scrollback;return S>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(_){if(this.lines.length===0){_===void 0&&(_=g.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(_))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(_,S){const N=this.getNullCell(g.DEFAULT_ATTR_DATA);let I=0;const R=this._getCorrectBufferLength(S);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<_)for(let k=0;k<this.lines.length;k++)I+=+this.lines.get(k).resize(_,N);let B=0;if(this._rows<S)for(let k=this._rows;k<S;k++)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 g.BufferLine(_,N)):this.ybase>0&&this.lines.length<=this.ybase+this.y+B+1?(this.ybase--,B++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(_,N)));else for(let k=this._rows;k>S;k--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const k=this.lines.length-R;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=R}this.x=Math.min(this.x,_-1),this.y=Math.min(this.y,S-1),B&&(this.y+=B),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(_,S),this._cols>_))for(let B=0;B<this.lines.length;B++)I+=+this.lines.get(B).resize(_,N);this._cols=_,this._rows=S,this._memoryCleanupQueue.clear(),I>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let _=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,_=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return _}get _isReflowEnabled(){const _=this._optionsService.rawOptions.windowsPty;return _&&_.buildNumber?this._hasScrollback&&_.backend==="conpty"&&_.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(_,S){this._cols!==_&&(_>this._cols?this._reflowLarger(_,S):this._reflowSmaller(_,S))}_reflowLarger(_,S){const N=(0,b.reflowLargerGetLinesToRemove)(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(N.length>0){const I=(0,b.reflowLargerCreateNewLayout)(this.lines,N);(0,b.reflowLargerApplyNewLayout)(this.lines,I.layout),this._reflowLargerAdjustViewport(_,S,I.countRemoved)}}_reflowLargerAdjustViewport(_,S,N){const I=this.getNullCell(g.DEFAULT_ATTR_DATA);let R=N;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new g.BufferLine(_,I))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-N,0)}_reflowSmaller(_,S){const N=this.getNullCell(g.DEFAULT_ATTR_DATA),I=[];let R=0;for(let B=this.lines.length-1;B>=0;B--){let k=this.lines.get(B);if(!k||!k.isWrapped&&k.getTrimmedLength()<=_)continue;const L=[k];for(;k.isWrapped&&B>0;)k=this.lines.get(--B),L.unshift(k);const z=this.ybase+this.y;if(z>=B&&z<B+L.length)continue;const G=L[L.length-1].getTrimmedLength(),K=(0,b.reflowSmallerGetNewLineLengths)(L,this._cols,_),Z=K.length-L.length;let te;te=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+Z):Math.max(0,this.lines.length-this.lines.maxLength+Z);const re=[];for(let V=0;V<Z;V++){const $=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);re.push($)}re.length>0&&(I.push({start:B+L.length+R,newLines:re}),R+=re.length),L.push(...re);let Q=K.length-1,de=K[Q];de===0&&(Q--,de=K[Q]);let ee=L.length-Z-1,P=G;for(;ee>=0;){const V=Math.min(P,de);if(L[Q]===void 0)break;if(L[Q].copyCellsFrom(L[ee],P-V,de-V,V,!0),de-=V,de===0&&(Q--,de=K[Q]),P-=V,P===0){ee--;const $=Math.max(ee,0);P=(0,b.getWrappedLineTrimmedLength)(L,$,this._cols)}}for(let V=0;V<L.length;V++)K[V]<_&&L[V].setCell(K[V],N);let M=Z-te;for(;M-- >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+R)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+Z,this.ybase+S-1)}if(I.length>0){const B=[],k=[];for(let Q=0;Q<this.lines.length;Q++)k.push(this.lines.get(Q));const L=this.lines.length;let z=L-1,G=0,K=I[G];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let Z=0;for(let Q=Math.min(this.lines.maxLength-1,L+R-1);Q>=0;Q--)if(K&&K.start>z+Z){for(let de=K.newLines.length-1;de>=0;de--)this.lines.set(Q--,K.newLines[de]);Q++,B.push({index:z+1,amount:K.newLines.length}),Z+=K.newLines.length,K=I[++G]}else this.lines.set(Q,k[z--]);let te=0;for(let Q=B.length-1;Q>=0;Q--)B[Q].index+=te,this.lines.onInsertEmitter.fire(B[Q]),te+=B[Q].amount;const re=Math.max(0,L+R-this.lines.maxLength);re>0&&this.lines.onTrimEmitter.fire(re)}}translateBufferLineToString(_,S,N=0,I){const R=this.lines.get(_);return R?R.translateToString(S,N,I):""}getWrappedRangeForLine(_){let S=_,N=_;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;N+1<this.lines.length&&this.lines.get(N+1).isWrapped;)N++;return{first:S,last:N}}setupTabStops(_){for(_!=null?this.tabs[_]||(_=this.prevStop(_)):(this.tabs={},_=0);_<this._cols;_+=this._optionsService.rawOptions.tabStopWidth)this.tabs[_]=!0}prevStop(_){for(_==null&&(_=this.x);!this.tabs[--_]&&_>0;);return _>=this._cols?this._cols-1:_<0?0:_}nextStop(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_<this._cols;);return _>=this._cols?this._cols-1:_<0?0:_}clearMarkers(_){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===_&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].dispose(),this.markers.splice(_--,1);this._isClearing=!1}addMarker(_){const S=new v.Marker(_);return this.markers.push(S),S.register(this.lines.onTrim((N=>{S.line-=N,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((N=>{S.line>=N.index&&(S.line+=N.amount)}))),S.register(this.lines.onDelete((N=>{S.line>=N.index&&S.line<N.index+N.amount&&S.dispose(),S.line>N.index&&(S.line-=N.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(_){this._isClearing||this.markers.splice(this.markers.indexOf(_),1)}}},8437:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=d(3734),p=d(511),h=d(643),g=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let b=0;class x{constructor(v,y,_=!1){this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const S=y||p.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let N=0;N<v;++N)this.setCell(N,S);this.length=v}get(v){const y=this._data[3*v+0],_=2097151&y;return[this._data[3*v+1],2097152&y?this._combined[v]:_?(0,g.stringFromCodePoint)(_):"",y>>22,2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):_]}set(v,y){this._data[3*v+1]=y[h.CHAR_DATA_ATTR_INDEX],y[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=y[1],this._data[3*v+0]=2097152|v|y[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=y[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&y}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v]:2097151&y?(0,g.stringFromCodePoint)(2097151&y):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,y){return b=3*v,y.content=this._data[b+0],y.fg=this._data[b+1],y.bg=this._data[b+2],2097152&y.content&&(y.combinedData=this._combined[v]),268435456&y.bg&&(y.extended=this._extendedAttrs[v]),y}setCell(v,y){2097152&y.content&&(this._combined[v]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[v]=y.extended),this._data[3*v+0]=y.content,this._data[3*v+1]=y.fg,this._data[3*v+2]=y.bg}setCellFromCodepoint(v,y,_,S){268435456&S.bg&&(this._extendedAttrs[v]=S.extended),this._data[3*v+0]=y|_<<22,this._data[3*v+1]=S.fg,this._data[3*v+2]=S.bg}addCodepointToCell(v,y,_){let S=this._data[3*v+0];2097152&S?this._combined[v]+=(0,g.stringFromCodePoint)(y):2097151&S?(this._combined[v]=(0,g.stringFromCodePoint)(2097151&S)+(0,g.stringFromCodePoint)(y),S&=-2097152,S|=2097152):S=y|4194304,_&&(S&=-12582913,S|=_<<22),this._data[3*v+0]=S}insertCells(v,y,_){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,_),y<this.length-v){const S=new p.CellData;for(let N=this.length-v-y-1;N>=0;--N)this.setCell(v+y+N,this.loadCell(v+N,S));for(let N=0;N<y;++N)this.setCell(v+N,_)}else for(let S=v;S<this.length;++S)this.setCell(S,_);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,_)}deleteCells(v,y,_){if(v%=this.length,y<this.length-v){const S=new p.CellData;for(let N=0;N<this.length-v-y;++N)this.setCell(v+N,this.loadCell(v+y+N,S));for(let N=this.length-y;N<this.length;++N)this.setCell(N,_)}else for(let S=v;S<this.length;++S)this.setCell(S,_);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,_),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,_)}replaceCells(v,y,_,S=!1){if(S)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,_),y<this.length&&this.getWidth(y-1)===2&&!this.isProtected(y)&&this.setCellFromCodepoint(y,0,1,_);v<y&&v<this.length;)this.isProtected(v)||this.setCell(v,_),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,_),y<this.length&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y,0,1,_);v<y&&v<this.length;)this.setCell(v++,_)}resize(v,y){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const _=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*_)this._data=new Uint32Array(this._data.buffer,0,_);else{const S=new Uint32Array(_);S.set(this._data),this._data=S}for(let S=this.length;S<v;++S)this.setCell(S,y)}else{this._data=this._data.subarray(0,_);const S=Object.keys(this._combined);for(let I=0;I<S.length;I++){const R=parseInt(S[I],10);R>=v&&delete this._combined[R]}const N=Object.keys(this._extendedAttrs);for(let I=0;I<N.length;I++){const R=parseInt(N[I],10);R>=v&&delete this._extendedAttrs[R]}}return this.length=v,4*_*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,y=!1){if(y)for(let _=0;_<this.length;++_)this.isProtected(_)||this.setCell(_,v);else{this._combined={},this._extendedAttrs={};for(let _=0;_<this.length;++_)this.setCell(_,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const y in v._combined)this._combined[y]=v._combined[y];this._extendedAttrs={};for(const y in v._extendedAttrs)this._extendedAttrs[y]=v._extendedAttrs[y];this.isWrapped=v.isWrapped}clone(){const v=new x(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const y in this._combined)v._combined[y]=this._combined[y];for(const y in this._extendedAttrs)v._extendedAttrs[y]=this._extendedAttrs[y];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,y,_,S,N){const I=v._data;if(N)for(let B=S-1;B>=0;B--){for(let k=0;k<3;k++)this._data[3*(_+B)+k]=I[3*(y+B)+k];268435456&I[3*(y+B)+2]&&(this._extendedAttrs[_+B]=v._extendedAttrs[y+B])}else for(let B=0;B<S;B++){for(let k=0;k<3;k++)this._data[3*(_+B)+k]=I[3*(y+B)+k];268435456&I[3*(y+B)+2]&&(this._extendedAttrs[_+B]=v._extendedAttrs[y+B])}const R=Object.keys(v._combined);for(let B=0;B<R.length;B++){const k=parseInt(R[B],10);k>=y&&(this._combined[k-y+_]=v._combined[k])}}translateToString(v,y,_,S){y=y??0,_=_??this.length,v&&(_=Math.min(_,this.getTrimmedLength())),S&&(S.length=0);let N="";for(;y<_;){const I=this._data[3*y+0],R=2097151&I,B=2097152&I?this._combined[y]:R?(0,g.stringFromCodePoint)(R):h.WHITESPACE_CELL_CHAR;if(N+=B,S)for(let k=0;k<B.length;++k)S.push(y);y+=I>>22||1}return S&&S.push(y),N}}l.BufferLine=x},4841:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(d,f){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return f*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(c,l)=>{function d(f,p,h){if(p===f.length-1)return f[p].getTrimmedLength();const g=!f[p].hasContent(h-1)&&f[p].getWidth(h-1)===1,b=f[p+1].getWidth(0)===2;return g&&b?h-1:h}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,p,h,g,b){const x=[];for(let E=0;E<f.length-1;E++){let v=E,y=f.get(++v);if(!y.isWrapped)continue;const _=[f.get(E)];for(;v<f.length&&y.isWrapped;)_.push(y),y=f.get(++v);if(g>=E&&g<v){E+=_.length-1;continue}let S=0,N=d(_,S,p),I=1,R=0;for(;I<_.length;){const k=d(_,I,p),L=k-R,z=h-N,G=Math.min(L,z);_[S].copyCellsFrom(_[I],R,N,G,!1),N+=G,N===h&&(S++,N=0),R+=G,R===k&&(I++,R=0),N===0&&S!==0&&_[S-1].getWidth(h-1)===2&&(_[S].copyCellsFrom(_[S-1],h-1,N++,1,!1),_[S-1].setCell(h-1,b))}_[S].replaceCells(N,h,b);let B=0;for(let k=_.length-1;k>0&&(k>S||_[k].getTrimmedLength()===0);k--)B++;B>0&&(x.push(E+_.length-B),x.push(B)),E+=_.length-1}return x},l.reflowLargerCreateNewLayout=function(f,p){const h=[];let g=0,b=p[g],x=0;for(let E=0;E<f.length;E++)if(b===E){const v=p[++g];f.onDeleteEmitter.fire({index:E-x,amount:v}),E+=v-1,x+=v,b=p[++g]}else h.push(E);return{layout:h,countRemoved:x}},l.reflowLargerApplyNewLayout=function(f,p){const h=[];for(let g=0;g<p.length;g++)h.push(f.get(p[g]));for(let g=0;g<h.length;g++)f.set(g,h[g]);f.length=p.length},l.reflowSmallerGetNewLineLengths=function(f,p,h){const g=[],b=f.map(((y,_)=>d(f,_,p))).reduce(((y,_)=>y+_));let x=0,E=0,v=0;for(;v<b;){if(b-v<h){g.push(b-v);break}x+=h;const y=d(f,E,p);x>y&&(x-=y,E++);const _=f[E].getWidth(x-1)===2;_&&x--;const S=_?h-1:h;g.push(S),v+=S}return g},l.getWrappedLineTrimmedLength=d},5295:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=d(8460),p=d(844),h=d(9092);class g extends p.Disposable{constructor(x,E){super(),this._optionsService=x,this._bufferService=E,this._onBufferActivate=this.register(new f.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(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),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(x,E){this._normal.resize(x,E),this._alt.resize(x,E),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}l.BufferSet=g},511:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=d(482),p=d(643),h=d(3734);class g extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const E=new g;return E.setFromCharData(x),E}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let E=!1;if(x[p.CHAR_DATA_CHAR_INDEX].length>2)E=!0;else if(x[p.CHAR_DATA_CHAR_INDEX].length===2){const v=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const y=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(v-55296)+y-56320+65536|x[p.CHAR_DATA_WIDTH_INDEX]<<22:E=!0}else E=!0}else this.content=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[p.CHAR_DATA_WIDTH_INDEX]<<22;E&&(this.combinedData=x[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=g},643:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=d(8460),p=d(844);class h{get id(){return this._id}constructor(b){this.line=b,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(b){return this._disposables.push(b),b}}l.Marker=h,h._nextId=1},7116:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.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:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,l)=>{var d,f,p;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.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=`
160
- `,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=""})(d||(l.C0=d={})),(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="Ÿ"})(f||(l.C1=f={})),(function(h){h.ST=`${d.ESC}\\`})(p||(l.C1_ESCAPED=p={}))},7399:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=d(2584),p={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:["'",'"']};l.evaluateKeyboardEvent=function(h,g,b,x){const E={type:0,cancel:!1,key:void 0},v=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?E.key=g?f.C0.ESC+"OA":f.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?E.key=g?f.C0.ESC+"OD":f.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?E.key=g?f.C0.ESC+"OC":f.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(E.key=g?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:E.key=h.ctrlKey?"\b":f.C0.DEL,h.altKey&&(E.key=f.C0.ESC+E.key);break;case 9:if(h.shiftKey){E.key=f.C0.ESC+"[Z";break}E.key=f.C0.HT,E.cancel=!0;break;case 13:E.key=h.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,E.cancel=!0;break;case 27:E.key=f.C0.ESC,h.altKey&&(E.key=f.C0.ESC+f.C0.ESC),E.cancel=!0;break;case 37:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"D",E.key===f.C0.ESC+"[1;3D"&&(E.key=f.C0.ESC+(b?"b":"[1;5D"))):E.key=g?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"C",E.key===f.C0.ESC+"[1;3C"&&(E.key=f.C0.ESC+(b?"f":"[1;5C"))):E.key=g?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"A",b||E.key!==f.C0.ESC+"[1;3A"||(E.key=f.C0.ESC+"[1;5A")):E.key=g?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"B",b||E.key!==f.C0.ESC+"[1;3B"||(E.key=f.C0.ESC+"[1;5B")):E.key=g?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(E.key=f.C0.ESC+"[2~");break;case 46:E.key=v?f.C0.ESC+"[3;"+(v+1)+"~":f.C0.ESC+"[3~";break;case 36:E.key=v?f.C0.ESC+"[1;"+(v+1)+"H":g?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:E.key=v?f.C0.ESC+"[1;"+(v+1)+"F":g?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:h.shiftKey?E.type=2:h.ctrlKey?E.key=f.C0.ESC+"[5;"+(v+1)+"~":E.key=f.C0.ESC+"[5~";break;case 34:h.shiftKey?E.type=3:h.ctrlKey?E.key=f.C0.ESC+"[6;"+(v+1)+"~":E.key=f.C0.ESC+"[6~";break;case 112:E.key=v?f.C0.ESC+"[1;"+(v+1)+"P":f.C0.ESC+"OP";break;case 113:E.key=v?f.C0.ESC+"[1;"+(v+1)+"Q":f.C0.ESC+"OQ";break;case 114:E.key=v?f.C0.ESC+"[1;"+(v+1)+"R":f.C0.ESC+"OR";break;case 115:E.key=v?f.C0.ESC+"[1;"+(v+1)+"S":f.C0.ESC+"OS";break;case 116:E.key=v?f.C0.ESC+"[15;"+(v+1)+"~":f.C0.ESC+"[15~";break;case 117:E.key=v?f.C0.ESC+"[17;"+(v+1)+"~":f.C0.ESC+"[17~";break;case 118:E.key=v?f.C0.ESC+"[18;"+(v+1)+"~":f.C0.ESC+"[18~";break;case 119:E.key=v?f.C0.ESC+"[19;"+(v+1)+"~":f.C0.ESC+"[19~";break;case 120:E.key=v?f.C0.ESC+"[20;"+(v+1)+"~":f.C0.ESC+"[20~";break;case 121:E.key=v?f.C0.ESC+"[21;"+(v+1)+"~":f.C0.ESC+"[21~";break;case 122:E.key=v?f.C0.ESC+"[23;"+(v+1)+"~":f.C0.ESC+"[23~";break;case 123:E.key=v?f.C0.ESC+"[24;"+(v+1)+"~":f.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(b&&!x||!h.altKey||h.metaKey)!b||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?E.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(E.key=f.C0.US),h.key==="@"&&(E.key=f.C0.NUL)):h.keyCode===65&&(E.type=1);else{const y=p[h.keyCode],_=y==null?void 0:y[h.shiftKey?1:0];if(_)E.key=f.C0.ESC+_;else if(h.keyCode>=65&&h.keyCode<=90){const S=h.ctrlKey?h.keyCode-64:h.keyCode+32;let N=String.fromCharCode(S);h.shiftKey&&(N=N.toUpperCase()),E.key=f.C0.ESC+N}else if(h.keyCode===32)E.key=f.C0.ESC+(h.ctrlKey?f.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let S=h.code.slice(3,4);h.shiftKey||(S=S.toLowerCase()),E.key=f.C0.ESC+S,E.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?E.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?E.key=f.C0.NUL:h.keyCode>=51&&h.keyCode<=55?E.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?E.key=f.C0.DEL:h.keyCode===219?E.key=f.C0.ESC:h.keyCode===220?E.key=f.C0.FS:h.keyCode===221&&(E.key=f.C0.GS)}return E}},482:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,f=0,p=d.length){let h="";for(let g=f;g<p;++g){let b=d[g];b>65535?(b-=65536,h+=String.fromCharCode(55296+(b>>10))+String.fromCharCode(b%1024+56320)):h+=String.fromCharCode(b)}return h},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const p=d.length;if(!p)return 0;let h=0,g=0;if(this._interim){const b=d.charCodeAt(g++);56320<=b&&b<=57343?f[h++]=1024*(this._interim-55296)+b-56320+65536:(f[h++]=this._interim,f[h++]=b),this._interim=0}for(let b=g;b<p;++b){const x=d.charCodeAt(b);if(55296<=x&&x<=56319){if(++b>=p)return this._interim=x,h;const E=d.charCodeAt(b);56320<=E&&E<=57343?f[h++]=1024*(x-55296)+E-56320+65536:(f[h++]=x,f[h++]=E)}else x!==65279&&(f[h++]=x)}return h}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,f){const p=d.length;if(!p)return 0;let h,g,b,x,E=0,v=0,y=0;if(this.interim[0]){let N=!1,I=this.interim[0];I&=(224&I)==192?31:(240&I)==224?15:7;let R,B=0;for(;(R=63&this.interim[++B])&&B<4;)I<<=6,I|=R;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=k-B;for(;y<L;){if(y>=p)return 0;if(R=d[y++],(192&R)!=128){y--,N=!0;break}this.interim[B++]=R,I<<=6,I|=63&R}N||(k===2?I<128?y--:f[E++]=I:k===3?I<2048||I>=55296&&I<=57343||I===65279||(f[E++]=I):I<65536||I>1114111||(f[E++]=I)),this.interim.fill(0)}const _=p-4;let S=y;for(;S<p;){for(;!(!(S<_)||128&(h=d[S])||128&(g=d[S+1])||128&(b=d[S+2])||128&(x=d[S+3]));)f[E++]=h,f[E++]=g,f[E++]=b,f[E++]=x,S+=4;if(h=d[S++],h<128)f[E++]=h;else if((224&h)==192){if(S>=p)return this.interim[0]=h,E;if(g=d[S++],(192&g)!=128){S--;continue}if(v=(31&h)<<6|63&g,v<128){S--;continue}f[E++]=v}else if((240&h)==224){if(S>=p)return this.interim[0]=h,E;if(g=d[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=h,this.interim[1]=g,E;if(b=d[S++],(192&b)!=128){S--;continue}if(v=(15&h)<<12|(63&g)<<6|63&b,v<2048||v>=55296&&v<=57343||v===65279)continue;f[E++]=v}else if((248&h)==240){if(S>=p)return this.interim[0]=h,E;if(g=d[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=h,this.interim[1]=g,E;if(b=d[S++],(192&b)!=128){S--;continue}if(S>=p)return this.interim[0]=h,this.interim[1]=g,this.interim[2]=b,E;if(x=d[S++],(192&x)!=128){S--;continue}if(v=(7&h)<<18|(63&g)<<12|(63&b)<<6|63&x,v<65536||v>1114111)continue;f[E++]=v}}return E}}},225:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=d(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],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 g;l.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let b=0;b<p.length;++b)g.fill(0,p[b][0],p[b][1]+1)}}wcwidth(b){return b<32?0:b<127?1:b<65536?g[b]:(function(x,E){let v,y=0,_=E.length-1;if(x<E[0][0]||x>E[_][1])return!1;for(;_>=y;)if(v=y+_>>1,x>E[v][1])y=v+1;else{if(!(x<E[v][0]))return!0;_=v-1}return!1})(b,h)?0:b>=131072&&b<=196605||b>=196608&&b<=262141?2:1}charProperties(b,x){let E=this.wcwidth(b),v=E===0&&x!==0;if(v){const y=f.UnicodeService.extractWidth(x);y===0?v=!1:y>E&&(E=y)}return f.UnicodeService.createPropertyValue(0,E,v)}}},5981:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=d(8460),p=d(844);class h extends p.Disposable{constructor(b){super(),this._action=b,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(b,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=b.length,this._writeBuffer.push(b),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let E;for(this._isSyncWriting=!0;E=this._writeBuffer.shift();){this._action(E);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(b,x){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+=b.length,this._writeBuffer.push(b),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=b.length,this._writeBuffer.push(b),this._callbacks.push(x)}_innerWrite(b=0,x=!0){const E=b||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],y=this._action(v,x);if(y){const S=N=>Date.now()-E>=12?setTimeout((()=>this._innerWrite(0,N))):this._innerWrite(E,N);return void y.catch((N=>(queueMicrotask((()=>{throw N})),Promise.resolve(!1)))).then(S)}const _=this._callbacks[this._bufferOffset];if(_&&_(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-E>=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()}}l.WriteBuffer=h},5941:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const d=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function p(h,g){const b=h.toString(16),x=b.length<2?"0"+b:b;switch(g){case 4:return b[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}l.parseColor=function(h){if(!h)return;let g=h.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const b=d.exec(g);if(b){const x=b[1]?15:b[4]?255:b[7]?4095:65535;return[Math.round(parseInt(b[1]||b[4]||b[7]||b[10],16)/x*255),Math.round(parseInt(b[2]||b[5]||b[8]||b[11],16)/x*255),Math.round(parseInt(b[3]||b[6]||b[9]||b[12],16)/x*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),f.exec(g)&&[3,6,9,12].includes(g.length))){const b=g.length/3,x=[0,0,0];for(let E=0;E<3;++E){const v=parseInt(g.slice(b*E,b*E+b),16);x[E]=b===1?v<<4:b===2?v:b===3?v>>4:v>>8}return x}},l.toRgbString=function(h,g=16){const[b,x,E]=h;return`rgb:${p(b,g)}/${p(x,g)}/${p(E,g)}`}},5770:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=d(482),p=d(8742),h=d(5770),g=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(x,E){this._handlers[x]===void 0&&(this._handlers[x]=[]);const v=this._handlers[x];return v.push(E),{dispose:()=>{const y=v.indexOf(E);y!==-1&&v.splice(y,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(x,E){if(this.reset(),this._ident=x,this._active=this._handlers[x]||g,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(E);else this._handlerFb(this._ident,"HOOK",E)}put(x,E,v){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(x,E,v);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(x,E,v))}unhook(x,E=!0){if(this._active.length){let v=!1,y=this._active.length-1,_=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,v=E,_=this._stack.fallThrough,this._stack.paused=!1),!_&&v===!1){for(;y>=0&&(v=this._active[y].unhook(x),v!==!0);y--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,v;y--}for(;y>=0;y--)if(v=this._active[y].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",x);this._active=g,this._ident=0}};const b=new p.Params;b.addParam(0),l.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=b,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():b,this._data="",this._hitLimit=!1}put(x,E,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(x,E,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let E=!1;if(this._hitLimit)E=!1;else if(x&&(E=this._handler(this._data,this._params),E instanceof Promise))return E.then((v=>(this._params=b,this._data="",this._hitLimit=!1,v)));return this._params=b,this._data="",this._hitLimit=!1,E}}},2015:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=d(844),p=d(8742),h=d(6242),g=d(6351);class b{constructor(y){this.table=new Uint8Array(y)}setDefault(y,_){this.table.fill(y<<4|_)}add(y,_,S,N){this.table[_<<8|y]=S<<4|N}addMany(y,_,S,N){for(let I=0;I<y.length;I++)this.table[_<<8|y[I]]=S<<4|N}}l.TransitionTable=b;const x=160;l.VT500_TRANSITION_TABLE=(function(){const v=new b(4095),y=Array.apply(null,Array(256)).map(((B,k)=>k)),_=(B,k)=>y.slice(B,k),S=_(32,127),N=_(0,24);N.push(25),N.push.apply(N,_(28,32));const I=_(0,14);let R;for(R in v.setDefault(1,0),v.addMany(S,0,2,0),I)v.addMany([24,26,153,154],R,3,0),v.addMany(_(128,144),R,3,0),v.addMany(_(144,152),R,3,0),v.add(156,R,0,0),v.add(27,R,11,1),v.add(157,R,4,8),v.addMany([152,158,159],R,0,7),v.add(155,R,11,3),v.add(144,R,11,9);return v.addMany(N,0,3,0),v.addMany(N,1,3,1),v.add(127,1,0,1),v.addMany(N,8,0,8),v.addMany(N,3,3,3),v.add(127,3,0,3),v.addMany(N,4,3,4),v.add(127,4,0,4),v.addMany(N,6,3,6),v.addMany(N,5,3,5),v.add(127,5,0,5),v.addMany(N,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(S,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(_(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(S,7,0,7),v.addMany(N,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(_(64,127),3,7,0),v.addMany(_(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(_(48,60),4,8,4),v.addMany(_(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(_(32,64),6,0,6),v.add(127,6,0,6),v.addMany(_(64,127),6,0,0),v.addMany(_(32,48),3,9,5),v.addMany(_(32,48),5,9,5),v.addMany(_(48,64),5,0,6),v.addMany(_(64,127),5,7,0),v.addMany(_(32,48),4,9,5),v.addMany(_(32,48),1,9,2),v.addMany(_(32,48),2,9,2),v.addMany(_(48,127),2,10,0),v.addMany(_(48,80),1,10,0),v.addMany(_(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(_(96,127),1,10,0),v.add(80,1,11,9),v.addMany(N,9,0,9),v.add(127,9,0,9),v.addMany(_(28,32),9,0,9),v.addMany(_(32,48),9,9,12),v.addMany(_(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(N,11,0,11),v.addMany(_(32,128),11,0,11),v.addMany(_(28,32),11,0,11),v.addMany(N,10,0,10),v.add(127,10,0,10),v.addMany(_(28,32),10,0,10),v.addMany(_(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(_(32,48),10,9,12),v.addMany(N,12,0,12),v.add(127,12,0,12),v.addMany(_(28,32),12,0,12),v.addMany(_(32,48),12,9,12),v.addMany(_(48,64),12,0,11),v.addMany(_(64,127),12,12,13),v.addMany(_(64,127),10,12,13),v.addMany(_(64,127),9,12,13),v.addMany(N,13,13,13),v.addMany(S,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(x,0,2,0),v.add(x,8,5,8),v.add(x,6,0,6),v.add(x,11,0,11),v.add(x,13,13,13),v})();class E extends f.Disposable{constructor(y=l.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(_,S,N)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,S)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,_=[64,126]){let S=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=y.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let I=0;I<y.intermediates.length;++I){const R=y.intermediates.charCodeAt(I);if(32>R||R>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=R}}if(y.final.length!==1)throw new Error("final must be a single byte");const N=y.final.charCodeAt(0);if(_[0]>N||N>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return S<<=8,S|=N,S}identToString(y){const _=[];for(;y;)_.push(String.fromCharCode(255&y)),y>>=8;return _.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,_){const S=this._identifier(y,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const N=this._escHandlers[S];return N.push(_),{dispose:()=>{const I=N.indexOf(_);I!==-1&&N.splice(I,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,_){this._executeHandlers[y.charCodeAt(0)]=_}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,_){const S=this._identifier(y);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const N=this._csiHandlers[S];return N.push(_),{dispose:()=>{const I=N.indexOf(_);I!==-1&&N.splice(I,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,_){return this._dcsParser.registerHandler(this._identifier(y),_)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,_){return this._oscParser.registerHandler(y,_)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}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(y,_,S,N,I){this._parseStack.state=y,this._parseStack.handlers=_,this._parseStack.handlerPos=S,this._parseStack.transition=N,this._parseStack.chunkPos=I}parse(y,_,S){let N,I=0,R=0,B=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,B=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 k=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&L>-1){for(;L>=0&&(N=k[L](this._params),N!==!0);L--)if(N instanceof Promise)return this._parseStack.handlerPos=L,N}this._parseStack.handlers=[];break;case 4:if(S===!1&&L>-1){for(;L>=0&&(N=k[L](),N!==!0);L--)if(N instanceof Promise)return this._parseStack.handlerPos=L,N}this._parseStack.handlers=[];break;case 6:if(I=y[this._parseStack.chunkPos],N=this._dcsParser.unhook(I!==24&&I!==26,S),N)return N;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(I=y[this._parseStack.chunkPos],N=this._oscParser.end(I!==24&&I!==26,S),N)return N;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,B=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=B;k<_;++k){switch(I=y[k],R=this._transitions.table[this.currentState<<8|(I<160?I:x)],R>>4){case 2:for(let Z=k+1;;++Z){if(Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}if(++Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}if(++Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}if(++Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}}break;case 3:this._executeHandlers[I]?this._executeHandlers[I]():this._executeHandlerFb(I),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:I,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|I];let z=L?L.length-1:-1;for(;z>=0&&(N=L[z](this._params),N!==!0);z--)if(N instanceof Promise)return this._preserveStack(3,L,z,R,k),N;z<0&&this._csiHandlerFb(this._collect<<8|I,this._params),this.precedingJoinState=0;break;case 8:do switch(I){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(I-48)}while(++k<_&&(I=y[k])>47&&I<60);k--;break;case 9:this._collect<<=8,this._collect|=I;break;case 10:const G=this._escHandlers[this._collect<<8|I];let K=G?G.length-1:-1;for(;K>=0&&(N=G[K](),N!==!0);K--)if(N instanceof Promise)return this._preserveStack(4,G,K,R,k),N;K<0&&this._escHandlerFb(this._collect<<8|I),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|I,this._params);break;case 13:for(let Z=k+1;;++Z)if(Z>=_||(I=y[Z])===24||I===26||I===27||I>127&&I<x){this._dcsParser.put(y,k,Z),k=Z-1;break}break;case 14:if(N=this._dcsParser.unhook(I!==24&&I!==26),N)return this._preserveStack(6,[],0,R,k),N;I===27&&(R|=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 Z=k+1;;Z++)if(Z>=_||(I=y[Z])<32||I>127&&I<x){this._oscParser.put(y,k,Z),k=Z-1;break}break;case 6:if(N=this._oscParser.end(I!==24&&I!==26),N)return this._preserveStack(5,[],0,R,k),N;I===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&R}}}l.EscapeSequenceParser=E},6242:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=d(5770),p=d(482),h=[];l.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(g,b){this._handlers[g]===void 0&&(this._handlers[g]=[]);const x=this._handlers[g];return x.push(b),{dispose:()=>{const E=x.indexOf(b);E!==-1&&x.splice(E,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,b,x){if(this._active.length)for(let E=this._active.length-1;E>=0;E--)this._active[E].put(g,b,x);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,b,x))}start(){this.reset(),this._state=1}put(g,b,x){if(this._state!==3){if(this._state===1)for(;b<x;){const E=g[b++];if(E===59){this._state=2,this._start();break}if(E<48||57<E)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+E-48}this._state===2&&x-b>0&&this._put(g,b,x)}}end(g,b=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,E=this._active.length-1,v=!1;if(this._stack.paused&&(E=this._stack.loopPosition-1,x=b,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;E>=0&&(x=this._active[E].end(g),x!==!0);E--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!1,x;E--}for(;E>=0;E--)if(x=this._active[E].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",g);this._active=h,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,b,x){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,b,x),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let b=!1;if(this._hitLimit)b=!1;else if(g&&(b=this._handler(this._data),b instanceof Promise))return b.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,b}}},8742:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class f{static fromArray(h){const g=new f;if(!h.length)return g;for(let b=Array.isArray(h[0])?1:0;b<h.length;++b){const x=h[b];if(Array.isArray(x))for(let E=0;E<x.length;++E)g.addSubParam(x[E]);else g.addParam(x)}return g}constructor(h=32,g=32){if(this.maxLength=h,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new f(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 g=0;g<this.length;++g){h.push(this.params[g]);const b=this._subParamsIdx[g]>>8,x=255&this._subParamsIdx[g];x-b>0&&h.push(Array.prototype.slice.call(this._subParams,b,x))}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>d?d: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>d?d:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const g=this._subParamsIdx[h]>>8,b=255&this._subParamsIdx[h];return b-g>0?this._subParams.subarray(g,b):null}getSubParamsAll(){const h={};for(let g=0;g<this.length;++g){const b=this._subParamsIdx[g]>>8,x=255&this._subParamsIdx[g];x-b>0&&(h[g]=this._subParams.slice(b,x))}return h}addDigit(h){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const b=this._digitIsSub?this._subParams:this.params,x=b[g-1];b[g-1]=~x?Math.min(10*x+h,d):h}}l.Params=f},5741:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let f=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===d){f=p;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(f,1)}}},8771:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=d(3785),p=d(511);l.BufferApiView=class{constructor(h,g){this._buffer=h,this.type=g}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 g=this._buffer.lines.get(h);if(g)return new f.BufferLineApiView(g)}getNullCell(){return new p.CellData}}},3785:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=d(511);l.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,h){if(!(p<0||p>=this._line.length))return h?(this._line.loadCell(p,h),h):this._line.loadCell(p,new f.CellData)}translateToString(p,h,g){return this._line.translateToString(p,h,g)}}},8285:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=d(8771),p=d(8460),h=d(844);class g extends h.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw 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)}}l.BufferNamespaceApi=g},7975:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,f){return this._core.registerCsiHandler(d,(p=>f(p.toArray())))}addCsiHandler(d,f){return this.registerCsiHandler(d,f)}registerDcsHandler(d,f){return this._core.registerDcsHandler(d,((p,h)=>f(p,h.toArray())))}addDcsHandler(d,f){return this.registerDcsHandler(d,f)}registerEscHandler(d,f){return this._core.registerEscHandler(d,f)}addEscHandler(d,f){return this.registerEscHandler(d,f)}registerOscHandler(d,f){return this._core.registerOscHandler(d,f)}addOscHandler(d,f){return this.registerOscHandler(d,f)}}},7090:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(c,l,d){var f=this&&this.__decorate||function(v,y,_,S){var N,I=arguments.length,R=I<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,_,S);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(R=(I<3?N(R):I>3?N(y,_,R):N(y,_))||R);return I>3&&R&&Object.defineProperty(y,_,R),R},p=this&&this.__param||function(v,y){return function(_,S){y(_,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const h=d(8460),g=d(844),b=d(5295),x=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let E=l.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(v){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(v.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new b.BufferSet(v,this))}resize(v,y){this.cols=v,this.rows=y,this.buffers.resize(v,y),this._onResize.fire({cols:v,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,y=!1){const _=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===v.fg&&S.getBg(0)===v.bg||(S=_.getBlankLine(v,y),this._cachedBlankLine=S),S.isWrapped=y;const N=_.ybase+_.scrollTop,I=_.ybase+_.scrollBottom;if(_.scrollTop===0){const R=_.lines.isFull;I===_.lines.length-1?R?_.lines.recycle().copyFrom(S):_.lines.push(S.clone()):_.lines.splice(I+1,0,S.clone()),R?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const R=I-N+1;_.lines.shiftElements(N+1,R-1,-1),_.lines.set(I,S.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(v,y,_){const S=this.buffer;if(v<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else v+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const N=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+v,S.ybase),0),N!==S.ydisp&&(y||this._onScroll.fire(S.ydisp))}};l.BufferService=E=f([p(0,x.IOptionsService)],E)},7994:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,f){this._charsets[d]=f,this.glevel===d&&(this.charset=f)}}},1753:function(c,l,d){var f=this&&this.__decorate||function(S,N,I,R){var B,k=arguments.length,L=k<3?N:R===null?R=Object.getOwnPropertyDescriptor(N,I):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,I,R);else for(var z=S.length-1;z>=0;z--)(B=S[z])&&(L=(k<3?B(L):k>3?B(N,I,L):B(N,I))||L);return k>3&&L&&Object.defineProperty(N,I,L),L},p=this&&this.__param||function(S,N){return function(I,R){N(I,R,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const h=d(2585),g=d(8460),b=d(844),x={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 E(S,N){let I=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(I|=64,I|=S.action):(I|=3&S.button,4&S.button&&(I|=64),8&S.button&&(I|=128),S.action===32?I|=32:S.action!==0||N||(I|=3)),I}const v=String.fromCharCode,y={DEFAULT:S=>{const N=[E(S,!1)+32,S.col+32,S.row+32];return N[0]>255||N[1]>255||N[2]>255?"":`\x1B[M${v(N[0])}${v(N[1])}${v(N[2])}`},SGR:S=>{const N=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${E(S,!0)};${S.col};${S.row}${N}`},SGR_PIXELS:S=>{const N=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${E(S,!0)};${S.x};${S.y}${N}`}};let _=l.CoreMouseService=class extends b.Disposable{constructor(S,N){super(),this._bufferService=S,this._coreService=N,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const I of Object.keys(x))this.addProtocol(I,x[I]);for(const I of Object.keys(y))this.addEncoding(I,y[I]);this.reset()}addProtocol(S,N){this._protocols[S]=N}addEncoding(S,N){this._encodings[S]=N}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 N=this._encodings[this._activeEncoding](S);return N&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(N):this._coreService.triggerDataEvent(N,!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,N,I){if(I){if(S.x!==N.x||S.y!==N.y)return!1}else if(S.col!==N.col||S.row!==N.row)return!1;return S.button===N.button&&S.action===N.action&&S.ctrl===N.ctrl&&S.alt===N.alt&&S.shift===N.shift}};l.CoreMouseService=_=f([p(0,h.IBufferService),p(1,h.ICoreService)],_)},6975:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const h=d(1439),g=d(8460),b=d(844),x=d(2585),E=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=l.CoreService=class extends b.Disposable{constructor(_,S,N){super(),this._bufferService=_,this._logService=S,this._optionsService=N,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(E),this.decPrivateModes=(0,h.clone)(v)}reset(){this.modes=(0,h.clone)(E),this.decPrivateModes=(0,h.clone)(v)}triggerDataEvent(_,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const N=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&N.ybase!==N.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,(()=>_.split("").map((I=>I.charCodeAt(0))))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,(()=>_.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(_))}};l.CoreService=y=f([p(0,x.IBufferService),p(1,x.ILogService),p(2,x.IOptionsService)],y)},9074:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=d(8055),p=d(8460),h=d(844),g=d(6106);let b=0,x=0;class E extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((_=>_==null?void 0:_.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(_){if(_.marker.isDisposed)return;const S=new v(_);if(S){const N=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),N.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,S,N){let I=0,R=0;for(const B of this._decorations.getKeyIterator(S))I=B.options.x??0,R=I+(B.options.width??1),_>=I&&_<R&&(!N||(B.options.layer??"bottom")===N)&&(yield B)}forEachDecorationAtCell(_,S,N,I){this._decorations.forEachByKey(S,(R=>{b=R.options.x??0,x=b+(R.options.width??1),_>=b&&_<x&&(!N||(R.options.layer??"bottom")===N)&&I(R)}))}}l.DecorationService=E;class v extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(_){super(),this.options=_,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=_.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=d(2585),p=d(8343);class h{constructor(...b){this._entries=new Map;for(const[x,E]of b)this.set(x,E)}set(b,x){const E=this._entries.get(b);return this._entries.set(b,x),E}forEach(b){for(const[x,E]of this._entries.entries())b(x,E)}has(b){return this._entries.has(b)}get(b){return this._entries.get(b)}}l.ServiceCollection=h,l.InstantiationService=class{constructor(){this._services=new h,this._services.set(f.IInstantiationService,this)}setService(g,b){this._services.set(g,b)}getService(g){return this._services.get(g)}createInstance(g,...b){const x=(0,p.getServiceDependencies)(g).sort(((y,_)=>y.index-_.index)),E=[];for(const y of x){const _=this._services.get(y.id);if(!_)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${y.id}.`);E.push(_)}const v=x.length>0?x[0].index:b.length;if(b.length!==v)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${v+1} conflicts with ${b.length} static arguments`);return new g(...b,...E)}}},7866:function(c,l,d){var f=this&&this.__decorate||function(v,y,_,S){var N,I=arguments.length,R=I<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,_,S);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(R=(I<3?N(R):I>3?N(y,_,R):N(y,_))||R);return I>3&&R&&Object.defineProperty(y,_,R),R},p=this&&this.__param||function(v,y){return function(_,S){y(_,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const h=d(844),g=d(2585),b={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let x,E=l.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=b[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let y=0;y<v.length;y++)typeof v[y]=="function"&&(v[y]=v[y]())}_log(v,y,_){this._evalLazyOptionalParams(_),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,..._)}trace(v,...y){var _;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.trace.bind(this._optionsService.options.logger))??console.log,v,y)}debug(v,...y){var _;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.debug.bind(this._optionsService.options.logger))??console.log,v,y)}info(v,...y){var _;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.info.bind(this._optionsService.options.logger))??console.info,v,y)}warn(v,...y){var _;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.warn.bind(this._optionsService.options.logger))??console.warn,v,y)}error(v,...y){var _;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.error.bind(this._optionsService.options.logger))??console.error,v,y)}};l.LogService=E=f([p(0,g.IOptionsService)],E),l.setTraceLogger=function(v){x=v},l.traceCall=function(v,y,_){if(typeof _.value!="function")throw new Error("not supported");const S=_.value;_.value=function(...N){if(x.logLevel!==g.LogLevelEnum.TRACE)return S.apply(this,N);x.trace(`GlyphRenderer#${S.name}(${N.map((R=>JSON.stringify(R))).join(", ")})`);const I=S.apply(this,N);return x.trace(`GlyphRenderer#${S.name} return`,I),I}}},7302:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=d(8460),p=d(844),h=d(6114);l.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 g=["normal","bold","100","200","300","400","500","600","700","800","900"];class b extends p.Disposable{constructor(E){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...l.DEFAULT_OPTIONS};for(const y in E)if(y in v)try{const _=E[y];v[y]=this._sanitizeAndValidateOption(y,_)}catch(_){console.error(_)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(E,v){return this.onOptionChange((y=>{y===E&&v(this.rawOptions[E])}))}onMultipleOptionChange(E,v){return this.onOptionChange((y=>{E.indexOf(y)!==-1&&v()}))}_setupOptions(){const E=y=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},v=(y,_)=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);_=this._sanitizeAndValidateOption(y,_),this.rawOptions[y]!==_&&(this.rawOptions[y]=_,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const _={get:E.bind(this,y),set:v.bind(this,y)};Object.defineProperty(this.options,y,_)}}_sanitizeAndValidateOption(E,v){switch(E){case"cursorStyle":if(v||(v=l.DEFAULT_OPTIONS[E]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${E}`);break;case"wordSeparator":v||(v=l.DEFAULT_OPTIONS[E]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=g.includes(v)?v:l.DEFAULT_OPTIONS[E];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${E} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${E} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${E} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${E} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}l.OptionsService=b},2660:function(c,l,d){var f=this&&this.__decorate||function(b,x,E,v){var y,_=arguments.length,S=_<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,E):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,x,E,v);else for(var N=b.length-1;N>=0;N--)(y=b[N])&&(S=(_<3?y(S):_>3?y(x,E,S):y(x,E))||S);return _>3&&S&&Object.defineProperty(x,E,S),S},p=this&&this.__param||function(b,x){return function(E,v){x(E,v,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const h=d(2585);let g=l.OscLinkService=class{constructor(b){this._bufferService=b,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(b){const x=this._bufferService.buffer;if(b.id===void 0){const N=x.addMarker(x.ybase+x.y),I={data:b,id:this._nextId++,lines:[N]};return N.onDispose((()=>this._removeMarkerFromLink(I,N))),this._dataByLinkId.set(I.id,I),I.id}const E=b,v=this._getEntryIdKey(E),y=this._entriesWithId.get(v);if(y)return this.addLineToLink(y.id,x.ybase+x.y),y.id;const _=x.addMarker(x.ybase+x.y),S={id:this._nextId++,key:this._getEntryIdKey(E),data:E,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(S,_))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(b,x){const E=this._dataByLinkId.get(b);if(E&&E.lines.every((v=>v.line!==x))){const v=this._bufferService.buffer.addMarker(x);E.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(E,v)))}}getLinkData(b){var x;return(x=this._dataByLinkId.get(b))==null?void 0:x.data}_getEntryIdKey(b){return`${b.id};;${b.uri}`}_removeMarkerFromLink(b,x){const E=b.lines.indexOf(x);E!==-1&&(b.lines.splice(E,1),b.lines.length===0&&(b.data.id!==void 0&&this._entriesWithId.delete(b.key),this._dataByLinkId.delete(b.id)))}};l.OscLinkService=g=f([p(0,h.IBufferService)],g)},8343:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[f]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const h=function(g,b,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,v,y){v[d]===v?v[f].push({id:E,index:y}):(v[f]=[{id:E,index:y}],v[d]=v)})(h,g,x)};return h.toString=()=>p,l.serviceRegistry.set(p,h),h}},2585:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=d(8343);var p;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.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"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=d(8460),p=d(225);class h{static extractShouldJoin(b){return(1&b)!=0}static extractWidth(b){return b>>1&3}static extractCharKind(b){return b>>3}static createPropertyValue(b,x,E=!1){return(16777215&b)<<3|(3&x)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const b=new p.UnicodeV6;this.register(b),this._active=b.version,this._activeProvider=b}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(b){if(!this._providers[b])throw new Error(`unknown Unicode version "${b}"`);this._active=b,this._activeProvider=this._providers[b],this._onChange.fire(b)}register(b){this._providers[b.version]=b}wcwidth(b){return this._activeProvider.wcwidth(b)}getStringCellWidth(b){let x=0,E=0;const v=b.length;for(let y=0;y<v;++y){let _=b.charCodeAt(y);if(55296<=_&&_<=56319){if(++y>=v)return x+this.wcwidth(_);const I=b.charCodeAt(y);56320<=I&&I<=57343?_=1024*(_-55296)+I-56320+65536:x+=this.wcwidth(I)}const S=this.charProperties(_,E);let N=h.extractWidth(S);h.extractShouldJoin(S)&&(N-=h.extractWidth(E)),x+=N,E=S}return x}charProperties(b,x){return this._activeProvider.charProperties(b,x)}}l.UnicodeService=h}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const l=o(9042),d=o(3236),f=o(844),p=o(5741),h=o(8285),g=o(7975),b=o(7090),x=["cols","rows"];class E extends f.Disposable{constructor(y){super(),this._core=this.register(new d.Terminal(y)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const _=N=>this._core.options[N],S=(N,I)=>{this._checkReadonlyOptions(N),this._core.options[N]=I};for(const N in this._core.options){const I={get:_.bind(this,N),set:S.bind(this,N)};Object.defineProperty(this._publicOptions,N,I)}}_checkReadonlyOptions(y){if(x.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new b.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 y=this._core.coreService.decPrivateModes;let _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const _ in y)this._publicOptions[_]=y[_]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,_=!0){this._core.input(y,_)}resize(y,_){this._verifyIntegers(y,_),this._core.resize(y,_)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,_,S){this._verifyIntegers(y,_,S),this._core.select(y,_,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,_){this._verifyIntegers(y,_),this._core.selectLines(y,_)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,_){this._core.write(y,_)}writeln(y,_){this._core.write(y),this._core.write(`\r
161
- `,_)}paste(y){this._core.paste(y)}refresh(y,_){this._verifyIntegers(y,_),this._core.refresh(y,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return l}_verifyIntegers(...y){for(const _ of y)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const _ of y)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}c.Terminal=E})(),a})()))})(r5)),r5.exports}var HH=zH(),q0={exports:{}},WH=q0.exports,o5;function GH(){return o5||(o5=1,(function(e,t){(function(n,r){e.exports=r()})(WH,(()=>(()=>{var n={930:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=d(485);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,h,g){this._css.set(p,h,g)}getCss(p,h){return this._css.get(p,h)}setColor(p,h,g){this._color.set(p,h,g)}getColor(p,h){return this._color.get(p,h)}clear(){this._color.clear(),this._css.clear()}}},997:function(c,l,d){var f=this&&this.__decorate||function(B,k,L,z){var G,K=arguments.length,Z=K<3?k:z===null?z=Object.getOwnPropertyDescriptor(k,L):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(B,k,L,z);else for(var te=B.length-1;te>=0;te--)(G=B[te])&&(Z=(K<3?G(Z):K>3?G(k,L,Z):G(k,L))||Z);return K>3&&Z&&Object.defineProperty(k,L,Z),Z},p=this&&this.__param||function(B,k){return function(L,z){k(L,z,B)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const h=d(930),g=d(160),b=d(345),x=d(859),E=d(97),v=g.css.toColor("#ffffff"),y=g.css.toColor("#000000"),_=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),N={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const B=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const z=k[L/36%6|0],G=k[L/6%6|0],K=k[L%6];B.push({css:g.channels.toCss(z,G,K),rgba:g.channels.toRgba(z,G,K)})}for(let L=0;L<24;L++){const z=8+10*L;B.push({css:g.channels.toCss(z,z,z),rgba:g.channels.toRgba(z,z,z)})}return B})());let I=l.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(B){super(),this._optionsService=B,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new b.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:y,cursor:_,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:N,selectionBackgroundOpaque:g.color.blend(y,N),selectionInactiveBackgroundTransparent:N,selectionInactiveBackgroundOpaque:g.color.blend(y,N),ansi:l.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(B={}){const k=this._colors;if(k.foreground=R(B.foreground,v),k.background=R(B.background,y),k.cursor=R(B.cursor,_),k.cursorAccent=R(B.cursorAccent,S),k.selectionBackgroundTransparent=R(B.selectionBackground,N),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=R(B.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=B.selectionForeground?R(B.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=l.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=R(B.black,l.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=R(B.red,l.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=R(B.green,l.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=R(B.yellow,l.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=R(B.blue,l.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=R(B.magenta,l.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=R(B.cyan,l.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=R(B.white,l.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=R(B.brightBlack,l.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=R(B.brightRed,l.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=R(B.brightGreen,l.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=R(B.brightYellow,l.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=R(B.brightBlue,l.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=R(B.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=R(B.brightCyan,l.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=R(B.brightWhite,l.DEFAULT_ANSI_COLORS[15]),B.extendedAnsi){const L=Math.min(k.ansi.length-16,B.extendedAnsi.length);for(let z=0;z<L;z++)k.ansi[z+16]=R(B.extendedAnsi[z],l.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(B){this._restoreColor(B),this._onChangeColors.fire(this.colors)}_restoreColor(B){if(B!==void 0)switch(B){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[B]=this._restoreColors.ansi[B]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(B){B(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 R(B,k){if(B!==void 0)try{return g.css.toColor(B)}catch{}return k}l.ThemeService=I=f([p(0,E.IOptionsService)],I)},160:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,f=0,p=0,h=0;var g,b,x,E,v;function y(S){const N=S.toString(16);return N.length<2?"0"+N:N}function _(S,N){return S<N?(N+.05)/(S+.05):(S+.05)/(N+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(N,I,R,B){return B!==void 0?`#${y(N)}${y(I)}${y(R)}${y(B)}`:`#${y(N)}${y(I)}${y(R)}`},S.toRgba=function(N,I,R,B=255){return(N<<24|I<<16|R<<8|B)>>>0},S.toColor=function(N,I,R,B){return{css:S.toCss(N,I,R,B),rgba:S.toRgba(N,I,R,B)}}})(g||(l.channels=g={})),(function(S){function N(I,R){return h=Math.round(255*R),[d,f,p]=v.toChannels(I.rgba),{css:g.toCss(d,f,p,h),rgba:g.toRgba(d,f,p,h)}}S.blend=function(I,R){if(h=(255&R.rgba)/255,h===1)return{css:R.css,rgba:R.rgba};const B=R.rgba>>24&255,k=R.rgba>>16&255,L=R.rgba>>8&255,z=I.rgba>>24&255,G=I.rgba>>16&255,K=I.rgba>>8&255;return d=z+Math.round((B-z)*h),f=G+Math.round((k-G)*h),p=K+Math.round((L-K)*h),{css:g.toCss(d,f,p),rgba:g.toRgba(d,f,p)}},S.isOpaque=function(I){return(255&I.rgba)==255},S.ensureContrastRatio=function(I,R,B){const k=v.ensureContrastRatio(I.rgba,R.rgba,B);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},S.opaque=function(I){const R=(255|I.rgba)>>>0;return[d,f,p]=v.toChannels(R),{css:g.toCss(d,f,p),rgba:R}},S.opacity=N,S.multiplyOpacity=function(I,R){return h=255&I.rgba,N(I,h*R/255)},S.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(b||(l.color=b={})),(function(S){let N,I;try{const R=document.createElement("canvas");R.width=1,R.height=1;const B=R.getContext("2d",{willReadFrequently:!0});B&&(N=B,N.globalCompositeOperation="copy",I=N.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),g.toColor(d,f,p);case 5:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),h=parseInt(R.slice(4,5).repeat(2),16),g.toColor(d,f,p,h);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const B=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(B)return d=parseInt(B[1]),f=parseInt(B[2]),p=parseInt(B[3]),h=Math.round(255*(B[5]===void 0?1:parseFloat(B[5]))),g.toColor(d,f,p,h);if(!N||!I)throw new Error("css.toColor: Unsupported css format");if(N.fillStyle=I,N.fillStyle=R,typeof N.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(N.fillRect(0,0,1,1),[d,f,p,h]=N.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(d,f,p,h),css:R}}})(x||(l.css=x={})),(function(S){function N(I,R,B){const k=I/255,L=R/255,z=B/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(I){return N(I>>16&255,I>>8&255,255&I)},S.relativeLuminance2=N})(E||(l.rgb=E={})),(function(S){function N(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K>0||Z>0||te>0);)K-=Math.max(0,Math.ceil(.1*K)),Z-=Math.max(0,Math.ceil(.1*Z)),te-=Math.max(0,Math.ceil(.1*te)),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}function I(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K<255||Z<255||te<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),Z=Math.min(255,Z+Math.ceil(.1*(255-Z))),te=Math.min(255,te+Math.ceil(.1*(255-te))),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}S.blend=function(R,B){if(h=(255&B)/255,h===1)return B;const k=B>>24&255,L=B>>16&255,z=B>>8&255,G=R>>24&255,K=R>>16&255,Z=R>>8&255;return d=G+Math.round((k-G)*h),f=K+Math.round((L-K)*h),p=Z+Math.round((z-Z)*h),g.toRgba(d,f,p)},S.ensureContrastRatio=function(R,B,k){const L=E.relativeLuminance(R>>8),z=E.relativeLuminance(B>>8);if(_(L,z)<k){if(z<L){const Z=N(R,B,k),te=_(L,E.relativeLuminance(Z>>8));if(te<k){const re=I(R,B,k);return te>_(L,E.relativeLuminance(re>>8))?Z:re}return Z}const G=I(R,B,k),K=_(L,E.relativeLuminance(G>>8));if(K<k){const Z=N(R,B,k);return K>_(L,E.relativeLuminance(Z>>8))?G:Z}return G}},S.reduceLuminance=N,S.increaseLuminance=I,S.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(v||(l.rgba=v={})),l.toPaddedHex=y,l.contrastRatio=_},345:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let h=0;h<this._listeners.length;h++)p.push(this._listeners[h]);for(let h=0;h<p.length;h++)p[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((p=>f.fire(p)))},l.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},859:(c,l)=>{function d(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=d,l.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},485:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(p,h,g){this._data[p]||(this._data[p]={}),this._data[p][h]=g}get(p,h){return this._data[p]?this._data[p][h]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(f,p,h,g,b){this._data.get(f,p)||this._data.set(f,p,new d),this._data.get(f,p).set(h,g,b)}get(f,p,h,g){var b;return(b=this._data.get(f,p))==null?void 0:b.get(h,g)}clear(){this._data.clear()}}},726:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[f]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const h=function(g,b,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,v,y){v[d]===v?v[f].push({id:E,index:y}):(v[f]=[{id:E,index:y}],v[d]=v)})(h,g,x)};return h.toString=()=>p,l.serviceRegistry.set(p,h),h}},97:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=d(726);var p;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.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"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.HTMLSerializeHandler=c.SerializeAddon=void 0;const l=o(997);function d(E,v,y){return Math.max(v,Math.min(E,y))}class f{constructor(v){this._buffer=v}serialize(v,y){const _=this._buffer.getNullCell(),S=this._buffer.getNullCell();let N=_;const I=v.start.y,R=v.end.y,B=v.start.x,k=v.end.x;this._beforeSerialize(R-I,I,R);for(let L=I;L<=R;L++){const z=this._buffer.getLine(L);if(z){const G=L===v.start.y?B:0,K=L===v.end.y?k:z.length;for(let Z=G;Z<K;Z++){const te=z.getCell(Z,N===_?S:_);te?(this._nextCell(te,N,L,Z),N=te):console.warn(`Can't get cell at row=${L}, col=${Z}`)}}this._rowEnd(L,L===R)}return this._afterSerialize(),this._serializeString(y)}_nextCell(v,y,_,S){}_rowEnd(v,y){}_beforeSerialize(v,y,_){}_afterSerialize(){}_serializeString(v){return""}}function p(E,v){return E.getFgColorMode()===v.getFgColorMode()&&E.getFgColor()===v.getFgColor()}function h(E,v){return E.getBgColorMode()===v.getBgColorMode()&&E.getBgColor()===v.getBgColor()}function g(E,v){return E.isInverse()===v.isInverse()&&E.isBold()===v.isBold()&&E.isUnderline()===v.isUnderline()&&E.isOverline()===v.isOverline()&&E.isBlink()===v.isBlink()&&E.isInvisible()===v.isInvisible()&&E.isItalic()===v.isItalic()&&E.isDim()===v.isDim()&&E.isStrikethrough()===v.isStrikethrough()}class b extends f{constructor(v,y){super(v),this._terminal=y,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(v,y,_){this._allRows=new Array(v),this._lastContentCursorRow=y,this._lastCursorRow=y,this._firstRow=y}_rowEnd(v,y){var _;this._nullCellCount>0&&!h(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let S="";if(!y){v-this._firstRow>=this._terminal.rows&&((_=this._buffer.getLine(this._cursorStyleRow))==null||_.getCell(this._cursorStyleCol,this._backgroundCell));const N=this._buffer.getLine(v),I=this._buffer.getLine(v+1);if(I.isWrapped){S="";const R=N.getCell(N.length-1,this._thisRowLastChar),B=N.getCell(N.length-2,this._thisRowLastSecondChar),k=I.getCell(0,this._nextRowFirstChar),L=k.getWidth()>1;let z=!1;(k.getChars()&&L?this._nullCellCount<=1:this._nullCellCount<=0)&&((R.getChars()||R.getWidth()===0)&&h(R,k)&&(z=!0),L&&(B.getChars()||B.getWidth()===0)&&h(R,k)&&h(B,k)&&(z=!0)),z||(S="-".repeat(this._nullCellCount+1),S+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(S+="\x1B[A",S+=`\x1B[${N.length-this._nullCellCount}C`,S+=`\x1B[${this._nullCellCount}X`,S+=`\x1B[${N.length-this._nullCellCount}D`,S+="\x1B[B"),this._lastContentCursorRow=v+1,this._lastContentCursorCol=0,this._lastCursorRow=v+1,this._lastCursorCol=0)}else S=`\r
162
- `,this._lastCursorRow=v+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=S,this._currentRow="",this._nullCellCount=0}_diffStyle(v,y){const _=[],S=!p(v,y),N=!h(v,y),I=!g(v,y);if(S||N||I)if(v.isAttributeDefault())y.isAttributeDefault()||_.push(0);else{if(S){const R=v.getFgColor();v.isFgRGB()?_.push(38,2,R>>>16&255,R>>>8&255,255&R):v.isFgPalette()?R>=16?_.push(38,5,R):_.push(8&R?90+(7&R):30+(7&R)):_.push(39)}if(N){const R=v.getBgColor();v.isBgRGB()?_.push(48,2,R>>>16&255,R>>>8&255,255&R):v.isBgPalette()?R>=16?_.push(48,5,R):_.push(8&R?100+(7&R):40+(7&R)):_.push(49)}I&&(v.isInverse()!==y.isInverse()&&_.push(v.isInverse()?7:27),v.isBold()!==y.isBold()&&_.push(v.isBold()?1:22),v.isUnderline()!==y.isUnderline()&&_.push(v.isUnderline()?4:24),v.isOverline()!==y.isOverline()&&_.push(v.isOverline()?53:55),v.isBlink()!==y.isBlink()&&_.push(v.isBlink()?5:25),v.isInvisible()!==y.isInvisible()&&_.push(v.isInvisible()?8:28),v.isItalic()!==y.isItalic()&&_.push(v.isItalic()?3:23),v.isDim()!==y.isDim()&&_.push(v.isDim()?2:22),v.isStrikethrough()!==y.isStrikethrough()&&_.push(v.isStrikethrough()?9:29))}return _}_nextCell(v,y,_,S){if(v.getWidth()===0)return;const N=v.getChars()==="",I=this._diffStyle(v,this._cursorStyle);if(N?!h(this._cursorStyle,v):I.length>0){this._nullCellCount>0&&(h(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=_,this._lastContentCursorCol=this._lastCursorCol=S,this._currentRow+=`\x1B[${I.join(";")}m`;const R=this._buffer.getLine(_);R!==void 0&&(R.getCell(S,this._cursorStyle),this._cursorStyleRow=_,this._cursorStyleCol=S)}N?this._nullCellCount+=v.getWidth():(this._nullCellCount>0&&(h(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=v.getChars(),this._lastContentCursorRow=this._lastCursorRow=_,this._lastContentCursorCol=this._lastCursorCol=S+v.getWidth())}_serializeString(v){let y=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(y=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let _="";for(let R=0;R<y;R++)_+=this._allRows[R],R+1<y&&(_+=this._allRowSeparators[R]);if(!v){const R=this._buffer.baseY+this._buffer.cursorY,B=this._buffer.cursorX,k=L=>{L>0?_+=`\x1B[${L}C`:L<0&&(_+=`\x1B[${-L}D`)};(R!==this._lastCursorRow||B!==this._lastCursorCol)&&((S=R-this._lastCursorRow)>0?_+=`\x1B[${S}B`:S<0&&(_+=`\x1B[${-S}A`),k(B-this._lastCursorCol))}var S;const N=this._terminal._core._inputHandler._curAttrData,I=this._diffStyle(N,this._cursorStyle);return I.length>0&&(_+=`\x1B[${I.join(";")}m`),_}}c.SerializeAddon=class{activate(E){this._terminal=E}_serializeBufferByScrollback(E,v,y){const _=v.length,S=y===void 0?_:d(y+E.rows,0,_);return this._serializeBufferByRange(E,v,{start:_-S,end:_-1},!1)}_serializeBufferByRange(E,v,y,_){return new b(v,E).serialize({start:{x:0,y:typeof y.start=="number"?y.start:y.start.line},end:{x:E.cols,y:typeof y.end=="number"?y.end:y.end.line}},_)}_serializeBufferAsHTML(E,v){var y;const _=E.buffer.active,S=new x(_,E,v);if(!v.onlySelection){const I=_.length,R=v.scrollback,B=R===void 0?I:d(R+E.rows,0,I);return S.serialize({start:{x:0,y:I-B},end:{x:E.cols,y:I-1}})}const N=(y=this._terminal)==null?void 0:y.getSelectionPosition();return N!==void 0?S.serialize({start:{x:N.start.x,y:N.start.y},end:{x:N.end.x,y:N.end.y}}):""}_serializeModes(E){let v="";const y=E.modes;if(y.applicationCursorKeysMode&&(v+="\x1B[?1h"),y.applicationKeypadMode&&(v+="\x1B[?66h"),y.bracketedPasteMode&&(v+="\x1B[?2004h"),y.insertMode&&(v+="\x1B[4h"),y.originMode&&(v+="\x1B[?6h"),y.reverseWraparoundMode&&(v+="\x1B[?45h"),y.sendFocusMode&&(v+="\x1B[?1004h"),y.wraparoundMode===!1&&(v+="\x1B[?7l"),y.mouseTrackingMode!=="none")switch(y.mouseTrackingMode){case"x10":v+="\x1B[?9h";break;case"vt200":v+="\x1B[?1000h";break;case"drag":v+="\x1B[?1002h";break;case"any":v+="\x1B[?1003h"}return v}serialize(E){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let v=E!=null&&E.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,E.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,E==null?void 0:E.scrollback);return E!=null&&E.excludeAltBuffer||this._terminal.buffer.active.type!=="alternate"||(v+=`\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0)}`),E!=null&&E.excludeModes||(v+=this._serializeModes(this._terminal)),v}serializeAsHTML(E){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,E||{})}dispose(){}};class x extends f{constructor(v,y,_){super(v),this._terminal=y,this._options=_,this._currentRow="",this._htmlContent="",y._core._themeService?this._ansiColors=y._core._themeService.colors.ansi:this._ansiColors=l.DEFAULT_ANSI_COLORS}_padStart(v,y,_){return y>>=0,_=_??" ",v.length>y?v:((y-=v.length)>_.length&&(_+=_.repeat(y/_.length)),_.slice(0,y)+v)}_beforeSerialize(v,y,_){var S,N;this._htmlContent+="<html><body><!--StartFragment--><pre>";let I="#000000",R="#ffffff";this._options.includeGlobalBackground&&(I=((S=this._terminal.options.theme)==null?void 0:S.foreground)??"#ffffff",R=((N=this._terminal.options.theme)==null?void 0:N.background)??"#000000");const B=[];B.push("color: "+I+";"),B.push("background-color: "+R+";"),B.push("font-family: "+this._terminal.options.fontFamily+";"),B.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+B.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(v,y){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(v,y){const _=y?v.getFgColor():v.getBgColor();return(y?v.isFgRGB():v.isBgRGB())?"#"+[_>>16&255,_>>8&255,255&_].map((S=>this._padStart(S.toString(16),2,"0"))).join(""):(y?v.isFgPalette():v.isBgPalette())?this._ansiColors[_].css:void 0}_diffStyle(v,y){const _=[],S=!p(v,y),N=!h(v,y),I=!g(v,y);if(S||N||I){const R=this._getHexColor(v,!0);R&&_.push("color: "+R+";");const B=this._getHexColor(v,!1);return B&&_.push("background-color: "+B+";"),v.isInverse()&&_.push("color: #000000; background-color: #BFBFBF;"),v.isBold()&&_.push("font-weight: bold;"),v.isUnderline()&&v.isOverline()?_.push("text-decoration: overline underline;"):v.isUnderline()?_.push("text-decoration: underline;"):v.isOverline()&&_.push("text-decoration: overline;"),v.isBlink()&&_.push("text-decoration: blink;"),v.isInvisible()&&_.push("visibility: hidden;"),v.isItalic()&&_.push("font-style: italic;"),v.isDim()&&_.push("opacity: 0.5;"),v.isStrikethrough()&&_.push("text-decoration: line-through;"),_}}_nextCell(v,y,_,S){if(v.getWidth()===0)return;const N=v.getChars()==="",I=this._diffStyle(v,y);I&&(this._currentRow+=I.length===0?"</span><span>":"</span><span style='"+I.join(" ")+"'>"),this._currentRow+=N?" ":v.getChars()}_serializeString(){return this._htmlContent}}c.HTMLSerializeHandler=x})(),a})()))})(q0)),q0.exports}var ZH=GH(),Q0={exports:{}},YH=Q0.exports,s5;function $H(){return s5||(s5=1,(function(e,t){(function(n,r){e.exports=r()})(YH,(()=>(()=>{var n={433:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV11=void 0;const f=d(938),p=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],h=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],g=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],b=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let x;function E(v,y){let _,S=0,N=y.length-1;if(v<y[0][0]||v>y[N][1])return!1;for(;N>=S;)if(_=S+N>>1,v>y[_][1])S=_+1;else{if(!(v<y[_][0]))return!0;N=_-1}return!1}l.UnicodeV11=class{constructor(){if(this.version="11",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160);for(let v=0;v<p.length;++v)x.fill(0,p[v][0],p[v][1]+1);for(let v=0;v<g.length;++v)x.fill(2,g[v][0],g[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?x[v]:E(v,h)?0:E(v,b)?2:1}charProperties(v,y){let _=this.wcwidth(v),S=_===0&&y!==0;if(S){const N=f.UnicodeService.extractWidth(y);N===0?S=!1:N>_&&(_=N)}return f.UnicodeService.createPropertyValue(0,_,S)}}},345:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let h=0;h<this._listeners.length;h++)p.push(this._listeners[h]);for(let h=0;h<p.length;h++)p[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((p=>f.fire(p)))},l.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},490:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=d(938),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],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 g;l.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let b=0;b<p.length;++b)g.fill(0,p[b][0],p[b][1]+1)}}wcwidth(b){return b<32?0:b<127?1:b<65536?g[b]:(function(x,E){let v,y=0,_=E.length-1;if(x<E[0][0]||x>E[_][1])return!1;for(;_>=y;)if(v=y+_>>1,x>E[v][1])y=v+1;else{if(!(x<E[v][0]))return!0;_=v-1}return!1})(b,h)?0:b>=131072&&b<=196605||b>=196608&&b<=262141?2:1}charProperties(b,x){let E=this.wcwidth(b),v=E===0&&x!==0;if(v){const y=f.UnicodeService.extractWidth(x);y===0?v=!1:y>E&&(E=y)}return f.UnicodeService.createPropertyValue(0,E,v)}}},938:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=d(345),p=d(490);class h{static extractShouldJoin(b){return(1&b)!=0}static extractWidth(b){return b>>1&3}static extractCharKind(b){return b>>3}static createPropertyValue(b,x,E=!1){return(16777215&b)<<3|(3&x)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const b=new p.UnicodeV6;this.register(b),this._active=b.version,this._activeProvider=b}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(b){if(!this._providers[b])throw new Error(`unknown Unicode version "${b}"`);this._active=b,this._activeProvider=this._providers[b],this._onChange.fire(b)}register(b){this._providers[b.version]=b}wcwidth(b){return this._activeProvider.wcwidth(b)}getStringCellWidth(b){let x=0,E=0;const v=b.length;for(let y=0;y<v;++y){let _=b.charCodeAt(y);if(55296<=_&&_<=56319){if(++y>=v)return x+this.wcwidth(_);const I=b.charCodeAt(y);56320<=I&&I<=57343?_=1024*(_-55296)+I-56320+65536:x+=this.wcwidth(I)}const S=this.charProperties(_,E);let N=h.extractWidth(S);h.extractShouldJoin(S)&&(N-=h.extractWidth(E)),x+=N,E=S}return x}charProperties(b,x){return this._activeProvider.charProperties(b,x)}}l.UnicodeService=h}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c](d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Unicode11Addon=void 0;const l=o(433);c.Unicode11Addon=class{activate(d){d.unicode.register(new l.UnicodeV11)}dispose(){}}})(),a})()))})(Q0)),Q0.exports}var XH=$H(),a5={exports:{}},l5;function KH(){return l5||(l5=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(c,l)=>{function d(p){try{const h=new URL(p),g=h.password&&h.username?`${h.protocol}//${h.username}:${h.password}@${h.host}`:h.username?`${h.protocol}//${h.username}@${h.host}`:`${h.protocol}//${h.host}`;return p.toLocaleLowerCase().startsWith(g.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(p,h,g,b={}){this._terminal=p,this._regex=h,this._handler=g,this._options=b}provideLinks(p,h){const g=f.computeLink(p,this._regex,this._terminal,this._handler);h(this._addCallbacks(g))}_addCallbacks(p){return p.map((h=>(h.leave=this._options.leave,h.hover=(g,b)=>{if(this._options.hover){const{range:x}=h;this._options.hover(g,b,x)}},h)))}};class f{static computeLink(h,g,b,x){const E=new RegExp(g.source,(g.flags||"")+"g"),[v,y]=f._getWindowedLineStrings(h-1,b),_=v.join("");let S;const N=[];for(;S=E.exec(_);){const I=S[0];if(!d(I))continue;const[R,B]=f._mapStrIdx(b,y,0,S.index),[k,L]=f._mapStrIdx(b,R,B,I.length);if(R===-1||B===-1||k===-1||L===-1)continue;const z={start:{x:B+1,y:R+1},end:{x:L,y:k+1}};N.push({range:z,text:I,activate:x})}return N}static _getWindowedLineStrings(h,g){let b,x=h,E=h,v=0,y="";const _=[];if(b=g.buffer.active.getLine(h)){const S=b.translateToString(!0);if(b.isWrapped&&S[0]!==" "){for(v=0;(b=g.buffer.active.getLine(--x))&&v<2048&&(y=b.translateToString(!0),v+=y.length,_.push(y),b.isWrapped&&y.indexOf(" ")===-1););_.reverse()}for(_.push(S),v=0;(b=g.buffer.active.getLine(++E))&&b.isWrapped&&v<2048&&(y=b.translateToString(!0),v+=y.length,_.push(y),y.indexOf(" ")===-1););}return[_,x]}static _mapStrIdx(h,g,b,x){const E=h.buffer.active,v=E.getNullCell();let y=b;for(;x;){const _=E.getLine(g);if(!_)return[-1,-1];for(let S=y;S<_.length;++S){_.getCell(S,v);const N=v.getChars();if(v.getWidth()&&(x-=N.length||1,S===_.length-1&&N==="")){const I=E.getLine(g+1);I&&I.isWrapped&&(I.getCell(0,v),v.getWidth()===2&&(x+=1))}if(x<0)return[g,S]}g++,y=0}return[g,y]}}l.LinkComputer=f}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c](d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.WebLinksAddon=void 0;const l=o(6),d=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(p,h){const g=window.open();if(g){try{g.opener=null}catch{}g.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}c.WebLinksAddon=class{constructor(p=f,h={}){this._handler=p,this._options=h}activate(p){this._terminal=p;const h=this._options,g=h.urlRegex||d;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,g,this._handler,h))}dispose(){var p;(p=this._linkProvider)==null||p.dispose()}}})(),a})()))})(a5)),a5.exports}var JH=KH();function br(e){return typeof e=="function"}function tk(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Zb=tk(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
163
- `+t.map(function(n,r){return r+1+") "+n.toString()}).join(`
164
- `):"",this.name="UnsubscriptionError",this.errors=t}});function dm(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var kf=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,a;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Lc(c),d=l.next();!d.done;d=l.next()){var f=d.value;f.remove(this)}}catch(E){t={error:E}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else c.remove(this);var p=this.initialTeardown;if(br(p))try{p()}catch(E){a=E instanceof Zb?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var g=Lc(h),b=g.next();!b.done;b=g.next()){var x=b.value;try{c5(x)}catch(E){a=a??[],E instanceof Zb?a=qd(qd([],Jd(a)),Jd(E.errors)):a.push(E)}}}catch(E){r={error:E}}finally{try{b&&!b.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}}if(a)throw new Zb(a)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)c5(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&dm(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&dm(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),nk=kf.EMPTY;function rk(e){return e instanceof kf||e&&"closed"in e&&br(e.remove)&&br(e.add)&&br(e.unsubscribe)}function c5(e){br(e)?e():e.unsubscribe()}var qH={Promise:void 0},QH={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,qd([e,t],Jd(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function ik(e){QH.setTimeout(function(){throw e})}function u5(){}function Ip(e){e()}var a_=(function(e){ca(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,rk(n)&&n.add(r)):r.destination=nW,r}return t.create=function(n,r,o){return new rf(n,r,o)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(kf),eW=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){ap(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){ap(r)}else ap(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){ap(n)}},e})(),rf=(function(e){ca(t,e);function t(n,r,o){var a=e.call(this)||this,c;return br(n)||!n?c={next:n??void 0,error:r??void 0,complete:o??void 0}:c=n,a.destination=new eW(c),a}return t})(a_);function ap(e){ik(e)}function tW(e){throw e}var nW={closed:!0,next:u5,error:tW,complete:u5},l_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ok(e){return e}function rW(e){return e.length===0?ok:e.length===1?e[0]:function(t){return e.reduce(function(n,r){return r(n)},t)}}var os=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,a=oW(t)?t:new rf(t,n,r);return Ip(function(){var c=o,l=c.operator,d=c.source;a.add(l?l.call(a,d):d?o._subscribe(a):o._trySubscribe(a))}),a},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=d5(n),new n(function(o,a){var c=new rf({next:function(l){try{t(l)}catch(d){a(d),c.unsubscribe()}},error:a,complete:o});r.subscribe(c)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[l_]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return rW(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=d5(t),new t(function(r,o){var a;n.subscribe(function(c){return a=c},function(c){return o(c)},function(){return r(a)})})},e.create=function(t){return new e(t)},e})();function d5(e){var t;return(t=e??qH.Promise)!==null&&t!==void 0?t:Promise}function iW(e){return e&&br(e.next)&&br(e.error)&&br(e.complete)}function oW(e){return e&&e instanceof a_||iW(e)&&rk(e)}function sW(e){return br(e==null?void 0:e.lift)}function If(e){return function(t){if(sW(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function rg(e,t,n,r,o){return new aW(e,t,n,r,o)}var aW=(function(e){ca(t,e);function t(n,r,o,a,c,l){var d=e.call(this,n)||this;return d.onFinalize=c,d.shouldUnsubscribe=l,d._next=r?function(f){try{r(f)}catch(p){n.error(p)}}:e.prototype._next,d._error=a?function(f){try{a(f)}catch(p){n.error(p)}finally{this.unsubscribe()}}:e.prototype._error,d._complete=o?function(){try{o()}catch(f){n.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,d}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t})(a_),lW=tk(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),sk=(function(e){ca(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new f5(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new lW},t.prototype.next=function(n){var r=this;Ip(function(){var o,a;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var c=Lc(r.currentObservers),l=c.next();!l.done;l=c.next()){var d=l.value;d.next(n)}}catch(f){o={error:f}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;Ip(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;Ip(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,a=o.hasError,c=o.isStopped,l=o.observers;return a||c?nk:(this.currentObservers=null,l.push(n),new kf(function(){r.currentObservers=null,dm(l,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,a=r.thrownError,c=r.isStopped;o?n.error(a):c&&n.complete()},t.prototype.asObservable=function(){var n=new os;return n.source=this,n},t.create=function(n,r){return new f5(n,r)},t})(os),f5=(function(e){ca(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:nk},t})(sk),cW={now:function(){return Date.now()}},uW=(function(e){ca(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t})(kf),h5={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,qd([e,t],Jd(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},dW=(function(e){ca(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var a=this.id,c=this.scheduler;return a!=null&&(this.id=this.recycleAsyncId(c,a,r)),this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){return o===void 0&&(o=0),h5.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return r;r!=null&&h5.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var o=!1,a;try{this.work(n)}catch(c){o=!0,a=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),a},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,o=n.scheduler,a=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,dm(a,this),r!=null&&(this.id=this.recycleAsyncId(o,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(uW),p5=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=cW.now,e})(),fW=(function(e){ca(t,e);function t(n,r){r===void 0&&(r=p5.now);var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){for(;n=r.shift();)n.unsubscribe();throw o}},t})(p5),hW=new fW(dW),pW=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function mW(e){return br(e==null?void 0:e.then)}function gW(e){return br(e[l_])}function vW(e){return Symbol.asyncIterator&&br(e==null?void 0:e[Symbol.asyncIterator])}function bW(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function yW(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var _W=yW();function SW(e){return br(e==null?void 0:e[_W])}function EW(e){return yH(this,arguments,function(){var t,n,r,o;return $4(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,bc(t.read())];case 3:return n=a.sent(),r=n.value,o=n.done,o?[4,bc(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,bc(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function wW(e){return br(e==null?void 0:e.getReader)}function ak(e){if(e instanceof os)return e;if(e!=null){if(gW(e))return CW(e);if(pW(e))return xW(e);if(mW(e))return AW(e);if(vW(e))return lk(e);if(SW(e))return TW(e);if(wW(e))return NW(e)}throw bW(e)}function CW(e){return new os(function(t){var n=e[l_]();if(br(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function xW(e){return new os(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function AW(e){return new os(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,ik)})}function TW(e){return new os(function(t){var n,r;try{for(var o=Lc(e),a=o.next();!a.done;a=o.next()){var c=a.value;if(t.next(c),t.closed)return}}catch(l){n={error:l}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function lk(e){return new os(function(t){RW(e,t).catch(function(n){return t.error(n)})})}function NW(e){return lk(EW(e))}function RW(e,t){var n,r,o,a;return bH(this,void 0,void 0,function(){var c,l;return $4(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),n=_H(e),d.label=1;case 1:return[4,n.next()];case 2:if(r=d.sent(),!!r.done)return[3,4];if(c=r.value,t.next(c),t.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=d.sent(),o={error:l},[3,11];case 6:return d.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function kW(e,t){return If(function(n,r){var o=0;n.subscribe(rg(r,function(a){r.next(e.call(t,a,o++))}))})}function ck(e,t){return If(function(n,r){var o=0;n.subscribe(rg(r,function(a){return e.call(t,a,o++)&&r.next(a)}))})}function uk(e,t){return t===void 0&&(t=hW),If(function(n,r){var o=null,a=null,c=null,l=function(){if(o){o.unsubscribe(),o=null;var f=a;a=null,r.next(f)}};function d(){var f=c+e,p=t.now();if(p<f){o=this.schedule(void 0,f-p),r.add(o);return}l()}n.subscribe(rg(r,function(f){a=f,c=t.now(),o||(o=t.schedule(d,e),r.add(o))},function(){l(),r.complete()},void 0,function(){a=o=null}))})}function dk(e,t){return t===void 0&&(t=ok),e=e??IW,If(function(n,r){var o,a=!0;n.subscribe(rg(r,function(c){var l=t(c);(a||!e(o,l))&&(a=!1,o=l,r.next(c))}))})}function IW(e,t){return e===t}function OW(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new sk}:t,r=e.resetOnError,o=r===void 0?!0:r,a=e.resetOnComplete,c=a===void 0?!0:a,l=e.resetOnRefCountZero,d=l===void 0?!0:l;return function(f){var p,h,g,b=0,x=!1,E=!1,v=function(){h==null||h.unsubscribe(),h=void 0},y=function(){v(),p=g=void 0,x=E=!1},_=function(){var S=p;y(),S==null||S.unsubscribe()};return If(function(S,N){b++,!E&&!x&&v();var I=g=g??n();N.add(function(){b--,b===0&&!E&&!x&&(h=Yb(_,d))}),I.subscribe(N),!p&&b>0&&(p=new rf({next:function(R){return I.next(R)},error:function(R){E=!0,v(),h=Yb(y,o,R),I.error(R)},complete:function(){x=!0,v(),h=Yb(y,c),I.complete()}}),ak(S).subscribe(p))})(f)}}function Yb(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var o=new rf({next:function(){o.unsubscribe(),e()}});return ak(t.apply(void 0,qd([],Jd(n)))).subscribe(o)}}/**
165
- * Copyright (c) 2017 The xterm.js authors. All rights reserved.
166
- * @license MIT
167
- */const BW=2,DW=1;class LW{constructor(){}activate(t){this._terminal=t}dispose(){}fit(t){const n=this.proposeDimensions();if(t!==void 0&&n&&(n.rows=t),!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;const r=this._terminal._core;return(this._terminal.rows!==n.rows||this._terminal.cols!==n.cols)&&(r._renderService.clear(),this._terminal.resize(n.cols,n.rows)),n}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const t=this.getCore(),n=t._renderService.dimensions;if(n.css.cell.width===0||n.css.cell.height===0)return;const r=this._terminal.options.scrollback===0?0:t.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(o.getPropertyValue("height")),c=Math.max(0,parseInt(o.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),d={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},f=d.top+d.bottom,p=d.right+d.left,h=a-f,g=c-p-r,{width:b,height:x}=this.getCellSize();return{cols:Math.max(BW,Math.floor(g/b)),rows:Math.max(DW,Math.floor(h/x))}}getCellSize(){const{value:t}=this.getCore()._renderService._renderer;return{width:t._charSizeService.width+Math.round(t._optionsService.rawOptions.letterSpacing),height:Math.floor(t._charSizeService.height*t._optionsService.rawOptions.lineHeight)}}getCore(){return this._terminal._core}}function MW({}){}function UW(e){return e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}function FW(e){const t=new Date().getTime()-e.getTime(),n=Math.floor(t/1e3)*-1,r=new Intl.RelativeTimeFormat("en",{numeric:"auto"});return Math.abs(n)<60?r.format(Math.round(n),"second"):Math.abs(n)<3600?r.format(Math.round(n/60),"minute"):Math.abs(n)<86400?r.format(Math.round(n/3600),"hour"):r.format(Math.round(n/86400),"day")}var VW=(e,t,n,r)=>{for(var o=t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=c(o)||o);return o};let ey=class extends vr{onClose(e){e.defaultPrevented&&e.preventDefault();const t=new CustomEvent("closed");this.dispatchEvent(t)}render(){return et`
149
+ */function jH(e){return dt({...e,state:!0,attribute:!1})}var zH=(e,t,n,r)=>{for(var o=t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=c(o)||o);return o};let q0=class extends vr{onClose(e){e.defaultPrevented&&e.preventDefault();const t=new CustomEvent("closed");this.dispatchEvent(t)}render(){return et`
168
150
  <div class="close-button tooltip">
169
151
  <span class="tooltiptext">Close</span>
170
152
  <vscode-button
@@ -176,7 +158,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
176
158
  <span class="icon icon-close"></span>
177
159
  </vscode-button>
178
160
  </div>
179
- `}};ey.styles=Gi`
161
+ `}};q0.styles=Gi`
180
162
  :host {
181
163
  --button-icon-hover-background: var(--vscode-toolbar-hoverBackground);
182
164
  --tooltip-background: #343434;
@@ -248,7 +230,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
248
230
  .tooltip:not(:hover) .tooltiptext {
249
231
  transition-delay: 0s;
250
232
  }
251
- `;ey=VW([Ai("close-cell-button")],ey);const fk=et`
233
+ `;q0=zH([Ai("close-cell-button")],q0);const ek=et`
252
234
  <svg
253
235
  class="icon"
254
236
  width="16"
@@ -264,11 +246,11 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
264
246
  />
265
247
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3 1L2 2v10l1 1V2h6.414l-1-1H3z" />
266
248
  </svg>
267
- `;var PW=Object.defineProperty,jW=Object.getOwnPropertyDescriptor,hk=(e,t,n,r)=>{for(var o=r>1?void 0:r?jW(t,n):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=(r?c(t,n,o):c(o))||o);return r&&o&&PW(t,n,o),o};let fm=class extends vr{constructor(){super(...arguments),this.copyText="Copy"}onCopy(e){e.defaultPrevented&&e.preventDefault();const t=new CustomEvent("onCopy");this.dispatchEvent(t)}render(){return et`
249
+ `;var HH=Object.defineProperty,WH=Object.getOwnPropertyDescriptor,tk=(e,t,n,r)=>{for(var o=r>1?void 0:r?WH(t,n):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=(r?c(t,n,o):c(o))||o);return r&&o&&HH(t,n,o),o};let dm=class extends vr{constructor(){super(...arguments),this.copyText="Copy"}onCopy(e){e.defaultPrevented&&e.preventDefault();const t=new CustomEvent("onCopy");this.dispatchEvent(t)}render(){return et`
268
250
  <vscode-button appearance="secondary" @click=${this.onCopy}>
269
- ${fk} ${this.copyText}
251
+ ${ek} ${this.copyText}
270
252
  </vscode-button>
271
- `}};fm.styles=Gi`
253
+ `}};dm.styles=Gi`
272
254
  vscode-button {
273
255
  color: var(--vscode-button-foreground);
274
256
  background-color: var(--vscode-button-background);
@@ -285,7 +267,25 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
285
267
  margin: 0 5px 0 -5px;
286
268
  padding: 0;
287
269
  }
288
- `;hk([dt({type:String})],fm.prototype,"copyText",2);fm=hk([Ai("copy-button")],fm);const zW=et`<svg
270
+ `;tk([dt({type:String})],dm.prototype,"copyText",2);dm=tk([Ai("copy-button")],dm);/**
271
+ * @license
272
+ * Copyright 2021 Google LLC
273
+ * SPDX-License-Identifier: BSD-3-Clause
274
+ */function Rn(e,t,n){return e?t(e):n==null?void 0:n(e)}var r5={exports:{}},i5;function GH(){return i5||(i5=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const h=d(9042),g=d(9924),b=d(844),x=d(4725),E=d(2585),v=d(3656);let y=l.AccessibilityManager=class extends b.Disposable{constructor(_,S,N,I){super(),this._terminal=_,this._coreBrowserService=N,this._renderService=I,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
275
+ `)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,b.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(_){for(let S=0;S<_;S++)this._handleChar(" ")}_handleChar(_){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==_&&(this._charsToAnnounce+=_):this._charsToAnnounce+=_,_===`
276
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(_){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(_)||this._charsToConsume.push(_)}_refreshRows(_,S){this._liveRegionDebouncer.refresh(_,S,this._terminal.rows)}_renderRows(_,S){const N=this._terminal.buffer,I=N.lines.length.toString();for(let R=_;R<=S;R++){const B=N.lines.get(N.ydisp+R),k=[],L=(B==null?void 0:B.translateToString(!0,void 0,void 0,k))||"",z=(N.ydisp+R+1).toString(),G=this._rowElements[R];G&&(L.length===0?(G.innerText=" ",this._rowColumns.set(G,[0,1])):(G.textContent=L,this._rowColumns.set(G,k)),G.setAttribute("aria-posinset",z),G.setAttribute("aria-setsize",I))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(_,S){const N=_.target,I=this._rowElements[S===0?1:this._rowElements.length-2];if(N.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||_.relatedTarget!==I)return;let R,B;if(S===0?(R=N,B=this._rowElements.pop(),this._rowContainer.removeChild(B)):(R=this._rowElements.shift(),B=N,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),B.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),_.preventDefault(),_.stopImmediatePropagation()}_handleSelectionChange(){var _;if(this._rowElements.length===0)return;const S=document.getSelection();if(!S)return;if(S.isCollapsed)return void(this._rowContainer.contains(S.anchorNode)&&this._terminal.clearSelection());if(!S.anchorNode||!S.focusNode)return void console.error("anchorNode and/or focusNode are null");let N={node:S.anchorNode,offset:S.anchorOffset},I={node:S.focusNode,offset:S.focusOffset};if((N.node.compareDocumentPosition(I.node)&Node.DOCUMENT_POSITION_PRECEDING||N.node===I.node&&N.offset>I.offset)&&([N,I]=[I,N]),N.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(N={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(N.node))return;const R=this._rowElements.slice(-1)[0];if(I.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(I={node:R,offset:((_=R.textContent)==null?void 0:_.length)??0}),!this._rowContainer.contains(I.node))return;const B=({node:z,offset:G})=>{const K=z instanceof Text?z.parentNode:z;let Z=parseInt(K==null?void 0:K.getAttribute("aria-posinset"),10)-1;if(isNaN(Z))return console.warn("row is invalid. Race condition?"),null;const te=this._rowColumns.get(K);if(!te)return console.warn("columns is null. Race condition?"),null;let re=G<te.length?te[G]:te.slice(-1)[0]+1;return re>=this._terminal.cols&&(++Z,re=0),{row:Z,column:re}},k=B(N),L=B(I);if(k&&L){if(k.row>L.row||k.row===L.row&&k.column>=L.column)throw new Error("invalid range");this._terminal.select(k.column,k.row,(L.row-k.row)*this._terminal.cols-k.column+L.column)}}_handleResize(_){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>_;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const _=this._coreBrowserService.mainDocument.createElement("div");return _.setAttribute("role","listitem"),_.tabIndex=-1,this._refreshRowDimensions(_),_}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let _=0;_<this._terminal.rows;_++)this._refreshRowDimensions(this._rowElements[_])}}_refreshRowDimensions(_){_.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=y=f([p(1,E.IInstantiationService),p(2,x.ICoreBrowserService),p(3,x.IRenderService)],y)},3614:(c,l)=>{function d(g){return g.replace(/\r?\n/g,"\r")}function f(g,b){return b?"\x1B[200~"+g+"\x1B[201~":g}function p(g,b,x,E){g=f(g=d(g),x.decPrivateModes.bracketedPasteMode&&E.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(g,!0),b.value=""}function h(g,b,x){const E=x.getBoundingClientRect(),v=g.clientX-E.left-10,y=g.clientY-E.top-10;b.style.width="20px",b.style.height="20px",b.style.left=`${v}px`,b.style.top=`${y}px`,b.style.zIndex="1000",b.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=f,l.copyHandler=function(g,b){g.clipboardData&&g.clipboardData.setData("text/plain",b.selectionText),g.preventDefault()},l.handlePasteEvent=function(g,b,x,E){g.stopPropagation(),g.clipboardData&&p(g.clipboardData.getData("text/plain"),b,x,E)},l.paste=p,l.moveTextAreaUnderMouseCursor=h,l.rightClickHandler=function(g,b,x,E,v){h(g,b,x),v&&E.rightClickSelect(g),b.value=E.selectionText,b.select()}},7239:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=d(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,h,g){this._css.set(p,h,g)}getCss(p,h){return this._css.get(p,h)}setColor(p,h,g){this._color.set(p,h,g)}getColor(p,h){return this._color.get(p,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,f,p,h){d.addEventListener(f,p,h);let g=!1;return{dispose:()=>{g||(g=!0,d.removeEventListener(f,p,h))}}}},3551:function(c,l,d){var f=this&&this.__decorate||function(y,_,S,N){var I,R=arguments.length,B=R<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,_,S,N);else for(var k=y.length-1;k>=0;k--)(I=y[k])&&(B=(R<3?I(B):R>3?I(_,S,B):I(_,S))||B);return R>3&&B&&Object.defineProperty(_,S,B),B},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const h=d(3656),g=d(8460),b=d(844),x=d(2585),E=d(4725);let v=l.Linkifier=class extends b.Disposable{get currentLink(){return this._currentLink}constructor(y,_,S,N,I){super(),this._element=y,this._mouseService=_,this._renderService=S,this._bufferService=N,this._linkProviderService=I,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,b.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,b.toDisposable)((()=>{var R;this._lastMouseEvent=void 0,(R=this._activeProviderReplies)==null||R.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(y){this._lastMouseEvent=y;const _=this._positionFromMouseEvent(y,this._element,this._mouseService);if(!_)return;this._isMouseOut=!1;const S=y.composedPath();for(let N=0;N<S.length;N++){const I=S[N];if(I.classList.contains("xterm"))break;if(I.classList.contains("xterm-hover"))return}this._lastBufferCell&&_.x===this._lastBufferCell.x&&_.y===this._lastBufferCell.y||(this._handleHover(_),this._lastBufferCell=_)}_handleHover(y){if(this._activeLine!==y.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(y,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,y)||(this._clearCurrentLink(),this._askForLink(y,!0))}_askForLink(y,_){var S,N;this._activeProviderReplies&&_||((S=this._activeProviderReplies)==null||S.forEach((R=>{R==null||R.forEach((B=>{B.link.dispose&&B.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=y.y);let I=!1;for(const[R,B]of this._linkProviderService.linkProviders.entries())_?(N=this._activeProviderReplies)!=null&&N.get(R)&&(I=this._checkLinkProviderResult(R,y,I)):B.provideLinks(y.y,(k=>{var L,z;if(this._isMouseOut)return;const G=k==null?void 0:k.map((K=>({link:K})));(L=this._activeProviderReplies)==null||L.set(R,G),I=this._checkLinkProviderResult(R,y,I),((z=this._activeProviderReplies)==null?void 0:z.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(y.y,this._activeProviderReplies)}))}_removeIntersectingLinks(y,_){const S=new Set;for(let N=0;N<_.size;N++){const I=_.get(N);if(I)for(let R=0;R<I.length;R++){const B=I[R],k=B.link.range.start.y<y?0:B.link.range.start.x,L=B.link.range.end.y>y?this._bufferService.cols:B.link.range.end.x;for(let z=k;z<=L;z++){if(S.has(z)){I.splice(R--,1);break}S.add(z)}}}}_checkLinkProviderResult(y,_,S){var N;if(!this._activeProviderReplies)return S;const I=this._activeProviderReplies.get(y);let R=!1;for(let B=0;B<y;B++)this._activeProviderReplies.has(B)&&!this._activeProviderReplies.get(B)||(R=!0);if(!R&&I){const B=I.find((k=>this._linkAtPosition(k.link,_)));B&&(S=!0,this._handleNewLink(B))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let B=0;B<this._activeProviderReplies.size;B++){const k=(N=this._activeProviderReplies.get(B))==null?void 0:N.find((L=>this._linkAtPosition(L.link,_)));if(k){S=!0,this._handleNewLink(k);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(y){if(!this._currentLink)return;const _=this._positionFromMouseEvent(y,this._element,this._mouseService);_&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,_)&&this._currentLink.link.activate(y,this._currentLink.link.text)}_clearCurrentLink(y,_){this._currentLink&&this._lastMouseEvent&&(!y||!_||this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=_)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,b.disposeArray)(this._linkCacheDisposables))}_handleNewLink(y){if(!this._lastMouseEvent)return;const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._linkAtPosition(y.link,_)&&(this._currentLink=y,this._currentLink.state={decorations:{underline:y.link.decorations===void 0||y.link.decorations.underline,pointerCursor:y.link.decorations===void 0||y.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,y.link,this._lastMouseEvent),y.link.decorations={},Object.defineProperties(y.link.decorations,{pointerCursor:{get:()=>{var S,N;return(N=(S=this._currentLink)==null?void 0:S.state)==null?void 0:N.decorations.pointerCursor},set:S=>{var N;(N=this._currentLink)!=null&&N.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,N;return(N=(S=this._currentLink)==null?void 0:S.state)==null?void 0:N.decorations.underline},set:S=>{var N,I,R;(N=this._currentLink)!=null&&N.state&&((R=(I=this._currentLink)==null?void 0:I.state)==null?void 0:R.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(y.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const N=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,I=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=N&&this._currentLink.link.range.end.y<=I&&(this._clearCurrentLink(N,I),this._lastMouseEvent)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(y,_,S){var N;(N=this._currentLink)!=null&&N.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!0),this._currentLink.state.decorations.pointerCursor&&y.classList.add("xterm-cursor-pointer")),_.hover&&_.hover(S,_.text)}_fireUnderlineEvent(y,_){const S=y.range,N=this._bufferService.buffer.ydisp,I=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-N-1,S.end.x,S.end.y-N-1,void 0);(_?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(I)}_linkLeave(y,_,S){var N;(N=this._currentLink)!=null&&N.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!1),this._currentLink.state.decorations.pointerCursor&&y.classList.remove("xterm-cursor-pointer")),_.leave&&_.leave(S,_.text)}_linkAtPosition(y,_){const S=y.range.start.y*this._bufferService.cols+y.range.start.x,N=y.range.end.y*this._bufferService.cols+y.range.end.x,I=_.y*this._bufferService.cols+_.x;return S<=I&&I<=N}_positionFromMouseEvent(y,_,S){const N=S.getCoords(y,_,this._bufferService.cols,this._bufferService.rows);if(N)return{x:N[0],y:N[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(y,_,S,N,I){return{x1:y,y1:_,x2:S,y2:N,cols:this._bufferService.cols,fg:I}}};l.Linkifier=v=f([p(1,E.IMouseService),p(2,E.IRenderService),p(3,x.IBufferService),p(4,E.ILinkProviderService)],v)},9042:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,l,d){var f=this&&this.__decorate||function(E,v,y,_){var S,N=arguments.length,I=N<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(E,v,y,_);else for(var R=E.length-1;R>=0;R--)(S=E[R])&&(I=(N<3?S(I):N>3?S(v,y,I):S(v,y))||I);return N>3&&I&&Object.defineProperty(v,y,I),I},p=this&&this.__param||function(E,v){return function(y,_){v(y,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const h=d(511),g=d(2585);let b=l.OscLinkProvider=class{constructor(E,v,y){this._bufferService=E,this._optionsService=v,this._oscLinkService=y}provideLinks(E,v){var y;const _=this._bufferService.buffer.lines.get(E-1);if(!_)return void v(void 0);const S=[],N=this._optionsService.rawOptions.linkHandler,I=new h.CellData,R=_.getTrimmedLength();let B=-1,k=-1,L=!1;for(let z=0;z<R;z++)if(k!==-1||_.hasContent(z)){if(_.loadCell(z,I),I.hasExtendedAttrs()&&I.extended.urlId){if(k===-1){k=z,B=I.extended.urlId;continue}L=I.extended.urlId!==B}else k!==-1&&(L=!0);if(L||k!==-1&&z===R-1){const G=(y=this._oscLinkService.getLinkData(B))==null?void 0:y.uri;if(G){const K={start:{x:k+1,y:E},end:{x:z+(L||z!==R-1?0:1),y:E}};let Z=!1;if(!(N!=null&&N.allowNonHttpProtocols))try{const te=new URL(G);["http:","https:"].includes(te.protocol)||(Z=!0)}catch{Z=!0}Z||S.push({text:G,range:K,activate:(te,re)=>N?N.activate(te,re,K):x(0,re),hover:(te,re)=>{var Q;return(Q=N==null?void 0:N.hover)==null?void 0:Q.call(N,te,re,K)},leave:(te,re)=>{var Q;return(Q=N==null?void 0:N.leave)==null?void 0:Q.call(N,te,re,K)}})}L=!1,I.hasExtendedAttrs()&&I.extended.urlId?(k=z,B=I.extended.urlId):(k=-1,B=-1)}}v(S)}};function x(E,v){if(confirm(`Do you want to navigate to ${v}?
277
+
278
+ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=b=f([p(0,g.IBufferService),p(1,g.IOptionsService),p(2,g.IOscLinkService)],b)},6193:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,f){this._renderCallback=d,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,f,p){this._rowCount=p,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=d(3614),p=d(3656),h=d(3551),g=d(9042),b=d(3730),x=d(1680),E=d(3107),v=d(5744),y=d(2950),_=d(1296),S=d(428),N=d(4269),I=d(5114),R=d(8934),B=d(3230),k=d(9312),L=d(4725),z=d(6731),G=d(8055),K=d(8969),Z=d(8460),te=d(844),re=d(6114),Q=d(8437),de=d(2584),ee=d(7399),P=d(5941),M=d(9074),V=d(2585),$=d(5435),H=d(4567),ye=d(779);class Ae extends K.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(ie={}){super(ie),this.browser=re,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new te.MutableDisposable),this._onCursorMove=this.register(new Z.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new Z.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new Z.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new Z.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new Z.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new Z.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new Z.EventEmitter),this._onBlur=this.register(new Z.EventEmitter),this._onA11yCharEmitter=this.register(new Z.EventEmitter),this._onA11yTabEmitter=this.register(new Z.EventEmitter),this._onWillOpen=this.register(new Z.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(V.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ye.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(b.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((J,fe)=>this.refresh(J,fe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((J=>this._reportWindowsOptions(J)))),this.register(this._inputHandler.onColor((J=>this._handleColorEvent(J)))),this.register((0,Z.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,Z.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,Z.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,Z.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((J=>this._afterResize(J.cols,J.rows)))),this.register((0,te.toDisposable)((()=>{var J,fe;this._customKeyEventHandler=void 0,(fe=(J=this.element)==null?void 0:J.parentNode)==null||fe.removeChild(this.element)})))}_handleColorEvent(ie){if(this._themeService)for(const J of ie){let fe,Te="";switch(J.index){case 256:fe="foreground",Te="10";break;case 257:fe="background",Te="11";break;case 258:fe="cursor",Te="12";break;default:fe="ansi",Te="4;"+J.index}switch(J.type){case 0:const We=G.color.toColorRGB(fe==="ansi"?this._themeService.colors.ansi[J.index]:this._themeService.colors[fe]);this.coreService.triggerDataEvent(`${de.C0.ESC}]${Te};${(0,P.toRgbString)(We)}${de.C1_ESCAPED.ST}`);break;case 1:if(fe==="ansi")this._themeService.modifyColors((Me=>Me.ansi[J.index]=G.channels.toColor(...J.color)));else{const Me=fe;this._themeService.modifyColors((it=>it[Me]=G.channels.toColor(...J.color)))}break;case 2:this._themeService.restoreColor(J.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(ie){ie?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(ie){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var ie;return(ie=this.textarea)==null?void 0:ie.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const ie=this.buffer.ybase+this.buffer.y,J=this.buffer.lines.get(ie);if(!J)return;const fe=Math.min(this.buffer.x,this.cols-1),Te=this._renderService.dimensions.css.cell.height,We=J.getWidth(fe),Me=this._renderService.dimensions.css.cell.width*We,it=this.buffer.y*this._renderService.dimensions.css.cell.height,Ct=fe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ct+"px",this.textarea.style.top=it+"px",this.textarea.style.width=Me+"px",this.textarea.style.height=Te+"px",this.textarea.style.lineHeight=Te+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(J=>{this.hasSelection()&&(0,f.copyHandler)(J,this._selectionService)})));const ie=J=>(0,f.handlePasteEvent)(J,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",ie)),this.register((0,p.addDisposableDomListener)(this.element,"paste",ie)),re.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(J=>{J.button===2&&(0,f.rightClickHandler)(J,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(J=>{(0,f.rightClickHandler)(J,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),re.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(J=>{J.button===1&&(0,f.moveTextAreaUnderMouseCursor)(J,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(ie=>this._keyUp(ie)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(ie=>this._keyDown(ie)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(ie=>this._keyPress(ie)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(ie=>this._compositionHelper.compositionupdate(ie)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(ie=>this._inputEvent(ie)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(ie){var J;if(!ie)throw new Error("Terminal requires a parent element.");if(ie.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((J=this.element)==null?void 0:J.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=ie.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),ie.appendChild(this.element);const fe=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),fe.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(Te=>this.updateCursorStyle(Te)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),fe.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),re.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(I.CoreBrowserService,this.textarea,ie.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(Te=>this._handleTextAreaFocus(Te)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(N.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(B.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Te=>this._onRender.fire(Te)))),this.onResize((Te=>this._renderService.resize(Te.cols,Te.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(fe);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Te=>this.scrollLines(Te.amount,Te.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Te=>this.scrollLines(Te.amount,Te.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Te=>this._renderService.handleSelectionChanged(Te.start,Te.end,Te.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Te=>{this.textarea.value=Te,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Te=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(E.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(Te=>this._selectionService.handleMouseDown(Te)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Te=>this._handleScreenReaderModeOptionChange(Te)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Te=>{!this._overviewRulerRenderer&&Te&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const ie=this,J=this.element;function fe(Me){const it=ie._mouseService.getMouseReportCoords(Me,ie.screenElement);if(!it)return!1;let Ct,St;switch(Me.overrideType||Me.type){case"mousemove":St=32,Me.buttons===void 0?(Ct=3,Me.button!==void 0&&(Ct=Me.button<3?Me.button:3)):Ct=1&Me.buttons?0:4&Me.buttons?1:2&Me.buttons?2:3;break;case"mouseup":St=0,Ct=Me.button<3?Me.button:3;break;case"mousedown":St=1,Ct=Me.button<3?Me.button:3;break;case"wheel":if(ie._customWheelEventHandler&&ie._customWheelEventHandler(Me)===!1||ie.viewport.getLinesScrolled(Me)===0)return!1;St=Me.deltaY<0?0:1,Ct=4;break;default:return!1}return!(St===void 0||Ct===void 0||Ct>4)&&ie.coreMouseService.triggerMouseEvent({col:it.col,row:it.row,x:it.x,y:it.y,button:Ct,action:St,ctrl:Me.ctrlKey,alt:Me.altKey,shift:Me.shiftKey})}const Te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},We={mouseup:Me=>(fe(Me),Me.buttons||(this._document.removeEventListener("mouseup",Te.mouseup),Te.mousedrag&&this._document.removeEventListener("mousemove",Te.mousedrag)),this.cancel(Me)),wheel:Me=>(fe(Me),this.cancel(Me,!0)),mousedrag:Me=>{Me.buttons&&fe(Me)},mousemove:Me=>{Me.buttons||fe(Me)}};this.register(this.coreMouseService.onProtocolChange((Me=>{Me?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Me)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Me?Te.mousemove||(J.addEventListener("mousemove",We.mousemove),Te.mousemove=We.mousemove):(J.removeEventListener("mousemove",Te.mousemove),Te.mousemove=null),16&Me?Te.wheel||(J.addEventListener("wheel",We.wheel,{passive:!1}),Te.wheel=We.wheel):(J.removeEventListener("wheel",Te.wheel),Te.wheel=null),2&Me?Te.mouseup||(Te.mouseup=We.mouseup):(this._document.removeEventListener("mouseup",Te.mouseup),Te.mouseup=null),4&Me?Te.mousedrag||(Te.mousedrag=We.mousedrag):(this._document.removeEventListener("mousemove",Te.mousedrag),Te.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(J,"mousedown",(Me=>{if(Me.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Me))return fe(Me),Te.mouseup&&this._document.addEventListener("mouseup",Te.mouseup),Te.mousedrag&&this._document.addEventListener("mousemove",Te.mousedrag),this.cancel(Me)}))),this.register((0,p.addDisposableDomListener)(J,"wheel",(Me=>{if(!Te.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Me)===!1)return!1;if(!this.buffer.hasScrollback){const it=this.viewport.getLinesScrolled(Me);if(it===0)return;const Ct=de.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Me.deltaY<0?"A":"B");let St="";for(let en=0;en<Math.abs(it);en++)St+=Ct;return this.coreService.triggerDataEvent(St,!0),this.cancel(Me,!0)}return this.viewport.handleWheel(Me)?this.cancel(Me):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(J,"touchstart",(Me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Me),this.cancel(Me)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(J,"touchmove",(Me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Me)?void 0:this.cancel(Me)}),{passive:!1}))}refresh(ie,J){var fe;(fe=this._renderService)==null||fe.refreshRows(ie,J)}updateCursorStyle(ie){var J;(J=this._selectionService)!=null&&J.shouldColumnSelect(ie)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(ie,J,fe=0){var Te;fe===1?(super.scrollLines(ie,J,fe),this.refresh(0,this.rows-1)):(Te=this.viewport)==null||Te.scrollLines(ie)}paste(ie){(0,f.paste)(ie,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(ie){this._customKeyEventHandler=ie}attachCustomWheelEventHandler(ie){this._customWheelEventHandler=ie}registerLinkProvider(ie){return this._linkProviderService.registerLinkProvider(ie)}registerCharacterJoiner(ie){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const J=this._characterJoinerService.register(ie);return this.refresh(0,this.rows-1),J}deregisterCharacterJoiner(ie){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ie)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(ie){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ie)}registerDecoration(ie){return this._decorationService.registerDecoration(ie)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(ie,J,fe){this._selectionService.setSelection(ie,J,fe)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var ie;(ie=this._selectionService)==null||ie.clearSelection()}selectAll(){var ie;(ie=this._selectionService)==null||ie.selectAll()}selectLines(ie,J){var fe;(fe=this._selectionService)==null||fe.selectLines(ie,J)}_keyDown(ie){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(ie)===!1)return!1;const J=this.browser.isMac&&this.options.macOptionIsMeta&&ie.altKey;if(!J&&!this._compositionHelper.keydown(ie))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;J||ie.key!=="Dead"&&ie.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const fe=(0,ee.evaluateKeyboardEvent)(ie,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ie),fe.type===3||fe.type===2){const Te=this.rows-1;return this.scrollLines(fe.type===2?-Te:Te),this.cancel(ie,!0)}return fe.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ie)||(fe.cancel&&this.cancel(ie,!0),!fe.key||!!(ie.key&&!ie.ctrlKey&&!ie.altKey&&!ie.metaKey&&ie.key.length===1&&ie.key.charCodeAt(0)>=65&&ie.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(fe.key!==de.C0.ETX&&fe.key!==de.C0.CR||(this.textarea.value=""),this._onKey.fire({key:fe.key,domEvent:ie}),this._showCursor(),this.coreService.triggerDataEvent(fe.key,!0),!this.optionsService.rawOptions.screenReaderMode||ie.altKey||ie.ctrlKey?this.cancel(ie,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(ie,J){const fe=ie.isMac&&!this.options.macOptionIsMeta&&J.altKey&&!J.ctrlKey&&!J.metaKey||ie.isWindows&&J.altKey&&J.ctrlKey&&!J.metaKey||ie.isWindows&&J.getModifierState("AltGraph");return J.type==="keypress"?fe:fe&&(!J.keyCode||J.keyCode>47)}_keyUp(ie){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ie)===!1||((function(J){return J.keyCode===16||J.keyCode===17||J.keyCode===18})(ie)||this.focus(),this.updateCursorStyle(ie),this._keyPressHandled=!1)}_keyPress(ie){let J;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ie)===!1)return!1;if(this.cancel(ie),ie.charCode)J=ie.charCode;else if(ie.which===null||ie.which===void 0)J=ie.keyCode;else{if(ie.which===0||ie.charCode===0)return!1;J=ie.which}return!(!J||(ie.altKey||ie.ctrlKey||ie.metaKey)&&!this._isThirdLevelShift(this.browser,ie)||(J=String.fromCharCode(J),this._onKey.fire({key:J,domEvent:ie}),this._showCursor(),this.coreService.triggerDataEvent(J,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(ie){if(ie.data&&ie.inputType==="insertText"&&(!ie.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const J=ie.data;return this.coreService.triggerDataEvent(J,!0),this.cancel(ie),!0}return!1}resize(ie,J){ie!==this.cols||J!==this.rows?super.resize(ie,J):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(ie,J){var fe,Te;(fe=this._charSizeService)==null||fe.measure(),(Te=this.viewport)==null||Te.syncScrollArea(!0)}clear(){var ie;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let J=1;J<this.rows;J++)this.buffer.lines.push(this.buffer.getBlankLine(Q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(ie=this.viewport)==null||ie.reset(),this.refresh(0,this.rows-1)}}reset(){var ie,J;this.options.rows=this.rows,this.options.cols=this.cols;const fe=this._customKeyEventHandler;this._setup(),super.reset(),(ie=this._selectionService)==null||ie.reset(),this._decorationService.reset(),(J=this.viewport)==null||J.reset(),this._customKeyEventHandler=fe,this.refresh(0,this.rows-1)}clearTextureAtlas(){var ie;(ie=this._renderService)==null||ie.clearTextureAtlas()}_reportFocus(){var ie;(ie=this.element)!=null&&ie.classList.contains("focus")?this.coreService.triggerDataEvent(de.C0.ESC+"[I"):this.coreService.triggerDataEvent(de.C0.ESC+"[O")}_reportWindowsOptions(ie){if(this._renderService)switch(ie){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const J=this._renderService.dimensions.css.canvas.width.toFixed(0),fe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${de.C0.ESC}[4;${fe};${J}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Te=this._renderService.dimensions.css.cell.width.toFixed(0),We=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${de.C0.ESC}[6;${We};${Te}t`)}}cancel(ie,J){if(this.options.cancelEvents||J)return ie.preventDefault(),ie.stopPropagation(),!1}}l.Terminal=Ae},9924:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,f=1e3){this._renderCallback=d,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,f,p){this._rowCount=p,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=h-this._lastRefreshMs,b=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),b)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f)}}},1680:function(c,l,d){var f=this&&this.__decorate||function(y,_,S,N){var I,R=arguments.length,B=R<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,_,S,N);else for(var k=y.length-1;k>=0;k--)(I=y[k])&&(B=(R<3?I(B):R>3?I(_,S,B):I(_,S))||B);return R>3&&B&&Object.defineProperty(_,S,B),B},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const h=d(3656),g=d(4725),b=d(8460),x=d(844),E=d(2585);let v=l.Viewport=class extends x.Disposable{constructor(y,_,S,N,I,R,B,k){super(),this._viewportElement=y,this._scrollArea=_,this._bufferService=S,this._optionsService=N,this._charSizeService=I,this._renderService=R,this._coreBrowserService=B,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(y){if(y)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const _=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==_&&(this._lastRecordedBufferHeight=_,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const _=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(y,_){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(_<0&&this._viewportElement.scrollTop!==0||_>0&&S<this._lastRecordedBufferHeight)||(y.cancelable&&y.preventDefault(),!1)}handleWheel(y){const _=this._getPixelsScrolled(y);return _!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+_:this._smoothScrollState.target+=_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=_,this._bubbleScroll(y,_))}scrollLines(y){if(y!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const _=y*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!1})}_getPixelsScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let _=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_LINE?_*=this._currentRowHeight:y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._currentRowHeight*this._bufferService.rows),_}getBufferElements(y,_){var S;let N,I="";const R=[],B=_??this._bufferService.buffer.lines.length,k=this._bufferService.buffer.lines;for(let L=y;L<B;L++){const z=k.get(L);if(!z)continue;const G=(S=k.get(L+1))==null?void 0:S.isWrapped;if(I+=z.translateToString(!G),!G||L===k.length-1){const K=document.createElement("div");K.textContent=I,R.push(K),I.length>0&&(N=K),I=""}}return{bufferElements:R,cursorElement:N}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let _=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(_/=this._currentRowHeight+0,this._wheelPartialScroll+=_,_=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._bufferService.rows),_}_applyScrollModifier(y,_){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&_.altKey||S==="ctrl"&&_.ctrlKey||S==="shift"&&_.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const _=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,_!==0&&(this._viewportElement.scrollTop+=_,this._bubbleScroll(y,_))}};l.Viewport=v=f([p(2,E.IBufferService),p(3,E.IOptionsService),p(4,g.ICharSizeService),p(5,g.IRenderService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],v)},3107:function(c,l,d){var f=this&&this.__decorate||function(E,v,y,_){var S,N=arguments.length,I=N<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(E,v,y,_);else for(var R=E.length-1;R>=0;R--)(S=E[R])&&(I=(N<3?S(I):N>3?S(v,y,I):S(v,y))||I);return N>3&&I&&Object.defineProperty(v,y,I),I},p=this&&this.__param||function(E,v){return function(y,_){v(y,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const h=d(4725),g=d(844),b=d(2585);let x=l.BufferDecorationRenderer=class extends g.Disposable{constructor(E,v,y,_,S){super(),this._screenElement=E,this._bufferService=v,this._coreBrowserService=y,this._decorationService=_,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((N=>this._removeDecoration(N)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const E of this._decorationService.decorations)this._renderDecoration(E);this._dimensionsChanged=!1}_renderDecoration(E){this._refreshStyle(E),this._dimensionsChanged&&this._refreshXPosition(E)}_createElement(E){var v;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((v=E==null?void 0:E.options)==null?void 0:v.layer)==="top"),y.style.width=`${Math.round((E.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(E.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(E.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=E.options.x??0;return _&&_>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(E,y),y}_refreshStyle(E){const v=E.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)E.element&&(E.element.style.display="none",E.onRenderEmitter.fire(E.element));else{let y=this._decorationElements.get(E);y||(y=this._createElement(E),E.element=y,this._decorationElements.set(E,y),this._container.appendChild(y),E.onDispose((()=>{this._decorationElements.delete(E),y.remove()}))),y.style.top=v*this._renderService.dimensions.css.cell.height+"px",y.style.display=this._altBufferIsActive?"none":"block",E.onRenderEmitter.fire(y)}}_refreshXPosition(E,v=E.element){if(!v)return;const y=E.options.x??0;(E.options.anchor||"left")==="right"?v.style.right=y?y*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=y?y*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(E){var v;(v=this._decorationElements.get(E))==null||v.remove(),this._decorationElements.delete(E),E.dispose()}};l.BufferDecorationRenderer=x=f([p(1,b.IBufferService),p(2,h.ICoreBrowserService),p(3,b.IDecorationService),p(4,h.IRenderService)],x)},5871:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const f of this._zones)if(f.color===d.options.overviewRulerOptions.color&&f.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,d.marker.line))return;if(this._lineAdjacentToZone(f,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(f,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,f){return f>=d.startBufferLine&&f<=d.endBufferLine}_lineAdjacentToZone(d,f,p){return f>=d.startBufferLine-this._linePadding[p||"full"]&&f<=d.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(c,l,d){var f=this&&this.__decorate||function(S,N,I,R){var B,k=arguments.length,L=k<3?N:R===null?R=Object.getOwnPropertyDescriptor(N,I):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,I,R);else for(var z=S.length-1;z>=0;z--)(B=S[z])&&(L=(k<3?B(L):k>3?B(N,I,L):B(N,I))||L);return k>3&&L&&Object.defineProperty(N,I,L),L},p=this&&this.__param||function(S,N){return function(I,R){N(I,R,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const h=d(5871),g=d(4725),b=d(844),x=d(2585),E={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0};let _=l.OverviewRulerRenderer=class extends b.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,N,I,R,B,k,L){var z;super(),this._viewportElement=S,this._screenElement=N,this._bufferService=I,this._decorationService=R,this._renderService=B,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(z=this._viewportElement.parentElement)==null||z.insertBefore(this._canvas,this._viewportElement);const G=this._canvas.getContext("2d");if(!G)throw new Error("Ctx cannot be null");this._ctx=G,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,b.toDisposable)((()=>{var K;(K=this._canvas)==null||K.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),N=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=S,v.center=N,v.right=S,this._refreshDrawHeightConstants(),y.full=0,y.left=0,y.center=v.left,y.right=v.left+v.center}_refreshDrawHeightConstants(){E.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,N=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);E.left=N,E.center=N,E.right=N}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const N of this._decorationService.decorations)this._colorZoneStore.addDecoration(N);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const N of S)N.position!=="full"&&this._renderColorZone(N);for(const N of S)N.position==="full"&&this._renderColorZone(N);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(y[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-E[S.position||"full"]/2),v[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+E[S.position||"full"]))}_queueRefresh(S,N){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=N||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=_=f([p(2,x.IBufferService),p(3,x.IDecorationService),p(4,g.IRenderService),p(5,x.IOptionsService),p(6,g.ICoreBrowserService)],_)},2950:function(c,l,d){var f=this&&this.__decorate||function(E,v,y,_){var S,N=arguments.length,I=N<3?v:_===null?_=Object.getOwnPropertyDescriptor(v,y):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(E,v,y,_);else for(var R=E.length-1;R>=0;R--)(S=E[R])&&(I=(N<3?S(I):N>3?S(v,y,I):S(v,y))||I);return N>3&&I&&Object.defineProperty(v,y,I),I},p=this&&this.__param||function(E,v){return function(y,_){v(y,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const h=d(4725),g=d(2585),b=d(2584);let x=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(E,v,y,_,S,N){this._textarea=E,this._compositionView=v,this._bufferService=y,this._optionsService=_,this._coreService=S,this._renderService=N,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(E){this._compositionView.textContent=E.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(E){if(this._isComposing||this._isSendingComposition){if(E.keyCode===229||E.keyCode===16||E.keyCode===17||E.keyCode===18)return!1;this._finalizeComposition(!1)}return E.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(E){if(this._compositionView.classList.remove("active"),this._isComposing=!1,E){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),y.length>0&&this._coreService.triggerDataEvent(y,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const E=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,y=v.replace(E,"");this._dataAlreadySent=y,v.length>E.length?this._coreService.triggerDataEvent(y,!0):v.length<E.length?this._coreService.triggerDataEvent(`${b.C0.DEL}`,!0):v.length===E.length&&v!==E&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(E){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._renderService.dimensions.css.cell.height,_=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=_+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const N=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=_+"px",this._textarea.style.width=Math.max(N.width,1)+"px",this._textarea.style.height=Math.max(N.height,1)+"px",this._textarea.style.lineHeight=N.height+"px"}E||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=x=f([p(2,g.IBufferService),p(3,g.IOptionsService),p(4,g.ICoreService),p(5,h.IRenderService)],x)},9806:(c,l)=>{function d(f,p,h){const g=h.getBoundingClientRect(),b=f.getComputedStyle(h),x=parseInt(b.getPropertyValue("padding-left")),E=parseInt(b.getPropertyValue("padding-top"));return[p.clientX-g.left-x,p.clientY-g.top-E]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(f,p,h,g,b,x,E,v,y){if(!x)return;const _=d(f,p,h);return _?(_[0]=Math.ceil((_[0]+(y?E/2:0))/E),_[1]=Math.ceil(_[1]/v),_[0]=Math.min(Math.max(_[0],1),g+(y?1:0)),_[1]=Math.min(Math.max(_[1],1),b),_):void 0}},9504:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=d(2584);function p(v,y,_,S){const N=v-h(v,_),I=y-h(y,_),R=Math.abs(N-I)-(function(B,k,L){let z=0;const G=B-h(B,L),K=k-h(k,L);for(let Z=0;Z<Math.abs(G-K);Z++){const te=g(B,k)==="A"?-1:1,re=L.buffer.lines.get(G+te*Z);re!=null&&re.isWrapped&&z++}return z})(v,y,_);return E(R,x(g(v,y),S))}function h(v,y){let _=0,S=y.buffer.lines.get(v),N=S==null?void 0:S.isWrapped;for(;N&&v>=0&&v<y.rows;)_++,S=y.buffer.lines.get(--v),N=S==null?void 0:S.isWrapped;return _}function g(v,y){return v>y?"A":"B"}function b(v,y,_,S,N,I){let R=v,B=y,k="";for(;R!==_||B!==S;)R+=N?1:-1,N&&R>I.cols-1?(k+=I.buffer.translateBufferLineToString(B,!1,v,R),R=0,v=0,B++):!N&&R<0&&(k+=I.buffer.translateBufferLineToString(B,!1,0,v+1),R=I.cols-1,v=R,B--);return k+I.buffer.translateBufferLineToString(B,!1,v,R)}function x(v,y){const _=y?"O":"[";return f.C0.ESC+_+v}function E(v,y){v=Math.floor(v);let _="";for(let S=0;S<v;S++)_+=y;return _}l.moveToCellSequence=function(v,y,_,S){const N=_.buffer.x,I=_.buffer.y;if(!_.buffer.hasScrollback)return(function(k,L,z,G,K,Z){return p(L,G,K,Z).length===0?"":E(b(k,L,k,L-h(L,K),!1,K).length,x("D",Z))})(N,I,0,y,_,S)+p(I,y,_,S)+(function(k,L,z,G,K,Z){let te;te=p(L,G,K,Z).length>0?G-h(G,K):L;const re=G,Q=(function(de,ee,P,M,V,$){let H;return H=p(P,M,V,$).length>0?M-h(M,V):ee,de<P&&H<=M||de>=P&&H<M?"C":"D"})(k,L,z,G,K,Z);return E(b(k,te,z,re,Q==="C",K).length,x(Q,Z))})(N,I,v,y,_,S);let R;if(I===y)return R=N>v?"D":"C",E(Math.abs(N-v),x(R,S));R=I>y?"D":"C";const B=Math.abs(I-y);return E((function(k,L){return L.cols-k})(I>y?v:N,_)+(B-1)*_.cols+1+((I>y?N:v)-1),x(R,S))}},1296:function(c,l,d){var f=this&&this.__decorate||function(Z,te,re,Q){var de,ee=arguments.length,P=ee<3?te:Q===null?Q=Object.getOwnPropertyDescriptor(te,re):Q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(Z,te,re,Q);else for(var M=Z.length-1;M>=0;M--)(de=Z[M])&&(P=(ee<3?de(P):ee>3?de(te,re,P):de(te,re))||P);return ee>3&&P&&Object.defineProperty(te,re,P),P},p=this&&this.__param||function(Z,te){return function(re,Q){te(re,Q,Z)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const h=d(3787),g=d(2550),b=d(2223),x=d(6171),E=d(6052),v=d(4725),y=d(8055),_=d(8460),S=d(844),N=d(2585),I="xterm-dom-renderer-owner-",R="xterm-rows",B="xterm-fg-",k="xterm-bg-",L="xterm-focus",z="xterm-selection";let G=1,K=l.DomRenderer=class extends S.Disposable{constructor(Z,te,re,Q,de,ee,P,M,V,$,H,ye,Ae){super(),this._terminal=Z,this._document=te,this._element=re,this._screenElement=Q,this._viewportElement=de,this._helperContainer=ee,this._linkifier2=P,this._charSizeService=V,this._optionsService=$,this._bufferService=H,this._coreBrowserService=ye,this._themeService=Ae,this._terminalClass=G++,this._rowElements=[],this._selectionRenderModel=(0,E.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new _.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Ne=>this._injectCss(Ne)))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(I+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Ne=>this._handleLinkHover(Ne)))),this.register(this._linkifier2.onHideLinkUnderline((Ne=>this._handleLinkLeave(Ne)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(I+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const Z=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*Z,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*Z),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/Z),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/Z),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const re of this._rowElements)re.style.width=`${this.dimensions.css.canvas.width}px`,re.style.height=`${this.dimensions.css.cell.height}px`,re.style.lineHeight=`${this.dimensions.css.cell.height}px`,re.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const te=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=te,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(Z){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let te=`${this._terminalSelector} .${R} { color: ${Z.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;te+=`${this._terminalSelector} .${R} .xterm-dim { color: ${y.color.multiplyOpacity(Z.foreground,.5).css};}`,te+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const re=`blink_underline_${this._terminalClass}`,Q=`blink_bar_${this._terminalClass}`,de=`blink_block_${this._terminalClass}`;te+=`@keyframes ${re} { 50% { border-bottom-style: hidden; }}`,te+=`@keyframes ${Q} { 50% { box-shadow: none; }}`,te+=`@keyframes ${de} { 0% { background-color: ${Z.cursor.css}; color: ${Z.cursorAccent.css}; } 50% { background-color: inherit; color: ${Z.cursor.css}; }}`,te+=`${this._terminalSelector} .${R}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${re} 1s step-end infinite;}${this._terminalSelector} .${R}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${R}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${de} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${Z.cursor.css}; color: ${Z.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${Z.cursor.css} !important; color: ${Z.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${Z.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${Z.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${Z.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,te+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${Z.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${Z.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,P]of Z.ansi.entries())te+=`${this._terminalSelector} .${B}${ee} { color: ${P.css}; }${this._terminalSelector} .${B}${ee}.xterm-dim { color: ${y.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${k}${ee} { background-color: ${P.css}; }`;te+=`${this._terminalSelector} .${B}${b.INVERTED_DEFAULT_COLOR} { color: ${y.color.opaque(Z.background).css}; }${this._terminalSelector} .${B}${b.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${y.color.multiplyOpacity(y.color.opaque(Z.background),.5).css}; }${this._terminalSelector} .${k}${b.INVERTED_DEFAULT_COLOR} { background-color: ${Z.foreground.css}; }`,this._themeStyleElement.textContent=te}_setDefaultSpacing(){const Z=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${Z}px`,this._rowFactory.defaultSpacing=Z}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(Z,te){for(let re=this._rowElements.length;re<=te;re++){const Q=this._document.createElement("div");this._rowContainer.appendChild(Q),this._rowElements.push(Q)}for(;this._rowElements.length>te;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(Z,te){this._refreshRowElements(Z,te),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(Z,te,re){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(Z,te,re),this.renderRows(0,this._bufferService.rows-1),!Z||!te)return;this._selectionRenderModel.update(this._terminal,Z,te,re);const Q=this._selectionRenderModel.viewportStartRow,de=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,P=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||P<0)return;const M=this._document.createDocumentFragment();if(re){const V=Z[0]>te[0];M.appendChild(this._createSelectionElement(ee,V?te[0]:Z[0],V?Z[0]:te[0],P-ee+1))}else{const V=Q===ee?Z[0]:0,$=ee===de?te[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(ee,V,$));const H=P-ee-1;if(M.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,H)),ee!==P){const ye=de===P?te[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(P,0,ye))}}this._selectionContainer.appendChild(M)}_createSelectionElement(Z,te,re,Q=1){const de=this._document.createElement("div"),ee=te*this.dimensions.css.cell.width;let P=this.dimensions.css.cell.width*(re-te);return ee+P>this.dimensions.css.canvas.width&&(P=this.dimensions.css.canvas.width-ee),de.style.height=Q*this.dimensions.css.cell.height+"px",de.style.top=Z*this.dimensions.css.cell.height+"px",de.style.left=`${ee}px`,de.style.width=`${P}px`,de}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const Z of this._rowElements)Z.replaceChildren()}renderRows(Z,te){const re=this._bufferService.buffer,Q=re.ybase+re.y,de=Math.min(re.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let V=Z;V<=te;V++){const $=V+re.ydisp,H=this._rowElements[V],ye=re.lines.get($);if(!H||!ye)break;H.replaceChildren(...this._rowFactory.createRow(ye,$,$===Q,P,M,de,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${I}${this._terminalClass}`}_handleLinkHover(Z){this._setCellUnderline(Z.x1,Z.x2,Z.y1,Z.y2,Z.cols,!0)}_handleLinkLeave(Z){this._setCellUnderline(Z.x1,Z.x2,Z.y1,Z.y2,Z.cols,!1)}_setCellUnderline(Z,te,re,Q,de,ee){re<0&&(Z=0),Q<0&&(te=0);const P=this._bufferService.rows-1;re=Math.max(Math.min(re,P),0),Q=Math.max(Math.min(Q,P),0),de=Math.min(de,this._bufferService.cols);const M=this._bufferService.buffer,V=M.ybase+M.y,$=Math.min(M.x,de-1),H=this._optionsService.rawOptions.cursorBlink,ye=this._optionsService.rawOptions.cursorStyle,Ae=this._optionsService.rawOptions.cursorInactiveStyle;for(let Ne=re;Ne<=Q;++Ne){const ie=Ne+M.ydisp,J=this._rowElements[Ne],fe=M.lines.get(ie);if(!J||!fe)break;J.replaceChildren(...this._rowFactory.createRow(fe,ie,ie===V,ye,Ae,$,H,this.dimensions.css.cell.width,this._widthCache,ee?Ne===re?Z:0:-1,ee?(Ne===Q?te:de)-1:-1))}}};l.DomRenderer=K=f([p(7,N.IInstantiationService),p(8,v.ICharSizeService),p(9,N.IOptionsService),p(10,N.IBufferService),p(11,v.ICoreBrowserService),p(12,v.IThemeService)],K)},3787:function(c,l,d){var f=this&&this.__decorate||function(R,B,k,L){var z,G=arguments.length,K=G<3?B:L===null?L=Object.getOwnPropertyDescriptor(B,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(R,B,k,L);else for(var Z=R.length-1;Z>=0;Z--)(z=R[Z])&&(K=(G<3?z(K):G>3?z(B,k,K):z(B,k))||K);return G>3&&K&&Object.defineProperty(B,k,K),K},p=this&&this.__param||function(R,B){return function(k,L){B(k,L,R)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const h=d(2223),g=d(643),b=d(511),x=d(2585),E=d(8055),v=d(4725),y=d(4269),_=d(6171),S=d(3734);let N=l.DomRendererRowFactory=class{constructor(R,B,k,L,z,G,K){this._document=R,this._characterJoinerService=B,this._optionsService=k,this._coreBrowserService=L,this._coreService=z,this._decorationService=G,this._themeService=K,this._workCell=new b.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,B,k){this._selectionStart=R,this._selectionEnd=B,this._columnSelectMode=k}createRow(R,B,k,L,z,G,K,Z,te,re,Q){const de=[],ee=this._characterJoinerService.getJoinedCharacters(B),P=this._themeService.colors;let M,V=R.getNoBgTrimmedLength();k&&V<G+1&&(V=G+1);let $=0,H="",ye=0,Ae=0,Ne=0,ie=!1,J=0,fe=!1,Te=0;const We=[],Me=re!==-1&&Q!==-1;for(let it=0;it<V;it++){R.loadCell(it,this._workCell);let Ct=this._workCell.getWidth();if(Ct===0)continue;let St=!1,en=it,rt=this._workCell;if(ee.length>0&&it===ee[0][0]){St=!0;const vt=ee.shift();rt=new y.JoinedCellData(this._workCell,R.translateToString(!0,vt[0],vt[1]),vt[1]-vt[0]),en=vt[1]-1,Ct=rt.getWidth()}const Tr=this._isCellInSelection(it,B),er=k&&it===G,Nr=Me&&it>=re&&it<=Q;let Bn=!1;this._decorationService.forEachDecorationAtCell(it,B,void 0,(vt=>{Bn=!0}));let Ti=rt.getChars()||g.WHITESPACE_CELL_CHAR;if(Ti===" "&&(rt.isUnderline()||rt.isOverline())&&(Ti=" "),Te=Ct*Z-te.get(Ti,rt.isBold(),rt.isItalic()),M){if($&&(Tr&&fe||!Tr&&!fe&&rt.bg===ye)&&(Tr&&fe&&P.selectionForeground||rt.fg===Ae)&&rt.extended.ext===Ne&&Nr===ie&&Te===J&&!er&&!St&&!Bn){rt.isInvisible()?H+=g.WHITESPACE_CELL_CHAR:H+=Ti,$++;continue}$&&(M.textContent=H),M=this._document.createElement("span"),$=0,H=""}else M=this._document.createElement("span");if(ye=rt.bg,Ae=rt.fg,Ne=rt.extended.ext,ie=Nr,J=Te,fe=Tr,St&&G>=it&&G<=en&&(G=it),!this._coreService.isCursorHidden&&er&&this._coreService.isCursorInitialized){if(We.push("xterm-cursor"),this._coreBrowserService.isFocused)K&&We.push("xterm-cursor-blink"),We.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":We.push("xterm-cursor-outline");break;case"block":We.push("xterm-cursor-block");break;case"bar":We.push("xterm-cursor-bar");break;case"underline":We.push("xterm-cursor-underline")}}if(rt.isBold()&&We.push("xterm-bold"),rt.isItalic()&&We.push("xterm-italic"),rt.isDim()&&We.push("xterm-dim"),H=rt.isInvisible()?g.WHITESPACE_CELL_CHAR:rt.getChars()||g.WHITESPACE_CELL_CHAR,rt.isUnderline()&&(We.push(`xterm-underline-${rt.extended.underlineStyle}`),H===" "&&(H=" "),!rt.isUnderlineColorDefault()))if(rt.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(rt.getUnderlineColor()).join(",")})`;else{let vt=rt.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&rt.isBold()&&vt<8&&(vt+=8),M.style.textDecorationColor=P.ansi[vt].css}rt.isOverline()&&(We.push("xterm-overline"),H===" "&&(H=" ")),rt.isStrikethrough()&&We.push("xterm-strikethrough"),Nr&&(M.style.textDecoration="underline");let yn=rt.getFgColor(),ln=rt.getFgColorMode(),Dn=rt.getBgColor(),ke=rt.getBgColorMode();const Ve=!!rt.isInverse();if(Ve){const vt=yn;yn=Dn,Dn=vt;const _n=ln;ln=ke,ke=_n}let qe,st,ht,cn=!1;switch(this._decorationService.forEachDecorationAtCell(it,B,void 0,(vt=>{vt.options.layer!=="top"&&cn||(vt.backgroundColorRGB&&(ke=50331648,Dn=vt.backgroundColorRGB.rgba>>8&16777215,qe=vt.backgroundColorRGB),vt.foregroundColorRGB&&(ln=50331648,yn=vt.foregroundColorRGB.rgba>>8&16777215,st=vt.foregroundColorRGB),cn=vt.options.layer==="top")})),!cn&&Tr&&(qe=this._coreBrowserService.isFocused?P.selectionBackgroundOpaque:P.selectionInactiveBackgroundOpaque,Dn=qe.rgba>>8&16777215,ke=50331648,cn=!0,P.selectionForeground&&(ln=50331648,yn=P.selectionForeground.rgba>>8&16777215,st=P.selectionForeground)),cn&&We.push("xterm-decoration-top"),ke){case 16777216:case 33554432:ht=P.ansi[Dn],We.push(`xterm-bg-${Dn}`);break;case 50331648:ht=E.channels.toColor(Dn>>16,Dn>>8&255,255&Dn),this._addStyle(M,`background-color:#${I((Dn>>>0).toString(16),"0",6)}`);break;default:Ve?(ht=P.foreground,We.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):ht=P.background}switch(qe||rt.isDim()&&(qe=E.color.multiplyOpacity(ht,.5)),ln){case 16777216:case 33554432:rt.isBold()&&yn<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(yn+=8),this._applyMinimumContrast(M,ht,P.ansi[yn],rt,qe,void 0)||We.push(`xterm-fg-${yn}`);break;case 50331648:const vt=E.channels.toColor(yn>>16&255,yn>>8&255,255&yn);this._applyMinimumContrast(M,ht,vt,rt,qe,st)||this._addStyle(M,`color:#${I(yn.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,ht,P.foreground,rt,qe,st)||Ve&&We.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}We.length&&(M.className=We.join(" "),We.length=0),er||St||Bn?M.textContent=H:$++,Te!==this.defaultSpacing&&(M.style.letterSpacing=`${Te}px`),de.push(M),it=en}return M&&$&&(M.textContent=H),de}_applyMinimumContrast(R,B,k,L,z,G){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,_.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const K=this._getContrastCache(L);let Z;if(z||G||(Z=K.getColor(B.rgba,k.rgba)),Z===void 0){const te=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);Z=E.color.ensureContrastRatio(z||B,G||k,te),K.setColor((z||B).rgba,(G||k).rgba,Z??null)}return!!Z&&(this._addStyle(R,`color:${Z.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,B){R.setAttribute("style",`${R.getAttribute("style")||""}${B};`)}_isCellInSelection(R,B){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?R>=k[0]&&B>=k[1]&&R<L[0]&&B<=L[1]:R<k[0]&&B>=k[1]&&R>=L[0]&&B<=L[1]:B>k[1]&&B<L[1]||k[1]===L[1]&&B===k[1]&&R>=k[0]&&R<L[0]||k[1]<L[1]&&B===L[1]&&R<L[0]||k[1]<L[1]&&B===k[1]&&R>=k[0])}};function I(R,B,k){for(;R.length<k;)R=B+R;return R}l.DomRendererRowFactory=N=f([p(1,v.ICharacterJoinerService),p(2,x.IOptionsService),p(3,v.ICoreBrowserService),p(4,x.ICoreService),p(5,x.IDecorationService),p(6,v.IThemeService)],N)},2550:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const p=d.createElement("span");p.classList.add("xterm-char-measure-element");const h=d.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const g=d.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const b=d.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontWeight="bold",b.style.fontStyle="italic",this._measureElements=[p,h,g,b],this._container.appendChild(p),this._container.appendChild(h),this._container.appendChild(g),this._container.appendChild(b),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,f,p,h){d===this._font&&f===this._fontSize&&p===this._weight&&h===this._weightBold||(this._font=d,this._fontSize=f,this._weight=p,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(d,f,p){let h=0;if(!f&&!p&&d.length===1&&(h=d.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const x=this._measure(d,0);return x>0&&(this._flat[h]=x),x}let g=d;f&&(g+="B"),p&&(g+="I");let b=this._holey.get(g);if(b===void 0){let x=0;f&&(x|=1),p&&(x|=2),b=this._measure(d,x),b>0&&this._holey.set(g,b)}return b}_measure(d,f){const p=this._measureElements[f];return p.textContent=d.repeat(32),p.offsetWidth/32}}},2223:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(c,l)=>{function d(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},l.isEmoji=f,l.allowRescaling=function(p,h,g,b){return h===1&&g>Math.ceil(1.5*b)&&p!==void 0&&p>255&&!f(p)&&!d(p)&&!(function(x){return 57344<=x&&x<=63743})(p)},l.treatGlyphAsBackgroundColor=function(p){return d(p)||(function(h){return 9472<=h&&h<=9631})(p)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(p,h,g=0){return(p-(2*Math.round(h)-g))%(2*Math.round(h))}},6052:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,h,g,b=!1){if(this.selectionStart=h,this.selectionEnd=g,!h||!g||h[0]===g[0]&&h[1]===g[1])return void this.clear();const x=p.buffers.active.ydisp,E=h[1]-x,v=g[1]-x,y=Math.max(E,0),_=Math.min(v,p.rows-1);y>=p.rows||_<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=b,this.viewportStartRow=E,this.viewportEndRow=v,this.viewportCappedStartRow=y,this.viewportCappedEndRow=_,this.startCol=h[0],this.endCol=g[0])}isCellSelected(p,h,g){return!!this.hasSelection&&(g-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&g>=this.viewportCappedStartRow&&h<this.endCol&&g<=this.viewportCappedEndRow:h<this.startCol&&g>=this.viewportCappedStartRow&&h>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&g===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportStartRow&&h>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,f=this.selectionEnd;return!(!d||!f)&&(d[1]>f[1]||d[1]===f[1]&&d[0]>f[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const h=d(2585),g=d(8460),b=d(844);let x=l.CharSizeService=class extends b.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(_,S,N){super(),this._optionsService=N,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new y(this._optionsService))}catch{this._measureStrategy=this.register(new v(_,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const _=this._measureStrategy.measure();_.width===this.width&&_.height===this.height||(this.width=_.width,this.height=_.height,this._onCharSizeChange.fire())}};l.CharSizeService=x=f([p(2,h.IOptionsService)],x);class E extends b.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,N){S!==void 0&&S>0&&N!==void 0&&N>0&&(this._result.width=S,this._result.height=N)}}class v extends E{constructor(S,N,I){super(),this._document=S,this._parentElement=N,this._optionsService=I,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class y extends E{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const N=this._ctx.measureText("W");if(!("width"in N&&"fontBoundingBoxAscent"in N&&"fontBoundingBoxDescent"in N))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(c,l,d){var f=this&&this.__decorate||function(y,_,S,N){var I,R=arguments.length,B=R<3?_:N===null?N=Object.getOwnPropertyDescriptor(_,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,_,S,N);else for(var k=y.length-1;k>=0;k--)(I=y[k])&&(B=(R<3?I(B):R>3?I(_,S,B):I(_,S))||B);return R>3&&B&&Object.defineProperty(_,S,B),B},p=this&&this.__param||function(y,_){return function(S,N){_(S,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const h=d(3734),g=d(643),b=d(511),x=d(2585);class E extends h.AttributeData{constructor(_,S,N){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=S,this._width=N}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=E;let v=l.CharacterJoinerService=class nk{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new b.CellData}register(_){const S={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(S),S.id}deregister(_){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===_)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(_){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(_);if(!S||S.length===0)return[];const N=[],I=S.translateToString(!0);let R=0,B=0,k=0,L=S.getFg(0),z=S.getBg(0);for(let G=0;G<S.getTrimmedLength();G++)if(S.loadCell(G,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==z){if(G-R>1){const K=this._getJoinedRanges(I,k,B,S,R);for(let Z=0;Z<K.length;Z++)N.push(K[Z])}R=G,k=B,L=this._workCell.fg,z=this._workCell.bg}B+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const G=this._getJoinedRanges(I,k,B,S,R);for(let K=0;K<G.length;K++)N.push(G[K])}return N}_getJoinedRanges(_,S,N,I,R){const B=_.substring(S,N);let k=[];try{k=this._characterJoiners[0].handler(B)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const z=this._characterJoiners[L].handler(B);for(let G=0;G<z.length;G++)nk._mergeRanges(k,z[G])}catch(z){console.error(z)}return this._stringRangesToCellRanges(k,I,R),k}_stringRangesToCellRanges(_,S,N){let I=0,R=!1,B=0,k=_[I];if(k){for(let L=N;L<this._bufferService.cols;L++){const z=S.getWidth(L),G=S.getString(L).length||g.WHITESPACE_CELL_CHAR.length;if(z!==0){if(!R&&k[0]<=B&&(k[0]=L,R=!0),k[1]<=B){if(k[1]=L,k=_[++I],!k)break;k[0]<=B?(k[0]=L,R=!0):R=!1}B+=G}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(_,S){let N=!1;for(let I=0;I<_.length;I++){const R=_[I];if(N){if(S[1]<=R[0])return _[I-1][1]=S[1],_;if(S[1]<=R[1])return _[I-1][1]=Math.max(S[1],R[1]),_.splice(I,1),_;_.splice(I,1),I--}else{if(S[1]<=R[0])return _.splice(I,0,S),_;if(S[1]<=R[1])return R[0]=Math.min(S[0],R[0]),_;S[0]<R[1]&&(R[0]=Math.min(S[0],R[0]),N=!0)}}return N?_[_.length-1][1]=S[1]:_.push(S),_}};l.CharacterJoinerService=v=f([p(0,x.IBufferService)],v)},5114:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=d(844),p=d(8460),h=d(3656);class g extends f.Disposable{constructor(E,v,y){super(),this._textarea=E,this._window=v,this.mainDocument=y,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new b(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((_=>this._screenDprMonitor.setWindow(_)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(E){this._window!==E&&(this._window=E,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=g;class b extends f.Disposable{constructor(E){super(),this._parentWindow=E,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(E){this._parentWindow=E,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var E;this._outerListener&&((E=this._resolutionMediaMatchList)==null||E.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=d(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{const b=this.linkProviders.indexOf(g);b!==-1&&this.linkProviders.splice(b,1)}}}}l.LinkProviderService=p},8934:function(c,l,d){var f=this&&this.__decorate||function(x,E,v,y){var _,S=arguments.length,N=S<3?E:y===null?y=Object.getOwnPropertyDescriptor(E,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,E,v,y);else for(var I=x.length-1;I>=0;I--)(_=x[I])&&(N=(S<3?_(N):S>3?_(E,v,N):_(E,v))||N);return S>3&&N&&Object.defineProperty(E,v,N),N},p=this&&this.__param||function(x,E){return function(v,y){E(v,y,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const h=d(4725),g=d(9806);let b=l.MouseService=class{constructor(x,E){this._renderService=x,this._charSizeService=E}getCoords(x,E,v,y,_){return(0,g.getCoords)(window,x,E,v,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,_)}getMouseReportCoords(x,E){const v=(0,g.getCoordsRelativeToElement)(window,x,E);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};l.MouseService=b=f([p(0,h.IRenderService),p(1,h.ICharSizeService)],b)},3230:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const h=d(6193),g=d(4725),b=d(8460),x=d(844),E=d(7226),v=d(2585);let y=l.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(_,S,N,I,R,B,k,L){super(),this._rowCount=_,this._charSizeService=I,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new E.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new b.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new b.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new b.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((z,G)=>this._renderRows(z,G)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(B.onResize((()=>this._fullRefresh()))),this.register(B.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(N.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(N.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(B.cols,B.rows),this._fullRefresh()}))),this.register(N.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(B.buffer.y,B.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,S),this.register(k.onWindowChange((z=>this._registerIntersectionObserver(z,S))))}_registerIntersectionObserver(_,S){if("IntersectionObserver"in _){const N=new _.IntersectionObserver((I=>this._handleIntersectionChange(I[I.length-1])),{threshold:0});N.observe(S),this._observerDisposable.value=(0,x.toDisposable)((()=>N.disconnect()))}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(_,S,N=!1){this._isPaused?this._needsFullRefresh=!0:(N||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,S,this._rowCount))}_renderRows(_,S){this._renderer.value&&(_=Math.min(_,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(_,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:S}),this._onRender.fire({start:_,end:S}),this._isNextRenderRedrawOnly=!0)}resize(_,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(_){this._renderer.value=_,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var _,S;this._renderer.value&&((S=(_=this._renderer.value).clearTextureAtlas)==null||S.call(_),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(_,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var N;return(N=this._renderer.value)==null?void 0:N.handleResize(_,S)})):this._renderer.value.handleResize(_,S),this._fullRefresh())}handleCharSizeChanged(){var _;(_=this._renderer.value)==null||_.handleCharSizeChanged()}handleBlur(){var _;(_=this._renderer.value)==null||_.handleBlur()}handleFocus(){var _;(_=this._renderer.value)==null||_.handleFocus()}handleSelectionChanged(_,S,N){var I;this._selectionState.start=_,this._selectionState.end=S,this._selectionState.columnSelectMode=N,(I=this._renderer.value)==null||I.handleSelectionChanged(_,S,N)}handleCursorMove(){var _;(_=this._renderer.value)==null||_.handleCursorMove()}clear(){var _;(_=this._renderer.value)==null||_.clear()}};l.RenderService=y=f([p(2,v.IOptionsService),p(3,g.ICharSizeService),p(4,v.IDecorationService),p(5,v.IBufferService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],y)},9312:function(c,l,d){var f=this&&this.__decorate||function(k,L,z,G){var K,Z=arguments.length,te=Z<3?L:G===null?G=Object.getOwnPropertyDescriptor(L,z):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(k,L,z,G);else for(var re=k.length-1;re>=0;re--)(K=k[re])&&(te=(Z<3?K(te):Z>3?K(L,z,te):K(L,z))||te);return Z>3&&te&&Object.defineProperty(L,z,te),te},p=this&&this.__param||function(k,L){return function(z,G){L(z,G,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const h=d(9806),g=d(9504),b=d(456),x=d(4725),E=d(8460),v=d(844),y=d(6114),_=d(4841),S=d(511),N=d(2585),I=" ",R=new RegExp(I,"g");let B=l.SelectionService=class extends v.Disposable{constructor(k,L,z,G,K,Z,te,re,Q){super(),this._element=k,this._screenElement=L,this._linkifier=z,this._bufferService=G,this._coreService=K,this._mouseService=Z,this._optionsService=te,this._renderService=re,this._coreBrowserService=Q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new E.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new E.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=de=>this._handleMouseMove(de),this._mouseUpListener=de=>this._handleMouseUp(de),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((de=>this._handleTrim(de))),this.register(this._bufferService.buffers.onBufferActivate((de=>this._handleBufferActivate(de)))),this.enable(),this._model=new b.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!k||!L||k[0]===L[0]&&k[1]===L[1])}get selectionText(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!k||!L)return"";const z=this._bufferService.buffer,G=[];if(this._activeSelectionMode===3){if(k[0]===L[0])return"";const K=k[0]<L[0]?k[0]:L[0],Z=k[0]<L[0]?L[0]:k[0];for(let te=k[1];te<=L[1];te++){const re=z.translateBufferLineToString(te,!0,K,Z);G.push(re)}}else{const K=k[1]===L[1]?L[0]:void 0;G.push(z.translateBufferLineToString(k[1],!0,k[0],K));for(let Z=k[1]+1;Z<=L[1]-1;Z++){const te=z.lines.get(Z),re=z.translateBufferLineToString(Z,!0);te!=null&&te.isWrapped?G[G.length-1]+=re:G.push(re)}if(k[1]!==L[1]){const Z=z.lines.get(L[1]),te=z.translateBufferLineToString(L[1],!0,0,L[0]);Z&&Z.isWrapped?G[G.length-1]+=te:G.push(te)}}return G.map((K=>K.replace(R," "))).join(y.isWindows?`\r
279
+ `:`
280
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),y.isLinux&&k&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(k){const L=this._getMouseBufferCoords(k),z=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!!(z&&G&&L)&&this._areCoordsInSelection(L,z,G)}isCellInSelection(k,L){const z=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!(!z||!G)&&this._areCoordsInSelection([k,L],z,G)}_areCoordsInSelection(k,L,z){return k[1]>L[1]&&k[1]<z[1]||L[1]===z[1]&&k[1]===L[1]&&k[0]>=L[0]&&k[0]<z[0]||L[1]<z[1]&&k[1]===z[1]&&k[0]<z[0]||L[1]<z[1]&&k[1]===L[1]&&k[0]>=L[0]}_selectWordAtCursor(k,L){var z,G;const K=(G=(z=this._linkifier.currentLink)==null?void 0:z.link)==null?void 0:G.range;if(K)return this._model.selectionStart=[K.start.x-1,K.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(K,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const Z=this._getMouseBufferCoords(k);return!!Z&&(this._selectWordAt(Z,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,L){this._model.clearSelection(),k=Math.max(k,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const L=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(k){let L=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=z?0:(L>z&&(L-=z),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(k){return y.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const L=this._getMouseBufferCoords(k);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(k){return k.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]<z.lines.length){const G=z.lines.get(this._model.selectionEnd[1]);G&&G.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const L=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const G=(0,g.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(G,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,z=!(!k||!L||k[0]===L[0]&&k[1]===L[1]);z?k&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,L,z)):this._oldHasSelection&&this._fireOnSelectionChange(k,L,z)}_fireOnSelectionChange(k,L,z){this._oldSelectionStart=k,this._oldSelectionEnd=L,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(k,L){let z=L;for(let G=0;L>=G;G++){const K=k.loadCell(G,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:K>1&&L!==G&&(z+=K-1)}return z}setSelection(k,L,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,L],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,L,z=!0,G=!0){if(k[0]>=this._bufferService.cols)return;const K=this._bufferService.buffer,Z=K.lines.get(k[1]);if(!Z)return;const te=K.translateBufferLineToString(k[1],!1);let re=this._convertViewportColToCharacterIndex(Z,k[0]),Q=re;const de=k[0]-re;let ee=0,P=0,M=0,V=0;if(te.charAt(re)===" "){for(;re>0&&te.charAt(re-1)===" ";)re--;for(;Q<te.length&&te.charAt(Q+1)===" ";)Q++}else{let ye=k[0],Ae=k[0];Z.getWidth(ye)===0&&(ee++,ye--),Z.getWidth(Ae)===2&&(P++,Ae++);const Ne=Z.getString(Ae).length;for(Ne>1&&(V+=Ne-1,Q+=Ne-1);ye>0&&re>0&&!this._isCharWordSeparator(Z.loadCell(ye-1,this._workCell));){Z.loadCell(ye-1,this._workCell);const ie=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,ye--):ie>1&&(M+=ie-1,re-=ie-1),re--,ye--}for(;Ae<Z.length&&Q+1<te.length&&!this._isCharWordSeparator(Z.loadCell(Ae+1,this._workCell));){Z.loadCell(Ae+1,this._workCell);const ie=this._workCell.getChars().length;this._workCell.getWidth()===2?(P++,Ae++):ie>1&&(V+=ie-1,Q+=ie-1),Q++,Ae++}}Q++;let $=re+de-ee+M,H=Math.min(this._bufferService.cols,Q-re+ee+P-M-V);if(L||te.slice(re,Q).trim()!==""){if(z&&$===0&&Z.getCodePoint(0)!==32){const ye=K.lines.get(k[1]-1);if(ye&&Z.isWrapped&&ye.getCodePoint(this._bufferService.cols-1)!==32){const Ae=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(Ae){const Ne=this._bufferService.cols-Ae.start;$-=Ne,H+=Ne}}}if(G&&$+H===this._bufferService.cols&&Z.getCodePoint(this._bufferService.cols-1)!==32){const ye=K.lines.get(k[1]+1);if(ye!=null&&ye.isWrapped&&ye.getCodePoint(0)!==32){const Ae=this._getWordAt([0,k[1]+1],!1,!1,!0);Ae&&(H+=Ae.length)}}return{start:$,length:H}}}_selectWordAt(k,L){const z=this._getWordAt(k,L);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[z.start,k[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(k){const L=this._getWordAt(k,!0);if(L){let z=k[1];for(;L.start<0;)L.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,z]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const L=this._bufferService.buffer.getWrappedRangeForLine(k),z={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(z,this._bufferService.cols)}};l.SelectionService=B=f([p(3,N.IBufferService),p(4,N.ICoreService),p(5,x.IMouseService),p(6,N.IOptionsService),p(7,x.IRenderService),p(8,x.ICoreBrowserService)],B)},4725:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=d(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(c,l,d){var f=this&&this.__decorate||function(B,k,L,z){var G,K=arguments.length,Z=K<3?k:z===null?z=Object.getOwnPropertyDescriptor(k,L):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(B,k,L,z);else for(var te=B.length-1;te>=0;te--)(G=B[te])&&(Z=(K<3?G(Z):K>3?G(k,L,Z):G(k,L))||Z);return K>3&&Z&&Object.defineProperty(k,L,Z),Z},p=this&&this.__param||function(B,k){return function(L,z){k(L,z,B)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const h=d(7239),g=d(8055),b=d(8460),x=d(844),E=d(2585),v=g.css.toColor("#ffffff"),y=g.css.toColor("#000000"),_=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),N={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const B=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const z=k[L/36%6|0],G=k[L/6%6|0],K=k[L%6];B.push({css:g.channels.toCss(z,G,K),rgba:g.channels.toRgba(z,G,K)})}for(let L=0;L<24;L++){const z=8+10*L;B.push({css:g.channels.toCss(z,z,z),rgba:g.channels.toRgba(z,z,z)})}return B})());let I=l.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(B){super(),this._optionsService=B,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new b.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:y,cursor:_,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:N,selectionBackgroundOpaque:g.color.blend(y,N),selectionInactiveBackgroundTransparent:N,selectionInactiveBackgroundOpaque:g.color.blend(y,N),ansi:l.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(B={}){const k=this._colors;if(k.foreground=R(B.foreground,v),k.background=R(B.background,y),k.cursor=R(B.cursor,_),k.cursorAccent=R(B.cursorAccent,S),k.selectionBackgroundTransparent=R(B.selectionBackground,N),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=R(B.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=B.selectionForeground?R(B.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=l.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=R(B.black,l.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=R(B.red,l.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=R(B.green,l.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=R(B.yellow,l.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=R(B.blue,l.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=R(B.magenta,l.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=R(B.cyan,l.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=R(B.white,l.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=R(B.brightBlack,l.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=R(B.brightRed,l.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=R(B.brightGreen,l.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=R(B.brightYellow,l.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=R(B.brightBlue,l.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=R(B.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=R(B.brightCyan,l.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=R(B.brightWhite,l.DEFAULT_ANSI_COLORS[15]),B.extendedAnsi){const L=Math.min(k.ansi.length-16,B.extendedAnsi.length);for(let z=0;z<L;z++)k.ansi[z+16]=R(B.extendedAnsi[z],l.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(B){this._restoreColor(B),this._onChangeColors.fire(this.colors)}_restoreColor(B){if(B!==void 0)switch(B){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[B]=this._restoreColors.ansi[B]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(B){B(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 R(B,k){if(B!==void 0)try{return g.css.toColor(B)}catch{}return k}l.ThemeService=I=f([p(0,E.IOptionsService)],I)},6349:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=d(8460),p=d(844);class h extends p.Disposable{constructor(b){super(),this._maxLength=b,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(b){if(this._maxLength===b)return;const x=new Array(b);for(let E=0;E<Math.min(b,this.length);E++)x[E]=this._array[this._getCyclicIndex(E)];this._array=x,this._maxLength=b,this._startIndex=0}get length(){return this._length}set length(b){if(b>this._length)for(let x=this._length;x<b;x++)this._array[x]=void 0;this._length=b}get(b){return this._array[this._getCyclicIndex(b)]}set(b,x){this._array[this._getCyclicIndex(b)]=x}push(b){this._array[this._getCyclicIndex(this._length)]=b,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(b,x,...E){if(x){for(let v=b;v<this._length-x;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+x)];this._length-=x,this.onDeleteEmitter.fire({index:b,amount:x})}for(let v=this._length-1;v>=b;v--)this._array[this._getCyclicIndex(v+E.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<E.length;v++)this._array[this._getCyclicIndex(b+v)]=E[v];if(E.length&&this.onInsertEmitter.fire({index:b,amount:E.length}),this._length+E.length>this._maxLength){const v=this._length+E.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=E.length}trimStart(b){b>this._length&&(b=this._length),this._startIndex+=b,this._length-=b,this.onTrimEmitter.fire(b)}shiftElements(b,x,E){if(!(x<=0)){if(b<0||b>=this._length)throw new Error("start argument out of range");if(b+E<0)throw new Error("Cannot shift elements in list beyond index 0");if(E>0){for(let y=x-1;y>=0;y--)this.set(b+y+E,this.get(b+y));const v=b+x+E-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<x;v++)this.set(b+v+E,this.get(b+v))}}_getCyclicIndex(b){return(this._startIndex+b)%this._maxLength}}l.CircularList=h},1439:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(f,p=5){if(typeof f!="object")return f;const h=Array.isArray(f)?[]:{};for(const g in f)h[g]=p<=1?f[g]:f[g]&&d(f[g],p-1);return h}},8055:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,f=0,p=0,h=0;var g,b,x,E,v;function y(S){const N=S.toString(16);return N.length<2?"0"+N:N}function _(S,N){return S<N?(N+.05)/(S+.05):(S+.05)/(N+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(N,I,R,B){return B!==void 0?`#${y(N)}${y(I)}${y(R)}${y(B)}`:`#${y(N)}${y(I)}${y(R)}`},S.toRgba=function(N,I,R,B=255){return(N<<24|I<<16|R<<8|B)>>>0},S.toColor=function(N,I,R,B){return{css:S.toCss(N,I,R,B),rgba:S.toRgba(N,I,R,B)}}})(g||(l.channels=g={})),(function(S){function N(I,R){return h=Math.round(255*R),[d,f,p]=v.toChannels(I.rgba),{css:g.toCss(d,f,p,h),rgba:g.toRgba(d,f,p,h)}}S.blend=function(I,R){if(h=(255&R.rgba)/255,h===1)return{css:R.css,rgba:R.rgba};const B=R.rgba>>24&255,k=R.rgba>>16&255,L=R.rgba>>8&255,z=I.rgba>>24&255,G=I.rgba>>16&255,K=I.rgba>>8&255;return d=z+Math.round((B-z)*h),f=G+Math.round((k-G)*h),p=K+Math.round((L-K)*h),{css:g.toCss(d,f,p),rgba:g.toRgba(d,f,p)}},S.isOpaque=function(I){return(255&I.rgba)==255},S.ensureContrastRatio=function(I,R,B){const k=v.ensureContrastRatio(I.rgba,R.rgba,B);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},S.opaque=function(I){const R=(255|I.rgba)>>>0;return[d,f,p]=v.toChannels(R),{css:g.toCss(d,f,p),rgba:R}},S.opacity=N,S.multiplyOpacity=function(I,R){return h=255&I.rgba,N(I,h*R/255)},S.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(b||(l.color=b={})),(function(S){let N,I;try{const R=document.createElement("canvas");R.width=1,R.height=1;const B=R.getContext("2d",{willReadFrequently:!0});B&&(N=B,N.globalCompositeOperation="copy",I=N.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),g.toColor(d,f,p);case 5:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),h=parseInt(R.slice(4,5).repeat(2),16),g.toColor(d,f,p,h);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const B=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(B)return d=parseInt(B[1]),f=parseInt(B[2]),p=parseInt(B[3]),h=Math.round(255*(B[5]===void 0?1:parseFloat(B[5]))),g.toColor(d,f,p,h);if(!N||!I)throw new Error("css.toColor: Unsupported css format");if(N.fillStyle=I,N.fillStyle=R,typeof N.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(N.fillRect(0,0,1,1),[d,f,p,h]=N.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(d,f,p,h),css:R}}})(x||(l.css=x={})),(function(S){function N(I,R,B){const k=I/255,L=R/255,z=B/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(I){return N(I>>16&255,I>>8&255,255&I)},S.relativeLuminance2=N})(E||(l.rgb=E={})),(function(S){function N(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K>0||Z>0||te>0);)K-=Math.max(0,Math.ceil(.1*K)),Z-=Math.max(0,Math.ceil(.1*Z)),te-=Math.max(0,Math.ceil(.1*te)),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}function I(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K<255||Z<255||te<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),Z=Math.min(255,Z+Math.ceil(.1*(255-Z))),te=Math.min(255,te+Math.ceil(.1*(255-te))),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}S.blend=function(R,B){if(h=(255&B)/255,h===1)return B;const k=B>>24&255,L=B>>16&255,z=B>>8&255,G=R>>24&255,K=R>>16&255,Z=R>>8&255;return d=G+Math.round((k-G)*h),f=K+Math.round((L-K)*h),p=Z+Math.round((z-Z)*h),g.toRgba(d,f,p)},S.ensureContrastRatio=function(R,B,k){const L=E.relativeLuminance(R>>8),z=E.relativeLuminance(B>>8);if(_(L,z)<k){if(z<L){const Z=N(R,B,k),te=_(L,E.relativeLuminance(Z>>8));if(te<k){const re=I(R,B,k);return te>_(L,E.relativeLuminance(re>>8))?Z:re}return Z}const G=I(R,B,k),K=_(L,E.relativeLuminance(G>>8));if(K<k){const Z=N(R,B,k);return K>_(L,E.relativeLuminance(Z>>8))?G:Z}return G}},S.reduceLuminance=N,S.increaseLuminance=I,S.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(v||(l.rgba=v={})),l.toPaddedHex=y,l.contrastRatio=_},8969:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=d(844),p=d(2585),h=d(4348),g=d(7866),b=d(744),x=d(7302),E=d(6975),v=d(8460),y=d(1753),_=d(1480),S=d(7994),N=d(9282),I=d(5435),R=d(5981),B=d(2660);let k=!1;class L extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((G=>{var K;(K=this._onScrollApi)==null||K.fire(G.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(G){for(const K in G)this.optionsService.options[K]=G[K]}constructor(G){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new x.OptionsService(G)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(b.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(E.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(B.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new I.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.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((K=>{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((K=>{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 R.WriteBuffer(((K,Z)=>this._inputHandler.parse(K,Z)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(G,K){this._writeBuffer.write(G,K)}writeSync(G,K){this._logService.logLevel<=p.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(G,K)}input(G,K=!0){this.coreService.triggerDataEvent(G,K)}resize(G,K){isNaN(G)||isNaN(K)||(G=Math.max(G,b.MINIMUM_COLS),K=Math.max(K,b.MINIMUM_ROWS),this._bufferService.resize(G,K))}scroll(G,K=!1){this._bufferService.scroll(G,K)}scrollLines(G,K,Z){this._bufferService.scrollLines(G,K,Z)}scrollPages(G){this.scrollLines(G*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(G){const K=G-this._bufferService.buffer.ydisp;K!==0&&this.scrollLines(K)}registerEscHandler(G,K){return this._inputHandler.registerEscHandler(G,K)}registerDcsHandler(G,K){return this._inputHandler.registerDcsHandler(G,K)}registerCsiHandler(G,K){return this._inputHandler.registerCsiHandler(G,K)}registerOscHandler(G,K){return this._inputHandler.registerOscHandler(G,K)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let G=!1;const K=this.optionsService.rawOptions.windowsPty;K&&K.buildNumber!==void 0&&K.buildNumber!==void 0?G=K.backend==="conpty"&&K.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(G=!0),G?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const G=[];G.push(this.onLineFeed(N.updateWindowsModeWrappedState.bind(null,this._bufferService))),G.push(this.registerCsiHandler({final:"H"},(()=>((0,N.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const K of G)K.dispose()}))}}}l.CoreTerminal=L},8460:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let h=0;h<this._listeners.length;h++)p.push(this._listeners[h]);for(let h=0;h<p.length;h++)p[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((p=>f.fire(p)))},l.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},5435:function(c,l,d){var f=this&&this.__decorate||function(ee,P,M,V){var $,H=arguments.length,ye=H<3?P:V===null?V=Object.getOwnPropertyDescriptor(P,M):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ye=Reflect.decorate(ee,P,M,V);else for(var Ae=ee.length-1;Ae>=0;Ae--)($=ee[Ae])&&(ye=(H<3?$(ye):H>3?$(P,M,ye):$(P,M))||ye);return H>3&&ye&&Object.defineProperty(P,M,ye),ye},p=this&&this.__param||function(ee,P){return function(M,V){P(M,V,ee)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const h=d(2584),g=d(7116),b=d(2015),x=d(844),E=d(482),v=d(8437),y=d(8460),_=d(643),S=d(511),N=d(3734),I=d(2585),R=d(1480),B=d(6242),k=d(6351),L=d(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},G=131072;function K(ee,P){if(ee>24)return P.setWinLines||!1;switch(ee){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var Z;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(Z||(l.WindowsOptionsReportType=Z={}));let te=0;class re extends x.Disposable{getAttrData(){return this._curAttrData}constructor(P,M,V,$,H,ye,Ae,Ne,ie=new b.EscapeSequenceParser){super(),this._bufferService=P,this._charsetService=M,this._coreService=V,this._logService=$,this._optionsService=H,this._oscLinkService=ye,this._coreMouseService=Ae,this._unicodeService=Ne,this._parser=ie,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new E.StringToUtf32,this._utf8Decoder=new E.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.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 Q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((J=>this._activeBuffer=J.activeBuffer))),this._parser.setCsiHandlerFallback(((J,fe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(J),params:fe.toArray()})})),this._parser.setEscHandlerFallback((J=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(J)})})),this._parser.setExecuteHandlerFallback((J=>{this._logService.debug("Unknown EXECUTE code: ",{code:J})})),this._parser.setOscHandlerFallback(((J,fe,Te)=>{this._logService.debug("Unknown OSC code: ",{identifier:J,action:fe,data:Te})})),this._parser.setDcsHandlerFallback(((J,fe,Te)=>{fe==="HOOK"&&(Te=Te.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(J),action:fe,payload:Te})})),this._parser.setPrintHandler(((J,fe,Te)=>this.print(J,fe,Te))),this._parser.registerCsiHandler({final:"@"},(J=>this.insertChars(J))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(J=>this.scrollLeft(J))),this._parser.registerCsiHandler({final:"A"},(J=>this.cursorUp(J))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(J=>this.scrollRight(J))),this._parser.registerCsiHandler({final:"B"},(J=>this.cursorDown(J))),this._parser.registerCsiHandler({final:"C"},(J=>this.cursorForward(J))),this._parser.registerCsiHandler({final:"D"},(J=>this.cursorBackward(J))),this._parser.registerCsiHandler({final:"E"},(J=>this.cursorNextLine(J))),this._parser.registerCsiHandler({final:"F"},(J=>this.cursorPrecedingLine(J))),this._parser.registerCsiHandler({final:"G"},(J=>this.cursorCharAbsolute(J))),this._parser.registerCsiHandler({final:"H"},(J=>this.cursorPosition(J))),this._parser.registerCsiHandler({final:"I"},(J=>this.cursorForwardTab(J))),this._parser.registerCsiHandler({final:"J"},(J=>this.eraseInDisplay(J,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(J=>this.eraseInDisplay(J,!0))),this._parser.registerCsiHandler({final:"K"},(J=>this.eraseInLine(J,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(J=>this.eraseInLine(J,!0))),this._parser.registerCsiHandler({final:"L"},(J=>this.insertLines(J))),this._parser.registerCsiHandler({final:"M"},(J=>this.deleteLines(J))),this._parser.registerCsiHandler({final:"P"},(J=>this.deleteChars(J))),this._parser.registerCsiHandler({final:"S"},(J=>this.scrollUp(J))),this._parser.registerCsiHandler({final:"T"},(J=>this.scrollDown(J))),this._parser.registerCsiHandler({final:"X"},(J=>this.eraseChars(J))),this._parser.registerCsiHandler({final:"Z"},(J=>this.cursorBackwardTab(J))),this._parser.registerCsiHandler({final:"`"},(J=>this.charPosAbsolute(J))),this._parser.registerCsiHandler({final:"a"},(J=>this.hPositionRelative(J))),this._parser.registerCsiHandler({final:"b"},(J=>this.repeatPrecedingCharacter(J))),this._parser.registerCsiHandler({final:"c"},(J=>this.sendDeviceAttributesPrimary(J))),this._parser.registerCsiHandler({prefix:">",final:"c"},(J=>this.sendDeviceAttributesSecondary(J))),this._parser.registerCsiHandler({final:"d"},(J=>this.linePosAbsolute(J))),this._parser.registerCsiHandler({final:"e"},(J=>this.vPositionRelative(J))),this._parser.registerCsiHandler({final:"f"},(J=>this.hVPosition(J))),this._parser.registerCsiHandler({final:"g"},(J=>this.tabClear(J))),this._parser.registerCsiHandler({final:"h"},(J=>this.setMode(J))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(J=>this.setModePrivate(J))),this._parser.registerCsiHandler({final:"l"},(J=>this.resetMode(J))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(J=>this.resetModePrivate(J))),this._parser.registerCsiHandler({final:"m"},(J=>this.charAttributes(J))),this._parser.registerCsiHandler({final:"n"},(J=>this.deviceStatus(J))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(J=>this.deviceStatusPrivate(J))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(J=>this.softReset(J))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(J=>this.setCursorStyle(J))),this._parser.registerCsiHandler({final:"r"},(J=>this.setScrollRegion(J))),this._parser.registerCsiHandler({final:"s"},(J=>this.saveCursor(J))),this._parser.registerCsiHandler({final:"t"},(J=>this.windowOptions(J))),this._parser.registerCsiHandler({final:"u"},(J=>this.restoreCursor(J))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(J=>this.insertColumns(J))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(J=>this.deleteColumns(J))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(J=>this.selectProtected(J))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(J=>this.requestMode(J,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(J=>this.requestMode(J,!1))),this._parser.setExecuteHandler(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 B.OscHandler((J=>(this.setTitle(J),this.setIconName(J),!0)))),this._parser.registerOscHandler(1,new B.OscHandler((J=>this.setIconName(J)))),this._parser.registerOscHandler(2,new B.OscHandler((J=>this.setTitle(J)))),this._parser.registerOscHandler(4,new B.OscHandler((J=>this.setOrReportIndexedColor(J)))),this._parser.registerOscHandler(8,new B.OscHandler((J=>this.setHyperlink(J)))),this._parser.registerOscHandler(10,new B.OscHandler((J=>this.setOrReportFgColor(J)))),this._parser.registerOscHandler(11,new B.OscHandler((J=>this.setOrReportBgColor(J)))),this._parser.registerOscHandler(12,new B.OscHandler((J=>this.setOrReportCursorColor(J)))),this._parser.registerOscHandler(104,new B.OscHandler((J=>this.restoreIndexedColor(J)))),this._parser.registerOscHandler(110,new B.OscHandler((J=>this.restoreFgColor(J)))),this._parser.registerOscHandler(111,new B.OscHandler((J=>this.restoreBgColor(J)))),this._parser.registerOscHandler(112,new B.OscHandler((J=>this.restoreCursorColor(J)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const J in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:J},(()=>this.selectCharset("("+J))),this._parser.registerEscHandler({intermediates:")",final:J},(()=>this.selectCharset(")"+J))),this._parser.registerEscHandler({intermediates:"*",final:J},(()=>this.selectCharset("*"+J))),this._parser.registerEscHandler({intermediates:"+",final:J},(()=>this.selectCharset("+"+J))),this._parser.registerEscHandler({intermediates:"-",final:J},(()=>this.selectCharset("-"+J))),this._parser.registerEscHandler({intermediates:".",final:J},(()=>this.selectCharset("."+J))),this._parser.registerEscHandler({intermediates:"/",final:J},(()=>this.selectCharset("/"+J)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((J=>(this._logService.error("Parsing error: ",J),J))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((J,fe)=>this.requestStatusString(J,fe))))}_preserveStack(P,M,V,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=P,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=V,this._parseStack.position=$}_logSlowResolvingAsync(P){this._logService.logLevel<=I.LogLevelEnum.WARN&&Promise.race([P,new Promise(((M,V)=>setTimeout((()=>V("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(P,M){let V,$=this._activeBuffer.x,H=this._activeBuffer.y,ye=0;const Ae=this._parseStack.paused;if(Ae){if(V=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(V),V;$=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,P.length>G&&(ye=this._parseStack.position+G)}if(this._logService.logLevel<=I.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof P=="string"?` "${P}"`:` "${Array.prototype.map.call(P,(J=>String.fromCharCode(J))).join("")}"`),typeof P=="string"?P.split("").map((J=>J.charCodeAt(0))):P),this._parseBuffer.length<P.length&&this._parseBuffer.length<G&&(this._parseBuffer=new Uint32Array(Math.min(P.length,G))),Ae||this._dirtyRowTracker.clearRange(),P.length>G)for(let J=ye;J<P.length;J+=G){const fe=J+G<P.length?J+G:P.length,Te=typeof P=="string"?this._stringDecoder.decode(P.substring(J,fe),this._parseBuffer):this._utf8Decoder.decode(P.subarray(J,fe),this._parseBuffer);if(V=this._parser.parse(this._parseBuffer,Te))return this._preserveStack($,H,Te,J),this._logSlowResolvingAsync(V),V}else if(!Ae){const J=typeof P=="string"?this._stringDecoder.decode(P,this._parseBuffer):this._utf8Decoder.decode(P,this._parseBuffer);if(V=this._parser.parse(this._parseBuffer,J))return this._preserveStack($,H,J,0),this._logSlowResolvingAsync(V),V}this._activeBuffer.x===$&&this._activeBuffer.y===H||this._onCursorMove.fire();const Ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),ie=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);ie<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(ie,this._bufferService.rows-1),Math.min(Ne,this._bufferService.rows-1))}print(P,M,V){let $,H;const ye=this._charsetService.charset,Ae=this._optionsService.rawOptions.screenReaderMode,Ne=this._bufferService.cols,ie=this._coreService.decPrivateModes.wraparound,J=this._coreService.modes.insertMode,fe=this._curAttrData;let Te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&V-M>0&&Te.getWidth(this._activeBuffer.x-1)===2&&Te.setCellFromCodepoint(this._activeBuffer.x-1,0,1,fe);let We=this._parser.precedingJoinState;for(let Me=M;Me<V;++Me){if($=P[Me],$<127&&ye){const en=ye[String.fromCharCode($)];en&&($=en.charCodeAt(0))}const it=this._unicodeService.charProperties($,We);H=R.UnicodeService.extractWidth(it);const Ct=R.UnicodeService.extractShouldJoin(it),St=Ct?R.UnicodeService.extractWidth(We):0;if(We=it,Ae&&this._onA11yChar.fire((0,E.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-St>Ne){if(ie){const en=Te;let rt=this._activeBuffer.x-St;for(this._activeBuffer.x=St,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),Te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),St>0&&Te instanceof v.BufferLine&&Te.copyCellsFrom(en,rt,0,St,!1);rt<Ne;)en.setCellFromCodepoint(rt++,0,1,fe)}else if(this._activeBuffer.x=Ne-1,H===2)continue}if(Ct&&this._activeBuffer.x){const en=Te.getWidth(this._activeBuffer.x-1)?1:2;Te.addCodepointToCell(this._activeBuffer.x-en,$,H);for(let rt=H-St;--rt>=0;)Te.setCellFromCodepoint(this._activeBuffer.x++,0,0,fe)}else if(J&&(Te.insertCells(this._activeBuffer.x,H-St,this._activeBuffer.getNullCell(fe)),Te.getWidth(Ne-1)===2&&Te.setCellFromCodepoint(Ne-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,fe)),Te.setCellFromCodepoint(this._activeBuffer.x++,$,H,fe),H>0)for(;--H;)Te.setCellFromCodepoint(this._activeBuffer.x++,0,0,fe)}this._parser.precedingJoinState=We,this._activeBuffer.x<Ne&&V-M>0&&Te.getWidth(this._activeBuffer.x)===0&&!Te.hasContent(this._activeBuffer.x)&&Te.setCellFromCodepoint(this._activeBuffer.x,0,1,fe),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(P,M){return P.final!=="t"||P.prefix||P.intermediates?this._parser.registerCsiHandler(P,M):this._parser.registerCsiHandler(P,(V=>!K(V.params[0],this._optionsService.rawOptions.windowOptions)||M(V)))}registerDcsHandler(P,M){return this._parser.registerDcsHandler(P,new k.DcsHandler(M))}registerEscHandler(P,M){return this._parser.registerEscHandler(P,M)}registerOscHandler(P,M){return this._parser.registerOscHandler(P,new B.OscHandler(M))}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 P;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&&(P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&P.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const P=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-P),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(P=this._bufferService.cols-1){this._activeBuffer.x=Math.min(P,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(P,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=P,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=P,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(P,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+P,this._activeBuffer.y+M)}cursorUp(P){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,P.params[0]||1)):this._moveCursor(0,-(P.params[0]||1)),!0}cursorDown(P){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,P.params[0]||1)):this._moveCursor(0,P.params[0]||1),!0}cursorForward(P){return this._moveCursor(P.params[0]||1,0),!0}cursorBackward(P){return this._moveCursor(-(P.params[0]||1),0),!0}cursorNextLine(P){return this.cursorDown(P),this._activeBuffer.x=0,!0}cursorPrecedingLine(P){return this.cursorUp(P),this._activeBuffer.x=0,!0}cursorCharAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(P){return this._setCursor(P.length>=2?(P.params[1]||1)-1:0,(P.params[0]||1)-1),!0}charPosAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(P){return this._moveCursor(P.params[0]||1,0),!0}linePosAbsolute(P){return this._setCursor(this._activeBuffer.x,(P.params[0]||1)-1),!0}vPositionRelative(P){return this._moveCursor(0,P.params[0]||1),!0}hVPosition(P){return this.cursorPosition(P),!0}tabClear(P){const M=P.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=P.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=P.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(P){const M=P.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(P,M,V,$=!1,H=!1){const ye=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);ye.replaceCells(M,V,this._activeBuffer.getNullCell(this._eraseAttrData()),H),$&&(ye.isWrapped=!1)}_resetBufferLine(P,M=!1){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);V&&(V.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+P),V.isWrapped=!1)}eraseInDisplay(P,M=!1){let V;switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:for(V=this._activeBuffer.y,this._dirtyRowTracker.markDirty(V),this._eraseInBufferLine(V++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);V<this._bufferService.rows;V++)this._resetBufferLine(V,M);this._dirtyRowTracker.markDirty(V);break;case 1:for(V=this._activeBuffer.y,this._dirtyRowTracker.markDirty(V),this._eraseInBufferLine(V,0,this._activeBuffer.x+1,!0,M),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(V+1).isWrapped=!1);V--;)this._resetBufferLine(V,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(V=this._bufferService.rows,this._dirtyRowTracker.markDirty(V-1);V--;)this._resetBufferLine(V,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(P,M=!1){switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(P){this._restrictCursor();let M=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const V=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;M--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(P){this._restrictCursor();let M=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const V=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;M--;)this._activeBuffer.lines.splice(V,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(P){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.insertCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(P){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.deleteCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(P){let M=P.params[0]||1;for(;M--;)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(P){let M=P.params[0]||1;for(;M--;)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(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.deleteCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.insertCells(0,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.insertCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=P.params[0]||1;for(let V=this._activeBuffer.scrollTop;V<=this._activeBuffer.scrollBottom;++V){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+V);$.deleteCells(this._activeBuffer.x,M,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(P){this._restrictCursor();const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return M&&(M.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(P.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(P){const M=this._parser.precedingJoinState;if(!M)return!0;const V=P.params[0]||1,$=R.UnicodeService.extractWidth(M),H=this._activeBuffer.x-$,ye=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),Ae=new Uint32Array(ye.length*V);let Ne=0;for(let J=0;J<ye.length;){const fe=ye.codePointAt(J)||0;Ae[Ne++]=fe,J+=fe>65535?2:1}let ie=Ne;for(let J=1;J<V;++J)Ae.copyWithin(ie,0,Ne),ie+=Ne;return this.print(Ae,0,ie),!0}sendDeviceAttributesPrimary(P){return P.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(P){return P.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(P.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(P){return(this._optionsService.rawOptions.termName+"").indexOf(P)===0}setMode(P){for(let M=0;M<P.length;M++)switch(P.params[M]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(P){for(let M=0;M<P.length;M++)switch(P.params[M]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(P){for(let M=0;M<P.length;M++)switch(P.params[M]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(P){for(let M=0;M<P.length;M++)switch(P.params[M]){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(),P.params[M]===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(P,M){const V=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:H}=this._coreMouseService,ye=this._coreService,{buffers:Ae,cols:Ne}=this._bufferService,{active:ie,alt:J}=Ae,fe=this._optionsService.rawOptions,Te=Ct=>Ct?1:2,We=P.params[0];return Me=We,it=M?We===2?4:We===4?Te(ye.modes.insertMode):We===12?3:We===20?Te(fe.convertEol):0:We===1?Te(V.applicationCursorKeys):We===3?fe.windowOptions.setWinLines?Ne===80?2:Ne===132?1:0:0:We===6?Te(V.origin):We===7?Te(V.wraparound):We===8?3:We===9?Te($==="X10"):We===12?Te(fe.cursorBlink):We===25?Te(!ye.isCursorHidden):We===45?Te(V.reverseWraparound):We===66?Te(V.applicationKeypad):We===67?4:We===1e3?Te($==="VT200"):We===1002?Te($==="DRAG"):We===1003?Te($==="ANY"):We===1004?Te(V.sendFocus):We===1005?4:We===1006?Te(H==="SGR"):We===1015?4:We===1016?Te(H==="SGR_PIXELS"):We===1048?1:We===47||We===1047||We===1049?Te(ie===J):We===2004?Te(V.bracketedPasteMode):0,ye.triggerDataEvent(`${h.C0.ESC}[${M?"":"?"}${Me};${it}$y`),!0;var Me,it}_updateAttrColor(P,M,V,$,H){return M===2?(P|=50331648,P&=-16777216,P|=N.AttributeData.fromColorRGB([V,$,H])):M===5&&(P&=-50331904,P|=33554432|255&V),P}_extractColor(P,M,V){const $=[0,0,-1,0,0,0];let H=0,ye=0;do{if($[ye+H]=P.params[M+ye],P.hasSubParams(M+ye)){const Ae=P.getSubParams(M+ye);let Ne=0;do $[1]===5&&(H=1),$[ye+Ne+1+H]=Ae[Ne];while(++Ne<Ae.length&&Ne+ye+1+H<$.length);break}if($[1]===5&&ye+H>=2||$[1]===2&&ye+H>=5)break;$[1]&&(H=1)}while(++ye+M<P.length&&ye+H<$.length);for(let Ae=2;Ae<$.length;++Ae)$[Ae]===-1&&($[Ae]=0);switch($[0]){case 38:V.fg=this._updateAttrColor(V.fg,$[1],$[3],$[4],$[5]);break;case 48:V.bg=this._updateAttrColor(V.bg,$[1],$[3],$[4],$[5]);break;case 58:V.extended=V.extended.clone(),V.extended.underlineColor=this._updateAttrColor(V.extended.underlineColor,$[1],$[3],$[4],$[5])}return ye}_processUnderline(P,M){M.extended=M.extended.clone(),(!~P||P>5)&&(P=1),M.extended.underlineStyle=P,M.fg|=268435456,P===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(P){P.fg=v.DEFAULT_ATTR_DATA.fg,P.bg=v.DEFAULT_ATTR_DATA.bg,P.extended=P.extended.clone(),P.extended.underlineStyle=0,P.extended.underlineColor&=-67108864,P.updateExtended()}charAttributes(P){if(P.length===1&&P.params[0]===0)return this._processSGR0(this._curAttrData),!0;const M=P.length;let V;const $=this._curAttrData;for(let H=0;H<M;H++)V=P.params[H],V>=30&&V<=37?($.fg&=-50331904,$.fg|=16777216|V-30):V>=40&&V<=47?($.bg&=-50331904,$.bg|=16777216|V-40):V>=90&&V<=97?($.fg&=-50331904,$.fg|=16777224|V-90):V>=100&&V<=107?($.bg&=-50331904,$.bg|=16777224|V-100):V===0?this._processSGR0($):V===1?$.fg|=134217728:V===3?$.bg|=67108864:V===4?($.fg|=268435456,this._processUnderline(P.hasSubParams(H)?P.getSubParams(H)[0]:1,$)):V===5?$.fg|=536870912:V===7?$.fg|=67108864:V===8?$.fg|=1073741824:V===9?$.fg|=2147483648:V===2?$.bg|=134217728:V===21?this._processUnderline(2,$):V===22?($.fg&=-134217729,$.bg&=-134217729):V===23?$.bg&=-67108865:V===24?($.fg&=-268435457,this._processUnderline(0,$)):V===25?$.fg&=-536870913:V===27?$.fg&=-67108865:V===28?$.fg&=-1073741825:V===29?$.fg&=2147483647:V===39?($.fg&=-67108864,$.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):V===49?($.bg&=-67108864,$.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):V===38||V===48||V===58?H+=this._extractColor(P,H,$):V===53?$.bg|=1073741824:V===55?$.bg&=-1073741825:V===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):V===100?($.fg&=-67108864,$.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",V);return!0}deviceStatus(P){switch(P.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,V=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${M};${V}R`)}return!0}deviceStatusPrivate(P){if(P.params[0]===6){const M=this._activeBuffer.y+1,V=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${M};${V}R`)}return!0}softReset(P){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.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(P){const M=P.params[0]||1;switch(M){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 V=M%2==1;return this._optionsService.options.cursorBlink=V,!0}setScrollRegion(P){const M=P.params[0]||1;let V;return(P.length<2||(V=P.params[1])>this._bufferService.rows||V===0)&&(V=this._bufferService.rows),V>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=V-1,this._setCursor(0,0)),!0}windowOptions(P){if(!K(P.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=P.length>1?P.params[1]:0;switch(P.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(Z.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(Z.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:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(P){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(P){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(P){return this._windowTitle=P,this._onTitleChange.fire(P),!0}setIconName(P){return this._iconName=P,!0}setOrReportIndexedColor(P){const M=[],V=P.split(";");for(;V.length>1;){const $=V.shift(),H=V.shift();if(/^\d+$/.exec($)){const ye=parseInt($);if(de(ye))if(H==="?")M.push({type:0,index:ye});else{const Ae=(0,L.parseColor)(H);Ae&&M.push({type:1,index:ye,color:Ae})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(P){const M=P.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(P,M){this._getCurrentLinkId()&&this._finishHyperlink();const V=P.split(":");let $;const H=V.findIndex((ye=>ye.startsWith("id=")));return H!==-1&&($=V[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(P,M){const V=P.split(";");for(let $=0;$<V.length&&!(M>=this._specialColors.length);++$,++M)if(V[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const H=(0,L.parseColor)(V[$]);H&&this._onColor.fire([{type:1,index:this._specialColors[M],color:H}])}return!0}setOrReportFgColor(P){return this._setOrReportSpecialColor(P,0)}setOrReportBgColor(P){return this._setOrReportSpecialColor(P,1)}setOrReportCursorColor(P){return this._setOrReportSpecialColor(P,2)}restoreIndexedColor(P){if(!P)return this._onColor.fire([{type:2}]),!0;const M=[],V=P.split(";");for(let $=0;$<V.length;++$)if(/^\d+$/.exec(V[$])){const H=parseInt(V[$]);de(H)&&M.push({type:2,index:H})}return M.length&&this._onColor.fire(M),!0}restoreFgColor(P){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(P){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(P){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,g.DEFAULT_CHARSET),!0}selectCharset(P){return P.length!==2?(this.selectDefaultCharset(),!0):(P[0]==="/"||this._charsetService.setgCharset(z[P[0]],g.CHARSETS[P[1]]||g.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const P=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,P,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=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(P){return this._charsetService.setgLevel(P),!0}screenAlignmentPattern(){const P=new S.CellData;P.content=4194373,P.fg=this._curAttrData.fg,P.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M<this._bufferService.rows;++M){const V=this._activeBuffer.ybase+this._activeBuffer.y+M,$=this._activeBuffer.lines.get(V);$&&($.fill(P),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(P,M){const V=this._bufferService.buffer,$=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${H}${h.C0.ESC}\\`),!0))(P==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:P==='"p'?'P1$r61;1"p':P==="r"?`P1$r${V.scrollTop+1};${V.scrollBottom+1}r`:P==="m"?"P1$r0m":P===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(P,M){this._dirtyRowTracker.markRangeDirty(P,M)}}l.InputHandler=re;let Q=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){ee<this.start?this.start=ee:ee>this.end&&(this.end=ee)}markRangeDirty(ee,P){ee>P&&(te=ee,ee=P,P=te),ee<this.start&&(this.start=ee),P>this.end&&(this.end=P)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function de(ee){return 0<=ee&&ee<256}Q=f([p(0,I.IBufferService)],Q)},844:(c,l)=>{function d(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=d,l.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(p,h,g){this._data[p]||(this._data[p]={}),this._data[p][h]=g}get(p,h){return this._data[p]?this._data[p][h]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(f,p,h,g,b){this._data.get(f,p)||this._data.set(f,p,new d),this._data.get(f,p).set(h,g,b)}get(f,p,h,g){var b;return(b=this._data.get(f,p))==null?void 0:b.get(h,g)}clear(){this._data.clear()}}},6114:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const d=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const p=d.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(d)},6106:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(d=this._search(this._getKey(f)),this._array.splice(d,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(d=this._search(p),d===-1)||this._getKey(this._array[d])!==p)return!1;do if(this._array[d]===f)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===p);return!1}*getKeyIterator(f){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===f)}forEachByKey(f,p){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do p(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===f)}values(){return[...this._array].values()}_search(f){let p=0,h=this._array.length-1;for(;h>=p;){let g=p+h>>1;const b=this._getKey(this._array[g]);if(b>f)h=g-1;else{if(!(b<f)){for(;g>0&&this._getKey(this._array[g-1])===f;)g--;return g}p=g+1}}return p}}},7226:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=d(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(b){this._tasks.push(b),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(b){this._idleCallback=void 0;let x=0,E=0,v=b.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(x=Date.now(),this._tasks[this._i]()||this._i++,x=Math.max(1,Date.now()-x),E=Math.max(x,E),y=b.timeRemaining(),1.5*E>y)return v-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-x))}ms`),void this._start();v=y}this.clear()}}class h extends p{_requestCallback(b){return setTimeout((()=>b(this._createDeadline(16))))}_cancelCallback(b){clearTimeout(b)}_createDeadline(b){const x=Date.now()+b;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}l.PriorityTaskQueue=h,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:h,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=d(643);l.updateWindowsModeWrappedState=function(p){const h=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),g=h==null?void 0:h.get(p.cols-1),b=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);b&&g&&(b.isWrapped=g[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&g[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 d;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}}l.AttributeData=d;class f{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,g=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=g}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=d(6349),p=d(7226),h=d(3734),g=d(8437),b=d(4634),x=d(511),E=d(643),v=d(4863),y=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(_,S,N){this._hasScrollback=_,this._optionsService=S,this._bufferService=N,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,E.NULL_CELL_CHAR,E.NULL_CELL_WIDTH,E.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,E.WHITESPACE_CELL_CHAR,E.WHITESPACE_CELL_WIDTH,E.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg,this._nullCell.extended=_.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg,this._whitespaceCell.extended=_.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(_,S){return new g.BufferLine(this._bufferService.cols,this.getNullCell(_),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const _=this.ybase+this.y-this.ydisp;return _>=0&&_<this._rows}_getCorrectBufferLength(_){if(!this._hasScrollback)return _;const S=_+this._optionsService.rawOptions.scrollback;return S>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(_){if(this.lines.length===0){_===void 0&&(_=g.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(_))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(_,S){const N=this.getNullCell(g.DEFAULT_ATTR_DATA);let I=0;const R=this._getCorrectBufferLength(S);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<_)for(let k=0;k<this.lines.length;k++)I+=+this.lines.get(k).resize(_,N);let B=0;if(this._rows<S)for(let k=this._rows;k<S;k++)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 g.BufferLine(_,N)):this.ybase>0&&this.lines.length<=this.ybase+this.y+B+1?(this.ybase--,B++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(_,N)));else for(let k=this._rows;k>S;k--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const k=this.lines.length-R;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=R}this.x=Math.min(this.x,_-1),this.y=Math.min(this.y,S-1),B&&(this.y+=B),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(_,S),this._cols>_))for(let B=0;B<this.lines.length;B++)I+=+this.lines.get(B).resize(_,N);this._cols=_,this._rows=S,this._memoryCleanupQueue.clear(),I>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let _=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,_=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return _}get _isReflowEnabled(){const _=this._optionsService.rawOptions.windowsPty;return _&&_.buildNumber?this._hasScrollback&&_.backend==="conpty"&&_.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(_,S){this._cols!==_&&(_>this._cols?this._reflowLarger(_,S):this._reflowSmaller(_,S))}_reflowLarger(_,S){const N=(0,b.reflowLargerGetLinesToRemove)(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(N.length>0){const I=(0,b.reflowLargerCreateNewLayout)(this.lines,N);(0,b.reflowLargerApplyNewLayout)(this.lines,I.layout),this._reflowLargerAdjustViewport(_,S,I.countRemoved)}}_reflowLargerAdjustViewport(_,S,N){const I=this.getNullCell(g.DEFAULT_ATTR_DATA);let R=N;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new g.BufferLine(_,I))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-N,0)}_reflowSmaller(_,S){const N=this.getNullCell(g.DEFAULT_ATTR_DATA),I=[];let R=0;for(let B=this.lines.length-1;B>=0;B--){let k=this.lines.get(B);if(!k||!k.isWrapped&&k.getTrimmedLength()<=_)continue;const L=[k];for(;k.isWrapped&&B>0;)k=this.lines.get(--B),L.unshift(k);const z=this.ybase+this.y;if(z>=B&&z<B+L.length)continue;const G=L[L.length-1].getTrimmedLength(),K=(0,b.reflowSmallerGetNewLineLengths)(L,this._cols,_),Z=K.length-L.length;let te;te=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+Z):Math.max(0,this.lines.length-this.lines.maxLength+Z);const re=[];for(let V=0;V<Z;V++){const $=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);re.push($)}re.length>0&&(I.push({start:B+L.length+R,newLines:re}),R+=re.length),L.push(...re);let Q=K.length-1,de=K[Q];de===0&&(Q--,de=K[Q]);let ee=L.length-Z-1,P=G;for(;ee>=0;){const V=Math.min(P,de);if(L[Q]===void 0)break;if(L[Q].copyCellsFrom(L[ee],P-V,de-V,V,!0),de-=V,de===0&&(Q--,de=K[Q]),P-=V,P===0){ee--;const $=Math.max(ee,0);P=(0,b.getWrappedLineTrimmedLength)(L,$,this._cols)}}for(let V=0;V<L.length;V++)K[V]<_&&L[V].setCell(K[V],N);let M=Z-te;for(;M-- >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+R)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+Z,this.ybase+S-1)}if(I.length>0){const B=[],k=[];for(let Q=0;Q<this.lines.length;Q++)k.push(this.lines.get(Q));const L=this.lines.length;let z=L-1,G=0,K=I[G];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let Z=0;for(let Q=Math.min(this.lines.maxLength-1,L+R-1);Q>=0;Q--)if(K&&K.start>z+Z){for(let de=K.newLines.length-1;de>=0;de--)this.lines.set(Q--,K.newLines[de]);Q++,B.push({index:z+1,amount:K.newLines.length}),Z+=K.newLines.length,K=I[++G]}else this.lines.set(Q,k[z--]);let te=0;for(let Q=B.length-1;Q>=0;Q--)B[Q].index+=te,this.lines.onInsertEmitter.fire(B[Q]),te+=B[Q].amount;const re=Math.max(0,L+R-this.lines.maxLength);re>0&&this.lines.onTrimEmitter.fire(re)}}translateBufferLineToString(_,S,N=0,I){const R=this.lines.get(_);return R?R.translateToString(S,N,I):""}getWrappedRangeForLine(_){let S=_,N=_;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;N+1<this.lines.length&&this.lines.get(N+1).isWrapped;)N++;return{first:S,last:N}}setupTabStops(_){for(_!=null?this.tabs[_]||(_=this.prevStop(_)):(this.tabs={},_=0);_<this._cols;_+=this._optionsService.rawOptions.tabStopWidth)this.tabs[_]=!0}prevStop(_){for(_==null&&(_=this.x);!this.tabs[--_]&&_>0;);return _>=this._cols?this._cols-1:_<0?0:_}nextStop(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_<this._cols;);return _>=this._cols?this._cols-1:_<0?0:_}clearMarkers(_){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===_&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].dispose(),this.markers.splice(_--,1);this._isClearing=!1}addMarker(_){const S=new v.Marker(_);return this.markers.push(S),S.register(this.lines.onTrim((N=>{S.line-=N,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((N=>{S.line>=N.index&&(S.line+=N.amount)}))),S.register(this.lines.onDelete((N=>{S.line>=N.index&&S.line<N.index+N.amount&&S.dispose(),S.line>N.index&&(S.line-=N.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(_){this._isClearing||this.markers.splice(this.markers.indexOf(_),1)}}},8437:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=d(3734),p=d(511),h=d(643),g=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let b=0;class x{constructor(v,y,_=!1){this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const S=y||p.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let N=0;N<v;++N)this.setCell(N,S);this.length=v}get(v){const y=this._data[3*v+0],_=2097151&y;return[this._data[3*v+1],2097152&y?this._combined[v]:_?(0,g.stringFromCodePoint)(_):"",y>>22,2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):_]}set(v,y){this._data[3*v+1]=y[h.CHAR_DATA_ATTR_INDEX],y[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=y[1],this._data[3*v+0]=2097152|v|y[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=y[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&y}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v]:2097151&y?(0,g.stringFromCodePoint)(2097151&y):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,y){return b=3*v,y.content=this._data[b+0],y.fg=this._data[b+1],y.bg=this._data[b+2],2097152&y.content&&(y.combinedData=this._combined[v]),268435456&y.bg&&(y.extended=this._extendedAttrs[v]),y}setCell(v,y){2097152&y.content&&(this._combined[v]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[v]=y.extended),this._data[3*v+0]=y.content,this._data[3*v+1]=y.fg,this._data[3*v+2]=y.bg}setCellFromCodepoint(v,y,_,S){268435456&S.bg&&(this._extendedAttrs[v]=S.extended),this._data[3*v+0]=y|_<<22,this._data[3*v+1]=S.fg,this._data[3*v+2]=S.bg}addCodepointToCell(v,y,_){let S=this._data[3*v+0];2097152&S?this._combined[v]+=(0,g.stringFromCodePoint)(y):2097151&S?(this._combined[v]=(0,g.stringFromCodePoint)(2097151&S)+(0,g.stringFromCodePoint)(y),S&=-2097152,S|=2097152):S=y|4194304,_&&(S&=-12582913,S|=_<<22),this._data[3*v+0]=S}insertCells(v,y,_){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,_),y<this.length-v){const S=new p.CellData;for(let N=this.length-v-y-1;N>=0;--N)this.setCell(v+y+N,this.loadCell(v+N,S));for(let N=0;N<y;++N)this.setCell(v+N,_)}else for(let S=v;S<this.length;++S)this.setCell(S,_);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,_)}deleteCells(v,y,_){if(v%=this.length,y<this.length-v){const S=new p.CellData;for(let N=0;N<this.length-v-y;++N)this.setCell(v+N,this.loadCell(v+y+N,S));for(let N=this.length-y;N<this.length;++N)this.setCell(N,_)}else for(let S=v;S<this.length;++S)this.setCell(S,_);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,_),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,_)}replaceCells(v,y,_,S=!1){if(S)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,_),y<this.length&&this.getWidth(y-1)===2&&!this.isProtected(y)&&this.setCellFromCodepoint(y,0,1,_);v<y&&v<this.length;)this.isProtected(v)||this.setCell(v,_),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,_),y<this.length&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y,0,1,_);v<y&&v<this.length;)this.setCell(v++,_)}resize(v,y){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const _=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*_)this._data=new Uint32Array(this._data.buffer,0,_);else{const S=new Uint32Array(_);S.set(this._data),this._data=S}for(let S=this.length;S<v;++S)this.setCell(S,y)}else{this._data=this._data.subarray(0,_);const S=Object.keys(this._combined);for(let I=0;I<S.length;I++){const R=parseInt(S[I],10);R>=v&&delete this._combined[R]}const N=Object.keys(this._extendedAttrs);for(let I=0;I<N.length;I++){const R=parseInt(N[I],10);R>=v&&delete this._extendedAttrs[R]}}return this.length=v,4*_*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,y=!1){if(y)for(let _=0;_<this.length;++_)this.isProtected(_)||this.setCell(_,v);else{this._combined={},this._extendedAttrs={};for(let _=0;_<this.length;++_)this.setCell(_,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const y in v._combined)this._combined[y]=v._combined[y];this._extendedAttrs={};for(const y in v._extendedAttrs)this._extendedAttrs[y]=v._extendedAttrs[y];this.isWrapped=v.isWrapped}clone(){const v=new x(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const y in this._combined)v._combined[y]=this._combined[y];for(const y in this._extendedAttrs)v._extendedAttrs[y]=this._extendedAttrs[y];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,y,_,S,N){const I=v._data;if(N)for(let B=S-1;B>=0;B--){for(let k=0;k<3;k++)this._data[3*(_+B)+k]=I[3*(y+B)+k];268435456&I[3*(y+B)+2]&&(this._extendedAttrs[_+B]=v._extendedAttrs[y+B])}else for(let B=0;B<S;B++){for(let k=0;k<3;k++)this._data[3*(_+B)+k]=I[3*(y+B)+k];268435456&I[3*(y+B)+2]&&(this._extendedAttrs[_+B]=v._extendedAttrs[y+B])}const R=Object.keys(v._combined);for(let B=0;B<R.length;B++){const k=parseInt(R[B],10);k>=y&&(this._combined[k-y+_]=v._combined[k])}}translateToString(v,y,_,S){y=y??0,_=_??this.length,v&&(_=Math.min(_,this.getTrimmedLength())),S&&(S.length=0);let N="";for(;y<_;){const I=this._data[3*y+0],R=2097151&I,B=2097152&I?this._combined[y]:R?(0,g.stringFromCodePoint)(R):h.WHITESPACE_CELL_CHAR;if(N+=B,S)for(let k=0;k<B.length;++k)S.push(y);y+=I>>22||1}return S&&S.push(y),N}}l.BufferLine=x},4841:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(d,f){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return f*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(c,l)=>{function d(f,p,h){if(p===f.length-1)return f[p].getTrimmedLength();const g=!f[p].hasContent(h-1)&&f[p].getWidth(h-1)===1,b=f[p+1].getWidth(0)===2;return g&&b?h-1:h}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,p,h,g,b){const x=[];for(let E=0;E<f.length-1;E++){let v=E,y=f.get(++v);if(!y.isWrapped)continue;const _=[f.get(E)];for(;v<f.length&&y.isWrapped;)_.push(y),y=f.get(++v);if(g>=E&&g<v){E+=_.length-1;continue}let S=0,N=d(_,S,p),I=1,R=0;for(;I<_.length;){const k=d(_,I,p),L=k-R,z=h-N,G=Math.min(L,z);_[S].copyCellsFrom(_[I],R,N,G,!1),N+=G,N===h&&(S++,N=0),R+=G,R===k&&(I++,R=0),N===0&&S!==0&&_[S-1].getWidth(h-1)===2&&(_[S].copyCellsFrom(_[S-1],h-1,N++,1,!1),_[S-1].setCell(h-1,b))}_[S].replaceCells(N,h,b);let B=0;for(let k=_.length-1;k>0&&(k>S||_[k].getTrimmedLength()===0);k--)B++;B>0&&(x.push(E+_.length-B),x.push(B)),E+=_.length-1}return x},l.reflowLargerCreateNewLayout=function(f,p){const h=[];let g=0,b=p[g],x=0;for(let E=0;E<f.length;E++)if(b===E){const v=p[++g];f.onDeleteEmitter.fire({index:E-x,amount:v}),E+=v-1,x+=v,b=p[++g]}else h.push(E);return{layout:h,countRemoved:x}},l.reflowLargerApplyNewLayout=function(f,p){const h=[];for(let g=0;g<p.length;g++)h.push(f.get(p[g]));for(let g=0;g<h.length;g++)f.set(g,h[g]);f.length=p.length},l.reflowSmallerGetNewLineLengths=function(f,p,h){const g=[],b=f.map(((y,_)=>d(f,_,p))).reduce(((y,_)=>y+_));let x=0,E=0,v=0;for(;v<b;){if(b-v<h){g.push(b-v);break}x+=h;const y=d(f,E,p);x>y&&(x-=y,E++);const _=f[E].getWidth(x-1)===2;_&&x--;const S=_?h-1:h;g.push(S),v+=S}return g},l.getWrappedLineTrimmedLength=d},5295:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=d(8460),p=d(844),h=d(9092);class g extends p.Disposable{constructor(x,E){super(),this._optionsService=x,this._bufferService=E,this._onBufferActivate=this.register(new f.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(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),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(x,E){this._normal.resize(x,E),this._alt.resize(x,E),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}l.BufferSet=g},511:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=d(482),p=d(643),h=d(3734);class g extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const E=new g;return E.setFromCharData(x),E}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let E=!1;if(x[p.CHAR_DATA_CHAR_INDEX].length>2)E=!0;else if(x[p.CHAR_DATA_CHAR_INDEX].length===2){const v=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const y=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(v-55296)+y-56320+65536|x[p.CHAR_DATA_WIDTH_INDEX]<<22:E=!0}else E=!0}else this.content=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[p.CHAR_DATA_WIDTH_INDEX]<<22;E&&(this.combinedData=x[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=g},643:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=d(8460),p=d(844);class h{get id(){return this._id}constructor(b){this.line=b,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(b){return this._disposables.push(b),b}}l.Marker=h,h._nextId=1},7116:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.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:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,l)=>{var d,f,p;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.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=`
281
+ `,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=""})(d||(l.C0=d={})),(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="Ÿ"})(f||(l.C1=f={})),(function(h){h.ST=`${d.ESC}\\`})(p||(l.C1_ESCAPED=p={}))},7399:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=d(2584),p={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:["'",'"']};l.evaluateKeyboardEvent=function(h,g,b,x){const E={type:0,cancel:!1,key:void 0},v=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?E.key=g?f.C0.ESC+"OA":f.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?E.key=g?f.C0.ESC+"OD":f.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?E.key=g?f.C0.ESC+"OC":f.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(E.key=g?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:E.key=h.ctrlKey?"\b":f.C0.DEL,h.altKey&&(E.key=f.C0.ESC+E.key);break;case 9:if(h.shiftKey){E.key=f.C0.ESC+"[Z";break}E.key=f.C0.HT,E.cancel=!0;break;case 13:E.key=h.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,E.cancel=!0;break;case 27:E.key=f.C0.ESC,h.altKey&&(E.key=f.C0.ESC+f.C0.ESC),E.cancel=!0;break;case 37:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"D",E.key===f.C0.ESC+"[1;3D"&&(E.key=f.C0.ESC+(b?"b":"[1;5D"))):E.key=g?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"C",E.key===f.C0.ESC+"[1;3C"&&(E.key=f.C0.ESC+(b?"f":"[1;5C"))):E.key=g?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"A",b||E.key!==f.C0.ESC+"[1;3A"||(E.key=f.C0.ESC+"[1;5A")):E.key=g?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(h.metaKey)break;v?(E.key=f.C0.ESC+"[1;"+(v+1)+"B",b||E.key!==f.C0.ESC+"[1;3B"||(E.key=f.C0.ESC+"[1;5B")):E.key=g?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(E.key=f.C0.ESC+"[2~");break;case 46:E.key=v?f.C0.ESC+"[3;"+(v+1)+"~":f.C0.ESC+"[3~";break;case 36:E.key=v?f.C0.ESC+"[1;"+(v+1)+"H":g?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:E.key=v?f.C0.ESC+"[1;"+(v+1)+"F":g?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:h.shiftKey?E.type=2:h.ctrlKey?E.key=f.C0.ESC+"[5;"+(v+1)+"~":E.key=f.C0.ESC+"[5~";break;case 34:h.shiftKey?E.type=3:h.ctrlKey?E.key=f.C0.ESC+"[6;"+(v+1)+"~":E.key=f.C0.ESC+"[6~";break;case 112:E.key=v?f.C0.ESC+"[1;"+(v+1)+"P":f.C0.ESC+"OP";break;case 113:E.key=v?f.C0.ESC+"[1;"+(v+1)+"Q":f.C0.ESC+"OQ";break;case 114:E.key=v?f.C0.ESC+"[1;"+(v+1)+"R":f.C0.ESC+"OR";break;case 115:E.key=v?f.C0.ESC+"[1;"+(v+1)+"S":f.C0.ESC+"OS";break;case 116:E.key=v?f.C0.ESC+"[15;"+(v+1)+"~":f.C0.ESC+"[15~";break;case 117:E.key=v?f.C0.ESC+"[17;"+(v+1)+"~":f.C0.ESC+"[17~";break;case 118:E.key=v?f.C0.ESC+"[18;"+(v+1)+"~":f.C0.ESC+"[18~";break;case 119:E.key=v?f.C0.ESC+"[19;"+(v+1)+"~":f.C0.ESC+"[19~";break;case 120:E.key=v?f.C0.ESC+"[20;"+(v+1)+"~":f.C0.ESC+"[20~";break;case 121:E.key=v?f.C0.ESC+"[21;"+(v+1)+"~":f.C0.ESC+"[21~";break;case 122:E.key=v?f.C0.ESC+"[23;"+(v+1)+"~":f.C0.ESC+"[23~";break;case 123:E.key=v?f.C0.ESC+"[24;"+(v+1)+"~":f.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(b&&!x||!h.altKey||h.metaKey)!b||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?E.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(E.key=f.C0.US),h.key==="@"&&(E.key=f.C0.NUL)):h.keyCode===65&&(E.type=1);else{const y=p[h.keyCode],_=y==null?void 0:y[h.shiftKey?1:0];if(_)E.key=f.C0.ESC+_;else if(h.keyCode>=65&&h.keyCode<=90){const S=h.ctrlKey?h.keyCode-64:h.keyCode+32;let N=String.fromCharCode(S);h.shiftKey&&(N=N.toUpperCase()),E.key=f.C0.ESC+N}else if(h.keyCode===32)E.key=f.C0.ESC+(h.ctrlKey?f.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let S=h.code.slice(3,4);h.shiftKey||(S=S.toLowerCase()),E.key=f.C0.ESC+S,E.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?E.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?E.key=f.C0.NUL:h.keyCode>=51&&h.keyCode<=55?E.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?E.key=f.C0.DEL:h.keyCode===219?E.key=f.C0.ESC:h.keyCode===220?E.key=f.C0.FS:h.keyCode===221&&(E.key=f.C0.GS)}return E}},482:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,f=0,p=d.length){let h="";for(let g=f;g<p;++g){let b=d[g];b>65535?(b-=65536,h+=String.fromCharCode(55296+(b>>10))+String.fromCharCode(b%1024+56320)):h+=String.fromCharCode(b)}return h},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const p=d.length;if(!p)return 0;let h=0,g=0;if(this._interim){const b=d.charCodeAt(g++);56320<=b&&b<=57343?f[h++]=1024*(this._interim-55296)+b-56320+65536:(f[h++]=this._interim,f[h++]=b),this._interim=0}for(let b=g;b<p;++b){const x=d.charCodeAt(b);if(55296<=x&&x<=56319){if(++b>=p)return this._interim=x,h;const E=d.charCodeAt(b);56320<=E&&E<=57343?f[h++]=1024*(x-55296)+E-56320+65536:(f[h++]=x,f[h++]=E)}else x!==65279&&(f[h++]=x)}return h}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,f){const p=d.length;if(!p)return 0;let h,g,b,x,E=0,v=0,y=0;if(this.interim[0]){let N=!1,I=this.interim[0];I&=(224&I)==192?31:(240&I)==224?15:7;let R,B=0;for(;(R=63&this.interim[++B])&&B<4;)I<<=6,I|=R;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=k-B;for(;y<L;){if(y>=p)return 0;if(R=d[y++],(192&R)!=128){y--,N=!0;break}this.interim[B++]=R,I<<=6,I|=63&R}N||(k===2?I<128?y--:f[E++]=I:k===3?I<2048||I>=55296&&I<=57343||I===65279||(f[E++]=I):I<65536||I>1114111||(f[E++]=I)),this.interim.fill(0)}const _=p-4;let S=y;for(;S<p;){for(;!(!(S<_)||128&(h=d[S])||128&(g=d[S+1])||128&(b=d[S+2])||128&(x=d[S+3]));)f[E++]=h,f[E++]=g,f[E++]=b,f[E++]=x,S+=4;if(h=d[S++],h<128)f[E++]=h;else if((224&h)==192){if(S>=p)return this.interim[0]=h,E;if(g=d[S++],(192&g)!=128){S--;continue}if(v=(31&h)<<6|63&g,v<128){S--;continue}f[E++]=v}else if((240&h)==224){if(S>=p)return this.interim[0]=h,E;if(g=d[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=h,this.interim[1]=g,E;if(b=d[S++],(192&b)!=128){S--;continue}if(v=(15&h)<<12|(63&g)<<6|63&b,v<2048||v>=55296&&v<=57343||v===65279)continue;f[E++]=v}else if((248&h)==240){if(S>=p)return this.interim[0]=h,E;if(g=d[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=h,this.interim[1]=g,E;if(b=d[S++],(192&b)!=128){S--;continue}if(S>=p)return this.interim[0]=h,this.interim[1]=g,this.interim[2]=b,E;if(x=d[S++],(192&x)!=128){S--;continue}if(v=(7&h)<<18|(63&g)<<12|(63&b)<<6|63&x,v<65536||v>1114111)continue;f[E++]=v}}return E}}},225:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=d(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],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 g;l.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let b=0;b<p.length;++b)g.fill(0,p[b][0],p[b][1]+1)}}wcwidth(b){return b<32?0:b<127?1:b<65536?g[b]:(function(x,E){let v,y=0,_=E.length-1;if(x<E[0][0]||x>E[_][1])return!1;for(;_>=y;)if(v=y+_>>1,x>E[v][1])y=v+1;else{if(!(x<E[v][0]))return!0;_=v-1}return!1})(b,h)?0:b>=131072&&b<=196605||b>=196608&&b<=262141?2:1}charProperties(b,x){let E=this.wcwidth(b),v=E===0&&x!==0;if(v){const y=f.UnicodeService.extractWidth(x);y===0?v=!1:y>E&&(E=y)}return f.UnicodeService.createPropertyValue(0,E,v)}}},5981:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=d(8460),p=d(844);class h extends p.Disposable{constructor(b){super(),this._action=b,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(b,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=b.length,this._writeBuffer.push(b),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let E;for(this._isSyncWriting=!0;E=this._writeBuffer.shift();){this._action(E);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(b,x){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+=b.length,this._writeBuffer.push(b),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=b.length,this._writeBuffer.push(b),this._callbacks.push(x)}_innerWrite(b=0,x=!0){const E=b||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],y=this._action(v,x);if(y){const S=N=>Date.now()-E>=12?setTimeout((()=>this._innerWrite(0,N))):this._innerWrite(E,N);return void y.catch((N=>(queueMicrotask((()=>{throw N})),Promise.resolve(!1)))).then(S)}const _=this._callbacks[this._bufferOffset];if(_&&_(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-E>=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()}}l.WriteBuffer=h},5941:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const d=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function p(h,g){const b=h.toString(16),x=b.length<2?"0"+b:b;switch(g){case 4:return b[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}l.parseColor=function(h){if(!h)return;let g=h.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const b=d.exec(g);if(b){const x=b[1]?15:b[4]?255:b[7]?4095:65535;return[Math.round(parseInt(b[1]||b[4]||b[7]||b[10],16)/x*255),Math.round(parseInt(b[2]||b[5]||b[8]||b[11],16)/x*255),Math.round(parseInt(b[3]||b[6]||b[9]||b[12],16)/x*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),f.exec(g)&&[3,6,9,12].includes(g.length))){const b=g.length/3,x=[0,0,0];for(let E=0;E<3;++E){const v=parseInt(g.slice(b*E,b*E+b),16);x[E]=b===1?v<<4:b===2?v:b===3?v>>4:v>>8}return x}},l.toRgbString=function(h,g=16){const[b,x,E]=h;return`rgb:${p(b,g)}/${p(x,g)}/${p(E,g)}`}},5770:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=d(482),p=d(8742),h=d(5770),g=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(x,E){this._handlers[x]===void 0&&(this._handlers[x]=[]);const v=this._handlers[x];return v.push(E),{dispose:()=>{const y=v.indexOf(E);y!==-1&&v.splice(y,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(x,E){if(this.reset(),this._ident=x,this._active=this._handlers[x]||g,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(E);else this._handlerFb(this._ident,"HOOK",E)}put(x,E,v){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(x,E,v);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(x,E,v))}unhook(x,E=!0){if(this._active.length){let v=!1,y=this._active.length-1,_=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,v=E,_=this._stack.fallThrough,this._stack.paused=!1),!_&&v===!1){for(;y>=0&&(v=this._active[y].unhook(x),v!==!0);y--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,v;y--}for(;y>=0;y--)if(v=this._active[y].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",x);this._active=g,this._ident=0}};const b=new p.Params;b.addParam(0),l.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=b,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():b,this._data="",this._hitLimit=!1}put(x,E,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(x,E,v),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let E=!1;if(this._hitLimit)E=!1;else if(x&&(E=this._handler(this._data,this._params),E instanceof Promise))return E.then((v=>(this._params=b,this._data="",this._hitLimit=!1,v)));return this._params=b,this._data="",this._hitLimit=!1,E}}},2015:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=d(844),p=d(8742),h=d(6242),g=d(6351);class b{constructor(y){this.table=new Uint8Array(y)}setDefault(y,_){this.table.fill(y<<4|_)}add(y,_,S,N){this.table[_<<8|y]=S<<4|N}addMany(y,_,S,N){for(let I=0;I<y.length;I++)this.table[_<<8|y[I]]=S<<4|N}}l.TransitionTable=b;const x=160;l.VT500_TRANSITION_TABLE=(function(){const v=new b(4095),y=Array.apply(null,Array(256)).map(((B,k)=>k)),_=(B,k)=>y.slice(B,k),S=_(32,127),N=_(0,24);N.push(25),N.push.apply(N,_(28,32));const I=_(0,14);let R;for(R in v.setDefault(1,0),v.addMany(S,0,2,0),I)v.addMany([24,26,153,154],R,3,0),v.addMany(_(128,144),R,3,0),v.addMany(_(144,152),R,3,0),v.add(156,R,0,0),v.add(27,R,11,1),v.add(157,R,4,8),v.addMany([152,158,159],R,0,7),v.add(155,R,11,3),v.add(144,R,11,9);return v.addMany(N,0,3,0),v.addMany(N,1,3,1),v.add(127,1,0,1),v.addMany(N,8,0,8),v.addMany(N,3,3,3),v.add(127,3,0,3),v.addMany(N,4,3,4),v.add(127,4,0,4),v.addMany(N,6,3,6),v.addMany(N,5,3,5),v.add(127,5,0,5),v.addMany(N,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(S,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(_(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(S,7,0,7),v.addMany(N,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(_(64,127),3,7,0),v.addMany(_(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(_(48,60),4,8,4),v.addMany(_(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(_(32,64),6,0,6),v.add(127,6,0,6),v.addMany(_(64,127),6,0,0),v.addMany(_(32,48),3,9,5),v.addMany(_(32,48),5,9,5),v.addMany(_(48,64),5,0,6),v.addMany(_(64,127),5,7,0),v.addMany(_(32,48),4,9,5),v.addMany(_(32,48),1,9,2),v.addMany(_(32,48),2,9,2),v.addMany(_(48,127),2,10,0),v.addMany(_(48,80),1,10,0),v.addMany(_(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(_(96,127),1,10,0),v.add(80,1,11,9),v.addMany(N,9,0,9),v.add(127,9,0,9),v.addMany(_(28,32),9,0,9),v.addMany(_(32,48),9,9,12),v.addMany(_(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(N,11,0,11),v.addMany(_(32,128),11,0,11),v.addMany(_(28,32),11,0,11),v.addMany(N,10,0,10),v.add(127,10,0,10),v.addMany(_(28,32),10,0,10),v.addMany(_(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(_(32,48),10,9,12),v.addMany(N,12,0,12),v.add(127,12,0,12),v.addMany(_(28,32),12,0,12),v.addMany(_(32,48),12,9,12),v.addMany(_(48,64),12,0,11),v.addMany(_(64,127),12,12,13),v.addMany(_(64,127),10,12,13),v.addMany(_(64,127),9,12,13),v.addMany(N,13,13,13),v.addMany(S,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(x,0,2,0),v.add(x,8,5,8),v.add(x,6,0,6),v.add(x,11,0,11),v.add(x,13,13,13),v})();class E extends f.Disposable{constructor(y=l.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(_,S,N)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,S)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,_=[64,126]){let S=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=y.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let I=0;I<y.intermediates.length;++I){const R=y.intermediates.charCodeAt(I);if(32>R||R>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=R}}if(y.final.length!==1)throw new Error("final must be a single byte");const N=y.final.charCodeAt(0);if(_[0]>N||N>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return S<<=8,S|=N,S}identToString(y){const _=[];for(;y;)_.push(String.fromCharCode(255&y)),y>>=8;return _.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,_){const S=this._identifier(y,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const N=this._escHandlers[S];return N.push(_),{dispose:()=>{const I=N.indexOf(_);I!==-1&&N.splice(I,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,_){this._executeHandlers[y.charCodeAt(0)]=_}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,_){const S=this._identifier(y);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const N=this._csiHandlers[S];return N.push(_),{dispose:()=>{const I=N.indexOf(_);I!==-1&&N.splice(I,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,_){return this._dcsParser.registerHandler(this._identifier(y),_)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,_){return this._oscParser.registerHandler(y,_)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}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(y,_,S,N,I){this._parseStack.state=y,this._parseStack.handlers=_,this._parseStack.handlerPos=S,this._parseStack.transition=N,this._parseStack.chunkPos=I}parse(y,_,S){let N,I=0,R=0,B=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,B=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 k=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&L>-1){for(;L>=0&&(N=k[L](this._params),N!==!0);L--)if(N instanceof Promise)return this._parseStack.handlerPos=L,N}this._parseStack.handlers=[];break;case 4:if(S===!1&&L>-1){for(;L>=0&&(N=k[L](),N!==!0);L--)if(N instanceof Promise)return this._parseStack.handlerPos=L,N}this._parseStack.handlers=[];break;case 6:if(I=y[this._parseStack.chunkPos],N=this._dcsParser.unhook(I!==24&&I!==26,S),N)return N;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(I=y[this._parseStack.chunkPos],N=this._oscParser.end(I!==24&&I!==26,S),N)return N;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,B=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=B;k<_;++k){switch(I=y[k],R=this._transitions.table[this.currentState<<8|(I<160?I:x)],R>>4){case 2:for(let Z=k+1;;++Z){if(Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}if(++Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}if(++Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}if(++Z>=_||(I=y[Z])<32||I>126&&I<x){this._printHandler(y,k,Z),k=Z-1;break}}break;case 3:this._executeHandlers[I]?this._executeHandlers[I]():this._executeHandlerFb(I),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:I,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|I];let z=L?L.length-1:-1;for(;z>=0&&(N=L[z](this._params),N!==!0);z--)if(N instanceof Promise)return this._preserveStack(3,L,z,R,k),N;z<0&&this._csiHandlerFb(this._collect<<8|I,this._params),this.precedingJoinState=0;break;case 8:do switch(I){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(I-48)}while(++k<_&&(I=y[k])>47&&I<60);k--;break;case 9:this._collect<<=8,this._collect|=I;break;case 10:const G=this._escHandlers[this._collect<<8|I];let K=G?G.length-1:-1;for(;K>=0&&(N=G[K](),N!==!0);K--)if(N instanceof Promise)return this._preserveStack(4,G,K,R,k),N;K<0&&this._escHandlerFb(this._collect<<8|I),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|I,this._params);break;case 13:for(let Z=k+1;;++Z)if(Z>=_||(I=y[Z])===24||I===26||I===27||I>127&&I<x){this._dcsParser.put(y,k,Z),k=Z-1;break}break;case 14:if(N=this._dcsParser.unhook(I!==24&&I!==26),N)return this._preserveStack(6,[],0,R,k),N;I===27&&(R|=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 Z=k+1;;Z++)if(Z>=_||(I=y[Z])<32||I>127&&I<x){this._oscParser.put(y,k,Z),k=Z-1;break}break;case 6:if(N=this._oscParser.end(I!==24&&I!==26),N)return this._preserveStack(5,[],0,R,k),N;I===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&R}}}l.EscapeSequenceParser=E},6242:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=d(5770),p=d(482),h=[];l.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(g,b){this._handlers[g]===void 0&&(this._handlers[g]=[]);const x=this._handlers[g];return x.push(b),{dispose:()=>{const E=x.indexOf(b);E!==-1&&x.splice(E,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,b,x){if(this._active.length)for(let E=this._active.length-1;E>=0;E--)this._active[E].put(g,b,x);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,b,x))}start(){this.reset(),this._state=1}put(g,b,x){if(this._state!==3){if(this._state===1)for(;b<x;){const E=g[b++];if(E===59){this._state=2,this._start();break}if(E<48||57<E)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+E-48}this._state===2&&x-b>0&&this._put(g,b,x)}}end(g,b=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,E=this._active.length-1,v=!1;if(this._stack.paused&&(E=this._stack.loopPosition-1,x=b,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;E>=0&&(x=this._active[E].end(g),x!==!0);E--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!1,x;E--}for(;E>=0;E--)if(x=this._active[E].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",g);this._active=h,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,b,x){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,b,x),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let b=!1;if(this._hitLimit)b=!1;else if(g&&(b=this._handler(this._data),b instanceof Promise))return b.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,b}}},8742:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class f{static fromArray(h){const g=new f;if(!h.length)return g;for(let b=Array.isArray(h[0])?1:0;b<h.length;++b){const x=h[b];if(Array.isArray(x))for(let E=0;E<x.length;++E)g.addSubParam(x[E]);else g.addParam(x)}return g}constructor(h=32,g=32){if(this.maxLength=h,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new f(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 g=0;g<this.length;++g){h.push(this.params[g]);const b=this._subParamsIdx[g]>>8,x=255&this._subParamsIdx[g];x-b>0&&h.push(Array.prototype.slice.call(this._subParams,b,x))}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>d?d: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>d?d:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const g=this._subParamsIdx[h]>>8,b=255&this._subParamsIdx[h];return b-g>0?this._subParams.subarray(g,b):null}getSubParamsAll(){const h={};for(let g=0;g<this.length;++g){const b=this._subParamsIdx[g]>>8,x=255&this._subParamsIdx[g];x-b>0&&(h[g]=this._subParams.slice(b,x))}return h}addDigit(h){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const b=this._digitIsSub?this._subParams:this.params,x=b[g-1];b[g-1]=~x?Math.min(10*x+h,d):h}}l.Params=f},5741:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let f=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===d){f=p;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(f,1)}}},8771:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=d(3785),p=d(511);l.BufferApiView=class{constructor(h,g){this._buffer=h,this.type=g}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 g=this._buffer.lines.get(h);if(g)return new f.BufferLineApiView(g)}getNullCell(){return new p.CellData}}},3785:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=d(511);l.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,h){if(!(p<0||p>=this._line.length))return h?(this._line.loadCell(p,h),h):this._line.loadCell(p,new f.CellData)}translateToString(p,h,g){return this._line.translateToString(p,h,g)}}},8285:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=d(8771),p=d(8460),h=d(844);class g extends h.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw 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)}}l.BufferNamespaceApi=g},7975:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,f){return this._core.registerCsiHandler(d,(p=>f(p.toArray())))}addCsiHandler(d,f){return this.registerCsiHandler(d,f)}registerDcsHandler(d,f){return this._core.registerDcsHandler(d,((p,h)=>f(p,h.toArray())))}addDcsHandler(d,f){return this.registerDcsHandler(d,f)}registerEscHandler(d,f){return this._core.registerEscHandler(d,f)}addEscHandler(d,f){return this.registerEscHandler(d,f)}registerOscHandler(d,f){return this._core.registerOscHandler(d,f)}addOscHandler(d,f){return this.registerOscHandler(d,f)}}},7090:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(c,l,d){var f=this&&this.__decorate||function(v,y,_,S){var N,I=arguments.length,R=I<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,_,S);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(R=(I<3?N(R):I>3?N(y,_,R):N(y,_))||R);return I>3&&R&&Object.defineProperty(y,_,R),R},p=this&&this.__param||function(v,y){return function(_,S){y(_,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const h=d(8460),g=d(844),b=d(5295),x=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let E=l.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(v){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(v.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new b.BufferSet(v,this))}resize(v,y){this.cols=v,this.rows=y,this.buffers.resize(v,y),this._onResize.fire({cols:v,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,y=!1){const _=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===v.fg&&S.getBg(0)===v.bg||(S=_.getBlankLine(v,y),this._cachedBlankLine=S),S.isWrapped=y;const N=_.ybase+_.scrollTop,I=_.ybase+_.scrollBottom;if(_.scrollTop===0){const R=_.lines.isFull;I===_.lines.length-1?R?_.lines.recycle().copyFrom(S):_.lines.push(S.clone()):_.lines.splice(I+1,0,S.clone()),R?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const R=I-N+1;_.lines.shiftElements(N+1,R-1,-1),_.lines.set(I,S.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(v,y,_){const S=this.buffer;if(v<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else v+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const N=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+v,S.ybase),0),N!==S.ydisp&&(y||this._onScroll.fire(S.ydisp))}};l.BufferService=E=f([p(0,x.IOptionsService)],E)},7994:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,f){this._charsets[d]=f,this.glevel===d&&(this.charset=f)}}},1753:function(c,l,d){var f=this&&this.__decorate||function(S,N,I,R){var B,k=arguments.length,L=k<3?N:R===null?R=Object.getOwnPropertyDescriptor(N,I):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,I,R);else for(var z=S.length-1;z>=0;z--)(B=S[z])&&(L=(k<3?B(L):k>3?B(N,I,L):B(N,I))||L);return k>3&&L&&Object.defineProperty(N,I,L),L},p=this&&this.__param||function(S,N){return function(I,R){N(I,R,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const h=d(2585),g=d(8460),b=d(844),x={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 E(S,N){let I=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(I|=64,I|=S.action):(I|=3&S.button,4&S.button&&(I|=64),8&S.button&&(I|=128),S.action===32?I|=32:S.action!==0||N||(I|=3)),I}const v=String.fromCharCode,y={DEFAULT:S=>{const N=[E(S,!1)+32,S.col+32,S.row+32];return N[0]>255||N[1]>255||N[2]>255?"":`\x1B[M${v(N[0])}${v(N[1])}${v(N[2])}`},SGR:S=>{const N=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${E(S,!0)};${S.col};${S.row}${N}`},SGR_PIXELS:S=>{const N=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${E(S,!0)};${S.x};${S.y}${N}`}};let _=l.CoreMouseService=class extends b.Disposable{constructor(S,N){super(),this._bufferService=S,this._coreService=N,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const I of Object.keys(x))this.addProtocol(I,x[I]);for(const I of Object.keys(y))this.addEncoding(I,y[I]);this.reset()}addProtocol(S,N){this._protocols[S]=N}addEncoding(S,N){this._encodings[S]=N}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 N=this._encodings[this._activeEncoding](S);return N&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(N):this._coreService.triggerDataEvent(N,!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,N,I){if(I){if(S.x!==N.x||S.y!==N.y)return!1}else if(S.col!==N.col||S.row!==N.row)return!1;return S.button===N.button&&S.action===N.action&&S.ctrl===N.ctrl&&S.alt===N.alt&&S.shift===N.shift}};l.CoreMouseService=_=f([p(0,h.IBufferService),p(1,h.ICoreService)],_)},6975:function(c,l,d){var f=this&&this.__decorate||function(_,S,N,I){var R,B=arguments.length,k=B<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,N):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(_,S,N,I);else for(var L=_.length-1;L>=0;L--)(R=_[L])&&(k=(B<3?R(k):B>3?R(S,N,k):R(S,N))||k);return B>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(_,S){return function(N,I){S(N,I,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const h=d(1439),g=d(8460),b=d(844),x=d(2585),E=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=l.CoreService=class extends b.Disposable{constructor(_,S,N){super(),this._bufferService=_,this._logService=S,this._optionsService=N,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(E),this.decPrivateModes=(0,h.clone)(v)}reset(){this.modes=(0,h.clone)(E),this.decPrivateModes=(0,h.clone)(v)}triggerDataEvent(_,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const N=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&N.ybase!==N.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,(()=>_.split("").map((I=>I.charCodeAt(0))))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,(()=>_.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(_))}};l.CoreService=y=f([p(0,x.IBufferService),p(1,x.ILogService),p(2,x.IOptionsService)],y)},9074:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=d(8055),p=d(8460),h=d(844),g=d(6106);let b=0,x=0;class E extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((_=>_==null?void 0:_.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(_){if(_.marker.isDisposed)return;const S=new v(_);if(S){const N=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),N.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,S,N){let I=0,R=0;for(const B of this._decorations.getKeyIterator(S))I=B.options.x??0,R=I+(B.options.width??1),_>=I&&_<R&&(!N||(B.options.layer??"bottom")===N)&&(yield B)}forEachDecorationAtCell(_,S,N,I){this._decorations.forEachByKey(S,(R=>{b=R.options.x??0,x=b+(R.options.width??1),_>=b&&_<x&&(!N||(R.options.layer??"bottom")===N)&&I(R)}))}}l.DecorationService=E;class v extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(_){super(),this.options=_,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=_.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=d(2585),p=d(8343);class h{constructor(...b){this._entries=new Map;for(const[x,E]of b)this.set(x,E)}set(b,x){const E=this._entries.get(b);return this._entries.set(b,x),E}forEach(b){for(const[x,E]of this._entries.entries())b(x,E)}has(b){return this._entries.has(b)}get(b){return this._entries.get(b)}}l.ServiceCollection=h,l.InstantiationService=class{constructor(){this._services=new h,this._services.set(f.IInstantiationService,this)}setService(g,b){this._services.set(g,b)}getService(g){return this._services.get(g)}createInstance(g,...b){const x=(0,p.getServiceDependencies)(g).sort(((y,_)=>y.index-_.index)),E=[];for(const y of x){const _=this._services.get(y.id);if(!_)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${y.id}.`);E.push(_)}const v=x.length>0?x[0].index:b.length;if(b.length!==v)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${v+1} conflicts with ${b.length} static arguments`);return new g(...b,...E)}}},7866:function(c,l,d){var f=this&&this.__decorate||function(v,y,_,S){var N,I=arguments.length,R=I<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,_,S);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(R=(I<3?N(R):I>3?N(y,_,R):N(y,_))||R);return I>3&&R&&Object.defineProperty(y,_,R),R},p=this&&this.__param||function(v,y){return function(_,S){y(_,S,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const h=d(844),g=d(2585),b={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let x,E=l.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=b[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let y=0;y<v.length;y++)typeof v[y]=="function"&&(v[y]=v[y]())}_log(v,y,_){this._evalLazyOptionalParams(_),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,..._)}trace(v,...y){var _;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.trace.bind(this._optionsService.options.logger))??console.log,v,y)}debug(v,...y){var _;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.debug.bind(this._optionsService.options.logger))??console.log,v,y)}info(v,...y){var _;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.info.bind(this._optionsService.options.logger))??console.info,v,y)}warn(v,...y){var _;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.warn.bind(this._optionsService.options.logger))??console.warn,v,y)}error(v,...y){var _;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.error.bind(this._optionsService.options.logger))??console.error,v,y)}};l.LogService=E=f([p(0,g.IOptionsService)],E),l.setTraceLogger=function(v){x=v},l.traceCall=function(v,y,_){if(typeof _.value!="function")throw new Error("not supported");const S=_.value;_.value=function(...N){if(x.logLevel!==g.LogLevelEnum.TRACE)return S.apply(this,N);x.trace(`GlyphRenderer#${S.name}(${N.map((R=>JSON.stringify(R))).join(", ")})`);const I=S.apply(this,N);return x.trace(`GlyphRenderer#${S.name} return`,I),I}}},7302:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=d(8460),p=d(844),h=d(6114);l.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 g=["normal","bold","100","200","300","400","500","600","700","800","900"];class b extends p.Disposable{constructor(E){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...l.DEFAULT_OPTIONS};for(const y in E)if(y in v)try{const _=E[y];v[y]=this._sanitizeAndValidateOption(y,_)}catch(_){console.error(_)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(E,v){return this.onOptionChange((y=>{y===E&&v(this.rawOptions[E])}))}onMultipleOptionChange(E,v){return this.onOptionChange((y=>{E.indexOf(y)!==-1&&v()}))}_setupOptions(){const E=y=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},v=(y,_)=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);_=this._sanitizeAndValidateOption(y,_),this.rawOptions[y]!==_&&(this.rawOptions[y]=_,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const _={get:E.bind(this,y),set:v.bind(this,y)};Object.defineProperty(this.options,y,_)}}_sanitizeAndValidateOption(E,v){switch(E){case"cursorStyle":if(v||(v=l.DEFAULT_OPTIONS[E]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${E}`);break;case"wordSeparator":v||(v=l.DEFAULT_OPTIONS[E]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=g.includes(v)?v:l.DEFAULT_OPTIONS[E];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${E} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${E} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${E} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${E} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}l.OptionsService=b},2660:function(c,l,d){var f=this&&this.__decorate||function(b,x,E,v){var y,_=arguments.length,S=_<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,E):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,x,E,v);else for(var N=b.length-1;N>=0;N--)(y=b[N])&&(S=(_<3?y(S):_>3?y(x,E,S):y(x,E))||S);return _>3&&S&&Object.defineProperty(x,E,S),S},p=this&&this.__param||function(b,x){return function(E,v){x(E,v,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const h=d(2585);let g=l.OscLinkService=class{constructor(b){this._bufferService=b,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(b){const x=this._bufferService.buffer;if(b.id===void 0){const N=x.addMarker(x.ybase+x.y),I={data:b,id:this._nextId++,lines:[N]};return N.onDispose((()=>this._removeMarkerFromLink(I,N))),this._dataByLinkId.set(I.id,I),I.id}const E=b,v=this._getEntryIdKey(E),y=this._entriesWithId.get(v);if(y)return this.addLineToLink(y.id,x.ybase+x.y),y.id;const _=x.addMarker(x.ybase+x.y),S={id:this._nextId++,key:this._getEntryIdKey(E),data:E,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(S,_))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(b,x){const E=this._dataByLinkId.get(b);if(E&&E.lines.every((v=>v.line!==x))){const v=this._bufferService.buffer.addMarker(x);E.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(E,v)))}}getLinkData(b){var x;return(x=this._dataByLinkId.get(b))==null?void 0:x.data}_getEntryIdKey(b){return`${b.id};;${b.uri}`}_removeMarkerFromLink(b,x){const E=b.lines.indexOf(x);E!==-1&&(b.lines.splice(E,1),b.lines.length===0&&(b.data.id!==void 0&&this._entriesWithId.delete(b.key),this._dataByLinkId.delete(b.id)))}};l.OscLinkService=g=f([p(0,h.IBufferService)],g)},8343:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[f]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const h=function(g,b,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,v,y){v[d]===v?v[f].push({id:E,index:y}):(v[f]=[{id:E,index:y}],v[d]=v)})(h,g,x)};return h.toString=()=>p,l.serviceRegistry.set(p,h),h}},2585:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=d(8343);var p;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.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"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=d(8460),p=d(225);class h{static extractShouldJoin(b){return(1&b)!=0}static extractWidth(b){return b>>1&3}static extractCharKind(b){return b>>3}static createPropertyValue(b,x,E=!1){return(16777215&b)<<3|(3&x)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const b=new p.UnicodeV6;this.register(b),this._active=b.version,this._activeProvider=b}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(b){if(!this._providers[b])throw new Error(`unknown Unicode version "${b}"`);this._active=b,this._activeProvider=this._providers[b],this._onChange.fire(b)}register(b){this._providers[b.version]=b}wcwidth(b){return this._activeProvider.wcwidth(b)}getStringCellWidth(b){let x=0,E=0;const v=b.length;for(let y=0;y<v;++y){let _=b.charCodeAt(y);if(55296<=_&&_<=56319){if(++y>=v)return x+this.wcwidth(_);const I=b.charCodeAt(y);56320<=I&&I<=57343?_=1024*(_-55296)+I-56320+65536:x+=this.wcwidth(I)}const S=this.charProperties(_,E);let N=h.extractWidth(S);h.extractShouldJoin(S)&&(N-=h.extractWidth(E)),x+=N,E=S}return x}charProperties(b,x){return this._activeProvider.charProperties(b,x)}}l.UnicodeService=h}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const l=o(9042),d=o(3236),f=o(844),p=o(5741),h=o(8285),g=o(7975),b=o(7090),x=["cols","rows"];class E extends f.Disposable{constructor(y){super(),this._core=this.register(new d.Terminal(y)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const _=N=>this._core.options[N],S=(N,I)=>{this._checkReadonlyOptions(N),this._core.options[N]=I};for(const N in this._core.options){const I={get:_.bind(this,N),set:S.bind(this,N)};Object.defineProperty(this._publicOptions,N,I)}}_checkReadonlyOptions(y){if(x.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new b.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 y=this._core.coreService.decPrivateModes;let _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const _ in y)this._publicOptions[_]=y[_]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,_=!0){this._core.input(y,_)}resize(y,_){this._verifyIntegers(y,_),this._core.resize(y,_)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,_,S){this._verifyIntegers(y,_,S),this._core.select(y,_,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,_){this._verifyIntegers(y,_),this._core.selectLines(y,_)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,_){this._core.write(y,_)}writeln(y,_){this._core.write(y),this._core.write(`\r
282
+ `,_)}paste(y){this._core.paste(y)}refresh(y,_){this._verifyIntegers(y,_),this._core.refresh(y,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return l}_verifyIntegers(...y){for(const _ of y)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const _ of y)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}c.Terminal=E})(),a})()))})(r5)),r5.exports}var ZH=GH(),Q0={exports:{}},YH=Q0.exports,o5;function $H(){return o5||(o5=1,(function(e,t){(function(n,r){e.exports=r()})(YH,(()=>(()=>{var n={930:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=d(485);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,h,g){this._css.set(p,h,g)}getCss(p,h){return this._css.get(p,h)}setColor(p,h,g){this._color.set(p,h,g)}getColor(p,h){return this._color.get(p,h)}clear(){this._color.clear(),this._css.clear()}}},997:function(c,l,d){var f=this&&this.__decorate||function(B,k,L,z){var G,K=arguments.length,Z=K<3?k:z===null?z=Object.getOwnPropertyDescriptor(k,L):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(B,k,L,z);else for(var te=B.length-1;te>=0;te--)(G=B[te])&&(Z=(K<3?G(Z):K>3?G(k,L,Z):G(k,L))||Z);return K>3&&Z&&Object.defineProperty(k,L,Z),Z},p=this&&this.__param||function(B,k){return function(L,z){k(L,z,B)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const h=d(930),g=d(160),b=d(345),x=d(859),E=d(97),v=g.css.toColor("#ffffff"),y=g.css.toColor("#000000"),_=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),N={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const B=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const z=k[L/36%6|0],G=k[L/6%6|0],K=k[L%6];B.push({css:g.channels.toCss(z,G,K),rgba:g.channels.toRgba(z,G,K)})}for(let L=0;L<24;L++){const z=8+10*L;B.push({css:g.channels.toCss(z,z,z),rgba:g.channels.toRgba(z,z,z)})}return B})());let I=l.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(B){super(),this._optionsService=B,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new b.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:y,cursor:_,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:N,selectionBackgroundOpaque:g.color.blend(y,N),selectionInactiveBackgroundTransparent:N,selectionInactiveBackgroundOpaque:g.color.blend(y,N),ansi:l.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(B={}){const k=this._colors;if(k.foreground=R(B.foreground,v),k.background=R(B.background,y),k.cursor=R(B.cursor,_),k.cursorAccent=R(B.cursorAccent,S),k.selectionBackgroundTransparent=R(B.selectionBackground,N),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=R(B.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=B.selectionForeground?R(B.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=l.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=R(B.black,l.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=R(B.red,l.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=R(B.green,l.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=R(B.yellow,l.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=R(B.blue,l.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=R(B.magenta,l.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=R(B.cyan,l.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=R(B.white,l.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=R(B.brightBlack,l.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=R(B.brightRed,l.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=R(B.brightGreen,l.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=R(B.brightYellow,l.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=R(B.brightBlue,l.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=R(B.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=R(B.brightCyan,l.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=R(B.brightWhite,l.DEFAULT_ANSI_COLORS[15]),B.extendedAnsi){const L=Math.min(k.ansi.length-16,B.extendedAnsi.length);for(let z=0;z<L;z++)k.ansi[z+16]=R(B.extendedAnsi[z],l.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(B){this._restoreColor(B),this._onChangeColors.fire(this.colors)}_restoreColor(B){if(B!==void 0)switch(B){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[B]=this._restoreColors.ansi[B]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(B){B(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 R(B,k){if(B!==void 0)try{return g.css.toColor(B)}catch{}return k}l.ThemeService=I=f([p(0,E.IOptionsService)],I)},160:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,f=0,p=0,h=0;var g,b,x,E,v;function y(S){const N=S.toString(16);return N.length<2?"0"+N:N}function _(S,N){return S<N?(N+.05)/(S+.05):(S+.05)/(N+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(N,I,R,B){return B!==void 0?`#${y(N)}${y(I)}${y(R)}${y(B)}`:`#${y(N)}${y(I)}${y(R)}`},S.toRgba=function(N,I,R,B=255){return(N<<24|I<<16|R<<8|B)>>>0},S.toColor=function(N,I,R,B){return{css:S.toCss(N,I,R,B),rgba:S.toRgba(N,I,R,B)}}})(g||(l.channels=g={})),(function(S){function N(I,R){return h=Math.round(255*R),[d,f,p]=v.toChannels(I.rgba),{css:g.toCss(d,f,p,h),rgba:g.toRgba(d,f,p,h)}}S.blend=function(I,R){if(h=(255&R.rgba)/255,h===1)return{css:R.css,rgba:R.rgba};const B=R.rgba>>24&255,k=R.rgba>>16&255,L=R.rgba>>8&255,z=I.rgba>>24&255,G=I.rgba>>16&255,K=I.rgba>>8&255;return d=z+Math.round((B-z)*h),f=G+Math.round((k-G)*h),p=K+Math.round((L-K)*h),{css:g.toCss(d,f,p),rgba:g.toRgba(d,f,p)}},S.isOpaque=function(I){return(255&I.rgba)==255},S.ensureContrastRatio=function(I,R,B){const k=v.ensureContrastRatio(I.rgba,R.rgba,B);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},S.opaque=function(I){const R=(255|I.rgba)>>>0;return[d,f,p]=v.toChannels(R),{css:g.toCss(d,f,p),rgba:R}},S.opacity=N,S.multiplyOpacity=function(I,R){return h=255&I.rgba,N(I,h*R/255)},S.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(b||(l.color=b={})),(function(S){let N,I;try{const R=document.createElement("canvas");R.width=1,R.height=1;const B=R.getContext("2d",{willReadFrequently:!0});B&&(N=B,N.globalCompositeOperation="copy",I=N.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),g.toColor(d,f,p);case 5:return d=parseInt(R.slice(1,2).repeat(2),16),f=parseInt(R.slice(2,3).repeat(2),16),p=parseInt(R.slice(3,4).repeat(2),16),h=parseInt(R.slice(4,5).repeat(2),16),g.toColor(d,f,p,h);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const B=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(B)return d=parseInt(B[1]),f=parseInt(B[2]),p=parseInt(B[3]),h=Math.round(255*(B[5]===void 0?1:parseFloat(B[5]))),g.toColor(d,f,p,h);if(!N||!I)throw new Error("css.toColor: Unsupported css format");if(N.fillStyle=I,N.fillStyle=R,typeof N.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(N.fillRect(0,0,1,1),[d,f,p,h]=N.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(d,f,p,h),css:R}}})(x||(l.css=x={})),(function(S){function N(I,R,B){const k=I/255,L=R/255,z=B/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(I){return N(I>>16&255,I>>8&255,255&I)},S.relativeLuminance2=N})(E||(l.rgb=E={})),(function(S){function N(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K>0||Z>0||te>0);)K-=Math.max(0,Math.ceil(.1*K)),Z-=Math.max(0,Math.ceil(.1*Z)),te-=Math.max(0,Math.ceil(.1*te)),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}function I(R,B,k){const L=R>>24&255,z=R>>16&255,G=R>>8&255;let K=B>>24&255,Z=B>>16&255,te=B>>8&255,re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));for(;re<k&&(K<255||Z<255||te<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),Z=Math.min(255,Z+Math.ceil(.1*(255-Z))),te=Math.min(255,te+Math.ceil(.1*(255-te))),re=_(E.relativeLuminance2(K,Z,te),E.relativeLuminance2(L,z,G));return(K<<24|Z<<16|te<<8|255)>>>0}S.blend=function(R,B){if(h=(255&B)/255,h===1)return B;const k=B>>24&255,L=B>>16&255,z=B>>8&255,G=R>>24&255,K=R>>16&255,Z=R>>8&255;return d=G+Math.round((k-G)*h),f=K+Math.round((L-K)*h),p=Z+Math.round((z-Z)*h),g.toRgba(d,f,p)},S.ensureContrastRatio=function(R,B,k){const L=E.relativeLuminance(R>>8),z=E.relativeLuminance(B>>8);if(_(L,z)<k){if(z<L){const Z=N(R,B,k),te=_(L,E.relativeLuminance(Z>>8));if(te<k){const re=I(R,B,k);return te>_(L,E.relativeLuminance(re>>8))?Z:re}return Z}const G=I(R,B,k),K=_(L,E.relativeLuminance(G>>8));if(K<k){const Z=N(R,B,k);return K>_(L,E.relativeLuminance(Z>>8))?G:Z}return G}},S.reduceLuminance=N,S.increaseLuminance=I,S.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(v||(l.rgba=v={})),l.toPaddedHex=y,l.contrastRatio=_},345:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let h=0;h<this._listeners.length;h++)p.push(this._listeners[h]);for(let h=0;h<p.length;h++)p[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((p=>f.fire(p)))},l.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},859:(c,l)=>{function d(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=d,l.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},485:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(p,h,g){this._data[p]||(this._data[p]={}),this._data[p][h]=g}get(p,h){return this._data[p]?this._data[p][h]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(f,p,h,g,b){this._data.get(f,p)||this._data.set(f,p,new d),this._data.get(f,p).set(h,g,b)}get(f,p,h,g){var b;return(b=this._data.get(f,p))==null?void 0:b.get(h,g)}clear(){this._data.clear()}}},726:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[f]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const h=function(g,b,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,v,y){v[d]===v?v[f].push({id:E,index:y}):(v[f]=[{id:E,index:y}],v[d]=v)})(h,g,x)};return h.toString=()=>p,l.serviceRegistry.set(p,h),h}},97:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=d(726);var p;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.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"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.HTMLSerializeHandler=c.SerializeAddon=void 0;const l=o(997);function d(E,v,y){return Math.max(v,Math.min(E,y))}class f{constructor(v){this._buffer=v}serialize(v,y){const _=this._buffer.getNullCell(),S=this._buffer.getNullCell();let N=_;const I=v.start.y,R=v.end.y,B=v.start.x,k=v.end.x;this._beforeSerialize(R-I,I,R);for(let L=I;L<=R;L++){const z=this._buffer.getLine(L);if(z){const G=L===v.start.y?B:0,K=L===v.end.y?k:z.length;for(let Z=G;Z<K;Z++){const te=z.getCell(Z,N===_?S:_);te?(this._nextCell(te,N,L,Z),N=te):console.warn(`Can't get cell at row=${L}, col=${Z}`)}}this._rowEnd(L,L===R)}return this._afterSerialize(),this._serializeString(y)}_nextCell(v,y,_,S){}_rowEnd(v,y){}_beforeSerialize(v,y,_){}_afterSerialize(){}_serializeString(v){return""}}function p(E,v){return E.getFgColorMode()===v.getFgColorMode()&&E.getFgColor()===v.getFgColor()}function h(E,v){return E.getBgColorMode()===v.getBgColorMode()&&E.getBgColor()===v.getBgColor()}function g(E,v){return E.isInverse()===v.isInverse()&&E.isBold()===v.isBold()&&E.isUnderline()===v.isUnderline()&&E.isOverline()===v.isOverline()&&E.isBlink()===v.isBlink()&&E.isInvisible()===v.isInvisible()&&E.isItalic()===v.isItalic()&&E.isDim()===v.isDim()&&E.isStrikethrough()===v.isStrikethrough()}class b extends f{constructor(v,y){super(v),this._terminal=y,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(v,y,_){this._allRows=new Array(v),this._lastContentCursorRow=y,this._lastCursorRow=y,this._firstRow=y}_rowEnd(v,y){var _;this._nullCellCount>0&&!h(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let S="";if(!y){v-this._firstRow>=this._terminal.rows&&((_=this._buffer.getLine(this._cursorStyleRow))==null||_.getCell(this._cursorStyleCol,this._backgroundCell));const N=this._buffer.getLine(v),I=this._buffer.getLine(v+1);if(I.isWrapped){S="";const R=N.getCell(N.length-1,this._thisRowLastChar),B=N.getCell(N.length-2,this._thisRowLastSecondChar),k=I.getCell(0,this._nextRowFirstChar),L=k.getWidth()>1;let z=!1;(k.getChars()&&L?this._nullCellCount<=1:this._nullCellCount<=0)&&((R.getChars()||R.getWidth()===0)&&h(R,k)&&(z=!0),L&&(B.getChars()||B.getWidth()===0)&&h(R,k)&&h(B,k)&&(z=!0)),z||(S="-".repeat(this._nullCellCount+1),S+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(S+="\x1B[A",S+=`\x1B[${N.length-this._nullCellCount}C`,S+=`\x1B[${this._nullCellCount}X`,S+=`\x1B[${N.length-this._nullCellCount}D`,S+="\x1B[B"),this._lastContentCursorRow=v+1,this._lastContentCursorCol=0,this._lastCursorRow=v+1,this._lastCursorCol=0)}else S=`\r
283
+ `,this._lastCursorRow=v+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=S,this._currentRow="",this._nullCellCount=0}_diffStyle(v,y){const _=[],S=!p(v,y),N=!h(v,y),I=!g(v,y);if(S||N||I)if(v.isAttributeDefault())y.isAttributeDefault()||_.push(0);else{if(S){const R=v.getFgColor();v.isFgRGB()?_.push(38,2,R>>>16&255,R>>>8&255,255&R):v.isFgPalette()?R>=16?_.push(38,5,R):_.push(8&R?90+(7&R):30+(7&R)):_.push(39)}if(N){const R=v.getBgColor();v.isBgRGB()?_.push(48,2,R>>>16&255,R>>>8&255,255&R):v.isBgPalette()?R>=16?_.push(48,5,R):_.push(8&R?100+(7&R):40+(7&R)):_.push(49)}I&&(v.isInverse()!==y.isInverse()&&_.push(v.isInverse()?7:27),v.isBold()!==y.isBold()&&_.push(v.isBold()?1:22),v.isUnderline()!==y.isUnderline()&&_.push(v.isUnderline()?4:24),v.isOverline()!==y.isOverline()&&_.push(v.isOverline()?53:55),v.isBlink()!==y.isBlink()&&_.push(v.isBlink()?5:25),v.isInvisible()!==y.isInvisible()&&_.push(v.isInvisible()?8:28),v.isItalic()!==y.isItalic()&&_.push(v.isItalic()?3:23),v.isDim()!==y.isDim()&&_.push(v.isDim()?2:22),v.isStrikethrough()!==y.isStrikethrough()&&_.push(v.isStrikethrough()?9:29))}return _}_nextCell(v,y,_,S){if(v.getWidth()===0)return;const N=v.getChars()==="",I=this._diffStyle(v,this._cursorStyle);if(N?!h(this._cursorStyle,v):I.length>0){this._nullCellCount>0&&(h(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=_,this._lastContentCursorCol=this._lastCursorCol=S,this._currentRow+=`\x1B[${I.join(";")}m`;const R=this._buffer.getLine(_);R!==void 0&&(R.getCell(S,this._cursorStyle),this._cursorStyleRow=_,this._cursorStyleCol=S)}N?this._nullCellCount+=v.getWidth():(this._nullCellCount>0&&(h(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=v.getChars(),this._lastContentCursorRow=this._lastCursorRow=_,this._lastContentCursorCol=this._lastCursorCol=S+v.getWidth())}_serializeString(v){let y=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(y=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let _="";for(let R=0;R<y;R++)_+=this._allRows[R],R+1<y&&(_+=this._allRowSeparators[R]);if(!v){const R=this._buffer.baseY+this._buffer.cursorY,B=this._buffer.cursorX,k=L=>{L>0?_+=`\x1B[${L}C`:L<0&&(_+=`\x1B[${-L}D`)};(R!==this._lastCursorRow||B!==this._lastCursorCol)&&((S=R-this._lastCursorRow)>0?_+=`\x1B[${S}B`:S<0&&(_+=`\x1B[${-S}A`),k(B-this._lastCursorCol))}var S;const N=this._terminal._core._inputHandler._curAttrData,I=this._diffStyle(N,this._cursorStyle);return I.length>0&&(_+=`\x1B[${I.join(";")}m`),_}}c.SerializeAddon=class{activate(E){this._terminal=E}_serializeBufferByScrollback(E,v,y){const _=v.length,S=y===void 0?_:d(y+E.rows,0,_);return this._serializeBufferByRange(E,v,{start:_-S,end:_-1},!1)}_serializeBufferByRange(E,v,y,_){return new b(v,E).serialize({start:{x:0,y:typeof y.start=="number"?y.start:y.start.line},end:{x:E.cols,y:typeof y.end=="number"?y.end:y.end.line}},_)}_serializeBufferAsHTML(E,v){var y;const _=E.buffer.active,S=new x(_,E,v);if(!v.onlySelection){const I=_.length,R=v.scrollback,B=R===void 0?I:d(R+E.rows,0,I);return S.serialize({start:{x:0,y:I-B},end:{x:E.cols,y:I-1}})}const N=(y=this._terminal)==null?void 0:y.getSelectionPosition();return N!==void 0?S.serialize({start:{x:N.start.x,y:N.start.y},end:{x:N.end.x,y:N.end.y}}):""}_serializeModes(E){let v="";const y=E.modes;if(y.applicationCursorKeysMode&&(v+="\x1B[?1h"),y.applicationKeypadMode&&(v+="\x1B[?66h"),y.bracketedPasteMode&&(v+="\x1B[?2004h"),y.insertMode&&(v+="\x1B[4h"),y.originMode&&(v+="\x1B[?6h"),y.reverseWraparoundMode&&(v+="\x1B[?45h"),y.sendFocusMode&&(v+="\x1B[?1004h"),y.wraparoundMode===!1&&(v+="\x1B[?7l"),y.mouseTrackingMode!=="none")switch(y.mouseTrackingMode){case"x10":v+="\x1B[?9h";break;case"vt200":v+="\x1B[?1000h";break;case"drag":v+="\x1B[?1002h";break;case"any":v+="\x1B[?1003h"}return v}serialize(E){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let v=E!=null&&E.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,E.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,E==null?void 0:E.scrollback);return E!=null&&E.excludeAltBuffer||this._terminal.buffer.active.type!=="alternate"||(v+=`\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0)}`),E!=null&&E.excludeModes||(v+=this._serializeModes(this._terminal)),v}serializeAsHTML(E){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,E||{})}dispose(){}};class x extends f{constructor(v,y,_){super(v),this._terminal=y,this._options=_,this._currentRow="",this._htmlContent="",y._core._themeService?this._ansiColors=y._core._themeService.colors.ansi:this._ansiColors=l.DEFAULT_ANSI_COLORS}_padStart(v,y,_){return y>>=0,_=_??" ",v.length>y?v:((y-=v.length)>_.length&&(_+=_.repeat(y/_.length)),_.slice(0,y)+v)}_beforeSerialize(v,y,_){var S,N;this._htmlContent+="<html><body><!--StartFragment--><pre>";let I="#000000",R="#ffffff";this._options.includeGlobalBackground&&(I=((S=this._terminal.options.theme)==null?void 0:S.foreground)??"#ffffff",R=((N=this._terminal.options.theme)==null?void 0:N.background)??"#000000");const B=[];B.push("color: "+I+";"),B.push("background-color: "+R+";"),B.push("font-family: "+this._terminal.options.fontFamily+";"),B.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+B.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(v,y){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(v,y){const _=y?v.getFgColor():v.getBgColor();return(y?v.isFgRGB():v.isBgRGB())?"#"+[_>>16&255,_>>8&255,255&_].map((S=>this._padStart(S.toString(16),2,"0"))).join(""):(y?v.isFgPalette():v.isBgPalette())?this._ansiColors[_].css:void 0}_diffStyle(v,y){const _=[],S=!p(v,y),N=!h(v,y),I=!g(v,y);if(S||N||I){const R=this._getHexColor(v,!0);R&&_.push("color: "+R+";");const B=this._getHexColor(v,!1);return B&&_.push("background-color: "+B+";"),v.isInverse()&&_.push("color: #000000; background-color: #BFBFBF;"),v.isBold()&&_.push("font-weight: bold;"),v.isUnderline()&&v.isOverline()?_.push("text-decoration: overline underline;"):v.isUnderline()?_.push("text-decoration: underline;"):v.isOverline()&&_.push("text-decoration: overline;"),v.isBlink()&&_.push("text-decoration: blink;"),v.isInvisible()&&_.push("visibility: hidden;"),v.isItalic()&&_.push("font-style: italic;"),v.isDim()&&_.push("opacity: 0.5;"),v.isStrikethrough()&&_.push("text-decoration: line-through;"),_}}_nextCell(v,y,_,S){if(v.getWidth()===0)return;const N=v.getChars()==="",I=this._diffStyle(v,y);I&&(this._currentRow+=I.length===0?"</span><span>":"</span><span style='"+I.join(" ")+"'>"),this._currentRow+=N?" ":v.getChars()}_serializeString(){return this._htmlContent}}c.HTMLSerializeHandler=x})(),a})()))})(Q0)),Q0.exports}var XH=$H(),ey={exports:{}},KH=ey.exports,s5;function JH(){return s5||(s5=1,(function(e,t){(function(n,r){e.exports=r()})(KH,(()=>(()=>{var n={433:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV11=void 0;const f=d(938),p=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],h=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],g=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],b=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let x;function E(v,y){let _,S=0,N=y.length-1;if(v<y[0][0]||v>y[N][1])return!1;for(;N>=S;)if(_=S+N>>1,v>y[_][1])S=_+1;else{if(!(v<y[_][0]))return!0;N=_-1}return!1}l.UnicodeV11=class{constructor(){if(this.version="11",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160);for(let v=0;v<p.length;++v)x.fill(0,p[v][0],p[v][1]+1);for(let v=0;v<g.length;++v)x.fill(2,g[v][0],g[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?x[v]:E(v,h)?0:E(v,b)?2:1}charProperties(v,y){let _=this.wcwidth(v),S=_===0&&y!==0;if(S){const N=f.UnicodeService.extractWidth(y);N===0?S=!1:N>_&&(_=N)}return f.UnicodeService.createPropertyValue(0,_,S)}}},345:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let h=0;h<this._listeners.length;h++)p.push(this._listeners[h]);for(let h=0;h<p.length;h++)p[h].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((p=>f.fire(p)))},l.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},490:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=d(938),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],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 g;l.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let b=0;b<p.length;++b)g.fill(0,p[b][0],p[b][1]+1)}}wcwidth(b){return b<32?0:b<127?1:b<65536?g[b]:(function(x,E){let v,y=0,_=E.length-1;if(x<E[0][0]||x>E[_][1])return!1;for(;_>=y;)if(v=y+_>>1,x>E[v][1])y=v+1;else{if(!(x<E[v][0]))return!0;_=v-1}return!1})(b,h)?0:b>=131072&&b<=196605||b>=196608&&b<=262141?2:1}charProperties(b,x){let E=this.wcwidth(b),v=E===0&&x!==0;if(v){const y=f.UnicodeService.extractWidth(x);y===0?v=!1:y>E&&(E=y)}return f.UnicodeService.createPropertyValue(0,E,v)}}},938:(c,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=d(345),p=d(490);class h{static extractShouldJoin(b){return(1&b)!=0}static extractWidth(b){return b>>1&3}static extractCharKind(b){return b>>3}static createPropertyValue(b,x,E=!1){return(16777215&b)<<3|(3&x)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const b=new p.UnicodeV6;this.register(b),this._active=b.version,this._activeProvider=b}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(b){if(!this._providers[b])throw new Error(`unknown Unicode version "${b}"`);this._active=b,this._activeProvider=this._providers[b],this._onChange.fire(b)}register(b){this._providers[b.version]=b}wcwidth(b){return this._activeProvider.wcwidth(b)}getStringCellWidth(b){let x=0,E=0;const v=b.length;for(let y=0;y<v;++y){let _=b.charCodeAt(y);if(55296<=_&&_<=56319){if(++y>=v)return x+this.wcwidth(_);const I=b.charCodeAt(y);56320<=I&&I<=57343?_=1024*(_-55296)+I-56320+65536:x+=this.wcwidth(I)}const S=this.charProperties(_,E);let N=h.extractWidth(S);h.extractShouldJoin(S)&&(N-=h.extractWidth(E)),x+=N,E=S}return x}charProperties(b,x){return this._activeProvider.charProperties(b,x)}}l.UnicodeService=h}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c](d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Unicode11Addon=void 0;const l=o(433);c.Unicode11Addon=class{activate(d){d.unicode.register(new l.UnicodeV11)}dispose(){}}})(),a})()))})(ey)),ey.exports}var qH=JH(),a5={exports:{}},l5;function QH(){return l5||(l5=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(c,l)=>{function d(p){try{const h=new URL(p),g=h.password&&h.username?`${h.protocol}//${h.username}:${h.password}@${h.host}`:h.username?`${h.protocol}//${h.username}@${h.host}`:`${h.protocol}//${h.host}`;return p.toLocaleLowerCase().startsWith(g.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(p,h,g,b={}){this._terminal=p,this._regex=h,this._handler=g,this._options=b}provideLinks(p,h){const g=f.computeLink(p,this._regex,this._terminal,this._handler);h(this._addCallbacks(g))}_addCallbacks(p){return p.map((h=>(h.leave=this._options.leave,h.hover=(g,b)=>{if(this._options.hover){const{range:x}=h;this._options.hover(g,b,x)}},h)))}};class f{static computeLink(h,g,b,x){const E=new RegExp(g.source,(g.flags||"")+"g"),[v,y]=f._getWindowedLineStrings(h-1,b),_=v.join("");let S;const N=[];for(;S=E.exec(_);){const I=S[0];if(!d(I))continue;const[R,B]=f._mapStrIdx(b,y,0,S.index),[k,L]=f._mapStrIdx(b,R,B,I.length);if(R===-1||B===-1||k===-1||L===-1)continue;const z={start:{x:B+1,y:R+1},end:{x:L,y:k+1}};N.push({range:z,text:I,activate:x})}return N}static _getWindowedLineStrings(h,g){let b,x=h,E=h,v=0,y="";const _=[];if(b=g.buffer.active.getLine(h)){const S=b.translateToString(!0);if(b.isWrapped&&S[0]!==" "){for(v=0;(b=g.buffer.active.getLine(--x))&&v<2048&&(y=b.translateToString(!0),v+=y.length,_.push(y),b.isWrapped&&y.indexOf(" ")===-1););_.reverse()}for(_.push(S),v=0;(b=g.buffer.active.getLine(++E))&&b.isWrapped&&v<2048&&(y=b.translateToString(!0),v+=y.length,_.push(y),y.indexOf(" ")===-1););}return[_,x]}static _mapStrIdx(h,g,b,x){const E=h.buffer.active,v=E.getNullCell();let y=b;for(;x;){const _=E.getLine(g);if(!_)return[-1,-1];for(let S=y;S<_.length;++S){_.getCell(S,v);const N=v.getChars();if(v.getWidth()&&(x-=N.length||1,S===_.length-1&&N==="")){const I=E.getLine(g+1);I&&I.isWrapped&&(I.getCell(0,v),v.getWidth()===2&&(x+=1))}if(x<0)return[g,S]}g++,y=0}return[g,y]}}l.LinkComputer=f}},r={};function o(c){var l=r[c];if(l!==void 0)return l.exports;var d=r[c]={exports:{}};return n[c](d,d.exports,o),d.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.WebLinksAddon=void 0;const l=o(6),d=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(p,h){const g=window.open();if(g){try{g.opener=null}catch{}g.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}c.WebLinksAddon=class{constructor(p=f,h={}){this._handler=p,this._options=h}activate(p){this._terminal=p;const h=this._options,g=h.urlRegex||d;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,g,this._handler,h))}dispose(){var p;(p=this._linkProvider)==null||p.dispose()}}})(),a})()))})(a5)),a5.exports}var eW=QH();function br(e){return typeof e=="function"}function rk(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Zb=rk(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
284
+ `+t.map(function(n,r){return r+1+") "+n.toString()}).join(`
285
+ `):"",this.name="UnsubscriptionError",this.errors=t}});function fm(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var kf=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,a;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Lc(c),d=l.next();!d.done;d=l.next()){var f=d.value;f.remove(this)}}catch(E){t={error:E}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else c.remove(this);var p=this.initialTeardown;if(br(p))try{p()}catch(E){a=E instanceof Zb?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var g=Lc(h),b=g.next();!b.done;b=g.next()){var x=b.value;try{c5(x)}catch(E){a=a??[],E instanceof Zb?a=qd(qd([],Jd(a)),Jd(E.errors)):a.push(E)}}}catch(E){r={error:E}}finally{try{b&&!b.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}}if(a)throw new Zb(a)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)c5(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&fm(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&fm(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),ik=kf.EMPTY;function ok(e){return e instanceof kf||e&&"closed"in e&&br(e.remove)&&br(e.add)&&br(e.unsubscribe)}function c5(e){br(e)?e():e.unsubscribe()}var tW={Promise:void 0},nW={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,qd([e,t],Jd(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function sk(e){nW.setTimeout(function(){throw e})}function u5(){}function Ip(e){e()}var a_=(function(e){ca(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ok(n)&&n.add(r)):r.destination=oW,r}return t.create=function(n,r,o){return new rf(n,r,o)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(kf),rW=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){ap(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){ap(r)}else ap(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){ap(n)}},e})(),rf=(function(e){ca(t,e);function t(n,r,o){var a=e.call(this)||this,c;return br(n)||!n?c={next:n??void 0,error:r??void 0,complete:o??void 0}:c=n,a.destination=new rW(c),a}return t})(a_);function ap(e){sk(e)}function iW(e){throw e}var oW={closed:!0,next:u5,error:iW,complete:u5},l_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ak(e){return e}function sW(e){return e.length===0?ak:e.length===1?e[0]:function(t){return e.reduce(function(n,r){return r(n)},t)}}var os=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,a=lW(t)?t:new rf(t,n,r);return Ip(function(){var c=o,l=c.operator,d=c.source;a.add(l?l.call(a,d):d?o._subscribe(a):o._trySubscribe(a))}),a},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=d5(n),new n(function(o,a){var c=new rf({next:function(l){try{t(l)}catch(d){a(d),c.unsubscribe()}},error:a,complete:o});r.subscribe(c)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[l_]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return sW(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=d5(t),new t(function(r,o){var a;n.subscribe(function(c){return a=c},function(c){return o(c)},function(){return r(a)})})},e.create=function(t){return new e(t)},e})();function d5(e){var t;return(t=e??tW.Promise)!==null&&t!==void 0?t:Promise}function aW(e){return e&&br(e.next)&&br(e.error)&&br(e.complete)}function lW(e){return e&&e instanceof a_||aW(e)&&ok(e)}function cW(e){return br(e==null?void 0:e.lift)}function If(e){return function(t){if(cW(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function rg(e,t,n,r,o){return new uW(e,t,n,r,o)}var uW=(function(e){ca(t,e);function t(n,r,o,a,c,l){var d=e.call(this,n)||this;return d.onFinalize=c,d.shouldUnsubscribe=l,d._next=r?function(f){try{r(f)}catch(p){n.error(p)}}:e.prototype._next,d._error=a?function(f){try{a(f)}catch(p){n.error(p)}finally{this.unsubscribe()}}:e.prototype._error,d._complete=o?function(){try{o()}catch(f){n.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,d}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t})(a_),dW=rk(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),lk=(function(e){ca(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new f5(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new dW},t.prototype.next=function(n){var r=this;Ip(function(){var o,a;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var c=Lc(r.currentObservers),l=c.next();!l.done;l=c.next()){var d=l.value;d.next(n)}}catch(f){o={error:f}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;Ip(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;Ip(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,a=o.hasError,c=o.isStopped,l=o.observers;return a||c?ik:(this.currentObservers=null,l.push(n),new kf(function(){r.currentObservers=null,fm(l,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,a=r.thrownError,c=r.isStopped;o?n.error(a):c&&n.complete()},t.prototype.asObservable=function(){var n=new os;return n.source=this,n},t.create=function(n,r){return new f5(n,r)},t})(os),f5=(function(e){ca(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:ik},t})(lk),fW={now:function(){return Date.now()}},hW=(function(e){ca(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t})(kf),h5={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,qd([e,t],Jd(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},pW=(function(e){ca(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var a=this.id,c=this.scheduler;return a!=null&&(this.id=this.recycleAsyncId(c,a,r)),this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){return o===void 0&&(o=0),h5.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return r;r!=null&&h5.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var o=!1,a;try{this.work(n)}catch(c){o=!0,a=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),a},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,o=n.scheduler,a=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,fm(a,this),r!=null&&(this.id=this.recycleAsyncId(o,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(hW),p5=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=fW.now,e})(),mW=(function(e){ca(t,e);function t(n,r){r===void 0&&(r=p5.now);var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){for(;n=r.shift();)n.unsubscribe();throw o}},t})(p5),gW=new mW(pW),vW=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function bW(e){return br(e==null?void 0:e.then)}function yW(e){return br(e[l_])}function _W(e){return Symbol.asyncIterator&&br(e==null?void 0:e[Symbol.asyncIterator])}function SW(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function EW(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var wW=EW();function CW(e){return br(e==null?void 0:e[wW])}function xW(e){return yH(this,arguments,function(){var t,n,r,o;return $4(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,bc(t.read())];case 3:return n=a.sent(),r=n.value,o=n.done,o?[4,bc(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,bc(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function AW(e){return br(e==null?void 0:e.getReader)}function ck(e){if(e instanceof os)return e;if(e!=null){if(yW(e))return TW(e);if(vW(e))return NW(e);if(bW(e))return RW(e);if(_W(e))return uk(e);if(CW(e))return kW(e);if(AW(e))return IW(e)}throw SW(e)}function TW(e){return new os(function(t){var n=e[l_]();if(br(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function NW(e){return new os(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function RW(e){return new os(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,sk)})}function kW(e){return new os(function(t){var n,r;try{for(var o=Lc(e),a=o.next();!a.done;a=o.next()){var c=a.value;if(t.next(c),t.closed)return}}catch(l){n={error:l}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function uk(e){return new os(function(t){OW(e,t).catch(function(n){return t.error(n)})})}function IW(e){return uk(xW(e))}function OW(e,t){var n,r,o,a;return bH(this,void 0,void 0,function(){var c,l;return $4(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),n=_H(e),d.label=1;case 1:return[4,n.next()];case 2:if(r=d.sent(),!!r.done)return[3,4];if(c=r.value,t.next(c),t.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=d.sent(),o={error:l},[3,11];case 6:return d.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function BW(e,t){return If(function(n,r){var o=0;n.subscribe(rg(r,function(a){r.next(e.call(t,a,o++))}))})}function dk(e,t){return If(function(n,r){var o=0;n.subscribe(rg(r,function(a){return e.call(t,a,o++)&&r.next(a)}))})}function fk(e,t){return t===void 0&&(t=gW),If(function(n,r){var o=null,a=null,c=null,l=function(){if(o){o.unsubscribe(),o=null;var f=a;a=null,r.next(f)}};function d(){var f=c+e,p=t.now();if(p<f){o=this.schedule(void 0,f-p),r.add(o);return}l()}n.subscribe(rg(r,function(f){a=f,c=t.now(),o||(o=t.schedule(d,e),r.add(o))},function(){l(),r.complete()},void 0,function(){a=o=null}))})}function hk(e,t){return t===void 0&&(t=ak),e=e??DW,If(function(n,r){var o,a=!0;n.subscribe(rg(r,function(c){var l=t(c);(a||!e(o,l))&&(a=!1,o=l,r.next(c))}))})}function DW(e,t){return e===t}function LW(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new lk}:t,r=e.resetOnError,o=r===void 0?!0:r,a=e.resetOnComplete,c=a===void 0?!0:a,l=e.resetOnRefCountZero,d=l===void 0?!0:l;return function(f){var p,h,g,b=0,x=!1,E=!1,v=function(){h==null||h.unsubscribe(),h=void 0},y=function(){v(),p=g=void 0,x=E=!1},_=function(){var S=p;y(),S==null||S.unsubscribe()};return If(function(S,N){b++,!E&&!x&&v();var I=g=g??n();N.add(function(){b--,b===0&&!E&&!x&&(h=Yb(_,d))}),I.subscribe(N),!p&&b>0&&(p=new rf({next:function(R){return I.next(R)},error:function(R){E=!0,v(),h=Yb(y,o,R),I.error(R)},complete:function(){x=!0,v(),h=Yb(y,c),I.complete()}}),ck(S).subscribe(p))})(f)}}function Yb(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var o=new rf({next:function(){o.unsubscribe(),e()}});return ck(t.apply(void 0,qd([],Jd(n)))).subscribe(o)}}/**
286
+ * Copyright (c) 2017 The xterm.js authors. All rights reserved.
287
+ * @license MIT
288
+ */const MW=2,UW=1;class FW{constructor(){}activate(t){this._terminal=t}dispose(){}fit(t){const n=this.proposeDimensions();if(t!==void 0&&n&&(n.rows=t),!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;const r=this._terminal._core;return(this._terminal.rows!==n.rows||this._terminal.cols!==n.cols)&&(r._renderService.clear(),this._terminal.resize(n.cols,n.rows)),n}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const t=this.getCore(),n=t._renderService.dimensions;if(n.css.cell.width===0||n.css.cell.height===0)return;const r=this._terminal.options.scrollback===0?0:t.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(o.getPropertyValue("height")),c=Math.max(0,parseInt(o.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),d={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},f=d.top+d.bottom,p=d.right+d.left,h=a-f,g=c-p-r,{width:b,height:x}=this.getCellSize();return{cols:Math.max(MW,Math.floor(g/b)),rows:Math.max(UW,Math.floor(h/x))}}getCellSize(){const{value:t}=this.getCore()._renderService._renderer;return{width:t._charSizeService.width+Math.round(t._optionsService.rawOptions.letterSpacing),height:Math.floor(t._charSizeService.height*t._optionsService.rawOptions.lineHeight)}}getCore(){return this._terminal._core}}function VW({}){}function PW(e){return e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}function jW(e){const t=new Date().getTime()-e.getTime(),n=Math.floor(t/1e3)*-1,r=new Intl.RelativeTimeFormat("en",{numeric:"auto"});return Math.abs(n)<60?r.format(Math.round(n),"second"):Math.abs(n)<3600?r.format(Math.round(n/60),"minute"):Math.abs(n)<86400?r.format(Math.round(n/3600),"hour"):r.format(Math.round(n/86400),"day")}const zW=et`<svg
289
289
  class="icon"
290
290
  width="16"
291
291
  height="16"
@@ -1565,9 +1565,9 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
1565
1565
  --vscode-widget-border: #e5e5e5;
1566
1566
  --vscode-activityBarBadge-background: #005fb8;
1567
1567
  }
1568
- `;var nG=Object.defineProperty,rG=Object.getOwnPropertyDescriptor,gk=e=>{throw TypeError(e)},bn=(e,t,n,r)=>{for(var o=r>1?void 0:r?rG(t,n):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=(r?c(t,n,o):c(o))||o);return r&&o&&nG(t,n,o),o},iG=(e,t,n)=>t.has(e)||gk("Cannot "+n),oG=(e,t,n)=>t.has(e)?gk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Lt=(e,t,n)=>(iG(e,t,"access private method"),n),Ot,ig,vk,bk,Op,Js,ny,yk,_k,ry,Sk,iy,Ek,wk,Ck,xk,Ak,Tk,Nk,Rk,kk=(e=>(e.OpenLink="Open",e.CopyToClipboard="Copy to clipboard",e.Cancel="Cancel",e))(kk||{});const yc=(...e)=>`--vscode-${e.join("-")}`,pc=e=>yc("terminal",e),sG=e=>`ansi${e.charAt(0).toUpperCase()+e.slice(1)}`,aG=["terminal:","theme:",Et.platformApiRequest,Et.platformApiResponse,Et.onOptionsMessage,Et.optionsMessage,Et.onCopyTextToClipboard,Et.onProgramClose,Et.featuresResponse,Et.featuresUpdateAction],lG=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],cG="terminal-view";let an=class extends vr{constructor(){super(),oG(this,Ot),this.copyText="Copy",this.disposables=[],this.rows=10,this.isShareReady=!1,this.buttons=!0,this.takeFocus=!0,this.theme="dark",this.isLoading=!1,this.isCreatingEscalation=!1,this.isUpdatedReady=!1,this.isAutoSaveEnabled=!1,this.isPlatformAuthEnabled=!1,this.isDaggerOutput=!1,this.windowSize={height:window.innerHeight,width:window.innerWidth}}applyThemeStyles(){if(this.shadowRoot){if(this.themeStyleSheet){const e=this.shadowRoot.adoptedStyleSheets.indexOf(this.themeStyleSheet);e!==-1&&(this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.filter((t,n)=>n!==e)),this.themeStyleSheet=void 0}this.theme==="dark"?(this.themeStyleSheet=new CSSStyleSheet,this.themeStyleSheet.replaceSync(eG.cssText),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.themeStyleSheet]):this.theme==="light"&&(this.themeStyleSheet=new CSSStyleSheet,this.themeStyleSheet.replaceSync(tG.cssText),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.themeStyleSheet])}}connectedCallback(){var e;if(super.connectedCallback(),this.applyThemeStyles(),!this.id)throw new Error("No id provided to terminal!");this.rows=this.initialRows??this.rows;const{rows:t,cursorBlink:n,fontSize:r,cursorStyle:o,cursorWidth:a,fontFamily:c,smoothScrollDuration:l,scrollback:d}=this;this.terminal=new HH.Terminal({rows:t,fontSize:r,fontFamily:c,scrollback:d,cursorWidth:a,cursorBlink:n,cursorStyle:o,smoothScrollDuration:l,disableStdin:!1,convertEol:!0,allowProposedApi:!0,drawBoldTextInBrightColors:!1}),this.initialContent&&((e=this.terminal)==null||e.write(this.initialContent)),this.fitAddon=new LW,this.fitAddon.activate(this.terminal),this.serializer=new ZH.SerializeAddon,this.terminal.loadAddon(this.serializer),this.terminal.loadAddon(new XH.Unicode11Addon),this.terminal.loadAddon(new JH.WebLinksAddon(Lt(this,Ot,Ak).bind(this))),this.terminal.attachCustomKeyEventHandler(p=>{var h;if(p.shiftKey&&p.ctrlKey&&p.code==="KeyC"){const g=(h=this==null?void 0:this.terminal)==null?void 0:h.getSelection();if(g)return navigator.clipboard.writeText(g),!1}return!0}),this.terminal.unicode.activeVersion="11",this.terminal.options.drawBoldTextInBrightColors;const f=oi();this.disposables.push(gH(f,async p=>{var h;if(aG.some(g=>p.type.startsWith(g)))switch(p.type){case Et.activeThemeChanged:Lt(this,Ot,Op).call(this);break;case Et.terminalStdout:case Et.terminalStderr:{const{"runme.dev/id":g,data:b}=p.output;if(g!==this.id)return;this.isShareReady=!1,this.terminal.write(b),this.requestUpdate()}break;case Et.platformApiResponse:{if(p.output.id!==this.id)return;if(this.isLoading=!1,p.output.hasErrors)return lr(f,Et.errorMessage,p.output.data);if(p.output.data.hasOwnProperty("displayShare")&&p.output.data.displayShare===!1)return;const g=((h=p.output.data)==null?void 0:h.data)||{};if(g.createExtensionCellOutput||g.createCellExecution){const b=g.createCellExecution||g.createExtensionCellOutput||{},{exitCode:x,id:E,htmlUrl:v,isSlackReady:y}=b;return this.platformId=E,this.shareUrl=v||"",this.exitCode=x,this.isSlackReady=!!y,this.isShareReady=!0,lr(f,Et.tangleEvent,{webviewId:Y4.RunmeCloud,data:{cellId:E}})}if(g.updateCellOutput){const{updateCellOutput:{exitCode:b,isSlackReady:x}}=g;this.isUpdatedReady=!0,this.exitCode=b,this.isSlackReady=!!x,Lt(this,Ot,Sk).call(this)}g.createEscalation&&(this.escalationUrl=g.createEscalation.escalationUrl)}break;case Et.onOptionsMessage:{if(p.output.id!==this.id)return;const g=p.output.option;switch(this.isLoading=!1,g){case"Open":return lr(f,Et.openExternalLink,{link:this.shareUrl,telemetryEvent:"app.openLink"});case"Copy to clipboard":return lr(f,Et.copyTextToClipboard,{id:this.id,text:this.shareUrl})}}break;case Et.onCopyTextToClipboard:return p.output.id!==this.id?void 0:lr(f,Et.infoMessage,"Link copied!");case Et.onProgramClose:{const{"runme.dev/id":g,code:b}=p.output;if(g!==this.id)return;this.exitCode=b;return}}}),this.terminal.onData(p=>lr(f,Et.terminalStdin,{"runme.dev/id":this.id,input:p}))),lr(f,Et.featuresRequest,{})}disconnectedCallback(){super.disconnectedCallback(),this.dispose()}updated(e){super.updated(e),e.has("theme")&&(this.applyThemeStyles(),Lt(this,Ot,Op).call(this))}firstUpdated(e){var t;super.firstUpdated(e);const n=Lt(this,Ot,bk).call(this);this.takeFocus&&window.addEventListener("focus",()=>{Lt(this,Ot,ry).call(this)}),window.addEventListener("click",()=>{Lt(this,Ot,ry).call(this,!1)}),this.terminal.open(n),this.takeFocus&&this.terminal.focus(),Lt(this,Ot,ig).call(this),Lt(this,Ot,Op).call(this);const r=Lt(this,Ot,vk).call(this),o=new os(c=>{window.addEventListener("resize",()=>c.next(Lt(this,Ot,ny).call(this,!0))),n.addEventListener("mouseup",()=>c.next(Lt(this,Ot,ny).call(this,!1)))}).pipe(OW());Lt(this,Ot,yk).call(this,o),Lt(this,Ot,_k).call(this,o),n.appendChild(r);const a=oi();a.postMessage&&lr(a,Et.terminalOpen,{"runme.dev/id":this.id,terminalDimensions:Ik((t=this.fitAddon)==null?void 0:t.proposeDimensions())}),this.lastLine&&this.terminal.scrollToLine(this.lastLine)}render(){const e=et`
1568
+ `;var nG=Object.defineProperty,rG=Object.getOwnPropertyDescriptor,gk=e=>{throw TypeError(e)},bn=(e,t,n,r)=>{for(var o=r>1?void 0:r?rG(t,n):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=(r?c(t,n,o):c(o))||o);return r&&o&&nG(t,n,o),o},iG=(e,t,n)=>t.has(e)||gk("Cannot "+n),oG=(e,t,n)=>t.has(e)?gk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Lt=(e,t,n)=>(iG(e,t,"access private method"),n),Ot,ig,vk,bk,Op,Js,ny,yk,_k,ry,Sk,iy,Ek,wk,Ck,xk,Ak,Tk,Nk,Rk,kk=(e=>(e.OpenLink="Open",e.CopyToClipboard="Copy to clipboard",e.Cancel="Cancel",e))(kk||{});const yc=(...e)=>`--vscode-${e.join("-")}`,pc=e=>yc("terminal",e),sG=e=>`ansi${e.charAt(0).toUpperCase()+e.slice(1)}`,aG=["terminal:","theme:",Et.platformApiRequest,Et.platformApiResponse,Et.onOptionsMessage,Et.optionsMessage,Et.onCopyTextToClipboard,Et.onProgramClose,Et.featuresResponse,Et.featuresUpdateAction],lG=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],cG="console-view";let an=class extends vr{constructor(){super(),oG(this,Ot),this.copyText="Copy",this.disposables=[],this.rows=10,this.isShareReady=!1,this.buttons=!0,this.takeFocus=!0,this.theme="dark",this.isLoading=!1,this.isCreatingEscalation=!1,this.isUpdatedReady=!1,this.isAutoSaveEnabled=!1,this.isPlatformAuthEnabled=!1,this.isDaggerOutput=!1,this.windowSize={height:window.innerHeight,width:window.innerWidth}}applyThemeStyles(){if(this.shadowRoot){if(this.themeStyleSheet){const e=this.shadowRoot.adoptedStyleSheets.indexOf(this.themeStyleSheet);e!==-1&&(this.shadowRoot.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets.filter((t,n)=>n!==e)),this.themeStyleSheet=void 0}this.theme==="dark"?(this.themeStyleSheet=new CSSStyleSheet,this.themeStyleSheet.replaceSync(eG.cssText),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.themeStyleSheet]):this.theme==="light"&&(this.themeStyleSheet=new CSSStyleSheet,this.themeStyleSheet.replaceSync(tG.cssText),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.themeStyleSheet])}}connectedCallback(){var e;if(super.connectedCallback(),this.applyThemeStyles(),!this.id)throw new Error("No id provided to terminal!");this.rows=this.initialRows??this.rows;const{rows:t,cursorBlink:n,fontSize:r,cursorStyle:o,cursorWidth:a,fontFamily:c,smoothScrollDuration:l,scrollback:d}=this;this.terminal=new ZH.Terminal({rows:t,fontSize:r,fontFamily:c,scrollback:d,cursorWidth:a,cursorBlink:n,cursorStyle:o,smoothScrollDuration:l,disableStdin:!1,convertEol:!0,allowProposedApi:!0,drawBoldTextInBrightColors:!1}),this.initialContent&&((e=this.terminal)==null||e.write(this.initialContent)),this.fitAddon=new FW,this.fitAddon.activate(this.terminal),this.serializer=new XH.SerializeAddon,this.terminal.loadAddon(this.serializer),this.terminal.loadAddon(new qH.Unicode11Addon),this.terminal.loadAddon(new eW.WebLinksAddon(Lt(this,Ot,Ak).bind(this))),this.terminal.attachCustomKeyEventHandler(p=>{var h;if(p.shiftKey&&p.ctrlKey&&p.code==="KeyC"){const g=(h=this==null?void 0:this.terminal)==null?void 0:h.getSelection();if(g)return navigator.clipboard.writeText(g),!1}return!0}),this.terminal.unicode.activeVersion="11",this.terminal.options.drawBoldTextInBrightColors;const f=oi();this.disposables.push(gH(f,async p=>{var h;if(aG.some(g=>p.type.startsWith(g)))switch(p.type){case Et.activeThemeChanged:Lt(this,Ot,Op).call(this);break;case Et.terminalStdout:case Et.terminalStderr:{const{"runme.dev/id":g,data:b}=p.output;if(g!==this.id)return;this.isShareReady=!1,this.terminal.write(b),this.requestUpdate()}break;case Et.platformApiResponse:{if(p.output.id!==this.id)return;if(this.isLoading=!1,p.output.hasErrors)return lr(f,Et.errorMessage,p.output.data);if(p.output.data.hasOwnProperty("displayShare")&&p.output.data.displayShare===!1)return;const g=((h=p.output.data)==null?void 0:h.data)||{};if(g.createExtensionCellOutput||g.createCellExecution){const b=g.createCellExecution||g.createExtensionCellOutput||{},{exitCode:x,id:E,htmlUrl:v,isSlackReady:y}=b;return this.platformId=E,this.shareUrl=v||"",this.exitCode=x,this.isSlackReady=!!y,this.isShareReady=!0,lr(f,Et.tangleEvent,{webviewId:Y4.RunmeCloud,data:{cellId:E}})}if(g.updateCellOutput){const{updateCellOutput:{exitCode:b,isSlackReady:x}}=g;this.isUpdatedReady=!0,this.exitCode=b,this.isSlackReady=!!x,Lt(this,Ot,Sk).call(this)}g.createEscalation&&(this.escalationUrl=g.createEscalation.escalationUrl)}break;case Et.onOptionsMessage:{if(p.output.id!==this.id)return;const g=p.output.option;switch(this.isLoading=!1,g){case"Open":return lr(f,Et.openExternalLink,{link:this.shareUrl,telemetryEvent:"app.openLink"});case"Copy to clipboard":return lr(f,Et.copyTextToClipboard,{id:this.id,text:this.shareUrl})}}break;case Et.onCopyTextToClipboard:return p.output.id!==this.id?void 0:lr(f,Et.infoMessage,"Link copied!");case Et.onProgramClose:{const{"runme.dev/id":g,code:b}=p.output;if(g!==this.id)return;this.exitCode=b;return}}}),this.terminal.onData(p=>lr(f,Et.terminalStdin,{"runme.dev/id":this.id,input:p}))),lr(f,Et.featuresRequest,{})}disconnectedCallback(){super.disconnectedCallback(),this.dispose()}updated(e){super.updated(e),e.has("theme")&&(this.applyThemeStyles(),Lt(this,Ot,Op).call(this))}firstUpdated(e){var t;super.firstUpdated(e);const n=Lt(this,Ot,bk).call(this);this.takeFocus&&window.addEventListener("focus",()=>{Lt(this,Ot,ry).call(this)}),window.addEventListener("click",()=>{Lt(this,Ot,ry).call(this,!1)}),this.terminal.open(n),this.takeFocus&&this.terminal.focus(),Lt(this,Ot,ig).call(this),Lt(this,Ot,Op).call(this);const r=Lt(this,Ot,vk).call(this),o=new os(c=>{window.addEventListener("resize",()=>c.next(Lt(this,Ot,ny).call(this,!0))),n.addEventListener("mouseup",()=>c.next(Lt(this,Ot,ny).call(this,!1)))}).pipe(LW());Lt(this,Ot,yk).call(this,o),Lt(this,Ot,_k).call(this,o),n.appendChild(r);const a=oi();a.postMessage&&lr(a,Et.terminalOpen,{"runme.dev/id":this.id,terminalDimensions:Ik((t=this.fitAddon)==null?void 0:t.proposeDimensions())}),this.lastLine&&this.terminal.scrollToLine(this.lastLine)}render(){const e=et`
1569
1569
  <close-cell-button
1570
- @closed="${()=>MW({id:this.id,outputType:Z4.terminal})}"
1570
+ @closed="${()=>VW({id:this.id,outputType:Z4.terminal})}"
1571
1571
  ></close-cell-button>
1572
1572
  <div class="button-group">
1573
1573
  <copy-button
@@ -1608,7 +1608,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
1608
1608
  `;return et`<section>
1609
1609
  <div id="terminal"></div>
1610
1610
  ${Rn(this.buttons,()=>e)}
1611
- </section>`}dispose(){this.disposables.forEach(({dispose:e})=>e())}shouldRenderSaveButton(){return!1}shouldRenderShareButton(){return!1}};Ot=new WeakSet;ig=function(e){var t;return e!==void 0&&(this.rows=e),(t=this.fitAddon)==null?void 0:t.fit(this.rows)};vk=function(){const e=document.createElement("div");e.setAttribute("class","xterm-drag-handle");let t;const n=a=>{var c;t={initialClientY:a.clientY,initialRows:this.rows},a.preventDefault(),(c=this.terminal)==null||c.focus()},r=()=>{t!==void 0&&(t=void 0)},o=a=>{var c;if(t===void 0||!this.fitAddon)return;const l=(a.clientY-t.initialClientY)/this.fitAddon.getCellSize().height,d=Math.round(t.initialRows+l);d!==this.rows&&(Lt(this,Ot,ig).call(this,d),(c=this.terminal)==null||c.focus())};return e.addEventListener("mousedown",n),window.addEventListener("mouseup",r),window.addEventListener("mousemove",o),this.disposables.push({dispose:()=>{e.removeEventListener("mousedown",n),window.removeEventListener("mouseup",r),window.removeEventListener("mousemove",o)}}),e};bk=function(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("#terminal")};Op=function(){const e=Lt(this,Ot,Js).call(this,pc("foreground")),t={foreground:e,cursor:Lt(this,Ot,Js).call(this,yc("terminalCursor","foreground"))||e,cursorAccent:Lt(this,Ot,Js).call(this,yc("terminalCursor","background")),selectionForeground:Lt(this,Ot,Js).call(this,pc("selectionForeground")),selectionBackground:Lt(this,Ot,Js).call(this,pc("selectionBackground")),selectionInactiveBackground:Lt(this,Ot,Js).call(this,pc("inactiveSelectionBackground")),...Object.fromEntries(lG.map(n=>[n,Lt(this,Ot,Js).call(this,pc(sG(n)))]))};this.terminal.options.theme=t};Js=function(e){var t;const n=(t=this.shadowRoot)==null?void 0:t.querySelector("#terminal");return getComputedStyle(n).getPropertyValue(e)??void 0};ny=function(e){if(!this.fitAddon)return;const{innerWidth:t,innerHeight:n}=window;if(e&&Math.abs(this.windowSize.width-t)<=Number.EPSILON&&Math.abs(this.windowSize.height-n)<=Number.EPSILON)return;this.windowSize.width=t;const r=Lt(this,Ot,ig).call(this);if(r)return Ik(r)};yk=async function(e){const t=e.pipe(ck(n=>!!n),dk(),uk(100)).subscribe(async n=>{const r=oi();r.postMessage&&await lr(r,Et.terminalResize,{"runme.dev/id":this.id,terminalDimensions:n})});this.disposables.push({dispose:()=>t.unsubscribe()})};_k=async function(e){const t=e.pipe(kW(n=>n==null?void 0:n.rows),ck(n=>!!n),dk(),uk(100)).subscribe(async n=>{const r=oi();r.postMessage&&r.postMessage({type:Et.mutateAnnotations,output:{annotations:{"runme.dev/id":this.id,terminalRows:n}}})});this.disposables.push({dispose:()=>t.unsubscribe()})};ry=async function(e=!0){var t;e&&((t=this.terminal)==null||t.focus());const n=oi();n.postMessage&&await lr(n,Et.terminalFocus,{"runme.dev/id":this.id})};Sk=async function(){const e=oi();if(!(!e.postMessage||!this.shareUrl))return lr(e,Et.optionsMessage,{title:'Please share link with caution. Anyone with the link has access. Click "Open" to toggle visibility.',options:Object.values(kk),id:this.id,telemetryEvent:"app.share"})};iy=async function(){return Lt(this,Ot,xk).call(this,!0)};Ek=async function(){this.isCreatingEscalation=!0};wk=async function(){const e=oi();if(this.escalationUrl)return lr(e,Et.openLink,this.escalationUrl)};Ck=function(){const e=oi();if(e.postMessage)return lr(e,Et.gistCell,{cellId:this.id,telemetryEvent:"app.cellGist"})};xk=async function(e){oi().postMessage};Ak=function(e,t){lr(oi(),Et.openLink,t)};Tk=function(){lr(oi(),Et.openLink,this.shareUrl)};Nk=function(){lr(oi(),Et.errorMessage,`There is no Slack integration configured yet.
1611
+ </section>`}dispose(){this.disposables.forEach(({dispose:e})=>e())}shouldRenderSaveButton(){return!1}shouldRenderShareButton(){return!1}};Ot=new WeakSet;ig=function(e){var t;return e!==void 0&&(this.rows=e),(t=this.fitAddon)==null?void 0:t.fit(this.rows)};vk=function(){const e=document.createElement("div");e.setAttribute("class","xterm-drag-handle");let t;const n=a=>{var c;t={initialClientY:a.clientY,initialRows:this.rows},a.preventDefault(),(c=this.terminal)==null||c.focus()},r=()=>{t!==void 0&&(t=void 0)},o=a=>{var c;if(t===void 0||!this.fitAddon)return;const l=(a.clientY-t.initialClientY)/this.fitAddon.getCellSize().height,d=Math.round(t.initialRows+l);d!==this.rows&&(Lt(this,Ot,ig).call(this,d),(c=this.terminal)==null||c.focus())};return e.addEventListener("mousedown",n),window.addEventListener("mouseup",r),window.addEventListener("mousemove",o),this.disposables.push({dispose:()=>{e.removeEventListener("mousedown",n),window.removeEventListener("mouseup",r),window.removeEventListener("mousemove",o)}}),e};bk=function(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("#terminal")};Op=function(){const e=Lt(this,Ot,Js).call(this,pc("foreground")),t={foreground:e,cursor:Lt(this,Ot,Js).call(this,yc("terminalCursor","foreground"))||e,cursorAccent:Lt(this,Ot,Js).call(this,yc("terminalCursor","background")),selectionForeground:Lt(this,Ot,Js).call(this,pc("selectionForeground")),selectionBackground:Lt(this,Ot,Js).call(this,pc("selectionBackground")),selectionInactiveBackground:Lt(this,Ot,Js).call(this,pc("inactiveSelectionBackground")),...Object.fromEntries(lG.map(n=>[n,Lt(this,Ot,Js).call(this,pc(sG(n)))]))};this.terminal.options.theme=t};Js=function(e){var t;const n=(t=this.shadowRoot)==null?void 0:t.querySelector("#terminal");return getComputedStyle(n).getPropertyValue(e)??void 0};ny=function(e){if(!this.fitAddon)return;const{innerWidth:t,innerHeight:n}=window;if(e&&Math.abs(this.windowSize.width-t)<=Number.EPSILON&&Math.abs(this.windowSize.height-n)<=Number.EPSILON)return;this.windowSize.width=t;const r=Lt(this,Ot,ig).call(this);if(r)return Ik(r)};yk=async function(e){const t=e.pipe(dk(n=>!!n),hk(),fk(100)).subscribe(async n=>{const r=oi();r.postMessage&&await lr(r,Et.terminalResize,{"runme.dev/id":this.id,terminalDimensions:n})});this.disposables.push({dispose:()=>t.unsubscribe()})};_k=async function(e){const t=e.pipe(BW(n=>n==null?void 0:n.rows),dk(n=>!!n),hk(),fk(100)).subscribe(async n=>{const r=oi();r.postMessage&&r.postMessage({type:Et.mutateAnnotations,output:{annotations:{"runme.dev/id":this.id,terminalRows:n}}})});this.disposables.push({dispose:()=>t.unsubscribe()})};ry=async function(e=!0){var t;e&&((t=this.terminal)==null||t.focus());const n=oi();n.postMessage&&await lr(n,Et.terminalFocus,{"runme.dev/id":this.id})};Sk=async function(){const e=oi();if(!(!e.postMessage||!this.shareUrl))return lr(e,Et.optionsMessage,{title:'Please share link with caution. Anyone with the link has access. Click "Open" to toggle visibility.',options:Object.values(kk),id:this.id,telemetryEvent:"app.share"})};iy=async function(){return Lt(this,Ot,xk).call(this,!0)};Ek=async function(){this.isCreatingEscalation=!0};wk=async function(){const e=oi();if(this.escalationUrl)return lr(e,Et.openLink,this.escalationUrl)};Ck=function(){const e=oi();if(e.postMessage)return lr(e,Et.gistCell,{cellId:this.id,telemetryEvent:"app.cellGist"})};xk=async function(e){oi().postMessage};Ak=function(e,t){lr(oi(),Et.openLink,t)};Tk=function(){lr(oi(),Et.openLink,this.shareUrl)};Nk=function(){lr(oi(),Et.errorMessage,`There is no Slack integration configured yet.
1612
1612
  Open Dashboard to configure it`)};Rk=function(){var e;const t=oi();if(!t.postMessage)return;const n=uG(((e=this.serializer)==null?void 0:e.serialize({excludeModes:!0,excludeAltBuffer:!0}))??"");return navigator.clipboard.writeText(n).then(()=>{this.copyText="Copied!",this.requestUpdate()}).catch(r=>lr(t,Et.infoMessage,`Failed to copy to clipboard: ${r.message}!`))};an.styles=Gi`
1613
1613
  .xterm {
1614
1614
  cursor: text;
@@ -2106,7 +2106,7 @@ Open Dashboard to configure it`)};Rk=function(){var e;const t=oi();if(!t.postMes
2106
2106
  appearance="icon"
2107
2107
  class="cursor-pointer"
2108
2108
  @click=${this.onCopy}
2109
- >${Rn(this._copied,()=>et`${VZ}`,()=>et`${fk}`)}</vscode-button
2109
+ >${Rn(this._copied,()=>et`${VZ}`,()=>et`${ek}`)}</vscode-button
2110
2110
  >`,()=>et``)}
2111
2111
  </div>
2112
2112
  </div>
@@ -2169,7 +2169,7 @@ Open Dashboard to configure it`)};Rk=function(){var e;const t=oi();if(!t.postMes
2169
2169
  `;var GZ=Object.defineProperty,ZZ=Object.getOwnPropertyDescriptor,tI=e=>{throw TypeError(e)},nI=(e,t,n,r)=>{for(var o=r>1?void 0:r?ZZ(t,n):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=(r?c(t,n,o):c(o))||o);return r&&o&&GZ(t,n,o),o},YZ=(e,t,n)=>t.has(e)||tI("Cannot "+n),$Z=(e,t,n)=>t.has(e)?tI("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),lc=(e,t,n)=>(YZ(e,t,"access private method"),n),qs,rI,iI,yd;const XZ="__",KZ=[{text:"Name"},{text:"Value"},{text:"Description"},{text:"Spec"},{text:"Source"},{text:"Updated"}],JZ=["resolvedValue","errors","status","specClass"];let cy=class extends vr{constructor(){super(...arguments),$Z(this,qs),this.disposables=[]}dispose(){this.disposables.forEach(({dispose:e})=>e())}render(){var e;return lc(this,qs,iI).call(this),et` <div>
2170
2170
  <table-view
2171
2171
  .columns="${KZ}"
2172
- .rows="${(e=this.variables)==null?void 0:e.map(t=>({name:t.name,status:t.status,originalValue:t.originalValue,description:t.description,spec:t.spec,specClass:t.isRequired?"required":"optional",source:t.origin,updatedAt:UW(new Date(t.updateTime)),resolvedValue:t.resolvedValue,errors:t.errors}))}"
2172
+ .rows="${(e=this.variables)==null?void 0:e.map(t=>({name:t.name,status:t.status,originalValue:t.originalValue,description:t.description,spec:t.spec,specClass:t.isRequired?"required":"optional",source:t.origin,updatedAt:PW(new Date(t.updateTime)),resolvedValue:t.resolvedValue,errors:t.errors}))}"
2173
2173
  .displayable="${(t,n)=>!JZ.includes(n)}"
2174
2174
  .hasErrors="${t=>{var n;return!(!((n=t.errors)!=null&&n.length)||t.name===XZ)}}"
2175
2175
  .renderer="${(t,n)=>{switch(n){case"originalValue":const r=t.status===Ko.LITERAL;let o=t.status===Ko.MASKED?`${t.resolvedValue} [masked]`:t.resolvedValue;return t.status===Ko.UNSPECIFIED?o="[unset]":t.status===Ko.HIDDEN&&(o="[hidden]"),o=o.replace(/\n/g," ").replace(/\r/g,""),et`<env-viewer
@@ -2178,7 +2178,7 @@ Open Dashboard to configure it`)};Rk=function(){var e;const t=oi();if(!t.postMes
2178
2178
  .maskedValue="${lc(this,qs,yd).call(this,t,n,()=>o)}"
2179
2179
  .status="${t.status}"
2180
2180
  @onCopy="${async()=>lc(this,qs,rI).call(this,t.originalValue)}"
2181
- ></env-viewer>`;case"updatedAt":return lc(this,qs,yd).call(this,t,n,()=>t[n]?FW(new Date(t[n])):"");case"spec":return lc(this,qs,yd).call(this,t,n,()=>et`<span class="${t.specClass}">${t[n]}</span>`);default:return lc(this,qs,yd).call(this,t,n,()=>t[n])}}}"
2181
+ ></env-viewer>`;case"updatedAt":return lc(this,qs,yd).call(this,t,n,()=>t[n]?jW(new Date(t[n])):"");case"spec":return lc(this,qs,yd).call(this,t,n,()=>et`<span class="${t.specClass}">${t[n]}</span>`);default:return lc(this,qs,yd).call(this,t,n,()=>t[n])}}}"
2182
2182
  ></table-view>
2183
2183
  </div>`}};qs=new WeakSet;rI=function(e){return navigator.clipboard.writeText(e)};iI=function(){var e;(e=this.variables)==null||e.sort((t,n)=>t.errors.length>0?-1:n.errors.length>0?1:0)};yd=function(e,t,n){var r;const o=t==="name"?et`${WZ(10,10)}`:et``;return(r=e.errors)!=null&&r.length?et`<div class="flex">
2184
2184
  <tooltip-text
@@ -2195,7 +2195,7 @@ Open Dashboard to configure it`)};Rk=function(){var e;const t=oi();if(!t.postMes
2195
2195
  </div>`:et`${n()}`};nI([dt({type:Array})],cy.prototype,"variables",2);cy=nI([Ai("env-store")],cy);const qZ=Nf("ChVnb29nbGUvcnBjL2NvZGUucHJvdG8SCmdvb2dsZS5ycGMqtwIKBENvZGUSBgoCT0sQABINCglDQU5DRUxMRUQQARILCgdVTktOT1dOEAISFAoQSU5WQUxJRF9BUkdVTUVOVBADEhUKEURFQURMSU5FX0VYQ0VFREVEEAQSDQoJTk9UX0ZPVU5EEAUSEgoOQUxSRUFEWV9FWElTVFMQBhIVChFQRVJNSVNTSU9OX0RFTklFRBAHEhMKD1VOQVVUSEVOVElDQVRFRBAQEhYKElJFU09VUkNFX0VYSEFVU1RFRBAIEhcKE0ZBSUxFRF9QUkVDT05ESVRJT04QCRILCgdBQk9SVEVEEAoSEAoMT1VUX09GX1JBTkdFEAsSEQoNVU5JTVBMRU1FTlRFRBAMEgwKCElOVEVSTkFMEA0SDwoLVU5BVkFJTEFCTEUQDhINCglEQVRBX0xPU1MQD0JYCg5jb20uZ29vZ2xlLnJwY0IJQ29kZVByb3RvUAFaM2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvcnBjL2NvZGU7Y29kZaICA1JQQ2IGcHJvdG8z"),QZ=Q1(qZ,0),eY=e_(QZ),tY=Nf("ChVnb29nbGUvcnBjL2NvZGUucHJvdG8SCmdvb2dsZS5ycGMqtwIKBENvZGUSBgoCT0sQABINCglDQU5DRUxMRUQQARILCgdVTktOT1dOEAISFAoQSU5WQUxJRF9BUkdVTUVOVBADEhUKEURFQURMSU5FX0VYQ0VFREVEEAQSDQoJTk9UX0ZPVU5EEAUSEgoOQUxSRUFEWV9FWElTVFMQBhIVChFQRVJNSVNTSU9OX0RFTklFRBAHEhMKD1VOQVVUSEVOVElDQVRFRBAQEhYKElJFU09VUkNFX0VYSEFVU1RFRBAIEhcKE0ZBSUxFRF9QUkVDT05ESVRJT04QCRILCgdBQk9SVEVEEAoSEAoMT1VUX09GX1JBTkdFEAsSEQoNVU5JTVBMRU1FTlRFRBAMEgwKCElOVEVSTkFMEA0SDwoLVU5BVkFJTEFCTEUQDhINCglEQVRBX0xPU1MQD0JYCg5jb20uZ29vZ2xlLnJwY0IJQ29kZVByb3RvUAFaM2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvcnBjL2NvZGU7Y29kZaICA1JQQ2IGcHJvdG8z"),oI=Nf("CiBydW5tZS9zdHJlYW0vdjEvd2Vic29ja2V0cy5wcm90bxIPcnVubWUuc3RyZWFtLnYxIkIKD1dlYnNvY2tldFN0YXR1cxIeCgRjb2RlGAEgASgOMhAuZ29vZ2xlLnJwYy5Db2RlEg8KB21lc3NhZ2UYAiABKAkiGQoEUGluZxIRCgl0aW1lc3RhbXAYASABKAMiGQoEUG9uZxIRCgl0aW1lc3RhbXAYASABKAMiugEKEFdlYnNvY2tldFJlcXVlc3QSOgoPZXhlY3V0ZV9yZXF1ZXN0GAEgASgLMh8ucnVubWUucnVubmVyLnYyLkV4ZWN1dGVSZXF1ZXN0SAASIwoEcGluZxhkIAEoCzIVLnJ1bm1lLnN0cmVhbS52MS5QaW5nEhYKDWF1dGhvcml6YXRpb24YyAEgASgJEhEKCGtub3duX2lkGNIBIAEoCRIPCgZydW5faWQY3AEgASgJQgkKB3BheWxvYWQi2AEKEVdlYnNvY2tldFJlc3BvbnNlEjwKEGV4ZWN1dGVfcmVzcG9uc2UYASABKAsyIC5ydW5tZS5ydW5uZXIudjIuRXhlY3V0ZVJlc3BvbnNlSAASIwoEcG9uZxhkIAEoCzIVLnJ1bm1lLnN0cmVhbS52MS5Qb25nEjEKBnN0YXR1cxjIASABKAsyIC5ydW5tZS5zdHJlYW0udjEuV2Vic29ja2V0U3RhdHVzEhEKCGtub3duX2lkGNIBIAEoCRIPCgZydW5faWQY3AEgASgJQgkKB3BheWxvYWRCSFpGZ2l0aHViLmNvbS9ydW5tZWRldi9ydW5tZS92My9hcGkvZ2VuL3Byb3RvL2dvL3J1bm1lL3N0cmVhbS92MTtzdHJlYW12MWIGcHJvdG8z",[tY,tg]),uy=Kc(oI,3),nY=Kc(oI,4);var dy=function(e,t){return dy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},dy(e,t)};function ua(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");dy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function rY(e,t,n,r){function o(a){return a instanceof n?a:new n(function(c){c(a)})}return new(n||(n=Promise))(function(a,c){function l(p){try{f(r.next(p))}catch(h){c(h)}}function d(p){try{f(r.throw(p))}catch(h){c(h)}}function f(p){p.done?a(p.value):o(p.value).then(l,d)}f((r=r.apply(e,[])).next())})}function sI(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,o,a,c=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return c.next=l(0),c.throw=l(1),c.return=l(2),typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(f){return function(p){return d([f,p])}}function d(f){if(r)throw new TypeError("Generator is already executing.");for(;c&&(c=0,f[0]&&(n=0)),n;)try{if(r=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,o=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(p){f=[6,p],o=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Wc(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function as(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,a=[],c;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(l){c={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return a}function oa(e,t,n){if(arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function _c(e){return this instanceof _c?(this.v=e,this):new _c(e)}function iY(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",c),o[Symbol.asyncIterator]=function(){return this},o;function c(b){return function(x){return Promise.resolve(x).then(b,h)}}function l(b,x){r[b]&&(o[b]=function(E){return new Promise(function(v,y){a.push([b,E,v,y])>1||d(b,E)})},x&&(o[b]=x(o[b])))}function d(b,x){try{f(r[b](x))}catch(E){g(a[0][3],E)}}function f(b){b.value instanceof _c?Promise.resolve(b.value.v).then(p,h):g(a[0][2],b)}function p(b){d("next",b)}function h(b){d("throw",b)}function g(b,x){b(x),a.shift(),a.length&&d(a[0][0],a[0][1])}}function oY(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Wc=="function"?Wc(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(a){n[a]=e[a]&&function(c){return new Promise(function(l,d){c=e[a](c),o(l,d,c.done,c.value)})}}function o(a,c,l,d){Promise.resolve(d).then(function(f){a({value:f,done:l})},c)}}function Zt(e){return typeof e=="function"}function aI(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var qb=aI(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
2196
2196
  `+t.map(function(n,r){return r+1+") "+n.toString()}).join(`
2197
2197
  `):"",this.name="UnsubscriptionError",this.errors=t}});function vm(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Of=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,a;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Wc(c),d=l.next();!d.done;d=l.next()){var f=d.value;f.remove(this)}}catch(E){t={error:E}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else c.remove(this);var p=this.initialTeardown;if(Zt(p))try{p()}catch(E){a=E instanceof qb?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var g=Wc(h),b=g.next();!b.done;b=g.next()){var x=b.value;try{J5(x)}catch(E){a=a??[],E instanceof qb?a=oa(oa([],as(a)),as(E.errors)):a.push(E)}}}catch(E){r={error:E}}finally{try{b&&!b.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}}if(a)throw new qb(a)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)J5(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&vm(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&vm(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),lI=Of.EMPTY;function cI(e){return e instanceof Of||e&&"closed"in e&&Zt(e.remove)&&Zt(e.add)&&Zt(e.unsubscribe)}function J5(e){Zt(e)?e():e.unsubscribe()}var sY={Promise:void 0},aY={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,oa([e,t],as(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function uI(e){aY.setTimeout(function(){throw e})}function ff(){}function Lp(e){e()}var A_=(function(e){ua(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,cI(n)&&n.add(r)):r.destination=uY,r}return t.create=function(n,r,o){return new hf(n,r,o)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Of),lY=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){up(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){up(r)}else up(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){up(n)}},e})(),hf=(function(e){ua(t,e);function t(n,r,o){var a=e.call(this)||this,c;return Zt(n)||!n?c={next:n??void 0,error:r??void 0,complete:o??void 0}:c=n,a.destination=new lY(c),a}return t})(A_);function up(e){uI(e)}function cY(e){throw e}var uY={closed:!0,next:ff,error:cY,complete:ff},T_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ag(e){return e}function dY(e){return e.length===0?ag:e.length===1?e[0]:function(t){return e.reduce(function(n,r){return r(n)},t)}}var Hn=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,a=hY(t)?t:new hf(t,n,r);return Lp(function(){var c=o,l=c.operator,d=c.source;a.add(l?l.call(a,d):d?o._subscribe(a):o._trySubscribe(a))}),a},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=q5(n),new n(function(o,a){var c=new hf({next:function(l){try{t(l)}catch(d){a(d),c.unsubscribe()}},error:a,complete:o});r.subscribe(c)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[T_]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return dY(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=q5(t),new t(function(r,o){var a;n.subscribe(function(c){return a=c},function(c){return o(c)},function(){return r(a)})})},e.create=function(t){return new e(t)},e})();function q5(e){var t;return(t=e??sY.Promise)!==null&&t!==void 0?t:Promise}function fY(e){return e&&Zt(e.next)&&Zt(e.error)&&Zt(e.complete)}function hY(e){return e&&e instanceof A_||fY(e)&&cI(e)}function pY(e){return Zt(e==null?void 0:e.lift)}function fr(e){return function(t){if(pY(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function On(e,t,n,r,o){return new mY(e,t,n,r,o)}var mY=(function(e){ua(t,e);function t(n,r,o,a,c,l){var d=e.call(this,n)||this;return d.onFinalize=c,d.shouldUnsubscribe=l,d._next=r?function(f){try{r(f)}catch(p){n.error(p)}}:e.prototype._next,d._error=a?function(f){try{a(f)}catch(p){n.error(p)}finally{this.unsubscribe()}}:e.prototype._error,d._complete=o?function(){try{o()}catch(f){n.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,d}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t})(A_),gY=aI(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),yi=(function(e){ua(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new Q5(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new gY},t.prototype.next=function(n){var r=this;Lp(function(){var o,a;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var c=Wc(r.currentObservers),l=c.next();!l.done;l=c.next()){var d=l.value;d.next(n)}}catch(f){o={error:f}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;Lp(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var o=r.observers;o.length;)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;Lp(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,a=o.hasError,c=o.isStopped,l=o.observers;return a||c?lI:(this.currentObservers=null,l.push(n),new Of(function(){r.currentObservers=null,vm(l,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,o=r.hasError,a=r.thrownError,c=r.isStopped;o?n.error(a):c&&n.complete()},t.prototype.asObservable=function(){var n=new Hn;return n.source=this,n},t.create=function(n,r){return new Q5(n,r)},t})(Hn),Q5=(function(e){ua(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:lI},t})(yi),vY={now:function(){return Date.now()}},bY=(function(e){ua(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t})(Of),ex={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,oa([e,t],as(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},yY=(function(e){ua(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var a=this.id,c=this.scheduler;return a!=null&&(this.id=this.recycleAsyncId(c,a,r)),this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){return o===void 0&&(o=0),ex.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return r;r!=null&&ex.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var o=!1,a;try{this.work(n)}catch(c){o=!0,a=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),a},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,o=n.scheduler,a=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,vm(a,this),r!=null&&(this.id=this.recycleAsyncId(o,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(bY),tx=(function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=vY.now,e})(),_Y=(function(e){ua(t,e);function t(n,r){r===void 0&&(r=tx.now);var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){for(;n=r.shift();)n.unsubscribe();throw o}},t})(tx),lg=new _Y(yY),SY=lg,dI=new Hn(function(e){return e.complete()});function fI(e){return e&&Zt(e.schedule)}function N_(e){return e[e.length-1]}function EY(e){return Zt(N_(e))?e.pop():void 0}function hI(e){return fI(N_(e))?e.pop():void 0}function wY(e,t){return typeof N_(e)=="number"?e.pop():t}var R_=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function pI(e){return Zt(e==null?void 0:e.then)}function mI(e){return Zt(e[T_])}function gI(e){return Symbol.asyncIterator&&Zt(e==null?void 0:e[Symbol.asyncIterator])}function vI(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function CY(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var bI=CY();function yI(e){return Zt(e==null?void 0:e[bI])}function _I(e){return iY(this,arguments,function(){var t,n,r,o;return sI(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,_c(t.read())];case 3:return n=a.sent(),r=n.value,o=n.done,o?[4,_c(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,_c(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function SI(e){return Zt(e==null?void 0:e.getReader)}function Qn(e){if(e instanceof Hn)return e;if(e!=null){if(mI(e))return xY(e);if(R_(e))return AY(e);if(pI(e))return TY(e);if(gI(e))return EI(e);if(yI(e))return NY(e);if(SI(e))return RY(e)}throw vI(e)}function xY(e){return new Hn(function(t){var n=e[T_]();if(Zt(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function AY(e){return new Hn(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function TY(e){return new Hn(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,uI)})}function NY(e){return new Hn(function(t){var n,r;try{for(var o=Wc(e),a=o.next();!a.done;a=o.next()){var c=a.value;if(t.next(c),t.closed)return}}catch(l){n={error:l}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}t.complete()})}function EI(e){return new Hn(function(t){kY(e,t).catch(function(n){return t.error(n)})})}function RY(e){return EI(_I(e))}function kY(e,t){var n,r,o,a;return rY(this,void 0,void 0,function(){var c,l;return sI(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),n=oY(e),d.label=1;case 1:return[4,n.next()];case 2:if(r=d.sent(),!!r.done)return[3,4];if(c=r.value,t.next(c),t.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=d.sent(),o={error:l},[3,11];case 6:return d.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function el(e,t,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var a=t.schedule(function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!o)return a}function wI(e,t){return t===void 0&&(t=0),fr(function(n,r){n.subscribe(On(r,function(o){return el(r,e,function(){return r.next(o)},t)},function(){return el(r,e,function(){return r.complete()},t)},function(o){return el(r,e,function(){return r.error(o)},t)}))})}function CI(e,t){return t===void 0&&(t=0),fr(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function IY(e,t){return Qn(e).pipe(CI(t),wI(t))}function OY(e,t){return Qn(e).pipe(CI(t),wI(t))}function BY(e,t){return new Hn(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function DY(e,t){return new Hn(function(n){var r;return el(n,t,function(){r=e[bI](),el(n,t,function(){var o,a,c;try{o=r.next(),a=o.value,c=o.done}catch(l){n.error(l);return}c?n.complete():n.next(a)},0,!0)}),function(){return Zt(r==null?void 0:r.return)&&r.return()}})}function xI(e,t){if(!e)throw new Error("Iterable cannot be null");return new Hn(function(n){el(n,t,function(){var r=e[Symbol.asyncIterator]();el(n,t,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}function LY(e,t){return xI(_I(e),t)}function MY(e,t){if(e!=null){if(mI(e))return IY(e,t);if(R_(e))return BY(e,t);if(pI(e))return OY(e,t);if(gI(e))return xI(e,t);if(yI(e))return DY(e,t);if(SI(e))return LY(e,t)}throw vI(e)}function AI(e,t){return t?MY(e,t):Qn(e)}function UY(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=hI(e);return AI(e,n)}function FY(e){return e instanceof Date&&!isNaN(e)}function bi(e,t){return fr(function(n,r){var o=0;n.subscribe(On(r,function(a){r.next(e.call(t,a,o++))}))})}var VY=Array.isArray;function PY(e,t){return VY(t)?e.apply(void 0,oa([],as(t))):e(t)}function jY(e){return bi(function(t){return PY(e,t)})}function zY(e,t,n,r,o,a,c,l){var d=[],f=0,p=0,h=!1,g=function(){h&&!d.length&&!f&&t.complete()},b=function(E){return f<r?x(E):d.push(E)},x=function(E){f++;var v=!1;Qn(n(E,p++)).subscribe(On(t,function(y){t.next(y)},function(){v=!0},void 0,function(){if(v)try{f--;for(var y=function(){var _=d.shift();c||x(_)};d.length&&f<r;)y();g()}catch(_){t.error(_)}}))};return e.subscribe(On(t,b,function(){h=!0,g()})),function(){}}function Ja(e,t,n){return n===void 0&&(n=1/0),Zt(t)?Ja(function(r,o){return bi(function(a,c){return t(r,a,o,c)})(Qn(e(r,o)))},n):(typeof t=="number"&&(n=t),fr(function(r,o){return zY(r,o,e,n)}))}function HY(e){return e===void 0&&(e=1/0),Ja(ag,e)}function WY(e){return new Hn(function(t){Qn(e()).subscribe(t)})}var GY={connector:function(){return new yi},resetOnDisconnect:!0};function Ya(e,t){t===void 0&&(t=GY);var n=null,r=t.connector,o=t.resetOnDisconnect,a=o===void 0?!0:o,c=r(),l=new Hn(function(d){return c.subscribe(d)});return l.connect=function(){return(!n||n.closed)&&(n=WY(function(){return e}).subscribe(c),a&&n.add(function(){return c=r()})),n},l}var ZY=["addListener","removeListener"],YY=["addEventListener","removeEventListener"],$Y=["on","off"];function fy(e,t,n,r){if(Zt(n)&&(r=n,n=void 0),r)return fy(e,t,n).pipe(jY(r));var o=as(JY(e)?YY.map(function(l){return function(d){return e[l](t,d,n)}}):XY(e)?ZY.map(nx(e,t)):KY(e)?$Y.map(nx(e,t)):[],2),a=o[0],c=o[1];if(!a&&R_(e))return Ja(function(l){return fy(l,t,n)})(Qn(e));if(!a)throw new TypeError("Invalid event target");return new Hn(function(l){var d=function(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];return l.next(1<f.length?f:f[0])};return a(d),function(){return c(d)}})}function nx(e,t){return function(n){return function(r){return e[n](t,r)}}}function XY(e){return Zt(e.addListener)&&Zt(e.removeListener)}function KY(e){return Zt(e.on)&&Zt(e.off)}function JY(e){return Zt(e.addEventListener)&&Zt(e.removeEventListener)}function kd(e,t,n){e===void 0&&(e=0),n===void 0&&(n=SY);var r=-1;return t!=null&&(fI(t)?n=t:r=t),new Hn(function(o){var a=FY(e)?+e-n.now():e;a<0&&(a=0);var c=0;return n.schedule(function(){o.closed||(o.next(c++),0<=r?this.schedule(void 0,r):o.complete())},a)})}function qY(e,t){return t===void 0&&(t=lg),kd(e,e,t)}function QY(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=hI(e),r=wY(e,1/0),o=e;return o.length?o.length===1?Qn(o[0]):HY(r)(AI(o,n)):dI}var e$=Array.isArray;function t$(e){return e.length===1&&e$(e[0])?e[0]:e}function Ys(e,t){return fr(function(n,r){var o=0;n.subscribe(On(r,function(a){return e.call(t,a,o++)&&r.next(a)}))})}function n$(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e=t$(e),e.length===1?Qn(e[0]):new Hn(r$(e))}function r$(e){return function(t){for(var n=[],r=function(a){n.push(Qn(e[a]).subscribe(On(t,function(c){if(n){for(var l=0;l<n.length;l++)l!==a&&n[l].unsubscribe();n=null}t.next(c)})))},o=0;n&&!t.closed&&o<e.length;o++)r(o)}}function i$(e){return fr(function(t,n){var r=null,o=null,a=function(){o==null||o.unsubscribe();var c=r;r=[],c&&n.next(c),Qn(e()).subscribe(o=On(n,a,ff))};a(),t.subscribe(On(n,function(c){return r==null?void 0:r.push(c)},function(){r&&n.next(r),n.complete()},void 0,function(){return r=o=null}))})}function TI(e){return fr(function(t,n){var r=null,o=!1,a;r=t.subscribe(On(n,void 0,void 0,function(c){a=Qn(e(c,TI(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):o=!0})),o&&(r.unsubscribe(),r=null,a.subscribe(n))})}function o$(e,t,n,r,o){return function(a,c){var l=n,d=t,f=0;a.subscribe(On(c,function(p){var h=f++;d=l?e(d,p,h):(l=!0,p),c.next(d)},o))}}function rx(e){return e<=0?function(){return dI}:fr(function(t,n){var r=0;t.subscribe(On(n,function(o){++r<=e&&(n.next(o),e<=r&&n.complete())}))})}function s$(e){return fr(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function a$(e,t){return fr(o$(e,t,arguments.length>=2,!0))}function l$(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new yi}:t,r=e.resetOnError,o=r===void 0?!0:r,a=e.resetOnComplete,c=a===void 0?!0:a,l=e.resetOnRefCountZero,d=l===void 0?!0:l;return function(f){var p,h,g,b=0,x=!1,E=!1,v=function(){h==null||h.unsubscribe(),h=void 0},y=function(){v(),p=g=void 0,x=E=!1},_=function(){var S=p;y(),S==null||S.unsubscribe()};return fr(function(S,N){b++,!E&&!x&&v();var I=g=g??n();N.add(function(){b--,b===0&&!E&&!x&&(h=Qb(_,d))}),I.subscribe(N),!p&&b>0&&(p=new hf({next:function(R){return I.next(R)},error:function(R){E=!0,v(),h=Qb(y,o,R),I.error(R)},complete:function(){x=!0,v(),h=Qb(y,c),I.complete()}}),Qn(S).subscribe(p))})(f)}}function Qb(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var o=new hf({next:function(){o.unsubscribe(),e()}});return Qn(t.apply(void 0,oa([],as(n)))).subscribe(o)}}function c$(e){return fr(function(t,n){var r=!1,o=On(n,function(){o==null||o.unsubscribe(),r=!0},ff);Qn(e).subscribe(o),t.subscribe(On(n,function(a){return r&&n.next(a)}))})}function ix(e,t){return fr(function(n,r){var o=null,a=0,c=!1,l=function(){return c&&!o&&r.complete()};n.subscribe(On(r,function(d){o==null||o.unsubscribe();var f=0,p=a++;Qn(e(d,p)).subscribe(o=On(r,function(h){return r.next(t?t(d,h,p,f++):h)},function(){o=null,l()}))},function(){c=!0,l()}))})}function dp(e,t){return t===void 0&&(t=!1),fr(function(n,r){var o=0;n.subscribe(On(r,function(a){var c=e(a,o++);(c||t)&&r.next(a),!c&&r.complete()}))})}function u$(e,t,n){var r=Zt(e)||t||n?{next:e,error:t,complete:n}:e;return r?fr(function(o,a){var c;(c=r.subscribe)===null||c===void 0||c.call(r);var l=!0;o.subscribe(On(a,function(d){var f;(f=r.next)===null||f===void 0||f.call(r,d),a.next(d)},function(){var d;l=!1,(d=r.complete)===null||d===void 0||d.call(r),a.complete()},function(d){var f;l=!1,(f=r.error)===null||f===void 0||f.call(r,d),a.error(d)},function(){var d,f;l&&((d=r.unsubscribe)===null||d===void 0||d.call(r)),(f=r.finalize)===null||f===void 0||f.call(r)}))}):ag}function d$(e,t){return fr(function(n,r){var o=t??{},a=o.leading,c=a===void 0?!0:a,l=o.trailing,d=l===void 0?!1:l,f=!1,p=null,h=null,g=!1,b=function(){h==null||h.unsubscribe(),h=null,d&&(v(),g&&r.complete())},x=function(){h=null,g&&r.complete()},E=function(y){return h=Qn(e(y)).subscribe(On(r,b,x))},v=function(){if(f){f=!1;var y=p;p=null,r.next(y),!g&&E(y)}};n.subscribe(On(r,function(y){f=!0,p=y,!(h&&!h.closed)&&(c?v():E(y))},function(){g=!0,!(d&&f&&h&&!h.closed)&&r.complete()}))})}function ox(e,t,n){t===void 0&&(t=lg);var r=kd(e,t);return d$(function(){return r},n)}function e0(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=EY(e);return fr(function(r,o){for(var a=e.length,c=new Array(a),l=e.map(function(){return!1}),d=!1,f=function(h){Qn(e[h]).subscribe(On(o,function(g){c[h]=g,!d&&!l[h]&&(l[h]=!0,(d=l.every(ag))&&(l=null))},ff))},p=0;p<a;p++)f(p);r.subscribe(On(o,function(h){if(d){var g=oa([h],as(c));o.next(n?n.apply(void 0,oa([],as(g))):g)}}))})}const NI="0123456789ABCDEFGHJKMNPQRSTVWXYZ",bm=32,f$=16,RI=10,sx=0xffffffffffff;var qa;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(qa||(qa={}));class _d extends Error{constructor(t,n){super(`${n} (${t})`),this.name="ULIDError",this.code=t}}function h$(e){const t=Math.floor(e()*bm)%bm;return NI.charAt(t)}function p$(e){const t=m$(),n=t&&(t.crypto||t.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new _d(qa.PRNGDetectFailure,"Failed to find a reliable PRNG")}function m$(){return b$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function g$(e,t){let n="";for(;e>0;e--)n=h$(t)+n;return n}function v$(e,t=RI){if(isNaN(e))throw new _d(qa.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>sx)throw new _d(qa.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${sx}: ${e}`);if(e<0)throw new _d(qa.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new _d(qa.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r="";for(let o=t;o>0;o--)n=e%bm,r=NI.charAt(n)+r,e=(e-n)/bm;return r}function b$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function y$(e,t){const n=p$(),r=Date.now();return v$(r,RI)+g$(f$,n)}const ar=[];for(let e=0;e<256;++e)ar.push((e+256).toString(16).slice(1));function _$(e,t=0){return(ar[e[t+0]]+ar[e[t+1]]+ar[e[t+2]]+ar[e[t+3]]+"-"+ar[e[t+4]]+ar[e[t+5]]+"-"+ar[e[t+6]]+ar[e[t+7]]+"-"+ar[e[t+8]]+ar[e[t+9]]+"-"+ar[e[t+10]]+ar[e[t+11]]+ar[e[t+12]]+ar[e[t+13]]+ar[e[t+14]]+ar[e[t+15]]).toLowerCase()}let t0;const S$=new Uint8Array(16);function E$(){if(!t0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t0=crypto.getRandomValues.bind(crypto)}return t0(S$)}const w$=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ax={randomUUID:w$};function C$(e,t,n){var r;if(ax.randomUUID&&!e)return ax.randomUUID();e=e||{};const o=e.random??((r=e.rng)==null?void 0:r.call(e))??E$();if(o.length<16)throw new Error("Random bytes length must be >= 16");return o[6]=o[6]&15|64,o[8]=o[8]&63|128,_$(o)}const x$=5e3,A$=1e3,fp=4e3,lx=1e3;var kI=(e=>(e.CONTINUOUS="CONTINUOUS",e.INITIAL="INITIAL",e))(kI||{});class II{constructor({knownID:t,runID:n,sequence:r,options:o}){sn(this,"callback"),sn(this,"queue",new yi),sn(this,"subscriptions",[]),sn(this,"reconnect",new yi),sn(this,"client",new Hn),sn(this,"_latencies",new yi),sn(this,"_latenciesConnectable",Ya(this._latencies.asObservable().pipe(a$((a,c)=>{if(c.latency<0){const l=a.get(c.streamID);l&&a.set(c.streamID,{...l,readyState:c.readyState})}else a.set(c.streamID,c);return a},new Map)))),sn(this,"_errors",new yi),sn(this,"_errorsConnectable",Ya(this._errors.asObservable())),sn(this,"_stdout",new yi),sn(this,"_stderr",new yi),sn(this,"_exitCode",new yi),sn(this,"_pid",new yi),sn(this,"_mimeType",new yi),sn(this,"_stdoutConnectable",Ya(this._stdout.asObservable())),sn(this,"_stderrConnectable",Ya(this._stderr.asObservable())),sn(this,"_exitCodeConnectable",Ya(this._exitCode.asObservable())),sn(this,"_pidConnectable",Ya(this._pid.asObservable())),sn(this,"_mimeTypeConnectable",Ya(this._mimeType.asObservable())),sn(this,"knownID"),sn(this,"runID"),sn(this,"sequence"),sn(this,"runnerEndpoint"),sn(this,"interceptors"),sn(this,"autoReconnect"),this.knownID=t,this.runID=n,this.sequence=r,this.runnerEndpoint=o.runnerEndpoint,this.interceptors=o.interceptors,this.autoReconnect=o.autoReconnect,this._latenciesConnectable.connect(),this._errorsConnectable.connect(),this._stdoutConnectable.connect(),this._stderrConnectable.connect(),this._exitCodeConnectable.connect(),this._pidConnectable.connect(),this._mimeTypeConnectable.connect(),this.client=this.reconnect.pipe(ox(lx,lg,{leading:!0,trailing:!0}),ix(a=>this.useSocketClient(a.streamID).pipe(ix(c=>this.useHeartbeat(c,a))))).pipe(l$()),this.subscriptions.push(this.monitor()),this.subscriptions.push(this.process())}get latencies(){return this._latenciesConnectable}get errors(){return this._errorsConnectable}get stdout(){return this._stdoutConnectable}get stderr(){return this._stderrConnectable}get exitCode(){return this._exitCodeConnectable}get pid(){return this._pidConnectable}get mimeType(){return this._mimeTypeConnectable}monitor(){return qY(A$).pipe(Ys(()=>this.autoReconnect),e0(this.reconnect),Ys(([,t])=>t.heartbeat==="CONTINUOUS"),e0(this.latencies),bi(([,t])=>Array.from(t.values()).filter(n=>n.readyState===WebSocket.OPEN&&n.latency>=fp)),Ys(t=>t.length>0),ox(lx)).subscribe({next:t=>{console.log(new Date,"Triggering reconnect",t),this.connect()},complete:()=>{console.log("Monitor complete")},error:t=>{console.error("Error in monitor",t)}})}process(){const t=this.client.pipe(Ys(o=>(o==null?void 0:o.readyState)===WebSocket.OPEN),rx(1)),n=this.queue.pipe(i$(()=>t),Ys(o=>o.length>0),bi(o=>o.sort((a,c)=>{const l=d=>{var f;return!!((f=d.payload.value)!=null&&f.config)};return l(c)?1:l(a)?-1:0}))),r=this.queue.pipe(c$(t));return QY(n.pipe(Ja(o=>o)),r).pipe(e0(this.client),dp(([,o])=>o.readyState===WebSocket.OPEN),Ja(async([o,a])=>{await ux({req:o,interceptors:this.interceptors,socket:a,knownID:this.knownID,runID:this.runID})})).subscribe({error:o=>{this._errors.next(o)}})}useSocketClient(t){return new Hn(n=>{const r=new URL(this.runnerEndpoint);r.searchParams.set("id",t),r.searchParams.set("runID",this.runID);const o=new WebSocket(r.toString()),a=f=>{if(console.log(new Date,`WebSocket transport ${t} closed`,f),f.code===1005){n.complete();return}if(this.autoReconnect){this.connect();return}},c=f=>{console.log(new Date,`WebSocket transport ${t} error`,f),this.autoReconnect||n.error(f)},l=f=>{var p,h;if(typeof f.data!="string"){console.warn("Unexpected WebSocket message type:",typeof f.data);return}let g;try{g=cx(f.data),console.log("Received WebsocketResponse:",g)}catch(E){console.error("Failed to parse WebsocketResponse:",E)}const b=g.status;if(b&&b.code!==eY.OK){n.error(b);return}if(g.pong)return;const x=g.payload.value;if(x.stdoutData&&x.stdoutData.length>0&&((p=this.callback)==null||p.call(this,{type:Et.terminalStdout,output:{"runme.dev/id":this.knownID,data:x.stdoutData}}),this._stdout.next(x.stdoutData)),x.stderrData&&x.stderrData.length>0&&((h=this.callback)==null||h.call(this,{type:Et.terminalStderr,output:{"runme.dev/id":this.knownID,data:x.stderrData}}),this._stderr.next(x.stderrData)),x.exitCode!==void 0&&(this._exitCode.next(x.exitCode),n.complete()),x.pid!==void 0&&this._pid.next(x.pid),x.mimeType){const E=x.mimeType.split(";")[0];this._mimeType.next(E)}},d=()=>{console.log(new Date,`✅ Connected WebSocket for cell ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),n.next(o)};return o.addEventListener("close",a),o.addEventListener("error",c),o.addEventListener("message",l),o.addEventListener("open",d),()=>{console.log(new Date,`☑️ Cleanly disconnected WebSocket for cell ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),o.removeEventListener("close",a),o.removeEventListener("error",c),o.removeEventListener("message",l),o.removeEventListener("open",d),o.close()}})}setCallback(t){this.callback=t}sendExecuteRequest(t){this.queue.next(gt(uy,{payload:{value:t,case:"executeRequest"}}))}useHeartbeat(t,{streamID:n,heartbeat:r}){return new Hn(o=>{const a=fy(t,"message").pipe(dp(()=>t.readyState===WebSocket.OPEN),bi(d=>cx(d.data)),bi(d=>d.pong),Ys(d=>d!==void 0),bi(d=>({receivedAt:BigInt(Date.now()),pong:d}))),c=(r==="INITIAL"?kd(0):kd(0,x$)).pipe(dp(()=>t.readyState===WebSocket.OPEN),bi(()=>{const d={timestamp:BigInt(Date.now())};return gt(uy,{ping:d})}),Ja(async d=>(await ux({req:d,interceptors:this.interceptors,socket:t}),d)),bi(d=>d.ping)).pipe(Ys(d=>(d==null?void 0:d.timestamp)!==void 0),Ja(d=>n$(a.pipe(Ys(f=>f.pong.timestamp===d.timestamp),rx(1),bi(f=>{const p=d.timestamp,h=f.receivedAt;return Number(h-p)})),kd(fp).pipe(bi(()=>{throw new Error(`Pong not received within ${fp}ms for stream ${n}`)}))).pipe(TI(f=>(this._latencies.next({streamID:n,latency:fp,readyState:t.readyState,updatedAt:BigInt(Date.now())}),console.log(new Date,"Ping deadline exceeded",f.message),UY(null))))),s$(()=>{this._latencies.next({streamID:n,latency:-1,readyState:t.readyState,updatedAt:BigInt(Date.now())})}),u$(d=>{d!==null&&this._latencies.next({streamID:n,latency:d,readyState:t.readyState,updatedAt:BigInt(Date.now())})})),l=[];return l.push(c.subscribe({error:d=>{console.error("Unexpected error sending heartbeat",d)}})),o.next(t),()=>{l.forEach(d=>d.unsubscribe())}})}connect(t="CONTINUOUS"){const n=T$(),r=this.latencies.pipe(bi(o=>{const a=o.get(n);return a===void 0?null:a}),dp(o=>(o==null?void 0:o.readyState)===WebSocket.OPEN));return this.reconnect.next({streamID:n,heartbeat:t}),r}close(){this.reconnect.complete(),this.queue.complete(),this._latencies.complete(),this.subscriptions.forEach(t=>t.unsubscribe())}}function cx(e){const t=JSON.parse(e);return M1(nY,t)}async function ux({req:e,interceptors:t,socket:n,knownID:r,runID:o}){r&&(e.knownId=r),o&&(e.runId=o);const a={stream:!1,message:{},method:{},service:{},requestMethod:"UPGRADE",url:n.url,signal:new AbortController().signal,header:new Headers,contextValues:{}};let c=async d=>({stream:!1,message:{},method:{},service:{},header:d.header});for(const d of t.concat().reverse())c=d(c);const l=(await c(a)).header.get("Authorization");l&&e&&(e.authorization=l),n.send(JSON.stringify(t4(uy,e)))}function T$(){return C$().replace(/-/g,"")}function OI(){return`run_${y$()}`}function N$({cellID:e,runID:t,sequence:n,languageID:r,commands:o,content:a,runner:c,settings:l={},onStdout:d,onStderr:f,onExitCode:p,onPid:h,onMimeType:g}){var b;const{rows:x=20,className:E,fontSize:v=12,fontFamily:y="monospace",takeFocus:_=!0,scrollToFit:S=!0}=l,N=O.useMemo(()=>!e||a===""?null:a,[e,a]),I=O.useMemo(()=>{if(!(!e||!t||!c.endpoint))return console.log("Creating stream",e,t,c.endpoint),new II({knownID:e,runID:t,sequence:n,options:{runnerEndpoint:c.endpoint,interceptors:c.interceptors,autoReconnect:c.reconnect}})},[e,t,n,c]);O.useEffect(()=>{const z=I==null?void 0:I.connect().subscribe(G=>console.log(`Heartbeat latency for streamID ${G==null?void 0:G.streamID} (${(G==null?void 0:G.readyState)===1?"open":"closed"}): ${G==null?void 0:G.latency}ms`));return()=>{z==null||z.unsubscribe(),I==null||I.close()}},[I]);let R=gt(z3,{rows:34,cols:100,x:0,y:0});const B=O.useMemo(()=>{const z=r||"sh",G=new Set(["sh","shell","bash","zsh","fish","ksh","csh","tcsh","dash","powershell","pwsh","cmd","ash","elvish","xonsh"]).has(z),K=gt(Wb,{sessionStrategy:mH.MOST_RECENT,storeStdoutInEnv:!0,config:{languageId:z,background:!1,fileExtension:"",env:[`RUNME_ID=${e}`,"RUNME_RUNNER=v2","TERM=xterm-256color"],interactive:!0,runId:t,knownId:e},winsize:R});return G?(K.config.source={case:"commands",value:gt(fH,{items:o})},K.config.mode=j3.INLINE):(K.config.source={case:"script",value:o.join(`
2198
- `)},K.config.mode=j3.FILE,K.config.fileExtension=r||""),K},[e,t,o,R]),k=O.useMemo(()=>{var z;return{output:{"runme.dev/id":(z=B.config)==null?void 0:z.knownId,theme:"dark",fontFamily:y||"monospace",fontSize:v||12,cursorStyle:"block",cursorBlink:!0,cursorWidth:1,takeFocus:_,scrollToFit:S,smoothScrollDuration:0,scrollback:4e3,initialRows:x,content:N||"",isAutoSaveEnabled:!1,isPlatformAuthEnabled:!1}}},[(b=B.config)==null?void 0:b.knownId,y,v,_,S,x,N]),L=new TextEncoder;return vH({postMessage:z=>{if(z.type===Et.terminalOpen||z.type===Et.terminalResize){const G=Number(z.output.terminalDimensions.columns),K=Number(z.output.terminalDimensions.rows);if(Number.isFinite(G)&&Number.isFinite(K)){if(R.cols===G&&R.rows===K)return;R=gt(z3,{cols:G,rows:K,x:0,y:0});const Z=gt(Wb,{winsize:R});I==null||I.sendExecuteRequest(Z)}}if(z.type===Et.terminalStdin){const G=L.encode(z.output.input),K=gt(Wb,{inputData:G});I==null||I.sendExecuteRequest(K)}},onDidReceiveMessage:z=>{I==null||I.setCallback(z)}}),O.useEffect(()=>{const z=I==null?void 0:I.stdout.subscribe(G=>{d==null||d(G)});return()=>z==null?void 0:z.unsubscribe()},[I,d]),O.useEffect(()=>{const z=I==null?void 0:I.stderr.subscribe(G=>{f==null||f(G)});return()=>z==null?void 0:z.unsubscribe()},[I,f]),O.useEffect(()=>{const z=I==null?void 0:I.exitCode.subscribe(G=>{p==null||p(G),I==null||I.close()});return()=>z==null?void 0:z.unsubscribe()},[I,p]),O.useEffect(()=>{const z=I==null?void 0:I.pid.subscribe(G=>{h==null||h(G)});return()=>z==null?void 0:z.unsubscribe()},[I,h]),O.useEffect(()=>{const z=I==null?void 0:I.mimeType.subscribe(G=>{g==null||g(G)});return()=>z==null?void 0:z.unsubscribe()},[I,g]),O.useEffect(()=>{!I||!B||(console.log("useEffect invoked - Commands changed:",JSON.stringify(B.config.source.value)),I==null||I.sendExecuteRequest(B))},[B,I]),Y.jsx("div",{className:E,ref:z=>{if(!z||z.hasChildNodes())return;const G=document.createElement("terminal-view");G.setAttribute("buttons","false"),G.setAttribute("id",k.output["runme.dev/id"]),G.setAttribute("theme",k.output.theme),G.setAttribute("fontFamily",k.output.fontFamily),typeof k.output.fontSize=="number"&&G.setAttribute("fontSize",k.output.fontSize.toString()),k.output.cursorStyle&&G.setAttribute("cursorStyle",k.output.cursorStyle),typeof k.output.cursorBlink=="boolean"&&G.setAttribute("cursorBlink",k.output.cursorBlink?"true":"false"),typeof k.output.cursorWidth=="number"&&G.setAttribute("cursorWidth",k.output.cursorWidth.toString()),typeof k.output.takeFocus=="boolean"&&G.setAttribute("takeFocus",k.output.takeFocus?"true":"false"),typeof k.output.smoothScrollDuration=="number"&&G.setAttribute("smoothScrollDuration",k.output.smoothScrollDuration.toString()),typeof k.output.scrollback=="number"&&G.setAttribute("scrollback",k.output.scrollback.toString()),k.output.initialRows!==void 0&&G.setAttribute("initialRows",k.output.initialRows.toString()),k.output.content!==void 0&&G.setAttribute("initialContent",k.output.content),k.output.isAutoSaveEnabled&&G.setAttribute("isAutoSaveEnabled",k.output.isAutoSaveEnabled.toString()),k.output.isPlatformAuthEnabled&&G.setAttribute("isPlatformAuthEnabled",k.output.isPlatformAuthEnabled.toString()),z.appendChild(G);const K=document.createElement("div");K.setAttribute("className","h-1"),z.appendChild(K),setTimeout(()=>{S&&!R$(K)&&K.scrollIntoView({behavior:"smooth"})},0)}})}function R$(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}class Sd extends Error{}Sd.prototype.name="InvalidTokenError";function k$(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function I$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return k$(t)}catch{return atob(t)}}function BI(e,t){if(typeof e!="string")throw new Sd("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new Sd(`Invalid token specified: missing part #${n+1}`);let o;try{o=I$(r)}catch(a){throw new Sd(`Invalid token specified: invalid base64 for part #${n+1} (${a.message})`)}try{return JSON.parse(o)}catch(a){throw new Sd(`Invalid token specified: invalid json for part #${n+1} (${a.message})`)}}const DI="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ym=32,O$=16,LI=10,dx=0xffffffffffff;var Qa;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(Qa||(Qa={}));class Ed extends Error{constructor(t,n){super(`${n} (${t})`),this.name="ULIDError",this.code=t}}function B$(e){const t=Math.floor(e()*ym)%ym;return DI.charAt(t)}function D$(e){const t=L$(),n=t&&(t.crypto||t.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new Ed(Qa.PRNGDetectFailure,"Failed to find a reliable PRNG")}function L$(){return F$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function M$(e,t){let n="";for(;e>0;e--)n=B$(t)+n;return n}function U$(e,t=LI){if(isNaN(e))throw new Ed(Qa.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>dx)throw new Ed(Qa.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${dx}: ${e}`);if(e<0)throw new Ed(Qa.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new Ed(Qa.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r="";for(let o=t;o>0;o--)n=e%ym,r=DI.charAt(n)+r,e=(e-n)/ym;return r}function F$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function V$(e,t){const n=D$(),r=Date.now();return U$(r,LI)+M$(O$,n)}const P$=xi("ChphZ2VudC92MS9jcmVkZW50aWFscy5wcm90bxIIYWdlbnQudjEioQEKCk9BdXRoVG9rZW4SFAoMYWNjZXNzX3Rva2VuGAEgASgJEhIKCnRva2VuX3R5cGUYAiABKAkSFQoNcmVmcmVzaF90b2tlbhgDIAEoCRISCgpleHBpcmVzX2F0GAQgASgDEioKBmV4cGlyeRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASEgoKZXhwaXJlc19pbhgGIAEoA0JAWj5naXRodWIuY29tL3J1bm1lZGV2L3J1bm1lL3YzL2FwaS9nZW4vcHJvdG8vZ28vYWdlbnQvdjE7YWdlbnR2MWIGcHJvdG8z",[AV]),fx=wn(P$,0);/*! js-cookie v3.0.5 | MIT */function hp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var j$={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function hy(e,t){function n(o,a,c){if(!(typeof document>"u")){c=hp({},t,c),typeof c.expires=="number"&&(c.expires=new Date(Date.now()+c.expires*864e5)),c.expires&&(c.expires=c.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var d in c)c[d]&&(l+="; "+d,c[d]!==!0&&(l+="="+c[d].split(";")[0]));return document.cookie=o+"="+e.write(a,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var a=document.cookie?document.cookie.split("; "):[],c={},l=0;l<a.length;l++){var d=a[l].split("="),f=d.slice(1).join("=");try{var p=decodeURIComponent(d[0]);if(c[p]=e.read(f,p),o===p)break}catch{}}return o?c[o]:c}}return Object.create({set:n,get:r,remove:function(o,a){n(o,"",hp({},a,{expires:-1}))},withAttributes:function(o){return hy(this.converter,hp({},this.attributes,o))},withConverter:function(o){return hy(hp({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var MI=hy(j$,{path:"/"});const z$=["agent-session","cassie-session"],H$=["agent-oauth-token","cassie-oauth-token"];function py(){for(const e of z$){const t=MI.get(e);if(t&&t.length>0)return t}}function W$(){let e=gt(fx);for(const t of H$){const n=MI.get(t);if(n&&n.length>0)try{const r=JSON.parse(n);return e=M1(fx,r),e.accessToken}catch(r){console.error("Failed to parse OAuthToken:",r)}}return e.accessToken}const UI=O.createContext(void 0),yo=()=>{const e=O.useContext(UI);if(!e)throw new Error("useSettings must be used within a SettingsProvider");return e},G$=({children:e,agentEndpoint:t,requireAuth:n,webApp:r,createAuthInterceptors:o})=>{const[a,c]=O.useState(null),l=O.useMemo(()=>{const E=py();if(!E)return"unauthenticated";let v;try{return v=BI(E),v.email||v.sub||"unauthenticated"}catch(y){return console.error("Error decoding token",y),"unauthenticated"}},[]),d=O.useMemo(()=>{const E=window.location.hostname==="localhost",v=window.location.protocol==="http:",y=window.location.port==="4173"||window.location.port==="5173",_=E&&v&&y;return{requireAuth:n??!1,agentEndpoint:t??(_?"http://localhost:8080":window.location.origin),webApp:{runner:(r==null?void 0:r.runner)??(_?"ws://localhost:8080/ws":`${v?"ws:":"wss:"}//${window.location.host}/ws`),reconnect:(r==null?void 0:r.reconnect)??!0,invertedOrder:(r==null?void 0:r.invertedOrder)??!1}}},[n,r]),[f,p]=O.useState(()=>{const E=localStorage.getItem("cloudAssistantSettings"),v=E?JSON.parse(E):{};return v&&v.webApp&&v.webApp.reconnect!==void 0&&(v.webApp.reconnect=d.webApp.reconnect),E?{...d,...v}:d});O.useEffect(()=>{localStorage.setItem("cloudAssistantSettings",JSON.stringify(f))},[f]);const h=O.useCallback(E=>{const v=y=>{const _=window.location.pathname,S=Gt.from(y);_!=="/login"&&S.code===Rt.Unauthenticated&&(window.location.href=`/login?error=${encodeURIComponent(S.name)}&error_description=${encodeURIComponent(S.message)}`)};return[y=>async _=>{const S=py();return S&&_.header.set("Authorization",`Bearer ${S}`),E?y(_).catch(N=>{throw v(N),N}):y(_)}]},[]),g=O.useMemo(()=>o??h,[o,h]),b=O.useCallback(async()=>{if(!f.webApp.runner)return;c(null);const E=new II({knownID:`check_${V$()}`,runID:OI(),sequence:0,options:{runnerEndpoint:f.webApp.runner,interceptors:g(!1),autoReconnect:!1}}),v=[];return v.push(E.errors.subscribe({next:y=>c(y)})),v.push(E.connect(kI.INITIAL).subscribe(y=>{y!==null&&(console.log(`Initial heartbeat latency for streamID ${y.streamID} (${y.readyState===1?"open":"closed"}): ${y.latency}ms`),E.close())})),()=>{v.forEach(y=>y.unsubscribe())}},[o,f.webApp.runner]);O.useEffect(()=>{b()},[b]);const x=E=>{p(v=>({...v,...E,webApp:{...v.webApp,...E.webApp}}))};return Y.jsx(UI.Provider,{value:{principal:l,checkRunnerAuth:b,createAuthInterceptors:g,defaultSettings:d,runnerError:a,settings:f,updateSettings:x},children:e})},FI=O.createContext(void 0),Z$=()=>{const e=O.useContext(FI);if(!e)throw new Error("useClient must be used within a ClientProvider");return e},Y$=({children:e})=>{const[t,n]=O.useState(),{settings:r,createAuthInterceptors:o}=yo();return O.useEffect(()=>{n($$(r.agentEndpoint,o(!0)))},[r.agentEndpoint,o]),Y.jsx(FI.Provider,{value:{client:t,setClient:n},children:e})};function $$(e,t){console.log(`initializing the client: baseURL ${e}`);const n=b4({baseUrl:e,interceptors:t});return u4(TP,n)}const VI=O.createContext(void 0),k_=()=>{const e=O.useContext(VI);if(!e)throw new Error("useOutput must be used within an OutputProvider");return e},X$=({children:e})=>{const t=O.useMemo(()=>new Map,[]),n=O.useCallback((l,d)=>{t.set(l,d)},[t]),r=O.useCallback(l=>{t.delete(l)},[t]),o=O.useCallback(l=>t.get(l),[t]),a=O.useCallback(()=>t,[t]),c=O.useMemo(()=>({registerRenderer:n,unregisterRenderer:r,getRenderer:o,getAllRenderers:a}),[n,r,o,a]);return Y.jsx(VI.Provider,{value:c,children:e})},PI=O.createContext(void 0),ds=()=>{const e=O.useContext(PI);if(!e)throw new Error("useCell must be used within a CellProvider");return e};function hx(e,t){if(!e)return[];const n=e.positions.map(r=>{const o=e.cells[r];return o.kind===Vr.CODE&&(o.languageId=o.languageId||"sh"),o});return n.length===0?[]:t?n.reverse():n}const K$=({children:e,getAccessToken:t})=>{const{settings:n,createAuthInterceptors:r,principal:o}=yo(),[a,c]=O.useState(0),[l,d]=O.useState(!1),[f,p]=O.useState(!1),[h,g]=O.useState(),{getAllRenderers:b}=k_(),x=O.useMemo(()=>{const ee=new URL(n.webApp.runner);return ee.protocol==="ws:"?ee.protocol="http:":ee.protocol="https:",ee.pathname="",ee.toString()},[n.webApp.runner]),E=O.useMemo(()=>{if(o)return new Wj("agent",o,KC(UP,x,r(!0)))},[n.agentEndpoint,o]),v=O.useMemo(()=>n.webApp.invertedOrder,[n.webApp.invertedOrder]),{client:y}=Z$(),[_,S]=O.useState(void 0),N=O.useCallback(()=>{if(!_)return;const ee=hx(_,v),P=gt(OC,{cells:ee});h&&(P.metadata[H0.PreviousResponseId]=h),E==null||E.saveNotebook(_.runmeSession,P)},[_,v,h,E]),I=O.useCallback(async({attemptRestore:ee})=>{if(!E)return;c(0),g(void 0);const P=E.createSession();let M;if(!ee)M=await P;else{const V=await E.listActiveSessions(),H=(await E.loadSessions(V)).filter(ye=>ye.data.cells.length!==0);if(H.length===0)M=await P;else{const ye=H[0];let Ae=ye.data.cells.map(ie=>ie.refId);v&&(Ae=Ae.reverse());const Ne=ye.data.metadata[H0.PreviousResponseId];Ne&&g(Ne),S({runmeSession:ye.id,cells:ye.data.cells.reduce((ie,J)=>(ie[J.refId]=J,ie),{}),positions:Ae});return}}S({runmeSession:M,cells:{},positions:[]})},[v,E]);O.useEffect(()=>{N()},[_,E,v,N]),O.useEffect(()=>{S(ee=>({runmeSession:(ee==null?void 0:ee.runmeSession)??"",cells:(ee==null?void 0:ee.cells)??{},positions:[...(ee==null?void 0:ee.positions)??[]].reverse()}))},[v]),O.useEffect(()=>{I&&I({attemptRestore:!0})},[I]);const R=O.useMemo(()=>_?_.positions.map(ee=>_.cells[ee]).filter(ee=>!!ee&&(ee.kind===Vr.MARKUP||ee.kind===Vr.CODE)):[],[_]),B=O.useMemo(()=>_?_.positions.map(ee=>_.cells[ee]).filter(ee=>!!ee&&ee.kind===Vr.CODE):[],[_]),k=O.useMemo(()=>_?_.positions.map(ee=>_.cells[ee]).filter(ee=>!!ee&&ee.kind===Vr.DOC_RESULTS):[],[_]),L=()=>({chat:R,actions:B,files:k}),z=ee=>jF(Ad,ee),G=async ee=>{const P=await t(),M=gt(AP,{cells:ee,previousResponseId:h});M.openaiAccessToken=P,P||console.warn("No access token found (expected if oauth is disabled)");try{const V=y.generate(M);for await(const $ of V){for(const H of $.cells)p(!1),te(H);g($.responseId)}}catch(V){console.log(V)}finally{p(!1),d(!1)}},K=async ee=>{if(!ee.trim())return;const P=gt(Ad,{refId:`user_${DC()}`,role:Vi.USER,kind:Vr.MARKUP,value:ee});te(P),d(!0),p(!0),await G([P])},Z=async ee=>{ee.outputs.length!==0&&(console.log("sending output cell",ee.refId,"previousResponseId",h),d(!0),p(!0),await G([ee]))},te=ee=>{const P=b();for(const M of P.values())M.onCellUpdate(ee);S(M=>{if(M){if(!M.cells[ee.refId]){const V=v?[ee.refId,...M.positions]:[...M.positions,ee.refId];return{runmeSession:M.runmeSession,cells:{...M.cells,[ee.refId]:ee},positions:V}}return{...M,runmeSession:M.runmeSession,cells:{...M.cells,[ee.refId]:ee}}}})},re=()=>{const ee=`code_${DC().replace(/-/g,"")}`,P=gt(Ad,{metadata:{[Fr.ID]:ee,[Fr.RunmeID]:ee},refId:ee,languageId:"sh",role:Vi.USER,kind:Vr.CODE,value:""});te(P)},Q=ee=>{if(!B.find(V=>V.refId===ee.refId))return;const M=new CustomEvent("runCodeCell",{detail:{cellId:ee.refId}});ee.executionSummary=void 0,ee.outputs=ee.outputs.filter(V=>V.items.some($=>$.mime===ts.StatefulRunmeTerminal)),c(V=>{const $=V+1;return ee.metadata[Fr.Sequence]=$.toString(),$}),window.dispatchEvent(M)},de=async({asSessionRecord:ee})=>{var J;const P=hx(_,v);if(!_||P.length===0)return;const M=gt(OC,{cells:P}),V=KC(xP,n.agentEndpoint,r(!0)),$=gt(EP,{notebook:M,options:gt(SP,{outputs:gt(_P,{enabled:!1,summary:!1})})});ee&&((J=$.options)!=null&&J.outputs)&&($.options.outputs.enabled=!0,$.options.outputs.summary=!0,$.options.session=gt(yP,{id:_.runmeSession}));const H=await V.serialize($),ye=new Blob([new Uint8Array(H.result)],{type:"text/plain"}),Ae=URL.createObjectURL(ye),Ne=document.createElement("a");Ne.href=Ae;const ie=ee?"Session":"Notebook";Ne.download=`${ie}-${w4()}.md`,document.body.appendChild(Ne),Ne.click(),document.body.removeChild(Ne),URL.revokeObjectURL(Ae)};return Y.jsx(PI.Provider,{value:{useColumns:L,sequence:a,saveState:N,exportDocument:de,sendOutputCell:Z,createOutputCell:z,sendUserCell:K,addCodeCell:re,isInputDisabled:l,isTyping:f,runCodeCell:Q,resetSession:I},children:e})},px=new TextEncoder;function J$({pid:e,exitCode:t},n,r,o){let a;return e!==null&&t!==null&&(a=gt(vP,{pid:BigInt(e),exitReason:gt(gP,{type:"exit",code:t})})),[gt(a4,{items:[gt(z0,{mime:ts.VSCodeNotebookStdOut,type:"Buffer",data:px.encode(n)}),gt(z0,{mime:ts.VSCodeNotebookStdErr,type:"Buffer",data:px.encode(r)})],processInfo:a})]}const q$=gt(Ad,{kind:Vr.MARKUP,role:Vi.ASSISTANT,value:"..."}),my={fontSize:14,fontFamily:"monospace"},Q$=new TextDecoder,eX=O.memo(N$,(e,t)=>e.cellID===t.cellID&&e.runID===t.runID),tX=({cell:e,onExitCode:t,onPid:n})=>{const{createAuthInterceptors:r,settings:{webApp:o}}=yo(),{sendOutputCell:a,saveState:c}=ds(),l=o.invertedOrder,[d,f]=O.useState(!1),[p,h]=O.useState({value:"",runID:""}),[g,b]=O.useState(null),[x,E]=O.useState(null),[v,y]=O.useState(null),[_,S]=O.useState(null),[N,I]=O.useState(""),[R,B]=O.useState(""),[k,L]=O.useState(""),z=O.useMemo(()=>Number(e.metadata[Fr.Sequence]??0),[e,x,v]),G=O.useCallback((Ae=!1)=>{b(BigInt(Date.now())),I(""),B(""),E(null),y(null),f(Ae),h({value:e.value,runID:OI()})},[e]),K=O.useMemo(()=>({...my,className:"rounded-md overflow-hidden",rows:14,scrollToFit:!l,takeFocus:d}),[l,d]);O.useEffect(()=>{const Ae=Ne=>{Ne.detail.cellId===e.refId&&G()};return window.addEventListener("runCodeCell",Ae),()=>{window.removeEventListener("runCodeCell",Ae)}},[e.refId,G]);const Z=O.useMemo(()=>{const Ae=e.outputs.filter(ie=>ie.items.some(J=>J.mime===ts.StatefulRunmeTerminal)),Ne=J$({pid:x,exitCode:v},N,R);return[...Ae,...Ne]},[x,v,N,R,_,e.outputs]);O.useEffect(()=>{g!==null&&(e.outputs=Z,e.executionSummary=gt(bP,{timing:gt(mP,{startTime:g,endTime:BigInt(Date.now())}),executionOrder:z,success:Number.isFinite(v)&&v===0}))},[e,Z,v,z,g]);const te=O.useMemo(()=>x===null||v===null||p.runID===""||!Number.isFinite(x)||!Number.isInteger(v)?null:e,[e,p.runID,v,x]);O.useEffect(()=>{!te||k===p.runID||(L(p.runID),a(te))},[a,te,p.runID,k]),O.useEffect(()=>{x!==null&&n(x)},[x,n]),O.useEffect(()=>{v!==null&&t(v)},[v,t]),O.useEffect(()=>{e.kind===Vr.CODE&&(p.runID!==""&&(e.metadata[Fr.LastRunID]=p.runID),x?e.metadata[Fr.Pid]=x.toString():delete e.metadata[Fr.Pid],v!==null&&Number.isFinite(v)?(delete e.metadata[Fr.Pid],e.metadata[Fr.ExitCode]=v.toString()):delete e.metadata[Fr.ExitCode],c())},[x,v,e,c,p.runID]);const re=O.useMemo(()=>{if(e.kind!==Vr.CODE||k!=="")return;const Ae=e.outputs.flatMap(Ne=>Ne.items).find(Ne=>Ne.mime===ts.VSCodeNotebookStdOut);if(Ae)return Q$.decode(Ae.data)},[e.kind,e.outputs,k]),Q=O.useMemo(()=>{var Ne;return((Ne=e.metadata)==null?void 0:Ne[Fr.Pid])??""?e.metadata[Fr.LastRunID]??"":""},[e.metadata]),de=O.useMemo(()=>p.value===""||p.runID===""?[]:p.value.split(`
2198
+ `)},K.config.mode=j3.FILE,K.config.fileExtension=r||""),K},[e,t,o,R]),k=O.useMemo(()=>{var z;return{output:{"runme.dev/id":(z=B.config)==null?void 0:z.knownId,theme:"dark",fontFamily:y||"monospace",fontSize:v||12,cursorStyle:"block",cursorBlink:!0,cursorWidth:1,takeFocus:_,scrollToFit:S,smoothScrollDuration:0,scrollback:4e3,initialRows:x,content:N||"",isAutoSaveEnabled:!1,isPlatformAuthEnabled:!1}}},[(b=B.config)==null?void 0:b.knownId,y,v,_,S,x,N]),L=new TextEncoder;return vH({postMessage:z=>{if(z.type===Et.terminalOpen||z.type===Et.terminalResize){const G=Number(z.output.terminalDimensions.columns),K=Number(z.output.terminalDimensions.rows);if(Number.isFinite(G)&&Number.isFinite(K)){if(R.cols===G&&R.rows===K)return;R=gt(z3,{cols:G,rows:K,x:0,y:0});const Z=gt(Wb,{winsize:R});I==null||I.sendExecuteRequest(Z)}}if(z.type===Et.terminalStdin){const G=L.encode(z.output.input),K=gt(Wb,{inputData:G});I==null||I.sendExecuteRequest(K)}},onDidReceiveMessage:z=>{I==null||I.setCallback(z)}}),O.useEffect(()=>{const z=I==null?void 0:I.stdout.subscribe(G=>{d==null||d(G)});return()=>z==null?void 0:z.unsubscribe()},[I,d]),O.useEffect(()=>{const z=I==null?void 0:I.stderr.subscribe(G=>{f==null||f(G)});return()=>z==null?void 0:z.unsubscribe()},[I,f]),O.useEffect(()=>{const z=I==null?void 0:I.exitCode.subscribe(G=>{p==null||p(G),I==null||I.close()});return()=>z==null?void 0:z.unsubscribe()},[I,p]),O.useEffect(()=>{const z=I==null?void 0:I.pid.subscribe(G=>{h==null||h(G)});return()=>z==null?void 0:z.unsubscribe()},[I,h]),O.useEffect(()=>{const z=I==null?void 0:I.mimeType.subscribe(G=>{g==null||g(G)});return()=>z==null?void 0:z.unsubscribe()},[I,g]),O.useEffect(()=>{!I||!B||(console.log("useEffect invoked - Commands changed:",JSON.stringify(B.config.source.value)),I==null||I.sendExecuteRequest(B))},[B,I]),Y.jsx("div",{className:E,ref:z=>{if(!z||z.hasChildNodes())return;const G=document.createElement("console-view");G.setAttribute("buttons","false"),G.setAttribute("id",k.output["runme.dev/id"]),G.setAttribute("theme",k.output.theme),G.setAttribute("fontFamily",k.output.fontFamily),typeof k.output.fontSize=="number"&&G.setAttribute("fontSize",k.output.fontSize.toString()),k.output.cursorStyle&&G.setAttribute("cursorStyle",k.output.cursorStyle),typeof k.output.cursorBlink=="boolean"&&G.setAttribute("cursorBlink",k.output.cursorBlink?"true":"false"),typeof k.output.cursorWidth=="number"&&G.setAttribute("cursorWidth",k.output.cursorWidth.toString()),typeof k.output.takeFocus=="boolean"&&G.setAttribute("takeFocus",k.output.takeFocus?"true":"false"),typeof k.output.smoothScrollDuration=="number"&&G.setAttribute("smoothScrollDuration",k.output.smoothScrollDuration.toString()),typeof k.output.scrollback=="number"&&G.setAttribute("scrollback",k.output.scrollback.toString()),k.output.initialRows!==void 0&&G.setAttribute("initialRows",k.output.initialRows.toString()),k.output.content!==void 0&&G.setAttribute("initialContent",k.output.content),k.output.isAutoSaveEnabled&&G.setAttribute("isAutoSaveEnabled",k.output.isAutoSaveEnabled.toString()),k.output.isPlatformAuthEnabled&&G.setAttribute("isPlatformAuthEnabled",k.output.isPlatformAuthEnabled.toString()),z.appendChild(G);const K=document.createElement("div");K.setAttribute("className","h-1"),z.appendChild(K),setTimeout(()=>{S&&!R$(K)&&K.scrollIntoView({behavior:"smooth"})},0)}})}function R$(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}class Sd extends Error{}Sd.prototype.name="InvalidTokenError";function k$(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function I$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return k$(t)}catch{return atob(t)}}function BI(e,t){if(typeof e!="string")throw new Sd("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new Sd(`Invalid token specified: missing part #${n+1}`);let o;try{o=I$(r)}catch(a){throw new Sd(`Invalid token specified: invalid base64 for part #${n+1} (${a.message})`)}try{return JSON.parse(o)}catch(a){throw new Sd(`Invalid token specified: invalid json for part #${n+1} (${a.message})`)}}const DI="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ym=32,O$=16,LI=10,dx=0xffffffffffff;var Qa;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(Qa||(Qa={}));class Ed extends Error{constructor(t,n){super(`${n} (${t})`),this.name="ULIDError",this.code=t}}function B$(e){const t=Math.floor(e()*ym)%ym;return DI.charAt(t)}function D$(e){const t=L$(),n=t&&(t.crypto||t.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new Ed(Qa.PRNGDetectFailure,"Failed to find a reliable PRNG")}function L$(){return F$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function M$(e,t){let n="";for(;e>0;e--)n=B$(t)+n;return n}function U$(e,t=LI){if(isNaN(e))throw new Ed(Qa.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>dx)throw new Ed(Qa.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${dx}: ${e}`);if(e<0)throw new Ed(Qa.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new Ed(Qa.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r="";for(let o=t;o>0;o--)n=e%ym,r=DI.charAt(n)+r,e=(e-n)/ym;return r}function F$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function V$(e,t){const n=D$(),r=Date.now();return U$(r,LI)+M$(O$,n)}const P$=xi("ChphZ2VudC92MS9jcmVkZW50aWFscy5wcm90bxIIYWdlbnQudjEioQEKCk9BdXRoVG9rZW4SFAoMYWNjZXNzX3Rva2VuGAEgASgJEhIKCnRva2VuX3R5cGUYAiABKAkSFQoNcmVmcmVzaF90b2tlbhgDIAEoCRISCgpleHBpcmVzX2F0GAQgASgDEioKBmV4cGlyeRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASEgoKZXhwaXJlc19pbhgGIAEoA0JAWj5naXRodWIuY29tL3J1bm1lZGV2L3J1bm1lL3YzL2FwaS9nZW4vcHJvdG8vZ28vYWdlbnQvdjE7YWdlbnR2MWIGcHJvdG8z",[AV]),fx=wn(P$,0);/*! js-cookie v3.0.5 | MIT */function hp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var j$={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function hy(e,t){function n(o,a,c){if(!(typeof document>"u")){c=hp({},t,c),typeof c.expires=="number"&&(c.expires=new Date(Date.now()+c.expires*864e5)),c.expires&&(c.expires=c.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var d in c)c[d]&&(l+="; "+d,c[d]!==!0&&(l+="="+c[d].split(";")[0]));return document.cookie=o+"="+e.write(a,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var a=document.cookie?document.cookie.split("; "):[],c={},l=0;l<a.length;l++){var d=a[l].split("="),f=d.slice(1).join("=");try{var p=decodeURIComponent(d[0]);if(c[p]=e.read(f,p),o===p)break}catch{}}return o?c[o]:c}}return Object.create({set:n,get:r,remove:function(o,a){n(o,"",hp({},a,{expires:-1}))},withAttributes:function(o){return hy(this.converter,hp({},this.attributes,o))},withConverter:function(o){return hy(hp({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var MI=hy(j$,{path:"/"});const z$=["agent-session","cassie-session"],H$=["agent-oauth-token","cassie-oauth-token"];function py(){for(const e of z$){const t=MI.get(e);if(t&&t.length>0)return t}}function W$(){let e=gt(fx);for(const t of H$){const n=MI.get(t);if(n&&n.length>0)try{const r=JSON.parse(n);return e=M1(fx,r),e.accessToken}catch(r){console.error("Failed to parse OAuthToken:",r)}}return e.accessToken}const UI=O.createContext(void 0),yo=()=>{const e=O.useContext(UI);if(!e)throw new Error("useSettings must be used within a SettingsProvider");return e},G$=({children:e,agentEndpoint:t,requireAuth:n,webApp:r,createAuthInterceptors:o})=>{const[a,c]=O.useState(null),l=O.useMemo(()=>{const E=py();if(!E)return"unauthenticated";let v;try{return v=BI(E),v.email||v.sub||"unauthenticated"}catch(y){return console.error("Error decoding token",y),"unauthenticated"}},[]),d=O.useMemo(()=>{const E=window.location.hostname==="localhost",v=window.location.protocol==="http:",y=window.location.port==="4173"||window.location.port==="5173",_=E&&v&&y;return{requireAuth:n??!1,agentEndpoint:t??(_?"http://localhost:8080":window.location.origin),webApp:{runner:(r==null?void 0:r.runner)??(_?"ws://localhost:8080/ws":`${v?"ws:":"wss:"}//${window.location.host}/ws`),reconnect:(r==null?void 0:r.reconnect)??!0,invertedOrder:(r==null?void 0:r.invertedOrder)??!1}}},[n,r]),[f,p]=O.useState(()=>{const E=localStorage.getItem("cloudAssistantSettings"),v=E?JSON.parse(E):{};return v&&v.webApp&&v.webApp.reconnect!==void 0&&(v.webApp.reconnect=d.webApp.reconnect),E?{...d,...v}:d});O.useEffect(()=>{localStorage.setItem("cloudAssistantSettings",JSON.stringify(f))},[f]);const h=O.useCallback(E=>{const v=y=>{const _=window.location.pathname,S=Gt.from(y);_!=="/login"&&S.code===Rt.Unauthenticated&&(window.location.href=`/login?error=${encodeURIComponent(S.name)}&error_description=${encodeURIComponent(S.message)}`)};return[y=>async _=>{const S=py();return S&&_.header.set("Authorization",`Bearer ${S}`),E?y(_).catch(N=>{throw v(N),N}):y(_)}]},[]),g=O.useMemo(()=>o??h,[o,h]),b=O.useCallback(async()=>{if(!f.webApp.runner)return;c(null);const E=new II({knownID:`check_${V$()}`,runID:OI(),sequence:0,options:{runnerEndpoint:f.webApp.runner,interceptors:g(!1),autoReconnect:!1}}),v=[];return v.push(E.errors.subscribe({next:y=>c(y)})),v.push(E.connect(kI.INITIAL).subscribe(y=>{y!==null&&(console.log(`Initial heartbeat latency for streamID ${y.streamID} (${y.readyState===1?"open":"closed"}): ${y.latency}ms`),E.close())})),()=>{v.forEach(y=>y.unsubscribe())}},[o,f.webApp.runner]);O.useEffect(()=>{b()},[b]);const x=E=>{p(v=>({...v,...E,webApp:{...v.webApp,...E.webApp}}))};return Y.jsx(UI.Provider,{value:{principal:l,checkRunnerAuth:b,createAuthInterceptors:g,defaultSettings:d,runnerError:a,settings:f,updateSettings:x},children:e})},FI=O.createContext(void 0),Z$=()=>{const e=O.useContext(FI);if(!e)throw new Error("useClient must be used within a ClientProvider");return e},Y$=({children:e})=>{const[t,n]=O.useState(),{settings:r,createAuthInterceptors:o}=yo();return O.useEffect(()=>{n($$(r.agentEndpoint,o(!0)))},[r.agentEndpoint,o]),Y.jsx(FI.Provider,{value:{client:t,setClient:n},children:e})};function $$(e,t){console.log(`initializing the client: baseURL ${e}`);const n=b4({baseUrl:e,interceptors:t});return u4(TP,n)}const VI=O.createContext(void 0),k_=()=>{const e=O.useContext(VI);if(!e)throw new Error("useOutput must be used within an OutputProvider");return e},X$=({children:e})=>{const t=O.useMemo(()=>new Map,[]),n=O.useCallback((l,d)=>{t.set(l,d)},[t]),r=O.useCallback(l=>{t.delete(l)},[t]),o=O.useCallback(l=>t.get(l),[t]),a=O.useCallback(()=>t,[t]),c=O.useMemo(()=>({registerRenderer:n,unregisterRenderer:r,getRenderer:o,getAllRenderers:a}),[n,r,o,a]);return Y.jsx(VI.Provider,{value:c,children:e})},PI=O.createContext(void 0),ds=()=>{const e=O.useContext(PI);if(!e)throw new Error("useCell must be used within a CellProvider");return e};function hx(e,t){if(!e)return[];const n=e.positions.map(r=>{const o=e.cells[r];return o.kind===Vr.CODE&&(o.languageId=o.languageId||"sh"),o});return n.length===0?[]:t?n.reverse():n}const K$=({children:e,getAccessToken:t})=>{const{settings:n,createAuthInterceptors:r,principal:o}=yo(),[a,c]=O.useState(0),[l,d]=O.useState(!1),[f,p]=O.useState(!1),[h,g]=O.useState(),{getAllRenderers:b}=k_(),x=O.useMemo(()=>{const ee=new URL(n.webApp.runner);return ee.protocol==="ws:"?ee.protocol="http:":ee.protocol="https:",ee.pathname="",ee.toString()},[n.webApp.runner]),E=O.useMemo(()=>{if(o)return new Wj("agent",o,KC(UP,x,r(!0)))},[n.agentEndpoint,o]),v=O.useMemo(()=>n.webApp.invertedOrder,[n.webApp.invertedOrder]),{client:y}=Z$(),[_,S]=O.useState(void 0),N=O.useCallback(()=>{if(!_)return;const ee=hx(_,v),P=gt(OC,{cells:ee});h&&(P.metadata[H0.PreviousResponseId]=h),E==null||E.saveNotebook(_.runmeSession,P)},[_,v,h,E]),I=O.useCallback(async({attemptRestore:ee})=>{if(!E)return;c(0),g(void 0);const P=E.createSession();let M;if(!ee)M=await P;else{const V=await E.listActiveSessions(),H=(await E.loadSessions(V)).filter(ye=>ye.data.cells.length!==0);if(H.length===0)M=await P;else{const ye=H[0];let Ae=ye.data.cells.map(ie=>ie.refId);v&&(Ae=Ae.reverse());const Ne=ye.data.metadata[H0.PreviousResponseId];Ne&&g(Ne),S({runmeSession:ye.id,cells:ye.data.cells.reduce((ie,J)=>(ie[J.refId]=J,ie),{}),positions:Ae});return}}S({runmeSession:M,cells:{},positions:[]})},[v,E]);O.useEffect(()=>{N()},[_,E,v,N]),O.useEffect(()=>{S(ee=>({runmeSession:(ee==null?void 0:ee.runmeSession)??"",cells:(ee==null?void 0:ee.cells)??{},positions:[...(ee==null?void 0:ee.positions)??[]].reverse()}))},[v]),O.useEffect(()=>{I&&I({attemptRestore:!0})},[I]);const R=O.useMemo(()=>_?_.positions.map(ee=>_.cells[ee]).filter(ee=>!!ee&&(ee.kind===Vr.MARKUP||ee.kind===Vr.CODE)):[],[_]),B=O.useMemo(()=>_?_.positions.map(ee=>_.cells[ee]).filter(ee=>!!ee&&ee.kind===Vr.CODE):[],[_]),k=O.useMemo(()=>_?_.positions.map(ee=>_.cells[ee]).filter(ee=>!!ee&&ee.kind===Vr.DOC_RESULTS):[],[_]),L=()=>({chat:R,actions:B,files:k}),z=ee=>jF(Ad,ee),G=async ee=>{const P=await t(),M=gt(AP,{cells:ee,previousResponseId:h});M.openaiAccessToken=P,P||console.warn("No access token found (expected if oauth is disabled)");try{const V=y.generate(M);for await(const $ of V){for(const H of $.cells)p(!1),te(H);g($.responseId)}}catch(V){console.log(V)}finally{p(!1),d(!1)}},K=async ee=>{if(!ee.trim())return;const P=gt(Ad,{refId:`user_${DC()}`,role:Vi.USER,kind:Vr.MARKUP,value:ee});te(P),d(!0),p(!0),await G([P])},Z=async ee=>{ee.outputs.length!==0&&(console.log("sending output cell",ee.refId,"previousResponseId",h),d(!0),p(!0),await G([ee]))},te=ee=>{const P=b();for(const M of P.values())M.onCellUpdate(ee);S(M=>{if(M){if(!M.cells[ee.refId]){const V=v?[ee.refId,...M.positions]:[...M.positions,ee.refId];return{runmeSession:M.runmeSession,cells:{...M.cells,[ee.refId]:ee},positions:V}}return{...M,runmeSession:M.runmeSession,cells:{...M.cells,[ee.refId]:ee}}}})},re=()=>{const ee=`code_${DC().replace(/-/g,"")}`,P=gt(Ad,{metadata:{[Fr.ID]:ee,[Fr.RunmeID]:ee},refId:ee,languageId:"sh",role:Vi.USER,kind:Vr.CODE,value:""});te(P)},Q=ee=>{if(!B.find(V=>V.refId===ee.refId))return;const M=new CustomEvent("runCodeCell",{detail:{cellId:ee.refId}});ee.executionSummary=void 0,ee.outputs=ee.outputs.filter(V=>V.items.some($=>$.mime===ts.StatefulRunmeTerminal)),c(V=>{const $=V+1;return ee.metadata[Fr.Sequence]=$.toString(),$}),window.dispatchEvent(M)},de=async({asSessionRecord:ee})=>{var J;const P=hx(_,v);if(!_||P.length===0)return;const M=gt(OC,{cells:P}),V=KC(xP,n.agentEndpoint,r(!0)),$=gt(EP,{notebook:M,options:gt(SP,{outputs:gt(_P,{enabled:!1,summary:!1})})});ee&&((J=$.options)!=null&&J.outputs)&&($.options.outputs.enabled=!0,$.options.outputs.summary=!0,$.options.session=gt(yP,{id:_.runmeSession}));const H=await V.serialize($),ye=new Blob([new Uint8Array(H.result)],{type:"text/plain"}),Ae=URL.createObjectURL(ye),Ne=document.createElement("a");Ne.href=Ae;const ie=ee?"Session":"Notebook";Ne.download=`${ie}-${w4()}.md`,document.body.appendChild(Ne),Ne.click(),document.body.removeChild(Ne),URL.revokeObjectURL(Ae)};return Y.jsx(PI.Provider,{value:{useColumns:L,sequence:a,saveState:N,exportDocument:de,sendOutputCell:Z,createOutputCell:z,sendUserCell:K,addCodeCell:re,isInputDisabled:l,isTyping:f,runCodeCell:Q,resetSession:I},children:e})},px=new TextEncoder;function J$({pid:e,exitCode:t},n,r,o){let a;return e!==null&&t!==null&&(a=gt(vP,{pid:BigInt(e),exitReason:gt(gP,{type:"exit",code:t})})),[gt(a4,{items:[gt(z0,{mime:ts.VSCodeNotebookStdOut,type:"Buffer",data:px.encode(n)}),gt(z0,{mime:ts.VSCodeNotebookStdErr,type:"Buffer",data:px.encode(r)})],processInfo:a})]}const q$=gt(Ad,{kind:Vr.MARKUP,role:Vi.ASSISTANT,value:"..."}),my={fontSize:14,fontFamily:"monospace"},Q$=new TextDecoder,eX=O.memo(N$,(e,t)=>e.cellID===t.cellID&&e.runID===t.runID),tX=({cell:e,onExitCode:t,onPid:n})=>{const{createAuthInterceptors:r,settings:{webApp:o}}=yo(),{sendOutputCell:a,saveState:c}=ds(),l=o.invertedOrder,[d,f]=O.useState(!1),[p,h]=O.useState({value:"",runID:""}),[g,b]=O.useState(null),[x,E]=O.useState(null),[v,y]=O.useState(null),[_,S]=O.useState(null),[N,I]=O.useState(""),[R,B]=O.useState(""),[k,L]=O.useState(""),z=O.useMemo(()=>Number(e.metadata[Fr.Sequence]??0),[e,x,v]),G=O.useCallback((Ae=!1)=>{b(BigInt(Date.now())),I(""),B(""),E(null),y(null),f(Ae),h({value:e.value,runID:OI()})},[e]),K=O.useMemo(()=>({...my,className:"rounded-md overflow-hidden",rows:14,scrollToFit:!l,takeFocus:d}),[l,d]);O.useEffect(()=>{const Ae=Ne=>{Ne.detail.cellId===e.refId&&G()};return window.addEventListener("runCodeCell",Ae),()=>{window.removeEventListener("runCodeCell",Ae)}},[e.refId,G]);const Z=O.useMemo(()=>{const Ae=e.outputs.filter(ie=>ie.items.some(J=>J.mime===ts.StatefulRunmeTerminal)),Ne=J$({pid:x,exitCode:v},N,R);return[...Ae,...Ne]},[x,v,N,R,_,e.outputs]);O.useEffect(()=>{g!==null&&(e.outputs=Z,e.executionSummary=gt(bP,{timing:gt(mP,{startTime:g,endTime:BigInt(Date.now())}),executionOrder:z,success:Number.isFinite(v)&&v===0}))},[e,Z,v,z,g]);const te=O.useMemo(()=>x===null||v===null||p.runID===""||!Number.isFinite(x)||!Number.isInteger(v)?null:e,[e,p.runID,v,x]);O.useEffect(()=>{!te||k===p.runID||(L(p.runID),a(te))},[a,te,p.runID,k]),O.useEffect(()=>{x!==null&&n(x)},[x,n]),O.useEffect(()=>{v!==null&&t(v)},[v,t]),O.useEffect(()=>{e.kind===Vr.CODE&&(p.runID!==""&&(e.metadata[Fr.LastRunID]=p.runID),x?e.metadata[Fr.Pid]=x.toString():delete e.metadata[Fr.Pid],v!==null&&Number.isFinite(v)?(delete e.metadata[Fr.Pid],e.metadata[Fr.ExitCode]=v.toString()):delete e.metadata[Fr.ExitCode],c())},[x,v,e,c,p.runID]);const re=O.useMemo(()=>{if(e.kind!==Vr.CODE||k!=="")return;const Ae=e.outputs.flatMap(Ne=>Ne.items).find(Ne=>Ne.mime===ts.VSCodeNotebookStdOut);if(Ae)return Q$.decode(Ae.data)},[e.kind,e.outputs,k]),Q=O.useMemo(()=>{var Ne;return((Ne=e.metadata)==null?void 0:Ne[Fr.Pid])??""?e.metadata[Fr.LastRunID]??"":""},[e.metadata]),de=O.useMemo(()=>p.value===""||p.runID===""?[]:p.value.split(`
2199
2199
  `),[p]),ee=O.useMemo(()=>p.runID===""?Q:p.runID,[p.runID,Q]),P=O.useMemo(()=>({endpoint:o.runner,reconnect:o.reconnect,interceptors:r(!1)}),[o.runner,o.reconnect,r]),M=O.useCallback(Ae=>{I(Ne=>Ne+new TextDecoder().decode(Ae))},[]),V=O.useCallback(Ae=>{B(Ne=>Ne+new TextDecoder().decode(Ae))},[]),$=O.useCallback(Ae=>{E(Ae)},[]),H=O.useCallback(Ae=>{y(Ae)},[]),ye=O.useCallback(Ae=>{S(Ae)},[]);return de.length===0&&(!re||re.length===0)?null:Y.jsx(eX,{cellID:e.refId,runID:ee,sequence:z,languageID:e.languageId,commands:de,content:re,runner:P,settings:K,onPid:$,onStdout:M,onStderr:V,onExitCode:H,onMimeType:ye},ee)};function nX(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function gx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mx(Object(n),!0).forEach(function(r){nX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rX(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function iX(e,t){if(e==null)return{};var n=rX(e,t),r,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oX(e,t){return sX(e)||aX(e,t)||lX(e,t)||cX()}function sX(e){if(Array.isArray(e))return e}function aX(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,a=void 0;try{for(var c=e[Symbol.iterator](),l;!(r=(l=c.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(d){o=!0,a=d}finally{try{!r&&c.return!=null&&c.return()}finally{if(o)throw a}}return n}}function lX(e,t){if(e){if(typeof e=="string")return vx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vx(e,t)}}function vx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2200
2200
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uX(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function yx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bx(Object(n),!0).forEach(function(r){uX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dX(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,a){return a(o)},r)}}function wd(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,l=new Array(c),d=0;d<c;d++)l[d]=arguments[d];return t.apply(n,[].concat(o,l))}}}function _m(e){return{}.toString.call(e).includes("Object")}function fX(e){return!Object.keys(e).length}function pf(e){return typeof e=="function"}function hX(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function pX(e,t){return _m(t)||ea("changeType"),Object.keys(t).some(function(n){return!hX(e,n)})&&ea("changeField"),t}function mX(e){pf(e)||ea("selectorType")}function gX(e){pf(e)||_m(e)||ea("handlerType"),_m(e)&&Object.values(e).some(function(t){return!pf(t)})&&ea("handlersType")}function vX(e){e||ea("initialIsRequired"),_m(e)||ea("initialType"),fX(e)&&ea("initialContent")}function bX(e,t){throw new Error(e[t]||e.default)}var yX={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ea=wd(bX)(yX),pp={changes:pX,selector:mX,handler:gX,initial:vX};function _X(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pp.initial(e),pp.handler(t);var n={current:e},r=wd(wX)(n,t),o=wd(EX)(n),a=wd(pp.changes)(e),c=wd(SX)(n);function l(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(p){return p};return pp.selector(f),f(n.current)}function d(f){dX(r,o,a,c)(f)}return[l,d]}function SX(e,t){return pf(t)?t(e.current):t}function EX(e,t){return e.current=yx(yx({},e.current),t),t}function wX(e,t,n){return pf(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var CX={create:_X},xX={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function AX(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,l=new Array(c),d=0;d<c;d++)l[d]=arguments[d];return t.apply(n,[].concat(o,l))}}}function TX(e){return{}.toString.call(e).includes("Object")}function NX(e){return e||_x("configIsRequired"),TX(e)||_x("configType"),e.urls?(RX(),{paths:{vs:e.urls.monacoBase}}):e}function RX(){console.warn(jI.deprecation)}function kX(e,t){throw new Error(e[t]||e.default)}var jI={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
2201
2201
  You are using deprecated way of configuration.