dsh-zterm 0.1.18 → 0.1.19

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 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 li=Object.create;var tt=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var ci=Object.getOwnPropertyNames;var di=Object.getPrototypeOf,ui=Object.prototype.hasOwnProperty;var pt=(T,R)=>()=>(R||T((R={exports:{}}).exports,R),R.exports),fi=(T,R)=>{for(var O in R)tt(T,O,{get:R[O],enumerable:!0})},Lt=(T,R,O,W)=>{if(R&&typeof R=="object"||typeof R=="function")for(let L of ci(R))!ui.call(T,L)&&L!==O&&tt(T,L,{get:()=>R[L],enumerable:!(W=hi(R,L))||W.enumerable});return T};var vt=(T,R,O)=>(O=T!=null?li(di(T)):{},Lt(R||!T||!T.__esModule?tt(O,"default",{value:T,enumerable:!0}):O,T)),_i=T=>Lt(tt({},"__esModule",{value:!0}),T);var Bt=pt((st,gt)=>{(function(T,R){if(typeof st=="object"&&typeof gt=="object")gt.exports=R();else if(typeof define=="function"&&define.amd)define([],R);else{var O=R();for(var W in O)(typeof st=="object"?st:T)[W]=O[W]}})(globalThis,(()=>(()=>{"use strict";var T={4567:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let a=o(9042),n=o(9924),d=o(844),_=o(4725),h=o(2585),i=o(3656),t=s.AccessibilityManager=class extends d.Disposable{constructor(e,r,l,v){super(),this._terminal=e,this._coreBrowserService=l,this._renderService=v,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 p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,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((p=>this._handleResize(p.rows)))),this.register(this._terminal.onRender((p=>this._refreshRows(p.start,p.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((p=>this._handleChar(p)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
3
- `)))),this.register(this._terminal.onA11yTab((p=>this._handleTab(p)))),this.register(this._terminal.onKey((p=>this._handleKey(p.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+=a.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 l=this._terminal.buffer,v=l.lines.length.toString();for(let p=e;p<=r;p++){let g=l.lines.get(l.ydisp+p),u=[],m=g?.translateToString(!0,void 0,void 0,u)||"",y=(l.ydisp+p+1).toString(),x=this._rowElements[p];x&&(m.length===0?(x.innerText="\xA0",this._rowColumns.set(x,[0,1])):(x.textContent=m,this._rowColumns.set(x,u)),x.setAttribute("aria-posinset",y),x.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,r){let l=e.target,v=this._rowElements[r===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==v)return;let p,g;if(r===0?(p=l,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(p=this._rowElements.shift(),g=l,this._rowContainer.removeChild(p)),p.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},l={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(l.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===l.node&&r.offset>l.offset)&&([r,l]=[l,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 v=this._rowElements.slice(-1)[0];if(l.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(l={node:v,offset:v.textContent?.length??0}),!this._rowContainer.contains(l.node))return;let p=({node:m,offset:y})=>{let x=m instanceof Text?m.parentNode:m,S=parseInt(x?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(x);if(!w)return console.warn("columns is null. Race condition?"),null;let A=y<w.length?w[y]:w.slice(-1)[0]+1;return A>=this._terminal.cols&&(++S,A=0),{row:S,column:A}},g=p(r),u=p(l);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,h.IInstantiationService),f(2,_.ICoreBrowserService),f(3,_.IRenderService)],t)},3614:(L,s)=>{function o(n){return n.replace(/\r?\n/g,"\r")}function c(n,d){return d?"\x1B[200~"+n+"\x1B[201~":n}function f(n,d,_,h){n=c(n=o(n),_.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),_.triggerDataEvent(n,!0),d.value=""}function a(n,d,_){let h=_.getBoundingClientRect(),i=n.clientX-h.left-10,t=n.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(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=c,s.copyHandler=function(n,d){n.clipboardData&&n.clipboardData.setData("text/plain",d.selectionText),n.preventDefault()},s.handlePasteEvent=function(n,d,_,h){n.stopPropagation(),n.clipboardData&&f(n.clipboardData.getData("text/plain"),d,_,h)},s.paste=f,s.moveTextAreaUnderMouseCursor=a,s.rightClickHandler=function(n,d,_,h,i){a(n,d,_),i&&h.rightClickSelect(n),d.value=h.selectionText,d.select()}},7239:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let c=o(1505);s.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,a,n){this._css.set(f,a,n)}getCss(f,a){return this._css.get(f,a)}setColor(f,a,n){this._color.set(f,a,n)}getColor(f,a){return this._color.get(f,a)}clear(){this._color.clear(),this._css.clear()}}},3656:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,f,a){o.addEventListener(c,f,a);let n=!1;return{dispose:()=>{n||(n=!0,o.removeEventListener(c,f,a))}}}},3551:function(L,s,o){var c=this&&this.__decorate||function(t,e,r,l){var v,p=arguments.length,g=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(v=t[u])&&(g=(p<3?v(g):p>3?v(e,r,g):v(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let a=o(3656),n=o(8460),d=o(844),_=o(2585),h=o(4725),i=s.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(t,e,r,l,v){super(),this._element=t,this._mouseService=e,this._renderService=r,this._bufferService=l,this._linkProviderService=v,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,a.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.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 l=0;l<r.length;l++){let v=r[l];if(v.classList.contains("xterm"))break;if(v.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((l=>{l?.forEach((v=>{v.link.dispose&&v.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=t.y);let r=!1;for(let[l,v]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(l)&&(r=this._checkLinkProviderResult(l,t,r)):v.provideLinks(t.y,(p=>{if(this._isMouseOut)return;let g=p?.map((u=>({link:u})));this._activeProviderReplies?.set(l,g),r=this._checkLinkProviderResult(l,t,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)}))}_removeIntersectingLinks(t,e){let r=new Set;for(let l=0;l<e.size;l++){let v=e.get(l);if(v)for(let p=0;p<v.length;p++){let g=v[p],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)){v.splice(p--,1);break}r.add(y)}}}}_checkLinkProviderResult(t,e,r){if(!this._activeProviderReplies)return r;let l=this._activeProviderReplies.get(t),v=!1;for(let p=0;p<t;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(v=!0);if(!v&&l){let p=l.find((g=>this._linkAtPosition(g.link,e)));p&&(r=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let p=0;p<this._activeProviderReplies.size;p++){let g=this._activeProviderReplies.get(p)?.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 l=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(l,v),this._lastMouseEvent)){let p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!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,l=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-l-1,r.end.x,r.end.y-l-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_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,l=t.range.end.y*this._bufferService.cols+t.range.end.x,v=e.y*this._bufferService.cols+e.x;return r<=v&&v<=l}_positionFromMouseEvent(t,e,r){let l=r.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,r,l,v){return{x1:t,y1:e,x2:r,y2:l,cols:this._bufferService.cols,fg:v}}};s.Linkifier=i=c([f(1,h.IMouseService),f(2,h.IRenderService),f(3,_.IBufferService),f(4,h.ILinkProviderService)],i)},9042:(L,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(L,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,v=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(h,i,t,e);else for(var p=h.length-1;p>=0;p--)(r=h[p])&&(v=(l<3?r(v):l>3?r(i,t,v):r(i,t))||v);return l>3&&v&&Object.defineProperty(i,t,v),v},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let a=o(511),n=o(2585),d=s.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=[],r=this._optionsService.rawOptions.linkHandler,l=new a.CellData,v=t.getTrimmedLength(),p=-1,g=-1,u=!1;for(let m=0;m<v;m++)if(g!==-1||t.hasContent(m)){if(t.loadCell(m,l),l.hasExtendedAttrs()&&l.extended.urlId){if(g===-1){g=m,p=l.extended.urlId;continue}u=l.extended.urlId!==p}else g!==-1&&(u=!0);if(u||g!==-1&&m===v-1){let y=this._oscLinkService.getLinkData(p)?.uri;if(y){let x={start:{x:g+1,y:h},end:{x:m+(u||m!==v-1?0:1),y:h}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||e.push({text:y,range:x,activate:(w,A)=>r?r.activate(w,A,x):_(0,A),hover:(w,A)=>r?.hover?.(w,A,x),leave:(w,A)=>r?.leave?.(w,A,x)})}u=!1,l.hasExtendedAttrs()&&l.extended.urlId?(g=m,p=l.extended.urlId):(g=-1,p=-1)}}i(e)}};function _(h,i){if(confirm(`Do you want to navigate to ${i}?
2
+ "use strict";var Oi=Object.create;var pt=Object.defineProperty;var Pi=Object.getOwnPropertyDescriptor;var zi=Object.getOwnPropertyNames;var Hi=Object.getPrototypeOf,Fi=Object.prototype.hasOwnProperty;var Ht=(w,S)=>()=>(S||w((S={exports:{}}).exports,S),S.exports),Ni=(w,S)=>{for(var A in S)pt(w,A,{get:S[A],enumerable:!0})},Zt=(w,S,A,B)=>{if(S&&typeof S=="object"||typeof S=="function")for(let D of zi(S))!Fi.call(w,D)&&D!==A&&pt(w,D,{get:()=>S[D],enumerable:!(B=Pi(S,D))||B.enumerable});return w};var Ft=(w,S,A)=>(A=w!=null?Oi(Hi(w)):{},Zt(S||!w||!w.__esModule?pt(A,"default",{value:w,enumerable:!0}):A,w)),Wi=w=>Zt(pt({},"__esModule",{value:!0}),w);var ri=Ht((mt,Nt)=>{(function(w,S){if(typeof mt=="object"&&typeof Nt=="object")Nt.exports=S();else if(typeof define=="function"&&define.amd)define([],S);else{var A=S();for(var B in A)(typeof mt=="object"?mt:w)[B]=A[B]}})(globalThis,(()=>(()=>{"use strict";var w={4567:function(D,r,o){var c=this&&this.__decorate||function(e,s,d,g){var p,v=arguments.length,f=v<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,s,d,g);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(f=(v<3?p(f):v>3?p(s,d,f):p(s,d))||f);return v>3&&f&&Object.defineProperty(s,d,f),f},u=this&&this.__param||function(e,s){return function(d,g){s(d,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let n=o(9042),a=o(9924),h=o(844),_=o(4725),l=o(2585),i=o(3656),t=r.AccessibilityManager=class extends h.Disposable{constructor(e,s,d,g){super(),this._terminal=e,this._coreBrowserService=d,this._renderService=g,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 p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,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 a.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((p=>this._handleResize(p.rows)))),this.register(this._terminal.onRender((p=>this._refreshRows(p.start,p.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((p=>this._handleChar(p)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
3
+ `)))),this.register(this._terminal.onA11yTab((p=>this._handleTab(p)))),this.register(this._terminal.onKey((p=>this._handleKey(p.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,h.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let s=0;s<e;s++)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+=n.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 d=this._terminal.buffer,g=d.lines.length.toString();for(let p=e;p<=s;p++){let v=d.lines.get(d.ydisp+p),f=[],m=v?.translateToString(!0,void 0,void 0,f)||"",E=(d.ydisp+p+1).toString(),k=this._rowElements[p];k&&(m.length===0?(k.innerText="\xA0",this._rowColumns.set(k,[0,1])):(k.textContent=m,this._rowColumns.set(k,f)),k.setAttribute("aria-posinset",E),k.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,s){let d=e.target,g=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==g)return;let p,v;if(s===0?(p=d,v=this._rowElements.pop(),this._rowContainer.removeChild(v)):(p=this._rowElements.shift(),v=d,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),v.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}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},d={node:e.focusNode,offset:e.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,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 g=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:g,offset:g.textContent?.length??0}),!this._rowContainer.contains(d.node))return;let p=({node:m,offset:E})=>{let k=m instanceof Text?m.parentNode:m,x=parseInt(k?.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;let C=this._rowColumns.get(k);if(!C)return console.warn("columns is null. Race condition?"),null;let M=E<C.length?C[E]:C.slice(-1)[0]+1;return M>=this._terminal.cols&&(++x,M=0),{row:x,column:M}},v=p(s),f=p(d);if(v&&f){if(v.row>f.row||v.row===f.row&&v.column>=f.column)throw new Error("invalid range");this._terminal.select(v.column,v.row,(f.row-v.row)*this._terminal.cols-v.column+f.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,l.IInstantiationService),u(2,_.ICoreBrowserService),u(3,_.IRenderService)],t)},3614:(D,r)=>{function o(a){return a.replace(/\r?\n/g,"\r")}function c(a,h){return h?"\x1B[200~"+a+"\x1B[201~":a}function u(a,h,_,l){a=c(a=o(a),_.decPrivateModes.bracketedPasteMode&&l.rawOptions.ignoreBracketedPasteMode!==!0),_.triggerDataEvent(a,!0),h.value=""}function n(a,h,_){let l=_.getBoundingClientRect(),i=a.clientX-l.left-10,t=a.clientY-l.top-10;h.style.width="20px",h.style.height="20px",h.style.left=`${i}px`,h.style.top=`${t}px`,h.style.zIndex="1000",h.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=o,r.bracketTextForPaste=c,r.copyHandler=function(a,h){a.clipboardData&&a.clipboardData.setData("text/plain",h.selectionText),a.preventDefault()},r.handlePasteEvent=function(a,h,_,l){a.stopPropagation(),a.clipboardData&&u(a.clipboardData.getData("text/plain"),h,_,l)},r.paste=u,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(a,h,_,l,i){n(a,h,_),i&&l.rightClickSelect(a),h.value=l.selectionText,h.select()}},7239:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let c=o(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(u,n,a){this._css.set(u,n,a)}getCss(u,n){return this._css.get(u,n)}setColor(u,n,a){this._color.set(u,n,a)}getColor(u,n){return this._color.get(u,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,c,u,n){o.addEventListener(c,u,n);let a=!1;return{dispose:()=>{a||(a=!0,o.removeEventListener(c,u,n))}}}},3551:function(D,r,o){var c=this&&this.__decorate||function(t,e,s,d){var g,p=arguments.length,v=p<3?e:d===null?d=Object.getOwnPropertyDescriptor(e,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(t,e,s,d);else for(var f=t.length-1;f>=0;f--)(g=t[f])&&(v=(p<3?g(v):p>3?g(e,s,v):g(e,s))||v);return p>3&&v&&Object.defineProperty(e,s,v),v},u=this&&this.__param||function(t,e){return function(s,d){e(s,d,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let n=o(3656),a=o(8460),h=o(844),_=o(2585),l=o(4725),i=r.Linkifier=class extends h.Disposable{get currentLink(){return this._currentLink}constructor(t,e,s,d,g){super(),this._element=t,this._mouseService=e,this._renderService=s,this._bufferService=d,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new a.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new a.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,h.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,h.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.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 d=0;d<s.length;d++){let g=s[d];if(g.classList.contains("xterm"))break;if(g.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((d=>{d?.forEach((g=>{g.link.dispose&&g.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=t.y);let s=!1;for(let[d,g]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(d)&&(s=this._checkLinkProviderResult(d,t,s)):g.provideLinks(t.y,(p=>{if(this._isMouseOut)return;let v=p?.map((f=>({link:f})));this._activeProviderReplies?.set(d,v),s=this._checkLinkProviderResult(d,t,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)}))}_removeIntersectingLinks(t,e){let s=new Set;for(let d=0;d<e.size;d++){let g=e.get(d);if(g)for(let p=0;p<g.length;p++){let v=g[p],f=v.link.range.start.y<t?0:v.link.range.start.x,m=v.link.range.end.y>t?this._bufferService.cols:v.link.range.end.x;for(let E=f;E<=m;E++){if(s.has(E)){g.splice(p--,1);break}s.add(E)}}}}_checkLinkProviderResult(t,e,s){if(!this._activeProviderReplies)return s;let d=this._activeProviderReplies.get(t),g=!1;for(let p=0;p<t;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(g=!0);if(!g&&d){let p=d.find((v=>this._linkAtPosition(v.link,e)));p&&(s=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let p=0;p<this._activeProviderReplies.size;p++){let v=this._activeProviderReplies.get(p)?.find((f=>this._linkAtPosition(f.link,e)));if(v){s=!0,this._handleNewLink(v);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,h.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 d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(d,g),this._lastMouseEvent)){let p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!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,d=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_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,d=t.range.end.y*this._bufferService.cols+t.range.end.x,g=e.y*this._bufferService.cols+e.x;return s<=g&&g<=d}_positionFromMouseEvent(t,e,s){let d=s.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,s,d,g){return{x1:t,y1:e,x2:s,y2:d,cols:this._bufferService.cols,fg:g}}};r.Linkifier=i=c([u(1,l.IMouseService),u(2,l.IRenderService),u(3,_.IBufferService),u(4,l.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,o){var c=this&&this.__decorate||function(l,i,t,e){var s,d=arguments.length,g=d<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(l,i,t,e);else for(var p=l.length-1;p>=0;p--)(s=l[p])&&(g=(d<3?s(g):d>3?s(i,t,g):s(i,t))||g);return d>3&&g&&Object.defineProperty(i,t,g),g},u=this&&this.__param||function(l,i){return function(t,e){i(t,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let n=o(511),a=o(2585),h=r.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=[],s=this._optionsService.rawOptions.linkHandler,d=new n.CellData,g=t.getTrimmedLength(),p=-1,v=-1,f=!1;for(let m=0;m<g;m++)if(v!==-1||t.hasContent(m)){if(t.loadCell(m,d),d.hasExtendedAttrs()&&d.extended.urlId){if(v===-1){v=m,p=d.extended.urlId;continue}f=d.extended.urlId!==p}else v!==-1&&(f=!0);if(f||v!==-1&&m===g-1){let E=this._oscLinkService.getLinkData(p)?.uri;if(E){let k={start:{x:v+1,y:l},end:{x:m+(f||m!==g-1?0:1),y:l}},x=!1;if(!s?.allowNonHttpProtocols)try{let C=new URL(E);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||e.push({text:E,range:k,activate:(C,M)=>s?s.activate(C,M,k):_(0,M),hover:(C,M)=>s?.hover?.(C,M,k),leave:(C,M)=>s?.leave?.(C,M,k)})}f=!1,d.hasExtendedAttrs()&&d.extended.urlId?(v=m,p=d.extended.urlId):(v=-1,p=-1)}}i(e)}};function _(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")}}s.OscLinkProvider=d=c([f(0,n.IBufferService),f(1,n.IOptionsService),f(2,n.IOscLinkService)],d)},6193:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let c=o(3614),f=o(3656),a=o(3551),n=o(9042),d=o(3730),_=o(1680),h=o(3107),i=o(5744),t=o(2950),e=o(1296),r=o(428),l=o(4269),v=o(5114),p=o(8934),g=o(3230),u=o(9312),m=o(4725),y=o(6731),x=o(8055),S=o(8969),w=o(8460),A=o(844),z=o(6114),U=o(8437),q=o(2584),$=o(7399),b=o(5941),E=o(9074),k=o(2585),D=o(5435),P=o(4567),K=o(779);class Y extends S.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(M={}){super(M),this.browser=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new A.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(E.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(((C,H)=>this.refresh(C,H)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((C=>this._reportWindowsOptions(C)))),this.register(this._inputHandler.onColor((C=>this._handleColorEvent(C)))),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((C=>this._afterResize(C.cols,C.rows)))),this.register((0,A.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(M){if(this._themeService)for(let C of M){let H,N="";switch(C.index){case 256:H="foreground",N="10";break;case 257:H="background",N="11";break;case 258:H="cursor",N="12";break;default:H="ansi",N="4;"+C.index}switch(C.type){case 0:let V=x.color.toColorRGB(H==="ansi"?this._themeService.colors.ansi[C.index]:this._themeService.colors[H]);this.coreService.triggerDataEvent(`${q.C0.ESC}]${N};${(0,b.toRgbString)(V)}${q.C1_ESCAPED.ST}`);break;case 1:if(H==="ansi")this._themeService.modifyColors((j=>j.ansi[C.index]=x.channels.toColor(...C.color)));else{let j=H;this._themeService.modifyColors((te=>te[j]=x.channels.toColor(...C.color)))}break;case 2:this._themeService.restoreColor(C.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){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 M=this.buffer.ybase+this.buffer.y,C=this.buffer.lines.get(M);if(!C)return;let H=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,V=C.getWidth(H),j=this._renderService.dimensions.css.cell.width*V,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ne=H*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",(C=>{this.hasSelection()&&(0,c.copyHandler)(C,this._selectionService)})));let M=C=>(0,c.handlePasteEvent)(C,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,f.addDisposableDomListener)(this.element,"paste",M)),z.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(C=>{C.button===2&&(0,c.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(C=>{(0,c.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),z.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(C=>{C.button===1&&(0,c.moveTextAreaUnderMouseCursor)(C,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(M=>this._keyUp(M)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(M=>this._keyDown(M)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(M=>this._keyPress(M)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(M=>this._compositionHelper.compositionupdate(M)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(M=>this._inputEvent(M)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(M){if(!M)throw new Error("Terminal requires a parent element.");if(M.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=M.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"),M.appendChild(this.element);let C=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),C.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",(H=>this.updateCursorStyle(H)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),C.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(v.CoreBrowserService,this.textarea,M.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",(H=>this._handleTextAreaFocus(H)))),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(l.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((H=>this._onRender.fire(H)))),this.onResize((H=>this._renderService.resize(H.cols,H.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(p.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(C);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(_.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((H=>this.scrollLines(H.amount,H.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((H=>this.scrollLines(H.amount,H.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(H=>this._selectionService.handleMouseDown(H)))),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(P.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(H=>this._handleScreenReaderModeOptionChange(H)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(H=>{!this._overviewRulerRenderer&&H&&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 M=this,C=this.element;function H(j){let te=M._mouseService.getMouseReportCoords(j,M.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(M._customWheelEventHandler&&M._customWheelEventHandler(j)===!1||M.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)&&M.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=>(H(j),j.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(j)),wheel:j=>(H(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&H(j)},mousemove:j=>{j.buttons||H(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||(C.addEventListener("mousemove",V.mousemove),N.mousemove=V.mousemove):(C.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&j?N.wheel||(C.addEventListener("wheel",V.wheel,{passive:!1}),N.wheel=V.wheel):(C.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)(C,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return H(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)(C,"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)(C,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(C,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(M,C){this._renderService?.refreshRows(M,C)}updateCursorStyle(M){this._selectionService?.shouldColumnSelect(M)?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(M,C,H=0){H===1?(super.scrollLines(M,C,H),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(M)}paste(M){(0,c.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let C=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),C}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,C,H){this._selectionService.setSelection(M,C,H)}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(M,C){this._selectionService?.selectLines(M,C)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;let C=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!C&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;C||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let H=(0,$.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),H.type===3||H.type===2){let N=this.rows-1;return this.scrollLines(H.type===2?-N:N),this.cancel(M,!0)}return H.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(H.cancel&&this.cancel(M,!0),!H.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(H.key!==q.C0.ETX&&H.key!==q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:H.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(H.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,C){let H=M.isMac&&!this.options.macOptionIsMeta&&C.altKey&&!C.ctrlKey&&!C.metaKey||M.isWindows&&C.altKey&&C.ctrlKey&&!C.metaKey||M.isWindows&&C.getModifierState("AltGraph");return C.type==="keypress"?H:H&&(!C.keyCode||C.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||((function(C){return C.keyCode===16||C.keyCode===17||C.keyCode===18})(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let C;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)C=M.charCode;else if(M.which===null||M.which===void 0)C=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;C=M.which}return!(!C||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(C=String.fromCharCode(C),this._onKey.fire({key:C,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(C,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let C=M.data;return this.coreService.triggerDataEvent(C,!0),this.cancel(M),!0}return!1}resize(M,C){M!==this.cols||C!==this.rows?super.resize(M,C):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,C){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 M=1;M<this.rows;M++)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 M=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=M,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(M){if(this._renderService)switch(M){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let C=this._renderService.dimensions.css.canvas.width.toFixed(0),H=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.C0.ESC}[4;${H};${C}t`);break;case D.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(M,C){if(this.options.cancelEvents||C)return M.preventDefault(),M.stopPropagation(),!1}}s.Terminal=Y},9924:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let a=Date.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=a-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 o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(L,s,o){var c=this&&this.__decorate||function(t,e,r,l){var v,p=arguments.length,g=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(v=t[u])&&(g=(p<3?v(g):p>3?v(e,r,g):v(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let a=o(3656),n=o(4725),d=o(8460),_=o(844),h=o(2585),i=s.Viewport=class extends _.Disposable{constructor(t,e,r,l,v,p,g,u){super(),this._viewportElement=t,this._scrollArea=e,this._bufferService=r,this._optionsService=l,this._charSizeService=v,this._renderService=p,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,a.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,l="",v=[],p=e??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let u=t;u<p;u++){let m=g.get(u);if(!m)continue;let y=g.get(u+1)?.isWrapped;if(l+=m.translateToString(!y),!y||u===g.length-1){let x=document.createElement("div");x.textContent=l,v.push(x),l.length>0&&(r=x),l=""}}return{bufferElements:v,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,h.IBufferService),f(3,h.IOptionsService),f(4,n.ICharSizeService),f(5,n.IRenderService),f(6,n.ICoreBrowserService),f(7,n.IThemeService)],i)},3107:function(L,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,v=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(h,i,t,e);else for(var p=h.length-1;p>=0;p--)(r=h[p])&&(v=(l<3?r(v):l>3?r(i,t,v):r(i,t))||v);return l>3&&v&&Object.defineProperty(i,t,v),v},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let a=o(4725),n=o(844),d=o(2585),_=s.BufferDecorationRenderer=class extends n.Disposable{constructor(h,i,t,e,r){super(),this._screenElement=h,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((l=>this._removeDecoration(l)))),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 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()}};s.BufferDecorationRenderer=_=c([f(1,d.IBufferService),f(2,a.ICoreBrowserService),f(3,d.IDecorationService),f(4,a.IRenderService)],_)},5871:(L,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(o){if(o.options.overviewRulerOptions){for(let c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,f){return c>=o.startBufferLine-this._linePadding[f||"full"]&&c<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(L,s,o){var c=this&&this.__decorate||function(r,l,v,p){var g,u=arguments.length,m=u<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,v):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,l,v,p);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(l,v,m):g(l,v))||m);return u>3&&m&&Object.defineProperty(l,v,m),m},f=this&&this.__param||function(r,l){return function(v,p){l(v,p,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let a=o(5871),n=o(4725),d=o(844),_=o(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=s.OverviewRulerRenderer=class extends d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,l,v,p,g,u,m){super(),this._viewportElement=r,this._screenElement=l,this._bufferService=v,this._decorationService=p,this._renderService=g,this._optionsService=u,this._coreBrowserService=m,this._colorZoneStore=new a.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),l=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=r,i.center=l,i.right=r,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 r=this._canvas.height/this._bufferService.buffer.lines.length,l=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);h.left=l,h.center=l,h.right=l}_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 l of this._decorationService.decorations)this._colorZoneStore.addDecoration(l);this._ctx.lineWidth=1;let r=this._colorZoneStore.zones;for(let l of r)l.position!=="full"&&this._renderColorZone(l);for(let l of r)l.position==="full"&&this._renderColorZone(l);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)-h[r.position||"full"]/2),i[r.position||"full"],Math.round((this._canvas.height-1)*((r.endBufferLine-r.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[r.position||"full"]))}_queueRefresh(r,l){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=l||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=e=c([f(2,_.IBufferService),f(3,_.IDecorationService),f(4,n.IRenderService),f(5,_.IOptionsService),f(6,n.ICoreBrowserService)],e)},2950:function(L,s,o){var c=this&&this.__decorate||function(h,i,t,e){var r,l=arguments.length,v=l<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(h,i,t,e);else for(var p=h.length-1;p>=0;p--)(r=h[p])&&(v=(l<3?r(v):l>3?r(i,t,v):r(i,t))||v);return l>3&&v&&Object.defineProperty(i,t,v),v},f=this&&this.__param||function(h,i){return function(t,e){i(t,e,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let a=o(4725),n=o(2585),d=o(2584),_=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,i,t,e,r,l){this._textarea=h,this._compositionView=i,this._bufferService=t,this._optionsService=e,this._coreService=r,this._renderService=l,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,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 l=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=_=c([f(2,n.IBufferService),f(3,n.IOptionsService),f(4,n.ICoreService),f(5,a.IRenderService)],_)},9806:(L,s)=>{function o(c,f,a){let n=a.getBoundingClientRect(),d=c.getComputedStyle(a),_=parseInt(d.getPropertyValue("padding-left")),h=parseInt(d.getPropertyValue("padding-top"));return[f.clientX-n.left-_,f.clientY-n.top-h]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(c,f,a,n,d,_,h,i,t){if(!_)return;let e=o(c,f,a);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),n+(t?1:0)),e[1]=Math.min(Math.max(e[1],1),d),e):void 0}},9504:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let c=o(2584);function f(i,t,e,r){let l=i-a(i,e),v=t-a(t,e),p=Math.abs(l-v)-(function(g,u,m){let y=0,x=g-a(g,m),S=u-a(u,m);for(let w=0;w<Math.abs(x-S);w++){let A=n(g,u)==="A"?-1:1;m.buffer.lines.get(x+A*w)?.isWrapped&&y++}return y})(i,t,e);return h(p,_(n(i,t),r))}function a(i,t){let e=0,r=t.buffer.lines.get(i),l=r?.isWrapped;for(;l&&i>=0&&i<t.rows;)e++,r=t.buffer.lines.get(--i),l=r?.isWrapped;return e}function n(i,t){return i>t?"A":"B"}function d(i,t,e,r,l,v){let p=i,g=t,u="";for(;p!==e||g!==r;)p+=l?1:-1,l&&p>v.cols-1?(u+=v.buffer.translateBufferLineToString(g,!1,i,p),p=0,i=0,g++):!l&&p<0&&(u+=v.buffer.translateBufferLineToString(g,!1,0,i+1),p=v.cols-1,i=p,g--);return u+v.buffer.translateBufferLineToString(g,!1,i,p)}function _(i,t){let e=t?"O":"[";return c.C0.ESC+e+i}function h(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 l=e.buffer.x,v=e.buffer.y;if(!e.buffer.hasScrollback)return(function(u,m,y,x,S,w){return f(m,x,S,w).length===0?"":h(d(u,m,u,m-a(m,S),!1,S).length,_("D",w))})(l,v,0,t,e,r)+f(v,t,e,r)+(function(u,m,y,x,S,w){let A;A=f(m,x,S,w).length>0?x-a(x,S):m;let z=x,U=(function(q,$,b,E,k,D){let P;return P=f(b,E,k,D).length>0?E-a(E,k):$,q<b&&P<=E||q>=b&&P<E?"C":"D"})(u,m,y,x,S,w);return h(d(u,A,y,z,U==="C",S).length,_(U,w))})(l,v,i,t,e,r);let p;if(v===t)return p=l>i?"D":"C",h(Math.abs(l-i),_(p,r));p=v>t?"D":"C";let g=Math.abs(v-t);return h((function(u,m){return m.cols-u})(v>t?i:l,e)+(g-1)*e.cols+1+((v>t?l:i)-1),_(p,r))}},1296:function(L,s,o){var c=this&&this.__decorate||function(w,A,z,U){var q,$=arguments.length,b=$<3?A:U===null?U=Object.getOwnPropertyDescriptor(A,z):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(w,A,z,U);else for(var E=w.length-1;E>=0;E--)(q=w[E])&&(b=($<3?q(b):$>3?q(A,z,b):q(A,z))||b);return $>3&&b&&Object.defineProperty(A,z,b),b},f=this&&this.__param||function(w,A){return function(z,U){A(z,U,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let a=o(3787),n=o(2550),d=o(2223),_=o(6171),h=o(6052),i=o(4725),t=o(8055),e=o(8460),r=o(844),l=o(2585),v="xterm-dom-renderer-owner-",p="xterm-rows",g="xterm-fg-",u="xterm-bg-",m="xterm-focus",y="xterm-selection",x=1,S=s.DomRenderer=class extends r.Disposable{constructor(w,A,z,U,q,$,b,E,k,D,P,K,Y){super(),this._terminal=w,this._document=A,this._element=z,this._screenElement=U,this._viewportElement=q,this._helperContainer=$,this._linkifier2=b,this._charSizeService=k,this._optionsService=D,this._bufferService=P,this._coreBrowserService=K,this._themeService=Y,this._terminalClass=x++,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(p),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,_.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=E.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(v+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(v+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 A=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=A,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 A=`${this._terminalSelector} .${p} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;A+=`${this._terminalSelector} .${p} .xterm-dim { color: ${t.color.multiplyOpacity(w.foreground,.5).css};}`,A+=`${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}`;A+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,A+=`@keyframes ${U} { 50% { box-shadow: none; }}`,A+=`@keyframes ${q} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,A+=`${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,A+=`${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[$,b]of w.ansi.entries())A+=`${this._terminalSelector} .${g}${$} { color: ${b.css}; }${this._terminalSelector} .${g}${$}.xterm-dim { color: ${t.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${u}${$} { background-color: ${b.css}; }`;A+=`${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=A}_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,A){for(let z=this._rowElements.length;z<=A;z++){let U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>A;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,A){this._refreshRowElements(w,A),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,A,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,A,z),this.renderRows(0,this._bufferService.rows-1),!w||!A)return;this._selectionRenderModel.update(this._terminal,w,A,z);let U=this._selectionRenderModel.viewportStartRow,q=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(z){let k=w[0]>A[0];E.appendChild(this._createSelectionElement($,k?A[0]:w[0],k?w[0]:A[0],b-$+1))}else{let k=U===$?w[0]:0,D=$===q?A[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement($,k,D));let P=b-$-1;if(E.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,P)),$!==b){let K=q===b?A[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(w,A,z,U=1){let q=this._document.createElement("div"),$=A*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(z-A);return $+b>this.dimensions.css.canvas.width&&(b=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=`${b}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,A){let z=this._bufferService.buffer,U=z.ybase+z.y,q=Math.min(z.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let k=w;k<=A;k++){let D=k+z.ydisp,P=this._rowElements[k],K=z.lines.get(D);if(!P||!K)break;P.replaceChildren(...this._rowFactory.createRow(K,D,D===U,b,E,q,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${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,A,z,U,q,$){z<0&&(w=0),U<0&&(A=0);let b=this._bufferService.rows-1;z=Math.max(Math.min(z,b),0),U=Math.max(Math.min(U,b),0),q=Math.min(q,this._bufferService.cols);let E=this._bufferService.buffer,k=E.ybase+E.y,D=Math.min(E.x,q-1),P=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=z;Z<=U;++Z){let M=Z+E.ydisp,C=this._rowElements[Z],H=E.lines.get(M);if(!C||!H)break;C.replaceChildren(...this._rowFactory.createRow(H,M,M===k,K,Y,D,P,this.dimensions.css.cell.width,this._widthCache,$?Z===z?w:0:-1,$?(Z===U?A:q)-1:-1))}}};s.DomRenderer=S=c([f(7,l.IInstantiationService),f(8,i.ICharSizeService),f(9,l.IOptionsService),f(10,l.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],S)},3787:function(L,s,o){var c=this&&this.__decorate||function(p,g,u,m){var y,x=arguments.length,S=x<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,g,u,m);else for(var w=p.length-1;w>=0;w--)(y=p[w])&&(S=(x<3?y(S):x>3?y(g,u,S):y(g,u))||S);return x>3&&S&&Object.defineProperty(g,u,S),S},f=this&&this.__param||function(p,g){return function(u,m){g(u,m,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let a=o(2223),n=o(643),d=o(511),_=o(2585),h=o(8055),i=o(4725),t=o(4269),e=o(6171),r=o(3734),l=s.DomRendererRowFactory=class{constructor(p,g,u,m,y,x,S){this._document=p,this._characterJoinerService=g,this._optionsService=u,this._coreBrowserService=m,this._coreService=y,this._decorationService=x,this._themeService=S,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,g,u){this._selectionStart=p,this._selectionEnd=g,this._columnSelectMode=u}createRow(p,g,u,m,y,x,S,w,A,z,U){let q=[],$=this._characterJoinerService.getJoinedCharacters(g),b=this._themeService.colors,E,k=p.getNoBgTrimmedLength();u&&k<x+1&&(k=x+1);let D=0,P="",K=0,Y=0,Z=0,M=!1,C=0,H=!1,N=0,V=[],j=z!==-1&&U!==-1;for(let te=0;te<k;te++){p.loadCell(te,this._workCell);let ne=this._workCell.getWidth();if(ne===0)continue;let oe=!1,fe=te,X=this._workCell;if($.length>0&&te===$[0][0]){oe=!0;let J=$.shift();X=new t.JoinedCellData(this._workCell,p.translateToString(!0,J[0],J[1]),J[1]-J[0]),fe=J[1]-1,ne=X.getWidth()}let Ce=this._isCellInSelection(te,g),We=u&&te===x,Be=j&&te>=z&&te<=U,Ue=!1;this._decorationService.forEachDecorationAtCell(te,g,void 0,(J=>{Ue=!0}));let Ie=X.getChars()||n.WHITESPACE_CELL_CHAR;if(Ie===" "&&(X.isUnderline()||X.isOverline())&&(Ie="\xA0"),N=ne*w-A.get(Ie,X.isBold(),X.isItalic()),E){if(D&&(Ce&&H||!Ce&&!H&&X.bg===K)&&(Ce&&H&&b.selectionForeground||X.fg===Y)&&X.extended.ext===Z&&Be===M&&N===C&&!We&&!oe&&!Ue){X.isInvisible()?P+=n.WHITESPACE_CELL_CHAR:P+=Ie,D++;continue}D&&(E.textContent=P),E=this._document.createElement("span"),D=0,P=""}else E=this._document.createElement("span");if(K=X.bg,Y=X.fg,Z=X.extended.ext,M=Be,C=N,H=Ce,oe&&x>=te&&x<=fe&&(x=te),!this._coreService.isCursorHidden&&We&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)S&&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(X.isBold()&&V.push("xterm-bold"),X.isItalic()&&V.push("xterm-italic"),X.isDim()&&V.push("xterm-dim"),P=X.isInvisible()?n.WHITESPACE_CELL_CHAR:X.getChars()||n.WHITESPACE_CELL_CHAR,X.isUnderline()&&(V.push(`xterm-underline-${X.extended.underlineStyle}`),P===" "&&(P="\xA0"),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let J=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&J<8&&(J+=8),E.style.textDecorationColor=b.ansi[J].css}X.isOverline()&&(V.push("xterm-overline"),P===" "&&(P="\xA0")),X.isStrikethrough()&&V.push("xterm-strikethrough"),Be&&(E.style.textDecoration="underline");let me=X.getFgColor(),ke=X.getFgColorMode(),we=X.getBgColor(),Te=X.getBgColorMode(),Je=!!X.isInverse();if(Je){let J=me;me=we,we=J;let xe=ke;ke=Te,Te=xe}let se,ye,ae,Le=!1;switch(this._decorationService.forEachDecorationAtCell(te,g,void 0,(J=>{J.options.layer!=="top"&&Le||(J.backgroundColorRGB&&(Te=50331648,we=J.backgroundColorRGB.rgba>>8&16777215,se=J.backgroundColorRGB),J.foregroundColorRGB&&(ke=50331648,me=J.foregroundColorRGB.rgba>>8&16777215,ye=J.foregroundColorRGB),Le=J.options.layer==="top")})),!Le&&Ce&&(se=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,we=se.rgba>>8&16777215,Te=50331648,Le=!0,b.selectionForeground&&(ke=50331648,me=b.selectionForeground.rgba>>8&16777215,ye=b.selectionForeground)),Le&&V.push("xterm-decoration-top"),Te){case 16777216:case 33554432:ae=b.ansi[we],V.push(`xterm-bg-${we}`);break;case 50331648:ae=h.channels.toColor(we>>16,we>>8&255,255&we),this._addStyle(E,`background-color:#${v((we>>>0).toString(16),"0",6)}`);break;default:Je?(ae=b.foreground,V.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ae=b.background}switch(se||X.isDim()&&(se=h.color.multiplyOpacity(ae,.5)),ke){case 16777216:case 33554432:X.isBold()&&me<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(me+=8),this._applyMinimumContrast(E,ae,b.ansi[me],X,se,void 0)||V.push(`xterm-fg-${me}`);break;case 50331648:let J=h.channels.toColor(me>>16&255,me>>8&255,255&me);this._applyMinimumContrast(E,ae,J,X,se,ye)||this._addStyle(E,`color:#${v(me.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ae,b.foreground,X,se,ye)||Je&&V.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}V.length&&(E.className=V.join(" "),V.length=0),We||oe||Ue?E.textContent=P:D++,N!==this.defaultSpacing&&(E.style.letterSpacing=`${N}px`),q.push(E),te=fe}return E&&D&&(E.textContent=P),q}_applyMinimumContrast(p,g,u,m,y,x){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let S=this._getContrastCache(m),w;if(y||x||(w=S.getColor(g.rgba,u.rgba)),w===void 0){let A=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);w=h.color.ensureContrastRatio(y||g,x||u,A),S.setColor((y||g).rgba,(x||u).rgba,w??null)}return!!w&&(this._addStyle(p,`color:${w.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,g){p.setAttribute("style",`${p.getAttribute("style")||""}${g};`)}_isCellInSelection(p,g){let u=this._selectionStart,m=this._selectionEnd;return!(!u||!m)&&(this._columnSelectMode?u[0]<=m[0]?p>=u[0]&&g>=u[1]&&p<m[0]&&g<=m[1]:p<u[0]&&g>=u[1]&&p>=m[0]&&g<=m[1]:g>u[1]&&g<m[1]||u[1]===m[1]&&g===u[1]&&p>=u[0]&&p<m[0]||u[1]<m[1]&&g===m[1]&&p<m[0]||u[1]<m[1]&&g===u[1]&&p>=u[0])}};function v(p,g,u){for(;p.length<u;)p=g+p;return p}s.DomRendererRowFactory=l=c([f(1,i.ICharacterJoinerService),f(2,_.IOptionsService),f(3,i.ICoreBrowserService),f(4,_.ICoreService),f(5,_.IDecorationService),f(6,i.IThemeService)],l)},2550:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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=o.createElement("span");f.classList.add("xterm-char-measure-element");let a=o.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[f,a,n,d],this._container.appendChild(f),this._container.appendChild(a),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(o,c,f,a){o===this._font&&c===this._fontSize&&f===this._weight&&a===this._weightBold||(this._font=o,this._fontSize=c,this._weight=f,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(o,c,f){let a=0;if(!c&&!f&&o.length===1&&(a=o.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let _=this._measure(o,0);return _>0&&(this._flat[a]=_),_}let n=o;c&&(n+="B"),f&&(n+="I");let d=this._holey.get(n);if(d===void 0){let _=0;c&&(_|=1),f&&(_|=2),d=this._measure(o,_),d>0&&this._holey.set(n,d)}return d}_measure(o,c){let f=this._measureElements[c];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let c=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(L,s)=>{function o(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=o,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=c,s.allowRescaling=function(f,a,n,d){return a===1&&n>Math.ceil(1.5*d)&&f!==void 0&&f>255&&!c(f)&&!o(f)&&!(function(_){return 57344<=_&&_<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return o(f)||(function(a){return 9472<=a&&a<=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,a,n=0){return(f-(2*Math.round(a)-n))%(2*Math.round(a))}},6052:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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,a,n,d=!1){if(this.selectionStart=a,this.selectionEnd=n,!a||!n||a[0]===n[0]&&a[1]===n[1])return void this.clear();let _=f.buffers.active.ydisp,h=a[1]-_,i=n[1]-_,t=Math.max(h,0),e=Math.min(i,f.rows-1);t>=f.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=a[0],this.endCol=n[0])}isCellSelected(f,a,n){return!!this.hasSelection&&(n-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?a>=this.startCol&&n>=this.viewportCappedStartRow&&a<this.endCol&&n<=this.viewportCappedEndRow:a<this.startCol&&n>=this.viewportCappedStartRow&&a>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&a>=this.startCol&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&a>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let a=o(2585),n=o(8460),d=o(844),_=s.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,r,l){super(),this._optionsService=l,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=_=c([f(2,a.IOptionsService)],_);class h extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,l){r!==void 0&&r>0&&l!==void 0&&l>0&&(this._result.width=r,this._result.height=l)}}class i extends h{constructor(r,l,v){super(),this._document=r,this._parentElement=l,this._optionsService=v,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(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let l=this._ctx.measureText("W");if(!("width"in l&&"fontBoundingBoxAscent"in l&&"fontBoundingBoxDescent"in l))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(L,s,o){var c=this&&this.__decorate||function(t,e,r,l){var v,p=arguments.length,g=p<3?e:l===null?l=Object.getOwnPropertyDescriptor(e,r):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,e,r,l);else for(var u=t.length-1;u>=0;u--)(v=t[u])&&(g=(p<3?v(g):p>3?v(e,r,g):v(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},f=this&&this.__param||function(t,e){return function(r,l){e(r,l,t)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let a=o(3734),n=o(643),d=o(511),_=o(2585);class h extends a.AttributeData{constructor(e,r,l){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=r,this._width=l}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=h;let i=s.CharacterJoinerService=class Mt{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 l=[],v=r.translateToString(!0),p=0,g=0,u=0,m=r.getFg(0),y=r.getBg(0);for(let x=0;x<r.getTrimmedLength();x++)if(r.loadCell(x,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==y){if(x-p>1){let S=this._getJoinedRanges(v,u,g,r,p);for(let w=0;w<S.length;w++)l.push(S[w])}p=x,u=g,m=this._workCell.fg,y=this._workCell.bg}g+=this._workCell.getChars().length||n.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){let x=this._getJoinedRanges(v,u,g,r,p);for(let S=0;S<x.length;S++)l.push(x[S])}return l}_getJoinedRanges(e,r,l,v,p){let g=e.substring(r,l),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 x=0;x<y.length;x++)Mt._mergeRanges(u,y[x])}catch(y){console.error(y)}return this._stringRangesToCellRanges(u,v,p),u}_stringRangesToCellRanges(e,r,l){let v=0,p=!1,g=0,u=e[v];if(u){for(let m=l;m<this._bufferService.cols;m++){let y=r.getWidth(m),x=r.getString(m).length||n.WHITESPACE_CELL_CHAR.length;if(y!==0){if(!p&&u[0]<=g&&(u[0]=m,p=!0),u[1]<=g){if(u[1]=m,u=e[++v],!u)break;u[0]<=g?(u[0]=m,p=!0):p=!1}g+=x}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,r){let l=!1;for(let v=0;v<e.length;v++){let p=e[v];if(l){if(r[1]<=p[0])return e[v-1][1]=r[1],e;if(r[1]<=p[1])return e[v-1][1]=Math.max(r[1],p[1]),e.splice(v,1),e;e.splice(v,1),v--}else{if(r[1]<=p[0])return e.splice(v,0,r),e;if(r[1]<=p[1])return p[0]=Math.min(r[0],p[0]),e;r[0]<p[1]&&(p[0]=Math.min(r[0],p[0]),l=!0)}}return l?e[e.length-1][1]=r[1]:e.push(r),e}};s.CharacterJoinerService=i=c([f(0,_.IBufferService)],i)},5114:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let c=o(844),f=o(8460),a=o(3656);class n 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 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(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}}s.CoreBrowserService=n;class d extends c.Disposable{constructor(h){super(),this._parentWindow=h,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(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let c=o(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(L,s,o){var c=this&&this.__decorate||function(_,h,i,t){var e,r=arguments.length,l=r<3?h:t===null?t=Object.getOwnPropertyDescriptor(h,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,h,i,t);else for(var v=_.length-1;v>=0;v--)(e=_[v])&&(l=(r<3?e(l):r>3?e(h,i,l):e(h,i))||l);return r>3&&l&&Object.defineProperty(h,i,l),l},f=this&&this.__param||function(_,h){return function(i,t){h(i,t,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let a=o(4725),n=o(9806),d=s.MouseService=class{constructor(_,h){this._renderService=_,this._charSizeService=h}getCoords(_,h,i,t,e){return(0,n.getCoords)(window,_,h,i,t,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(_,h){let i=(0,n.getCoordsRelativeToElement)(window,_,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])}}};s.MouseService=d=c([f(0,a.IRenderService),f(1,a.ICharSizeService)],d)},3230:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let a=o(6193),n=o(4725),d=o(8460),_=o(844),h=o(7226),i=o(2585),t=s.RenderService=class extends _.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,r,l,v,p,g,u,m){super(),this._rowCount=e,this._charSizeService=v,this._renderer=this.register(new _.MutableDisposable),this._pausedResizeTask=new h.DebouncedIdleTask,this._observerDisposable=this.register(new _.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 a.RenderDebouncer(((y,x)=>this._renderRows(y,x)),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(l.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(p.onDecorationRegistered((()=>this._fullRefresh()))),this.register(p.onDecorationRemoved((()=>this._fullRefresh()))),this.register(l.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()}))),this.register(l.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 l=new e.IntersectionObserver((v=>this._handleIntersectionChange(v[v.length-1])),{threshold:0});l.observe(r),this._observerDisposable.value=(0,_.toDisposable)((()=>l.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,l=!1){this._isPaused?this._needsFullRefresh=!0:(l||(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,l){this._selectionState.start=e,this._selectionState.end=r,this._selectionState.columnSelectMode=l,this._renderer.value?.handleSelectionChanged(e,r,l)}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(L,s,o){var c=this&&this.__decorate||function(u,m,y,x){var S,w=arguments.length,A=w<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(u,m,y,x);else for(var z=u.length-1;z>=0;z--)(S=u[z])&&(A=(w<3?S(A):w>3?S(m,y,A):S(m,y))||A);return w>3&&A&&Object.defineProperty(m,y,A),A},f=this&&this.__param||function(u,m){return function(y,x){m(y,x,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let a=o(9806),n=o(9504),d=o(456),_=o(4725),h=o(8460),i=o(844),t=o(6114),e=o(4841),r=o(511),l=o(2585),v="\xA0",p=new RegExp(v,"g"),g=s.SelectionService=class extends i.Disposable{constructor(u,m,y,x,S,w,A,z,U){super(),this._element=u,this._screenElement=m,this._linkifier=y,this._bufferService=x,this._coreService=S,this._mouseService=w,this._optionsService=A,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 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=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,x=[];if(this._activeSelectionMode===3){if(u[0]===m[0])return"";let S=u[0]<m[0]?u[0]:m[0],w=u[0]<m[0]?m[0]:u[0];for(let A=u[1];A<=m[1];A++){let z=y.translateBufferLineToString(A,!0,S,w);x.push(z)}}else{let S=u[1]===m[1]?m[0]:void 0;x.push(y.translateBufferLineToString(u[1],!0,u[0],S));for(let w=u[1]+1;w<=m[1]-1;w++){let A=y.lines.get(w),z=y.translateBufferLineToString(w,!0);A?.isWrapped?x[x.length-1]+=z:x.push(z)}if(u[1]!==m[1]){let w=y.lines.get(m[1]),A=y.translateBufferLineToString(m[1],!0,0,m[0]);w&&w.isWrapped?x[x.length-1]+=A:x.push(A)}}return x.map((S=>S.replace(p," "))).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")}}r.OscLinkProvider=h=c([u(0,a.IBufferService),u(1,a.IOptionsService),u(2,a.IOscLinkService)],h)},6193:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,c,u){this._rowCount=u,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let c=o(3614),u=o(3656),n=o(3551),a=o(9042),h=o(3730),_=o(1680),l=o(3107),i=o(5744),t=o(2950),e=o(1296),s=o(428),d=o(4269),g=o(5114),p=o(8934),v=o(3230),f=o(9312),m=o(4725),E=o(6731),k=o(8055),x=o(8969),C=o(8460),M=o(844),z=o(6114),j=o(8437),U=o(2584),$=o(7399),b=o(5941),L=o(9074),R=o(2585),T=o(5435),H=o(4567),q=o(779);class X extends x.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(I={}){super(I),this.browser=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new M.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(h.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((y,F)=>this.refresh(y,F)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((y=>this._reportWindowsOptions(y)))),this.register(this._inputHandler.onColor((y=>this._handleColorEvent(y)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((y=>this._afterResize(y.cols,y.rows)))),this.register((0,M.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(I){if(this._themeService)for(let y of I){let F,N="";switch(y.index){case 256:F="foreground",N="10";break;case 257:F="background",N="11";break;case 258:F="cursor",N="12";break;default:F="ansi",N="4;"+y.index}switch(y.type){case 0:let K=k.color.toColorRGB(F==="ansi"?this._themeService.colors.ansi[y.index]:this._themeService.colors[F]);this.coreService.triggerDataEvent(`${U.C0.ESC}]${N};${(0,b.toRgbString)(K)}${U.C1_ESCAPED.ST}`);break;case 1:if(F==="ansi")this._themeService.modifyColors((V=>V.ansi[y.index]=k.channels.toColor(...y.color)));else{let V=F;this._themeService.modifyColors((ie=>ie[V]=k.channels.toColor(...y.color)))}break;case 2:this._themeService.restoreColor(y.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(H.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.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(U.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 I=this.buffer.ybase+this.buffer.y,y=this.buffer.lines.get(I);if(!y)return;let F=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,K=y.getWidth(F),V=this._renderService.dimensions.css.cell.width*K,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,he=F*this._renderService.dimensions.css.cell.width;this.textarea.style.left=he+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=V+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(y=>{this.hasSelection()&&(0,c.copyHandler)(y,this._selectionService)})));let I=y=>(0,c.handlePasteEvent)(y,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,u.addDisposableDomListener)(this.element,"paste",I)),z.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(y=>{y.button===2&&(0,c.rightClickHandler)(y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(y=>{(0,c.rightClickHandler)(y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),z.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(y=>{y.button===1&&(0,c.moveTextAreaUnderMouseCursor)(y,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(I=>this._keyUp(I)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(I=>this._keyDown(I)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(I=>this._keyPress(I)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(I=>this._compositionHelper.compositionupdate(I)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(I=>this._inputEvent(I)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(I){if(!I)throw new Error("Terminal requires a parent element.");if(I.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=I.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"),I.appendChild(this.element);let y=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),y.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",(F=>this.updateCursorStyle(F)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),y.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",a.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(g.CoreBrowserService,this.textarea,I.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",(F=>this._handleTextAreaFocus(F)))),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(E.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(v.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((F=>this._onRender.fire(F)))),this.onResize((F=>this._renderService.resize(F.cols,F.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(p.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(y);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(_.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((F=>this.scrollLines(F.amount,F.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(f.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((F=>this.scrollLines(F.amount,F.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((F=>this._renderService.handleSelectionChanged(F.start,F.end,F.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((F=>{this.textarea.value=F,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((F=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(F=>this._selectionService.handleMouseDown(F)))),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",(F=>this._handleScreenReaderModeOptionChange(F)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(F=>{!this._overviewRulerRenderer&&F&&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 I=this,y=this.element;function F(V){let ie=I._mouseService.getMouseReportCoords(V,I.screenElement);if(!ie)return!1;let he,le;switch(V.overrideType||V.type){case"mousemove":le=32,V.buttons===void 0?(he=3,V.button!==void 0&&(he=V.button<3?V.button:3)):he=1&V.buttons?0:4&V.buttons?1:2&V.buttons?2:3;break;case"mouseup":le=0,he=V.button<3?V.button:3;break;case"mousedown":le=1,he=V.button<3?V.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(V)===!1||I.viewport.getLinesScrolled(V)===0)return!1;le=V.deltaY<0?0:1,he=4;break;default:return!1}return!(le===void 0||he===void 0||he>4)&&I.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:he,action:le,ctrl:V.ctrlKey,alt:V.altKey,shift:V.shiftKey})}let N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},K={mouseup:V=>(F(V),V.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(V)),wheel:V=>(F(V),this.cancel(V,!0)),mousedrag:V=>{V.buttons&&F(V)},mousemove:V=>{V.buttons||F(V)}};this.register(this.coreMouseService.onProtocolChange((V=>{V?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(V)),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&V?N.mousemove||(y.addEventListener("mousemove",K.mousemove),N.mousemove=K.mousemove):(y.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&V?N.wheel||(y.addEventListener("wheel",K.wheel,{passive:!1}),N.wheel=K.wheel):(y.removeEventListener("wheel",N.wheel),N.wheel=null),2&V?N.mouseup||(N.mouseup=K.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&V?N.mousedrag||(N.mousedrag=K.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(y,"mousedown",(V=>{if(V.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(V))return F(V),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(V)}))),this.register((0,u.addDisposableDomListener)(y,"wheel",(V=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(V)===!1)return!1;if(!this.buffer.hasScrollback){let ie=this.viewport.getLinesScrolled(V);if(ie===0)return;let he=U.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(V.deltaY<0?"A":"B"),le="";for(let ne=0;ne<Math.abs(ie);ne++)le+=he;return this.coreService.triggerDataEvent(le,!0),this.cancel(V,!0)}return this.viewport.handleWheel(V)?this.cancel(V):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(y,"touchstart",(V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(V),this.cancel(V)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(y,"touchmove",(V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(V)?void 0:this.cancel(V)}),{passive:!1}))}refresh(I,y){this._renderService?.refreshRows(I,y)}updateCursorStyle(I){this._selectionService?.shouldColumnSelect(I)?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(I,y,F=0){F===1?(super.scrollLines(I,y,F),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(I)}paste(I){(0,c.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let y=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),y}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,y,F){this._selectionService.setSelection(I,y,F)}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(I,y){this._selectionService?.selectLines(I,y)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;let y=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!y&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;y||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let F=(0,$.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),F.type===3||F.type===2){let N=this.rows-1;return this.scrollLines(F.type===2?-N:N),this.cancel(I,!0)}return F.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(F.cancel&&this.cancel(I,!0),!F.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(F.key!==U.C0.ETX&&F.key!==U.C0.CR||(this.textarea.value=""),this._onKey.fire({key:F.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(F.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,y){let F=I.isMac&&!this.options.macOptionIsMeta&&y.altKey&&!y.ctrlKey&&!y.metaKey||I.isWindows&&y.altKey&&y.ctrlKey&&!y.metaKey||I.isWindows&&y.getModifierState("AltGraph");return y.type==="keypress"?F:F&&(!y.keyCode||y.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||((function(y){return y.keyCode===16||y.keyCode===17||y.keyCode===18})(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let y;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)y=I.charCode;else if(I.which===null||I.which===void 0)y=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;y=I.which}return!(!y||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(y=String.fromCharCode(y),this._onKey.fire({key:y,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(y,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let y=I.data;return this.coreService.triggerDataEvent(y,!0),this.cancel(I),!0}return!1}resize(I,y){I!==this.cols||y!==this.rows?super.resize(I,y):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,y){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 I=1;I<this.rows;I++)this.buffer.lines.push(this.buffer.getBlankLine(j.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 I=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(U.C0.ESC+"[I"):this.coreService.triggerDataEvent(U.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let y=this._renderService.dimensions.css.canvas.width.toFixed(0),F=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[4;${F};${y}t`);break;case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let N=this._renderService.dimensions.css.cell.width.toFixed(0),K=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[6;${K};${N}t`)}}cancel(I,y){if(this.options.cancelEvents||y)return I.preventDefault(),I.stopPropagation(),!1}}r.Terminal=X},9924:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,u){this._rowCount=u,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=n-this._lastRefreshMs,h=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),h)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(D,r,o){var c=this&&this.__decorate||function(t,e,s,d){var g,p=arguments.length,v=p<3?e:d===null?d=Object.getOwnPropertyDescriptor(e,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(t,e,s,d);else for(var f=t.length-1;f>=0;f--)(g=t[f])&&(v=(p<3?g(v):p>3?g(e,s,v):g(e,s))||v);return p>3&&v&&Object.defineProperty(e,s,v),v},u=this&&this.__param||function(t,e){return function(s,d){e(s,d,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let n=o(3656),a=o(4725),h=o(8460),_=o(844),l=o(2585),i=r.Viewport=class extends _.Disposable{constructor(t,e,s,d,g,p,v,f){super(),this._viewportElement=t,this._scrollArea=e,this._bufferService=s,this._optionsService=d,this._charSizeService=g,this._renderService=p,this._coreBrowserService=v,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 h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.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(f.colors),this.register(f.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,d="",g=[],p=e??this._bufferService.buffer.lines.length,v=this._bufferService.buffer.lines;for(let f=t;f<p;f++){let m=v.get(f);if(!m)continue;let E=v.get(f+1)?.isWrapped;if(d+=m.translateToString(!E),!E||f===v.length-1){let k=document.createElement("div");k.textContent=d,g.push(k),d.length>0&&(s=k),d=""}}return{bufferElements:g,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,l.IBufferService),u(3,l.IOptionsService),u(4,a.ICharSizeService),u(5,a.IRenderService),u(6,a.ICoreBrowserService),u(7,a.IThemeService)],i)},3107:function(D,r,o){var c=this&&this.__decorate||function(l,i,t,e){var s,d=arguments.length,g=d<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(l,i,t,e);else for(var p=l.length-1;p>=0;p--)(s=l[p])&&(g=(d<3?s(g):d>3?s(i,t,g):s(i,t))||g);return d>3&&g&&Object.defineProperty(i,t,g),g},u=this&&this.__param||function(l,i){return function(t,e){i(t,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let n=o(4725),a=o(844),h=o(2585),_=r.BufferDecorationRenderer=class extends a.Disposable{constructor(l,i,t,e,s){super(),this._screenElement=l,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((d=>this._removeDecoration(d)))),this.register((0,a.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()}};r.BufferDecorationRenderer=_=c([u(1,h.IBufferService),u(2,n.ICoreBrowserService),u(3,h.IDecorationService),u(4,n.IRenderService)],_)},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(o){if(o.options.overviewRulerOptions){for(let c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,u){return c>=o.startBufferLine-this._linePadding[u||"full"]&&c<=o.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(D,r,o){var c=this&&this.__decorate||function(s,d,g,p){var v,f=arguments.length,m=f<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,d,g,p);else for(var E=s.length-1;E>=0;E--)(v=s[E])&&(m=(f<3?v(m):f>3?v(d,g,m):v(d,g))||m);return f>3&&m&&Object.defineProperty(d,g,m),m},u=this&&this.__param||function(s,d){return function(g,p){d(g,p,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let n=o(5871),a=o(4725),h=o(844),_=o(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=r.OverviewRulerRenderer=class extends h.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,g,p,v,f,m){super(),this._viewportElement=s,this._screenElement=d,this._bufferService=g,this._decorationService=p,this._renderService=v,this._optionsService=f,this._coreBrowserService=m,this._colorZoneStore=new n.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 E=this._canvas.getContext("2d");if(!E)throw new Error("Ctx cannot be null");this._ctx=E,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,h.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),d=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=s,i.center=d,i.right=s,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 s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);l.left=d,l.center=d,l.right=d}_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 d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;let s=this._colorZoneStore.zones;for(let d of s)d.position!=="full"&&this._renderColorZone(d);for(let d of s)d.position==="full"&&this._renderColorZone(d);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)-l[s.position||"full"]/2),i[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=e=c([u(2,_.IBufferService),u(3,_.IDecorationService),u(4,a.IRenderService),u(5,_.IOptionsService),u(6,a.ICoreBrowserService)],e)},2950:function(D,r,o){var c=this&&this.__decorate||function(l,i,t,e){var s,d=arguments.length,g=d<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,t):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(l,i,t,e);else for(var p=l.length-1;p>=0;p--)(s=l[p])&&(g=(d<3?s(g):d>3?s(i,t,g):s(i,t))||g);return d>3&&g&&Object.defineProperty(i,t,g),g},u=this&&this.__param||function(l,i){return function(t,e){i(t,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let n=o(4725),a=o(2585),h=o(2584),_=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(l,i,t,e,s,d){this._textarea=l,this._compositionView=i,this._bufferService=t,this._optionsService=e,this._coreService=s,this._renderService=d,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(`${h.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,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 d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}l||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=_=c([u(2,a.IBufferService),u(3,a.IOptionsService),u(4,a.ICoreService),u(5,n.IRenderService)],_)},9806:(D,r)=>{function o(c,u,n){let a=n.getBoundingClientRect(),h=c.getComputedStyle(n),_=parseInt(h.getPropertyValue("padding-left")),l=parseInt(h.getPropertyValue("padding-top"));return[u.clientX-a.left-_,u.clientY-a.top-l]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(c,u,n,a,h,_,l,i,t){if(!_)return;let e=o(c,u,n);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),a+(t?1:0)),e[1]=Math.min(Math.max(e[1],1),h),e):void 0}},9504:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let c=o(2584);function u(i,t,e,s){let d=i-n(i,e),g=t-n(t,e),p=Math.abs(d-g)-(function(v,f,m){let E=0,k=v-n(v,m),x=f-n(f,m);for(let C=0;C<Math.abs(k-x);C++){let M=a(v,f)==="A"?-1:1;m.buffer.lines.get(k+M*C)?.isWrapped&&E++}return E})(i,t,e);return l(p,_(a(i,t),s))}function n(i,t){let e=0,s=t.buffer.lines.get(i),d=s?.isWrapped;for(;d&&i>=0&&i<t.rows;)e++,s=t.buffer.lines.get(--i),d=s?.isWrapped;return e}function a(i,t){return i>t?"A":"B"}function h(i,t,e,s,d,g){let p=i,v=t,f="";for(;p!==e||v!==s;)p+=d?1:-1,d&&p>g.cols-1?(f+=g.buffer.translateBufferLineToString(v,!1,i,p),p=0,i=0,v++):!d&&p<0&&(f+=g.buffer.translateBufferLineToString(v,!1,0,i+1),p=g.cols-1,i=p,v--);return f+g.buffer.translateBufferLineToString(v,!1,i,p)}function _(i,t){let e=t?"O":"[";return c.C0.ESC+e+i}function l(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 d=e.buffer.x,g=e.buffer.y;if(!e.buffer.hasScrollback)return(function(f,m,E,k,x,C){return u(m,k,x,C).length===0?"":l(h(f,m,f,m-n(m,x),!1,x).length,_("D",C))})(d,g,0,t,e,s)+u(g,t,e,s)+(function(f,m,E,k,x,C){let M;M=u(m,k,x,C).length>0?k-n(k,x):m;let z=k,j=(function(U,$,b,L,R,T){let H;return H=u(b,L,R,T).length>0?L-n(L,R):$,U<b&&H<=L||U>=b&&H<L?"C":"D"})(f,m,E,k,x,C);return l(h(f,M,E,z,j==="C",x).length,_(j,C))})(d,g,i,t,e,s);let p;if(g===t)return p=d>i?"D":"C",l(Math.abs(d-i),_(p,s));p=g>t?"D":"C";let v=Math.abs(g-t);return l((function(f,m){return m.cols-f})(g>t?i:d,e)+(v-1)*e.cols+1+((g>t?d:i)-1),_(p,s))}},1296:function(D,r,o){var c=this&&this.__decorate||function(C,M,z,j){var U,$=arguments.length,b=$<3?M:j===null?j=Object.getOwnPropertyDescriptor(M,z):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(C,M,z,j);else for(var L=C.length-1;L>=0;L--)(U=C[L])&&(b=($<3?U(b):$>3?U(M,z,b):U(M,z))||b);return $>3&&b&&Object.defineProperty(M,z,b),b},u=this&&this.__param||function(C,M){return function(z,j){M(z,j,C)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let n=o(3787),a=o(2550),h=o(2223),_=o(6171),l=o(6052),i=o(4725),t=o(8055),e=o(8460),s=o(844),d=o(2585),g="xterm-dom-renderer-owner-",p="xterm-rows",v="xterm-fg-",f="xterm-bg-",m="xterm-focus",E="xterm-selection",k=1,x=r.DomRenderer=class extends s.Disposable{constructor(C,M,z,j,U,$,b,L,R,T,H,q,X){super(),this._terminal=C,this._document=M,this._element=z,this._screenElement=j,this._viewportElement=U,this._helperContainer=$,this._linkifier2=b,this._charSizeService=R,this._optionsService=T,this._bufferService=H,this._coreBrowserService=q,this._themeService=X,this._terminalClass=k++,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(p),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(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,_.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Y=>this._injectCss(Y)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Y=>this._handleLinkHover(Y)))),this.register(this._linkifier2.onHideLinkUnderline((Y=>this._handleLinkLeave(Y)))),this.register((0,s.toDisposable)((()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new a.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 C=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*C,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*C),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/C),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/C),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 M=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=M,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(C){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let M=`${this._terminalSelector} .${p} { color: ${C.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;M+=`${this._terminalSelector} .${p} .xterm-dim { color: ${t.color.multiplyOpacity(C.foreground,.5).css};}`,M+=`${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}`,j=`blink_bar_${this._terminalClass}`,U=`blink_block_${this._terminalClass}`;M+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,M+=`@keyframes ${j} { 50% { box-shadow: none; }}`,M+=`@keyframes ${U} { 0% { background-color: ${C.cursor.css}; color: ${C.cursorAccent.css}; } 50% { background-color: inherit; color: ${C.cursor.css}; }}`,M+=`${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${j} 1s step-end infinite;}${this._terminalSelector} .${p}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${C.cursor.css}; color: ${C.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${C.cursor.css} !important; color: ${C.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${C.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${C.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${C.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,M+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${C.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${C.selectionInactiveBackgroundOpaque.css};}`;for(let[$,b]of C.ansi.entries())M+=`${this._terminalSelector} .${v}${$} { color: ${b.css}; }${this._terminalSelector} .${v}${$}.xterm-dim { color: ${t.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${f}${$} { background-color: ${b.css}; }`;M+=`${this._terminalSelector} .${v}${h.INVERTED_DEFAULT_COLOR} { color: ${t.color.opaque(C.background).css}; }${this._terminalSelector} .${v}${h.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${t.color.multiplyOpacity(t.color.opaque(C.background),.5).css}; }${this._terminalSelector} .${f}${h.INVERTED_DEFAULT_COLOR} { background-color: ${C.foreground.css}; }`,this._themeStyleElement.textContent=M}_setDefaultSpacing(){let C=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${C}px`,this._rowFactory.defaultSpacing=C}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(C,M){for(let z=this._rowElements.length;z<=M;z++){let j=this._document.createElement("div");this._rowContainer.appendChild(j),this._rowElements.push(j)}for(;this._rowElements.length>M;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(C,M){this._refreshRowElements(C,M),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(C,M,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(C,M,z),this.renderRows(0,this._bufferService.rows-1),!C||!M)return;this._selectionRenderModel.update(this._terminal,C,M,z);let j=this._selectionRenderModel.viewportStartRow,U=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||b<0)return;let L=this._document.createDocumentFragment();if(z){let R=C[0]>M[0];L.appendChild(this._createSelectionElement($,R?M[0]:C[0],R?C[0]:M[0],b-$+1))}else{let R=j===$?C[0]:0,T=$===U?M[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement($,R,T));let H=b-$-1;if(L.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,H)),$!==b){let q=U===b?M[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(b,0,q))}}this._selectionContainer.appendChild(L)}_createSelectionElement(C,M,z,j=1){let U=this._document.createElement("div"),$=M*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(z-M);return $+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-$),U.style.height=j*this.dimensions.css.cell.height+"px",U.style.top=C*this.dimensions.css.cell.height+"px",U.style.left=`${$}px`,U.style.width=`${b}px`,U}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 C of this._rowElements)C.replaceChildren()}renderRows(C,M){let z=this._bufferService.buffer,j=z.ybase+z.y,U=Math.min(z.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=C;R<=M;R++){let T=R+z.ydisp,H=this._rowElements[R],q=z.lines.get(T);if(!H||!q)break;H.replaceChildren(...this._rowFactory.createRow(q,T,T===j,b,L,U,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(C){this._setCellUnderline(C.x1,C.x2,C.y1,C.y2,C.cols,!0)}_handleLinkLeave(C){this._setCellUnderline(C.x1,C.x2,C.y1,C.y2,C.cols,!1)}_setCellUnderline(C,M,z,j,U,$){z<0&&(C=0),j<0&&(M=0);let b=this._bufferService.rows-1;z=Math.max(Math.min(z,b),0),j=Math.max(Math.min(j,b),0),U=Math.min(U,this._bufferService.cols);let L=this._bufferService.buffer,R=L.ybase+L.y,T=Math.min(L.x,U-1),H=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=z;Y<=j;++Y){let I=Y+L.ydisp,y=this._rowElements[Y],F=L.lines.get(I);if(!y||!F)break;y.replaceChildren(...this._rowFactory.createRow(F,I,I===R,q,X,T,H,this.dimensions.css.cell.width,this._widthCache,$?Y===z?C:0:-1,$?(Y===j?M:U)-1:-1))}}};r.DomRenderer=x=c([u(7,d.IInstantiationService),u(8,i.ICharSizeService),u(9,d.IOptionsService),u(10,d.IBufferService),u(11,i.ICoreBrowserService),u(12,i.IThemeService)],x)},3787:function(D,r,o){var c=this&&this.__decorate||function(p,v,f,m){var E,k=arguments.length,x=k<3?v:m===null?m=Object.getOwnPropertyDescriptor(v,f):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,v,f,m);else for(var C=p.length-1;C>=0;C--)(E=p[C])&&(x=(k<3?E(x):k>3?E(v,f,x):E(v,f))||x);return k>3&&x&&Object.defineProperty(v,f,x),x},u=this&&this.__param||function(p,v){return function(f,m){v(f,m,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let n=o(2223),a=o(643),h=o(511),_=o(2585),l=o(8055),i=o(4725),t=o(4269),e=o(6171),s=o(3734),d=r.DomRendererRowFactory=class{constructor(p,v,f,m,E,k,x){this._document=p,this._characterJoinerService=v,this._optionsService=f,this._coreBrowserService=m,this._coreService=E,this._decorationService=k,this._themeService=x,this._workCell=new h.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(p,v,f){this._selectionStart=p,this._selectionEnd=v,this._columnSelectMode=f}createRow(p,v,f,m,E,k,x,C,M,z,j){let U=[],$=this._characterJoinerService.getJoinedCharacters(v),b=this._themeService.colors,L,R=p.getNoBgTrimmedLength();f&&R<k+1&&(R=k+1);let T=0,H="",q=0,X=0,Y=0,I=!1,y=0,F=!1,N=0,K=[],V=z!==-1&&j!==-1;for(let ie=0;ie<R;ie++){p.loadCell(ie,this._workCell);let he=this._workCell.getWidth();if(he===0)continue;let le=!1,ne=ie,G=this._workCell;if($.length>0&&ie===$[0][0]){le=!0;let oe=$.shift();G=new t.JoinedCellData(this._workCell,p.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),ne=oe[1]-1,he=G.getWidth()}let Fe=this._isCellInSelection(ie,v),We=f&&ie===k,qe=V&&ie>=z&&ie<=j,Ke=!1;this._decorationService.forEachDecorationAtCell(ie,v,void 0,(oe=>{Ke=!0}));let $e=G.getChars()||a.WHITESPACE_CELL_CHAR;if($e===" "&&(G.isUnderline()||G.isOverline())&&($e="\xA0"),N=he*C-M.get($e,G.isBold(),G.isItalic()),L){if(T&&(Fe&&F||!Fe&&!F&&G.bg===q)&&(Fe&&F&&b.selectionForeground||G.fg===X)&&G.extended.ext===Y&&qe===I&&N===y&&!We&&!le&&!Ke){G.isInvisible()?H+=a.WHITESPACE_CELL_CHAR:H+=$e,T++;continue}T&&(L.textContent=H),L=this._document.createElement("span"),T=0,H=""}else L=this._document.createElement("span");if(q=G.bg,X=G.fg,Y=G.extended.ext,I=qe,y=N,F=Fe,le&&k>=ie&&k<=ne&&(k=ie),!this._coreService.isCursorHidden&&We&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)x&&K.push("xterm-cursor-blink"),K.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(E)switch(E){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline")}}if(G.isBold()&&K.push("xterm-bold"),G.isItalic()&&K.push("xterm-italic"),G.isDim()&&K.push("xterm-dim"),H=G.isInvisible()?a.WHITESPACE_CELL_CHAR:G.getChars()||a.WHITESPACE_CELL_CHAR,G.isUnderline()&&(K.push(`xterm-underline-${G.extended.underlineStyle}`),H===" "&&(H="\xA0"),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let oe=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&oe<8&&(oe+=8),L.style.textDecorationColor=b.ansi[oe].css}G.isOverline()&&(K.push("xterm-overline"),H===" "&&(H="\xA0")),G.isStrikethrough()&&K.push("xterm-strikethrough"),qe&&(L.style.textDecoration="underline");let we=G.getFgColor(),Ae=G.getFgColorMode(),Re=G.getBgColor(),Ne=G.getBgColorMode(),tt=!!G.isInverse();if(tt){let oe=we;we=Re,Re=oe;let xe=Ae;Ae=Ne,Ne=xe}let pe,ke,Me,Te=!1;switch(this._decorationService.forEachDecorationAtCell(ie,v,void 0,(oe=>{oe.options.layer!=="top"&&Te||(oe.backgroundColorRGB&&(Ne=50331648,Re=oe.backgroundColorRGB.rgba>>8&16777215,pe=oe.backgroundColorRGB),oe.foregroundColorRGB&&(Ae=50331648,we=oe.foregroundColorRGB.rgba>>8&16777215,ke=oe.foregroundColorRGB),Te=oe.options.layer==="top")})),!Te&&Fe&&(pe=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,Re=pe.rgba>>8&16777215,Ne=50331648,Te=!0,b.selectionForeground&&(Ae=50331648,we=b.selectionForeground.rgba>>8&16777215,ke=b.selectionForeground)),Te&&K.push("xterm-decoration-top"),Ne){case 16777216:case 33554432:Me=b.ansi[Re],K.push(`xterm-bg-${Re}`);break;case 50331648:Me=l.channels.toColor(Re>>16,Re>>8&255,255&Re),this._addStyle(L,`background-color:#${g((Re>>>0).toString(16),"0",6)}`);break;default:tt?(Me=b.foreground,K.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):Me=b.background}switch(pe||G.isDim()&&(pe=l.color.multiplyOpacity(Me,.5)),Ae){case 16777216:case 33554432:G.isBold()&&we<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(we+=8),this._applyMinimumContrast(L,Me,b.ansi[we],G,pe,void 0)||K.push(`xterm-fg-${we}`);break;case 50331648:let oe=l.channels.toColor(we>>16&255,we>>8&255,255&we);this._applyMinimumContrast(L,Me,oe,G,pe,ke)||this._addStyle(L,`color:#${g(we.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Me,b.foreground,G,pe,ke)||tt&&K.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}K.length&&(L.className=K.join(" "),K.length=0),We||le||Ke?L.textContent=H:T++,N!==this.defaultSpacing&&(L.style.letterSpacing=`${N}px`),U.push(L),ie=ne}return L&&T&&(L.textContent=H),U}_applyMinimumContrast(p,v,f,m,E,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;let x=this._getContrastCache(m),C;if(E||k||(C=x.getColor(v.rgba,f.rgba)),C===void 0){let M=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);C=l.color.ensureContrastRatio(E||v,k||f,M),x.setColor((E||v).rgba,(k||f).rgba,C??null)}return!!C&&(this._addStyle(p,`color:${C.css}`),!0)}_getContrastCache(p){return p.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(p,v){p.setAttribute("style",`${p.getAttribute("style")||""}${v};`)}_isCellInSelection(p,v){let f=this._selectionStart,m=this._selectionEnd;return!(!f||!m)&&(this._columnSelectMode?f[0]<=m[0]?p>=f[0]&&v>=f[1]&&p<m[0]&&v<=m[1]:p<f[0]&&v>=f[1]&&p>=m[0]&&v<=m[1]:v>f[1]&&v<m[1]||f[1]===m[1]&&v===f[1]&&p>=f[0]&&p<m[0]||f[1]<m[1]&&v===m[1]&&p<m[0]||f[1]<m[1]&&v===f[1]&&p>=f[0])}};function g(p,v,f){for(;p.length<f;)p=v+p;return p}r.DomRendererRowFactory=d=c([u(1,i.ICharacterJoinerService),u(2,_.IOptionsService),u(3,i.ICoreBrowserService),u(4,_.ICoreService),u(5,_.IDecorationService),u(6,i.IThemeService)],d)},2550:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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=o.createElement("span");u.classList.add("xterm-char-measure-element");let n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let a=o.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let h=o.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[u,n,a,h],this._container.appendChild(u),this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(h),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(o,c,u,n){o===this._font&&c===this._fontSize&&u===this._weight&&n===this._weightBold||(this._font=o,this._fontSize=c,this._weight=u,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(o,c,u){let n=0;if(!c&&!u&&o.length===1&&(n=o.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let _=this._measure(o,0);return _>0&&(this._flat[n]=_),_}let a=o;c&&(a+="B"),u&&(a+="I");let h=this._holey.get(a);if(h===void 0){let _=0;c&&(_|=1),u&&(_|=2),h=this._measure(o,_),h>0&&this._holey.set(a,h)}return h}_measure(o,c){let u=this._measureElements[c];return u.textContent=o.repeat(32),u.offsetWidth/32}}},2223:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let c=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(D,r)=>{function o(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=o,r.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},r.isEmoji=c,r.allowRescaling=function(u,n,a,h){return n===1&&a>Math.ceil(1.5*h)&&u!==void 0&&u>255&&!c(u)&&!o(u)&&!(function(_){return 57344<=_&&_<=63743})(u)},r.treatGlyphAsBackgroundColor=function(u){return o(u)||(function(n){return 9472<=n&&n<=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,n,a=0){return(u-(2*Math.round(n)-a))%(2*Math.round(n))}},6052:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class o{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,n,a,h=!1){if(this.selectionStart=n,this.selectionEnd=a,!n||!a||n[0]===a[0]&&n[1]===a[1])return void this.clear();let _=u.buffers.active.ydisp,l=n[1]-_,i=a[1]-_,t=Math.max(l,0),e=Math.min(i,u.rows-1);t>=u.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=h,this.viewportStartRow=l,this.viewportEndRow=i,this.viewportCappedStartRow=t,this.viewportCappedEndRow=e,this.startCol=n[0],this.endCol=a[0])}isCellSelected(u,n,a){return!!this.hasSelection&&(a-=u.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&a>=this.viewportCappedStartRow&&n<this.endCol&&a<=this.viewportCappedEndRow:n<this.startCol&&a>=this.viewportCappedStartRow&&n>=this.endCol&&a<=this.viewportCappedEndRow:a>this.viewportStartRow&&a<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&a===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&a===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&a===this.viewportStartRow&&n>=this.startCol)}}r.createSelectionRenderModel=function(){return new o}},456:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,r,o){var c=this&&this.__decorate||function(e,s,d,g){var p,v=arguments.length,f=v<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,s,d,g);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(f=(v<3?p(f):v>3?p(s,d,f):p(s,d))||f);return v>3&&f&&Object.defineProperty(s,d,f),f},u=this&&this.__param||function(e,s){return function(d,g){s(d,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let n=o(2585),a=o(8460),h=o(844),_=r.CharSizeService=class extends h.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new a.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=_=c([u(2,n.IOptionsService)],_);class l extends h.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class i extends l{constructor(s,d,g){super(),this._document=s,this._parentElement=d,this._optionsService=g,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(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))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,o){var c=this&&this.__decorate||function(t,e,s,d){var g,p=arguments.length,v=p<3?e:d===null?d=Object.getOwnPropertyDescriptor(e,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(t,e,s,d);else for(var f=t.length-1;f>=0;f--)(g=t[f])&&(v=(p<3?g(v):p>3?g(e,s,v):g(e,s))||v);return p>3&&v&&Object.defineProperty(e,s,v),v},u=this&&this.__param||function(t,e){return function(s,d){e(s,d,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let n=o(3734),a=o(643),h=o(511),_=o(2585);class l extends n.AttributeData{constructor(e,s,d){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=s,this._width=d}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=l;let i=r.CharacterJoinerService=class ii{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new h.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 d=[],g=s.translateToString(!0),p=0,v=0,f=0,m=s.getFg(0),E=s.getBg(0);for(let k=0;k<s.getTrimmedLength();k++)if(s.loadCell(k,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==E){if(k-p>1){let x=this._getJoinedRanges(g,f,v,s,p);for(let C=0;C<x.length;C++)d.push(x[C])}p=k,f=v,m=this._workCell.fg,E=this._workCell.bg}v+=this._workCell.getChars().length||a.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-p>1){let k=this._getJoinedRanges(g,f,v,s,p);for(let x=0;x<k.length;x++)d.push(k[x])}return d}_getJoinedRanges(e,s,d,g,p){let v=e.substring(s,d),f=[];try{f=this._characterJoiners[0].handler(v)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{let E=this._characterJoiners[m].handler(v);for(let k=0;k<E.length;k++)ii._mergeRanges(f,E[k])}catch(E){console.error(E)}return this._stringRangesToCellRanges(f,g,p),f}_stringRangesToCellRanges(e,s,d){let g=0,p=!1,v=0,f=e[g];if(f){for(let m=d;m<this._bufferService.cols;m++){let E=s.getWidth(m),k=s.getString(m).length||a.WHITESPACE_CELL_CHAR.length;if(E!==0){if(!p&&f[0]<=v&&(f[0]=m,p=!0),f[1]<=v){if(f[1]=m,f=e[++g],!f)break;f[0]<=v?(f[0]=m,p=!0):p=!1}v+=k}}f&&(f[1]=this._bufferService.cols)}}static _mergeRanges(e,s){let d=!1;for(let g=0;g<e.length;g++){let p=e[g];if(d){if(s[1]<=p[0])return e[g-1][1]=s[1],e;if(s[1]<=p[1])return e[g-1][1]=Math.max(s[1],p[1]),e.splice(g,1),e;e.splice(g,1),g--}else{if(s[1]<=p[0])return e.splice(g,0,s),e;if(s[1]<=p[1])return p[0]=Math.min(s[0],p[0]),e;s[0]<p[1]&&(p[0]=Math.min(s[0],p[0]),d=!0)}}return d?e[e.length-1][1]=s[1]:e.push(s),e}};r.CharacterJoinerService=i=c([u(0,_.IBufferService)],i)},5114:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let c=o(844),u=o(8460),n=o(3656);class a 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 h(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(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}}r.CoreBrowserService=a;class h extends c.Disposable{constructor(l){super(),this._parentWindow=l,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(l){this._parentWindow=l,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.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,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let c=o(844);class u extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(a){return this.linkProviders.push(a),{dispose:()=>{let h=this.linkProviders.indexOf(a);h!==-1&&this.linkProviders.splice(h,1)}}}}r.LinkProviderService=u},8934:function(D,r,o){var c=this&&this.__decorate||function(_,l,i,t){var e,s=arguments.length,d=s<3?l:t===null?t=Object.getOwnPropertyDescriptor(l,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(_,l,i,t);else for(var g=_.length-1;g>=0;g--)(e=_[g])&&(d=(s<3?e(d):s>3?e(l,i,d):e(l,i))||d);return s>3&&d&&Object.defineProperty(l,i,d),d},u=this&&this.__param||function(_,l){return function(i,t){l(i,t,_)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let n=o(4725),a=o(9806),h=r.MouseService=class{constructor(_,l){this._renderService=_,this._charSizeService=l}getCoords(_,l,i,t,e){return(0,a.getCoords)(window,_,l,i,t,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(_,l){let i=(0,a.getCoordsRelativeToElement)(window,_,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])}}};r.MouseService=h=c([u(0,n.IRenderService),u(1,n.ICharSizeService)],h)},3230:function(D,r,o){var c=this&&this.__decorate||function(e,s,d,g){var p,v=arguments.length,f=v<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,s,d,g);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(f=(v<3?p(f):v>3?p(s,d,f):p(s,d))||f);return v>3&&f&&Object.defineProperty(s,d,f),f},u=this&&this.__param||function(e,s){return function(d,g){s(d,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let n=o(6193),a=o(4725),h=o(8460),_=o(844),l=o(7226),i=o(2585),t=r.RenderService=class extends _.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,s,d,g,p,v,f,m){super(),this._rowCount=e,this._charSizeService=g,this._renderer=this.register(new _.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new _.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 h.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new h.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new h.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new h.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((E,k)=>this._renderRows(E,k)),f),this.register(this._renderDebouncer),this.register(f.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(v.onResize((()=>this._fullRefresh()))),this.register(v.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(d.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(p.onDecorationRegistered((()=>this._fullRefresh()))),this.register(p.onDecorationRemoved((()=>this._fullRefresh()))),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(v.cols,v.rows),this._fullRefresh()}))),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(v.buffer.y,v.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(f.window,s),this.register(f.onWindowChange((E=>this._registerIntersectionObserver(E,s))))}_registerIntersectionObserver(e,s){if("IntersectionObserver"in e){let d=new e.IntersectionObserver((g=>this._handleIntersectionChange(g[g.length-1])),{threshold:0});d.observe(s),this._observerDisposable.value=(0,_.toDisposable)((()=>d.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,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(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,d){this._selectionState.start=e,this._selectionState.end=s,this._selectionState.columnSelectMode=d,this._renderer.value?.handleSelectionChanged(e,s,d)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=t=c([u(2,i.IOptionsService),u(3,a.ICharSizeService),u(4,i.IDecorationService),u(5,i.IBufferService),u(6,a.ICoreBrowserService),u(7,a.IThemeService)],t)},9312:function(D,r,o){var c=this&&this.__decorate||function(f,m,E,k){var x,C=arguments.length,M=C<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(f,m,E,k);else for(var z=f.length-1;z>=0;z--)(x=f[z])&&(M=(C<3?x(M):C>3?x(m,E,M):x(m,E))||M);return C>3&&M&&Object.defineProperty(m,E,M),M},u=this&&this.__param||function(f,m){return function(E,k){m(E,k,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let n=o(9806),a=o(9504),h=o(456),_=o(4725),l=o(8460),i=o(844),t=o(6114),e=o(4841),s=o(511),d=o(2585),g="\xA0",p=new RegExp(g,"g"),v=r.SelectionService=class extends i.Disposable{constructor(f,m,E,k,x,C,M,z,j){super(),this._element=f,this._screenElement=m,this._linkifier=E,this._bufferService=k,this._coreService=x,this._mouseService=C,this._optionsService=M,this._renderService=z,this._coreBrowserService=j,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 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=U=>this._handleMouseMove(U),this._mouseUpListener=U=>this._handleMouseUp(U),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((U=>this._handleTrim(U))),this.register(this._bufferService.buffers.onBufferActivate((U=>this._handleBufferActivate(U)))),this.enable(),this._model=new h.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 f=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!f||!m||f[0]===m[0]&&f[1]===m[1])}get selectionText(){let f=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!f||!m)return"";let E=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(f[0]===m[0])return"";let x=f[0]<m[0]?f[0]:m[0],C=f[0]<m[0]?m[0]:f[0];for(let M=f[1];M<=m[1];M++){let z=E.translateBufferLineToString(M,!0,x,C);k.push(z)}}else{let x=f[1]===m[1]?m[0]:void 0;k.push(E.translateBufferLineToString(f[1],!0,f[0],x));for(let C=f[1]+1;C<=m[1]-1;C++){let M=E.lines.get(C),z=E.translateBufferLineToString(C,!0);M?.isWrapped?k[k.length-1]+=z:k.push(z)}if(f[1]!==m[1]){let C=E.lines.get(m[1]),M=E.translateBufferLineToString(m[1],!0,0,m[0]);C&&C.isWrapped?k[k.length-1]+=M:k.push(M)}}return k.map((x=>x.replace(p," "))).join(t.isWindows?`\r
7
7
  `:`
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,x=this._model.finalSelectionEnd;return!!(y&&x&&m)&&this._areCoordsInSelection(m,y,x)}isCellInSelection(u,m){let y=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!y||!x)&&this._areCoordsInSelection([u,m],y,x)}_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 x=this._getMouseBufferCoords(u);return!!x&&(this._selectWordAt(x,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,a.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 x=y.lines.get(this._model.selectionEnd[1]);x&&x.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 x=(0,n.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!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 x=0;m>=x;x++){let S=u.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:S>1&&m!==x&&(y+=S-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,x=!0){if(u[0]>=this._bufferService.cols)return;let S=this._bufferService.buffer,w=S.lines.get(u[1]);if(!w)return;let A=S.translateBufferLineToString(u[1],!1),z=this._convertViewportColToCharacterIndex(w,u[0]),U=z,q=u[0]-z,$=0,b=0,E=0,k=0;if(A.charAt(z)===" "){for(;z>0&&A.charAt(z-1)===" ";)z--;for(;U<A.length&&A.charAt(U+1)===" ";)U++}else{let K=u[0],Y=u[0];w.getWidth(K)===0&&($++,K--),w.getWidth(Y)===2&&(b++,Y++);let Z=w.getString(Y).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 M=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,K--):M>1&&(E+=M-1,z-=M-1),z--,K--}for(;Y<w.length&&U+1<A.length&&!this._isCharWordSeparator(w.loadCell(Y+1,this._workCell));){w.loadCell(Y+1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):M>1&&(k+=M-1,U+=M-1),U++,Y++}}U++;let D=z+q-$+E,P=Math.min(this._bufferService.cols,U-z+$+b-E-k);if(m||A.slice(z,U).trim()!==""){if(y&&D===0&&w.getCodePoint(0)!==32){let K=S.lines.get(u[1]-1);if(K&&w.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){let Z=this._bufferService.cols-Y.start;D-=Z,P+=Z}}}if(x&&D+P===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){let K=S.lines.get(u[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(P+=Y.length)}}return{start:D,length:P}}}_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,l.IBufferService),f(4,l.ICoreService),f(5,_.IMouseService),f(6,l.IOptionsService),f(7,_.IRenderService),f(8,_.ICoreBrowserService)],g)},4725:(L,s,o)=>{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=o(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(L,s,o){var c=this&&this.__decorate||function(g,u,m,y){var x,S=arguments.length,w=S<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 A=g.length-1;A>=0;A--)(x=g[A])&&(w=(S<3?x(w):S>3?x(u,m,w):x(u,m))||w);return S>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 a=o(7239),n=o(8055),d=o(8460),_=o(844),h=o(2585),i=n.css.toColor("#ffffff"),t=n.css.toColor("#000000"),e=n.css.toColor("#ffffff"),r=n.css.toColor("#000000"),l={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],x=u[m/6%6|0],S=u[m%6];g.push({css:n.channels.toCss(y,x,S),rgba:n.channels.toRgba(y,x,S)})}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 v=s.ThemeService=class extends _.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.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:l,selectionBackgroundOpaque:n.color.blend(t,l),selectionInactiveBackgroundTransparent:l,selectionInactiveBackgroundOpaque:n.color.blend(t,l),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=p(g.foreground,i),u.background=p(g.background,t),u.cursor=p(g.cursor,e),u.cursorAccent=p(g.cursorAccent,r),u.selectionBackgroundTransparent=p(g.selectionBackground,l),u.selectionBackgroundOpaque=n.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=p(g.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=n.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=g.selectionForeground?p(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]=p(g.black,s.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=p(g.red,s.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=p(g.green,s.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=p(g.yellow,s.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=p(g.blue,s.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=p(g.magenta,s.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=p(g.cyan,s.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=p(g.white,s.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=p(g.brightBlack,s.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=p(g.brightRed,s.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=p(g.brightGreen,s.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=p(g.brightYellow,s.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=p(g.brightBlue,s.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=p(g.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=p(g.brightCyan,s.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=p(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]=p(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 p(g,u){if(g!==void 0)try{return n.css.toColor(g)}catch{}return u}s.ThemeService=v=c([f(0,h.IOptionsService)],v)},6349:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let c=o(8460),f=o(844);class a 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 _=new Array(d);for(let h=0;h<Math.min(d,this.length);h++)_[h]=this._array[this._getCyclicIndex(h)];this._array=_,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let _=this._length;_<d;_++)this._array[_]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,_){this._array[this._getCyclicIndex(d)]=_}push(d){this._array[this._getCyclicIndex(this._length)]=d,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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,_,...h){if(_){for(let i=d;i<this._length-_;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+_)];this._length-=_,this.onDeleteEmitter.fire({index:d,amount:_})}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,_,h){if(!(_<=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=_-1;t>=0;t--)this.set(d+t+h,this.get(d+t));let i=d+_+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<_;i++)this.set(d+i+h,this.get(d+i))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}s.CircularList=a},1439:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(c,f=5){if(typeof c!="object")return c;let a=Array.isArray(c)?[]:{};for(let n in c)a[n]=f<=1?c[n]:c[n]&&o(c[n],f-1);return a}},8055:(L,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 o=0,c=0,f=0,a=0;var n,d,_,h,i;function t(r){let l=r.toString(16);return l.length<2?"0"+l:l}function e(r,l){return r<l?(l+.05)/(r+.05):(r+.05)/(l+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(r){r.toCss=function(l,v,p,g){return g!==void 0?`#${t(l)}${t(v)}${t(p)}${t(g)}`:`#${t(l)}${t(v)}${t(p)}`},r.toRgba=function(l,v,p,g=255){return(l<<24|v<<16|p<<8|g)>>>0},r.toColor=function(l,v,p,g){return{css:r.toCss(l,v,p,g),rgba:r.toRgba(l,v,p,g)}}})(n||(s.channels=n={})),(function(r){function l(v,p){return a=Math.round(255*p),[o,c,f]=i.toChannels(v.rgba),{css:n.toCss(o,c,f,a),rgba:n.toRgba(o,c,f,a)}}r.blend=function(v,p){if(a=(255&p.rgba)/255,a===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,u=p.rgba>>16&255,m=p.rgba>>8&255,y=v.rgba>>24&255,x=v.rgba>>16&255,S=v.rgba>>8&255;return o=y+Math.round((g-y)*a),c=x+Math.round((u-x)*a),f=S+Math.round((m-S)*a),{css:n.toCss(o,c,f),rgba:n.toRgba(o,c,f)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,p,g){let u=i.ensureContrastRatio(v.rgba,p.rgba,g);if(u)return n.toColor(u>>24&255,u>>16&255,u>>8&255)},r.opaque=function(v){let p=(255|v.rgba)>>>0;return[o,c,f]=i.toChannels(p),{css:n.toCss(o,c,f),rgba:p}},r.opacity=l,r.multiplyOpacity=function(v,p){return a=255&v.rgba,l(v,a*p/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}})(d||(s.color=d={})),(function(r){let l,v;try{let p=document.createElement("canvas");p.width=1,p.height=1;let g=p.getContext("2d",{willReadFrequently:!0});g&&(l=g,l.globalCompositeOperation="copy",v=l.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return o=parseInt(p.slice(1,2).repeat(2),16),c=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),n.toColor(o,c,f);case 5:return o=parseInt(p.slice(1,2).repeat(2),16),c=parseInt(p.slice(2,3).repeat(2),16),f=parseInt(p.slice(3,4).repeat(2),16),a=parseInt(p.slice(4,5).repeat(2),16),n.toColor(o,c,f,a);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let g=p.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 o=parseInt(g[1]),c=parseInt(g[2]),f=parseInt(g[3]),a=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),n.toColor(o,c,f,a);if(!l||!v)throw new Error("css.toColor: Unsupported css format");if(l.fillStyle=v,l.fillStyle=p,typeof l.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(l.fillRect(0,0,1,1),[o,c,f,a]=l.getImageData(0,0,1,1).data,a!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:n.toRgba(o,c,f,a),css:p}}})(_||(s.css=_={})),(function(r){function l(v,p,g){let u=v/255,m=p/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(v){return l(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=l})(h||(s.rgb=h={})),(function(r){function l(p,g,u){let m=p>>24&255,y=p>>16&255,x=p>>8&255,S=g>>24&255,w=g>>16&255,A=g>>8&255,z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));for(;z<u&&(S>0||w>0||A>0);)S-=Math.max(0,Math.ceil(.1*S)),w-=Math.max(0,Math.ceil(.1*w)),A-=Math.max(0,Math.ceil(.1*A)),z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));return(S<<24|w<<16|A<<8|255)>>>0}function v(p,g,u){let m=p>>24&255,y=p>>16&255,x=p>>8&255,S=g>>24&255,w=g>>16&255,A=g>>8&255,z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));for(;z<u&&(S<255||w<255||A<255);)S=Math.min(255,S+Math.ceil(.1*(255-S))),w=Math.min(255,w+Math.ceil(.1*(255-w))),A=Math.min(255,A+Math.ceil(.1*(255-A))),z=e(h.relativeLuminance2(S,w,A),h.relativeLuminance2(m,y,x));return(S<<24|w<<16|A<<8|255)>>>0}r.blend=function(p,g){if(a=(255&g)/255,a===1)return g;let u=g>>24&255,m=g>>16&255,y=g>>8&255,x=p>>24&255,S=p>>16&255,w=p>>8&255;return o=x+Math.round((u-x)*a),c=S+Math.round((m-S)*a),f=w+Math.round((y-w)*a),n.toRgba(o,c,f)},r.ensureContrastRatio=function(p,g,u){let m=h.relativeLuminance(p>>8),y=h.relativeLuminance(g>>8);if(e(m,y)<u){if(y<m){let w=l(p,g,u),A=e(m,h.relativeLuminance(w>>8));if(A<u){let z=v(p,g,u);return A>e(m,h.relativeLuminance(z>>8))?w:z}return w}let x=v(p,g,u),S=e(m,h.relativeLuminance(x>>8));if(S<u){let w=l(p,g,u);return S>e(m,h.relativeLuminance(w>>8))?x:w}return x}},r.reduceLuminance=l,r.increaseLuminance=v,r.toChannels=function(p){return[p>>24&255,p>>16&255,p>>8&255,255&p]}})(i||(s.rgba=i={})),s.toPaddedHex=t,s.contrastRatio=e},8969:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let c=o(844),f=o(2585),a=o(4348),n=o(7866),d=o(744),_=o(7302),h=o(6975),i=o(8460),t=o(1753),e=o(1480),r=o(7994),l=o(9282),v=o(5435),p=o(5981),g=o(2660),u=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((x=>{this._onScrollApi?.fire(x.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(x){for(let S in x)this.optionsService.options[S]=x[S]}constructor(x){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 a.InstantiationService,this.optionsService=this.register(new _.OptionsService(x)),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(h.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 v.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((S=>{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((S=>{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 p.WriteBuffer(((S,w)=>this._inputHandler.parse(S,w)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,S){this._writeBuffer.write(x,S)}writeSync(x,S){this._logService.logLevel<=f.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(x,S)}input(x,S=!0){this.coreService.triggerDataEvent(x,S)}resize(x,S){isNaN(x)||isNaN(S)||(x=Math.max(x,d.MINIMUM_COLS),S=Math.max(S,d.MINIMUM_ROWS),this._bufferService.resize(x,S))}scroll(x,S=!1){this._bufferService.scroll(x,S)}scrollLines(x,S,w){this._bufferService.scrollLines(x,S,w)}scrollPages(x){this.scrollLines(x*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(x){let S=x-this._bufferService.buffer.ydisp;S!==0&&this.scrollLines(S)}registerEscHandler(x,S){return this._inputHandler.registerEscHandler(x,S)}registerDcsHandler(x,S){return this._inputHandler.registerDcsHandler(x,S)}registerCsiHandler(x,S){return this._inputHandler.registerCsiHandler(x,S)}registerOscHandler(x,S){return this._inputHandler.registerOscHandler(x,S)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1,S=this.optionsService.rawOptions.windowsPty;S&&S.buildNumber!==void 0&&S.buildNumber!==void 0?x=S.backend==="conpty"&&S.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let x=[];x.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},(()=>((0,l.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(let S of x)S.dispose()}))}}}s.CoreTerminal=m},8460:(L,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=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o((f=>c.fire(f)))},s.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},5435:function(L,s,o){var c=this&&this.__decorate||function($,b,E,k){var D,P=arguments.length,K=P<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,b,E,k);else for(var Y=$.length-1;Y>=0;Y--)(D=$[Y])&&(K=(P<3?D(K):P>3?D(b,E,K):D(b,E))||K);return P>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function($,b){return function(E,k){b(E,k,$)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let a=o(2584),n=o(7116),d=o(2015),_=o(844),h=o(482),i=o(8437),t=o(8460),e=o(643),r=o(511),l=o(3734),v=o(2585),p=o(1480),g=o(6242),u=o(6351),m=o(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S($,b){if($>24)return b.setWinLines||!1;switch($){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.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 A=0;class z extends _.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,k,D,P,K,Y,Z,M=new d.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=k,this._logService=D,this._optionsService=P,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=Z,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new h.StringToUtf32,this._utf8Decoder=new h.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((C=>this._activeBuffer=C.activeBuffer))),this._parser.setCsiHandlerFallback(((C,H)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(C),params:H.toArray()})})),this._parser.setEscHandlerFallback((C=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(C)})})),this._parser.setExecuteHandlerFallback((C=>{this._logService.debug("Unknown EXECUTE code: ",{code:C})})),this._parser.setOscHandlerFallback(((C,H,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:C,action:H,data:N})})),this._parser.setDcsHandlerFallback(((C,H,N)=>{H==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(C),action:H,payload:N})})),this._parser.setPrintHandler(((C,H,N)=>this.print(C,H,N))),this._parser.registerCsiHandler({final:"@"},(C=>this.insertChars(C))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(C=>this.scrollLeft(C))),this._parser.registerCsiHandler({final:"A"},(C=>this.cursorUp(C))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(C=>this.scrollRight(C))),this._parser.registerCsiHandler({final:"B"},(C=>this.cursorDown(C))),this._parser.registerCsiHandler({final:"C"},(C=>this.cursorForward(C))),this._parser.registerCsiHandler({final:"D"},(C=>this.cursorBackward(C))),this._parser.registerCsiHandler({final:"E"},(C=>this.cursorNextLine(C))),this._parser.registerCsiHandler({final:"F"},(C=>this.cursorPrecedingLine(C))),this._parser.registerCsiHandler({final:"G"},(C=>this.cursorCharAbsolute(C))),this._parser.registerCsiHandler({final:"H"},(C=>this.cursorPosition(C))),this._parser.registerCsiHandler({final:"I"},(C=>this.cursorForwardTab(C))),this._parser.registerCsiHandler({final:"J"},(C=>this.eraseInDisplay(C,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(C=>this.eraseInDisplay(C,!0))),this._parser.registerCsiHandler({final:"K"},(C=>this.eraseInLine(C,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(C=>this.eraseInLine(C,!0))),this._parser.registerCsiHandler({final:"L"},(C=>this.insertLines(C))),this._parser.registerCsiHandler({final:"M"},(C=>this.deleteLines(C))),this._parser.registerCsiHandler({final:"P"},(C=>this.deleteChars(C))),this._parser.registerCsiHandler({final:"S"},(C=>this.scrollUp(C))),this._parser.registerCsiHandler({final:"T"},(C=>this.scrollDown(C))),this._parser.registerCsiHandler({final:"X"},(C=>this.eraseChars(C))),this._parser.registerCsiHandler({final:"Z"},(C=>this.cursorBackwardTab(C))),this._parser.registerCsiHandler({final:"`"},(C=>this.charPosAbsolute(C))),this._parser.registerCsiHandler({final:"a"},(C=>this.hPositionRelative(C))),this._parser.registerCsiHandler({final:"b"},(C=>this.repeatPrecedingCharacter(C))),this._parser.registerCsiHandler({final:"c"},(C=>this.sendDeviceAttributesPrimary(C))),this._parser.registerCsiHandler({prefix:">",final:"c"},(C=>this.sendDeviceAttributesSecondary(C))),this._parser.registerCsiHandler({final:"d"},(C=>this.linePosAbsolute(C))),this._parser.registerCsiHandler({final:"e"},(C=>this.vPositionRelative(C))),this._parser.registerCsiHandler({final:"f"},(C=>this.hVPosition(C))),this._parser.registerCsiHandler({final:"g"},(C=>this.tabClear(C))),this._parser.registerCsiHandler({final:"h"},(C=>this.setMode(C))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(C=>this.setModePrivate(C))),this._parser.registerCsiHandler({final:"l"},(C=>this.resetMode(C))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(C=>this.resetModePrivate(C))),this._parser.registerCsiHandler({final:"m"},(C=>this.charAttributes(C))),this._parser.registerCsiHandler({final:"n"},(C=>this.deviceStatus(C))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(C=>this.deviceStatusPrivate(C))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(C=>this.softReset(C))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(C=>this.setCursorStyle(C))),this._parser.registerCsiHandler({final:"r"},(C=>this.setScrollRegion(C))),this._parser.registerCsiHandler({final:"s"},(C=>this.saveCursor(C))),this._parser.registerCsiHandler({final:"t"},(C=>this.windowOptions(C))),this._parser.registerCsiHandler({final:"u"},(C=>this.restoreCursor(C))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(C=>this.insertColumns(C))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(C=>this.deleteColumns(C))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(C=>this.selectProtected(C))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(C=>this.requestMode(C,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(C=>this.requestMode(C,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((C=>(this.setTitle(C),this.setIconName(C),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((C=>this.setIconName(C)))),this._parser.registerOscHandler(2,new g.OscHandler((C=>this.setTitle(C)))),this._parser.registerOscHandler(4,new g.OscHandler((C=>this.setOrReportIndexedColor(C)))),this._parser.registerOscHandler(8,new g.OscHandler((C=>this.setHyperlink(C)))),this._parser.registerOscHandler(10,new g.OscHandler((C=>this.setOrReportFgColor(C)))),this._parser.registerOscHandler(11,new g.OscHandler((C=>this.setOrReportBgColor(C)))),this._parser.registerOscHandler(12,new g.OscHandler((C=>this.setOrReportCursorColor(C)))),this._parser.registerOscHandler(104,new g.OscHandler((C=>this.restoreIndexedColor(C)))),this._parser.registerOscHandler(110,new g.OscHandler((C=>this.restoreFgColor(C)))),this._parser.registerOscHandler(111,new g.OscHandler((C=>this.restoreBgColor(C)))),this._parser.registerOscHandler(112,new g.OscHandler((C=>this.restoreCursorColor(C)))),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 C in n.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:C},(()=>this.selectCharset("("+C))),this._parser.registerEscHandler({intermediates:")",final:C},(()=>this.selectCharset(")"+C))),this._parser.registerEscHandler({intermediates:"*",final:C},(()=>this.selectCharset("*"+C))),this._parser.registerEscHandler({intermediates:"+",final:C},(()=>this.selectCharset("+"+C))),this._parser.registerEscHandler({intermediates:"-",final:C},(()=>this.selectCharset("-"+C))),this._parser.registerEscHandler({intermediates:".",final:C},(()=>this.selectCharset("."+C))),this._parser.registerEscHandler({intermediates:"/",final:C},(()=>this.selectCharset("/"+C)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((C=>(this._logService.error("Parsing error: ",C),C))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler(((C,H)=>this.requestStatusString(C,H))))}_preserveStack(b,E,k,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=k,this._parseStack.position=D}_logSlowResolvingAsync(b){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,E){let k,D=this._activeBuffer.x,P=this._activeBuffer.y,K=0,Y=this._parseStack.paused;if(Y){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(k),k;D=this._parseStack.cursorStartX,P=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>x&&(K=this._parseStack.position+x)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(C=>String.fromCharCode(C))).join("")}"`),typeof b=="string"?b.split("").map((C=>C.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(b.length,x))),Y||this._dirtyRowTracker.clearRange(),b.length>x)for(let C=K;C<b.length;C+=x){let H=C+x<b.length?C+x:b.length,N=typeof b=="string"?this._stringDecoder.decode(b.substring(C,H),this._parseBuffer):this._utf8Decoder.decode(b.subarray(C,H),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,N))return this._preserveStack(D,P,N,C),this._logSlowResolvingAsync(k),k}else if(!Y){let C=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,C))return this._preserveStack(D,P,C,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===D&&this._activeBuffer.y===P||this._onCursorMove.fire();let Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(b,E,k){let D,P,K=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,C=this._coreService.modes.insertMode,H=this._curAttrData,N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-E>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,H);let V=this._parser.precedingJoinState;for(let j=E;j<k;++j){if(D=b[j],D<127&&K){let fe=K[String.fromCharCode(D)];fe&&(D=fe.charCodeAt(0))}let te=this._unicodeService.charProperties(D,V);P=p.UnicodeService.extractWidth(te);let ne=p.UnicodeService.extractShouldJoin(te),oe=ne?p.UnicodeService.extractWidth(V):0;if(V=te,Y&&this._onA11yChar.fire((0,h.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+P-oe>Z){if(M){let fe=N,X=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,X,0,oe,!1);X<Z;)fe.setCellFromCodepoint(X++,0,1,H)}else if(this._activeBuffer.x=Z-1,P===2)continue}if(ne&&this._activeBuffer.x){let fe=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-fe,D,P);for(let X=P-oe;--X>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}else if(C&&(N.insertCells(this._activeBuffer.x,P-oe,this._activeBuffer.getNullCell(H)),N.getWidth(Z-1)===2&&N.setCellFromCodepoint(Z-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,H)),N.setCellFromCodepoint(this._activeBuffer.x++,D,P,H),P>0)for(;--P;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}this._parser.precedingJoinState=V,this._activeBuffer.x<Z&&k-E>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,H),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,E){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,E):this._parser.registerCsiHandler(b,(k=>!S(k.params[0],this._optionsService.rawOptions.windowOptions)||E(k)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new u.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new g.OscHandler(E))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=b,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+E)}cursorUp(b){let E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let E=b.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=b.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let E=b.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,E,k,D=!1,P=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,k,this._activeBuffer.getNullCell(this._eraseAttrData()),P),D&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),k.isWrapped=!1)}eraseInDisplay(b,E=!1){let k;switch(this._restrictCursor(this._bufferService.cols),b.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,E);k<this._bufferService.rows;k++)this._resetBufferLine(k,E);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,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,E);this._dirtyRowTracker.markDirty(0);break;case 3:let D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(b,E=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let E=b.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,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;E--;)this._activeBuffer.lines.splice(P-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(b){this._restrictCursor();let E=b.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,D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;E--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let E=b.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(b){let E=b.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let E=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let E=this._parser.precedingJoinState;if(!E)return!0;let k=b.params[0]||1,D=p.UnicodeService.extractWidth(E),P=this._activeBuffer.x-D,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(P),Y=new Uint32Array(K.length*k),Z=0;for(let C=0;C<K.length;){let H=K.codePointAt(C)||0;Y[Z++]=H,C+=H>65535?2:1}let M=Z;for(let C=1;C<k;++C)Y.copyWithin(M,0,Z),M+=Z;return this.print(Y,0,M),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){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(b){for(let E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let E=0;E<b.length;E++)switch(b.params[E]){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(),b.params[E]===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(b,E){let k=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:P}=this._coreMouseService,K=this._coreService,{buffers:Y,cols:Z}=this._bufferService,{active:M,alt:C}=Y,H=this._optionsService.rawOptions,N=ne=>ne?1:2,V=b.params[0];return j=V,te=E?V===2?4:V===4?N(K.modes.insertMode):V===12?3:V===20?N(H.convertEol):0:V===1?N(k.applicationCursorKeys):V===3?H.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(D==="X10"):V===12?N(H.cursorBlink):V===25?N(!K.isCursorHidden):V===45?N(k.reverseWraparound):V===66?N(k.applicationKeypad):V===67?4:V===1e3?N(D==="VT200"):V===1002?N(D==="DRAG"):V===1003?N(D==="ANY"):V===1004?N(k.sendFocus):V===1005?4:V===1006?N(P==="SGR"):V===1015?4:V===1016?N(P==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?N(M===C):V===2004?N(k.bracketedPasteMode):0,K.triggerDataEvent(`${a.C0.ESC}[${E?"":"?"}${j};${te}$y`),!0;var j,te}_updateAttrColor(b,E,k,D,P){return E===2?(b|=50331648,b&=-16777216,b|=l.AttributeData.fromColorRGB([k,D,P])):E===5&&(b&=-50331904,b|=33554432|255&k),b}_extractColor(b,E,k){let D=[0,0,-1,0,0,0],P=0,K=0;do{if(D[K+P]=b.params[E+K],b.hasSubParams(E+K)){let Y=b.getSubParams(E+K),Z=0;do D[1]===5&&(P=1),D[K+Z+1+P]=Y[Z];while(++Z<Y.length&&Z+K+1+P<D.length);break}if(D[1]===5&&K+P>=2||D[1]===2&&K+P>=5)break;D[1]&&(P=1)}while(++K+E<b.length&&K+P<D.length);for(let Y=2;Y<D.length;++Y)D[Y]===-1&&(D[Y]=0);switch(D[0]){case 38:k.fg=this._updateAttrColor(k.fg,D[1],D[3],D[4],D[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,D[1],D[3],D[4],D[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,D[1],D[3],D[4],D[5])}return K}_processUnderline(b,E){E.extended=E.extended.clone(),(!~b||b>5)&&(b=1),E.extended.underlineStyle=b,E.fg|=268435456,b===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(b){b.fg=i.DEFAULT_ATTR_DATA.fg,b.bg=i.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let E=b.length,k,D=this._curAttrData;for(let P=0;P<E;P++)k=b.params[P],k>=30&&k<=37?(D.fg&=-50331904,D.fg|=16777216|k-30):k>=40&&k<=47?(D.bg&=-50331904,D.bg|=16777216|k-40):k>=90&&k<=97?(D.fg&=-50331904,D.fg|=16777224|k-90):k>=100&&k<=107?(D.bg&=-50331904,D.bg|=16777224|k-100):k===0?this._processSGR0(D):k===1?D.fg|=134217728:k===3?D.bg|=67108864:k===4?(D.fg|=268435456,this._processUnderline(b.hasSubParams(P)?b.getSubParams(P)[0]:1,D)):k===5?D.fg|=536870912:k===7?D.fg|=67108864:k===8?D.fg|=1073741824:k===9?D.fg|=2147483648:k===2?D.bg|=134217728:k===21?this._processUnderline(2,D):k===22?(D.fg&=-134217729,D.bg&=-134217729):k===23?D.bg&=-67108865:k===24?(D.fg&=-268435457,this._processUnderline(0,D)):k===25?D.fg&=-536870913:k===27?D.fg&=-67108865:k===28?D.fg&=-1073741825:k===29?D.fg&=2147483647:k===39?(D.fg&=-67108864,D.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):k===49?(D.bg&=-67108864,D.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?P+=this._extractColor(b,P,D):k===53?D.bg|=1073741824:k===55?D.bg&=-1073741825:k===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):k===100?(D.fg&=-67108864,D.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${E};${k}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${E};${k}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(b){let E=b.params[0]||1;switch(E){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=E%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(b){let E=b.params[0]||1,k;return(b.length<2||(k=b.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(b){if(!S(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let E=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:E!==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(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let E=[],k=b.split(";");for(;k.length>1;){let D=k.shift(),P=k.shift();if(/^\d+$/.exec(D)){let K=parseInt(D);if(q(K))if(P==="?")E.push({type:0,index:K});else{let Y=(0,m.parseColor)(P);Y&&E.push({type:1,index:K,color:Y})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(b){let E=b.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(b,E){this._getCurrentLinkId()&&this._finishHyperlink();let k=b.split(":"),D,P=k.findIndex((K=>K.startsWith("id=")));return P!==-1&&(D=k[P].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,E){let k=b.split(";");for(let D=0;D<k.length&&!(E>=this._specialColors.length);++D,++E)if(k[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let P=(0,m.parseColor)(k[D]);P&&this._onColor.fire([{type:1,index:this._specialColors[E],color:P}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let E=[],k=b.split(";");for(let D=0;D<k.length;++D)if(/^\d+$/.exec(k[D])){let P=parseInt(k[D]);q(P)&&E.push({type:2,index:P})}return E.length&&this._onColor.fire(E),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,n.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(y[b[0]],n.CHARSETS[b[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 b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new r.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){let k=this._activeBuffer.ybase+this._activeBuffer.y+E,D=this._activeBuffer.lines.get(k);D&&(D.fill(b),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let k=this._bufferService.buffer,D=this._optionsService.rawOptions;return(P=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${P}${a.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}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($,b){$>b&&(A=$,$=b,b=A),$<this.start&&(this.start=$),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function q($){return 0<=$&&$<256}U=c([f(0,v.IBufferService)],U)},844:(L,s)=>{function o(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=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,a,n){this._data[f]||(this._data[f]={}),this._data[f][a]=n}get(f,a){return this._data[f]?this._data[f][a]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,f,a,n,d){this._data.get(c,f)||this._data.set(c,f,new o),this._data.get(c,f).set(a,n,d)}get(c,f,a,n){return this._data.get(c,f)?.get(a,n)}clear(){this._data.clear()}}},6114:(L,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 o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=o.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(o)},6106:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;let f=this._getKey(c);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,f){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let f=0,a=this._array.length-1;for(;a>=f;){let n=f+a>>1,d=this._getKey(this._array[n]);if(d>c)a=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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let c=o(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 _=0,h=0,i=d.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(_=Date.now(),this._tasks[this._i]()||this._i++,_=Math.max(1,Date.now()-_),h=Math.max(_,h),t=d.timeRemaining(),1.5*h>t)return i-_<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-_))}ms`),void this._start();i=t}this.clear()}}class a extends f{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){let _=Date.now()+d;return{timeRemaining:()=>Math.max(0,_-Date.now())}}}s.PriorityTaskQueue=a,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(n){return requestIdleCallback(n)}_cancelCallback(n){cancelIdleCallback(n)}}:a,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(n){this._queue.clear(),this._queue.enqueue(n)}flush(){this._queue.flush()}}},9282:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let c=o(643);s.updateWindowsModeWrappedState=function(f){let a=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),n=a?.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:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){let a=new o;return a.fg=this.fg,a.bg=this.bg,a.extended=this.extended.clone(),a}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=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(a){this._ext&=-469762049,this._ext|=a<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(a){this._ext&=-67108864,this._ext|=67108863&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}get underlineVariantOffset(){let a=(3758096384&this._ext)>>29;return a<0?4294967288^a:a}set underlineVariantOffset(a){this._ext&=536870911,this._ext|=a<<29&3758096384}constructor(a=0,n=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=n}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},9092:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let c=o(6349),f=o(7226),a=o(3734),n=o(8437),d=o(4634),_=o(511),h=o(643),i=o(4863),t=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(e,r,l){this._hasScrollback=e,this._optionsService=r,this._bufferService=l,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=_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=_.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.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 a.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 a.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 l=this.getNullCell(n.DEFAULT_ATTR_DATA),v=0,p=this._getCorrectBufferLength(r);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)v+=+this.lines.get(u).resize(e,l);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,l)):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,l)));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(p<this.lines.maxLength){let u=this.lines.length-p;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=p}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++)v+=+this.lines.get(g).resize(e,l);this._cols=e,this._rows=r,this._memoryCleanupQueue.clear(),v>.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 l=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(l.length>0){let v=(0,d.reflowLargerCreateNewLayout)(this.lines,l);(0,d.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(e,r,v.countRemoved)}}_reflowLargerAdjustViewport(e,r,l){let v=this.getNullCell(n.DEFAULT_ATTR_DATA),p=l;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new n.BufferLine(e,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-l,0)}_reflowSmaller(e,r){let l=this.getNullCell(n.DEFAULT_ATTR_DATA),v=[],p=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 x=m[m.length-1].getTrimmedLength(),S=(0,d.reflowSmallerGetNewLineLengths)(m,this._cols,e),w=S.length-m.length,A;A=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 D=this.getBlankLine(n.DEFAULT_ATTR_DATA,!0);z.push(D)}z.length>0&&(v.push({start:g+m.length+p,newLines:z}),p+=z.length),m.push(...z);let U=S.length-1,q=S[U];q===0&&(U--,q=S[U]);let $=m.length-w-1,b=x;for(;$>=0;){let k=Math.min(b,q);if(m[U]===void 0)break;if(m[U].copyCellsFrom(m[$],b-k,q-k,k,!0),q-=k,q===0&&(U--,q=S[U]),b-=k,b===0){$--;let D=Math.max($,0);b=(0,d.getWrappedLineTrimmedLength)(m,D,this._cols)}}for(let k=0;k<m.length;k++)S[k]<e&&m[k].setCell(S[k],l);let E=w-A;for(;E-- >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+p)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(v.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,x=0,S=v[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let w=0;for(let U=Math.min(this.lines.maxLength-1,m+p-1);U>=0;U--)if(S&&S.start>y+w){for(let q=S.newLines.length-1;q>=0;q--)this.lines.set(U--,S.newLines[q]);U++,g.push({index:y+1,amount:S.newLines.length}),w+=S.newLines.length,S=v[++x]}else this.lines.set(U,u[y--]);let A=0;for(let U=g.length-1;U>=0;U--)g[U].index+=A,this.lines.onInsertEmitter.fire(g[U]),A+=g[U].amount;let z=Math.max(0,m+p-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(e,r,l=0,v){let p=this.lines.get(e);return p?p.translateToString(r,l,v):""}getWrappedRangeForLine(e){let r=e,l=e;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;l+1<this.lines.length&&this.lines.get(l+1).isWrapped;)l++;return{first:r,last:l}}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((l=>{r.line-=l,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((l=>{r.line>=l.index&&(r.line+=l.amount)}))),r.register(this.lines.onDelete((l=>{r.line>=l.index&&r.line<l.index+l.amount&&r.dispose(),r.line>l.index&&(r.line-=l.amount)}))),r.register(r.onDispose((()=>this._removeMarker(r)))),r}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let c=o(3734),f=o(511),a=o(643),n=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let d=0;class _{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,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let l=0;l<i;++l)this.setCell(l,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[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=t[1],this._data[3*i+0]=2097152|i|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.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 l=this.length-i-t-1;l>=0;--l)this.setCell(i+t+l,this.loadCell(i+l,r));for(let l=0;l<t;++l)this.setCell(i+l,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 l=0;l<this.length-i-t;++l)this.setCell(i+l,this.loadCell(i+t+l,r));for(let l=this.length-t;l<this.length;++l)this.setCell(l,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 v=0;v<r.length;v++){let p=parseInt(r[v],10);p>=i&&delete this._combined[p]}let l=Object.keys(this._extendedAttrs);for(let v=0;v<l.length;v++){let p=parseInt(l[v],10);p>=i&&delete this._extendedAttrs[p]}}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 _(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,l){let v=i._data;if(l)for(let g=r-1;g>=0;g--){for(let u=0;u<3;u++)this._data[3*(e+g)+u]=v[3*(t+g)+u];268435456&v[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]=v[3*(t+g)+u];268435456&v[3*(t+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[t+g])}let p=Object.keys(i._combined);for(let g=0;g<p.length;g++){let u=parseInt(p[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 l="";for(;t<e;){let v=this._data[3*t+0],p=2097151&v,g=2097152&v?this._combined[t]:p?(0,n.stringFromCodePoint)(p):a.WHITESPACE_CELL_CHAR;if(l+=g,r)for(let u=0;u<g.length;++u)r.push(t);t+=v>>22||1}return r&&r.push(t),l}}s.BufferLine=_},4841:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(L,s)=>{function o(c,f,a){if(f===c.length-1)return c[f].getTrimmedLength();let n=!c[f].hasContent(a-1)&&c[f].getWidth(a-1)===1,d=c[f+1].getWidth(0)===2;return n&&d?a-1:a}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(c,f,a,n,d){let _=[];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(n>=h&&n<i){h+=e.length-1;continue}let r=0,l=o(e,r,f),v=1,p=0;for(;v<e.length;){let u=o(e,v,f),m=u-p,y=a-l,x=Math.min(m,y);e[r].copyCellsFrom(e[v],p,l,x,!1),l+=x,l===a&&(r++,l=0),p+=x,p===u&&(v++,p=0),l===0&&r!==0&&e[r-1].getWidth(a-1)===2&&(e[r].copyCellsFrom(e[r-1],a-1,l++,1,!1),e[r-1].setCell(a-1,d))}e[r].replaceCells(l,a,d);let g=0;for(let u=e.length-1;u>0&&(u>r||e[u].getTrimmedLength()===0);u--)g++;g>0&&(_.push(h+e.length-g),_.push(g)),h+=e.length-1}return _},s.reflowLargerCreateNewLayout=function(c,f){let a=[],n=0,d=f[n],_=0;for(let h=0;h<c.length;h++)if(d===h){let i=f[++n];c.onDeleteEmitter.fire({index:h-_,amount:i}),h+=i-1,_+=i,d=f[++n]}else a.push(h);return{layout:a,countRemoved:_}},s.reflowLargerApplyNewLayout=function(c,f){let a=[];for(let n=0;n<f.length;n++)a.push(c.get(f[n]));for(let n=0;n<a.length;n++)c.set(n,a[n]);c.length=f.length},s.reflowSmallerGetNewLineLengths=function(c,f,a){let n=[],d=c.map(((t,e)=>o(c,e,f))).reduce(((t,e)=>t+e)),_=0,h=0,i=0;for(;i<d;){if(d-i<a){n.push(d-i);break}_+=a;let t=o(c,h,f);_>t&&(_-=t,h++);let e=c[h].getWidth(_-1)===2;e&&_--;let r=e?a-1:a;n.push(r),i+=r}return n},s.getWrappedLineTrimmedLength=o},5295:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let c=o(8460),f=o(844),a=o(9092);class n extends f.Disposable{constructor(_,h){super(),this._optionsService=_,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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(_){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(_),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(_,h){this._normal.resize(_,h),this._alt.resize(_,h),this.setupTabStops(_)}setupTabStops(_){this._normal.setupTabStops(_),this._alt.setupTabStops(_)}}s.BufferSet=n},511:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let c=o(482),f=o(643),a=o(3734);class n extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=""}static fromCharData(_){let h=new n;return h.setFromCharData(_),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(_){this.fg=_[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let h=!1;if(_[f.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(_[f.CHAR_DATA_CHAR_INDEX].length===2){let i=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let t=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(i-55296)+t-56320+65536|_[f.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[f.CHAR_DATA_WIDTH_INDEX]<<22;h&&(this.combinedData=_[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|_[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=n},643:(L,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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let c=o(8460),f=o(844);class a{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=a._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=a,a._nextId=1},7116:(L,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:(L,s)=>{var o,c,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT=" ",a.LF=`
9
- `,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL="\x7F"})(o||(s.C0=o={})),(function(a){a.PAD="\x80",a.HOP="\x81",a.BPH="\x82",a.NBH="\x83",a.IND="\x84",a.NEL="\x85",a.SSA="\x86",a.ESA="\x87",a.HTS="\x88",a.HTJ="\x89",a.VTS="\x8A",a.PLD="\x8B",a.PLU="\x8C",a.RI="\x8D",a.SS2="\x8E",a.SS3="\x8F",a.DCS="\x90",a.PU1="\x91",a.PU2="\x92",a.STS="\x93",a.CCH="\x94",a.MW="\x95",a.SPA="\x96",a.EPA="\x97",a.SOS="\x98",a.SGCI="\x99",a.SCI="\x9A",a.CSI="\x9B",a.ST="\x9C",a.OSC="\x9D",a.PM="\x9E",a.APC="\x9F"})(c||(s.C1=c={})),(function(a){a.ST=`${o.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let c=o(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(a,n,d,_){let h={type:0,cancel:!1,key:void 0},i=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:a.key==="UIKeyInputUpArrow"?h.key=n?c.C0.ESC+"OA":c.C0.ESC+"[A":a.key==="UIKeyInputLeftArrow"?h.key=n?c.C0.ESC+"OD":c.C0.ESC+"[D":a.key==="UIKeyInputRightArrow"?h.key=n?c.C0.ESC+"OC":c.C0.ESC+"[C":a.key==="UIKeyInputDownArrow"&&(h.key=n?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:h.key=a.ctrlKey?"\b":c.C0.DEL,a.altKey&&(h.key=c.C0.ESC+h.key);break;case 9:if(a.shiftKey){h.key=c.C0.ESC+"[Z";break}h.key=c.C0.HT,h.cancel=!0;break;case 13:h.key=a.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,h.cancel=!0;break;case 27:h.key=c.C0.ESC,a.altKey&&(h.key=c.C0.ESC+c.C0.ESC),h.cancel=!0;break;case 37:if(a.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=n?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(a.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=n?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(a.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=n?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(a.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=n?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:a.shiftKey||a.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":n?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:h.key=i?c.C0.ESC+"[1;"+(i+1)+"F":n?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:a.shiftKey?h.type=2:a.ctrlKey?h.key=c.C0.ESC+"[5;"+(i+1)+"~":h.key=c.C0.ESC+"[5~";break;case 34:a.shiftKey?h.type=3:a.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(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if(d&&!_||!a.altKey||a.metaKey)!d||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&a.keyCode>=48&&a.key.length===1?h.key=a.key:a.key&&a.ctrlKey&&(a.key==="_"&&(h.key=c.C0.US),a.key==="@"&&(h.key=c.C0.NUL)):a.keyCode===65&&(h.type=1);else{let t=f[a.keyCode],e=t?.[a.shiftKey?1:0];if(e)h.key=c.C0.ESC+e;else if(a.keyCode>=65&&a.keyCode<=90){let r=a.ctrlKey?a.keyCode-64:a.keyCode+32,l=String.fromCharCode(r);a.shiftKey&&(l=l.toUpperCase()),h.key=c.C0.ESC+l}else if(a.keyCode===32)h.key=c.C0.ESC+(a.ctrlKey?c.C0.NUL:" ");else if(a.key==="Dead"&&a.code.startsWith("Key")){let r=a.code.slice(3,4);a.shiftKey||(r=r.toLowerCase()),h.key=c.C0.ESC+r,h.cancel=!0}}else a.keyCode>=65&&a.keyCode<=90?h.key=String.fromCharCode(a.keyCode-64):a.keyCode===32?h.key=c.C0.NUL:a.keyCode>=51&&a.keyCode<=55?h.key=String.fromCharCode(a.keyCode-51+27):a.keyCode===56?h.key=c.C0.DEL:a.keyCode===219?h.key=c.C0.ESC:a.keyCode===220?h.key=c.C0.FS:a.keyCode===221&&(h.key=c.C0.GS)}return h}},482:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,c=0,f=o.length){let a="";for(let n=c;n<f;++n){let d=o[n];d>65535?(d-=65536,a+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):a+=String.fromCharCode(d)}return a},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){let f=o.length;if(!f)return 0;let a=0,n=0;if(this._interim){let d=o.charCodeAt(n++);56320<=d&&d<=57343?c[a++]=1024*(this._interim-55296)+d-56320+65536:(c[a++]=this._interim,c[a++]=d),this._interim=0}for(let d=n;d<f;++d){let _=o.charCodeAt(d);if(55296<=_&&_<=56319){if(++d>=f)return this._interim=_,a;let h=o.charCodeAt(d);56320<=h&&h<=57343?c[a++]=1024*(_-55296)+h-56320+65536:(c[a++]=_,c[a++]=h)}else _!==65279&&(c[a++]=_)}return a}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){let f=o.length;if(!f)return 0;let a,n,d,_,h=0,i=0,t=0;if(this.interim[0]){let l=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let p,g=0;for(;(p=63&this.interim[++g])&&g<4;)v<<=6,v|=p;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(p=o[t++],(192&p)!=128){t--,l=!0;break}this.interim[g++]=p,v<<=6,v|=63&p}l||(u===2?v<128?t--:c[h++]=v:u===3?v<2048||v>=55296&&v<=57343||v===65279||(c[h++]=v):v<65536||v>1114111||(c[h++]=v)),this.interim.fill(0)}let e=f-4,r=t;for(;r<f;){for(;!(!(r<e)||128&(a=o[r])||128&(n=o[r+1])||128&(d=o[r+2])||128&(_=o[r+3]));)c[h++]=a,c[h++]=n,c[h++]=d,c[h++]=_,r+=4;if(a=o[r++],a<128)c[h++]=a;else if((224&a)==192){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(i=(31&a)<<6|63&n,i<128){r--;continue}c[h++]=i}else if((240&a)==224){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,h;if(d=o[r++],(192&d)!=128){r--;continue}if(i=(15&a)<<12|(63&n)<<6|63&d,i<2048||i>=55296&&i<=57343||i===65279)continue;c[h++]=i}else if((248&a)==240){if(r>=f)return this.interim[0]=a,h;if(n=o[r++],(192&n)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,h;if(d=o[r++],(192&d)!=128){r--;continue}if(r>=f)return this.interim[0]=a,this.interim[1]=n,this.interim[2]=d,h;if(_=o[r++],(192&_)!=128){r--;continue}if(i=(7&a)<<18|(63&n)<<12|(63&d)<<6|63&_,i<65536||i>1114111)continue;c[h++]=i}}return h}}},225:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let c=o(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]],a=[[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(_,h){let i,t=0,e=h.length-1;if(_<h[0][0]||_>h[e][1])return!1;for(;e>=t;)if(i=t+e>>1,_>h[i][1])t=i+1;else{if(!(_<h[i][0]))return!0;e=i-1}return!1})(d,a)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,_){let h=this.wcwidth(d),i=h===0&&_!==0;if(i){let t=c.UnicodeService.extractWidth(_);t===0?i=!1:t>h&&(h=t)}return c.UnicodeService.createPropertyValue(0,h,i)}}},5981:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let c=o(8460),f=o(844);class a 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,_){if(_!==void 0&&this._syncCalls>_)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let 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,_){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(_),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(_)}_innerWrite(d=0,_=!0){let h=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],t=this._action(i,_);if(t){let r=l=>Date.now()-h>=12?setTimeout((()=>this._innerWrite(0,l))):this._innerWrite(h,l);return void t.catch((l=>(queueMicrotask((()=>{throw l})),Promise.resolve(!1)))).then(r)}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()}}s.WriteBuffer=a},5941:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function f(a,n){let d=a.toString(16),_=d.length<2?"0"+d:d;switch(n){case 4:return d[0];case 8:return _;case 12:return(_+_).slice(0,3);default:return _+_}}s.parseColor=function(a){if(!a)return;let n=a.toLowerCase();if(n.indexOf("rgb:")===0){n=n.slice(4);let d=o.exec(n);if(d){let _=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/_*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/_*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/_*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,_=[0,0,0];for(let h=0;h<3;++h){let i=parseInt(n.slice(d*h,d*h+d),16);_[h]=d===1?i<<4:d===2?i:d===3?i>>4:i>>8}return _}},s.toRgbString=function(a,n=16){let[d,_,h]=a;return`rgb:${f(d,n)}/${f(_,n)}/${f(h,n)}`}},5770:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let c=o(482),f=o(8742),a=o(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(_,h){this._handlers[_]===void 0&&(this._handlers[_]=[]);let i=this._handlers[_];return i.push(h),{dispose:()=>{let t=i.indexOf(h);t!==-1&&i.splice(t,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}reset(){if(this._active.length)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].unhook(!1);this._stack.paused=!1,this._active=n,this._ident=0}hook(_,h){if(this.reset(),this._ident=_,this._active=this._handlers[_]||n,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(_,h,i){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(_,h,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(_,h,i))}unhook(_,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(_),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",_);this._active=n,this._ident=0}};let d=new f.Params;d.addParam(0),s.DcsHandler=class{constructor(_){this._handler=_,this._data="",this._params=d,this._hitLimit=!1}hook(_){this._params=_.length>1||_.params[0]?_.clone():d,this._data="",this._hitLimit=!1}put(_,h,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(_,h,i),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(_){let h=!1;if(this._hitLimit)h=!1;else if(_&&(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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let c=o(844),f=o(8742),a=o(6242),n=o(6351);class d{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,r,l){this.table[e<<8|t]=r<<4|l}addMany(t,e,r,l){for(let v=0;v<t.length;v++)this.table[e<<8|t[v]]=r<<4|l}}s.TransitionTable=d;let _=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),l=e(0,24);l.push(25),l.push.apply(l,e(28,32));let v=e(0,14),p;for(p in i.setDefault(1,0),i.addMany(r,0,2,0),v)i.addMany([24,26,153,154],p,3,0),i.addMany(e(128,144),p,3,0),i.addMany(e(144,152),p,3,0),i.add(156,p,0,0),i.add(27,p,11,1),i.add(157,p,4,8),i.addMany([152,158,159],p,0,7),i.add(155,p,11,3),i.add(144,p,11,9);return i.addMany(l,0,3,0),i.addMany(l,1,3,1),i.add(127,1,0,1),i.addMany(l,8,0,8),i.addMany(l,3,3,3),i.add(127,3,0,3),i.addMany(l,4,3,4),i.add(127,4,0,4),i.addMany(l,6,3,6),i.addMany(l,5,3,5),i.add(127,5,0,5),i.addMany(l,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(l,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(l,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(l,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(l,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(l,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(l,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(_,0,2,0),i.add(_,8,5,8),i.add(_,6,0,6),i.add(_,11,0,11),i.add(_,13,13,13),i})();class h 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,l)=>{},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 a.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 v=0;v<t.intermediates.length;++v){let p=t.intermediates.charCodeAt(v);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=p}}if(t.final.length!==1)throw new Error("final must be a single byte");let l=t.final.charCodeAt(0);if(e[0]>l||l>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return r<<=8,r|=l,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 l=this._escHandlers[r];return l.push(e),{dispose:()=>{let v=l.indexOf(e);v!==-1&&l.splice(v,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 l=this._csiHandlers[r];return l.push(e),{dispose:()=>{let v=l.indexOf(e);v!==-1&&l.splice(v,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,l,v){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=r,this._parseStack.transition=l,this._parseStack.chunkPos=v}parse(t,e,r){let l,v=0,p=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&&(l=u[m](this._params),l!==!0);m--)if(l instanceof Promise)return this._parseStack.handlerPos=m,l}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(l=u[m](),l!==!0);m--)if(l instanceof Promise)return this._parseStack.handlerPos=m,l}this._parseStack.handlers=[];break;case 6:if(v=t[this._parseStack.chunkPos],l=this._dcsParser.unhook(v!==24&&v!==26,r),l)return l;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(v=t[this._parseStack.chunkPos],l=this._oscParser.end(v!==24&&v!==26,r),l)return l;v===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(v=t[u],p=this._transitions.table[this.currentState<<8|(v<160?v:_)],p>>4){case 2:for(let w=u+1;;++w){if(w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}if(++w>=e||(v=t[w])<32||v>126&&v<_){this._printHandler(t,u,w),u=w-1;break}}break;case 3:this._executeHandlers[v]?this._executeHandlers[v]():this._executeHandlerFb(v),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:v,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|v],y=m?m.length-1:-1;for(;y>=0&&(l=m[y](this._params),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(3,m,y,p,u),l;y<0&&this._csiHandlerFb(this._collect<<8|v,this._params),this.precedingJoinState=0;break;case 8:do switch(v){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(v-48)}while(++u<e&&(v=t[u])>47&&v<60);u--;break;case 9:this._collect<<=8,this._collect|=v;break;case 10:let x=this._escHandlers[this._collect<<8|v],S=x?x.length-1:-1;for(;S>=0&&(l=x[S](),l!==!0);S--)if(l instanceof Promise)return this._preserveStack(4,x,S,p,u),l;S<0&&this._escHandlerFb(this._collect<<8|v),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|v,this._params);break;case 13:for(let w=u+1;;++w)if(w>=e||(v=t[w])===24||v===26||v===27||v>127&&v<_){this._dcsParser.put(t,u,w),u=w-1;break}break;case 14:if(l=this._dcsParser.unhook(v!==24&&v!==26),l)return this._preserveStack(6,[],0,p,u),l;v===27&&(p|=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||(v=t[w])<32||v>127&&v<_){this._oscParser.put(t,u,w),u=w-1;break}break;case 6:if(l=this._oscParser.end(v!==24&&v!==26),l)return this._preserveStack(5,[],0,p,u),l;v===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}s.EscapeSequenceParser=h},6242:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let c=o(5770),f=o(482),a=[];s.OscParser=class{constructor(){this._state=0,this._active=a,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 _=this._handlers[n];return _.push(d),{dispose:()=>{let h=_.indexOf(d);h!==-1&&_.splice(h,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=a}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=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,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,_){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(n,d,_);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(n,d,_))}start(){this.reset(),this._state=1}put(n,d,_){if(this._state!==3){if(this._state===1)for(;d<_;){let h=n[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&&_-d>0&&this._put(n,d,_)}}end(n,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let _=!1,h=this._active.length-1,i=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,_=d,i=this._stack.fallThrough,this._stack.paused=!1),!i&&_===!1){for(;h>=0&&(_=this._active[h].end(n),_!==!0);h--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,_;h--}for(;h>=0;h--)if(_=this._active[h].end(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,_}else this._handlerFb(this._id,"END",n);this._active=a,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,_){this._hitLimit||(this._data+=(0,f.utf32ToString)(n,d,_),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((_=>(this._data="",this._hitLimit=!1,_)));return this._data="",this._hitLimit=!1,d}}},8742:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let o=2147483647;class c{static fromArray(a){let n=new c;if(!a.length)return n;for(let d=Array.isArray(a[0])?1:0;d<a.length;++d){let _=a[d];if(Array.isArray(_))for(let h=0;h<_.length;++h)n.addSubParam(_[h]);else n.addParam(_)}return n}constructor(a=32,n=32){if(this.maxLength=a,this.maxSubParamsLength=n,n>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(a),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let a=new c(this.maxLength,this.maxSubParamsLength);return a.params.set(this.params),a.length=this.length,a._subParams.set(this._subParams),a._subParamsLength=this._subParamsLength,a._subParamsIdx.set(this._subParamsIdx),a._rejectDigits=this._rejectDigits,a._rejectSubDigits=this._rejectSubDigits,a._digitIsSub=this._digitIsSub,a}toArray(){let a=[];for(let n=0;n<this.length;++n){a.push(this.params[n]);let d=this._subParamsIdx[n]>>8,_=255&this._subParamsIdx[n];_-d>0&&a.push(Array.prototype.slice.call(this._subParams,d,_))}return a}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=a>o?o:a}}addSubParam(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=a>o?o:a,this._subParamsIdx[this.length-1]++}}hasSubParams(a){return(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)>0}getSubParams(a){let n=this._subParamsIdx[a]>>8,d=255&this._subParamsIdx[a];return d-n>0?this._subParams.subarray(n,d):null}getSubParamsAll(){let a={};for(let n=0;n<this.length;++n){let d=this._subParamsIdx[n]>>8,_=255&this._subParamsIdx[n];_-d>0&&(a[n]=this._subParams.slice(d,_))}return a}addDigit(a){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,_=d[n-1];d[n-1]=~_?Math.min(10*_+a,o):a}}s.Params=c},5741:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){let f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let c=o(3785),f=o(511);s.BufferApiView=class{constructor(a,n){this._buffer=a,this.type=n}init(a){return this._buffer=a,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(a){let n=this._buffer.lines.get(a);if(n)return new c.BufferLineApiView(n)}getNullCell(){return new f.CellData}}},3785:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let c=o(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,a){if(!(f<0||f>=this._line.length))return a?(this._line.loadCell(f,a),a):this._line.loadCell(f,new c.CellData)}translateToString(f,a,n){return this._line.translateToString(f,a,n)}}},8285:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let c=o(8771),f=o(8460),a=o(844);class n extends a.Disposable{constructor(_){super(),this._core=_,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:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(f=>c(f.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((f,a)=>c(f,a.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(L,s,o){var c=this&&this.__decorate||function(i,t,e,r){var l,v=arguments.length,p=v<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(l=i[g])&&(p=(v<3?l(p):v>3?l(t,e,p):l(t,e))||p);return v>3&&p&&Object.defineProperty(t,e,p),p},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 a=o(8460),n=o(844),d=o(5295),_=o(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let h=s.BufferService=class extends n.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.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 l=e.ybase+e.scrollTop,v=e.ybase+e.scrollBottom;if(e.scrollTop===0){let p=e.lines.isFull;v===e.lines.length-1?p?e.lines.recycle().copyFrom(r):e.lines.push(r.clone()):e.lines.splice(v+1,0,r.clone()),p?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let p=v-l+1;e.lines.shiftElements(l+1,p-1,-1),e.lines.set(v,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 l=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+i,r.ybase),0),l!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};s.BufferService=h=c([f(0,_.IOptionsService)],h)},7994:(L,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(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(L,s,o){var c=this&&this.__decorate||function(r,l,v,p){var g,u=arguments.length,m=u<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,v):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,l,v,p);else for(var y=r.length-1;y>=0;y--)(g=r[y])&&(m=(u<3?g(m):u>3?g(l,v,m):g(l,v))||m);return u>3&&m&&Object.defineProperty(l,v,m),m},f=this&&this.__param||function(r,l){return function(v,p){l(v,p,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let a=o(2585),n=o(8460),d=o(844),_={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 h(r,l){let v=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(v|=64,v|=r.action):(v|=3&r.button,4&r.button&&(v|=64),8&r.button&&(v|=128),r.action===32?v|=32:r.action!==0||l||(v|=3)),v}let i=String.fromCharCode,t={DEFAULT:r=>{let l=[h(r,!1)+32,r.col+32,r.row+32];return l[0]>255||l[1]>255||l[2]>255?"":`\x1B[M${i(l[0])}${i(l[1])}${i(l[2])}`},SGR:r=>{let l=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${h(r,!0)};${r.col};${r.row}${l}`},SGR_PIXELS:r=>{let l=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${h(r,!0)};${r.x};${r.y}${l}`}},e=s.CoreMouseService=class extends d.Disposable{constructor(r,l){super(),this._bufferService=r,this._coreService=l,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 v of Object.keys(_))this.addProtocol(v,_[v]);for(let v of Object.keys(t))this.addEncoding(v,t[v]);this.reset()}addProtocol(r,l){this._protocols[r]=l}addEncoding(r,l){this._encodings[r]=l}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 l=this._encodings[this._activeEncoding](r);return l&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(l):this._coreService.triggerDataEvent(l,!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,l,v){if(v){if(r.x!==l.x||r.y!==l.y)return!1}else if(r.col!==l.col||r.row!==l.row)return!1;return r.button===l.button&&r.action===l.action&&r.ctrl===l.ctrl&&r.alt===l.alt&&r.shift===l.shift}};s.CoreMouseService=e=c([f(0,a.IBufferService),f(1,a.ICoreService)],e)},6975:function(L,s,o){var c=this&&this.__decorate||function(e,r,l,v){var p,g=arguments.length,u=g<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,l):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,l,v);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(u=(g<3?p(u):g>3?p(r,l,u):p(r,l))||u);return g>3&&u&&Object.defineProperty(r,l,u),u},f=this&&this.__param||function(e,r){return function(l,v){r(l,v,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let a=o(1439),n=o(8460),d=o(844),_=o(2585),h=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,l){super(),this._bufferService=e,this._logService=r,this._optionsService=l,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,a.clone)(h),this.decPrivateModes=(0,a.clone)(i)}reset(){this.modes=(0,a.clone)(h),this.decPrivateModes=(0,a.clone)(i)}triggerDataEvent(e,r=!1){if(this._optionsService.rawOptions.disableStdin)return;let l=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&l.ybase!==l.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((v=>v.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,_.IBufferService),f(1,_.ILogService),f(2,_.IOptionsService)],t)},9074:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let c=o(8055),f=o(8460),a=o(844),n=o(6106),d=0,_=0;class h extends a.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,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let r=new i(e);if(r){let l=r.marker.onDispose((()=>r.dispose()));r.onDispose((()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),l.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,l){let v=0,p=0;for(let g of this._decorations.getKeyIterator(r))v=g.options.x??0,p=v+(g.options.width??1),e>=v&&e<p&&(!l||(g.options.layer??"bottom")===l)&&(yield g)}forEachDecorationAtCell(e,r,l,v){this._decorations.forEachByKey(r,(p=>{d=p.options.x??0,_=d+(p.options.width??1),e>=d&&e<_&&(!l||(p.options.layer??"bottom")===l)&&v(p)}))}}s.DecorationService=h;class i extends a.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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let c=o(2585),f=o(8343);class a{constructor(...d){this._entries=new Map;for(let[_,h]of d)this.set(_,h)}set(d,_){let h=this._entries.get(d);return this._entries.set(d,_),h}forEach(d){for(let[_,h]of this._entries.entries())d(_,h)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}s.ServiceCollection=a,s.InstantiationService=class{constructor(){this._services=new a,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 _=(0,f.getServiceDependencies)(n).sort(((t,e)=>t.index-e.index)),h=[];for(let t of _){let e=this._services.get(t.id);if(!e)throw new Error(`[createInstance] ${n.name} depends on UNKNOWN service ${t.id}.`);h.push(e)}let i=_.length>0?_[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,...h)}}},7866:function(L,s,o){var c=this&&this.__decorate||function(i,t,e,r){var l,v=arguments.length,p=v<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,t,e,r);else for(var g=i.length-1;g>=0;g--)(l=i[g])&&(p=(v<3?l(p):v>3?l(t,e,p):l(t,e))||p);return v>3&&p&&Object.defineProperty(t,e,p),p},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 a=o(844),n=o(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},_,h=s.LogService=class extends a.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()))),_=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=h=c([f(0,n.IOptionsService)],h),s.setTraceLogger=function(i){_=i},s.traceCall=function(i,t,e){if(typeof e.value!="function")throw new Error("not supported");let r=e.value;e.value=function(...l){if(_.logLevel!==n.LogLevelEnum.TRACE)return r.apply(this,l);_.trace(`GlyphRenderer#${r.name}(${l.map((p=>JSON.stringify(p))).join(", ")})`);let v=r.apply(this,l);return _.trace(`GlyphRenderer#${r.name} return`,v),v}}},7302:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let c=o(8460),f=o(844),a=o(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:a.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(h){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...s.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,f.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 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: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=s.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=s.DEFAULT_OPTIONS[h]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=n.includes(i)?i:s.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}}s.OptionsService=d},2660:function(L,s,o){var c=this&&this.__decorate||function(d,_,h,i){var t,e=arguments.length,r=e<3?_:i===null?i=Object.getOwnPropertyDescriptor(_,h):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,_,h,i);else for(var l=d.length-1;l>=0;l--)(t=d[l])&&(r=(e<3?t(r):e>3?t(_,h,r):t(_,h))||r);return e>3&&r&&Object.defineProperty(_,h,r),r},f=this&&this.__param||function(d,_){return function(h,i){_(h,i,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let a=o(2585),n=s.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){let _=this._bufferService.buffer;if(d.id===void 0){let l=_.addMarker(_.ybase+_.y),v={data:d,id:this._nextId++,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(v,l))),this._dataByLinkId.set(v.id,v),v.id}let h=d,i=this._getEntryIdKey(h),t=this._entriesWithId.get(i);if(t)return this.addLineToLink(t.id,_.ybase+_.y),t.id;let e=_.addMarker(_.ybase+_.y),r={id:this._nextId++,key:this._getEntryIdKey(h),data:h,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,_){let h=this._dataByLinkId.get(d);if(h&&h.lines.every((i=>i.line!==_))){let i=this._bufferService.buffer.addMarker(_);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,_){let h=d.lines.indexOf(_);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)))}};s.OscLinkService=n=c([f(0,a.IBufferService)],n)},8343:(L,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let o="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 a=function(n,d,_){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(h,i,t){i[o]===i?i[c].push({id:h,index:t}):(i[c]=[{id:h,index:t}],i[o]=i)})(a,n,_)};return a.toString=()=>f,s.serviceRegistry.set(f,a),a}},2585:(L,s,o)=>{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=o(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(a){a[a.TRACE=0]="TRACE",a[a.DEBUG=1]="DEBUG",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.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:(L,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let c=o(8460),f=o(225);class a{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,_,h=!1){return(16777215&d)<<3|(3&_)<<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 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 _=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 _+this.wcwidth(e);let v=d.charCodeAt(t);56320<=v&&v<=57343?e=1024*(e-55296)+v-56320+65536:_+=this.wcwidth(v)}let r=this.charProperties(e,h),l=a.extractWidth(r);a.extractShouldJoin(r)&&(l-=a.extractWidth(h)),_+=l,h=r}return _}charProperties(d,_){return this._activeProvider.charProperties(d,_)}}s.UnicodeService=a}},R={};function O(L){var s=R[L];if(s!==void 0)return s.exports;var o=R[L]={exports:{}};return T[L].call(o.exports,o,o.exports,O),o.exports}var W={};return(()=>{var L=W;Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;let s=O(9042),o=O(3236),c=O(844),f=O(5741),a=O(8285),n=O(7975),d=O(7090),_=["cols","rows"];class h extends c.Disposable{constructor(t){super(),this._core=this.register(new o.Terminal(t)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let e=l=>this._core.options[l],r=(l,v)=>{this._checkReadonlyOptions(l),this._core.options[l]=v};for(let l in this._core.options){let v={get:e.bind(this,l),set:r.bind(this,l)};Object.defineProperty(this._publicOptions,l,v)}}_checkReadonlyOptions(t){if(_.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 a.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")}}L.Terminal=h})(),W})()))});var It=pt((nt,mt)=>{(function(T,R){typeof nt=="object"&&typeof mt=="object"?mt.exports=R():typeof define=="function"&&define.amd?define([],R):typeof nt=="object"?nt.FitAddon=R():T.FitAddon=R()})(self,(()=>(()=>{"use strict";var T={};return(()=>{var R=T;Object.defineProperty(R,"__esModule",{value:!0}),R.FitAddon=void 0,R.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 W=this._terminal._core;this._terminal.rows===O.rows&&this._terminal.cols===O.cols||(W._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,W=O._renderService.dimensions;if(W.css.cell.width===0||W.css.cell.height===0)return;let L=this._terminal.options.scrollback===0?0:O.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(s.getPropertyValue("height")),c=Math.max(0,parseInt(s.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),a=o-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),n=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-L;return{cols:Math.max(2,Math.floor(n/W.css.cell.width)),rows:Math.max(1,Math.floor(a/W.css.cell.height))}}}})(),T})()))});var Ot=pt((ot,bt)=>{(function(T,R){typeof ot=="object"&&typeof bt=="object"?bt.exports=R():typeof define=="function"&&define.amd?define([],R):typeof ot=="object"?ot.SearchAddon=R():T.SearchAddon=R()})(self,(()=>(()=>{"use strict";var T={345:(L,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=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o((f=>c.fire(f)))},s.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},859:(L,s)=>{function o(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=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}}},R={};function O(L){var s=R[L];if(s!==void 0)return s.exports;var o=R[L]={exports:{}};return T[L](o,o.exports,O),o.exports}var W={};return(()=>{var L=W;Object.defineProperty(L,"__esModule",{value:!0}),L.SearchAddon=void 0;let s=O(345),o=O(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class f extends o.Disposable{constructor(n){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new o.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new o.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,o.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,o.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 _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||_)&&this._highlightAllMatches(n,d);let h=this._findNextAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,h}_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 _=[],h,i=this._find(n,0,0,d);for(;i&&(h?.row!==i.row||h?.col!==i.col)&&!(_.length>=this._highlightLimit);)h=i,_.push(h),i=this._find(n,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 _){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,_,h){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(_>this._terminal.cols)throw new Error(`Invalid col: ${_} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let t={startRow:d,startCol:_};if(i=this._findInLine(n,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(n,t,h),!i);e++);return i}_findNextAndSelect(n,d){if(!this._terminal||!n||n.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,i=0;_&&(this._cachedSearchTerm===n?(h=_.end.x,i=_.end.y):(h=_.start.x,i=_.start.y)),this._initLinesCache();let t={startRow:i,startCol:h},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&&_&&(t.startRow=_.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 _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,d);this._lastSearchOptions=d,d?.decorations&&(this._cachedSearchTerm===void 0||n!==this._cachedSearchTerm||_)&&this._highlightAllMatches(n,d);let h=this._findPreviousAndSelect(n,d);return this._fireResults(d),this._cachedSearchTerm=n,h}_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 _=this._selectedDecoration.value.match;for(let h=0;h<this._highlightDecorations.length;h++){let i=this._highlightDecorations[h].match;if(i.row===_.row&&i.col===_.col&&i.size===_.size){d=h;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 _=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},r;if(_&&(e.startRow=h=_.start.y,e.startCol=i=_.start.x,this._cachedSearchTerm!==n&&(r=this._findInLine(n,e,d,!1),r||(e.startRow=h=_.end.y,e.startCol=i=_.end.x))),r||(r=this._findInLine(n,e,d,t)),!r){e.startCol=Math.max(e.startCol,this._terminal.cols);for(let l=h-1;l>=0&&(e.startRow=l,r=this._findInLine(n,e,d,t),!r);l--);}if(!r&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=h&&(e.startRow=l,r=this._findInLine(n,e,d,t),!r);l--);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,o.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,_){return(n===0||c.includes(d[n-1]))&&(n+_.length===d.length||c.includes(d[n+_.length]))}_findInLine(n,d,_={},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(n,d,_));let l=this._linesCache?.[t];l||(l=this._translateBufferLineToStringWithWrap(t,!0),this._linesCache&&(this._linesCache[t]=l));let[v,p]=l,g=this._bufferColsToStringOffset(t,e),u=_.caseSensitive?n:n.toLowerCase(),m=_.caseSensitive?v:v.toLowerCase(),y=-1;if(_.regex){let x=RegExp(u,"g"),S;if(h)for(;S=x.exec(m.slice(0,g));)y=x.lastIndex-S[0].length,n=S[0],x.lastIndex-=n.length-1;else S=x.exec(m.slice(g)),S&&S[0].length>0&&(y=g+(x.lastIndex-S[0].length),n=S[0])}else h?g-u.length>=0&&(y=m.lastIndexOf(u,g-u.length)):y=m.indexOf(u,g);if(y>=0){if(_.wholeWord&&!this._isWholeWord(y,m,n))return;let x=0;for(;x<p.length-1&&y>=p[x+1];)x++;let S=x;for(;S<p.length-1&&y+n.length>=p[S+1];)S++;let w=y-p[x],A=y+n.length-p[S],z=this._stringLengthToBufferSize(t+x,w);return{term:n,col:z,row:t+x,size:this._stringLengthToBufferSize(t+S,A)-z+i.cols*(S-x)}}}_stringLengthToBufferSize(n,d){let _=this._terminal.buffer.active.getLine(n);if(!_)return 0;for(let h=0;h<d;h++){let i=_.getCell(h);if(!i)break;let t=i.getChars();t.length>1&&(d-=t.length-1);let e=_.getCell(h+1);e&&e.getWidth()===0&&d++}return d}_bufferColsToStringOffset(n,d){let _=this._terminal,h=n,i=0,t=_.buffer.active.getLine(h);for(;d>0&&t;){for(let e=0;e<d&&e<_.cols;e++){let r=t.getCell(e);if(!r)break;r.getWidth()&&(i+=r.getCode()===0?1:r.getChars().length)}if(h++,t=_.buffer.active.getLine(h),t&&!t.isWrapped)break;d-=_.cols}return i}_translateBufferLineToStringWithWrap(n,d){let _=this._terminal,h=[],i=[0],t=_.buffer.active.getLine(n);for(;t;){let e=_.buffer.active.getLine(n+1),r=!!e&&e.isWrapped,l=t.translateToString(!r&&d);if(r&&e){let v=t.getCell(t.length-1);v&&v.getCode()===0&&v.getWidth()===1&&e.getCell(0)?.getWidth()===2&&(l=l.slice(0,-1))}if(h.push(l),!r)break;i.push(i[i.length-1]+l.length),n++,t=e}return[h.join(""),i]}_selectResult(n,d,_){let h=this._terminal;if(this._selectedDecoration.clear(),!n)return h.clearSelection(),!1;if(h.select(n.col,n.row,n.size),d){let i=h.registerMarker(-h.buffer.active.baseY-h.buffer.active.cursorY+n.row);if(i){let t=h.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,o.disposeArray)(e)))),this._selectedDecoration.value={decoration:t,match:n,dispose(){t.dispose()}}}}}if(!_&&(n.row>=h.buffer.active.viewportY+h.rows||n.row<h.buffer.active.viewportY)){let i=n.row-h.buffer.active.viewportY;i-=Math.floor(h.rows/2),h.scrollLines(i)}return!0}_applyStyles(n,d,_){n.classList.contains("xterm-find-result-decoration")||(n.classList.add("xterm-find-result-decoration"),d&&(n.style.outline=`1px solid ${d}`)),_&&n.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(n,d){let _=this._terminal,h=_.registerMarker(-_.buffer.active.baseY-_.buffer.active.cursorY+n.row);if(!h)return;let i=_.registerDecoration({marker:h,x:n.col,width:n.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,o.disposeArray)(t))))}return i}}L.SearchAddon=f})(),W})()))});var ki={};fi(ki,{apply:()=>xi,inject:()=>wi});module.exports=_i(ki);var pe=require("react");var ee=require("react");var le="zTerm";async function ie(T,R,O={},W){let L=T.connection;if(!L?.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 L.rpc.call("/api",`zterm/${R}`,O,W);if(!s.ok)throw new Error(s.error?.message||`${le} \u8BF7\u6C42\u5931\u8D25`);return s.value}function it(T,R,O="text/plain;charset=utf-8"){let W=URL.createObjectURL(new Blob([R],{type:O})),L=document.createElement("a");L.href=W,L.download=T,L.click(),URL.revokeObjectURL(W)}function rt(){return new Date().toISOString().replace(/[-:]/g,"").replace(/T/,"-").slice(0,15)}function At(T,R=Date.now()){if(!T)return;let O=Date.parse(T);if(!Number.isFinite(O))return;let W=Math.floor((R-O)/1e3);if(!(W<2))return W<60?`\u5DF2 ${W} \u79D2`:`\u5DF2 ${Math.floor(W/60)} \u5206 ${W%60} \u79D2`}var Rt=0;function Tt(T,R){let O=new Map(T);if(R.reset){O.clear();for(let s of R.snapshots??[])O.set(s.terminalId,{generation:s.generation,text:s.text,seq:R.cursor,epoch:++Rt,end:s.text.length})}let W=new Map,L=s=>({generation:s,seq:Number.NEGATIVE_INFINITY,base:"",parts:[],epoch:++Rt,end:0});for(let s of R.output??[]){let o=O.get(s.terminalId),c=W.get(s.terminalId);c?c.generation!==s.generation&&(c=L(s.generation),W.set(s.terminalId,c)):(c=o&&o.generation===s.generation?{generation:s.generation,seq:o.seq,base:o.text,parts:[],epoch:o.epoch,end:o.end}:L(s.generation),W.set(s.terminalId,c)),!(s.seq<=c.seq)&&(c.seq=s.seq,c.parts.push(s.text),c.end+=s.text.length)}for(let[s,o]of W)o.parts.length&&O.set(s,{generation:o.generation,text:`${o.base}${o.parts.join("")}`.slice(-5e5),seq:o.seq,epoch:o.epoch,end:o.end});for(let s of O.keys())R.workspace.terminals.some(o=>o.id===s)||O.delete(s);return O}var he=require("react"),Ut=vt(Bt(),1),$t=vt(It(),1),jt=vt(Ot(),1);var Ve=require("react");function ze(T,R,O,W){try{let L=localStorage.getItem(T),s=L===null?R:Number(L);return Number.isFinite(s)?Math.max(O,Math.min(W,s)):R}catch{return R}}function Pe(T,R){try{localStorage.setItem(T,String(R))}catch{}}var qe=12,at=8,lt=32,St="dsh-zterm.terminal-font-size",Xe=new Set,ht;function Pt(T){return Number.isInteger(T)&&T>=at&&T<=lt}function Ct(){try{let T=localStorage.getItem(St),R=T===null?qe:Number(T);return Pt(R)?R:qe}catch{return ht??qe}}function Ht(){return ht??=Ct()}function Nt(T){T!==Ht()&&(ht=T,Xe.forEach(R=>R()))}function Ft(T){Pt(T)&&(Nt(T),Pe(St,T))}function zt(T){(T.key===St||T.key===null)&&Nt(Ct())}function pi(T){return!Xe.size&&typeof window<"u"&&(ht=Ct(),window.addEventListener("storage",zt)),Xe.add(T),()=>{Xe.delete(T),!Xe.size&&typeof window<"u"&&window.removeEventListener("storage",zt)}}function ct(){return(0,Ve.useSyncExternalStore)(pi,Ht,()=>qe)}function Ge(){let T=(0,Ve.useRef)(()=>{});return(0,Ve.useEffect)(()=>()=>T.current(),[]),(R,O)=>{R.preventDefault(),T.current();let W=()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",W),T.current=()=>{}};T.current=W,window.addEventListener("mousemove",O),window.addEventListener("mouseup",W,{once:!0})}}var Re=require("react/jsx-runtime"),vi=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.userAgentData?.platform||navigator.platform||"");function gi(T){return(/^[a-z]$/i.test(T.key)?T.key.toLowerCase()==="f":T.code==="KeyF")&&!T.altKey&&(vi?T.metaKey&&!T.ctrlKey&&!T.shiftKey:T.ctrlKey&&T.shiftKey&&!T.metaKey)}var mi=/^(?:\x1b\[[?>]?[\d;]*[cnRt]|\x1b\[\??\d+;\d+\$y|\x1bP[01]\$r[^\x1b]*\x1b\\|\x1b\][\d;]+;rgb:[\da-fA-F/]+(?:\x1b\\|\x07))+$/,Wt={epoch:-1,end:0,text:""};function Kt({ctx:T,sessionId:R,terminal:O,buffer:W,visible:L,onError:s}){let o=(0,he.useRef)(null),c=(0,he.useRef)(),f=(0,he.useRef)(),a=(0,he.useRef)(),n=(0,he.useRef)(Wt),d=(0,he.useRef)(O),_=(0,he.useRef)(s),h=(0,he.useRef)(Promise.resolve()),i=(0,he.useRef)(()=>{}),t=(0,he.useRef)(()=>{}),e=(0,he.useRef)(()=>{}),r=(0,he.useRef)(!1),[l,v]=(0,he.useState)(""),p=ct(),g=(0,he.useRef)(p),u=(0,he.useRef)(W);g.current=p,u.current=W,d.current=O,_.current=s;let m=()=>{let x=c.current,S=u.current,w=r.current;if(r.current=!1,!x||!S||S.generation!==d.current.generation)return;let A=n.current;if(A.epoch===S.epoch&&A.end===S.end)return;let z=A.epoch===S.epoch?A.end-(S.end-S.text.length):-1;z>=0&&z<=S.text.length?e.current(S.text.slice(z),w):S.text.startsWith(A.text)?e.current(S.text.slice(A.text.length),w||!!A.text):(x.reset(),e.current(S.text,!0)),n.current={epoch:S.epoch,end:S.end,text:S.text}},y=()=>{if(c.current||!o.current)return;let x=o.current,S=new Ut.Terminal({cursorBlink:!0,fontSize:g.current,fontFamily:"Menlo, Consolas, monospace",scrollback:5e3,allowProposedApi:!1,convertEol:!1,theme:{background:"#12161d",foreground:"#dce3ed",cursor:"#e4edf8",selectionBackground:"#334b66"}}),w=new $t.FitAddon,A=new jt.SearchAddon;S.loadAddon(w),S.loadAddon(A),S.open(x),c.current=S,a.current=w,f.current=A,n.current=Wt;let z=!1,U=0;e.current=(D,P)=>{if(D){if(!P){S.write(D);return}U++,S.write(D,()=>{U--})}};let q=S.onData(D=>{let P=d.current;P.state==="ready"&&(U>0&&mi.test(D)||(h.current=h.current.catch(()=>{}).then(async()=>{z||await ie(T,"input",{sessionId:R,terminalId:P.id,generation:P.generation,data:D})}).catch(K=>{z||_.current(K.message)})))}),$;i.current=()=>{if(z||!o.current?.clientWidth)return;w.fit();let D=d.current;D.state==="ready"&&ie(T,"resize",{sessionId:R,terminalId:D.id,generation:D.generation,cols:S.cols,rows:S.rows}).catch(P=>{z||_.current(P.message)})};let b=()=>{clearTimeout($),$=setTimeout(()=>i.current(),80)},E=new ResizeObserver(b);E.observe(x),b();let k=D=>{gi(D)&&(D.preventDefault(),D.stopPropagation(),document.getElementById(`zterm-find-${O.id}`)?.focus())};x.addEventListener("keydown",k,!0),t.current=()=>{z=!0,i.current=()=>{},e.current=()=>{},clearTimeout($),E.disconnect(),q.dispose(),x.removeEventListener("keydown",k,!0),S.dispose(),c.current=void 0}};return(0,he.useLayoutEffect)(()=>()=>{t.current(),t.current=()=>{}},[T,R,O.id,O.generation]),(0,he.useLayoutEffect)(()=>{L&&(y(),r.current=!0,m())},[L,T,R,O.id,O.generation]),(0,he.useEffect)(()=>{L&&m()},[W,O.generation]),(0,he.useLayoutEffect)(()=>{let x=c.current;!L||!x||x.options.fontSize===p||(x.options.fontSize=p,i.current())},[p,L]),(0,he.useEffect)(()=>{L&&(i.current(),c.current?.focus())},[L,O.state,O.generation]),(0,Re.jsxs)("div",{className:"zt-terminal-screen",style:{display:L?"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:l,onChange:x=>{v(x.target.value),f.current?.findNext(x.target.value)},onKeyDown:x=>{x.key==="Enter"&&f.current?.findNext(l),x.key==="Escape"&&(v(""),c.current?.focus())}}),(0,Re.jsx)("button",{title:"\u4E0A\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findPrevious(l),children:"\u2191"}),(0,Re.jsx)("button",{title:"\u4E0B\u4E00\u4E2A\u5339\u914D",onClick:()=>f.current?.findNext(l),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:o})]})}var de=require("react");var He={password:"\u5BC6\u7801",key:"\u79C1\u94A5\u5185\u5BB9","key-file":"\u79C1\u94A5\u6587\u4EF6"};var Ee=require("react"),be=require("react/jsx-runtime");function Ye(T){let R=new Map;for(let s of T){let o=s.parentId??"";R.set(o,[...R.get(o)??[],s])}let O=(R.get("")??[]).slice().reverse().map(s=>({...s,depth:0})),W=[],L=new Set;for(;O.length;){let s=O.pop();if(!L.has(s.id)){L.add(s.id),W.push(s);for(let o of(R.get(s.id)??[]).slice().reverse())O.push({...o,depth:s.depth+1})}}return W}function bi({folder:T,onEdit:R,onDelete:O}){let W=(0,Ee.useRef)(null),L=(0,Ee.useRef)(null),s=(0,Ee.useId)(),[o,c]=(0,Ee.useState)(!1);(0,Ee.useEffect)(()=>{let n=W.current;n.setAttribute("popover","auto"),L.current.setAttribute("popovertarget",s);let d=()=>{let _=n.matches(":popover-open");if(c(_),!_)return;let h=L.current.getBoundingClientRect();n.style.left=`${Math.max(8,Math.min(h.right-n.offsetWidth,window.innerWidth-n.offsetWidth-8))}px`,n.style.top=`${Math.max(8,h.bottom+n.offsetHeight+4<=window.innerHeight-8?h.bottom+4:h.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(!o)return;let n=()=>W.current?.hidePopover();return window.addEventListener("resize",n),document.addEventListener("scroll",n,!0),()=>{window.removeEventListener("resize",n),document.removeEventListener("scroll",n,!0)}},[o]);let f=n=>{W.current?.hidePopover(),n(T)},a=n=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;n.preventDefault();let d=[...n.currentTarget.querySelectorAll("button")],_=d.indexOf(document.activeElement),h=n.key==="Home"?0:n.key==="End"?d.length-1:(_+(n.key==="ArrowUp"?-1:1)+d.length)%d.length;d[h]?.focus()};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)("button",{ref:L,className:"zt-folder-action","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${T.label}`,title:"\u6587\u4EF6\u5939\u64CD\u4F5C","aria-haspopup":"menu","aria-controls":s,"aria-expanded":o,children:"\u22EF"}),(0,be.jsxs)("div",{ref:W,id:s,className:"zt-folder-menu",role:"menu","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${T.label}`,onKeyDown:a,children:[(0,be.jsx)("button",{role:"menuitem",onClick:()=>f(R),children:"\u66F4\u540D"}),(0,be.jsx)("button",{role:"menuitem",onClick:()=>f(O),children:"\u5220\u9664"})]})]})}function qt({folders:T,selected:R,onSelect:O,onEdit:W,onDelete:L}){let[s,o]=(0,Ee.useState)(new Set),c=Ye(T),f=new Set,a=new Set(T.map(n=>n.parentId));return(0,be.jsxs)("nav",{className:"zt-folder-tree","aria-label":"\u4E3B\u673A\u6587\u4EF6\u5939",children:[(0,be.jsx)("button",{className:R===""?"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,be.jsxs)("div",{style:{paddingLeft:`min(${Math.min(8,n.depth)*12}px, 25%)`},children:[(0,be.jsx)("button",{className:"zt-folder-toggle","aria-label":`${s.has(n.id)?"\u5C55\u5F00":"\u6536\u8D77"}\u6587\u4EF6\u5939 ${n.label}`,disabled:!a.has(n.id),onClick:()=>o(d=>{let _=new Set(d);return _.has(n.id)?_.delete(n.id):_.add(n.id),_}),children:a.has(n.id)?s.has(n.id)?"\u25B8":"\u25BE":"\xB7"}),(0,be.jsxs)("button",{className:`zt-folder-name${R===n.id?" active":""}`,onClick:()=>O(n.id),title:n.label,children:["\u25B1 ",n.label]}),(0,be.jsx)(bi,{folder:n,onEdit:W,onDelete:L})]},n.id))]})}var F=require("react/jsx-runtime");function Ne({title:T,children:R,onClose:O}){let W=(0,de.useRef)(null),L=(0,de.useRef)(O);return L.current=O,(0,de.useEffect)(()=>{let s=document.activeElement,o=W.current;(o?.querySelector("input,select,textarea")??o?.querySelector("button")??o)?.focus();let c=f=>{if(f.key==="Escape"){f.preventDefault(),f.stopPropagation(),L.current();return}if(f.key!=="Tab")return;let a=[...o?.querySelectorAll('button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')??[]].filter(_=>_.offsetParent!==null),n=a[0],d=a.at(-1);n?f.shiftKey&&(document.activeElement===n||document.activeElement===o)?(f.preventDefault(),d?.focus()):!f.shiftKey&&document.activeElement===d&&(f.preventDefault(),n.focus()):(f.preventDefault(),o?.focus())};return o?.addEventListener("keydown",c),()=>{o?.removeEventListener("keydown",c),s?.isConnected&&s.focus()}},[]),(0,F.jsx)("div",{className:"zt-modal-shade",onMouseDown:s=>{s.target===s.currentTarget&&O()},children:(0,F.jsxs)("section",{ref:W,tabIndex:-1,className:"zt-modal",role:"dialog","aria-modal":"true","aria-label":T,children:[(0,F.jsxs)("header",{children:[(0,F.jsx)("strong",{children:T}),(0,F.jsx)("button",{"aria-label":"\u5173\u95ED\u5BF9\u8BDD\u6846",onClick:O,children:"\xD7"})]}),R]})})}function _e({title:T,children:R}){return(0,F.jsxs)("label",{className:"zt-field",children:[(0,F.jsx)("span",{children:T}),R]})}function Vt({ctx:T,host:R,folders:O,credentials:W=[],defaultCredentialId:L,revision:s,onClose:o,onSaved:c}){let[f,a]=(0,de.useState)({label:R?.label??"",host:R?.host??"",port:String(R?.port??22),username:R?.username??"",authType:R?.authType??"key-file",privateKeyPath:R?.privateKeyPath??"",folderId:R?.folderId??""}),[n,d]=(0,de.useState)(""),[_,h]=(0,de.useState)(""),[i,t]=(0,de.useState)(!1),[e,r]=(0,de.useState)(""),[l,v]=(0,de.useState)(!1),[p,g]=(0,de.useState)(R?.credentialId||!R&&W.length?"saved":R?.authType??"key-file"),[u,m]=(0,de.useState)(R?.credentialId||L||W[0]?.id||""),y=R&&!R.credentialId&&R.authType===p,x=(S,w)=>a(A=>({...A,[S]:w}));return(0,F.jsx)(Ne,{title:R?"\u7F16\u8F91\u8FDC\u7A0B\u4E3B\u673A":"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A",onClose:o,children:(0,F.jsxs)("form",{onSubmit:S=>{S.preventDefault(),v(!0),r(""),ie(T,"host/save",{host:{...R,...f,credentialId:p==="saved"?u:void 0,folderId:f.folderId||void 0,port:Number(f.port),kind:"ssh"},secret:p==="saved"?"":n,passphrase:p==="saved"?"":_,clearPassphrase:i,revision:s}).then(()=>{d(""),h(""),c(),o()}).catch(w=>r(w.message)).finally(()=>v(!1))},children:[(0,F.jsx)(_e,{title:"\u540D\u79F0",children:(0,F.jsx)("input",{required:!0,value:f.label,onChange:S=>x("label",S.target.value)})}),(0,F.jsxs)("div",{className:"zt-form-row",children:[(0,F.jsx)(_e,{title:"\u4E3B\u673A\u5730\u5740",children:(0,F.jsx)("input",{required:!0,value:f.host,placeholder:"\u4E3B\u673A\u540D\u6216 IP",onChange:S=>x("host",S.target.value)})}),(0,F.jsx)(_e,{title:"\u7AEF\u53E3",children:(0,F.jsx)("input",{type:"number",required:!0,min:"1",max:"65535",value:f.port,onChange:S=>x("port",S.target.value)})})]}),(0,F.jsx)(_e,{title:"\u767B\u5F55\u8D26\u53F7",children:(0,F.jsx)("input",{required:!0,value:f.username,onChange:S=>x("username",S.target.value)})}),(0,F.jsx)(_e,{title:"\u6587\u4EF6\u5939",children:(0,F.jsxs)("select",{value:f.folderId,onChange:S=>x("folderId",S.target.value),children:[(0,F.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).map(S=>(0,F.jsxs)("option",{value:S.id,children:["\u3000".repeat(Math.min(8,S.depth)),S.label]},S.id))]})}),(0,F.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,F.jsxs)("select",{value:p,onChange:S=>{g(S.target.value),S.target.value!=="saved"&&x("authType",S.target.value),d(""),h(""),t(!1)},children:[(0,F.jsx)("option",{value:"saved",children:"\u9009\u62E9\u5DF2\u4FDD\u5B58\u51ED\u8BC1"}),(0,F.jsx)("option",{value:"password",children:"\u5BC6\u7801"}),(0,F.jsx)("option",{value:"key",children:"\u79C1\u94A5\u5185\u5BB9"}),(0,F.jsx)("option",{value:"key-file",children:"\u79C1\u94A5\u6587\u4EF6"})]})}),p==="saved"&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(_e,{title:"\u767B\u5F55\u51ED\u8BC1",children:(0,F.jsxs)("select",{required:!0,value:u,onChange:S=>m(S.target.value),children:[(0,F.jsx)("option",{value:"",children:"\u8BF7\u9009\u62E9\u51ED\u8BC1"}),W.map(S=>(0,F.jsxs)("option",{value:S.id,children:[S.label," \xB7 ",He[S.authType]]},S.id))]})}),(0,F.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(p)&&(0,F.jsx)(_e,{title:f.authType==="key"?"\u79C1\u94A5\u5185\u5BB9":"\u5BC6\u7801",children:f.authType==="key"?(0,F.jsx)("textarea",{rows:5,value:n,placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9",onChange:S=>d(S.target.value),spellCheck:!1,required:!y}):(0,F.jsx)("input",{type:"password",value:n,autoComplete:"new-password",placeholder:y?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:S=>d(S.target.value),required:!y})}),p==="key-file"&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(_e,{title:"\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84",children:(0,F.jsx)("input",{value:f.privateKeyPath,placeholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6",onChange:S=>x("privateKeyPath",S.target.value)})}),(0,F.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(p)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(_e,{title:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09",children:(0,F.jsx)("input",{type:"password",disabled:i,value:_,placeholder:"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4",onChange:S=>h(S.target.value)})}),R?.passphraseRef&&(0,F.jsxs)("label",{className:"zt-check",children:[(0,F.jsx)("input",{type:"checkbox",checked:i,onChange:S=>t(S.target.checked)}),"\u79FB\u9664\u6B64\u4E3B\u673A\u7684\u79C1\u94A5\u53E3\u4EE4\u5F15\u7528"]})]}),(0,F.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,F.jsx)("p",{className:"zt-error",role:"alert",children:e}),(0,F.jsxs)("footer",{children:[(0,F.jsx)("button",{type:"button",onClick:o,children:"\u53D6\u6D88"}),(0,F.jsx)("button",{className:"zt-primary",disabled:l,children:l?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u4E3B\u673A"})]})]})})}function Gt({ctx:T,profile:R,revision:O,onClose:W,onSaved:L}){let[s,o]=(0,de.useState)({label:R?.label??"",baseUrl:R?.baseUrl??"",authMode:R?.authMode??"access_key",username:R?.username??"",verifyTls:R?.verifyTls??!0}),[c,f]=(0,de.useState)(""),[a,n]=(0,de.useState)(""),[d,_]=(0,de.useState)(""),[h,i]=(0,de.useState)(!1);return(0,F.jsx)(Ne,{title:R?"\u7F16\u8F91 JumpServer":"\u6DFB\u52A0 JumpServer",onClose:W,children:(0,F.jsxs)("form",{onSubmit:t=>{t.preventDefault(),i(!0),_(""),ie(T,"jump/save",{profile:{...R,...s},secret:c,accessKeyId:a,revision:O}).then(()=>{f(""),n(""),L(),W()}).catch(e=>_(e.message)).finally(()=>i(!1))},children:[(0,F.jsx)(_e,{title:"\u540D\u79F0",children:(0,F.jsx)("input",{required:!0,value:s.label,onChange:t=>o({...s,label:t.target.value})})}),(0,F.jsx)(_e,{title:"\u670D\u52A1\u5730\u5740",children:(0,F.jsx)("input",{required:!0,type:"url",value:s.baseUrl,placeholder:"https://jump.example.com",onChange:t=>o({...s,baseUrl:t.target.value})})}),(0,F.jsx)(_e,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,F.jsxs)("select",{value:s.authMode,onChange:t=>o({...s,authMode:t.target.value}),children:[(0,F.jsx)("option",{value:"access_key",children:"Access Key"}),(0,F.jsx)("option",{value:"token",children:"Token"}),(0,F.jsx)("option",{value:"password",children:"\u8D26\u53F7\u5BC6\u7801"})]})}),s.authMode==="access_key"&&(0,F.jsx)(_e,{title:"Access Key ID",children:(0,F.jsx)("input",{type:"password",value:a,placeholder:R?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>n(t.target.value)})}),s.authMode==="password"&&(0,F.jsx)(_e,{title:"\u8D26\u53F7",children:(0,F.jsx)("input",{required:!0,value:s.username,onChange:t=>o({...s,username:t.target.value})})}),(0,F.jsx)(_e,{title:s.authMode==="access_key"?"Access Key Secret":s.authMode==="token"?"Token":"\u5BC6\u7801",children:(0,F.jsx)("input",{type:"password",value:c,placeholder:R?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>f(t.target.value)})}),(0,F.jsxs)("label",{className:"zt-check",children:[(0,F.jsx)("input",{type:"checkbox",checked:s.verifyTls,onChange:t=>o({...s,verifyTls:t.target.checked})}),"\u9A8C\u8BC1 TLS \u8BC1\u4E66"]}),(0,F.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,F.jsx)("p",{className:"zt-error",role:"alert",children:d}),(0,F.jsxs)("footer",{children:[(0,F.jsx)("button",{type:"button",onClick:W,children:"\u53D6\u6D88"}),(0,F.jsx)("button",{className:"zt-primary",disabled:h,children:h?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u5B9E\u4F8B"})]})]})})}function Jt({ctx:T,folder:R,folders:O,revision:W,onClose:L,onSaved:s}){let[o,c]=(0,de.useState)(R?.label??""),[f,a]=(0,de.useState)(R?.parentId??""),[n,d]=(0,de.useState)(""),[_,h]=(0,de.useState)(!1),i=new Set;if(R){i.add(R.id);for(let t of Ye(O))t.parentId&&i.has(t.parentId)&&i.add(t.id)}return(0,F.jsx)(Ne,{title:R?"\u7F16\u8F91\u4E3B\u673A\u6587\u4EF6\u5939":"\u65B0\u5EFA\u4E3B\u673A\u6587\u4EF6\u5939",onClose:L,children:(0,F.jsxs)("form",{onSubmit:t=>{t.preventDefault(),h(!0),ie(T,"folder/save",{folder:{id:R?.id,label:o,parentId:f||void 0},revision:W}).then(()=>{s(),L()}).catch(e=>d(e.message)).finally(()=>h(!1))},children:[(0,F.jsx)(_e,{title:"\u540D\u79F0",children:(0,F.jsx)("input",{required:!0,value:o,onChange:t=>c(t.target.value)})}),(0,F.jsx)(_e,{title:"\u7236\u6587\u4EF6\u5939",children:(0,F.jsxs)("select",{value:f,onChange:t=>a(t.target.value),children:[(0,F.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Ye(O).filter(t=>!i.has(t.id)).map(t=>(0,F.jsxs)("option",{value:t.id,children:["\u3000".repeat(Math.min(8,t.depth)),t.label]},t.id))]})}),n&&(0,F.jsx)("p",{className:"zt-error",role:"alert",children:n}),(0,F.jsxs)("footer",{children:[(0,F.jsx)("button",{type:"button",onClick:L,children:"\u53D6\u6D88"}),(0,F.jsx)("button",{disabled:_,className:"zt-primary",children:_?"\u4FDD\u5B58\u4E2D\u2026":R?"\u4FDD\u5B58":"\u521B\u5EFA"})]})]})})}var Ae=require("react");var Me=require("react/jsx-runtime");function Xt({ctx:T,instanceId:R,nodes:O,selected:W,onSelect:L,onError:s}){let[o,c]=(0,Ae.useState)(new Map),[f,a]=(0,Ae.useState)(new Set),[n,d]=(0,Ae.useState)(new Set),_=(0,Ae.useRef)(!0),h=(0,Ae.useRef)(new AbortController);(0,Ae.useEffect)(()=>()=>{_.current=!1,h.current.abort()},[]);let i=async l=>{if(f.has(l.nodeId)){a(v=>{let p=new Set(v);return p.delete(l.nodeId),p});return}if(!o.has(l.nodeId)){d(v=>new Set(v).add(l.nodeId));try{let v=await ie(T,"jump/query",{instanceId:R,operation:"nodes",parentKey:l.key||l.nodeId},h.current.signal);if(!_.current)return;c(p=>new Map(p).set(l.nodeId,v.nodes??[]))}catch(v){_.current&&s(v.message);return}finally{_.current&&d(v=>{let p=new Set(v);return p.delete(l.nodeId),p})}}a(v=>new Set(v).add(l.nodeId))},t=O.slice().reverse().map(l=>({node:l,depth:0})),e=[],r=new Set;for(;t.length&&e.length<500;){let l=t.pop();if(!r.has(l.node.nodeId)&&(r.add(l.node.nodeId),e.push(l),f.has(l.node.nodeId)))for(let v of(o.get(l.node.nodeId)??[]).slice().reverse())t.push({node:v,depth:l.depth+1})}return(0,Me.jsxs)("nav",{className:"zt-folder-tree","aria-label":"JumpServer \u8D44\u4EA7\u8282\u70B9",children:[(0,Me.jsx)("button",{className:W?"":"active",onClick:()=>L(""),children:"\u25A4 \u5168\u90E8\u8D44\u4EA7"}),e.map(({node:l,depth:v})=>(0,Me.jsxs)("div",{style:{paddingLeft:Math.min(8,v)*12},children:[(0,Me.jsx)("button",{className:"zt-folder-toggle",disabled:!l.hasChildren||n.has(l.nodeId),"aria-label":`\u5C55\u5F00\u8D44\u4EA7\u8282\u70B9 ${l.name}`,onClick:()=>void i(l),children:n.has(l.nodeId)?"\u2026":l.hasChildren?f.has(l.nodeId)?"\u25BE":"\u25B8":"\xB7"}),(0,Me.jsxs)("button",{className:W===l.nodeId?"active":"",onClick:()=>L(l.nodeId),title:l.name,children:[l.name," (",l.assetCount,")"]})]},l.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 Fe=require("react");var dt=require("react/jsx-runtime");function wt({children:T,label:R,storageKey:O}){let W=(0,Fe.useRef)(null),L=Ge(),[s,o]=(0,Fe.useState)(()=>ze(O,165,56,Number.MAX_SAFE_INTEGER)),[c,f]=(0,Fe.useState)(165);(0,Fe.useLayoutEffect)(()=>{let i=W.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 a=Math.min(56,c),n=Math.max(a,Math.min(c,s)),d=i=>{let t=Math.max(a,Math.min(c,Math.round(i)));o(t),Pe(O,t)};return(0,dt.jsxs)("div",{ref:W,className:"zt-tree-pane",style:{height:n},children:[T,(0,dt.jsx)("div",{className:"zt-tree-handle",role:"separator","aria-label":R,"aria-orientation":"horizontal",tabIndex:0,"aria-valuemin":a,"aria-valuemax":c,"aria-valuenow":n,onMouseDown:i=>{if(i.button!==0)return;let t=i.clientY,e=W.current?.getBoundingClientRect().height??n;L(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=a;else if(i.key==="End")t=c;else return;i.preventDefault(),d(t)}})]})}var B=require("react/jsx-runtime"),Yt={terminals:[],operations:[],revision:0,capabilities:{local:!1,external:!1},hostPlatform:""},Zt={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:T,sessionId:R,visible:O=!0,onClose:W}){let[L,s]=(0,ee.useState)(Yt),[o,c]=(0,ee.useState)(new Map),[f,a]=(0,ee.useState)(""),[n,d]=(0,ee.useState)(""),[_,h]=(0,ee.useState)(),[i,t]=(0,ee.useState)(""),[e,r]=(0,ee.useState)(0),[l,v]=(0,ee.useState)(""),[p,g]=(0,ee.useState)("ssh"),[u,m]=(0,ee.useState)(!1),[y,x]=(0,ee.useState)(!1),[S,w]=(0,ee.useState)(!1),[A,z]=(0,ee.useState)(""),[U,q]=(0,ee.useState)(""),[$,b]=(0,ee.useState)([]),[E,k]=(0,ee.useState)(),[D,P]=(0,ee.useState)(),[K,Y]=(0,ee.useState)(),[Z,M]=(0,ee.useState)(!1),[C,H]=(0,ee.useState)(!1),[N,V]=(0,ee.useState)(()=>ze("dsh-zterm.list-width",240,180,440)),[j,te]=(0,ee.useState)(!1),[ne,oe]=(0,ee.useState)(!1),[fe,X]=(0,ee.useState)(),Ce=(0,ee.useRef)(!0),We=(0,ee.useRef)(O),Be=(0,ee.useRef)(-1),Ue=(0,ee.useRef)(async()=>{}),Ie=(0,ee.useRef)(f),me=(0,ee.useRef)(0),ke=(0,ee.useRef)(0),we=(0,ee.useRef)(null),Te=(0,ee.useRef)(null),Je=Ge();We.current=O,Ie.current=f;let se=(0,ee.useCallback)(I=>d(I),[]);(0,ee.useEffect)(()=>{Ce.current=!0,s(Yt),c(new Map),Be.current=-1;let I=!1,re=!1,ce,Oe,Ke=new AbortController,ai=async()=>{try{re||(await ie(T,"client/attach",{sessionId:R,pageId:ut},Ke.signal),re=!0);let De=await ie(T,"poll",{sessionId:R,cursor:Be.current},Ke.signal);if(I)return;Be.current=De.cursor,s(De.workspace),c(_t=>Tt(_t,De)),De.workspace.terminals.some(_t=>_t.id===Ie.current)||a(De.workspace.terminals[0]?.id??"")}catch(De){I||d(De instanceof Error?De.message:"\u65E0\u6CD5\u8BFB\u53D6\u7EC8\u7AEF\u72B6\u6001")}},kt=()=>Oe||(Oe=ai().finally(()=>{Oe=void 0}),Oe),Dt=async()=>{await kt(),I||(ce=setTimeout(Dt,We.current?200:1e3))};return Ue.current=kt,Dt(),ie(T,"saved-workspace",{sessionId:R}).then(De=>{I||oe(De.length>0)}).catch(()=>{}),()=>{I=!0,Ce.current=!1,clearTimeout(ce),Ke.abort()}},[T,R]);let ye=(0,ee.useCallback)(async I=>{let re=++me.current,ce=await ie(T,"catalog",{query:i,offset:e,folderId:l||void 0},I);I?.aborted||re!==me.current||!Ce.current||(h(ce),!A&&ce.jumpservers.length&&z(ce.jumpservers[0].id))},[T,i,e,l,A]);(0,ee.useEffect)(()=>{let I=new AbortController,re=setTimeout(()=>{ye(I.signal).catch(ce=>{I.signal.aborted||se(ce.message)})},150);return()=>{clearTimeout(re),I.abort()}},[ye,se,L.catalogRevision]);let ae=(0,ee.useCallback)(async(I,re={})=>{te(!0),d("");try{let ce=await ie(T,I,{sessionId:R,pageId:ut,...re});if(Ce.current)return await Ue.current(),ce}catch(ce){Ce.current&&se(ce instanceof Error?ce.message:"\u64CD\u4F5C\u5931\u8D25")}finally{Ce.current&&te(!1)}},[T,R,se]),Le=async I=>{let re=await ae("connect",{target:I});re?.id&&a(re.id)};(0,ee.useEffect)(()=>{if(!O||!we.current)return;let I=()=>Te.current?.scrollIntoView({block:"nearest",inline:"nearest"});I();let re=new ResizeObserver(I);return re.observe(we.current),()=>re.disconnect()},[f,O,L.terminals.length]);let J=L.terminals.find(I=>I.id===f),xe=L.binding,Ze=J&&xe?.terminalId===J.id&&xe.generation===J.generation,ve=L.terminals.find(I=>I.trust),$e=ve?{terminalId:ve.id,generation:ve.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=J?{terminalId:J.id,generation:J.generation}:{},si=J?L.operations.filter(I=>I.status==="executing"&&I.terminalId===J.id).at(-1)?.startedAt??(J.state==="connecting"?J.createdAt:void 0):void 0,Et=At(si),et=_?.jumpservers?.find(I=>I.id===A);(0,ee.useEffect)(()=>{if(p!=="jumpserver"||!A)return;let I=!0;return b([]),ie(T,"jump/query",{instanceId:A,operation:"nodes"}).then(re=>{I&&b(re.nodes??[])}).catch(re=>{I&&se(re.message)}),()=>{I=!1}},[T,A,p,se]),(0,ee.useEffect)(()=>{if(p!=="jumpserver"||!A)return;let I=!0;k(void 0);let re=setTimeout(()=>{ie(T,"jump/query",{instanceId:A,operation:"assets",nodeId:U||void 0,query:i,offset:e,limit:100}).then(ce=>{I&&k(ce)}).catch(ce=>{I&&se(ce.message)})},200);return()=>{I=!1,clearTimeout(re)}},[T,A,U,i,e,p,se]),(0,ee.useEffect)(()=>{ke.current++,P(void 0)},[A,p]);let ni=async I=>{let re=++ke.current;Y(I),P(void 0);try{let ce=await ie(T,"jump/query",{instanceId:A,operation:"accounts",assetId:I.assetId});re===ke.current&&Ce.current&&P(ce.accounts)}catch(ce){re===ke.current&&Ce.current&&se(ce.message)}},oi=I=>{let re=I.clientX,ce=N;Je(I,Oe=>{let Ke=Math.max(180,Math.min(440,ce+re-Oe.clientX));V(Ke),Pe("dsh-zterm.list-width",Ke)})};return(0,B.jsxs)("div",{className:"zt-workbench",children:[_?.temporarilyDisabled&&(0,B.jsx)("div",{className:"zt-workbench-notice",role:"status",children:"zTerm \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230\u672C\u63D2\u4EF6\u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\uFF1B\u624B\u5DE5\u8FDE\u63A5\u3001\u7EC8\u7AEF\u548C\u914D\u7F6E\u7BA1\u7406\u4ECD\u53EF\u4F7F\u7528\u3002\u53EF\u5728\u300C\u8BBE\u7F6E \u2192 zTerm\u300D\u6062\u590D\u3002"}),n&&(0,B.jsxs)("div",{className:"zt-error-banner",role:"alert",children:[(0,B.jsx)("span",{children:n}),(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:we,className:"zt-terminal-tabs","aria-label":"\u7EC8\u7AEF\u6807\u7B7E",children:L.terminals.map(I=>(0,B.jsxs)("div",{ref:I.id===f?Te:void 0,className:`zt-tab ${I.id===f?"active":""}`,children:[(0,B.jsxs)("button",{onClick:()=>a(I.id),title:Qe(I),children:[(0,B.jsx)("i",{className:`zt-state-dot ${I.state}`}),I.target.label]}),(0,B.jsx)("button",{"aria-label":`\u5173\u95ED\u7EC8\u7AEF ${I.target.label}`,onClick:()=>X({text:`\u5173\u95ED\u300C${I.target.label}\u300D\u7684\u7EC8\u7AEF\u8FDE\u63A5\uFF1F`,act:()=>{ae("close",{terminalId:I.id}),X(void 0)}}),children:"\xD7"})]},I.id))}),(0,B.jsxs)("div",{className:"zt-terminal-controls",children:[(0,B.jsx)("button",{disabled:!L.capabilities.local||j,title:L.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 ${le} \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,B.jsx)("button",{title:"\u64CD\u4F5C\u8BB0\u5F55",onClick:()=>M(!Z),children:"\u8BB0\u5F55"}),C&&(0,B.jsx)("button",{title:"\u663E\u793A\u673A\u5668\u5217\u8868","aria-expanded":!1,onClick:()=>H(!1),children:"\u673A\u5668\u5217\u8868"}),W&&(0,B.jsx)("button",{"aria-label":`\u6536\u8D77 ${le}`,onClick:W,children:"\xD7"})]})]}),J?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-terminal-toolbar",children:[(0,B.jsxs)("div",{className:"zt-target",title:Qe(J),children:[Qe(J),(0,B.jsxs)("span",{children:[Zt[J.state],J.busy?" \xB7 AI \u6267\u884C\u4E2D":"",Et?` \xB7 ${Et}`:""]})]}),(0,B.jsxs)("div",{className:"zt-actions",children:[(0,B.jsx)("button",{disabled:j||J.state!=="ready"||!J.agentReady||J.uncertain,onClick:()=>void ae("bind",je),children:Ze?"\u5DF2\u7ED1\u5B9A AI":"\u7ED1\u5B9A AI"}),(0,B.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,B.jsx)("input",{type:"checkbox","aria-label":"\u5141\u8BB8AI\u5199\u64CD\u4F5C",checked:!!(Ze&&xe.mode==="readwrite"),disabled:!Ze||j||!J.agentReady||J.uncertain,onChange:I=>void ae("mode",{...je,mode:I.target.checked?"readwrite":"read"})}),"\u5141\u8BB8AI\u5199\u64CD\u4F5C"]}),(0,B.jsx)("button",{disabled:!J.busy,onClick:()=>void ae("stop",je),children:"\u505C\u6B62"}),(0,B.jsx)("button",{disabled:j||J.busy,onClick:()=>void ae(J.state==="ready"?"disconnect":"reconnect",je),children:J.state==="ready"?"\u65AD\u5F00":"\u91CD\u8FDE"})]})]}),!J.agentReady&&J.state==="ready"&&!J.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"})]}),J.uncertain&&(0,B.jsxs)("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",(0,B.jsx)("button",{disabled:j||J.busy,onClick:()=>X({text:`\u91CD\u5EFA\u300C${J.target.label}\u300D\u7684\u8FDE\u63A5\uFF1F\u5F53\u524D Shell \u4F1A\u65AD\u5F00\uFF0C\u4ECD\u5728\u524D\u53F0\u8FD0\u884C\u7684\u547D\u4EE4\u53EF\u80FD\u968F\u4E4B\u7EC8\u6B62\uFF0C\u8BF7\u5148\u5728\u7EC8\u7AEF\u6838\u5B9E\u8FDC\u7AEF\u72B6\u6001\u3002`,act:()=>{ae("reconnect",je),X(void 0)}}),children:"\u91CD\u5EFA\u8FDE\u63A5"})]}),J.error&&(0,B.jsx)("div",{className:"zt-notice danger",children:J.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"]}),L.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:L.terminals.map(I=>(0,B.jsx)(Kt,{ctx:T,sessionId:R,terminal:I,buffer:o.get(I.id),visible:O&&I.id===f,onError:se},`${I.id}:${I.generation}`))}),(0,B.jsxs)("footer",{className:"zt-statusbar",children:[(0,B.jsxs)("div",{className:"zt-status-info",children:[(0,B.jsx)("span",{children:xe?`AI \u7ED1\u5B9A\uFF1A${L.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,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 ",L.hostPlatform||"\u6B63\u5728\u8FDE\u63A5"]})]}),J&&(0,B.jsx)("button",{onClick:()=>{ie(T,"terminal/export",{sessionId:R,terminalId:J.id}).then(I=>it(`zterm-${rt()}-\u7EC8\u7AEF.txt`,`\u7EC8\u7AEF\uFF1A${Qe(J)}
8
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(f){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),t.isLinux&&f&&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(f){let m=this._getMouseBufferCoords(f),E=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(E&&k&&m)&&this._areCoordsInSelection(m,E,k)}isCellInSelection(f,m){let E=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!E||!k)&&this._areCoordsInSelection([f,m],E,k)}_areCoordsInSelection(f,m,E){return f[1]>m[1]&&f[1]<E[1]||m[1]===E[1]&&f[1]===m[1]&&f[0]>=m[0]&&f[0]<E[0]||m[1]<E[1]&&f[1]===E[1]&&f[0]<E[0]||m[1]<E[1]&&f[1]===m[1]&&f[0]>=m[0]}_selectWordAtCursor(f,m){let E=this._linkifier.currentLink?.link?.range;if(E)return this._model.selectionStart=[E.start.x-1,E.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(E,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let k=this._getMouseBufferCoords(f);return!!k&&(this._selectWordAt(k,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(f,m){this._model.clearSelection(),f=Math.max(f,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,f],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(f){this._model.handleTrim(f)&&this.refresh()}_getMouseBufferCoords(f){let m=this._mouseService.getCoords(f,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(f){let m=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,f,this._screenElement)[1],E=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=E?0:(m>E&&(m-=E),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(f){return t.isMac?f.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:f.shiftKey}handleMouseDown(f){if(this._mouseDownTimeStamp=f.timeStamp,(f.button!==2||!this.hasSelection)&&f.button===0){if(!this._enabled){if(!this.shouldForceSelection(f))return;f.stopPropagation()}f.preventDefault(),this._dragScrollAmount=0,this._enabled&&f.shiftKey?this._handleIncrementalClick(f):f.detail===1?this._handleSingleClick(f):f.detail===2?this._handleDoubleClick(f):f.detail===3&&this._handleTripleClick(f),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(f){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(f))}_handleSingleClick(f){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(f)?3:0,this._model.selectionStart=this._getMouseBufferCoords(f),!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(f){this._selectWordAtCursor(f,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(f){let m=this._getMouseBufferCoords(f);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(f){return f.altKey&&!(t.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(f){if(f.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(f),!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(f),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let E=this._bufferService.buffer;if(this._model.selectionEnd[1]<E.lines.length){let k=E.lines.get(this._model.selectionEnd[1]);k&&k.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 f=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(f.ydisp+this._bufferService.rows,f.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=f.ydisp),this.refresh()}}_handleMouseUp(f){let m=f.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&f.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let E=this._mouseService.getCoords(f,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(E&&E[0]!==void 0&&E[1]!==void 0){let k=(0,a.moveToCellSequence)(E[0]-1,E[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let f=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,E=!(!f||!m||f[0]===m[0]&&f[1]===m[1]);E?f&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&f[0]===this._oldSelectionStart[0]&&f[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(f,m,E)):this._oldHasSelection&&this._fireOnSelectionChange(f,m,E)}_fireOnSelectionChange(f,m,E){this._oldSelectionStart=f,this._oldSelectionEnd=m,this._oldHasSelection=E,this._onSelectionChange.fire()}_handleBufferActivate(f){this.clearSelection(),this._trimListener.dispose(),this._trimListener=f.activeBuffer.lines.onTrim((m=>this._handleTrim(m)))}_convertViewportColToCharacterIndex(f,m){let E=m;for(let k=0;m>=k;k++){let x=f.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?E--:x>1&&m!==k&&(E+=x-1)}return E}setSelection(f,m,E){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[f,m],this._model.selectionStartLength=E,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(f){this._isClickInSelection(f)||(this._selectWordAtCursor(f,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(f,m,E=!0,k=!0){if(f[0]>=this._bufferService.cols)return;let x=this._bufferService.buffer,C=x.lines.get(f[1]);if(!C)return;let M=x.translateBufferLineToString(f[1],!1),z=this._convertViewportColToCharacterIndex(C,f[0]),j=z,U=f[0]-z,$=0,b=0,L=0,R=0;if(M.charAt(z)===" "){for(;z>0&&M.charAt(z-1)===" ";)z--;for(;j<M.length&&M.charAt(j+1)===" ";)j++}else{let q=f[0],X=f[0];C.getWidth(q)===0&&($++,q--),C.getWidth(X)===2&&(b++,X++);let Y=C.getString(X).length;for(Y>1&&(R+=Y-1,j+=Y-1);q>0&&z>0&&!this._isCharWordSeparator(C.loadCell(q-1,this._workCell));){C.loadCell(q-1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,q--):I>1&&(L+=I-1,z-=I-1),z--,q--}for(;X<C.length&&j+1<M.length&&!this._isCharWordSeparator(C.loadCell(X+1,this._workCell));){C.loadCell(X+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,X++):I>1&&(R+=I-1,j+=I-1),j++,X++}}j++;let T=z+U-$+L,H=Math.min(this._bufferService.cols,j-z+$+b-L-R);if(m||M.slice(z,j).trim()!==""){if(E&&T===0&&C.getCodePoint(0)!==32){let q=x.lines.get(f[1]-1);if(q&&C.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){let X=this._getWordAt([this._bufferService.cols-1,f[1]-1],!1,!0,!1);if(X){let Y=this._bufferService.cols-X.start;T-=Y,H+=Y}}}if(k&&T+H===this._bufferService.cols&&C.getCodePoint(this._bufferService.cols-1)!==32){let q=x.lines.get(f[1]+1);if(q?.isWrapped&&q.getCodePoint(0)!==32){let X=this._getWordAt([0,f[1]+1],!1,!1,!0);X&&(H+=X.length)}}return{start:T,length:H}}}_selectWordAt(f,m){let E=this._getWordAt(f,m);if(E){for(;E.start<0;)E.start+=this._bufferService.cols,f[1]--;this._model.selectionStart=[E.start,f[1]],this._model.selectionStartLength=E.length}}_selectToWordAt(f){let m=this._getWordAt(f,!0);if(m){let E=f[1];for(;m.start<0;)m.start+=this._bufferService.cols,E--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,E++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,E]}}_isCharWordSeparator(f){return f.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(f.getChars())>=0}_selectLineAt(f){let m=this._bufferService.buffer.getWrappedRangeForLine(f),E={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)(E,this._bufferService.cols)}};r.SelectionService=v=c([u(3,d.IBufferService),u(4,d.ICoreService),u(5,_.IMouseService),u(6,d.IOptionsService),u(7,_.IRenderService),u(8,_.ICoreBrowserService)],v)},4725:(D,r,o)=>{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=o(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,o){var c=this&&this.__decorate||function(v,f,m,E){var k,x=arguments.length,C=x<3?f:E===null?E=Object.getOwnPropertyDescriptor(f,m):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(v,f,m,E);else for(var M=v.length-1;M>=0;M--)(k=v[M])&&(C=(x<3?k(C):x>3?k(f,m,C):k(f,m))||C);return x>3&&C&&Object.defineProperty(f,m,C),C},u=this&&this.__param||function(v,f){return function(m,E){f(m,E,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let n=o(7239),a=o(8055),h=o(8460),_=o(844),l=o(2585),i=a.css.toColor("#ffffff"),t=a.css.toColor("#000000"),e=a.css.toColor("#ffffff"),s=a.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let v=[a.css.toColor("#2e3436"),a.css.toColor("#cc0000"),a.css.toColor("#4e9a06"),a.css.toColor("#c4a000"),a.css.toColor("#3465a4"),a.css.toColor("#75507b"),a.css.toColor("#06989a"),a.css.toColor("#d3d7cf"),a.css.toColor("#555753"),a.css.toColor("#ef2929"),a.css.toColor("#8ae234"),a.css.toColor("#fce94f"),a.css.toColor("#729fcf"),a.css.toColor("#ad7fa8"),a.css.toColor("#34e2e2"),a.css.toColor("#eeeeec")],f=[0,95,135,175,215,255];for(let m=0;m<216;m++){let E=f[m/36%6|0],k=f[m/6%6|0],x=f[m%6];v.push({css:a.channels.toCss(E,k,x),rgba:a.channels.toRgba(E,k,x)})}for(let m=0;m<24;m++){let E=8+10*m;v.push({css:a.channels.toCss(E,E,E),rgba:a.channels.toRgba(E,E,E)})}return v})());let g=r.ThemeService=class extends _.Disposable{get colors(){return this._colors}constructor(v){super(),this._optionsService=v,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new h.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:t,cursor:e,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:a.color.blend(t,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:a.color.blend(t,d),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(v={}){let f=this._colors;if(f.foreground=p(v.foreground,i),f.background=p(v.background,t),f.cursor=p(v.cursor,e),f.cursorAccent=p(v.cursorAccent,s),f.selectionBackgroundTransparent=p(v.selectionBackground,d),f.selectionBackgroundOpaque=a.color.blend(f.background,f.selectionBackgroundTransparent),f.selectionInactiveBackgroundTransparent=p(v.selectionInactiveBackground,f.selectionBackgroundTransparent),f.selectionInactiveBackgroundOpaque=a.color.blend(f.background,f.selectionInactiveBackgroundTransparent),f.selectionForeground=v.selectionForeground?p(v.selectionForeground,a.NULL_COLOR):void 0,f.selectionForeground===a.NULL_COLOR&&(f.selectionForeground=void 0),a.color.isOpaque(f.selectionBackgroundTransparent)&&(f.selectionBackgroundTransparent=a.color.opacity(f.selectionBackgroundTransparent,.3)),a.color.isOpaque(f.selectionInactiveBackgroundTransparent)&&(f.selectionInactiveBackgroundTransparent=a.color.opacity(f.selectionInactiveBackgroundTransparent,.3)),f.ansi=r.DEFAULT_ANSI_COLORS.slice(),f.ansi[0]=p(v.black,r.DEFAULT_ANSI_COLORS[0]),f.ansi[1]=p(v.red,r.DEFAULT_ANSI_COLORS[1]),f.ansi[2]=p(v.green,r.DEFAULT_ANSI_COLORS[2]),f.ansi[3]=p(v.yellow,r.DEFAULT_ANSI_COLORS[3]),f.ansi[4]=p(v.blue,r.DEFAULT_ANSI_COLORS[4]),f.ansi[5]=p(v.magenta,r.DEFAULT_ANSI_COLORS[5]),f.ansi[6]=p(v.cyan,r.DEFAULT_ANSI_COLORS[6]),f.ansi[7]=p(v.white,r.DEFAULT_ANSI_COLORS[7]),f.ansi[8]=p(v.brightBlack,r.DEFAULT_ANSI_COLORS[8]),f.ansi[9]=p(v.brightRed,r.DEFAULT_ANSI_COLORS[9]),f.ansi[10]=p(v.brightGreen,r.DEFAULT_ANSI_COLORS[10]),f.ansi[11]=p(v.brightYellow,r.DEFAULT_ANSI_COLORS[11]),f.ansi[12]=p(v.brightBlue,r.DEFAULT_ANSI_COLORS[12]),f.ansi[13]=p(v.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),f.ansi[14]=p(v.brightCyan,r.DEFAULT_ANSI_COLORS[14]),f.ansi[15]=p(v.brightWhite,r.DEFAULT_ANSI_COLORS[15]),v.extendedAnsi){let m=Math.min(f.ansi.length-16,v.extendedAnsi.length);for(let E=0;E<m;E++)f.ansi[E+16]=p(v.extendedAnsi[E],r.DEFAULT_ANSI_COLORS[E+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(v){this._restoreColor(v),this._onChangeColors.fire(this.colors)}_restoreColor(v){if(v!==void 0)switch(v){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[v]=this._restoreColors.ansi[v]}else for(let f=0;f<this._restoreColors.ansi.length;++f)this._colors.ansi[f]=this._restoreColors.ansi[f]}modifyColors(v){v(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 p(v,f){if(v!==void 0)try{return a.css.toColor(v)}catch{}return f}r.ThemeService=g=c([u(0,l.IOptionsService)],g)},6349:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let c=o(8460),u=o(844);class n extends u.Disposable{constructor(h){super(),this._maxLength=h,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(h){if(this._maxLength===h)return;let _=new Array(h);for(let l=0;l<Math.min(h,this.length);l++)_[l]=this._array[this._getCyclicIndex(l)];this._array=_,this._maxLength=h,this._startIndex=0}get length(){return this._length}set length(h){if(h>this._length)for(let _=this._length;_<h;_++)this._array[_]=void 0;this._length=h}get(h){return this._array[this._getCyclicIndex(h)]}set(h,_){this._array[this._getCyclicIndex(h)]=_}push(h){this._array[this._getCyclicIndex(this._length)]=h,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(h,_,...l){if(_){for(let i=h;i<this._length-_;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+_)];this._length-=_,this.onDeleteEmitter.fire({index:h,amount:_})}for(let i=this._length-1;i>=h;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(h+i)]=l[i];if(l.length&&this.onInsertEmitter.fire({index:h,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(h){h>this._length&&(h=this._length),this._startIndex+=h,this._length-=h,this.onTrimEmitter.fire(h)}shiftElements(h,_,l){if(!(_<=0)){if(h<0||h>=this._length)throw new Error("start argument out of range");if(h+l<0)throw new Error("Cannot shift elements in list beyond index 0");if(l>0){for(let t=_-1;t>=0;t--)this.set(h+t+l,this.get(h+t));let i=h+_+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<_;i++)this.set(h+i+l,this.get(h+i))}}_getCyclicIndex(h){return(this._startIndex+h)%this._maxLength}}r.CircularList=n},1439:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(c,u=5){if(typeof c!="object")return c;let n=Array.isArray(c)?[]:{};for(let a in c)n[a]=u<=1?c[a]:c[a]&&o(c[a],u-1);return n}},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 o=0,c=0,u=0,n=0;var a,h,_,l,i;function t(s){let d=s.toString(16);return d.length<2?"0"+d:d}function e(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(s){s.toCss=function(d,g,p,v){return v!==void 0?`#${t(d)}${t(g)}${t(p)}${t(v)}`:`#${t(d)}${t(g)}${t(p)}`},s.toRgba=function(d,g,p,v=255){return(d<<24|g<<16|p<<8|v)>>>0},s.toColor=function(d,g,p,v){return{css:s.toCss(d,g,p,v),rgba:s.toRgba(d,g,p,v)}}})(a||(r.channels=a={})),(function(s){function d(g,p){return n=Math.round(255*p),[o,c,u]=i.toChannels(g.rgba),{css:a.toCss(o,c,u,n),rgba:a.toRgba(o,c,u,n)}}s.blend=function(g,p){if(n=(255&p.rgba)/255,n===1)return{css:p.css,rgba:p.rgba};let v=p.rgba>>24&255,f=p.rgba>>16&255,m=p.rgba>>8&255,E=g.rgba>>24&255,k=g.rgba>>16&255,x=g.rgba>>8&255;return o=E+Math.round((v-E)*n),c=k+Math.round((f-k)*n),u=x+Math.round((m-x)*n),{css:a.toCss(o,c,u),rgba:a.toRgba(o,c,u)}},s.isOpaque=function(g){return(255&g.rgba)==255},s.ensureContrastRatio=function(g,p,v){let f=i.ensureContrastRatio(g.rgba,p.rgba,v);if(f)return a.toColor(f>>24&255,f>>16&255,f>>8&255)},s.opaque=function(g){let p=(255|g.rgba)>>>0;return[o,c,u]=i.toChannels(p),{css:a.toCss(o,c,u),rgba:p}},s.opacity=d,s.multiplyOpacity=function(g,p){return n=255&g.rgba,d(g,n*p/255)},s.toColorRGB=function(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}})(h||(r.color=h={})),(function(s){let d,g;try{let p=document.createElement("canvas");p.width=1,p.height=1;let v=p.getContext("2d",{willReadFrequently:!0});v&&(d=v,d.globalCompositeOperation="copy",g=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(p){if(p.match(/#[\da-f]{3,8}/i))switch(p.length){case 4:return o=parseInt(p.slice(1,2).repeat(2),16),c=parseInt(p.slice(2,3).repeat(2),16),u=parseInt(p.slice(3,4).repeat(2),16),a.toColor(o,c,u);case 5:return o=parseInt(p.slice(1,2).repeat(2),16),c=parseInt(p.slice(2,3).repeat(2),16),u=parseInt(p.slice(3,4).repeat(2),16),n=parseInt(p.slice(4,5).repeat(2),16),a.toColor(o,c,u,n);case 7:return{css:p,rgba:(parseInt(p.slice(1),16)<<8|255)>>>0};case 9:return{css:p,rgba:parseInt(p.slice(1),16)>>>0}}let v=p.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(v)return o=parseInt(v[1]),c=parseInt(v[2]),u=parseInt(v[3]),n=Math.round(255*(v[5]===void 0?1:parseFloat(v[5]))),a.toColor(o,c,u,n);if(!d||!g)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=g,d.fillStyle=p,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,c,u,n]=d.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:a.toRgba(o,c,u,n),css:p}}})(_||(r.css=_={})),(function(s){function d(g,p,v){let f=g/255,m=p/255,E=v/255;return .2126*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))}s.relativeLuminance=function(g){return d(g>>16&255,g>>8&255,255&g)},s.relativeLuminance2=d})(l||(r.rgb=l={})),(function(s){function d(p,v,f){let m=p>>24&255,E=p>>16&255,k=p>>8&255,x=v>>24&255,C=v>>16&255,M=v>>8&255,z=e(l.relativeLuminance2(x,C,M),l.relativeLuminance2(m,E,k));for(;z<f&&(x>0||C>0||M>0);)x-=Math.max(0,Math.ceil(.1*x)),C-=Math.max(0,Math.ceil(.1*C)),M-=Math.max(0,Math.ceil(.1*M)),z=e(l.relativeLuminance2(x,C,M),l.relativeLuminance2(m,E,k));return(x<<24|C<<16|M<<8|255)>>>0}function g(p,v,f){let m=p>>24&255,E=p>>16&255,k=p>>8&255,x=v>>24&255,C=v>>16&255,M=v>>8&255,z=e(l.relativeLuminance2(x,C,M),l.relativeLuminance2(m,E,k));for(;z<f&&(x<255||C<255||M<255);)x=Math.min(255,x+Math.ceil(.1*(255-x))),C=Math.min(255,C+Math.ceil(.1*(255-C))),M=Math.min(255,M+Math.ceil(.1*(255-M))),z=e(l.relativeLuminance2(x,C,M),l.relativeLuminance2(m,E,k));return(x<<24|C<<16|M<<8|255)>>>0}s.blend=function(p,v){if(n=(255&v)/255,n===1)return v;let f=v>>24&255,m=v>>16&255,E=v>>8&255,k=p>>24&255,x=p>>16&255,C=p>>8&255;return o=k+Math.round((f-k)*n),c=x+Math.round((m-x)*n),u=C+Math.round((E-C)*n),a.toRgba(o,c,u)},s.ensureContrastRatio=function(p,v,f){let m=l.relativeLuminance(p>>8),E=l.relativeLuminance(v>>8);if(e(m,E)<f){if(E<m){let C=d(p,v,f),M=e(m,l.relativeLuminance(C>>8));if(M<f){let z=g(p,v,f);return M>e(m,l.relativeLuminance(z>>8))?C:z}return C}let k=g(p,v,f),x=e(m,l.relativeLuminance(k>>8));if(x<f){let C=d(p,v,f);return x>e(m,l.relativeLuminance(C>>8))?k:C}return k}},s.reduceLuminance=d,s.increaseLuminance=g,s.toChannels=function(p){return[p>>24&255,p>>16&255,p>>8&255,255&p]}})(i||(r.rgba=i={})),r.toPaddedHex=t,r.contrastRatio=e},8969:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let c=o(844),u=o(2585),n=o(4348),a=o(7866),h=o(744),_=o(7302),l=o(6975),i=o(8460),t=o(1753),e=o(1480),s=o(7994),d=o(9282),g=o(5435),p=o(5981),v=o(2660),f=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event((k=>{this._onScrollApi?.fire(k.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(k){for(let x in k)this.optionsService.options[x]=k[x]}constructor(k){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 n.InstantiationService,this.optionsService=this.register(new _.OptionsService(k)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(h.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(a.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.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(v.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.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((x=>{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((x=>{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 p.WriteBuffer(((x,C)=>this._inputHandler.parse(x,C)))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(k,x){this._writeBuffer.write(k,x)}writeSync(k,x){this._logService.logLevel<=u.LogLevelEnum.WARN&&!f&&(this._logService.warn("writeSync is unreliable and will be removed soon."),f=!0),this._writeBuffer.writeSync(k,x)}input(k,x=!0){this.coreService.triggerDataEvent(k,x)}resize(k,x){isNaN(k)||isNaN(x)||(k=Math.max(k,h.MINIMUM_COLS),x=Math.max(x,h.MINIMUM_ROWS),this._bufferService.resize(k,x))}scroll(k,x=!1){this._bufferService.scroll(k,x)}scrollLines(k,x,C){this._bufferService.scrollLines(k,x,C)}scrollPages(k){this.scrollLines(k*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(k){let x=k-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)}registerEscHandler(k,x){return this._inputHandler.registerEscHandler(k,x)}registerDcsHandler(k,x){return this._inputHandler.registerDcsHandler(k,x)}registerCsiHandler(k,x){return this._inputHandler.registerCsiHandler(k,x)}registerOscHandler(k,x){return this._inputHandler.registerOscHandler(k,x)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let k=!1,x=this.optionsService.rawOptions.windowsPty;x&&x.buildNumber!==void 0&&x.buildNumber!==void 0?k=x.backend==="conpty"&&x.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(k=!0),k?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let k=[];k.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),k.push(this.registerCsiHandler({final:"H"},(()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(let x of k)x.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=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let u=[];for(let n=0;n<this._listeners.length;n++)u.push(this._listeners[n]);for(let n=0;n<u.length;n++)u[n].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(o,c){return o((u=>c.fire(u)))},r.runAndSubscribe=function(o,c){return c(void 0),o((u=>c(u)))}},5435:function(D,r,o){var c=this&&this.__decorate||function($,b,L,R){var T,H=arguments.length,q=H<3?b:R===null?R=Object.getOwnPropertyDescriptor(b,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,b,L,R);else for(var X=$.length-1;X>=0;X--)(T=$[X])&&(q=(H<3?T(q):H>3?T(b,L,q):T(b,L))||q);return H>3&&q&&Object.defineProperty(b,L,q),q},u=this&&this.__param||function($,b){return function(L,R){b(L,R,$)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let n=o(2584),a=o(7116),h=o(2015),_=o(844),l=o(482),i=o(8437),t=o(8460),e=o(643),s=o(511),d=o(3734),g=o(2585),p=o(1480),v=o(6242),f=o(6351),m=o(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},k=131072;function x($,b){if($>24)return b.setWinLines||!1;switch($){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var C;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(C||(r.WindowsOptionsReportType=C={}));let M=0;class z extends _.Disposable{getAttrData(){return this._curAttrData}constructor(b,L,R,T,H,q,X,Y,I=new h.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=L,this._coreService=R,this._logService=T,this._optionsService=H,this._oscLinkService=q,this._coreMouseService=X,this._unicodeService=Y,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.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 j(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((y=>this._activeBuffer=y.activeBuffer))),this._parser.setCsiHandlerFallback(((y,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(y),params:F.toArray()})})),this._parser.setEscHandlerFallback((y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(y)})})),this._parser.setExecuteHandlerFallback((y=>{this._logService.debug("Unknown EXECUTE code: ",{code:y})})),this._parser.setOscHandlerFallback(((y,F,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:y,action:F,data:N})})),this._parser.setDcsHandlerFallback(((y,F,N)=>{F==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(y),action:F,payload:N})})),this._parser.setPrintHandler(((y,F,N)=>this.print(y,F,N))),this._parser.registerCsiHandler({final:"@"},(y=>this.insertChars(y))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(y=>this.scrollLeft(y))),this._parser.registerCsiHandler({final:"A"},(y=>this.cursorUp(y))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(y=>this.scrollRight(y))),this._parser.registerCsiHandler({final:"B"},(y=>this.cursorDown(y))),this._parser.registerCsiHandler({final:"C"},(y=>this.cursorForward(y))),this._parser.registerCsiHandler({final:"D"},(y=>this.cursorBackward(y))),this._parser.registerCsiHandler({final:"E"},(y=>this.cursorNextLine(y))),this._parser.registerCsiHandler({final:"F"},(y=>this.cursorPrecedingLine(y))),this._parser.registerCsiHandler({final:"G"},(y=>this.cursorCharAbsolute(y))),this._parser.registerCsiHandler({final:"H"},(y=>this.cursorPosition(y))),this._parser.registerCsiHandler({final:"I"},(y=>this.cursorForwardTab(y))),this._parser.registerCsiHandler({final:"J"},(y=>this.eraseInDisplay(y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(y=>this.eraseInDisplay(y,!0))),this._parser.registerCsiHandler({final:"K"},(y=>this.eraseInLine(y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(y=>this.eraseInLine(y,!0))),this._parser.registerCsiHandler({final:"L"},(y=>this.insertLines(y))),this._parser.registerCsiHandler({final:"M"},(y=>this.deleteLines(y))),this._parser.registerCsiHandler({final:"P"},(y=>this.deleteChars(y))),this._parser.registerCsiHandler({final:"S"},(y=>this.scrollUp(y))),this._parser.registerCsiHandler({final:"T"},(y=>this.scrollDown(y))),this._parser.registerCsiHandler({final:"X"},(y=>this.eraseChars(y))),this._parser.registerCsiHandler({final:"Z"},(y=>this.cursorBackwardTab(y))),this._parser.registerCsiHandler({final:"`"},(y=>this.charPosAbsolute(y))),this._parser.registerCsiHandler({final:"a"},(y=>this.hPositionRelative(y))),this._parser.registerCsiHandler({final:"b"},(y=>this.repeatPrecedingCharacter(y))),this._parser.registerCsiHandler({final:"c"},(y=>this.sendDeviceAttributesPrimary(y))),this._parser.registerCsiHandler({prefix:">",final:"c"},(y=>this.sendDeviceAttributesSecondary(y))),this._parser.registerCsiHandler({final:"d"},(y=>this.linePosAbsolute(y))),this._parser.registerCsiHandler({final:"e"},(y=>this.vPositionRelative(y))),this._parser.registerCsiHandler({final:"f"},(y=>this.hVPosition(y))),this._parser.registerCsiHandler({final:"g"},(y=>this.tabClear(y))),this._parser.registerCsiHandler({final:"h"},(y=>this.setMode(y))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(y=>this.setModePrivate(y))),this._parser.registerCsiHandler({final:"l"},(y=>this.resetMode(y))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(y=>this.resetModePrivate(y))),this._parser.registerCsiHandler({final:"m"},(y=>this.charAttributes(y))),this._parser.registerCsiHandler({final:"n"},(y=>this.deviceStatus(y))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(y=>this.deviceStatusPrivate(y))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(y=>this.softReset(y))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(y=>this.setCursorStyle(y))),this._parser.registerCsiHandler({final:"r"},(y=>this.setScrollRegion(y))),this._parser.registerCsiHandler({final:"s"},(y=>this.saveCursor(y))),this._parser.registerCsiHandler({final:"t"},(y=>this.windowOptions(y))),this._parser.registerCsiHandler({final:"u"},(y=>this.restoreCursor(y))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(y=>this.insertColumns(y))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(y=>this.deleteColumns(y))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(y=>this.selectProtected(y))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(y=>this.requestMode(y,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(y=>this.requestMode(y,!1))),this._parser.setExecuteHandler(n.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(n.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(n.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(n.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(n.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(n.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(n.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(n.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(n.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new v.OscHandler((y=>(this.setTitle(y),this.setIconName(y),!0)))),this._parser.registerOscHandler(1,new v.OscHandler((y=>this.setIconName(y)))),this._parser.registerOscHandler(2,new v.OscHandler((y=>this.setTitle(y)))),this._parser.registerOscHandler(4,new v.OscHandler((y=>this.setOrReportIndexedColor(y)))),this._parser.registerOscHandler(8,new v.OscHandler((y=>this.setHyperlink(y)))),this._parser.registerOscHandler(10,new v.OscHandler((y=>this.setOrReportFgColor(y)))),this._parser.registerOscHandler(11,new v.OscHandler((y=>this.setOrReportBgColor(y)))),this._parser.registerOscHandler(12,new v.OscHandler((y=>this.setOrReportCursorColor(y)))),this._parser.registerOscHandler(104,new v.OscHandler((y=>this.restoreIndexedColor(y)))),this._parser.registerOscHandler(110,new v.OscHandler((y=>this.restoreFgColor(y)))),this._parser.registerOscHandler(111,new v.OscHandler((y=>this.restoreBgColor(y)))),this._parser.registerOscHandler(112,new v.OscHandler((y=>this.restoreCursorColor(y)))),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 y in a.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:y},(()=>this.selectCharset("("+y))),this._parser.registerEscHandler({intermediates:")",final:y},(()=>this.selectCharset(")"+y))),this._parser.registerEscHandler({intermediates:"*",final:y},(()=>this.selectCharset("*"+y))),this._parser.registerEscHandler({intermediates:"+",final:y},(()=>this.selectCharset("+"+y))),this._parser.registerEscHandler({intermediates:"-",final:y},(()=>this.selectCharset("-"+y))),this._parser.registerEscHandler({intermediates:".",final:y},(()=>this.selectCharset("."+y))),this._parser.registerEscHandler({intermediates:"/",final:y},(()=>this.selectCharset("/"+y)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((y=>(this._logService.error("Parsing error: ",y),y))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new f.DcsHandler(((y,F)=>this.requestStatusString(y,F))))}_preserveStack(b,L,R,T){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=R,this._parseStack.position=T}_logSlowResolvingAsync(b){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([b,new Promise(((L,R)=>setTimeout((()=>R("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,L){let R,T=this._activeBuffer.x,H=this._activeBuffer.y,q=0,X=this._parseStack.paused;if(X){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(R),R;T=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>k&&(q=this._parseStack.position+k)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(y=>String.fromCharCode(y))).join("")}"`),typeof b=="string"?b.split("").map((y=>y.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<k&&(this._parseBuffer=new Uint32Array(Math.min(b.length,k))),X||this._dirtyRowTracker.clearRange(),b.length>k)for(let y=q;y<b.length;y+=k){let F=y+k<b.length?y+k:b.length,N=typeof b=="string"?this._stringDecoder.decode(b.substring(y,F),this._parseBuffer):this._utf8Decoder.decode(b.subarray(y,F),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,N))return this._preserveStack(T,H,N,y),this._logSlowResolvingAsync(R),R}else if(!X){let y=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,y))return this._preserveStack(T,H,y,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===T&&this._activeBuffer.y===H||this._onCursorMove.fire();let Y=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(b,L,R){let T,H,q=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,y=this._coreService.modes.insertMode,F=this._curAttrData,N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-L>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,F);let K=this._parser.precedingJoinState;for(let V=L;V<R;++V){if(T=b[V],T<127&&q){let ne=q[String.fromCharCode(T)];ne&&(T=ne.charCodeAt(0))}let ie=this._unicodeService.charProperties(T,K);H=p.UnicodeService.extractWidth(ie);let he=p.UnicodeService.extractShouldJoin(ie),le=he?p.UnicodeService.extractWidth(K):0;if(K=ie,X&&this._onA11yChar.fire((0,l.stringFromCodePoint)(T)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-le>Y){if(I){let ne=N,G=this._activeBuffer.x-le;for(this._activeBuffer.x=le,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),le>0&&N instanceof i.BufferLine&&N.copyCellsFrom(ne,G,0,le,!1);G<Y;)ne.setCellFromCodepoint(G++,0,1,F)}else if(this._activeBuffer.x=Y-1,H===2)continue}if(he&&this._activeBuffer.x){let ne=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-ne,T,H);for(let G=H-le;--G>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,F)}else if(y&&(N.insertCells(this._activeBuffer.x,H-le,this._activeBuffer.getNullCell(F)),N.getWidth(Y-1)===2&&N.setCellFromCodepoint(Y-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,F)),N.setCellFromCodepoint(this._activeBuffer.x++,T,H,F),H>0)for(;--H;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,F)}this._parser.precedingJoinState=K,this._activeBuffer.x<Y&&R-L>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,F),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,L){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,L):this._parser.registerCsiHandler(b,(R=>!x(R.params[0],this._optionsService.rawOptions.windowOptions)||L(R)))}registerDcsHandler(b,L){return this._parser.registerDcsHandler(b,new f.DcsHandler(L))}registerEscHandler(b,L){return this._parser.registerEscHandler(b,L)}registerOscHandler(b,L){return this._parser.registerOscHandler(b,new v.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);b.hasWidth(this._activeBuffer.x)&&!b.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=b,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+L)}cursorUp(b){let L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){let L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){let L=b.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=b.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=b.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){let L=b.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,L,R,T=!1,H=!1){let q=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);q.replaceCells(L,R,this._activeBuffer.getNullCell(this._eraseAttrData()),H),T&&(q.isWrapped=!1)}_resetBufferLine(b,L=!1){let R=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),R.isWrapped=!1)}eraseInDisplay(b,L=!1){let R;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);R<this._bufferService.rows;R++)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(0);break;case 3:let T=this._activeBuffer.lines.length-this._bufferService.rows;T>0&&(this._activeBuffer.lines.trimStart(T),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-T,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-T,0),this._onScroll.fire(0))}return!0}eraseInLine(b,L=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let L=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let R=this._activeBuffer.ybase+this._activeBuffer.y,T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-T+1;for(;L--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let L=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let R=this._activeBuffer.ybase+this._activeBuffer.y,T;for(T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,T=this._bufferService.rows-1+this._activeBuffer.ybase-T;L--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(b){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let L=b.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(b){let L=b.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=b.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);T.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=b.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);T.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=b.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);T.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=b.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);T.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){let L=this._parser.precedingJoinState;if(!L)return!0;let R=b.params[0]||1,T=p.UnicodeService.extractWidth(L),H=this._activeBuffer.x-T,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),X=new Uint32Array(q.length*R),Y=0;for(let y=0;y<q.length;){let F=q.codePointAt(y)||0;X[Y++]=F,y+=F>65535?2:1}let I=Y;for(let y=1;y<R;++y)X.copyWithin(I,0,Y),I+=Y;return this.print(X,0,I),!0}sendDeviceAttributesPrimary(b){return b.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(b){return b.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let L=0;L<b.length;L++)switch(b.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let L=0;L<b.length;L++)switch(b.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),this._charsetService.setgCharset(1,a.DEFAULT_CHARSET),this._charsetService.setgCharset(2,a.DEFAULT_CHARSET),this._charsetService.setgCharset(3,a.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(b){for(let L=0;L<b.length;L++)switch(b.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let L=0;L<b.length;L++)switch(b.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),b.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(b,L){let R=this._coreService.decPrivateModes,{activeProtocol:T,activeEncoding:H}=this._coreMouseService,q=this._coreService,{buffers:X,cols:Y}=this._bufferService,{active:I,alt:y}=X,F=this._optionsService.rawOptions,N=he=>he?1:2,K=b.params[0];return V=K,ie=L?K===2?4:K===4?N(q.modes.insertMode):K===12?3:K===20?N(F.convertEol):0:K===1?N(R.applicationCursorKeys):K===3?F.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:K===6?N(R.origin):K===7?N(R.wraparound):K===8?3:K===9?N(T==="X10"):K===12?N(F.cursorBlink):K===25?N(!q.isCursorHidden):K===45?N(R.reverseWraparound):K===66?N(R.applicationKeypad):K===67?4:K===1e3?N(T==="VT200"):K===1002?N(T==="DRAG"):K===1003?N(T==="ANY"):K===1004?N(R.sendFocus):K===1005?4:K===1006?N(H==="SGR"):K===1015?4:K===1016?N(H==="SGR_PIXELS"):K===1048?1:K===47||K===1047||K===1049?N(I===y):K===2004?N(R.bracketedPasteMode):0,q.triggerDataEvent(`${n.C0.ESC}[${L?"":"?"}${V};${ie}$y`),!0;var V,ie}_updateAttrColor(b,L,R,T,H){return L===2?(b|=50331648,b&=-16777216,b|=d.AttributeData.fromColorRGB([R,T,H])):L===5&&(b&=-50331904,b|=33554432|255&R),b}_extractColor(b,L,R){let T=[0,0,-1,0,0,0],H=0,q=0;do{if(T[q+H]=b.params[L+q],b.hasSubParams(L+q)){let X=b.getSubParams(L+q),Y=0;do T[1]===5&&(H=1),T[q+Y+1+H]=X[Y];while(++Y<X.length&&Y+q+1+H<T.length);break}if(T[1]===5&&q+H>=2||T[1]===2&&q+H>=5)break;T[1]&&(H=1)}while(++q+L<b.length&&q+H<T.length);for(let X=2;X<T.length;++X)T[X]===-1&&(T[X]=0);switch(T[0]){case 38:R.fg=this._updateAttrColor(R.fg,T[1],T[3],T[4],T[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,T[1],T[3],T[4],T[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,T[1],T[3],T[4],T[5])}return q}_processUnderline(b,L){L.extended=L.extended.clone(),(!~b||b>5)&&(b=1),L.extended.underlineStyle=b,L.fg|=268435456,b===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(b){b.fg=i.DEFAULT_ATTR_DATA.fg,b.bg=i.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;let L=b.length,R,T=this._curAttrData;for(let H=0;H<L;H++)R=b.params[H],R>=30&&R<=37?(T.fg&=-50331904,T.fg|=16777216|R-30):R>=40&&R<=47?(T.bg&=-50331904,T.bg|=16777216|R-40):R>=90&&R<=97?(T.fg&=-50331904,T.fg|=16777224|R-90):R>=100&&R<=107?(T.bg&=-50331904,T.bg|=16777224|R-100):R===0?this._processSGR0(T):R===1?T.fg|=134217728:R===3?T.bg|=67108864:R===4?(T.fg|=268435456,this._processUnderline(b.hasSubParams(H)?b.getSubParams(H)[0]:1,T)):R===5?T.fg|=536870912:R===7?T.fg|=67108864:R===8?T.fg|=1073741824:R===9?T.fg|=2147483648:R===2?T.bg|=134217728:R===21?this._processUnderline(2,T):R===22?(T.fg&=-134217729,T.bg&=-134217729):R===23?T.bg&=-67108865:R===24?(T.fg&=-268435457,this._processUnderline(0,T)):R===25?T.fg&=-536870913:R===27?T.fg&=-67108865:R===28?T.fg&=-1073741825:R===29?T.fg&=2147483647:R===39?(T.fg&=-67108864,T.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):R===49?(T.bg&=-67108864,T.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?H+=this._extractColor(b,H,T):R===53?T.bg|=1073741824:R===55?T.bg&=-1073741825:R===59?(T.extended=T.extended.clone(),T.extended.underlineColor=-1,T.updateExtended()):R===100?(T.fg&=-67108864,T.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,T.bg&=-67108864,T.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let L=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${L};${R}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let L=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${L};${R}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(b){let L=b.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let R=L%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(b){let L=b.params[0]||1,R;return(b.length<2||(R=b.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(b){if(!x(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;let L=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){let L=[],R=b.split(";");for(;R.length>1;){let T=R.shift(),H=R.shift();if(/^\d+$/.exec(T)){let q=parseInt(T);if(U(q))if(H==="?")L.push({type:0,index:q});else{let X=(0,m.parseColor)(H);X&&L.push({type:1,index:q,color:X})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(b){let L=b.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(b,L){this._getCurrentLinkId()&&this._finishHyperlink();let R=b.split(":"),T,H=R.findIndex((q=>q.startsWith("id=")));return H!==-1&&(T=R[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:T,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,L){let R=b.split(";");for(let T=0;T<R.length&&!(L>=this._specialColors.length);++T,++L)if(R[T]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{let H=(0,m.parseColor)(R[T]);H&&this._onColor.fire([{type:1,index:this._specialColors[L],color:H}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;let L=[],R=b.split(";");for(let T=0;T<R.length;++T)if(/^\d+$/.exec(R[T])){let H=parseInt(R[T]);U(H)&&L.push({type:2,index:H})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(E[b[0]],a.CHARSETS[b[1]]||a.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){let b=new s.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){let R=this._activeBuffer.ybase+this._activeBuffer.y+L,T=this._activeBuffer.lines.get(R);T&&(T.fill(b),T.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,L){let R=this._bufferService.buffer,T=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${H}${n.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[T.cursorStyle]-(T.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,L){this._dirtyRowTracker.markRangeDirty(b,L)}}r.InputHandler=z;let j=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($,b){$>b&&(M=$,$=b,b=M),$<this.start&&(this.start=$),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function U($){return 0<=$&&$<256}j=c([u(0,g.IBufferService)],j)},844:(D,r)=>{function o(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=o,r.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(u,n,a){this._data[u]||(this._data[u]={}),this._data[u][n]=a}get(u,n){return this._data[u]?this._data[u][n]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(c,u,n,a,h){this._data.get(c,u)||this._data.set(c,u,new o),this._data.get(c,u).set(n,a,h)}get(c,u,n,a){return this._data.get(c,u)?.get(n,a)}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 o=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;let u=o.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(o)},6106:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;let u=this._getKey(c);if(u===void 0||(o=this._search(u),o===-1)||this._getKey(this._array[o])!==u)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===u);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,u){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do u(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let u=0,n=this._array.length-1;for(;n>=u;){let a=u+n>>1,h=this._getKey(this._array[a]);if(h>c)n=a-1;else{if(!(h<c)){for(;a>0&&this._getKey(this._array[a-1])===c;)a--;return a}u=a+1}}return u}}},7226:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let c=o(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(h){this._tasks.push(h),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(h){this._idleCallback=void 0;let _=0,l=0,i=h.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(_=Date.now(),this._tasks[this._i]()||this._i++,_=Math.max(1,Date.now()-_),l=Math.max(_,l),t=h.timeRemaining(),1.5*l>t)return i-_<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-_))}ms`),void this._start();i=t}this.clear()}}class n extends u{_requestCallback(h){return setTimeout((()=>h(this._createDeadline(16))))}_cancelCallback(h){clearTimeout(h)}_createDeadline(h){let _=Date.now()+h;return{timeRemaining:()=>Math.max(0,_-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(a){return requestIdleCallback(a)}_cancelCallback(a){cancelIdleCallback(a)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(a){this._queue.clear(),this._queue.enqueue(a)}flush(){this._queue.flush()}}},9282:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let c=o(643);r.updateWindowsModeWrappedState=function(u){let n=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),a=n?.get(u.cols-1),h=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);h&&a&&(h.isWrapped=a[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&a[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 o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){let n=new o;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}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=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){let n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,a=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=a}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let c=o(6349),u=o(7226),n=o(3734),a=o(8437),h=o(4634),_=o(511),l=o(643),i=o(4863),t=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,s,d){this._hasScrollback=e,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=a.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=_.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=_.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.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 n.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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,s){return new a.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=a.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 d=this.getNullCell(a.DEFAULT_ATTR_DATA),g=0,p=this._getCorrectBufferLength(s);if(p>this.lines.maxLength&&(this.lines.maxLength=p),this.lines.length>0){if(this._cols<e)for(let f=0;f<this.lines.length;f++)g+=+this.lines.get(f).resize(e,d);let v=0;if(this._rows<s)for(let f=this._rows;f<s;f++)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 a.BufferLine(e,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+v+1?(this.ybase--,v++,this.ydisp>0&&this.ydisp--):this.lines.push(new a.BufferLine(e,d)));else for(let f=this._rows;f>s;f--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(p<this.lines.maxLength){let f=this.lines.length-p;f>0&&(this.lines.trimStart(f),this.ybase=Math.max(this.ybase-f,0),this.ydisp=Math.max(this.ydisp-f,0),this.savedY=Math.max(this.savedY-f,0)),this.lines.maxLength=p}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,s-1),v&&(this.y+=v),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 v=0;v<this.lines.length;v++)g+=+this.lines.get(v).resize(e,d);this._cols=e,this._rows=s,this._memoryCleanupQueue.clear(),g>.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 d=(0,h.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(a.DEFAULT_ATTR_DATA));if(d.length>0){let g=(0,h.reflowLargerCreateNewLayout)(this.lines,d);(0,h.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(e,s,g.countRemoved)}}_reflowLargerAdjustViewport(e,s,d){let g=this.getNullCell(a.DEFAULT_ATTR_DATA),p=d;for(;p-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new a.BufferLine(e,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(e,s){let d=this.getNullCell(a.DEFAULT_ATTR_DATA),g=[],p=0;for(let v=this.lines.length-1;v>=0;v--){let f=this.lines.get(v);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let m=[f];for(;f.isWrapped&&v>0;)f=this.lines.get(--v),m.unshift(f);let E=this.ybase+this.y;if(E>=v&&E<v+m.length)continue;let k=m[m.length-1].getTrimmedLength(),x=(0,h.reflowSmallerGetNewLineLengths)(m,this._cols,e),C=x.length-m.length,M;M=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+C):Math.max(0,this.lines.length-this.lines.maxLength+C);let z=[];for(let R=0;R<C;R++){let T=this.getBlankLine(a.DEFAULT_ATTR_DATA,!0);z.push(T)}z.length>0&&(g.push({start:v+m.length+p,newLines:z}),p+=z.length),m.push(...z);let j=x.length-1,U=x[j];U===0&&(j--,U=x[j]);let $=m.length-C-1,b=k;for(;$>=0;){let R=Math.min(b,U);if(m[j]===void 0)break;if(m[j].copyCellsFrom(m[$],b-R,U-R,R,!0),U-=R,U===0&&(j--,U=x[j]),b-=R,b===0){$--;let T=Math.max($,0);b=(0,h.getWrappedLineTrimmedLength)(m,T,this._cols)}}for(let R=0;R<m.length;R++)x[R]<e&&m[R].setCell(x[R],d);let L=C-M;for(;L-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+p)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+C,this.ybase+s-1)}if(g.length>0){let v=[],f=[];for(let j=0;j<this.lines.length;j++)f.push(this.lines.get(j));let m=this.lines.length,E=m-1,k=0,x=g[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+p);let C=0;for(let j=Math.min(this.lines.maxLength-1,m+p-1);j>=0;j--)if(x&&x.start>E+C){for(let U=x.newLines.length-1;U>=0;U--)this.lines.set(j--,x.newLines[U]);j++,v.push({index:E+1,amount:x.newLines.length}),C+=x.newLines.length,x=g[++k]}else this.lines.set(j,f[E--]);let M=0;for(let j=v.length-1;j>=0;j--)v[j].index+=M,this.lines.onInsertEmitter.fire(v[j]),M+=v[j].amount;let z=Math.max(0,m+p-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(e,s,d=0,g){let p=this.lines.get(e);return p?p.translateToString(s,d,g):""}getWrappedRangeForLine(e){let s=e,d=e;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}setupTabStops(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((d=>{s.line-=d,s.line<0&&s.dispose()}))),s.register(this.lines.onInsert((d=>{s.line>=d.index&&(s.line+=d.amount)}))),s.register(this.lines.onDelete((d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)}))),s.register(s.onDispose((()=>this._removeMarker(s)))),s}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let c=o(3734),u=o(511),n=o(643),a=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let h=0;class _{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,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let d=0;d<i;++d)this.setCell(d,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,a.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[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=t[1],this._data[3*i+0]=2097152|i|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.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,a.stringFromCodePoint)(2097151&t):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,t){return h=3*i,t.content=this._data[h+0],t.fg=this._data[h+1],t.bg=this._data[h+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,a.stringFromCodePoint)(t):2097151&s?(this._combined[i]=(0,a.stringFromCodePoint)(2097151&s)+(0,a.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 d=this.length-i-t-1;d>=0;--d)this.setCell(i+t+d,this.loadCell(i+d,s));for(let d=0;d<t;++d)this.setCell(i+d,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 d=0;d<this.length-i-t;++d)this.setCell(i+d,this.loadCell(i+t+d,s));for(let d=this.length-t;d<this.length;++d)this.setCell(d,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 g=0;g<s.length;g++){let p=parseInt(s[g],10);p>=i&&delete this._combined[p]}let d=Object.keys(this._extendedAttrs);for(let g=0;g<d.length;g++){let p=parseInt(d[g],10);p>=i&&delete this._extendedAttrs[p]}}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 _(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,d){let g=i._data;if(d)for(let v=s-1;v>=0;v--){for(let f=0;f<3;f++)this._data[3*(e+v)+f]=g[3*(t+v)+f];268435456&g[3*(t+v)+2]&&(this._extendedAttrs[e+v]=i._extendedAttrs[t+v])}else for(let v=0;v<s;v++){for(let f=0;f<3;f++)this._data[3*(e+v)+f]=g[3*(t+v)+f];268435456&g[3*(t+v)+2]&&(this._extendedAttrs[e+v]=i._extendedAttrs[t+v])}let p=Object.keys(i._combined);for(let v=0;v<p.length;v++){let f=parseInt(p[v],10);f>=t&&(this._combined[f-t+e]=i._combined[f])}}translateToString(i,t,e,s){t=t??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;t<e;){let g=this._data[3*t+0],p=2097151&g,v=2097152&g?this._combined[t]:p?(0,a.stringFromCodePoint)(p):n.WHITESPACE_CELL_CHAR;if(d+=v,s)for(let f=0;f<v.length;++f)s.push(t);t+=g>>22||1}return s&&s.push(t),d}}r.BufferLine=_},4841:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(D,r)=>{function o(c,u,n){if(u===c.length-1)return c[u].getTrimmedLength();let a=!c[u].hasContent(n-1)&&c[u].getWidth(n-1)===1,h=c[u+1].getWidth(0)===2;return a&&h?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,u,n,a,h){let _=[];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(a>=l&&a<i){l+=e.length-1;continue}let s=0,d=o(e,s,u),g=1,p=0;for(;g<e.length;){let f=o(e,g,u),m=f-p,E=n-d,k=Math.min(m,E);e[s].copyCellsFrom(e[g],p,d,k,!1),d+=k,d===n&&(s++,d=0),p+=k,p===f&&(g++,p=0),d===0&&s!==0&&e[s-1].getWidth(n-1)===2&&(e[s].copyCellsFrom(e[s-1],n-1,d++,1,!1),e[s-1].setCell(n-1,h))}e[s].replaceCells(d,n,h);let v=0;for(let f=e.length-1;f>0&&(f>s||e[f].getTrimmedLength()===0);f--)v++;v>0&&(_.push(l+e.length-v),_.push(v)),l+=e.length-1}return _},r.reflowLargerCreateNewLayout=function(c,u){let n=[],a=0,h=u[a],_=0;for(let l=0;l<c.length;l++)if(h===l){let i=u[++a];c.onDeleteEmitter.fire({index:l-_,amount:i}),l+=i-1,_+=i,h=u[++a]}else n.push(l);return{layout:n,countRemoved:_}},r.reflowLargerApplyNewLayout=function(c,u){let n=[];for(let a=0;a<u.length;a++)n.push(c.get(u[a]));for(let a=0;a<n.length;a++)c.set(a,n[a]);c.length=u.length},r.reflowSmallerGetNewLineLengths=function(c,u,n){let a=[],h=c.map(((t,e)=>o(c,e,u))).reduce(((t,e)=>t+e)),_=0,l=0,i=0;for(;i<h;){if(h-i<n){a.push(h-i);break}_+=n;let t=o(c,l,u);_>t&&(_-=t,l++);let e=c[l].getWidth(_-1)===2;e&&_--;let s=e?n-1:n;a.push(s),i+=s}return a},r.getWrappedLineTrimmedLength=o},5295:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let c=o(8460),u=o(844),n=o(9092);class a extends u.Disposable{constructor(_,l){super(),this._optionsService=_,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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(_){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(_),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(_,l){this._normal.resize(_,l),this._alt.resize(_,l),this.setupTabStops(_)}setupTabStops(_){this._normal.setupTabStops(_),this._alt.setupTabStops(_)}}r.BufferSet=a},511:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let c=o(482),u=o(643),n=o(3734);class a extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(_){let l=new a;return l.setFromCharData(_),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(_){this.fg=_[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let l=!1;if(_[u.CHAR_DATA_CHAR_INDEX].length>2)l=!0;else if(_[u.CHAR_DATA_CHAR_INDEX].length===2){let i=_[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){let t=_[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(i-55296)+t-56320+65536|_[u.CHAR_DATA_WIDTH_INDEX]<<22:l=!0}else l=!0}else this.content=_[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[u.CHAR_DATA_WIDTH_INDEX]<<22;l&&(this.combinedData=_[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|_[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=a},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,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let c=o(8460),u=o(844);class n{get id(){return this._id}constructor(h){this.line=h,this.isDisposed=!1,this._disposables=[],this._id=n._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(h){return this._disposables.push(h),h}}r.Marker=n,n._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 o,c,u;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
9
+ `,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL="\x7F"})(o||(r.C0=o={})),(function(n){n.PAD="\x80",n.HOP="\x81",n.BPH="\x82",n.NBH="\x83",n.IND="\x84",n.NEL="\x85",n.SSA="\x86",n.ESA="\x87",n.HTS="\x88",n.HTJ="\x89",n.VTS="\x8A",n.PLD="\x8B",n.PLU="\x8C",n.RI="\x8D",n.SS2="\x8E",n.SS3="\x8F",n.DCS="\x90",n.PU1="\x91",n.PU2="\x92",n.STS="\x93",n.CCH="\x94",n.MW="\x95",n.SPA="\x96",n.EPA="\x97",n.SOS="\x98",n.SGCI="\x99",n.SCI="\x9A",n.CSI="\x9B",n.ST="\x9C",n.OSC="\x9D",n.PM="\x9E",n.APC="\x9F"})(c||(r.C1=c={})),(function(n){n.ST=`${o.ESC}\\`})(u||(r.C1_ESCAPED=u={}))},7399:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let c=o(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(n,a,h,_){let l={type:0,cancel:!1,key:void 0},i=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?l.key=a?c.C0.ESC+"OA":c.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?l.key=a?c.C0.ESC+"OD":c.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?l.key=a?c.C0.ESC+"OC":c.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(l.key=a?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:l.key=n.ctrlKey?"\b":c.C0.DEL,n.altKey&&(l.key=c.C0.ESC+l.key);break;case 9:if(n.shiftKey){l.key=c.C0.ESC+"[Z";break}l.key=c.C0.HT,l.cancel=!0;break;case 13:l.key=n.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,l.cancel=!0;break;case 27:l.key=c.C0.ESC,n.altKey&&(l.key=c.C0.ESC+c.C0.ESC),l.cancel=!0;break;case 37:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"D",l.key===c.C0.ESC+"[1;3D"&&(l.key=c.C0.ESC+(h?"b":"[1;5D"))):l.key=a?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"C",l.key===c.C0.ESC+"[1;3C"&&(l.key=c.C0.ESC+(h?"f":"[1;5C"))):l.key=a?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"A",h||l.key!==c.C0.ESC+"[1;3A"||(l.key=c.C0.ESC+"[1;5A")):l.key=a?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"B",h||l.key!==c.C0.ESC+"[1;3B"||(l.key=c.C0.ESC+"[1;5B")):l.key=a?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:n.shiftKey||n.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":a?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:l.key=i?c.C0.ESC+"[1;"+(i+1)+"F":a?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:n.shiftKey?l.type=2:n.ctrlKey?l.key=c.C0.ESC+"[5;"+(i+1)+"~":l.key=c.C0.ESC+"[5~";break;case 34:n.shiftKey?l.type=3:n.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(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(h&&!_||!n.altKey||n.metaKey)!h||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?l.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(l.key=c.C0.US),n.key==="@"&&(l.key=c.C0.NUL)):n.keyCode===65&&(l.type=1);else{let t=u[n.keyCode],e=t?.[n.shiftKey?1:0];if(e)l.key=c.C0.ESC+e;else if(n.keyCode>=65&&n.keyCode<=90){let s=n.ctrlKey?n.keyCode-64:n.keyCode+32,d=String.fromCharCode(s);n.shiftKey&&(d=d.toUpperCase()),l.key=c.C0.ESC+d}else if(n.keyCode===32)l.key=c.C0.ESC+(n.ctrlKey?c.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let s=n.code.slice(3,4);n.shiftKey||(s=s.toLowerCase()),l.key=c.C0.ESC+s,l.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?l.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?l.key=c.C0.NUL:n.keyCode>=51&&n.keyCode<=55?l.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?l.key=c.C0.DEL:n.keyCode===219?l.key=c.C0.ESC:n.keyCode===220?l.key=c.C0.FS:n.keyCode===221&&(l.key=c.C0.GS)}return l}},482:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,c=0,u=o.length){let n="";for(let a=c;a<u;++a){let h=o[a];h>65535?(h-=65536,n+=String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):n+=String.fromCharCode(h)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){let u=o.length;if(!u)return 0;let n=0,a=0;if(this._interim){let h=o.charCodeAt(a++);56320<=h&&h<=57343?c[n++]=1024*(this._interim-55296)+h-56320+65536:(c[n++]=this._interim,c[n++]=h),this._interim=0}for(let h=a;h<u;++h){let _=o.charCodeAt(h);if(55296<=_&&_<=56319){if(++h>=u)return this._interim=_,n;let l=o.charCodeAt(h);56320<=l&&l<=57343?c[n++]=1024*(_-55296)+l-56320+65536:(c[n++]=_,c[n++]=l)}else _!==65279&&(c[n++]=_)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){let u=o.length;if(!u)return 0;let n,a,h,_,l=0,i=0,t=0;if(this.interim[0]){let d=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let p,v=0;for(;(p=63&this.interim[++v])&&v<4;)g<<=6,g|=p;let f=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=f-v;for(;t<m;){if(t>=u)return 0;if(p=o[t++],(192&p)!=128){t--,d=!0;break}this.interim[v++]=p,g<<=6,g|=63&p}d||(f===2?g<128?t--:c[l++]=g:f===3?g<2048||g>=55296&&g<=57343||g===65279||(c[l++]=g):g<65536||g>1114111||(c[l++]=g)),this.interim.fill(0)}let e=u-4,s=t;for(;s<u;){for(;!(!(s<e)||128&(n=o[s])||128&(a=o[s+1])||128&(h=o[s+2])||128&(_=o[s+3]));)c[l++]=n,c[l++]=a,c[l++]=h,c[l++]=_,s+=4;if(n=o[s++],n<128)c[l++]=n;else if((224&n)==192){if(s>=u)return this.interim[0]=n,l;if(a=o[s++],(192&a)!=128){s--;continue}if(i=(31&n)<<6|63&a,i<128){s--;continue}c[l++]=i}else if((240&n)==224){if(s>=u)return this.interim[0]=n,l;if(a=o[s++],(192&a)!=128){s--;continue}if(s>=u)return this.interim[0]=n,this.interim[1]=a,l;if(h=o[s++],(192&h)!=128){s--;continue}if(i=(15&n)<<12|(63&a)<<6|63&h,i<2048||i>=55296&&i<=57343||i===65279)continue;c[l++]=i}else if((248&n)==240){if(s>=u)return this.interim[0]=n,l;if(a=o[s++],(192&a)!=128){s--;continue}if(s>=u)return this.interim[0]=n,this.interim[1]=a,l;if(h=o[s++],(192&h)!=128){s--;continue}if(s>=u)return this.interim[0]=n,this.interim[1]=a,this.interim[2]=h,l;if(_=o[s++],(192&_)!=128){s--;continue}if(i=(7&n)<<18|(63&a)<<12|(63&h)<<6|63&_,i<65536||i>1114111)continue;c[l++]=i}}return l}}},225:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let c=o(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]],n=[[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]],a;r.UnicodeV6=class{constructor(){if(this.version="6",!a){a=new Uint8Array(65536),a.fill(1),a[0]=0,a.fill(0,1,32),a.fill(0,127,160),a.fill(2,4352,4448),a[9001]=2,a[9002]=2,a.fill(2,11904,42192),a[12351]=1,a.fill(2,44032,55204),a.fill(2,63744,64256),a.fill(2,65040,65050),a.fill(2,65072,65136),a.fill(2,65280,65377),a.fill(2,65504,65511);for(let h=0;h<u.length;++h)a.fill(0,u[h][0],u[h][1]+1)}}wcwidth(h){return h<32?0:h<127?1:h<65536?a[h]:(function(_,l){let i,t=0,e=l.length-1;if(_<l[0][0]||_>l[e][1])return!1;for(;e>=t;)if(i=t+e>>1,_>l[i][1])t=i+1;else{if(!(_<l[i][0]))return!0;e=i-1}return!1})(h,n)?0:h>=131072&&h<=196605||h>=196608&&h<=262141?2:1}charProperties(h,_){let l=this.wcwidth(h),i=l===0&&_!==0;if(i){let t=c.UnicodeService.extractWidth(_);t===0?i=!1:t>l&&(l=t)}return c.UnicodeService.createPropertyValue(0,l,i)}}},5981:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let c=o(8460),u=o(844);class n extends u.Disposable{constructor(h){super(),this._action=h,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(h,_){if(_!==void 0&&this._syncCalls>_)return void(this._syncCalls=0);if(this._pendingData+=h.length,this._writeBuffer.push(h),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(h,_){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+=h.length,this._writeBuffer.push(h),this._callbacks.push(_),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=h.length,this._writeBuffer.push(h),this._callbacks.push(_)}_innerWrite(h=0,_=!0){let l=h||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],t=this._action(i,_);if(t){let s=d=>Date.now()-l>=12?setTimeout((()=>this._innerWrite(0,d))):this._innerWrite(l,d);return void t.catch((d=>(queueMicrotask((()=>{throw d})),Promise.resolve(!1)))).then(s)}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()}}r.WriteBuffer=n},5941:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function u(n,a){let h=n.toString(16),_=h.length<2?"0"+h:h;switch(a){case 4:return h[0];case 8:return _;case 12:return(_+_).slice(0,3);default:return _+_}}r.parseColor=function(n){if(!n)return;let a=n.toLowerCase();if(a.indexOf("rgb:")===0){a=a.slice(4);let h=o.exec(a);if(h){let _=h[1]?15:h[4]?255:h[7]?4095:65535;return[Math.round(parseInt(h[1]||h[4]||h[7]||h[10],16)/_*255),Math.round(parseInt(h[2]||h[5]||h[8]||h[11],16)/_*255),Math.round(parseInt(h[3]||h[6]||h[9]||h[12],16)/_*255)]}}else if(a.indexOf("#")===0&&(a=a.slice(1),c.exec(a)&&[3,6,9,12].includes(a.length))){let h=a.length/3,_=[0,0,0];for(let l=0;l<3;++l){let i=parseInt(a.slice(h*l,h*l+h),16);_[l]=h===1?i<<4:h===2?i:h===3?i>>4:i>>8}return _}},r.toRgbString=function(n,a=16){let[h,_,l]=n;return`rgb:${u(h,a)}/${u(_,a)}/${u(l,a)}`}},5770:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let c=o(482),u=o(8742),n=o(5770),a=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=a,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}registerHandler(_,l){this._handlers[_]===void 0&&(this._handlers[_]=[]);let i=this._handlers[_];return i.push(l),{dispose:()=>{let t=i.indexOf(l);t!==-1&&i.splice(t,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}reset(){if(this._active.length)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].unhook(!1);this._stack.paused=!1,this._active=a,this._ident=0}hook(_,l){if(this.reset(),this._ident=_,this._active=this._handlers[_]||a,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(_,l,i){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(_,l,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(_,l,i))}unhook(_,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(_),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",_);this._active=a,this._ident=0}};let h=new u.Params;h.addParam(0),r.DcsHandler=class{constructor(_){this._handler=_,this._data="",this._params=h,this._hitLimit=!1}hook(_){this._params=_.length>1||_.params[0]?_.clone():h,this._data="",this._hitLimit=!1}put(_,l,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(_,l,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(_){let l=!1;if(this._hitLimit)l=!1;else if(_&&(l=this._handler(this._data,this._params),l instanceof Promise))return l.then((i=>(this._params=h,this._data="",this._hitLimit=!1,i)));return this._params=h,this._data="",this._hitLimit=!1,l}}},2015:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let c=o(844),u=o(8742),n=o(6242),a=o(6351);class h{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,s,d){this.table[e<<8|t]=s<<4|d}addMany(t,e,s,d){for(let g=0;g<t.length;g++)this.table[e<<8|t[g]]=s<<4|d}}r.TransitionTable=h;let _=160;r.VT500_TRANSITION_TABLE=(function(){let i=new h(4095),t=Array.apply(null,Array(256)).map(((v,f)=>f)),e=(v,f)=>t.slice(v,f),s=e(32,127),d=e(0,24);d.push(25),d.push.apply(d,e(28,32));let g=e(0,14),p;for(p in i.setDefault(1,0),i.addMany(s,0,2,0),g)i.addMany([24,26,153,154],p,3,0),i.addMany(e(128,144),p,3,0),i.addMany(e(144,152),p,3,0),i.add(156,p,0,0),i.add(27,p,11,1),i.add(157,p,4,8),i.addMany([152,158,159],p,0,7),i.add(155,p,11,3),i.add(144,p,11,9);return i.addMany(d,0,3,0),i.addMany(d,1,3,1),i.add(127,1,0,1),i.addMany(d,8,0,8),i.addMany(d,3,3,3),i.add(127,3,0,3),i.addMany(d,4,3,4),i.add(127,4,0,4),i.addMany(d,6,3,6),i.addMany(d,5,3,5),i.add(127,5,0,5),i.addMany(d,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(d,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(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(d,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(d,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(d,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(d,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(d,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(_,0,2,0),i.add(_,8,5,8),i.add(_,6,0,6),i.add(_,11,0,11),i.add(_,13,13,13),i})();class l 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,d)=>{},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 n.OscParser),this._dcsParser=this.register(new a.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 g=0;g<t.intermediates.length;++g){let p=t.intermediates.charCodeAt(g);if(32>p||p>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=p}}if(t.final.length!==1)throw new Error("final must be a single byte");let d=t.final.charCodeAt(0);if(e[0]>d||d>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return s<<=8,s|=d,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 d=this._escHandlers[s];return d.push(e),{dispose:()=>{let g=d.indexOf(e);g!==-1&&d.splice(g,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 d=this._csiHandlers[s];return d.push(e),{dispose:()=>{let g=d.indexOf(e);g!==-1&&d.splice(g,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,d,g){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=g}parse(t,e,s){let d,g=0,p=0,v=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,v=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 f=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&m>-1){for(;m>=0&&(d=f[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._parseStack.handlerPos=m,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&m>-1){for(;m>=0&&(d=f[m](),d!==!0);m--)if(d instanceof Promise)return this._parseStack.handlerPos=m,d}this._parseStack.handlers=[];break;case 6:if(g=t[this._parseStack.chunkPos],d=this._dcsParser.unhook(g!==24&&g!==26,s),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=t[this._parseStack.chunkPos],d=this._oscParser.end(g!==24&&g!==26,s),d)return d;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,v=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let f=v;f<e;++f){switch(g=t[f],p=this._transitions.table[this.currentState<<8|(g<160?g:_)],p>>4){case 2:for(let C=f+1;;++C){if(C>=e||(g=t[C])<32||g>126&&g<_){this._printHandler(t,f,C),f=C-1;break}if(++C>=e||(g=t[C])<32||g>126&&g<_){this._printHandler(t,f,C),f=C-1;break}if(++C>=e||(g=t[C])<32||g>126&&g<_){this._printHandler(t,f,C),f=C-1;break}if(++C>=e||(g=t[C])<32||g>126&&g<_){this._printHandler(t,f,C),f=C-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|g],E=m?m.length-1:-1;for(;E>=0&&(d=m[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._preserveStack(3,m,E,p,f),d;E<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++f<e&&(g=t[f])>47&&g<60);f--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:let k=this._escHandlers[this._collect<<8|g],x=k?k.length-1:-1;for(;x>=0&&(d=k[x](),d!==!0);x--)if(d instanceof Promise)return this._preserveStack(4,k,x,p,f),d;x<0&&this._escHandlerFb(this._collect<<8|g),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|g,this._params);break;case 13:for(let C=f+1;;++C)if(C>=e||(g=t[C])===24||g===26||g===27||g>127&&g<_){this._dcsParser.put(t,f,C),f=C-1;break}break;case 14:if(d=this._dcsParser.unhook(g!==24&&g!==26),d)return this._preserveStack(6,[],0,p,f),d;g===27&&(p|=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 C=f+1;;C++)if(C>=e||(g=t[C])<32||g>127&&g<_){this._oscParser.put(t,f,C),f=C-1;break}break;case 6:if(d=this._oscParser.end(g!==24&&g!==26),d)return this._preserveStack(5,[],0,p,f),d;g===27&&(p|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&p}}}r.EscapeSequenceParser=l},6242:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let c=o(5770),u=o(482),n=[];r.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(a,h){this._handlers[a]===void 0&&(this._handlers[a]=[]);let _=this._handlers[a];return _.push(h),{dispose:()=>{let l=_.indexOf(h);l!==-1&&_.splice(l,1)}}}clearHandler(a){this._handlers[a]&&delete this._handlers[a]}setHandlerFallback(a){this._handlerFb=a}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let a=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;a>=0;--a)this._active[a].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].start();else this._handlerFb(this._id,"START")}_put(a,h,_){if(this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].put(a,h,_);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(a,h,_))}start(){this.reset(),this._state=1}put(a,h,_){if(this._state!==3){if(this._state===1)for(;h<_;){let l=a[h++];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&&_-h>0&&this._put(a,h,_)}}end(a,h=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let _=!1,l=this._active.length-1,i=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,_=h,i=this._stack.fallThrough,this._stack.paused=!1),!i&&_===!1){for(;l>=0&&(_=this._active[l].end(a),_!==!0);l--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,_;l--}for(;l>=0;l--)if(_=this._active[l].end(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,_}else this._handlerFb(this._id,"END",a);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(a){this._handler=a,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(a,h,_){this._hitLimit||(this._data+=(0,u.utf32ToString)(a,h,_),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(a){let h=!1;if(this._hitLimit)h=!1;else if(a&&(h=this._handler(this._data),h instanceof Promise))return h.then((_=>(this._data="",this._hitLimit=!1,_)));return this._data="",this._hitLimit=!1,h}}},8742:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let o=2147483647;class c{static fromArray(n){let a=new c;if(!n.length)return a;for(let h=Array.isArray(n[0])?1:0;h<n.length;++h){let _=n[h];if(Array.isArray(_))for(let l=0;l<_.length;++l)a.addSubParam(_[l]);else a.addParam(_)}return a}constructor(n=32,a=32){if(this.maxLength=n,this.maxSubParamsLength=a,a>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(a),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let n=new c(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){let n=[];for(let a=0;a<this.length;++a){n.push(this.params[a]);let h=this._subParamsIdx[a]>>8,_=255&this._subParamsIdx[a];_-h>0&&n.push(Array.prototype.slice.call(this._subParams,h,_))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>o?o:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>o?o:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let a=this._subParamsIdx[n]>>8,h=255&this._subParamsIdx[n];return h-a>0?this._subParams.subarray(a,h):null}getSubParamsAll(){let n={};for(let a=0;a<this.length;++a){let h=this._subParamsIdx[a]>>8,_=255&this._subParamsIdx[a];_-h>0&&(n[a]=this._subParams.slice(h,_))}return n}addDigit(n){let a;if(this._rejectDigits||!(a=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let h=this._digitIsSub?this._subParams:this.params,_=h[a-1];h[a-1]=~_?Math.min(10*_+n,o):n}}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 o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){let u={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(u),c.dispose=()=>this._wrappedAddonDispose(u),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===o){c=u;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let c=o(3785),u=o(511);r.BufferApiView=class{constructor(n,a){this._buffer=n,this.type=a}init(n){return this._buffer=n,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(n){let a=this._buffer.lines.get(n);if(a)return new c.BufferLineApiView(a)}getNullCell(){return new u.CellData}}},3785:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let c=o(511);r.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,n){if(!(u<0||u>=this._line.length))return n?(this._line.loadCell(u,n),n):this._line.loadCell(u,new c.CellData)}translateToString(u,n,a){return this._line.translateToString(u,n,a)}}},8285:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let c=o(8771),u=o(8460),n=o(844);class a extends n.Disposable{constructor(_){super(),this._core=_,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=a},7975:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(u=>c(u.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((u,n)=>c(u,n.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(D,r,o){var c=this&&this.__decorate||function(i,t,e,s){var d,g=arguments.length,p=g<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,t,e,s);else for(var v=i.length-1;v>=0;v--)(d=i[v])&&(p=(g<3?d(p):g>3?d(t,e,p):d(t,e))||p);return g>3&&p&&Object.defineProperty(t,e,p),p},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 n=o(8460),a=o(844),h=o(5295),_=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let l=r.BufferService=class extends a.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.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 h.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 d=e.ybase+e.scrollTop,g=e.ybase+e.scrollBottom;if(e.scrollTop===0){let p=e.lines.isFull;g===e.lines.length-1?p?e.lines.recycle().copyFrom(s):e.lines.push(s.clone()):e.lines.splice(g+1,0,s.clone()),p?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let p=g-d+1;e.lines.shiftElements(d+1,p-1,-1),e.lines.set(g,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 d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),d!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};r.BufferService=l=c([u(0,_.IOptionsService)],l)},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(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(D,r,o){var c=this&&this.__decorate||function(s,d,g,p){var v,f=arguments.length,m=f<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,d,g,p);else for(var E=s.length-1;E>=0;E--)(v=s[E])&&(m=(f<3?v(m):f>3?v(d,g,m):v(d,g))||m);return f>3&&m&&Object.defineProperty(d,g,m),m},u=this&&this.__param||function(s,d){return function(g,p){d(g,p,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let n=o(2585),a=o(8460),h=o(844),_={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 l(s,d){let g=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(g|=64,g|=s.action):(g|=3&s.button,4&s.button&&(g|=64),8&s.button&&(g|=128),s.action===32?g|=32:s.action!==0||d||(g|=3)),g}let i=String.fromCharCode,t={DEFAULT:s=>{let d=[l(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${i(d[0])}${i(d[1])}${i(d[2])}`},SGR:s=>{let d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${l(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{let d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${l(s,!0)};${s.x};${s.y}${d}`}},e=r.CoreMouseService=class extends h.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new a.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let g of Object.keys(_))this.addProtocol(g,_[g]);for(let g of Object.keys(t))this.addEncoding(g,t[g]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;let d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,g){if(g){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};r.CoreMouseService=e=c([u(0,n.IBufferService),u(1,n.ICoreService)],e)},6975:function(D,r,o){var c=this&&this.__decorate||function(e,s,d,g){var p,v=arguments.length,f=v<3?s:g===null?g=Object.getOwnPropertyDescriptor(s,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,s,d,g);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(f=(v<3?p(f):v>3?p(s,d,f):p(s,d))||f);return v>3&&f&&Object.defineProperty(s,d,f),f},u=this&&this.__param||function(e,s){return function(d,g){s(d,g,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let n=o(1439),a=o(8460),h=o(844),_=o(2585),l=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 h.Disposable{constructor(e,s,d){super(),this._bufferService=e,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new a.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new a.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(l),this.decPrivateModes=(0,n.clone)(i)}reset(){this.modes=(0,n.clone)(l),this.decPrivateModes=(0,n.clone)(i)}triggerDataEvent(e,s=!1){if(this._optionsService.rawOptions.disableStdin)return;let d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((g=>g.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,_.IBufferService),u(1,_.ILogService),u(2,_.IOptionsService)],t)},9074:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let c=o(8055),u=o(8460),n=o(844),a=o(6106),h=0,_=0;class l extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new a.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,n.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let s=new i(e);if(s){let d=s.marker.onDispose((()=>s.dispose()));s.onDispose((()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())})),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,s,d){let g=0,p=0;for(let v of this._decorations.getKeyIterator(s))g=v.options.x??0,p=g+(v.options.width??1),e>=g&&e<p&&(!d||(v.options.layer??"bottom")===d)&&(yield v)}forEachDecorationAtCell(e,s,d,g){this._decorations.forEachByKey(s,(p=>{h=p.options.x??0,_=h+(p.options.width??1),e>=h&&e<_&&(!d||(p.options.layer??"bottom")===d)&&g(p)}))}}r.DecorationService=l;class i extends n.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,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let c=o(2585),u=o(8343);class n{constructor(...h){this._entries=new Map;for(let[_,l]of h)this.set(_,l)}set(h,_){let l=this._entries.get(h);return this._entries.set(h,_),l}forEach(h){for(let[_,l]of this._entries.entries())h(_,l)}has(h){return this._entries.has(h)}get(h){return this._entries.get(h)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(c.IInstantiationService,this)}setService(a,h){this._services.set(a,h)}getService(a){return this._services.get(a)}createInstance(a,...h){let _=(0,u.getServiceDependencies)(a).sort(((t,e)=>t.index-e.index)),l=[];for(let t of _){let e=this._services.get(t.id);if(!e)throw new Error(`[createInstance] ${a.name} depends on UNKNOWN service ${t.id}.`);l.push(e)}let i=_.length>0?_[0].index:h.length;if(h.length!==i)throw new Error(`[createInstance] First service dependency of ${a.name} at position ${i+1} conflicts with ${h.length} static arguments`);return new a(...h,...l)}}},7866:function(D,r,o){var c=this&&this.__decorate||function(i,t,e,s){var d,g=arguments.length,p=g<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(i,t,e,s);else for(var v=i.length-1;v>=0;v--)(d=i[v])&&(p=(g<3?d(p):g>3?d(t,e,p):d(t,e))||p);return g>3&&p&&Object.defineProperty(t,e,p),p},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 n=o(844),a=o(2585),h={trace:a.LogLevelEnum.TRACE,debug:a.LogLevelEnum.DEBUG,info:a.LogLevelEnum.INFO,warn:a.LogLevelEnum.WARN,error:a.LogLevelEnum.ERROR,off:a.LogLevelEnum.OFF},_,l=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=a.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),_=this}_updateLogLevel(){this._logLevel=h[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<=a.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,t)}debug(i,...t){this._logLevel<=a.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,t)}info(i,...t){this._logLevel<=a.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,t)}warn(i,...t){this._logLevel<=a.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,t)}error(i,...t){this._logLevel<=a.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,t)}};r.LogService=l=c([u(0,a.IOptionsService)],l),r.setTraceLogger=function(i){_=i},r.traceCall=function(i,t,e){if(typeof e.value!="function")throw new Error("not supported");let s=e.value;e.value=function(...d){if(_.logLevel!==a.LogLevelEnum.TRACE)return s.apply(this,d);_.trace(`GlyphRenderer#${s.name}(${d.map((p=>JSON.stringify(p))).join(", ")})`);let g=s.apply(this,d);return _.trace(`GlyphRenderer#${s.name} return`,g),g}}},7302:(D,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let c=o(8460),u=o(844),n=o(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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let a=["normal","bold","100","200","300","400","500","600","700","800","900"];class h extends u.Disposable{constructor(l){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...r.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,u.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 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: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=r.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=r.DEFAULT_OPTIONS[l]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=a.includes(i)?i:r.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}}r.OptionsService=h},2660:function(D,r,o){var c=this&&this.__decorate||function(h,_,l,i){var t,e=arguments.length,s=e<3?_:i===null?i=Object.getOwnPropertyDescriptor(_,l):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(h,_,l,i);else for(var d=h.length-1;d>=0;d--)(t=h[d])&&(s=(e<3?t(s):e>3?t(_,l,s):t(_,l))||s);return e>3&&s&&Object.defineProperty(_,l,s),s},u=this&&this.__param||function(h,_){return function(l,i){_(l,i,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let n=o(2585),a=r.OscLinkService=class{constructor(h){this._bufferService=h,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(h){let _=this._bufferService.buffer;if(h.id===void 0){let d=_.addMarker(_.ybase+_.y),g={data:h,id:this._nextId++,lines:[d]};return d.onDispose((()=>this._removeMarkerFromLink(g,d))),this._dataByLinkId.set(g.id,g),g.id}let l=h,i=this._getEntryIdKey(l),t=this._entriesWithId.get(i);if(t)return this.addLineToLink(t.id,_.ybase+_.y),t.id;let e=_.addMarker(_.ybase+_.y),s={id:this._nextId++,key:this._getEntryIdKey(l),data:l,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(s,e))),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(h,_){let l=this._dataByLinkId.get(h);if(l&&l.lines.every((i=>i.line!==_))){let i=this._bufferService.buffer.addMarker(_);l.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(l,i)))}}getLinkData(h){return this._dataByLinkId.get(h)?.data}_getEntryIdKey(h){return`${h.id};;${h.uri}`}_removeMarkerFromLink(h,_){let l=h.lines.indexOf(_);l!==-1&&(h.lines.splice(l,1),h.lines.length===0&&(h.data.id!==void 0&&this._entriesWithId.delete(h.key),this._dataByLinkId.delete(h.id)))}};r.OscLinkService=a=c([u(0,n.IBufferService)],a)},8343:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let o="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 n=function(a,h,_){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(l,i,t){i[o]===i?i[c].push({id:l,index:t}):(i[c]=[{id:l,index:t}],i[o]=i)})(n,a,_)};return n.toString=()=>u,r.serviceRegistry.set(u,n),n}},2585:(D,r,o)=>{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=o(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(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.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,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let c=o(8460),u=o(225);class n{static extractShouldJoin(h){return(1&h)!=0}static extractWidth(h){return h>>1&3}static extractCharKind(h){return h>>3}static createPropertyValue(h,_,l=!1){return(16777215&h)<<3|(3&_)<<1|(l?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;let h=new u.UnicodeV6;this.register(h),this._active=h.version,this._activeProvider=h}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(h){if(!this._providers[h])throw new Error(`unknown Unicode version "${h}"`);this._active=h,this._activeProvider=this._providers[h],this._onChange.fire(h)}register(h){this._providers[h.version]=h}wcwidth(h){return this._activeProvider.wcwidth(h)}getStringCellWidth(h){let _=0,l=0,i=h.length;for(let t=0;t<i;++t){let e=h.charCodeAt(t);if(55296<=e&&e<=56319){if(++t>=i)return _+this.wcwidth(e);let g=h.charCodeAt(t);56320<=g&&g<=57343?e=1024*(e-55296)+g-56320+65536:_+=this.wcwidth(g)}let s=this.charProperties(e,l),d=n.extractWidth(s);n.extractShouldJoin(s)&&(d-=n.extractWidth(l)),_+=d,l=s}return _}charProperties(h,_){return this._activeProvider.charProperties(h,_)}}r.UnicodeService=n}},S={};function A(D){var r=S[D];if(r!==void 0)return r.exports;var o=S[D]={exports:{}};return w[D].call(o.exports,o,o.exports,A),o.exports}var B={};return(()=>{var D=B;Object.defineProperty(D,"__esModule",{value:!0}),D.Terminal=void 0;let r=A(9042),o=A(3236),c=A(844),u=A(5741),n=A(8285),a=A(7975),h=A(7090),_=["cols","rows"];class l extends c.Disposable{constructor(t){super(),this._core=this.register(new o.Terminal(t)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};let e=d=>this._core.options[d],s=(d,g)=>{this._checkReadonlyOptions(d),this._core.options[d]=g};for(let d in this._core.options){let g={get:e.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,g)}}_checkReadonlyOptions(t){if(_.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 a.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new h.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 n.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=l})(),B})()))});var si=Ht((bt,Wt)=>{(function(w,S){typeof bt=="object"&&typeof Wt=="object"?Wt.exports=S():typeof define=="function"&&define.amd?define([],S):typeof bt=="object"?bt.FitAddon=S():w.FitAddon=S()})(self,(()=>(()=>{"use strict";var w={};return(()=>{var S=w;Object.defineProperty(S,"__esModule",{value:!0}),S.FitAddon=void 0,S.FitAddon=class{activate(A){this._terminal=A}dispose(){}fit(){let A=this.proposeDimensions();if(!A||!this._terminal||isNaN(A.cols)||isNaN(A.rows))return;let B=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||(B._renderService.clear(),this._terminal.resize(A.cols,A.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let A=this._terminal._core,B=A._renderService.dimensions;if(B.css.cell.width===0||B.css.cell.height===0)return;let D=this._terminal.options.scrollback===0?0:A.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),c=Math.max(0,parseInt(r.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),n=o-(parseInt(u.getPropertyValue("padding-top"))+parseInt(u.getPropertyValue("padding-bottom"))),a=c-(parseInt(u.getPropertyValue("padding-right"))+parseInt(u.getPropertyValue("padding-left")))-D;return{cols:Math.max(2,Math.floor(a/B.css.cell.width)),rows:Math.max(1,Math.floor(n/B.css.cell.height))}}}})(),w})()))});var ni=Ht((St,$t)=>{(function(w,S){typeof St=="object"&&typeof $t=="object"?$t.exports=S():typeof define=="function"&&define.amd?define([],S):typeof St=="object"?St.SearchAddon=S():w.SearchAddon=S()})(self,(()=>(()=>{"use strict";var w={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=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){let u=[];for(let n=0;n<this._listeners.length;n++)u.push(this._listeners[n]);for(let n=0;n<u.length;n++)u[n].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(o,c){return o((u=>c.fire(u)))},r.runAndSubscribe=function(o,c){return c(void 0),o((u=>c(u)))}},859:(D,r)=>{function o(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=o,r.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}}},S={};function A(D){var r=S[D];if(r!==void 0)return r.exports;var o=S[D]={exports:{}};return w[D](o,o.exports,A),o.exports}var B={};return(()=>{var D=B;Object.defineProperty(D,"__esModule",{value:!0}),D.SearchAddon=void 0;let r=A(345),o=A(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class u extends o.Disposable{constructor(a){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new o.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new o.MutableDisposable,this._onDidChangeResults=this.register(new r.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=a?.highlightLimit??1e3}activate(a){this._terminal=a,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,o.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let a=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(a,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(a){this._selectedDecoration.clear(),(0,o.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),a||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(a,h){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,h);this._lastSearchOptions=h,h?.decorations&&(this._cachedSearchTerm===void 0||a!==this._cachedSearchTerm||_)&&this._highlightAllMatches(a,h);let l=this._findNextAndSelect(a,h);return this._fireResults(h),this._cachedSearchTerm=a,l}_highlightAllMatches(a,h){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!a||a.length===0)return void this.clearDecorations();h=h||{},this.clearDecorations(!0);let _=[],l,i=this._find(a,0,0,h);for(;i&&(l?.row!==i.row||l?.col!==i.col)&&!(_.length>=this._highlightLimit);)l=i,_.push(l),i=this._find(a,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,h);for(let t of _){let e=this._createResultDecoration(t,h.decorations);e&&(this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}}))}}_find(a,h,_,l){if(!this._terminal||!a||a.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(_>this._terminal.cols)throw new Error(`Invalid col: ${_} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let t={startRow:h,startCol:_};if(i=this._findInLine(a,t,l),!i)for(let e=h+1;e<this._terminal.buffer.active.baseY+this._terminal.rows&&(t.startRow=e,t.startCol=0,i=this._findInLine(a,t,l),!i);e++);return i}_findNextAndSelect(a,h){if(!this._terminal||!a||a.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=this._terminal.getSelectionPosition();this._terminal.clearSelection();let l=0,i=0;_&&(this._cachedSearchTerm===a?(l=_.end.x,i=_.end.y):(l=_.start.x,i=_.start.y)),this._initLinesCache();let t={startRow:i,startCol:l},e=this._findInLine(a,t,h);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(a,t,h),!e);s++);if(!e&&i!==0)for(let s=0;s<i&&(t.startRow=s,t.startCol=0,e=this._findInLine(a,t,h),!e);s++);return!e&&_&&(t.startRow=_.start.y,t.startCol=0,e=this._findInLine(a,t,h)),this._selectResult(e,h?.decorations,h?.noScroll)}findPrevious(a,h){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let _=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,h);this._lastSearchOptions=h,h?.decorations&&(this._cachedSearchTerm===void 0||a!==this._cachedSearchTerm||_)&&this._highlightAllMatches(a,h);let l=this._findPreviousAndSelect(a,h);return this._fireResults(h),this._cachedSearchTerm=a,l}_didOptionsChange(a,h){return!!h&&(a.caseSensitive!==h.caseSensitive||a.regex!==h.regex||a.wholeWord!==h.wholeWord)}_fireResults(a){if(a?.decorations){let h=-1;if(this._selectedDecoration.value){let _=this._selectedDecoration.value.match;for(let l=0;l<this._highlightDecorations.length;l++){let i=this._highlightDecorations[l].match;if(i.row===_.row&&i.col===_.col&&i.size===_.size){h=l;break}}}this._onDidChangeResults.fire({resultIndex:h,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(a,h){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!a||a.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let _=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},s;if(_&&(e.startRow=l=_.start.y,e.startCol=i=_.start.x,this._cachedSearchTerm!==a&&(s=this._findInLine(a,e,h,!1),s||(e.startRow=l=_.end.y,e.startCol=i=_.end.x))),s||(s=this._findInLine(a,e,h,t)),!s){e.startCol=Math.max(e.startCol,this._terminal.cols);for(let d=l-1;d>=0&&(e.startRow=d,s=this._findInLine(a,e,h,t),!s);d--);}if(!s&&l!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let d=this._terminal.buffer.active.baseY+this._terminal.rows-1;d>=l&&(e.startRow=d,s=this._findInLine(a,e,h,t),!s);d--);return this._selectResult(s,h?.decorations,h?.noScroll)}_initLinesCache(){let a=this._terminal;this._linesCache||(this._linesCache=new Array(a.buffer.active.length),this._linesCacheDisposables.value=(0,o.getDisposeArrayDisposable)([a.onLineFeed((()=>this._destroyLinesCache())),a.onCursorMove((()=>this._destroyLinesCache())),a.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(a,h,_){return(a===0||c.includes(h[a-1]))&&(a+_.length===h.length||c.includes(h[a+_.length]))}_findInLine(a,h,_={},l=!1){let i=this._terminal,t=h.startRow,e=h.startCol;if(i.buffer.active.getLine(t)?.isWrapped)return l?void(h.startCol+=i.cols):(h.startRow--,h.startCol+=i.cols,this._findInLine(a,h,_));let d=this._linesCache?.[t];d||(d=this._translateBufferLineToStringWithWrap(t,!0),this._linesCache&&(this._linesCache[t]=d));let[g,p]=d,v=this._bufferColsToStringOffset(t,e),f=_.caseSensitive?a:a.toLowerCase(),m=_.caseSensitive?g:g.toLowerCase(),E=-1;if(_.regex){let k=RegExp(f,"g"),x;if(l)for(;x=k.exec(m.slice(0,v));)E=k.lastIndex-x[0].length,a=x[0],k.lastIndex-=a.length-1;else x=k.exec(m.slice(v)),x&&x[0].length>0&&(E=v+(k.lastIndex-x[0].length),a=x[0])}else l?v-f.length>=0&&(E=m.lastIndexOf(f,v-f.length)):E=m.indexOf(f,v);if(E>=0){if(_.wholeWord&&!this._isWholeWord(E,m,a))return;let k=0;for(;k<p.length-1&&E>=p[k+1];)k++;let x=k;for(;x<p.length-1&&E+a.length>=p[x+1];)x++;let C=E-p[k],M=E+a.length-p[x],z=this._stringLengthToBufferSize(t+k,C);return{term:a,col:z,row:t+k,size:this._stringLengthToBufferSize(t+x,M)-z+i.cols*(x-k)}}}_stringLengthToBufferSize(a,h){let _=this._terminal.buffer.active.getLine(a);if(!_)return 0;for(let l=0;l<h;l++){let i=_.getCell(l);if(!i)break;let t=i.getChars();t.length>1&&(h-=t.length-1);let e=_.getCell(l+1);e&&e.getWidth()===0&&h++}return h}_bufferColsToStringOffset(a,h){let _=this._terminal,l=a,i=0,t=_.buffer.active.getLine(l);for(;h>0&&t;){for(let e=0;e<h&&e<_.cols;e++){let s=t.getCell(e);if(!s)break;s.getWidth()&&(i+=s.getCode()===0?1:s.getChars().length)}if(l++,t=_.buffer.active.getLine(l),t&&!t.isWrapped)break;h-=_.cols}return i}_translateBufferLineToStringWithWrap(a,h){let _=this._terminal,l=[],i=[0],t=_.buffer.active.getLine(a);for(;t;){let e=_.buffer.active.getLine(a+1),s=!!e&&e.isWrapped,d=t.translateToString(!s&&h);if(s&&e){let g=t.getCell(t.length-1);g&&g.getCode()===0&&g.getWidth()===1&&e.getCell(0)?.getWidth()===2&&(d=d.slice(0,-1))}if(l.push(d),!s)break;i.push(i[i.length-1]+d.length),a++,t=e}return[l.join(""),i]}_selectResult(a,h,_){let l=this._terminal;if(this._selectedDecoration.clear(),!a)return l.clearSelection(),!1;if(l.select(a.col,a.row,a.size),h){let i=l.registerMarker(-l.buffer.active.baseY-l.buffer.active.cursorY+a.row);if(i){let t=l.registerDecoration({marker:i,x:a.col,width:a.size,backgroundColor:h.activeMatchBackground,layer:"top",overviewRulerOptions:{color:h.activeMatchColorOverviewRuler}});if(t){let e=[];e.push(i),e.push(t.onRender((s=>this._applyStyles(s,h.activeMatchBorder,!0)))),e.push(t.onDispose((()=>(0,o.disposeArray)(e)))),this._selectedDecoration.value={decoration:t,match:a,dispose(){t.dispose()}}}}}if(!_&&(a.row>=l.buffer.active.viewportY+l.rows||a.row<l.buffer.active.viewportY)){let i=a.row-l.buffer.active.viewportY;i-=Math.floor(l.rows/2),l.scrollLines(i)}return!0}_applyStyles(a,h,_){a.classList.contains("xterm-find-result-decoration")||(a.classList.add("xterm-find-result-decoration"),h&&(a.style.outline=`1px solid ${h}`)),_&&a.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(a,h){let _=this._terminal,l=_.registerMarker(-_.buffer.active.baseY-_.buffer.active.cursorY+a.row);if(!l)return;let i=_.registerDecoration({marker:l,x:a.col,width:a.size,backgroundColor:h.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:h.matchOverviewRuler,position:"center"}});if(i){let t=[];t.push(l),t.push(i.onRender((e=>this._applyStyles(e,h.matchBorder,!1)))),t.push(i.onDispose((()=>(0,o.disposeArray)(t))))}return i}}D.SearchAddon=u})(),B})()))});var tr={};Ni(tr,{apply:()=>Qi,inject:()=>Yi});module.exports=Wi(tr);var ye=require("react");var Z=require("react");var de="zTerm";async function te(w,S,A={},B){let D=w.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/${S}`,A,B);if(!r.ok)throw new Error(r.error?.message||`${de} \u8BF7\u6C42\u5931\u8D25`);return r.value}function gt(w,S,A="text/plain;charset=utf-8"){let B=URL.createObjectURL(new Blob([S],{type:A})),D=document.createElement("a");D.href=B,D.download=w,D.click(),URL.revokeObjectURL(B)}function vt(){return new Date().toISOString().replace(/[-:]/g,"").replace(/T/,"-").slice(0,15)}function ei(w,S=Date.now()){if(!w)return;let A=Date.parse(w);if(!Number.isFinite(A))return;let B=Math.floor((S-A)/1e3);if(!(B<2))return B<60?`\u5DF2 ${B} \u79D2`:`\u5DF2 ${Math.floor(B/60)} \u5206 ${B%60} \u79D2`}var Qt=0;function ti(w,S){let A=new Map(w);if(S.reset){A.clear();for(let r of S.snapshots??[])A.set(r.terminalId,{generation:r.generation,text:r.text,seq:S.cursor,epoch:++Qt,end:r.text.length})}let B=new Map,D=r=>({generation:r,seq:Number.NEGATIVE_INFINITY,base:"",parts:[],epoch:++Qt,end:0});for(let r of S.output??[]){let o=A.get(r.terminalId),c=B.get(r.terminalId);c?c.generation!==r.generation&&(c=D(r.generation),B.set(r.terminalId,c)):(c=o&&o.generation===r.generation?{generation:r.generation,seq:o.seq,base:o.text,parts:[],epoch:o.epoch,end:o.end}:D(r.generation),B.set(r.terminalId,c)),!(r.seq<=c.seq)&&(c.seq=r.seq,c.parts.push(r.text),c.end+=r.text.length)}for(let[r,o]of B)o.parts.length&&A.set(r,{generation:o.generation,text:`${o.base}${o.parts.join("")}`.slice(-5e5),seq:o.seq,epoch:o.epoch,end:o.end});for(let r of A.keys())S.workspace.terminals.some(o=>o.id===r)||A.delete(r);return A}var ue=require("react"),ui=Ft(ri(),1),fi=Ft(si(),1),_i=Ft(ni(),1);var Xe=require("react");function rt(w,S,A,B){try{let D=localStorage.getItem(w),r=D===null?S:Number(D);return Number.isFinite(r)?Math.max(A,Math.min(B,r)):S}catch{return S}}function st(w,S){try{localStorage.setItem(w,String(S))}catch{}}var Ge=12,Ct=8,yt=32,Ut="dsh-zterm.terminal-font-size",it=new Set,wt;function ai(w){return Number.isInteger(w)&&w>=Ct&&w<=yt}function jt(){try{let w=localStorage.getItem(Ut),S=w===null?Ge:Number(w);return ai(S)?S:Ge}catch{return wt??Ge}}function li(){return wt??=jt()}function ci(w){w!==li()&&(wt=w,it.forEach(S=>S()))}function hi(w){ai(w)&&(ci(w),st(Ut,w))}function oi(w){(w.key===Ut||w.key===null)&&ci(jt())}function $i(w){return!it.size&&typeof window<"u"&&(wt=jt(),window.addEventListener("storage",oi)),it.add(w),()=>{it.delete(w),!it.size&&typeof window<"u"&&window.removeEventListener("storage",oi)}}function xt(){return(0,Xe.useSyncExternalStore)($i,li,()=>Ge)}function Et(){let w=(0,Xe.useRef)(()=>{});return(0,Xe.useEffect)(()=>()=>w.current(),[]),(S,A)=>{S.preventDefault(),w.current();let B=()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",B),w.current=()=>{}};w.current=B,window.addEventListener("mousemove",A),window.addEventListener("mouseup",B,{once:!0})}}var He=require("react/jsx-runtime"),Ui=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.userAgentData?.platform||navigator.platform||"");function ji(w){return(/^[a-z]$/i.test(w.key)?w.key.toLowerCase()==="f":w.code==="KeyF")&&!w.altKey&&(Ui?w.metaKey&&!w.ctrlKey&&!w.shiftKey:w.ctrlKey&&w.shiftKey&&!w.metaKey)}var qi=/^(?:\x1b\[[?>]?[\d;]*[cnRt]|\x1b\[\??\d+;\d+\$y|\x1bP[01]\$r[^\x1b]*\x1b\\|\x1b\][\d;]+;rgb:[\da-fA-F/]+(?:\x1b\\|\x07))+$/,di={epoch:-1,end:0,text:""};function pi({ctx:w,sessionId:S,terminal:A,buffer:B,visible:D,onError:r}){let o=(0,ue.useRef)(null),c=(0,ue.useRef)(),u=(0,ue.useRef)(),n=(0,ue.useRef)(),a=(0,ue.useRef)(di),h=(0,ue.useRef)(A),_=(0,ue.useRef)(r),l=(0,ue.useRef)(Promise.resolve()),i=(0,ue.useRef)(()=>{}),t=(0,ue.useRef)(()=>{}),e=(0,ue.useRef)(()=>{}),s=(0,ue.useRef)(!1),[d,g]=(0,ue.useState)(""),p=xt(),v=(0,ue.useRef)(p),f=(0,ue.useRef)(B);v.current=p,f.current=B,h.current=A,_.current=r;let m=()=>{let k=c.current,x=f.current,C=s.current;if(s.current=!1,!k||!x||x.generation!==h.current.generation)return;let M=a.current;if(M.epoch===x.epoch&&M.end===x.end)return;let z=M.epoch===x.epoch?M.end-(x.end-x.text.length):-1;z>=0&&z<=x.text.length?e.current(x.text.slice(z),C):x.text.startsWith(M.text)?e.current(x.text.slice(M.text.length),C||!!M.text):(k.reset(),e.current(x.text,!0)),a.current={epoch:x.epoch,end:x.end,text:x.text}},E=()=>{if(c.current||!o.current)return;let k=o.current,x=new ui.Terminal({cursorBlink:!0,fontSize:v.current,fontFamily:"Menlo, Consolas, monospace",scrollback:5e3,allowProposedApi:!1,convertEol:!1,theme:{background:"#12161d",foreground:"#dce3ed",cursor:"#e4edf8",selectionBackground:"#334b66"}}),C=new fi.FitAddon,M=new _i.SearchAddon;x.loadAddon(C),x.loadAddon(M),x.open(k),c.current=x,n.current=C,u.current=M,a.current=di;let z=!1,j=0;e.current=(T,H)=>{if(T){if(!H){x.write(T);return}j++,x.write(T,()=>{j--})}};let U=x.onData(T=>{let H=h.current;H.state==="ready"&&(j>0&&qi.test(T)||(l.current=l.current.catch(()=>{}).then(async()=>{z||await te(w,"input",{sessionId:S,terminalId:H.id,generation:H.generation,data:T})}).catch(q=>{z||_.current(q.message)})))}),$;i.current=()=>{if(z||!o.current?.clientWidth)return;C.fit();let T=h.current;T.state==="ready"&&te(w,"resize",{sessionId:S,terminalId:T.id,generation:T.generation,cols:x.cols,rows:x.rows}).catch(H=>{z||_.current(H.message)})};let b=()=>{clearTimeout($),$=setTimeout(()=>i.current(),80)},L=new ResizeObserver(b);L.observe(k),b();let R=T=>{ji(T)&&(T.preventDefault(),T.stopPropagation(),document.getElementById(`zterm-find-${A.id}`)?.focus())};k.addEventListener("keydown",R,!0),t.current=()=>{z=!0,i.current=()=>{},e.current=()=>{},clearTimeout($),L.disconnect(),U.dispose(),k.removeEventListener("keydown",R,!0),x.dispose(),c.current=void 0}};return(0,ue.useLayoutEffect)(()=>()=>{t.current(),t.current=()=>{}},[w,S,A.id,A.generation]),(0,ue.useLayoutEffect)(()=>{D&&(E(),s.current=!0,m())},[D,w,S,A.id,A.generation]),(0,ue.useEffect)(()=>{D&&m()},[B,A.generation]),(0,ue.useLayoutEffect)(()=>{let k=c.current;!D||!k||k.options.fontSize===p||(k.options.fontSize=p,i.current())},[p,D]),(0,ue.useEffect)(()=>{D&&(i.current(),c.current?.focus())},[D,A.state,A.generation]),(0,He.jsxs)("div",{className:"zt-terminal-screen",style:{display:D?"flex":"none"},children:[(0,He.jsxs)("div",{className:"zt-terminal-search",children:[(0,He.jsx)("input",{id:`zterm-find-${A.id}`,"aria-label":"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",placeholder:"\u641C\u7D22\u7EC8\u7AEF\u8F93\u51FA",value:d,onChange:k=>{g(k.target.value),u.current?.findNext(k.target.value)},onKeyDown:k=>{k.key==="Enter"&&u.current?.findNext(d),k.key==="Escape"&&(g(""),c.current?.focus())}}),(0,He.jsx)("button",{title:"\u4E0A\u4E00\u4E2A\u5339\u914D",onClick:()=>u.current?.findPrevious(d),children:"\u2191"}),(0,He.jsx)("button",{title:"\u4E0B\u4E00\u4E2A\u5339\u914D",onClick:()=>u.current?.findNext(d),children:"\u2193"}),(0,He.jsx)("span",{children:"\u7EC8\u7AEF\u8F93\u5165\u76F4\u63A5\u64CD\u4F5C\u5F53\u524D\u673A\u5668"})]}),(0,He.jsx)("div",{className:"zt-terminal-canvas",ref:o})]})}var _e=require("react");var Ue={password:"\u5BC6\u7801",key:"\u79C1\u94A5\u5185\u5BB9","key-file":"\u79C1\u94A5\u6587\u4EF6"};var Ie=require("react");var nt=class{expanded;scroll=new Map;pages=new Map;pending=new Map;listeners=new Set;version=0;onChange;constructor(S=[]){this.expanded=new Set(S)}subscribe=S=>(this.listeners.add(S),()=>{this.listeners.delete(S)});snapshot=()=>this.version;changed(){this.version++,this.listeners.forEach(S=>S()),this.onChange?.()}setScroll(S,A){this.scroll.set(S,A),S==="tree"&&this.onChange?.()}restore(S){this.expanded.clear(),S.expanded.forEach(A=>this.expanded.add(A)),this.scroll.set("tree",S.scroll);for(let[A,B]of S.pages)this.pages.set(A,{...B,status:"ready",stale:!0})}export(){return{expanded:[...this.expanded],scroll:this.scroll.get("tree")??0,pages:[...this.pages].flatMap(([S,A])=>!S.startsWith("search:")&&A.data?[[S,{offset:A.offset,data:A.data}]]:[])}}page(S){return this.pages.get(S)}toggle(S){this.expanded.has(S)?this.expanded.delete(S):this.expanded.add(S),this.changed()}reveal(S){S.forEach(A=>this.expanded.add(A)),this.changed()}retain(S){for(let A of this.expanded)S.has(A)||this.expanded.delete(A)}seed(S,A){(this.pages.get(S)?.offset??0)===0&&(this.cancel(S),this.pages.set(S,{offset:0,status:"ready",data:A,updatedAt:Date.now()}),this.changed())}async load(S,A,B=this.pages.get(S)?.offset??0){this.pending.get(S)?.abort();let D=this.pages.get(S),r=D?.offset===B?D.data:void 0,o=new AbortController;this.pending.set(S,o),this.pages.set(S,{offset:B,status:r?"ready":"loading",data:r,refreshing:!0}),this.changed();try{let c=await A(B,o.signal);if(o.signal.aborted||this.pending.get(S)!==o||(B>0&&!c.items.length&&(B=0,c=await A(0,o.signal)),o.signal.aborted||this.pending.get(S)!==o))return;this.pages.set(S,{offset:B,status:"ready",data:c,updatedAt:Date.now()})}catch(c){if(o.signal.aborted||this.pending.get(S)!==o)return;this.pages.set(S,{offset:r?D.offset:B,status:r?"ready":"error",data:r,error:c instanceof Error?c.message:"\u8BFB\u53D6\u5931\u8D25"})}finally{this.pending.get(S)===o&&(this.pending.delete(S),this.changed())}}ensure(S,A,B=!1){let D=this.pages.get(S);!this.pending.has(S)&&(!D||D.status==="idle"||D.stale||B&&Date.now()-(D.updatedAt??0)>=3e3)&&this.load(S,A)}cancel(S){let A=this.pending.get(S);if(!A)return;A.abort(),this.pending.delete(S);let B=this.pages.get(S);this.pages.set(S,B.data?{...B,status:"ready",refreshing:!1,stale:!0}:{offset:B.offset,status:"idle"}),this.changed()}forget(S){this.cancel(S),this.pages.delete(S)&&this.changed()}invalidate(S=!1){this.pending.forEach(A=>A.abort()),this.pending.clear();for(let[A,B]of this.pages)this.pages.set(A,!S&&B.data?{...B,stale:!0,refreshing:!1,error:void 0}:{offset:B.offset,status:"idle"});this.changed()}dispose(){this.pending.forEach(S=>S.abort()),this.pending.clear(),this.listeners.clear()}};function kt(w,S,A,B,D=500){let r=w.slice().reverse().map(n=>({node:n,depth:0,content:!1})),o=[],c=new Set,u=!1;for(;r.length;){let n=r.pop(),a=S(n.node);if(n.content){o.push(n);continue}if(!c.has(a)){if(c.size>=D){u=!0;continue}if(c.add(a),o.push(n),!!B.has(a)){r.push({...n,content:!0});for(let h of A(n.node).slice().reverse())r.push({node:h,depth:n.depth+1,content:!1})}}}return{rows:o,truncated:u}}function Dt(w,S){let A=new Set;return w.filter(B=>{let D=S(B);return A.has(D)?!1:(A.add(D),!0)})}var Be=require("react"),be=require("react/jsx-runtime"),ot=w=>({paddingLeft:`min(${Math.min(8,w)*12}px, 25%)`});function at(w){return(0,Be.useSyncExternalStore)(w.subscribe,w.snapshot,w.snapshot)}function Ye(w,S,A,B=!0,D=!1){let r=at(w),o=(0,Be.useRef)(A);return o.current=A,(0,Be.useEffect)(()=>{B&&w.ensure(S,(c,u)=>o.current(c,u),!0)},[w,S,B]),(0,Be.useEffect)(()=>{B&&w.ensure(S,(c,u)=>o.current(c,u))},[w,S,B,r]),(0,Be.useEffect)(()=>()=>{D?w.forget(S):w.cancel(S)},[w,S,D]),{page:w.page(S),load:c=>{w.load(S,(u,n)=>o.current(u,n),c)}}}function Lt({state:w,view:S,label:A,children:B}){let D=(0,Be.useRef)(null);return(0,Be.useLayoutEffect)(()=>{D.current&&(D.current.scrollTop=w.scroll.get(S)??0)},[w,S]),(0,be.jsx)("nav",{ref:D,className:"zt-asset-tree","aria-label":A,onScroll:r=>w.setScroll(S,r.currentTarget.scrollTop),children:B})}function lt({label:w,expanded:S,depth:A,selected:B,onToggle:D,actions:r}){return(0,be.jsxs)("div",{className:`zt-directory-row${B?" active":""}`,style:ot(A),children:[(0,be.jsxs)("button",{className:"zt-directory-name","aria-expanded":S,"aria-label":`${S?"\u6536\u8D77":"\u5C55\u5F00"}\u6587\u4EF6\u5939 ${w}`,title:w,onClick:D,children:[(0,be.jsx)("span",{className:"zt-directory-arrow","aria-hidden":"true",children:S?"\u25BE":"\u25B8"}),(0,be.jsxs)("span",{className:"zt-directory-label",children:["\u25B1 ",w]})]}),r]})}function Ze({page:w,label:S,retry:A}){return w?.data?w.error?(0,be.jsxs)("div",{className:"zt-tree-message",role:"status",children:[(0,be.jsxs)("span",{title:w.error,children:[S,"\u66F4\u65B0\u5931\u8D25\uFF0C\u5F53\u524D\u663E\u793A\u7F13\u5B58"]}),(0,be.jsx)("button",{onClick:A,children:"\u91CD\u8BD5"})]}):null:!w||w.status==="idle"||w.status==="loading"?(0,be.jsxs)("p",{className:"zt-tree-message",role:"status",children:["\u6B63\u5728\u52A0\u8F7D",S,"\u2026"]}):w.status==="error"?(0,be.jsxs)("div",{className:"zt-tree-message zt-error",role:"alert",children:[(0,be.jsxs)("span",{children:[S,"\uFF1A",w.error]}),(0,be.jsx)("button",{onClick:A,children:"\u91CD\u8BD5"})]}):null}function Rt({page:w,size:S,label:A,load:B}){return w?.status!=="ready"||!w.offset&&!w.data?.hasMore?null:(0,be.jsxs)("div",{className:"zt-pagination","aria-label":`${A}\u5206\u9875`,children:[(0,be.jsxs)("span",{children:[w.data?.total??0," \u53F0 \xB7 \u7B2C ",Math.floor(w.offset/S)+1," \u9875"]}),(0,be.jsx)("button",{"aria-label":`${A}\u4E0A\u4E00\u9875`,disabled:!w.offset,onClick:()=>B(Math.max(0,w.offset-S)),children:"\u2039"}),(0,be.jsx)("button",{"aria-label":`${A}\u4E0B\u4E00\u9875`,disabled:!w.data?.hasMore,onClick:()=>B(w.offset+S),children:"\u203A"})]})}var se=require("react/jsx-runtime");function Tt(w){let S=new Map;for(let r of w){let o=r.parentId??"";S.set(o,[...S.get(o)??[],r])}let A=(S.get("")??[]).slice().reverse().map(r=>({...r,depth:0})),B=[],D=new Set;for(;A.length;){let r=A.pop();if(!D.has(r.id)){D.add(r.id),B.push(r);for(let o of(S.get(r.id)??[]).slice().reverse())A.push({...o,depth:r.depth+1})}}return B}function Ki({folder:w,busy:S,onEdit:A,onDelete:B}){let D=(0,Ie.useRef)(null),r=(0,Ie.useRef)(null),o=(0,Ie.useId)(),[c,u]=(0,Ie.useState)(!1);(0,Ie.useEffect)(()=>{let h=D.current;h.setAttribute("popover","auto"),r.current.setAttribute("popovertarget",o);let _=()=>{let l=h.matches(":popover-open");if(u(l),!l)return;let i=r.current.getBoundingClientRect();h.style.left=`${Math.max(8,Math.min(i.right-h.offsetWidth,window.innerWidth-h.offsetWidth-8))}px`,h.style.top=`${Math.max(8,i.bottom+h.offsetHeight+4<=window.innerHeight-8?i.bottom+4:i.top-h.offsetHeight-4)}px`,h.querySelector("button")?.focus({preventScroll:!0})};return h.addEventListener("toggle",_),()=>h.removeEventListener("toggle",_)},[o]),(0,Ie.useEffect)(()=>{if(!c)return;let h=()=>D.current?.hidePopover();return window.addEventListener("resize",h),document.addEventListener("scroll",h,!0),()=>{window.removeEventListener("resize",h),document.removeEventListener("scroll",h,!0)}},[c]);let n=h=>{D.current?.hidePopover(),h(w)},a=h=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(h.key))return;h.preventDefault();let _=[...h.currentTarget.querySelectorAll("button")],l=_.indexOf(document.activeElement),i=h.key==="Home"?0:h.key==="End"?_.length-1:(l+(h.key==="ArrowUp"?-1:1)+_.length)%_.length;_[i]?.focus()};return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("button",{ref:r,disabled:S,className:"zt-folder-action","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${w.label}`,title:"\u6587\u4EF6\u5939\u64CD\u4F5C","aria-haspopup":"menu","aria-controls":o,"aria-expanded":c,children:"\u22EF"}),(0,se.jsxs)("div",{ref:D,id:o,className:"zt-folder-menu",role:"menu","aria-label":`\u6587\u4EF6\u5939\u64CD\u4F5C ${w.label}`,onKeyDown:a,children:[(0,se.jsx)("button",{role:"menuitem",disabled:S,onClick:()=>n(A),children:"\u66F4\u540D"}),(0,se.jsx)("button",{role:"menuitem",disabled:S,onClick:()=>n(B),children:"\u5220\u9664"})]})]})}function gi({props:w,folder:S,depth:A,hasChildren:B=!1}){let{ctx:D,state:r,query:o,busy:c,onConnect:u,onHostEdit:n,onHostDelete:a}=w,h=S?`hosts:${S.id}`:`search:${o}`,_=S?.label??"\u641C\u7D22\u7ED3\u679C",{page:l,load:i}=Ye(r,h,async(t,e)=>{let s=await te(D,"catalog",{offset:t,query:S?void 0:o,folderId:S?S.id||"root":void 0},e);return{items:s.hosts,total:s.total,hasMore:t+200<s.total}},!0,!S);return(0,se.jsxs)("div",{className:"zt-tree-content",style:ot(A),"data-host-folder":S?.id??"search",children:[(0,se.jsx)(Ze,{page:l,label:_,retry:()=>i()}),l?.status==="ready"&&(0,se.jsxs)(se.Fragment,{children:[l.data?.items.map(t=>(0,se.jsxs)("div",{className:"zt-host-row",children:[(0,se.jsxs)("button",{className:"zt-host-connect",disabled:c,onClick:()=>u(t),title:`\u8FDE\u63A5 ${t.username}@${t.host}:${t.port}`,children:[(0,se.jsx)("span",{className:"zt-host-glyph",children:"\u25A4"}),(0,se.jsxs)("span",{children:[(0,se.jsx)("strong",{children:t.label}),(0,se.jsxs)("small",{children:[t.username,"@",t.host]})]})]}),(0,se.jsx)("button",{disabled:c,title:"\u7F16\u8F91\u4E3B\u673A","aria-label":`\u7F16\u8F91\u4E3B\u673A ${t.label}`,onClick:()=>n(t),children:"\u22EF"}),(0,se.jsx)("button",{disabled:c,title:"\u79FB\u9664\u4E3B\u673A\u914D\u7F6E","aria-label":`\u79FB\u9664\u4E3B\u673A ${t.label}`,onClick:()=>a(t),children:"\xD7"})]},t.id)),!l.data?.items.length&&!B&&(0,se.jsx)("p",{className:"zt-tree-message",children:S?"\u6B64\u76EE\u5F55\u4E3A\u7A7A":"\u6CA1\u6709\u5339\u914D\u7684\u4E3B\u673A"})]}),(0,se.jsx)(Rt,{page:l,size:200,label:_,load:i})]})}function vi(w){let{state:S,folders:A,query:B,selected:D,onSelect:r,onEdit:o,onDelete:c}=w;at(S);let u=(0,Ie.useMemo)(()=>{let a=new Map;for(let h of A){let _=h.parentId??"";a.has(_)||a.set(_,[]),a.get(_).push(h)}return a},[A]),{rows:n}=kt([{id:"",label:"\u6839\u76EE\u5F55"}],a=>a.id,a=>u.get(a.id)??[],S.expanded,Number.MAX_SAFE_INTEGER);return(0,se.jsx)(Lt,{state:S,view:B?`search:${B}`:"tree",label:B?"\u4E3B\u673A\u641C\u7D22\u7ED3\u679C":"\u4E3B\u673A\u6587\u4EF6\u5939",children:B?(0,se.jsx)(gi,{props:w,depth:0},`search:${B}`):n.map(({node:a,depth:h,content:_})=>_?(0,se.jsx)(gi,{props:w,folder:a,depth:h+1,hasChildren:!!u.get(a.id)?.length},`content:${a.id}`):(0,se.jsx)(lt,{label:a.label,depth:h,selected:D===a.id,expanded:S.expanded.has(a.id),onToggle:()=>{r(a.id),S.toggle(a.id)},actions:a.id?(0,se.jsx)(Ki,{folder:a,busy:w.busy,onEdit:o,onDelete:c}):void 0},`directory:${a.id}`))})}var W=require("react/jsx-runtime");function je({title:w,children:S,onClose:A}){let B=(0,_e.useRef)(null),D=(0,_e.useRef)(A);return D.current=A,(0,_e.useEffect)(()=>{let r=document.activeElement,o=B.current;(o?.querySelector("input,select,textarea")??o?.querySelector("button")??o)?.focus();let c=u=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),D.current();return}if(u.key!=="Tab")return;let n=[...o?.querySelectorAll('button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')??[]].filter(_=>_.offsetParent!==null),a=n[0],h=n.at(-1);a?u.shiftKey&&(document.activeElement===a||document.activeElement===o)?(u.preventDefault(),h?.focus()):!u.shiftKey&&document.activeElement===h&&(u.preventDefault(),a.focus()):(u.preventDefault(),o?.focus())};return o?.addEventListener("keydown",c),()=>{o?.removeEventListener("keydown",c),r?.isConnected&&r.focus()}},[]),(0,W.jsx)("div",{className:"zt-modal-shade",onMouseDown:r=>{r.target===r.currentTarget&&A()},children:(0,W.jsxs)("section",{ref:B,tabIndex:-1,className:"zt-modal",role:"dialog","aria-modal":"true","aria-label":w,children:[(0,W.jsxs)("header",{children:[(0,W.jsx)("strong",{children:w}),(0,W.jsx)("button",{"aria-label":"\u5173\u95ED\u5BF9\u8BDD\u6846",onClick:A,children:"\xD7"})]}),S]})})}function Se({title:w,children:S}){return(0,W.jsxs)("label",{className:"zt-field",children:[(0,W.jsx)("span",{children:w}),S]})}function mi({ctx:w,host:S,defaultFolderId:A="",folders:B,credentials:D=[],defaultCredentialId:r,revision:o,onClose:c,onSaved:u}){let[n,a]=(0,_e.useState)({label:S?.label??"",host:S?.host??"",port:String(S?.port??22),username:S?.username??"",authType:S?.authType??"key-file",privateKeyPath:S?.privateKeyPath??"",folderId:S?S.folderId??"":A}),[h,_]=(0,_e.useState)(""),[l,i]=(0,_e.useState)(""),[t,e]=(0,_e.useState)(!1),[s,d]=(0,_e.useState)(""),[g,p]=(0,_e.useState)(!1),[v,f]=(0,_e.useState)(S?.credentialId||!S&&D.length?"saved":S?.authType??"key-file"),[m,E]=(0,_e.useState)(S?.credentialId||r||D[0]?.id||""),k=S&&!S.credentialId&&S.authType===v,x=(C,M)=>a(z=>({...z,[C]:M}));return(0,W.jsx)(je,{title:S?"\u7F16\u8F91\u8FDC\u7A0B\u4E3B\u673A":"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A",onClose:c,children:(0,W.jsxs)("form",{onSubmit:C=>{C.preventDefault(),p(!0),d(""),te(w,"host/save",{host:{...S,...n,credentialId:v==="saved"?m:void 0,folderId:n.folderId||void 0,port:Number(n.port),kind:"ssh"},secret:v==="saved"?"":h,passphrase:v==="saved"?"":l,clearPassphrase:t,revision:o}).then(()=>{_(""),i(""),u(n.folderId),c()}).catch(M=>d(M.message)).finally(()=>p(!1))},children:[(0,W.jsx)(Se,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:n.label,onChange:C=>x("label",C.target.value)})}),(0,W.jsxs)("div",{className:"zt-form-row",children:[(0,W.jsx)(Se,{title:"\u4E3B\u673A\u5730\u5740",children:(0,W.jsx)("input",{required:!0,value:n.host,placeholder:"\u4E3B\u673A\u540D\u6216 IP",onChange:C=>x("host",C.target.value)})}),(0,W.jsx)(Se,{title:"\u7AEF\u53E3",children:(0,W.jsx)("input",{type:"number",required:!0,min:"1",max:"65535",value:n.port,onChange:C=>x("port",C.target.value)})})]}),(0,W.jsx)(Se,{title:"\u767B\u5F55\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:n.username,onChange:C=>x("username",C.target.value)})}),(0,W.jsx)(Se,{title:"\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:n.folderId,onChange:C=>x("folderId",C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Tt(B).map(C=>(0,W.jsxs)("option",{value:C.id,children:["\u3000".repeat(Math.min(8,C.depth)),C.label]},C.id))]})}),(0,W.jsx)(Se,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:v,onChange:C=>{f(C.target.value),C.target.value!=="saved"&&x("authType",C.target.value),_(""),i(""),e(!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)(Se,{title:"\u767B\u5F55\u51ED\u8BC1",children:(0,W.jsxs)("select",{required:!0,value:m,onChange:C=>E(C.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u8BF7\u9009\u62E9\u51ED\u8BC1"}),D.map(C=>(0,W.jsxs)("option",{value:C.id,children:[C.label," \xB7 ",Ue[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)(Se,{title:n.authType==="key"?"\u79C1\u94A5\u5185\u5BB9":"\u5BC6\u7801",children:n.authType==="key"?(0,W.jsx)("textarea",{rows:5,value:h,placeholder:k?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u79C1\u94A5":"\u7C98\u8D34\u79C1\u94A5\u5185\u5BB9",onChange:C=>_(C.target.value),spellCheck:!1,required:!k}):(0,W.jsx)("input",{type:"password",value:h,autoComplete:"new-password",placeholder:k?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:C=>_(C.target.value),required:!k})}),v==="key-file"&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Se,{title:"\u79C1\u94A5\u6587\u4EF6\u8DEF\u5F84",children:(0,W.jsx)("input",{value:n.privateKeyPath,placeholder:"\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6",onChange:C=>x("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)(Se,{title:"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u9009\uFF09",children:(0,W.jsx)("input",{type:"password",disabled:t,value:l,placeholder:"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4",onChange:C=>i(C.target.value)})}),S?.passphraseRef&&(0,W.jsxs)("label",{className:"zt-check",children:[(0,W.jsx)("input",{type:"checkbox",checked:t,onChange:C=>e(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"}),s&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:s}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:c,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:g,children:g?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u4E3B\u673A"})]})]})})}function bi({ctx:w,profile:S,revision:A,onClose:B,onSaved:D}){let[r,o]=(0,_e.useState)({label:S?.label??"",baseUrl:S?.baseUrl??"",authMode:S?.authMode??"access_key",username:S?.username??"",verifyTls:S?.verifyTls??!0}),[c,u]=(0,_e.useState)(""),[n,a]=(0,_e.useState)(""),[h,_]=(0,_e.useState)(""),[l,i]=(0,_e.useState)(!1);return(0,W.jsx)(je,{title:S?"\u7F16\u8F91 JumpServer":"\u6DFB\u52A0 JumpServer",onClose:B,children:(0,W.jsxs)("form",{onSubmit:t=>{t.preventDefault(),i(!0),_(""),te(w,"jump/save",{profile:{...S,...r},secret:c,accessKeyId:n,revision:A}).then(()=>{u(""),a(""),D(),B()}).catch(e=>_(e.message)).finally(()=>i(!1))},children:[(0,W.jsx)(Se,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:r.label,onChange:t=>o({...r,label:t.target.value})})}),(0,W.jsx)(Se,{title:"\u670D\u52A1\u5730\u5740",children:(0,W.jsx)("input",{required:!0,type:"url",value:r.baseUrl,placeholder:"https://jump.example.com",onChange:t=>o({...r,baseUrl:t.target.value})})}),(0,W.jsx)(Se,{title:"\u8BA4\u8BC1\u65B9\u5F0F",children:(0,W.jsxs)("select",{value:r.authMode,onChange:t=>o({...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)(Se,{title:"Access Key ID",children:(0,W.jsx)("input",{type:"password",value:n,placeholder:S?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u503C":"",onChange:t=>a(t.target.value)})}),r.authMode==="password"&&(0,W.jsx)(Se,{title:"\u8D26\u53F7",children:(0,W.jsx)("input",{required:!0,value:r.username,onChange:t=>o({...r,username:t.target.value})})}),(0,W.jsx)(Se,{title:r.authMode==="access_key"?"Access Key Secret":r.authMode==="token"?"Token":"\u5BC6\u7801",children:(0,W.jsx)("input",{type:"password",value:c,placeholder:S?"\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=>o({...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"}),h&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:h}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:B,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{className:"zt-primary",disabled:l,children:l?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u5B9E\u4F8B"})]})]})})}function Si({ctx:w,folder:S,defaultParentId:A="",folders:B,revision:D,onClose:r,onSaved:o}){let[c,u]=(0,_e.useState)(S?.label??""),[n,a]=(0,_e.useState)(S?S.parentId??"":A),[h,_]=(0,_e.useState)(""),[l,i]=(0,_e.useState)(!1),t=new Set;if(S){t.add(S.id);for(let e of Tt(B))e.parentId&&t.has(e.parentId)&&t.add(e.id)}return(0,W.jsx)(je,{title:S?"\u7F16\u8F91\u4E3B\u673A\u6587\u4EF6\u5939":"\u65B0\u5EFA\u4E3B\u673A\u6587\u4EF6\u5939",onClose:r,children:(0,W.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i(!0),te(w,"folder/save",{folder:{id:S?.id,label:c,parentId:n||void 0},revision:D}).then(()=>{o(n),r()}).catch(s=>_(s.message)).finally(()=>i(!1))},children:[(0,W.jsx)(Se,{title:"\u540D\u79F0",children:(0,W.jsx)("input",{required:!0,value:c,onChange:e=>u(e.target.value)})}),(0,W.jsx)(Se,{title:"\u7236\u6587\u4EF6\u5939",children:(0,W.jsxs)("select",{value:n,onChange:e=>a(e.target.value),children:[(0,W.jsx)("option",{value:"",children:"\u6839\u76EE\u5F55"}),Tt(B).filter(e=>!t.has(e.id)).map(e=>(0,W.jsxs)("option",{value:e.id,children:["\u3000".repeat(Math.min(8,e.depth)),e.label]},e.id))]})}),h&&(0,W.jsx)("p",{className:"zt-error",role:"alert",children:h}),(0,W.jsxs)("footer",{children:[(0,W.jsx)("button",{type:"button",onClick:r,children:"\u53D6\u6D88"}),(0,W.jsx)("button",{disabled:l,className:"zt-primary",children:l?"\u4FDD\u5B58\u4E2D\u2026":S?"\u4FDD\u5B58":"\u521B\u5EFA"})]})]})})}var ce=require("react/jsx-runtime"),ct={nodeId:"",key:"",name:"\u5168\u90E8\u8D44\u4EA7",hasChildren:!1,assetCount:0};function qt({props:w,node:S,depth:A}){let{ctx:B,instanceId:D,state:r,query:o,onChoose:c}=w,u=Ye(r,`children:${S?.nodeId}`,async(_,l)=>{let i=await te(B,"jump/query",{instanceId:D,operation:"nodes",parentKey:S.key||S.nodeId},l);return{items:Dt(i.nodes??[],t=>t.nodeId),total:i.nodes?.length??0,hasMore:!1,truncated:i.truncated}},!!S?.hasChildren),{page:n,load:a}=Ye(r,S?`assets:${S.nodeId}`:`search:${o}`,async(_,l)=>{let i=await te(B,"jump/query",{instanceId:D,operation:"assets",nodeId:S?.nodeId||void 0,query:S?void 0:o,offset:_,limit:100},l);return{items:Dt(i.assets??[],t=>t.assetId),total:i.total,hasMore:i.hasMore}},!0,!S),h=S?.name??"\u641C\u7D22\u7ED3\u679C";return(0,ce.jsxs)("div",{className:"zt-tree-content",style:ot(A),"data-asset-node":S?.nodeId??"search",children:[S?.hasChildren&&(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(Ze,{page:u.page,label:`${h}\u5B50\u76EE\u5F55`,retry:()=>u.load()}),u.page?.data?.truncated&&(0,ce.jsx)("p",{className:"zt-tree-message",children:"\u5B50\u76EE\u5F55\u8D85\u8FC7\u8BFB\u53D6\u4E0A\u9650\uFF0C\u53EF\u901A\u8FC7\u641C\u7D22\u67E5\u627E\u8D44\u4EA7\u3002"})]}),(0,ce.jsx)(Ze,{page:n,label:h,retry:()=>a()}),n?.status==="ready"&&(0,ce.jsxs)(ce.Fragment,{children:[n.data?.items.map(_=>(0,ce.jsxs)("button",{className:"zt-asset-row",onClick:()=>c(_),title:`${_.name} \xB7 ${_.address}`,children:[(0,ce.jsxs)("strong",{children:["\u25A4 ",_.name]}),(0,ce.jsxs)("small",{children:[_.address," \xB7 ",_.platform]})]},_.assetId)),!n.data?.items.length&&(!S?.hasChildren||u.page?.status==="ready"&&!u.page.data?.items.length)&&(0,ce.jsx)("p",{className:"zt-tree-message",children:S?"\u6B64\u76EE\u5F55\u4E3A\u7A7A":"\u6CA1\u6709\u5339\u914D\u7684\u8D44\u4EA7"})]}),(0,ce.jsx)(Rt,{page:n,size:100,label:h,load:a})]})}function Ci(w){let{ctx:S,instanceId:A,state:B,query:D}=w;at(B);let{page:r,load:o}=Ye(B,"nodes",async(n,a)=>{let h=await te(S,"jump/query",{instanceId:A,operation:"nodes"},a);return{items:Dt(h.nodes??[],_=>_.nodeId),total:h.nodes?.length??0,hasMore:!1,truncated:h.truncated}},!D),{rows:c,truncated:u}=kt(r?.data?.items??[],n=>n.nodeId,n=>n.hasChildren?B.page(`children:${n.nodeId}`)?.data?.items??[]:[],B.expanded);return(0,ce.jsx)(Lt,{state:B,view:D?`search:${D}`:"tree",label:D?"JumpServer \u641C\u7D22\u7ED3\u679C":"JumpServer \u8D44\u4EA7\u76EE\u5F55",children:D?(0,ce.jsx)(qt,{props:w,depth:0},`search:${D}`):(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(Ze,{page:r,label:"\u8D44\u4EA7\u76EE\u5F55",retry:()=>o()}),c.map(({node:n,depth:a,content:h})=>h?(0,ce.jsx)(qt,{props:w,node:n,depth:a+1},`content:${n.nodeId}`):(0,ce.jsx)(lt,{label:n.name,depth:a,expanded:B.expanded.has(n.nodeId),onToggle:()=>B.toggle(n.nodeId)},`directory:${n.nodeId}`)),(u||r?.data?.truncated)&&(0,ce.jsx)("p",{className:"zt-tree-message",children:"\u76EE\u5F55\u663E\u793A\u5DF2\u8FBE 500 \u9879\uFF0C\u8BF7\u6536\u8D77\u90E8\u5206\u76EE\u5F55\u6216\u641C\u7D22\u8D44\u4EA7\u3002"}),(0,ce.jsx)(lt,{label:ct.name,depth:0,expanded:B.expanded.has(ct.nodeId),onToggle:()=>B.toggle(ct.nodeId)}),B.expanded.has(ct.nodeId)&&(0,ce.jsx)(qt,{props:w,node:ct,depth:1})]})})}var yi="dsh-zterm.asset-tree-cache.v1:",Vi=1440*60*1e3,Kt=6e5,xi=64,Qe=w=>!!(w&&typeof w=="object"&&!Array.isArray(w)),Ce=w=>typeof w=="string"&&w.length<=4096,ht=w=>Number.isFinite(w)&&w>=0,It=w=>w==="nodes"?2:typeof w=="string"&&w.startsWith("children:")?1:0;function et(w,S,A=[],B=[]){if(!Qe(w))return;let D={};for(let r of S)Ce(w[r])&&(D[r]=w[r]);for(let r of A)ht(w[r])&&(D[r]=w[r]);for(let r of B)typeof w[r]=="boolean"&&(D[r]=w[r]);return D}function Vt(w,S,A){return Array.isArray(w)?w.slice(0,S).map(A).filter(Boolean):[]}function wi(w){if(!(!Qe(w)||!Array.isArray(w.folders)||!Array.isArray(w.jumpservers)))return{...et(w,[],["revision"],["temporarilyDisabled"]),folders:Vt(w.folders,2e3,S=>Ce(S?.id)&&Ce(S?.label)?et(S,["id","label","parentId"]):void 0),jumpservers:Vt(w.jumpservers,32,S=>Ce(S?.id)&&Ce(S?.label)?et(S,["id","label"]):void 0)}}function At(w,S){if(!Qe(w)||!Array.isArray(w.expanded)||!Array.isArray(w.pages))return;let A=[];for(let B of w.pages.slice().sort((D,r)=>It(r?.[0])-It(D?.[0])).slice(0,xi)){if(!Array.isArray(B)||B.length!==2)continue;let[D,r]=B;if(!Ce(D)||!Qe(r)||!Number.isInteger(r.offset)||r.offset<0||!Qe(r.data)||!Array.isArray(r.data.items)||!ht(r.data.total))continue;let o=!S&&(D==="nodes"||D.startsWith("children:"));if(S?!D.startsWith("hosts:"):!o&&!D.startsWith("assets:"))continue;let c=Vt(r.data.items,o?500:S?200:100,u=>S?Ce(u?.id)&&Ce(u?.label)&&Ce(u?.host)&&Ce(u?.username)&&ht(u?.port)?et(u,["id","label","folderId","kind","host","username"],["port"]):void 0:o?Ce(u?.nodeId)&&Ce(u?.key)&&Ce(u?.name)?et(u,["nodeId","key","name"],["assetCount"],["hasChildren"]):void 0:Ce(u?.assetId)&&Ce(u?.name)&&Ce(u?.address)&&Ce(u?.platform)?et(u,["assetId","name","address","platform"]):void 0);c.length===r.data.items.length&&A.push([D,{offset:r.offset,data:{items:c,total:r.data.total,hasMore:!!r.data.hasMore,truncated:!!r.data.truncated}}])}return{expanded:w.expanded.filter(Ce).slice(0,2001),scroll:ht(w.scroll)?w.scroll:0,pages:A}}function Ji(){try{return localStorage}catch{return}}var Mt=class{constructor(S,A=Ji(),B=()=>Date.now()){this.storage=A;this.now=B;this.key=yi+encodeURIComponent(S);try{let D=A?.getItem(this.key);if(D&&D.length<=Kt){let r=JSON.parse(D);if(r.schema===1&&ht(r.writtenAt)&&this.now()-r.writtenAt>=0&&this.now()-r.writtenAt<Vi&&(this.catalog=wi(r.catalog),this.catalog)){let o=At(r.host,!0);o&&this.host.restore(o);for(let u of Array.isArray(r.jumps)?r.jumps.slice(0,32):[]){if(!Array.isArray(u)||!this.catalog.jumpservers.some(a=>a.id===u[0]))continue;let n=At(u[1],!1);n&&this.jump(u[0]).restore(n)}let c=r.preferences;Qe(c)&&(this.preferences={source:c.source==="jumpserver"?"jumpserver":"ssh",instanceId:this.catalog.jumpservers.some(u=>u.id===c.instanceId)?c.instanceId:this.catalog.jumpservers[0]?.id??"",folder:this.catalog.folders.some(u=>u.id===c.folder)?c.folder:""})}}}catch{}this.host.onChange=this.schedule}host=new nt([""]);jumps=new Map;key;catalog;preferences={source:"ssh",instanceId:"",folder:""};timer;jump(S){let A=this.jumps.get(S);return A||(A=new nt,A.onChange=this.schedule,this.jumps.set(S,A)),A}schedule=()=>{this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},200))};flush(){if(!(!this.catalog||!this.storage))try{let S=At(this.host.export(),!0),A=[...this.jumps].map(([a,h])=>[a,At(h.export(),!1)]),B={schema:1,writtenAt:this.now(),catalog:wi(this.catalog),preferences:this.preferences,host:S,jumps:A},D=[S,...A.map(([,a])=>a)],r=D.flatMap(a=>a.pages.map(h=>({tree:a,page:h})));D.forEach(a=>{a.pages=[]});let o=JSON.stringify(B).length,c=0;for(let{tree:a,page:h}of r.sort((_,l)=>It(l.page[0])-It(_.page[0]))){let _=JSON.stringify(h).length+1;c<xi&&o+_<Kt&&(a.pages.push(h),o+=_,c++)}let u=JSON.stringify(B);if(u.length>Kt)return;let n=[];for(let a=0;a<this.storage.length;a++){let h=this.storage.key(a);if(h?.startsWith(yi)&&h!==this.key){let _=0;try{_=JSON.parse(this.storage.getItem(h)??"{}").writtenAt??0}catch{}n.push({key:h,time:_})}}n.sort((a,h)=>h.time-a.time).slice(2).forEach(({key:a})=>this.storage.removeItem(a)),this.storage.setItem(this.key,u)}catch{}}dispose(){clearTimeout(this.timer),this.flush(),this.host.onChange=void 0,this.host.dispose(),this.jumps.forEach(S=>{S.onChange=void 0,S.dispose()})}};var P=require("react/jsx-runtime"),Ei={terminals:[],operations:[],revision:0,capabilities:{local:!1,external:!1},hostPlatform:""},ki={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"},Bt=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`page-${Date.now()}-${Math.random()}`;function Jt({ctx:w,sessionId:S,visible:A=!0,onClose:B}){let[D]=(0,Z.useState)(()=>new Mt(S)),[r,o]=(0,Z.useState)(Ei),[c,u]=(0,Z.useState)(new Map),[n,a]=(0,Z.useState)(""),[h,_]=(0,Z.useState)(""),[l,i]=(0,Z.useState)(D.catalog),[t,e]=(0,Z.useState)(""),[s,d]=(0,Z.useState)(""),[g,p]=(0,Z.useState)(""),[v,f]=(0,Z.useState)(D.preferences.folder),[m,E]=(0,Z.useState)(D.preferences.source),[k,x]=(0,Z.useState)(!1),[C,M]=(0,Z.useState)(!1),[z,j]=(0,Z.useState)(!1),[U,$]=(0,Z.useState)(D.preferences.instanceId),[b,L]=(0,Z.useState)(),[R,T]=(0,Z.useState)(),H=D.host,q=D.jumps;U&&D.jump(U);let[X,Y]=(0,Z.useState)(!1),[I,y]=(0,Z.useState)(!1),[F,N]=(0,Z.useState)(()=>rt("dsh-zterm.list-width",240,180,440)),[K,V]=(0,Z.useState)(!1),[ie,he]=(0,Z.useState)(!1),[le,ne]=(0,Z.useState)(),G=(0,Z.useRef)(!0),Fe=(0,Z.useRef)(A),We=(0,Z.useRef)(-1),qe=(0,Z.useRef)(async()=>{}),Ke=(0,Z.useRef)(n),$e=(0,Z.useRef)(0),we=(0,Z.useRef)(0),Ae=(0,Z.useRef)(0),Re=(0,Z.useRef)(null),Ne=(0,Z.useRef)(null),tt=Et();Fe.current=A,Ke.current=n;let pe=(0,Z.useCallback)(O=>_(O),[]);(0,Z.useEffect)(()=>{let O=setTimeout(()=>p(s.trim()),150);return()=>clearTimeout(O)},[s]),(0,Z.useEffect)(()=>()=>D.dispose(),[D]),(0,Z.useEffect)(()=>{D.preferences={source:m,instanceId:U,folder:v},D.schedule()},[D,m,U,v]),(0,Z.useEffect)(()=>{G.current=!0,o(Ei),u(new Map),We.current=-1;let O=!1,ee=!1,fe,ae,ve=new AbortController,me=async()=>{try{ee||(await te(w,"client/attach",{sessionId:S,pageId:Bt},ve.signal),ee=!0);let Pe=await te(w,"poll",{sessionId:S,cursor:We.current},ve.signal);if(O)return;We.current=Pe.cursor,o(Pe.workspace),u(zt=>ti(zt,Pe)),Pe.workspace.terminals.some(zt=>zt.id===Ke.current)||a(Pe.workspace.terminals[0]?.id??"")}catch(Pe){O||_(Pe instanceof Error?Pe.message:"\u65E0\u6CD5\u8BFB\u53D6\u7EC8\u7AEF\u72B6\u6001")}},ze=()=>ae||(ae=me().finally(()=>{ae=void 0}),ae),_t=async()=>{await ze(),O||(fe=setTimeout(_t,Fe.current?200:1e3))};return qe.current=ze,_t(),te(w,"saved-workspace",{sessionId:S}).then(Pe=>{O||he(Pe.length>0)}).catch(()=>{}),()=>{O=!0,G.current=!1,clearTimeout(fe),ve.abort()}},[w,S]);let ke=(0,Z.useCallback)(async(O,ee=!0)=>{let fe=++$e.current;ee&&(H.invalidate(),q.forEach(me=>me.invalidate()));let ae=await te(w,"catalog",{folderId:"root"},O);if(O?.aborted||fe!==$e.current||!G.current)return;let ve=D.catalog&&D.catalog.revision!==ae.revision;return ve&&H.invalidate(),H.retain(new Set(["",...ae.folders.map(me=>me.id)])),H.seed("hosts:",{items:ae.hosts,total:ae.total,hasMore:ae.total>200}),q.forEach((me,ze)=>{ae.jumpservers.some(_t=>_t.id===ze)?ve&&me.invalidate():(me.dispose(),q.delete(ze))}),D.catalog=ae,D.schedule(),e(""),i(ae),f(me=>ae.folders.some(ze=>ze.id===me)?me:""),$(me=>ae.jumpservers.some(ze=>ze.id===me)?me:ae.jumpservers[0]?.id??""),ae},[w,H,q,D]),Me=(0,Z.useRef)(A&&!I);(0,Z.useEffect)(()=>{let O=A&&!I;O&&!Me.current&&(H.invalidate(),q.forEach(ee=>ee.invalidate())),Me.current=O},[A,I,H,q]),(0,Z.useEffect)(()=>{if(!A||I)return;let O=new AbortController;return ke(O.signal,!1).catch(ee=>{O.signal.aborted||e(ee.message)}),()=>O.abort()},[ke,A,I,r.catalogRevision]);let Te=async(O,ee)=>{let fe=++Ae.current;V(!0);try{let ae=await ke(void 0,!1);if(!ae||fe!==Ae.current||!G.current)return;if(O==="host"){let ve=ee?(await te(w,"catalog",{targetId:ee.id})).hosts.find(me=>me.id===ee.id):null;if(fe!==Ae.current||!G.current)return;if(ee&&!ve)throw new Error("\u4E3B\u673A\u5DF2\u79FB\u9664\uFF0C\u8BF7\u5237\u65B0\u5217\u8868");x(ve)}else{let ve=ee?ae[O==="folder"?"folders":"jumpservers"].find(me=>me.id===ee.id):null;if(ee&&!ve)throw new Error("\u914D\u7F6E\u5DF2\u79FB\u9664\uFF0C\u8BF7\u5237\u65B0\u5217\u8868");O==="folder"?j(ve):M(ve)}}catch(ae){G.current&&fe===Ae.current&&pe(ae.message)}finally{G.current&&fe===Ae.current&&V(!1)}},oe=()=>{Ae.current++,V(!1),x(!1),M(!1),j(!1)},xe=(0,Z.useCallback)(async(O,ee={})=>{V(!0),_("");try{let fe=await te(w,O,{sessionId:S,pageId:Bt,...ee});if(G.current)return await qe.current(),fe}catch(fe){G.current&&pe(fe instanceof Error?fe.message:"\u64CD\u4F5C\u5931\u8D25")}finally{G.current&&V(!1)}},[w,S,pe]),Pt=async O=>{let ee=await xe("connect",{target:O});ee?.id&&a(ee.id)};(0,Z.useEffect)(()=>{if(!A||!Re.current)return;let O=()=>Ne.current?.scrollIntoView({block:"nearest",inline:"nearest"});O();let ee=new ResizeObserver(O);return ee.observe(Re.current),()=>ee.disconnect()},[n,A,r.terminals.length]);let re=r.terminals.find(O=>O.id===n),Oe=r.binding,dt=re&&Oe?.terminalId===re.id&&Oe.generation===re.generation,Ee=r.terminals.find(O=>O.trust),Ve=Ee?{terminalId:Ee.id,generation:Ee.generation}:{},ut=O=>O.target.source==="local"?O.target.label:`${O.target.username??""}@${O.target.host??O.target.label}${O.target.port?`:${O.target.port}`:""}`,Je=re?{terminalId:re.id,generation:re.generation}:{},Ii=re?r.operations.filter(O=>O.status==="executing"&&O.terminalId===re.id).at(-1)?.startedAt??(re.state==="connecting"?re.createdAt:void 0):void 0,Xt=ei(Ii),ft=l?.jumpservers?.find(O=>O.id===U),Yt=(O="")=>{let ee=[""],fe=new Set,ae=new Map((l?.folders??[]).map(ve=>[ve.id,ve]));for(;O&&!fe.has(O);)fe.add(O),ee.push(O),O=ae.get(O)?.parentId??"";H.reveal(ee)};(0,Z.useEffect)(()=>{we.current++,L(void 0)},[U,m]);let Mi=async O=>{let ee=++we.current;T(O),L(void 0);try{let fe=await te(w,"jump/query",{instanceId:U,operation:"accounts",assetId:O.assetId});ee===we.current&&G.current&&L(fe.accounts)}catch(fe){ee===we.current&&G.current&&pe(fe.message)}},Bi=O=>{let ee=O.clientX,fe=F;tt(O,ae=>{let ve=Math.max(180,Math.min(440,fe+ee-ae.clientX));N(ve),st("dsh-zterm.list-width",ve)})};return(0,P.jsxs)("div",{className:"zt-workbench",children:[l?.temporarilyDisabled&&(0,P.jsx)("div",{className:"zt-workbench-notice",role:"status",children:"zTerm \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230\u672C\u63D2\u4EF6\u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\uFF1B\u624B\u5DE5\u8FDE\u63A5\u3001\u7EC8\u7AEF\u548C\u914D\u7F6E\u7BA1\u7406\u4ECD\u53EF\u4F7F\u7528\u3002\u53EF\u5728\u300C\u8BBE\u7F6E \u2192 zTerm\u300D\u6062\u590D\u3002"}),h&&(0,P.jsxs)("div",{className:"zt-error-banner",role:"alert",children:[(0,P.jsx)("span",{children:h}),(0,P.jsx)("button",{"aria-label":"\u5173\u95ED\u9519\u8BEF\u63D0\u793A",onClick:()=>_(""),children:"\xD7"})]}),(0,P.jsxs)("div",{className:"zt-workbench-body",children:[(0,P.jsxs)("main",{className:"zt-terminal-area",children:[(0,P.jsxs)("div",{className:"zt-terminal-topbar",children:[(0,P.jsx)("nav",{ref:Re,className:"zt-terminal-tabs","aria-label":"\u7EC8\u7AEF\u6807\u7B7E",children:r.terminals.map(O=>(0,P.jsxs)("div",{ref:O.id===n?Ne:void 0,className:`zt-tab ${O.id===n?"active":""}`,children:[(0,P.jsxs)("button",{onClick:()=>a(O.id),title:ut(O),children:[(0,P.jsx)("i",{className:`zt-state-dot ${O.state}`}),O.target.label]}),(0,P.jsx)("button",{"aria-label":`\u5173\u95ED\u7EC8\u7AEF ${O.target.label}`,onClick:()=>ne({text:`\u5173\u95ED\u300C${O.target.label}\u300D\u7684\u7EC8\u7AEF\u8FDE\u63A5\uFF1F`,act:()=>{xe("close",{terminalId:O.id}),ne(void 0)}}),children:"\xD7"})]},O.id))}),(0,P.jsxs)("div",{className:"zt-terminal-controls",children:[(0,P.jsx)("button",{disabled:!r.capabilities.local||K,title:r.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 ${de} \u8BBE\u7F6E\u4E2D\u542F\u7528\u672C\u5730\u7EC8\u7AEF\u5E76\u4FDD\u5B58`,onClick:()=>void Pt({kind:"local"}),children:"\u6253\u5F00\u672C\u673A\u7EC8\u7AEF"}),(0,P.jsx)("button",{title:"\u64CD\u4F5C\u8BB0\u5F55",onClick:()=>Y(!X),children:"\u8BB0\u5F55"}),I&&(0,P.jsx)("button",{title:"\u663E\u793A\u673A\u5668\u5217\u8868","aria-expanded":!1,onClick:()=>y(!1),children:"\u673A\u5668\u5217\u8868"}),B&&(0,P.jsx)("button",{"aria-label":`\u6536\u8D77 ${de}`,onClick:B,children:"\xD7"})]})]}),re?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"zt-terminal-toolbar",children:[(0,P.jsxs)("div",{className:"zt-target",title:ut(re),children:[ut(re),(0,P.jsxs)("span",{children:[ki[re.state],re.busy?" \xB7 AI \u6267\u884C\u4E2D":"",Xt?` \xB7 ${Xt}`:""]})]}),(0,P.jsxs)("div",{className:"zt-actions",children:[(0,P.jsx)("button",{disabled:K||re.state!=="ready"||!re.agentReady||re.uncertain,onClick:()=>void xe("bind",Je),children:dt?"\u5DF2\u7ED1\u5B9A AI":"\u7ED1\u5B9A AI"}),(0,P.jsxs)("label",{className:`zt-mode ${dt&&Oe.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,P.jsx)("input",{type:"checkbox","aria-label":"\u5141\u8BB8AI\u5199\u64CD\u4F5C",checked:!!(dt&&Oe.mode==="readwrite"),disabled:!dt||K||!re.agentReady||re.uncertain,onChange:O=>void xe("mode",{...Je,mode:O.target.checked?"readwrite":"read"})}),"\u5141\u8BB8AI\u5199\u64CD\u4F5C"]}),(0,P.jsx)("button",{disabled:!re.busy,onClick:()=>void xe("stop",Je),children:"\u505C\u6B62"}),(0,P.jsx)("button",{disabled:K||re.busy,onClick:()=>void xe(re.state==="ready"?"disconnect":"reconnect",Je),children:re.state==="ready"?"\u65AD\u5F00":"\u91CD\u8FDE"})]})]}),!re.agentReady&&re.state==="ready"&&!re.uncertain&&(0,P.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,P.jsx)("button",{onClick:()=>void xe("shell-ready",Je),children:"\u786E\u8BA4\u7A7A\u95F2 Shell"})]}),re.uncertain&&(0,P.jsxs)("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",(0,P.jsx)("button",{disabled:K||re.busy,onClick:()=>ne({text:`\u91CD\u5EFA\u300C${re.target.label}\u300D\u7684\u8FDE\u63A5\uFF1F\u5F53\u524D Shell \u4F1A\u65AD\u5F00\uFF0C\u4ECD\u5728\u524D\u53F0\u8FD0\u884C\u7684\u547D\u4EE4\u53EF\u80FD\u968F\u4E4B\u7EC8\u6B62\uFF0C\u8BF7\u5148\u5728\u7EC8\u7AEF\u6838\u5B9E\u8FDC\u7AEF\u72B6\u6001\u3002`,act:()=>{xe("reconnect",Je),ne(void 0)}}),children:"\u91CD\u5EFA\u8FDE\u63A5"})]}),re.error&&(0,P.jsx)("div",{className:"zt-notice danger",children:re.error})]}):(0,P.jsxs)("div",{className:"zt-empty",children:[(0,P.jsx)("div",{className:"zt-terminal-mark",children:">_"}),(0,P.jsx)("h3",{children:"\u8FDE\u63A5\u4E00\u53F0\u673A\u5668"}),(0,P.jsxs)("p",{children:["\u4ECE\u53F3\u4FA7\u9009\u62E9\u4E3B\u673A\u6216 JumpServer \u8D44\u4EA7\u3002",(0,P.jsx)("br",{}),"\u8FDE\u63A5\u540E\u53EF\u624B\u5DE5\u64CD\u4F5C\uFF0C\u6216\u7ED1\u5B9A\u7ED9\u5F53\u524D DSH \u5BF9\u8BDD\u4E2D\u7684 AI\u3002"]}),r.capabilities.automatic&&(0,P.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,P.jsx)("button",{className:"zt-primary",disabled:K,onClick:()=>void Te("host"),children:"\u6DFB\u52A0\u8FDC\u7A0B\u4E3B\u673A"}),ie&&(0,P.jsx)("button",{onClick:()=>void xe("restore"),children:"\u6062\u590D\u4E0A\u6B21\u7EC8\u7AEF\u5217\u8868\uFF08\u9ED8\u8BA4\u53EA\u8BFB\uFF09"})]}),(0,P.jsx)("div",{className:"zt-screens",children:r.terminals.map(O=>(0,P.jsx)(pi,{ctx:w,sessionId:S,terminal:O,buffer:c.get(O.id),visible:A&&O.id===n,onError:pe},`${O.id}:${O.generation}`))}),(0,P.jsxs)("footer",{className:"zt-statusbar",children:[(0,P.jsxs)("div",{className:"zt-status-info",children:[(0,P.jsx)("span",{children:Oe?`AI \u7ED1\u5B9A\uFF1A${r.terminals.find(O=>O.id===Oe.terminalId)?.target.label??Oe.terminalId} \xB7 ${Oe.mode==="readwrite"?`\u8BFB\u5199 ${Oe.writeCalls}/${Oe.maxWriteCalls}`:"\u53EA\u8BFB"}`:"AI \u5C1A\u672A\u7ED1\u5B9A\u7EC8\u7AEF"}),(0,P.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 ",r.hostPlatform||"\u6B63\u5728\u8FDE\u63A5"]})]}),re&&(0,P.jsx)("button",{onClick:()=>{te(w,"terminal/export",{sessionId:S,terminalId:re.id}).then(O=>gt(`zterm-${vt()}-\u7EC8\u7AEF.txt`,`\u7EC8\u7AEF\uFF1A${ut(re)}
11
11
  \u8BF4\u660E\uFF1A\u4EC5\u5305\u542B\u6709\u754C\u5386\u53F2\u7F13\u51B2\uFF0C\u53EF\u80FD\u5DF2\u622A\u65AD\u3002
12
12
 
13
- ${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,B.jsxs)("div",{className:"zt-records",children:[(0,B.jsxs)("header",{children:[(0,B.jsx)("strong",{children:"\u5B9E\u9645\u64CD\u4F5C\u8BB0\u5F55"}),(0,B.jsx)("button",{onClick:()=>{ie(T,"results",{sessionId:R,limit:200}).then(I=>it(`zterm-${rt()}-\u64CD\u4F5C\u8BB0\u5F55.json`,JSON.stringify({version:1,sessionId:R,historyLimited:!0,records:I},null,2),"application/json")).catch(I=>se(I.message))},children:"\u5BFC\u51FA JSON"})]}),!L.operations.length&&(0,B.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"}),L.operations.slice().reverse().map(I=>(0,B.jsxs)("details",{children:[(0,B.jsxs)("summary",{children:[(0,B.jsx)("span",{className:`zt-record-status ${I.status}`,children:Zt[I.status]}),(0,B.jsx)("span",{children:I.label}),(0,B.jsx)("time",{children:new Date(I.startedAt).toLocaleTimeString("zh-CN")})]}),(0,B.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,B.jsx)("pre",{children:I.error||I.output||"\uFF08\u65E0\u8F93\u51FA\uFF09"})]},I.id))]})]}),!C&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{className:"zt-list-handle",role:"separator","aria-label":"\u8C03\u6574\u673A\u5668\u5217\u8868\u5BBD\u5EA6","aria-orientation":"vertical",onMouseDown:oi}),(0,B.jsxs)("aside",{className:"zt-hosts",style:{width:N},children:[(0,B.jsxs)("div",{className:"zt-list-header",children:[(0,B.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u8D44\u4EA7"}),(0,B.jsxs)("div",{className:"zt-list-header-actions",children:[(0,B.jsx)("button",{"aria-label":"\u5237\u65B0\u673A\u5668\u5217\u8868",title:"\u5237\u65B0\u673A\u5668\u5217\u8868",onClick:()=>void ye().catch(I=>se(I.message)),children:"\u21BB"}),(0,B.jsx)("button",{title:"\u6536\u8D77\u673A\u5668\u5217\u8868","aria-expanded":!0,onClick:()=>H(!0),children:"\u6536\u8D77\u5217\u8868"})]})]}),(0,B.jsxs)("div",{className:"zt-source-tabs",children:[(0,B.jsx)("button",{className:p==="ssh"?"active":"",onClick:()=>{g("ssh"),r(0),t("")},children:"\u8FDC\u7A0B\u4E3B\u673A"}),(0,B.jsx)("button",{className:p==="jumpserver"?"active":"",onClick:()=>{g("jumpserver"),r(0),t("")},children:"JumpServer"})]}),(0,B.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)}}),p==="ssh"?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-list-actions",children:[(0,B.jsx)("button",{onClick:()=>m(null),children:"\uFF0B \u4E3B\u673A"}),(0,B.jsx)("button",{onClick:()=>w(null),children:"\uFF0B \u6587\u4EF6\u5939"}),(0,B.jsx)("button",{onClick:()=>void ie(T,"hosts/export").then(I=>it(`zterm-${rt()}-ssh-config`,I)).catch(I=>se(I.message)),children:"\u5BFC\u51FA"})]}),(0,B.jsxs)("div",{className:"zt-host-browser",children:[(0,B.jsx)(wt,{label:"\u8C03\u6574\u4E3B\u673A\u6587\u4EF6\u5939\u9AD8\u5EA6",storageKey:"dsh-zterm.folder-tree-height",children:(0,B.jsx)(qt,{folders:_?.folders??[],selected:l,onSelect:I=>{v(I),r(0)},onEdit:w,onDelete:I=>X({text:`\u5220\u9664\u6587\u4EF6\u5939\u300C${I.label}\u300D\uFF1F\u6587\u4EF6\u5939\u5FC5\u987B\u4E3A\u7A7A\u3002`,act:()=>{ie(T,"folder/delete",{id:I.id,revision:_?.revision}).then(()=>(l===I.id&&v(""),ye())).catch(re=>se(re.message)),X(void 0)}})})},"folders"),(0,B.jsxs)("div",{className:"zt-host-list",children:[_?.hosts.map(I=>(0,B.jsxs)("div",{className:"zt-host-row",children:[(0,B.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,B.jsx)("span",{className:"zt-host-glyph",children:"\u25A4"}),(0,B.jsxs)("span",{children:[(0,B.jsx)("strong",{children:I.label}),(0,B.jsxs)("small",{children:[I.username,"@",I.host]})]})]}),(0,B.jsx)("button",{title:"\u7F16\u8F91\u4E3B\u673A",onClick:()=>m(I),children:"\u22EF"}),(0,B.jsx)("button",{title:"\u79FB\u9664\u4E3B\u673A\u914D\u7F6E",onClick:()=>X({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(T,"host/delete",{id:I.id,revision:_.revision}).then(()=>ye()).catch(re=>se(re.message)),X(void 0)}}),children:"\xD7"})]},I.id)),!_?.hosts.length&&(0,B.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,B.jsxs)("div",{className:"zt-pagination",children:[(0,B.jsxs)("span",{children:[_?.total??0," \u53F0",_?.total?` \xB7 \u5F53\u524D ${e+1}\u2013${Math.min(e+200,_.total)}`:""]}),(0,B.jsx)("button",{disabled:!e,onClick:()=>r(Math.max(0,e-200)),children:"\u2039"}),(0,B.jsx)("button",{disabled:e+200>=(_?.total??0),onClick:()=>r(e+200),children:"\u203A"})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("div",{className:"zt-list-actions",children:[(0,B.jsx)("button",{onClick:()=>x(null),children:"\uFF0B \u5B9E\u4F8B"}),et&&(0,B.jsx)("button",{onClick:()=>x(et),children:"\u7F16\u8F91"}),et&&(0,B.jsx)("button",{onClick:()=>X({text:`\u79FB\u9664\u300C${et.label}\u300D\u7684\u914D\u7F6E\uFF1F`,act:()=>{ie(T,"jump/delete",{id:A,revision:_.revision}).then(()=>{z(""),ye()}).catch(I=>se(I.message)),X(void 0)}}),children:"\u79FB\u9664"})]}),(0,B.jsxs)("select",{"aria-label":"JumpServer \u5B9E\u4F8B",value:A,onChange:I=>{z(I.target.value),q(""),r(0)},children:[(0,B.jsx)("option",{value:"",children:"\u9009\u62E9\u5B9E\u4F8B"}),_?.jumpservers.map(I=>(0,B.jsx)("option",{value:I.id,children:I.label},I.id))]}),(0,B.jsxs)("div",{className:"zt-host-browser",children:[A&&(0,B.jsx)(wt,{label:"\u8C03\u6574 JumpServer \u8D44\u4EA7\u8282\u70B9\u9AD8\u5EA6",storageKey:"dsh-zterm.jump-tree-height",children:(0,B.jsx)(Xt,{ctx:T,instanceId:A,nodes:$,selected:U,onSelect:I=>{q(I),r(0)},onError:se},A)},"jumpserver"),(0,B.jsxs)("div",{className:"zt-host-list",children:[E?.assets?.map(I=>(0,B.jsxs)("button",{className:"zt-asset-row",onClick:()=>void ni(I),children:[(0,B.jsx)("strong",{children:I.name}),(0,B.jsxs)("small",{children:[I.address," \xB7 ",I.platform]})]},I.assetId)),!A&&(0,B.jsx)("p",{className:"zt-list-empty",children:"\u5148\u6DFB\u52A0 JumpServer \u5B9E\u4F8B"})]})]}),(0,B.jsxs)("div",{className:"zt-pagination",children:[(0,B.jsxs)("span",{children:[E?.total??0," \u53F0"]}),(0,B.jsx)("button",{disabled:!e,onClick:()=>r(Math.max(0,e-100)),children:"\u2039"}),(0,B.jsx)("button",{disabled:!E?.hasMore,onClick:()=>r(e+100),children:"\u203A"})]})]})]})]})]}),u!==!1&&(0,B.jsx)(Vt,{ctx:T,host:u??void 0,folders:_?.folders??[],credentials:_?.credentials??[],defaultCredentialId:_?.defaultCredentialId,revision:_?.revision,onClose:()=>m(!1),onSaved:()=>void ye()}),y!==!1&&(0,B.jsx)(Gt,{ctx:T,profile:y??void 0,revision:_?.revision,onClose:()=>x(!1),onSaved:()=>void ye()}),S!==!1&&(0,B.jsx)(Jt,{ctx:T,folder:S??void 0,folders:_?.folders??[],revision:_?.revision,onClose:()=>w(!1),onSaved:()=>void ye()}),D&&(0,B.jsx)(Ne,{title:`\u9009\u62E9\u8D26\u53F7 \xB7 ${K?.name??""}`,onClose:()=>P(void 0),children:(0,B.jsxs)("div",{className:"zt-account-list",children:[D.map(I=>(0,B.jsxs)("button",{disabled:!I.canConnect||j,onClick:()=>{Le({kind:"jumpserver",instanceId:A,assetId:K.assetId,accountId:I.accountId,label:K.name,accountName:I.name||I.username}),P(void 0)},children:[(0,B.jsx)("strong",{children:I.name}),(0,B.jsxs)("span",{children:[I.username,I.canConnect?"":" \xB7 \u65E0\u8FDE\u63A5\u6743\u9650"]})]},I.accountId)),!D.length&&(0,B.jsx)("p",{children:"\u6CA1\u6709\u53EF\u7528\u8D26\u53F7"})]})}),O&&ve?.trust&&(0,B.jsx)(Ne,{title:ve.trust.kind==="changed"?"SSH \u4E3B\u673A\u6307\u7EB9\u5DF2\u53D8\u66F4":"\u6838\u5B9E SSH \u4E3B\u673A\u8EAB\u4EFD",onClose:()=>{ae("disconnect",$e)},children:(0,B.jsxs)("div",{className:"zt-trust",children:[(0,B.jsxs)("p",{children:[ve.target.label," \xB7 ",ve.trust.username,"@",ve.trust.host,":",ve.trust.port]}),(0,B.jsxs)("pre",{children:[ve.trust.algorithm,`
14
- `,ve.trust.fingerprint]}),ve.trust.trustedFingerprint&&(0,B.jsxs)("p",{children:["\u539F\u6307\u7EB9\uFF1A",ve.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:ve.trust.kind==="changed"?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{onClick:()=>void ae("disconnect",$e),children:"\u53D6\u6D88\u8FDE\u63A5"}),(0,B.jsx)("button",{onClick:()=>{ae("trust/reset",$e)},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",{...$e,requestId:ve.trust.requestId,decision:"reject"}),children:"\u62D2\u7EDD"}),(0,B.jsx)("button",{onClick:()=>void ae("trust",{...$e,requestId:ve.trust.requestId,decision:"trust-once"}),children:"\u4EC5\u4FE1\u4EFB\u6B64\u6B21\u8FDE\u63A5"}),(0,B.jsx)("button",{className:"zt-primary",onClick:()=>void ae("trust",{...$e,requestId:ve.trust.requestId,decision:"trust-always"}),children:"\u4FE1\u4EFB\u5E76\u4FDD\u5B58"})]})})]})}),fe&&(0,B.jsxs)(Ne,{title:"\u786E\u8BA4\u64CD\u4F5C",onClose:()=>X(void 0),children:[(0,B.jsx)("p",{children:fe.text}),(0,B.jsxs)("footer",{children:[(0,B.jsx)("button",{onClick:()=>X(void 0),children:"\u53D6\u6D88"}),(0,B.jsx)("button",{className:"zt-primary",onClick:fe.act,children:"\u786E\u8BA4"})]})]})]})}var ge=require("react");var Se=require("react");var Q=require("react/jsx-runtime");function Qt({ctx:T,credentials:R,revision:O,onSaved:W}){let[L,s]=(0,Se.useState)(),[o,c]=(0,Se.useState)(""),[f,a]=(0,Se.useState)("key"),[n,d]=(0,Se.useState)(""),[_,h]=(0,Se.useState)(""),[i,t]=(0,Se.useState)(!1),[e,r]=(0,Se.useState)(!1),[l,v]=(0,Se.useState)(!1),[p,g]=(0,Se.useState)(""),[u,m]=(0,Se.useState)(""),y=(0,Se.useRef)(0);(0,Se.useEffect)(()=>()=>{y.current++},[]);let x=S=>{y.current++,v(!1),s(S),c(S?.label??""),a(S?.authType??"key"),d(S?.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:()=>{W().then(()=>g("")).catch(S=>g(S.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:R.length?R.map(S=>(0,Q.jsxs)("div",{className:"zt-credential-row",role:"listitem",children:[(0,Q.jsxs)("span",{children:[(0,Q.jsx)("b",{children:S.label}),(0,Q.jsx)("small",{children:He[S.authType]})]}),(0,Q.jsx)("button",{type:"button",disabled:e,"aria-label":`\u7F16\u8F91\u51ED\u8BC1 ${S.label}`,onClick:()=>x(S),children:"\u7F16\u8F91"})]},S.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:S=>{S.preventDefault(),!(e||l)&&(r(!0),g(""),m(""),y.current++,ie(T,"credential/save",{credential:{id:L?.id,label:o,authType:f},content:n,passphrase:_,clearPassphrase:i,revision:O}).then(async()=>{x(),await W(),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:L?"\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:o,placeholder:"\u4F8B\u5982\uFF1A\u8FD0\u7EF4\u79C1\u94A5",onChange:S=>c(S.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:S=>{y.current++,v(!1),a(S.target.value),d(""),h(""),t(!1),g("")},children:Object.entries(He).map(([S,w])=>(0,Q.jsx)("option",{value:S,children:w},S))})]})]}),(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:!L||L.authType!==f,placeholder:L?.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:S=>{y.current++,v(!1),d(S.target.value)}}):(0,Q.jsx)("input",{type:f==="password"?"password":"text",value:n,autoComplete:"new-password",required:f==="key-file"||!L||L.authType!==f,placeholder:f==="key-file"?"\u5BBF\u4E3B\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4F8B\u5982 ~/.ssh/id_ed25519":L?.authType===f?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u5BC6\u7801":"\u8F93\u5165\u5BC6\u7801",onChange:S=>d(S.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:S=>{let w=S.target.files?.[0],A=++y.current;if(S.target.value="",v(!1),!!w){if(w.size>1e5){g("\u79C1\u94A5\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 100 KB");return}v(!0),w.text().then(z=>{y.current===A&&(d(z),c(U=>U||w.name.slice(0,200)),g(""))}).catch(()=>{y.current===A&&g("\u8BFB\u53D6\u79C1\u94A5\u6587\u4EF6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")}).finally(()=>{y.current===A&&v(!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:_,onChange:S=>h(S.target.value),placeholder:L?"\u7559\u7A7A\u4FDD\u7559\u73B0\u6709\u53E3\u4EE4":"\u79C1\u94A5\u6709\u53E3\u4EE4\u65F6\u586B\u5199"})]}),L?.passphraseRef&&(0,Q.jsxs)("label",{className:"zt-check",children:[(0,Q.jsx)("input",{type:"checkbox",checked:i,onChange:S=>t(S.target.checked)}),"\u6E05\u9664\u79C1\u94A5\u53E3\u4EE4"]})]}),p&&(0,Q.jsx)("p",{role:"alert",className:"zt-error",children:p}),u&&(0,Q.jsx)("p",{role:"status",className:"zt-success",children:u}),(0,Q.jsxs)("div",{className:"zt-actions",children:[L&&(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>x(),children:"\u53D6\u6D88\u7F16\u8F91"}),(0,Q.jsx)("button",{className:"zt-primary",disabled:e||l,children:e?"\u4FDD\u5B58\u4E2D\u2026":l?"\u8BFB\u53D6\u6587\u4EF6\u2026":"\u4FDD\u5B58\u51ED\u8BC1"})]})]})})]})}var G=require("react/jsx-runtime"),ei=["allowLocalTerminal","defaultSshUsername","defaultPrivateKeyPath","defaultCredentialId","defaultPanelWidth","maxSessions","maxWriteCalls","commandTimeoutMs"];function ti({ctx:T}){let[R,O]=(0,ge.useState)(),[W,L]=(0,ge.useState)(""),[s,o]=(0,ge.useState)(!1),[c,f]=(0,ge.useState)(""),[a,n]=(0,ge.useState)(!1),[d,_]=(0,ge.useState)(""),h=ct(),[i,t]=(0,ge.useState)(String(h)),e=(0,ge.useRef)(),r=(0,ge.useRef)(!0),l=(0,ge.useCallback)(async()=>{let g=await ie(T,"catalog");if(!r.current)return;let u=e.current;e.current=g,O(m=>({...g,...Object.fromEntries(ei.filter(y=>u&&m?.[y]!==u[y]).map(y=>[y,m[y]]))}))},[T]);(0,ge.useEffect)(()=>t(String(h)),[h]),(0,ge.useEffect)(()=>(r.current=!0,l().catch(g=>{r.current&&L(g.message)}),()=>{r.current=!1}),[l]);let v=(g,u)=>{O({...R,[g]:u}),f("")},p=async g=>{if(!R||a)return;let u=!!R.temporarilyDisabled;n(!0),_(""),f(""),O({...R,temporarilyDisabled:g});try{await ie(T,"config",{patch:{temporarilyDisabled:g},revision:R.revision})}catch(m){O(y=>({...y,temporarilyDisabled:u})),_(m instanceof Error?m.message:"\u5207\u6362\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),n(!1);return}window.dispatchEvent(new CustomEvent("dsh-zterm:state")),n(!1);try{await l()}catch(m){_(m instanceof Error?m.message:"\u5DF2\u5207\u6362\uFF0C\u4F46\u5237\u65B0\u914D\u7F6E\u5931\u8D25")}};return(0,G.jsxs)("section",{className:"zt-settings",children:[(0,G.jsx)("h2",{children:le}),(0,G.jsxs)("div",{className:`zt-settings-card zt-switch-card${R?.temporarilyDisabled?" active":""}`,children:[(0,G.jsx)("strong",{children:"\u4E34\u65F6\u7981\u7528 zTerm"}),(0,G.jsxs)("label",{className:"zt-check",children:[(0,G.jsx)("input",{type:"checkbox",role:"switch","aria-label":"\u4E34\u65F6\u7981\u7528 zTerm",checked:!!R?.temporarilyDisabled,disabled:!R||a,onChange:g=>void p(g.target.checked)}),"AI \u6682\u65F6\u4E0D\u4F7F\u7528 zTerm"]}),(0,G.jsx)("p",{className:"zt-hint",children:"\u63D2\u4EF6\u4FDD\u6301\u542F\u7528\uFF0C\u53EA\u8BA9 AI \u6682\u65F6\u770B\u4E0D\u5230\u3001\u4E5F\u7528\u4E0D\u4E86 zTerm \u5DE5\u5177\uFF0C\u5E76\u505C\u6B62\u6CE8\u5165 zTerm \u63D0\u793A\uFF1B\u5DE5\u4F5C\u53F0\u3001\u624B\u5DE5\u7EC8\u7AEF\u548C\u4E3B\u673A\uFF0F\u51ED\u636E\u7BA1\u7406\u4E0D\u53D7\u5F71\u54CD\u3002\u70B9\u51FB\u7ACB\u5373\u751F\u6548\uFF0C\u65E0\u9700\u4FDD\u5B58\u8BBE\u7F6E\u3002"}),R?.temporarilyDisabled&&(0,G.jsx)("p",{className:"zt-switch-status",role:"status",children:"\u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230 zTerm \u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\u3002"}),d&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:d})]}),(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:i,onChange:g=>{t(g.target.value),Ft(Number(g.target.value))},onBlur:()=>t(String(h))})]}),(0,G.jsxs)("p",{className:"zt-hint",children:["\u9ED8\u8BA4 ",qe,"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"]})]}),W&&(0,G.jsx)("p",{className:"zt-error",role:"alert",children:W}),c&&(0,G.jsx)("p",{className:"zt-success",role:"status",children:c}),R?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("form",{onSubmit:g=>{g.preventDefault(),o(!0),L(""),f(""),ie(T,"config",{patch:Object.fromEntries(ei.map(u=>[u,R[u]])),revision:R.revision}).then(()=>ie(T,"catalog")).then(u=>{e.current=u,O(u),f(u.allowLocalTerminal?`\u914D\u7F6E\u5DF2\u4FDD\u5B58\u3002\u672C\u5730\u7EC8\u7AEF\u5DF2\u542F\u7528\uFF1A\u6253\u5F00 ${le}\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(u=>L(u.message)).finally(()=>o(!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:R.allowLocalTerminal,onChange:g=>v("allowLocalTerminal",g.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",le,"\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:R.defaultSshUsername??"",placeholder:"\u7559\u7A7A\u4F7F\u7528\u8FD0\u884C DSH \u7684\u8D26\u53F7",onChange:g=>v("defaultSshUsername",g.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:R.defaultCredentialId??"",onChange:g=>v("defaultCredentialId",g.target.value),children:[(0,G.jsx)("option",{value:"",children:"\u81EA\u52A8\u67E5\u627E\u5BBF\u4E3B\u9ED8\u8BA4\u79C1\u94A5\u6587\u4EF6"}),(R.credentials??[]).filter(g=>g.authType!=="password").map(g=>(0,G.jsxs)("option",{value:g.id,children:[g.label," \xB7 ",He[g.authType]]},g.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"}),!R.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:R.defaultPrivateKeyPath??"",placeholder:"\u7559\u7A7A\u81EA\u52A8\u67E5\u627E ~/.ssh \u4E0B\u7684\u9ED8\u8BA4\u79C1\u94A5",onChange:g=>v("defaultPrivateKeyPath",g.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(([g,u,m,y])=>(0,G.jsxs)("label",{className:"zt-field",children:[(0,G.jsx)("span",{children:u}),(0,G.jsx)("input",{type:"number",min:m,max:y,required:!0,value:R[g],onChange:x=>v(String(g),Number(x.target.value))})]},g))]}),(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",le,"\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 ",R.total," \u53F0\u4E3B\u673A\u3001",R.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)(Qt,{ctx:T,credentials:R.credentials??[],revision:R.revision,onSaved:l})]}):(0,G.jsx)("p",{className:"zt-hint",children:"\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026"})]})}var ii=`.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
+ ${O}`)).catch(O=>pe(O.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),X&&(0,P.jsxs)("div",{className:"zt-records",children:[(0,P.jsxs)("header",{children:[(0,P.jsx)("strong",{children:"\u5B9E\u9645\u64CD\u4F5C\u8BB0\u5F55"}),(0,P.jsx)("button",{onClick:()=>{te(w,"results",{sessionId:S,limit:200}).then(O=>gt(`zterm-${vt()}-\u64CD\u4F5C\u8BB0\u5F55.json`,JSON.stringify({version:1,sessionId:S,historyLimited:!0,records:O},null,2),"application/json")).catch(O=>pe(O.message))},children:"\u5BFC\u51FA JSON"})]}),!r.operations.length&&(0,P.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"}),r.operations.slice().reverse().map(O=>(0,P.jsxs)("details",{children:[(0,P.jsxs)("summary",{children:[(0,P.jsx)("span",{className:`zt-record-status ${O.status}`,children:ki[O.status]}),(0,P.jsx)("span",{children:O.label}),(0,P.jsx)("time",{children:new Date(O.startedAt).toLocaleTimeString("zh-CN")})]}),(0,P.jsxs)("p",{className:"zt-hint",children:[O.target.label," \xB7 \u9000\u51FA\u7801 ",O.exitCode??"\u672A\u77E5"," \xB7 ",O.completion??"\u672A\u6838\u9A8C",O.truncated?" \xB7 \u8BB0\u5F55\u5DF2\u622A\u65AD":""]}),(0,P.jsx)("pre",{children:O.error||O.output||"\uFF08\u65E0\u8F93\u51FA\uFF09"})]},O.id))]})]}),!I&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("div",{className:"zt-list-handle",role:"separator","aria-label":"\u8C03\u6574\u673A\u5668\u5217\u8868\u5BBD\u5EA6","aria-orientation":"vertical",onMouseDown:Bi}),(0,P.jsxs)("aside",{className:"zt-hosts",style:{width:F},children:[(0,P.jsxs)("div",{className:"zt-list-header",children:[(0,P.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u8D44\u4EA7"}),(0,P.jsxs)("div",{className:"zt-list-header-actions",children:[(0,P.jsx)("button",{"aria-label":"\u5237\u65B0\u673A\u5668\u5217\u8868",title:"\u5237\u65B0\u673A\u5668\u5217\u8868",onClick:()=>void ke().catch(O=>e(O.message)),children:"\u21BB"}),(0,P.jsx)("button",{title:"\u6536\u8D77\u673A\u5668\u5217\u8868","aria-expanded":!0,onClick:()=>y(!0),children:"\u6536\u8D77\u5217\u8868"})]})]}),t&&(0,P.jsxs)("div",{className:"zt-tree-message",role:"status",children:[(0,P.jsx)("span",{title:t,children:l?"\u66F4\u65B0\u5931\u8D25\uFF0C\u5F53\u524D\u663E\u793A\u7F13\u5B58":"\u76EE\u5F55\u52A0\u8F7D\u5931\u8D25"}),(0,P.jsx)("button",{onClick:()=>void ke().catch(O=>e(O.message)),children:"\u91CD\u8BD5"})]}),(0,P.jsxs)("div",{className:"zt-source-tabs",children:[(0,P.jsx)("button",{className:m==="ssh"?"active":"",onClick:()=>{E("ssh"),d(""),p("")},children:"\u8FDC\u7A0B\u4E3B\u673A"}),(0,P.jsx)("button",{className:m==="jumpserver"?"active":"",onClick:()=>{E("jumpserver"),d(""),p("")},children:"JumpServer"})]}),(0,P.jsx)("input",{className:"zt-list-search","aria-label":"\u641C\u7D22\u4E3B\u673A\u6216\u8D44\u4EA7",placeholder:"\u641C\u7D22\u540D\u79F0\u6216\u5730\u5740",value:s,onChange:O=>d(O.target.value)}),m==="ssh"?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"zt-list-actions",children:[(0,P.jsx)("button",{disabled:K,onClick:()=>void Te("host"),children:"\uFF0B \u4E3B\u673A"}),(0,P.jsx)("button",{disabled:K,onClick:()=>void Te("folder"),children:"\uFF0B \u6587\u4EF6\u5939"}),(0,P.jsx)("button",{onClick:()=>void te(w,"hosts/export").then(O=>gt(`zterm-${vt()}-ssh-config`,O)).catch(O=>pe(O.message)),children:"\u5BFC\u51FA"})]}),(0,P.jsx)("div",{className:"zt-host-browser",children:l?(0,P.jsx)(vi,{ctx:w,state:H,folders:l.folders,query:g,selected:v,busy:K,onSelect:f,onEdit:O=>void Te("folder",O),onConnect:O=>void Pt({targetId:O.id}),onHostEdit:O=>void Te("host",O),onHostDelete:O=>ne({text:`\u79FB\u9664\u300C${O.label}\u300D\u7684\u914D\u7F6E\uFF1F\u5DF2\u6709\u7EC8\u7AEF\u8FDE\u63A5\u4FDD\u6301\u539F\u76EE\u6807\u3002`,act:()=>{te(w,"host/delete",{id:O.id,revision:l.revision}).then(()=>ke()).catch(ee=>pe(ee.message)),ne(void 0)}}),onDelete:O=>ne({text:`\u5220\u9664\u6587\u4EF6\u5939\u300C${O.label}\u300D\uFF1F\u6587\u4EF6\u5939\u5FC5\u987B\u4E3A\u7A7A\u3002`,act:()=>{te(w,"folder/delete",{id:O.id,revision:l.revision}).then(()=>ke()).catch(ee=>pe(ee.message)),ne(void 0)}})}):(0,P.jsx)("p",{className:"zt-tree-message",role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u4E3B\u673A\u76EE\u5F55\u2026"})})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"zt-list-actions",children:[(0,P.jsx)("button",{disabled:K,onClick:()=>void Te("jump"),children:"\uFF0B \u5B9E\u4F8B"}),ft&&(0,P.jsx)("button",{disabled:K,onClick:()=>void Te("jump",ft),children:"\u7F16\u8F91"}),ft&&(0,P.jsx)("button",{onClick:()=>ne({text:`\u79FB\u9664\u300C${ft.label}\u300D\u7684\u914D\u7F6E\uFF1F`,act:()=>{te(w,"jump/delete",{id:U,revision:l.revision}).then(()=>{$(""),ke()}).catch(O=>pe(O.message)),ne(void 0)}}),children:"\u79FB\u9664"})]}),(0,P.jsxs)("select",{"aria-label":"JumpServer \u5B9E\u4F8B",value:U,onChange:O=>{$(O.target.value),d(""),p("")},children:[(0,P.jsx)("option",{value:"",children:"\u9009\u62E9\u5B9E\u4F8B"}),l?.jumpservers.map(O=>(0,P.jsx)("option",{value:O.id,children:O.label},O.id))]}),(0,P.jsx)("div",{className:"zt-host-browser",children:U?(0,P.jsx)(Ci,{ctx:w,instanceId:U,state:q.get(U),query:g,onChoose:O=>void Mi(O)},U):(0,P.jsx)("p",{className:"zt-list-empty",children:l?.jumpservers.length?"\u8BF7\u9009\u62E9 JumpServer \u5B9E\u4F8B":"\u5148\u6DFB\u52A0 JumpServer \u5B9E\u4F8B"})})]})]})]})]}),k!==!1&&(0,P.jsx)(mi,{ctx:w,host:k??void 0,defaultFolderId:v,folders:l?.folders??[],credentials:l?.credentials??[],defaultCredentialId:l?.defaultCredentialId,revision:l?.revision,onClose:oe,onSaved:O=>{Yt(O),ke().catch(ee=>pe(ee.message))}},k?.id??"new"),C!==!1&&(0,P.jsx)(bi,{ctx:w,profile:C??void 0,revision:l?.revision,onClose:oe,onSaved:()=>void ke()},C?.id??"new"),z!==!1&&(0,P.jsx)(Si,{ctx:w,folder:z??void 0,defaultParentId:v,folders:l?.folders??[],revision:l?.revision,onClose:oe,onSaved:O=>{Yt(O),ke().catch(ee=>pe(ee.message))}},z?.id??"new"),b&&(0,P.jsx)(je,{title:`\u9009\u62E9\u8D26\u53F7 \xB7 ${R?.name??""}`,onClose:()=>L(void 0),children:(0,P.jsxs)("div",{className:"zt-account-list",children:[b.map(O=>(0,P.jsxs)("button",{disabled:!O.canConnect||K,onClick:()=>{Pt({kind:"jumpserver",instanceId:U,assetId:R.assetId,accountId:O.accountId,label:R.name,accountName:O.name||O.username}),L(void 0)},children:[(0,P.jsx)("strong",{children:O.name}),(0,P.jsxs)("span",{children:[O.username,O.canConnect?"":" \xB7 \u65E0\u8FDE\u63A5\u6743\u9650"]})]},O.accountId)),!b.length&&(0,P.jsx)("p",{children:"\u6CA1\u6709\u53EF\u7528\u8D26\u53F7"})]})}),A&&Ee?.trust&&(0,P.jsx)(je,{title:Ee.trust.kind==="changed"?"SSH \u4E3B\u673A\u6307\u7EB9\u5DF2\u53D8\u66F4":"\u6838\u5B9E SSH \u4E3B\u673A\u8EAB\u4EFD",onClose:()=>{xe("disconnect",Ve)},children:(0,P.jsxs)("div",{className:"zt-trust",children:[(0,P.jsxs)("p",{children:[Ee.target.label," \xB7 ",Ee.trust.username,"@",Ee.trust.host,":",Ee.trust.port]}),(0,P.jsxs)("pre",{children:[Ee.trust.algorithm,`
14
+ `,Ee.trust.fingerprint]}),Ee.trust.trustedFingerprint&&(0,P.jsxs)("p",{children:["\u539F\u6307\u7EB9\uFF1A",Ee.trust.trustedFingerprint]}),(0,P.jsx)("p",{className:"zt-hint",children:"\u901A\u8FC7\u72EC\u7ACB\u53EF\u4FE1\u6E20\u9053\u6838\u5B9E\u6307\u7EB9\u540E\u518D\u7EE7\u7EED\u3002"}),(0,P.jsx)("footer",{children:Ee.trust.kind==="changed"?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("button",{onClick:()=>void xe("disconnect",Ve),children:"\u53D6\u6D88\u8FDE\u63A5"}),(0,P.jsx)("button",{onClick:()=>{xe("trust/reset",Ve)},children:"\u5DF2\u6838\u5B9E\u53D8\u66F4\uFF0C\u6E05\u9664\u65E7\u8BB0\u5F55"})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("button",{onClick:()=>void xe("trust",{...Ve,requestId:Ee.trust.requestId,decision:"reject"}),children:"\u62D2\u7EDD"}),(0,P.jsx)("button",{onClick:()=>void xe("trust",{...Ve,requestId:Ee.trust.requestId,decision:"trust-once"}),children:"\u4EC5\u4FE1\u4EFB\u6B64\u6B21\u8FDE\u63A5"}),(0,P.jsx)("button",{className:"zt-primary",onClick:()=>void xe("trust",{...Ve,requestId:Ee.trust.requestId,decision:"trust-always"}),children:"\u4FE1\u4EFB\u5E76\u4FDD\u5B58"})]})})]})}),le&&(0,P.jsxs)(je,{title:"\u786E\u8BA4\u64CD\u4F5C",onClose:()=>ne(void 0),children:[(0,P.jsx)("p",{children:le.text}),(0,P.jsxs)("footer",{children:[(0,P.jsx)("button",{onClick:()=>ne(void 0),children:"\u53D6\u6D88"}),(0,P.jsx)("button",{className:"zt-primary",onClick:le.act,children:"\u786E\u8BA4"})]})]})]})}var De=require("react");var Le=require("react");var Q=require("react/jsx-runtime");function Di({ctx:w,credentials:S,revision:A,onSaved:B}){let[D,r]=(0,Le.useState)(),[o,c]=(0,Le.useState)(""),[u,n]=(0,Le.useState)("key"),[a,h]=(0,Le.useState)(""),[_,l]=(0,Le.useState)(""),[i,t]=(0,Le.useState)(!1),[e,s]=(0,Le.useState)(!1),[d,g]=(0,Le.useState)(!1),[p,v]=(0,Le.useState)(""),[f,m]=(0,Le.useState)(""),E=(0,Le.useRef)(0);(0,Le.useEffect)(()=>()=>{E.current++},[]);let k=x=>{E.current++,g(!1),r(x),c(x?.label??""),n(x?.authType??"key"),h(x?.privateKeyPath??""),l(""),t(!1),v(""),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:()=>{B().then(()=>v("")).catch(x=>v(x.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:S.length?S.map(x=>(0,Q.jsxs)("div",{className:"zt-credential-row",role:"listitem",children:[(0,Q.jsxs)("span",{children:[(0,Q.jsx)("b",{children:x.label}),(0,Q.jsx)("small",{children:Ue[x.authType]})]}),(0,Q.jsx)("button",{type:"button",disabled:e,"aria-label":`\u7F16\u8F91\u51ED\u8BC1 ${x.label}`,onClick:()=>k(x),children:"\u7F16\u8F91"})]},x.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:x=>{x.preventDefault(),!(e||d)&&(s(!0),v(""),m(""),E.current++,te(w,"credential/save",{credential:{id:D?.id,label:o,authType:u},content:a,passphrase:_,clearPassphrase:i,revision:A}).then(async()=>{k(),await B(),m("\u51ED\u8BC1\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u5728\u4E3B\u673A\u4E2D\u6309\u540D\u79F0\u9009\u62E9\u3002")}).catch(C=>v(C.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:o,placeholder:"\u4F8B\u5982\uFF1A\u8FD0\u7EF4\u79C1\u94A5",onChange:x=>c(x.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:x=>{E.current++,g(!1),n(x.target.value),h(""),l(""),t(!1),v("")},children:Object.entries(Ue).map(([x,C])=>(0,Q.jsx)("option",{value:x,children:C},x))})]})]}),(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:a,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:x=>{E.current++,g(!1),h(x.target.value)}}):(0,Q.jsx)("input",{type:u==="password"?"password":"text",value:a,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:x=>h(x.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:x=>{let C=x.target.files?.[0],M=++E.current;if(x.target.value="",g(!1),!!C){if(C.size>1e5){v("\u79C1\u94A5\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 100 KB");return}g(!0),C.text().then(z=>{E.current===M&&(h(z),c(j=>j||C.name.slice(0,200)),v(""))}).catch(()=>{E.current===M&&v("\u8BFB\u53D6\u79C1\u94A5\u6587\u4EF6\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")}).finally(()=>{E.current===M&&g(!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:_,onChange:x=>l(x.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:x=>t(x.target.checked)}),"\u6E05\u9664\u79C1\u94A5\u53E3\u4EE4"]})]}),p&&(0,Q.jsx)("p",{role:"alert",className:"zt-error",children:p}),f&&(0,Q.jsx)("p",{role:"status",className:"zt-success",children:f}),(0,Q.jsxs)("div",{className:"zt-actions",children:[D&&(0,Q.jsx)("button",{type:"button",disabled:e,onClick:()=>k(),children:"\u53D6\u6D88\u7F16\u8F91"}),(0,Q.jsx)("button",{className:"zt-primary",disabled:e||d,children:e?"\u4FDD\u5B58\u4E2D\u2026":d?"\u8BFB\u53D6\u6587\u4EF6\u2026":"\u4FDD\u5B58\u51ED\u8BC1"})]})]})})]})}var J=require("react/jsx-runtime"),Li=["allowLocalTerminal","defaultSshUsername","defaultPrivateKeyPath","defaultCredentialId","defaultPanelWidth","maxSessions","maxWriteCalls","commandTimeoutMs"];function Ri({ctx:w}){let[S,A]=(0,De.useState)(),[B,D]=(0,De.useState)(""),[r,o]=(0,De.useState)(!1),[c,u]=(0,De.useState)(""),[n,a]=(0,De.useState)(!1),[h,_]=(0,De.useState)(""),l=xt(),[i,t]=(0,De.useState)(String(l)),e=(0,De.useRef)(),s=(0,De.useRef)(!0),d=(0,De.useCallback)(async()=>{let v=await te(w,"catalog");if(!s.current)return;let f=e.current;e.current=v,A(m=>({...v,...Object.fromEntries(Li.filter(E=>f&&m?.[E]!==f[E]).map(E=>[E,m[E]]))}))},[w]);(0,De.useEffect)(()=>t(String(l)),[l]),(0,De.useEffect)(()=>(s.current=!0,d().catch(v=>{s.current&&D(v.message)}),()=>{s.current=!1}),[d]);let g=(v,f)=>{A({...S,[v]:f}),u("")},p=async v=>{if(!S||n)return;let f=!!S.temporarilyDisabled;a(!0),_(""),u(""),A({...S,temporarilyDisabled:v});try{await te(w,"config",{patch:{temporarilyDisabled:v},revision:S.revision})}catch(m){A(E=>({...E,temporarilyDisabled:f})),_(m instanceof Error?m.message:"\u5207\u6362\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),a(!1);return}window.dispatchEvent(new CustomEvent("dsh-zterm:state")),a(!1);try{await d()}catch(m){_(m instanceof Error?m.message:"\u5DF2\u5207\u6362\uFF0C\u4F46\u5237\u65B0\u914D\u7F6E\u5931\u8D25")}};return(0,J.jsxs)("section",{className:"zt-settings",children:[(0,J.jsx)("h2",{children:de}),(0,J.jsxs)("div",{className:`zt-settings-card zt-switch-card${S?.temporarilyDisabled?" active":""}`,children:[(0,J.jsx)("strong",{children:"\u4E34\u65F6\u7981\u7528 zTerm"}),(0,J.jsxs)("label",{className:"zt-check",children:[(0,J.jsx)("input",{type:"checkbox",role:"switch","aria-label":"\u4E34\u65F6\u7981\u7528 zTerm",checked:!!S?.temporarilyDisabled,disabled:!S||n,onChange:v=>void p(v.target.checked)}),"AI \u6682\u65F6\u4E0D\u4F7F\u7528 zTerm"]}),(0,J.jsx)("p",{className:"zt-hint",children:"\u63D2\u4EF6\u4FDD\u6301\u542F\u7528\uFF0C\u53EA\u8BA9 AI \u6682\u65F6\u770B\u4E0D\u5230\u3001\u4E5F\u7528\u4E0D\u4E86 zTerm \u5DE5\u5177\uFF0C\u5E76\u505C\u6B62\u6CE8\u5165 zTerm \u63D0\u793A\uFF1B\u5DE5\u4F5C\u53F0\u3001\u624B\u5DE5\u7EC8\u7AEF\u548C\u4E3B\u673A\uFF0F\u51ED\u636E\u7BA1\u7406\u4E0D\u53D7\u5F71\u54CD\u3002\u70B9\u51FB\u7ACB\u5373\u751F\u6548\uFF0C\u65E0\u9700\u4FDD\u5B58\u8BBE\u7F6E\u3002"}),S?.temporarilyDisabled&&(0,J.jsx)("p",{className:"zt-switch-status",role:"status",children:"\u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u6536\u5230 zTerm \u63D0\u793A\uFF0C\u4E5F\u4E0D\u80FD\u8C03\u7528 zterm_* \u5DE5\u5177\u3002"}),h&&(0,J.jsx)("p",{className:"zt-error",role:"alert",children:h})]}),(0,J.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,J.jsxs)("div",{className:"zt-settings-card",children:[(0,J.jsx)("strong",{children:"\u7EC8\u7AEF\u5916\u89C2"}),(0,J.jsxs)("label",{className:"zt-field",children:[(0,J.jsx)("span",{children:"\u7EC8\u7AEF\u5B57\u4F53\u5927\u5C0F\uFF08px\uFF09"}),(0,J.jsx)("input",{type:"number",min:Ct,max:yt,step:1,value:i,onChange:v=>{t(v.target.value),hi(Number(v.target.value))},onBlur:()=>t(String(l))})]}),(0,J.jsxs)("p",{className:"zt-hint",children:["\u9ED8\u8BA4 ",Ge,"px\uFF0C\u53EF\u8C03 ",Ct,"\u2013",yt,"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"]})]}),B&&(0,J.jsx)("p",{className:"zt-error",role:"alert",children:B}),c&&(0,J.jsx)("p",{className:"zt-success",role:"status",children:c}),S?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("form",{onSubmit:v=>{v.preventDefault(),o(!0),D(""),u(""),te(w,"config",{patch:Object.fromEntries(Li.map(f=>[f,S[f]])),revision:S.revision}).then(()=>te(w,"catalog")).then(f=>{e.current=f,A(f),u(f.allowLocalTerminal?`\u914D\u7F6E\u5DF2\u4FDD\u5B58\u3002\u672C\u5730\u7EC8\u7AEF\u5DF2\u542F\u7528\uFF1A\u6253\u5F00 ${de}\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(f=>D(f.message)).finally(()=>o(!1))},children:[(0,J.jsxs)("div",{className:"zt-settings-card",children:[(0,J.jsx)("strong",{children:"\u672C\u5730\u7EC8\u7AEF"}),(0,J.jsxs)("label",{className:"zt-check",children:[(0,J.jsx)("input",{type:"checkbox",checked:S.allowLocalTerminal,onChange:v=>g("allowLocalTerminal",v.target.checked)}),"\u5141\u8BB8\u6253\u5F00\u8FD0\u884C DSH \u7684\u673A\u5668\u4E0A\u7684\u7EC8\u7AEF"]}),(0,J.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,J.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",de,"\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,J.jsxs)("div",{className:"zt-settings-card",children:[(0,J.jsx)("strong",{children:"\u901A\u8FC7\u5BF9\u8BDD\u8FDE\u63A5\u8FDC\u7A0B\u673A\u5668"}),(0,J.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,J.jsxs)("ol",{className:"zt-hint",children:[(0,J.jsx)("li",{children:"\u5148\u627E\u4E3B\u673A\u5217\u8868\u91CC\u5DF2\u4FDD\u5B58\u7684\u673A\u5668\u3002"}),(0,J.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,J.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,J.jsxs)("label",{className:"zt-field",children:[(0,J.jsx)("span",{children:"\u65B0\u4E3B\u673A\u9ED8\u8BA4\u767B\u5F55\u8D26\u53F7"}),(0,J.jsx)("input",{value:S.defaultSshUsername??"",placeholder:"\u7559\u7A7A\u4F7F\u7528\u8FD0\u884C DSH \u7684\u8D26\u53F7",onChange:v=>g("defaultSshUsername",v.target.value)})]}),(0,J.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,J.jsxs)("label",{className:"zt-field",children:[(0,J.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u51ED\u8BC1"}),(0,J.jsxs)("select",{value:S.defaultCredentialId??"",onChange:v=>g("defaultCredentialId",v.target.value),children:[(0,J.jsx)("option",{value:"",children:"\u81EA\u52A8\u67E5\u627E\u5BBF\u4E3B\u9ED8\u8BA4\u79C1\u94A5\u6587\u4EF6"}),(S.credentials??[]).filter(v=>v.authType!=="password").map(v=>(0,J.jsxs)("option",{value:v.id,children:[v.label," \xB7 ",Ue[v.authType]]},v.id))]})]}),(0,J.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"}),!S.defaultCredentialId&&(0,J.jsxs)("details",{children:[(0,J.jsx)("summary",{children:"\u6307\u5B9A\u5DF2\u6709\u7684\u5BBF\u4E3B\u79C1\u94A5\u6587\u4EF6\uFF08\u53EF\u9009\uFF09"}),(0,J.jsxs)("label",{className:"zt-field",children:[(0,J.jsx)("span",{children:"\u9ED8\u8BA4 SSH \u79C1\u94A5\u6587\u4EF6"}),(0,J.jsx)("input",{value:S.defaultPrivateKeyPath??"",placeholder:"\u7559\u7A7A\u81EA\u52A8\u67E5\u627E ~/.ssh \u4E0B\u7684\u9ED8\u8BA4\u79C1\u94A5",onChange:v=>g("defaultPrivateKeyPath",v.target.value)})]}),(0,J.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,J.jsxs)("div",{className:"zt-settings-card",children:[(0,J.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(([v,f,m,E])=>(0,J.jsxs)("label",{className:"zt-field",children:[(0,J.jsx)("span",{children:f}),(0,J.jsx)("input",{type:"number",min:m,max:E,required:!0,value:S[v],onChange:k=>g(String(v),Number(k.target.value))})]},v))]}),(0,J.jsxs)("div",{className:"zt-settings-card",children:[(0,J.jsx)("strong",{children:"\u4E3B\u673A\u4E0E\u51ED\u636E"}),(0,J.jsxs)("p",{children:["\u4E3B\u673A\u3001\u6587\u4EF6\u5939\u3001JumpServer \u5B9E\u4F8B\u548C\u8D26\u53F7\u4ECE\u4F1A\u8BDD\u4E2D\u7684\u300C",de,"\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,J.jsxs)("p",{className:"zt-hint",children:["\u5DF2\u914D\u7F6E ",S.total," \u53F0\u4E3B\u673A\u3001",S.jumpservers.length," \u4E2A JumpServer \u5B9E\u4F8B\u3002"]})]}),(0,J.jsx)("button",{className:"zt-primary",disabled:r,children:r?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u8BBE\u7F6E"})]}),(0,J.jsx)(Di,{ctx:w,credentials:S.credentials??[],revision:S.revision,onSaved:d})]}):(0,J.jsx)("p",{className:"zt-hint",children:"\u6B63\u5728\u8BFB\u53D6\u914D\u7F6E\u2026"})]})}var Ti=`.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}
@@ -41,10 +41,10 @@ ${I}`)).catch(I=>se(I.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}.zt-settings-card.zt-switch-card.active{background:color-mix(in srgb,#d8a048 14%,var(--zt-layer));border-color:color-mix(in srgb,#d8a048 42%,var(--zt-border))}.zt-switch-card .zt-check{margin:0 0 6px;font-weight:500}.zt-switch-status{margin:8px 0 0;font-size:12px;color:var(--zt-text);font-weight:500}
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)}.zt-header-badge{font-size:9px;line-height:1;padding:2px 4px;border-radius:999px;background:color-mix(in srgb,#d45f64 16%,var(--dsw-alias-bg-layer-2,#f4f6f8));color:var(--dsw-alias-label-primary,#252b36);border:1px solid color-mix(in srgb,#d45f64 42%,var(--dsw-alias-border-l2,#dfe3e9))}
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-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}
44
+ .zt-host-browser{display:flex;flex-direction:column;flex:1;min-height:0}.zt-asset-tree{flex:1;min-height:0;overflow:auto;overflow-anchor:none;padding:2px 5px 7px}.zt-directory-row{display:flex;align-items:center;min-width:0;min-height:28px;border-radius:5px}.zt-directory-row.active{color:var(--zt-accent);background:var(--zt-layer)}.zt-directory-row>button{border:0;background:transparent;font-size:12px;padding:4px 5px}.zt-directory-name{display:flex;align-items:center;flex:1;min-width:0;text-align:left;gap:3px}.zt-directory-arrow{width:15px;flex:none;text-align:center}.zt-directory-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.zt-directory-row .zt-folder-action{flex:none}.zt-tree-content{min-width:0}.zt-tree-content .zt-host-connect small,.zt-asset-row strong,.zt-asset-row small{white-space:nowrap;max-width:100%}.zt-tree-message{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:11px;color:var(--zt-muted);margin:5px 8px 9px;overflow-wrap:anywhere}.zt-tree-message.zt-error{color:#bc414b}.zt-tree-message button{font-size:11px;padding:1px 5px}.zt-tree-content .zt-pagination{margin:2px 0 5px;font-size:10px}.zt-asset-tree button:focus-visible{outline:2px solid var(--zt-accent);outline-offset:-2px}
45
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)}
46
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}}
47
- `;var ri=`/**
47
+ `;var Ai=`/**
48
48
  * Copyright (c) 2014 The xterm.js authors. All rights reserved.
49
49
  * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
50
50
  * https://github.com/chjj/term.js
@@ -262,6 +262,6 @@ ${I}`)).catch(I=>se(I.message))},children:"\u5BFC\u51FA\u7EC8\u7AEF"})]}),Z&&(0,
262
262
  z-index: 2;
263
263
  position: relative;
264
264
  }
265
- `;var ue=require("react/jsx-runtime"),wi=["slots","connection"],xt="dsh-zterm:workbench";function ft(T=16){return(0,ue.jsxs)("svg",{width:T,height:T,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,ue.jsx)("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"2"}),(0,ue.jsx)("path",{d:"m4 6 2 2-2 2m4 0h4"})]})}function yi({ctx:T,service:R,tab:O,scope:W,visible:L}){return(0,pe.useEffect)(()=>{O?.id&&O.title!==le&&R.updateTab?.(O.id,{title:le})},[R,O?.id,O?.title]),(0,ue.jsx)(yt,{ctx:T,sessionId:W.sessionId,visible:L})}function xi(T){let R=new Set,O,W=()=>R.forEach(c=>c()),L=()=>(0,pe.useSyncExternalStore)(c=>(R.add(c),()=>R.delete(c)),()=>O),s=document.createElement("style");s.dataset.plugin="dsh-zterm",s.textContent=`${ri}
266
- ${ii}`,document.head.appendChild(s),T.effect(()=>()=>{s.remove(),R.clear()}),T.inject(["betterSidebar"],c=>{O=c.betterSidebar,W();let f=O.registerTab({id:xt,title:()=>le,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,ue.jsx)(yi,{...n,ctx:T,service:c.betterSidebar})}),a=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,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)("span",{"aria-hidden":"true",children:ft()}),le]})));return()=>{a?.(),f?.(),O=void 0,W()}});function o(c){let f=L(),[a,n]=(0,pe.useState)(!1),[d,_]=(0,pe.useState)(""),[h,i]=(0,pe.useState)(!1),t=c.sessionId??c.scope?.sessionId,e=c.scope??{sessionId:t},r=c.useChat??c.useSession,l=typeof r=="function"?r(g=>g.legacy?.nodes??g.nodes):void 0,v=(0,pe.useRef)(""),p=()=>{f?.openTab?f.openTab({type:xt,title:le,url:"zterm://workbench"},e):parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0?_("\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,pe.useEffect)(()=>{t&&ie(T,"client/attach",{sessionId:t,pageId:ut}).catch(()=>{})},[t]),(0,pe.useEffect)(()=>{let g=!0,u=()=>{ie(T,"status").then(m=>{g&&i(!!m?.temporarilyDisabled)}).catch(()=>{})};return u(),window.addEventListener("dsh-zterm:state",u),()=>{g=!1,window.removeEventListener("dsh-zterm:state",u)}},[T]),(0,pe.useEffect)(()=>{if(!l)return;let g=Array.isArray(l)?[...l]:[l],u="";for(let m=0;g.length&&m<5e3;m++){let y=g.pop();if(!y||typeof y!="object")continue;let x=y.name??y.call?.name??y.toolName;if(["zterm_connect","zterm_bind"].includes(x)){u=String(y.id??y.callId??y.call?.id??x);break}for(let S of["children","nodes","body","calls","subCalls"]){let w=y[S];if(Array.isArray(w))for(let A of w){if(g.length>=5e3)break;g.push(A)}}}u&&u!==v.current&&(v.current=u,p())},[l,f,t]),(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("button",{className:"zt-header-button",title:h?`${le} \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u4F7F\u7528\u672C\u63D2\u4EF6\u5DE5\u5177`:`\u6253\u5F00 ${le}`,onClick:p,children:[ft(15),le,h&&(0,ue.jsx)("span",{className:"zt-header-badge",children:"AI\u7981\u7528"})]}),a&&!f&&t&&(0,ue.jsx)(Ei,{ctx:T,sessionId:t,onClose:()=>n(!1),onConflict:()=>{n(!1),_(`\u8111\u56FE\u9762\u677F\u5DF2\u5C55\u5F00\uFF0C${le} \u72EC\u7ACB\u9762\u677F\u5DF2\u6536\u8D77\u3002\u53EF\u4EE5\u4ECE ${le} \u5165\u53E3\u91CD\u65B0\u6253\u5F00\u3002`)}}),d&&(0,ue.jsxs)("div",{className:"zt-standalone-error",role:"alert",children:[d,(0,ue.jsx)("button",{onClick:()=>_(""),children:"\u5173\u95ED"})]})]})}T.slots.inject("conversation.session.header.actions",()=>T.slots.register({name:"conversation.session.header.actions",id:"dsh-zterm",order:109},o)),T.slots.inject("settings.section",()=>T.slots.register({name:"settings.section",id:"dsh-zterm",order:109,label:le,icon:ft},()=>(0,ue.jsx)(ti,{ctx:T})))}function Ei({ctx:T,sessionId:R,onClose:O,onConflict:W}){let L=a=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),a)),[s,o]=(0,pe.useState)(()=>L(ze("dsh-zterm.panel-width",window.innerWidth*.6,0,window.innerWidth))),c=Ge();(0,pe.useEffect)(()=>{let a=!0;return ie(T,"catalog").then(n=>{a&&o(L(ze("dsh-zterm.panel-width",window.innerWidth*n.defaultPanelWidth/100,0,window.innerWidth)))}).catch(()=>{}),()=>{a=!1}},[T]),(0,pe.useEffect)(()=>{let a=()=>{parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0&&W()},n=new MutationObserver(a);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),a(),()=>n.disconnect()},[W]),(0,pe.useEffect)(()=>{let a=()=>o(n=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),n)));return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),(0,pe.useEffect)(()=>{document.documentElement.style.setProperty("--dsh-zterm-width",`${s}px`);let a=document.createElement("style");return a.dataset.plugin="dsh-zterm",a.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(a),()=>{a.remove(),document.documentElement.style.removeProperty("--dsh-zterm-width")}},[s]);let f=a=>{let n=a.clientX,d=s;c(a,_=>{let h=L(d+n-_.clientX);o(h),Pe("dsh-zterm.panel-width",h)})};return(0,ue.jsxs)("section",{className:"zt-standalone",style:{width:s},"aria-label":le,children:[(0,ue.jsx)("div",{className:"zt-panel-handle",role:"separator","aria-label":`\u8C03\u6574 ${le} \u9762\u677F\u5BBD\u5EA6`,onMouseDown:f}),(0,ue.jsx)(yt,{ctx:T,sessionId:R,onClose:O})]})}
265
+ `;var ge=require("react/jsx-runtime"),Yi=["slots","connection"],Gt="dsh-zterm:workbench";function Ot(w=16){return(0,ge.jsxs)("svg",{width:w,height:w,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[(0,ge.jsx)("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"2"}),(0,ge.jsx)("path",{d:"m4 6 2 2-2 2m4 0h4"})]})}function Zi({ctx:w,service:S,tab:A,scope:B,visible:D}){return(0,ye.useEffect)(()=>{A?.id&&A.title!==de&&S.updateTab?.(A.id,{title:de})},[S,A?.id,A?.title]),(0,ge.jsx)(Jt,{ctx:w,sessionId:B.sessionId,visible:D},B.sessionId)}function Qi(w){let S=new Set,A,B=()=>S.forEach(c=>c()),D=()=>(0,ye.useSyncExternalStore)(c=>(S.add(c),()=>S.delete(c)),()=>A),r=document.createElement("style");r.dataset.plugin="dsh-zterm",r.textContent=`${Ai}
266
+ ${Ti}`,document.head.appendChild(r),w.effect(()=>()=>{r.remove(),S.clear()}),w.inject(["betterSidebar"],c=>{A=c.betterSidebar,B();let u=A.registerTab({id:Gt,title:()=>de,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:Ot,single:!0,order:109,component:a=>(0,ge.jsx)(Zi,{...a,ctx:w,service:c.betterSidebar})}),n=c.slots.inject("sidebar.right.pane.tab.title",()=>c.slots.register({name:"sidebar.right.pane.tab.title",key:`dsh-better-sidebar:${Gt}`,priority:-1},()=>(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)("span",{"aria-hidden":"true",children:Ot()}),de]})));return()=>{n?.(),u?.(),A=void 0,B()}});function o(c){let u=D(),[n,a]=(0,ye.useState)(!1),[h,_]=(0,ye.useState)(""),[l,i]=(0,ye.useState)(!1),t=c.sessionId??c.scope?.sessionId,e=c.scope??{sessionId:t},s=c.useChat??c.useSession,d=typeof s=="function"?s(v=>v.legacy?.nodes??v.nodes):void 0,g=(0,ye.useRef)(""),p=()=>{u?.openTab?u.openTab({type:Gt,title:de,url:"zterm://workbench"},e):parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0?_("\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"):a(!0)};return(0,ye.useEffect)(()=>{t&&te(w,"client/attach",{sessionId:t,pageId:Bt}).catch(()=>{})},[t]),(0,ye.useEffect)(()=>{let v=!0,f=()=>{te(w,"status").then(m=>{v&&i(!!m?.temporarilyDisabled)}).catch(()=>{})};return f(),window.addEventListener("dsh-zterm:state",f),()=>{v=!1,window.removeEventListener("dsh-zterm:state",f)}},[w]),(0,ye.useEffect)(()=>{if(!d)return;let v=Array.isArray(d)?[...d]:[d],f="";for(let m=0;v.length&&m<5e3;m++){let E=v.pop();if(!E||typeof E!="object")continue;let k=E.name??E.call?.name??E.toolName;if(["zterm_connect","zterm_bind"].includes(k)){f=String(E.id??E.callId??E.call?.id??k);break}for(let x of["children","nodes","body","calls","subCalls"]){let C=E[x];if(Array.isArray(C))for(let M of C){if(v.length>=5e3)break;v.push(M)}}}f&&f!==g.current&&(g.current=f,p())},[d,u,t]),(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsxs)("button",{className:"zt-header-button",title:l?`${de} \u5DF2\u4E34\u65F6\u7981\u7528\uFF1AAI \u4E0D\u4F1A\u4F7F\u7528\u672C\u63D2\u4EF6\u5DE5\u5177`:`\u6253\u5F00 ${de}`,onClick:p,children:[Ot(15),de,l&&(0,ge.jsx)("span",{className:"zt-header-badge",children:"AI\u7981\u7528"})]}),n&&!u&&t&&(0,ge.jsx)(er,{ctx:w,sessionId:t,onClose:()=>a(!1),onConflict:()=>{a(!1),_(`\u8111\u56FE\u9762\u677F\u5DF2\u5C55\u5F00\uFF0C${de} \u72EC\u7ACB\u9762\u677F\u5DF2\u6536\u8D77\u3002\u53EF\u4EE5\u4ECE ${de} \u5165\u53E3\u91CD\u65B0\u6253\u5F00\u3002`)}}),h&&(0,ge.jsxs)("div",{className:"zt-standalone-error",role:"alert",children:[h,(0,ge.jsx)("button",{onClick:()=>_(""),children:"\u5173\u95ED"})]})]})}w.slots.inject("conversation.session.header.actions",()=>w.slots.register({name:"conversation.session.header.actions",id:"dsh-zterm",order:109},o)),w.slots.inject("settings.section",()=>w.slots.register({name:"settings.section",id:"dsh-zterm",order:109,label:de,icon:Ot},()=>(0,ge.jsx)(Ri,{ctx:w})))}function er({ctx:w,sessionId:S,onClose:A,onConflict:B}){let D=n=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),n)),[r,o]=(0,ye.useState)(()=>D(rt("dsh-zterm.panel-width",window.innerWidth*.6,0,window.innerWidth))),c=Et();(0,ye.useEffect)(()=>{let n=!0;return te(w,"catalog").then(a=>{n&&o(D(rt("dsh-zterm.panel-width",window.innerWidth*a.defaultPanelWidth/100,0,window.innerWidth)))}).catch(()=>{}),()=>{n=!1}},[w]),(0,ye.useEffect)(()=>{let n=()=>{parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--dsh-mindmap-width"))>0&&B()},a=new MutationObserver(n);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),n(),()=>a.disconnect()},[B]),(0,ye.useEffect)(()=>{let n=()=>o(a=>Math.min(window.innerWidth*.8,Math.max(Math.min(480,window.innerWidth*.8),a)));return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),(0,ye.useEffect)(()=>{document.documentElement.style.setProperty("--dsh-zterm-width",`${r}px`);let n=document.createElement("style");return n.dataset.plugin="dsh-zterm",n.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(n),()=>{n.remove(),document.documentElement.style.removeProperty("--dsh-zterm-width")}},[r]);let u=n=>{let a=n.clientX,h=r;c(n,_=>{let l=D(h+a-_.clientX);o(l),st("dsh-zterm.panel-width",l)})};return(0,ge.jsxs)("section",{className:"zt-standalone",style:{width:r},"aria-label":de,children:[(0,ge.jsx)("div",{className:"zt-panel-handle",role:"separator","aria-label":`\u8C03\u6574 ${de} \u9762\u677F\u5BBD\u5EA6`,onMouseDown:u}),(0,ge.jsx)(Jt,{ctx:w,sessionId:S,onClose:A},S)]})}
267
267
  return module.exports; } });