dsh-zterm 0.1.13 → 0.1.14
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/lib/client.js +17 -16
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-zterm", factory: (require) => { var module = { exports: {} }; var exports = module.exports;
|
|
2
|
-
"use strict";var
|
|
3
|
-
`)))),this.register(this._terminal.onA11yTab((v=>this._handleTab(v)))),this.register(this._terminal.onKey((v=>this._handleKey(v.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,d.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let
|
|
4
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,s){this._liveRegionDebouncer.refresh(e,s,this._terminal.rows)}_renderRows(e,s){let a=this._terminal.buffer,f=a.lines.length.toString();for(let v=e;v<=s;v++){let g=a.lines.get(a.ydisp+v),_=[],m=g?.translateToString(!0,void 0,void 0,_)||"",y=(a.ydisp+v+1).toString(),E=this._rowElements[v];E&&(m.length===0?(E.innerText="\xA0",this._rowColumns.set(E,[0,1])):(E.textContent=m,this._rowColumns.set(E,_)),E.setAttribute("aria-posinset",y),E.setAttribute("aria-setsize",f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,s){let a=e.target,f=this._rowElements[s===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==f)return;let v,g;if(s===0?(v=a,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(v=this._rowElements.shift(),g=a,this._rowContainer.removeChild(v)),v.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){let _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}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(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((s.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===a.node&&s.offset>a.offset)&&([s,a]=[a,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;let f=this._rowElements.slice(-1)[0];if(a.node.compareDocumentPosition(f)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(a={node:f,offset:f.textContent?.length??0}),!this._rowContainer.contains(a.node))return;let v=({node:m,offset:y})=>{let E=m instanceof Text?m.parentNode:m,C=parseInt(E?.getAttribute("aria-posinset"),10)-1;if(isNaN(C))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(E);if(!w)return console.warn("columns is null. Race condition?"),null;let R=y<w.length?w[y]:w.slice(-1)[0]+1;return R>=this._terminal.cols&&(++C,R=0),{row:C,column:R}},g=v(s),_=v(a);if(g&&_){if(g.row>_.row||g.row===_.row&&g.column>=_.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(_.row-g.row)*this._terminal.cols-g.column+_.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=t=c([u(1,h.IInstantiationService),u(2,p.ICoreBrowserService),u(3,p.IRenderService)],t)},3614:(D,r)=>{function n(l){return l.replace(/\r?\n/g,"\r")}function c(l,d){return d?"\x1B[200~"+l+"\x1B[201~":l}function u(l,d,p,h){l=c(l=n(l),p.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(l,!0),d.value=""}function o(l,d,p){let h=p.getBoundingClientRect(),i=l.clientX-h.left-10,t=l.clientY-h.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${i}px`,d.style.top=`${t}px`,d.style.zIndex="1000",d.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=n,r.bracketTextForPaste=c,r.copyHandler=function(l,d){l.clipboardData&&l.clipboardData.setData("text/plain",d.selectionText),l.preventDefault()},r.handlePasteEvent=function(l,d,p,h){l.stopPropagation(),l.clipboardData&&u(l.clipboardData.getData("text/plain"),d,p,h)},r.paste=u,r.moveTextAreaUnderMouseCursor=o,r.rightClickHandler=function(l,d,p,h,i){o(l,d,p),i&&h.rightClickSelect(l),d.value=h.selectionText,d.select()}},7239:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let c=n(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(u,o,l){this._css.set(u,o,l)}getCss(u,o){return this._css.get(u,o)}setColor(u,o,l){this._color.set(u,o,l)}getColor(u,o){return this._color.get(u,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(n,c,u,o){n.addEventListener(c,u,o);let l=!1;return{dispose:()=>{l||(l=!0,n.removeEventListener(c,u,o))}}}},3551:function(D,r,n){var c=this&&this.__decorate||function(t,e,s,a){var f,v=arguments.length,g=v<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,s,a);else for(var _=t.length-1;_>=0;_--)(f=t[_])&&(g=(v<3?f(g):v>3?f(e,s,g):f(e,s))||g);return v>3&&g&&Object.defineProperty(e,s,g),g},u=this&&this.__param||function(t,e){return function(s,a){e(s,a,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let o=n(3656),l=n(8460),d=n(844),p=n(2585),h=n(4725),i=r.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(t,e,s,a,f){super(),this._element=t,this._mouseService=e,this._renderService=s,this._bufferService=a,this._linkProviderService=f,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new l.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new l.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let s=t.composedPath();for(let a=0;a<s.length;a++){let f=s[a];if(f.classList.contains("xterm"))break;if(f.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(t,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((a=>{a?.forEach((f=>{f.link.dispose&&f.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=t.y);let s=!1;for(let[a,f]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(s=this._checkLinkProviderResult(a,t,s)):f.provideLinks(t.y,(v=>{if(this._isMouseOut)return;let g=v?.map((_=>({link:_})));this._activeProviderReplies?.set(a,g),s=this._checkLinkProviderResult(a,t,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)}))}_removeIntersectingLinks(t,e){let s=new Set;for(let a=0;a<e.size;a++){let f=e.get(a);if(f)for(let v=0;v<f.length;v++){let g=f[v],_=g.link.range.start.y<t?0:g.link.range.start.x,m=g.link.range.end.y>t?this._bufferService.cols:g.link.range.end.x;for(let y=_;y<=m;y++){if(s.has(y)){f.splice(v--,1);break}s.add(y)}}}}_checkLinkProviderResult(t,e,s){if(!this._activeProviderReplies)return s;let a=this._activeProviderReplies.get(t),f=!1;for(let v=0;v<t;v++)this._activeProviderReplies.has(v)&&!this._activeProviderReplies.get(v)||(f=!0);if(!f&&a){let v=a.find((g=>this._linkAtPosition(g.link,e)));v&&(s=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let v=0;v<this._activeProviderReplies.size;v++){let g=this._activeProviderReplies.get(v)?.find((_=>this._linkAtPosition(_.link,e)));if(g){s=!0,this._handleNewLink(g);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){this._currentLink&&this._lastMouseEvent&&(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,d.disposeArray)(this._linkCacheDisposables))}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0||t.link.decorations.underline,pointerCursor:t.link.decorations===void 0||t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.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:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((s=>{if(!this._currentLink)return;let a=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=f&&(this._clearCurrentLink(a,f),this._lastMouseEvent)){let v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._askForLink(v,!1)}}))))}_linkHover(t,e,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(s,e.text)}_fireUnderlineEvent(t,e){let s=t.range,a=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-a-1,s.end.x,s.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(t,e,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(s,e.text)}_linkAtPosition(t,e){let s=t.range.start.y*this._bufferService.cols+t.range.start.x,a=t.range.end.y*this._bufferService.cols+t.range.end.x,f=e.y*this._bufferService.cols+e.x;return s<=f&&f<=a}_positionFromMouseEvent(t,e,s){let a=s.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,s,a,f){return{x1:t,y1:e,x2:s,y2:a,cols:this._bufferService.cols,fg:f}}};r.Linkifier=i=c([u(1,h.IMouseService),u(2,h.IRenderService),u(3,p.IBufferService),u(4,h.ILinkProviderService)],i)},9042:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(D,r,n){var c=this&&this.__decorate||function(h,i,t,e){var s,a=arguments.length,f=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(h,i,t,e);else for(var v=h.length-1;v>=0;v--)(s=h[v])&&(f=(a<3?s(f):a>3?s(i,t,f):s(i,t))||f);return a>3&&f&&Object.defineProperty(i,t,f),f},u=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let o=n(511),l=n(2585),d=r.OscLinkProvider=class{constructor(h,i,t){this._bufferService=h,this._optionsService=i,this._oscLinkService=t}provideLinks(h,i){let t=this._bufferService.buffer.lines.get(h-1);if(!t)return void i(void 0);let e=[],s=this._optionsService.rawOptions.linkHandler,a=new o.CellData,f=t.getTrimmedLength(),v=-1,g=-1,_=!1;for(let m=0;m<f;m++)if(g!==-1||t.hasContent(m)){if(t.loadCell(m,a),a.hasExtendedAttrs()&&a.extended.urlId){if(g===-1){g=m,v=a.extended.urlId;continue}_=a.extended.urlId!==v}else g!==-1&&(_=!0);if(_||g!==-1&&m===f-1){let y=this._oscLinkService.getLinkData(v)?.uri;if(y){let E={start:{x:g+1,y:h},end:{x:m+(_||m!==f-1?0:1),y:h}},C=!1;if(!s?.allowNonHttpProtocols)try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(C=!0)}catch{C=!0}C||e.push({text:y,range:E,activate:(w,R)=>s?s.activate(w,R,E):p(0,R),hover:(w,R)=>s?.hover?.(w,R,E),leave:(w,R)=>s?.leave?.(w,R,E)})}_=!1,a.hasExtendedAttrs()&&a.extended.urlId?(g=m,v=a.extended.urlId):(g=-1,v=-1)}}i(e)}};function p(h,i){if(confirm(`Do you want to navigate to ${i}?
|
|
2
|
+
"use strict";var ri=Object.create;var tt=Object.defineProperty;var si=Object.getOwnPropertyDescriptor;var ni=Object.getOwnPropertyNames;var oi=Object.getPrototypeOf,ai=Object.prototype.hasOwnProperty;var pt=(B,A)=>()=>(A||B((A={exports:{}}).exports,A),A.exports),li=(B,A)=>{for(var O in A)tt(B,O,{get:A[O],enumerable:!0})},Dt=(B,A,O,F)=>{if(A&&typeof A=="object"||typeof A=="function")for(let D of ni(A))!ai.call(B,D)&&D!==O&&tt(B,D,{get:()=>A[D],enumerable:!(F=si(A,D))||F.enumerable});return B};var vt=(B,A,O)=>(O=B!=null?ri(oi(B)):{},Dt(A||!B||!B.__esModule?tt(O,"default",{value:B,enumerable:!0}):O,B)),hi=B=>Dt(tt({},"__esModule",{value:!0}),B);var At=pt((st,gt)=>{(function(B,A){if(typeof st=="object"&&typeof gt=="object")gt.exports=A();else if(typeof define=="function"&&define.amd)define([],A);else{var O=A();for(var F in O)(typeof st=="object"?st:B)[F]=O[F]}})(globalThis,(()=>(()=>{"use strict";var B={4567:function(D,s,a){var c=this&&this.__decorate||function(e,r,h,_){var v,g=arguments.length,u=g<3?r:_===null?_=Object.getOwnPropertyDescriptor(r,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,h,_);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,h,u):v(r,h))||u);return g>3&&u&&Object.defineProperty(r,h,u),u},f=this&&this.__param||function(e,r){return function(h,_){r(h,_,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let o=a(9042),n=a(9924),d=a(844),p=a(4725),l=a(2585),i=a(3656),t=s.AccessibilityManager=class extends d.Disposable{constructor(e,r,h,_){super(),this._terminal=e,this._coreBrowserService=h,this._renderService=_,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 v=0;v<this._terminal.rows;v++)this._rowElements[v]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[v]);if(this._topBoundaryFocusListener=v=>this._handleBoundaryFocus(v,0),this._bottomBoundaryFocusListener=v=>this._handleBoundaryFocus(v,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 n.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((v=>this._handleResize(v.rows)))),this.register(this._terminal.onRender((v=>this._refreshRows(v.start,v.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((v=>this._handleChar(v)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
3
|
+
`)))),this.register(this._terminal.onA11yTab((v=>this._handleTab(v)))),this.register(this._terminal.onKey((v=>this._handleKey(v.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,d.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let r=0;r<e;r++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
4
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,r){this._liveRegionDebouncer.refresh(e,r,this._terminal.rows)}_renderRows(e,r){let h=this._terminal.buffer,_=h.lines.length.toString();for(let v=e;v<=r;v++){let g=h.lines.get(h.ydisp+v),u=[],m=g?.translateToString(!0,void 0,void 0,u)||"",y=(h.ydisp+v+1).toString(),E=this._rowElements[v];E&&(m.length===0?(E.innerText="\xA0",this._rowColumns.set(E,[0,1])):(E.textContent=m,this._rowColumns.set(E,u)),E.setAttribute("aria-posinset",y),E.setAttribute("aria-setsize",_))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,r){let h=e.target,_=this._rowElements[r===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==_)return;let v,g;if(r===0?(v=h,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(v=this._rowElements.shift(),g=h,this._rowContainer.removeChild(v)),v.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:e.anchorNode,offset:e.anchorOffset},h={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===h.node&&r.offset>h.offset)&&([r,h]=[h,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;let _=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(_)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:_,offset:_.textContent?.length??0}),!this._rowContainer.contains(h.node))return;let v=({node:m,offset:y})=>{let E=m instanceof Text?m.parentNode:m,C=parseInt(E?.getAttribute("aria-posinset"),10)-1;if(isNaN(C))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(E);if(!w)return console.warn("columns is null. Race condition?"),null;let R=y<w.length?w[y]:w.slice(-1)[0]+1;return R>=this._terminal.cols&&(++C,R=0),{row:C,column:R}},g=v(r),u=v(h);if(g&&u){if(g.row>u.row||g.row===u.row&&g.column>=u.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(u.row-g.row)*this._terminal.cols-g.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=t=c([f(1,l.IInstantiationService),f(2,p.ICoreBrowserService),f(3,p.IRenderService)],t)},3614:(D,s)=>{function a(n){return n.replace(/\r?\n/g,"\r")}function c(n,d){return d?"\x1B[200~"+n+"\x1B[201~":n}function f(n,d,p,l){n=c(n=a(n),p.decPrivateModes.bracketedPasteMode&&l.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(n,!0),d.value=""}function o(n,d,p){let l=p.getBoundingClientRect(),i=n.clientX-l.left-10,t=n.clientY-l.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${i}px`,d.style.top=`${t}px`,d.style.zIndex="1000",d.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=a,s.bracketTextForPaste=c,s.copyHandler=function(n,d){n.clipboardData&&n.clipboardData.setData("text/plain",d.selectionText),n.preventDefault()},s.handlePasteEvent=function(n,d,p,l){n.stopPropagation(),n.clipboardData&&f(n.clipboardData.getData("text/plain"),d,p,l)},s.paste=f,s.moveTextAreaUnderMouseCursor=o,s.rightClickHandler=function(n,d,p,l,i){o(n,d,p),i&&l.rightClickSelect(n),d.value=l.selectionText,d.select()}},7239:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let c=a(1505);s.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,o,n){this._css.set(f,o,n)}getCss(f,o){return this._css.get(f,o)}setColor(f,o,n){this._color.set(f,o,n)}getColor(f,o){return this._color.get(f,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(a,c,f,o){a.addEventListener(c,f,o);let n=!1;return{dispose:()=>{n||(n=!0,a.removeEventListener(c,f,o))}}}},3551:function(D,s,a){var c=this&&this.__decorate||function(t,e,r,h){var _,v=arguments.length,g=v<3?e:h===null?h=Object.getOwnPropertyDescriptor(e,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,h);else for(var u=t.length-1;u>=0;u--)(_=t[u])&&(g=(v<3?_(g):v>3?_(e,r,g):_(e,r))||g);return v>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,h){e(r,h,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let o=a(3656),n=a(8460),d=a(844),p=a(2585),l=a(4725),i=s.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(t,e,r,h,_){super(),this._element=t,this._mouseService=e,this._renderService=r,this._bufferService=h,this._linkProviderService=_,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new n.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new n.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let r=t.composedPath();for(let h=0;h<r.length;h++){let _=r[h];if(_.classList.contains("xterm"))break;if(_.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(t,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((h=>{h?.forEach((_=>{_.link.dispose&&_.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=t.y);let r=!1;for(let[h,_]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(h)&&(r=this._checkLinkProviderResult(h,t,r)):_.provideLinks(t.y,(v=>{if(this._isMouseOut)return;let g=v?.map((u=>({link:u})));this._activeProviderReplies?.set(h,g),r=this._checkLinkProviderResult(h,t,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)}))}_removeIntersectingLinks(t,e){let r=new Set;for(let h=0;h<e.size;h++){let _=e.get(h);if(_)for(let v=0;v<_.length;v++){let g=_[v],u=g.link.range.start.y<t?0:g.link.range.start.x,m=g.link.range.end.y>t?this._bufferService.cols:g.link.range.end.x;for(let y=u;y<=m;y++){if(r.has(y)){_.splice(v--,1);break}r.add(y)}}}}_checkLinkProviderResult(t,e,r){if(!this._activeProviderReplies)return r;let h=this._activeProviderReplies.get(t),_=!1;for(let v=0;v<t;v++)this._activeProviderReplies.has(v)&&!this._activeProviderReplies.get(v)||(_=!0);if(!_&&h){let v=h.find((g=>this._linkAtPosition(g.link,e)));v&&(r=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let v=0;v<this._activeProviderReplies.size;v++){let g=this._activeProviderReplies.get(v)?.find((u=>this._linkAtPosition(u.link,e)));if(g){r=!0,this._handleNewLink(g);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){this._currentLink&&this._lastMouseEvent&&(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,d.disposeArray)(this._linkCacheDisposables))}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0||t.link.decorations.underline,pointerCursor:t.link.decorations===void 0||t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((r=>{if(!this._currentLink)return;let h=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,_=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=_&&(this._clearCurrentLink(h,_),this._lastMouseEvent)){let v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._askForLink(v,!1)}}))))}_linkHover(t,e,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(r,e.text)}_fireUnderlineEvent(t,e){let r=t.range,h=this._bufferService.buffer.ydisp,_=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-h-1,r.end.x,r.end.y-h-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(_)}_linkLeave(t,e,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(r,e.text)}_linkAtPosition(t,e){let r=t.range.start.y*this._bufferService.cols+t.range.start.x,h=t.range.end.y*this._bufferService.cols+t.range.end.x,_=e.y*this._bufferService.cols+e.x;return r<=_&&_<=h}_positionFromMouseEvent(t,e,r){let h=r.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,r,h,_){return{x1:t,y1:e,x2:r,y2:h,cols:this._bufferService.cols,fg:_}}};s.Linkifier=i=c([f(1,l.IMouseService),f(2,l.IRenderService),f(3,p.IBufferService),f(4,l.ILinkProviderService)],i)},9042:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(D,s,a){var c=this&&this.__decorate||function(l,i,t,e){var r,h=arguments.length,_=h<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,i,t,e);else for(var v=l.length-1;v>=0;v--)(r=l[v])&&(_=(h<3?r(_):h>3?r(i,t,_):r(i,t))||_);return h>3&&_&&Object.defineProperty(i,t,_),_},f=this&&this.__param||function(l,i){return function(t,e){i(t,e,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let o=a(511),n=a(2585),d=s.OscLinkProvider=class{constructor(l,i,t){this._bufferService=l,this._optionsService=i,this._oscLinkService=t}provideLinks(l,i){let t=this._bufferService.buffer.lines.get(l-1);if(!t)return void i(void 0);let e=[],r=this._optionsService.rawOptions.linkHandler,h=new o.CellData,_=t.getTrimmedLength(),v=-1,g=-1,u=!1;for(let m=0;m<_;m++)if(g!==-1||t.hasContent(m)){if(t.loadCell(m,h),h.hasExtendedAttrs()&&h.extended.urlId){if(g===-1){g=m,v=h.extended.urlId;continue}u=h.extended.urlId!==v}else g!==-1&&(u=!0);if(u||g!==-1&&m===_-1){let y=this._oscLinkService.getLinkData(v)?.uri;if(y){let E={start:{x:g+1,y:l},end:{x:m+(u||m!==_-1?0:1),y:l}},C=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(C=!0)}catch{C=!0}C||e.push({text:y,range:E,activate:(w,R)=>r?r.activate(w,R,E):p(0,R),hover:(w,R)=>r?.hover?.(w,R,E),leave:(w,R)=>r?.leave?.(w,R,E)})}u=!1,h.hasExtendedAttrs()&&h.extended.urlId?(g=m,v=h.extended.urlId):(g=-1,v=-1)}}i(e)}};function p(l,i){if(confirm(`Do you want to navigate to ${i}?
|
|
5
5
|
|
|
6
|
-
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=d=c([u(0,l.IBufferService),u(1,l.IOptionsService),u(2,l.IOscLinkService)],d)},6193:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(n,c){this._renderCallback=n,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(n,c,u){this._rowCount=u,n=n!==void 0?n:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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();let n=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let c=n(3614),u=n(3656),o=n(3551),l=n(9042),d=n(3730),p=n(1680),h=n(3107),i=n(5744),t=n(2950),e=n(1296),s=n(428),a=n(4269),f=n(5114),v=n(8934),g=n(3230),_=n(9312),m=n(4725),y=n(6731),E=n(8055),C=n(8969),w=n(8460),R=n(844),P=n(6114),U=n(8437),K=n(2584),$=n(7399),S=n(5941),x=n(9074),k=n(2585),L=n(5435),H=n(4567),q=n(779);class X extends C.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(T={}){super(T),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(d.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((b,z)=>this.refresh(b,z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((b=>this._reportWindowsOptions(b)))),this.register(this._inputHandler.onColor((b=>this._handleColorEvent(b)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((b=>this._afterResize(b.cols,b.rows)))),this.register((0,R.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(T){if(this._themeService)for(let b of T){let z,F="";switch(b.index){case 256:z="foreground",F="10";break;case 257:z="background",F="11";break;case 258:z="cursor",F="12";break;default:z="ansi",F="4;"+b.index}switch(b.type){case 0:let V=E.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[b.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${F};${(0,S.toRgbString)(V)}${K.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((j=>j.ansi[b.index]=E.channels.toColor(...b.color)));else{let j=z;this._themeService.modifyColors((te=>te[j]=E.channels.toColor(...b.color)))}break;case 2:this._themeService.restoreColor(b.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(T){T?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(T){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let T=this.buffer.ybase+this.buffer.y,b=this.buffer.lines.get(T);if(!b)return;let z=Math.min(this.buffer.x,this.cols-1),F=this._renderService.dimensions.css.cell.height,V=b.getWidth(z),j=this._renderService.dimensions.css.cell.width*V,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ne=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ne+"px",this.textarea.style.top=te+"px",this.textarea.style.width=j+"px",this.textarea.style.height=F+"px",this.textarea.style.lineHeight=F+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(b=>{this.hasSelection()&&(0,c.copyHandler)(b,this._selectionService)})));let T=b=>(0,c.handlePasteEvent)(b,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",T)),this.register((0,u.addDisposableDomListener)(this.element,"paste",T)),P.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(b=>{b.button===2&&(0,c.rightClickHandler)(b,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(b=>{(0,c.rightClickHandler)(b,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(b=>{b.button===1&&(0,c.moveTextAreaUnderMouseCursor)(b,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(T=>this._keyUp(T)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(T=>this._keyDown(T)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(T=>this._keyPress(T)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(T=>this._compositionHelper.compositionupdate(T)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(T=>this._inputEvent(T)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(T){if(!T)throw new Error("Terminal requires a parent element.");if(T.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=T.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"),T.appendChild(this.element);let b=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),b.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,u.addDisposableDomListener)(this.screenElement,"mousemove",(z=>this.updateCursorStyle(z)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),b.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",l.promptLabel),P.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(f.CoreBrowserService,this.textarea,T.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,u.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(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(a.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((z=>this._onRender.fire(z)))),this.onResize((z=>this._renderService.resize(z.cols,z.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(t.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(v.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(b);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((z=>this.scrollLines(z.amount,z.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(_.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((z=>this.scrollLines(z.amount,z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((z=>this._renderService.handleSelectionChanged(z.start,z.end,z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((z=>{this.textarea.value=z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(z=>this._selectionService.handleMouseDown(z)))),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",(z=>this._handleScreenReaderModeOptionChange(z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(z=>{!this._overviewRulerRenderer&&z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let T=this,b=this.element;function z(j){let te=T._mouseService.getMouseReportCoords(j,T.screenElement);if(!te)return!1;let ne,oe;switch(j.overrideType||j.type){case"mousemove":oe=32,j.buttons===void 0?(ne=3,j.button!==void 0&&(ne=j.button<3?j.button:3)):ne=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":oe=0,ne=j.button<3?j.button:3;break;case"mousedown":oe=1,ne=j.button<3?j.button:3;break;case"wheel":if(T._customWheelEventHandler&&T._customWheelEventHandler(j)===!1||T.viewport.getLinesScrolled(j)===0)return!1;oe=j.deltaY<0?0:1,ne=4;break;default:return!1}return!(oe===void 0||ne===void 0||ne>4)&&T.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:ne,action:oe,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let F={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:j=>(z(j),j.buttons||(this._document.removeEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.removeEventListener("mousemove",F.mousedrag)),this.cancel(j)),wheel:j=>(z(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&z(j)},mousemove:j=>{j.buttons||z(j)}};this.register(this.coreMouseService.onProtocolChange((j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),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&j?F.mousemove||(b.addEventListener("mousemove",V.mousemove),F.mousemove=V.mousemove):(b.removeEventListener("mousemove",F.mousemove),F.mousemove=null),16&j?F.wheel||(b.addEventListener("wheel",V.wheel,{passive:!1}),F.wheel=V.wheel):(b.removeEventListener("wheel",F.wheel),F.wheel=null),2&j?F.mouseup||(F.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",F.mouseup),F.mouseup=null),4&j?F.mousedrag||(F.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",F.mousedrag),F.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(b,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return z(j),F.mouseup&&this._document.addEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.addEventListener("mousemove",F.mousedrag),this.cancel(j)}))),this.register((0,u.addDisposableDomListener)(b,"wheel",(j=>{if(!F.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let te=this.viewport.getLinesScrolled(j);if(te===0)return;let ne=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),oe="";for(let _e=0;_e<Math.abs(te);_e++)oe+=ne;return this.coreService.triggerDataEvent(oe,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(b,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(b,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(T,b){this._renderService?.refreshRows(T,b)}updateCursorStyle(T){this._selectionService?.shouldColumnSelect(T)?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(T,b,z=0){z===1?(super.scrollLines(T,b,z),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(T)}paste(T){(0,c.paste)(T,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(T){this._customKeyEventHandler=T}attachCustomWheelEventHandler(T){this._customWheelEventHandler=T}registerLinkProvider(T){return this._linkProviderService.registerLinkProvider(T)}registerCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let b=this._characterJoinerService.register(T);return this.refresh(0,this.rows-1),b}deregisterCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(T)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(T){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+T)}registerDecoration(T){return this._decorationService.registerDecoration(T)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(T,b,z){this._selectionService.setSelection(T,b,z)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(T,b){this._selectionService?.selectLines(T,b)}_keyDown(T){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;let b=this.browser.isMac&&this.options.macOptionIsMeta&&T.altKey;if(!b&&!this._compositionHelper.keydown(T))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;b||T.key!=="Dead"&&T.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let z=(0,$.evaluateKeyboardEvent)(T,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),z.type===3||z.type===2){let F=this.rows-1;return this.scrollLines(z.type===2?-F:F),this.cancel(T,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||(z.cancel&&this.cancel(T,!0),!z.key||!!(T.key&&!T.ctrlKey&&!T.altKey&&!T.metaKey&&T.key.length===1&&T.key.charCodeAt(0)>=65&&T.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==K.C0.ETX&&z.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||T.altKey||T.ctrlKey?this.cancel(T,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(T,b){let z=T.isMac&&!this.options.macOptionIsMeta&&b.altKey&&!b.ctrlKey&&!b.metaKey||T.isWindows&&b.altKey&&b.ctrlKey&&!b.metaKey||T.isWindows&&b.getModifierState("AltGraph");return b.type==="keypress"?z:z&&(!b.keyCode||b.keyCode>47)}_keyUp(T){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||((function(b){return b.keyCode===16||b.keyCode===17||b.keyCode===18})(T)||this.focus(),this.updateCursorStyle(T),this._keyPressHandled=!1)}_keyPress(T){let b;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)b=T.charCode;else if(T.which===null||T.which===void 0)b=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;b=T.which}return!(!b||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(b=String.fromCharCode(b),this._onKey.fire({key:b,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(b,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(T){if(T.data&&T.inputType==="insertText"&&(!T.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let b=T.data;return this.coreService.triggerDataEvent(b,!0),this.cancel(T),!0}return!1}resize(T,b){T!==this.cols||b!==this.rows?super.resize(T,b):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(T,b){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){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 T=1;T<this.rows;T++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let T=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=T,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(T){if(this._renderService)switch(T){case L.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let b=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${z};${b}t`);break;case L.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let F=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${V};${F}t`)}}cancel(T,b){if(this.options.cancelEvents||b)return T.preventDefault(),T.stopPropagation(),!1}}r.Terminal=X},9924:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(n,c=1e3){this._renderCallback=n,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,c,u){this._rowCount=u,n=n!==void 0?n:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=o-this._lastRefreshMs,d=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,c)}}},1680:function(D,r,n){var c=this&&this.__decorate||function(t,e,s,a){var f,v=arguments.length,g=v<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,s,a);else for(var _=t.length-1;_>=0;_--)(f=t[_])&&(g=(v<3?f(g):v>3?f(e,s,g):f(e,s))||g);return v>3&&g&&Object.defineProperty(e,s,g),g},u=this&&this.__param||function(t,e){return function(s,a){e(s,a,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let o=n(3656),l=n(4725),d=n(8460),p=n(844),h=n(2585),i=r.Viewport=class extends p.Disposable{constructor(t,e,s,a,f,v,g,_){super(),this._viewportElement=t,this._scrollArea=e,this._bufferService=s,this._optionsService=a,this._charSizeService=f,this._renderService=v,this._coreBrowserService=g,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 d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(_.colors),this.register(_.onChangeColors((m=>this._handleThemeChange(m)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(t){this._viewportElement.style.backgroundColor=t.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(t){if(t)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;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null}syncScrollArea(t=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(t);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(t)}_handleScroll(t){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});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let t=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(t*(this._smoothScrollState.target-this._smoothScrollState.origin)),t<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(t,e){let s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&s<this._lastRecordedBufferHeight)||(t.cancelable&&t.preventDefault(),!1)}handleWheel(t){let e=this._getPixelsScrolled(t);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}scrollLines(t){if(t!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=t*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!1})}_getPixelsScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(t,e){let s,a="",f=[],v=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let _=t;_<v;_++){let m=g.get(_);if(!m)continue;let y=g.get(_+1)?.isWrapped;if(a+=m.translateToString(!y),!y||_===g.length-1){let E=document.createElement("div");E.textContent=a,f.push(E),a.length>0&&(s=E),a=""}}return{bufferElements:f,cursorElement:s}}getLinesScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(t,e){let s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&e.altKey||s==="ctrl"&&e.ctrlKey||s==="shift"&&e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(t){this._lastTouchY=t.touches[0].pageY}handleTouchMove(t){let e=this._lastTouchY-t.touches[0].pageY;return this._lastTouchY=t.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}};r.Viewport=i=c([u(2,h.IBufferService),u(3,h.IOptionsService),u(4,l.ICharSizeService),u(5,l.IRenderService),u(6,l.ICoreBrowserService),u(7,l.IThemeService)],i)},3107:function(D,r,n){var c=this&&this.__decorate||function(h,i,t,e){var s,a=arguments.length,f=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(h,i,t,e);else for(var v=h.length-1;v>=0;v--)(s=h[v])&&(f=(a<3?s(f):a>3?s(i,t,f):s(i,t))||f);return a>3&&f&&Object.defineProperty(i,t,f),f},u=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let o=n(4725),l=n(844),d=n(2585),p=r.BufferDecorationRenderer=class extends l.Disposable{constructor(h,i,t,e,s){super(),this._screenElement=h,this._bufferService=i,this._coreBrowserService=t,this._decorationService=e,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((a=>this._removeDecoration(a)))),this.register((0,l.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(let h of this._decorationService.decorations)this._renderDecoration(h);this._dimensionsChanged=!1}_renderDecoration(h){this._refreshStyle(h),this._dimensionsChanged&&this._refreshXPosition(h)}_createElement(h){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",h?.options?.layer==="top"),i.style.width=`${Math.round((h.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(h.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(h.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let t=h.options.x??0;return t&&t>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(h,i),i}_refreshStyle(h){let i=h.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)h.element&&(h.element.style.display="none",h.onRenderEmitter.fire(h.element));else{let t=this._decorationElements.get(h);t||(t=this._createElement(h),h.element=t,this._decorationElements.set(h,t),this._container.appendChild(t),h.onDispose((()=>{this._decorationElements.delete(h),t.remove()}))),t.style.top=i*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",h.onRenderEmitter.fire(t)}}_refreshXPosition(h,i=h.element){if(!i)return;let t=h.options.x??0;(h.options.anchor||"left")==="right"?i.style.right=t?t*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=t?t*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(h){this._decorationElements.get(h)?.remove(),this._decorationElements.delete(h),h.dispose()}};r.BufferDecorationRenderer=p=c([u(1,d.IBufferService),u(2,o.ICoreBrowserService),u(3,d.IDecorationService),u(4,o.IRenderService)],p)},5871:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.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(n){if(n.options.overviewRulerOptions){for(let c of this._zones)if(c.color===n.options.overviewRulerOptions.color&&c.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,n.marker.line))return;if(this._lineAdjacentToZone(c,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(c,n.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=n.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=n.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=n.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=n.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:n.options.overviewRulerOptions.color,position:n.options.overviewRulerOptions.position,startBufferLine:n.marker.line,endBufferLine:n.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(n){this._linePadding=n}_lineIntersectsZone(n,c){return c>=n.startBufferLine&&c<=n.endBufferLine}_lineAdjacentToZone(n,c,u){return c>=n.startBufferLine-this._linePadding[u||"full"]&&c<=n.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(n,c){n.startBufferLine=Math.min(n.startBufferLine,c),n.endBufferLine=Math.max(n.endBufferLine,c)}}},5744:function(D,r,n){var c=this&&this.__decorate||function(s,a,f,v){var g,_=arguments.length,m=_<3?a:v===null?v=Object.getOwnPropertyDescriptor(a,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,a,f,v);else for(var y=s.length-1;y>=0;y--)(g=s[y])&&(m=(_<3?g(m):_>3?g(a,f,m):g(a,f))||m);return _>3&&m&&Object.defineProperty(a,f,m),m},u=this&&this.__param||function(s,a){return function(f,v){a(f,v,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let o=n(5871),l=n(4725),d=n(844),p=n(2585),h={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},e=r.OverviewRulerRenderer=class extends d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,a,f,v,g,_,m){super(),this._viewportElement=s,this._screenElement=a,this._bufferService=f,this._decorationService=v,this._renderService=g,this._optionsService=_,this._coreBrowserService=m,this._colorZoneStore=new o.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,d.toDisposable)((()=>{this._canvas?.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(){let s=Math.floor(this._canvas.width/3),a=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=s,i.center=a,i.right=s,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=i.left,t.right=i.left+i.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);let s=this._canvas.height/this._bufferService.buffer.lines.length,a=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);h.left=a,h.center=a,h.right=a}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.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(let a of this._decorationService.decorations)this._colorZoneStore.addDecoration(a);this._ctx.lineWidth=1;let s=this._colorZoneStore.zones;for(let a of s)a.position!=="full"&&this._renderColorZone(a);for(let a of s)a.position==="full"&&this._renderColorZone(a);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(t[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-h[s.position||"full"]/2),i[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[s.position||"full"]))}_queueRefresh(s,a){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=a||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=e=c([u(2,p.IBufferService),u(3,p.IDecorationService),u(4,l.IRenderService),u(5,p.IOptionsService),u(6,l.ICoreBrowserService)],e)},2950:function(D,r,n){var c=this&&this.__decorate||function(h,i,t,e){var s,a=arguments.length,f=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(h,i,t,e);else for(var v=h.length-1;v>=0;v--)(s=h[v])&&(f=(a<3?s(f):a>3?s(i,t,f):s(i,t))||f);return a>3&&f&&Object.defineProperty(i,t,f),f},u=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let o=n(4725),l=n(2585),d=n(2584),p=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,i,t,e,s,a){this._textarea=h,this._compositionView=i,this._bufferService=t,this._optionsService=e,this._coreService=s,this._renderService=a,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(h){this._compositionView.textContent=h.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(h){if(this._isComposing||this._isSendingComposition){if(h.keyCode===229||h.keyCode===16||h.keyCode===17||h.keyCode===18)return!1;this._finalizeComposition(!1)}return h.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(h){if(this._compositionView.classList.remove("active"),this._isComposing=!1,h){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let h=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,t=i.replace(h,"");this._dataAlreadySent=t,i.length>h.length?this._coreService.triggerDataEvent(t,!0):i.length<h.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):i.length===h.length&&i!==h&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(h){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=p=c([u(2,l.IBufferService),u(3,l.IOptionsService),u(4,l.ICoreService),u(5,o.IRenderService)],p)},9806:(D,r)=>{function n(c,u,o){let l=o.getBoundingClientRect(),d=c.getComputedStyle(o),p=parseInt(d.getPropertyValue("padding-left")),h=parseInt(d.getPropertyValue("padding-top"));return[u.clientX-l.left-p,u.clientY-l.top-h]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=n,r.getCoords=function(c,u,o,l,d,p,h,i,t){if(!p)return;let e=n(c,u,o);return e?(e[0]=Math.ceil((e[0]+(t?h/2:0))/h),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),l+(t?1:0)),e[1]=Math.min(Math.max(e[1],1),d),e):void 0}},9504:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let c=n(2584);function u(i,t,e,s){let a=i-o(i,e),f=t-o(t,e),v=Math.abs(a-f)-(function(g,_,m){let y=0,E=g-o(g,m),C=_-o(_,m);for(let w=0;w<Math.abs(E-C);w++){let R=l(g,_)==="A"?-1:1;m.buffer.lines.get(E+R*w)?.isWrapped&&y++}return y})(i,t,e);return h(v,p(l(i,t),s))}function o(i,t){let e=0,s=t.buffer.lines.get(i),a=s?.isWrapped;for(;a&&i>=0&&i<t.rows;)e++,s=t.buffer.lines.get(--i),a=s?.isWrapped;return e}function l(i,t){return i>t?"A":"B"}function d(i,t,e,s,a,f){let v=i,g=t,_="";for(;v!==e||g!==s;)v+=a?1:-1,a&&v>f.cols-1?(_+=f.buffer.translateBufferLineToString(g,!1,i,v),v=0,i=0,g++):!a&&v<0&&(_+=f.buffer.translateBufferLineToString(g,!1,0,i+1),v=f.cols-1,i=v,g--);return _+f.buffer.translateBufferLineToString(g,!1,i,v)}function p(i,t){let e=t?"O":"[";return c.C0.ESC+e+i}function h(i,t){i=Math.floor(i);let e="";for(let s=0;s<i;s++)e+=t;return e}r.moveToCellSequence=function(i,t,e,s){let a=e.buffer.x,f=e.buffer.y;if(!e.buffer.hasScrollback)return(function(_,m,y,E,C,w){return u(m,E,C,w).length===0?"":h(d(_,m,_,m-o(m,C),!1,C).length,p("D",w))})(a,f,0,t,e,s)+u(f,t,e,s)+(function(_,m,y,E,C,w){let R;R=u(m,E,C,w).length>0?E-o(E,C):m;let P=E,U=(function(K,$,S,x,k,L){let H;return H=u(S,x,k,L).length>0?x-o(x,k):$,K<S&&H<=x||K>=S&&H<x?"C":"D"})(_,m,y,E,C,w);return h(d(_,R,y,P,U==="C",C).length,p(U,w))})(a,f,i,t,e,s);let v;if(f===t)return v=a>i?"D":"C",h(Math.abs(a-i),p(v,s));v=f>t?"D":"C";let g=Math.abs(f-t);return h((function(_,m){return m.cols-_})(f>t?i:a,e)+(g-1)*e.cols+1+((f>t?a:i)-1),p(v,s))}},1296:function(D,r,n){var c=this&&this.__decorate||function(w,R,P,U){var K,$=arguments.length,S=$<3?R:U===null?U=Object.getOwnPropertyDescriptor(R,P):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(w,R,P,U);else for(var x=w.length-1;x>=0;x--)(K=w[x])&&(S=($<3?K(S):$>3?K(R,P,S):K(R,P))||S);return $>3&&S&&Object.defineProperty(R,P,S),S},u=this&&this.__param||function(w,R){return function(P,U){R(P,U,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let o=n(3787),l=n(2550),d=n(2223),p=n(6171),h=n(6052),i=n(4725),t=n(8055),e=n(8460),s=n(844),a=n(2585),f="xterm-dom-renderer-owner-",v="xterm-rows",g="xterm-fg-",_="xterm-bg-",m="xterm-focus",y="xterm-selection",E=1,C=r.DomRenderer=class extends s.Disposable{constructor(w,R,P,U,K,$,S,x,k,L,H,q,X){super(),this._terminal=w,this._document=R,this._element=P,this._screenElement=U,this._viewportElement=K,this._helperContainer=$,this._linkifier2=S,this._charSizeService=k,this._optionsService=L,this._bufferService=H,this._coreBrowserService=q,this._themeService=X,this._terminalClass=E++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(v),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Z=>this._injectCss(Z)))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(f+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Z=>this._handleLinkHover(Z)))),this.register(this._linkifier2.onHideLinkUnderline((Z=>this._handleLinkLeave(Z)))),this.register((0,s.toDisposable)((()=>{this._element.classList.remove(f+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new l.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(){let w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),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/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),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(let P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let R=`${this._terminalSelector} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=R,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(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let R=`${this._terminalSelector} .${v} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;R+=`${this._terminalSelector} .${v} .xterm-dim { color: ${t.color.multiplyOpacity(w.foreground,.5).css};}`,R+=`${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;}`;let P=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;R+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,R+=`@keyframes ${U} { 50% { box-shadow: none; }}`,R+=`@keyframes ${K} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,R+=`${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,R+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(let[$,S]of w.ansi.entries())R+=`${this._terminalSelector} .${g}${$} { color: ${S.css}; }${this._terminalSelector} .${g}${$}.xterm-dim { color: ${t.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${_}${$} { background-color: ${S.css}; }`;R+=`${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR} { color: ${t.color.opaque(w.background).css}; }${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${t.color.multiplyOpacity(t.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${_}${d.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=R}_setDefaultSpacing(){let w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,R){for(let P=this._rowElements.length;P<=R;P++){let U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>R;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,R){this._refreshRowElements(w,R),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(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,R,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,R,P),this.renderRows(0,this._bufferService.rows-1),!w||!R)return;this._selectionRenderModel.update(this._terminal,w,R,P);let U=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||S<0)return;let x=this._document.createDocumentFragment();if(P){let k=w[0]>R[0];x.appendChild(this._createSelectionElement($,k?R[0]:w[0],k?w[0]:R[0],S-$+1))}else{let k=U===$?w[0]:0,L=$===K?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement($,k,L));let H=S-$-1;if(x.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,H)),$!==S){let q=K===S?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(S,0,q))}}this._selectionContainer.appendChild(x)}_createSelectionElement(w,R,P,U=1){let K=this._document.createElement("div"),$=R*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(P-R);return $+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-$),K.style.height=U*this.dimensions.css.cell.height+"px",K.style.top=w*this.dimensions.css.cell.height+"px",K.style.left=`${$}px`,K.style.width=`${S}px`,K}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(let w of this._rowElements)w.replaceChildren()}renderRows(w,R){let P=this._bufferService.buffer,U=P.ybase+P.y,K=Math.min(P.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=w;k<=R;k++){let L=k+P.ydisp,H=this._rowElements[k],q=P.lines.get(L);if(!H||!q)break;H.replaceChildren(...this._rowFactory.createRow(q,L,L===U,S,x,K,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${f}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,R,P,U,K,$){P<0&&(w=0),U<0&&(R=0);let S=this._bufferService.rows-1;P=Math.max(Math.min(P,S),0),U=Math.max(Math.min(U,S),0),K=Math.min(K,this._bufferService.cols);let x=this._bufferService.buffer,k=x.ybase+x.y,L=Math.min(x.x,K-1),H=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=P;Z<=U;++Z){let T=Z+x.ydisp,b=this._rowElements[Z],z=x.lines.get(T);if(!b||!z)break;b.replaceChildren(...this._rowFactory.createRow(z,T,T===k,q,X,L,H,this.dimensions.css.cell.width,this._widthCache,$?Z===P?w:0:-1,$?(Z===U?R:K)-1:-1))}}};r.DomRenderer=C=c([u(7,a.IInstantiationService),u(8,i.ICharSizeService),u(9,a.IOptionsService),u(10,a.IBufferService),u(11,i.ICoreBrowserService),u(12,i.IThemeService)],C)},3787:function(D,r,n){var c=this&&this.__decorate||function(v,g,_,m){var y,E=arguments.length,C=E<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(v,g,_,m);else for(var w=v.length-1;w>=0;w--)(y=v[w])&&(C=(E<3?y(C):E>3?y(g,_,C):y(g,_))||C);return E>3&&C&&Object.defineProperty(g,_,C),C},u=this&&this.__param||function(v,g){return function(_,m){g(_,m,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let o=n(2223),l=n(643),d=n(511),p=n(2585),h=n(8055),i=n(4725),t=n(4269),e=n(6171),s=n(3734),a=r.DomRendererRowFactory=class{constructor(v,g,_,m,y,E,C){this._document=v,this._characterJoinerService=g,this._optionsService=_,this._coreBrowserService=m,this._coreService=y,this._decorationService=E,this._themeService=C,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(v,g,_){this._selectionStart=v,this._selectionEnd=g,this._columnSelectMode=_}createRow(v,g,_,m,y,E,C,w,R,P,U){let K=[],$=this._characterJoinerService.getJoinedCharacters(g),S=this._themeService.colors,x,k=v.getNoBgTrimmedLength();_&&k<E+1&&(k=E+1);let L=0,H="",q=0,X=0,Z=0,T=!1,b=0,z=!1,F=0,V=[],j=P!==-1&&U!==-1;for(let te=0;te<k;te++){v.loadCell(te,this._workCell);let ne=this._workCell.getWidth();if(ne===0)continue;let oe=!1,_e=te,J=this._workCell;if($.length>0&&te===$[0][0]){oe=!0;let Y=$.shift();J=new t.JoinedCellData(this._workCell,v.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),_e=Y[1]-1,ne=J.getWidth()}let Se=this._isCellInSelection(te,g),ze=_&&te===E,Te=j&&te>=P&&te<=U,He=!1;this._decorationService.forEachDecorationAtCell(te,g,void 0,(Y=>{He=!0}));let Be=J.getChars()||l.WHITESPACE_CELL_CHAR;if(Be===" "&&(J.isUnderline()||J.isOverline())&&(Be="\xA0"),F=ne*w-R.get(Be,J.isBold(),J.isItalic()),x){if(L&&(Se&&z||!Se&&!z&&J.bg===q)&&(Se&&z&&S.selectionForeground||J.fg===X)&&J.extended.ext===Z&&Te===T&&F===b&&!ze&&!oe&&!He){J.isInvisible()?H+=l.WHITESPACE_CELL_CHAR:H+=Be,L++;continue}L&&(x.textContent=H),x=this._document.createElement("span"),L=0,H=""}else x=this._document.createElement("span");if(q=J.bg,X=J.fg,Z=J.extended.ext,T=Te,b=F,z=Se,oe&&E>=te&&E<=_e&&(E=te),!this._coreService.isCursorHidden&&ze&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)C&&V.push("xterm-cursor-blink"),V.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(J.isBold()&&V.push("xterm-bold"),J.isItalic()&&V.push("xterm-italic"),J.isDim()&&V.push("xterm-dim"),H=J.isInvisible()?l.WHITESPACE_CELL_CHAR:J.getChars()||l.WHITESPACE_CELL_CHAR,J.isUnderline()&&(V.push(`xterm-underline-${J.extended.underlineStyle}`),H===" "&&(H="\xA0"),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let Y=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&Y<8&&(Y+=8),x.style.textDecorationColor=S.ansi[Y].css}J.isOverline()&&(V.push("xterm-overline"),H===" "&&(H="\xA0")),J.isStrikethrough()&&V.push("xterm-strikethrough"),Te&&(x.style.textDecoration="underline");let ge=J.getFgColor(),xe=J.getFgColorMode(),be=J.getBgColor(),Re=J.getBgColorMode(),$e=!!J.isInverse();if($e){let Y=ge;ge=be,be=Y;let ye=xe;xe=Re,Re=ye}let se,Ce,ae,ke=!1;switch(this._decorationService.forEachDecorationAtCell(te,g,void 0,(Y=>{Y.options.layer!=="top"&&ke||(Y.backgroundColorRGB&&(Re=50331648,be=Y.backgroundColorRGB.rgba>>8&16777215,se=Y.backgroundColorRGB),Y.foregroundColorRGB&&(xe=50331648,ge=Y.foregroundColorRGB.rgba>>8&16777215,Ce=Y.foregroundColorRGB),ke=Y.options.layer==="top")})),!ke&&Se&&(se=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,be=se.rgba>>8&16777215,Re=50331648,ke=!0,S.selectionForeground&&(xe=50331648,ge=S.selectionForeground.rgba>>8&16777215,Ce=S.selectionForeground)),ke&&V.push("xterm-decoration-top"),Re){case 16777216:case 33554432:ae=S.ansi[be],V.push(`xterm-bg-${be}`);break;case 50331648:ae=h.channels.toColor(be>>16,be>>8&255,255&be),this._addStyle(x,`background-color:#${f((be>>>0).toString(16),"0",6)}`);break;default:$e?(ae=S.foreground,V.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):ae=S.background}switch(se||J.isDim()&&(se=h.color.multiplyOpacity(ae,.5)),xe){case 16777216:case 33554432:J.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(x,ae,S.ansi[ge],J,se,void 0)||V.push(`xterm-fg-${ge}`);break;case 50331648:let Y=h.channels.toColor(ge>>16&255,ge>>8&255,255&ge);this._applyMinimumContrast(x,ae,Y,J,se,Ce)||this._addStyle(x,`color:#${f(ge.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,ae,S.foreground,J,se,Ce)||$e&&V.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}V.length&&(x.className=V.join(" "),V.length=0),ze||oe||He?x.textContent=H:L++,F!==this.defaultSpacing&&(x.style.letterSpacing=`${F}px`),K.push(x),te=_e}return x&&L&&(x.textContent=H),K}_applyMinimumContrast(v,g,_,m,y,E){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let C=this._getContrastCache(m),w;if(y||E||(w=C.getColor(g.rgba,_.rgba)),w===void 0){let R=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);w=h.color.ensureContrastRatio(y||g,E||_,R),C.setColor((y||g).rgba,(E||_).rgba,w??null)}return!!w&&(this._addStyle(v,`color:${w.css}`),!0)}_getContrastCache(v){return v.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(v,g){v.setAttribute("style",`${v.getAttribute("style")||""}${g};`)}_isCellInSelection(v,g){let _=this._selectionStart,m=this._selectionEnd;return!(!_||!m)&&(this._columnSelectMode?_[0]<=m[0]?v>=_[0]&&g>=_[1]&&v<m[0]&&g<=m[1]:v<_[0]&&g>=_[1]&&v>=m[0]&&g<=m[1]:g>_[1]&&g<m[1]||_[1]===m[1]&&g===_[1]&&v>=_[0]&&v<m[0]||_[1]<m[1]&&g===m[1]&&v<m[0]||_[1]<m[1]&&g===_[1]&&v>=_[0])}};function f(v,g,_){for(;v.length<_;)v=g+v;return v}r.DomRendererRowFactory=a=c([u(1,i.ICharacterJoinerService),u(2,p.IOptionsService),u(3,i.ICoreBrowserService),u(4,p.ICoreService),u(5,p.IDecorationService),u(6,i.IThemeService)],a)},2550:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(n,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.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";let u=n.createElement("span");u.classList.add("xterm-char-measure-element");let o=n.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let l=n.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let d=n.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[u,o,l,d],this._container.appendChild(u),this._container.appendChild(o),this._container.appendChild(l),this._container.appendChild(d),c.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(n,c,u,o){n===this._font&&c===this._fontSize&&u===this._weight&&o===this._weightBold||(this._font=n,this._fontSize=c,this._weight=u,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(n,c,u){let o=0;if(!c&&!u&&n.length===1&&(o=n.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let p=this._measure(n,0);return p>0&&(this._flat[o]=p),p}let l=n;c&&(l+="B"),u&&(l+="I");let d=this._holey.get(l);if(d===void 0){let p=0;c&&(p|=1),u&&(p|=2),d=this._measure(n,p),d>0&&this._holey.set(l,d)}return d}_measure(n,c){let u=this._measureElements[c];return u.textContent=n.repeat(32),u.offsetWidth/32}}},2223:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let c=n(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(D,r)=>{function n(u){return 57508<=u&&u<=57558}function c(u){return u>=128512&&u<=128591||u>=127744&&u<=128511||u>=128640&&u<=128767||u>=9728&&u<=9983||u>=9984&&u<=10175||u>=65024&&u<=65039||u>=129280&&u<=129535||u>=127462&&u<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(u){if(!u)throw new Error("value must not be falsy");return u},r.isPowerlineGlyph=n,r.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},r.isEmoji=c,r.allowRescaling=function(u,o,l,d){return o===1&&l>Math.ceil(1.5*d)&&u!==void 0&&u>255&&!c(u)&&!n(u)&&!(function(p){return 57344<=p&&p<=63743})(u)},r.treatGlyphAsBackgroundColor=function(u){return n(u)||(function(o){return 9472<=o&&o<=9631})(u)},r.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}}}},r.computeNextVariantOffset=function(u,o,l=0){return(u-(2*Math.round(o)-l))%(2*Math.round(o))}},6052:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class n{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(u,o,l,d=!1){if(this.selectionStart=o,this.selectionEnd=l,!o||!l||o[0]===l[0]&&o[1]===l[1])return void this.clear();let p=u.buffers.active.ydisp,h=o[1]-p,i=l[1]-p,t=Math.max(h,0),e=Math.min(i,u.rows-1);t>=u.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=h,this.viewportEndRow=i,this.viewportCappedStartRow=t,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=l[0])}isCellSelected(u,o,l){return!!this.hasSelection&&(l-=u.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&l>=this.viewportCappedStartRow&&o<this.endCol&&l<=this.viewportCappedEndRow:o<this.startCol&&l>=this.viewportCappedStartRow&&o>=this.endCol&&l<=this.viewportCappedEndRow:l>this.viewportStartRow&&l<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&l===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&l===this.viewportStartRow&&o>=this.startCol)}}r.createSelectionRenderModel=function(){return new n}},456:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(n){this._bufferService=n,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()){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let n=this.selectionStart,c=this.selectionEnd;return!(!n||!c)&&(n[1]>c[1]||n[1]===c[1]&&n[0]>c[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,r,n){var c=this&&this.__decorate||function(e,s,a,f){var v,g=arguments.length,_=g<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,s,a,f);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(_=(g<3?v(_):g>3?v(s,a,_):v(s,a))||_);return g>3&&_&&Object.defineProperty(s,a,_),_},u=this&&this.__param||function(e,s){return function(a,f){s(a,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let o=n(2585),l=n(8460),d=n(844),p=r.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,a){super(),this._optionsService=a,this.width=0,this.height=0,this._onCharSizeChange=this.register(new l.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new t(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=p=c([u(2,o.IOptionsService)],p);class h extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,a){s!==void 0&&s>0&&a!==void 0&&a>0&&(this._result.width=s,this._result.height=a)}}class i extends h{constructor(s,a,f){super(),this._document=s,this._parentElement=a,this._optionsService=f,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 t extends h{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let a=this._ctx.measureText("W");if(!("width"in a&&"fontBoundingBoxAscent"in a&&"fontBoundingBoxDescent"in a))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(D,r,n){var c=this&&this.__decorate||function(t,e,s,a){var f,v=arguments.length,g=v<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,s,a);else for(var _=t.length-1;_>=0;_--)(f=t[_])&&(g=(v<3?f(g):v>3?f(e,s,g):f(e,s))||g);return v>3&&g&&Object.defineProperty(e,s,g),g},u=this&&this.__param||function(t,e){return function(s,a){e(s,a,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let o=n(3734),l=n(643),d=n(511),p=n(2585);class h extends o.AttributeData{constructor(e,s,a){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=s,this._width=a}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=h;let i=r.CharacterJoinerService=class Et{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(e){let s={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(s),s.id}deregister(e){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===e)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let s=this._bufferService.buffer.lines.get(e);if(!s||s.length===0)return[];let a=[],f=s.translateToString(!0),v=0,g=0,_=0,m=s.getFg(0),y=s.getBg(0);for(let E=0;E<s.getTrimmedLength();E++)if(s.loadCell(E,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==y){if(E-v>1){let C=this._getJoinedRanges(f,_,g,s,v);for(let w=0;w<C.length;w++)a.push(C[w])}v=E,_=g,m=this._workCell.fg,y=this._workCell.bg}g+=this._workCell.getChars().length||l.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-v>1){let E=this._getJoinedRanges(f,_,g,s,v);for(let C=0;C<E.length;C++)a.push(E[C])}return a}_getJoinedRanges(e,s,a,f,v){let g=e.substring(s,a),_=[];try{_=this._characterJoiners[0].handler(g)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let y=this._characterJoiners[m].handler(g);for(let E=0;E<y.length;E++)Et._mergeRanges(_,y[E])}catch(y){console.error(y)}return this._stringRangesToCellRanges(_,f,v),_}_stringRangesToCellRanges(e,s,a){let f=0,v=!1,g=0,_=e[f];if(_){for(let m=a;m<this._bufferService.cols;m++){let y=s.getWidth(m),E=s.getString(m).length||l.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!v&&_[0]<=g&&(_[0]=m,v=!0),_[1]<=g){if(_[1]=m,_=e[++f],!_)break;_[0]<=g?(_[0]=m,v=!0):v=!1}g+=E}}_&&(_[1]=this._bufferService.cols)}}static _mergeRanges(e,s){let a=!1;for(let f=0;f<e.length;f++){let v=e[f];if(a){if(s[1]<=v[0])return e[f-1][1]=s[1],e;if(s[1]<=v[1])return e[f-1][1]=Math.max(s[1],v[1]),e.splice(f,1),e;e.splice(f,1),f--}else{if(s[1]<=v[0])return e.splice(f,0,s),e;if(s[1]<=v[1])return v[0]=Math.min(s[0],v[0]),e;s[0]<v[1]&&(v[0]=Math.min(s[0],v[0]),a=!0)}}return a?e[e.length-1][1]=s[1]:e.push(s),e}};r.CharacterJoinerService=i=c([u(0,p.IBufferService)],i)},5114:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let c=n(844),u=n(8460),o=n(3656);class l extends c.Disposable{constructor(h,i,t){super(),this._textarea=h,this._window=i,this.mainDocument=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new d(this._window),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new u.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,u.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(h){this._window!==h&&(this._window=h,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}}r.CoreBrowserService=l;class d extends c.Disposable{constructor(h){super(),this._parentWindow=h,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)((()=>this.clearListener())))}setWindow(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let c=n(844);class u extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(l){return this.linkProviders.push(l),{dispose:()=>{let d=this.linkProviders.indexOf(l);d!==-1&&this.linkProviders.splice(d,1)}}}}r.LinkProviderService=u},8934:function(D,r,n){var c=this&&this.__decorate||function(p,h,i,t){var e,s=arguments.length,a=s<3?h:t===null?t=Object.getOwnPropertyDescriptor(h,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(p,h,i,t);else for(var f=p.length-1;f>=0;f--)(e=p[f])&&(a=(s<3?e(a):s>3?e(h,i,a):e(h,i))||a);return s>3&&a&&Object.defineProperty(h,i,a),a},u=this&&this.__param||function(p,h){return function(i,t){h(i,t,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let o=n(4725),l=n(9806),d=r.MouseService=class{constructor(p,h){this._renderService=p,this._charSizeService=h}getCoords(p,h,i,t,e){return(0,l.getCoords)(window,p,h,i,t,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(p,h){let i=(0,l.getCoordsRelativeToElement)(window,p,h);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};r.MouseService=d=c([u(0,o.IRenderService),u(1,o.ICharSizeService)],d)},3230:function(D,r,n){var c=this&&this.__decorate||function(e,s,a,f){var v,g=arguments.length,_=g<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,s,a,f);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(_=(g<3?v(_):g>3?v(s,a,_):v(s,a))||_);return g>3&&_&&Object.defineProperty(s,a,_),_},u=this&&this.__param||function(e,s){return function(a,f){s(a,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let o=n(6193),l=n(4725),d=n(8460),p=n(844),h=n(7226),i=n(2585),t=r.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,s,a,f,v,g,_,m){super(),this._rowCount=e,this._charSizeService=f,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new h.DebouncedIdleTask,this._observerDisposable=this.register(new p.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 d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(((y,E)=>this._renderRows(y,E)),_),this.register(this._renderDebouncer),this.register(_.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(a.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(v.onDecorationRegistered((()=>this._fullRefresh()))),this.register(v.onDecorationRemoved((()=>this._fullRefresh()))),this.register(a.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(a.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(_.window,s),this.register(_.onWindowChange((y=>this._registerIntersectionObserver(y,s))))}_registerIntersectionObserver(e,s){if("IntersectionObserver"in e){let a=new e.IntersectionObserver((f=>this._handleIntersectionChange(f[f.length-1])),{threshold:0});a.observe(s),this._observerDisposable.value=(0,p.toDisposable)((()=>a.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,s,a=!1){this._isPaused?this._needsFullRefresh=!0:(a||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,s,this._rowCount))}_renderRows(e,s){this._renderer.value&&(e=Math.min(e,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(e,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:e,end:s}),this._onRender.fire({start:e,end:s}),this._isNextRenderRedrawOnly=!0)}resize(e,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((s=>this.refreshRows(s.start,s.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,s))):this._renderer.value.handleResize(e,s),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,s,a){this._selectionState.start=e,this._selectionState.end=s,this._selectionState.columnSelectMode=a,this._renderer.value?.handleSelectionChanged(e,s,a)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=t=c([u(2,i.IOptionsService),u(3,l.ICharSizeService),u(4,i.IDecorationService),u(5,i.IBufferService),u(6,l.ICoreBrowserService),u(7,l.IThemeService)],t)},9312:function(D,r,n){var c=this&&this.__decorate||function(_,m,y,E){var C,w=arguments.length,R=w<3?m:E===null?E=Object.getOwnPropertyDescriptor(m,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,m,y,E);else for(var P=_.length-1;P>=0;P--)(C=_[P])&&(R=(w<3?C(R):w>3?C(m,y,R):C(m,y))||R);return w>3&&R&&Object.defineProperty(m,y,R),R},u=this&&this.__param||function(_,m){return function(y,E){m(y,E,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let o=n(9806),l=n(9504),d=n(456),p=n(4725),h=n(8460),i=n(844),t=n(6114),e=n(4841),s=n(511),a=n(2585),f="\xA0",v=new RegExp(f,"g"),g=r.SelectionService=class extends i.Disposable{constructor(_,m,y,E,C,w,R,P,U){super(),this._element=_,this._screenElement=m,this._linkifier=y,this._bufferService=E,this._coreService=C,this._mouseService=w,this._optionsService=R,this._renderService=P,this._coreBrowserService=U,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 h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new d.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.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(){let _=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!_||!m||_[0]===m[0]&&_[1]===m[1])}get selectionText(){let _=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!_||!m)return"";let y=this._bufferService.buffer,E=[];if(this._activeSelectionMode===3){if(_[0]===m[0])return"";let C=_[0]<m[0]?_[0]:m[0],w=_[0]<m[0]?m[0]:_[0];for(let R=_[1];R<=m[1];R++){let P=y.translateBufferLineToString(R,!0,C,w);E.push(P)}}else{let C=_[1]===m[1]?m[0]:void 0;E.push(y.translateBufferLineToString(_[1],!0,_[0],C));for(let w=_[1]+1;w<=m[1]-1;w++){let R=y.lines.get(w),P=y.translateBufferLineToString(w,!0);R?.isWrapped?E[E.length-1]+=P:E.push(P)}if(_[1]!==m[1]){let w=y.lines.get(m[1]),R=y.translateBufferLineToString(m[1],!0,0,m[0]);w&&w.isWrapped?E[E.length-1]+=R:E.push(R)}}return E.map((C=>C.replace(v," "))).join(t.isWindows?`\r
|
|
6
|
+
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=d=c([f(0,n.IBufferService),f(1,n.IOptionsService),f(2,n.IOscLinkService)],d)},6193:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(a,c){this._renderCallback=a,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,c,f){this._rowCount=f,a=a!==void 0?a:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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();let a=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let c=a(3614),f=a(3656),o=a(3551),n=a(9042),d=a(3730),p=a(1680),l=a(3107),i=a(5744),t=a(2950),e=a(1296),r=a(428),h=a(4269),_=a(5114),v=a(8934),g=a(3230),u=a(9312),m=a(4725),y=a(6731),E=a(8055),C=a(8969),w=a(8460),R=a(844),z=a(6114),U=a(8437),q=a(2584),$=a(7399),S=a(5941),x=a(9074),k=a(2585),L=a(5435),H=a(4567),K=a(779);class X extends C.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(T={}){super(T),this.browser=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(x.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(d.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((b,P)=>this.refresh(b,P)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((b=>this._reportWindowsOptions(b)))),this.register(this._inputHandler.onColor((b=>this._handleColorEvent(b)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((b=>this._afterResize(b.cols,b.rows)))),this.register((0,R.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(T){if(this._themeService)for(let b of T){let P,N="";switch(b.index){case 256:P="foreground",N="10";break;case 257:P="background",N="11";break;case 258:P="cursor",N="12";break;default:P="ansi",N="4;"+b.index}switch(b.type){case 0:let V=E.color.toColorRGB(P==="ansi"?this._themeService.colors.ansi[b.index]:this._themeService.colors[P]);this.coreService.triggerDataEvent(`${q.C0.ESC}]${N};${(0,S.toRgbString)(V)}${q.C1_ESCAPED.ST}`);break;case 1:if(P==="ansi")this._themeService.modifyColors((j=>j.ansi[b.index]=E.channels.toColor(...b.color)));else{let j=P;this._themeService.modifyColors((te=>te[j]=E.channels.toColor(...b.color)))}break;case 2:this._themeService.restoreColor(b.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(T){T?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(T){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let T=this.buffer.ybase+this.buffer.y,b=this.buffer.lines.get(T);if(!b)return;let P=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,V=b.getWidth(P),j=this._renderService.dimensions.css.cell.width*V,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ne=P*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ne+"px",this.textarea.style.top=te+"px",this.textarea.style.width=j+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(b=>{this.hasSelection()&&(0,c.copyHandler)(b,this._selectionService)})));let T=b=>(0,c.handlePasteEvent)(b,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",T)),this.register((0,f.addDisposableDomListener)(this.element,"paste",T)),z.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(b=>{b.button===2&&(0,c.rightClickHandler)(b,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(b=>{(0,c.rightClickHandler)(b,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),z.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(b=>{b.button===1&&(0,c.moveTextAreaUnderMouseCursor)(b,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(T=>this._keyUp(T)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(T=>this._keyDown(T)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(T=>this._keyPress(T)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(T=>this._compositionHelper.compositionupdate(T)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(T=>this._inputEvent(T)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(T){if(!T)throw new Error("Terminal requires a parent element.");if(T.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=T.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"),T.appendChild(this.element);let b=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),b.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,f.addDisposableDomListener)(this.screenElement,"mousemove",(P=>this.updateCursorStyle(P)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),b.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",n.promptLabel),z.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(_.CoreBrowserService,this.textarea,T.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(P=>this._handleTextAreaFocus(P)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(r.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(h.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((P=>this._onRender.fire(P)))),this.onResize((P=>this._renderService.resize(P.cols,P.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(t.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(v.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(o.Linkifier,this.screenElement)),this.element.appendChild(b);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((P=>this.scrollLines(P.amount,P.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(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((P=>this.scrollLines(P.amount,P.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((P=>this._renderService.handleSelectionChanged(P.start,P.end,P.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((P=>{this.textarea.value=P,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((P=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(P=>this._selectionService.handleMouseDown(P)))),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",(P=>this._handleScreenReaderModeOptionChange(P)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(P=>{!this._overviewRulerRenderer&&P&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let T=this,b=this.element;function P(j){let te=T._mouseService.getMouseReportCoords(j,T.screenElement);if(!te)return!1;let ne,oe;switch(j.overrideType||j.type){case"mousemove":oe=32,j.buttons===void 0?(ne=3,j.button!==void 0&&(ne=j.button<3?j.button:3)):ne=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":oe=0,ne=j.button<3?j.button:3;break;case"mousedown":oe=1,ne=j.button<3?j.button:3;break;case"wheel":if(T._customWheelEventHandler&&T._customWheelEventHandler(j)===!1||T.viewport.getLinesScrolled(j)===0)return!1;oe=j.deltaY<0?0:1,ne=4;break;default:return!1}return!(oe===void 0||ne===void 0||ne>4)&&T.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:ne,action:oe,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:j=>(P(j),j.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(j)),wheel:j=>(P(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&P(j)},mousemove:j=>{j.buttons||P(j)}};this.register(this.coreMouseService.onProtocolChange((j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),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&j?N.mousemove||(b.addEventListener("mousemove",V.mousemove),N.mousemove=V.mousemove):(b.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&j?N.wheel||(b.addEventListener("wheel",V.wheel,{passive:!1}),N.wheel=V.wheel):(b.removeEventListener("wheel",N.wheel),N.wheel=null),2&j?N.mouseup||(N.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&j?N.mousedrag||(N.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(b,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return P(j),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(j)}))),this.register((0,f.addDisposableDomListener)(b,"wheel",(j=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let te=this.viewport.getLinesScrolled(j);if(te===0)return;let ne=q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),oe="";for(let fe=0;fe<Math.abs(te);fe++)oe+=ne;return this.coreService.triggerDataEvent(oe,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(b,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(b,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(T,b){this._renderService?.refreshRows(T,b)}updateCursorStyle(T){this._selectionService?.shouldColumnSelect(T)?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(T,b,P=0){P===1?(super.scrollLines(T,b,P),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(T)}paste(T){(0,c.paste)(T,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(T){this._customKeyEventHandler=T}attachCustomWheelEventHandler(T){this._customWheelEventHandler=T}registerLinkProvider(T){return this._linkProviderService.registerLinkProvider(T)}registerCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let b=this._characterJoinerService.register(T);return this.refresh(0,this.rows-1),b}deregisterCharacterJoiner(T){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(T)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(T){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+T)}registerDecoration(T){return this._decorationService.registerDecoration(T)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(T,b,P){this._selectionService.setSelection(T,b,P)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(T,b){this._selectionService?.selectLines(T,b)}_keyDown(T){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;let b=this.browser.isMac&&this.options.macOptionIsMeta&&T.altKey;if(!b&&!this._compositionHelper.keydown(T))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;b||T.key!=="Dead"&&T.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let P=(0,$.evaluateKeyboardEvent)(T,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),P.type===3||P.type===2){let N=this.rows-1;return this.scrollLines(P.type===2?-N:N),this.cancel(T,!0)}return P.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||(P.cancel&&this.cancel(T,!0),!P.key||!!(T.key&&!T.ctrlKey&&!T.altKey&&!T.metaKey&&T.key.length===1&&T.key.charCodeAt(0)>=65&&T.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(P.key!==q.C0.ETX&&P.key!==q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:P.key,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(P.key,!0),!this.optionsService.rawOptions.screenReaderMode||T.altKey||T.ctrlKey?this.cancel(T,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(T,b){let P=T.isMac&&!this.options.macOptionIsMeta&&b.altKey&&!b.ctrlKey&&!b.metaKey||T.isWindows&&b.altKey&&b.ctrlKey&&!b.metaKey||T.isWindows&&b.getModifierState("AltGraph");return b.type==="keypress"?P:P&&(!b.keyCode||b.keyCode>47)}_keyUp(T){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||((function(b){return b.keyCode===16||b.keyCode===17||b.keyCode===18})(T)||this.focus(),this.updateCursorStyle(T),this._keyPressHandled=!1)}_keyPress(T){let b;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)b=T.charCode;else if(T.which===null||T.which===void 0)b=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;b=T.which}return!(!b||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(b=String.fromCharCode(b),this._onKey.fire({key:b,domEvent:T}),this._showCursor(),this.coreService.triggerDataEvent(b,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(T){if(T.data&&T.inputType==="insertText"&&(!T.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let b=T.data;return this.coreService.triggerDataEvent(b,!0),this.cancel(T),!0}return!1}resize(T,b){T!==this.cols||b!==this.rows?super.resize(T,b):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(T,b){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){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 T=1;T<this.rows;T++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let T=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=T,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(q.C0.ESC+"[I"):this.coreService.triggerDataEvent(q.C0.ESC+"[O")}_reportWindowsOptions(T){if(this._renderService)switch(T){case L.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let b=this._renderService.dimensions.css.canvas.width.toFixed(0),P=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[4;${P};${b}t`);break;case L.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let N=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[6;${V};${N}t`)}}cancel(T,b){if(this.options.cancelEvents||b)return T.preventDefault(),T.stopPropagation(),!1}}s.Terminal=X},9924:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(a,c=1e3){this._renderCallback=a,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,c,f){this._rowCount=f,a=a!==void 0?a:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=o-this._lastRefreshMs,d=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let a=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c)}}},1680:function(D,s,a){var c=this&&this.__decorate||function(t,e,r,h){var _,v=arguments.length,g=v<3?e:h===null?h=Object.getOwnPropertyDescriptor(e,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,h);else for(var u=t.length-1;u>=0;u--)(_=t[u])&&(g=(v<3?_(g):v>3?_(e,r,g):_(e,r))||g);return v>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,h){e(r,h,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let o=a(3656),n=a(4725),d=a(8460),p=a(844),l=a(2585),i=s.Viewport=class extends p.Disposable{constructor(t,e,r,h,_,v,g,u){super(),this._viewportElement=t,this._scrollArea=e,this._bufferService=r,this._optionsService=h,this._charSizeService=_,this._renderService=v,this._coreBrowserService=g,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 d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(u.colors),this.register(u.onChangeColors((m=>this._handleThemeChange(m)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(t){this._viewportElement.style.backgroundColor=t.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(t){if(t)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;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null}syncScrollArea(t=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(t);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(t)}_handleScroll(t){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});let e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let t=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(t*(this._smoothScrollState.target-this._smoothScrollState.origin)),t<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(t,e){let r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&r<this._lastRecordedBufferHeight)||(t.cancelable&&t.preventDefault(),!1)}handleWheel(t){let e=this._getPixelsScrolled(t);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}scrollLines(t){if(t!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let e=t*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!1})}_getPixelsScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(t,e){let r,h="",_=[],v=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let u=t;u<v;u++){let m=g.get(u);if(!m)continue;let y=g.get(u+1)?.isWrapped;if(h+=m.translateToString(!y),!y||u===g.length-1){let E=document.createElement("div");E.textContent=h,_.push(E),h.length>0&&(r=E),h=""}}return{bufferElements:_,cursorElement:r}}getLinesScrolled(t){if(t.deltaY===0||t.shiftKey)return 0;let e=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(t,e){let r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&e.altKey||r==="ctrl"&&e.ctrlKey||r==="shift"&&e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(t){this._lastTouchY=t.touches[0].pageY}handleTouchMove(t){let e=this._lastTouchY-t.touches[0].pageY;return this._lastTouchY=t.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(t,e))}};s.Viewport=i=c([f(2,l.IBufferService),f(3,l.IOptionsService),f(4,n.ICharSizeService),f(5,n.IRenderService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],i)},3107:function(D,s,a){var c=this&&this.__decorate||function(l,i,t,e){var r,h=arguments.length,_=h<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,i,t,e);else for(var v=l.length-1;v>=0;v--)(r=l[v])&&(_=(h<3?r(_):h>3?r(i,t,_):r(i,t))||_);return h>3&&_&&Object.defineProperty(i,t,_),_},f=this&&this.__param||function(l,i){return function(t,e){i(t,e,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let o=a(4725),n=a(844),d=a(2585),p=s.BufferDecorationRenderer=class extends n.Disposable{constructor(l,i,t,e,r){super(),this._screenElement=l,this._bufferService=i,this._coreBrowserService=t,this._decorationService=e,this._renderService=r,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((h=>this._removeDecoration(h)))),this.register((0,n.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(let l of this._decorationService.decorations)this._renderDecoration(l);this._dimensionsChanged=!1}_renderDecoration(l){this._refreshStyle(l),this._dimensionsChanged&&this._refreshXPosition(l)}_createElement(l){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",l?.options?.layer==="top"),i.style.width=`${Math.round((l.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(l.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(l.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let t=l.options.x??0;return t&&t>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(l,i),i}_refreshStyle(l){let i=l.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)l.element&&(l.element.style.display="none",l.onRenderEmitter.fire(l.element));else{let t=this._decorationElements.get(l);t||(t=this._createElement(l),l.element=t,this._decorationElements.set(l,t),this._container.appendChild(t),l.onDispose((()=>{this._decorationElements.delete(l),t.remove()}))),t.style.top=i*this._renderService.dimensions.css.cell.height+"px",t.style.display=this._altBufferIsActive?"none":"block",l.onRenderEmitter.fire(t)}}_refreshXPosition(l,i=l.element){if(!i)return;let t=l.options.x??0;(l.options.anchor||"left")==="right"?i.style.right=t?t*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=t?t*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(l){this._decorationElements.get(l)?.remove(),this._decorationElements.delete(l),l.dispose()}};s.BufferDecorationRenderer=p=c([f(1,d.IBufferService),f(2,o.ICoreBrowserService),f(3,d.IDecorationService),f(4,o.IRenderService)],p)},5871:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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(a){if(a.options.overviewRulerOptions){for(let c of this._zones)if(c.color===a.options.overviewRulerOptions.color&&c.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,a.marker.line))return;if(this._lineAdjacentToZone(c,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(c,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,c){return c>=a.startBufferLine&&c<=a.endBufferLine}_lineAdjacentToZone(a,c,f){return c>=a.startBufferLine-this._linePadding[f||"full"]&&c<=a.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(a,c){a.startBufferLine=Math.min(a.startBufferLine,c),a.endBufferLine=Math.max(a.endBufferLine,c)}}},5744:function(D,s,a){var c=this&&this.__decorate||function(r,h,_,v){var g,u=arguments.length,m=u<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,h,_,v);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(h,_,m):g(h,_))||m);return u>3&&m&&Object.defineProperty(h,_,m),m},f=this&&this.__param||function(r,h){return function(_,v){h(_,v,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let o=a(5871),n=a(4725),d=a(844),p=a(2585),l={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},e=s.OverviewRulerRenderer=class extends d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,h,_,v,g,u,m){super(),this._viewportElement=r,this._screenElement=h,this._bufferService=_,this._decorationService=v,this._renderService=g,this._optionsService=u,this._coreBrowserService=m,this._colorZoneStore=new o.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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let y=this._canvas.getContext("2d");if(!y)throw new Error("Ctx cannot be null");this._ctx=y,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,d.toDisposable)((()=>{this._canvas?.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(){let r=Math.floor(this._canvas.width/3),h=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=r,i.center=h,i.right=r,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=i.left,t.right=i.left+i.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let r=this._canvas.height/this._bufferService.buffer.lines.length,h=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);l.left=h,l.center=h,l.right=h}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.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(let h of this._decorationService.decorations)this._colorZoneStore.addDecoration(h);this._ctx.lineWidth=1;let r=this._colorZoneStore.zones;for(let h of r)h.position!=="full"&&this._renderColorZone(h);for(let h of r)h.position==="full"&&this._renderColorZone(h);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(t[r.position||"full"],Math.round((this._canvas.height-1)*(r.startBufferLine/this._bufferService.buffers.active.lines.length)-l[r.position||"full"]/2),i[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[r.position||"full"]))}_queueRefresh(r,h){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=h||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=e=c([f(2,p.IBufferService),f(3,p.IDecorationService),f(4,n.IRenderService),f(5,p.IOptionsService),f(6,n.ICoreBrowserService)],e)},2950:function(D,s,a){var c=this&&this.__decorate||function(l,i,t,e){var r,h=arguments.length,_=h<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,i,t,e);else for(var v=l.length-1;v>=0;v--)(r=l[v])&&(_=(h<3?r(_):h>3?r(i,t,_):r(i,t))||_);return h>3&&_&&Object.defineProperty(i,t,_),_},f=this&&this.__param||function(l,i){return function(t,e){i(t,e,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let o=a(4725),n=a(2585),d=a(2584),p=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(l,i,t,e,r,h){this._textarea=l,this._compositionView=i,this._bufferService=t,this._optionsService=e,this._coreService=r,this._renderService=h,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(l){this._compositionView.textContent=l.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(l){if(this._isComposing||this._isSendingComposition){if(l.keyCode===229||l.keyCode===16||l.keyCode===17||l.keyCode===18)return!1;this._finalizeComposition(!1)}return l.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(l){if(this._compositionView.classList.remove("active"),this._isComposing=!1,l){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let l=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let i=this._textarea.value,t=i.replace(l,"");this._dataAlreadySent=t,i.length>l.length?this._coreService.triggerDataEvent(t,!0):i.length<l.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):i.length===l.length&&i!==l&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(l){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}l||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=p=c([f(2,n.IBufferService),f(3,n.IOptionsService),f(4,n.ICoreService),f(5,o.IRenderService)],p)},9806:(D,s)=>{function a(c,f,o){let n=o.getBoundingClientRect(),d=c.getComputedStyle(o),p=parseInt(d.getPropertyValue("padding-left")),l=parseInt(d.getPropertyValue("padding-top"));return[f.clientX-n.left-p,f.clientY-n.top-l]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=a,s.getCoords=function(c,f,o,n,d,p,l,i,t){if(!p)return;let e=a(c,f,o);return e?(e[0]=Math.ceil((e[0]+(t?l/2:0))/l),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),n+(t?1:0)),e[1]=Math.min(Math.max(e[1],1),d),e):void 0}},9504:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let c=a(2584);function f(i,t,e,r){let h=i-o(i,e),_=t-o(t,e),v=Math.abs(h-_)-(function(g,u,m){let y=0,E=g-o(g,m),C=u-o(u,m);for(let w=0;w<Math.abs(E-C);w++){let R=n(g,u)==="A"?-1:1;m.buffer.lines.get(E+R*w)?.isWrapped&&y++}return y})(i,t,e);return l(v,p(n(i,t),r))}function o(i,t){let e=0,r=t.buffer.lines.get(i),h=r?.isWrapped;for(;h&&i>=0&&i<t.rows;)e++,r=t.buffer.lines.get(--i),h=r?.isWrapped;return e}function n(i,t){return i>t?"A":"B"}function d(i,t,e,r,h,_){let v=i,g=t,u="";for(;v!==e||g!==r;)v+=h?1:-1,h&&v>_.cols-1?(u+=_.buffer.translateBufferLineToString(g,!1,i,v),v=0,i=0,g++):!h&&v<0&&(u+=_.buffer.translateBufferLineToString(g,!1,0,i+1),v=_.cols-1,i=v,g--);return u+_.buffer.translateBufferLineToString(g,!1,i,v)}function p(i,t){let e=t?"O":"[";return c.C0.ESC+e+i}function l(i,t){i=Math.floor(i);let e="";for(let r=0;r<i;r++)e+=t;return e}s.moveToCellSequence=function(i,t,e,r){let h=e.buffer.x,_=e.buffer.y;if(!e.buffer.hasScrollback)return(function(u,m,y,E,C,w){return f(m,E,C,w).length===0?"":l(d(u,m,u,m-o(m,C),!1,C).length,p("D",w))})(h,_,0,t,e,r)+f(_,t,e,r)+(function(u,m,y,E,C,w){let R;R=f(m,E,C,w).length>0?E-o(E,C):m;let z=E,U=(function(q,$,S,x,k,L){let H;return H=f(S,x,k,L).length>0?x-o(x,k):$,q<S&&H<=x||q>=S&&H<x?"C":"D"})(u,m,y,E,C,w);return l(d(u,R,y,z,U==="C",C).length,p(U,w))})(h,_,i,t,e,r);let v;if(_===t)return v=h>i?"D":"C",l(Math.abs(h-i),p(v,r));v=_>t?"D":"C";let g=Math.abs(_-t);return l((function(u,m){return m.cols-u})(_>t?i:h,e)+(g-1)*e.cols+1+((_>t?h:i)-1),p(v,r))}},1296:function(D,s,a){var c=this&&this.__decorate||function(w,R,z,U){var q,$=arguments.length,S=$<3?R:U===null?U=Object.getOwnPropertyDescriptor(R,z):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(w,R,z,U);else for(var x=w.length-1;x>=0;x--)(q=w[x])&&(S=($<3?q(S):$>3?q(R,z,S):q(R,z))||S);return $>3&&S&&Object.defineProperty(R,z,S),S},f=this&&this.__param||function(w,R){return function(z,U){R(z,U,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let o=a(3787),n=a(2550),d=a(2223),p=a(6171),l=a(6052),i=a(4725),t=a(8055),e=a(8460),r=a(844),h=a(2585),_="xterm-dom-renderer-owner-",v="xterm-rows",g="xterm-fg-",u="xterm-bg-",m="xterm-focus",y="xterm-selection",E=1,C=s.DomRenderer=class extends r.Disposable{constructor(w,R,z,U,q,$,S,x,k,L,H,K,X){super(),this._terminal=w,this._document=R,this._element=z,this._screenElement=U,this._viewportElement=q,this._helperContainer=$,this._linkifier2=S,this._charSizeService=k,this._optionsService=L,this._bufferService=H,this._coreBrowserService=K,this._themeService=X,this._terminalClass=E++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(v),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Z=>this._injectCss(Z)))),this._injectCss(this._themeService.colors),this._rowFactory=x.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Z=>this._handleLinkHover(Z)))),this.register(this._linkifier2.onHideLinkUnderline((Z=>this._handleLinkLeave(Z)))),this.register((0,r.toDisposable)((()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new n.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(){let w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),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/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),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(let z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let R=`${this._terminalSelector} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=R,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(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let R=`${this._terminalSelector} .${v} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;R+=`${this._terminalSelector} .${v} .xterm-dim { color: ${t.color.multiplyOpacity(w.foreground,.5).css};}`,R+=`${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;}`;let z=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,q=`blink_block_${this._terminalClass}`;R+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,R+=`@keyframes ${U} { 50% { box-shadow: none; }}`,R+=`@keyframes ${q} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,R+=`${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,R+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(let[$,S]of w.ansi.entries())R+=`${this._terminalSelector} .${g}${$} { color: ${S.css}; }${this._terminalSelector} .${g}${$}.xterm-dim { color: ${t.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${u}${$} { background-color: ${S.css}; }`;R+=`${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR} { color: ${t.color.opaque(w.background).css}; }${this._terminalSelector} .${g}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${t.color.multiplyOpacity(t.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${u}${d.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=R}_setDefaultSpacing(){let w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,R){for(let z=this._rowElements.length;z<=R;z++){let U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>R;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,R){this._refreshRowElements(w,R),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(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,R,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,R,z),this.renderRows(0,this._bufferService.rows-1),!w||!R)return;this._selectionRenderModel.update(this._terminal,w,R,z);let U=this._selectionRenderModel.viewportStartRow,q=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||S<0)return;let x=this._document.createDocumentFragment();if(z){let k=w[0]>R[0];x.appendChild(this._createSelectionElement($,k?R[0]:w[0],k?w[0]:R[0],S-$+1))}else{let k=U===$?w[0]:0,L=$===q?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement($,k,L));let H=S-$-1;if(x.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,H)),$!==S){let K=q===S?R[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(S,0,K))}}this._selectionContainer.appendChild(x)}_createSelectionElement(w,R,z,U=1){let q=this._document.createElement("div"),$=R*this.dimensions.css.cell.width,S=this.dimensions.css.cell.width*(z-R);return $+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-$),q.style.height=U*this.dimensions.css.cell.height+"px",q.style.top=w*this.dimensions.css.cell.height+"px",q.style.left=`${$}px`,q.style.width=`${S}px`,q}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(let w of this._rowElements)w.replaceChildren()}renderRows(w,R){let z=this._bufferService.buffer,U=z.ybase+z.y,q=Math.min(z.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=w;k<=R;k++){let L=k+z.ydisp,H=this._rowElements[k],K=z.lines.get(L);if(!H||!K)break;H.replaceChildren(...this._rowFactory.createRow(K,L,L===U,S,x,q,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,R,z,U,q,$){z<0&&(w=0),U<0&&(R=0);let S=this._bufferService.rows-1;z=Math.max(Math.min(z,S),0),U=Math.max(Math.min(U,S),0),q=Math.min(q,this._bufferService.cols);let x=this._bufferService.buffer,k=x.ybase+x.y,L=Math.min(x.x,q-1),H=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=z;Z<=U;++Z){let T=Z+x.ydisp,b=this._rowElements[Z],P=x.lines.get(T);if(!b||!P)break;b.replaceChildren(...this._rowFactory.createRow(P,T,T===k,K,X,L,H,this.dimensions.css.cell.width,this._widthCache,$?Z===z?w:0:-1,$?(Z===U?R:q)-1:-1))}}};s.DomRenderer=C=c([f(7,h.IInstantiationService),f(8,i.ICharSizeService),f(9,h.IOptionsService),f(10,h.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],C)},3787:function(D,s,a){var c=this&&this.__decorate||function(v,g,u,m){var y,E=arguments.length,C=E<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(v,g,u,m);else for(var w=v.length-1;w>=0;w--)(y=v[w])&&(C=(E<3?y(C):E>3?y(g,u,C):y(g,u))||C);return E>3&&C&&Object.defineProperty(g,u,C),C},f=this&&this.__param||function(v,g){return function(u,m){g(u,m,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let o=a(2223),n=a(643),d=a(511),p=a(2585),l=a(8055),i=a(4725),t=a(4269),e=a(6171),r=a(3734),h=s.DomRendererRowFactory=class{constructor(v,g,u,m,y,E,C){this._document=v,this._characterJoinerService=g,this._optionsService=u,this._coreBrowserService=m,this._coreService=y,this._decorationService=E,this._themeService=C,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(v,g,u){this._selectionStart=v,this._selectionEnd=g,this._columnSelectMode=u}createRow(v,g,u,m,y,E,C,w,R,z,U){let q=[],$=this._characterJoinerService.getJoinedCharacters(g),S=this._themeService.colors,x,k=v.getNoBgTrimmedLength();u&&k<E+1&&(k=E+1);let L=0,H="",K=0,X=0,Z=0,T=!1,b=0,P=!1,N=0,V=[],j=z!==-1&&U!==-1;for(let te=0;te<k;te++){v.loadCell(te,this._workCell);let ne=this._workCell.getWidth();if(ne===0)continue;let oe=!1,fe=te,J=this._workCell;if($.length>0&&te===$[0][0]){oe=!0;let Y=$.shift();J=new t.JoinedCellData(this._workCell,v.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),fe=Y[1]-1,ne=J.getWidth()}let be=this._isCellInSelection(te,g),We=u&&te===E,Be=j&&te>=z&&te<=U,Ue=!1;this._decorationService.forEachDecorationAtCell(te,g,void 0,(Y=>{Ue=!0}));let Ie=J.getChars()||n.WHITESPACE_CELL_CHAR;if(Ie===" "&&(J.isUnderline()||J.isOverline())&&(Ie="\xA0"),N=ne*w-R.get(Ie,J.isBold(),J.isItalic()),x){if(L&&(be&&P||!be&&!P&&J.bg===K)&&(be&&P&&S.selectionForeground||J.fg===X)&&J.extended.ext===Z&&Be===T&&N===b&&!We&&!oe&&!Ue){J.isInvisible()?H+=n.WHITESPACE_CELL_CHAR:H+=Ie,L++;continue}L&&(x.textContent=H),x=this._document.createElement("span"),L=0,H=""}else x=this._document.createElement("span");if(K=J.bg,X=J.fg,Z=J.extended.ext,T=Be,b=N,P=be,oe&&E>=te&&E<=fe&&(E=te),!this._coreService.isCursorHidden&&We&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)C&&V.push("xterm-cursor-blink"),V.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(J.isBold()&&V.push("xterm-bold"),J.isItalic()&&V.push("xterm-italic"),J.isDim()&&V.push("xterm-dim"),H=J.isInvisible()?n.WHITESPACE_CELL_CHAR:J.getChars()||n.WHITESPACE_CELL_CHAR,J.isUnderline()&&(V.push(`xterm-underline-${J.extended.underlineStyle}`),H===" "&&(H="\xA0"),!J.isUnderlineColorDefault()))if(J.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(J.getUnderlineColor()).join(",")})`;else{let Y=J.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&J.isBold()&&Y<8&&(Y+=8),x.style.textDecorationColor=S.ansi[Y].css}J.isOverline()&&(V.push("xterm-overline"),H===" "&&(H="\xA0")),J.isStrikethrough()&&V.push("xterm-strikethrough"),Be&&(x.style.textDecoration="underline");let ge=J.getFgColor(),ke=J.getFgColorMode(),Ce=J.getBgColor(),Te=J.getBgColorMode(),Ge=!!J.isInverse();if(Ge){let Y=ge;ge=Ce,Ce=Y;let xe=ke;ke=Te,Te=xe}let se,we,ae,Le=!1;switch(this._decorationService.forEachDecorationAtCell(te,g,void 0,(Y=>{Y.options.layer!=="top"&&Le||(Y.backgroundColorRGB&&(Te=50331648,Ce=Y.backgroundColorRGB.rgba>>8&16777215,se=Y.backgroundColorRGB),Y.foregroundColorRGB&&(ke=50331648,ge=Y.foregroundColorRGB.rgba>>8&16777215,we=Y.foregroundColorRGB),Le=Y.options.layer==="top")})),!Le&&be&&(se=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,Ce=se.rgba>>8&16777215,Te=50331648,Le=!0,S.selectionForeground&&(ke=50331648,ge=S.selectionForeground.rgba>>8&16777215,we=S.selectionForeground)),Le&&V.push("xterm-decoration-top"),Te){case 16777216:case 33554432:ae=S.ansi[Ce],V.push(`xterm-bg-${Ce}`);break;case 50331648:ae=l.channels.toColor(Ce>>16,Ce>>8&255,255&Ce),this._addStyle(x,`background-color:#${_((Ce>>>0).toString(16),"0",6)}`);break;default:Ge?(ae=S.foreground,V.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):ae=S.background}switch(se||J.isDim()&&(se=l.color.multiplyOpacity(ae,.5)),ke){case 16777216:case 33554432:J.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(x,ae,S.ansi[ge],J,se,void 0)||V.push(`xterm-fg-${ge}`);break;case 50331648:let Y=l.channels.toColor(ge>>16&255,ge>>8&255,255&ge);this._applyMinimumContrast(x,ae,Y,J,se,we)||this._addStyle(x,`color:#${_(ge.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,ae,S.foreground,J,se,we)||Ge&&V.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}V.length&&(x.className=V.join(" "),V.length=0),We||oe||Ue?x.textContent=H:L++,N!==this.defaultSpacing&&(x.style.letterSpacing=`${N}px`),q.push(x),te=fe}return x&&L&&(x.textContent=H),q}_applyMinimumContrast(v,g,u,m,y,E){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let C=this._getContrastCache(m),w;if(y||E||(w=C.getColor(g.rgba,u.rgba)),w===void 0){let R=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);w=l.color.ensureContrastRatio(y||g,E||u,R),C.setColor((y||g).rgba,(E||u).rgba,w??null)}return!!w&&(this._addStyle(v,`color:${w.css}`),!0)}_getContrastCache(v){return v.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(v,g){v.setAttribute("style",`${v.getAttribute("style")||""}${g};`)}_isCellInSelection(v,g){let u=this._selectionStart,m=this._selectionEnd;return!(!u||!m)&&(this._columnSelectMode?u[0]<=m[0]?v>=u[0]&&g>=u[1]&&v<m[0]&&g<=m[1]:v<u[0]&&g>=u[1]&&v>=m[0]&&g<=m[1]:g>u[1]&&g<m[1]||u[1]===m[1]&&g===u[1]&&v>=u[0]&&v<m[0]||u[1]<m[1]&&g===m[1]&&v<m[0]||u[1]<m[1]&&g===u[1]&&v>=u[0])}};function _(v,g,u){for(;v.length<u;)v=g+v;return v}s.DomRendererRowFactory=h=c([f(1,i.ICharacterJoinerService),f(2,p.IOptionsService),f(3,i.ICoreBrowserService),f(4,p.ICoreService),f(5,p.IDecorationService),f(6,i.IThemeService)],h)},2550:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(a,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.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";let f=a.createElement("span");f.classList.add("xterm-char-measure-element");let o=a.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold";let n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let d=a.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[f,o,n,d],this._container.appendChild(f),this._container.appendChild(o),this._container.appendChild(n),this._container.appendChild(d),c.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(a,c,f,o){a===this._font&&c===this._fontSize&&f===this._weight&&o===this._weightBold||(this._font=a,this._fontSize=c,this._weight=f,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(a,c,f){let o=0;if(!c&&!f&&a.length===1&&(o=a.charCodeAt(0))<256){if(this._flat[o]!==-9999)return this._flat[o];let p=this._measure(a,0);return p>0&&(this._flat[o]=p),p}let n=a;c&&(n+="B"),f&&(n+="I");let d=this._holey.get(n);if(d===void 0){let p=0;c&&(p|=1),f&&(p|=2),d=this._measure(a,p),d>0&&this._holey.set(n,d)}return d}_measure(a,c){let f=this._measureElements[c];return f.textContent=a.repeat(32),f.offsetWidth/32}}},2223:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let c=a(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(D,s)=>{function a(f){return 57508<=f&&f<=57558}function c(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},s.isPowerlineGlyph=a,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=c,s.allowRescaling=function(f,o,n,d){return o===1&&n>Math.ceil(1.5*d)&&f!==void 0&&f>255&&!c(f)&&!a(f)&&!(function(p){return 57344<=p&&p<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return a(f)||(function(o){return 9472<=o&&o<=9631})(f)},s.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}}}},s.computeNextVariantOffset=function(f,o,n=0){return(f-(2*Math.round(o)-n))%(2*Math.round(o))}},6052:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class a{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(f,o,n,d=!1){if(this.selectionStart=o,this.selectionEnd=n,!o||!n||o[0]===n[0]&&o[1]===n[1])return void this.clear();let p=f.buffers.active.ydisp,l=o[1]-p,i=n[1]-p,t=Math.max(l,0),e=Math.min(i,f.rows-1);t>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=l,this.viewportEndRow=i,this.viewportCappedStartRow=t,this.viewportCappedEndRow=e,this.startCol=o[0],this.endCol=n[0])}isCellSelected(f,o,n){return!!this.hasSelection&&(n-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?o>=this.startCol&&n>=this.viewportCappedStartRow&&o<this.endCol&&n<=this.viewportCappedEndRow:o<this.startCol&&n>=this.viewportCappedStartRow&&o>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&o>=this.startCol&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&o<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&o>=this.startCol)}}s.createSelectionRenderModel=function(){return new a}},456:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(a){this._bufferService=a,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()){let a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let a=this.selectionStart,c=this.selectionEnd;return!(!a||!c)&&(a[1]>c[1]||a[1]===c[1]&&a[0]>c[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,s,a){var c=this&&this.__decorate||function(e,r,h,_){var v,g=arguments.length,u=g<3?r:_===null?_=Object.getOwnPropertyDescriptor(r,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,h,_);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,h,u):v(r,h))||u);return g>3&&u&&Object.defineProperty(r,h,u),u},f=this&&this.__param||function(e,r){return function(h,_){r(h,_,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let o=a(2585),n=a(8460),d=a(844),p=s.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,r,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new n.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new t(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};s.CharSizeService=p=c([f(2,o.IOptionsService)],p);class l extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,h){r!==void 0&&r>0&&h!==void 0&&h>0&&(this._result.width=r,this._result.height=h)}}class i extends l{constructor(r,h,_){super(),this._document=r,this._parentElement=h,this._optionsService=_,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 t extends l{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let h=this._ctx.measureText("W");if(!("width"in h&&"fontBoundingBoxAscent"in h&&"fontBoundingBoxDescent"in h))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(D,s,a){var c=this&&this.__decorate||function(t,e,r,h){var _,v=arguments.length,g=v<3?e:h===null?h=Object.getOwnPropertyDescriptor(e,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,h);else for(var u=t.length-1;u>=0;u--)(_=t[u])&&(g=(v<3?_(g):v>3?_(e,r,g):_(e,r))||g);return v>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,h){e(r,h,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let o=a(3734),n=a(643),d=a(511),p=a(2585);class l extends o.AttributeData{constructor(e,r,h){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=r,this._width=h}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=l;let i=s.CharacterJoinerService=class Rt{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(e){let r={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(r),r.id}deregister(e){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===e)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let r=this._bufferService.buffer.lines.get(e);if(!r||r.length===0)return[];let h=[],_=r.translateToString(!0),v=0,g=0,u=0,m=r.getFg(0),y=r.getBg(0);for(let E=0;E<r.getTrimmedLength();E++)if(r.loadCell(E,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==y){if(E-v>1){let C=this._getJoinedRanges(_,u,g,r,v);for(let w=0;w<C.length;w++)h.push(C[w])}v=E,u=g,m=this._workCell.fg,y=this._workCell.bg}g+=this._workCell.getChars().length||n.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-v>1){let E=this._getJoinedRanges(_,u,g,r,v);for(let C=0;C<E.length;C++)h.push(E[C])}return h}_getJoinedRanges(e,r,h,_,v){let g=e.substring(r,h),u=[];try{u=this._characterJoiners[0].handler(g)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let y=this._characterJoiners[m].handler(g);for(let E=0;E<y.length;E++)Rt._mergeRanges(u,y[E])}catch(y){console.error(y)}return this._stringRangesToCellRanges(u,_,v),u}_stringRangesToCellRanges(e,r,h){let _=0,v=!1,g=0,u=e[_];if(u){for(let m=h;m<this._bufferService.cols;m++){let y=r.getWidth(m),E=r.getString(m).length||n.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!v&&u[0]<=g&&(u[0]=m,v=!0),u[1]<=g){if(u[1]=m,u=e[++_],!u)break;u[0]<=g?(u[0]=m,v=!0):v=!1}g+=E}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,r){let h=!1;for(let _=0;_<e.length;_++){let v=e[_];if(h){if(r[1]<=v[0])return e[_-1][1]=r[1],e;if(r[1]<=v[1])return e[_-1][1]=Math.max(r[1],v[1]),e.splice(_,1),e;e.splice(_,1),_--}else{if(r[1]<=v[0])return e.splice(_,0,r),e;if(r[1]<=v[1])return v[0]=Math.min(r[0],v[0]),e;r[0]<v[1]&&(v[0]=Math.min(r[0],v[0]),h=!0)}}return h?e[e.length-1][1]=r[1]:e.push(r),e}};s.CharacterJoinerService=i=c([f(0,p.IBufferService)],i)},5114:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let c=a(844),f=a(8460),o=a(3656);class n extends c.Disposable{constructor(l,i,t){super(),this._textarea=l,this._window=i,this.mainDocument=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new d(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,f.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(l){this._window!==l&&(this._window=l,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}}s.CoreBrowserService=n;class d extends c.Disposable{constructor(l){super(),this._parentWindow=l,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)((()=>this.clearListener())))}setWindow(l){this._parentWindow=l,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,o.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let c=a(844);class f extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(n){return this.linkProviders.push(n),{dispose:()=>{let d=this.linkProviders.indexOf(n);d!==-1&&this.linkProviders.splice(d,1)}}}}s.LinkProviderService=f},8934:function(D,s,a){var c=this&&this.__decorate||function(p,l,i,t){var e,r=arguments.length,h=r<3?l:t===null?t=Object.getOwnPropertyDescriptor(l,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(p,l,i,t);else for(var _=p.length-1;_>=0;_--)(e=p[_])&&(h=(r<3?e(h):r>3?e(l,i,h):e(l,i))||h);return r>3&&h&&Object.defineProperty(l,i,h),h},f=this&&this.__param||function(p,l){return function(i,t){l(i,t,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let o=a(4725),n=a(9806),d=s.MouseService=class{constructor(p,l){this._renderService=p,this._charSizeService=l}getCoords(p,l,i,t,e){return(0,n.getCoords)(window,p,l,i,t,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(p,l){let i=(0,n.getCoordsRelativeToElement)(window,p,l);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};s.MouseService=d=c([f(0,o.IRenderService),f(1,o.ICharSizeService)],d)},3230:function(D,s,a){var c=this&&this.__decorate||function(e,r,h,_){var v,g=arguments.length,u=g<3?r:_===null?_=Object.getOwnPropertyDescriptor(r,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,h,_);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,h,u):v(r,h))||u);return g>3&&u&&Object.defineProperty(r,h,u),u},f=this&&this.__param||function(e,r){return function(h,_){r(h,_,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let o=a(6193),n=a(4725),d=a(8460),p=a(844),l=a(7226),i=a(2585),t=s.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,r,h,_,v,g,u,m){super(),this._rowCount=e,this._charSizeService=_,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new p.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 d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(((y,E)=>this._renderRows(y,E)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(g.onResize((()=>this._fullRefresh()))),this.register(g.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(h.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(v.onDecorationRegistered((()=>this._fullRefresh()))),this.register(v.onDecorationRemoved((()=>this._fullRefresh()))),this.register(h.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(h.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(g.buffer.y,g.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,r),this.register(u.onWindowChange((y=>this._registerIntersectionObserver(y,r))))}_registerIntersectionObserver(e,r){if("IntersectionObserver"in e){let h=new e.IntersectionObserver((_=>this._handleIntersectionChange(_[_.length-1])),{threshold:0});h.observe(r),this._observerDisposable.value=(0,p.toDisposable)((()=>h.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,r,h=!1){this._isPaused?this._needsFullRefresh=!0:(h||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,r,this._rowCount))}_renderRows(e,r){this._renderer.value&&(e=Math.min(e,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(e,r),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:r}),this._onRender.fire({start:e,end:r}),this._isNextRenderRedrawOnly=!0)}resize(e,r){this._rowCount=r,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((r=>this.refreshRows(r.start,r.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,r))):this._renderer.value.handleResize(e,r),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,r,h){this._selectionState.start=e,this._selectionState.end=r,this._selectionState.columnSelectMode=h,this._renderer.value?.handleSelectionChanged(e,r,h)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=t=c([f(2,i.IOptionsService),f(3,n.ICharSizeService),f(4,i.IDecorationService),f(5,i.IBufferService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],t)},9312:function(D,s,a){var c=this&&this.__decorate||function(u,m,y,E){var C,w=arguments.length,R=w<3?m:E===null?E=Object.getOwnPropertyDescriptor(m,y):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(u,m,y,E);else for(var z=u.length-1;z>=0;z--)(C=u[z])&&(R=(w<3?C(R):w>3?C(m,y,R):C(m,y))||R);return w>3&&R&&Object.defineProperty(m,y,R),R},f=this&&this.__param||function(u,m){return function(y,E){m(y,E,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let o=a(9806),n=a(9504),d=a(456),p=a(4725),l=a(8460),i=a(844),t=a(6114),e=a(4841),r=a(511),h=a(2585),_="\xA0",v=new RegExp(_,"g"),g=s.SelectionService=class extends i.Disposable{constructor(u,m,y,E,C,w,R,z,U){super(),this._element=u,this._screenElement=m,this._linkifier=y,this._bufferService=E,this._coreService=C,this._mouseService=w,this._optionsService=R,this._renderService=z,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new r.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=q=>this._handleMouseMove(q),this._mouseUpListener=q=>this._handleMouseUp(q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((q=>this._handleTrim(q))),this.register(this._bufferService.buffers.onBufferActivate((q=>this._handleBufferActivate(q)))),this.enable(),this._model=new d.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.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(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!u||!m||u[0]===m[0]&&u[1]===m[1])}get selectionText(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!u||!m)return"";let y=this._bufferService.buffer,E=[];if(this._activeSelectionMode===3){if(u[0]===m[0])return"";let C=u[0]<m[0]?u[0]:m[0],w=u[0]<m[0]?m[0]:u[0];for(let R=u[1];R<=m[1];R++){let z=y.translateBufferLineToString(R,!0,C,w);E.push(z)}}else{let C=u[1]===m[1]?m[0]:void 0;E.push(y.translateBufferLineToString(u[1],!0,u[0],C));for(let w=u[1]+1;w<=m[1]-1;w++){let R=y.lines.get(w),z=y.translateBufferLineToString(w,!0);R?.isWrapped?E[E.length-1]+=z:E.push(z)}if(u[1]!==m[1]){let w=y.lines.get(m[1]),R=y.translateBufferLineToString(m[1],!0,0,m[0]);w&&w.isWrapped?E[E.length-1]+=R:E.push(R)}}return E.map((C=>C.replace(v," "))).join(t.isWindows?`\r
|
|
7
7
|
`:`
|
|
8
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(_){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),t.isLinux&&_&&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(_){let m=this._getMouseBufferCoords(_),y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!!(y&&E&&m)&&this._areCoordsInSelection(m,y,E)}isCellInSelection(_,m){let y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!y||!E)&&this._areCoordsInSelection([_,m],y,E)}_areCoordsInSelection(_,m,y){return _[1]>m[1]&&_[1]<y[1]||m[1]===y[1]&&_[1]===m[1]&&_[0]>=m[0]&&_[0]<y[0]||m[1]<y[1]&&_[1]===y[1]&&_[0]<y[0]||m[1]<y[1]&&_[1]===m[1]&&_[0]>=m[0]}_selectWordAtCursor(_,m){let y=this._linkifier.currentLink?.link?.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let E=this._getMouseBufferCoords(_);return!!E&&(this._selectWordAt(E,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(_,m){this._model.clearSelection(),_=Math.max(_,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,_],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(_){this._model.handleTrim(_)&&this.refresh()}_getMouseBufferCoords(_){let m=this._mouseService.getCoords(_,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(_){let m=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,_,this._screenElement)[1],y=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=y?0:(m>y&&(m-=y),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(_){return t.isMac?_.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:_.shiftKey}handleMouseDown(_){if(this._mouseDownTimeStamp=_.timeStamp,(_.button!==2||!this.hasSelection)&&_.button===0){if(!this._enabled){if(!this.shouldForceSelection(_))return;_.stopPropagation()}_.preventDefault(),this._dragScrollAmount=0,this._enabled&&_.shiftKey?this._handleIncrementalClick(_):_.detail===1?this._handleSingleClick(_):_.detail===2?this._handleDoubleClick(_):_.detail===3&&this._handleTripleClick(_),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(_){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(_))}_handleSingleClick(_){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(_)?3:0,this._model.selectionStart=this._getMouseBufferCoords(_),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(_){this._selectWordAtCursor(_,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(_){let m=this._getMouseBufferCoords(_);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(_){return _.altKey&&!(t.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(_){if(_.stopImmediatePropagation(),!this._model.selectionStart)return;let m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(_),!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(_),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let y=this._bufferService.buffer;if(this._model.selectionEnd[1]<y.lines.length){let E=y.lines.get(this._model.selectionEnd[1]);E&&E.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[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});let _=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(_.ydisp+this._bufferService.rows,_.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=_.ydisp),this.refresh()}}_handleMouseUp(_){let m=_.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&_.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let y=this._mouseService.getCoords(_,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){let E=(0,l.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(E,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let _=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,y=!(!_||!m||_[0]===m[0]&&_[1]===m[1]);y?_&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&_[0]===this._oldSelectionStart[0]&&_[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(_,m,y)):this._oldHasSelection&&this._fireOnSelectionChange(_,m,y)}_fireOnSelectionChange(_,m,y){this._oldSelectionStart=_,this._oldSelectionEnd=m,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(_){this.clearSelection(),this._trimListener.dispose(),this._trimListener=_.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(_,m){let y=m;for(let E=0;m>=E;E++){let C=_.loadCell(E,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:C>1&&m!==E&&(y+=C-1)}return y}setSelection(_,m,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[_,m],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(_){this._isClickInSelection(_)||(this._selectWordAtCursor(_,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(_,m,y=!0,E=!0){if(_[0]>=this._bufferService.cols)return;let C=this._bufferService.buffer,w=C.lines.get(_[1]);if(!w)return;let R=C.translateBufferLineToString(_[1],!1),P=this._convertViewportColToCharacterIndex(w,_[0]),U=P,K=_[0]-P,$=0,S=0,x=0,k=0;if(R.charAt(P)===" "){for(;P>0&&R.charAt(P-1)===" ";)P--;for(;U<R.length&&R.charAt(U+1)===" ";)U++}else{let q=_[0],X=_[0];w.getWidth(q)===0&&($++,q--),w.getWidth(X)===2&&(S++,X++);let Z=w.getString(X).length;for(Z>1&&(k+=Z-1,U+=Z-1);q>0&&P>0&&!this._isCharWordSeparator(w.loadCell(q-1,this._workCell));){w.loadCell(q-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,q--):T>1&&(x+=T-1,P-=T-1),P--,q--}for(;X<w.length&&U+1<R.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,X++):T>1&&(k+=T-1,U+=T-1),U++,X++}}U++;let L=P+K-$+x,H=Math.min(this._bufferService.cols,U-P+$+S-x-k);if(m||R.slice(P,U).trim()!==""){if(y&&L===0&&w.getCodePoint(0)!==32){let q=C.lines.get(_[1]-1);if(q&&w.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){let X=this._getWordAt([this._bufferService.cols-1,_[1]-1],!1,!0,!1);if(X){let Z=this._bufferService.cols-X.start;L-=Z,H+=Z}}}if(E&&L+H===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){let q=C.lines.get(_[1]+1);if(q?.isWrapped&&q.getCodePoint(0)!==32){let X=this._getWordAt([0,_[1]+1],!1,!1,!0);X&&(H+=X.length)}}return{start:L,length:H}}}_selectWordAt(_,m){let y=this._getWordAt(_,m);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,_[1]--;this._model.selectionStart=[y.start,_[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(_){let m=this._getWordAt(_,!0);if(m){let y=_[1];for(;m.start<0;)m.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,y]}}_isCharWordSeparator(_){return _.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(_.getChars())>=0}_selectLineAt(_){let m=this._bufferService.buffer.getWrappedRangeForLine(_),y={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols)}};r.SelectionService=g=c([u(3,a.IBufferService),u(4,a.ICoreService),u(5,p.IMouseService),u(6,a.IOptionsService),u(7,p.IRenderService),u(8,p.ICoreBrowserService)],g)},4725:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;let c=n(8343);r.ICharSizeService=(0,c.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),r.IMouseService=(0,c.createDecorator)("MouseService"),r.IRenderService=(0,c.createDecorator)("RenderService"),r.ISelectionService=(0,c.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,c.createDecorator)("ThemeService"),r.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(D,r,n){var c=this&&this.__decorate||function(g,_,m,y){var E,C=arguments.length,w=C<3?_:y===null?y=Object.getOwnPropertyDescriptor(_,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(g,_,m,y);else for(var R=g.length-1;R>=0;R--)(E=g[R])&&(w=(C<3?E(w):C>3?E(_,m,w):E(_,m))||w);return C>3&&w&&Object.defineProperty(_,m,w),w},u=this&&this.__param||function(g,_){return function(m,y){_(m,y,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let o=n(7239),l=n(8055),d=n(8460),p=n(844),h=n(2585),i=l.css.toColor("#ffffff"),t=l.css.toColor("#000000"),e=l.css.toColor("#ffffff"),s=l.css.toColor("#000000"),a={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let g=[l.css.toColor("#2e3436"),l.css.toColor("#cc0000"),l.css.toColor("#4e9a06"),l.css.toColor("#c4a000"),l.css.toColor("#3465a4"),l.css.toColor("#75507b"),l.css.toColor("#06989a"),l.css.toColor("#d3d7cf"),l.css.toColor("#555753"),l.css.toColor("#ef2929"),l.css.toColor("#8ae234"),l.css.toColor("#fce94f"),l.css.toColor("#729fcf"),l.css.toColor("#ad7fa8"),l.css.toColor("#34e2e2"),l.css.toColor("#eeeeec")],_=[0,95,135,175,215,255];for(let m=0;m<216;m++){let y=_[m/36%6|0],E=_[m/6%6|0],C=_[m%6];g.push({css:l.channels.toCss(y,E,C),rgba:l.channels.toRgba(y,E,C)})}for(let m=0;m<24;m++){let y=8+10*m;g.push({css:l.channels.toCss(y,y,y),rgba:l.channels.toRgba(y,y,y)})}return g})());let f=r.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:t,cursor:e,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:a,selectionBackgroundOpaque:l.color.blend(t,a),selectionInactiveBackgroundTransparent:a,selectionInactiveBackgroundOpaque:l.color.blend(t,a),ansi:r.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(g={}){let _=this._colors;if(_.foreground=v(g.foreground,i),_.background=v(g.background,t),_.cursor=v(g.cursor,e),_.cursorAccent=v(g.cursorAccent,s),_.selectionBackgroundTransparent=v(g.selectionBackground,a),_.selectionBackgroundOpaque=l.color.blend(_.background,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundTransparent=v(g.selectionInactiveBackground,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundOpaque=l.color.blend(_.background,_.selectionInactiveBackgroundTransparent),_.selectionForeground=g.selectionForeground?v(g.selectionForeground,l.NULL_COLOR):void 0,_.selectionForeground===l.NULL_COLOR&&(_.selectionForeground=void 0),l.color.isOpaque(_.selectionBackgroundTransparent)&&(_.selectionBackgroundTransparent=l.color.opacity(_.selectionBackgroundTransparent,.3)),l.color.isOpaque(_.selectionInactiveBackgroundTransparent)&&(_.selectionInactiveBackgroundTransparent=l.color.opacity(_.selectionInactiveBackgroundTransparent,.3)),_.ansi=r.DEFAULT_ANSI_COLORS.slice(),_.ansi[0]=v(g.black,r.DEFAULT_ANSI_COLORS[0]),_.ansi[1]=v(g.red,r.DEFAULT_ANSI_COLORS[1]),_.ansi[2]=v(g.green,r.DEFAULT_ANSI_COLORS[2]),_.ansi[3]=v(g.yellow,r.DEFAULT_ANSI_COLORS[3]),_.ansi[4]=v(g.blue,r.DEFAULT_ANSI_COLORS[4]),_.ansi[5]=v(g.magenta,r.DEFAULT_ANSI_COLORS[5]),_.ansi[6]=v(g.cyan,r.DEFAULT_ANSI_COLORS[6]),_.ansi[7]=v(g.white,r.DEFAULT_ANSI_COLORS[7]),_.ansi[8]=v(g.brightBlack,r.DEFAULT_ANSI_COLORS[8]),_.ansi[9]=v(g.brightRed,r.DEFAULT_ANSI_COLORS[9]),_.ansi[10]=v(g.brightGreen,r.DEFAULT_ANSI_COLORS[10]),_.ansi[11]=v(g.brightYellow,r.DEFAULT_ANSI_COLORS[11]),_.ansi[12]=v(g.brightBlue,r.DEFAULT_ANSI_COLORS[12]),_.ansi[13]=v(g.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),_.ansi[14]=v(g.brightCyan,r.DEFAULT_ANSI_COLORS[14]),_.ansi[15]=v(g.brightWhite,r.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){let m=Math.min(_.ansi.length-16,g.extendedAnsi.length);for(let y=0;y<m;y++)_.ansi[y+16]=v(g.extendedAnsi[y],r.DEFAULT_ANSI_COLORS[y+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){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[g]=this._restoreColors.ansi[g]}else for(let _=0;_<this._restoreColors.ansi.length;++_)this._colors.ansi[_]=this._restoreColors.ansi[_]}modifyColors(g){g(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 v(g,_){if(g!==void 0)try{return l.css.toColor(g)}catch{}return _}r.ThemeService=f=c([u(0,h.IOptionsService)],f)},6349:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let c=n(8460),u=n(844);class o extends u.Disposable{constructor(d){super(),this._maxLength=d,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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(d){if(this._maxLength===d)return;let p=new Array(d);for(let h=0;h<Math.min(d,this.length);h++)p[h]=this._array[this._getCyclicIndex(h)];this._array=p,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let p=this._length;p<d;p++)this._array[p]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,p){this._array[this._getCyclicIndex(d)]=p}push(d){this._array[this._getCyclicIndex(this._length)]=d,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(d,p,...h){if(p){for(let i=d;i<this._length-p;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+p)];this._length-=p,this.onDeleteEmitter.fire({index:d,amount:p})}for(let i=this._length-1;i>=d;i--)this._array[this._getCyclicIndex(i+h.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<h.length;i++)this._array[this._getCyclicIndex(d+i)]=h[i];if(h.length&&this.onInsertEmitter.fire({index:d,amount:h.length}),this._length+h.length>this._maxLength){let i=this._length+h.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=h.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,p,h){if(!(p<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+h<0)throw new Error("Cannot shift elements in list beyond index 0");if(h>0){for(let t=p-1;t>=0;t--)this.set(d+t+h,this.get(d+t));let i=d+p+h-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<p;i++)this.set(d+i+h,this.get(d+i))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}r.CircularList=o},1439:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(c,u=5){if(typeof c!="object")return c;let o=Array.isArray(c)?[]:{};for(let l in c)o[l]=u<=1?c[l]:c[l]&&n(c[l],u-1);return o}},8055:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let n=0,c=0,u=0,o=0;var l,d,p,h,i;function t(s){let a=s.toString(16);return a.length<2?"0"+a:a}function e(s,a){return s<a?(a+.05)/(s+.05):(s+.05)/(a+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(s){s.toCss=function(a,f,v,g){return g!==void 0?`#${t(a)}${t(f)}${t(v)}${t(g)}`:`#${t(a)}${t(f)}${t(v)}`},s.toRgba=function(a,f,v,g=255){return(a<<24|f<<16|v<<8|g)>>>0},s.toColor=function(a,f,v,g){return{css:s.toCss(a,f,v,g),rgba:s.toRgba(a,f,v,g)}}})(l||(r.channels=l={})),(function(s){function a(f,v){return o=Math.round(255*v),[n,c,u]=i.toChannels(f.rgba),{css:l.toCss(n,c,u,o),rgba:l.toRgba(n,c,u,o)}}s.blend=function(f,v){if(o=(255&v.rgba)/255,o===1)return{css:v.css,rgba:v.rgba};let g=v.rgba>>24&255,_=v.rgba>>16&255,m=v.rgba>>8&255,y=f.rgba>>24&255,E=f.rgba>>16&255,C=f.rgba>>8&255;return n=y+Math.round((g-y)*o),c=E+Math.round((_-E)*o),u=C+Math.round((m-C)*o),{css:l.toCss(n,c,u),rgba:l.toRgba(n,c,u)}},s.isOpaque=function(f){return(255&f.rgba)==255},s.ensureContrastRatio=function(f,v,g){let _=i.ensureContrastRatio(f.rgba,v.rgba,g);if(_)return l.toColor(_>>24&255,_>>16&255,_>>8&255)},s.opaque=function(f){let v=(255|f.rgba)>>>0;return[n,c,u]=i.toChannels(v),{css:l.toCss(n,c,u),rgba:v}},s.opacity=a,s.multiplyOpacity=function(f,v){return o=255&f.rgba,a(f,o*v/255)},s.toColorRGB=function(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}})(d||(r.color=d={})),(function(s){let a,f;try{let v=document.createElement("canvas");v.width=1,v.height=1;let g=v.getContext("2d",{willReadFrequently:!0});g&&(a=g,a.globalCompositeOperation="copy",f=a.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(v){if(v.match(/#[\da-f]{3,8}/i))switch(v.length){case 4:return n=parseInt(v.slice(1,2).repeat(2),16),c=parseInt(v.slice(2,3).repeat(2),16),u=parseInt(v.slice(3,4).repeat(2),16),l.toColor(n,c,u);case 5:return n=parseInt(v.slice(1,2).repeat(2),16),c=parseInt(v.slice(2,3).repeat(2),16),u=parseInt(v.slice(3,4).repeat(2),16),o=parseInt(v.slice(4,5).repeat(2),16),l.toColor(n,c,u,o);case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}let g=v.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return n=parseInt(g[1]),c=parseInt(g[2]),u=parseInt(g[3]),o=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),l.toColor(n,c,u,o);if(!a||!f)throw new Error("css.toColor: Unsupported css format");if(a.fillStyle=f,a.fillStyle=v,typeof a.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(a.fillRect(0,0,1,1),[n,c,u,o]=a.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:l.toRgba(n,c,u,o),css:v}}})(p||(r.css=p={})),(function(s){function a(f,v,g){let _=f/255,m=v/255,y=g/255;return .2126*(_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}s.relativeLuminance=function(f){return a(f>>16&255,f>>8&255,255&f)},s.relativeLuminance2=a})(h||(r.rgb=h={})),(function(s){function a(v,g,_){let m=v>>24&255,y=v>>16&255,E=v>>8&255,C=g>>24&255,w=g>>16&255,R=g>>8&255,P=e(h.relativeLuminance2(C,w,R),h.relativeLuminance2(m,y,E));for(;P<_&&(C>0||w>0||R>0);)C-=Math.max(0,Math.ceil(.1*C)),w-=Math.max(0,Math.ceil(.1*w)),R-=Math.max(0,Math.ceil(.1*R)),P=e(h.relativeLuminance2(C,w,R),h.relativeLuminance2(m,y,E));return(C<<24|w<<16|R<<8|255)>>>0}function f(v,g,_){let m=v>>24&255,y=v>>16&255,E=v>>8&255,C=g>>24&255,w=g>>16&255,R=g>>8&255,P=e(h.relativeLuminance2(C,w,R),h.relativeLuminance2(m,y,E));for(;P<_&&(C<255||w<255||R<255);)C=Math.min(255,C+Math.ceil(.1*(255-C))),w=Math.min(255,w+Math.ceil(.1*(255-w))),R=Math.min(255,R+Math.ceil(.1*(255-R))),P=e(h.relativeLuminance2(C,w,R),h.relativeLuminance2(m,y,E));return(C<<24|w<<16|R<<8|255)>>>0}s.blend=function(v,g){if(o=(255&g)/255,o===1)return g;let _=g>>24&255,m=g>>16&255,y=g>>8&255,E=v>>24&255,C=v>>16&255,w=v>>8&255;return n=E+Math.round((_-E)*o),c=C+Math.round((m-C)*o),u=w+Math.round((y-w)*o),l.toRgba(n,c,u)},s.ensureContrastRatio=function(v,g,_){let m=h.relativeLuminance(v>>8),y=h.relativeLuminance(g>>8);if(e(m,y)<_){if(y<m){let w=a(v,g,_),R=e(m,h.relativeLuminance(w>>8));if(R<_){let P=f(v,g,_);return R>e(m,h.relativeLuminance(P>>8))?w:P}return w}let E=f(v,g,_),C=e(m,h.relativeLuminance(E>>8));if(C<_){let w=a(v,g,_);return C>e(m,h.relativeLuminance(w>>8))?E:w}return E}},s.reduceLuminance=a,s.increaseLuminance=f,s.toChannels=function(v){return[v>>24&255,v>>16&255,v>>8&255,255&v]}})(i||(r.rgba=i={})),r.toPaddedHex=t,r.contrastRatio=e},8969:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let c=n(844),u=n(2585),o=n(4348),l=n(7866),d=n(744),p=n(7302),h=n(6975),i=n(8460),t=n(1753),e=n(1480),s=n(7994),a=n(9282),f=n(5435),v=n(5981),g=n(2660),_=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((E=>{this._onScrollApi?.fire(E.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(E){for(let C in E)this.optionsService.options[C]=E[C]}constructor(E){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new p.OptionsService(E)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(l.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(h.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new f.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((C=>{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((C=>{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 v.WriteBuffer(((C,w)=>this._inputHandler.parse(C,w)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,C){this._writeBuffer.write(E,C)}writeSync(E,C){this._logService.logLevel<=u.LogLevelEnum.WARN&&!_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_=!0),this._writeBuffer.writeSync(E,C)}input(E,C=!0){this.coreService.triggerDataEvent(E,C)}resize(E,C){isNaN(E)||isNaN(C)||(E=Math.max(E,d.MINIMUM_COLS),C=Math.max(C,d.MINIMUM_ROWS),this._bufferService.resize(E,C))}scroll(E,C=!1){this._bufferService.scroll(E,C)}scrollLines(E,C,w){this._bufferService.scrollLines(E,C,w)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){let C=E-this._bufferService.buffer.ydisp;C!==0&&this.scrollLines(C)}registerEscHandler(E,C){return this._inputHandler.registerEscHandler(E,C)}registerDcsHandler(E,C){return this._inputHandler.registerDcsHandler(E,C)}registerCsiHandler(E,C){return this._inputHandler.registerCsiHandler(E,C)}registerOscHandler(E,C){return this._inputHandler.registerOscHandler(E,C)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1,C=this.optionsService.rawOptions.windowsPty;C&&C.buildNumber!==void 0&&C.buildNumber!==void 0?E=C.backend==="conpty"&&C.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let E=[];E.push(this.onLineFeed(a.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},(()=>((0,a.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(let C of E)C.dispose()}))}}}r.CoreTerminal=m},8460:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===n)return void this._listeners.splice(c,1)}}})),this._event}fire(n,c){let u=[];for(let o=0;o<this._listeners.length;o++)u.push(this._listeners[o]);for(let o=0;o<u.length;o++)u[o].call(void 0,n,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,c){return n((u=>c.fire(u)))},r.runAndSubscribe=function(n,c){return c(void 0),n((u=>c(u)))}},5435:function(D,r,n){var c=this&&this.__decorate||function($,S,x,k){var L,H=arguments.length,q=H<3?S:k===null?k=Object.getOwnPropertyDescriptor(S,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,S,x,k);else for(var X=$.length-1;X>=0;X--)(L=$[X])&&(q=(H<3?L(q):H>3?L(S,x,q):L(S,x))||q);return H>3&&q&&Object.defineProperty(S,x,q),q},u=this&&this.__param||function($,S){return function(x,k){S(x,k,$)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let o=n(2584),l=n(7116),d=n(2015),p=n(844),h=n(482),i=n(8437),t=n(8460),e=n(643),s=n(511),a=n(3734),f=n(2585),v=n(1480),g=n(6242),_=n(6351),m=n(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=131072;function C($,S){if($>24)return S.setWinLines||!1;switch($){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var w;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(r.WindowsOptionsReportType=w={}));let R=0;class P extends p.Disposable{getAttrData(){return this._curAttrData}constructor(S,x,k,L,H,q,X,Z,T=new d.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=x,this._coreService=k,this._logService=L,this._optionsService=H,this._oscLinkService=q,this._coreMouseService=X,this._unicodeService=Z,this._parser=T,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new h.StringToUtf32,this._utf8Decoder=new h.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((b=>this._activeBuffer=b.activeBuffer))),this._parser.setCsiHandlerFallback(((b,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(b),params:z.toArray()})})),this._parser.setEscHandlerFallback((b=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(b)})})),this._parser.setExecuteHandlerFallback((b=>{this._logService.debug("Unknown EXECUTE code: ",{code:b})})),this._parser.setOscHandlerFallback(((b,z,F)=>{this._logService.debug("Unknown OSC code: ",{identifier:b,action:z,data:F})})),this._parser.setDcsHandlerFallback(((b,z,F)=>{z==="HOOK"&&(F=F.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(b),action:z,payload:F})})),this._parser.setPrintHandler(((b,z,F)=>this.print(b,z,F))),this._parser.registerCsiHandler({final:"@"},(b=>this.insertChars(b))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(b=>this.scrollLeft(b))),this._parser.registerCsiHandler({final:"A"},(b=>this.cursorUp(b))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(b=>this.scrollRight(b))),this._parser.registerCsiHandler({final:"B"},(b=>this.cursorDown(b))),this._parser.registerCsiHandler({final:"C"},(b=>this.cursorForward(b))),this._parser.registerCsiHandler({final:"D"},(b=>this.cursorBackward(b))),this._parser.registerCsiHandler({final:"E"},(b=>this.cursorNextLine(b))),this._parser.registerCsiHandler({final:"F"},(b=>this.cursorPrecedingLine(b))),this._parser.registerCsiHandler({final:"G"},(b=>this.cursorCharAbsolute(b))),this._parser.registerCsiHandler({final:"H"},(b=>this.cursorPosition(b))),this._parser.registerCsiHandler({final:"I"},(b=>this.cursorForwardTab(b))),this._parser.registerCsiHandler({final:"J"},(b=>this.eraseInDisplay(b,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(b=>this.eraseInDisplay(b,!0))),this._parser.registerCsiHandler({final:"K"},(b=>this.eraseInLine(b,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(b=>this.eraseInLine(b,!0))),this._parser.registerCsiHandler({final:"L"},(b=>this.insertLines(b))),this._parser.registerCsiHandler({final:"M"},(b=>this.deleteLines(b))),this._parser.registerCsiHandler({final:"P"},(b=>this.deleteChars(b))),this._parser.registerCsiHandler({final:"S"},(b=>this.scrollUp(b))),this._parser.registerCsiHandler({final:"T"},(b=>this.scrollDown(b))),this._parser.registerCsiHandler({final:"X"},(b=>this.eraseChars(b))),this._parser.registerCsiHandler({final:"Z"},(b=>this.cursorBackwardTab(b))),this._parser.registerCsiHandler({final:"`"},(b=>this.charPosAbsolute(b))),this._parser.registerCsiHandler({final:"a"},(b=>this.hPositionRelative(b))),this._parser.registerCsiHandler({final:"b"},(b=>this.repeatPrecedingCharacter(b))),this._parser.registerCsiHandler({final:"c"},(b=>this.sendDeviceAttributesPrimary(b))),this._parser.registerCsiHandler({prefix:">",final:"c"},(b=>this.sendDeviceAttributesSecondary(b))),this._parser.registerCsiHandler({final:"d"},(b=>this.linePosAbsolute(b))),this._parser.registerCsiHandler({final:"e"},(b=>this.vPositionRelative(b))),this._parser.registerCsiHandler({final:"f"},(b=>this.hVPosition(b))),this._parser.registerCsiHandler({final:"g"},(b=>this.tabClear(b))),this._parser.registerCsiHandler({final:"h"},(b=>this.setMode(b))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(b=>this.setModePrivate(b))),this._parser.registerCsiHandler({final:"l"},(b=>this.resetMode(b))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(b=>this.resetModePrivate(b))),this._parser.registerCsiHandler({final:"m"},(b=>this.charAttributes(b))),this._parser.registerCsiHandler({final:"n"},(b=>this.deviceStatus(b))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(b=>this.deviceStatusPrivate(b))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(b=>this.softReset(b))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(b=>this.setCursorStyle(b))),this._parser.registerCsiHandler({final:"r"},(b=>this.setScrollRegion(b))),this._parser.registerCsiHandler({final:"s"},(b=>this.saveCursor(b))),this._parser.registerCsiHandler({final:"t"},(b=>this.windowOptions(b))),this._parser.registerCsiHandler({final:"u"},(b=>this.restoreCursor(b))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(b=>this.insertColumns(b))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(b=>this.deleteColumns(b))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(b=>this.selectProtected(b))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(b=>this.requestMode(b,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(b=>this.requestMode(b,!1))),this._parser.setExecuteHandler(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((b=>(this.setTitle(b),this.setIconName(b),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((b=>this.setIconName(b)))),this._parser.registerOscHandler(2,new g.OscHandler((b=>this.setTitle(b)))),this._parser.registerOscHandler(4,new g.OscHandler((b=>this.setOrReportIndexedColor(b)))),this._parser.registerOscHandler(8,new g.OscHandler((b=>this.setHyperlink(b)))),this._parser.registerOscHandler(10,new g.OscHandler((b=>this.setOrReportFgColor(b)))),this._parser.registerOscHandler(11,new g.OscHandler((b=>this.setOrReportBgColor(b)))),this._parser.registerOscHandler(12,new g.OscHandler((b=>this.setOrReportCursorColor(b)))),this._parser.registerOscHandler(104,new g.OscHandler((b=>this.restoreIndexedColor(b)))),this._parser.registerOscHandler(110,new g.OscHandler((b=>this.restoreFgColor(b)))),this._parser.registerOscHandler(111,new g.OscHandler((b=>this.restoreBgColor(b)))),this._parser.registerOscHandler(112,new g.OscHandler((b=>this.restoreCursorColor(b)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let b in l.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:b},(()=>this.selectCharset("("+b))),this._parser.registerEscHandler({intermediates:")",final:b},(()=>this.selectCharset(")"+b))),this._parser.registerEscHandler({intermediates:"*",final:b},(()=>this.selectCharset("*"+b))),this._parser.registerEscHandler({intermediates:"+",final:b},(()=>this.selectCharset("+"+b))),this._parser.registerEscHandler({intermediates:"-",final:b},(()=>this.selectCharset("-"+b))),this._parser.registerEscHandler({intermediates:".",final:b},(()=>this.selectCharset("."+b))),this._parser.registerEscHandler({intermediates:"/",final:b},(()=>this.selectCharset("/"+b)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((b=>(this._logService.error("Parsing error: ",b),b))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new _.DcsHandler(((b,z)=>this.requestStatusString(b,z))))}_preserveStack(S,x,k,L){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=k,this._parseStack.position=L}_logSlowResolvingAsync(S){this._logService.logLevel<=f.LogLevelEnum.WARN&&Promise.race([S,new Promise(((x,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,x){let k,L=this._activeBuffer.x,H=this._activeBuffer.y,q=0,X=this._parseStack.paused;if(X){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(k),k;L=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>E&&(q=this._parseStack.position+E)}if(this._logService.logLevel<=f.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?` "${S}"`:` "${Array.prototype.map.call(S,(b=>String.fromCharCode(b))).join("")}"`),typeof S=="string"?S.split("").map((b=>b.charCodeAt(0))):S),this._parseBuffer.length<S.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(S.length,E))),X||this._dirtyRowTracker.clearRange(),S.length>E)for(let b=q;b<S.length;b+=E){let z=b+E<S.length?b+E:S.length,F=typeof S=="string"?this._stringDecoder.decode(S.substring(b,z),this._parseBuffer):this._utf8Decoder.decode(S.subarray(b,z),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,F))return this._preserveStack(L,H,F,b),this._logSlowResolvingAsync(k),k}else if(!X){let b=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,b))return this._preserveStack(L,H,b,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===L&&this._activeBuffer.y===H||this._onCursorMove.fire();let Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),T=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);T<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(T,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(S,x,k){let L,H,q=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,T=this._coreService.decPrivateModes.wraparound,b=this._coreService.modes.insertMode,z=this._curAttrData,F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-x>0&&F.getWidth(this._activeBuffer.x-1)===2&&F.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let V=this._parser.precedingJoinState;for(let j=x;j<k;++j){if(L=S[j],L<127&&q){let _e=q[String.fromCharCode(L)];_e&&(L=_e.charCodeAt(0))}let te=this._unicodeService.charProperties(L,V);H=v.UnicodeService.extractWidth(te);let ne=v.UnicodeService.extractShouldJoin(te),oe=ne?v.UnicodeService.extractWidth(V):0;if(V=te,X&&this._onA11yChar.fire((0,h.stringFromCodePoint)(L)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-oe>Z){if(T){let _e=F,J=this._activeBuffer.x-oe;for(this._activeBuffer.x=oe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&F instanceof i.BufferLine&&F.copyCellsFrom(_e,J,0,oe,!1);J<Z;)_e.setCellFromCodepoint(J++,0,1,z)}else if(this._activeBuffer.x=Z-1,H===2)continue}if(ne&&this._activeBuffer.x){let _e=F.getWidth(this._activeBuffer.x-1)?1:2;F.addCodepointToCell(this._activeBuffer.x-_e,L,H);for(let J=H-oe;--J>=0;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(b&&(F.insertCells(this._activeBuffer.x,H-oe,this._activeBuffer.getNullCell(z)),F.getWidth(Z-1)===2&&F.setCellFromCodepoint(Z-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,z)),F.setCellFromCodepoint(this._activeBuffer.x++,L,H,z),H>0)for(;--H;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=V,this._activeBuffer.x<Z&&k-x>0&&F.getWidth(this._activeBuffer.x)===0&&!F.hasContent(this._activeBuffer.x)&&F.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,x){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,x):this._parser.registerCsiHandler(S,(k=>!C(k.params[0],this._optionsService.rawOptions.windowOptions)||x(k)))}registerDcsHandler(S,x){return this._parser.registerDcsHandler(S,new _.DcsHandler(x))}registerEscHandler(S,x){return this._parser.registerEscHandler(S,x)}registerOscHandler(S,x){return this._parser.registerOscHandler(S,new g.OscHandler(x))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);S.hasWidth(this._activeBuffer.x)&&!S.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-S),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(S=this._bufferService.cols-1){this._activeBuffer.x=Math.min(S,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(S,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=S,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+x)}cursorUp(S){let x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){let x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,S.params[0]||1)):this._moveCursor(0,S.params[0]||1),!0}cursorForward(S){return this._moveCursor(S.params[0]||1,0),!0}cursorBackward(S){return this._moveCursor(-(S.params[0]||1),0),!0}cursorNextLine(S){return this.cursorDown(S),this._activeBuffer.x=0,!0}cursorPrecedingLine(S){return this.cursorUp(S),this._activeBuffer.x=0,!0}cursorCharAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(S){return this._setCursor(S.length>=2?(S.params[1]||1)-1:0,(S.params[0]||1)-1),!0}charPosAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(S){return this._moveCursor(S.params[0]||1,0),!0}linePosAbsolute(S){return this._setCursor(this._activeBuffer.x,(S.params[0]||1)-1),!0}vPositionRelative(S){return this._moveCursor(0,S.params[0]||1),!0}hVPosition(S){return this.cursorPosition(S),!0}tabClear(S){let x=S.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=S.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=S.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){let x=S.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,x,k,L=!1,H=!1){let q=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);q.replaceCells(x,k,this._activeBuffer.getNullCell(this._eraseAttrData()),H),L&&(q.isWrapped=!1)}_resetBufferLine(S,x=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),k.isWrapped=!1)}eraseInDisplay(S,x=!1){let k;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);k<this._bufferService.rows;k++)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(0);break;case 3:let L=this._activeBuffer.lines.length-this._bufferService.rows;L>0&&(this._activeBuffer.lines.trimStart(L),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-L,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-L,0),this._onScroll.fire(0))}return!0}eraseInLine(S,x=!1){switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(S){this._restrictCursor();let x=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-L+1;for(;x--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let x=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,L;for(L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,L=this._bufferService.rows-1+this._activeBuffer.ybase-L;x--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(S){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(S){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let x=S.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(S){let x=S.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(S.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(S){let x=this._parser.precedingJoinState;if(!x)return!0;let k=S.params[0]||1,L=v.UnicodeService.extractWidth(x),H=this._activeBuffer.x-L,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),X=new Uint32Array(q.length*k),Z=0;for(let b=0;b<q.length;){let z=q.codePointAt(b)||0;X[Z++]=z,b+=z>65535?2:1}let T=Z;for(let b=1;b<k;++b)X.copyWithin(T,0,Z),T+=Z;return this.print(X,0,T),!0}sendDeviceAttributesPrimary(S){return S.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(S){return(this._optionsService.rawOptions.termName+"").indexOf(S)===0}setMode(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,l.DEFAULT_CHARSET),this._charsetService.setgCharset(1,l.DEFAULT_CHARSET),this._charsetService.setgCharset(2,l.DEFAULT_CHARSET),this._charsetService.setgCharset(3,l.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 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(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 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(),S.params[x]===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(S,x){let k=this._coreService.decPrivateModes,{activeProtocol:L,activeEncoding:H}=this._coreMouseService,q=this._coreService,{buffers:X,cols:Z}=this._bufferService,{active:T,alt:b}=X,z=this._optionsService.rawOptions,F=ne=>ne?1:2,V=S.params[0];return j=V,te=x?V===2?4:V===4?F(q.modes.insertMode):V===12?3:V===20?F(z.convertEol):0:V===1?F(k.applicationCursorKeys):V===3?z.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:V===6?F(k.origin):V===7?F(k.wraparound):V===8?3:V===9?F(L==="X10"):V===12?F(z.cursorBlink):V===25?F(!q.isCursorHidden):V===45?F(k.reverseWraparound):V===66?F(k.applicationKeypad):V===67?4:V===1e3?F(L==="VT200"):V===1002?F(L==="DRAG"):V===1003?F(L==="ANY"):V===1004?F(k.sendFocus):V===1005?4:V===1006?F(H==="SGR"):V===1015?4:V===1016?F(H==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?F(T===b):V===2004?F(k.bracketedPasteMode):0,q.triggerDataEvent(`${o.C0.ESC}[${x?"":"?"}${j};${te}$y`),!0;var j,te}_updateAttrColor(S,x,k,L,H){return x===2?(S|=50331648,S&=-16777216,S|=a.AttributeData.fromColorRGB([k,L,H])):x===5&&(S&=-50331904,S|=33554432|255&k),S}_extractColor(S,x,k){let L=[0,0,-1,0,0,0],H=0,q=0;do{if(L[q+H]=S.params[x+q],S.hasSubParams(x+q)){let X=S.getSubParams(x+q),Z=0;do L[1]===5&&(H=1),L[q+Z+1+H]=X[Z];while(++Z<X.length&&Z+q+1+H<L.length);break}if(L[1]===5&&q+H>=2||L[1]===2&&q+H>=5)break;L[1]&&(H=1)}while(++q+x<S.length&&q+H<L.length);for(let X=2;X<L.length;++X)L[X]===-1&&(L[X]=0);switch(L[0]){case 38:k.fg=this._updateAttrColor(k.fg,L[1],L[3],L[4],L[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,L[1],L[3],L[4],L[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,L[1],L[3],L[4],L[5])}return q}_processUnderline(S,x){x.extended=x.extended.clone(),(!~S||S>5)&&(S=1),x.extended.underlineStyle=S,x.fg|=268435456,S===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(S){S.fg=i.DEFAULT_ATTR_DATA.fg,S.bg=i.DEFAULT_ATTR_DATA.bg,S.extended=S.extended.clone(),S.extended.underlineStyle=0,S.extended.underlineColor&=-67108864,S.updateExtended()}charAttributes(S){if(S.length===1&&S.params[0]===0)return this._processSGR0(this._curAttrData),!0;let x=S.length,k,L=this._curAttrData;for(let H=0;H<x;H++)k=S.params[H],k>=30&&k<=37?(L.fg&=-50331904,L.fg|=16777216|k-30):k>=40&&k<=47?(L.bg&=-50331904,L.bg|=16777216|k-40):k>=90&&k<=97?(L.fg&=-50331904,L.fg|=16777224|k-90):k>=100&&k<=107?(L.bg&=-50331904,L.bg|=16777224|k-100):k===0?this._processSGR0(L):k===1?L.fg|=134217728:k===3?L.bg|=67108864:k===4?(L.fg|=268435456,this._processUnderline(S.hasSubParams(H)?S.getSubParams(H)[0]:1,L)):k===5?L.fg|=536870912:k===7?L.fg|=67108864:k===8?L.fg|=1073741824:k===9?L.fg|=2147483648:k===2?L.bg|=134217728:k===21?this._processUnderline(2,L):k===22?(L.fg&=-134217729,L.bg&=-134217729):k===23?L.bg&=-67108865:k===24?(L.fg&=-268435457,this._processUnderline(0,L)):k===25?L.fg&=-536870913:k===27?L.fg&=-67108865:k===28?L.fg&=-1073741825:k===29?L.fg&=2147483647:k===39?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):k===49?(L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?H+=this._extractColor(S,H,L):k===53?L.bg|=1073741824:k===55?L.bg&=-1073741825:k===59?(L.extended=L.extended.clone(),L.extended.underlineColor=-1,L.updateExtended()):k===100?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let x=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${x};${k}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let x=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${x};${k}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){let x=S.params[0]||1;switch(x){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"}let k=x%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(S){let x=S.params[0]||1,k;return(S.length<2||(k=S.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(S){if(!C(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let x=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(S){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(S){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(S){return this._windowTitle=S,this._onTitleChange.fire(S),!0}setIconName(S){return this._iconName=S,!0}setOrReportIndexedColor(S){let x=[],k=S.split(";");for(;k.length>1;){let L=k.shift(),H=k.shift();if(/^\d+$/.exec(L)){let q=parseInt(L);if(K(q))if(H==="?")x.push({type:0,index:q});else{let X=(0,m.parseColor)(H);X&&x.push({type:1,index:q,color:X})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(S){let x=S.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(S,x){this._getCurrentLinkId()&&this._finishHyperlink();let k=S.split(":"),L,H=k.findIndex((q=>q.startsWith("id=")));return H!==-1&&(L=k[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:L,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(S,x){let k=S.split(";");for(let L=0;L<k.length&&!(x>=this._specialColors.length);++L,++x)if(k[L]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{let H=(0,m.parseColor)(k[L]);H&&this._onColor.fire([{type:1,index:this._specialColors[x],color:H}])}return!0}setOrReportFgColor(S){return this._setOrReportSpecialColor(S,0)}setOrReportBgColor(S){return this._setOrReportSpecialColor(S,1)}setOrReportCursorColor(S){return this._setOrReportSpecialColor(S,2)}restoreIndexedColor(S){if(!S)return this._onColor.fire([{type:2}]),!0;let x=[],k=S.split(";");for(let L=0;L<k.length;++L)if(/^\d+$/.exec(k[L])){let H=parseInt(k[L]);K(H)&&x.push({type:2,index:H})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(S){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(S){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(S){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,l.DEFAULT_CHARSET),!0}selectCharset(S){return S.length!==2?(this.selectDefaultCharset(),!0):(S[0]==="/"||this._charsetService.setgCharset(y[S[0]],l.CHARSETS[S[1]]||l.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let S=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,S,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(S){return this._charsetService.setgLevel(S),!0}screenAlignmentPattern(){let S=new s.CellData;S.content=4194373,S.fg=this._curAttrData.fg,S.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){let k=this._activeBuffer.ybase+this._activeBuffer.y+x,L=this._activeBuffer.lines.get(k);L&&(L.fill(S),L.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,x){let k=this._bufferService.buffer,L=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${H}${o.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[L.cursorStyle]-(L.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,x){this._dirtyRowTracker.markRangeDirty(S,x)}}r.InputHandler=P;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,S){$>S&&(R=$,$=S,S=R),$<this.start&&(this.start=$),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K($){return 0<=$&&$<256}U=c([u(0,f.IBufferService)],U)},844:(D,r)=>{function n(c){for(let u of c)u.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let u=this._disposables.indexOf(c);u!==-1&&this._disposables.splice(u,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=n,r.getDisposeArrayDisposable=function(c){return{dispose:()=>n(c)}}},1505:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(u,o,l){this._data[u]||(this._data[u]={}),this._data[u][o]=l}get(u,o){return this._data[u]?this._data[u][o]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(c,u,o,l,d){this._data.get(c,u)||this._data.set(c,u,new n),this._data.get(c,u).set(o,l,d)}get(c,u,o,l){return this._data.get(c,u)?.get(o,l)}clear(){this._data.clear()}}},6114:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;let n=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.getSafariVersion=function(){if(!r.isSafari)return 0;let u=n.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),r.isIpad=c==="iPad",r.isIphone=c==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),r.isLinux=c.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(n=this._search(this._getKey(c)),this._array.splice(n,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;let u=this._getKey(c);if(u===void 0||(n=this._search(u),n===-1)||this._getKey(this._array[n])!==u)return!1;do if(this._array[n]===c)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===u);return!1}*getKeyIterator(c){if(this._array.length!==0&&(n=this._search(c),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===c))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===c)}forEachByKey(c,u){if(this._array.length!==0&&(n=this._search(c),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===c))do u(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===c)}values(){return[...this._array].values()}_search(c){let u=0,o=this._array.length-1;for(;o>=u;){let l=u+o>>1,d=this._getKey(this._array[l]);if(d>c)o=l-1;else{if(!(d<c)){for(;l>0&&this._getKey(this._array[l-1])===c;)l--;return l}u=l+1}}return u}}},7226:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let c=n(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(d){this._idleCallback=void 0;let p=0,h=0,i=d.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),h=Math.max(p,h),t=d.timeRemaining(),1.5*h>t)return i-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-p))}ms`),void this._start();i=t}this.clear()}}class o extends u{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){let p=Date.now()+d;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}r.PriorityTaskQueue=o,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(l){return requestIdleCallback(l)}_cancelCallback(l){cancelIdleCallback(l)}}:o,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(l){this._queue.clear(),this._queue.enqueue(l)}flush(){this._queue.flush()}}},9282:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let c=n(643);r.updateWindowsModeWrappedState=function(u){let o=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),l=o?.get(u.cols-1),d=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);d&&l&&(d.isWrapped=l[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&l[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){let o=new n;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}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}}r.AttributeData=n;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}get underlineVariantOffset(){let o=(3758096384&this._ext)>>29;return o<0?4294967288^o:o}set underlineVariantOffset(o){this._ext&=536870911,this._ext|=o<<29&3758096384}constructor(o=0,l=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=l}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let c=n(6349),u=n(7226),o=n(3734),l=n(8437),d=n(4634),p=n(511),h=n(643),i=n(4863),t=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,s,a){this._hasScrollback=e,this._optionsService=s,this._bufferService=a,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=l.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,s){return new l.BufferLine(this._bufferService.cols,this.getNullCell(e),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let s=e+this._optionsService.rawOptions.scrollback;return s>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:s}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=l.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,s){let a=this.getNullCell(l.DEFAULT_ATTR_DATA),f=0,v=this._getCorrectBufferLength(s);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols<e)for(let _=0;_<this.lines.length;_++)f+=+this.lines.get(_).resize(e,a);let g=0;if(this._rows<s)for(let _=this._rows;_<s;_++)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 l.BufferLine(e,a)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new l.BufferLine(e,a)));else for(let _=this._rows;_>s;_--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v<this.lines.maxLength){let _=this.lines.length-v;_>0&&(this.lines.trimStart(_),this.ybase=Math.max(this.ybase-_,0),this.ydisp=Math.max(this.ydisp-_,0),this.savedY=Math.max(this.savedY-_,0)),this.lines.maxLength=v}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,s-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(e,s),this._cols>e))for(let g=0;g<this.lines.length;g++)f+=+this.lines.get(g).resize(e,a);this._cols=e,this._rows=s,this._memoryCleanupQueue.clear(),f>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,s){this._cols!==e&&(e>this._cols?this._reflowLarger(e,s):this._reflowSmaller(e,s))}_reflowLarger(e,s){let a=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(l.DEFAULT_ATTR_DATA));if(a.length>0){let f=(0,d.reflowLargerCreateNewLayout)(this.lines,a);(0,d.reflowLargerApplyNewLayout)(this.lines,f.layout),this._reflowLargerAdjustViewport(e,s,f.countRemoved)}}_reflowLargerAdjustViewport(e,s,a){let f=this.getNullCell(l.DEFAULT_ATTR_DATA),v=a;for(;v-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new l.BufferLine(e,f))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-a,0)}_reflowSmaller(e,s){let a=this.getNullCell(l.DEFAULT_ATTR_DATA),f=[],v=0;for(let g=this.lines.length-1;g>=0;g--){let _=this.lines.get(g);if(!_||!_.isWrapped&&_.getTrimmedLength()<=e)continue;let m=[_];for(;_.isWrapped&&g>0;)_=this.lines.get(--g),m.unshift(_);let y=this.ybase+this.y;if(y>=g&&y<g+m.length)continue;let E=m[m.length-1].getTrimmedLength(),C=(0,d.reflowSmallerGetNewLineLengths)(m,this._cols,e),w=C.length-m.length,R;R=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);let P=[];for(let k=0;k<w;k++){let L=this.getBlankLine(l.DEFAULT_ATTR_DATA,!0);P.push(L)}P.length>0&&(f.push({start:g+m.length+v,newLines:P}),v+=P.length),m.push(...P);let U=C.length-1,K=C[U];K===0&&(U--,K=C[U]);let $=m.length-w-1,S=E;for(;$>=0;){let k=Math.min(S,K);if(m[U]===void 0)break;if(m[U].copyCellsFrom(m[$],S-k,K-k,k,!0),K-=k,K===0&&(U--,K=C[U]),S-=k,S===0){$--;let L=Math.max($,0);S=(0,d.getWrappedLineTrimmedLength)(m,L,this._cols)}}for(let k=0;k<m.length;k++)C[k]<e&&m[k].setCell(C[k],a);let x=w-R;for(;x-- >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+v)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+s-1)}if(f.length>0){let g=[],_=[];for(let U=0;U<this.lines.length;U++)_.push(this.lines.get(U));let m=this.lines.length,y=m-1,E=0,C=f[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+v);let w=0;for(let U=Math.min(this.lines.maxLength-1,m+v-1);U>=0;U--)if(C&&C.start>y+w){for(let K=C.newLines.length-1;K>=0;K--)this.lines.set(U--,C.newLines[K]);U++,g.push({index:y+1,amount:C.newLines.length}),w+=C.newLines.length,C=f[++E]}else this.lines.set(U,_[y--]);let R=0;for(let U=g.length-1;U>=0;U--)g[U].index+=R,this.lines.onInsertEmitter.fire(g[U]),R+=g[U].amount;let P=Math.max(0,m+v-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(e,s,a=0,f){let v=this.lines.get(e);return v?v.translateToString(s,a,f):""}getWrappedRangeForLine(e){let s=e,a=e;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;a+1<this.lines.length&&this.lines.get(a+1).isWrapped;)a++;return{first:s,last:a}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===e&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let s=new i.Marker(e);return this.markers.push(s),s.register(this.lines.onTrim((a=>{s.line-=a,s.line<0&&s.dispose()}))),s.register(this.lines.onInsert((a=>{s.line>=a.index&&(s.line+=a.amount)}))),s.register(this.lines.onDelete((a=>{s.line>=a.index&&s.line<a.index+a.amount&&s.dispose(),s.line>a.index&&(s.line-=a.amount)}))),s.register(s.onDispose((()=>this._removeMarker(s)))),s}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let c=n(3734),u=n(511),o=n(643),l=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let d=0;class p{constructor(i,t,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let s=t||u.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let a=0;a<i;++a)this.setCell(a,s);this.length=i}get(i){let t=this._data[3*i+0],e=2097151&t;return[this._data[3*i+1],2097152&t?this._combined[i]:e?(0,l.stringFromCodePoint)(e):"",t>>22,2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,t){this._data[3*i+1]=t[o.CHAR_DATA_ATTR_INDEX],t[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=t[1],this._data[3*i+0]=2097152|i|t[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=t[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&t}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i]:2097151&t?(0,l.stringFromCodePoint)(2097151&t):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,t){return d=3*i,t.content=this._data[d+0],t.fg=this._data[d+1],t.bg=this._data[d+2],2097152&t.content&&(t.combinedData=this._combined[i]),268435456&t.bg&&(t.extended=this._extendedAttrs[i]),t}setCell(i,t){2097152&t.content&&(this._combined[i]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=t.content,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}setCellFromCodepoint(i,t,e,s){268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=t|e<<22,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}addCodepointToCell(i,t,e){let s=this._data[3*i+0];2097152&s?this._combined[i]+=(0,l.stringFromCodePoint)(t):2097151&s?(this._combined[i]=(0,l.stringFromCodePoint)(2097151&s)+(0,l.stringFromCodePoint)(t),s&=-2097152,s|=2097152):s=t|4194304,e&&(s&=-12582913,s|=e<<22),this._data[3*i+0]=s}insertCells(i,t,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length-i){let s=new u.CellData;for(let a=this.length-i-t-1;a>=0;--a)this.setCell(i+t+a,this.loadCell(i+a,s));for(let a=0;a<t;++a)this.setCell(i+a,e)}else for(let s=i;s<this.length;++s)this.setCell(s,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,t,e){if(i%=this.length,t<this.length-i){let s=new u.CellData;for(let a=0;a<this.length-i-t;++a)this.setCell(i+a,this.loadCell(i+t+a,s));for(let a=this.length-t;a<this.length;++a)this.setCell(a,e)}else for(let s=i;s<this.length;++s)this.setCell(s,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,t,e,s=!1){if(s)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.setCell(i++,e)}resize(i,t){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let s=new Uint32Array(e);s.set(this._data),this._data=s}for(let s=this.length;s<i;++s)this.setCell(s,t)}else{this._data=this._data.subarray(0,e);let s=Object.keys(this._combined);for(let f=0;f<s.length;f++){let v=parseInt(s[f],10);v>=i&&delete this._combined[v]}let a=Object.keys(this._extendedAttrs);for(let f=0;f<a.length;f++){let v=parseInt(a[f],10);v>=i&&delete this._extendedAttrs[v]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,t=!1){if(t)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let t in i._combined)this._combined[t]=i._combined[t];this._extendedAttrs={};for(let t in i._extendedAttrs)this._extendedAttrs[t]=i._extendedAttrs[t];this.isWrapped=i.isWrapped}clone(){let i=new p(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let t in this._combined)i._combined[t]=this._combined[t];for(let t in this._extendedAttrs)i._extendedAttrs[t]=this._extendedAttrs[t];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,t,e,s,a){let f=i._data;if(a)for(let g=s-1;g>=0;g--){for(let _=0;_<3;_++)this._data[3*(e+g)+_]=f[3*(t+g)+_];268435456&f[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}else for(let g=0;g<s;g++){for(let _=0;_<3;_++)this._data[3*(e+g)+_]=f[3*(t+g)+_];268435456&f[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}let v=Object.keys(i._combined);for(let g=0;g<v.length;g++){let _=parseInt(v[g],10);_>=t&&(this._combined[_-t+e]=i._combined[_])}}translateToString(i,t,e,s){t=t??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),s&&(s.length=0);let a="";for(;t<e;){let f=this._data[3*t+0],v=2097151&f,g=2097152&f?this._combined[t]:v?(0,l.stringFromCodePoint)(v):o.WHITESPACE_CELL_CHAR;if(a+=g,s)for(let _=0;_<g.length;++_)s.push(t);t+=f>>22||1}return s&&s.push(t),a}}r.BufferLine=p},4841:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,c){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return c*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(D,r)=>{function n(c,u,o){if(u===c.length-1)return c[u].getTrimmedLength();let l=!c[u].hasContent(o-1)&&c[u].getWidth(o-1)===1,d=c[u+1].getWidth(0)===2;return l&&d?o-1:o}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,u,o,l,d){let p=[];for(let h=0;h<c.length-1;h++){let i=h,t=c.get(++i);if(!t.isWrapped)continue;let e=[c.get(h)];for(;i<c.length&&t.isWrapped;)e.push(t),t=c.get(++i);if(l>=h&&l<i){h+=e.length-1;continue}let s=0,a=n(e,s,u),f=1,v=0;for(;f<e.length;){let _=n(e,f,u),m=_-v,y=o-a,E=Math.min(m,y);e[s].copyCellsFrom(e[f],v,a,E,!1),a+=E,a===o&&(s++,a=0),v+=E,v===_&&(f++,v=0),a===0&&s!==0&&e[s-1].getWidth(o-1)===2&&(e[s].copyCellsFrom(e[s-1],o-1,a++,1,!1),e[s-1].setCell(o-1,d))}e[s].replaceCells(a,o,d);let g=0;for(let _=e.length-1;_>0&&(_>s||e[_].getTrimmedLength()===0);_--)g++;g>0&&(p.push(h+e.length-g),p.push(g)),h+=e.length-1}return p},r.reflowLargerCreateNewLayout=function(c,u){let o=[],l=0,d=u[l],p=0;for(let h=0;h<c.length;h++)if(d===h){let i=u[++l];c.onDeleteEmitter.fire({index:h-p,amount:i}),h+=i-1,p+=i,d=u[++l]}else o.push(h);return{layout:o,countRemoved:p}},r.reflowLargerApplyNewLayout=function(c,u){let o=[];for(let l=0;l<u.length;l++)o.push(c.get(u[l]));for(let l=0;l<o.length;l++)c.set(l,o[l]);c.length=u.length},r.reflowSmallerGetNewLineLengths=function(c,u,o){let l=[],d=c.map(((t,e)=>n(c,e,u))).reduce(((t,e)=>t+e)),p=0,h=0,i=0;for(;i<d;){if(d-i<o){l.push(d-i);break}p+=o;let t=n(c,h,u);p>t&&(p-=t,h++);let e=c[h].getWidth(p-1)===2;e&&p--;let s=e?o-1:o;l.push(s),i+=s}return l},r.getWrappedLineTrimmedLength=n},5295:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let c=n(8460),u=n(844),o=n(9092);class l extends u.Disposable{constructor(p,h){super(),this._optionsService=p,this._bufferService=h,this._onBufferActivate=this.register(new c.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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.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(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,h){this._normal.resize(p,h),this._alt.resize(p,h),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}r.BufferSet=l},511:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let c=n(482),u=n(643),o=n(3734);class l extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(p){let h=new l;return h.setFromCharData(p),h}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let h=!1;if(p[u.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(p[u.CHAR_DATA_CHAR_INDEX].length===2){let i=p[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let t=p[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(i-55296)+t-56320+65536|p[u.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=p[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[u.CHAR_DATA_WIDTH_INDEX]<<22;h&&(this.combinedData=p[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=l},643:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let c=n(8460),u=n(844);class o{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,u.disposeArray)(this._disposables),this._disposables.length=0)}register(d){return this._disposables.push(d),d}}r.Marker=o,o._nextId=1},7116:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(D,r)=>{var n,c,u;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
9
|
-
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="\x7F"})(n||(r.C0=n={})),(function(o){o.PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F"})(c||(r.C1=c={})),(function(o){o.ST=`${n.ESC}\\`})(u||(r.C1_ESCAPED=u={}))},7399:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let c=n(2584),u={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(o,l,d,p){let h={type:0,cancel:!1,key:void 0},i=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?h.key=l?c.C0.ESC+"OA":c.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?h.key=l?c.C0.ESC+"OD":c.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?h.key=l?c.C0.ESC+"OC":c.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(h.key=l?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:h.key=o.ctrlKey?"\b":c.C0.DEL,o.altKey&&(h.key=c.C0.ESC+h.key);break;case 9:if(o.shiftKey){h.key=c.C0.ESC+"[Z";break}h.key=c.C0.HT,h.cancel=!0;break;case 13:h.key=o.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,h.cancel=!0;break;case 27:h.key=c.C0.ESC,o.altKey&&(h.key=c.C0.ESC+c.C0.ESC),h.cancel=!0;break;case 37:if(o.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"D",h.key===c.C0.ESC+"[1;3D"&&(h.key=c.C0.ESC+(d?"b":"[1;5D"))):h.key=l?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(o.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"C",h.key===c.C0.ESC+"[1;3C"&&(h.key=c.C0.ESC+(d?"f":"[1;5C"))):h.key=l?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(o.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"A",d||h.key!==c.C0.ESC+"[1;3A"||(h.key=c.C0.ESC+"[1;5A")):h.key=l?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(o.metaKey)break;i?(h.key=c.C0.ESC+"[1;"+(i+1)+"B",d||h.key!==c.C0.ESC+"[1;3B"||(h.key=c.C0.ESC+"[1;5B")):h.key=l?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(h.key=c.C0.ESC+"[2~");break;case 46:h.key=i?c.C0.ESC+"[3;"+(i+1)+"~":c.C0.ESC+"[3~";break;case 36:h.key=i?c.C0.ESC+"[1;"+(i+1)+"H":l?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:h.key=i?c.C0.ESC+"[1;"+(i+1)+"F":l?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:o.shiftKey?h.type=2:o.ctrlKey?h.key=c.C0.ESC+"[5;"+(i+1)+"~":h.key=c.C0.ESC+"[5~";break;case 34:o.shiftKey?h.type=3:o.ctrlKey?h.key=c.C0.ESC+"[6;"+(i+1)+"~":h.key=c.C0.ESC+"[6~";break;case 112:h.key=i?c.C0.ESC+"[1;"+(i+1)+"P":c.C0.ESC+"OP";break;case 113:h.key=i?c.C0.ESC+"[1;"+(i+1)+"Q":c.C0.ESC+"OQ";break;case 114:h.key=i?c.C0.ESC+"[1;"+(i+1)+"R":c.C0.ESC+"OR";break;case 115:h.key=i?c.C0.ESC+"[1;"+(i+1)+"S":c.C0.ESC+"OS";break;case 116:h.key=i?c.C0.ESC+"[15;"+(i+1)+"~":c.C0.ESC+"[15~";break;case 117:h.key=i?c.C0.ESC+"[17;"+(i+1)+"~":c.C0.ESC+"[17~";break;case 118:h.key=i?c.C0.ESC+"[18;"+(i+1)+"~":c.C0.ESC+"[18~";break;case 119:h.key=i?c.C0.ESC+"[19;"+(i+1)+"~":c.C0.ESC+"[19~";break;case 120:h.key=i?c.C0.ESC+"[20;"+(i+1)+"~":c.C0.ESC+"[20~";break;case 121:h.key=i?c.C0.ESC+"[21;"+(i+1)+"~":c.C0.ESC+"[21~";break;case 122:h.key=i?c.C0.ESC+"[23;"+(i+1)+"~":c.C0.ESC+"[23~";break;case 123:h.key=i?c.C0.ESC+"[24;"+(i+1)+"~":c.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(d&&!p||!o.altKey||o.metaKey)!d||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?h.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(h.key=c.C0.US),o.key==="@"&&(h.key=c.C0.NUL)):o.keyCode===65&&(h.type=1);else{let t=u[o.keyCode],e=t?.[o.shiftKey?1:0];if(e)h.key=c.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let s=o.ctrlKey?o.keyCode-64:o.keyCode+32,a=String.fromCharCode(s);o.shiftKey&&(a=a.toUpperCase()),h.key=c.C0.ESC+a}else if(o.keyCode===32)h.key=c.C0.ESC+(o.ctrlKey?c.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let s=o.code.slice(3,4);o.shiftKey||(s=s.toLowerCase()),h.key=c.C0.ESC+s,h.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?h.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?h.key=c.C0.NUL:o.keyCode>=51&&o.keyCode<=55?h.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?h.key=c.C0.DEL:o.keyCode===219?h.key=c.C0.ESC:o.keyCode===220?h.key=c.C0.FS:o.keyCode===221&&(h.key=c.C0.GS)}return h}},482:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},r.utf32ToString=function(n,c=0,u=n.length){let o="";for(let l=c;l<u;++l){let d=n[l];d>65535?(d-=65536,o+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):o+=String.fromCharCode(d)}return o},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,c){let u=n.length;if(!u)return 0;let o=0,l=0;if(this._interim){let d=n.charCodeAt(l++);56320<=d&&d<=57343?c[o++]=1024*(this._interim-55296)+d-56320+65536:(c[o++]=this._interim,c[o++]=d),this._interim=0}for(let d=l;d<u;++d){let p=n.charCodeAt(d);if(55296<=p&&p<=56319){if(++d>=u)return this._interim=p,o;let h=n.charCodeAt(d);56320<=h&&h<=57343?c[o++]=1024*(p-55296)+h-56320+65536:(c[o++]=p,c[o++]=h)}else p!==65279&&(c[o++]=p)}return o}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,c){let u=n.length;if(!u)return 0;let o,l,d,p,h=0,i=0,t=0;if(this.interim[0]){let a=!1,f=this.interim[0];f&=(224&f)==192?31:(240&f)==224?15:7;let v,g=0;for(;(v=63&this.interim[++g])&&g<4;)f<<=6,f|=v;let _=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=_-g;for(;t<m;){if(t>=u)return 0;if(v=n[t++],(192&v)!=128){t--,a=!0;break}this.interim[g++]=v,f<<=6,f|=63&v}a||(_===2?f<128?t--:c[h++]=f:_===3?f<2048||f>=55296&&f<=57343||f===65279||(c[h++]=f):f<65536||f>1114111||(c[h++]=f)),this.interim.fill(0)}let e=u-4,s=t;for(;s<u;){for(;!(!(s<e)||128&(o=n[s])||128&(l=n[s+1])||128&(d=n[s+2])||128&(p=n[s+3]));)c[h++]=o,c[h++]=l,c[h++]=d,c[h++]=p,s+=4;if(o=n[s++],o<128)c[h++]=o;else if((224&o)==192){if(s>=u)return this.interim[0]=o,h;if(l=n[s++],(192&l)!=128){s--;continue}if(i=(31&o)<<6|63&l,i<128){s--;continue}c[h++]=i}else if((240&o)==224){if(s>=u)return this.interim[0]=o,h;if(l=n[s++],(192&l)!=128){s--;continue}if(s>=u)return this.interim[0]=o,this.interim[1]=l,h;if(d=n[s++],(192&d)!=128){s--;continue}if(i=(15&o)<<12|(63&l)<<6|63&d,i<2048||i>=55296&&i<=57343||i===65279)continue;c[h++]=i}else if((248&o)==240){if(s>=u)return this.interim[0]=o,h;if(l=n[s++],(192&l)!=128){s--;continue}if(s>=u)return this.interim[0]=o,this.interim[1]=l,h;if(d=n[s++],(192&d)!=128){s--;continue}if(s>=u)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=d,h;if(p=n[s++],(192&p)!=128){s--;continue}if(i=(7&o)<<18|(63&l)<<12|(63&d)<<6|63&p,i<65536||i>1114111)continue;c[h++]=i}}return h}}},225:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let c=n(1480),u=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],o=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],l;r.UnicodeV6=class{constructor(){if(this.version="6",!l){l=new Uint8Array(65536),l.fill(1),l[0]=0,l.fill(0,1,32),l.fill(0,127,160),l.fill(2,4352,4448),l[9001]=2,l[9002]=2,l.fill(2,11904,42192),l[12351]=1,l.fill(2,44032,55204),l.fill(2,63744,64256),l.fill(2,65040,65050),l.fill(2,65072,65136),l.fill(2,65280,65377),l.fill(2,65504,65511);for(let d=0;d<u.length;++d)l.fill(0,u[d][0],u[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?l[d]:(function(p,h){let i,t=0,e=h.length-1;if(p<h[0][0]||p>h[e][1])return!1;for(;e>=t;)if(i=t+e>>1,p>h[i][1])t=i+1;else{if(!(p<h[i][0]))return!0;e=i-1}return!1})(d,o)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,p){let h=this.wcwidth(d),i=h===0&&p!==0;if(i){let t=c.UnicodeService.extractWidth(p);t===0?i=!1:t>h&&(h=t)}return c.UnicodeService.createPropertyValue(0,h,i)}}},5981:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let c=n(8460),u=n(844);class o extends u.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let h;for(this._isSyncWriting=!0;h=this._writeBuffer.shift();){this._action(h);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,p){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+=d.length,this._writeBuffer.push(d),this._callbacks.push(p),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(p)}_innerWrite(d=0,p=!0){let h=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],t=this._action(i,p);if(t){let s=a=>Date.now()-h>=12?setTimeout((()=>this._innerWrite(0,a))):this._innerWrite(h,a);return void t.catch((a=>(queueMicrotask((()=>{throw a})),Promise.resolve(!1)))).then(s)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-h>=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()}}r.WriteBuffer=o},5941:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function u(o,l){let d=o.toString(16),p=d.length<2?"0"+d:d;switch(l){case 4:return d[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}r.parseColor=function(o){if(!o)return;let l=o.toLowerCase();if(l.indexOf("rgb:")===0){l=l.slice(4);let d=n.exec(l);if(d){let p=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/p*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/p*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/p*255)]}}else if(l.indexOf("#")===0&&(l=l.slice(1),c.exec(l)&&[3,6,9,12].includes(l.length))){let d=l.length/3,p=[0,0,0];for(let h=0;h<3;++h){let i=parseInt(l.slice(d*h,d*h+d),16);p[h]=d===1?i<<4:d===2?i:d===3?i>>4:i>>8}return p}},r.toRgbString=function(o,l=16){let[d,p,h]=o;return`rgb:${u(d,l)}/${u(p,l)}/${u(h,l)}`}},5770:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let c=n(482),u=n(8742),o=n(5770),l=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=l,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}registerHandler(p,h){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(h),{dispose:()=>{let t=i.indexOf(h);t!==-1&&i.splice(t,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=l,this._ident=0}hook(p,h){if(this.reset(),this._ident=p,this._active=this._handlers[p]||l,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(h);else this._handlerFb(this._ident,"HOOK",h)}put(p,h,i){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(p,h,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(p,h,i))}unhook(p,h=!0){if(this._active.length){let i=!1,t=this._active.length-1,e=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,i=h,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;t>=0&&(i=this._active[t].unhook(p),i!==!0);t--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,i;t--}for(;t>=0;t--)if(i=this._active[t].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",p);this._active=l,this._ident=0}};let d=new u.Params;d.addParam(0),r.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=d,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():d,this._data="",this._hitLimit=!1}put(p,h,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(p,h,i),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let h=!1;if(this._hitLimit)h=!1;else if(p&&(h=this._handler(this._data,this._params),h instanceof Promise))return h.then((i=>(this._params=d,this._data="",this._hitLimit=!1,i)));return this._params=d,this._data="",this._hitLimit=!1,h}}},2015:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let c=n(844),u=n(8742),o=n(6242),l=n(6351);class d{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,s,a){this.table[e<<8|t]=s<<4|a}addMany(t,e,s,a){for(let f=0;f<t.length;f++)this.table[e<<8|t[f]]=s<<4|a}}r.TransitionTable=d;let p=160;r.VT500_TRANSITION_TABLE=(function(){let i=new d(4095),t=Array.apply(null,Array(256)).map(((g,_)=>_)),e=(g,_)=>t.slice(g,_),s=e(32,127),a=e(0,24);a.push(25),a.push.apply(a,e(28,32));let f=e(0,14),v;for(v in i.setDefault(1,0),i.addMany(s,0,2,0),f)i.addMany([24,26,153,154],v,3,0),i.addMany(e(128,144),v,3,0),i.addMany(e(144,152),v,3,0),i.add(156,v,0,0),i.add(27,v,11,1),i.add(157,v,4,8),i.addMany([152,158,159],v,0,7),i.add(155,v,11,3),i.add(144,v,11,9);return i.addMany(a,0,3,0),i.addMany(a,1,3,1),i.add(127,1,0,1),i.addMany(a,8,0,8),i.addMany(a,3,3,3),i.add(127,3,0,3),i.addMany(a,4,3,4),i.add(127,4,0,4),i.addMany(a,6,3,6),i.addMany(a,5,3,5),i.add(127,5,0,5),i.addMany(a,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(a,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(a,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(a,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(a,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(a,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(a,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(p,0,2,0),i.add(p,8,5,8),i.add(p,6,0,6),i.add(p,11,0,11),i.add(p,13,13,13),i})();class h extends c.Disposable{constructor(t=r.VT500_TRANSITION_TABLE){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,s,a)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,s)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new l.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,e=[64,126]){let s=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=t.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let f=0;f<t.intermediates.length;++f){let v=t.intermediates.charCodeAt(f);if(32>v||v>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=v}}if(t.final.length!==1)throw new Error("final must be a single byte");let a=t.final.charCodeAt(0);if(e[0]>a||a>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return s<<=8,s|=a,s}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(255&t)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let s=this._identifier(t,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let a=this._escHandlers[s];return a.push(e),{dispose:()=>{let f=a.indexOf(e);f!==-1&&a.splice(f,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let s=this._identifier(t);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let a=this._csiHandlers[s];return a.push(e),{dispose:()=>{let f=a.indexOf(e);f!==-1&&a.splice(f,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,e,s,a,f){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=s,this._parseStack.transition=a,this._parseStack.chunkPos=f}parse(t,e,s){let a,f=0,v=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=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");let _=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&m>-1){for(;m>=0&&(a=_[m](this._params),a!==!0);m--)if(a instanceof Promise)return this._parseStack.handlerPos=m,a}this._parseStack.handlers=[];break;case 4:if(s===!1&&m>-1){for(;m>=0&&(a=_[m](),a!==!0);m--)if(a instanceof Promise)return this._parseStack.handlerPos=m,a}this._parseStack.handlers=[];break;case 6:if(f=t[this._parseStack.chunkPos],a=this._dcsParser.unhook(f!==24&&f!==26,s),a)return a;f===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(f=t[this._parseStack.chunkPos],a=this._oscParser.end(f!==24&&f!==26,s),a)return a;f===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let _=g;_<e;++_){switch(f=t[_],v=this._transitions.table[this.currentState<<8|(f<160?f:p)],v>>4){case 2:for(let w=_+1;;++w){if(w>=e||(f=t[w])<32||f>126&&f<p){this._printHandler(t,_,w),_=w-1;break}if(++w>=e||(f=t[w])<32||f>126&&f<p){this._printHandler(t,_,w),_=w-1;break}if(++w>=e||(f=t[w])<32||f>126&&f<p){this._printHandler(t,_,w),_=w-1;break}if(++w>=e||(f=t[w])<32||f>126&&f<p){this._printHandler(t,_,w),_=w-1;break}}break;case 3:this._executeHandlers[f]?this._executeHandlers[f]():this._executeHandlerFb(f),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:_,code:f,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|f],y=m?m.length-1:-1;for(;y>=0&&(a=m[y](this._params),a!==!0);y--)if(a instanceof Promise)return this._preserveStack(3,m,y,v,_),a;y<0&&this._csiHandlerFb(this._collect<<8|f,this._params),this.precedingJoinState=0;break;case 8:do switch(f){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(f-48)}while(++_<e&&(f=t[_])>47&&f<60);_--;break;case 9:this._collect<<=8,this._collect|=f;break;case 10:let E=this._escHandlers[this._collect<<8|f],C=E?E.length-1:-1;for(;C>=0&&(a=E[C](),a!==!0);C--)if(a instanceof Promise)return this._preserveStack(4,E,C,v,_),a;C<0&&this._escHandlerFb(this._collect<<8|f),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|f,this._params);break;case 13:for(let w=_+1;;++w)if(w>=e||(f=t[w])===24||f===26||f===27||f>127&&f<p){this._dcsParser.put(t,_,w),_=w-1;break}break;case 14:if(a=this._dcsParser.unhook(f!==24&&f!==26),a)return this._preserveStack(6,[],0,v,_),a;f===27&&(v|=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 w=_+1;;w++)if(w>=e||(f=t[w])<32||f>127&&f<p){this._oscParser.put(t,_,w),_=w-1;break}break;case 6:if(a=this._oscParser.end(f!==24&&f!==26),a)return this._preserveStack(5,[],0,v,_),a;f===27&&(v|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&v}}}r.EscapeSequenceParser=h},6242:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let c=n(5770),u=n(482),o=[];r.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(l,d){this._handlers[l]===void 0&&(this._handlers[l]=[]);let p=this._handlers[l];return p.push(d),{dispose:()=>{let h=p.indexOf(d);h!==-1&&p.splice(h,1)}}}clearHandler(l){this._handlers[l]&&delete this._handlers[l]}setHandlerFallback(l){this._handlerFb=l}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let l=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;l>=0;--l)this._active[l].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].start();else this._handlerFb(this._id,"START")}_put(l,d,p){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(l,d,p);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(l,d,p))}start(){this.reset(),this._state=1}put(l,d,p){if(this._state!==3){if(this._state===1)for(;d<p;){let h=l[d++];if(h===59){this._state=2,this._start();break}if(h<48||57<h)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+h-48}this._state===2&&p-d>0&&this._put(l,d,p)}}end(l,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,h=this._active.length-1,i=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,p=d,i=this._stack.fallThrough,this._stack.paused=!1),!i&&p===!1){for(;h>=0&&(p=this._active[h].end(l),p!==!0);h--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,p;h--}for(;h>=0;h--)if(p=this._active[h].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",l);this._active=o,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(l){this._handler=l,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(l,d,p){this._hitLimit||(this._data+=(0,u.utf32ToString)(l,d,p),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(l){let d=!1;if(this._hitLimit)d=!1;else if(l&&(d=this._handler(this._data),d instanceof Promise))return d.then((p=>(this._data="",this._hitLimit=!1,p)));return this._data="",this._hitLimit=!1,d}}},8742:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let n=2147483647;class c{static fromArray(o){let l=new c;if(!o.length)return l;for(let d=Array.isArray(o[0])?1:0;d<o.length;++d){let p=o[d];if(Array.isArray(p))for(let h=0;h<p.length;++h)l.addSubParam(p[h]);else l.addParam(p)}return l}constructor(o=32,l=32){if(this.maxLength=o,this.maxSubParamsLength=l,l>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(l),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new c(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){let o=[];for(let l=0;l<this.length;++l){o.push(this.params[l]);let d=this._subParamsIdx[l]>>8,p=255&this._subParamsIdx[l];p-d>0&&o.push(Array.prototype.slice.call(this._subParams,d,p))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>n?n:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>n?n:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let l=this._subParamsIdx[o]>>8,d=255&this._subParamsIdx[o];return d-l>0?this._subParams.subarray(l,d):null}getSubParamsAll(){let o={};for(let l=0;l<this.length;++l){let d=this._subParamsIdx[l]>>8,p=255&this._subParamsIdx[l];p-d>0&&(o[l]=this._subParams.slice(d,p))}return o}addDigit(o){let l;if(this._rejectDigits||!(l=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let d=this._digitIsSub?this._subParams:this.params,p=d[l-1];d[l-1]=~p?Math.min(10*p+o,n):o}}r.Params=c},5741:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,c){let u={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(u),c.dispose=()=>this._wrappedAddonDispose(u),c.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let c=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===n){c=u;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(c,1)}}},8771:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let c=n(3785),u=n(511);r.BufferApiView=class{constructor(o,l){this._buffer=o,this.type=l}init(o){return this._buffer=o,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(o){let l=this._buffer.lines.get(o);if(l)return new c.BufferLineApiView(l)}getNullCell(){return new u.CellData}}},3785:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let c=n(511);r.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,o){if(!(u<0||u>=this._line.length))return o?(this._line.loadCell(u,o),o):this._line.loadCell(u,new c.CellData)}translateToString(u,o,l){return this._line.translateToString(u,o,l)}}},8285:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let c=n(8771),u=n(8460),o=n(844);class l extends o.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new u.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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)}}r.BufferNamespaceApi=l},7975:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,c){return this._core.registerCsiHandler(n,(u=>c(u.toArray())))}addCsiHandler(n,c){return this.registerCsiHandler(n,c)}registerDcsHandler(n,c){return this._core.registerDcsHandler(n,((u,o)=>c(u,o.toArray())))}addDcsHandler(n,c){return this.registerDcsHandler(n,c)}registerEscHandler(n,c){return this._core.registerEscHandler(n,c)}addEscHandler(n,c){return this.registerEscHandler(n,c)}registerOscHandler(n,c){return this._core.registerOscHandler(n,c)}addOscHandler(n,c){return this.registerOscHandler(n,c)}}},7090:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(D,r,n){var c=this&&this.__decorate||function(i,t,e,s){var a,f=arguments.length,v=f<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,t,e,s);else for(var g=i.length-1;g>=0;g--)(a=i[g])&&(v=(f<3?a(v):f>3?a(t,e,v):a(t,e))||v);return f>3&&v&&Object.defineProperty(t,e,v),v},u=this&&this.__param||function(i,t){return function(e,s){t(e,s,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let o=n(8460),l=n(844),d=n(5295),p=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let h=r.BufferService=class extends l.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new d.BufferSet(i,this))}resize(i,t){this.cols=i,this.rows=t,this.buffers.resize(i,t),this._onResize.fire({cols:i,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,t=!1){let e=this.buffer,s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===i.fg&&s.getBg(0)===i.bg||(s=e.getBlankLine(i,t),this._cachedBlankLine=s),s.isWrapped=t;let a=e.ybase+e.scrollTop,f=e.ybase+e.scrollBottom;if(e.scrollTop===0){let v=e.lines.isFull;f===e.lines.length-1?v?e.lines.recycle().copyFrom(s):e.lines.push(s.clone()):e.lines.splice(f+1,0,s.clone()),v?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let v=f-a+1;e.lines.shiftElements(a+1,v-1,-1),e.lines.set(f,s.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,t,e){let s=this.buffer;if(i<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else i+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let a=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),a!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};r.BufferService=h=c([u(0,p.IOptionsService)],h)},7994:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,c){this._charsets[n]=c,this.glevel===n&&(this.charset=c)}}},1753:function(D,r,n){var c=this&&this.__decorate||function(s,a,f,v){var g,_=arguments.length,m=_<3?a:v===null?v=Object.getOwnPropertyDescriptor(a,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,a,f,v);else for(var y=s.length-1;y>=0;y--)(g=s[y])&&(m=(_<3?g(m):_>3?g(a,f,m):g(a,f))||m);return _>3&&m&&Object.defineProperty(a,f,m),m},u=this&&this.__param||function(s,a){return function(f,v){a(f,v,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let o=n(2585),l=n(8460),d=n(844),p={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 h(s,a){let f=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(f|=64,f|=s.action):(f|=3&s.button,4&s.button&&(f|=64),8&s.button&&(f|=128),s.action===32?f|=32:s.action!==0||a||(f|=3)),f}let i=String.fromCharCode,t={DEFAULT:s=>{let a=[h(s,!1)+32,s.col+32,s.row+32];return a[0]>255||a[1]>255||a[2]>255?"":`\x1B[M${i(a[0])}${i(a[1])}${i(a[2])}`},SGR:s=>{let a=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${h(s,!0)};${s.col};${s.row}${a}`},SGR_PIXELS:s=>{let a=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${h(s,!0)};${s.x};${s.y}${a}`}},e=r.CoreMouseService=class extends d.Disposable{constructor(s,a){super(),this._bufferService=s,this._coreService=a,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new l.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let f of Object.keys(p))this.addProtocol(f,p[f]);for(let f of Object.keys(t))this.addEncoding(f,t[f]);this.reset()}addProtocol(s,a){this._protocols[s]=a}addEncoding(s,a){this._encodings[s]=a}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;let a=this._encodings[this._activeEncoding](s);return a&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(a):this._coreService.triggerDataEvent(a,!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,a,f){if(f){if(s.x!==a.x||s.y!==a.y)return!1}else if(s.col!==a.col||s.row!==a.row)return!1;return s.button===a.button&&s.action===a.action&&s.ctrl===a.ctrl&&s.alt===a.alt&&s.shift===a.shift}};r.CoreMouseService=e=c([u(0,o.IBufferService),u(1,o.ICoreService)],e)},6975:function(D,r,n){var c=this&&this.__decorate||function(e,s,a,f){var v,g=arguments.length,_=g<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(e,s,a,f);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(_=(g<3?v(_):g>3?v(s,a,_):v(s,a))||_);return g>3&&_&&Object.defineProperty(s,a,_),_},u=this&&this.__param||function(e,s){return function(a,f){s(a,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let o=n(1439),l=n(8460),d=n(844),p=n(2585),h=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=r.CoreService=class extends d.Disposable{constructor(e,s,a){super(),this._bufferService=e,this._logService=s,this._optionsService=a,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new l.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new l.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new l.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new l.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(h),this.decPrivateModes=(0,o.clone)(i)}reset(){this.modes=(0,o.clone)(h),this.decPrivateModes=(0,o.clone)(i)}triggerDataEvent(e,s=!1){if(this._optionsService.rawOptions.disableStdin)return;let a=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&a.ybase!==a.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((f=>f.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((s=>s.charCodeAt(0))))),this._onBinary.fire(e))}};r.CoreService=t=c([u(0,p.IBufferService),u(1,p.ILogService),u(2,p.IOptionsService)],t)},9074:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let c=n(8055),u=n(8460),o=n(844),l=n(6106),d=0,p=0;class h extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new l.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let s=new i(e);if(s){let a=s.marker.onDispose((()=>s.dispose()));s.onDispose((()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),a.dispose())})),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,s,a){let f=0,v=0;for(let g of this._decorations.getKeyIterator(s))f=g.options.x??0,v=f+(g.options.width??1),e>=f&&e<v&&(!a||(g.options.layer??"bottom")===a)&&(yield g)}forEachDecorationAtCell(e,s,a,f){this._decorations.forEachByKey(s,(v=>{d=v.options.x??0,p=d+(v.options.width??1),e>=d&&e<p&&(!a||(v.options.layer??"bottom")===a)&&f(v)}))}}r.DecorationService=h;class i extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let c=n(2585),u=n(8343);class o{constructor(...d){this._entries=new Map;for(let[p,h]of d)this.set(p,h)}set(d,p){let h=this._entries.get(d);return this._entries.set(d,p),h}forEach(d){for(let[p,h]of this._entries.entries())d(p,h)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}r.ServiceCollection=o,r.InstantiationService=class{constructor(){this._services=new o,this._services.set(c.IInstantiationService,this)}setService(l,d){this._services.set(l,d)}getService(l){return this._services.get(l)}createInstance(l,...d){let p=(0,u.getServiceDependencies)(l).sort(((t,e)=>t.index-e.index)),h=[];for(let t of p){let e=this._services.get(t.id);if(!e)throw new Error(`[createInstance] ${l.name} depends on UNKNOWN service ${t.id}.`);h.push(e)}let i=p.length>0?p[0].index:d.length;if(d.length!==i)throw new Error(`[createInstance] First service dependency of ${l.name} at position ${i+1} conflicts with ${d.length} static arguments`);return new l(...d,...h)}}},7866:function(D,r,n){var c=this&&this.__decorate||function(i,t,e,s){var a,f=arguments.length,v=f<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,t,e,s);else for(var g=i.length-1;g>=0;g--)(a=i[g])&&(v=(f<3?a(v):f>3?a(t,e,v):a(t,e))||v);return f>3&&v&&Object.defineProperty(t,e,v),v},u=this&&this.__param||function(i,t){return function(e,s){t(e,s,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let o=n(844),l=n(2585),d={trace:l.LogLevelEnum.TRACE,debug:l.LogLevelEnum.DEBUG,info:l.LogLevelEnum.INFO,warn:l.LogLevelEnum.WARN,error:l.LogLevelEnum.ERROR,off:l.LogLevelEnum.OFF},p,h=r.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=l.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),p=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let t=0;t<i.length;t++)typeof i[t]=="function"&&(i[t]=i[t]())}_log(i,t,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...e)}trace(i,...t){this._logLevel<=l.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,t)}debug(i,...t){this._logLevel<=l.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,t)}info(i,...t){this._logLevel<=l.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,t)}warn(i,...t){this._logLevel<=l.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,t)}error(i,...t){this._logLevel<=l.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,t)}};r.LogService=h=c([u(0,l.IOptionsService)],h),r.setTraceLogger=function(i){p=i},r.traceCall=function(i,t,e){if(typeof e.value!="function")throw new Error("not supported");let s=e.value;e.value=function(...a){if(p.logLevel!==l.LogLevelEnum.TRACE)return s.apply(this,a);p.trace(`GlyphRenderer#${s.name}(${a.map((v=>JSON.stringify(v))).join(", ")})`);let f=s.apply(this,a);return p.trace(`GlyphRenderer#${s.name} return`,f),f}}},7302:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let c=n(8460),u=n(844),o=n(6114);r.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:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let l=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends u.Disposable{constructor(h){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...r.DEFAULT_OPTIONS};for(let t in h)if(t in i)try{let e=h[t];i[t]=this._sanitizeAndValidateOption(t,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,u.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(h,i){return this.onOptionChange((t=>{t===h&&i(this.rawOptions[h])}))}onMultipleOptionChange(h,i){return this.onOptionChange((t=>{h.indexOf(t)!==-1&&i()}))}_setupOptions(){let h=t=>{if(!(t in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},i=(t,e)=>{if(!(t in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);e=this._sanitizeAndValidateOption(t,e),this.rawOptions[t]!==e&&(this.rawOptions[t]=e,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let e={get:h.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,e)}}_sanitizeAndValidateOption(h,i){switch(h){case"cursorStyle":if(i||(i=r.DEFAULT_OPTIONS[h]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${h}`);break;case"wordSeparator":i||(i=r.DEFAULT_OPTIONS[h]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=l.includes(i)?i:r.DEFAULT_OPTIONS[h];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${h} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${h} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${h} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${h} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}r.OptionsService=d},2660:function(D,r,n){var c=this&&this.__decorate||function(d,p,h,i){var t,e=arguments.length,s=e<3?p:i===null?i=Object.getOwnPropertyDescriptor(p,h):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(d,p,h,i);else for(var a=d.length-1;a>=0;a--)(t=d[a])&&(s=(e<3?t(s):e>3?t(p,h,s):t(p,h))||s);return e>3&&s&&Object.defineProperty(p,h,s),s},u=this&&this.__param||function(d,p){return function(h,i){p(h,i,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let o=n(2585),l=r.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){let p=this._bufferService.buffer;if(d.id===void 0){let a=p.addMarker(p.ybase+p.y),f={data:d,id:this._nextId++,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(f,a))),this._dataByLinkId.set(f.id,f),f.id}let h=d,i=this._getEntryIdKey(h),t=this._entriesWithId.get(i);if(t)return this.addLineToLink(t.id,p.ybase+p.y),t.id;let e=p.addMarker(p.ybase+p.y),s={id:this._nextId++,key:this._getEntryIdKey(h),data:h,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(s,e))),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(d,p){let h=this._dataByLinkId.get(d);if(h&&h.lines.every((i=>i.line!==p))){let i=this._bufferService.buffer.addMarker(p);h.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(h,i)))}}getLinkData(d){return this._dataByLinkId.get(d)?.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,p){let h=d.lines.indexOf(p);h!==-1&&(d.lines.splice(h,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};r.OscLinkService=l=c([u(0,o.IBufferService)],l)},8343:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let n="di$target",c="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(u){return u[c]||[]},r.createDecorator=function(u){if(r.serviceRegistry.has(u))return r.serviceRegistry.get(u);let o=function(l,d,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(h,i,t){i[n]===i?i[c].push({id:h,index:t}):(i[c]=[{id:h,index:t}],i[n]=i)})(o,l,p)};return o.toString=()=>u,r.serviceRegistry.set(u,o),o}},2585:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;let c=n(8343);var u;r.IBufferService=(0,c.createDecorator)("BufferService"),r.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),r.ICoreService=(0,c.createDecorator)("CoreService"),r.ICharsetService=(0,c.createDecorator)("CharsetService"),r.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(u||(r.LogLevelEnum=u={})),r.ILogService=(0,c.createDecorator)("LogService"),r.IOptionsService=(0,c.createDecorator)("OptionsService"),r.IOscLinkService=(0,c.createDecorator)("OscLinkService"),r.IUnicodeService=(0,c.createDecorator)("UnicodeService"),r.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(D,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let c=n(8460),u=n(225);class o{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,p,h=!1){return(16777215&d)<<3|(3&p)<<1|(h?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;let d=new u.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let p=0,h=0,i=d.length;for(let t=0;t<i;++t){let e=d.charCodeAt(t);if(55296<=e&&e<=56319){if(++t>=i)return p+this.wcwidth(e);let f=d.charCodeAt(t);56320<=f&&f<=57343?e=1024*(e-55296)+f-56320+65536:p+=this.wcwidth(f)}let s=this.charProperties(e,h),a=o.extractWidth(s);o.extractShouldJoin(s)&&(a-=o.extractWidth(h)),p+=a,h=s}return p}charProperties(d,p){return this._activeProvider.charProperties(d,p)}}r.UnicodeService=o}},A={};function O(D){var r=A[D];if(r!==void 0)return r.exports;var n=A[D]={exports:{}};return I[D].call(n.exports,n,n.exports,O),n.exports}var N={};return(()=>{var D=N;Object.defineProperty(D,"__esModule",{value:!0}),D.Terminal=void 0;let r=O(9042),n=O(3236),c=O(844),u=O(5741),o=O(8285),l=O(7975),d=O(7090),p=["cols","rows"];class h extends c.Disposable{constructor(t){super(),this._core=this.register(new n.Terminal(t)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};let e=a=>this._core.options[a],s=(a,f)=>{this._checkReadonlyOptions(a),this._core.options[a]=f};for(let a in this._core.options){let f={get:e.bind(this,a),set:s.bind(this,a)};Object.defineProperty(this._publicOptions,a,f)}}_checkReadonlyOptions(t){if(p.includes(t))throw new Error(`Option "${t}" 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 l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.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 o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,s){this._verifyIntegers(t,e,s),this._core.select(t,e,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
10
|
-
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return r}_verifyIntegers(...t){for(let e of t)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(let e of t)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}D.Terminal=h})(),N})()))});var Dt=ut((it,pt)=>{(function(I,A){typeof it=="object"&&typeof pt=="object"?pt.exports=A():typeof define=="function"&&define.amd?define([],A):typeof it=="object"?it.FitAddon=A():I.FitAddon=A()})(self,(()=>(()=>{"use strict";var I={};return(()=>{var A=I;Object.defineProperty(A,"__esModule",{value:!0}),A.FitAddon=void 0,A.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){let O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;let N=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(N._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let O=this._terminal._core,N=O._renderService.dimensions;if(N.css.cell.width===0||N.css.cell.height===0)return;let D=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),c=Math.max(0,parseInt(r.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),o=n-(parseInt(u.getPropertyValue("padding-top"))+parseInt(u.getPropertyValue("padding-bottom"))),l=c-(parseInt(u.getPropertyValue("padding-right"))+parseInt(u.getPropertyValue("padding-left")))-D;return{cols:Math.max(2,Math.floor(l/N.css.cell.width)),rows:Math.max(1,Math.floor(o/N.css.cell.height))}}}})(),I})()))});var Lt=ut((st,vt)=>{(function(I,A){typeof st=="object"&&typeof vt=="object"?vt.exports=A():typeof define=="function"&&define.amd?define([],A):typeof st=="object"?st.SearchAddon=A():I.SearchAddon=A()})(self,(()=>(()=>{"use strict";var I={345:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===n)return void this._listeners.splice(c,1)}}})),this._event}fire(n,c){let u=[];for(let o=0;o<this._listeners.length;o++)u.push(this._listeners[o]);for(let o=0;o<u.length;o++)u[o].call(void 0,n,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,c){return n((u=>c.fire(u)))},r.runAndSubscribe=function(n,c){return c(void 0),n((u=>c(u)))}},859:(D,r)=>{function n(c){for(let u of c)u.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let u=this._disposables.indexOf(c);u!==-1&&this._disposables.splice(u,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=n,r.getDisposeArrayDisposable=function(c){return{dispose:()=>n(c)}}}},A={};function O(D){var r=A[D];if(r!==void 0)return r.exports;var n=A[D]={exports:{}};return I[D](n,n.exports,O),n.exports}var N={};return(()=>{var D=N;Object.defineProperty(D,"__esModule",{value:!0}),D.SearchAddon=void 0;let r=O(345),n=O(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class u extends n.Disposable{constructor(l){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new n.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new n.MutableDisposable,this._onDidChangeResults=this.register(new r.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=l?.highlightLimit??1e3}activate(l){this._terminal=l,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,n.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let l=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(l,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(l){this._selectedDecoration.clear(),(0,n.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),l||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(l,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let p=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||l!==this._cachedSearchTerm||p)&&this._highlightAllMatches(l,d);let h=this._findNextAndSelect(l,d);return this._fireResults(d),this._cachedSearchTerm=l,h}_highlightAllMatches(l,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!l||l.length===0)return void this.clearDecorations();d=d||{},this.clearDecorations(!0);let p=[],h,i=this._find(l,0,0,d);for(;i&&(h?.row!==i.row||h?.col!==i.col)&&!(p.length>=this._highlightLimit);)h=i,p.push(h),i=this._find(l,h.col+h.term.length>=this._terminal.cols?h.row+1:h.row,h.col+h.term.length>=this._terminal.cols?0:h.col+1,d);for(let t of p){let e=this._createResultDecoration(t,d.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}}))}}_find(l,d,p,h){if(!this._terminal||!l||l.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(p>this._terminal.cols)throw new Error(`Invalid col: ${p} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let t={startRow:d,startCol:p};if(i=this._findInLine(l,t,h),!i)for(let e=d+1;e<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=e,t.startCol=0,i=this._findInLine(l,t,h),!i);e++);return i}_findNextAndSelect(l,d){if(!this._terminal||!l||l.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let p=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,i=0;p&&(this._cachedSearchTerm===l?(h=p.end.x,i=p.end.y):(h=p.start.x,i=p.start.y)),this._initLinesCache();let t={startRow:i,startCol:h},e=this._findInLine(l,t,d);if(!e)for(let s=i+1;s<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=s,t.startCol=0,e=this._findInLine(l,t,d),!e);s++);if(!e&&i!==0)for(let s=0;s<i&&(t.startRow=s,t.startCol=0,e=this._findInLine(l,t,d),!e);s++);return!e&&p&&(t.startRow=p.start.y,t.startCol=0,e=this._findInLine(l,t,d)),this._selectResult(e,d?.decorations,d?.noScroll)}findPrevious(l,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let p=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||l!==this._cachedSearchTerm||p)&&this._highlightAllMatches(l,d);let h=this._findPreviousAndSelect(l,d);return this._fireResults(d),this._cachedSearchTerm=l,h}_didOptionsChange(l,d){return!!d&&(l.caseSensitive!==d.caseSensitive||l.regex!==d.regex||l.wholeWord!==d.wholeWord)}_fireResults(l){if(l?.decorations){let d=-1;if(this._selectedDecoration.value){let p=this._selectedDecoration.value.match;for(let h=0;h<this._highlightDecorations.length;h++){let i=this._highlightDecorations[h].match;if(i.row===p.row&&i.col===p.col&&i.size===p.size){d=h;break}}}this._onDidChangeResults.fire({resultIndex:d,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(l,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!l||l.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let p=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,t=!0;this._initLinesCache();let e={startRow:h,startCol:i},s;if(p&&(e.startRow=h=p.start.y,e.startCol=i=p.start.x,this._cachedSearchTerm!==l&&(s=this._findInLine(l,e,d,!1),s||(e.startRow=h=p.end.y,e.startCol=i=p.end.x))),s||(s=this._findInLine(l,e,d,t)),!s){e.startCol=Math.max(e.startCol,this._terminal.cols);for(let a=h-1;a>=0&&(e.startRow=a,s=this._findInLine(l,e,d,t),!s);a--);}if(!s&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let a=this._terminal.buffer.active.baseY+this._terminal.rows-1;a>=h&&(e.startRow=a,s=this._findInLine(l,e,d,t),!s);a--);return this._selectResult(s,d?.decorations,d?.noScroll)}_initLinesCache(){let l=this._terminal;this._linesCache||(this._linesCache=new Array(l.buffer.active.length),this._linesCacheDisposables.value=(0,n.getDisposeArrayDisposable)([l.onLineFeed((()=>this._destroyLinesCache())),l.onCursorMove((()=>this._destroyLinesCache())),l.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(l,d,p){return(l===0||c.includes(d[l-1]))&&(l+p.length===d.length||c.includes(d[l+p.length]))}_findInLine(l,d,p={},h=!1){let i=this._terminal,t=d.startRow,e=d.startCol;if(i.buffer.active.getLine(t)?.isWrapped)return h?void(d.startCol+=i.cols):(d.startRow--,d.startCol+=i.cols,this._findInLine(l,d,p));let a=this._linesCache?.[t];a||(a=this._translateBufferLineToStringWithWrap(t,!0),this._linesCache&&(this._linesCache[t]=a));let[f,v]=a,g=this._bufferColsToStringOffset(t,e),_=p.caseSensitive?l:l.toLowerCase(),m=p.caseSensitive?f:f.toLowerCase(),y=-1;if(p.regex){let E=RegExp(_,"g"),C;if(h)for(;C=E.exec(m.slice(0,g));)y=E.lastIndex-C[0].length,l=C[0],E.lastIndex-=l.length-1;else C=E.exec(m.slice(g)),C&&C[0].length>0&&(y=g+(E.lastIndex-C[0].length),l=C[0])}else h?g-_.length>=0&&(y=m.lastIndexOf(_,g-_.length)):y=m.indexOf(_,g);if(y>=0){if(p.wholeWord&&!this._isWholeWord(y,m,l))return;let E=0;for(;E<v.length-1&&y>=v[E+1];)E++;let C=E;for(;C<v.length-1&&y+l.length>=v[C+1];)C++;let w=y-v[E],R=y+l.length-v[C],P=this._stringLengthToBufferSize(t+E,w);return{term:l,col:P,row:t+E,size:this._stringLengthToBufferSize(t+C,R)-P+i.cols*(C-E)}}}_stringLengthToBufferSize(l,d){let p=this._terminal.buffer.active.getLine(l);if(!p)return 0;for(let h=0;h<d;h++){let i=p.getCell(h);if(!i)break;let t=i.getChars();t.length>1&&(d-=t.length-1);let e=p.getCell(h+1);e&&e.getWidth()===0&&d++}return d}_bufferColsToStringOffset(l,d){let p=this._terminal,h=l,i=0,t=p.buffer.active.getLine(h);for(;d>0&&t;){for(let e=0;e<d&&e<p.cols;e++){let s=t.getCell(e);if(!s)break;s.getWidth()&&(i+=s.getCode()===0?1:s.getChars().length)}if(h++,t=p.buffer.active.getLine(h),t&&!t.isWrapped)break;d-=p.cols}return i}_translateBufferLineToStringWithWrap(l,d){let p=this._terminal,h=[],i=[0],t=p.buffer.active.getLine(l);for(;t;){let e=p.buffer.active.getLine(l+1),s=!!e&&e.isWrapped,a=t.translateToString(!s&&d);if(s&&e){let f=t.getCell(t.length-1);f&&f.getCode()===0&&f.getWidth()===1&&e.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(h.push(a),!s)break;i.push(i[i.length-1]+a.length),l++,t=e}return[h.join(""),i]}_selectResult(l,d,p){let h=this._terminal;if(this._selectedDecoration.clear(),!l)return h.clearSelection(),!1;if(h.select(l.col,l.row,l.size),d){let i=h.registerMarker(-h.buffer.active.baseY-h.buffer.active.cursorY+l.row);if(i){let t=h.registerDecoration({marker:i,x:l.col,width:l.size,backgroundColor:d.activeMatchBackground,layer:"top",overviewRulerOptions:{color:d.activeMatchColorOverviewRuler}});if(t){let e=[];e.push(i),e.push(t.onRender((s=>this._applyStyles(s,d.activeMatchBorder,!0)))),e.push(t.onDispose((()=>(0,n.disposeArray)(e)))),this._selectedDecoration.value={decoration:t,match:l,dispose(){t.dispose()}}}}}if(!p&&(l.row>=h.buffer.active.viewportY+h.rows||l.row<h.buffer.active.viewportY)){let i=l.row-h.buffer.active.viewportY;i-=Math.floor(h.rows/2),h.scrollLines(i)}return!0}_applyStyles(l,d,p){l.classList.contains("xterm-find-result-decoration")||(l.classList.add("xterm-find-result-decoration"),d&&(l.style.outline=`1px solid ${d}`)),p&&l.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(l,d){let p=this._terminal,h=p.registerMarker(-p.buffer.active.baseY-p.buffer.active.cursorY+l.row);if(!h)return;let i=p.registerDecoration({marker:h,x:l.col,width:l.size,backgroundColor:d.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:d.matchOverviewRuler,position:"center"}});if(i){let t=[];t.push(h),t.push(i.onRender((e=>this._applyStyles(e,d.matchBorder,!1)))),t.push(i.onDispose((()=>(0,n.disposeArray)(t))))}return i}}D.SearchAddon=u})(),N})()))});var fi={};ni(fi,{apply:()=>ui,inject:()=>ci});module.exports=oi(fi);var ve=require("react");var ee=require("react");var he="zTerm";async function ie(I,A,O={},N){let D=I.connection;if(!D?.rpc?.call)throw new Error("\u5F53\u524D DSH \u7F3A\u5C11 Connection RPC\uFF0C\u8BF7\u4F7F\u7528\u5DF2\u652F\u6301\u7684\u5BBF\u4E3B\u7248\u672C");let r=await D.rpc.call("/api",`zterm/${A}`,O,N);if(!r.ok)throw new Error(r.error?.message||`${he} \u8BF7\u6C42\u5931\u8D25`);return r.value}function Qe(I,A,O="text/plain;charset=utf-8"){let N=URL.createObjectURL(new Blob([A],{type:O})),D=document.createElement("a");D.href=N,D.download=I,D.click(),URL.revokeObjectURL(N)}function et(){return new Date().toISOString().replace(/[-:]/g,"").replace(/T/,"-").slice(0,15)}function xt(I,A){let O=new Map(I);if(A.reset){O.clear();for(let N of A.snapshots??[])O.set(N.terminalId,{generation:N.generation,text:N.text,seq:A.cursor})}for(let N of A.output??[]){let D=O.get(N.terminalId);D&&D.generation===N.generation&&N.seq<=D.seq||O.set(N.terminalId,{generation:N.generation,text:`${D&&D.generation===N.generation?D.text:""}${N.text}`.slice(-5e5),seq:N.seq})}for(let N of O.keys())A.workspace.terminals.some(D=>D.id===N)||O.delete(N);return O}var ue=require("react"),It=_t(kt(),1),Ot=_t(Dt(),1),Pt=_t(Lt(),1);var Ue=require("react");function Ke(I,A,O,N){try{let D=localStorage.getItem(I),r=D===null?A:Number(D);return Number.isFinite(r)?Math.max(O,Math.min(N,r)):A}catch{return A}}function Ve(I,A){try{localStorage.setItem(I,String(A))}catch{}}var We=12,rt=8,nt=32,gt="dsh-zterm.terminal-font-size",qe=new Set,ot;function At(I){return Number.isInteger(I)&&I>=rt&&I<=nt}function mt(){try{let I=localStorage.getItem(gt),A=I===null?We:Number(I);return At(A)?A:We}catch{return ot??We}}function Tt(){return ot??=mt()}function Bt(I){I!==Tt()&&(ot=I,qe.forEach(A=>A()))}function Mt(I){At(I)&&(Bt(I),Ve(gt,I))}function Rt(I){(I.key===gt||I.key===null)&&Bt(mt())}function ai(I){return!qe.size&&typeof window<"u"&&(ot=mt(),window.addEventListener("storage",Rt)),qe.add(I),()=>{qe.delete(I),!qe.size&&typeof window<"u"&&window.removeEventListener("storage",Rt)}}function at(){return(0,Ue.useSyncExternalStore)(ai,Tt,()=>We)}function lt(){let I=(0,Ue.useRef)(()=>{});return(0,Ue.useEffect)(()=>()=>I.current(),[]),(A,O)=>{A.preventDefault(),I.current();let N=()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",N),I.current=()=>{}};I.current=N,window.addEventListener("mousemove",O),window.addEventListener("mouseup",N,{once:!0})}}var De=require("react/jsx-runtime");function zt({ctx:I,sessionId:A,terminal:O,buffer:N,visible:D,onError:r}){let n=(0,ue.useRef)(null),c=(0,ue.useRef)(),u=(0,ue.useRef)(),o=(0,ue.useRef)(),l=(0,ue.useRef)(""),d=(0,ue.useRef)(O),p=(0,ue.useRef)(r),h=(0,ue.useRef)(Promise.resolve()),i=(0,ue.useRef)(()=>{}),[t,e]=(0,ue.useState)(""),s=at(),a=(0,ue.useRef)(s);return a.current=s,d.current=O,p.current=r,(0,ue.useLayoutEffect)(()=>{if(!n.current)return;let f=new It.Terminal({cursorBlink:!0,fontSize:a.current,fontFamily:"Menlo, Consolas, monospace",scrollback:5e3,allowProposedApi:!1,convertEol:!1,theme:{background:"#12161d",foreground:"#dce3ed",cursor:"#e4edf8",selectionBackground:"#334b66"}}),v=new Ot.FitAddon,g=new Pt.SearchAddon;f.loadAddon(v),f.loadAddon(g),f.open(n.current),c.current=f,o.current=v,u.current=g,l.current="";let _=!1,m=f.onData(R=>{let P=d.current;P.state==="ready"&&(h.current=h.current.catch(()=>{}).then(async()=>{_||await ie(I,"input",{sessionId:A,terminalId:P.id,generation:P.generation,data:R})}).catch(U=>{_||p.current(U.message)}))}),y;i.current=()=>{if(_||!n.current?.clientWidth)return;v.fit();let R=d.current;R.state==="ready"&&ie(I,"resize",{sessionId:A,terminalId:R.id,generation:R.generation,cols:f.cols,rows:f.rows}).catch(P=>{_||p.current(P.message)})};let E=()=>{clearTimeout(y),y=setTimeout(()=>i.current(),80)},C=new ResizeObserver(E);C.observe(n.current),E();let w=R=>{(R.metaKey||R.ctrlKey)&&R.key.toLowerCase()==="f"&&(R.preventDefault(),document.getElementById(`zterm-find-${O.id}`)?.focus())};return n.current.addEventListener("keydown",w),()=>{_=!0,i.current=()=>{},clearTimeout(y),C.disconnect(),m.dispose(),n.current?.removeEventListener("keydown",w),f.dispose(),c.current=void 0}},[I,A,O.id,O.generation]),(0,ue.useEffect)(()=>{let f=c.current;!f||!N||N.generation!==O.generation||(N.text.startsWith(l.current)?f.write(N.text.slice(l.current.length)):(f.reset(),f.write(N.text)),l.current=N.text)},[N,O.generation]),(0,ue.useLayoutEffect)(()=>{let f=c.current;!f||f.options.fontSize===s||(f.options.fontSize=s,D&&i.current())},[s,D]),(0,ue.useEffect)(()=>{D&&(i.current(),c.current?.focus())},[D,O.state,O.generation]),(0,De.jsxs)("div",{className:"zt-terminal-screen",style:{display:D?"flex":"none"},children:[(0,De.jsxs)("div",{className:"zt-terminal-search",children:[(0,De.jsx)("input",{id:`zterm-find-${O.id}`,"aria-label":"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",placeholder:"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",value:t,onChange:f=>{e(f.target.value),u.current?.findNext(f.target.value)},onKeyDown:f=>{f.key==="Enter"&&u.current?.findNext(t),f.key==="Escape"&&(e(""),c.current?.focus())}}),(0,De.jsx)("button",{title:"\u4E0A\u4E00\u4E2A\u5339\u914D",onClick:()=>u.current?.findPrevious(t),children:"\u2191"}),(0,De.jsx)("button",{title:"\u4E0B\u4E00\u4E2A\u5339\u914D",onClick:()=>u.current?.findNext(t),children:"\u2193"}),(0,De.jsx)("span",{children:"\u7EC8\u7AEF\u8F93\u5165\u76F4\u63A5\u64CD\u4F5C\u5F53\u524D\u673A\u5668"})]}),(0,De.jsx)("div",{className:"zt-terminal-canvas",ref:n})]})}var ce=require("react");var Ie={password:"\u5BC6\u7801",key:"\u79C1\u94A5\u5185\u5BB9","key-file":"\u79C1\u94A5\u6587\u4EF6"};var Ht=require("react"),Oe=require("react/jsx-runtime");function Ge(I){let A=new Map;for(let r of I){let n=r.parentId??"";A.set(n,[...A.get(n)??[],r])}let O=(A.get("")??[]).slice().reverse().map(r=>({...r,depth:0})),N=[],D=new Set;for(;O.length;){let r=O.pop();if(!D.has(r.id)){D.add(r.id),N.push(r);for(let n of(A.get(r.id)??[]).slice().reverse())O.push({...n,depth:r.depth+1})}}return N}function Ft({folders:I,selected:A,onSelect:O}){let[N,D]=(0,Ht.useState)(new Set),r=Ge(I),n=new Set,c=new Set(I.map(u=>u.parentId));return(0,Oe.jsxs)("nav",{className:"zt-folder-tree","aria-label":"\u4E3B\u673A\u6587\u4EF6\u5939",children:[(0,Oe.jsx)("button",{className:A===""?"active":"",onClick:()=>O(""),children:"\u25B1 \u6839\u76EE\u5F55(\u5168\u90E8\u4E3B\u673A)"}),r.map(u=>u.parentId&&(N.has(u.parentId)||n.has(u.parentId))?(n.add(u.id),null):(0,Oe.jsxs)("div",{style:{paddingLeft:Math.min(8,u.depth)*12},children:[(0,Oe.jsx)("button",{className:"zt-folder-toggle","aria-label":`${N.has(u.id)?"\u5C55\u5F00":"\u6536\u8D77"}\u6587\u4EF6\u5939 ${u.label}`,disabled:!c.has(u.id),onClick:()=>D(o=>{let l=new Set(o);return l.has(u.id)?l.delete(u.id):l.add(u.id),l}),children:c.has(u.id)?N.has(u.id)?"\u25B8":"\u25BE":"\xB7"}),(0,Oe.jsxs)("button",{className:A===u.id?"active":"",onClick:()=>O(u.id),title:u.label,children:["\u25B1 ",u.label]})]},u.id))]})}var W=require("react/jsx-runtime");function Pe({title:I,children:A,onClose:O}){let N=(0,ce.useRef)(null),D=(0,ce.useRef)(O);return D.current=O,(0,ce.useEffect)(()=>{let r=document.activeElement,n=N.current;(n?.querySelector("input,select,textarea")??n?.querySelector("button")??n)?.focus();let c=u=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),D.current();return}if(u.key!=="Tab")return;let o=[...n?.querySelectorAll('button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')??[]].filter(p=>p.offsetParent!==null),l=o[0],d=o.at(-1);l?u.shiftKey&&(document.activeElement===l||document.activeElement===n)?(u.preventDefault(),d?.focus()):!u.shiftKey&&document.activeElement===d&&(u.preventDefault(),l.focus()):(u.preventDefault(),n?.focus())};return n?.addEventListener("keydown",c),()=>{n?.removeEventListener("keydown",c),r?.isConnected&&r.focus()}},[]),(0,W.jsx)("div",{className:"zt-modal-shade",onMouseDown:r=>{r.target===r.currentTarget&&O()},children:(0,W.jsxs)("section",{ref:N,tabIndex:-1,className:"zt-modal",role:"dialog","aria-modal":"true","aria-label":I,children:[(0,W.jsxs)("header",{children:[(0,W.jsx)("strong",{children:I}),(0,W.jsx)("button",{"aria-label":"\u5173\u95ED\u5BF9\u8BDD\u6846",onClick:O,children:"\xD7"})]}),A]})})}function fe({title:I,children:A}){return(0,W.jsxs)("label",{className:"zt-field",children:[(0,W.jsx)("span",{children:I}),A]})}function Nt({ctx:I,host:A,folders:O,credentials:N=[],defaultCredentialId:D,revision:r,onClose:n,onSaved:c}){let[u,o]=(0,ce.useState)({label:A?.label??"",host:A?.host??"",port:String(A?.port??22),username:A?.username??"",authType:A?.authType??"key-file",privateKeyPath:A?.privateKeyPath??"",folderId:A?.folderId??""}),[l,d]=(0,ce.useState)(""),[p,h]=(0,ce.useState)(""),[i,t]=(0,ce.useState)(!1),[e,s]=(0,ce.useState)(""),[a,f]=(0,ce.useState)(!1),[v,g]=(0,ce.useState)(A?.credentialId||!A&&N.length?"saved":A?.authType??"key-file"),[_,m]=(0,ce.useState)(A?.credentialId||D||N[0]?.id||""),y=A&&!A.credentialId&&A.authType===v,E=(C,w)=>o(R=>({...R,[C]:w}));return(0,W.jsx)(Pe,{title:A?"\u7F16\u8F91\u8FDC\u7A0B\u4E3B\u673A":"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A",onClose:n,children:(0,W.jsxs)("form",{onSubmit:C=>{C.preventDefault(),f(!0),s(""),ie(I,"host/save",{host:{...A,...u,credentialId:v==="saved"?_:void 0,folderId:u.folderId||void 0,port:Number(u.port),kind:"ssh"},secret:v==="saved"?"":l,passphrase:v==="saved"?"":p,clearPassphrase:i,revision:r}).then(()=>{d(""),h(""),c(),n()}).catch(w=>s(w.message)).finally(()=>f(!1))},children:[(0,W.jsx)(fe,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:u.label,onChange:C=>E("label",C.target.value)})}),(0,W.jsxs)("div",{className:"zt-form-row",children:[(0,W.jsx)(fe,{title:"\u4E3B\u673A\u5730\u5740",children:(0,W.jsx)("input",{required:!0,value:u.host,placeholder:"\u4E3B\u673A\u540D\u6216 IP",onChange:C=>E("host",C.target.value)})}),(0,W.jsx)(fe,{title:"\u7AEF\u53E3",children:(0,W.jsx)("input",{type:"number",required:!0,min:"1",max:"65535",value:u.port,onChange:C=>E("port",C.target.value)})})]}),(0,W.jsx)(fe,{title:"\u767B\u5F55\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:u.username,onChange:C=>E("username",C.target.value)})}),(0,W.jsx)(fe,{title:"\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:u.folderId,onChange:C=>E("folderId",C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ge(O).map(C=>(0,W.jsxs)("option",{value:C.id,children:["\u3000".repeat(Math.min(8,C.depth)),C.label]},C.id))]})}),(0,W.jsx)(fe,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:v,onChange:C=>{g(C.target.value),C.target.value!=="saved"&&E("authType",C.target.value),d(""),h(""),t(!1)},children:[(0,W.jsx)("option",{value:"saved",children:"\u9009\u62E9\u5DF2\u4FDD\u5B58\u51ED\u8BC1"}),(0,W.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,W.jsx)("option",{value:"key",children:"\u79C1\u94A5\u5185\u5BB9"}),(0,W.jsx)("option",{value:"key-file",children:"\u79C1\u94A5\u6587\u4EF6"})]})}),v==="saved"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{title:"\u767B\u5F55\u51ED\u8BC1",children:(0,W.jsxs)("select",{required:!0,value:_,onChange:C=>m(C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u8BF7\u9009\u62E9\u51ED\u8BC1"}),N.map(C=>(0,W.jsxs)("option",{value:C.id,children:[C.label," \xB7 ",Ie[C.authType]]},C.id))]})}),(0,W.jsx)("p",{className:"zt-hint",children:"\u51ED\u8BC1\u5728\u300C\u8BBE\u7F6E \u2192 zTerm \u2192 \u7BA1\u7406\u51ED\u8BC1\u300D\u4E2D\u4FDD\u5B58\uFF0C\u6B64\u5904\u65E0\u9700\u518D\u586B\u5185\u5BB9\u6216\u8DEF\u5F84\u3002"})]}),["password","key"].includes(v)&&(0,W.jsx)(fe,{title:u.authType==="key"?"\u79C1\u94A5\u5185\u5BB9":"\u5BC6\u7801",children:u.authType==="key"?(0,W.jsx)("textarea",{rows:5,value:l,placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9",onChange:C=>d(C.target.value),spellCheck:!1,required:!y}):(0,W.jsx)("input",{type:"password",value:l,autoComplete:"new-password",placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>d(C.target.value),required:!y})}),v==="key-file"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{title:"\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84",children:(0,W.jsx)("input",{value:u.privateKeyPath,placeholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6",onChange:C=>E("privateKeyPath",C.target.value)})}),(0,W.jsx)("p",{className:"zt-hint",children:"\u586B\u5199 DSH \u5BBF\u4E3B\u4E0A\u7684\u7EDD\u5BF9\u8DEF\u5F84\u6216 ~/ \u8DEF\u5F84\u3002DSH \u90E8\u7F72\u5728\u8FDC\u7AEF\u65F6\uFF0C\u586B\u5199\u8FDC\u7AEF\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})]}),["key","key-file"].includes(v)&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{title:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09",children:(0,W.jsx)("input",{type:"password",disabled:i,value:p,placeholder:"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4",onChange:C=>h(C.target.value)})}),A?.passphraseRef&&(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:i,onChange:C=>t(C.target.checked)}),"\u79FB\u9664\u6B64\u4E3B\u673A\u7684\u79C1\u94A5\u53E3\u4EE4\u5F15\u7528"]})]}),(0,W.jsx)("p",{className:"zt-hint",children:"\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u4FDD\u5B58\u5728 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u7531\u5BBF\u4E3B\u8BFB\u53D6\u3002\u6240\u6709\u65B0\u8FDE\u63A5\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\u3002"}),e&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:e}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:n,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:a,children:a?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u4E3B\u673A"})]})]})})}function Wt({ctx:I,profile:A,revision:O,onClose:N,onSaved:D}){let[r,n]=(0,ce.useState)({label:A?.label??"",baseUrl:A?.baseUrl??"",authMode:A?.authMode??"access_key",username:A?.username??"",verifyTls:A?.verifyTls??!0}),[c,u]=(0,ce.useState)(""),[o,l]=(0,ce.useState)(""),[d,p]=(0,ce.useState)(""),[h,i]=(0,ce.useState)(!1);return(0,W.jsx)(Pe,{title:A?"\u7F16\u8F91 JumpServer":"\u6DFB\u52A0 JumpServer",onClose:N,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),i(!0),p(""),ie(I,"jump/save",{profile:{...A,...r},secret:c,accessKeyId:o,revision:O}).then(()=>{u(""),l(""),D(),N()}).catch(e=>p(e.message)).finally(()=>i(!1))},children:[(0,W.jsx)(fe,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:r.label,onChange:t=>n({...r,label:t.target.value})})}),(0,W.jsx)(fe,{title:"\u670D\u52A1\u5730\u5740",children:(0,W.jsx)("input",{required:!0,type:"url",value:r.baseUrl,placeholder:"https://jump.example.com",onChange:t=>n({...r,baseUrl:t.target.value})})}),(0,W.jsx)(fe,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:r.authMode,onChange:t=>n({...r,authMode:t.target.value}),children:[(0,W.jsx)("option",{value:"access_key",children:"Access Key"}),(0,W.jsx)("option",{value:"token",children:"Token"}),(0,W.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"})]})}),r.authMode==="access_key"&&(0,W.jsx)(fe,{title:"Access Key ID",children:(0,W.jsx)("input",{type:"password",value:o,placeholder:A?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>l(t.target.value)})}),r.authMode==="password"&&(0,W.jsx)(fe,{title:"\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:r.username,onChange:t=>n({...r,username:t.target.value})})}),(0,W.jsx)(fe,{title:r.authMode==="access_key"?"Access Key Secret":r.authMode==="token"?"Token":"\u5BC6\u7801",children:(0,W.jsx)("input",{type:"password",value:c,placeholder:A?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>u(t.target.value)})}),(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:r.verifyTls,onChange:t=>n({...r,verifyTls:t.target.checked})}),"\u9A8C\u8BC1 TLS \u8BC1\u4E66"]}),(0,W.jsx)("p",{className:"zt-hint",children:"\u8FDE\u63A5\u4F7F\u7528\u8D44\u4EA7\u4E0E\u8D26\u53F7\u7684\u7A33\u5B9A ID\uFF0C\u4EE4\u724C\u4EC5\u5728\u5BBF\u4E3B\u5185\u90E8\u5904\u7406\u3002"}),d&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:d}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:N,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u5B9E\u4F8B"})]})]})})}function Ut({ctx:I,folder:A,folders:O,revision:N,onClose:D,onSaved:r}){let[n,c]=(0,ce.useState)(A?.label??""),[u,o]=(0,ce.useState)(A?.parentId??""),[l,d]=(0,ce.useState)(""),[p,h]=(0,ce.useState)(!1),i=new Set;if(A){i.add(A.id);for(let t of Ge(O))t.parentId&&i.has(t.parentId)&&i.add(t.id)}return(0,W.jsx)(Pe,{title:A?"\u7F16\u8F91\u4E3B\u673A\u6587\u4EF6\u5939":"\u65B0\u5EFA\u4E3B\u673A\u6587\u4EF6\u5939",onClose:D,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),h(!0),ie(I,"folder/save",{folder:{id:A?.id,label:n,parentId:u||void 0},revision:N}).then(()=>{r(),D()}).catch(e=>d(e.message)).finally(()=>h(!1))},children:[(0,W.jsx)(fe,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:n,onChange:t=>c(t.target.value)})}),(0,W.jsx)(fe,{title:"\u7236\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:u,onChange:t=>o(t.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ge(O).filter(t=>!i.has(t.id)).map(t=>(0,W.jsxs)("option",{value:t.id,children:["\u3000".repeat(Math.min(8,t.depth)),t.label]},t.id))]})}),l&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:l}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:D,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{disabled:p,className:"zt-primary",children:p?"\u4FDD\u5B58\u4E2D\u2026":A?"\u4FDD\u5B58":"\u521B\u5EFA"})]})]})})}var Le=require("react");var Ae=require("react/jsx-runtime");function $t({ctx:I,instanceId:A,nodes:O,selected:N,onSelect:D,onError:r}){let[n,c]=(0,Le.useState)(new Map),[u,o]=(0,Le.useState)(new Set),[l,d]=(0,Le.useState)(new Set),p=(0,Le.useRef)(!0),h=(0,Le.useRef)(new AbortController);(0,Le.useEffect)(()=>()=>{p.current=!1,h.current.abort()},[]);let i=async a=>{if(u.has(a.nodeId)){o(f=>{let v=new Set(f);return v.delete(a.nodeId),v});return}if(!n.has(a.nodeId)){d(f=>new Set(f).add(a.nodeId));try{let f=await ie(I,"jump/query",{instanceId:A,operation:"nodes",parentKey:a.key||a.nodeId},h.current.signal);if(!p.current)return;c(v=>new Map(v).set(a.nodeId,f.nodes??[]))}catch(f){p.current&&r(f.message);return}finally{p.current&&d(f=>{let v=new Set(f);return v.delete(a.nodeId),v})}}o(f=>new Set(f).add(a.nodeId))},t=O.slice().reverse().map(a=>({node:a,depth:0})),e=[],s=new Set;for(;t.length&&e.length<500;){let a=t.pop();if(!s.has(a.node.nodeId)&&(s.add(a.node.nodeId),e.push(a),u.has(a.node.nodeId)))for(let f of(n.get(a.node.nodeId)??[]).slice().reverse())t.push({node:f,depth:a.depth+1})}return(0,Ae.jsxs)("nav",{className:"zt-folder-tree","aria-label":"JumpServer \u8D44\u4EA7\u8282\u70B9",children:[(0,Ae.jsx)("button",{className:N?"":"active",onClick:()=>D(""),children:"\u25A4 \u5168\u90E8\u8D44\u4EA7"}),e.map(({node:a,depth:f})=>(0,Ae.jsxs)("div",{style:{paddingLeft:Math.min(8,f)*12},children:[(0,Ae.jsx)("button",{className:"zt-folder-toggle",disabled:!a.hasChildren||l.has(a.nodeId),"aria-label":`\u5C55\u5F00\u8D44\u4EA7\u8282\u70B9 ${a.name}`,onClick:()=>void i(a),children:l.has(a.nodeId)?"\u2026":a.hasChildren?u.has(a.nodeId)?"\u25BE":"\u25B8":"\xB7"}),(0,Ae.jsxs)("button",{className:N===a.nodeId?"active":"",onClick:()=>D(a.nodeId),title:a.name,children:[a.name," (",a.assetCount,")"]})]},a.nodeId)),t.length>0&&(0,Ae.jsx)("p",{className:"zt-hint",children:"\u8282\u70B9\u663E\u793A\u5DF2\u8FBE 500 \u9879\uFF0C\u8BF7\u6536\u8D77\u90E8\u5206\u8282\u70B9\u3002"})]})}var B=require("react/jsx-runtime"),jt={terminals:[],operations:[],revision:0,capabilities:{local:!1,external:!1},hostPlatform:""},qt={connecting:"\u8FDE\u63A5\u4E2D",ready:"\u5DF2\u8FDE\u63A5",disconnected:"\u5DF2\u65AD\u5F00",error:"\u8FDE\u63A5\u5931\u8D25",executing:"\u6267\u884C\u4E2D",completed:"\u5B8C\u6210",failed:"\u5931\u8D25",unknown:"\u7ED3\u679C\u4E0D\u660E",blocked:"\u5DF2\u62D2\u7EDD",not_sent:"\u672A\u4E0B\u53D1"},ht=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`page-${Date.now()}-${Math.random()}`;function St({ctx:I,sessionId:A,visible:O=!0,onClose:N}){let[D,r]=(0,ee.useState)(jt),[n,c]=(0,ee.useState)(new Map),[u,o]=(0,ee.useState)(""),[l,d]=(0,ee.useState)(""),[p,h]=(0,ee.useState)(),[i,t]=(0,ee.useState)(""),[e,s]=(0,ee.useState)(0),[a,f]=(0,ee.useState)(""),[v,g]=(0,ee.useState)("ssh"),[_,m]=(0,ee.useState)(!1),[y,E]=(0,ee.useState)(!1),[C,w]=(0,ee.useState)(!1),[R,P]=(0,ee.useState)(""),[U,K]=(0,ee.useState)(""),[$,S]=(0,ee.useState)([]),[x,k]=(0,ee.useState)(),[L,H]=(0,ee.useState)(),[q,X]=(0,ee.useState)(),[Z,T]=(0,ee.useState)(!1),[b,z]=(0,ee.useState)(!1),[F,V]=(0,ee.useState)(()=>Ke("dsh-zterm.list-width",240,180,440)),[j,te]=(0,ee.useState)(!1),[ne,oe]=(0,ee.useState)(!1),[_e,J]=(0,ee.useState)(),Se=(0,ee.useRef)(!0),ze=(0,ee.useRef)(O),Te=(0,ee.useRef)(-1),He=(0,ee.useRef)(async()=>{}),Be=(0,ee.useRef)(u),ge=(0,ee.useRef)(0),xe=(0,ee.useRef)(0),be=(0,ee.useRef)(null),Re=(0,ee.useRef)(null),$e=lt();ze.current=O,Be.current=u;let se=(0,ee.useCallback)(M=>d(M),[]);(0,ee.useEffect)(()=>{Se.current=!0,r(jt),c(new Map),Te.current=-1;let M=!1,re=!1,le,Me,Ne=new AbortController,Qt=async()=>{try{re||(await ie(I,"client/attach",{sessionId:A,pageId:ht},Ne.signal),re=!0);let Ee=await ie(I,"poll",{sessionId:A,cursor:Te.current},Ne.signal);if(M)return;Te.current=Ee.cursor,r(Ee.workspace),c(dt=>xt(dt,Ee)),Ee.workspace.terminals.some(dt=>dt.id===Be.current)||o(Ee.workspace.terminals[0]?.id??"")}catch(Ee){M||d(Ee instanceof Error?Ee.message:"\u65E0\u6CD5\u8BFB\u53D6\u7EC8\u7AEF\u72B6\u6001")}},Ct=()=>Me||(Me=Qt().finally(()=>{Me=void 0}),Me),wt=async()=>{await Ct(),M||(le=setTimeout(wt,ze.current?200:1e3))};return He.current=Ct,wt(),ie(I,"saved-workspace",{sessionId:A}).then(Ee=>{M||oe(Ee.length>0)}).catch(()=>{}),()=>{M=!0,Se.current=!1,clearTimeout(le),Ne.abort()}},[I,A]);let Ce=(0,ee.useCallback)(async M=>{let re=++ge.current,le=await ie(I,"catalog",{query:i,offset:e,folderId:a||void 0},M);M?.aborted||re!==ge.current||!Se.current||(h(le),!R&&le.jumpservers.length&&P(le.jumpservers[0].id))},[I,i,e,a,R]);(0,ee.useEffect)(()=>{let M=new AbortController,re=setTimeout(()=>{Ce(M.signal).catch(le=>{M.signal.aborted||se(le.message)})},150);return()=>{clearTimeout(re),M.abort()}},[Ce,se,D.catalogRevision]);let ae=(0,ee.useCallback)(async(M,re={})=>{te(!0),d("");try{let le=await ie(I,M,{sessionId:A,pageId:ht,...re});if(Se.current)return await He.current(),le}catch(le){Se.current&&se(le instanceof Error?le.message:"\u64CD\u4F5C\u5931\u8D25")}finally{Se.current&&te(!1)}},[I,A,se]),ke=async M=>{let re=await ae("connect",{target:M});re?.id&&o(re.id)};(0,ee.useEffect)(()=>{if(!O||!be.current)return;let M=()=>Re.current?.scrollIntoView({block:"nearest",inline:"nearest"});M();let re=new ResizeObserver(M);return re.observe(be.current),()=>re.disconnect()},[u,O,D.terminals.length]);let Y=D.terminals.find(M=>M.id===u),ye=D.binding,Je=Y&&ye?.terminalId===Y.id&&ye.generation===Y.generation,pe=D.terminals.find(M=>M.trust),Fe=pe?{terminalId:pe.id,generation:pe.generation}:{},Xe=M=>M.target.source==="local"?M.target.label:`${M.target.username??""}@${M.target.host??M.target.label}${M.target.port?`:${M.target.port}`:""}`,je=Y?{terminalId:Y.id,generation:Y.generation}:{},Ye=p?.jumpservers?.find(M=>M.id===R);(0,ee.useEffect)(()=>{if(v!=="jumpserver"||!R)return;let M=!0;return S([]),ie(I,"jump/query",{instanceId:R,operation:"nodes"}).then(re=>{M&&S(re.nodes??[])}).catch(re=>{M&&se(re.message)}),()=>{M=!1}},[I,R,v,se]),(0,ee.useEffect)(()=>{if(v!=="jumpserver"||!R)return;let M=!0;k(void 0);let re=setTimeout(()=>{ie(I,"jump/query",{instanceId:R,operation:"assets",nodeId:U||void 0,query:i,offset:e,limit:100}).then(le=>{M&&k(le)}).catch(le=>{M&&se(le.message)})},200);return()=>{M=!1,clearTimeout(re)}},[I,R,U,i,e,v,se]),(0,ee.useEffect)(()=>{xe.current++,H(void 0)},[R,v]);let Yt=async M=>{let re=++xe.current;X(M),H(void 0);try{let le=await ie(I,"jump/query",{instanceId:R,operation:"accounts",assetId:M.assetId});re===xe.current&&Se.current&&H(le.accounts)}catch(le){re===xe.current&&Se.current&&se(le.message)}},Zt=M=>{let re=M.clientX,le=F;$e(M,Me=>{let Ne=Math.max(180,Math.min(440,le+re-Me.clientX));V(Ne),Ve("dsh-zterm.list-width",Ne)})};return(0,B.jsxs)("div",{className:"zt-workbench",children:[l&&(0,B.jsxs)("div",{className:"zt-error-banner",role:"alert",children:[(0,B.jsx)("span",{children:l}),(0,B.jsx)("button",{"aria-label":"\u5173\u95ED\u9519\u8BEF\u63D0\u793A",onClick:()=>d(""),children:"\xD7"})]}),(0,B.jsxs)("div",{className:"zt-workbench-body",children:[(0,B.jsxs)("main",{className:"zt-terminal-area",children:[(0,B.jsxs)("div",{className:"zt-terminal-topbar",children:[(0,B.jsx)("nav",{ref:be,className:"zt-terminal-tabs","aria-label":"\u7EC8\u7AEF\u6807\u7B7E",children:D.terminals.map(M=>(0,B.jsxs)("div",{ref:M.id===u?Re:void 0,className:`zt-tab ${M.id===u?"active":""}`,children:[(0,B.jsxs)("button",{onClick:()=>o(M.id),title:Xe(M),children:[(0,B.jsx)("i",{className:`zt-state-dot ${M.state}`}),M.target.label]}),(0,B.jsx)("button",{"aria-label":`\u5173\u95ED\u7EC8\u7AEF ${M.target.label}`,onClick:()=>J({text:`\u5173\u95ED\u300C${M.target.label}\u300D\u7684\u7EC8\u7AEF\u8FDE\u63A5\uFF1F`,act:()=>{ae("close",{terminalId:M.id}),J(void 0)}}),children:"\xD7"})]},M.id))}),(0,B.jsxs)("div",{className:"zt-terminal-controls",children:[(0,B.jsx)("button",{disabled:!D.capabilities.local||j,title:D.capabilities.local?"\u6BCF\u6B21\u70B9\u51FB\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\uFF0C\u8FD0\u884C\u5728 DSH \u6240\u5728\u7684\u673A\u5668\u4E0A":`\u8BF7\u5728 ${he} \u8BBE\u7F6E\u4E2D\u542F\u7528\u672C\u5730\u7EC8\u7AEF\u5E76\u4FDD\u5B58`,onClick:()=>void ke({kind:"local"}),children:"\u6253\u5F00\u672C\u673A\u7EC8\u7AEF"}),(0,B.jsx)("button",{title:"\u64CD\u4F5C\u8BB0\u5F55",onClick:()=>T(!Z),children:"\u8BB0\u5F55"}),(0,B.jsx)("button",{title:"\u663E\u793A\u6216\u6536\u8D77\u4E3B\u673A\u5217\u8868",onClick:()=>z(!b),children:b?"\u4E3B\u673A\u5217\u8868":"\u6536\u8D77\u5217\u8868"}),N&&(0,B.jsx)("button",{"aria-label":`\u6536\u8D77 ${he}`,onClick:N,children:"\xD7"})]})]}),Y?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-terminal-toolbar",children:[(0,B.jsxs)("div",{className:"zt-target",title:Xe(Y),children:[Xe(Y),(0,B.jsxs)("span",{children:[qt[Y.state],Y.busy?" \xB7 AI \u6267\u884C\u4E2D":""]})]}),(0,B.jsxs)("div",{className:"zt-actions",children:[(0,B.jsx)("button",{disabled:j||Y.state!=="ready"||!Y.agentReady||Y.uncertain,onClick:()=>void ae("bind",je),children:Je?"\u5DF2\u7ED1\u5B9A AI":"\u7ED1\u5B9A AI"}),(0,B.jsxs)("label",{className:`zt-mode ${Je&&ye.mode==="readwrite"?"write":""}`,title:"\u672A\u52FE\u9009\uFF1A\u8BFB\u6A21\u5F0F\uFF0CAI \u4EC5\u53EF\u4F7F\u7528\u5185\u7F6E\u67E5\u8BE2\u5DE5\u5177\uFF1B\u52FE\u9009\uFF1A\u8BFB\u5199\u6A21\u5F0F\uFF0CAI \u53EF\u6267\u884C\u5DF2\u6388\u6743\u7684\u547D\u4EE4\u3002",children:[(0,B.jsx)("input",{type:"checkbox","aria-label":"\u5141\u8BB8AI\u5199\u64CD\u4F5C",checked:!!(Je&&ye.mode==="readwrite"),disabled:!Je||j||!Y.agentReady||Y.uncertain,onChange:M=>void ae("mode",{...je,mode:M.target.checked?"readwrite":"read"})}),"\u5141\u8BB8AI\u5199\u64CD\u4F5C"]}),(0,B.jsx)("button",{disabled:!Y.busy,onClick:()=>void ae("stop",je),children:"\u505C\u6B62"}),(0,B.jsx)("button",{disabled:j||Y.busy,onClick:()=>void ae(Y.state==="ready"?"disconnect":"reconnect",je),children:Y.state==="ready"?"\u65AD\u5F00":"\u91CD\u8FDE"})]})]}),!Y.agentReady&&Y.state==="ready"&&!Y.uncertain&&(0,B.jsxs)("div",{className:"zt-notice",children:["\u624B\u5DE5\u8F93\u5165\u540E\uFF0CAI \u5DF2\u6682\u505C\u64CD\u4F5C\u3002\u786E\u8BA4\u7EC8\u7AEF\u56DE\u5230\u7A7A\u95F2 Shell \u540E\uFF1A",(0,B.jsx)("button",{onClick:()=>void ae("shell-ready",je),children:"\u786E\u8BA4\u7A7A\u95F2 Shell"})]}),Y.uncertain&&(0,B.jsx)("div",{className:"zt-notice danger",children:"\u524D\u6B21\u64CD\u4F5C\u7ED3\u679C\u4E0D\u660E\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u4E0B\u53D1\u3002\u6838\u5B9E\u673A\u5668\u72B6\u6001\u540E\u91CD\u65B0\u5EFA\u7ACB\u8FDE\u63A5\u3002"}),Y.error&&(0,B.jsx)("div",{className:"zt-notice danger",children:Y.error})]}):(0,B.jsxs)("div",{className:"zt-empty",children:[(0,B.jsx)("div",{className:"zt-terminal-mark",children:">_"}),(0,B.jsx)("h3",{children:"\u8FDE\u63A5\u4E00\u53F0\u673A\u5668"}),(0,B.jsxs)("p",{children:["\u4ECE\u53F3\u4FA7\u9009\u62E9\u4E3B\u673A\u6216 JumpServer \u8D44\u4EA7\u3002",(0,B.jsx)("br",{}),"\u8FDE\u63A5\u540E\u53EF\u624B\u5DE5\u64CD\u4F5C\uFF0C\u6216\u7ED1\u5B9A\u7ED9\u5F53\u524D DSH \u5BF9\u8BDD\u4E2D\u7684 AI\u3002"]}),D.capabilities.automatic&&(0,B.jsx)("p",{children:"\u4E5F\u53EF\u5728\u5BF9\u8BDD\u4E2D\u6307\u5B9A\u4E3B\u673A\u540D\u6216 IP\uFF0CAI \u4F1A\u5148\u67E5\u8FDC\u7A0B\u4E3B\u673A\uFF0C\u518D\u67E5 JumpServer\uFF0C\u6700\u540E\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u3002"}),(0,B.jsx)("button",{className:"zt-primary",onClick:()=>m(null),children:"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A"}),ne&&(0,B.jsx)("button",{onClick:()=>void ae("restore"),children:"\u6062\u590D\u4E0A\u6B21\u7EC8\u7AEF\u5217\u8868\uFF08\u9ED8\u8BA4\u53EA\u8BFB\uFF09"})]}),(0,B.jsx)("div",{className:"zt-screens",children:D.terminals.map(M=>(0,B.jsx)(zt,{ctx:I,sessionId:A,terminal:M,buffer:n.get(M.id),visible:O&&M.id===u,onError:se},`${M.id}:${M.generation}`))}),(0,B.jsxs)("footer",{className:"zt-statusbar",children:[(0,B.jsxs)("div",{className:"zt-status-info",children:[(0,B.jsx)("span",{children:ye?`AI \u7ED1\u5B9A\uFF1A${D.terminals.find(M=>M.id===ye.terminalId)?.target.label??ye.terminalId} \xB7 ${ye.mode==="readwrite"?`\u8BFB\u5199 ${ye.writeCalls}/${ye.maxWriteCalls}`:"\u53EA\u8BFB"}`:"AI \u5C1A\u672A\u7ED1\u5B9A\u7EC8\u7AEF"}),(0,B.jsxs)("span",{className:"zt-host-platform",title:"\u7EC8\u7AEF\u8FDE\u63A5\u4E0E\u547D\u4EE4\u4ECE DSH \u5BBF\u4E3B\u53D1\u8D77",children:["DSH \u5BBF\u4E3B \xB7 ",D.hostPlatform||"\u6B63\u5728\u8FDE\u63A5"]})]}),Y&&(0,B.jsx)("button",{onClick:()=>{ie(I,"terminal/export",{sessionId:A,terminalId:Y.id}).then(M=>Qe(`zterm-${et()}-\u7EC8\u7AEF.txt`,`\u7EC8\u7AEF\uFF1A${Xe(Y)}
|
|
8
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),t.isLinux&&u&&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(u){let m=this._getMouseBufferCoords(u),y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!!(y&&E&&m)&&this._areCoordsInSelection(m,y,E)}isCellInSelection(u,m){let y=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!y||!E)&&this._areCoordsInSelection([u,m],y,E)}_areCoordsInSelection(u,m,y){return u[1]>m[1]&&u[1]<y[1]||m[1]===y[1]&&u[1]===m[1]&&u[0]>=m[0]&&u[0]<y[0]||m[1]<y[1]&&u[1]===y[1]&&u[0]<y[0]||m[1]<y[1]&&u[1]===m[1]&&u[0]>=m[0]}_selectWordAtCursor(u,m){let y=this._linkifier.currentLink?.link?.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let E=this._getMouseBufferCoords(u);return!!E&&(this._selectWordAt(E,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,m){this._model.clearSelection(),u=Math.max(u,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){let m=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(u){let m=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1],y=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=y?0:(m>y&&(m-=y),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(u){return t.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),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(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){let m=this._getMouseBufferCoords(u);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(u){return u.altKey&&!(t.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;let m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!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(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let y=this._bufferService.buffer;if(this._model.selectionEnd[1]<y.lines.length){let E=y.lines.get(this._model.selectionEnd[1]);E&&E.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[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});let u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){let m=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let y=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){let E=(0,n.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(E,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,y=!(!u||!m||u[0]===m[0]&&u[1]===m[1]);y?u&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,m,y)):this._oldHasSelection&&this._fireOnSelectionChange(u,m,y)}_fireOnSelectionChange(u,m,y){this._oldSelectionStart=u,this._oldSelectionEnd=m,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(u,m){let y=m;for(let E=0;m>=E;E++){let C=u.loadCell(E,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:C>1&&m!==E&&(y+=C-1)}return y}setSelection(u,m,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,m],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,m,y=!0,E=!0){if(u[0]>=this._bufferService.cols)return;let C=this._bufferService.buffer,w=C.lines.get(u[1]);if(!w)return;let R=C.translateBufferLineToString(u[1],!1),z=this._convertViewportColToCharacterIndex(w,u[0]),U=z,q=u[0]-z,$=0,S=0,x=0,k=0;if(R.charAt(z)===" "){for(;z>0&&R.charAt(z-1)===" ";)z--;for(;U<R.length&&R.charAt(U+1)===" ";)U++}else{let K=u[0],X=u[0];w.getWidth(K)===0&&($++,K--),w.getWidth(X)===2&&(S++,X++);let Z=w.getString(X).length;for(Z>1&&(k+=Z-1,U+=Z-1);K>0&&z>0&&!this._isCharWordSeparator(w.loadCell(K-1,this._workCell));){w.loadCell(K-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,K--):T>1&&(x+=T-1,z-=T-1),z--,K--}for(;X<w.length&&U+1<R.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(S++,X++):T>1&&(k+=T-1,U+=T-1),U++,X++}}U++;let L=z+q-$+x,H=Math.min(this._bufferService.cols,U-z+$+S-x-k);if(m||R.slice(z,U).trim()!==""){if(y&&L===0&&w.getCodePoint(0)!==32){let K=C.lines.get(u[1]-1);if(K&&w.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let X=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(X){let Z=this._bufferService.cols-X.start;L-=Z,H+=Z}}}if(E&&L+H===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){let K=C.lines.get(u[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let X=this._getWordAt([0,u[1]+1],!1,!1,!0);X&&(H+=X.length)}}return{start:L,length:H}}}_selectWordAt(u,m){let y=this._getWordAt(u,m);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[y.start,u[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(u){let m=this._getWordAt(u,!0);if(m){let y=u[1];for(;m.start<0;)m.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,y]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){let m=this._bufferService.buffer.getWrappedRangeForLine(u),y={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols)}};s.SelectionService=g=c([f(3,h.IBufferService),f(4,h.ICoreService),f(5,p.IMouseService),f(6,h.IOptionsService),f(7,p.IRenderService),f(8,p.ICoreBrowserService)],g)},4725:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;let c=a(8343);s.ICharSizeService=(0,c.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),s.IMouseService=(0,c.createDecorator)("MouseService"),s.IRenderService=(0,c.createDecorator)("RenderService"),s.ISelectionService=(0,c.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,c.createDecorator)("ThemeService"),s.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(D,s,a){var c=this&&this.__decorate||function(g,u,m,y){var E,C=arguments.length,w=C<3?u:y===null?y=Object.getOwnPropertyDescriptor(u,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(g,u,m,y);else for(var R=g.length-1;R>=0;R--)(E=g[R])&&(w=(C<3?E(w):C>3?E(u,m,w):E(u,m))||w);return C>3&&w&&Object.defineProperty(u,m,w),w},f=this&&this.__param||function(g,u){return function(m,y){u(m,y,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let o=a(7239),n=a(8055),d=a(8460),p=a(844),l=a(2585),i=n.css.toColor("#ffffff"),t=n.css.toColor("#000000"),e=n.css.toColor("#ffffff"),r=n.css.toColor("#000000"),h={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let g=[n.css.toColor("#2e3436"),n.css.toColor("#cc0000"),n.css.toColor("#4e9a06"),n.css.toColor("#c4a000"),n.css.toColor("#3465a4"),n.css.toColor("#75507b"),n.css.toColor("#06989a"),n.css.toColor("#d3d7cf"),n.css.toColor("#555753"),n.css.toColor("#ef2929"),n.css.toColor("#8ae234"),n.css.toColor("#fce94f"),n.css.toColor("#729fcf"),n.css.toColor("#ad7fa8"),n.css.toColor("#34e2e2"),n.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let m=0;m<216;m++){let y=u[m/36%6|0],E=u[m/6%6|0],C=u[m%6];g.push({css:n.channels.toCss(y,E,C),rgba:n.channels.toRgba(y,E,C)})}for(let m=0;m<24;m++){let y=8+10*m;g.push({css:n.channels.toCss(y,y,y),rgba:n.channels.toRgba(y,y,y)})}return g})());let _=s.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:t,cursor:e,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:h,selectionBackgroundOpaque:n.color.blend(t,h),selectionInactiveBackgroundTransparent:h,selectionInactiveBackgroundOpaque:n.color.blend(t,h),ansi:s.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(g={}){let u=this._colors;if(u.foreground=v(g.foreground,i),u.background=v(g.background,t),u.cursor=v(g.cursor,e),u.cursorAccent=v(g.cursorAccent,r),u.selectionBackgroundTransparent=v(g.selectionBackground,h),u.selectionBackgroundOpaque=n.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=v(g.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=n.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=g.selectionForeground?v(g.selectionForeground,n.NULL_COLOR):void 0,u.selectionForeground===n.NULL_COLOR&&(u.selectionForeground=void 0),n.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=n.color.opacity(u.selectionBackgroundTransparent,.3)),n.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=n.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=s.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=v(g.black,s.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=v(g.red,s.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=v(g.green,s.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=v(g.yellow,s.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=v(g.blue,s.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=v(g.magenta,s.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=v(g.cyan,s.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=v(g.white,s.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=v(g.brightBlack,s.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=v(g.brightRed,s.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=v(g.brightGreen,s.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=v(g.brightYellow,s.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=v(g.brightBlue,s.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=v(g.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=v(g.brightCyan,s.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=v(g.brightWhite,s.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){let m=Math.min(u.ansi.length-16,g.extendedAnsi.length);for(let y=0;y<m;y++)u.ansi[y+16]=v(g.extendedAnsi[y],s.DEFAULT_ANSI_COLORS[y+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(g){this._restoreColor(g),this._onChangeColors.fire(this.colors)}_restoreColor(g){if(g!==void 0)switch(g){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[g]=this._restoreColors.ansi[g]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(g){g(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 v(g,u){if(g!==void 0)try{return n.css.toColor(g)}catch{}return u}s.ThemeService=_=c([f(0,l.IOptionsService)],_)},6349:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let c=a(8460),f=a(844);class o extends f.Disposable{constructor(d){super(),this._maxLength=d,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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(d){if(this._maxLength===d)return;let p=new Array(d);for(let l=0;l<Math.min(d,this.length);l++)p[l]=this._array[this._getCyclicIndex(l)];this._array=p,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let p=this._length;p<d;p++)this._array[p]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,p){this._array[this._getCyclicIndex(d)]=p}push(d){this._array[this._getCyclicIndex(this._length)]=d,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(d,p,...l){if(p){for(let i=d;i<this._length-p;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+p)];this._length-=p,this.onDeleteEmitter.fire({index:d,amount:p})}for(let i=this._length-1;i>=d;i--)this._array[this._getCyclicIndex(i+l.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<l.length;i++)this._array[this._getCyclicIndex(d+i)]=l[i];if(l.length&&this.onInsertEmitter.fire({index:d,amount:l.length}),this._length+l.length>this._maxLength){let i=this._length+l.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=l.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,p,l){if(!(p<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+l<0)throw new Error("Cannot shift elements in list beyond index 0");if(l>0){for(let t=p-1;t>=0;t--)this.set(d+t+l,this.get(d+t));let i=d+p+l-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<p;i++)this.set(d+i+l,this.get(d+i))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}s.CircularList=o},1439:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function a(c,f=5){if(typeof c!="object")return c;let o=Array.isArray(c)?[]:{};for(let n in c)o[n]=f<=1?c[n]:c[n]&&a(c[n],f-1);return o}},8055:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let a=0,c=0,f=0,o=0;var n,d,p,l,i;function t(r){let h=r.toString(16);return h.length<2?"0"+h:h}function e(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(h,_,v,g){return g!==void 0?`#${t(h)}${t(_)}${t(v)}${t(g)}`:`#${t(h)}${t(_)}${t(v)}`},r.toRgba=function(h,_,v,g=255){return(h<<24|_<<16|v<<8|g)>>>0},r.toColor=function(h,_,v,g){return{css:r.toCss(h,_,v,g),rgba:r.toRgba(h,_,v,g)}}})(n||(s.channels=n={})),(function(r){function h(_,v){return o=Math.round(255*v),[a,c,f]=i.toChannels(_.rgba),{css:n.toCss(a,c,f,o),rgba:n.toRgba(a,c,f,o)}}r.blend=function(_,v){if(o=(255&v.rgba)/255,o===1)return{css:v.css,rgba:v.rgba};let g=v.rgba>>24&255,u=v.rgba>>16&255,m=v.rgba>>8&255,y=_.rgba>>24&255,E=_.rgba>>16&255,C=_.rgba>>8&255;return a=y+Math.round((g-y)*o),c=E+Math.round((u-E)*o),f=C+Math.round((m-C)*o),{css:n.toCss(a,c,f),rgba:n.toRgba(a,c,f)}},r.isOpaque=function(_){return(255&_.rgba)==255},r.ensureContrastRatio=function(_,v,g){let u=i.ensureContrastRatio(_.rgba,v.rgba,g);if(u)return n.toColor(u>>24&255,u>>16&255,u>>8&255)},r.opaque=function(_){let v=(255|_.rgba)>>>0;return[a,c,f]=i.toChannels(v),{css:n.toCss(a,c,f),rgba:v}},r.opacity=h,r.multiplyOpacity=function(_,v){return o=255&_.rgba,h(_,o*v/255)},r.toColorRGB=function(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}})(d||(s.color=d={})),(function(r){let h,_;try{let v=document.createElement("canvas");v.width=1,v.height=1;let g=v.getContext("2d",{willReadFrequently:!0});g&&(h=g,h.globalCompositeOperation="copy",_=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(v){if(v.match(/#[\da-f]{3,8}/i))switch(v.length){case 4:return a=parseInt(v.slice(1,2).repeat(2),16),c=parseInt(v.slice(2,3).repeat(2),16),f=parseInt(v.slice(3,4).repeat(2),16),n.toColor(a,c,f);case 5:return a=parseInt(v.slice(1,2).repeat(2),16),c=parseInt(v.slice(2,3).repeat(2),16),f=parseInt(v.slice(3,4).repeat(2),16),o=parseInt(v.slice(4,5).repeat(2),16),n.toColor(a,c,f,o);case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}let g=v.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return a=parseInt(g[1]),c=parseInt(g[2]),f=parseInt(g[3]),o=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),n.toColor(a,c,f,o);if(!h||!_)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=_,h.fillStyle=v,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,c,f,o]=h.getImageData(0,0,1,1).data,o!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:n.toRgba(a,c,f,o),css:v}}})(p||(s.css=p={})),(function(r){function h(_,v,g){let u=_/255,m=v/255,y=g/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}r.relativeLuminance=function(_){return h(_>>16&255,_>>8&255,255&_)},r.relativeLuminance2=h})(l||(s.rgb=l={})),(function(r){function h(v,g,u){let m=v>>24&255,y=v>>16&255,E=v>>8&255,C=g>>24&255,w=g>>16&255,R=g>>8&255,z=e(l.relativeLuminance2(C,w,R),l.relativeLuminance2(m,y,E));for(;z<u&&(C>0||w>0||R>0);)C-=Math.max(0,Math.ceil(.1*C)),w-=Math.max(0,Math.ceil(.1*w)),R-=Math.max(0,Math.ceil(.1*R)),z=e(l.relativeLuminance2(C,w,R),l.relativeLuminance2(m,y,E));return(C<<24|w<<16|R<<8|255)>>>0}function _(v,g,u){let m=v>>24&255,y=v>>16&255,E=v>>8&255,C=g>>24&255,w=g>>16&255,R=g>>8&255,z=e(l.relativeLuminance2(C,w,R),l.relativeLuminance2(m,y,E));for(;z<u&&(C<255||w<255||R<255);)C=Math.min(255,C+Math.ceil(.1*(255-C))),w=Math.min(255,w+Math.ceil(.1*(255-w))),R=Math.min(255,R+Math.ceil(.1*(255-R))),z=e(l.relativeLuminance2(C,w,R),l.relativeLuminance2(m,y,E));return(C<<24|w<<16|R<<8|255)>>>0}r.blend=function(v,g){if(o=(255&g)/255,o===1)return g;let u=g>>24&255,m=g>>16&255,y=g>>8&255,E=v>>24&255,C=v>>16&255,w=v>>8&255;return a=E+Math.round((u-E)*o),c=C+Math.round((m-C)*o),f=w+Math.round((y-w)*o),n.toRgba(a,c,f)},r.ensureContrastRatio=function(v,g,u){let m=l.relativeLuminance(v>>8),y=l.relativeLuminance(g>>8);if(e(m,y)<u){if(y<m){let w=h(v,g,u),R=e(m,l.relativeLuminance(w>>8));if(R<u){let z=_(v,g,u);return R>e(m,l.relativeLuminance(z>>8))?w:z}return w}let E=_(v,g,u),C=e(m,l.relativeLuminance(E>>8));if(C<u){let w=h(v,g,u);return C>e(m,l.relativeLuminance(w>>8))?E:w}return E}},r.reduceLuminance=h,r.increaseLuminance=_,r.toChannels=function(v){return[v>>24&255,v>>16&255,v>>8&255,255&v]}})(i||(s.rgba=i={})),s.toPaddedHex=t,s.contrastRatio=e},8969:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let c=a(844),f=a(2585),o=a(4348),n=a(7866),d=a(744),p=a(7302),l=a(6975),i=a(8460),t=a(1753),e=a(1480),r=a(7994),h=a(9282),_=a(5435),v=a(5981),g=a(2660),u=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((E=>{this._onScrollApi?.fire(E.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(E){for(let C in E)this.optionsService.options[C]=E[C]}constructor(E){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new p.OptionsService(E)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(n.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((C=>{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((C=>{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 v.WriteBuffer(((C,w)=>this._inputHandler.parse(C,w)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,C){this._writeBuffer.write(E,C)}writeSync(E,C){this._logService.logLevel<=f.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(E,C)}input(E,C=!0){this.coreService.triggerDataEvent(E,C)}resize(E,C){isNaN(E)||isNaN(C)||(E=Math.max(E,d.MINIMUM_COLS),C=Math.max(C,d.MINIMUM_ROWS),this._bufferService.resize(E,C))}scroll(E,C=!1){this._bufferService.scroll(E,C)}scrollLines(E,C,w){this._bufferService.scrollLines(E,C,w)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){let C=E-this._bufferService.buffer.ydisp;C!==0&&this.scrollLines(C)}registerEscHandler(E,C){return this._inputHandler.registerEscHandler(E,C)}registerDcsHandler(E,C){return this._inputHandler.registerDcsHandler(E,C)}registerCsiHandler(E,C){return this._inputHandler.registerCsiHandler(E,C)}registerOscHandler(E,C){return this._inputHandler.registerOscHandler(E,C)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1,C=this.optionsService.rawOptions.windowsPty;C&&C.buildNumber!==void 0&&C.buildNumber!==void 0?E=C.backend==="conpty"&&C.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let E=[];E.push(this.onLineFeed(h.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},(()=>((0,h.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(let C of E)C.dispose()}))}}}s.CoreTerminal=m},8460:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===a)return void this._listeners.splice(c,1)}}})),this._event}fire(a,c){let f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,a,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(a,c){return a((f=>c.fire(f)))},s.runAndSubscribe=function(a,c){return c(void 0),a((f=>c(f)))}},5435:function(D,s,a){var c=this&&this.__decorate||function($,S,x,k){var L,H=arguments.length,K=H<3?S:k===null?k=Object.getOwnPropertyDescriptor(S,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,S,x,k);else for(var X=$.length-1;X>=0;X--)(L=$[X])&&(K=(H<3?L(K):H>3?L(S,x,K):L(S,x))||K);return H>3&&K&&Object.defineProperty(S,x,K),K},f=this&&this.__param||function($,S){return function(x,k){S(x,k,$)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let o=a(2584),n=a(7116),d=a(2015),p=a(844),l=a(482),i=a(8437),t=a(8460),e=a(643),r=a(511),h=a(3734),_=a(2585),v=a(1480),g=a(6242),u=a(6351),m=a(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=131072;function C($,S){if($>24)return S.setWinLines||!1;switch($){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var w;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(s.WindowsOptionsReportType=w={}));let R=0;class z extends p.Disposable{getAttrData(){return this._curAttrData}constructor(S,x,k,L,H,K,X,Z,T=new d.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=x,this._coreService=k,this._logService=L,this._optionsService=H,this._oscLinkService=K,this._coreMouseService=X,this._unicodeService=Z,this._parser=T,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new r.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((b=>this._activeBuffer=b.activeBuffer))),this._parser.setCsiHandlerFallback(((b,P)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(b),params:P.toArray()})})),this._parser.setEscHandlerFallback((b=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(b)})})),this._parser.setExecuteHandlerFallback((b=>{this._logService.debug("Unknown EXECUTE code: ",{code:b})})),this._parser.setOscHandlerFallback(((b,P,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:b,action:P,data:N})})),this._parser.setDcsHandlerFallback(((b,P,N)=>{P==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(b),action:P,payload:N})})),this._parser.setPrintHandler(((b,P,N)=>this.print(b,P,N))),this._parser.registerCsiHandler({final:"@"},(b=>this.insertChars(b))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(b=>this.scrollLeft(b))),this._parser.registerCsiHandler({final:"A"},(b=>this.cursorUp(b))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(b=>this.scrollRight(b))),this._parser.registerCsiHandler({final:"B"},(b=>this.cursorDown(b))),this._parser.registerCsiHandler({final:"C"},(b=>this.cursorForward(b))),this._parser.registerCsiHandler({final:"D"},(b=>this.cursorBackward(b))),this._parser.registerCsiHandler({final:"E"},(b=>this.cursorNextLine(b))),this._parser.registerCsiHandler({final:"F"},(b=>this.cursorPrecedingLine(b))),this._parser.registerCsiHandler({final:"G"},(b=>this.cursorCharAbsolute(b))),this._parser.registerCsiHandler({final:"H"},(b=>this.cursorPosition(b))),this._parser.registerCsiHandler({final:"I"},(b=>this.cursorForwardTab(b))),this._parser.registerCsiHandler({final:"J"},(b=>this.eraseInDisplay(b,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(b=>this.eraseInDisplay(b,!0))),this._parser.registerCsiHandler({final:"K"},(b=>this.eraseInLine(b,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(b=>this.eraseInLine(b,!0))),this._parser.registerCsiHandler({final:"L"},(b=>this.insertLines(b))),this._parser.registerCsiHandler({final:"M"},(b=>this.deleteLines(b))),this._parser.registerCsiHandler({final:"P"},(b=>this.deleteChars(b))),this._parser.registerCsiHandler({final:"S"},(b=>this.scrollUp(b))),this._parser.registerCsiHandler({final:"T"},(b=>this.scrollDown(b))),this._parser.registerCsiHandler({final:"X"},(b=>this.eraseChars(b))),this._parser.registerCsiHandler({final:"Z"},(b=>this.cursorBackwardTab(b))),this._parser.registerCsiHandler({final:"`"},(b=>this.charPosAbsolute(b))),this._parser.registerCsiHandler({final:"a"},(b=>this.hPositionRelative(b))),this._parser.registerCsiHandler({final:"b"},(b=>this.repeatPrecedingCharacter(b))),this._parser.registerCsiHandler({final:"c"},(b=>this.sendDeviceAttributesPrimary(b))),this._parser.registerCsiHandler({prefix:">",final:"c"},(b=>this.sendDeviceAttributesSecondary(b))),this._parser.registerCsiHandler({final:"d"},(b=>this.linePosAbsolute(b))),this._parser.registerCsiHandler({final:"e"},(b=>this.vPositionRelative(b))),this._parser.registerCsiHandler({final:"f"},(b=>this.hVPosition(b))),this._parser.registerCsiHandler({final:"g"},(b=>this.tabClear(b))),this._parser.registerCsiHandler({final:"h"},(b=>this.setMode(b))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(b=>this.setModePrivate(b))),this._parser.registerCsiHandler({final:"l"},(b=>this.resetMode(b))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(b=>this.resetModePrivate(b))),this._parser.registerCsiHandler({final:"m"},(b=>this.charAttributes(b))),this._parser.registerCsiHandler({final:"n"},(b=>this.deviceStatus(b))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(b=>this.deviceStatusPrivate(b))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(b=>this.softReset(b))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(b=>this.setCursorStyle(b))),this._parser.registerCsiHandler({final:"r"},(b=>this.setScrollRegion(b))),this._parser.registerCsiHandler({final:"s"},(b=>this.saveCursor(b))),this._parser.registerCsiHandler({final:"t"},(b=>this.windowOptions(b))),this._parser.registerCsiHandler({final:"u"},(b=>this.restoreCursor(b))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(b=>this.insertColumns(b))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(b=>this.deleteColumns(b))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(b=>this.selectProtected(b))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(b=>this.requestMode(b,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(b=>this.requestMode(b,!1))),this._parser.setExecuteHandler(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((b=>(this.setTitle(b),this.setIconName(b),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((b=>this.setIconName(b)))),this._parser.registerOscHandler(2,new g.OscHandler((b=>this.setTitle(b)))),this._parser.registerOscHandler(4,new g.OscHandler((b=>this.setOrReportIndexedColor(b)))),this._parser.registerOscHandler(8,new g.OscHandler((b=>this.setHyperlink(b)))),this._parser.registerOscHandler(10,new g.OscHandler((b=>this.setOrReportFgColor(b)))),this._parser.registerOscHandler(11,new g.OscHandler((b=>this.setOrReportBgColor(b)))),this._parser.registerOscHandler(12,new g.OscHandler((b=>this.setOrReportCursorColor(b)))),this._parser.registerOscHandler(104,new g.OscHandler((b=>this.restoreIndexedColor(b)))),this._parser.registerOscHandler(110,new g.OscHandler((b=>this.restoreFgColor(b)))),this._parser.registerOscHandler(111,new g.OscHandler((b=>this.restoreBgColor(b)))),this._parser.registerOscHandler(112,new g.OscHandler((b=>this.restoreCursorColor(b)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let b in n.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:b},(()=>this.selectCharset("("+b))),this._parser.registerEscHandler({intermediates:")",final:b},(()=>this.selectCharset(")"+b))),this._parser.registerEscHandler({intermediates:"*",final:b},(()=>this.selectCharset("*"+b))),this._parser.registerEscHandler({intermediates:"+",final:b},(()=>this.selectCharset("+"+b))),this._parser.registerEscHandler({intermediates:"-",final:b},(()=>this.selectCharset("-"+b))),this._parser.registerEscHandler({intermediates:".",final:b},(()=>this.selectCharset("."+b))),this._parser.registerEscHandler({intermediates:"/",final:b},(()=>this.selectCharset("/"+b)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((b=>(this._logService.error("Parsing error: ",b),b))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler(((b,P)=>this.requestStatusString(b,P))))}_preserveStack(S,x,k,L){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=x,this._parseStack.decodedLength=k,this._parseStack.position=L}_logSlowResolvingAsync(S){this._logService.logLevel<=_.LogLevelEnum.WARN&&Promise.race([S,new Promise(((x,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((x=>{if(x!=="#SLOW_TIMEOUT")throw x;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,x){let k,L=this._activeBuffer.x,H=this._activeBuffer.y,K=0,X=this._parseStack.paused;if(X){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,x))return this._logSlowResolvingAsync(k),k;L=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>E&&(K=this._parseStack.position+E)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?` "${S}"`:` "${Array.prototype.map.call(S,(b=>String.fromCharCode(b))).join("")}"`),typeof S=="string"?S.split("").map((b=>b.charCodeAt(0))):S),this._parseBuffer.length<S.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(S.length,E))),X||this._dirtyRowTracker.clearRange(),S.length>E)for(let b=K;b<S.length;b+=E){let P=b+E<S.length?b+E:S.length,N=typeof S=="string"?this._stringDecoder.decode(S.substring(b,P),this._parseBuffer):this._utf8Decoder.decode(S.subarray(b,P),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,N))return this._preserveStack(L,H,N,b),this._logSlowResolvingAsync(k),k}else if(!X){let b=typeof S=="string"?this._stringDecoder.decode(S,this._parseBuffer):this._utf8Decoder.decode(S,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,b))return this._preserveStack(L,H,b,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===L&&this._activeBuffer.y===H||this._onCursorMove.fire();let Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),T=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);T<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(T,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(S,x,k){let L,H,K=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,T=this._coreService.decPrivateModes.wraparound,b=this._coreService.modes.insertMode,P=this._curAttrData,N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-x>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,P);let V=this._parser.precedingJoinState;for(let j=x;j<k;++j){if(L=S[j],L<127&&K){let fe=K[String.fromCharCode(L)];fe&&(L=fe.charCodeAt(0))}let te=this._unicodeService.charProperties(L,V);H=v.UnicodeService.extractWidth(te);let ne=v.UnicodeService.extractShouldJoin(te),oe=ne?v.UnicodeService.extractWidth(V):0;if(V=te,X&&this._onA11yChar.fire((0,l.stringFromCodePoint)(L)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-oe>Z){if(T){let fe=N,J=this._activeBuffer.x-oe;for(this._activeBuffer.x=oe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),oe>0&&N instanceof i.BufferLine&&N.copyCellsFrom(fe,J,0,oe,!1);J<Z;)fe.setCellFromCodepoint(J++,0,1,P)}else if(this._activeBuffer.x=Z-1,H===2)continue}if(ne&&this._activeBuffer.x){let fe=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-fe,L,H);for(let J=H-oe;--J>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,P)}else if(b&&(N.insertCells(this._activeBuffer.x,H-oe,this._activeBuffer.getNullCell(P)),N.getWidth(Z-1)===2&&N.setCellFromCodepoint(Z-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,P)),N.setCellFromCodepoint(this._activeBuffer.x++,L,H,P),H>0)for(;--H;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,P)}this._parser.precedingJoinState=V,this._activeBuffer.x<Z&&k-x>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,P),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,x){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,x):this._parser.registerCsiHandler(S,(k=>!C(k.params[0],this._optionsService.rawOptions.windowOptions)||x(k)))}registerDcsHandler(S,x){return this._parser.registerDcsHandler(S,new u.DcsHandler(x))}registerEscHandler(S,x){return this._parser.registerEscHandler(S,x)}registerOscHandler(S,x){return this._parser.registerOscHandler(S,new g.OscHandler(x))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);S.hasWidth(this._activeBuffer.x)&&!S.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-S),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(S=this._bufferService.cols-1){this._activeBuffer.x=Math.min(S,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(S,x){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+x):(this._activeBuffer.x=S,this._activeBuffer.y=x),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,x){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+x)}cursorUp(S){let x=this._activeBuffer.y-this._activeBuffer.scrollTop;return x>=0?this._moveCursor(0,-Math.min(x,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){let x=this._activeBuffer.scrollBottom-this._activeBuffer.y;return x>=0?this._moveCursor(0,Math.min(x,S.params[0]||1)):this._moveCursor(0,S.params[0]||1),!0}cursorForward(S){return this._moveCursor(S.params[0]||1,0),!0}cursorBackward(S){return this._moveCursor(-(S.params[0]||1),0),!0}cursorNextLine(S){return this.cursorDown(S),this._activeBuffer.x=0,!0}cursorPrecedingLine(S){return this.cursorUp(S),this._activeBuffer.x=0,!0}cursorCharAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(S){return this._setCursor(S.length>=2?(S.params[1]||1)-1:0,(S.params[0]||1)-1),!0}charPosAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(S){return this._moveCursor(S.params[0]||1,0),!0}linePosAbsolute(S){return this._setCursor(this._activeBuffer.x,(S.params[0]||1)-1),!0}vPositionRelative(S){return this._moveCursor(0,S.params[0]||1),!0}hVPosition(S){return this.cursorPosition(S),!0}tabClear(S){let x=S.params[0];return x===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:x===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=S.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let x=S.params[0]||1;for(;x--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){let x=S.params[0];return x===1&&(this._curAttrData.bg|=536870912),x!==2&&x!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,x,k,L=!1,H=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);K.replaceCells(x,k,this._activeBuffer.getNullCell(this._eraseAttrData()),H),L&&(K.isWrapped=!1)}_resetBufferLine(S,x=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),x),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),k.isWrapped=!1)}eraseInDisplay(S,x=!1){let k;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);k<this._bufferService.rows;k++)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,x),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,x);this._dirtyRowTracker.markDirty(0);break;case 3:let L=this._activeBuffer.lines.length-this._bufferService.rows;L>0&&(this._activeBuffer.lines.trimStart(L),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-L,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-L,0),this._onScroll.fire(0))}return!0}eraseInLine(S,x=!1){switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,x);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,x);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,x)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(S){this._restrictCursor();let x=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-L+1;for(;x--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(S){this._restrictCursor();let x=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,L;for(L=this._bufferService.rows-1-this._activeBuffer.scrollBottom,L=this._bufferService.rows-1+this._activeBuffer.ybase-L;x--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(S){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.insertCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(S){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.deleteCells(this._activeBuffer.x,S.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(S){let x=S.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(S){let x=S.params[0]||1;for(;x--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.deleteCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.insertCells(0,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.insertCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(S){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let x=S.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);L.deleteCells(this._activeBuffer.x,x,this._activeBuffer.getNullCell(this._eraseAttrData())),L.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(S){this._restrictCursor();let x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return x&&(x.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(S.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(S){let x=this._parser.precedingJoinState;if(!x)return!0;let k=S.params[0]||1,L=v.UnicodeService.extractWidth(x),H=this._activeBuffer.x-L,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),X=new Uint32Array(K.length*k),Z=0;for(let b=0;b<K.length;){let P=K.codePointAt(b)||0;X[Z++]=P,b+=P>65535?2:1}let T=Z;for(let b=1;b<k;++b)X.copyWithin(T,0,Z),T+=Z;return this.print(X,0,T),!0}sendDeviceAttributesPrimary(S){return S.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(S){return(this._optionsService.rawOptions.termName+"").indexOf(S)===0}setMode(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,n.DEFAULT_CHARSET),this._charsetService.setgCharset(1,n.DEFAULT_CHARSET),this._charsetService.setgCharset(2,n.DEFAULT_CHARSET),this._charsetService.setgCharset(3,n.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(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(S){for(let x=0;x<S.length;x++)switch(S.params[x]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 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(),S.params[x]===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(S,x){let k=this._coreService.decPrivateModes,{activeProtocol:L,activeEncoding:H}=this._coreMouseService,K=this._coreService,{buffers:X,cols:Z}=this._bufferService,{active:T,alt:b}=X,P=this._optionsService.rawOptions,N=ne=>ne?1:2,V=S.params[0];return j=V,te=x?V===2?4:V===4?N(K.modes.insertMode):V===12?3:V===20?N(P.convertEol):0:V===1?N(k.applicationCursorKeys):V===3?P.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:V===6?N(k.origin):V===7?N(k.wraparound):V===8?3:V===9?N(L==="X10"):V===12?N(P.cursorBlink):V===25?N(!K.isCursorHidden):V===45?N(k.reverseWraparound):V===66?N(k.applicationKeypad):V===67?4:V===1e3?N(L==="VT200"):V===1002?N(L==="DRAG"):V===1003?N(L==="ANY"):V===1004?N(k.sendFocus):V===1005?4:V===1006?N(H==="SGR"):V===1015?4:V===1016?N(H==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?N(T===b):V===2004?N(k.bracketedPasteMode):0,K.triggerDataEvent(`${o.C0.ESC}[${x?"":"?"}${j};${te}$y`),!0;var j,te}_updateAttrColor(S,x,k,L,H){return x===2?(S|=50331648,S&=-16777216,S|=h.AttributeData.fromColorRGB([k,L,H])):x===5&&(S&=-50331904,S|=33554432|255&k),S}_extractColor(S,x,k){let L=[0,0,-1,0,0,0],H=0,K=0;do{if(L[K+H]=S.params[x+K],S.hasSubParams(x+K)){let X=S.getSubParams(x+K),Z=0;do L[1]===5&&(H=1),L[K+Z+1+H]=X[Z];while(++Z<X.length&&Z+K+1+H<L.length);break}if(L[1]===5&&K+H>=2||L[1]===2&&K+H>=5)break;L[1]&&(H=1)}while(++K+x<S.length&&K+H<L.length);for(let X=2;X<L.length;++X)L[X]===-1&&(L[X]=0);switch(L[0]){case 38:k.fg=this._updateAttrColor(k.fg,L[1],L[3],L[4],L[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,L[1],L[3],L[4],L[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,L[1],L[3],L[4],L[5])}return K}_processUnderline(S,x){x.extended=x.extended.clone(),(!~S||S>5)&&(S=1),x.extended.underlineStyle=S,x.fg|=268435456,S===0&&(x.fg&=-268435457),x.updateExtended()}_processSGR0(S){S.fg=i.DEFAULT_ATTR_DATA.fg,S.bg=i.DEFAULT_ATTR_DATA.bg,S.extended=S.extended.clone(),S.extended.underlineStyle=0,S.extended.underlineColor&=-67108864,S.updateExtended()}charAttributes(S){if(S.length===1&&S.params[0]===0)return this._processSGR0(this._curAttrData),!0;let x=S.length,k,L=this._curAttrData;for(let H=0;H<x;H++)k=S.params[H],k>=30&&k<=37?(L.fg&=-50331904,L.fg|=16777216|k-30):k>=40&&k<=47?(L.bg&=-50331904,L.bg|=16777216|k-40):k>=90&&k<=97?(L.fg&=-50331904,L.fg|=16777224|k-90):k>=100&&k<=107?(L.bg&=-50331904,L.bg|=16777224|k-100):k===0?this._processSGR0(L):k===1?L.fg|=134217728:k===3?L.bg|=67108864:k===4?(L.fg|=268435456,this._processUnderline(S.hasSubParams(H)?S.getSubParams(H)[0]:1,L)):k===5?L.fg|=536870912:k===7?L.fg|=67108864:k===8?L.fg|=1073741824:k===9?L.fg|=2147483648:k===2?L.bg|=134217728:k===21?this._processUnderline(2,L):k===22?(L.fg&=-134217729,L.bg&=-134217729):k===23?L.bg&=-67108865:k===24?(L.fg&=-268435457,this._processUnderline(0,L)):k===25?L.fg&=-536870913:k===27?L.fg&=-67108865:k===28?L.fg&=-1073741825:k===29?L.fg&=2147483647:k===39?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):k===49?(L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?H+=this._extractColor(S,H,L):k===53?L.bg|=1073741824:k===55?L.bg&=-1073741825:k===59?(L.extended=L.extended.clone(),L.extended.underlineColor=-1,L.updateExtended()):k===100?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:let x=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${x};${k}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){let x=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${x};${k}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){let x=S.params[0]||1;switch(x){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"}let k=x%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(S){let x=S.params[0]||1,k;return(S.length<2||(k=S.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>x&&(this._activeBuffer.scrollTop=x-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(S){if(!C(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;let x=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:x!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:x!==0&&x!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),x!==0&&x!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:x!==0&&x!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),x!==0&&x!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(S){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(S){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(S){return this._windowTitle=S,this._onTitleChange.fire(S),!0}setIconName(S){return this._iconName=S,!0}setOrReportIndexedColor(S){let x=[],k=S.split(";");for(;k.length>1;){let L=k.shift(),H=k.shift();if(/^\d+$/.exec(L)){let K=parseInt(L);if(q(K))if(H==="?")x.push({type:0,index:K});else{let X=(0,m.parseColor)(H);X&&x.push({type:1,index:K,color:X})}}}return x.length&&this._onColor.fire(x),!0}setHyperlink(S){let x=S.split(";");return!(x.length<2)&&(x[1]?this._createHyperlink(x[0],x[1]):!x[0]&&this._finishHyperlink())}_createHyperlink(S,x){this._getCurrentLinkId()&&this._finishHyperlink();let k=S.split(":"),L,H=k.findIndex((K=>K.startsWith("id=")));return H!==-1&&(L=k[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:L,uri:x}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(S,x){let k=S.split(";");for(let L=0;L<k.length&&!(x>=this._specialColors.length);++L,++x)if(k[L]==="?")this._onColor.fire([{type:0,index:this._specialColors[x]}]);else{let H=(0,m.parseColor)(k[L]);H&&this._onColor.fire([{type:1,index:this._specialColors[x],color:H}])}return!0}setOrReportFgColor(S){return this._setOrReportSpecialColor(S,0)}setOrReportBgColor(S){return this._setOrReportSpecialColor(S,1)}setOrReportCursorColor(S){return this._setOrReportSpecialColor(S,2)}restoreIndexedColor(S){if(!S)return this._onColor.fire([{type:2}]),!0;let x=[],k=S.split(";");for(let L=0;L<k.length;++L)if(/^\d+$/.exec(k[L])){let H=parseInt(k[L]);q(H)&&x.push({type:2,index:H})}return x.length&&this._onColor.fire(x),!0}restoreFgColor(S){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(S){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(S){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,n.DEFAULT_CHARSET),!0}selectCharset(S){return S.length!==2?(this.selectDefaultCharset(),!0):(S[0]==="/"||this._charsetService.setgCharset(y[S[0]],n.CHARSETS[S[1]]||n.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let S=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,S,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(S){return this._charsetService.setgLevel(S),!0}screenAlignmentPattern(){let S=new r.CellData;S.content=4194373,S.fg=this._curAttrData.fg,S.bg=this._curAttrData.bg,this._setCursor(0,0);for(let x=0;x<this._bufferService.rows;++x){let k=this._activeBuffer.ybase+this._activeBuffer.y+x,L=this._activeBuffer.lines.get(k);L&&(L.fill(S),L.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(S,x){let k=this._bufferService.buffer,L=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${H}${o.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[L.cursorStyle]-(L.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,x){this._dirtyRowTracker.markRangeDirty(S,x)}}s.InputHandler=z;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,S){$>S&&(R=$,$=S,S=R),$<this.start&&(this.start=$),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function q($){return 0<=$&&$<256}U=c([f(0,_.IBufferService)],U)},844:(D,s)=>{function a(c){for(let f of c)f.dispose();c.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=a,s.getDisposeArrayDisposable=function(c){return{dispose:()=>a(c)}}},1505:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(f,o,n){this._data[f]||(this._data[f]={}),this._data[f][o]=n}get(f,o){return this._data[f]?this._data[f][o]:void 0}clear(){this._data={}}}s.TwoKeyMap=a,s.FourKeyMap=class{constructor(){this._data=new a}set(c,f,o,n,d){this._data.get(c,f)||this._data.set(c,f,new a),this._data.get(c,f).set(o,n,d)}get(c,f,o,n){return this._data.get(c,f)?.get(o,n)}clear(){this._data.clear()}}},6114:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;let a=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=a.includes("Firefox"),s.isLegacyEdge=a.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(a),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=a.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(a)},6106:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let a=0;s.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(a=this._search(this._getKey(c)),this._array.splice(a,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;let f=this._getKey(c);if(f===void 0||(a=this._search(f),a===-1)||this._getKey(this._array[a])!==f)return!1;do if(this._array[a]===c)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===c)}forEachByKey(c,f){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do f(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===c)}values(){return[...this._array].values()}_search(c){let f=0,o=this._array.length-1;for(;o>=f;){let n=f+o>>1,d=this._getKey(this._array[n]);if(d>c)o=n-1;else{if(!(d<c)){for(;n>0&&this._getKey(this._array[n-1])===c;)n--;return n}f=n+1}}return f}}},7226:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let c=a(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(d){this._idleCallback=void 0;let p=0,l=0,i=d.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(p=Date.now(),this._tasks[this._i]()||this._i++,p=Math.max(1,Date.now()-p),l=Math.max(p,l),t=d.timeRemaining(),1.5*l>t)return i-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-p))}ms`),void this._start();i=t}this.clear()}}class o extends f{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){let p=Date.now()+d;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}s.PriorityTaskQueue=o,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(n){return requestIdleCallback(n)}_cancelCallback(n){cancelIdleCallback(n)}}:o,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(n){this._queue.clear(),this._queue.enqueue(n)}flush(){this._queue.flush()}}},9282:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let c=a(643);s.updateWindowsModeWrappedState=function(f){let o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),n=o?.get(f.cols-1),d=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);d&&n&&(d.isWrapped=n[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&n[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){let o=new a;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}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}}s.AttributeData=a;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}get underlineVariantOffset(){let o=(3758096384&this._ext)>>29;return o<0?4294967288^o:o}set underlineVariantOffset(o){this._ext&=536870911,this._ext|=o<<29&3758096384}constructor(o=0,n=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=n}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},9092:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let c=a(6349),f=a(7226),o=a(3734),n=a(8437),d=a(4634),p=a(511),l=a(643),i=a(4863),t=a(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(e,r,h){this._hasScrollback=e,this._optionsService=r,this._bufferService=h,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,r){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let r=e+this._optionsService.rawOptions.scrollback;return r>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:r}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=n.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,r){let h=this.getNullCell(n.DEFAULT_ATTR_DATA),_=0,v=this._getCorrectBufferLength(r);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)_+=+this.lines.get(u).resize(e,h);let g=0;if(this._rows<r)for(let u=this._rows;u<r;u++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new n.BufferLine(e,h)):this.ybase>0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,h)));else for(let u=this._rows;u>r;u--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v<this.lines.maxLength){let u=this.lines.length-v;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=v}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,r-1),g&&(this.y+=g),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(e,r),this._cols>e))for(let g=0;g<this.lines.length;g++)_+=+this.lines.get(g).resize(e,h);this._cols=e,this._rows=r,this._memoryCleanupQueue.clear(),_>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,r){this._cols!==e&&(e>this._cols?this._reflowLarger(e,r):this._reflowSmaller(e,r))}_reflowLarger(e,r){let h=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(h.length>0){let _=(0,d.reflowLargerCreateNewLayout)(this.lines,h);(0,d.reflowLargerApplyNewLayout)(this.lines,_.layout),this._reflowLargerAdjustViewport(e,r,_.countRemoved)}}_reflowLargerAdjustViewport(e,r,h){let _=this.getNullCell(n.DEFAULT_ATTR_DATA),v=h;for(;v-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new n.BufferLine(e,_))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-h,0)}_reflowSmaller(e,r){let h=this.getNullCell(n.DEFAULT_ATTR_DATA),_=[],v=0;for(let g=this.lines.length-1;g>=0;g--){let u=this.lines.get(g);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let m=[u];for(;u.isWrapped&&g>0;)u=this.lines.get(--g),m.unshift(u);let y=this.ybase+this.y;if(y>=g&&y<g+m.length)continue;let E=m[m.length-1].getTrimmedLength(),C=(0,d.reflowSmallerGetNewLineLengths)(m,this._cols,e),w=C.length-m.length,R;R=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);let z=[];for(let k=0;k<w;k++){let L=this.getBlankLine(n.DEFAULT_ATTR_DATA,!0);z.push(L)}z.length>0&&(_.push({start:g+m.length+v,newLines:z}),v+=z.length),m.push(...z);let U=C.length-1,q=C[U];q===0&&(U--,q=C[U]);let $=m.length-w-1,S=E;for(;$>=0;){let k=Math.min(S,q);if(m[U]===void 0)break;if(m[U].copyCellsFrom(m[$],S-k,q-k,k,!0),q-=k,q===0&&(U--,q=C[U]),S-=k,S===0){$--;let L=Math.max($,0);S=(0,d.getWrappedLineTrimmedLength)(m,L,this._cols)}}for(let k=0;k<m.length;k++)C[k]<e&&m[k].setCell(C[k],h);let x=w-R;for(;x-- >0;)this.ybase===0?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+v)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(_.length>0){let g=[],u=[];for(let U=0;U<this.lines.length;U++)u.push(this.lines.get(U));let m=this.lines.length,y=m-1,E=0,C=_[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+v);let w=0;for(let U=Math.min(this.lines.maxLength-1,m+v-1);U>=0;U--)if(C&&C.start>y+w){for(let q=C.newLines.length-1;q>=0;q--)this.lines.set(U--,C.newLines[q]);U++,g.push({index:y+1,amount:C.newLines.length}),w+=C.newLines.length,C=_[++E]}else this.lines.set(U,u[y--]);let R=0;for(let U=g.length-1;U>=0;U--)g[U].index+=R,this.lines.onInsertEmitter.fire(g[U]),R+=g[U].amount;let z=Math.max(0,m+v-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(e,r,h=0,_){let v=this.lines.get(e);return v?v.translateToString(r,h,_):""}getWrappedRangeForLine(e){let r=e,h=e;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;h+1<this.lines.length&&this.lines.get(h+1).isWrapped;)h++;return{first:r,last:h}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===e&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let r=new i.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((h=>{r.line-=h,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((h=>{r.line>=h.index&&(r.line+=h.amount)}))),r.register(this.lines.onDelete((h=>{r.line>=h.index&&r.line<h.index+h.amount&&r.dispose(),r.line>h.index&&(r.line-=h.amount)}))),r.register(r.onDispose((()=>this._removeMarker(r)))),r}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let c=a(3734),f=a(511),o=a(643),n=a(482);s.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let d=0;class p{constructor(i,t,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);let r=t||f.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let h=0;h<i;++h)this.setCell(h,r);this.length=i}get(i){let t=this._data[3*i+0],e=2097151&t;return[this._data[3*i+1],2097152&t?this._combined[i]:e?(0,n.stringFromCodePoint)(e):"",t>>22,2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,t){this._data[3*i+1]=t[o.CHAR_DATA_ATTR_INDEX],t[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=t[1],this._data[3*i+0]=2097152|i|t[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=t[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&t}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){let t=this._data[3*i+0];return 2097152&t?this._combined[i]:2097151&t?(0,n.stringFromCodePoint)(2097151&t):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,t){return d=3*i,t.content=this._data[d+0],t.fg=this._data[d+1],t.bg=this._data[d+2],2097152&t.content&&(t.combinedData=this._combined[i]),268435456&t.bg&&(t.extended=this._extendedAttrs[i]),t}setCell(i,t){2097152&t.content&&(this._combined[i]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=t.content,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}setCellFromCodepoint(i,t,e,r){268435456&r.bg&&(this._extendedAttrs[i]=r.extended),this._data[3*i+0]=t|e<<22,this._data[3*i+1]=r.fg,this._data[3*i+2]=r.bg}addCodepointToCell(i,t,e){let r=this._data[3*i+0];2097152&r?this._combined[i]+=(0,n.stringFromCodePoint)(t):2097151&r?(this._combined[i]=(0,n.stringFromCodePoint)(2097151&r)+(0,n.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|4194304,e&&(r&=-12582913,r|=e<<22),this._data[3*i+0]=r}insertCells(i,t,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length-i){let r=new f.CellData;for(let h=this.length-i-t-1;h>=0;--h)this.setCell(i+t+h,this.loadCell(i+h,r));for(let h=0;h<t;++h)this.setCell(i+h,e)}else for(let r=i;r<this.length;++r)this.setCell(r,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(i,t,e){if(i%=this.length,t<this.length-i){let r=new f.CellData;for(let h=0;h<this.length-i-t;++h)this.setCell(i+h,this.loadCell(i+t+h,r));for(let h=this.length-t;h<this.length;++h)this.setCell(h,e)}else for(let r=i;r<this.length;++r)this.setCell(r,e);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,e)}replaceCells(i,t,e,r=!1){if(r)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.isProtected(i)||this.setCell(i,e),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,e);i<t&&i<this.length;)this.setCell(i++,e)}resize(i,t){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let e=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{let r=new Uint32Array(e);r.set(this._data),this._data=r}for(let r=this.length;r<i;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,e);let r=Object.keys(this._combined);for(let _=0;_<r.length;_++){let v=parseInt(r[_],10);v>=i&&delete this._combined[v]}let h=Object.keys(this._extendedAttrs);for(let _=0;_<h.length;_++){let v=parseInt(h[_],10);v>=i&&delete this._extendedAttrs[v]}}return this.length=i,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,t=!1){if(t)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,i);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let t in i._combined)this._combined[t]=i._combined[t];this._extendedAttrs={};for(let t in i._extendedAttrs)this._extendedAttrs[t]=i._extendedAttrs[t];this.isWrapped=i.isWrapped}clone(){let i=new p(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let t in this._combined)i._combined[t]=this._combined[t];for(let t in this._extendedAttrs)i._extendedAttrs[t]=this._extendedAttrs[t];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,t,e,r,h){let _=i._data;if(h)for(let g=r-1;g>=0;g--){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=_[3*(t+g)+u];268435456&_[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}else for(let g=0;g<r;g++){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=_[3*(t+g)+u];268435456&_[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}let v=Object.keys(i._combined);for(let g=0;g<v.length;g++){let u=parseInt(v[g],10);u>=t&&(this._combined[u-t+e]=i._combined[u])}}translateToString(i,t,e,r){t=t??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),r&&(r.length=0);let h="";for(;t<e;){let _=this._data[3*t+0],v=2097151&_,g=2097152&_?this._combined[t]:v?(0,n.stringFromCodePoint)(v):o.WHITESPACE_CELL_CHAR;if(h+=g,r)for(let u=0;u<g.length;++u)r.push(t);t+=_>>22||1}return r&&r.push(t),h}}s.BufferLine=p},4841:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(a,c){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return c*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(D,s)=>{function a(c,f,o){if(f===c.length-1)return c[f].getTrimmedLength();let n=!c[f].hasContent(o-1)&&c[f].getWidth(o-1)===1,d=c[f+1].getWidth(0)===2;return n&&d?o-1:o}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(c,f,o,n,d){let p=[];for(let l=0;l<c.length-1;l++){let i=l,t=c.get(++i);if(!t.isWrapped)continue;let e=[c.get(l)];for(;i<c.length&&t.isWrapped;)e.push(t),t=c.get(++i);if(n>=l&&n<i){l+=e.length-1;continue}let r=0,h=a(e,r,f),_=1,v=0;for(;_<e.length;){let u=a(e,_,f),m=u-v,y=o-h,E=Math.min(m,y);e[r].copyCellsFrom(e[_],v,h,E,!1),h+=E,h===o&&(r++,h=0),v+=E,v===u&&(_++,v=0),h===0&&r!==0&&e[r-1].getWidth(o-1)===2&&(e[r].copyCellsFrom(e[r-1],o-1,h++,1,!1),e[r-1].setCell(o-1,d))}e[r].replaceCells(h,o,d);let g=0;for(let u=e.length-1;u>0&&(u>r||e[u].getTrimmedLength()===0);u--)g++;g>0&&(p.push(l+e.length-g),p.push(g)),l+=e.length-1}return p},s.reflowLargerCreateNewLayout=function(c,f){let o=[],n=0,d=f[n],p=0;for(let l=0;l<c.length;l++)if(d===l){let i=f[++n];c.onDeleteEmitter.fire({index:l-p,amount:i}),l+=i-1,p+=i,d=f[++n]}else o.push(l);return{layout:o,countRemoved:p}},s.reflowLargerApplyNewLayout=function(c,f){let o=[];for(let n=0;n<f.length;n++)o.push(c.get(f[n]));for(let n=0;n<o.length;n++)c.set(n,o[n]);c.length=f.length},s.reflowSmallerGetNewLineLengths=function(c,f,o){let n=[],d=c.map(((t,e)=>a(c,e,f))).reduce(((t,e)=>t+e)),p=0,l=0,i=0;for(;i<d;){if(d-i<o){n.push(d-i);break}p+=o;let t=a(c,l,f);p>t&&(p-=t,l++);let e=c[l].getWidth(p-1)===2;e&&p--;let r=e?o-1:o;n.push(r),i+=r}return n},s.getWrappedLineTrimmedLength=a},5295:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let c=a(8460),f=a(844),o=a(9092);class n extends f.Disposable{constructor(p,l){super(),this._optionsService=p,this._bufferService=l,this._onBufferActivate=this.register(new c.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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.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(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,l){this._normal.resize(p,l),this._alt.resize(p,l),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}s.BufferSet=n},511:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let c=a(482),f=a(643),o=a(3734);class n extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(p){let l=new n;return l.setFromCharData(p),l}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let l=!1;if(p[f.CHAR_DATA_CHAR_INDEX].length>2)l=!0;else if(p[f.CHAR_DATA_CHAR_INDEX].length===2){let i=p[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let t=p[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(i-55296)+t-56320+65536|p[f.CHAR_DATA_WIDTH_INDEX]<<22:l=!0}else l=!0}else this.content=p[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[f.CHAR_DATA_WIDTH_INDEX]<<22;l&&(this.combinedData=p[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=n},643:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let c=a(8460),f=a(844);class o{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(d){return this._disposables.push(d),d}}s.Marker=o,o._nextId=1},7116:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},s.CHARSETS.A={"#":"\xA3"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},s.CHARSETS.C=s.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},s.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},s.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},s.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},s.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},s.CHARSETS.E=s.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},s.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},s.CHARSETS.H=s.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},s.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(D,s)=>{var a,c,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
9
|
+
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="\x7F"})(a||(s.C0=a={})),(function(o){o.PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F"})(c||(s.C1=c={})),(function(o){o.ST=`${a.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let c=a(2584),f={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:["'",'"']};s.evaluateKeyboardEvent=function(o,n,d,p){let l={type:0,cancel:!1,key:void 0},i=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?l.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?l.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?l.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(l.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:l.key=o.ctrlKey?"\b":c.C0.DEL,o.altKey&&(l.key=c.C0.ESC+l.key);break;case 9:if(o.shiftKey){l.key=c.C0.ESC+"[Z";break}l.key=c.C0.HT,l.cancel=!0;break;case 13:l.key=o.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,l.cancel=!0;break;case 27:l.key=c.C0.ESC,o.altKey&&(l.key=c.C0.ESC+c.C0.ESC),l.cancel=!0;break;case 37:if(o.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"D",l.key===c.C0.ESC+"[1;3D"&&(l.key=c.C0.ESC+(d?"b":"[1;5D"))):l.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(o.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"C",l.key===c.C0.ESC+"[1;3C"&&(l.key=c.C0.ESC+(d?"f":"[1;5C"))):l.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(o.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"A",d||l.key!==c.C0.ESC+"[1;3A"||(l.key=c.C0.ESC+"[1;5A")):l.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(o.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"B",d||l.key!==c.C0.ESC+"[1;3B"||(l.key=c.C0.ESC+"[1;5B")):l.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(l.key=c.C0.ESC+"[2~");break;case 46:l.key=i?c.C0.ESC+"[3;"+(i+1)+"~":c.C0.ESC+"[3~";break;case 36:l.key=i?c.C0.ESC+"[1;"+(i+1)+"H":n?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:l.key=i?c.C0.ESC+"[1;"+(i+1)+"F":n?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:o.shiftKey?l.type=2:o.ctrlKey?l.key=c.C0.ESC+"[5;"+(i+1)+"~":l.key=c.C0.ESC+"[5~";break;case 34:o.shiftKey?l.type=3:o.ctrlKey?l.key=c.C0.ESC+"[6;"+(i+1)+"~":l.key=c.C0.ESC+"[6~";break;case 112:l.key=i?c.C0.ESC+"[1;"+(i+1)+"P":c.C0.ESC+"OP";break;case 113:l.key=i?c.C0.ESC+"[1;"+(i+1)+"Q":c.C0.ESC+"OQ";break;case 114:l.key=i?c.C0.ESC+"[1;"+(i+1)+"R":c.C0.ESC+"OR";break;case 115:l.key=i?c.C0.ESC+"[1;"+(i+1)+"S":c.C0.ESC+"OS";break;case 116:l.key=i?c.C0.ESC+"[15;"+(i+1)+"~":c.C0.ESC+"[15~";break;case 117:l.key=i?c.C0.ESC+"[17;"+(i+1)+"~":c.C0.ESC+"[17~";break;case 118:l.key=i?c.C0.ESC+"[18;"+(i+1)+"~":c.C0.ESC+"[18~";break;case 119:l.key=i?c.C0.ESC+"[19;"+(i+1)+"~":c.C0.ESC+"[19~";break;case 120:l.key=i?c.C0.ESC+"[20;"+(i+1)+"~":c.C0.ESC+"[20~";break;case 121:l.key=i?c.C0.ESC+"[21;"+(i+1)+"~":c.C0.ESC+"[21~";break;case 122:l.key=i?c.C0.ESC+"[23;"+(i+1)+"~":c.C0.ESC+"[23~";break;case 123:l.key=i?c.C0.ESC+"[24;"+(i+1)+"~":c.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(d&&!p||!o.altKey||o.metaKey)!d||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?l.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(l.key=c.C0.US),o.key==="@"&&(l.key=c.C0.NUL)):o.keyCode===65&&(l.type=1);else{let t=f[o.keyCode],e=t?.[o.shiftKey?1:0];if(e)l.key=c.C0.ESC+e;else if(o.keyCode>=65&&o.keyCode<=90){let r=o.ctrlKey?o.keyCode-64:o.keyCode+32,h=String.fromCharCode(r);o.shiftKey&&(h=h.toUpperCase()),l.key=c.C0.ESC+h}else if(o.keyCode===32)l.key=c.C0.ESC+(o.ctrlKey?c.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let r=o.code.slice(3,4);o.shiftKey||(r=r.toLowerCase()),l.key=c.C0.ESC+r,l.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?l.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?l.key=c.C0.NUL:o.keyCode>=51&&o.keyCode<=55?l.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?l.key=c.C0.DEL:o.keyCode===219?l.key=c.C0.ESC:o.keyCode===220?l.key=c.C0.FS:o.keyCode===221&&(l.key=c.C0.GS)}return l}},482:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},s.utf32ToString=function(a,c=0,f=a.length){let o="";for(let n=c;n<f;++n){let d=a[n];d>65535?(d-=65536,o+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):o+=String.fromCharCode(d)}return o},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,c){let f=a.length;if(!f)return 0;let o=0,n=0;if(this._interim){let d=a.charCodeAt(n++);56320<=d&&d<=57343?c[o++]=1024*(this._interim-55296)+d-56320+65536:(c[o++]=this._interim,c[o++]=d),this._interim=0}for(let d=n;d<f;++d){let p=a.charCodeAt(d);if(55296<=p&&p<=56319){if(++d>=f)return this._interim=p,o;let l=a.charCodeAt(d);56320<=l&&l<=57343?c[o++]=1024*(p-55296)+l-56320+65536:(c[o++]=p,c[o++]=l)}else p!==65279&&(c[o++]=p)}return o}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,c){let f=a.length;if(!f)return 0;let o,n,d,p,l=0,i=0,t=0;if(this.interim[0]){let h=!1,_=this.interim[0];_&=(224&_)==192?31:(240&_)==224?15:7;let v,g=0;for(;(v=63&this.interim[++g])&&g<4;)_<<=6,_|=v;let u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=u-g;for(;t<m;){if(t>=f)return 0;if(v=a[t++],(192&v)!=128){t--,h=!0;break}this.interim[g++]=v,_<<=6,_|=63&v}h||(u===2?_<128?t--:c[l++]=_:u===3?_<2048||_>=55296&&_<=57343||_===65279||(c[l++]=_):_<65536||_>1114111||(c[l++]=_)),this.interim.fill(0)}let e=f-4,r=t;for(;r<f;){for(;!(!(r<e)||128&(o=a[r])||128&(n=a[r+1])||128&(d=a[r+2])||128&(p=a[r+3]));)c[l++]=o,c[l++]=n,c[l++]=d,c[l++]=p,r+=4;if(o=a[r++],o<128)c[l++]=o;else if((224&o)==192){if(r>=f)return this.interim[0]=o,l;if(n=a[r++],(192&n)!=128){r--;continue}if(i=(31&o)<<6|63&n,i<128){r--;continue}c[l++]=i}else if((240&o)==224){if(r>=f)return this.interim[0]=o,l;if(n=a[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=o,this.interim[1]=n,l;if(d=a[r++],(192&d)!=128){r--;continue}if(i=(15&o)<<12|(63&n)<<6|63&d,i<2048||i>=55296&&i<=57343||i===65279)continue;c[l++]=i}else if((248&o)==240){if(r>=f)return this.interim[0]=o,l;if(n=a[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=o,this.interim[1]=n,l;if(d=a[r++],(192&d)!=128){r--;continue}if(r>=f)return this.interim[0]=o,this.interim[1]=n,this.interim[2]=d,l;if(p=a[r++],(192&p)!=128){r--;continue}if(i=(7&o)<<18|(63&n)<<12|(63&d)<<6|63&p,i<65536||i>1114111)continue;c[l++]=i}}return l}}},225:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let c=a(1480),f=[[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]],o=[[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]],n;s.UnicodeV6=class{constructor(){if(this.version="6",!n){n=new Uint8Array(65536),n.fill(1),n[0]=0,n.fill(0,1,32),n.fill(0,127,160),n.fill(2,4352,4448),n[9001]=2,n[9002]=2,n.fill(2,11904,42192),n[12351]=1,n.fill(2,44032,55204),n.fill(2,63744,64256),n.fill(2,65040,65050),n.fill(2,65072,65136),n.fill(2,65280,65377),n.fill(2,65504,65511);for(let d=0;d<f.length;++d)n.fill(0,f[d][0],f[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?n[d]:(function(p,l){let i,t=0,e=l.length-1;if(p<l[0][0]||p>l[e][1])return!1;for(;e>=t;)if(i=t+e>>1,p>l[i][1])t=i+1;else{if(!(p<l[i][0]))return!0;e=i-1}return!1})(d,o)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,p){let l=this.wcwidth(d),i=l===0&&p!==0;if(i){let t=c.UnicodeService.extractWidth(p);t===0?i=!1:t>l&&(l=t)}return c.UnicodeService.createPropertyValue(0,l,i)}}},5981:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let c=a(8460),f=a(844);class o extends f.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let l;for(this._isSyncWriting=!0;l=this._writeBuffer.shift();){this._action(l);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,p){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+=d.length,this._writeBuffer.push(d),this._callbacks.push(p),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(p)}_innerWrite(d=0,p=!0){let l=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],t=this._action(i,p);if(t){let r=h=>Date.now()-l>=12?setTimeout((()=>this._innerWrite(0,h))):this._innerWrite(l,h);return void t.catch((h=>(queueMicrotask((()=>{throw h})),Promise.resolve(!1)))).then(r)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-l>=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()}}s.WriteBuffer=o},5941:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let a=/^([\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})$/,c=/^[\da-f]+$/;function f(o,n){let d=o.toString(16),p=d.length<2?"0"+d:d;switch(n){case 4:return d[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}s.parseColor=function(o){if(!o)return;let n=o.toLowerCase();if(n.indexOf("rgb:")===0){n=n.slice(4);let d=a.exec(n);if(d){let p=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/p*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/p*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/p*255)]}}else if(n.indexOf("#")===0&&(n=n.slice(1),c.exec(n)&&[3,6,9,12].includes(n.length))){let d=n.length/3,p=[0,0,0];for(let l=0;l<3;++l){let i=parseInt(n.slice(d*l,d*l+d),16);p[l]=d===1?i<<4:d===2?i:d===3?i>>4:i>>8}return p}},s.toRgbString=function(o,n=16){let[d,p,l]=o;return`rgb:${f(d,n)}/${f(p,n)}/${f(l,n)}`}},5770:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let c=a(482),f=a(8742),o=a(5770),n=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}registerHandler(p,l){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(l),{dispose:()=>{let t=i.indexOf(l);t!==-1&&i.splice(t,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=n,this._ident=0}hook(p,l){if(this.reset(),this._ident=p,this._active=this._handlers[p]||n,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(l);else this._handlerFb(this._ident,"HOOK",l)}put(p,l,i){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(p,l,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(p,l,i))}unhook(p,l=!0){if(this._active.length){let i=!1,t=this._active.length-1,e=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,i=l,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;t>=0&&(i=this._active[t].unhook(p),i!==!0);t--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,i;t--}for(;t>=0;t--)if(i=this._active[t].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",p);this._active=n,this._ident=0}};let d=new f.Params;d.addParam(0),s.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=d,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():d,this._data="",this._hitLimit=!1}put(p,l,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(p,l,i),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let l=!1;if(this._hitLimit)l=!1;else if(p&&(l=this._handler(this._data,this._params),l instanceof Promise))return l.then((i=>(this._params=d,this._data="",this._hitLimit=!1,i)));return this._params=d,this._data="",this._hitLimit=!1,l}}},2015:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let c=a(844),f=a(8742),o=a(6242),n=a(6351);class d{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,r,h){this.table[e<<8|t]=r<<4|h}addMany(t,e,r,h){for(let _=0;_<t.length;_++)this.table[e<<8|t[_]]=r<<4|h}}s.TransitionTable=d;let p=160;s.VT500_TRANSITION_TABLE=(function(){let i=new d(4095),t=Array.apply(null,Array(256)).map(((g,u)=>u)),e=(g,u)=>t.slice(g,u),r=e(32,127),h=e(0,24);h.push(25),h.push.apply(h,e(28,32));let _=e(0,14),v;for(v in i.setDefault(1,0),i.addMany(r,0,2,0),_)i.addMany([24,26,153,154],v,3,0),i.addMany(e(128,144),v,3,0),i.addMany(e(144,152),v,3,0),i.add(156,v,0,0),i.add(27,v,11,1),i.add(157,v,4,8),i.addMany([152,158,159],v,0,7),i.add(155,v,11,3),i.add(144,v,11,9);return i.addMany(h,0,3,0),i.addMany(h,1,3,1),i.add(127,1,0,1),i.addMany(h,8,0,8),i.addMany(h,3,3,3),i.add(127,3,0,3),i.addMany(h,4,3,4),i.add(127,4,0,4),i.addMany(h,6,3,6),i.addMany(h,5,3,5),i.add(127,5,0,5),i.addMany(h,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(r,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(r,7,0,7),i.addMany(h,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(h,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(h,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(h,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(h,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(h,13,13,13),i.addMany(r,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(p,0,2,0),i.add(p,8,5,8),i.add(p,6,0,6),i.add(p,11,0,11),i.add(p,13,13,13),i})();class l extends c.Disposable{constructor(t=s.VT500_TRANSITION_TABLE){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,r,h)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,r)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new n.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,e=[64,126]){let r=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=t.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let _=0;_<t.intermediates.length;++_){let v=t.intermediates.charCodeAt(_);if(32>v||v>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=v}}if(t.final.length!==1)throw new Error("final must be a single byte");let h=t.final.charCodeAt(0);if(e[0]>h||h>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return r<<=8,r|=h,r}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(255&t)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let r=this._identifier(t,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let h=this._escHandlers[r];return h.push(e),{dispose:()=>{let _=h.indexOf(e);_!==-1&&h.splice(_,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let r=this._identifier(t);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let h=this._csiHandlers[r];return h.push(e),{dispose:()=>{let _=h.indexOf(e);_!==-1&&h.splice(_,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,e,r,h,_){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=r,this._parseStack.transition=h,this._parseStack.chunkPos=_}parse(t,e,r){let h,_=0,v=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(h=u[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(h=u[m](),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 6:if(_=t[this._parseStack.chunkPos],h=this._dcsParser.unhook(_!==24&&_!==26,r),h)return h;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(_=t[this._parseStack.chunkPos],h=this._oscParser.end(_!==24&&_!==26,r),h)return h;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=g;u<e;++u){switch(_=t[u],v=this._transitions.table[this.currentState<<8|(_<160?_:p)],v>>4){case 2:for(let w=u+1;;++w){if(w>=e||(_=t[w])<32||_>126&&_<p){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(_=t[w])<32||_>126&&_<p){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(_=t[w])<32||_>126&&_<p){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(_=t[w])<32||_>126&&_<p){this._printHandler(t,u,w),u=w-1;break}}break;case 3:this._executeHandlers[_]?this._executeHandlers[_]():this._executeHandlerFb(_),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:_,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|_],y=m?m.length-1:-1;for(;y>=0&&(h=m[y](this._params),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(3,m,y,v,u),h;y<0&&this._csiHandlerFb(this._collect<<8|_,this._params),this.precedingJoinState=0;break;case 8:do switch(_){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(_-48)}while(++u<e&&(_=t[u])>47&&_<60);u--;break;case 9:this._collect<<=8,this._collect|=_;break;case 10:let E=this._escHandlers[this._collect<<8|_],C=E?E.length-1:-1;for(;C>=0&&(h=E[C](),h!==!0);C--)if(h instanceof Promise)return this._preserveStack(4,E,C,v,u),h;C<0&&this._escHandlerFb(this._collect<<8|_),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|_,this._params);break;case 13:for(let w=u+1;;++w)if(w>=e||(_=t[w])===24||_===26||_===27||_>127&&_<p){this._dcsParser.put(t,u,w),u=w-1;break}break;case 14:if(h=this._dcsParser.unhook(_!==24&&_!==26),h)return this._preserveStack(6,[],0,v,u),h;_===27&&(v|=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 w=u+1;;w++)if(w>=e||(_=t[w])<32||_>127&&_<p){this._oscParser.put(t,u,w),u=w-1;break}break;case 6:if(h=this._oscParser.end(_!==24&&_!==26),h)return this._preserveStack(5,[],0,v,u),h;_===27&&(v|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&v}}}s.EscapeSequenceParser=l},6242:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let c=a(5770),f=a(482),o=[];s.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(n,d){this._handlers[n]===void 0&&(this._handlers[n]=[]);let p=this._handlers[n];return p.push(d),{dispose:()=>{let l=p.indexOf(d);l!==-1&&p.splice(l,1)}}}clearHandler(n){this._handlers[n]&&delete this._handlers[n]}setHandlerFallback(n){this._handlerFb=n}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let n=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;n>=0;--n)this._active[n].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].start();else this._handlerFb(this._id,"START")}_put(n,d,p){if(this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].put(n,d,p);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(n,d,p))}start(){this.reset(),this._state=1}put(n,d,p){if(this._state!==3){if(this._state===1)for(;d<p;){let l=n[d++];if(l===59){this._state=2,this._start();break}if(l<48||57<l)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+l-48}this._state===2&&p-d>0&&this._put(n,d,p)}}end(n,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,l=this._active.length-1,i=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,p=d,i=this._stack.fallThrough,this._stack.paused=!1),!i&&p===!1){for(;l>=0&&(p=this._active[l].end(n),p!==!0);l--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,p;l--}for(;l>=0;l--)if(p=this._active[l].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",n);this._active=o,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(n){this._handler=n,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(n,d,p){this._hitLimit||(this._data+=(0,f.utf32ToString)(n,d,p),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(n){let d=!1;if(this._hitLimit)d=!1;else if(n&&(d=this._handler(this._data),d instanceof Promise))return d.then((p=>(this._data="",this._hitLimit=!1,p)));return this._data="",this._hitLimit=!1,d}}},8742:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let a=2147483647;class c{static fromArray(o){let n=new c;if(!o.length)return n;for(let d=Array.isArray(o[0])?1:0;d<o.length;++d){let p=o[d];if(Array.isArray(p))for(let l=0;l<p.length;++l)n.addSubParam(p[l]);else n.addParam(p)}return n}constructor(o=32,n=32){if(this.maxLength=o,this.maxSubParamsLength=n,n>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let o=new c(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){let o=[];for(let n=0;n<this.length;++n){o.push(this.params[n]);let d=this._subParamsIdx[n]>>8,p=255&this._subParamsIdx[n];p-d>0&&o.push(Array.prototype.slice.call(this._subParams,d,p))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>a?a:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>a?a:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){let n=this._subParamsIdx[o]>>8,d=255&this._subParamsIdx[o];return d-n>0?this._subParams.subarray(n,d):null}getSubParamsAll(){let o={};for(let n=0;n<this.length;++n){let d=this._subParamsIdx[n]>>8,p=255&this._subParamsIdx[n];p-d>0&&(o[n]=this._subParams.slice(d,p))}return o}addDigit(o){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let d=this._digitIsSub?this._subParams:this.params,p=d[n-1];d[n-1]=~p?Math.min(10*p+o,a):o}}s.Params=c},5741:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,c){let f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===a){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(c,1)}}},8771:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let c=a(3785),f=a(511);s.BufferApiView=class{constructor(o,n){this._buffer=o,this.type=n}init(o){return this._buffer=o,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(o){let n=this._buffer.lines.get(o);if(n)return new c.BufferLineApiView(n)}getNullCell(){return new f.CellData}}},3785:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let c=a(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,o){if(!(f<0||f>=this._line.length))return o?(this._line.loadCell(f,o),o):this._line.loadCell(f,new c.CellData)}translateToString(f,o,n){return this._line.translateToString(f,o,n)}}},8285:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let c=a(8771),f=a(8460),o=a(844);class n extends o.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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)}}s.BufferNamespaceApi=n},7975:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,c){return this._core.registerCsiHandler(a,(f=>c(f.toArray())))}addCsiHandler(a,c){return this.registerCsiHandler(a,c)}registerDcsHandler(a,c){return this._core.registerDcsHandler(a,((f,o)=>c(f,o.toArray())))}addDcsHandler(a,c){return this.registerDcsHandler(a,c)}registerEscHandler(a,c){return this._core.registerEscHandler(a,c)}addEscHandler(a,c){return this.registerEscHandler(a,c)}registerOscHandler(a,c){return this._core.registerOscHandler(a,c)}addOscHandler(a,c){return this.registerOscHandler(a,c)}}},7090:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(D,s,a){var c=this&&this.__decorate||function(i,t,e,r){var h,_=arguments.length,v=_<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(h=i[g])&&(v=(_<3?h(v):_>3?h(t,e,v):h(t,e))||v);return _>3&&v&&Object.defineProperty(t,e,v),v},f=this&&this.__param||function(i,t){return function(e,r){t(e,r,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let o=a(8460),n=a(844),d=a(5295),p=a(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let l=s.BufferService=class extends n.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new d.BufferSet(i,this))}resize(i,t){this.cols=i,this.rows=t,this.buffers.resize(i,t),this._onResize.fire({cols:i,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,t=!1){let e=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===i.fg&&r.getBg(0)===i.bg||(r=e.getBlankLine(i,t),this._cachedBlankLine=r),r.isWrapped=t;let h=e.ybase+e.scrollTop,_=e.ybase+e.scrollBottom;if(e.scrollTop===0){let v=e.lines.isFull;_===e.lines.length-1?v?e.lines.recycle().copyFrom(r):e.lines.push(r.clone()):e.lines.splice(_+1,0,r.clone()),v?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let v=_-h+1;e.lines.shiftElements(h+1,v-1,-1),e.lines.set(_,r.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,t,e){let r=this.buffer;if(i<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else i+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let h=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+i,r.ybase),0),h!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};s.BufferService=l=c([f(0,p.IOptionsService)],l)},7994:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,c){this._charsets[a]=c,this.glevel===a&&(this.charset=c)}}},1753:function(D,s,a){var c=this&&this.__decorate||function(r,h,_,v){var g,u=arguments.length,m=u<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,h,_,v);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(h,_,m):g(h,_))||m);return u>3&&m&&Object.defineProperty(h,_,m),m},f=this&&this.__param||function(r,h){return function(_,v){h(_,v,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let o=a(2585),n=a(8460),d=a(844),p={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:r=>r.button!==4&&r.action===1&&(r.ctrl=!1,r.alt=!1,r.shift=!1,!0)},VT200:{events:19,restrict:r=>r.action!==32},DRAG:{events:23,restrict:r=>r.action!==32||r.button!==3},ANY:{events:31,restrict:r=>!0}};function l(r,h){let _=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(_|=64,_|=r.action):(_|=3&r.button,4&r.button&&(_|=64),8&r.button&&(_|=128),r.action===32?_|=32:r.action!==0||h||(_|=3)),_}let i=String.fromCharCode,t={DEFAULT:r=>{let h=[l(r,!1)+32,r.col+32,r.row+32];return h[0]>255||h[1]>255||h[2]>255?"":`\x1B[M${i(h[0])}${i(h[1])}${i(h[2])}`},SGR:r=>{let h=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${l(r,!0)};${r.col};${r.row}${h}`},SGR_PIXELS:r=>{let h=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${l(r,!0)};${r.x};${r.y}${h}`}},e=s.CoreMouseService=class extends d.Disposable{constructor(r,h){super(),this._bufferService=r,this._coreService=h,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new n.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let _ of Object.keys(p))this.addProtocol(_,p[_]);for(let _ of Object.keys(t))this.addEncoding(_,t[_]);this.reset()}addProtocol(r,h){this._protocols[r]=h}addEncoding(r,h){this._encodings[r]=h}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(r){if(!this._protocols[r])throw new Error(`unknown protocol "${r}"`);this._activeProtocol=r,this._onProtocolChange.fire(this._protocols[r].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(r){if(!this._encodings[r])throw new Error(`unknown encoding "${r}"`);this._activeEncoding=r}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(r){if(r.col<0||r.col>=this._bufferService.cols||r.row<0||r.row>=this._bufferService.rows||r.button===4&&r.action===32||r.button===3&&r.action!==32||r.button!==4&&(r.action===2||r.action===3)||(r.col++,r.row++,r.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,r,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(r))return!1;let h=this._encodings[this._activeEncoding](r);return h&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(h):this._coreService.triggerDataEvent(h,!0)),this._lastEvent=r,!0}explainEvents(r){return{down:!!(1&r),up:!!(2&r),drag:!!(4&r),move:!!(8&r),wheel:!!(16&r)}}_equalEvents(r,h,_){if(_){if(r.x!==h.x||r.y!==h.y)return!1}else if(r.col!==h.col||r.row!==h.row)return!1;return r.button===h.button&&r.action===h.action&&r.ctrl===h.ctrl&&r.alt===h.alt&&r.shift===h.shift}};s.CoreMouseService=e=c([f(0,o.IBufferService),f(1,o.ICoreService)],e)},6975:function(D,s,a){var c=this&&this.__decorate||function(e,r,h,_){var v,g=arguments.length,u=g<3?r:_===null?_=Object.getOwnPropertyDescriptor(r,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,h,_);else for(var m=e.length-1;m>=0;m--)(v=e[m])&&(u=(g<3?v(u):g>3?v(r,h,u):v(r,h))||u);return g>3&&u&&Object.defineProperty(r,h,u),u},f=this&&this.__param||function(e,r){return function(h,_){r(h,_,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let o=a(1439),n=a(8460),d=a(844),p=a(2585),l=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=s.CoreService=class extends d.Disposable{constructor(e,r,h){super(),this._bufferService=e,this._logService=r,this._optionsService=h,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new n.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new n.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new n.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new n.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(l),this.decPrivateModes=(0,o.clone)(i)}reset(){this.modes=(0,o.clone)(l),this.decPrivateModes=(0,o.clone)(i)}triggerDataEvent(e,r=!1){if(this._optionsService.rawOptions.disableStdin)return;let h=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&h.ybase!==h.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((_=>_.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((r=>r.charCodeAt(0))))),this._onBinary.fire(e))}};s.CoreService=t=c([f(0,p.IBufferService),f(1,p.ILogService),f(2,p.IOptionsService)],t)},9074:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let c=a(8055),f=a(8460),o=a(844),n=a(6106),d=0,p=0;class l extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new n.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let r=new i(e);if(r){let h=r.marker.onDispose((()=>r.dispose()));r.onDispose((()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),h.dispose())})),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,r,h){let _=0,v=0;for(let g of this._decorations.getKeyIterator(r))_=g.options.x??0,v=_+(g.options.width??1),e>=_&&e<v&&(!h||(g.options.layer??"bottom")===h)&&(yield g)}forEachDecorationAtCell(e,r,h,_){this._decorations.forEachByKey(r,(v=>{d=v.options.x??0,p=d+(v.options.width??1),e>=d&&e<p&&(!h||(v.options.layer??"bottom")===h)&&_(v)}))}}s.DecorationService=l;class i extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let c=a(2585),f=a(8343);class o{constructor(...d){this._entries=new Map;for(let[p,l]of d)this.set(p,l)}set(d,p){let l=this._entries.get(d);return this._entries.set(d,p),l}forEach(d){for(let[p,l]of this._entries.entries())d(p,l)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}s.ServiceCollection=o,s.InstantiationService=class{constructor(){this._services=new o,this._services.set(c.IInstantiationService,this)}setService(n,d){this._services.set(n,d)}getService(n){return this._services.get(n)}createInstance(n,...d){let p=(0,f.getServiceDependencies)(n).sort(((t,e)=>t.index-e.index)),l=[];for(let t of p){let e=this._services.get(t.id);if(!e)throw new Error(`[createInstance] ${n.name} depends on UNKNOWN service ${t.id}.`);l.push(e)}let i=p.length>0?p[0].index:d.length;if(d.length!==i)throw new Error(`[createInstance] First service dependency of ${n.name} at position ${i+1} conflicts with ${d.length} static arguments`);return new n(...d,...l)}}},7866:function(D,s,a){var c=this&&this.__decorate||function(i,t,e,r){var h,_=arguments.length,v=_<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(h=i[g])&&(v=(_<3?h(v):_>3?h(t,e,v):h(t,e))||v);return _>3&&v&&Object.defineProperty(t,e,v),v},f=this&&this.__param||function(i,t){return function(e,r){t(e,r,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let o=a(844),n=a(2585),d={trace:n.LogLevelEnum.TRACE,debug:n.LogLevelEnum.DEBUG,info:n.LogLevelEnum.INFO,warn:n.LogLevelEnum.WARN,error:n.LogLevelEnum.ERROR,off:n.LogLevelEnum.OFF},p,l=s.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=n.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),p=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let t=0;t<i.length;t++)typeof i[t]=="function"&&(i[t]=i[t]())}_log(i,t,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...e)}trace(i,...t){this._logLevel<=n.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,t)}debug(i,...t){this._logLevel<=n.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,t)}info(i,...t){this._logLevel<=n.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,t)}warn(i,...t){this._logLevel<=n.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,t)}error(i,...t){this._logLevel<=n.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,t)}};s.LogService=l=c([f(0,n.IOptionsService)],l),s.setTraceLogger=function(i){p=i},s.traceCall=function(i,t,e){if(typeof e.value!="function")throw new Error("not supported");let r=e.value;e.value=function(...h){if(p.logLevel!==n.LogLevelEnum.TRACE)return r.apply(this,h);p.trace(`GlyphRenderer#${r.name}(${h.map((v=>JSON.stringify(v))).join(", ")})`);let _=r.apply(this,h);return p.trace(`GlyphRenderer#${r.name} return`,_),_}}},7302:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let c=a(8460),f=a(844),o=a(6114);s.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:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let n=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends f.Disposable{constructor(l){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...s.DEFAULT_OPTIONS};for(let t in l)if(t in i)try{let e=l[t];i[t]=this._sanitizeAndValidateOption(t,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(l,i){return this.onOptionChange((t=>{t===l&&i(this.rawOptions[l])}))}onMultipleOptionChange(l,i){return this.onOptionChange((t=>{l.indexOf(t)!==-1&&i()}))}_setupOptions(){let l=t=>{if(!(t in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},i=(t,e)=>{if(!(t in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);e=this._sanitizeAndValidateOption(t,e),this.rawOptions[t]!==e&&(this.rawOptions[t]=e,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let e={get:l.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,e)}}_sanitizeAndValidateOption(l,i){switch(l){case"cursorStyle":if(i||(i=s.DEFAULT_OPTIONS[l]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${l}`);break;case"wordSeparator":i||(i=s.DEFAULT_OPTIONS[l]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=n.includes(i)?i:s.DEFAULT_OPTIONS[l];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${l} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${l} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${l} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${l} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}s.OptionsService=d},2660:function(D,s,a){var c=this&&this.__decorate||function(d,p,l,i){var t,e=arguments.length,r=e<3?p:i===null?i=Object.getOwnPropertyDescriptor(p,l):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,p,l,i);else for(var h=d.length-1;h>=0;h--)(t=d[h])&&(r=(e<3?t(r):e>3?t(p,l,r):t(p,l))||r);return e>3&&r&&Object.defineProperty(p,l,r),r},f=this&&this.__param||function(d,p){return function(l,i){p(l,i,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let o=a(2585),n=s.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){let p=this._bufferService.buffer;if(d.id===void 0){let h=p.addMarker(p.ybase+p.y),_={data:d,id:this._nextId++,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(_,h))),this._dataByLinkId.set(_.id,_),_.id}let l=d,i=this._getEntryIdKey(l),t=this._entriesWithId.get(i);if(t)return this.addLineToLink(t.id,p.ybase+p.y),t.id;let e=p.addMarker(p.ybase+p.y),r={id:this._nextId++,key:this._getEntryIdKey(l),data:l,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(r,e))),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(d,p){let l=this._dataByLinkId.get(d);if(l&&l.lines.every((i=>i.line!==p))){let i=this._bufferService.buffer.addMarker(p);l.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(l,i)))}}getLinkData(d){return this._dataByLinkId.get(d)?.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,p){let l=d.lines.indexOf(p);l!==-1&&(d.lines.splice(l,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};s.OscLinkService=n=c([f(0,o.IBufferService)],n)},8343:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let a="di$target",c="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[c]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);let o=function(n,d,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(l,i,t){i[a]===i?i[c].push({id:l,index:t}):(i[c]=[{id:l,index:t}],i[a]=i)})(o,n,p)};return o.toString=()=>f,s.serviceRegistry.set(f,o),o}},2585:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;let c=a(8343);var f;s.IBufferService=(0,c.createDecorator)("BufferService"),s.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),s.ICoreService=(0,c.createDecorator)("CoreService"),s.ICharsetService=(0,c.createDecorator)("CharsetService"),s.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(f||(s.LogLevelEnum=f={})),s.ILogService=(0,c.createDecorator)("LogService"),s.IOptionsService=(0,c.createDecorator)("OptionsService"),s.IOscLinkService=(0,c.createDecorator)("OscLinkService"),s.IUnicodeService=(0,c.createDecorator)("UnicodeService"),s.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(D,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let c=a(8460),f=a(225);class o{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,p,l=!1){return(16777215&d)<<3|(3&p)<<1|(l?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;let d=new f.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let p=0,l=0,i=d.length;for(let t=0;t<i;++t){let e=d.charCodeAt(t);if(55296<=e&&e<=56319){if(++t>=i)return p+this.wcwidth(e);let _=d.charCodeAt(t);56320<=_&&_<=57343?e=1024*(e-55296)+_-56320+65536:p+=this.wcwidth(_)}let r=this.charProperties(e,l),h=o.extractWidth(r);o.extractShouldJoin(r)&&(h-=o.extractWidth(l)),p+=h,l=r}return p}charProperties(d,p){return this._activeProvider.charProperties(d,p)}}s.UnicodeService=o}},A={};function O(D){var s=A[D];if(s!==void 0)return s.exports;var a=A[D]={exports:{}};return B[D].call(a.exports,a,a.exports,O),a.exports}var F={};return(()=>{var D=F;Object.defineProperty(D,"__esModule",{value:!0}),D.Terminal=void 0;let s=O(9042),a=O(3236),c=O(844),f=O(5741),o=O(8285),n=O(7975),d=O(7090),p=["cols","rows"];class l extends c.Disposable{constructor(t){super(),this._core=this.register(new a.Terminal(t)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let e=h=>this._core.options[h],r=(h,_)=>{this._checkReadonlyOptions(h),this._core.options[h]=_};for(let h in this._core.options){let _={get:e.bind(this,h),set:r.bind(this,h)};Object.defineProperty(this._publicOptions,h,_)}}_checkReadonlyOptions(t){if(p.includes(t))throw new Error(`Option "${t}" 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 n.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.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 o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,r){this._verifyIntegers(t,e,r),this._core.select(t,e,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
10
|
+
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return s}_verifyIntegers(...t){for(let e of t)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(let e of t)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}D.Terminal=l})(),F})()))});var Tt=pt((nt,mt)=>{(function(B,A){typeof nt=="object"&&typeof mt=="object"?mt.exports=A():typeof define=="function"&&define.amd?define([],A):typeof nt=="object"?nt.FitAddon=A():B.FitAddon=A()})(self,(()=>(()=>{"use strict";var B={};return(()=>{var A=B;Object.defineProperty(A,"__esModule",{value:!0}),A.FitAddon=void 0,A.FitAddon=class{activate(O){this._terminal=O}dispose(){}fit(){let O=this.proposeDimensions();if(!O||!this._terminal||isNaN(O.cols)||isNaN(O.rows))return;let F=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(F._renderService.clear(),this._terminal.resize(O.cols,O.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let O=this._terminal._core,F=O._renderService.dimensions;if(F.css.cell.width===0||F.css.cell.height===0)return;let D=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(s.getPropertyValue("height")),c=Math.max(0,parseInt(s.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),o=a-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),n=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-D;return{cols:Math.max(2,Math.floor(n/F.css.cell.width)),rows:Math.max(1,Math.floor(o/F.css.cell.height))}}}})(),B})()))});var Mt=pt((ot,St)=>{(function(B,A){typeof ot=="object"&&typeof St=="object"?St.exports=A():typeof define=="function"&&define.amd?define([],A):typeof ot=="object"?ot.SearchAddon=A():B.SearchAddon=A()})(self,(()=>(()=>{"use strict";var B={345:(D,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===a)return void this._listeners.splice(c,1)}}})),this._event}fire(a,c){let f=[];for(let o=0;o<this._listeners.length;o++)f.push(this._listeners[o]);for(let o=0;o<f.length;o++)f[o].call(void 0,a,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(a,c){return a((f=>c.fire(f)))},s.runAndSubscribe=function(a,c){return c(void 0),a((f=>c(f)))}},859:(D,s)=>{function a(c){for(let f of c)f.dispose();c.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){let f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){this._isDisposed||c===this._value||(this._value?.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=a,s.getDisposeArrayDisposable=function(c){return{dispose:()=>a(c)}}}},A={};function O(D){var s=A[D];if(s!==void 0)return s.exports;var a=A[D]={exports:{}};return B[D](a,a.exports,O),a.exports}var F={};return(()=>{var D=F;Object.defineProperty(D,"__esModule",{value:!0}),D.SearchAddon=void 0;let s=O(345),a=O(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class f extends a.Disposable{constructor(n){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new a.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new a.MutableDisposable,this._onDidChangeResults=this.register(new s.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=n?.highlightLimit??1e3}activate(n){this._terminal=n,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,a.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let n=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(n,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(n){this._selectedDecoration.clear(),(0,a.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),n||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let p=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||p)&&this._highlightAllMatches(n,d);let l=this._findNextAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,l}_highlightAllMatches(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!n||n.length===0)return void this.clearDecorations();d=d||{},this.clearDecorations(!0);let p=[],l,i=this._find(n,0,0,d);for(;i&&(l?.row!==i.row||l?.col!==i.col)&&!(p.length>=this._highlightLimit);)l=i,p.push(l),i=this._find(n,l.col+l.term.length>=this._terminal.cols?l.row+1:l.row,l.col+l.term.length>=this._terminal.cols?0:l.col+1,d);for(let t of p){let e=this._createResultDecoration(t,d.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}}))}}_find(n,d,p,l){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(p>this._terminal.cols)throw new Error(`Invalid col: ${p} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let t={startRow:d,startCol:p};if(i=this._findInLine(n,t,l),!i)for(let e=d+1;e<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=e,t.startCol=0,i=this._findInLine(n,t,l),!i);e++);return i}_findNextAndSelect(n,d){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let p=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,i=0;p&&(this._cachedSearchTerm===n?(l=p.end.x,i=p.end.y):(l=p.start.x,i=p.start.y)),this._initLinesCache();let t={startRow:i,startCol:l},e=this._findInLine(n,t,d);if(!e)for(let r=i+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=r,t.startCol=0,e=this._findInLine(n,t,d),!e);r++);if(!e&&i!==0)for(let r=0;r<i&&(t.startRow=r,t.startCol=0,e=this._findInLine(n,t,d),!e);r++);return!e&&p&&(t.startRow=p.start.y,t.startCol=0,e=this._findInLine(n,t,d)),this._selectResult(e,d?.decorations,d?.noScroll)}findPrevious(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let p=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||p)&&this._highlightAllMatches(n,d);let l=this._findPreviousAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,l}_didOptionsChange(n,d){return!!d&&(n.caseSensitive!==d.caseSensitive||n.regex!==d.regex||n.wholeWord!==d.wholeWord)}_fireResults(n){if(n?.decorations){let d=-1;if(this._selectedDecoration.value){let p=this._selectedDecoration.value.match;for(let l=0;l<this._highlightDecorations.length;l++){let i=this._highlightDecorations[l].match;if(i.row===p.row&&i.col===p.col&&i.size===p.size){d=l;break}}}this._onDidChangeResults.fire({resultIndex:d,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(n,d){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let p=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols,t=!0;this._initLinesCache();let e={startRow:l,startCol:i},r;if(p&&(e.startRow=l=p.start.y,e.startCol=i=p.start.x,this._cachedSearchTerm!==n&&(r=this._findInLine(n,e,d,!1),r||(e.startRow=l=p.end.y,e.startCol=i=p.end.x))),r||(r=this._findInLine(n,e,d,t)),!r){e.startCol=Math.max(e.startCol,this._terminal.cols);for(let h=l-1;h>=0&&(e.startRow=h,r=this._findInLine(n,e,d,t),!r);h--);}if(!r&&l!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let h=this._terminal.buffer.active.baseY+this._terminal.rows-1;h>=l&&(e.startRow=h,r=this._findInLine(n,e,d,t),!r);h--);return this._selectResult(r,d?.decorations,d?.noScroll)}_initLinesCache(){let n=this._terminal;this._linesCache||(this._linesCache=new Array(n.buffer.active.length),this._linesCacheDisposables.value=(0,a.getDisposeArrayDisposable)([n.onLineFeed((()=>this._destroyLinesCache())),n.onCursorMove((()=>this._destroyLinesCache())),n.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(n,d,p){return(n===0||c.includes(d[n-1]))&&(n+p.length===d.length||c.includes(d[n+p.length]))}_findInLine(n,d,p={},l=!1){let i=this._terminal,t=d.startRow,e=d.startCol;if(i.buffer.active.getLine(t)?.isWrapped)return l?void(d.startCol+=i.cols):(d.startRow--,d.startCol+=i.cols,this._findInLine(n,d,p));let h=this._linesCache?.[t];h||(h=this._translateBufferLineToStringWithWrap(t,!0),this._linesCache&&(this._linesCache[t]=h));let[_,v]=h,g=this._bufferColsToStringOffset(t,e),u=p.caseSensitive?n:n.toLowerCase(),m=p.caseSensitive?_:_.toLowerCase(),y=-1;if(p.regex){let E=RegExp(u,"g"),C;if(l)for(;C=E.exec(m.slice(0,g));)y=E.lastIndex-C[0].length,n=C[0],E.lastIndex-=n.length-1;else C=E.exec(m.slice(g)),C&&C[0].length>0&&(y=g+(E.lastIndex-C[0].length),n=C[0])}else l?g-u.length>=0&&(y=m.lastIndexOf(u,g-u.length)):y=m.indexOf(u,g);if(y>=0){if(p.wholeWord&&!this._isWholeWord(y,m,n))return;let E=0;for(;E<v.length-1&&y>=v[E+1];)E++;let C=E;for(;C<v.length-1&&y+n.length>=v[C+1];)C++;let w=y-v[E],R=y+n.length-v[C],z=this._stringLengthToBufferSize(t+E,w);return{term:n,col:z,row:t+E,size:this._stringLengthToBufferSize(t+C,R)-z+i.cols*(C-E)}}}_stringLengthToBufferSize(n,d){let p=this._terminal.buffer.active.getLine(n);if(!p)return 0;for(let l=0;l<d;l++){let i=p.getCell(l);if(!i)break;let t=i.getChars();t.length>1&&(d-=t.length-1);let e=p.getCell(l+1);e&&e.getWidth()===0&&d++}return d}_bufferColsToStringOffset(n,d){let p=this._terminal,l=n,i=0,t=p.buffer.active.getLine(l);for(;d>0&&t;){for(let e=0;e<d&&e<p.cols;e++){let r=t.getCell(e);if(!r)break;r.getWidth()&&(i+=r.getCode()===0?1:r.getChars().length)}if(l++,t=p.buffer.active.getLine(l),t&&!t.isWrapped)break;d-=p.cols}return i}_translateBufferLineToStringWithWrap(n,d){let p=this._terminal,l=[],i=[0],t=p.buffer.active.getLine(n);for(;t;){let e=p.buffer.active.getLine(n+1),r=!!e&&e.isWrapped,h=t.translateToString(!r&&d);if(r&&e){let _=t.getCell(t.length-1);_&&_.getCode()===0&&_.getWidth()===1&&e.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(l.push(h),!r)break;i.push(i[i.length-1]+h.length),n++,t=e}return[l.join(""),i]}_selectResult(n,d,p){let l=this._terminal;if(this._selectedDecoration.clear(),!n)return l.clearSelection(),!1;if(l.select(n.col,n.row,n.size),d){let i=l.registerMarker(-l.buffer.active.baseY-l.buffer.active.cursorY+n.row);if(i){let t=l.registerDecoration({marker:i,x:n.col,width:n.size,backgroundColor:d.activeMatchBackground,layer:"top",overviewRulerOptions:{color:d.activeMatchColorOverviewRuler}});if(t){let e=[];e.push(i),e.push(t.onRender((r=>this._applyStyles(r,d.activeMatchBorder,!0)))),e.push(t.onDispose((()=>(0,a.disposeArray)(e)))),this._selectedDecoration.value={decoration:t,match:n,dispose(){t.dispose()}}}}}if(!p&&(n.row>=l.buffer.active.viewportY+l.rows||n.row<l.buffer.active.viewportY)){let i=n.row-l.buffer.active.viewportY;i-=Math.floor(l.rows/2),l.scrollLines(i)}return!0}_applyStyles(n,d,p){n.classList.contains("xterm-find-result-decoration")||(n.classList.add("xterm-find-result-decoration"),d&&(n.style.outline=`1px solid ${d}`)),p&&n.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(n,d){let p=this._terminal,l=p.registerMarker(-p.buffer.active.baseY-p.buffer.active.cursorY+n.row);if(!l)return;let i=p.registerDecoration({marker:l,x:n.col,width:n.size,backgroundColor:d.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:d.matchOverviewRuler,position:"center"}});if(i){let t=[];t.push(l),t.push(i.onRender((e=>this._applyStyles(e,d.matchBorder,!1)))),t.push(i.onDispose((()=>(0,a.disposeArray)(t))))}return i}}D.SearchAddon=f})(),F})()))});var mi={};li(mi,{apply:()=>vi,inject:()=>_i});module.exports=hi(mi);var ve=require("react");var ee=require("react");var he="zTerm";async function ie(B,A,O={},F){let D=B.connection;if(!D?.rpc?.call)throw new Error("\u5F53\u524D DSH \u7F3A\u5C11 Connection RPC\uFF0C\u8BF7\u4F7F\u7528\u5DF2\u652F\u6301\u7684\u5BBF\u4E3B\u7248\u672C");let s=await D.rpc.call("/api",`zterm/${A}`,O,F);if(!s.ok)throw new Error(s.error?.message||`${he} \u8BF7\u6C42\u5931\u8D25`);return s.value}function it(B,A,O="text/plain;charset=utf-8"){let F=URL.createObjectURL(new Blob([A],{type:O})),D=document.createElement("a");D.href=F,D.download=B,D.click(),URL.revokeObjectURL(F)}function rt(){return new Date().toISOString().replace(/[-:]/g,"").replace(/T/,"-").slice(0,15)}function Lt(B,A){let O=new Map(B);if(A.reset){O.clear();for(let F of A.snapshots??[])O.set(F.terminalId,{generation:F.generation,text:F.text,seq:A.cursor})}for(let F of A.output??[]){let D=O.get(F.terminalId);D&&D.generation===F.generation&&F.seq<=D.seq||O.set(F.terminalId,{generation:F.generation,text:`${D&&D.generation===F.generation?D.text:""}${F.text}`.slice(-5e5),seq:F.seq})}for(let F of O.keys())A.workspace.terminals.some(D=>D.id===F)||O.delete(F);return O}var ue=require("react"),Ht=vt(At(),1),Ft=vt(Tt(),1),Nt=vt(Mt(),1);var qe=require("react");function Pe(B,A,O,F){try{let D=localStorage.getItem(B),s=D===null?A:Number(D);return Number.isFinite(s)?Math.max(O,Math.min(F,s)):A}catch{return A}}function ze(B,A){try{localStorage.setItem(B,String(A))}catch{}}var Ke=12,at=8,lt=32,bt="dsh-zterm.terminal-font-size",Xe=new Set,ht;function It(B){return Number.isInteger(B)&&B>=at&&B<=lt}function Ct(){try{let B=localStorage.getItem(bt),A=B===null?Ke:Number(B);return It(A)?A:Ke}catch{return ht??Ke}}function Ot(){return ht??=Ct()}function Pt(B){B!==Ot()&&(ht=B,Xe.forEach(A=>A()))}function zt(B){It(B)&&(Pt(B),ze(bt,B))}function Bt(B){(B.key===bt||B.key===null)&&Pt(Ct())}function ci(B){return!Xe.size&&typeof window<"u"&&(ht=Ct(),window.addEventListener("storage",Bt)),Xe.add(B),()=>{Xe.delete(B),!Xe.size&&typeof window<"u"&&window.removeEventListener("storage",Bt)}}function ct(){return(0,qe.useSyncExternalStore)(ci,Ot,()=>Ke)}function Ve(){let B=(0,qe.useRef)(()=>{});return(0,qe.useEffect)(()=>()=>B.current(),[]),(A,O)=>{A.preventDefault(),B.current();let F=()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",F),B.current=()=>{}};B.current=F,window.addEventListener("mousemove",O),window.addEventListener("mouseup",F,{once:!0})}}var Re=require("react/jsx-runtime");function Wt({ctx:B,sessionId:A,terminal:O,buffer:F,visible:D,onError:s}){let a=(0,ue.useRef)(null),c=(0,ue.useRef)(),f=(0,ue.useRef)(),o=(0,ue.useRef)(),n=(0,ue.useRef)(""),d=(0,ue.useRef)(O),p=(0,ue.useRef)(s),l=(0,ue.useRef)(Promise.resolve()),i=(0,ue.useRef)(()=>{}),[t,e]=(0,ue.useState)(""),r=ct(),h=(0,ue.useRef)(r);return h.current=r,d.current=O,p.current=s,(0,ue.useLayoutEffect)(()=>{if(!a.current)return;let _=new Ht.Terminal({cursorBlink:!0,fontSize:h.current,fontFamily:"Menlo, Consolas, monospace",scrollback:5e3,allowProposedApi:!1,convertEol:!1,theme:{background:"#12161d",foreground:"#dce3ed",cursor:"#e4edf8",selectionBackground:"#334b66"}}),v=new Ft.FitAddon,g=new Nt.SearchAddon;_.loadAddon(v),_.loadAddon(g),_.open(a.current),c.current=_,o.current=v,f.current=g,n.current="";let u=!1,m=_.onData(R=>{let z=d.current;z.state==="ready"&&(l.current=l.current.catch(()=>{}).then(async()=>{u||await ie(B,"input",{sessionId:A,terminalId:z.id,generation:z.generation,data:R})}).catch(U=>{u||p.current(U.message)}))}),y;i.current=()=>{if(u||!a.current?.clientWidth)return;v.fit();let R=d.current;R.state==="ready"&&ie(B,"resize",{sessionId:A,terminalId:R.id,generation:R.generation,cols:_.cols,rows:_.rows}).catch(z=>{u||p.current(z.message)})};let E=()=>{clearTimeout(y),y=setTimeout(()=>i.current(),80)},C=new ResizeObserver(E);C.observe(a.current),E();let w=R=>{(R.metaKey||R.ctrlKey)&&R.key.toLowerCase()==="f"&&(R.preventDefault(),document.getElementById(`zterm-find-${O.id}`)?.focus())};return a.current.addEventListener("keydown",w),()=>{u=!0,i.current=()=>{},clearTimeout(y),C.disconnect(),m.dispose(),a.current?.removeEventListener("keydown",w),_.dispose(),c.current=void 0}},[B,A,O.id,O.generation]),(0,ue.useEffect)(()=>{let _=c.current;!_||!F||F.generation!==O.generation||(F.text.startsWith(n.current)?_.write(F.text.slice(n.current.length)):(_.reset(),_.write(F.text)),n.current=F.text)},[F,O.generation]),(0,ue.useLayoutEffect)(()=>{let _=c.current;!_||_.options.fontSize===r||(_.options.fontSize=r,D&&i.current())},[r,D]),(0,ue.useEffect)(()=>{D&&(i.current(),c.current?.focus())},[D,O.state,O.generation]),(0,Re.jsxs)("div",{className:"zt-terminal-screen",style:{display:D?"flex":"none"},children:[(0,Re.jsxs)("div",{className:"zt-terminal-search",children:[(0,Re.jsx)("input",{id:`zterm-find-${O.id}`,"aria-label":"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",placeholder:"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",value:t,onChange:_=>{e(_.target.value),f.current?.findNext(_.target.value)},onKeyDown:_=>{_.key==="Enter"&&f.current?.findNext(t),_.key==="Escape"&&(e(""),c.current?.focus())}}),(0,Re.jsx)("button",{title:"\u4E0A\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findPrevious(t),children:"\u2191"}),(0,Re.jsx)("button",{title:"\u4E0B\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findNext(t),children:"\u2193"}),(0,Re.jsx)("span",{children:"\u7EC8\u7AEF\u8F93\u5165\u76F4\u63A5\u64CD\u4F5C\u5F53\u524D\u673A\u5668"})]}),(0,Re.jsx)("div",{className:"zt-terminal-canvas",ref:a})]})}var ce=require("react");var He={password:"\u5BC6\u7801",key:"\u79C1\u94A5\u5185\u5BB9","key-file":"\u79C1\u94A5\u6587\u4EF6"};var Ee=require("react"),me=require("react/jsx-runtime");function Ye(B){let A=new Map;for(let s of B){let a=s.parentId??"";A.set(a,[...A.get(a)??[],s])}let O=(A.get("")??[]).slice().reverse().map(s=>({...s,depth:0})),F=[],D=new Set;for(;O.length;){let s=O.pop();if(!D.has(s.id)){D.add(s.id),F.push(s);for(let a of(A.get(s.id)??[]).slice().reverse())O.push({...a,depth:s.depth+1})}}return F}function di({folder:B,onEdit:A,onDelete:O}){let F=(0,Ee.useRef)(null),D=(0,Ee.useRef)(null),s=(0,Ee.useId)(),[a,c]=(0,Ee.useState)(!1);(0,Ee.useEffect)(()=>{let n=F.current;n.setAttribute("popover","auto"),D.current.setAttribute("popovertarget",s);let d=()=>{let p=n.matches(":popover-open");if(c(p),!p)return;let l=D.current.getBoundingClientRect();n.style.left=`${Math.max(8,Math.min(l.right-n.offsetWidth,window.innerWidth-n.offsetWidth-8))}px`,n.style.top=`${Math.max(8,l.bottom+n.offsetHeight+4<=window.innerHeight-8?l.bottom+4:l.top-n.offsetHeight-4)}px`,n.querySelector("button")?.focus({preventScroll:!0})};return n.addEventListener("toggle",d),()=>n.removeEventListener("toggle",d)},[s]),(0,Ee.useEffect)(()=>{if(!a)return;let n=()=>F.current?.hidePopover();return window.addEventListener("resize",n),document.addEventListener("scroll",n,!0),()=>{window.removeEventListener("resize",n),document.removeEventListener("scroll",n,!0)}},[a]);let f=n=>{F.current?.hidePopover(),n(B)},o=n=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();let d=[...n.currentTarget.querySelectorAll("button")],p=d.indexOf(document.activeElement),l=n.key==="Home"?0:n.key==="End"?d.length-1:(p+(n.key==="ArrowUp"?-1:1)+d.length)%d.length;d[l]?.focus()};return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("button",{ref:D,className:"zt-folder-action","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${B.label}`,title:"\u6587\u4EF6\u5939\u64CD\u4F5C","aria-haspopup":"menu","aria-controls":s,"aria-expanded":a,children:"\u22EF"}),(0,me.jsxs)("div",{ref:F,id:s,className:"zt-folder-menu",role:"menu","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${B.label}`,onKeyDown:o,children:[(0,me.jsx)("button",{role:"menuitem",onClick:()=>f(A),children:"\u66F4\u540D"}),(0,me.jsx)("button",{role:"menuitem",onClick:()=>f(O),children:"\u5220\u9664"})]})]})}function Ut({folders:B,selected:A,onSelect:O,onEdit:F,onDelete:D}){let[s,a]=(0,Ee.useState)(new Set),c=Ye(B),f=new Set,o=new Set(B.map(n=>n.parentId));return(0,me.jsxs)("nav",{className:"zt-folder-tree","aria-label":"\u4E3B\u673A\u6587\u4EF6\u5939",children:[(0,me.jsx)("button",{className:A===""?"active":"",onClick:()=>O(""),children:"\u25B1 \u6839\u76EE\u5F55(\u5168\u90E8\u4E3B\u673A)"}),c.map(n=>n.parentId&&(s.has(n.parentId)||f.has(n.parentId))?(f.add(n.id),null):(0,me.jsxs)("div",{style:{paddingLeft:`min(${Math.min(8,n.depth)*12}px, 25%)`},children:[(0,me.jsx)("button",{className:"zt-folder-toggle","aria-label":`${s.has(n.id)?"\u5C55\u5F00":"\u6536\u8D77"}\u6587\u4EF6\u5939 ${n.label}`,disabled:!o.has(n.id),onClick:()=>a(d=>{let p=new Set(d);return p.has(n.id)?p.delete(n.id):p.add(n.id),p}),children:o.has(n.id)?s.has(n.id)?"\u25B8":"\u25BE":"\xB7"}),(0,me.jsxs)("button",{className:`zt-folder-name${A===n.id?" active":""}`,onClick:()=>O(n.id),title:n.label,children:["\u25B1 ",n.label]}),(0,me.jsx)(di,{folder:n,onEdit:F,onDelete:D})]},n.id))]})}var W=require("react/jsx-runtime");function Fe({title:B,children:A,onClose:O}){let F=(0,ce.useRef)(null),D=(0,ce.useRef)(O);return D.current=O,(0,ce.useEffect)(()=>{let s=document.activeElement,a=F.current;(a?.querySelector("input,select,textarea")??a?.querySelector("button")??a)?.focus();let c=f=>{if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),D.current();return}if(f.key!=="Tab")return;let o=[...a?.querySelectorAll('button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')??[]].filter(p=>p.offsetParent!==null),n=o[0],d=o.at(-1);n?f.shiftKey&&(document.activeElement===n||document.activeElement===a)?(f.preventDefault(),d?.focus()):!f.shiftKey&&document.activeElement===d&&(f.preventDefault(),n.focus()):(f.preventDefault(),a?.focus())};return a?.addEventListener("keydown",c),()=>{a?.removeEventListener("keydown",c),s?.isConnected&&s.focus()}},[]),(0,W.jsx)("div",{className:"zt-modal-shade",onMouseDown:s=>{s.target===s.currentTarget&&O()},children:(0,W.jsxs)("section",{ref:F,tabIndex:-1,className:"zt-modal",role:"dialog","aria-modal":"true","aria-label":B,children:[(0,W.jsxs)("header",{children:[(0,W.jsx)("strong",{children:B}),(0,W.jsx)("button",{"aria-label":"\u5173\u95ED\u5BF9\u8BDD\u6846",onClick:O,children:"\xD7"})]}),A]})})}function _e({title:B,children:A}){return(0,W.jsxs)("label",{className:"zt-field",children:[(0,W.jsx)("span",{children:B}),A]})}function $t({ctx:B,host:A,folders:O,credentials:F=[],defaultCredentialId:D,revision:s,onClose:a,onSaved:c}){let[f,o]=(0,ce.useState)({label:A?.label??"",host:A?.host??"",port:String(A?.port??22),username:A?.username??"",authType:A?.authType??"key-file",privateKeyPath:A?.privateKeyPath??"",folderId:A?.folderId??""}),[n,d]=(0,ce.useState)(""),[p,l]=(0,ce.useState)(""),[i,t]=(0,ce.useState)(!1),[e,r]=(0,ce.useState)(""),[h,_]=(0,ce.useState)(!1),[v,g]=(0,ce.useState)(A?.credentialId||!A&&F.length?"saved":A?.authType??"key-file"),[u,m]=(0,ce.useState)(A?.credentialId||D||F[0]?.id||""),y=A&&!A.credentialId&&A.authType===v,E=(C,w)=>o(R=>({...R,[C]:w}));return(0,W.jsx)(Fe,{title:A?"\u7F16\u8F91\u8FDC\u7A0B\u4E3B\u673A":"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A",onClose:a,children:(0,W.jsxs)("form",{onSubmit:C=>{C.preventDefault(),_(!0),r(""),ie(B,"host/save",{host:{...A,...f,credentialId:v==="saved"?u:void 0,folderId:f.folderId||void 0,port:Number(f.port),kind:"ssh"},secret:v==="saved"?"":n,passphrase:v==="saved"?"":p,clearPassphrase:i,revision:s}).then(()=>{d(""),l(""),c(),a()}).catch(w=>r(w.message)).finally(()=>_(!1))},children:[(0,W.jsx)(_e,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:f.label,onChange:C=>E("label",C.target.value)})}),(0,W.jsxs)("div",{className:"zt-form-row",children:[(0,W.jsx)(_e,{title:"\u4E3B\u673A\u5730\u5740",children:(0,W.jsx)("input",{required:!0,value:f.host,placeholder:"\u4E3B\u673A\u540D\u6216 IP",onChange:C=>E("host",C.target.value)})}),(0,W.jsx)(_e,{title:"\u7AEF\u53E3",children:(0,W.jsx)("input",{type:"number",required:!0,min:"1",max:"65535",value:f.port,onChange:C=>E("port",C.target.value)})})]}),(0,W.jsx)(_e,{title:"\u767B\u5F55\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:f.username,onChange:C=>E("username",C.target.value)})}),(0,W.jsx)(_e,{title:"\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:f.folderId,onChange:C=>E("folderId",C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).map(C=>(0,W.jsxs)("option",{value:C.id,children:["\u3000".repeat(Math.min(8,C.depth)),C.label]},C.id))]})}),(0,W.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:v,onChange:C=>{g(C.target.value),C.target.value!=="saved"&&E("authType",C.target.value),d(""),l(""),t(!1)},children:[(0,W.jsx)("option",{value:"saved",children:"\u9009\u62E9\u5DF2\u4FDD\u5B58\u51ED\u8BC1"}),(0,W.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,W.jsx)("option",{value:"key",children:"\u79C1\u94A5\u5185\u5BB9"}),(0,W.jsx)("option",{value:"key-file",children:"\u79C1\u94A5\u6587\u4EF6"})]})}),v==="saved"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_e,{title:"\u767B\u5F55\u51ED\u8BC1",children:(0,W.jsxs)("select",{required:!0,value:u,onChange:C=>m(C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u8BF7\u9009\u62E9\u51ED\u8BC1"}),F.map(C=>(0,W.jsxs)("option",{value:C.id,children:[C.label," \xB7 ",He[C.authType]]},C.id))]})}),(0,W.jsx)("p",{className:"zt-hint",children:"\u51ED\u8BC1\u5728\u300C\u8BBE\u7F6E \u2192 zTerm \u2192 \u7BA1\u7406\u51ED\u8BC1\u300D\u4E2D\u4FDD\u5B58\uFF0C\u6B64\u5904\u65E0\u9700\u518D\u586B\u5185\u5BB9\u6216\u8DEF\u5F84\u3002"})]}),["password","key"].includes(v)&&(0,W.jsx)(_e,{title:f.authType==="key"?"\u79C1\u94A5\u5185\u5BB9":"\u5BC6\u7801",children:f.authType==="key"?(0,W.jsx)("textarea",{rows:5,value:n,placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9",onChange:C=>d(C.target.value),spellCheck:!1,required:!y}):(0,W.jsx)("input",{type:"password",value:n,autoComplete:"new-password",placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>d(C.target.value),required:!y})}),v==="key-file"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_e,{title:"\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84",children:(0,W.jsx)("input",{value:f.privateKeyPath,placeholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6",onChange:C=>E("privateKeyPath",C.target.value)})}),(0,W.jsx)("p",{className:"zt-hint",children:"\u586B\u5199 DSH \u5BBF\u4E3B\u4E0A\u7684\u7EDD\u5BF9\u8DEF\u5F84\u6216 ~/ \u8DEF\u5F84\u3002DSH \u90E8\u7F72\u5728\u8FDC\u7AEF\u65F6\uFF0C\u586B\u5199\u8FDC\u7AEF\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})]}),["key","key-file"].includes(v)&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_e,{title:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09",children:(0,W.jsx)("input",{type:"password",disabled:i,value:p,placeholder:"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4",onChange:C=>l(C.target.value)})}),A?.passphraseRef&&(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:i,onChange:C=>t(C.target.checked)}),"\u79FB\u9664\u6B64\u4E3B\u673A\u7684\u79C1\u94A5\u53E3\u4EE4\u5F15\u7528"]})]}),(0,W.jsx)("p",{className:"zt-hint",children:"\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u4FDD\u5B58\u5728 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u7531\u5BBF\u4E3B\u8BFB\u53D6\u3002\u6240\u6709\u65B0\u8FDE\u63A5\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\u3002"}),e&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:e}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:a,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u4E3B\u673A"})]})]})})}function jt({ctx:B,profile:A,revision:O,onClose:F,onSaved:D}){let[s,a]=(0,ce.useState)({label:A?.label??"",baseUrl:A?.baseUrl??"",authMode:A?.authMode??"access_key",username:A?.username??"",verifyTls:A?.verifyTls??!0}),[c,f]=(0,ce.useState)(""),[o,n]=(0,ce.useState)(""),[d,p]=(0,ce.useState)(""),[l,i]=(0,ce.useState)(!1);return(0,W.jsx)(Fe,{title:A?"\u7F16\u8F91 JumpServer":"\u6DFB\u52A0 JumpServer",onClose:F,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),i(!0),p(""),ie(B,"jump/save",{profile:{...A,...s},secret:c,accessKeyId:o,revision:O}).then(()=>{f(""),n(""),D(),F()}).catch(e=>p(e.message)).finally(()=>i(!1))},children:[(0,W.jsx)(_e,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:s.label,onChange:t=>a({...s,label:t.target.value})})}),(0,W.jsx)(_e,{title:"\u670D\u52A1\u5730\u5740",children:(0,W.jsx)("input",{required:!0,type:"url",value:s.baseUrl,placeholder:"https://jump.example.com",onChange:t=>a({...s,baseUrl:t.target.value})})}),(0,W.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:s.authMode,onChange:t=>a({...s,authMode:t.target.value}),children:[(0,W.jsx)("option",{value:"access_key",children:"Access Key"}),(0,W.jsx)("option",{value:"token",children:"Token"}),(0,W.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"})]})}),s.authMode==="access_key"&&(0,W.jsx)(_e,{title:"Access Key ID",children:(0,W.jsx)("input",{type:"password",value:o,placeholder:A?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>n(t.target.value)})}),s.authMode==="password"&&(0,W.jsx)(_e,{title:"\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:s.username,onChange:t=>a({...s,username:t.target.value})})}),(0,W.jsx)(_e,{title:s.authMode==="access_key"?"Access Key Secret":s.authMode==="token"?"Token":"\u5BC6\u7801",children:(0,W.jsx)("input",{type:"password",value:c,placeholder:A?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>f(t.target.value)})}),(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:s.verifyTls,onChange:t=>a({...s,verifyTls:t.target.checked})}),"\u9A8C\u8BC1 TLS \u8BC1\u4E66"]}),(0,W.jsx)("p",{className:"zt-hint",children:"\u8FDE\u63A5\u4F7F\u7528\u8D44\u4EA7\u4E0E\u8D26\u53F7\u7684\u7A33\u5B9A ID\uFF0C\u4EE4\u724C\u4EC5\u5728\u5BBF\u4E3B\u5185\u90E8\u5904\u7406\u3002"}),d&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:d}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:F,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:l,children:l?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u5B9E\u4F8B"})]})]})})}function Kt({ctx:B,folder:A,folders:O,revision:F,onClose:D,onSaved:s}){let[a,c]=(0,ce.useState)(A?.label??""),[f,o]=(0,ce.useState)(A?.parentId??""),[n,d]=(0,ce.useState)(""),[p,l]=(0,ce.useState)(!1),i=new Set;if(A){i.add(A.id);for(let t of Ye(O))t.parentId&&i.has(t.parentId)&&i.add(t.id)}return(0,W.jsx)(Fe,{title:A?"\u7F16\u8F91\u4E3B\u673A\u6587\u4EF6\u5939":"\u65B0\u5EFA\u4E3B\u673A\u6587\u4EF6\u5939",onClose:D,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),l(!0),ie(B,"folder/save",{folder:{id:A?.id,label:a,parentId:f||void 0},revision:F}).then(()=>{s(),D()}).catch(e=>d(e.message)).finally(()=>l(!1))},children:[(0,W.jsx)(_e,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:a,onChange:t=>c(t.target.value)})}),(0,W.jsx)(_e,{title:"\u7236\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:f,onChange:t=>o(t.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).filter(t=>!i.has(t.id)).map(t=>(0,W.jsxs)("option",{value:t.id,children:["\u3000".repeat(Math.min(8,t.depth)),t.label]},t.id))]})}),n&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:n}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:D,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{disabled:p,className:"zt-primary",children:p?"\u4FDD\u5B58\u4E2D\u2026":A?"\u4FDD\u5B58":"\u521B\u5EFA"})]})]})})}var Ae=require("react");var Me=require("react/jsx-runtime");function qt({ctx:B,instanceId:A,nodes:O,selected:F,onSelect:D,onError:s}){let[a,c]=(0,Ae.useState)(new Map),[f,o]=(0,Ae.useState)(new Set),[n,d]=(0,Ae.useState)(new Set),p=(0,Ae.useRef)(!0),l=(0,Ae.useRef)(new AbortController);(0,Ae.useEffect)(()=>()=>{p.current=!1,l.current.abort()},[]);let i=async h=>{if(f.has(h.nodeId)){o(_=>{let v=new Set(_);return v.delete(h.nodeId),v});return}if(!a.has(h.nodeId)){d(_=>new Set(_).add(h.nodeId));try{let _=await ie(B,"jump/query",{instanceId:A,operation:"nodes",parentKey:h.key||h.nodeId},l.current.signal);if(!p.current)return;c(v=>new Map(v).set(h.nodeId,_.nodes??[]))}catch(_){p.current&&s(_.message);return}finally{p.current&&d(_=>{let v=new Set(_);return v.delete(h.nodeId),v})}}o(_=>new Set(_).add(h.nodeId))},t=O.slice().reverse().map(h=>({node:h,depth:0})),e=[],r=new Set;for(;t.length&&e.length<500;){let h=t.pop();if(!r.has(h.node.nodeId)&&(r.add(h.node.nodeId),e.push(h),f.has(h.node.nodeId)))for(let _ of(a.get(h.node.nodeId)??[]).slice().reverse())t.push({node:_,depth:h.depth+1})}return(0,Me.jsxs)("nav",{className:"zt-folder-tree","aria-label":"JumpServer \u8D44\u4EA7\u8282\u70B9",children:[(0,Me.jsx)("button",{className:F?"":"active",onClick:()=>D(""),children:"\u25A4 \u5168\u90E8\u8D44\u4EA7"}),e.map(({node:h,depth:_})=>(0,Me.jsxs)("div",{style:{paddingLeft:Math.min(8,_)*12},children:[(0,Me.jsx)("button",{className:"zt-folder-toggle",disabled:!h.hasChildren||n.has(h.nodeId),"aria-label":`\u5C55\u5F00\u8D44\u4EA7\u8282\u70B9 ${h.name}`,onClick:()=>void i(h),children:n.has(h.nodeId)?"\u2026":h.hasChildren?f.has(h.nodeId)?"\u25BE":"\u25B8":"\xB7"}),(0,Me.jsxs)("button",{className:F===h.nodeId?"active":"",onClick:()=>D(h.nodeId),title:h.name,children:[h.name," (",h.assetCount,")"]})]},h.nodeId)),t.length>0&&(0,Me.jsx)("p",{className:"zt-hint",children:"\u8282\u70B9\u663E\u793A\u5DF2\u8FBE 500 \u9879\uFF0C\u8BF7\u6536\u8D77\u90E8\u5206\u8282\u70B9\u3002"})]})}var Ne=require("react");var dt=require("react/jsx-runtime");function wt({children:B,label:A,storageKey:O}){let F=(0,Ne.useRef)(null),D=Ve(),[s,a]=(0,Ne.useState)(()=>Pe(O,165,56,Number.MAX_SAFE_INTEGER)),[c,f]=(0,Ne.useState)(165);(0,Ne.useLayoutEffect)(()=>{let i=F.current?.parentElement;if(!i)return;let t=()=>f(Math.max(8,i.clientHeight-120));t();let e=new ResizeObserver(t);return e.observe(i),()=>e.disconnect()},[]);let o=Math.min(56,c),n=Math.max(o,Math.min(c,s)),d=i=>{let t=Math.max(o,Math.min(c,Math.round(i)));a(t),ze(O,t)};return(0,dt.jsxs)("div",{ref:F,className:"zt-tree-pane",style:{height:n},children:[B,(0,dt.jsx)("div",{className:"zt-tree-handle",role:"separator","aria-label":A,"aria-orientation":"horizontal",tabIndex:0,"aria-valuemin":o,"aria-valuemax":c,"aria-valuenow":n,onMouseDown:i=>{if(i.button!==0)return;let t=i.clientY,e=F.current?.getBoundingClientRect().height??n;D(i,r=>d(e+r.clientY-t))},onKeyDown:i=>{let t;if(i.key==="ArrowUp")t=n-10;else if(i.key==="ArrowDown")t=n+10;else if(i.key==="Home")t=o;else if(i.key==="End")t=c;else return;i.preventDefault(),d(t)}})]})}var M=require("react/jsx-runtime"),Vt={terminals:[],operations:[],revision:0,capabilities:{local:!1,external:!1},hostPlatform:""},Gt={connecting:"\u8FDE\u63A5\u4E2D",ready:"\u5DF2\u8FDE\u63A5",disconnected:"\u5DF2\u65AD\u5F00",error:"\u8FDE\u63A5\u5931\u8D25",executing:"\u6267\u884C\u4E2D",completed:"\u5B8C\u6210",failed:"\u5931\u8D25",unknown:"\u7ED3\u679C\u4E0D\u660E",blocked:"\u5DF2\u62D2\u7EDD",not_sent:"\u672A\u4E0B\u53D1"},ut=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`page-${Date.now()}-${Math.random()}`;function yt({ctx:B,sessionId:A,visible:O=!0,onClose:F}){let[D,s]=(0,ee.useState)(Vt),[a,c]=(0,ee.useState)(new Map),[f,o]=(0,ee.useState)(""),[n,d]=(0,ee.useState)(""),[p,l]=(0,ee.useState)(),[i,t]=(0,ee.useState)(""),[e,r]=(0,ee.useState)(0),[h,_]=(0,ee.useState)(""),[v,g]=(0,ee.useState)("ssh"),[u,m]=(0,ee.useState)(!1),[y,E]=(0,ee.useState)(!1),[C,w]=(0,ee.useState)(!1),[R,z]=(0,ee.useState)(""),[U,q]=(0,ee.useState)(""),[$,S]=(0,ee.useState)([]),[x,k]=(0,ee.useState)(),[L,H]=(0,ee.useState)(),[K,X]=(0,ee.useState)(),[Z,T]=(0,ee.useState)(!1),[b,P]=(0,ee.useState)(!1),[N,V]=(0,ee.useState)(()=>Pe("dsh-zterm.list-width",240,180,440)),[j,te]=(0,ee.useState)(!1),[ne,oe]=(0,ee.useState)(!1),[fe,J]=(0,ee.useState)(),be=(0,ee.useRef)(!0),We=(0,ee.useRef)(O),Be=(0,ee.useRef)(-1),Ue=(0,ee.useRef)(async()=>{}),Ie=(0,ee.useRef)(f),ge=(0,ee.useRef)(0),ke=(0,ee.useRef)(0),Ce=(0,ee.useRef)(null),Te=(0,ee.useRef)(null),Ge=Ve();We.current=O,Ie.current=f;let se=(0,ee.useCallback)(I=>d(I),[]);(0,ee.useEffect)(()=>{be.current=!0,s(Vt),c(new Map),Be.current=-1;let I=!1,re=!1,le,Oe,je=new AbortController,ii=async()=>{try{re||(await ie(B,"client/attach",{sessionId:A,pageId:ut},je.signal),re=!0);let De=await ie(B,"poll",{sessionId:A,cursor:Be.current},je.signal);if(I)return;Be.current=De.cursor,s(De.workspace),c(_t=>Lt(_t,De)),De.workspace.terminals.some(_t=>_t.id===Ie.current)||o(De.workspace.terminals[0]?.id??"")}catch(De){I||d(De instanceof Error?De.message:"\u65E0\u6CD5\u8BFB\u53D6\u7EC8\u7AEF\u72B6\u6001")}},Et=()=>Oe||(Oe=ii().finally(()=>{Oe=void 0}),Oe),kt=async()=>{await Et(),I||(le=setTimeout(kt,We.current?200:1e3))};return Ue.current=Et,kt(),ie(B,"saved-workspace",{sessionId:A}).then(De=>{I||oe(De.length>0)}).catch(()=>{}),()=>{I=!0,be.current=!1,clearTimeout(le),je.abort()}},[B,A]);let we=(0,ee.useCallback)(async I=>{let re=++ge.current,le=await ie(B,"catalog",{query:i,offset:e,folderId:h||void 0},I);I?.aborted||re!==ge.current||!be.current||(l(le),!R&&le.jumpservers.length&&z(le.jumpservers[0].id))},[B,i,e,h,R]);(0,ee.useEffect)(()=>{let I=new AbortController,re=setTimeout(()=>{we(I.signal).catch(le=>{I.signal.aborted||se(le.message)})},150);return()=>{clearTimeout(re),I.abort()}},[we,se,D.catalogRevision]);let ae=(0,ee.useCallback)(async(I,re={})=>{te(!0),d("");try{let le=await ie(B,I,{sessionId:A,pageId:ut,...re});if(be.current)return await Ue.current(),le}catch(le){be.current&&se(le instanceof Error?le.message:"\u64CD\u4F5C\u5931\u8D25")}finally{be.current&&te(!1)}},[B,A,se]),Le=async I=>{let re=await ae("connect",{target:I});re?.id&&o(re.id)};(0,ee.useEffect)(()=>{if(!O||!Ce.current)return;let I=()=>Te.current?.scrollIntoView({block:"nearest",inline:"nearest"});I();let re=new ResizeObserver(I);return re.observe(Ce.current),()=>re.disconnect()},[f,O,D.terminals.length]);let Y=D.terminals.find(I=>I.id===f),xe=D.binding,Ze=Y&&xe?.terminalId===Y.id&&xe.generation===Y.generation,pe=D.terminals.find(I=>I.trust),$e=pe?{terminalId:pe.id,generation:pe.generation}:{},Qe=I=>I.target.source==="local"?I.target.label:`${I.target.username??""}@${I.target.host??I.target.label}${I.target.port?`:${I.target.port}`:""}`,Je=Y?{terminalId:Y.id,generation:Y.generation}:{},et=p?.jumpservers?.find(I=>I.id===R);(0,ee.useEffect)(()=>{if(v!=="jumpserver"||!R)return;let I=!0;return S([]),ie(B,"jump/query",{instanceId:R,operation:"nodes"}).then(re=>{I&&S(re.nodes??[])}).catch(re=>{I&&se(re.message)}),()=>{I=!1}},[B,R,v,se]),(0,ee.useEffect)(()=>{if(v!=="jumpserver"||!R)return;let I=!0;k(void 0);let re=setTimeout(()=>{ie(B,"jump/query",{instanceId:R,operation:"assets",nodeId:U||void 0,query:i,offset:e,limit:100}).then(le=>{I&&k(le)}).catch(le=>{I&&se(le.message)})},200);return()=>{I=!1,clearTimeout(re)}},[B,R,U,i,e,v,se]),(0,ee.useEffect)(()=>{ke.current++,H(void 0)},[R,v]);let ei=async I=>{let re=++ke.current;X(I),H(void 0);try{let le=await ie(B,"jump/query",{instanceId:R,operation:"accounts",assetId:I.assetId});re===ke.current&&be.current&&H(le.accounts)}catch(le){re===ke.current&&be.current&&se(le.message)}},ti=I=>{let re=I.clientX,le=N;Ge(I,Oe=>{let je=Math.max(180,Math.min(440,le+re-Oe.clientX));V(je),ze("dsh-zterm.list-width",je)})};return(0,M.jsxs)("div",{className:"zt-workbench",children:[n&&(0,M.jsxs)("div",{className:"zt-error-banner",role:"alert",children:[(0,M.jsx)("span",{children:n}),(0,M.jsx)("button",{"aria-label":"\u5173\u95ED\u9519\u8BEF\u63D0\u793A",onClick:()=>d(""),children:"\xD7"})]}),(0,M.jsxs)("div",{className:"zt-workbench-body",children:[(0,M.jsxs)("main",{className:"zt-terminal-area",children:[(0,M.jsxs)("div",{className:"zt-terminal-topbar",children:[(0,M.jsx)("nav",{ref:Ce,className:"zt-terminal-tabs","aria-label":"\u7EC8\u7AEF\u6807\u7B7E",children:D.terminals.map(I=>(0,M.jsxs)("div",{ref:I.id===f?Te:void 0,className:`zt-tab ${I.id===f?"active":""}`,children:[(0,M.jsxs)("button",{onClick:()=>o(I.id),title:Qe(I),children:[(0,M.jsx)("i",{className:`zt-state-dot ${I.state}`}),I.target.label]}),(0,M.jsx)("button",{"aria-label":`\u5173\u95ED\u7EC8\u7AEF ${I.target.label}`,onClick:()=>J({text:`\u5173\u95ED\u300C${I.target.label}\u300D\u7684\u7EC8\u7AEF\u8FDE\u63A5\uFF1F`,act:()=>{ae("close",{terminalId:I.id}),J(void 0)}}),children:"\xD7"})]},I.id))}),(0,M.jsxs)("div",{className:"zt-terminal-controls",children:[(0,M.jsx)("button",{disabled:!D.capabilities.local||j,title:D.capabilities.local?"\u6BCF\u6B21\u70B9\u51FB\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\uFF0C\u8FD0\u884C\u5728 DSH \u6240\u5728\u7684\u673A\u5668\u4E0A":`\u8BF7\u5728 ${he} \u8BBE\u7F6E\u4E2D\u542F\u7528\u672C\u5730\u7EC8\u7AEF\u5E76\u4FDD\u5B58`,onClick:()=>void Le({kind:"local"}),children:"\u6253\u5F00\u672C\u673A\u7EC8\u7AEF"}),(0,M.jsx)("button",{title:"\u64CD\u4F5C\u8BB0\u5F55",onClick:()=>T(!Z),children:"\u8BB0\u5F55"}),b&&(0,M.jsx)("button",{title:"\u663E\u793A\u673A\u5668\u5217\u8868","aria-expanded":!1,onClick:()=>P(!1),children:"\u673A\u5668\u5217\u8868"}),F&&(0,M.jsx)("button",{"aria-label":`\u6536\u8D77 ${he}`,onClick:F,children:"\xD7"})]})]}),Y?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)("div",{className:"zt-terminal-toolbar",children:[(0,M.jsxs)("div",{className:"zt-target",title:Qe(Y),children:[Qe(Y),(0,M.jsxs)("span",{children:[Gt[Y.state],Y.busy?" \xB7 AI \u6267\u884C\u4E2D":""]})]}),(0,M.jsxs)("div",{className:"zt-actions",children:[(0,M.jsx)("button",{disabled:j||Y.state!=="ready"||!Y.agentReady||Y.uncertain,onClick:()=>void ae("bind",Je),children:Ze?"\u5DF2\u7ED1\u5B9A AI":"\u7ED1\u5B9A AI"}),(0,M.jsxs)("label",{className:`zt-mode ${Ze&&xe.mode==="readwrite"?"write":""}`,title:"\u672A\u52FE\u9009\uFF1A\u8BFB\u6A21\u5F0F\uFF0CAI \u4EC5\u53EF\u4F7F\u7528\u5185\u7F6E\u67E5\u8BE2\u5DE5\u5177\uFF1B\u52FE\u9009\uFF1A\u8BFB\u5199\u6A21\u5F0F\uFF0CAI \u53EF\u6267\u884C\u5DF2\u6388\u6743\u7684\u547D\u4EE4\u3002",children:[(0,M.jsx)("input",{type:"checkbox","aria-label":"\u5141\u8BB8AI\u5199\u64CD\u4F5C",checked:!!(Ze&&xe.mode==="readwrite"),disabled:!Ze||j||!Y.agentReady||Y.uncertain,onChange:I=>void ae("mode",{...Je,mode:I.target.checked?"readwrite":"read"})}),"\u5141\u8BB8AI\u5199\u64CD\u4F5C"]}),(0,M.jsx)("button",{disabled:!Y.busy,onClick:()=>void ae("stop",Je),children:"\u505C\u6B62"}),(0,M.jsx)("button",{disabled:j||Y.busy,onClick:()=>void ae(Y.state==="ready"?"disconnect":"reconnect",Je),children:Y.state==="ready"?"\u65AD\u5F00":"\u91CD\u8FDE"})]})]}),!Y.agentReady&&Y.state==="ready"&&!Y.uncertain&&(0,M.jsxs)("div",{className:"zt-notice",children:["\u624B\u5DE5\u8F93\u5165\u540E\uFF0CAI \u5DF2\u6682\u505C\u64CD\u4F5C\u3002\u786E\u8BA4\u7EC8\u7AEF\u56DE\u5230\u7A7A\u95F2 Shell \u540E\uFF1A",(0,M.jsx)("button",{onClick:()=>void ae("shell-ready",Je),children:"\u786E\u8BA4\u7A7A\u95F2 Shell"})]}),Y.uncertain&&(0,M.jsx)("div",{className:"zt-notice danger",children:"\u524D\u6B21\u64CD\u4F5C\u7ED3\u679C\u4E0D\u660E\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u4E0B\u53D1\u3002\u6838\u5B9E\u673A\u5668\u72B6\u6001\u540E\u91CD\u65B0\u5EFA\u7ACB\u8FDE\u63A5\u3002"}),Y.error&&(0,M.jsx)("div",{className:"zt-notice danger",children:Y.error})]}):(0,M.jsxs)("div",{className:"zt-empty",children:[(0,M.jsx)("div",{className:"zt-terminal-mark",children:">_"}),(0,M.jsx)("h3",{children:"\u8FDE\u63A5\u4E00\u53F0\u673A\u5668"}),(0,M.jsxs)("p",{children:["\u4ECE\u53F3\u4FA7\u9009\u62E9\u4E3B\u673A\u6216 JumpServer \u8D44\u4EA7\u3002",(0,M.jsx)("br",{}),"\u8FDE\u63A5\u540E\u53EF\u624B\u5DE5\u64CD\u4F5C\uFF0C\u6216\u7ED1\u5B9A\u7ED9\u5F53\u524D DSH \u5BF9\u8BDD\u4E2D\u7684 AI\u3002"]}),D.capabilities.automatic&&(0,M.jsx)("p",{children:"\u4E5F\u53EF\u5728\u5BF9\u8BDD\u4E2D\u6307\u5B9A\u4E3B\u673A\u540D\u6216 IP\uFF0CAI \u4F1A\u5148\u67E5\u8FDC\u7A0B\u4E3B\u673A\uFF0C\u518D\u67E5 JumpServer\uFF0C\u6700\u540E\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u3002"}),(0,M.jsx)("button",{className:"zt-primary",onClick:()=>m(null),children:"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A"}),ne&&(0,M.jsx)("button",{onClick:()=>void ae("restore"),children:"\u6062\u590D\u4E0A\u6B21\u7EC8\u7AEF\u5217\u8868\uFF08\u9ED8\u8BA4\u53EA\u8BFB\uFF09"})]}),(0,M.jsx)("div",{className:"zt-screens",children:D.terminals.map(I=>(0,M.jsx)(Wt,{ctx:B,sessionId:A,terminal:I,buffer:a.get(I.id),visible:O&&I.id===f,onError:se},`${I.id}:${I.generation}`))}),(0,M.jsxs)("footer",{className:"zt-statusbar",children:[(0,M.jsxs)("div",{className:"zt-status-info",children:[(0,M.jsx)("span",{children:xe?`AI \u7ED1\u5B9A\uFF1A${D.terminals.find(I=>I.id===xe.terminalId)?.target.label??xe.terminalId} \xB7 ${xe.mode==="readwrite"?`\u8BFB\u5199 ${xe.writeCalls}/${xe.maxWriteCalls}`:"\u53EA\u8BFB"}`:"AI \u5C1A\u672A\u7ED1\u5B9A\u7EC8\u7AEF"}),(0,M.jsxs)("span",{className:"zt-host-platform",title:"\u7EC8\u7AEF\u8FDE\u63A5\u4E0E\u547D\u4EE4\u4ECE DSH \u5BBF\u4E3B\u53D1\u8D77",children:["DSH \u5BBF\u4E3B \xB7 ",D.hostPlatform||"\u6B63\u5728\u8FDE\u63A5"]})]}),Y&&(0,M.jsx)("button",{onClick:()=>{ie(B,"terminal/export",{sessionId:A,terminalId:Y.id}).then(I=>it(`zterm-${rt()}-\u7EC8\u7AEF.txt`,`\u7EC8\u7AEF\uFF1A${Qe(Y)}
|
|
11
11
|
\u8BF4\u660E\uFF1A\u4EC5\u5305\u542B\u6709\u754C\u5386\u53F2\u7F13\u51B2\uFF0C\u53EF\u80FD\u5DF2\u622A\u65AD\u3002
|
|
12
12
|
|
|
13
|
-
${
|
|
14
|
-
`,pe.trust.fingerprint]}),pe.trust.trustedFingerprint&&(0,B.jsxs)("p",{children:["\u539F\u6307\u7EB9\uFF1A",pe.trust.trustedFingerprint]}),(0,B.jsx)("p",{className:"zt-hint",children:"\u901A\u8FC7\u72EC\u7ACB\u53EF\u4FE1\u6E20\u9053\u6838\u5B9E\u6307\u7EB9\u540E\u518D\u7EE7\u7EED\u3002"}),(0,B.jsx)("footer",{children:pe.trust.kind==="changed"?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{onClick:()=>void ae("disconnect",Fe),children:"\u53D6\u6D88\u8FDE\u63A5"}),(0,B.jsx)("button",{onClick:()=>{ae("trust/reset",Fe)},children:"\u5DF2\u6838\u5B9E\u53D8\u66F4\uFF0C\u6E05\u9664\u65E7\u8BB0\u5F55"})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{onClick:()=>void ae("trust",{...Fe,requestId:pe.trust.requestId,decision:"reject"}),children:"\u62D2\u7EDD"}),(0,B.jsx)("button",{onClick:()=>void ae("trust",{...Fe,requestId:pe.trust.requestId,decision:"trust-once"}),children:"\u4EC5\u4FE1\u4EFB\u6B64\u6B21\u8FDE\u63A5"}),(0,B.jsx)("button",{className:"zt-primary",onClick:()=>void ae("trust",{...Fe,requestId:pe.trust.requestId,decision:"trust-always"}),children:"\u4FE1\u4EFB\u5E76\u4FDD\u5B58"})]})})]})}),_e&&(0,B.jsxs)(Pe,{title:"\u786E\u8BA4\u64CD\u4F5C",onClose:()=>J(void 0),children:[(0,B.jsx)("p",{children:_e.text}),(0,B.jsxs)("footer",{children:[(0,B.jsx)("button",{onClick:()=>J(void 0),children:"\u53D6\u6D88"}),(0,B.jsx)("button",{className:"zt-primary",onClick:_e.act,children:"\u786E\u8BA4"})]})]})]})}var we=require("react");var me=require("react");var Q=require("react/jsx-runtime");function Kt({ctx:I,credentials:A,revision:O,onSaved:N}){let[D,r]=(0,me.useState)(),[n,c]=(0,me.useState)(""),[u,o]=(0,me.useState)("key"),[l,d]=(0,me.useState)(""),[p,h]=(0,me.useState)(""),[i,t]=(0,me.useState)(!1),[e,s]=(0,me.useState)(!1),[a,f]=(0,me.useState)(!1),[v,g]=(0,me.useState)(""),[_,m]=(0,me.useState)(""),y=(0,me.useRef)(0);(0,me.useEffect)(()=>()=>{y.current++},[]);let E=C=>{y.current++,f(!1),r(C),c(C?.label??""),o(C?.authType??"key"),d(C?.privateKeyPath??""),h(""),t(!1),g(""),m("")};return(0,Q.jsxs)("section",{className:"zt-settings-card zt-credential-manager","aria-label":"\u7BA1\u7406\u51ED\u8BC1",children:[(0,Q.jsxs)("div",{className:"zt-credential-header",children:[(0,Q.jsx)("strong",{children:"\u7BA1\u7406\u51ED\u8BC1"}),(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>{N().then(()=>g("")).catch(C=>g(C.message))},children:"\u5237\u65B0\u51ED\u8BC1\u5217\u8868"})]}),(0,Q.jsx)("p",{className:"zt-hint",children:"\u4FDD\u5B58\u4E00\u6B21\uFF0C\u4E3B\u673A\u6309\u540D\u79F0\u9009\u7528\u3002"}),(0,Q.jsx)("div",{className:"zt-credential-list",role:"list","aria-label":"\u51ED\u8BC1\u5217\u8868",children:A.length?A.map(C=>(0,Q.jsxs)("div",{className:"zt-credential-row",role:"listitem",children:[(0,Q.jsxs)("span",{children:[(0,Q.jsx)("b",{children:C.label}),(0,Q.jsx)("small",{children:Ie[C.authType]})]}),(0,Q.jsx)("button",{type:"button",disabled:e,"aria-label":`\u7F16\u8F91\u51ED\u8BC1 ${C.label}`,onClick:()=>E(C),children:"\u7F16\u8F91"})]},C.id)):(0,Q.jsx)("p",{className:"zt-hint",children:"\u6682\u65E0\u51ED\u8BC1\uFF0C\u5728\u4E0B\u65B9\u65B0\u589E\u3002"})}),(0,Q.jsx)("form",{onSubmit:C=>{C.preventDefault(),!(e||a)&&(s(!0),g(""),m(""),y.current++,ie(I,"credential/save",{credential:{id:D?.id,label:n,authType:u},content:l,passphrase:p,clearPassphrase:i,revision:O}).then(async()=>{E(),await N(),m("\u51ED\u8BC1\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u5728\u4E3B\u673A\u4E2D\u6309\u540D\u79F0\u9009\u62E9\u3002")}).catch(w=>g(w.message)).finally(()=>s(!1)))},children:(0,Q.jsxs)("fieldset",{disabled:e,className:"zt-credential-fields",children:[(0,Q.jsx)("h3",{children:D?"\u7F16\u8F91\u51ED\u8BC1":"\u65B0\u589E\u51ED\u8BC1"}),(0,Q.jsxs)("div",{className:"zt-credential-meta",children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u540D\u79F0"}),(0,Q.jsx)("input",{required:!0,maxLength:200,value:n,placeholder:"\u4F8B\u5982\uFF1A\u8FD0\u7EF4\u79C1\u94A5",onChange:C=>c(C.target.value)})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u7C7B\u578B"}),(0,Q.jsx)("select",{value:u,onChange:C=>{y.current++,f(!1),o(C.target.value),d(""),h(""),t(!1),g("")},children:Object.entries(Ie).map(([C,w])=>(0,Q.jsx)("option",{value:C,children:w},C))})]})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u5185\u5BB9"}),u==="key"?(0,Q.jsx)("textarea",{rows:3,value:l,spellCheck:!1,autoComplete:"off",required:!D||D.authType!==u,placeholder:D?.authType===u?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5\uFF1B\u4E5F\u53EF\u9009\u62E9\u6587\u4EF6\u5BFC\u5165":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9\uFF0C\u6216\u5728\u4E0B\u65B9\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",onChange:C=>{y.current++,f(!1),d(C.target.value)}}):(0,Q.jsx)("input",{type:u==="password"?"password":"text",value:l,autoComplete:"new-password",required:u==="key-file"||!D||D.authType!==u,placeholder:u==="key-file"?"\u5BBF\u4E3B\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4F8B\u5982 ~/.ssh/id_ed25519":D?.authType===u?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>d(C.target.value)})]}),u==="key"&&(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6"}),(0,Q.jsx)("input",{type:"file","aria-label":"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",disabled:e,onChange:C=>{let w=C.target.files?.[0],R=++y.current;if(C.target.value="",f(!1),!!w){if(w.size>1e5){g("\u79C1\u94A5\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 100 KB");return}f(!0),w.text().then(P=>{y.current===R&&(d(P),c(U=>U||w.name.slice(0,200)),g(""))}).catch(()=>{y.current===R&&g("\u8BFB\u53D6\u79C1\u94A5\u6587\u4EF6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")}).finally(()=>{y.current===R&&f(!1)})}}}),(0,Q.jsx)("small",{className:"zt-hint",children:"\u76F4\u63A5\u5BFC\u5165\u6587\u4EF6\uFF0C\u65E0\u9700\u586B\u5199\u8DEF\u5F84\u3002"})]}),u==="key-file"&&(0,Q.jsx)("p",{className:"zt-hint",children:"\u586B\u5199\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u79C1\u94A5\u8DEF\u5F84\uFF0C\u4EC5\u5728\u8FD9\u91CC\u586B\u5199\u4E00\u6B21\u3002\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"}),u!=="password"&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09"}),(0,Q.jsx)("input",{type:"password",autoComplete:"new-password",disabled:i,value:p,onChange:C=>h(C.target.value),placeholder:D?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4":"\u79C1\u94A5\u6709\u53E3\u4EE4\u65F6\u586B\u5199"})]}),D?.passphraseRef&&(0,Q.jsxs)("label",{className:"zt-check",children:[(0,Q.jsx)("input",{type:"checkbox",checked:i,onChange:C=>t(C.target.checked)}),"\u6E05\u9664\u79C1\u94A5\u53E3\u4EE4"]})]}),v&&(0,Q.jsx)("p",{role:"alert",className:"zt-error",children:v}),_&&(0,Q.jsx)("p",{role:"status",className:"zt-success",children:_}),(0,Q.jsxs)("div",{className:"zt-actions",children:[D&&(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>E(),children:"\u53D6\u6D88\u7F16\u8F91"}),(0,Q.jsx)("button",{className:"zt-primary",disabled:e||a,children:e?"\u4FDD\u5B58\u4E2D\u2026":a?"\u8BFB\u53D6\u6587\u4EF6\u2026":"\u4FDD\u5B58\u51ED\u8BC1"})]})]})})]})}var G=require("react/jsx-runtime"),Vt=["allowLocalTerminal","defaultSshUsername","defaultPrivateKeyPath","defaultCredentialId","defaultPanelWidth","maxSessions","maxWriteCalls","commandTimeoutMs"];function Gt({ctx:I}){let[A,O]=(0,we.useState)(),[N,D]=(0,we.useState)(""),[r,n]=(0,we.useState)(!1),[c,u]=(0,we.useState)(""),o=at(),[l,d]=(0,we.useState)(String(o)),p=(0,we.useRef)(),h=(0,we.useRef)(!0),i=(0,we.useCallback)(async()=>{let e=await ie(I,"catalog");if(!h.current)return;let s=p.current;p.current=e,O(a=>({...e,...Object.fromEntries(Vt.filter(f=>s&&a?.[f]!==s[f]).map(f=>[f,a[f]]))}))},[I]);(0,we.useEffect)(()=>d(String(o)),[o]),(0,we.useEffect)(()=>(h.current=!0,i().catch(e=>{h.current&&D(e.message)}),()=>{h.current=!1}),[i]);let t=(e,s)=>{O({...A,[e]:s}),u("")};return(0,G.jsxs)("section",{className:"zt-settings",children:[(0,G.jsx)("h2",{children:he}),(0,G.jsx)("p",{children:"\u5728 DSH \u5BF9\u8BDD\u53F3\u4FA7\u8FDE\u63A5\u771F\u5B9E\u673A\u5668\u3002\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\uFF0C\u7531\u4EBA\u7C7B\u5728\u5DF2\u7ED1\u5B9A\u7EC8\u7AEF\u7684\u5DE5\u5177\u680F\u5F00\u542F\u8BFB\u5199\u3002"}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u7EC8\u7AEF\u5916\u89C2"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u7EC8\u7AEF\u5B57\u4F53\u5927\u5C0F\uFF08px\uFF09"}),(0,G.jsx)("input",{type:"number",min:rt,max:nt,step:1,value:l,onChange:e=>{d(e.target.value),Mt(Number(e.target.value))},onBlur:()=>d(String(o))})]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u9ED8\u8BA4 ",We,"px\uFF0C\u53EF\u8C03 ",rt,"\u2013",nt,"px\u3002\u4FEE\u6539\u7ACB\u5373\u5E94\u7528\u5230\u5DF2\u6253\u5F00\u7684\u7EC8\u7AEF\uFF0C\u4FDD\u5B58\u5728\u5F53\u524D\u6D4F\u89C8\u5668\u3002"]})]}),N&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:N}),c&&(0,G.jsx)("p",{className:"zt-success",role:"status",children:c}),A?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("form",{onSubmit:e=>{e.preventDefault(),n(!0),D(""),u(""),ie(I,"config",{patch:Object.fromEntries(Vt.map(s=>[s,A[s]])),revision:A.revision}).then(()=>ie(I,"catalog")).then(s=>{p.current=s,O(s),u(s.allowLocalTerminal?`\u914D\u7F6E\u5DF2\u4FDD\u5B58\u3002\u672C\u5730\u7EC8\u7AEF\u5DF2\u542F\u7528\uFF1A\u6253\u5F00 ${he}\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002`:"\u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u672C\u5730\u7EC8\u7AEF\u672A\u542F\u7528\u3002")}).catch(s=>D(s.message)).finally(()=>n(!1))},children:[(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u672C\u5730\u7EC8\u7AEF"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",checked:A.allowLocalTerminal,onChange:e=>t("allowLocalTerminal",e.target.checked)}),"\u5141\u8BB8\u6253\u5F00\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u7EC8\u7AEF"]}),(0,G.jsx)("p",{className:"zt-hint",children:"DSH \u5728\u4F60\u7684\u7535\u8111\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u8FD9\u53F0\u7535\u8111\u7684\u7EC8\u7AEF\uFF1BDSH \u5728\u670D\u52A1\u5668\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u670D\u52A1\u5668\u7684\u7EC8\u7AEF\u3002"}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u52FE\u9009\u540E\u70B9\u51FB\u4E0B\u65B9\u7684\u300C\u4FDD\u5B58\u8BBE\u7F6E\u300D\u624D\u4F1A\u751F\u6548\u3002\u7136\u540E\u4ECE\u804A\u5929\u9876\u90E8\u6253\u5F00\u300C",he,"\u300D\uFF0C\u70B9\u51FB\u9762\u677F\u53F3\u4E0A\u65B9\u7684\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002\u6BCF\u6B21\u70B9\u51FB\u90FD\u4F1A\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\u6807\u7B7E\u3002"]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u901A\u8FC7\u5BF9\u8BDD\u8FDE\u63A5\u8FDC\u7A0B\u673A\u5668"}),(0,G.jsx)("p",{children:"\u544A\u8BC9 AI \u8981\u8FDE\u63A5\u7684\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4F8B\u5982\u300C\u8FDE\u63A5 192.0.2.21\u300D\u3002AI \u4F1A\u6309\u4EE5\u4E0B\u987A\u5E8F\u67E5\u627E\uFF1A"}),(0,G.jsxs)("ol",{className:"zt-hint",children:[(0,G.jsx)("li",{children:"\u5148\u627E\u4E3B\u673A\u5217\u8868\u91CC\u5DF2\u4FDD\u5B58\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u6CA1\u627E\u5230\uFF0C\u518D\u67E5 JumpServer\uFF08\u5821\u5792\u673A\uFF09\u91CC\u4F60\u6709\u6743\u9650\u8BBF\u95EE\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u90FD\u6CA1\u627E\u5230\uFF0C\u5C31\u4FDD\u5B58\u4E3A\u65B0\u4E3B\u673A\uFF0C\u5E76\u5C1D\u8BD5\u7528\u4E0B\u65B9\u7684\u8D26\u53F7\u548C SSH \u79C1\u94A5\u8FDE\u63A5\u3002"})]}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u65B0\u4E3B\u673A\u9ED8\u8BA4\u767B\u5F55\u8D26\u53F7"}),(0,G.jsx)("input",{value:A.defaultSshUsername??"",placeholder:"\u7559\u7A7A\u4F7F\u7528\u8FD0\u884C DSH \u7684\u8D26\u53F7",onChange:e=>t("defaultSshUsername",e.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5BF9\u8BDD\u91CC\u6307\u5B9A\u4E86\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u4F18\u5148\u4F7F\u7528\u4F60\u6307\u5B9A\u7684\u8D26\u53F7\u3002"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u51ED\u8BC1"}),(0,G.jsxs)("select",{value:A.defaultCredentialId??"",onChange:e=>t("defaultCredentialId",e.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u81EA\u52A8\u67E5\u627E\u5BBF\u4E3B\u9ED8\u8BA4\u79C1\u94A5\u6587\u4EF6"}),(A.credentials??[]).filter(e=>e.authType!=="password").map(e=>(0,G.jsxs)("option",{value:e.id,children:[e.label," \xB7 ",Ie[e.authType]]},e.id))]})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5728\u4E0B\u65B9\u300C\u7BA1\u7406\u51ED\u8BC1\u300D\u4FDD\u5B58\u79C1\u94A5\u540E\uFF0C\u6309\u540D\u79F0\u9009\u62E9\u9ED8\u8BA4\u51ED\u8BC1\u3002\u79C1\u94A5\u5185\u5BB9\u4E0D\u4F1A\u53D1\u9001\u7ED9 AI\u3002"}),!A.defaultCredentialId&&(0,G.jsxs)("details",{children:[(0,G.jsx)("summary",{children:"\u6307\u5B9A\u5DF2\u6709\u7684\u5BBF\u4E3B\u79C1\u94A5\u6587\u4EF6\uFF08\u53EF\u9009\uFF09"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6"}),(0,G.jsx)("input",{value:A.defaultPrivateKeyPath??"",placeholder:"\u7559\u7A7A\u81EA\u52A8\u67E5\u627E ~/.ssh \u4E0B\u7684\u9ED8\u8BA4\u79C1\u94A5",onChange:e=>t("defaultPrivateKeyPath",e.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u4F7F\u7528\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u8DEF\u5F84\uFF1B\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"})]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u6267\u884C\u4E0E\u5E03\u5C40"}),[["defaultPanelWidth","\u72EC\u7ACB\u9762\u677F\u9ED8\u8BA4\u5BBD\u5EA6\uFF08\u767E\u5206\u6BD4\uFF09",30,80],["maxSessions","\u6BCF\u4F1A\u8BDD\u7EC8\u7AEF\u4E0A\u9650",1,32],["maxWriteCalls","\u6BCF\u6B21\u8BFB\u5199\u6388\u6743\u7684\u547D\u4EE4\u4E0A\u9650",1,1e3],["commandTimeoutMs","\u5355\u6B21\u547D\u4EE4\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",1e3,12e4]].map(([e,s,a,f])=>(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:s}),(0,G.jsx)("input",{type:"number",min:a,max:f,required:!0,value:A[e],onChange:v=>t(String(e),Number(v.target.value))})]},e))]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u51ED\u636E"}),(0,G.jsxs)("p",{children:["\u4E3B\u673A\u3001\u6587\u4EF6\u5939\u3001JumpServer \u5B9E\u4F8B\u548C\u8D26\u53F7\u4ECE\u4F1A\u8BDD\u4E2D\u7684\u300C",he,"\u300D\u5165\u53E3\u7BA1\u7406\u3002\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u5199\u5165 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u76F4\u63A5\u4ECE\u5BBF\u4E3B\u8BFB\u53D6\uFF0C\u5DE5\u5177\u7ED3\u679C\u4E0D\u5305\u542B\u51ED\u636E\u503C\u3002"]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u5DF2\u914D\u7F6E ",A.total," \u53F0\u4E3B\u673A\u3001",A.jumpservers.length," \u4E2A JumpServer \u5B9E\u4F8B\u3002"]})]}),(0,G.jsx)("button",{className:"zt-primary",disabled:r,children:r?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u8BBE\u7F6E"})]}),(0,G.jsx)(Kt,{ctx:I,credentials:A.credentials??[],revision:A.revision,onSaved:i})]}):(0,G.jsx)("p",{className:"zt-hint",children:"\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026"})]})}var Jt=`.zt-workbench,.zt-settings,.zt-modal{--zt-bg:var(--dsw-alias-bg-base,#fff);--zt-layer:var(--dsw-alias-bg-layer-2,#f4f6f8);--zt-text:var(--dsw-alias-label-primary,#252b36);--zt-muted:var(--dsw-alias-label-secondary,#687284);--zt-border:var(--dsw-alias-border-l2,#dfe3e9);--zt-accent:var(--dsw-alias-state-business-primary,#3764d6);color:var(--zt-text);font:13px/1.5 system-ui,sans-serif;box-sizing:border-box}
|
|
13
|
+
${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,M.jsxs)("div",{className:"zt-records",children:[(0,M.jsxs)("header",{children:[(0,M.jsx)("strong",{children:"\u5B9E\u9645\u64CD\u4F5C\u8BB0\u5F55"}),(0,M.jsx)("button",{onClick:()=>{ie(B,"results",{sessionId:A,limit:200}).then(I=>it(`zterm-${rt()}-\u64CD\u4F5C\u8BB0\u5F55.json`,JSON.stringify({version:1,sessionId:A,historyLimited:!0,records:I},null,2),"application/json")).catch(I=>se(I.message))},children:"\u5BFC\u51FA JSON"})]}),!D.operations.length&&(0,M.jsx)("p",{className:"zt-hint",children:"\u7ED1\u5B9A\u7EC8\u7AEF\u5E76\u8C03\u7528\u5DE5\u5177\u540E\uFF0C\u5B9E\u9645\u64CD\u4F5C\u8BB0\u5F55\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002"}),D.operations.slice().reverse().map(I=>(0,M.jsxs)("details",{children:[(0,M.jsxs)("summary",{children:[(0,M.jsx)("span",{className:`zt-record-status ${I.status}`,children:Gt[I.status]}),(0,M.jsx)("span",{children:I.label}),(0,M.jsx)("time",{children:new Date(I.startedAt).toLocaleTimeString("zh-CN")})]}),(0,M.jsxs)("p",{className:"zt-hint",children:[I.target.label," \xB7 \u9000\u51FA\u7801 ",I.exitCode??"\u672A\u77E5"," \xB7 ",I.completion??"\u672A\u6838\u9A8C",I.truncated?" \xB7 \u8BB0\u5F55\u5DF2\u622A\u65AD":""]}),(0,M.jsx)("pre",{children:I.error||I.output||"\uFF08\u65E0\u8F93\u51FA\uFF09"})]},I.id))]})]}),!b&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("div",{className:"zt-list-handle",role:"separator","aria-label":"\u8C03\u6574\u673A\u5668\u5217\u8868\u5BBD\u5EA6","aria-orientation":"vertical",onMouseDown:ti}),(0,M.jsxs)("aside",{className:"zt-hosts",style:{width:N},children:[(0,M.jsxs)("div",{className:"zt-list-header",children:[(0,M.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u8D44\u4EA7"}),(0,M.jsxs)("div",{className:"zt-list-header-actions",children:[(0,M.jsx)("button",{"aria-label":"\u5237\u65B0\u673A\u5668\u5217\u8868",title:"\u5237\u65B0\u673A\u5668\u5217\u8868",onClick:()=>void we().catch(I=>se(I.message)),children:"\u21BB"}),(0,M.jsx)("button",{title:"\u6536\u8D77\u673A\u5668\u5217\u8868","aria-expanded":!0,onClick:()=>P(!0),children:"\u6536\u8D77\u5217\u8868"})]})]}),(0,M.jsxs)("div",{className:"zt-source-tabs",children:[(0,M.jsx)("button",{className:v==="ssh"?"active":"",onClick:()=>{g("ssh"),r(0),t("")},children:"\u8FDC\u7A0B\u4E3B\u673A"}),(0,M.jsx)("button",{className:v==="jumpserver"?"active":"",onClick:()=>{g("jumpserver"),r(0),t("")},children:"JumpServer"})]}),(0,M.jsx)("input",{className:"zt-list-search","aria-label":"\u641C\u7D22\u4E3B\u673A\u6216\u8D44\u4EA7",placeholder:"\u641C\u7D22\u540D\u79F0\u6216\u5730\u5740",value:i,onChange:I=>{t(I.target.value),r(0)}}),v==="ssh"?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)("div",{className:"zt-list-actions",children:[(0,M.jsx)("button",{onClick:()=>m(null),children:"\uFF0B \u4E3B\u673A"}),(0,M.jsx)("button",{onClick:()=>w(null),children:"\uFF0B \u6587\u4EF6\u5939"}),(0,M.jsx)("button",{onClick:()=>void ie(B,"hosts/export").then(I=>it(`zterm-${rt()}-ssh-config`,I)).catch(I=>se(I.message)),children:"\u5BFC\u51FA"})]}),(0,M.jsxs)("div",{className:"zt-host-browser",children:[(0,M.jsx)(wt,{label:"\u8C03\u6574\u4E3B\u673A\u6587\u4EF6\u5939\u9AD8\u5EA6",storageKey:"dsh-zterm.folder-tree-height",children:(0,M.jsx)(Ut,{folders:p?.folders??[],selected:h,onSelect:I=>{_(I),r(0)},onEdit:w,onDelete:I=>J({text:`\u5220\u9664\u6587\u4EF6\u5939\u300C${I.label}\u300D\uFF1F\u6587\u4EF6\u5939\u5FC5\u987B\u4E3A\u7A7A\u3002`,act:()=>{ie(B,"folder/delete",{id:I.id,revision:p?.revision}).then(()=>(h===I.id&&_(""),we())).catch(re=>se(re.message)),J(void 0)}})})},"folders"),(0,M.jsxs)("div",{className:"zt-host-list",children:[p?.hosts.map(I=>(0,M.jsxs)("div",{className:"zt-host-row",children:[(0,M.jsxs)("button",{className:"zt-host-connect",disabled:j,onClick:()=>void Le({targetId:I.id}),title:`\u8FDE\u63A5 ${I.username}@${I.host}:${I.port}`,children:[(0,M.jsx)("span",{className:"zt-host-glyph",children:"\u25A4"}),(0,M.jsxs)("span",{children:[(0,M.jsx)("strong",{children:I.label}),(0,M.jsxs)("small",{children:[I.username,"@",I.host]})]})]}),(0,M.jsx)("button",{title:"\u7F16\u8F91\u4E3B\u673A",onClick:()=>m(I),children:"\u22EF"}),(0,M.jsx)("button",{title:"\u79FB\u9664\u4E3B\u673A\u914D\u7F6E",onClick:()=>J({text:`\u79FB\u9664\u300C${I.label}\u300D\u7684\u914D\u7F6E\uFF1F\u5DF2\u6709\u7EC8\u7AEF\u8FDE\u63A5\u4FDD\u6301\u539F\u76EE\u6807\u3002`,act:()=>{ie(B,"host/delete",{id:I.id,revision:p.revision}).then(()=>we()).catch(re=>se(re.message)),J(void 0)}}),children:"\xD7"})]},I.id)),!p?.hosts.length&&(0,M.jsx)("p",{className:"zt-list-empty",children:i?"\u6CA1\u6709\u5339\u914D\u7684\u4E3B\u673A":"\u6DFB\u52A0\u4E3B\u673A\u540E\u4ECE\u8FD9\u91CC\u8FDE\u63A5"})]})]}),(0,M.jsxs)("div",{className:"zt-pagination",children:[(0,M.jsxs)("span",{children:[p?.total??0," \u53F0",p?.total?` \xB7 \u5F53\u524D ${e+1}\u2013${Math.min(e+200,p.total)}`:""]}),(0,M.jsx)("button",{disabled:!e,onClick:()=>r(Math.max(0,e-200)),children:"\u2039"}),(0,M.jsx)("button",{disabled:e+200>=(p?.total??0),onClick:()=>r(e+200),children:"\u203A"})]})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)("div",{className:"zt-list-actions",children:[(0,M.jsx)("button",{onClick:()=>E(null),children:"\uFF0B \u5B9E\u4F8B"}),et&&(0,M.jsx)("button",{onClick:()=>E(et),children:"\u7F16\u8F91"}),et&&(0,M.jsx)("button",{onClick:()=>J({text:`\u79FB\u9664\u300C${et.label}\u300D\u7684\u914D\u7F6E\uFF1F`,act:()=>{ie(B,"jump/delete",{id:R,revision:p.revision}).then(()=>{z(""),we()}).catch(I=>se(I.message)),J(void 0)}}),children:"\u79FB\u9664"})]}),(0,M.jsxs)("select",{"aria-label":"JumpServer \u5B9E\u4F8B",value:R,onChange:I=>{z(I.target.value),q(""),r(0)},children:[(0,M.jsx)("option",{value:"",children:"\u9009\u62E9\u5B9E\u4F8B"}),p?.jumpservers.map(I=>(0,M.jsx)("option",{value:I.id,children:I.label},I.id))]}),(0,M.jsxs)("div",{className:"zt-host-browser",children:[R&&(0,M.jsx)(wt,{label:"\u8C03\u6574 JumpServer \u8D44\u4EA7\u8282\u70B9\u9AD8\u5EA6",storageKey:"dsh-zterm.jump-tree-height",children:(0,M.jsx)(qt,{ctx:B,instanceId:R,nodes:$,selected:U,onSelect:I=>{q(I),r(0)},onError:se},R)},"jumpserver"),(0,M.jsxs)("div",{className:"zt-host-list",children:[x?.assets?.map(I=>(0,M.jsxs)("button",{className:"zt-asset-row",onClick:()=>void ei(I),children:[(0,M.jsx)("strong",{children:I.name}),(0,M.jsxs)("small",{children:[I.address," \xB7 ",I.platform]})]},I.assetId)),!R&&(0,M.jsx)("p",{className:"zt-list-empty",children:"\u5148\u6DFB\u52A0 JumpServer \u5B9E\u4F8B"})]})]}),(0,M.jsxs)("div",{className:"zt-pagination",children:[(0,M.jsxs)("span",{children:[x?.total??0," \u53F0"]}),(0,M.jsx)("button",{disabled:!e,onClick:()=>r(Math.max(0,e-100)),children:"\u2039"}),(0,M.jsx)("button",{disabled:!x?.hasMore,onClick:()=>r(e+100),children:"\u203A"})]})]})]})]})]}),u!==!1&&(0,M.jsx)($t,{ctx:B,host:u??void 0,folders:p?.folders??[],credentials:p?.credentials??[],defaultCredentialId:p?.defaultCredentialId,revision:p?.revision,onClose:()=>m(!1),onSaved:()=>void we()}),y!==!1&&(0,M.jsx)(jt,{ctx:B,profile:y??void 0,revision:p?.revision,onClose:()=>E(!1),onSaved:()=>void we()}),C!==!1&&(0,M.jsx)(Kt,{ctx:B,folder:C??void 0,folders:p?.folders??[],revision:p?.revision,onClose:()=>w(!1),onSaved:()=>void we()}),L&&(0,M.jsx)(Fe,{title:`\u9009\u62E9\u8D26\u53F7 \xB7 ${K?.name??""}`,onClose:()=>H(void 0),children:(0,M.jsxs)("div",{className:"zt-account-list",children:[L.map(I=>(0,M.jsxs)("button",{disabled:!I.canConnect||j,onClick:()=>{Le({kind:"jumpserver",instanceId:R,assetId:K.assetId,accountId:I.accountId,label:K.name,accountName:I.name||I.username}),H(void 0)},children:[(0,M.jsx)("strong",{children:I.name}),(0,M.jsxs)("span",{children:[I.username,I.canConnect?"":" \xB7 \u65E0\u8FDE\u63A5\u6743\u9650"]})]},I.accountId)),!L.length&&(0,M.jsx)("p",{children:"\u6CA1\u6709\u53EF\u7528\u8D26\u53F7"})]})}),O&&pe?.trust&&(0,M.jsx)(Fe,{title:pe.trust.kind==="changed"?"SSH \u4E3B\u673A\u6307\u7EB9\u5DF2\u53D8\u66F4":"\u6838\u5B9E SSH \u4E3B\u673A\u8EAB\u4EFD",onClose:()=>{ae("disconnect",$e)},children:(0,M.jsxs)("div",{className:"zt-trust",children:[(0,M.jsxs)("p",{children:[pe.target.label," \xB7 ",pe.trust.username,"@",pe.trust.host,":",pe.trust.port]}),(0,M.jsxs)("pre",{children:[pe.trust.algorithm,`
|
|
14
|
+
`,pe.trust.fingerprint]}),pe.trust.trustedFingerprint&&(0,M.jsxs)("p",{children:["\u539F\u6307\u7EB9\uFF1A",pe.trust.trustedFingerprint]}),(0,M.jsx)("p",{className:"zt-hint",children:"\u901A\u8FC7\u72EC\u7ACB\u53EF\u4FE1\u6E20\u9053\u6838\u5B9E\u6307\u7EB9\u540E\u518D\u7EE7\u7EED\u3002"}),(0,M.jsx)("footer",{children:pe.trust.kind==="changed"?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{onClick:()=>void ae("disconnect",$e),children:"\u53D6\u6D88\u8FDE\u63A5"}),(0,M.jsx)("button",{onClick:()=>{ae("trust/reset",$e)},children:"\u5DF2\u6838\u5B9E\u53D8\u66F4\uFF0C\u6E05\u9664\u65E7\u8BB0\u5F55"})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{onClick:()=>void ae("trust",{...$e,requestId:pe.trust.requestId,decision:"reject"}),children:"\u62D2\u7EDD"}),(0,M.jsx)("button",{onClick:()=>void ae("trust",{...$e,requestId:pe.trust.requestId,decision:"trust-once"}),children:"\u4EC5\u4FE1\u4EFB\u6B64\u6B21\u8FDE\u63A5"}),(0,M.jsx)("button",{className:"zt-primary",onClick:()=>void ae("trust",{...$e,requestId:pe.trust.requestId,decision:"trust-always"}),children:"\u4FE1\u4EFB\u5E76\u4FDD\u5B58"})]})})]})}),fe&&(0,M.jsxs)(Fe,{title:"\u786E\u8BA4\u64CD\u4F5C",onClose:()=>J(void 0),children:[(0,M.jsx)("p",{children:fe.text}),(0,M.jsxs)("footer",{children:[(0,M.jsx)("button",{onClick:()=>J(void 0),children:"\u53D6\u6D88"}),(0,M.jsx)("button",{className:"zt-primary",onClick:fe.act,children:"\u786E\u8BA4"})]})]})]})}var ye=require("react");var Se=require("react");var Q=require("react/jsx-runtime");function Jt({ctx:B,credentials:A,revision:O,onSaved:F}){let[D,s]=(0,Se.useState)(),[a,c]=(0,Se.useState)(""),[f,o]=(0,Se.useState)("key"),[n,d]=(0,Se.useState)(""),[p,l]=(0,Se.useState)(""),[i,t]=(0,Se.useState)(!1),[e,r]=(0,Se.useState)(!1),[h,_]=(0,Se.useState)(!1),[v,g]=(0,Se.useState)(""),[u,m]=(0,Se.useState)(""),y=(0,Se.useRef)(0);(0,Se.useEffect)(()=>()=>{y.current++},[]);let E=C=>{y.current++,_(!1),s(C),c(C?.label??""),o(C?.authType??"key"),d(C?.privateKeyPath??""),l(""),t(!1),g(""),m("")};return(0,Q.jsxs)("section",{className:"zt-settings-card zt-credential-manager","aria-label":"\u7BA1\u7406\u51ED\u8BC1",children:[(0,Q.jsxs)("div",{className:"zt-credential-header",children:[(0,Q.jsx)("strong",{children:"\u7BA1\u7406\u51ED\u8BC1"}),(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>{F().then(()=>g("")).catch(C=>g(C.message))},children:"\u5237\u65B0\u51ED\u8BC1\u5217\u8868"})]}),(0,Q.jsx)("p",{className:"zt-hint",children:"\u4FDD\u5B58\u4E00\u6B21\uFF0C\u4E3B\u673A\u6309\u540D\u79F0\u9009\u7528\u3002"}),(0,Q.jsx)("div",{className:"zt-credential-list",role:"list","aria-label":"\u51ED\u8BC1\u5217\u8868",children:A.length?A.map(C=>(0,Q.jsxs)("div",{className:"zt-credential-row",role:"listitem",children:[(0,Q.jsxs)("span",{children:[(0,Q.jsx)("b",{children:C.label}),(0,Q.jsx)("small",{children:He[C.authType]})]}),(0,Q.jsx)("button",{type:"button",disabled:e,"aria-label":`\u7F16\u8F91\u51ED\u8BC1 ${C.label}`,onClick:()=>E(C),children:"\u7F16\u8F91"})]},C.id)):(0,Q.jsx)("p",{className:"zt-hint",children:"\u6682\u65E0\u51ED\u8BC1\uFF0C\u5728\u4E0B\u65B9\u65B0\u589E\u3002"})}),(0,Q.jsx)("form",{onSubmit:C=>{C.preventDefault(),!(e||h)&&(r(!0),g(""),m(""),y.current++,ie(B,"credential/save",{credential:{id:D?.id,label:a,authType:f},content:n,passphrase:p,clearPassphrase:i,revision:O}).then(async()=>{E(),await F(),m("\u51ED\u8BC1\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u5728\u4E3B\u673A\u4E2D\u6309\u540D\u79F0\u9009\u62E9\u3002")}).catch(w=>g(w.message)).finally(()=>r(!1)))},children:(0,Q.jsxs)("fieldset",{disabled:e,className:"zt-credential-fields",children:[(0,Q.jsx)("h3",{children:D?"\u7F16\u8F91\u51ED\u8BC1":"\u65B0\u589E\u51ED\u8BC1"}),(0,Q.jsxs)("div",{className:"zt-credential-meta",children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u540D\u79F0"}),(0,Q.jsx)("input",{required:!0,maxLength:200,value:a,placeholder:"\u4F8B\u5982\uFF1A\u8FD0\u7EF4\u79C1\u94A5",onChange:C=>c(C.target.value)})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u7C7B\u578B"}),(0,Q.jsx)("select",{value:f,onChange:C=>{y.current++,_(!1),o(C.target.value),d(""),l(""),t(!1),g("")},children:Object.entries(He).map(([C,w])=>(0,Q.jsx)("option",{value:C,children:w},C))})]})]}),(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u51ED\u8BC1\u5185\u5BB9"}),f==="key"?(0,Q.jsx)("textarea",{rows:3,value:n,spellCheck:!1,autoComplete:"off",required:!D||D.authType!==f,placeholder:D?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5\uFF1B\u4E5F\u53EF\u9009\u62E9\u6587\u4EF6\u5BFC\u5165":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9\uFF0C\u6216\u5728\u4E0B\u65B9\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",onChange:C=>{y.current++,_(!1),d(C.target.value)}}):(0,Q.jsx)("input",{type:f==="password"?"password":"text",value:n,autoComplete:"new-password",required:f==="key-file"||!D||D.authType!==f,placeholder:f==="key-file"?"\u5BBF\u4E3B\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4F8B\u5982 ~/.ssh/id_ed25519":D?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>d(C.target.value)})]}),f==="key"&&(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6"}),(0,Q.jsx)("input",{type:"file","aria-label":"\u9009\u62E9\u79C1\u94A5\u6587\u4EF6",disabled:e,onChange:C=>{let w=C.target.files?.[0],R=++y.current;if(C.target.value="",_(!1),!!w){if(w.size>1e5){g("\u79C1\u94A5\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 100 KB");return}_(!0),w.text().then(z=>{y.current===R&&(d(z),c(U=>U||w.name.slice(0,200)),g(""))}).catch(()=>{y.current===R&&g("\u8BFB\u53D6\u79C1\u94A5\u6587\u4EF6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")}).finally(()=>{y.current===R&&_(!1)})}}}),(0,Q.jsx)("small",{className:"zt-hint",children:"\u76F4\u63A5\u5BFC\u5165\u6587\u4EF6\uFF0C\u65E0\u9700\u586B\u5199\u8DEF\u5F84\u3002"})]}),f==="key-file"&&(0,Q.jsx)("p",{className:"zt-hint",children:"\u586B\u5199\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u79C1\u94A5\u8DEF\u5F84\uFF0C\u4EC5\u5728\u8FD9\u91CC\u586B\u5199\u4E00\u6B21\u3002\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"}),f!=="password"&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("label",{className:"zt-field",children:[(0,Q.jsx)("span",{children:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09"}),(0,Q.jsx)("input",{type:"password",autoComplete:"new-password",disabled:i,value:p,onChange:C=>l(C.target.value),placeholder:D?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4":"\u79C1\u94A5\u6709\u53E3\u4EE4\u65F6\u586B\u5199"})]}),D?.passphraseRef&&(0,Q.jsxs)("label",{className:"zt-check",children:[(0,Q.jsx)("input",{type:"checkbox",checked:i,onChange:C=>t(C.target.checked)}),"\u6E05\u9664\u79C1\u94A5\u53E3\u4EE4"]})]}),v&&(0,Q.jsx)("p",{role:"alert",className:"zt-error",children:v}),u&&(0,Q.jsx)("p",{role:"status",className:"zt-success",children:u}),(0,Q.jsxs)("div",{className:"zt-actions",children:[D&&(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>E(),children:"\u53D6\u6D88\u7F16\u8F91"}),(0,Q.jsx)("button",{className:"zt-primary",disabled:e||h,children:e?"\u4FDD\u5B58\u4E2D\u2026":h?"\u8BFB\u53D6\u6587\u4EF6\u2026":"\u4FDD\u5B58\u51ED\u8BC1"})]})]})})]})}var G=require("react/jsx-runtime"),Xt=["allowLocalTerminal","defaultSshUsername","defaultPrivateKeyPath","defaultCredentialId","defaultPanelWidth","maxSessions","maxWriteCalls","commandTimeoutMs"];function Yt({ctx:B}){let[A,O]=(0,ye.useState)(),[F,D]=(0,ye.useState)(""),[s,a]=(0,ye.useState)(!1),[c,f]=(0,ye.useState)(""),o=ct(),[n,d]=(0,ye.useState)(String(o)),p=(0,ye.useRef)(),l=(0,ye.useRef)(!0),i=(0,ye.useCallback)(async()=>{let e=await ie(B,"catalog");if(!l.current)return;let r=p.current;p.current=e,O(h=>({...e,...Object.fromEntries(Xt.filter(_=>r&&h?.[_]!==r[_]).map(_=>[_,h[_]]))}))},[B]);(0,ye.useEffect)(()=>d(String(o)),[o]),(0,ye.useEffect)(()=>(l.current=!0,i().catch(e=>{l.current&&D(e.message)}),()=>{l.current=!1}),[i]);let t=(e,r)=>{O({...A,[e]:r}),f("")};return(0,G.jsxs)("section",{className:"zt-settings",children:[(0,G.jsx)("h2",{children:he}),(0,G.jsx)("p",{children:"\u5728 DSH \u5BF9\u8BDD\u53F3\u4FA7\u8FDE\u63A5\u771F\u5B9E\u673A\u5668\u3002\u9ED8\u8BA4\u8BFB\u6A21\u5F0F\uFF0C\u7531\u4EBA\u7C7B\u5728\u5DF2\u7ED1\u5B9A\u7EC8\u7AEF\u7684\u5DE5\u5177\u680F\u5F00\u542F\u8BFB\u5199\u3002"}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u7EC8\u7AEF\u5916\u89C2"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u7EC8\u7AEF\u5B57\u4F53\u5927\u5C0F\uFF08px\uFF09"}),(0,G.jsx)("input",{type:"number",min:at,max:lt,step:1,value:n,onChange:e=>{d(e.target.value),zt(Number(e.target.value))},onBlur:()=>d(String(o))})]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u9ED8\u8BA4 ",Ke,"px\uFF0C\u53EF\u8C03 ",at,"\u2013",lt,"px\u3002\u4FEE\u6539\u7ACB\u5373\u5E94\u7528\u5230\u5DF2\u6253\u5F00\u7684\u7EC8\u7AEF\uFF0C\u4FDD\u5B58\u5728\u5F53\u524D\u6D4F\u89C8\u5668\u3002"]})]}),F&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:F}),c&&(0,G.jsx)("p",{className:"zt-success",role:"status",children:c}),A?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("form",{onSubmit:e=>{e.preventDefault(),a(!0),D(""),f(""),ie(B,"config",{patch:Object.fromEntries(Xt.map(r=>[r,A[r]])),revision:A.revision}).then(()=>ie(B,"catalog")).then(r=>{p.current=r,O(r),f(r.allowLocalTerminal?`\u914D\u7F6E\u5DF2\u4FDD\u5B58\u3002\u672C\u5730\u7EC8\u7AEF\u5DF2\u542F\u7528\uFF1A\u6253\u5F00 ${he}\uFF0C\u70B9\u51FB\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002`:"\u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u672C\u5730\u7EC8\u7AEF\u672A\u542F\u7528\u3002")}).catch(r=>D(r.message)).finally(()=>a(!1))},children:[(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u672C\u5730\u7EC8\u7AEF"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",checked:A.allowLocalTerminal,onChange:e=>t("allowLocalTerminal",e.target.checked)}),"\u5141\u8BB8\u6253\u5F00\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u7EC8\u7AEF"]}),(0,G.jsx)("p",{className:"zt-hint",children:"DSH \u5728\u4F60\u7684\u7535\u8111\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u8FD9\u53F0\u7535\u8111\u7684\u7EC8\u7AEF\uFF1BDSH \u5728\u670D\u52A1\u5668\u4E0A\u8FD0\u884C\uFF0C\u5C31\u6253\u5F00\u670D\u52A1\u5668\u7684\u7EC8\u7AEF\u3002"}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u52FE\u9009\u540E\u70B9\u51FB\u4E0B\u65B9\u7684\u300C\u4FDD\u5B58\u8BBE\u7F6E\u300D\u624D\u4F1A\u751F\u6548\u3002\u7136\u540E\u4ECE\u804A\u5929\u9876\u90E8\u6253\u5F00\u300C",he,"\u300D\uFF0C\u70B9\u51FB\u9762\u677F\u53F3\u4E0A\u65B9\u7684\u300C\u6253\u5F00\u672C\u673A\u7EC8\u7AEF\u300D\u3002\u6BCF\u6B21\u70B9\u51FB\u90FD\u4F1A\u65B0\u5F00\u4E00\u4E2A\u7EC8\u7AEF\u6807\u7B7E\u3002"]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u901A\u8FC7\u5BF9\u8BDD\u8FDE\u63A5\u8FDC\u7A0B\u673A\u5668"}),(0,G.jsx)("p",{children:"\u544A\u8BC9 AI \u8981\u8FDE\u63A5\u7684\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4F8B\u5982\u300C\u8FDE\u63A5 192.0.2.21\u300D\u3002AI \u4F1A\u6309\u4EE5\u4E0B\u987A\u5E8F\u67E5\u627E\uFF1A"}),(0,G.jsxs)("ol",{className:"zt-hint",children:[(0,G.jsx)("li",{children:"\u5148\u627E\u4E3B\u673A\u5217\u8868\u91CC\u5DF2\u4FDD\u5B58\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u6CA1\u627E\u5230\uFF0C\u518D\u67E5 JumpServer\uFF08\u5821\u5792\u673A\uFF09\u91CC\u4F60\u6709\u6743\u9650\u8BBF\u95EE\u7684\u673A\u5668\u3002"}),(0,G.jsx)("li",{children:"\u90FD\u6CA1\u627E\u5230\uFF0C\u5C31\u4FDD\u5B58\u4E3A\u65B0\u4E3B\u673A\uFF0C\u5E76\u5C1D\u8BD5\u7528\u4E0B\u65B9\u7684\u8D26\u53F7\u548C SSH \u79C1\u94A5\u8FDE\u63A5\u3002"})]}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u65B0\u4E3B\u673A\u9ED8\u8BA4\u767B\u5F55\u8D26\u53F7"}),(0,G.jsx)("input",{value:A.defaultSshUsername??"",placeholder:"\u7559\u7A7A\u4F7F\u7528\u8FD0\u884C DSH \u7684\u8D26\u53F7",onChange:e=>t("defaultSshUsername",e.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5BF9\u8BDD\u91CC\u6307\u5B9A\u4E86\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u4F18\u5148\u4F7F\u7528\u4F60\u6307\u5B9A\u7684\u8D26\u53F7\u3002"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u51ED\u8BC1"}),(0,G.jsxs)("select",{value:A.defaultCredentialId??"",onChange:e=>t("defaultCredentialId",e.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u81EA\u52A8\u67E5\u627E\u5BBF\u4E3B\u9ED8\u8BA4\u79C1\u94A5\u6587\u4EF6"}),(A.credentials??[]).filter(e=>e.authType!=="password").map(e=>(0,G.jsxs)("option",{value:e.id,children:[e.label," \xB7 ",He[e.authType]]},e.id))]})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u5728\u4E0B\u65B9\u300C\u7BA1\u7406\u51ED\u8BC1\u300D\u4FDD\u5B58\u79C1\u94A5\u540E\uFF0C\u6309\u540D\u79F0\u9009\u62E9\u9ED8\u8BA4\u51ED\u8BC1\u3002\u79C1\u94A5\u5185\u5BB9\u4E0D\u4F1A\u53D1\u9001\u7ED9 AI\u3002"}),!A.defaultCredentialId&&(0,G.jsxs)("details",{children:[(0,G.jsx)("summary",{children:"\u6307\u5B9A\u5DF2\u6709\u7684\u5BBF\u4E3B\u79C1\u94A5\u6587\u4EF6\uFF08\u53EF\u9009\uFF09"}),(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6"}),(0,G.jsx)("input",{value:A.defaultPrivateKeyPath??"",placeholder:"\u7559\u7A7A\u81EA\u52A8\u67E5\u627E ~/.ssh \u4E0B\u7684\u9ED8\u8BA4\u79C1\u94A5",onChange:e=>t("defaultPrivateKeyPath",e.target.value)})]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u4F7F\u7528\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u8DEF\u5F84\uFF1B\u8FDC\u7AEF\u90E8\u7F72\u65F6\u4F7F\u7528\u8FDC\u7AEF\u8DEF\u5F84\u3002"})]})]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u6267\u884C\u4E0E\u5E03\u5C40"}),[["defaultPanelWidth","\u72EC\u7ACB\u9762\u677F\u9ED8\u8BA4\u5BBD\u5EA6\uFF08\u767E\u5206\u6BD4\uFF09",30,80],["maxSessions","\u6BCF\u4F1A\u8BDD\u7EC8\u7AEF\u4E0A\u9650",1,32],["maxWriteCalls","\u6BCF\u6B21\u8BFB\u5199\u6388\u6743\u7684\u547D\u4EE4\u4E0A\u9650",1,1e3],["commandTimeoutMs","\u5355\u6B21\u547D\u4EE4\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",1e3,12e4]].map(([e,r,h,_])=>(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:r}),(0,G.jsx)("input",{type:"number",min:h,max:_,required:!0,value:A[e],onChange:v=>t(String(e),Number(v.target.value))})]},e))]}),(0,G.jsxs)("div",{className:"zt-settings-card",children:[(0,G.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u51ED\u636E"}),(0,G.jsxs)("p",{children:["\u4E3B\u673A\u3001\u6587\u4EF6\u5939\u3001JumpServer \u5B9E\u4F8B\u548C\u8D26\u53F7\u4ECE\u4F1A\u8BDD\u4E2D\u7684\u300C",he,"\u300D\u5165\u53E3\u7BA1\u7406\u3002\u5BC6\u7801\u3001\u79C1\u94A5\u5185\u5BB9\u548C\u53E3\u4EE4\u5199\u5165 DSH \u51ED\u636E\u5E93\uFF1B\u79C1\u94A5\u6587\u4EF6\u76F4\u63A5\u4ECE\u5BBF\u4E3B\u8BFB\u53D6\uFF0C\u5DE5\u5177\u7ED3\u679C\u4E0D\u5305\u542B\u51ED\u636E\u503C\u3002"]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u5DF2\u914D\u7F6E ",A.total," \u53F0\u4E3B\u673A\u3001",A.jumpservers.length," \u4E2A JumpServer \u5B9E\u4F8B\u3002"]})]}),(0,G.jsx)("button",{className:"zt-primary",disabled:s,children:s?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u8BBE\u7F6E"})]}),(0,G.jsx)(Jt,{ctx:B,credentials:A.credentials??[],revision:A.revision,onSaved:i})]}):(0,G.jsx)("p",{className:"zt-hint",children:"\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026"})]})}var Zt=`.zt-workbench,.zt-settings,.zt-modal{--zt-bg:var(--dsw-alias-bg-base,#fff);--zt-layer:var(--dsw-alias-bg-layer-2,#f4f6f8);--zt-text:var(--dsw-alias-label-primary,#252b36);--zt-muted:var(--dsw-alias-label-secondary,#687284);--zt-border:var(--dsw-alias-border-l2,#dfe3e9);--zt-accent:var(--dsw-alias-state-business-primary,#3764d6);color:var(--zt-text);font:13px/1.5 system-ui,sans-serif;box-sizing:border-box}
|
|
15
15
|
.zt-workbench *,.zt-settings *,.zt-modal *{box-sizing:border-box}
|
|
16
16
|
.zt-credential-header{display:flex;align-items:center;justify-content:space-between;gap:12px}.zt-credential-meta{display:flex;gap:12px;flex-wrap:wrap}.zt-credential-meta>.zt-field{flex:1 1 160px}.zt-credential-list{max-height:220px;overflow:auto}
|
|
17
17
|
.zt-settings-card.zt-credential-manager .zt-field{margin-top:8px;margin-bottom:8px}.zt-credential-manager .zt-hint{margin:8px 0}.zt-credential-header strong{font-weight:500}
|
|
@@ -23,8 +23,8 @@ ${M}`)).catch(M=>se(M.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
|
23
23
|
.zt-workbench input,.zt-workbench select,.zt-settings input,.zt-modal input,.zt-modal select,.zt-modal textarea{font:inherit;color:var(--zt-text);background:var(--zt-bg);border:1px solid var(--zt-border);border-radius:6px;padding:7px 8px;min-width:0}
|
|
24
24
|
.zt-workbench{height:100%;width:100%;display:flex;flex-direction:column;min-height:0;min-width:0;position:relative;background:var(--zt-bg);overflow:hidden}
|
|
25
25
|
.zt-actions{display:flex;align-items:center;gap:5px;flex-wrap:wrap}.zt-workbench-body{display:flex;flex:1;min-width:0;min-height:0;position:relative}
|
|
26
|
-
.zt-terminal-area{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;position:relative;background:#12161d}.zt-terminal-topbar{height:
|
|
27
|
-
.zt-tab{display:flex;flex:none;max-width:min(210px,100%);align-items:center;border-right:1px solid var(--zt-border);border-
|
|
26
|
+
.zt-terminal-area{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;position:relative;background:#12161d}.zt-terminal-topbar{height:38px;display:flex;align-items:stretch;flex:none;background:var(--zt-bg);background:color-mix(in srgb,var(--zt-bg) 88%,var(--zt-layer));border-bottom:.5px solid var(--dsw-alias-border-l3,var(--zt-border))}.zt-terminal-tabs{display:flex;align-items:stretch;flex:1;min-width:0;padding-top:3px;overflow-x:auto;gap:2px;scrollbar-width:none}.zt-terminal-tabs::-webkit-scrollbar{display:none}.zt-terminal-controls{display:flex;align-items:center;gap:5px;flex:none;padding:3px 7px}.zt-terminal-controls button{font-size:12px;padding:3px 7px;background:transparent;border-color:color-mix(in srgb,var(--zt-border) 65%,transparent)}
|
|
27
|
+
.zt-tab{display:flex;flex:none;max-width:min(210px,100%);align-items:center;border-right:1px solid var(--zt-border);border-top:2px solid transparent}.zt-tab.active{background:var(--zt-bg);border-top-color:var(--zt-accent)}.zt-tab>button{border:0;border-radius:0;background:transparent;overflow:hidden;text-overflow:ellipsis}.zt-tab>button:first-child{display:flex;align-items:center;gap:6px;min-width:0}.zt-tab>button:last-child{padding:3px 6px}
|
|
28
28
|
.zt-state-dot{width:6px;height:6px;border-radius:50%;background:#8a94a5;flex:none}.zt-state-dot.ready{background:#45a77c}.zt-state-dot.connecting{background:#d8a048}.zt-state-dot.error{background:#d45f64}
|
|
29
29
|
.zt-terminal-toolbar{display:flex;flex:none;align-items:center;justify-content:space-between;gap:8px;padding:7px 9px;background:var(--zt-bg);border-bottom:1px solid var(--zt-border);flex-wrap:wrap}.zt-target{font-family:Menlo,Consolas,monospace;font-size:11px;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zt-target span{display:block;font:11px system-ui;color:var(--zt-muted);margin-top:2px}
|
|
30
30
|
.zt-mode{display:flex;align-items:center;gap:5px;padding:3px 7px;background:var(--zt-layer);border:1px solid var(--zt-border);border-radius:6px;font-size:12px;white-space:nowrap}.zt-mode.write{background:#fff2db;border-color:#dfb466;color:#825009}.zt-mode input{margin:0;accent-color:var(--zt-accent)}
|
|
@@ -33,7 +33,7 @@ ${M}`)).catch(M=>se(M.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
|
33
33
|
.zt-terminal-canvas>.xterm{height:100%;padding:8px 5px 8px 8px}
|
|
34
34
|
.zt-terminal-search{display:flex;align-items:center;gap:4px;padding:3px 8px;background:#1a202a;flex:none}.zt-terminal-search input{background:#222c39;border-color:#364356;color:#dce3ed;padding:2px 6px;width:150px;font-size:11px}.zt-terminal-search button{padding:1px 5px;background:#222c39;color:#dce3ed;border-color:#364356;font-size:11px}.zt-terminal-search span{color:#929dae;font-size:10px;margin-left:auto}
|
|
35
35
|
.zt-statusbar{height:28px;display:flex;align-items:center;justify-content:space-between;gap:8px;background:var(--zt-layer);padding:2px 9px;font-size:11px;color:var(--zt-muted);border-top:1px solid var(--zt-border);flex:none}.zt-status-info{display:flex;align-items:center;gap:12px;flex:1;min-width:0}.zt-statusbar span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zt-host-platform{font-size:10px}.zt-statusbar button{font-size:11px;padding:1px 5px;border:0;background:transparent;flex:none}
|
|
36
|
-
.zt-hosts{display:flex;flex-direction:column;flex:none;min-width:0;min-height:0;max-width:45%;background:var(--zt-bg);border-left:1px solid var(--zt-border)}.zt-list-handle{width:5px;position:relative;cursor:col-resize;flex:none;background:var(--zt-layer)}.zt-list-handle:hover{background:var(--zt-accent)}.zt-list-header{height:
|
|
36
|
+
.zt-hosts{display:flex;flex-direction:column;flex:none;min-width:0;min-height:0;max-width:45%;background:var(--zt-bg);border-left:1px solid var(--zt-border)}.zt-list-handle{width:5px;position:relative;cursor:col-resize;flex:none;background:var(--zt-layer)}.zt-list-handle:hover{background:var(--zt-accent)}.zt-list-header{height:38px;display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:6px 9px;border-bottom:.5px solid var(--dsw-alias-border-l3,var(--zt-border))}.zt-list-header>strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zt-list-header-actions{display:flex;align-items:center;gap:4px;flex:none}.zt-list-header button{border:0;padding:0 4px}.zt-source-tabs{display:flex;padding:7px 8px 0;gap:5px}.zt-source-tabs button{flex:1;border:0;background:var(--zt-layer);font-size:12px}.zt-source-tabs .active{color:var(--zt-accent);box-shadow:inset 0 -2px var(--zt-accent)}.zt-list-search{margin:8px;font-size:12px!important}.zt-list-actions{display:flex;gap:3px;align-items:center;padding:0 8px 7px;flex-wrap:wrap}.zt-list-actions button{font-size:11px;padding:2px 5px;border:0;background:var(--zt-layer)}.zt-folder-filter,.zt-hosts>select{margin:0 8px 7px;padding:4px!important;font-size:12px!important}.zt-delete-folder{margin:0 8px 5px!important;font-size:11px!important}.zt-host-list{flex:1;overflow:auto;min-height:0;padding:3px 5px}.zt-host-row{display:flex;align-items:center;border-radius:6px;min-width:0}.zt-host-row:hover{background:var(--zt-layer)}.zt-host-row>button{border:0;padding:4px 5px;background:transparent}.zt-host-connect{display:flex;align-items:center;gap:8px;flex:1;min-width:0;text-align:left}.zt-host-connect>span:last-child{display:flex;flex-direction:column;min-width:0}.zt-host-connect strong{font-weight:500;overflow:hidden;text-overflow:ellipsis}.zt-host-connect small,.zt-asset-row small{font-size:10px;color:var(--zt-muted);overflow:hidden;text-overflow:ellipsis}.zt-host-glyph{font-size:17px;color:var(--zt-muted);flex:none}.zt-host-row>button:not(.zt-host-connect){font-size:12px;color:var(--zt-muted)}.zt-asset-row{width:100%;display:flex;flex-direction:column;text-align:left;border:0!important;gap:3px;padding:7px 8px!important;background:transparent!important}.zt-asset-row strong{font-weight:500;overflow:hidden;text-overflow:ellipsis}.zt-asset-row:hover{background:var(--zt-layer)!important}.zt-list-empty{padding:18px 8px;color:var(--zt-muted);font-size:12px;text-align:center}.zt-pagination{display:flex;gap:4px;align-items:center;justify-content:flex-end;padding:5px 8px;border-top:1px solid var(--zt-border);font-size:10px;color:var(--zt-muted);flex:none}.zt-pagination span{margin-right:auto}.zt-pagination button{font-size:12px;padding:0 6px}
|
|
37
37
|
.zt-empty{flex:1;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:12px;color:#c6d1e1;padding:30px;text-align:center;min-height:0}.zt-empty h3{font-size:17px;font-weight:500;margin:0}.zt-empty p{font-size:12px;line-height:1.8;color:#8694a9;margin:0}.zt-terminal-mark{font:28px Menlo,Consolas,monospace;opacity:.55}.zt-empty+.zt-screens:empty{flex:none}
|
|
38
38
|
.zt-notice,.zt-error-banner{font-size:12px;padding:7px 9px;background:#fff7e7;color:#805b22;display:flex;gap:8px;align-items:center;flex:none}.zt-notice.danger,.zt-error-banner{background:#fff1f1;color:#a44343}.zt-error-banner{justify-content:space-between}.zt-error-banner button{padding:0 4px;border:0;background:transparent}.zt-notice button{font-size:11px;padding:2px 5px}.zt-error{color:#bc414b}.zt-success{color:#27805c}.zt-hint{font-size:12px;color:var(--zt-muted);line-height:1.7}
|
|
39
39
|
.zt-records{position:absolute;left:0;right:0;bottom:28px;max-height:48%;overflow:auto;background:var(--zt-bg);color:var(--zt-text);border-top:1px solid var(--zt-border);padding:8px 12px;z-index:4;box-shadow:0 -4px 20px #0002}.zt-records>header{display:flex;align-items:center;justify-content:space-between;padding-bottom:7px}.zt-records details{border-top:1px solid var(--zt-border);padding:6px 0}.zt-records summary{display:flex;gap:7px;cursor:pointer;font-size:12px;align-items:center}.zt-records summary>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.zt-records time{font-size:10px;color:var(--zt-muted)}.zt-record-status{font-size:10px;border-radius:4px;padding:1px 4px;background:var(--zt-layer);white-space:nowrap}.zt-record-status.completed{color:#27805c}.zt-record-status.failed,.zt-record-status.unknown{color:#ba4750}.zt-records pre{font:11px/1.6 Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-height:200px;overflow:auto;background:var(--zt-layer);padding:8px;border-radius:6px}
|
|
@@ -41,9 +41,10 @@ ${M}`)).catch(M=>se(M.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
|
41
41
|
.zt-settings{padding:24px;max-width:680px;background:var(--zt-bg);height:100%;overflow:auto}.zt-settings h2{font-size:19px;margin:0 0 8px}.zt-settings>p{color:var(--zt-muted);font-size:13px}.zt-settings-card{background:var(--zt-layer);border:1px solid var(--zt-border);border-radius:10px;padding:16px;margin:18px 0}.zt-settings-card>strong{display:block;margin-bottom:12px}.zt-settings-card .zt-field{margin-top:12px}.zt-settings-card .zt-field input{max-width:220px}
|
|
42
42
|
.zt-header-button{display:inline-flex;align-items:center;gap:5px;font:12px system-ui;border:0;border-radius:6px;padding:5px 7px;color:var(--dsw-alias-label-secondary,#657083);background:transparent;cursor:pointer}.zt-header-button:hover{background:var(--dsw-alias-bg-layer-2,#f4f6f8)}
|
|
43
43
|
.zt-standalone{position:fixed;right:0;top:0;bottom:0;z-index:40;box-shadow:-6px 0 22px #0002;border-left:1px solid var(--dsw-alias-border-l2,#dfe3e9)}.zt-panel-handle{position:absolute;left:-4px;top:0;bottom:0;width:8px;cursor:col-resize;z-index:3}.zt-standalone-error{position:fixed;right:20px;top:80px;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#252b36);padding:18px;border:1px solid #dfe3e9;border-radius:8px;z-index:60;max-width:350px}
|
|
44
|
-
.zt-
|
|
44
|
+
.zt-host-browser{display:flex;flex-direction:column;flex:1;min-height:0}.zt-tree-pane{display:flex;flex-direction:column;flex:none;min-height:0;max-height:100%}.zt-tree-handle{height:8px;flex:none;position:relative;cursor:row-resize;user-select:none}.zt-tree-handle::after{content:"";position:absolute;left:8px;right:8px;top:3px;height:1px;background:var(--zt-border)}.zt-tree-handle::before{content:"";position:absolute;left:calc(50% - 14px);top:2px;width:28px;height:3px;border-radius:2px;background:var(--zt-muted);z-index:1}.zt-tree-handle:hover::before,.zt-tree-handle:focus-visible::before{background:var(--zt-accent)}.zt-tree-handle:focus-visible{outline:1px solid var(--zt-accent);outline-offset:-1px}
|
|
45
|
+
.zt-folder-tree{flex:1;min-height:0;overflow:auto;padding:2px 8px 7px}.zt-folder-tree>button{display:block;width:100%;text-align:left}.zt-folder-tree>div{display:flex;min-width:0}.zt-folder-tree button{font-size:12px;border:0;background:transparent;padding:3px 5px;text-align:left;overflow:hidden;text-overflow:ellipsis}.zt-folder-tree .zt-folder-name{flex:1;min-width:0}.zt-folder-tree .zt-folder-action{flex:none;padding:3px 5px}.zt-folder-menu{position:fixed;inset:auto;margin:0;width:110px;padding:4px;border:1px solid var(--zt-border);border-radius:6px;background:var(--zt-bg);color:var(--zt-text);box-shadow:0 4px 14px #0002}.zt-folder-menu>button{display:block;width:100%;padding:5px 8px;text-align:left;border-radius:4px}.zt-folder-tree .active{color:var(--zt-accent);background:var(--zt-layer)}.zt-folder-toggle{width:20px;flex:none}.zt-standalone{right:var(--dsh-sidebar-width,0px)}
|
|
45
46
|
@media(max-width:700px){.zt-status-info{gap:6px}.zt-terminal-controls{gap:3px;padding:3px 5px}.zt-terminal-controls button{font-size:11px;padding:3px 5px}.zt-terminal-toolbar{padding:5px}.zt-terminal-search span{display:none}.zt-hosts{max-width:42%;min-width:150px}.zt-host-row>button:last-child{display:none}.zt-modal-shade{padding:8px}.zt-mode{padding:3px;font-size:11px}.zt-terminal-toolbar .zt-actions{gap:3px}.zt-terminal-toolbar button{padding:3px 5px;font-size:11px}}
|
|
46
|
-
`;var
|
|
47
|
+
`;var Qt=`/**
|
|
47
48
|
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
48
49
|
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
49
50
|
* https://github.com/chjj/term.js
|
|
@@ -261,6 +262,6 @@ ${M}`)).catch(M=>se(M.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
|
|
|
261
262
|
z-index: 2;
|
|
262
263
|
position: relative;
|
|
263
264
|
}
|
|
264
|
-
`;var de=require("react/jsx-runtime"),
|
|
265
|
-
${
|
|
265
|
+
`;var de=require("react/jsx-runtime"),_i=["slots","connection"],xt="dsh-zterm:workbench";function ft(B=16){return(0,de.jsxs)("svg",{width:B,height:B,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,de.jsx)("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"2"}),(0,de.jsx)("path",{d:"m4 6 2 2-2 2m4 0h4"})]})}function pi({ctx:B,service:A,tab:O,scope:F,visible:D}){return(0,ve.useEffect)(()=>{O?.id&&O.title!==he&&A.updateTab?.(O.id,{title:he})},[A,O?.id,O?.title]),(0,de.jsx)(yt,{ctx:B,sessionId:F.sessionId,visible:D})}function vi(B){let A=new Set,O,F=()=>A.forEach(c=>c()),D=()=>(0,ve.useSyncExternalStore)(c=>(A.add(c),()=>A.delete(c)),()=>O),s=document.createElement("style");s.dataset.plugin="dsh-zterm",s.textContent=`${Qt}
|
|
266
|
+
${Zt}`,document.head.appendChild(s),B.effect(()=>()=>{s.remove(),A.clear()}),B.inject(["betterSidebar"],c=>{O=c.betterSidebar,F();let f=O.registerTab({id:xt,title:()=>he,description:"\u8FDE\u63A5\u771F\u5B9E\u673A\u5668\uFF0C\u63D0\u4F9B\u8BFB\u5DE5\u5177\u548C\u4EBA\u7C7B\u5F00\u542F\u7684\u8BFB\u5199\u64CD\u4F5C\u3002",icon:ft,single:!0,order:109,component:n=>(0,de.jsx)(pi,{...n,ctx:B,service:c.betterSidebar})}),o=c.slots.inject("sidebar.right.pane.tab.title",()=>c.slots.register({name:"sidebar.right.pane.tab.title",key:`dsh-better-sidebar:${xt}`,priority:-1},()=>(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)("span",{"aria-hidden":"true",children:ft()}),he]})));return()=>{o?.(),f?.(),O=void 0,F()}});function a(c){let f=D(),[o,n]=(0,ve.useState)(!1),[d,p]=(0,ve.useState)(""),l=c.sessionId??c.scope?.sessionId,i=c.scope??{sessionId:l},t=c.useChat??c.useSession,e=typeof t=="function"?t(_=>_.legacy?.nodes??_.nodes):void 0,r=(0,ve.useRef)(""),h=()=>{f?.openTab?f.openTab({type:xt,title:he,url:"zterm://workbench"},i):parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0?p("\u53F3\u4FA7\u8111\u56FE\u9762\u677F\u5DF2\u5C55\u5F00\u3002\u8BF7\u5148\u6536\u8D77\u8111\u56FE\uFF0C\u6216\u4F7F\u7528 Better Sidebar \u7684 Tab \u5207\u6362\u3002"):n(!0)};return(0,ve.useEffect)(()=>{l&&ie(B,"client/attach",{sessionId:l,pageId:ut}).catch(()=>{})},[l]),(0,ve.useEffect)(()=>{if(!e)return;let _=Array.isArray(e)?[...e]:[e],v="";for(let g=0;_.length&&g<5e3;g++){let u=_.pop();if(!u||typeof u!="object")continue;let m=u.name??u.call?.name??u.toolName;if(["zterm_connect","zterm_bind"].includes(m)){v=String(u.id??u.callId??u.call?.id??m);break}for(let y of["children","nodes","body","calls","subCalls"])Array.isArray(u[y])&&_.push(...u[y])}v&&v!==r.current&&(r.current=v,h())},[e,f,l]),(0,de.jsxs)(de.Fragment,{children:[(0,de.jsxs)("button",{className:"zt-header-button",title:`\u6253\u5F00 ${he}`,onClick:h,children:[ft(15),he]}),o&&!f&&l&&(0,de.jsx)(gi,{ctx:B,sessionId:l,onClose:()=>n(!1),onConflict:()=>{n(!1),p(`\u8111\u56FE\u9762\u677F\u5DF2\u5C55\u5F00\uFF0C${he} \u72EC\u7ACB\u9762\u677F\u5DF2\u6536\u8D77\u3002\u53EF\u4EE5\u4ECE ${he} \u5165\u53E3\u91CD\u65B0\u6253\u5F00\u3002`)}}),d&&(0,de.jsxs)("div",{className:"zt-standalone-error",role:"alert",children:[d,(0,de.jsx)("button",{onClick:()=>p(""),children:"\u5173\u95ED"})]})]})}B.slots.inject("conversation.session.header.actions",()=>B.slots.register({name:"conversation.session.header.actions",id:"dsh-zterm",order:109},a)),B.slots.inject("settings.section",()=>B.slots.register({name:"settings.section",id:"dsh-zterm",order:109,label:he,icon:ft},()=>(0,de.jsx)(Yt,{ctx:B})))}function gi({ctx:B,sessionId:A,onClose:O,onConflict:F}){let D=o=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),o)),[s,a]=(0,ve.useState)(()=>D(Pe("dsh-zterm.panel-width",window.innerWidth*.6,0,window.innerWidth))),c=Ve();(0,ve.useEffect)(()=>{let o=!0;return ie(B,"catalog").then(n=>{o&&a(D(Pe("dsh-zterm.panel-width",window.innerWidth*n.defaultPanelWidth/100,0,window.innerWidth)))}).catch(()=>{}),()=>{o=!1}},[B]),(0,ve.useEffect)(()=>{let o=()=>{parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0&&F()},n=new MutationObserver(o);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),o(),()=>n.disconnect()},[F]),(0,ve.useEffect)(()=>{let o=()=>a(n=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),n)));return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),(0,ve.useEffect)(()=>{document.documentElement.style.setProperty("--dsh-zterm-width",`${s}px`);let o=document.createElement("style");return o.dataset.plugin="dsh-zterm",o.textContent="#root{margin-right:calc(var(--dsh-zterm-width,0px) + var(--dsh-sidebar-width,0px))!important;width:calc(100% - var(--dsh-zterm-width,0px) - var(--dsh-sidebar-width,0px))!important}",document.head.appendChild(o),()=>{o.remove(),document.documentElement.style.removeProperty("--dsh-zterm-width")}},[s]);let f=o=>{let n=o.clientX,d=s;c(o,p=>{let l=D(d+n-p.clientX);a(l),ze("dsh-zterm.panel-width",l)})};return(0,de.jsxs)("section",{className:"zt-standalone",style:{width:s},"aria-label":he,children:[(0,de.jsx)("div",{className:"zt-panel-handle",role:"separator","aria-label":`\u8C03\u6574 ${he} \u9762\u677F\u5BBD\u5EA6`,onMouseDown:f}),(0,de.jsx)(yt,{ctx:B,sessionId:A,onClose:O})]})}
|
|
266
267
|
return module.exports; } });
|