@hyzyn/dsh-tty 0.16.0 → 0.16.1
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/README.md +4 -4
- package/client.js +65 -34
- package/lib/index.js +728 -611
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,c.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),/\p{Control}/u.test(l)||this._charsToConsume.push(l)}_refreshRows(l,u){this._liveRegionDebouncer.refresh(l,u,this._terminal.rows)}_renderRows(l,u){let g=this._terminal.buffer,C=g.lines.length.toString();for(let w=l;w<=u;w++){let y=g.lines.get(g.ydisp+w),m=[],x=y?.translateToString(!0,void 0,void 0,m)||"",T=(g.ydisp+w+1).toString(),I=this._rowElements[w];I&&(x.length===0?(I.innerText="\xA0",this._rowColumns.set(I,[0,1])):(I.textContent=x,this._rowColumns.set(I,m)),I.setAttribute("aria-posinset",T),I.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,u){let g=l.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(g.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==C)return;let w,y;if(u===0?(w=g,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(w=this._rowElements.shift(),y=g,this._rowContainer.removeChild(w)),w.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:l.anchorNode,offset:l.anchorOffset},g={node:l.focusNode,offset:l.focusOffset};if((u.node.compareDocumentPosition(g.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===g.node&&u.offset>g.offset)&&([u,g]=[g,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;let C=this._rowElements.slice(-1)[0];if(g.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(g={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(g.node))return;let w=({node:x,offset:T})=>{let I=x instanceof Text?x.parentNode:x,F=parseInt(I?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let R=this._rowColumns.get(I);if(!R)return console.warn("columns is null. Race condition?"),null;let z=T<R.length?R[T]:R.slice(-1)[0]+1;return z>=this._terminal.cols&&(++F,z=0),{row:F,column:z}},y=w(u),m=w(g);if(y&&m){if(y.row>m.row||y.row===m.row&&y.column>=m.column)throw new Error("invalid range");this._terminal.select(y.column,y.row,(m.row-y.row)*this._terminal.cols-y.column+m.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_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 l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=d=a([f(1,p.IInstantiationService),f(2,S.ICoreBrowserService),f(3,S.IRenderService)],d)},3614:(h,s)=>{function r(_){return _.replace(/\r?\n/g,"\r")}function a(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function f(_,v,S,p){_=a(_=r(_),S.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(_,!0),v.value=""}function n(_,v,S){let p=S.getBoundingClientRect(),c=_.clientX-p.left-10,d=_.clientY-p.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${c}px`,v.style.top=`${d}px`,v.style.zIndex="1000",v.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=r,s.bracketTextForPaste=a,s.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},s.handlePasteEvent=function(_,v,S,p){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),v,S,p)},s.paste=f,s.moveTextAreaUnderMouseCursor=n,s.rightClickHandler=function(_,v,S,p,c){n(_,v,S),c&&p.rightClickSelect(_),v.value=p.selectionText,v.select()}},7239:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=r(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(f,n,_){this._css.set(f,n,_)}getCss(f,n){return this._css.get(f,n)}setColor(f,n,_){this._color.set(f,n,_)}getColor(f,n){return this._color.get(f,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(r,a,f,n){r.addEventListener(a,f,n);let _=!1;return{dispose:()=>{_||(_=!0,r.removeEventListener(a,f,n))}}}},3551:function(h,s,r){var a=this&&this.__decorate||function(d,l,u,g){var C,w=arguments.length,y=w<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,g){l(u,g,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let n=r(3656),_=r(8460),v=r(844),S=r(2585),p=r(4725),c=s.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(d,l,u,g,C){super(),this._element=d,this._mouseService=l,this._renderService=u,this._bufferService=g,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.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(d){this._lastMouseEvent=d;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;let u=d.composedPath();for(let g=0;g<u.length;g++){let C=u[g];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(d){if(this._activeLine!==d.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(d,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,d)||(this._clearCurrentLink(),this._askForLink(d,!0))}_askForLink(d,l){this._activeProviderReplies&&l||(this._activeProviderReplies?.forEach((g=>{g?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[g,C]of this._linkProviderService.linkProviders.entries())l?this._activeProviderReplies?.get(g)&&(u=this._checkLinkProviderResult(g,d,u)):C.provideLinks(d.y,(w=>{if(this._isMouseOut)return;let y=w?.map((m=>({link:m})));this._activeProviderReplies?.set(g,y),u=this._checkLinkProviderResult(g,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,l){let u=new Set;for(let g=0;g<l.size;g++){let C=l.get(g);if(C)for(let w=0;w<C.length;w++){let y=C[w],m=y.link.range.start.y<d?0:y.link.range.start.x,x=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let T=m;T<=x;T++){if(u.has(T)){C.splice(w--,1);break}u.add(T)}}}}_checkLinkProviderResult(d,l,u){if(!this._activeProviderReplies)return u;let g=this._activeProviderReplies.get(d),C=!1;for(let w=0;w<d;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(C=!0);if(!C&&g){let w=g.find((y=>this._linkAtPosition(y.link,l)));w&&(u=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let w=0;w<this._activeProviderReplies.size;w++){let y=this._activeProviderReplies.get(w)?.find((m=>this._linkAtPosition(m.link,l)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,l){this._currentLink&&this._lastMouseEvent&&(!d||!l||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(d.link,l)&&(this._currentLink=d,this._currentLink.state={decorations:{underline:d.link.decorations===void 0||d.link.decorations.underline,pointerCursor:d.link.decorations===void 0||d.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,d.link,this._lastMouseEvent),d.link.decorations={},Object.defineProperties(d.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:u=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:u=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(d.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((u=>{if(!this._currentLink)return;let g=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=g&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(g,C),this._lastMouseEvent)){let w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(u,l.text)}_fireUnderlineEvent(d,l){let u=d.range,g=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-g-1,u.end.x,u.end.y-g-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(u,l.text)}_linkAtPosition(d,l){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,g=d.range.end.y*this._bufferService.cols+d.range.end.x,C=l.y*this._bufferService.cols+l.x;return u<=C&&C<=g}_positionFromMouseEvent(d,l,u){let g=u.getCoords(d,l,this._bufferService.cols,this._bufferService.rows);if(g)return{x:g[0],y:g[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,l,u,g,C){return{x1:d,y1:l,x2:u,y2:g,cols:this._bufferService.cols,fg:C}}};s.Linkifier=c=a([f(1,p.IMouseService),f(2,p.IRenderService),f(3,S.IBufferService),f(4,p.ILinkProviderService)],c)},9042:(h,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(h,s,r){var a=this&&this.__decorate||function(p,c,d,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let n=r(511),_=r(2585),v=s.OscLinkProvider=class{constructor(p,c,d){this._bufferService=p,this._optionsService=c,this._oscLinkService=d}provideLinks(p,c){let d=this._bufferService.buffer.lines.get(p-1);if(!d)return void c(void 0);let l=[],u=this._optionsService.rawOptions.linkHandler,g=new n.CellData,C=d.getTrimmedLength(),w=-1,y=-1,m=!1;for(let x=0;x<C;x++)if(y!==-1||d.hasContent(x)){if(d.loadCell(x,g),g.hasExtendedAttrs()&&g.extended.urlId){if(y===-1){y=x,w=g.extended.urlId;continue}m=g.extended.urlId!==w}else y!==-1&&(m=!0);if(m||y!==-1&&x===C-1){let T=this._oscLinkService.getLinkData(w)?.uri;if(T){let I={start:{x:y+1,y:p},end:{x:x+(m||x!==C-1?0:1),y:p}},F=!1;if(!u?.allowNonHttpProtocols)try{let R=new URL(T);["http:","https:"].includes(R.protocol)||(F=!0)}catch{F=!0}F||l.push({text:T,range:I,activate:(R,z)=>u?u.activate(R,z,I):S(0,z),hover:(R,z)=>u?.hover?.(R,z,I),leave:(R,z)=>u?.leave?.(R,z,I)})}m=!1,g.hasExtendedAttrs()&&g.extended.urlId?(y=x,w=g.extended.urlId):(y=-1,w=-1)}}c(l)}};function S(p,c){if(confirm(`Do you want to navigate to ${c}?
|
|
1
|
+
"use strict";(()=>{var za=Object.create;var Ys=Object.defineProperty;var Ua=Object.getOwnPropertyDescriptor;var ja=Object.getOwnPropertyNames;var qa=Object.getPrototypeOf,Ka=Object.prototype.hasOwnProperty;var Xs=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}};var Ga=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let h of ja(t))!Ka.call(e,h)&&h!==i&&Ys(e,h,{get:()=>t[h],enumerable:!(o=Ua(t,h))||o.enumerable});return e};var Js=(e,t,i)=>(i=e!=null?za(qa(e)):{},Ga(t||!e||!e.__esModule?Ys(i,"default",{value:e,enumerable:!0}):i,e));var Qs=Xs((Pi,Tr)=>{(function(e,t){if(typeof Pi=="object"&&typeof Tr=="object")Tr.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var i=t();for(var o in i)(typeof Pi=="object"?Pi:e)[o]=i[o]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(h,r,s){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;let n=s(9042),_=s(9924),g=s(844),S=s(4725),p=s(2585),c=s(3656),d=r.AccessibilityManager=class extends g.Disposable{constructor(l,u,v,C){super(),this._terminal=l,this._coreBrowserService=v,this._renderService=C,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 w=0;w<this._terminal.rows;w++)this._rowElements[w]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[w]);if(this._topBoundaryFocusListener=w=>this._handleBoundaryFocus(w,0),this._bottomBoundaryFocusListener=w=>this._handleBoundaryFocus(w,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 _.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((w=>this._handleResize(w.rows)))),this.register(this._terminal.onRender((w=>this._refreshRows(w.start,w.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((w=>this._handleChar(w)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2
|
+
`)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,c.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,g.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(l){for(let u=0;u<l;u++)this._handleChar(" ")}_handleChar(l){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==l&&(this._charsToAnnounce+=l):this._charsToAnnounce+=l,l===`
|
|
3
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),/\p{Control}/u.test(l)||this._charsToConsume.push(l)}_refreshRows(l,u){this._liveRegionDebouncer.refresh(l,u,this._terminal.rows)}_renderRows(l,u){let v=this._terminal.buffer,C=v.lines.length.toString();for(let w=l;w<=u;w++){let y=v.lines.get(v.ydisp+w),m=[],x=y?.translateToString(!0,void 0,void 0,m)||"",T=(v.ydisp+w+1).toString(),I=this._rowElements[w];I&&(x.length===0?(I.innerText="\xA0",this._rowColumns.set(I,[0,1])):(I.textContent=x,this._rowColumns.set(I,m)),I.setAttribute("aria-posinset",T),I.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,u){let v=l.target,C=this._rowElements[u===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==C)return;let w,y;if(u===0?(w=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(w=this._rowElements.shift(),y=v,this._rowContainer.removeChild(w)),w.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:l.anchorNode,offset:l.anchorOffset},v={node:l.focusNode,offset:l.focusOffset};if((u.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===v.node&&u.offset>v.offset)&&([u,v]=[v,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;let C=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:C,offset:C.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let w=({node:x,offset:T})=>{let I=x instanceof Text?x.parentNode:x,F=parseInt(I?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let R=this._rowColumns.get(I);if(!R)return console.warn("columns is null. Race condition?"),null;let z=T<R.length?R[T]:R.slice(-1)[0]+1;return z>=this._terminal.cols&&(++F,z=0),{row:F,column:z}},y=w(u),m=w(v);if(y&&m){if(y.row>m.row||y.row===m.row&&y.column>=m.column)throw new Error("invalid range");this._terminal.select(y.column,y.row,(m.row-y.row)*this._terminal.cols-y.column+m.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_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 l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=d=a([f(1,p.IInstantiationService),f(2,S.ICoreBrowserService),f(3,S.IRenderService)],d)},3614:(h,r)=>{function s(_){return _.replace(/\r?\n/g,"\r")}function a(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function f(_,g,S,p){_=a(_=s(_),S.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(_,!0),g.value=""}function n(_,g,S){let p=S.getBoundingClientRect(),c=_.clientX-p.left-10,d=_.clientY-p.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${c}px`,g.style.top=`${d}px`,g.style.zIndex="1000",g.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=s,r.bracketTextForPaste=a,r.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,g,S,p){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),g,S,p)},r.paste=f,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(_,g,S,p,c){n(_,g,S),c&&p.rightClickSelect(_),g.value=p.selectionText,g.select()}},7239:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;let a=s(1505);r.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(f,n,_){this._css.set(f,n,_)}getCss(f,n){return this._css.get(f,n)}setColor(f,n,_){this._color.set(f,n,_)}getColor(f,n){return this._color.get(f,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(s,a,f,n){s.addEventListener(a,f,n);let _=!1;return{dispose:()=>{_||(_=!0,s.removeEventListener(a,f,n))}}}},3551:function(h,r,s){var a=this&&this.__decorate||function(d,l,u,v){var C,w=arguments.length,y=w<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,v){l(u,v,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;let n=s(3656),_=s(8460),g=s(844),S=s(2585),p=s(4725),c=r.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(d,l,u,v,C){super(),this._element=d,this._mouseService=l,this._renderService=u,this._bufferService=v,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.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(d){this._lastMouseEvent=d;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;let u=d.composedPath();for(let v=0;v<u.length;v++){let C=u[v];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(d){if(this._activeLine!==d.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(d,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,d)||(this._clearCurrentLink(),this._askForLink(d,!0))}_askForLink(d,l){this._activeProviderReplies&&l||(this._activeProviderReplies?.forEach((v=>{v?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=d.y);let u=!1;for(let[v,C]of this._linkProviderService.linkProviders.entries())l?this._activeProviderReplies?.get(v)&&(u=this._checkLinkProviderResult(v,d,u)):C.provideLinks(d.y,(w=>{if(this._isMouseOut)return;let y=w?.map((m=>({link:m})));this._activeProviderReplies?.set(v,y),u=this._checkLinkProviderResult(v,d,u),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(d.y,this._activeProviderReplies)}))}_removeIntersectingLinks(d,l){let u=new Set;for(let v=0;v<l.size;v++){let C=l.get(v);if(C)for(let w=0;w<C.length;w++){let y=C[w],m=y.link.range.start.y<d?0:y.link.range.start.x,x=y.link.range.end.y>d?this._bufferService.cols:y.link.range.end.x;for(let T=m;T<=x;T++){if(u.has(T)){C.splice(w--,1);break}u.add(T)}}}}_checkLinkProviderResult(d,l,u){if(!this._activeProviderReplies)return u;let v=this._activeProviderReplies.get(d),C=!1;for(let w=0;w<d;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(C=!0);if(!C&&v){let w=v.find((y=>this._linkAtPosition(y.link,l)));w&&(u=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let w=0;w<this._activeProviderReplies.size;w++){let y=this._activeProviderReplies.get(w)?.find((m=>this._linkAtPosition(m.link,l)));if(y){u=!0,this._handleNewLink(y);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(d){if(!this._currentLink)return;let l=this._positionFromMouseEvent(d,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(d,this._currentLink.link.text)}_clearCurrentLink(d,l){this._currentLink&&this._lastMouseEvent&&(!d||!l||this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(d){if(!this._lastMouseEvent)return;let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(d.link,l)&&(this._currentLink=d,this._currentLink.state={decorations:{underline:d.link.decorations===void 0||d.link.decorations.underline,pointerCursor:d.link.decorations===void 0||d.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,d.link,this._lastMouseEvent),d.link.decorations={},Object.defineProperties(d.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:u=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:u=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(d.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((u=>{if(!this._currentLink)return;let v=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,C=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(v,C),this._lastMouseEvent)){let w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&d.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(u,l.text)}_fireUnderlineEvent(d,l){let u=d.range,v=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-v-1,u.end.x,u.end.y-v-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(d,l,u){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&d.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(u,l.text)}_linkAtPosition(d,l){let u=d.range.start.y*this._bufferService.cols+d.range.start.x,v=d.range.end.y*this._bufferService.cols+d.range.end.x,C=l.y*this._bufferService.cols+l.x;return u<=C&&C<=v}_positionFromMouseEvent(d,l,u){let v=u.getCoords(d,l,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(d,l,u,v,C){return{x1:d,y1:l,x2:u,y2:v,cols:this._bufferService.cols,fg:C}}};r.Linkifier=c=a([f(1,p.IMouseService),f(2,p.IRenderService),f(3,S.IBufferService),f(4,p.ILinkProviderService)],c)},9042:(h,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(h,r,s){var a=this&&this.__decorate||function(p,c,d,l){var u,v=arguments.length,C=v<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(c,d,C):u(c,d))||C);return v>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;let n=s(511),_=s(2585),g=r.OscLinkProvider=class{constructor(p,c,d){this._bufferService=p,this._optionsService=c,this._oscLinkService=d}provideLinks(p,c){let d=this._bufferService.buffer.lines.get(p-1);if(!d)return void c(void 0);let l=[],u=this._optionsService.rawOptions.linkHandler,v=new n.CellData,C=d.getTrimmedLength(),w=-1,y=-1,m=!1;for(let x=0;x<C;x++)if(y!==-1||d.hasContent(x)){if(d.loadCell(x,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=x,w=v.extended.urlId;continue}m=v.extended.urlId!==w}else y!==-1&&(m=!0);if(m||y!==-1&&x===C-1){let T=this._oscLinkService.getLinkData(w)?.uri;if(T){let I={start:{x:y+1,y:p},end:{x:x+(m||x!==C-1?0:1),y:p}},F=!1;if(!u?.allowNonHttpProtocols)try{let R=new URL(T);["http:","https:"].includes(R.protocol)||(F=!0)}catch{F=!0}F||l.push({text:T,range:I,activate:(R,z)=>u?u.activate(R,z,I):S(0,z),hover:(R,z)=>u?.hover?.(R,z,I),leave:(R,z)=>u?.leave?.(R,z,I)})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=x,w=v.extended.urlId):(y=-1,w=-1)}}c(l)}};function S(p,c){if(confirm(`Do you want to navigate to ${c}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=v=a([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],v)},6193:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(r,a){this._renderCallback=r,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(r){return this._refreshCallbacks.push(r),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(r,a,f){this._rowCount=f,r=r!==void 0?r:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a,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 r=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let r of this._refreshCallbacks)r(0);this._refreshCallbacks=[]}}},3236:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=r(3614),f=r(3656),n=r(3551),_=r(9042),v=r(3730),S=r(1680),p=r(3107),c=r(5744),d=r(2950),l=r(1296),u=r(428),g=r(4269),C=r(5114),w=r(8934),y=r(3230),m=r(9312),x=r(4725),T=r(6731),I=r(8055),F=r(8969),R=r(8460),z=r(844),B=r(6114),D=r(8437),O=r(2584),P=r(7399),b=r(5941),E=r(9074),L=r(2585),M=r(5435),$=r(4567),K=r(779);class Y extends F.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(A={}){super(A),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new R.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new R.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new R.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new R.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new R.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new R.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new R.EventEmitter),this._onBlur=this.register(new R.EventEmitter),this._onA11yCharEmitter=this.register(new R.EventEmitter),this._onA11yTabEmitter=this.register(new R.EventEmitter),this._onWillOpen=this.register(new R.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,N)=>this.refresh(k,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((k=>this._reportWindowsOptions(k)))),this.register(this._inputHandler.onColor((k=>this._handleColorEvent(k)))),this.register((0,R.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,R.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((k=>this._afterResize(k.cols,k.rows)))),this.register((0,z.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(A){if(this._themeService)for(let k of A){let N,H="";switch(k.index){case 256:N="foreground",H="10";break;case 257:N="background",H="11";break;case 258:N="cursor",H="12";break;default:N="ansi",H="4;"+k.index}switch(k.type){case 0:let q=I.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${O.C0.ESC}]${H};${(0,b.toRgbString)(q)}${O.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((j=>j.ansi[k.index]=I.channels.toColor(...k.color)));else{let j=N;this._themeService.modifyColors((Q=>Q[j]=I.channels.toColor(...k.color)))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.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(O.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 A=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(A);if(!k)return;let N=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,q=k.getWidth(N),j=this._renderService.dimensions.css.cell.width*q,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,ee=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ee+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=j+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let A=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,f.addDisposableDomListener)(this.element,"paste",A)),B.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(A=>this._keyUp(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(A=>this._keyDown(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(A=>this._keyPress(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(A=>this._compositionHelper.compositionupdate(A)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(A=>this._inputEvent(A)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(A){if(!A)throw new Error("Terminal requires a parent element.");if(A.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=A.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"),A.appendChild(this.element);let k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.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",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),B.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(C.CoreBrowserService,this.textarea,A.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(x.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(g.CharacterJoinerService),this._instantiationService.setService(x.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.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(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),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($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let A=this,k=this.element;function N(j){let Q=A._mouseService.getMouseReportCoords(j,A.screenElement);if(!Q)return!1;let ee,G;switch(j.overrideType||j.type){case"mousemove":G=32,j.buttons===void 0?(ee=3,j.button!==void 0&&(ee=j.button<3?j.button:3)):ee=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":G=0,ee=j.button<3?j.button:3;break;case"mousedown":G=1,ee=j.button<3?j.button:3;break;case"wheel":if(A._customWheelEventHandler&&A._customWheelEventHandler(j)===!1||A.viewport.getLinesScrolled(j)===0)return!1;G=j.deltaY<0?0:1,ee=4;break;default:return!1}return!(G===void 0||ee===void 0||ee>4)&&A.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:ee,action:G,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:j=>(N(j),j.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(j)),wheel:j=>(N(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&N(j)},mousemove:j=>{j.buttons||N(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?H.mousemove||(k.addEventListener("mousemove",q.mousemove),H.mousemove=q.mousemove):(k.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&j?H.wheel||(k.addEventListener("wheel",q.wheel,{passive:!1}),H.wheel=q.wheel):(k.removeEventListener("wheel",H.wheel),H.wheel=null),2&j?H.mouseup||(H.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&j?H.mousedrag||(H.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(k,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return N(j),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(j)}))),this.register((0,f.addDisposableDomListener)(k,"wheel",(j=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let Q=this.viewport.getLinesScrolled(j);if(Q===0)return;let ee=O.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),G="";for(let J=0;J<Math.abs(Q);J++)G+=ee;return this.coreService.triggerDataEvent(G,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(k,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(k,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(A,k){this._renderService?.refreshRows(A,k)}updateCursorStyle(A){this._selectionService?.shouldColumnSelect(A)?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(A,k,N=0){N===1?(super.scrollLines(A,k,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(A)}paste(A){(0,a.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}attachCustomWheelEventHandler(A){this._customWheelEventHandler=A}registerLinkProvider(A){return this._linkProviderService.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,k,N){this._selectionService.setSelection(A,k,N)}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(A,k){this._selectionService?.selectLines(A,k)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!k&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,P.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),N.type===3||N.type===2){let H=this.rows-1;return this.scrollLines(N.type===2?-H:H),this.cancel(A,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||(N.cancel&&this.cancel(A,!0),!N.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==O.C0.ETX&&N.key!==O.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,k){let N=A.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||A.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||A.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?N:N&&(!k.keyCode||k.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)k=A.charCode;else if(A.which===null||A.which===void 0)k=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;k=A.which}return!(!k||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=A.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(A),!0}return!1}resize(A,k){A!==this.cols||k!==this.rows?super.resize(A,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,k){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 A=1;A<this.rows;A++)this.buffer.lines.push(this.buffer.getBlankLine(D.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 A=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=A,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(O.C0.ESC+"[I"):this.coreService.triggerDataEvent(O.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[4;${N};${k}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let H=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[6;${q};${H}t`)}}cancel(A,k){if(this.options.cancelEvents||k)return A.preventDefault(),A.stopPropagation(),!1}}s.Terminal=Y},9924:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(r,a=1e3){this._renderCallback=r,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(r,a,f){this._rowCount=f,r=r!==void 0?r:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,r):r,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=n-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let r=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(r,a)}}},1680:function(h,s,r){var a=this&&this.__decorate||function(d,l,u,g){var C,w=arguments.length,y=w<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,g){l(u,g,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let n=r(3656),_=r(4725),v=r(8460),S=r(844),p=r(2585),c=s.Viewport=class extends S.Disposable{constructor(d,l,u,g,C,w,y,m){super(),this._viewportElement=d,this._scrollArea=l,this._bufferService=u,this._optionsService=g,this._charSizeService=C,this._renderService=w,this._coreBrowserService=y,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 v.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((x=>this._activeBuffer=x.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((x=>this._renderDimensions=x))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((x=>this._handleThemeChange(x)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.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(d){if(d)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 l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){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 l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<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(d,l){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let l=this._getPixelsScrolled(d);return l!==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+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let l=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(d,l){let u,g="",C=[],w=l??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<w;m++){let x=y.get(m);if(!x)continue;let T=y.get(m+1)?.isWrapped;if(g+=x.translateToString(!T),!T||m===y.length-1){let I=document.createElement("div");I.textContent=g,C.push(I),g.length>0&&(u=I),g=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(d,l){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&l.altKey||u==="ctrl"&&l.ctrlKey||u==="shift"&&l.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){let l=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}};s.Viewport=c=a([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],c)},3107:function(h,s,r){var a=this&&this.__decorate||function(p,c,d,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let n=r(4725),_=r(844),v=r(2585),S=s.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,d,l,u){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=d,this._decorationService=l,this._renderService=u,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((g=>this._removeDecoration(g)))),this.register((0,_.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 p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),c.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let d=p.options.x??0;return d&&d>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let d=this._decorationElements.get(p);d||(d=this._createElement(p),p.element=d,this._decorationElements.set(p,d),this._container.appendChild(d),p.onDispose((()=>{this._decorationElements.delete(p),d.remove()}))),d.style.top=c*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(d)}}_refreshXPosition(p,c=p.element){if(!c)return;let d=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};s.BufferDecorationRenderer=S=a([f(1,v.IBufferService),f(2,n.ICoreBrowserService),f(3,v.IDecorationService),f(4,n.IRenderService)],S)},5871:(h,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(r){if(r.options.overviewRulerOptions){for(let a of this._zones)if(a.color===r.options.overviewRulerOptions.color&&a.position===r.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,r.marker.line))return;if(this._lineAdjacentToZone(a,r.marker.line,r.options.overviewRulerOptions.position))return void this._addLineToZone(a,r.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=r.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=r.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=r.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=r.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:r.options.overviewRulerOptions.color,position:r.options.overviewRulerOptions.position,startBufferLine:r.marker.line,endBufferLine:r.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(r){this._linePadding=r}_lineIntersectsZone(r,a){return a>=r.startBufferLine&&a<=r.endBufferLine}_lineAdjacentToZone(r,a,f){return a>=r.startBufferLine-this._linePadding[f||"full"]&&a<=r.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(r,a){r.startBufferLine=Math.min(r.startBufferLine,a),r.endBufferLine=Math.max(r.endBufferLine,a)}}},5744:function(h,s,r){var a=this&&this.__decorate||function(u,g,C,w){var y,m=arguments.length,x=m<3?g:w===null?w=Object.getOwnPropertyDescriptor(g,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,g,C,w);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(g,C,x):y(g,C))||x);return m>3&&x&&Object.defineProperty(g,C,x),x},f=this&&this.__param||function(u,g){return function(C,w){g(C,w,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let n=r(5871),_=r(4725),v=r(844),S=r(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},l=s.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,g,C,w,y,m,x){super(),this._viewportElement=u,this._screenElement=g,this._bufferService=C,this._decorationService=w,this._renderService=y,this._optionsService=m,this._coreBrowserService=x,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 T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.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 u=Math.floor(this._canvas.width/3),g=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=u,c.center=g,c.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=c.left,d.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,g=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=g,p.center=g,p.right=g}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.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 g of this._decorationService.decorations)this._colorZoneStore.addDecoration(g);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let g of u)g.position!=="full"&&this._renderColorZone(g);for(let g of u)g.position==="full"&&this._renderColorZone(g);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(d[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-p[u.position||"full"]/2),c[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,g){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=g||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=l=a([f(2,S.IBufferService),f(3,S.IDecorationService),f(4,_.IRenderService),f(5,S.IOptionsService),f(6,_.ICoreBrowserService)],l)},2950:function(h,s,r){var a=this&&this.__decorate||function(p,c,d,l){var u,g=arguments.length,C=g<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(g<3?u(C):g>3?u(c,d,C):u(c,d))||C);return g>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let n=r(4725),_=r(2585),v=r(2584),S=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,d,l,u,g){this._textarea=p,this._compositionView=c,this._bufferService=d,this._optionsService=l,this._coreService=u,this._renderService=g,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(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,d=c.replace(p,"");this._dataAlreadySent=d,c.length>p.length?this._coreService.triggerDataEvent(d,!0):c.length<p.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let g=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(g.width,1)+"px",this._textarea.style.height=Math.max(g.height,1)+"px",this._textarea.style.lineHeight=g.height+"px"}p||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=S=a([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,n.IRenderService)],S)},9806:(h,s)=>{function r(a,f,n){let _=n.getBoundingClientRect(),v=a.getComputedStyle(n),S=parseInt(v.getPropertyValue("padding-left")),p=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-_.left-S,f.clientY-_.top-p]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=r,s.getCoords=function(a,f,n,_,v,S,p,c,d){if(!S)return;let l=r(a,f,n);return l?(l[0]=Math.ceil((l[0]+(d?p/2:0))/p),l[1]=Math.ceil(l[1]/c),l[0]=Math.min(Math.max(l[0],1),_+(d?1:0)),l[1]=Math.min(Math.max(l[1],1),v),l):void 0}},9504:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=r(2584);function f(c,d,l,u){let g=c-n(c,l),C=d-n(d,l),w=Math.abs(g-C)-(function(y,m,x){let T=0,I=y-n(y,x),F=m-n(m,x);for(let R=0;R<Math.abs(I-F);R++){let z=_(y,m)==="A"?-1:1;x.buffer.lines.get(I+z*R)?.isWrapped&&T++}return T})(c,d,l);return p(w,S(_(c,d),u))}function n(c,d){let l=0,u=d.buffer.lines.get(c),g=u?.isWrapped;for(;g&&c>=0&&c<d.rows;)l++,u=d.buffer.lines.get(--c),g=u?.isWrapped;return l}function _(c,d){return c>d?"A":"B"}function v(c,d,l,u,g,C){let w=c,y=d,m="";for(;w!==l||y!==u;)w+=g?1:-1,g&&w>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,c,w),w=0,c=0,y++):!g&&w<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,c+1),w=C.cols-1,c=w,y--);return m+C.buffer.translateBufferLineToString(y,!1,c,w)}function S(c,d){let l=d?"O":"[";return a.C0.ESC+l+c}function p(c,d){c=Math.floor(c);let l="";for(let u=0;u<c;u++)l+=d;return l}s.moveToCellSequence=function(c,d,l,u){let g=l.buffer.x,C=l.buffer.y;if(!l.buffer.hasScrollback)return(function(m,x,T,I,F,R){return f(x,I,F,R).length===0?"":p(v(m,x,m,x-n(x,F),!1,F).length,S("D",R))})(g,C,0,d,l,u)+f(C,d,l,u)+(function(m,x,T,I,F,R){let z;z=f(x,I,F,R).length>0?I-n(I,F):x;let B=I,D=(function(O,P,b,E,L,M){let $;return $=f(b,E,L,M).length>0?E-n(E,L):P,O<b&&$<=E||O>=b&&$<E?"C":"D"})(m,x,T,I,F,R);return p(v(m,z,T,B,D==="C",F).length,S(D,R))})(g,C,c,d,l,u);let w;if(C===d)return w=g>c?"D":"C",p(Math.abs(g-c),S(w,u));w=C>d?"D":"C";let y=Math.abs(C-d);return p((function(m,x){return x.cols-m})(C>d?c:g,l)+(y-1)*l.cols+1+((C>d?g:c)-1),S(w,u))}},1296:function(h,s,r){var a=this&&this.__decorate||function(R,z,B,D){var O,P=arguments.length,b=P<3?z:D===null?D=Object.getOwnPropertyDescriptor(z,B):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(R,z,B,D);else for(var E=R.length-1;E>=0;E--)(O=R[E])&&(b=(P<3?O(b):P>3?O(z,B,b):O(z,B))||b);return P>3&&b&&Object.defineProperty(z,B,b),b},f=this&&this.__param||function(R,z){return function(B,D){z(B,D,R)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let n=r(3787),_=r(2550),v=r(2223),S=r(6171),p=r(6052),c=r(4725),d=r(8055),l=r(8460),u=r(844),g=r(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",y="xterm-fg-",m="xterm-bg-",x="xterm-focus",T="xterm-selection",I=1,F=s.DomRenderer=class extends u.Disposable{constructor(R,z,B,D,O,P,b,E,L,M,$,K,Y){super(),this._terminal=R,this._document=z,this._element=B,this._screenElement=D,this._viewportElement=O,this._helperContainer=P,this._linkifier2=b,this._charSizeService=L,this._optionsService=M,this._bufferService=$,this._coreBrowserService=K,this._themeService=Y,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),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(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((U=>this._injectCss(U)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((U=>this._handleLinkHover(U)))),this.register(this._linkifier2.onHideLinkUnderline((U=>this._handleLinkLeave(U)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.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 R=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*R,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*R),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/R),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/R),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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let z=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(R){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${w} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${w} .xterm-dim { color: ${d.color.multiplyOpacity(R.foreground,.5).css};}`,z+=`${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 B=`blink_underline_${this._terminalClass}`,D=`blink_bar_${this._terminalClass}`,O=`blink_block_${this._terminalClass}`;z+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${D} { 50% { box-shadow: none; }}`,z+=`@keyframes ${O} { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,z+=`${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${D} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${R.cursor.css} !important; color: ${R.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(let[P,b]of R.ansi.entries())z+=`${this._terminalSelector} .${y}${P} { color: ${b.css}; }${this._terminalSelector} .${y}${P}.xterm-dim { color: ${d.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${m}${P} { background-color: ${b.css}; }`;z+=`${this._terminalSelector} .${y}${v.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(R.background).css}; }${this._terminalSelector} .${y}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${m}${v.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){let R=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${R}px`,this._rowFactory.defaultSpacing=R}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(R,z){for(let B=this._rowElements.length;B<=z;B++){let D=this._document.createElement("div");this._rowContainer.appendChild(D),this._rowElements.push(D)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,z){this._refreshRowElements(R,z),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(x),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,z,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,z,B),this.renderRows(0,this._bufferService.rows-1),!R||!z)return;this._selectionRenderModel.update(this._terminal,R,z,B);let D=this._selectionRenderModel.viewportStartRow,O=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(B){let L=R[0]>z[0];E.appendChild(this._createSelectionElement(P,L?z[0]:R[0],L?R[0]:z[0],b-P+1))}else{let L=D===P?R[0]:0,M=P===O?z[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(P,L,M));let $=b-P-1;if(E.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,$)),P!==b){let K=O===b?z[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(R,z,B,D=1){let O=this._document.createElement("div"),P=z*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(B-z);return P+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-P),O.style.height=D*this.dimensions.css.cell.height+"px",O.style.top=R*this.dimensions.css.cell.height+"px",O.style.left=`${P}px`,O.style.width=`${b}px`,O}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 R of this._rowElements)R.replaceChildren()}renderRows(R,z){let B=this._bufferService.buffer,D=B.ybase+B.y,O=Math.min(B.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=R;L<=z;L++){let M=L+B.ydisp,$=this._rowElements[L],K=B.lines.get(M);if(!$||!K)break;$.replaceChildren(...this._rowFactory.createRow(K,M,M===D,b,E,O,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!0)}_handleLinkLeave(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!1)}_setCellUnderline(R,z,B,D,O,P){B<0&&(R=0),D<0&&(z=0);let b=this._bufferService.rows-1;B=Math.max(Math.min(B,b),0),D=Math.max(Math.min(D,b),0),O=Math.min(O,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,M=Math.min(E.x,O-1),$=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let U=B;U<=D;++U){let A=U+E.ydisp,k=this._rowElements[U],N=E.lines.get(A);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,A,A===L,K,Y,M,$,this.dimensions.css.cell.width,this._widthCache,P?U===B?R:0:-1,P?(U===D?z:O)-1:-1))}}};s.DomRenderer=F=a([f(7,g.IInstantiationService),f(8,c.ICharSizeService),f(9,g.IOptionsService),f(10,g.IBufferService),f(11,c.ICoreBrowserService),f(12,c.IThemeService)],F)},3787:function(h,s,r){var a=this&&this.__decorate||function(w,y,m,x){var T,I=arguments.length,F=I<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(w,y,m,x);else for(var R=w.length-1;R>=0;R--)(T=w[R])&&(F=(I<3?T(F):I>3?T(y,m,F):T(y,m))||F);return I>3&&F&&Object.defineProperty(y,m,F),F},f=this&&this.__param||function(w,y){return function(m,x){y(m,x,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let n=r(2223),_=r(643),v=r(511),S=r(2585),p=r(8055),c=r(4725),d=r(4269),l=r(6171),u=r(3734),g=s.DomRendererRowFactory=class{constructor(w,y,m,x,T,I,F){this._document=w,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=x,this._coreService=T,this._decorationService=I,this._themeService=F,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,y,m){this._selectionStart=w,this._selectionEnd=y,this._columnSelectMode=m}createRow(w,y,m,x,T,I,F,R,z,B,D){let O=[],P=this._characterJoinerService.getJoinedCharacters(y),b=this._themeService.colors,E,L=w.getNoBgTrimmedLength();m&&L<I+1&&(L=I+1);let M=0,$="",K=0,Y=0,U=0,A=!1,k=0,N=!1,H=0,q=[],j=B!==-1&&D!==-1;for(let Q=0;Q<L;Q++){w.loadCell(Q,this._workCell);let ee=this._workCell.getWidth();if(ee===0)continue;let G=!1,J=Q,Z=this._workCell;if(P.length>0&&Q===P[0][0]){G=!0;let le=P.shift();Z=new d.JoinedCellData(this._workCell,w.translateToString(!0,le[0],le[1]),le[1]-le[0]),J=le[1]-1,ee=Z.getWidth()}let oe=this._isCellInSelection(Q,y),ae=m&&Q===I,me=j&&Q>=B&&Q<=D,we=!1;this._decorationService.forEachDecorationAtCell(Q,y,void 0,(le=>{we=!0}));let fe=Z.getChars()||_.WHITESPACE_CELL_CHAR;if(fe===" "&&(Z.isUnderline()||Z.isOverline())&&(fe="\xA0"),H=ee*R-z.get(fe,Z.isBold(),Z.isItalic()),E){if(M&&(oe&&N||!oe&&!N&&Z.bg===K)&&(oe&&N&&b.selectionForeground||Z.fg===Y)&&Z.extended.ext===U&&me===A&&H===k&&!ae&&!G&&!we){Z.isInvisible()?$+=_.WHITESPACE_CELL_CHAR:$+=fe,M++;continue}M&&(E.textContent=$),E=this._document.createElement("span"),M=0,$=""}else E=this._document.createElement("span");if(K=Z.bg,Y=Z.fg,U=Z.extended.ext,A=me,k=H,N=oe,G&&I>=Q&&I<=J&&(I=Q),!this._coreService.isCursorHidden&&ae&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&q.push("xterm-cursor-blink"),q.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(Z.isBold()&&q.push("xterm-bold"),Z.isItalic()&&q.push("xterm-italic"),Z.isDim()&&q.push("xterm-dim"),$=Z.isInvisible()?_.WHITESPACE_CELL_CHAR:Z.getChars()||_.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(q.push(`xterm-underline-${Z.extended.underlineStyle}`),$===" "&&($="\xA0"),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let le=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&le<8&&(le+=8),E.style.textDecorationColor=b.ansi[le].css}Z.isOverline()&&(q.push("xterm-overline"),$===" "&&($="\xA0")),Z.isStrikethrough()&&q.push("xterm-strikethrough"),me&&(E.style.textDecoration="underline");let W=Z.getFgColor(),V=Z.getFgColorMode(),X=Z.getBgColor(),te=Z.getBgColorMode(),ne=!!Z.isInverse();if(ne){let le=W;W=X,X=le;let Ha=V;V=te,te=Ha}let ce,ve,ie,ge=!1;switch(this._decorationService.forEachDecorationAtCell(Q,y,void 0,(le=>{le.options.layer!=="top"&&ge||(le.backgroundColorRGB&&(te=50331648,X=le.backgroundColorRGB.rgba>>8&16777215,ce=le.backgroundColorRGB),le.foregroundColorRGB&&(V=50331648,W=le.foregroundColorRGB.rgba>>8&16777215,ve=le.foregroundColorRGB),ge=le.options.layer==="top")})),!ge&&oe&&(ce=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,X=ce.rgba>>8&16777215,te=50331648,ge=!0,b.selectionForeground&&(V=50331648,W=b.selectionForeground.rgba>>8&16777215,ve=b.selectionForeground)),ge&&q.push("xterm-decoration-top"),te){case 16777216:case 33554432:ie=b.ansi[X],q.push(`xterm-bg-${X}`);break;case 50331648:ie=p.channels.toColor(X>>16,X>>8&255,255&X),this._addStyle(E,`background-color:#${C((X>>>0).toString(16),"0",6)}`);break;default:ne?(ie=b.foreground,q.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ie=b.background}switch(ce||Z.isDim()&&(ce=p.color.multiplyOpacity(ie,.5)),V){case 16777216:case 33554432:Z.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(E,ie,b.ansi[W],Z,ce,void 0)||q.push(`xterm-fg-${W}`);break;case 50331648:let le=p.channels.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(E,ie,le,Z,ce,ve)||this._addStyle(E,`color:#${C(W.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ie,b.foreground,Z,ce,ve)||ne&&q.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}q.length&&(E.className=q.join(" "),q.length=0),ae||G||we?E.textContent=$:M++,H!==this.defaultSpacing&&(E.style.letterSpacing=`${H}px`),O.push(E),Q=J}return E&&M&&(E.textContent=$),O}_applyMinimumContrast(w,y,m,x,T,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(x.getCode()))return!1;let F=this._getContrastCache(x),R;if(T||I||(R=F.getColor(y.rgba,m.rgba)),R===void 0){let z=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);R=p.color.ensureContrastRatio(T||y,I||m,z),F.setColor((T||y).rgba,(I||m).rgba,R??null)}return!!R&&(this._addStyle(w,`color:${R.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,y){w.setAttribute("style",`${w.getAttribute("style")||""}${y};`)}_isCellInSelection(w,y){let m=this._selectionStart,x=this._selectionEnd;return!(!m||!x)&&(this._columnSelectMode?m[0]<=x[0]?w>=m[0]&&y>=m[1]&&w<x[0]&&y<=x[1]:w<m[0]&&y>=m[1]&&w>=x[0]&&y<=x[1]:y>m[1]&&y<x[1]||m[1]===x[1]&&y===m[1]&&w>=m[0]&&w<x[0]||m[1]<x[1]&&y===x[1]&&w<x[0]||m[1]<x[1]&&y===m[1]&&w>=m[0])}};function C(w,y,m){for(;w.length<m;)w=y+w;return w}s.DomRendererRowFactory=g=a([f(1,c.ICharacterJoinerService),f(2,S.IOptionsService),f(3,c.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,c.IThemeService)],g)},2550:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(r,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=r.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=r.createElement("span");f.classList.add("xterm-char-measure-element");let n=r.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let _=r.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let v=r.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,n,_,v],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(v),a.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(r,a,f,n){r===this._font&&a===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=r,this._fontSize=a,this._weight=f,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(r,a,f){let n=0;if(!a&&!f&&r.length===1&&(n=r.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let S=this._measure(r,0);return S>0&&(this._flat[n]=S),S}let _=r;a&&(_+="B"),f&&(_+="I");let v=this._holey.get(_);if(v===void 0){let S=0;a&&(S|=1),f&&(S|=2),v=this._measure(r,S),v>0&&this._holey.set(_,v)}return v}_measure(r,a){let f=this._measureElements[a];return f.textContent=r.repeat(32),f.offsetWidth/32}}},2223:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=r(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(h,s)=>{function r(f){return 57508<=f&&f<=57558}function a(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=r,s.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},s.isEmoji=a,s.allowRescaling=function(f,n,_,v){return n===1&&_>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!a(f)&&!r(f)&&!(function(S){return 57344<=S&&S<=63743})(f)},s.treatGlyphAsBackgroundColor=function(f){return r(f)||(function(n){return 9472<=n&&n<=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,n,_=0){return(f-(2*Math.round(n)-_))%(2*Math.round(n))}},6052:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class r{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,n,_,v=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();let S=f.buffers.active.ydisp,p=n[1]-S,c=_[1]-S,d=Math.max(p,0),l=Math.min(c,f.rows-1);d>=f.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=l,this.startCol=n[0],this.endCol=_[0])}isCellSelected(f,n,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}s.createSelectionRenderModel=function(){return new r}},456:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(r){this._bufferService=r,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 r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?r%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)-1]:[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[r,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let r=this.selectionStart[0]+this.selectionStartLength;return r>this._bufferService.cols?[r%this._bufferService.cols,this.selectionStart[1]+Math.floor(r/this._bufferService.cols)]:[Math.max(r,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let r=this.selectionStart,a=this.selectionEnd;return!(!r||!a)&&(r[1]>a[1]||r[1]===a[1]&&r[0]>a[0])}handleTrim(r){return this.selectionStart&&(this.selectionStart[1]-=r),this.selectionEnd&&(this.selectionEnd[1]-=r),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,s,r){var a=this&&this.__decorate||function(l,u,g,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,g,m):w(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let n=r(2585),_=r(8460),v=r(844),S=s.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,u,g){super(),this._optionsService=g,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new c(l,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};s.CharSizeService=S=a([f(2,n.IOptionsService)],S);class p extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,g){u!==void 0&&u>0&&g!==void 0&&g>0&&(this._result.width=u,this._result.height=g)}}class c extends p{constructor(u,g,C){super(),this._document=u,this._parentElement=g,this._optionsService=C,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 d extends p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let g=this._ctx.measureText("W");if(!("width"in g&&"fontBoundingBoxAscent"in g&&"fontBoundingBoxDescent"in g))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(h,s,r){var a=this&&this.__decorate||function(d,l,u,g){var C,w=arguments.length,y=w<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,g);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,g){l(u,g,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let n=r(3734),_=r(643),v=r(511),S=r(2585);class p extends n.AttributeData{constructor(l,u,g){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=u,this._width=g}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=p;let c=s.CharacterJoinerService=class Yr{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(l){let u={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(u),u.id}deregister(l){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===l)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(l);if(!u||u.length===0)return[];let g=[],C=u.translateToString(!0),w=0,y=0,m=0,x=u.getFg(0),T=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==T){if(I-w>1){let F=this._getJoinedRanges(C,m,y,u,w);for(let R=0;R<F.length;R++)g.push(F[R])}w=I,m=y,x=this._workCell.fg,T=this._workCell.bg}y+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){let I=this._getJoinedRanges(C,m,y,u,w);for(let F=0;F<I.length;F++)g.push(I[F])}return g}_getJoinedRanges(l,u,g,C,w){let y=l.substring(u,g),m=[];try{m=this._characterJoiners[0].handler(y)}catch(x){console.error(x)}for(let x=1;x<this._characterJoiners.length;x++)try{let T=this._characterJoiners[x].handler(y);for(let I=0;I<T.length;I++)Yr._mergeRanges(m,T[I])}catch(T){console.error(T)}return this._stringRangesToCellRanges(m,C,w),m}_stringRangesToCellRanges(l,u,g){let C=0,w=!1,y=0,m=l[C];if(m){for(let x=g;x<this._bufferService.cols;x++){let T=u.getWidth(x),I=u.getString(x).length||_.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!w&&m[0]<=y&&(m[0]=x,w=!0),m[1]<=y){if(m[1]=x,m=l[++C],!m)break;m[0]<=y?(m[0]=x,w=!0):w=!1}y+=I}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(l,u){let g=!1;for(let C=0;C<l.length;C++){let w=l[C];if(g){if(u[1]<=w[0])return l[C-1][1]=u[1],l;if(u[1]<=w[1])return l[C-1][1]=Math.max(u[1],w[1]),l.splice(C,1),l;l.splice(C,1),C--}else{if(u[1]<=w[0])return l.splice(C,0,u),l;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),l;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),g=!0)}}return g?l[l.length-1][1]=u[1]:l.push(u),l}};s.CharacterJoinerService=c=a([f(0,S.IBufferService)],c)},5114:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=r(844),f=r(8460),n=r(3656);class _ extends a.Disposable{constructor(p,c,d){super(),this._textarea=p,this._window=c,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(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((l=>this._screenDprMonitor.setWindow(l)))),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(p){this._window!==p&&(this._window=p,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=_;class v extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.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,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,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:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=r(844);class f extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}s.LinkProviderService=f},8934:function(h,s,r){var a=this&&this.__decorate||function(S,p,c,d){var l,u=arguments.length,g=u<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,c):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(S,p,c,d);else for(var C=S.length-1;C>=0;C--)(l=S[C])&&(g=(u<3?l(g):u>3?l(p,c,g):l(p,c))||g);return u>3&&g&&Object.defineProperty(p,c,g),g},f=this&&this.__param||function(S,p){return function(c,d){p(c,d,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let n=r(4725),_=r(9806),v=s.MouseService=class{constructor(S,p){this._renderService=S,this._charSizeService=p}getCoords(S,p,c,d,l){return(0,_.getCoords)(window,S,p,c,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(S,p){let c=(0,_.getCoordsRelativeToElement)(window,S,p);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};s.MouseService=v=a([f(0,n.IRenderService),f(1,n.ICharSizeService)],v)},3230:function(h,s,r){var a=this&&this.__decorate||function(l,u,g,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,g,m):w(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let n=r(6193),_=r(4725),v=r(8460),S=r(844),p=r(7226),c=r(2585),d=s.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,g,C,w,y,m,x){super(),this._rowCount=l,this._charSizeService=C,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((T,I)=>this._renderRows(T,I)),m),this.register(this._renderDebouncer),this.register(m.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(y.onResize((()=>this._fullRefresh()))),this.register(y.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(g.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.onDecorationRemoved((()=>this._fullRefresh()))),this.register(g.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()}))),this.register(g.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(y.buffer.y,y.buffer.y,!0)))),this.register(x.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((T=>this._registerIntersectionObserver(T,u))))}_registerIntersectionObserver(l,u){if("IntersectionObserver"in l){let g=new l.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});g.observe(u),this._observerDisposable.value=(0,S.toDisposable)((()=>g.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.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(l,u,g=!1){this._isPaused?this._needsFullRefresh=!0:(g||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,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(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_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(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(l,u))):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(l,u,g){this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=g,this._renderer.value?.handleSelectionChanged(l,u,g)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=d=a([f(2,c.IOptionsService),f(3,_.ICharSizeService),f(4,c.IDecorationService),f(5,c.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],d)},9312:function(h,s,r){var a=this&&this.__decorate||function(m,x,T,I){var F,R=arguments.length,z=R<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(m,x,T,I);else for(var B=m.length-1;B>=0;B--)(F=m[B])&&(z=(R<3?F(z):R>3?F(x,T,z):F(x,T))||z);return R>3&&z&&Object.defineProperty(x,T,z),z},f=this&&this.__param||function(m,x){return function(T,I){x(T,I,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let n=r(9806),_=r(9504),v=r(456),S=r(4725),p=r(8460),c=r(844),d=r(6114),l=r(4841),u=r(511),g=r(2585),C="\xA0",w=new RegExp(C,"g"),y=s.SelectionService=class extends c.Disposable{constructor(m,x,T,I,F,R,z,B,D){super(),this._element=m,this._screenElement=x,this._linkifier=T,this._bufferService=I,this._coreService=F,this._mouseService=R,this._optionsService=z,this._renderService=B,this._coreBrowserService=D,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=O=>this._handleMouseMove(O),this._mouseUpListener=O=>this._handleMouseUp(O),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((O=>this._handleTrim(O))),this.register(this._bufferService.buffers.onBufferActivate((O=>this._handleBufferActivate(O)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.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 m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!m||!x||m[0]===x[0]&&m[1]===x[1])}get selectionText(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!m||!x)return"";let T=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(m[0]===x[0])return"";let F=m[0]<x[0]?m[0]:x[0],R=m[0]<x[0]?x[0]:m[0];for(let z=m[1];z<=x[1];z++){let B=T.translateBufferLineToString(z,!0,F,R);I.push(B)}}else{let F=m[1]===x[1]?x[0]:void 0;I.push(T.translateBufferLineToString(m[1],!0,m[0],F));for(let R=m[1]+1;R<=x[1]-1;R++){let z=T.lines.get(R),B=T.translateBufferLineToString(R,!0);z?.isWrapped?I[I.length-1]+=B:I.push(B)}if(m[1]!==x[1]){let R=T.lines.get(x[1]),z=T.translateBufferLineToString(x[1],!0,0,x[0]);R&&R.isWrapped?I[I.length-1]+=z:I.push(z)}}return I.map((F=>F.replace(w," "))).join(d.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){let d=window.open();if(d){try{d.opener=null}catch{}d.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=g=a([f(0,_.IBufferService),f(1,_.IOptionsService),f(2,_.IOscLinkService)],g)},6193:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(s,a){this._renderCallback=s,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(s){return this._refreshCallbacks.push(s),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(s,a,f){this._rowCount=f,s=s!==void 0?s:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a,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 s=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let s of this._refreshCallbacks)s(0);this._refreshCallbacks=[]}}},3236:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;let a=s(3614),f=s(3656),n=s(3551),_=s(9042),g=s(3730),S=s(1680),p=s(3107),c=s(5744),d=s(2950),l=s(1296),u=s(428),v=s(4269),C=s(5114),w=s(8934),y=s(3230),m=s(9312),x=s(4725),T=s(6731),I=s(8055),F=s(8969),R=s(8460),z=s(844),B=s(6114),D=s(8437),O=s(2584),P=s(7399),b=s(5941),E=s(9074),L=s(2585),M=s(5435),$=s(4567),K=s(779);class Y extends F.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(A={}){super(A),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new R.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new R.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new R.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new R.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new R.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new R.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new R.EventEmitter),this._onBlur=this.register(new R.EventEmitter),this._onA11yCharEmitter=this.register(new R.EventEmitter),this._onA11yTabEmitter=this.register(new R.EventEmitter),this._onWillOpen=this.register(new R.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,N)=>this.refresh(k,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((k=>this._reportWindowsOptions(k)))),this.register(this._inputHandler.onColor((k=>this._handleColorEvent(k)))),this.register((0,R.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,R.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,R.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((k=>this._afterResize(k.cols,k.rows)))),this.register((0,z.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(A){if(this._themeService)for(let k of A){let N,H="";switch(k.index){case 256:N="foreground",H="10";break;case 257:N="background",H="11";break;case 258:N="cursor",H="12";break;default:N="ansi",H="4;"+k.index}switch(k.type){case 0:let q=I.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${O.C0.ESC}]${H};${(0,b.toRgbString)(q)}${O.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((j=>j.ansi[k.index]=I.channels.toColor(...k.color)));else{let j=N;this._themeService.modifyColors((Q=>Q[j]=I.channels.toColor(...k.color)))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.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(O.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 A=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(A);if(!k)return;let N=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,q=k.getWidth(N),j=this._renderService.dimensions.css.cell.width*q,Q=this.buffer.y*this._renderService.dimensions.css.cell.height,ee=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ee+"px",this.textarea.style.top=Q+"px",this.textarea.style.width=j+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let A=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,f.addDisposableDomListener)(this.element,"paste",A)),B.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(A=>this._keyUp(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(A=>this._keyDown(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(A=>this._keyPress(A)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(A=>this._compositionHelper.compositionupdate(A)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(A=>this._inputEvent(A)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(A){if(!A)throw new Error("Terminal requires a parent element.");if(A.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=A.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"),A.appendChild(this.element);let k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.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",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),B.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(C.CoreBrowserService,this.textarea,A.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(x.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(x.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(y.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.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(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),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($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let A=this,k=this.element;function N(j){let Q=A._mouseService.getMouseReportCoords(j,A.screenElement);if(!Q)return!1;let ee,G;switch(j.overrideType||j.type){case"mousemove":G=32,j.buttons===void 0?(ee=3,j.button!==void 0&&(ee=j.button<3?j.button:3)):ee=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":G=0,ee=j.button<3?j.button:3;break;case"mousedown":G=1,ee=j.button<3?j.button:3;break;case"wheel":if(A._customWheelEventHandler&&A._customWheelEventHandler(j)===!1||A.viewport.getLinesScrolled(j)===0)return!1;G=j.deltaY<0?0:1,ee=4;break;default:return!1}return!(G===void 0||ee===void 0||ee>4)&&A.coreMouseService.triggerMouseEvent({col:Q.col,row:Q.row,x:Q.x,y:Q.y,button:ee,action:G,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}let H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:j=>(N(j),j.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(j)),wheel:j=>(N(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&N(j)},mousemove:j=>{j.buttons||N(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?H.mousemove||(k.addEventListener("mousemove",q.mousemove),H.mousemove=q.mousemove):(k.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&j?H.wheel||(k.addEventListener("wheel",q.wheel,{passive:!1}),H.wheel=q.wheel):(k.removeEventListener("wheel",H.wheel),H.wheel=null),2&j?H.mouseup||(H.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&j?H.mousedrag||(H.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(k,"mousedown",(j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return N(j),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(j)}))),this.register((0,f.addDisposableDomListener)(k,"wheel",(j=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){let Q=this.viewport.getLinesScrolled(j);if(Q===0)return;let ee=O.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B"),G="";for(let J=0;J<Math.abs(Q);J++)G+=ee;return this.coreService.triggerDataEvent(G,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(k,"touchstart",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(k,"touchmove",(j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)}),{passive:!1}))}refresh(A,k){this._renderService?.refreshRows(A,k)}updateCursorStyle(A){this._selectionService?.shouldColumnSelect(A)?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(A,k,N=0){N===1?(super.scrollLines(A,k,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(A)}paste(A){(0,a.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}attachCustomWheelEventHandler(A){this._customWheelEventHandler=A}registerLinkProvider(A){return this._linkProviderService.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,k,N){this._selectionService.setSelection(A,k,N)}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(A,k){this._selectionService?.selectLines(A,k)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!k&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let N=(0,P.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),N.type===3||N.type===2){let H=this.rows-1;return this.scrollLines(N.type===2?-H:H),this.cancel(A,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||(N.cancel&&this.cancel(A,!0),!N.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==O.C0.ETX&&N.key!==O.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,k){let N=A.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||A.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||A.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?N:N&&(!k.keyCode||k.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)k=A.charCode;else if(A.which===null||A.which===void 0)k=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;k=A.which}return!(!k||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=A.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(A),!0}return!1}resize(A,k){A!==this.cols||k!==this.rows?super.resize(A,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,k){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 A=1;A<this.rows;A++)this.buffer.lines.push(this.buffer.getBlankLine(D.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 A=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=A,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(O.C0.ESC+"[I"):this.coreService.triggerDataEvent(O.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[4;${N};${k}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let H=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.C0.ESC}[6;${q};${H}t`)}}cancel(A,k){if(this.options.cancelEvents||k)return A.preventDefault(),A.stopPropagation(),!1}}r.Terminal=Y},9924:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(s,a=1e3){this._renderCallback=s,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(s,a,f){this._rowCount=f,s=s!==void 0?s:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=n-this._lastRefreshMs,g=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let s=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,a)}}},1680:function(h,r,s){var a=this&&this.__decorate||function(d,l,u,v){var C,w=arguments.length,y=w<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,v){l(u,v,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;let n=s(3656),_=s(4725),g=s(8460),S=s(844),p=s(2585),c=r.Viewport=class extends S.Disposable{constructor(d,l,u,v,C,w,y,m){super(),this._viewportElement=d,this._scrollArea=l,this._bufferService=u,this._optionsService=v,this._charSizeService=C,this._renderService=w,this._coreBrowserService=y,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 g.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((x=>this._activeBuffer=x.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((x=>this._renderDimensions=x))),this._handleThemeChange(m.colors),this.register(m.onChangeColors((x=>this._handleThemeChange(x)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(d){this._viewportElement.style.backgroundColor=d.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(d){if(d)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 l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let d=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==d&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=d),this._refreshAnimationFrame=null}syncScrollArea(d=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(d);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(d)}_handleScroll(d){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 l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let d=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(d*(this._smoothScrollState.target-this._smoothScrollState.origin)),d<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(d,l){let u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&u<this._lastRecordedBufferHeight)||(d.cancelable&&d.preventDefault(),!1)}handleWheel(d){let l=this._getPixelsScrolled(d);return l!==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+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}scrollLines(d){if(d!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let l=d*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!1})}_getPixelsScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(d,l){let u,v="",C=[],w=l??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let m=d;m<w;m++){let x=y.get(m);if(!x)continue;let T=y.get(m+1)?.isWrapped;if(v+=x.translateToString(!T),!T||m===y.length-1){let I=document.createElement("div");I.textContent=v,C.push(I),v.length>0&&(u=I),v=""}}return{bufferElements:C,cursorElement:u}}getLinesScrolled(d){if(d.deltaY===0||d.shiftKey)return 0;let l=this._applyScrollModifier(d.deltaY,d);return d.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):d.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(d,l){let u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&l.altKey||u==="ctrl"&&l.ctrlKey||u==="shift"&&l.shiftKey?d*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:d*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(d){this._lastTouchY=d.touches[0].pageY}handleTouchMove(d){let l=this._lastTouchY-d.touches[0].pageY;return this._lastTouchY=d.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(d,l))}};r.Viewport=c=a([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,_.ICharSizeService),f(5,_.IRenderService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],c)},3107:function(h,r,s){var a=this&&this.__decorate||function(p,c,d,l){var u,v=arguments.length,C=v<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(c,d,C):u(c,d))||C);return v>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;let n=s(4725),_=s(844),g=s(2585),S=r.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,d,l,u){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=d,this._decorationService=l,this._renderService=u,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((v=>this._removeDecoration(v)))),this.register((0,_.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 p of this._decorationService.decorations)this._renderDecoration(p);this._dimensionsChanged=!1}_renderDecoration(p){this._refreshStyle(p),this._dimensionsChanged&&this._refreshXPosition(p)}_createElement(p){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",p?.options?.layer==="top"),c.style.width=`${Math.round((p.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(p.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(p.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let d=p.options.x??0;return d&&d>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(p,c),c}_refreshStyle(p){let c=p.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)p.element&&(p.element.style.display="none",p.onRenderEmitter.fire(p.element));else{let d=this._decorationElements.get(p);d||(d=this._createElement(p),p.element=d,this._decorationElements.set(p,d),this._container.appendChild(d),p.onDispose((()=>{this._decorationElements.delete(p),d.remove()}))),d.style.top=c*this._renderService.dimensions.css.cell.height+"px",d.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(d)}}_refreshXPosition(p,c=p.element){if(!c)return;let d=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=d?d*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=d?d*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};r.BufferDecorationRenderer=S=a([f(1,g.IBufferService),f(2,n.ICoreBrowserService),f(3,g.IDecorationService),f(4,n.IRenderService)],S)},5871:(h,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(s){if(s.options.overviewRulerOptions){for(let a of this._zones)if(a.color===s.options.overviewRulerOptions.color&&a.position===s.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,s.marker.line))return;if(this._lineAdjacentToZone(a,s.marker.line,s.options.overviewRulerOptions.position))return void this._addLineToZone(a,s.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=s.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=s.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=s.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=s.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:s.options.overviewRulerOptions.color,position:s.options.overviewRulerOptions.position,startBufferLine:s.marker.line,endBufferLine:s.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(s){this._linePadding=s}_lineIntersectsZone(s,a){return a>=s.startBufferLine&&a<=s.endBufferLine}_lineAdjacentToZone(s,a,f){return a>=s.startBufferLine-this._linePadding[f||"full"]&&a<=s.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(s,a){s.startBufferLine=Math.min(s.startBufferLine,a),s.endBufferLine=Math.max(s.endBufferLine,a)}}},5744:function(h,r,s){var a=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;let n=s(5871),_=s(4725),g=s(844),S=s(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},l=r.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,v,C,w,y,m,x){super(),this._viewportElement=u,this._screenElement=v,this._bufferService=C,this._decorationService=w,this._renderService=y,this._optionsService=m,this._coreBrowserService=x,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 T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,g.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 u=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=u,c.center=v,c.right=u,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=c.left,d.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let u=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);p.left=v,p.center=v,p.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*p.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 v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;let u=this._colorZoneStore.zones;for(let v of u)v.position!=="full"&&this._renderColorZone(v);for(let v of u)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(d[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-p[u.position||"full"]/2),c[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[u.position||"full"]))}_queueRefresh(u,v){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=l=a([f(2,S.IBufferService),f(3,S.IDecorationService),f(4,_.IRenderService),f(5,S.IOptionsService),f(6,_.ICoreBrowserService)],l)},2950:function(h,r,s){var a=this&&this.__decorate||function(p,c,d,l){var u,v=arguments.length,C=v<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,d):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(p,c,d,l);else for(var w=p.length-1;w>=0;w--)(u=p[w])&&(C=(v<3?u(C):v>3?u(c,d,C):u(c,d))||C);return v>3&&C&&Object.defineProperty(c,d,C),C},f=this&&this.__param||function(p,c){return function(d,l){c(d,l,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;let n=s(4725),_=s(2585),g=s(2584),S=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,d,l,u,v){this._textarea=p,this._compositionView=c,this._bufferService=d,this._optionsService=l,this._coreService=u,this._renderService=v,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(p){this._compositionView.textContent=p.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(p){if(this._isComposing||this._isSendingComposition){if(p.keyCode===229||p.keyCode===16||p.keyCode===17||p.keyCode===18)return!1;this._finalizeComposition(!1)}return p.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(p){if(this._compositionView.classList.remove("active"),this._isComposing=!1,p){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let d;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,d=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),d.length>0&&this._coreService.triggerDataEvent(d,!0)}}),0)}else{this._isSendingComposition=!1;let c=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(c,!0)}}_handleAnyTextareaChanges(){let p=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,d=c.replace(p,"");this._dataAlreadySent=d,c.length>p.length?this._coreService.triggerDataEvent(d,!0):c.length<p.length?this._coreService.triggerDataEvent(`${g.C0.DEL}`,!0):c.length===p.length&&c!==p&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(p){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let v=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(v.width,1)+"px",this._textarea.style.height=Math.max(v.height,1)+"px",this._textarea.style.lineHeight=v.height+"px"}p||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=S=a([f(2,_.IBufferService),f(3,_.IOptionsService),f(4,_.ICoreService),f(5,n.IRenderService)],S)},9806:(h,r)=>{function s(a,f,n){let _=n.getBoundingClientRect(),g=a.getComputedStyle(n),S=parseInt(g.getPropertyValue("padding-left")),p=parseInt(g.getPropertyValue("padding-top"));return[f.clientX-_.left-S,f.clientY-_.top-p]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=s,r.getCoords=function(a,f,n,_,g,S,p,c,d){if(!S)return;let l=s(a,f,n);return l?(l[0]=Math.ceil((l[0]+(d?p/2:0))/p),l[1]=Math.ceil(l[1]/c),l[0]=Math.min(Math.max(l[0],1),_+(d?1:0)),l[1]=Math.min(Math.max(l[1],1),g),l):void 0}},9504:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;let a=s(2584);function f(c,d,l,u){let v=c-n(c,l),C=d-n(d,l),w=Math.abs(v-C)-(function(y,m,x){let T=0,I=y-n(y,x),F=m-n(m,x);for(let R=0;R<Math.abs(I-F);R++){let z=_(y,m)==="A"?-1:1;x.buffer.lines.get(I+z*R)?.isWrapped&&T++}return T})(c,d,l);return p(w,S(_(c,d),u))}function n(c,d){let l=0,u=d.buffer.lines.get(c),v=u?.isWrapped;for(;v&&c>=0&&c<d.rows;)l++,u=d.buffer.lines.get(--c),v=u?.isWrapped;return l}function _(c,d){return c>d?"A":"B"}function g(c,d,l,u,v,C){let w=c,y=d,m="";for(;w!==l||y!==u;)w+=v?1:-1,v&&w>C.cols-1?(m+=C.buffer.translateBufferLineToString(y,!1,c,w),w=0,c=0,y++):!v&&w<0&&(m+=C.buffer.translateBufferLineToString(y,!1,0,c+1),w=C.cols-1,c=w,y--);return m+C.buffer.translateBufferLineToString(y,!1,c,w)}function S(c,d){let l=d?"O":"[";return a.C0.ESC+l+c}function p(c,d){c=Math.floor(c);let l="";for(let u=0;u<c;u++)l+=d;return l}r.moveToCellSequence=function(c,d,l,u){let v=l.buffer.x,C=l.buffer.y;if(!l.buffer.hasScrollback)return(function(m,x,T,I,F,R){return f(x,I,F,R).length===0?"":p(g(m,x,m,x-n(x,F),!1,F).length,S("D",R))})(v,C,0,d,l,u)+f(C,d,l,u)+(function(m,x,T,I,F,R){let z;z=f(x,I,F,R).length>0?I-n(I,F):x;let B=I,D=(function(O,P,b,E,L,M){let $;return $=f(b,E,L,M).length>0?E-n(E,L):P,O<b&&$<=E||O>=b&&$<E?"C":"D"})(m,x,T,I,F,R);return p(g(m,z,T,B,D==="C",F).length,S(D,R))})(v,C,c,d,l,u);let w;if(C===d)return w=v>c?"D":"C",p(Math.abs(v-c),S(w,u));w=C>d?"D":"C";let y=Math.abs(C-d);return p((function(m,x){return x.cols-m})(C>d?c:v,l)+(y-1)*l.cols+1+((C>d?v:c)-1),S(w,u))}},1296:function(h,r,s){var a=this&&this.__decorate||function(R,z,B,D){var O,P=arguments.length,b=P<3?z:D===null?D=Object.getOwnPropertyDescriptor(z,B):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(R,z,B,D);else for(var E=R.length-1;E>=0;E--)(O=R[E])&&(b=(P<3?O(b):P>3?O(z,B,b):O(z,B))||b);return P>3&&b&&Object.defineProperty(z,B,b),b},f=this&&this.__param||function(R,z){return function(B,D){z(B,D,R)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;let n=s(3787),_=s(2550),g=s(2223),S=s(6171),p=s(6052),c=s(4725),d=s(8055),l=s(8460),u=s(844),v=s(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",y="xterm-fg-",m="xterm-bg-",x="xterm-focus",T="xterm-selection",I=1,F=r.DomRenderer=class extends u.Disposable{constructor(R,z,B,D,O,P,b,E,L,M,$,K,Y){super(),this._terminal=R,this._document=z,this._element=B,this._screenElement=D,this._viewportElement=O,this._helperContainer=P,this._linkifier2=b,this._charSizeService=L,this._optionsService=M,this._bufferService=$,this._coreBrowserService=K,this._themeService=Y,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),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(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((U=>this._injectCss(U)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((U=>this._handleLinkHover(U)))),this.register(this._linkifier2.onHideLinkUnderline((U=>this._handleLinkLeave(U)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.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 R=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*R,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*R),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/R),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/R),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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let z=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(R){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${w} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${w} .xterm-dim { color: ${d.color.multiplyOpacity(R.foreground,.5).css};}`,z+=`${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 B=`blink_underline_${this._terminalClass}`,D=`blink_bar_${this._terminalClass}`,O=`blink_block_${this._terminalClass}`;z+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${D} { 50% { box-shadow: none; }}`,z+=`@keyframes ${O} { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,z+=`${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${D} 1s step-end infinite;}${this._terminalSelector} .${w}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${R.cursor.css} !important; color: ${R.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(let[P,b]of R.ansi.entries())z+=`${this._terminalSelector} .${y}${P} { color: ${b.css}; }${this._terminalSelector} .${y}${P}.xterm-dim { color: ${d.color.multiplyOpacity(b,.5).css}; }${this._terminalSelector} .${m}${P} { background-color: ${b.css}; }`;z+=`${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(R.background).css}; }${this._terminalSelector} .${y}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){let R=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${R}px`,this._rowFactory.defaultSpacing=R}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(R,z){for(let B=this._rowElements.length;B<=z;B++){let D=this._document.createElement("div");this._rowContainer.appendChild(D),this._rowElements.push(D)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,z){this._refreshRowElements(R,z),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(x),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,z,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,z,B),this.renderRows(0,this._bufferService.rows-1),!R||!z)return;this._selectionRenderModel.update(this._terminal,R,z,B);let D=this._selectionRenderModel.viewportStartRow,O=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,b=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||b<0)return;let E=this._document.createDocumentFragment();if(B){let L=R[0]>z[0];E.appendChild(this._createSelectionElement(P,L?z[0]:R[0],L?R[0]:z[0],b-P+1))}else{let L=D===P?R[0]:0,M=P===O?z[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(P,L,M));let $=b-P-1;if(E.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,$)),P!==b){let K=O===b?z[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,K))}}this._selectionContainer.appendChild(E)}_createSelectionElement(R,z,B,D=1){let O=this._document.createElement("div"),P=z*this.dimensions.css.cell.width,b=this.dimensions.css.cell.width*(B-z);return P+b>this.dimensions.css.canvas.width&&(b=this.dimensions.css.canvas.width-P),O.style.height=D*this.dimensions.css.cell.height+"px",O.style.top=R*this.dimensions.css.cell.height+"px",O.style.left=`${P}px`,O.style.width=`${b}px`,O}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 R of this._rowElements)R.replaceChildren()}renderRows(R,z){let B=this._bufferService.buffer,D=B.ybase+B.y,O=Math.min(B.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=R;L<=z;L++){let M=L+B.ydisp,$=this._rowElements[L],K=B.lines.get(M);if(!$||!K)break;$.replaceChildren(...this._rowFactory.createRow(K,M,M===D,b,E,O,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!0)}_handleLinkLeave(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!1)}_setCellUnderline(R,z,B,D,O,P){B<0&&(R=0),D<0&&(z=0);let b=this._bufferService.rows-1;B=Math.max(Math.min(B,b),0),D=Math.max(Math.min(D,b),0),O=Math.min(O,this._bufferService.cols);let E=this._bufferService.buffer,L=E.ybase+E.y,M=Math.min(E.x,O-1),$=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let U=B;U<=D;++U){let A=U+E.ydisp,k=this._rowElements[U],N=E.lines.get(A);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,A,A===L,K,Y,M,$,this.dimensions.css.cell.width,this._widthCache,P?U===B?R:0:-1,P?(U===D?z:O)-1:-1))}}};r.DomRenderer=F=a([f(7,v.IInstantiationService),f(8,c.ICharSizeService),f(9,v.IOptionsService),f(10,v.IBufferService),f(11,c.ICoreBrowserService),f(12,c.IThemeService)],F)},3787:function(h,r,s){var a=this&&this.__decorate||function(w,y,m,x){var T,I=arguments.length,F=I<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(w,y,m,x);else for(var R=w.length-1;R>=0;R--)(T=w[R])&&(F=(I<3?T(F):I>3?T(y,m,F):T(y,m))||F);return I>3&&F&&Object.defineProperty(y,m,F),F},f=this&&this.__param||function(w,y){return function(m,x){y(m,x,w)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;let n=s(2223),_=s(643),g=s(511),S=s(2585),p=s(8055),c=s(4725),d=s(4269),l=s(6171),u=s(3734),v=r.DomRendererRowFactory=class{constructor(w,y,m,x,T,I,F){this._document=w,this._characterJoinerService=y,this._optionsService=m,this._coreBrowserService=x,this._coreService=T,this._decorationService=I,this._themeService=F,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,y,m){this._selectionStart=w,this._selectionEnd=y,this._columnSelectMode=m}createRow(w,y,m,x,T,I,F,R,z,B,D){let O=[],P=this._characterJoinerService.getJoinedCharacters(y),b=this._themeService.colors,E,L=w.getNoBgTrimmedLength();m&&L<I+1&&(L=I+1);let M=0,$="",K=0,Y=0,U=0,A=!1,k=0,N=!1,H=0,q=[],j=B!==-1&&D!==-1;for(let Q=0;Q<L;Q++){w.loadCell(Q,this._workCell);let ee=this._workCell.getWidth();if(ee===0)continue;let G=!1,J=Q,Z=this._workCell;if(P.length>0&&Q===P[0][0]){G=!0;let le=P.shift();Z=new d.JoinedCellData(this._workCell,w.translateToString(!0,le[0],le[1]),le[1]-le[0]),J=le[1]-1,ee=Z.getWidth()}let oe=this._isCellInSelection(Q,y),ae=m&&Q===I,me=j&&Q>=B&&Q<=D,we=!1;this._decorationService.forEachDecorationAtCell(Q,y,void 0,(le=>{we=!0}));let fe=Z.getChars()||_.WHITESPACE_CELL_CHAR;if(fe===" "&&(Z.isUnderline()||Z.isOverline())&&(fe="\xA0"),H=ee*R-z.get(fe,Z.isBold(),Z.isItalic()),E){if(M&&(oe&&N||!oe&&!N&&Z.bg===K)&&(oe&&N&&b.selectionForeground||Z.fg===Y)&&Z.extended.ext===U&&me===A&&H===k&&!ae&&!G&&!we){Z.isInvisible()?$+=_.WHITESPACE_CELL_CHAR:$+=fe,M++;continue}M&&(E.textContent=$),E=this._document.createElement("span"),M=0,$=""}else E=this._document.createElement("span");if(K=Z.bg,Y=Z.fg,U=Z.extended.ext,A=me,k=H,N=oe,G&&I>=Q&&I<=J&&(I=Q),!this._coreService.isCursorHidden&&ae&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&q.push("xterm-cursor-blink"),q.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(Z.isBold()&&q.push("xterm-bold"),Z.isItalic()&&q.push("xterm-italic"),Z.isDim()&&q.push("xterm-dim"),$=Z.isInvisible()?_.WHITESPACE_CELL_CHAR:Z.getChars()||_.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(q.push(`xterm-underline-${Z.extended.underlineStyle}`),$===" "&&($="\xA0"),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let le=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&le<8&&(le+=8),E.style.textDecorationColor=b.ansi[le].css}Z.isOverline()&&(q.push("xterm-overline"),$===" "&&($="\xA0")),Z.isStrikethrough()&&q.push("xterm-strikethrough"),me&&(E.style.textDecoration="underline");let W=Z.getFgColor(),V=Z.getFgColorMode(),X=Z.getBgColor(),te=Z.getBgColorMode(),ne=!!Z.isInverse();if(ne){let le=W;W=X,X=le;let $a=V;V=te,te=$a}let ce,ge,ie,ve=!1;switch(this._decorationService.forEachDecorationAtCell(Q,y,void 0,(le=>{le.options.layer!=="top"&&ve||(le.backgroundColorRGB&&(te=50331648,X=le.backgroundColorRGB.rgba>>8&16777215,ce=le.backgroundColorRGB),le.foregroundColorRGB&&(V=50331648,W=le.foregroundColorRGB.rgba>>8&16777215,ge=le.foregroundColorRGB),ve=le.options.layer==="top")})),!ve&&oe&&(ce=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,X=ce.rgba>>8&16777215,te=50331648,ve=!0,b.selectionForeground&&(V=50331648,W=b.selectionForeground.rgba>>8&16777215,ge=b.selectionForeground)),ve&&q.push("xterm-decoration-top"),te){case 16777216:case 33554432:ie=b.ansi[X],q.push(`xterm-bg-${X}`);break;case 50331648:ie=p.channels.toColor(X>>16,X>>8&255,255&X),this._addStyle(E,`background-color:#${C((X>>>0).toString(16),"0",6)}`);break;default:ne?(ie=b.foreground,q.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):ie=b.background}switch(ce||Z.isDim()&&(ce=p.color.multiplyOpacity(ie,.5)),V){case 16777216:case 33554432:Z.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(E,ie,b.ansi[W],Z,ce,void 0)||q.push(`xterm-fg-${W}`);break;case 50331648:let le=p.channels.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(E,ie,le,Z,ce,ge)||this._addStyle(E,`color:#${C(W.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ie,b.foreground,Z,ce,ge)||ne&&q.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}q.length&&(E.className=q.join(" "),q.length=0),ae||G||we?E.textContent=$:M++,H!==this.defaultSpacing&&(E.style.letterSpacing=`${H}px`),O.push(E),Q=J}return E&&M&&(E.textContent=$),O}_applyMinimumContrast(w,y,m,x,T,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(x.getCode()))return!1;let F=this._getContrastCache(x),R;if(T||I||(R=F.getColor(y.rgba,m.rgba)),R===void 0){let z=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);R=p.color.ensureContrastRatio(T||y,I||m,z),F.setColor((T||y).rgba,(I||m).rgba,R??null)}return!!R&&(this._addStyle(w,`color:${R.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,y){w.setAttribute("style",`${w.getAttribute("style")||""}${y};`)}_isCellInSelection(w,y){let m=this._selectionStart,x=this._selectionEnd;return!(!m||!x)&&(this._columnSelectMode?m[0]<=x[0]?w>=m[0]&&y>=m[1]&&w<x[0]&&y<=x[1]:w<m[0]&&y>=m[1]&&w>=x[0]&&y<=x[1]:y>m[1]&&y<x[1]||m[1]===x[1]&&y===m[1]&&w>=m[0]&&w<x[0]||m[1]<x[1]&&y===x[1]&&w<x[0]||m[1]<x[1]&&y===m[1]&&w>=m[0])}};function C(w,y,m){for(;w.length<m;)w=y+w;return w}r.DomRendererRowFactory=v=a([f(1,c.ICharacterJoinerService),f(2,S.IOptionsService),f(3,c.ICoreBrowserService),f(4,S.ICoreService),f(5,S.IDecorationService),f(6,c.IThemeService)],v)},2550:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(s,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=s.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=s.createElement("span");f.classList.add("xterm-char-measure-element");let n=s.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let _=s.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let g=s.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[f,n,_,g],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(g),a.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(s,a,f,n){s===this._font&&a===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=s,this._fontSize=a,this._weight=f,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(s,a,f){let n=0;if(!a&&!f&&s.length===1&&(n=s.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let S=this._measure(s,0);return S>0&&(this._flat[n]=S),S}let _=s;a&&(_+="B"),f&&(_+="I");let g=this._holey.get(_);if(g===void 0){let S=0;a&&(S|=1),f&&(S|=2),g=this._measure(s,S),g>0&&this._holey.set(_,g)}return g}_measure(s,a){let f=this._measureElements[a];return f.textContent=s.repeat(32),f.offsetWidth/32}}},2223:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;let a=s(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(h,r)=>{function s(f){return 57508<=f&&f<=57558}function a(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(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(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=s,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=a,r.allowRescaling=function(f,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&f!==void 0&&f>255&&!a(f)&&!s(f)&&!(function(S){return 57344<=S&&S<=63743})(f)},r.treatGlyphAsBackgroundColor=function(f){return s(f)||(function(n){return 9472<=n&&n<=9631})(f)},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(f,n,_=0){return(f-(2*Math.round(n)-_))%(2*Math.round(n))}},6052:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class s{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,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();let S=f.buffers.active.ydisp,p=n[1]-S,c=_[1]-S,d=Math.max(p,0),l=Math.min(c,f.rows-1);d>=f.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=l,this.startCol=n[0],this.endCol=_[0])}isCellSelected(f,n,_){return!!this.hasSelection&&(_-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}r.createSelectionRenderModel=function(){return new s}},456:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(s){this._bufferService=s,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 s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?s%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)-1]:[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[s,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[Math.max(s,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let s=this.selectionStart,a=this.selectionEnd;return!(!s||!a)&&(s[1]>a[1]||s[1]===a[1]&&s[0]>a[0])}handleTrim(s){return this.selectionStart&&(this.selectionStart[1]-=s),this.selectionEnd&&(this.selectionEnd[1]-=s),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,r,s){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;let n=s(2585),_=s(8460),g=s(844),S=r.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,u,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new c(l,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};r.CharSizeService=S=a([f(2,n.IOptionsService)],S);class p extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,v){u!==void 0&&u>0&&v!==void 0&&v>0&&(this._result.width=u,this._result.height=v)}}class c extends p{constructor(u,v,C){super(),this._document=u,this._parentElement=v,this._optionsService=C,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 d extends p{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let v=this._ctx.measureText("W");if(!("width"in v&&"fontBoundingBoxAscent"in v&&"fontBoundingBoxDescent"in v))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(h,r,s){var a=this&&this.__decorate||function(d,l,u,v){var C,w=arguments.length,y=w<3?l:v===null?v=Object.getOwnPropertyDescriptor(l,u):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(d,l,u,v);else for(var m=d.length-1;m>=0;m--)(C=d[m])&&(y=(w<3?C(y):w>3?C(l,u,y):C(l,u))||y);return w>3&&y&&Object.defineProperty(l,u,y),y},f=this&&this.__param||function(d,l){return function(u,v){l(u,v,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;let n=s(3734),_=s(643),g=s(511),S=s(2585);class p extends n.AttributeData{constructor(l,u,v){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=u,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=p;let c=r.CharacterJoinerService=class Zs{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(l){let u={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(u),u.id}deregister(l){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===l)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];let u=this._bufferService.buffer.lines.get(l);if(!u||u.length===0)return[];let v=[],C=u.translateToString(!0),w=0,y=0,m=0,x=u.getFg(0),T=u.getBg(0);for(let I=0;I<u.getTrimmedLength();I++)if(u.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==T){if(I-w>1){let F=this._getJoinedRanges(C,m,y,u,w);for(let R=0;R<F.length;R++)v.push(F[R])}w=I,m=y,x=this._workCell.fg,T=this._workCell.bg}y+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){let I=this._getJoinedRanges(C,m,y,u,w);for(let F=0;F<I.length;F++)v.push(I[F])}return v}_getJoinedRanges(l,u,v,C,w){let y=l.substring(u,v),m=[];try{m=this._characterJoiners[0].handler(y)}catch(x){console.error(x)}for(let x=1;x<this._characterJoiners.length;x++)try{let T=this._characterJoiners[x].handler(y);for(let I=0;I<T.length;I++)Zs._mergeRanges(m,T[I])}catch(T){console.error(T)}return this._stringRangesToCellRanges(m,C,w),m}_stringRangesToCellRanges(l,u,v){let C=0,w=!1,y=0,m=l[C];if(m){for(let x=v;x<this._bufferService.cols;x++){let T=u.getWidth(x),I=u.getString(x).length||_.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!w&&m[0]<=y&&(m[0]=x,w=!0),m[1]<=y){if(m[1]=x,m=l[++C],!m)break;m[0]<=y?(m[0]=x,w=!0):w=!1}y+=I}}m&&(m[1]=this._bufferService.cols)}}static _mergeRanges(l,u){let v=!1;for(let C=0;C<l.length;C++){let w=l[C];if(v){if(u[1]<=w[0])return l[C-1][1]=u[1],l;if(u[1]<=w[1])return l[C-1][1]=Math.max(u[1],w[1]),l.splice(C,1),l;l.splice(C,1),C--}else{if(u[1]<=w[0])return l.splice(C,0,u),l;if(u[1]<=w[1])return w[0]=Math.min(u[0],w[0]),l;u[0]<w[1]&&(w[0]=Math.min(u[0],w[0]),v=!0)}}return v?l[l.length-1][1]=u[1]:l.push(u),l}};r.CharacterJoinerService=c=a([f(0,S.IBufferService)],c)},5114:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;let a=s(844),f=s(8460),n=s(3656);class _ extends a.Disposable{constructor(p,c,d){super(),this._textarea=p,this._window=c,this.mainDocument=d,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(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((l=>this._screenDprMonitor.setWindow(l)))),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(p){this._window!==p&&(this._window=p,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=_;class g extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.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,a.toDisposable)((()=>this.clearListener())))}setWindow(p){this._parentWindow=p,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:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;let a=s(844);class f extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let g=this.linkProviders.indexOf(_);g!==-1&&this.linkProviders.splice(g,1)}}}}r.LinkProviderService=f},8934:function(h,r,s){var a=this&&this.__decorate||function(S,p,c,d){var l,u=arguments.length,v=u<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,c):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(S,p,c,d);else for(var C=S.length-1;C>=0;C--)(l=S[C])&&(v=(u<3?l(v):u>3?l(p,c,v):l(p,c))||v);return u>3&&v&&Object.defineProperty(p,c,v),v},f=this&&this.__param||function(S,p){return function(c,d){p(c,d,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;let n=s(4725),_=s(9806),g=r.MouseService=class{constructor(S,p){this._renderService=S,this._charSizeService=p}getCoords(S,p,c,d,l){return(0,_.getCoords)(window,S,p,c,d,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(S,p){let c=(0,_.getCoordsRelativeToElement)(window,S,p);if(this._charSizeService.hasValidSize)return c[0]=Math.min(Math.max(c[0],0),this._renderService.dimensions.css.canvas.width-1),c[1]=Math.min(Math.max(c[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(c[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(c[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(c[0]),y:Math.floor(c[1])}}};r.MouseService=g=a([f(0,n.IRenderService),f(1,n.ICharSizeService)],g)},3230:function(h,r,s){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;let n=s(6193),_=s(4725),g=s(8460),S=s(844),p=s(7226),c=s(2585),d=r.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,u,v,C,w,y,m,x){super(),this._rowCount=l,this._charSizeService=C,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((T,I)=>this._renderRows(T,I)),m),this.register(this._renderDebouncer),this.register(m.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(y.onResize((()=>this._fullRefresh()))),this.register(y.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(v.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.onDecorationRemoved((()=>this._fullRefresh()))),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(y.cols,y.rows),this._fullRefresh()}))),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(y.buffer.y,y.buffer.y,!0)))),this.register(x.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(m.window,u),this.register(m.onWindowChange((T=>this._registerIntersectionObserver(T,u))))}_registerIntersectionObserver(l,u){if("IntersectionObserver"in l){let v=new l.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});v.observe(u),this._observerDisposable.value=(0,S.toDisposable)((()=>v.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.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(l,u,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,u,this._rowCount))}_renderRows(l,u){this._renderer.value&&(l=Math.min(l,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(l,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:u}),this._onRender.fire({start:l,end:u}),this._isNextRenderRedrawOnly=!0)}resize(l,u){this._rowCount=u,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(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_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(l,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(l,u))):this._renderer.value.handleResize(l,u),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(l,u,v){this._selectionState.start=l,this._selectionState.end=u,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(l,u,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=d=a([f(2,c.IOptionsService),f(3,_.ICharSizeService),f(4,c.IDecorationService),f(5,c.IBufferService),f(6,_.ICoreBrowserService),f(7,_.IThemeService)],d)},9312:function(h,r,s){var a=this&&this.__decorate||function(m,x,T,I){var F,R=arguments.length,z=R<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(m,x,T,I);else for(var B=m.length-1;B>=0;B--)(F=m[B])&&(z=(R<3?F(z):R>3?F(x,T,z):F(x,T))||z);return R>3&&z&&Object.defineProperty(x,T,z),z},f=this&&this.__param||function(m,x){return function(T,I){x(T,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;let n=s(9806),_=s(9504),g=s(456),S=s(4725),p=s(8460),c=s(844),d=s(6114),l=s(4841),u=s(511),v=s(2585),C="\xA0",w=new RegExp(C,"g"),y=r.SelectionService=class extends c.Disposable{constructor(m,x,T,I,F,R,z,B,D){super(),this._element=m,this._screenElement=x,this._linkifier=T,this._bufferService=I,this._coreService=F,this._mouseService=R,this._optionsService=z,this._renderService=B,this._coreBrowserService=D,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new p.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new p.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new p.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=O=>this._handleMouseMove(O),this._mouseUpListener=O=>this._handleMouseUp(O),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((O=>this._handleTrim(O))),this.register(this._bufferService.buffers.onBufferActivate((O=>this._handleBufferActivate(O)))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,c.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 m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!m||!x||m[0]===x[0]&&m[1]===x[1])}get selectionText(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!m||!x)return"";let T=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(m[0]===x[0])return"";let F=m[0]<x[0]?m[0]:x[0],R=m[0]<x[0]?x[0]:m[0];for(let z=m[1];z<=x[1];z++){let B=T.translateBufferLineToString(z,!0,F,R);I.push(B)}}else{let F=m[1]===x[1]?x[0]:void 0;I.push(T.translateBufferLineToString(m[1],!0,m[0],F));for(let R=m[1]+1;R<=x[1]-1;R++){let z=T.lines.get(R),B=T.translateBufferLineToString(R,!0);z?.isWrapped?I[I.length-1]+=B:I.push(B)}if(m[1]!==x[1]){let R=T.lines.get(x[1]),z=T.translateBufferLineToString(x[1],!0,0,x[0]);R&&R.isWrapped?I[I.length-1]+=z:I.push(z)}}return I.map((F=>F.replace(w," "))).join(d.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&m&&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(m){let x=this._getMouseBufferCoords(m),T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(T&&I&&x)&&this._areCoordsInSelection(x,T,I)}isCellInSelection(m,x){let T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I)&&this._areCoordsInSelection([m,x],T,I)}_areCoordsInSelection(m,x,T){return m[1]>x[1]&&m[1]<T[1]||x[1]===T[1]&&m[1]===x[1]&&m[0]>=x[0]&&m[0]<T[0]||x[1]<T[1]&&m[1]===T[1]&&m[0]<T[0]||x[1]<T[1]&&m[1]===x[1]&&m[0]>=x[0]}_selectWordAtCursor(m,x){let T=this._linkifier.currentLink?.link?.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let I=this._getMouseBufferCoords(m);return!!I&&(this._selectWordAt(I,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,x){this._model.clearSelection(),m=Math.max(m,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let x=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(m){let x=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],T=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=T?0:(x>T&&(x-=T),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(m){return d.isMac?m.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:m.shiftKey}handleMouseDown(m){if(this._mouseDownTimeStamp=m.timeStamp,(m.button!==2||!this.hasSelection)&&m.button===0){if(!this._enabled){if(!this.shouldForceSelection(m))return;m.stopPropagation()}m.preventDefault(),this._dragScrollAmount=0,this._enabled&&m.shiftKey?this._handleIncrementalClick(m):m.detail===1?this._handleSingleClick(m):m.detail===2?this._handleDoubleClick(m):m.detail===3&&this._handleTripleClick(m),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(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))}_handleSingleClick(m){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(m)?3:0,this._model.selectionStart=this._getMouseBufferCoords(m),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let x=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);x&&x.length!==this._model.selectionStart[0]&&x.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let x=this._getMouseBufferCoords(m);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let x=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(m),!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(m),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){let I=T.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}x&&x[0]===this._model.selectionEnd[0]&&x[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 m=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(m.ydisp+this._bufferService.rows,m.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=m.ydisp),this.refresh()}}_handleMouseUp(m){let x=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let T=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){let I=(0,_.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,T=!(!m||!x||m[0]===x[0]&&m[1]===x[1]);T?m&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,x,T)):this._oldHasSelection&&this._fireOnSelectionChange(m,x,T)}_fireOnSelectionChange(m,x,T){this._oldSelectionStart=m,this._oldSelectionEnd=x,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(m,x){let T=x;for(let I=0;x>=I;I++){let F=m.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:F>1&&x!==I&&(T+=F-1)}return T}setSelection(m,x,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,x],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,x,T=!0,I=!0){if(m[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,R=F.lines.get(m[1]);if(!R)return;let z=F.translateBufferLineToString(m[1],!1),B=this._convertViewportColToCharacterIndex(R,m[0]),D=B,O=m[0]-B,P=0,b=0,E=0,L=0;if(z.charAt(B)===" "){for(;B>0&&z.charAt(B-1)===" ";)B--;for(;D<z.length&&z.charAt(D+1)===" ";)D++}else{let K=m[0],Y=m[0];R.getWidth(K)===0&&(P++,K--),R.getWidth(Y)===2&&(b++,Y++);let U=R.getString(Y).length;for(U>1&&(L+=U-1,D+=U-1);K>0&&B>0&&!this._isCharWordSeparator(R.loadCell(K-1,this._workCell));){R.loadCell(K-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,K--):A>1&&(E+=A-1,B-=A-1),B--,K--}for(;Y<R.length&&D+1<z.length&&!this._isCharWordSeparator(R.loadCell(Y+1,this._workCell));){R.loadCell(Y+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):A>1&&(L+=A-1,D+=A-1),D++,Y++}}D++;let M=B+O-P+E,$=Math.min(this._bufferService.cols,D-B+P+b-E-L);if(x||z.slice(B,D).trim()!==""){if(T&&M===0&&R.getCodePoint(0)!==32){let K=F.lines.get(m[1]-1);if(K&&R.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Y){let U=this._bufferService.cols-Y.start;M-=U,$+=U}}}if(I&&M+$===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){let K=F.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let Y=this._getWordAt([0,m[1]+1],!1,!1,!0);Y&&($+=Y.length)}}return{start:M,length:$}}}_selectWordAt(m,x){let T=this._getWordAt(m,x);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[T.start,m[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(m){let x=this._getWordAt(m,!0);if(x){let T=m[1];for(;x.start<0;)x.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,T]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let x=this._bufferService.buffer.getWrappedRangeForLine(m),T={start:{x:0,y:x.first},end:{x:this._bufferService.cols-1,y:x.last}};this._model.selectionStart=[0,x.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(T,this._bufferService.cols)}};s.SelectionService=y=a([f(3,g.IBufferService),f(4,g.ICoreService),f(5,S.IMouseService),f(6,g.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],y)},4725:(h,s,r)=>{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 a=r(8343);s.ICharSizeService=(0,a.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),s.IMouseService=(0,a.createDecorator)("MouseService"),s.IRenderService=(0,a.createDecorator)("RenderService"),s.ISelectionService=(0,a.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,a.createDecorator)("ThemeService"),s.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(h,s,r){var a=this&&this.__decorate||function(y,m,x,T){var I,F=arguments.length,R=F<3?m:T===null?T=Object.getOwnPropertyDescriptor(m,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,m,x,T);else for(var z=y.length-1;z>=0;z--)(I=y[z])&&(R=(F<3?I(R):F>3?I(m,x,R):I(m,x))||R);return F>3&&R&&Object.defineProperty(m,x,R),R},f=this&&this.__param||function(y,m){return function(x,T){m(x,T,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let n=r(7239),_=r(8055),v=r(8460),S=r(844),p=r(2585),c=_.css.toColor("#ffffff"),d=_.css.toColor("#000000"),l=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),g={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let y=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],m=[0,95,135,175,215,255];for(let x=0;x<216;x++){let T=m[x/36%6|0],I=m[x/6%6|0],F=m[x%6];y.push({css:_.channels.toCss(T,I,F),rgba:_.channels.toRgba(T,I,F)})}for(let x=0;x<24;x++){let T=8+10*x;y.push({css:_.channels.toCss(T,T,T),rgba:_.channels.toRgba(T,T,T)})}return y})());let C=s.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(y){super(),this._optionsService=y,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:d,cursor:l,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:g,selectionBackgroundOpaque:_.color.blend(d,g),selectionInactiveBackgroundTransparent:g,selectionInactiveBackgroundOpaque:_.color.blend(d,g),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(y={}){let m=this._colors;if(m.foreground=w(y.foreground,c),m.background=w(y.background,d),m.cursor=w(y.cursor,l),m.cursorAccent=w(y.cursorAccent,u),m.selectionBackgroundTransparent=w(y.selectionBackground,g),m.selectionBackgroundOpaque=_.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=w(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=_.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?w(y.selectionForeground,_.NULL_COLOR):void 0,m.selectionForeground===_.NULL_COLOR&&(m.selectionForeground=void 0),_.color.isOpaque(m.selectionBackgroundTransparent)&&(m.selectionBackgroundTransparent=_.color.opacity(m.selectionBackgroundTransparent,.3)),_.color.isOpaque(m.selectionInactiveBackgroundTransparent)&&(m.selectionInactiveBackgroundTransparent=_.color.opacity(m.selectionInactiveBackgroundTransparent,.3)),m.ansi=s.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=w(y.black,s.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=w(y.red,s.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=w(y.green,s.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=w(y.yellow,s.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=w(y.blue,s.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=w(y.magenta,s.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=w(y.cyan,s.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=w(y.white,s.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=w(y.brightBlack,s.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=w(y.brightRed,s.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=w(y.brightGreen,s.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=w(y.brightYellow,s.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=w(y.brightBlue,s.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=w(y.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=w(y.brightCyan,s.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=w(y.brightWhite,s.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let x=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let T=0;T<x;T++)m.ansi[T+16]=w(y.extendedAnsi[T],s.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(y){this._restoreColor(y),this._onChangeColors.fire(this.colors)}_restoreColor(y){if(y!==void 0)switch(y){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[y]=this._restoreColors.ansi[y]}else for(let m=0;m<this._restoreColors.ansi.length;++m)this._colors.ansi[m]=this._restoreColors.ansi[m]}modifyColors(y){y(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 w(y,m){if(y!==void 0)try{return _.css.toColor(y)}catch{}return m}s.ThemeService=C=a([f(0,p.IOptionsService)],C)},6349:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=r(8460),f=r(844);class n extends f.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new a.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new a.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new a.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(v){if(this._maxLength===v)return;let S=new Array(v);for(let p=0;p<Math.min(v,this.length);p++)S[p]=this._array[this._getCyclicIndex(p)];this._array=S,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let S=this._length;S<v;S++)this._array[S]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,S){this._array[this._getCyclicIndex(v)]=S}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,S,...p){if(S){for(let c=v;c<this._length-S;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+S)];this._length-=S,this.onDeleteEmitter.fire({index:v,amount:S})}for(let c=this._length-1;c>=v;c--)this._array[this._getCyclicIndex(c+p.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<p.length;c++)this._array[this._getCyclicIndex(v+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:v,amount:p.length}),this._length+p.length>this._maxLength){let c=this._length+p.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=p.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,S,p){if(!(S<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let d=S-1;d>=0;d--)this.set(v+d+p,this.get(v+d));let c=v+S+p-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<S;c++)this.set(v+c+p,this.get(v+c))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}s.CircularList=n},1439:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function r(a,f=5){if(typeof a!="object")return a;let n=Array.isArray(a)?[]:{};for(let _ in a)n[_]=f<=1?a[_]:a[_]&&r(a[_],f-1);return n}},8055:(h,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 r=0,a=0,f=0,n=0;var _,v,S,p,c;function d(u){let g=u.toString(16);return g.length<2?"0"+g:g}function l(u,g){return u<g?(g+.05)/(u+.05):(u+.05)/(g+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(g,C,w,y){return y!==void 0?`#${d(g)}${d(C)}${d(w)}${d(y)}`:`#${d(g)}${d(C)}${d(w)}`},u.toRgba=function(g,C,w,y=255){return(g<<24|C<<16|w<<8|y)>>>0},u.toColor=function(g,C,w,y){return{css:u.toCss(g,C,w,y),rgba:u.toRgba(g,C,w,y)}}})(_||(s.channels=_={})),(function(u){function g(C,w){return n=Math.round(255*w),[r,a,f]=c.toChannels(C.rgba),{css:_.toCss(r,a,f,n),rgba:_.toRgba(r,a,f,n)}}u.blend=function(C,w){if(n=(255&w.rgba)/255,n===1)return{css:w.css,rgba:w.rgba};let y=w.rgba>>24&255,m=w.rgba>>16&255,x=w.rgba>>8&255,T=C.rgba>>24&255,I=C.rgba>>16&255,F=C.rgba>>8&255;return r=T+Math.round((y-T)*n),a=I+Math.round((m-I)*n),f=F+Math.round((x-F)*n),{css:_.toCss(r,a,f),rgba:_.toRgba(r,a,f)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,w,y){let m=c.ensureContrastRatio(C.rgba,w.rgba,y);if(m)return _.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let w=(255|C.rgba)>>>0;return[r,a,f]=c.toChannels(w),{css:_.toCss(r,a,f),rgba:w}},u.opacity=g,u.multiplyOpacity=function(C,w){return n=255&C.rgba,g(C,n*w/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(v||(s.color=v={})),(function(u){let g,C;try{let w=document.createElement("canvas");w.width=1,w.height=1;let y=w.getContext("2d",{willReadFrequently:!0});y&&(g=y,g.globalCompositeOperation="copy",C=g.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return r=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),_.toColor(r,a,f);case 5:return r=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),n=parseInt(w.slice(4,5).repeat(2),16),_.toColor(r,a,f,n);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}let y=w.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(y)return r=parseInt(y[1]),a=parseInt(y[2]),f=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),_.toColor(r,a,f,n);if(!g||!C)throw new Error("css.toColor: Unsupported css format");if(g.fillStyle=C,g.fillStyle=w,typeof g.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(g.fillRect(0,0,1,1),[r,a,f,n]=g.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(r,a,f,n),css:w}}})(S||(s.css=S={})),(function(u){function g(C,w,y){let m=C/255,x=w/255,T=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}u.relativeLuminance=function(C){return g(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=g})(p||(s.rgb=p={})),(function(u){function g(w,y,m){let x=w>>24&255,T=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,z=y>>8&255,B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));for(;B<m&&(F>0||R>0||z>0);)F-=Math.max(0,Math.ceil(.1*F)),R-=Math.max(0,Math.ceil(.1*R)),z-=Math.max(0,Math.ceil(.1*z)),B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));return(F<<24|R<<16|z<<8|255)>>>0}function C(w,y,m){let x=w>>24&255,T=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,z=y>>8&255,B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));for(;B<m&&(F<255||R<255||z<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),R=Math.min(255,R+Math.ceil(.1*(255-R))),z=Math.min(255,z+Math.ceil(.1*(255-z))),B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));return(F<<24|R<<16|z<<8|255)>>>0}u.blend=function(w,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,x=y>>16&255,T=y>>8&255,I=w>>24&255,F=w>>16&255,R=w>>8&255;return r=I+Math.round((m-I)*n),a=F+Math.round((x-F)*n),f=R+Math.round((T-R)*n),_.toRgba(r,a,f)},u.ensureContrastRatio=function(w,y,m){let x=p.relativeLuminance(w>>8),T=p.relativeLuminance(y>>8);if(l(x,T)<m){if(T<x){let R=g(w,y,m),z=l(x,p.relativeLuminance(R>>8));if(z<m){let B=C(w,y,m);return z>l(x,p.relativeLuminance(B>>8))?R:B}return R}let I=C(w,y,m),F=l(x,p.relativeLuminance(I>>8));if(F<m){let R=g(w,y,m);return F>l(x,p.relativeLuminance(R>>8))?I:R}return I}},u.reduceLuminance=g,u.increaseLuminance=C,u.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(c||(s.rgba=c={})),s.toPaddedHex=d,s.contrastRatio=l},8969:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=r(844),f=r(2585),n=r(4348),_=r(7866),v=r(744),S=r(7302),p=r(6975),c=r(8460),d=r(1753),l=r(1480),u=r(7994),g=r(9282),C=r(5435),w=r(5981),y=r(2660),m=!1;class x extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((I=>{this._onScrollApi?.fire(I.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(I){for(let F in I)this.optionsService.options[F]=I[F]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new S.OptionsService(I)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(y.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.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((F=>{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((F=>{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 w.WriteBuffer(((F,R)=>this._inputHandler.parse(F,R)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,F){this._writeBuffer.write(I,F)}writeSync(I,F){this._logService.logLevel<=f.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(I,F)}input(I,F=!0){this.coreService.triggerDataEvent(I,F)}resize(I,F){isNaN(I)||isNaN(F)||(I=Math.max(I,v.MINIMUM_COLS),F=Math.max(F,v.MINIMUM_ROWS),this._bufferService.resize(I,F))}scroll(I,F=!1){this._bufferService.scroll(I,F)}scrollLines(I,F,R){this._bufferService.scrollLines(I,F,R)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){let F=I-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(I,F){return this._inputHandler.registerEscHandler(I,F)}registerDcsHandler(I,F){return this._inputHandler.registerDcsHandler(I,F)}registerCsiHandler(I,F){return this._inputHandler.registerCsiHandler(I,F)}registerOscHandler(I,F){return this._inputHandler.registerOscHandler(I,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?I=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let I=[];I.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,g.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of I)F.dispose()}))}}}s.CoreTerminal=x},8460:(h,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=r=>(this._listeners.push(r),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===r)return void this._listeners.splice(a,1)}}})),this._event}fire(r,a){let f=[];for(let n=0;n<this._listeners.length;n++)f.push(this._listeners[n]);for(let n=0;n<f.length;n++)f[n].call(void 0,r,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(r,a){return r((f=>a.fire(f)))},s.runAndSubscribe=function(r,a){return a(void 0),r((f=>a(f)))}},5435:function(h,s,r){var a=this&&this.__decorate||function(P,b,E,L){var M,$=arguments.length,K=$<3?b:L===null?L=Object.getOwnPropertyDescriptor(b,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(P,b,E,L);else for(var Y=P.length-1;Y>=0;Y--)(M=P[Y])&&(K=($<3?M(K):$>3?M(b,E,K):M(b,E))||K);return $>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function(P,b){return function(E,L){b(E,L,P)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let n=r(2584),_=r(7116),v=r(2015),S=r(844),p=r(482),c=r(8437),d=r(8460),l=r(643),u=r(511),g=r(3734),C=r(2585),w=r(1480),y=r(6242),m=r(6351),x=r(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function F(P,b){if(P>24)return b.setWinLines||!1;switch(P){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 R;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(s.WindowsOptionsReportType=R={}));let z=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,L,M,$,K,Y,U,A=new v.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=L,this._logService=M,this._optionsService=$,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=U,this._parser=A,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.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 D(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:N.toArray()})})),this._parser.setEscHandlerFallback((k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})})),this._parser.setExecuteHandlerFallback((k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})})),this._parser.setOscHandlerFallback(((k,N,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:N,data:H})})),this._parser.setDcsHandlerFallback(((k,N,H)=>{N==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:N,payload:H})})),this._parser.setPrintHandler(((k,N,H)=>this.print(k,N,H))),this._parser.registerCsiHandler({final:"@"},(k=>this.insertChars(k))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(k=>this.scrollLeft(k))),this._parser.registerCsiHandler({final:"A"},(k=>this.cursorUp(k))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(k=>this.scrollRight(k))),this._parser.registerCsiHandler({final:"B"},(k=>this.cursorDown(k))),this._parser.registerCsiHandler({final:"C"},(k=>this.cursorForward(k))),this._parser.registerCsiHandler({final:"D"},(k=>this.cursorBackward(k))),this._parser.registerCsiHandler({final:"E"},(k=>this.cursorNextLine(k))),this._parser.registerCsiHandler({final:"F"},(k=>this.cursorPrecedingLine(k))),this._parser.registerCsiHandler({final:"G"},(k=>this.cursorCharAbsolute(k))),this._parser.registerCsiHandler({final:"H"},(k=>this.cursorPosition(k))),this._parser.registerCsiHandler({final:"I"},(k=>this.cursorForwardTab(k))),this._parser.registerCsiHandler({final:"J"},(k=>this.eraseInDisplay(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(k=>this.eraseInDisplay(k,!0))),this._parser.registerCsiHandler({final:"K"},(k=>this.eraseInLine(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(k=>this.eraseInLine(k,!0))),this._parser.registerCsiHandler({final:"L"},(k=>this.insertLines(k))),this._parser.registerCsiHandler({final:"M"},(k=>this.deleteLines(k))),this._parser.registerCsiHandler({final:"P"},(k=>this.deleteChars(k))),this._parser.registerCsiHandler({final:"S"},(k=>this.scrollUp(k))),this._parser.registerCsiHandler({final:"T"},(k=>this.scrollDown(k))),this._parser.registerCsiHandler({final:"X"},(k=>this.eraseChars(k))),this._parser.registerCsiHandler({final:"Z"},(k=>this.cursorBackwardTab(k))),this._parser.registerCsiHandler({final:"`"},(k=>this.charPosAbsolute(k))),this._parser.registerCsiHandler({final:"a"},(k=>this.hPositionRelative(k))),this._parser.registerCsiHandler({final:"b"},(k=>this.repeatPrecedingCharacter(k))),this._parser.registerCsiHandler({final:"c"},(k=>this.sendDeviceAttributesPrimary(k))),this._parser.registerCsiHandler({prefix:">",final:"c"},(k=>this.sendDeviceAttributesSecondary(k))),this._parser.registerCsiHandler({final:"d"},(k=>this.linePosAbsolute(k))),this._parser.registerCsiHandler({final:"e"},(k=>this.vPositionRelative(k))),this._parser.registerCsiHandler({final:"f"},(k=>this.hVPosition(k))),this._parser.registerCsiHandler({final:"g"},(k=>this.tabClear(k))),this._parser.registerCsiHandler({final:"h"},(k=>this.setMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(k=>this.setModePrivate(k))),this._parser.registerCsiHandler({final:"l"},(k=>this.resetMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(k=>this.resetModePrivate(k))),this._parser.registerCsiHandler({final:"m"},(k=>this.charAttributes(k))),this._parser.registerCsiHandler({final:"n"},(k=>this.deviceStatus(k))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(k=>this.deviceStatusPrivate(k))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(k=>this.softReset(k))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(k=>this.setCursorStyle(k))),this._parser.registerCsiHandler({final:"r"},(k=>this.setScrollRegion(k))),this._parser.registerCsiHandler({final:"s"},(k=>this.saveCursor(k))),this._parser.registerCsiHandler({final:"t"},(k=>this.windowOptions(k))),this._parser.registerCsiHandler({final:"u"},(k=>this.restoreCursor(k))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(k=>this.insertColumns(k))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(k=>this.deleteColumns(k))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(k=>this.selectProtected(k))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(k=>this.requestMode(k,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(k=>this.requestMode(k,!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 y.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new y.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new y.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new y.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new y.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new y.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new y.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new y.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new y.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new y.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new y.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new y.OscHandler((k=>this.restoreCursorColor(k)))),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 k in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler(((k,N)=>this.requestStatusString(k,N))))}_preserveStack(b,E,L,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=M}_logSlowResolvingAsync(b){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,L)=>setTimeout((()=>L("#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 L,M=this._activeBuffer.x,$=this._activeBuffer.y,K=0,Y=this._parseStack.paused;if(Y){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;M=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>I&&(K=this._parseStack.position+I)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(k=>String.fromCharCode(k))).join("")}"`),typeof b=="string"?b.split("").map((k=>k.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(b.length,I))),Y||this._dirtyRowTracker.clearRange(),b.length>I)for(let k=K;k<b.length;k+=I){let N=k+I<b.length?k+I:b.length,H=typeof b=="string"?this._stringDecoder.decode(b.substring(k,N),this._parseBuffer):this._utf8Decoder.decode(b.subarray(k,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,$,H,k),this._logSlowResolvingAsync(L),L}else if(!Y){let k=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,k))return this._preserveStack(M,$,k,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===M&&this._activeBuffer.y===$||this._onCursorMove.fire();let U=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),A=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);A<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(A,this._bufferService.rows-1),Math.min(U,this._bufferService.rows-1))}print(b,E,L){let M,$,K=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,U=this._bufferService.cols,A=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,N=this._curAttrData,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let q=this._parser.precedingJoinState;for(let j=E;j<L;++j){if(M=b[j],M<127&&K){let J=K[String.fromCharCode(M)];J&&(M=J.charCodeAt(0))}let Q=this._unicodeService.charProperties(M,q);$=w.UnicodeService.extractWidth(Q);let ee=w.UnicodeService.extractShouldJoin(Q),G=ee?w.UnicodeService.extractWidth(q):0;if(q=Q,Y&&this._onA11yChar.fire((0,p.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-G>U){if(A){let J=H,Z=this._activeBuffer.x-G;for(this._activeBuffer.x=G,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),G>0&&H instanceof c.BufferLine&&H.copyCellsFrom(J,Z,0,G,!1);Z<U;)J.setCellFromCodepoint(Z++,0,1,N)}else if(this._activeBuffer.x=U-1,$===2)continue}if(ee&&this._activeBuffer.x){let J=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-J,M,$);for(let Z=$-G;--Z>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(k&&(H.insertCells(this._activeBuffer.x,$-G,this._activeBuffer.getNullCell(N)),H.getWidth(U-1)===2&&H.setCellFromCodepoint(U-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,N)),H.setCellFromCodepoint(this._activeBuffer.x++,M,$,N),$>0)for(;--$;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=q,this._activeBuffer.x<U&&L-E>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,N),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,(L=>!F(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new m.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new y.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,L,M=!1,$=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),$),M&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 3:let M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(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 L=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;E--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;E--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(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(c.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=b.params[0]||1,M=w.UnicodeService.extractWidth(E),$=this._activeBuffer.x-M,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),Y=new Uint32Array(K.length*L),U=0;for(let k=0;k<K.length;){let N=K.codePointAt(k)||0;Y[U++]=N,k+=N>65535?2:1}let A=U;for(let k=1;k<L;++k)Y.copyWithin(A,0,U),A+=U;return this.print(Y,0,A),!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 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,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.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 L=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:$}=this._coreMouseService,K=this._coreService,{buffers:Y,cols:U}=this._bufferService,{active:A,alt:k}=Y,N=this._optionsService.rawOptions,H=ee=>ee?1:2,q=b.params[0];return j=q,Q=E?q===2?4:q===4?H(K.modes.insertMode):q===12?3:q===20?H(N.convertEol):0:q===1?H(L.applicationCursorKeys):q===3?N.windowOptions.setWinLines?U===80?2:U===132?1:0:0:q===6?H(L.origin):q===7?H(L.wraparound):q===8?3:q===9?H(M==="X10"):q===12?H(N.cursorBlink):q===25?H(!K.isCursorHidden):q===45?H(L.reverseWraparound):q===66?H(L.applicationKeypad):q===67?4:q===1e3?H(M==="VT200"):q===1002?H(M==="DRAG"):q===1003?H(M==="ANY"):q===1004?H(L.sendFocus):q===1005?4:q===1006?H($==="SGR"):q===1015?4:q===1016?H($==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?H(A===k):q===2004?H(L.bracketedPasteMode):0,K.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${j};${Q}$y`),!0;var j,Q}_updateAttrColor(b,E,L,M,$){return E===2?(b|=50331648,b&=-16777216,b|=g.AttributeData.fromColorRGB([L,M,$])):E===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,E,L){let M=[0,0,-1,0,0,0],$=0,K=0;do{if(M[K+$]=b.params[E+K],b.hasSubParams(E+K)){let Y=b.getSubParams(E+K),U=0;do M[1]===5&&($=1),M[K+U+1+$]=Y[U];while(++U<Y.length&&U+K+1+$<M.length);break}if(M[1]===5&&K+$>=2||M[1]===2&&K+$>=5)break;M[1]&&($=1)}while(++K+E<b.length&&K+$<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:L.fg=this._updateAttrColor(L.fg,M[1],M[3],M[4],M[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,M[1],M[3],M[4],M[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,M[1],M[3],M[4],M[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=c.DEFAULT_ATTR_DATA.fg,b.bg=c.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,L,M=this._curAttrData;for(let $=0;$<E;$++)L=b.params[$],L>=30&&L<=37?(M.fg&=-50331904,M.fg|=16777216|L-30):L>=40&&L<=47?(M.bg&=-50331904,M.bg|=16777216|L-40):L>=90&&L<=97?(M.fg&=-50331904,M.fg|=16777224|L-90):L>=100&&L<=107?(M.bg&=-50331904,M.bg|=16777224|L-100):L===0?this._processSGR0(M):L===1?M.fg|=134217728:L===3?M.bg|=67108864:L===4?(M.fg|=268435456,this._processUnderline(b.hasSubParams($)?b.getSubParams($)[0]:1,M)):L===5?M.fg|=536870912:L===7?M.fg|=67108864:L===8?M.fg|=1073741824:L===9?M.fg|=2147483648:L===2?M.bg|=134217728:L===21?this._processUnderline(2,M):L===22?(M.fg&=-134217729,M.bg&=-134217729):L===23?M.bg&=-67108865:L===24?(M.fg&=-268435457,this._processUnderline(0,M)):L===25?M.fg&=-536870913:L===27?M.fg&=-67108865:L===28?M.fg&=-1073741825:L===29?M.fg&=2147483647:L===39?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):L===49?(M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?$+=this._extractColor(b,$,M):L===53?M.bg|=1073741824:L===55?M.bg&=-1073741825:L===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):L===100?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=c.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 L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(b){let E=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!F(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(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.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: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=[],L=b.split(";");for(;L.length>1;){let M=L.shift(),$=L.shift();if(/^\d+$/.exec(M)){let K=parseInt(M);if(O(K))if($==="?")E.push({type:0,index:K});else{let Y=(0,x.parseColor)($);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 L=b.split(":"),M,$=L.findIndex((K=>K.startsWith("id=")));return $!==-1&&(M=L[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,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 L=b.split(";");for(let M=0;M<L.length&&!(E>=this._specialColors.length);++M,++E)if(L[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let $=(0,x.parseColor)(L[M]);$&&this._onColor.fire([{type:1,index:this._specialColors[E],color:$}])}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=[],L=b.split(";");for(let M=0;M<L.length;++M)if(/^\d+$/.exec(L[M])){let $=parseInt(L[M]);O($)&&E.push({type:2,index:$})}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,_.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(T[b[0]],_.CHARSETS[b[1]]||_.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=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.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 u.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 L=this._activeBuffer.ybase+this._activeBuffer.y+E,M=this._activeBuffer.lines.get(L);M&&(M.fill(b),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let L=this._bufferService.buffer,M=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${$}${n.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}s.InputHandler=B;let D=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){P<this.start?this.start=P:P>this.end&&(this.end=P)}markRangeDirty(P,b){P>b&&(z=P,P=b,b=z),P<this.start&&(this.start=P),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function O(P){return 0<=P&&P<256}D=a([f(0,C.IBufferService)],D)},844:(h,s)=>{function r(a){for(let f of a)f.dispose();a.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 a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let f=this._disposables.indexOf(a);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(a){this._isDisposed||a===this._value||(this._value?.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},s.toDisposable=function(a){return{dispose:a}},s.disposeArray=r,s.getDisposeArrayDisposable=function(a){return{dispose:()=>r(a)}}},1505:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class r{constructor(){this._data={}}set(f,n,_){this._data[f]||(this._data[f]={}),this._data[f][n]=_}get(f,n){return this._data[f]?this._data[f][n]:void 0}clear(){this._data={}}}s.TwoKeyMap=r,s.FourKeyMap=class{constructor(){this._data=new r}set(a,f,n,_,v){this._data.get(a,f)||this._data.set(a,f,new r),this._data.get(a,f).set(n,_,v)}get(a,f,n,_){return this._data.get(a,f)?.get(n,_)}clear(){this._data.clear()}}},6114:(h,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 r=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=r.includes("Firefox"),s.isLegacyEdge=r.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(r),s.getSafariVersion=function(){if(!s.isSafari)return 0;let f=r.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),s.isIpad=a==="iPad",s.isIphone=a==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),s.isLinux=a.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(r)},6106:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let r=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(r=this._search(this._getKey(a)),this._array.splice(r,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let f=this._getKey(a);if(f===void 0||(r=this._search(f),r===-1)||this._getKey(this._array[r])!==f)return!1;do if(this._array[r]===a)return this._array.splice(r,1),!0;while(++r<this._array.length&&this._getKey(this._array[r])===f);return!1}*getKeyIterator(a){if(this._array.length!==0&&(r=this._search(a),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===a))do yield this._array[r];while(++r<this._array.length&&this._getKey(this._array[r])===a)}forEachByKey(a,f){if(this._array.length!==0&&(r=this._search(a),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===a))do f(this._array[r]);while(++r<this._array.length&&this._getKey(this._array[r])===a)}values(){return[...this._array].values()}_search(a){let f=0,n=this._array.length-1;for(;n>=f;){let _=f+n>>1,v=this._getKey(this._array[_]);if(v>a)n=_-1;else{if(!(v<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}f=_+1}}return f}}},7226:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=r(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let S=0,p=0,c=v.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),p=Math.max(S,p),d=v.timeRemaining(),1.5*p>d)return c-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-S))}ms`),void this._start();c=d}this.clear()}}class n extends f{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){let S=Date.now()+v;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}s.PriorityTaskQueue=n,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=r(643);s.updateWindowsModeWrappedState=function(f){let n=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=n?.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&_&&(v.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class r{constructor(){this.fg=0,this.bg=0,this.extended=new a}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 r;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}}s.AttributeData=r;class a{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,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=r(6349),f=r(7226),n=r(3734),_=r(8437),v=r(4634),S=r(511),p=r(643),c=r(4863),d=r(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(l,u,g){this._hasScrollback=l,this._optionsService=u,this._bufferService=g,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.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 a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,u){return new _.BufferLine(this._bufferService.cols,this.getNullCell(l),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;let u=l+this._optionsService.rawOptions.scrollback;return u>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:u}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=_.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,u){let g=this.getNullCell(_.DEFAULT_ATTR_DATA),C=0,w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<l)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(l,g);let y=0;if(this._rows<u)for(let m=this._rows;m<u;m++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(l,g)):this.ybase>0&&this.lines.length<=this.ybase+this.y+y+1?(this.ybase--,y++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(l,g)));else for(let m=this._rows;m>u;m--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){let m=this.lines.length-w;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=w}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(l,g);this._cols=l,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return l}get _isReflowEnabled(){let l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))}_reflowLarger(l,u){let g=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(g.length>0){let C=(0,v.reflowLargerCreateNewLayout)(this.lines,g);(0,v.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(l,u,C.countRemoved)}}_reflowLargerAdjustViewport(l,u,g){let C=this.getNullCell(_.DEFAULT_ATTR_DATA),w=g;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new _.BufferLine(l,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)}_reflowSmaller(l,u){let g=this.getNullCell(_.DEFAULT_ATTR_DATA),C=[],w=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=l)continue;let x=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),x.unshift(m);let T=this.ybase+this.y;if(T>=y&&T<y+x.length)continue;let I=x[x.length-1].getTrimmedLength(),F=(0,v.reflowSmallerGetNewLineLengths)(x,this._cols,l),R=F.length-x.length,z;z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+R):Math.max(0,this.lines.length-this.lines.maxLength+R);let B=[];for(let L=0;L<R;L++){let M=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(M)}B.length>0&&(C.push({start:y+x.length+w,newLines:B}),w+=B.length),x.push(...B);let D=F.length-1,O=F[D];O===0&&(D--,O=F[D]);let P=x.length-R-1,b=I;for(;P>=0;){let L=Math.min(b,O);if(x[D]===void 0)break;if(x[D].copyCellsFrom(x[P],b-L,O-L,L,!0),O-=L,O===0&&(D--,O=F[D]),b-=L,b===0){P--;let M=Math.max(P,0);b=(0,v.getWrappedLineTrimmedLength)(x,M,this._cols)}}for(let L=0;L<x.length;L++)F[L]<l&&x[L].setCell(F[L],g);let E=R-z;for(;E-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+R,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let D=0;D<this.lines.length;D++)m.push(this.lines.get(D));let x=this.lines.length,T=x-1,I=0,F=C[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let R=0;for(let D=Math.min(this.lines.maxLength-1,x+w-1);D>=0;D--)if(F&&F.start>T+R){for(let O=F.newLines.length-1;O>=0;O--)this.lines.set(D--,F.newLines[O]);D++,y.push({index:T+1,amount:F.newLines.length}),R+=F.newLines.length,F=C[++I]}else this.lines.set(D,m[T--]);let z=0;for(let D=y.length-1;D>=0;D--)y[D].index+=z,this.lines.onInsertEmitter.fire(y[D]),z+=y[D].amount;let B=Math.max(0,x+w-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(l,u,g=0,C){let w=this.lines.get(l);return w?w.translateToString(u,g,C):""}getWrappedRangeForLine(l){let u=l,g=l;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:u,last:g}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===l&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){let u=new c.Marker(l);return this.markers.push(u),u.register(this.lines.onTrim((g=>{u.line-=g,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((g=>{u.line>=g.index&&(u.line+=g.amount)}))),u.register(this.lines.onDelete((g=>{u.line>=g.index&&u.line<g.index+g.amount&&u.dispose(),u.line>g.index&&(u.line-=g.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=r(3734),f=r(511),n=r(643),_=r(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let v=0;class S{constructor(c,d,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let u=d||f.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let g=0;g<c;++g)this.setCell(g,u);this.length=c}get(c){let d=this._data[3*c+0],l=2097151&d;return[this._data[3*c+1],2097152&d?this._combined[c]:l?(0,_.stringFromCodePoint)(l):"",d>>22,2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):l]}set(c,d){this._data[3*c+1]=d[n.CHAR_DATA_ATTR_INDEX],d[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=d[1],this._data[3*c+0]=2097152|c|d[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=d[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&d}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c]:2097151&d?(0,_.stringFromCodePoint)(2097151&d):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,d){return v=3*c,d.content=this._data[v+0],d.fg=this._data[v+1],d.bg=this._data[v+2],2097152&d.content&&(d.combinedData=this._combined[c]),268435456&d.bg&&(d.extended=this._extendedAttrs[c]),d}setCell(c,d){2097152&d.content&&(this._combined[c]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[c]=d.extended),this._data[3*c+0]=d.content,this._data[3*c+1]=d.fg,this._data[3*c+2]=d.bg}setCellFromCodepoint(c,d,l,u){268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=d|l<<22,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}addCodepointToCell(c,d,l){let u=this._data[3*c+0];2097152&u?this._combined[c]+=(0,_.stringFromCodePoint)(d):2097151&u?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&u)+(0,_.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,l&&(u&=-12582913,u|=l<<22),this._data[3*c+0]=u}insertCells(c,d,l){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length-c){let u=new f.CellData;for(let g=this.length-c-d-1;g>=0;--g)this.setCell(c+d+g,this.loadCell(c+g,u));for(let g=0;g<d;++g)this.setCell(c+g,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(c,d,l){if(c%=this.length,d<this.length-c){let u=new f.CellData;for(let g=0;g<this.length-c-d;++g)this.setCell(c+g,this.loadCell(c+d+g,u));for(let g=this.length-d;g<this.length;++g)this.setCell(g,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,l)}replaceCells(c,d,l,u=!1){if(u)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.isProtected(c)||this.setCell(c,l),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.setCell(c++,l)}resize(c,d){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let l=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{let u=new Uint32Array(l);u.set(this._data),this._data=u}for(let u=this.length;u<c;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,l);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let w=parseInt(u[C],10);w>=c&&delete this._combined[w]}let g=Object.keys(this._extendedAttrs);for(let C=0;C<g.length;C++){let w=parseInt(g[C],10);w>=c&&delete this._extendedAttrs[w]}}return this.length=c,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,d=!1){if(d)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,c);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(let d in c._combined)this._combined[d]=c._combined[d];this._extendedAttrs={};for(let d in c._extendedAttrs)this._extendedAttrs[d]=c._extendedAttrs[d];this.isWrapped=c.isWrapped}clone(){let c=new S(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let d in this._combined)c._combined[d]=this._combined[d];for(let d in this._extendedAttrs)c._extendedAttrs[d]=this._extendedAttrs[d];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,d,l,u,g){let C=c._data;if(g)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}let w=Object.keys(c._combined);for(let y=0;y<w.length;y++){let m=parseInt(w[y],10);m>=d&&(this._combined[m-d+l]=c._combined[m])}}translateToString(c,d,l,u){d=d??0,l=l??this.length,c&&(l=Math.min(l,this.getTrimmedLength())),u&&(u.length=0);let g="";for(;d<l;){let C=this._data[3*d+0],w=2097151&C,y=2097152&C?this._combined[d]:w?(0,_.stringFromCodePoint)(w):n.WHITESPACE_CELL_CHAR;if(g+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),g}}s.BufferLine=S},4841:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(r,a){if(r.start.y>r.end.y)throw new Error(`Buffer range end (${r.end.x}, ${r.end.y}) cannot be before start (${r.start.x}, ${r.start.y})`);return a*(r.end.y-r.start.y)+(r.end.x-r.start.x+1)}},4634:(h,s)=>{function r(a,f,n){if(f===a.length-1)return a[f].getTrimmedLength();let _=!a[f].hasContent(n-1)&&a[f].getWidth(n-1)===1,v=a[f+1].getWidth(0)===2;return _&&v?n-1:n}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,f,n,_,v){let S=[];for(let p=0;p<a.length-1;p++){let c=p,d=a.get(++c);if(!d.isWrapped)continue;let l=[a.get(p)];for(;c<a.length&&d.isWrapped;)l.push(d),d=a.get(++c);if(_>=p&&_<c){p+=l.length-1;continue}let u=0,g=r(l,u,f),C=1,w=0;for(;C<l.length;){let m=r(l,C,f),x=m-w,T=n-g,I=Math.min(x,T);l[u].copyCellsFrom(l[C],w,g,I,!1),g+=I,g===n&&(u++,g=0),w+=I,w===m&&(C++,w=0),g===0&&u!==0&&l[u-1].getWidth(n-1)===2&&(l[u].copyCellsFrom(l[u-1],n-1,g++,1,!1),l[u-1].setCell(n-1,v))}l[u].replaceCells(g,n,v);let y=0;for(let m=l.length-1;m>0&&(m>u||l[m].getTrimmedLength()===0);m--)y++;y>0&&(S.push(p+l.length-y),S.push(y)),p+=l.length-1}return S},s.reflowLargerCreateNewLayout=function(a,f){let n=[],_=0,v=f[_],S=0;for(let p=0;p<a.length;p++)if(v===p){let c=f[++_];a.onDeleteEmitter.fire({index:p-S,amount:c}),p+=c-1,S+=c,v=f[++_]}else n.push(p);return{layout:n,countRemoved:S}},s.reflowLargerApplyNewLayout=function(a,f){let n=[];for(let _=0;_<f.length;_++)n.push(a.get(f[_]));for(let _=0;_<n.length;_++)a.set(_,n[_]);a.length=f.length},s.reflowSmallerGetNewLineLengths=function(a,f,n){let _=[],v=a.map(((d,l)=>r(a,l,f))).reduce(((d,l)=>d+l)),S=0,p=0,c=0;for(;c<v;){if(v-c<n){_.push(v-c);break}S+=n;let d=r(a,p,f);S>d&&(S-=d,p++);let l=a[p].getWidth(S-1)===2;l&&S--;let u=l?n-1:n;_.push(u),c+=u}return _},s.getWrappedLineTrimmedLength=r},5295:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=r(8460),f=r(844),n=r(9092);class _ extends f.Disposable{constructor(S,p){super(),this._optionsService=S,this._bufferService=p,this._onBufferActivate=this.register(new a.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,p){this._normal.resize(S,p),this._alt.resize(S,p),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}s.BufferSet=_},511:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=r(482),f=r(643),n=r(3734);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let p=new _;return p.setFromCharData(S),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){let c=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let d=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(c-55296)+d-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=_},643:(h,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:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=r(8460),f=r(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new a.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(v){return this._disposables.push(v),v}}s.Marker=n,n._nextId=1},7116:(h,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:(h,s)=>{var r,a,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.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=`
|
|
8
|
-
`,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"})(r||(s.C0=r={})),(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"})(a||(s.C1=a={})),(function(n){n.ST=`${r.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=r(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(n,_,v,S){let p={type:0,cancel:!1,key:void 0},c=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=n.ctrlKey?"\b":a.C0.DEL,n.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(n.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=n.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,n.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(v?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(v?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",v||p.key!==a.C0.ESC+"[1;3A"||(p.key=a.C0.ESC+"[1;5A")):p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",v||p.key!==a.C0.ESC+"[1;3B"||(p.key=a.C0.ESC+"[1;5B")):p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(p.key=a.C0.ESC+"[2~");break;case 46:p.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:p.key=c?a.C0.ESC+"[1;"+(c+1)+"H":_?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:p.key=c?a.C0.ESC+"[1;"+(c+1)+"F":_?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:n.shiftKey?p.type=2:n.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:n.shiftKey?p.type=3:n.ctrlKey?p.key=a.C0.ESC+"[6;"+(c+1)+"~":p.key=a.C0.ESC+"[6~";break;case 112:p.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:p.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:p.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:p.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:p.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:p.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:p.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:p.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:p.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:p.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:p.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:p.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!S||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?p.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(p.key=a.C0.US),n.key==="@"&&(p.key=a.C0.NUL)):n.keyCode===65&&(p.type=1);else{let d=f[n.keyCode],l=d?.[n.shiftKey?1:0];if(l)p.key=a.C0.ESC+l;else if(n.keyCode>=65&&n.keyCode<=90){let u=n.ctrlKey?n.keyCode-64:n.keyCode+32,g=String.fromCharCode(u);n.shiftKey&&(g=g.toUpperCase()),p.key=a.C0.ESC+g}else if(n.keyCode===32)p.key=a.C0.ESC+(n.ctrlKey?a.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let u=n.code.slice(3,4);n.shiftKey||(u=u.toLowerCase()),p.key=a.C0.ESC+u,p.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?p.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?p.key=a.C0.NUL:n.keyCode>=51&&n.keyCode<=55?p.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?p.key=a.C0.DEL:n.keyCode===219?p.key=a.C0.ESC:n.keyCode===220?p.key=a.C0.FS:n.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(r){return r>65535?(r-=65536,String.fromCharCode(55296+(r>>10))+String.fromCharCode(r%1024+56320)):String.fromCharCode(r)},s.utf32ToString=function(r,a=0,f=r.length){let n="";for(let _=a;_<f;++_){let v=r[_];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(r,a){let f=r.length;if(!f)return 0;let n=0,_=0;if(this._interim){let v=r.charCodeAt(_++);56320<=v&&v<=57343?a[n++]=1024*(this._interim-55296)+v-56320+65536:(a[n++]=this._interim,a[n++]=v),this._interim=0}for(let v=_;v<f;++v){let S=r.charCodeAt(v);if(55296<=S&&S<=56319){if(++v>=f)return this._interim=S,n;let p=r.charCodeAt(v);56320<=p&&p<=57343?a[n++]=1024*(S-55296)+p-56320+65536:(a[n++]=S,a[n++]=p)}else S!==65279&&(a[n++]=S)}return n}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(r,a){let f=r.length;if(!f)return 0;let n,_,v,S,p=0,c=0,d=0;if(this.interim[0]){let g=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,y=0;for(;(w=63&this.interim[++y])&&y<4;)C<<=6,C|=w;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=m-y;for(;d<x;){if(d>=f)return 0;if(w=r[d++],(192&w)!=128){d--,g=!0;break}this.interim[y++]=w,C<<=6,C|=63&w}g||(m===2?C<128?d--:a[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(a[p++]=C):C<65536||C>1114111||(a[p++]=C)),this.interim.fill(0)}let l=f-4,u=d;for(;u<f;){for(;!(!(u<l)||128&(n=r[u])||128&(_=r[u+1])||128&(v=r[u+2])||128&(S=r[u+3]));)a[p++]=n,a[p++]=_,a[p++]=v,a[p++]=S,u+=4;if(n=r[u++],n<128)a[p++]=n;else if((224&n)==192){if(u>=f)return this.interim[0]=n,p;if(_=r[u++],(192&_)!=128){u--;continue}if(c=(31&n)<<6|63&_,c<128){u--;continue}a[p++]=c}else if((240&n)==224){if(u>=f)return this.interim[0]=n,p;if(_=r[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,p;if(v=r[u++],(192&v)!=128){u--;continue}if(c=(15&n)<<12|(63&_)<<6|63&v,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&n)==240){if(u>=f)return this.interim[0]=n,p;if(_=r[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,p;if(v=r[u++],(192&v)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=v,p;if(S=r[u++],(192&S)!=128){u--;continue}if(c=(7&n)<<18|(63&_)<<12|(63&v)<<6|63&S,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=r(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]],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]],_;s.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;v<f.length;++v)_.fill(0,f[v][0],f[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?_[v]:(function(S,p){let c,d=0,l=p.length-1;if(S<p[0][0]||S>p[l][1])return!1;for(;l>=d;)if(c=d+l>>1,S>p[c][1])d=c+1;else{if(!(S<p[c][0]))return!0;l=c-1}return!1})(v,n)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,S){let p=this.wcwidth(v),c=p===0&&S!==0;if(c){let d=a.UnicodeService.extractWidth(S);d===0?c=!1:d>p&&(p=d)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=r(8460),f=r(844);class n extends f.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,S){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(S)}_innerWrite(v=0,S=!0){let p=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],d=this._action(c,S);if(d){let u=g=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,g))):this._innerWrite(p,g);return void d.catch((g=>(queueMicrotask((()=>{throw g})),Promise.resolve(!1)))).then(u)}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=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=n},5941:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let r=/^([\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})$/,a=/^[\da-f]+$/;function f(n,_){let v=n.toString(16),S=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}s.parseColor=function(n){if(!n)return;let _=n.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let v=r.exec(_);if(v){let S=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/S*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/S*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/S*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let v=_.length/3,S=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(v*p,v*p+v),16);S[p]=v===1?c<<4:v===2?c:v===3?c>>4:c>>8}return S}},s.toRgbString=function(n,_=16){let[v,S,p]=n;return`rgb:${f(v,_)}/${f(S,_)}/${f(p,_)}`}},5770:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=r(482),f=r(8742),n=r(5770),_=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(S,p){this._handlers[S]===void 0&&(this._handlers[S]=[]);let c=this._handlers[S];return c.push(p),{dispose:()=>{let d=c.indexOf(p);d!==-1&&c.splice(d,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(S,p){if(this.reset(),this._ident=S,this._active=this._handlers[S]||_,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(S,p,c){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(S,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(S,p,c))}unhook(S,p=!0){if(this._active.length){let c=!1,d=this._active.length-1,l=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,c=p,l=this._stack.fallThrough,this._stack.paused=!1),!l&&c===!1){for(;d>=0&&(c=this._active[d].unhook(S),c!==!0);d--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,c;d--}for(;d>=0;d--)if(c=this._active[d].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",S);this._active=_,this._ident=0}};let v=new f.Params;v.addParam(0),s.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=v,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():v,this._data="",this._hitLimit=!1}put(S,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(S,p,c),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let p=!1;if(this._hitLimit)p=!1;else if(S&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=v,this._data="",this._hitLimit=!1,c)));return this._params=v,this._data="",this._hitLimit=!1,p}}},2015:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=r(844),f=r(8742),n=r(6242),_=r(6351);class v{constructor(d){this.table=new Uint8Array(d)}setDefault(d,l){this.table.fill(d<<4|l)}add(d,l,u,g){this.table[l<<8|d]=u<<4|g}addMany(d,l,u,g){for(let C=0;C<d.length;C++)this.table[l<<8|d[C]]=u<<4|g}}s.TransitionTable=v;let S=160;s.VT500_TRANSITION_TABLE=(function(){let c=new v(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),l=(y,m)=>d.slice(y,m),u=l(32,127),g=l(0,24);g.push(25),g.push.apply(g,l(28,32));let C=l(0,14),w;for(w in c.setDefault(1,0),c.addMany(u,0,2,0),C)c.addMany([24,26,153,154],w,3,0),c.addMany(l(128,144),w,3,0),c.addMany(l(144,152),w,3,0),c.add(156,w,0,0),c.add(27,w,11,1),c.add(157,w,4,8),c.addMany([152,158,159],w,0,7),c.add(155,w,11,3),c.add(144,w,11,9);return c.addMany(g,0,3,0),c.addMany(g,1,3,1),c.add(127,1,0,1),c.addMany(g,8,0,8),c.addMany(g,3,3,3),c.add(127,3,0,3),c.addMany(g,4,3,4),c.add(127,4,0,4),c.addMany(g,6,3,6),c.addMany(g,5,3,5),c.add(127,5,0,5),c.addMany(g,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(u,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(l(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(u,7,0,7),c.addMany(g,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(l(64,127),3,7,0),c.addMany(l(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(l(48,60),4,8,4),c.addMany(l(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(l(32,64),6,0,6),c.add(127,6,0,6),c.addMany(l(64,127),6,0,0),c.addMany(l(32,48),3,9,5),c.addMany(l(32,48),5,9,5),c.addMany(l(48,64),5,0,6),c.addMany(l(64,127),5,7,0),c.addMany(l(32,48),4,9,5),c.addMany(l(32,48),1,9,2),c.addMany(l(32,48),2,9,2),c.addMany(l(48,127),2,10,0),c.addMany(l(48,80),1,10,0),c.addMany(l(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(l(96,127),1,10,0),c.add(80,1,11,9),c.addMany(g,9,0,9),c.add(127,9,0,9),c.addMany(l(28,32),9,0,9),c.addMany(l(32,48),9,9,12),c.addMany(l(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(g,11,0,11),c.addMany(l(32,128),11,0,11),c.addMany(l(28,32),11,0,11),c.addMany(g,10,0,10),c.add(127,10,0,10),c.addMany(l(28,32),10,0,10),c.addMany(l(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(l(32,48),10,9,12),c.addMany(g,12,0,12),c.add(127,12,0,12),c.addMany(l(28,32),12,0,12),c.addMany(l(32,48),12,9,12),c.addMany(l(48,64),12,0,11),c.addMany(l(64,127),12,12,13),c.addMany(l(64,127),10,12,13),c.addMany(l(64,127),9,12,13),c.addMany(g,13,13,13),c.addMany(u,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(S,0,2,0),c.add(S,8,5,8),c.add(S,6,0,6),c.add(S,11,0,11),c.add(S,13,13,13),c})();class p extends a.Disposable{constructor(d=s.VT500_TRANSITION_TABLE){super(),this._transitions=d,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=(l,u,g)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,u)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,a.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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,l=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<d.intermediates.length;++C){let w=d.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");let g=d.final.charCodeAt(0);if(l[0]>g||g>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return u<<=8,u|=g,u}identToString(d){let l=[];for(;d;)l.push(String.fromCharCode(255&d)),d>>=8;return l.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,l){let u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let g=this._escHandlers[u];return g.push(l),{dispose:()=>{let C=g.indexOf(l);C!==-1&&g.splice(C,1)}}}clearEscHandler(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,l){this._executeHandlers[d.charCodeAt(0)]=l}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,l){let u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let g=this._csiHandlers[u];return g.push(l),{dispose:()=>{let C=g.indexOf(l);C!==-1&&g.splice(C,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,l){return this._dcsParser.registerHandler(this._identifier(d),l)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,l){return this._oscParser.registerHandler(d,l)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}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(d,l,u,g,C){this._parseStack.state=d,this._parseStack.handlers=l,this._parseStack.handlerPos=u,this._parseStack.transition=g,this._parseStack.chunkPos=C}parse(d,l,u){let g,C=0,w=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let m=this._parseStack.handlers,x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&x>-1){for(;x>=0&&(g=m[x](this._params),g!==!0);x--)if(g instanceof Promise)return this._parseStack.handlerPos=x,g}this._parseStack.handlers=[];break;case 4:if(u===!1&&x>-1){for(;x>=0&&(g=m[x](),g!==!0);x--)if(g instanceof Promise)return this._parseStack.handlerPos=x,g}this._parseStack.handlers=[];break;case 6:if(C=d[this._parseStack.chunkPos],g=this._dcsParser.unhook(C!==24&&C!==26,u),g)return g;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=d[this._parseStack.chunkPos],g=this._oscParser.end(C!==24&&C!==26,u),g)return g;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let m=y;m<l;++m){switch(C=d[m],w=this._transitions.table[this.currentState<<8|(C<160?C:S)],w>>4){case 2:for(let R=m+1;;++R){if(R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:m,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let x=this._csiHandlers[this._collect<<8|C],T=x?x.length-1:-1;for(;T>=0&&(g=x[T](this._params),g!==!0);T--)if(g instanceof Promise)return this._preserveStack(3,x,T,w,m),g;T<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++m<l&&(C=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let I=this._escHandlers[this._collect<<8|C],F=I?I.length-1:-1;for(;F>=0&&(g=I[F](),g!==!0);F--)if(g instanceof Promise)return this._preserveStack(4,I,F,w,m),g;F<0&&this._escHandlerFb(this._collect<<8|C),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|C,this._params);break;case 13:for(let R=m+1;;++R)if(R>=l||(C=d[R])===24||C===26||C===27||C>127&&C<S){this._dcsParser.put(d,m,R),m=R-1;break}break;case 14:if(g=this._dcsParser.unhook(C!==24&&C!==26),g)return this._preserveStack(6,[],0,w,m),g;C===27&&(w|=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 R=m+1;;R++)if(R>=l||(C=d[R])<32||C>127&&C<S){this._oscParser.put(d,m,R),m=R-1;break}break;case 6:if(g=this._oscParser.end(C!==24&&C!==26),g)return this._preserveStack(5,[],0,w,m),g;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}s.EscapeSequenceParser=p},6242:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=r(5770),f=r(482),n=[];s.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(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);let S=this._handlers[_];return S.push(v),{dispose:()=>{let p=S.indexOf(v);p!==-1&&S.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].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 _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,S){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,v,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,v,S))}start(){this.reset(),this._state=1}put(_,v,S){if(this._state!==3){if(this._state===1)for(;v<S;){let p=_[v++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&S-v>0&&this._put(_,v,S)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,S=v,c=this._stack.fallThrough,this._stack.paused=!1),!c&&S===!1){for(;p>=0&&(S=this._active[p].end(_),S!==!0);p--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,S;p--}for(;p>=0;p--)if(S=this._active[p].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",_);this._active=n,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,v,S),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,v}}},8742:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let r=2147483647;class a{static fromArray(n){let _=new a;if(!n.length)return _;for(let v=Array.isArray(n[0])?1:0;v<n.length;++v){let S=n[v];if(Array.isArray(S))for(let p=0;p<S.length;++p)_.addSubParam(S[p]);else _.addParam(S)}return _}constructor(n=32,_=32){if(this.maxLength=n,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let n=new a(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 _=0;_<this.length;++_){n.push(this.params[_]);let v=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,S))}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>r?r: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>r?r:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let _=this._subParamsIdx[n]>>8,v=255&this._subParamsIdx[n];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){let n={};for(let _=0;_<this.length;++_){let v=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-v>0&&(n[_]=this._subParams.slice(v,S))}return n}addDigit(n){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let v=this._digitIsSub?this._subParams:this.params,S=v[_-1];v[_-1]=~S?Math.min(10*S+n,r):n}}s.Params=a},5741:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let r=this._addons.length-1;r>=0;r--)this._addons[r].instance.dispose()}loadAddon(r,a){let f={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(f),a.dispose=()=>this._wrappedAddonDispose(f),a.activate(r)}_wrappedAddonDispose(r){if(r.isDisposed)return;let a=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===r){a=f;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");r.isDisposed=!0,r.dispose.apply(r.instance),this._addons.splice(a,1)}}},8771:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=r(3785),f=r(511);s.BufferApiView=class{constructor(n,_){this._buffer=n,this.type=_}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 _=this._buffer.lines.get(n);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=r(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,n){if(!(f<0||f>=this._line.length))return n?(this._line.loadCell(f,n),n):this._line.loadCell(f,new a.CellData)}translateToString(f,n,_){return this._line.translateToString(f,n,_)}}},8285:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=r(8771),f=r(8460),n=r(844);class _ extends n.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new a.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new a.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=_},7975:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(r){this._core=r}registerCsiHandler(r,a){return this._core.registerCsiHandler(r,(f=>a(f.toArray())))}addCsiHandler(r,a){return this.registerCsiHandler(r,a)}registerDcsHandler(r,a){return this._core.registerDcsHandler(r,((f,n)=>a(f,n.toArray())))}addDcsHandler(r,a){return this.registerDcsHandler(r,a)}registerEscHandler(r,a){return this._core.registerEscHandler(r,a)}addEscHandler(r,a){return this.registerEscHandler(r,a)}registerOscHandler(r,a){return this._core.registerOscHandler(r,a)}addOscHandler(r,a){return this.registerOscHandler(r,a)}}},7090:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(r){this._core=r}register(r){this._core.unicodeService.register(r)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(r){this._core.unicodeService.activeVersion=r}}},744:function(h,s,r){var a=this&&this.__decorate||function(c,d,l,u){var g,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(g=c[y])&&(w=(C<3?g(w):C>3?g(d,l,w):g(d,l))||w);return C>3&&w&&Object.defineProperty(d,l,w),w},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let n=r(8460),_=r(844),v=r(5295),S=r(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let p=s.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(c){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(c.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(c,this))}resize(c,d){this.cols=c,this.rows=d,this.buffers.resize(c,d),this._onResize.fire({cols:c,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,d=!1){let l=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===c.fg&&u.getBg(0)===c.bg||(u=l.getBlankLine(c,d),this._cachedBlankLine=u),u.isWrapped=d;let g=l.ybase+l.scrollTop,C=l.ybase+l.scrollBottom;if(l.scrollTop===0){let w=l.lines.isFull;C===l.lines.length-1?w?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(C+1,0,u.clone()),w?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{let w=C-g+1;l.lines.shiftElements(g+1,w-1,-1),l.lines.set(C,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(c,d,l){let u=this.buffer;if(c<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else c+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let g=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+c,u.ybase),0),g!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};s.BufferService=p=a([f(0,S.IOptionsService)],p)},7994:(h,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(r){this.glevel=r,this.charset=this._charsets[r]}setgCharset(r,a){this._charsets[r]=a,this.glevel===r&&(this.charset=a)}}},1753:function(h,s,r){var a=this&&this.__decorate||function(u,g,C,w){var y,m=arguments.length,x=m<3?g:w===null?w=Object.getOwnPropertyDescriptor(g,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,g,C,w);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(g,C,x):y(g,C))||x);return m>3&&x&&Object.defineProperty(g,C,x),x},f=this&&this.__param||function(u,g){return function(C,w){g(C,w,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let n=r(2585),_=r(8460),v=r(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,g){let C=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(C|=64,C|=u.action):(C|=3&u.button,4&u.button&&(C|=64),8&u.button&&(C|=128),u.action===32?C|=32:u.action!==0||g||(C|=3)),C}let c=String.fromCharCode,d={DEFAULT:u=>{let g=[p(u,!1)+32,u.col+32,u.row+32];return g[0]>255||g[1]>255||g[2]>255?"":`\x1B[M${c(g[0])}${c(g[1])}${c(g[2])}`},SGR:u=>{let g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${g}`},SGR_PIXELS:u=>{let g=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${g}`}},l=s.CoreMouseService=class extends v.Disposable{constructor(u,g){super(),this._bufferService=u,this._coreService=g,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(S))this.addProtocol(C,S[C]);for(let C of Object.keys(d))this.addEncoding(C,d[C]);this.reset()}addProtocol(u,g){this._protocols[u]=g}addEncoding(u,g){this._encodings[u]=g}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;let g=this._encodings[this._activeEncoding](u);return g&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(g):this._coreService.triggerDataEvent(g,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,g,C){if(C){if(u.x!==g.x||u.y!==g.y)return!1}else if(u.col!==g.col||u.row!==g.row)return!1;return u.button===g.button&&u.action===g.action&&u.ctrl===g.ctrl&&u.alt===g.alt&&u.shift===g.shift}};s.CoreMouseService=l=a([f(0,n.IBufferService),f(1,n.ICoreService)],l)},6975:function(h,s,r){var a=this&&this.__decorate||function(l,u,g,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,g):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,g,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,g,m):w(u,g))||m);return y>3&&m&&Object.defineProperty(u,g,m),m},f=this&&this.__param||function(l,u){return function(g,C){u(g,C,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let n=r(1439),_=r(8460),v=r(844),S=r(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=s.CoreService=class extends v.Disposable{constructor(l,u,g){super(),this._bufferService=l,this._logService=u,this._optionsService=g,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}reset(){this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}triggerDataEvent(l,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let g=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&g.ybase!==g.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(l))}};s.CoreService=d=a([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],d)},9074:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=r(8055),f=r(8460),n=r(844),_=r(6106),v=0,S=0;class p extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((l=>l?.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,n.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;let u=new c(l);if(u){let g=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),g.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,u,g){let C=0,w=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,w=C+(y.options.width??1),l>=C&&l<w&&(!g||(y.options.layer??"bottom")===g)&&(yield y)}forEachDecorationAtCell(l,u,g,C){this._decorations.forEachByKey(u,(w=>{v=w.options.x??0,S=v+(w.options.width??1),l>=v&&l<S&&(!g||(w.options.layer??"bottom")===g)&&C(w)}))}}s.DecorationService=p;class c extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=a.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=a.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,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=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=r(2585),f=r(8343);class n{constructor(...v){this._entries=new Map;for(let[S,p]of v)this.set(S,p)}set(v,S){let p=this._entries.get(v);return this._entries.set(v,S),p}forEach(v){for(let[S,p]of this._entries.entries())v(S,p)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}s.ServiceCollection=n,s.InstantiationService=class{constructor(){this._services=new n,this._services.set(a.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){let S=(0,f.getServiceDependencies)(_).sort(((d,l)=>d.index-l.index)),p=[];for(let d of S){let l=this._services.get(d.id);if(!l)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${d.id}.`);p.push(l)}let c=S.length>0?S[0].index:v.length;if(v.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${v.length} static arguments`);return new _(...v,...p)}}},7866:function(h,s,r){var a=this&&this.__decorate||function(c,d,l,u){var g,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(g=c[y])&&(w=(C<3?g(w):C>3?g(d,l,w):g(d,l))||w);return C>3&&w&&Object.defineProperty(d,l,w),w},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let n=r(844),_=r(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},S,p=s.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let d=0;d<c.length;d++)typeof c[d]=="function"&&(c[d]=c[d]())}_log(c,d,l){this._evalLazyOptionalParams(l),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...l)}trace(c,...d){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,d)}debug(c,...d){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,d)}info(c,...d){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,d)}warn(c,...d){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,d)}error(c,...d){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,d)}};s.LogService=p=a([f(0,_.IOptionsService)],p),s.setTraceLogger=function(c){S=c},s.traceCall=function(c,d,l){if(typeof l.value!="function")throw new Error("not supported");let u=l.value;l.value=function(...g){if(S.logLevel!==_.LogLevelEnum.TRACE)return u.apply(this,g);S.trace(`GlyphRenderer#${u.name}(${g.map((w=>JSON.stringify(w))).join(", ")})`);let C=u.apply(this,g);return S.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=r(8460),f=r(844),n=r(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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends f.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let d in p)if(d in c)try{let l=p[d];c[d]=this._sanitizeAndValidateOption(d,l)}catch(l){console.error(l)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((d=>{d===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((d=>{p.indexOf(d)!==-1&&c()}))}_setupOptions(){let p=d=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},c=(d,l)=>{if(!(d in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);l=this._sanitizeAndValidateOption(d,l),this.rawOptions[d]!==l&&(this.rawOptions[d]=l,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let l={get:p.bind(this,d),set:c.bind(this,d)};Object.defineProperty(this.options,d,l)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[p]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=_.includes(c)?c:s.DEFAULT_OPTIONS[p];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${p} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${p} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}s.OptionsService=v},2660:function(h,s,r){var a=this&&this.__decorate||function(v,S,p,c){var d,l=arguments.length,u=l<3?S:c===null?c=Object.getOwnPropertyDescriptor(S,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(v,S,p,c);else for(var g=v.length-1;g>=0;g--)(d=v[g])&&(u=(l<3?d(u):l>3?d(S,p,u):d(S,p))||u);return l>3&&u&&Object.defineProperty(S,p,u),u},f=this&&this.__param||function(v,S){return function(p,c){S(p,c,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let n=r(2585),_=s.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){let S=this._bufferService.buffer;if(v.id===void 0){let g=S.addMarker(S.ybase+S.y),C={data:v,id:this._nextId++,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(C,g))),this._dataByLinkId.set(C.id,C),C.id}let p=v,c=this._getEntryIdKey(p),d=this._entriesWithId.get(c);if(d)return this.addLineToLink(d.id,S.ybase+S.y),d.id;let l=S.addMarker(S.ybase+S.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(v,S){let p=this._dataByLinkId.get(v);if(p&&p.lines.every((c=>c.line!==S))){let c=this._bufferService.buffer.addMarker(S);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,S){let p=v.lines.indexOf(S);p!==-1&&(v.lines.splice(p,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};s.OscLinkService=_=a([f(0,n.IBufferService)],_)},8343:(h,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let r="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[a]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);let n=function(_,v,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,d){c[r]===c?c[a].push({id:p,index:d}):(c[a]=[{id:p,index:d}],c[r]=c)})(n,_,S)};return n.toString=()=>f,s.serviceRegistry.set(f,n),n}},2585:(h,s,r)=>{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 a=r(8343);var f;s.IBufferService=(0,a.createDecorator)("BufferService"),s.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),s.ICoreService=(0,a.createDecorator)("CoreService"),s.ICharsetService=(0,a.createDecorator)("CharsetService"),s.IInstantiationService=(0,a.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"})(f||(s.LogLevelEnum=f={})),s.ILogService=(0,a.createDecorator)("LogService"),s.IOptionsService=(0,a.createDecorator)("OptionsService"),s.IOscLinkService=(0,a.createDecorator)("OscLinkService"),s.IUnicodeService=(0,a.createDecorator)("UnicodeService"),s.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(h,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=r(8460),f=r(225);class n{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,S,p=!1){return(16777215&v)<<3|(3&S)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let S=0,p=0,c=v.length;for(let d=0;d<c;++d){let l=v.charCodeAt(d);if(55296<=l&&l<=56319){if(++d>=c)return S+this.wcwidth(l);let C=v.charCodeAt(d);56320<=C&&C<=57343?l=1024*(l-55296)+C-56320+65536:S+=this.wcwidth(C)}let u=this.charProperties(l,p),g=n.extractWidth(u);n.extractShouldJoin(u)&&(g-=n.extractWidth(p)),S+=g,p=u}return S}charProperties(v,S){return this._activeProvider.charProperties(v,S)}}s.UnicodeService=n}},t={};function i(h){var s=t[h];if(s!==void 0)return s.exports;var r=t[h]={exports:{}};return e[h].call(r.exports,r,r.exports,i),r.exports}var o={};return(()=>{var h=o;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let s=i(9042),r=i(3236),a=i(844),f=i(5741),n=i(8285),_=i(7975),v=i(7090),S=["cols","rows"];class p extends a.Disposable{constructor(d){super(),this._core=this.register(new r.Terminal(d)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let l=g=>this._core.options[g],u=(g,C)=>{this._checkReadonlyOptions(g),this._core.options[g]=C};for(let g in this._core.options){let C={get:l.bind(this,g),set:u.bind(this,g)};Object.defineProperty(this._publicOptions,g,C)}}_checkReadonlyOptions(d){if(S.includes(d))throw new Error(`Option "${d}" 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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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 d=this._core.coreService.decPrivateModes,l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let l in d)this._publicOptions[l]=d[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,l=!0){this._core.input(d,l)}resize(d,l){this._verifyIntegers(d,l),this._core.resize(d,l)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}attachCustomWheelEventHandler(d){this._core.attachCustomWheelEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){return this._checkProposedApi(),this._verifyPositiveIntegers(d.x??0,d.width??0,d.height??0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,l,u){this._verifyIntegers(d,l,u),this._core.select(d,l,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,l){this._verifyIntegers(d,l),this._core.selectLines(d,l)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,l){this._core.write(d,l)}writeln(d,l){this._core.write(d),this._core.write(`\r
|
|
9
|
-
`,l)}paste(d){this._core.paste(d)}refresh(d,l){this._verifyIntegers(d,l),this._core.refresh(d,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(m){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&m&&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(m){let x=this._getMouseBufferCoords(m),T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(T&&I&&x)&&this._areCoordsInSelection(x,T,I)}isCellInSelection(m,x){let T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I)&&this._areCoordsInSelection([m,x],T,I)}_areCoordsInSelection(m,x,T){return m[1]>x[1]&&m[1]<T[1]||x[1]===T[1]&&m[1]===x[1]&&m[0]>=x[0]&&m[0]<T[0]||x[1]<T[1]&&m[1]===T[1]&&m[0]<T[0]||x[1]<T[1]&&m[1]===x[1]&&m[0]>=x[0]}_selectWordAtCursor(m,x){let T=this._linkifier.currentLink?.link?.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let I=this._getMouseBufferCoords(m);return!!I&&(this._selectWordAt(I,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(m,x){this._model.clearSelection(),m=Math.max(m,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(m){this._model.handleTrim(m)&&this.refresh()}_getMouseBufferCoords(m){let x=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(m){let x=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,m,this._screenElement)[1],T=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=T?0:(x>T&&(x-=T),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(m){return d.isMac?m.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:m.shiftKey}handleMouseDown(m){if(this._mouseDownTimeStamp=m.timeStamp,(m.button!==2||!this.hasSelection)&&m.button===0){if(!this._enabled){if(!this.shouldForceSelection(m))return;m.stopPropagation()}m.preventDefault(),this._dragScrollAmount=0,this._enabled&&m.shiftKey?this._handleIncrementalClick(m):m.detail===1?this._handleSingleClick(m):m.detail===2?this._handleDoubleClick(m):m.detail===3&&this._handleTripleClick(m),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(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))}_handleSingleClick(m){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(m)?3:0,this._model.selectionStart=this._getMouseBufferCoords(m),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let x=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);x&&x.length!==this._model.selectionStart[0]&&x.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(m){this._selectWordAtCursor(m,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(m){let x=this._getMouseBufferCoords(m);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(m){return m.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(m){if(m.stopImmediatePropagation(),!this._model.selectionStart)return;let x=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(m),!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(m),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){let I=T.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}x&&x[0]===this._model.selectionEnd[0]&&x[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 m=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(m.ydisp+this._bufferService.rows,m.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=m.ydisp),this.refresh()}}_handleMouseUp(m){let x=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&m.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let T=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){let I=(0,_.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let m=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,T=!(!m||!x||m[0]===x[0]&&m[1]===x[1]);T?m&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&m[0]===this._oldSelectionStart[0]&&m[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(m,x,T)):this._oldHasSelection&&this._fireOnSelectionChange(m,x,T)}_fireOnSelectionChange(m,x,T){this._oldSelectionStart=m,this._oldSelectionEnd=x,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(m){this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(m,x){let T=x;for(let I=0;x>=I;I++){let F=m.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:F>1&&x!==I&&(T+=F-1)}return T}setSelection(m,x,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,x],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(m){this._isClickInSelection(m)||(this._selectWordAtCursor(m,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(m,x,T=!0,I=!0){if(m[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,R=F.lines.get(m[1]);if(!R)return;let z=F.translateBufferLineToString(m[1],!1),B=this._convertViewportColToCharacterIndex(R,m[0]),D=B,O=m[0]-B,P=0,b=0,E=0,L=0;if(z.charAt(B)===" "){for(;B>0&&z.charAt(B-1)===" ";)B--;for(;D<z.length&&z.charAt(D+1)===" ";)D++}else{let K=m[0],Y=m[0];R.getWidth(K)===0&&(P++,K--),R.getWidth(Y)===2&&(b++,Y++);let U=R.getString(Y).length;for(U>1&&(L+=U-1,D+=U-1);K>0&&B>0&&!this._isCharWordSeparator(R.loadCell(K-1,this._workCell));){R.loadCell(K-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,K--):A>1&&(E+=A-1,B-=A-1),B--,K--}for(;Y<R.length&&D+1<z.length&&!this._isCharWordSeparator(R.loadCell(Y+1,this._workCell));){R.loadCell(Y+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,Y++):A>1&&(L+=A-1,D+=A-1),D++,Y++}}D++;let M=B+O-P+E,$=Math.min(this._bufferService.cols,D-B+P+b-E-L);if(x||z.slice(B,D).trim()!==""){if(T&&M===0&&R.getCodePoint(0)!==32){let K=F.lines.get(m[1]-1);if(K&&R.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){let Y=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Y){let U=this._bufferService.cols-Y.start;M-=U,$+=U}}}if(I&&M+$===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){let K=F.lines.get(m[1]+1);if(K?.isWrapped&&K.getCodePoint(0)!==32){let Y=this._getWordAt([0,m[1]+1],!1,!1,!0);Y&&($+=Y.length)}}return{start:M,length:$}}}_selectWordAt(m,x){let T=this._getWordAt(m,x);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[T.start,m[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(m){let x=this._getWordAt(m,!0);if(x){let T=m[1];for(;x.start<0;)x.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,T]}}_isCharWordSeparator(m){return m.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(m.getChars())>=0}_selectLineAt(m){let x=this._bufferService.buffer.getWrappedRangeForLine(m),T={start:{x:0,y:x.first},end:{x:this._bufferService.cols-1,y:x.last}};this._model.selectionStart=[0,x.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(T,this._bufferService.cols)}};r.SelectionService=y=a([f(3,v.IBufferService),f(4,v.ICoreService),f(5,S.IMouseService),f(6,v.IOptionsService),f(7,S.IRenderService),f(8,S.ICoreBrowserService)],y)},4725:(h,r,s)=>{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 a=s(8343);r.ICharSizeService=(0,a.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),r.IMouseService=(0,a.createDecorator)("MouseService"),r.IRenderService=(0,a.createDecorator)("RenderService"),r.ISelectionService=(0,a.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,a.createDecorator)("ThemeService"),r.ILinkProviderService=(0,a.createDecorator)("LinkProviderService")},6731:function(h,r,s){var a=this&&this.__decorate||function(y,m,x,T){var I,F=arguments.length,R=F<3?m:T===null?T=Object.getOwnPropertyDescriptor(m,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,m,x,T);else for(var z=y.length-1;z>=0;z--)(I=y[z])&&(R=(F<3?I(R):F>3?I(m,x,R):I(m,x))||R);return F>3&&R&&Object.defineProperty(m,x,R),R},f=this&&this.__param||function(y,m){return function(x,T){m(x,T,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;let n=s(7239),_=s(8055),g=s(8460),S=s(844),p=s(2585),c=_.css.toColor("#ffffff"),d=_.css.toColor("#000000"),l=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let y=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],m=[0,95,135,175,215,255];for(let x=0;x<216;x++){let T=m[x/36%6|0],I=m[x/6%6|0],F=m[x%6];y.push({css:_.channels.toCss(T,I,F),rgba:_.channels.toRgba(T,I,F)})}for(let x=0;x<24;x++){let T=8+10*x;y.push({css:_.channels.toCss(T,T,T),rgba:_.channels.toRgba(T,T,T)})}return y})());let C=r.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(y){super(),this._optionsService=y,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:d,cursor:l,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(d,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(d,v),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(y={}){let m=this._colors;if(m.foreground=w(y.foreground,c),m.background=w(y.background,d),m.cursor=w(y.cursor,l),m.cursorAccent=w(y.cursorAccent,u),m.selectionBackgroundTransparent=w(y.selectionBackground,v),m.selectionBackgroundOpaque=_.color.blend(m.background,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundTransparent=w(y.selectionInactiveBackground,m.selectionBackgroundTransparent),m.selectionInactiveBackgroundOpaque=_.color.blend(m.background,m.selectionInactiveBackgroundTransparent),m.selectionForeground=y.selectionForeground?w(y.selectionForeground,_.NULL_COLOR):void 0,m.selectionForeground===_.NULL_COLOR&&(m.selectionForeground=void 0),_.color.isOpaque(m.selectionBackgroundTransparent)&&(m.selectionBackgroundTransparent=_.color.opacity(m.selectionBackgroundTransparent,.3)),_.color.isOpaque(m.selectionInactiveBackgroundTransparent)&&(m.selectionInactiveBackgroundTransparent=_.color.opacity(m.selectionInactiveBackgroundTransparent,.3)),m.ansi=r.DEFAULT_ANSI_COLORS.slice(),m.ansi[0]=w(y.black,r.DEFAULT_ANSI_COLORS[0]),m.ansi[1]=w(y.red,r.DEFAULT_ANSI_COLORS[1]),m.ansi[2]=w(y.green,r.DEFAULT_ANSI_COLORS[2]),m.ansi[3]=w(y.yellow,r.DEFAULT_ANSI_COLORS[3]),m.ansi[4]=w(y.blue,r.DEFAULT_ANSI_COLORS[4]),m.ansi[5]=w(y.magenta,r.DEFAULT_ANSI_COLORS[5]),m.ansi[6]=w(y.cyan,r.DEFAULT_ANSI_COLORS[6]),m.ansi[7]=w(y.white,r.DEFAULT_ANSI_COLORS[7]),m.ansi[8]=w(y.brightBlack,r.DEFAULT_ANSI_COLORS[8]),m.ansi[9]=w(y.brightRed,r.DEFAULT_ANSI_COLORS[9]),m.ansi[10]=w(y.brightGreen,r.DEFAULT_ANSI_COLORS[10]),m.ansi[11]=w(y.brightYellow,r.DEFAULT_ANSI_COLORS[11]),m.ansi[12]=w(y.brightBlue,r.DEFAULT_ANSI_COLORS[12]),m.ansi[13]=w(y.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),m.ansi[14]=w(y.brightCyan,r.DEFAULT_ANSI_COLORS[14]),m.ansi[15]=w(y.brightWhite,r.DEFAULT_ANSI_COLORS[15]),y.extendedAnsi){let x=Math.min(m.ansi.length-16,y.extendedAnsi.length);for(let T=0;T<x;T++)m.ansi[T+16]=w(y.extendedAnsi[T],r.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(y){this._restoreColor(y),this._onChangeColors.fire(this.colors)}_restoreColor(y){if(y!==void 0)switch(y){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[y]=this._restoreColors.ansi[y]}else for(let m=0;m<this._restoreColors.ansi.length;++m)this._colors.ansi[m]=this._restoreColors.ansi[m]}modifyColors(y){y(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 w(y,m){if(y!==void 0)try{return _.css.toColor(y)}catch{}return m}r.ThemeService=C=a([f(0,p.IOptionsService)],C)},6349:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;let a=s(8460),f=s(844);class n extends f.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new a.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new a.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new a.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(g){if(this._maxLength===g)return;let S=new Array(g);for(let p=0;p<Math.min(g,this.length);p++)S[p]=this._array[this._getCyclicIndex(p)];this._array=S,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let S=this._length;S<g;S++)this._array[S]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,S){this._array[this._getCyclicIndex(g)]=S}push(g){this._array[this._getCyclicIndex(this._length)]=g,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(g,S,...p){if(S){for(let c=g;c<this._length-S;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+S)];this._length-=S,this.onDeleteEmitter.fire({index:g,amount:S})}for(let c=this._length-1;c>=g;c--)this._array[this._getCyclicIndex(c+p.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<p.length;c++)this._array[this._getCyclicIndex(g+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:g,amount:p.length}),this._length+p.length>this._maxLength){let c=this._length+p.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=p.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,S,p){if(!(S<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let d=S-1;d>=0;d--)this.set(g+d+p,this.get(g+d));let c=g+S+p-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let c=0;c<S;c++)this.set(g+c+p,this.get(g+c))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}r.CircularList=n},1439:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function s(a,f=5){if(typeof a!="object")return a;let n=Array.isArray(a)?[]:{};for(let _ in a)n[_]=f<=1?a[_]:a[_]&&s(a[_],f-1);return n}},8055:(h,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 s=0,a=0,f=0,n=0;var _,g,S,p,c;function d(u){let v=u.toString(16);return v.length<2?"0"+v:v}function l(u,v){return u<v?(v+.05)/(u+.05):(u+.05)/(v+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(v,C,w,y){return y!==void 0?`#${d(v)}${d(C)}${d(w)}${d(y)}`:`#${d(v)}${d(C)}${d(w)}`},u.toRgba=function(v,C,w,y=255){return(v<<24|C<<16|w<<8|y)>>>0},u.toColor=function(v,C,w,y){return{css:u.toCss(v,C,w,y),rgba:u.toRgba(v,C,w,y)}}})(_||(r.channels=_={})),(function(u){function v(C,w){return n=Math.round(255*w),[s,a,f]=c.toChannels(C.rgba),{css:_.toCss(s,a,f,n),rgba:_.toRgba(s,a,f,n)}}u.blend=function(C,w){if(n=(255&w.rgba)/255,n===1)return{css:w.css,rgba:w.rgba};let y=w.rgba>>24&255,m=w.rgba>>16&255,x=w.rgba>>8&255,T=C.rgba>>24&255,I=C.rgba>>16&255,F=C.rgba>>8&255;return s=T+Math.round((y-T)*n),a=I+Math.round((m-I)*n),f=F+Math.round((x-F)*n),{css:_.toCss(s,a,f),rgba:_.toRgba(s,a,f)}},u.isOpaque=function(C){return(255&C.rgba)==255},u.ensureContrastRatio=function(C,w,y){let m=c.ensureContrastRatio(C.rgba,w.rgba,y);if(m)return _.toColor(m>>24&255,m>>16&255,m>>8&255)},u.opaque=function(C){let w=(255|C.rgba)>>>0;return[s,a,f]=c.toChannels(w),{css:_.toCss(s,a,f),rgba:w}},u.opacity=v,u.multiplyOpacity=function(C,w){return n=255&C.rgba,v(C,n*w/255)},u.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(g||(r.color=g={})),(function(u){let v,C;try{let w=document.createElement("canvas");w.width=1,w.height=1;let y=w.getContext("2d",{willReadFrequently:!0});y&&(v=y,v.globalCompositeOperation="copy",C=v.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return s=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),_.toColor(s,a,f);case 5:return s=parseInt(w.slice(1,2).repeat(2),16),a=parseInt(w.slice(2,3).repeat(2),16),f=parseInt(w.slice(3,4).repeat(2),16),n=parseInt(w.slice(4,5).repeat(2),16),_.toColor(s,a,f,n);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}let y=w.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(y)return s=parseInt(y[1]),a=parseInt(y[2]),f=parseInt(y[3]),n=Math.round(255*(y[5]===void 0?1:parseFloat(y[5]))),_.toColor(s,a,f,n);if(!v||!C)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=C,v.fillStyle=w,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[s,a,f,n]=v.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(s,a,f,n),css:w}}})(S||(r.css=S={})),(function(u){function v(C,w,y){let m=C/255,x=w/255,T=y/255;return .2126*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}u.relativeLuminance=function(C){return v(C>>16&255,C>>8&255,255&C)},u.relativeLuminance2=v})(p||(r.rgb=p={})),(function(u){function v(w,y,m){let x=w>>24&255,T=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,z=y>>8&255,B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));for(;B<m&&(F>0||R>0||z>0);)F-=Math.max(0,Math.ceil(.1*F)),R-=Math.max(0,Math.ceil(.1*R)),z-=Math.max(0,Math.ceil(.1*z)),B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));return(F<<24|R<<16|z<<8|255)>>>0}function C(w,y,m){let x=w>>24&255,T=w>>16&255,I=w>>8&255,F=y>>24&255,R=y>>16&255,z=y>>8&255,B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));for(;B<m&&(F<255||R<255||z<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),R=Math.min(255,R+Math.ceil(.1*(255-R))),z=Math.min(255,z+Math.ceil(.1*(255-z))),B=l(p.relativeLuminance2(F,R,z),p.relativeLuminance2(x,T,I));return(F<<24|R<<16|z<<8|255)>>>0}u.blend=function(w,y){if(n=(255&y)/255,n===1)return y;let m=y>>24&255,x=y>>16&255,T=y>>8&255,I=w>>24&255,F=w>>16&255,R=w>>8&255;return s=I+Math.round((m-I)*n),a=F+Math.round((x-F)*n),f=R+Math.round((T-R)*n),_.toRgba(s,a,f)},u.ensureContrastRatio=function(w,y,m){let x=p.relativeLuminance(w>>8),T=p.relativeLuminance(y>>8);if(l(x,T)<m){if(T<x){let R=v(w,y,m),z=l(x,p.relativeLuminance(R>>8));if(z<m){let B=C(w,y,m);return z>l(x,p.relativeLuminance(B>>8))?R:B}return R}let I=C(w,y,m),F=l(x,p.relativeLuminance(I>>8));if(F<m){let R=v(w,y,m);return F>l(x,p.relativeLuminance(R>>8))?I:R}return I}},u.reduceLuminance=v,u.increaseLuminance=C,u.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(c||(r.rgba=c={})),r.toPaddedHex=d,r.contrastRatio=l},8969:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;let a=s(844),f=s(2585),n=s(4348),_=s(7866),g=s(744),S=s(7302),p=s(6975),c=s(8460),d=s(1753),l=s(1480),u=s(7994),v=s(9282),C=s(5435),w=s(5981),y=s(2660),m=!1;class x extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((I=>{this._onScrollApi?.fire(I.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(I){for(let F in I)this.optionsService.options[F]=I[F]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new c.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new S.OptionsService(I)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(y.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,c.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,c.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,c.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,c.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((F=>{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((F=>{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 w.WriteBuffer(((F,R)=>this._inputHandler.parse(F,R)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,F){this._writeBuffer.write(I,F)}writeSync(I,F){this._logService.logLevel<=f.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(I,F)}input(I,F=!0){this.coreService.triggerDataEvent(I,F)}resize(I,F){isNaN(I)||isNaN(F)||(I=Math.max(I,g.MINIMUM_COLS),F=Math.max(F,g.MINIMUM_ROWS),this._bufferService.resize(I,F))}scroll(I,F=!1){this._bufferService.scroll(I,F)}scrollLines(I,F,R){this._bufferService.scrollLines(I,F,R)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){let F=I-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(I,F){return this._inputHandler.registerEscHandler(I,F)}registerDcsHandler(I,F){return this._inputHandler.registerDcsHandler(I,F)}registerCsiHandler(I,F){return this._inputHandler.registerCsiHandler(I,F)}registerOscHandler(I,F){return this._inputHandler.registerOscHandler(I,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?I=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let I=[];I.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of I)F.dispose()}))}}}r.CoreTerminal=x},8460:(h,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=s=>(this._listeners.push(s),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===s)return void this._listeners.splice(a,1)}}})),this._event}fire(s,a){let f=[];for(let n=0;n<this._listeners.length;n++)f.push(this._listeners[n]);for(let n=0;n<f.length;n++)f[n].call(void 0,s,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(s,a){return s((f=>a.fire(f)))},r.runAndSubscribe=function(s,a){return a(void 0),s((f=>a(f)))}},5435:function(h,r,s){var a=this&&this.__decorate||function(P,b,E,L){var M,$=arguments.length,K=$<3?b:L===null?L=Object.getOwnPropertyDescriptor(b,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(P,b,E,L);else for(var Y=P.length-1;Y>=0;Y--)(M=P[Y])&&(K=($<3?M(K):$>3?M(b,E,K):M(b,E))||K);return $>3&&K&&Object.defineProperty(b,E,K),K},f=this&&this.__param||function(P,b){return function(E,L){b(E,L,P)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;let n=s(2584),_=s(7116),g=s(2015),S=s(844),p=s(482),c=s(8437),d=s(8460),l=s(643),u=s(511),v=s(3734),C=s(2585),w=s(1480),y=s(6242),m=s(6351),x=s(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function F(P,b){if(P>24)return b.setWinLines||!1;switch(P){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 R;(function(P){P[P.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",P[P.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(r.WindowsOptionsReportType=R={}));let z=0;class B extends S.Disposable{getAttrData(){return this._curAttrData}constructor(b,E,L,M,$,K,Y,U,A=new g.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=E,this._coreService=L,this._logService=M,this._optionsService=$,this._oscLinkService=K,this._coreMouseService=Y,this._unicodeService=U,this._parser=A,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.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 D(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:N.toArray()})})),this._parser.setEscHandlerFallback((k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})})),this._parser.setExecuteHandlerFallback((k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})})),this._parser.setOscHandlerFallback(((k,N,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:N,data:H})})),this._parser.setDcsHandlerFallback(((k,N,H)=>{N==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:N,payload:H})})),this._parser.setPrintHandler(((k,N,H)=>this.print(k,N,H))),this._parser.registerCsiHandler({final:"@"},(k=>this.insertChars(k))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(k=>this.scrollLeft(k))),this._parser.registerCsiHandler({final:"A"},(k=>this.cursorUp(k))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(k=>this.scrollRight(k))),this._parser.registerCsiHandler({final:"B"},(k=>this.cursorDown(k))),this._parser.registerCsiHandler({final:"C"},(k=>this.cursorForward(k))),this._parser.registerCsiHandler({final:"D"},(k=>this.cursorBackward(k))),this._parser.registerCsiHandler({final:"E"},(k=>this.cursorNextLine(k))),this._parser.registerCsiHandler({final:"F"},(k=>this.cursorPrecedingLine(k))),this._parser.registerCsiHandler({final:"G"},(k=>this.cursorCharAbsolute(k))),this._parser.registerCsiHandler({final:"H"},(k=>this.cursorPosition(k))),this._parser.registerCsiHandler({final:"I"},(k=>this.cursorForwardTab(k))),this._parser.registerCsiHandler({final:"J"},(k=>this.eraseInDisplay(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(k=>this.eraseInDisplay(k,!0))),this._parser.registerCsiHandler({final:"K"},(k=>this.eraseInLine(k,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(k=>this.eraseInLine(k,!0))),this._parser.registerCsiHandler({final:"L"},(k=>this.insertLines(k))),this._parser.registerCsiHandler({final:"M"},(k=>this.deleteLines(k))),this._parser.registerCsiHandler({final:"P"},(k=>this.deleteChars(k))),this._parser.registerCsiHandler({final:"S"},(k=>this.scrollUp(k))),this._parser.registerCsiHandler({final:"T"},(k=>this.scrollDown(k))),this._parser.registerCsiHandler({final:"X"},(k=>this.eraseChars(k))),this._parser.registerCsiHandler({final:"Z"},(k=>this.cursorBackwardTab(k))),this._parser.registerCsiHandler({final:"`"},(k=>this.charPosAbsolute(k))),this._parser.registerCsiHandler({final:"a"},(k=>this.hPositionRelative(k))),this._parser.registerCsiHandler({final:"b"},(k=>this.repeatPrecedingCharacter(k))),this._parser.registerCsiHandler({final:"c"},(k=>this.sendDeviceAttributesPrimary(k))),this._parser.registerCsiHandler({prefix:">",final:"c"},(k=>this.sendDeviceAttributesSecondary(k))),this._parser.registerCsiHandler({final:"d"},(k=>this.linePosAbsolute(k))),this._parser.registerCsiHandler({final:"e"},(k=>this.vPositionRelative(k))),this._parser.registerCsiHandler({final:"f"},(k=>this.hVPosition(k))),this._parser.registerCsiHandler({final:"g"},(k=>this.tabClear(k))),this._parser.registerCsiHandler({final:"h"},(k=>this.setMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(k=>this.setModePrivate(k))),this._parser.registerCsiHandler({final:"l"},(k=>this.resetMode(k))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(k=>this.resetModePrivate(k))),this._parser.registerCsiHandler({final:"m"},(k=>this.charAttributes(k))),this._parser.registerCsiHandler({final:"n"},(k=>this.deviceStatus(k))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(k=>this.deviceStatusPrivate(k))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(k=>this.softReset(k))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(k=>this.setCursorStyle(k))),this._parser.registerCsiHandler({final:"r"},(k=>this.setScrollRegion(k))),this._parser.registerCsiHandler({final:"s"},(k=>this.saveCursor(k))),this._parser.registerCsiHandler({final:"t"},(k=>this.windowOptions(k))),this._parser.registerCsiHandler({final:"u"},(k=>this.restoreCursor(k))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(k=>this.insertColumns(k))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(k=>this.deleteColumns(k))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(k=>this.selectProtected(k))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(k=>this.requestMode(k,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(k=>this.requestMode(k,!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 y.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new y.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new y.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new y.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new y.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new y.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new y.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new y.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new y.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new y.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new y.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new y.OscHandler((k=>this.restoreCursorColor(k)))),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 k in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},(()=>this.selectCharset("("+k))),this._parser.registerEscHandler({intermediates:")",final:k},(()=>this.selectCharset(")"+k))),this._parser.registerEscHandler({intermediates:"*",final:k},(()=>this.selectCharset("*"+k))),this._parser.registerEscHandler({intermediates:"+",final:k},(()=>this.selectCharset("+"+k))),this._parser.registerEscHandler({intermediates:"-",final:k},(()=>this.selectCharset("-"+k))),this._parser.registerEscHandler({intermediates:".",final:k},(()=>this.selectCharset("."+k))),this._parser.registerEscHandler({intermediates:"/",final:k},(()=>this.selectCharset("/"+k)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((k=>(this._logService.error("Parsing error: ",k),k))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler(((k,N)=>this.requestStatusString(k,N))))}_preserveStack(b,E,L,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=L,this._parseStack.position=M}_logSlowResolvingAsync(b){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([b,new Promise(((E,L)=>setTimeout((()=>L("#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 L,M=this._activeBuffer.x,$=this._activeBuffer.y,K=0,Y=this._parseStack.paused;if(Y){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(L),L;M=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>I&&(K=this._parseStack.position+I)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(k=>String.fromCharCode(k))).join("")}"`),typeof b=="string"?b.split("").map((k=>k.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(b.length,I))),Y||this._dirtyRowTracker.clearRange(),b.length>I)for(let k=K;k<b.length;k+=I){let N=k+I<b.length?k+I:b.length,H=typeof b=="string"?this._stringDecoder.decode(b.substring(k,N),this._parseBuffer):this._utf8Decoder.decode(b.subarray(k,N),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,$,H,k),this._logSlowResolvingAsync(L),L}else if(!Y){let k=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,k))return this._preserveStack(M,$,k,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===M&&this._activeBuffer.y===$||this._onCursorMove.fire();let U=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),A=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);A<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(A,this._bufferService.rows-1),Math.min(U,this._bufferService.rows-1))}print(b,E,L){let M,$,K=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,U=this._bufferService.cols,A=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,N=this._curAttrData,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-E>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,N);let q=this._parser.precedingJoinState;for(let j=E;j<L;++j){if(M=b[j],M<127&&K){let J=K[String.fromCharCode(M)];J&&(M=J.charCodeAt(0))}let Q=this._unicodeService.charProperties(M,q);$=w.UnicodeService.extractWidth(Q);let ee=w.UnicodeService.extractShouldJoin(Q),G=ee?w.UnicodeService.extractWidth(q):0;if(q=Q,Y&&this._onA11yChar.fire((0,p.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-G>U){if(A){let J=H,Z=this._activeBuffer.x-G;for(this._activeBuffer.x=G,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),G>0&&H instanceof c.BufferLine&&H.copyCellsFrom(J,Z,0,G,!1);Z<U;)J.setCellFromCodepoint(Z++,0,1,N)}else if(this._activeBuffer.x=U-1,$===2)continue}if(ee&&this._activeBuffer.x){let J=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-J,M,$);for(let Z=$-G;--Z>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}else if(k&&(H.insertCells(this._activeBuffer.x,$-G,this._activeBuffer.getNullCell(N)),H.getWidth(U-1)===2&&H.setCellFromCodepoint(U-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,N)),H.setCellFromCodepoint(this._activeBuffer.x++,M,$,N),$>0)for(;--$;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}this._parser.precedingJoinState=q,this._activeBuffer.x<U&&L-E>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,N),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,(L=>!F(L.params[0],this._optionsService.rawOptions.windowOptions)||E(L)))}registerDcsHandler(b,E){return this._parser.registerDcsHandler(b,new m.DcsHandler(E))}registerEscHandler(b,E){return this._parser.registerEscHandler(b,E)}registerOscHandler(b,E){return this._parser.registerOscHandler(b,new y.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,L,M=!1,$=!1){let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);K.replaceCells(E,L,this._activeBuffer.getNullCell(this._eraseAttrData()),$),M&&(K.isWrapped=!1)}_resetBufferLine(b,E=!1){let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),L.isWrapped=!1)}eraseInDisplay(b,E=!1){let L;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);L<this._bufferService.rows;L++)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,E);this._dirtyRowTracker.markDirty(0);break;case 3:let M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(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 L=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;E--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let E=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=this._activeBuffer.ybase+this._activeBuffer.y,M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;E--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(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(c.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);M.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),M.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 L=b.params[0]||1,M=w.UnicodeService.extractWidth(E),$=this._activeBuffer.x-M,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),Y=new Uint32Array(K.length*L),U=0;for(let k=0;k<K.length;){let N=K.codePointAt(k)||0;Y[U++]=N,k+=N>65535?2:1}let A=U;for(let k=1;k<L;++k)Y.copyWithin(A,0,U),A+=U;return this.print(Y,0,A),!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 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,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.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 L=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:$}=this._coreMouseService,K=this._coreService,{buffers:Y,cols:U}=this._bufferService,{active:A,alt:k}=Y,N=this._optionsService.rawOptions,H=ee=>ee?1:2,q=b.params[0];return j=q,Q=E?q===2?4:q===4?H(K.modes.insertMode):q===12?3:q===20?H(N.convertEol):0:q===1?H(L.applicationCursorKeys):q===3?N.windowOptions.setWinLines?U===80?2:U===132?1:0:0:q===6?H(L.origin):q===7?H(L.wraparound):q===8?3:q===9?H(M==="X10"):q===12?H(N.cursorBlink):q===25?H(!K.isCursorHidden):q===45?H(L.reverseWraparound):q===66?H(L.applicationKeypad):q===67?4:q===1e3?H(M==="VT200"):q===1002?H(M==="DRAG"):q===1003?H(M==="ANY"):q===1004?H(L.sendFocus):q===1005?4:q===1006?H($==="SGR"):q===1015?4:q===1016?H($==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?H(A===k):q===2004?H(L.bracketedPasteMode):0,K.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${j};${Q}$y`),!0;var j,Q}_updateAttrColor(b,E,L,M,$){return E===2?(b|=50331648,b&=-16777216,b|=v.AttributeData.fromColorRGB([L,M,$])):E===5&&(b&=-50331904,b|=33554432|255&L),b}_extractColor(b,E,L){let M=[0,0,-1,0,0,0],$=0,K=0;do{if(M[K+$]=b.params[E+K],b.hasSubParams(E+K)){let Y=b.getSubParams(E+K),U=0;do M[1]===5&&($=1),M[K+U+1+$]=Y[U];while(++U<Y.length&&U+K+1+$<M.length);break}if(M[1]===5&&K+$>=2||M[1]===2&&K+$>=5)break;M[1]&&($=1)}while(++K+E<b.length&&K+$<M.length);for(let Y=2;Y<M.length;++Y)M[Y]===-1&&(M[Y]=0);switch(M[0]){case 38:L.fg=this._updateAttrColor(L.fg,M[1],M[3],M[4],M[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,M[1],M[3],M[4],M[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,M[1],M[3],M[4],M[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=c.DEFAULT_ATTR_DATA.fg,b.bg=c.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,L,M=this._curAttrData;for(let $=0;$<E;$++)L=b.params[$],L>=30&&L<=37?(M.fg&=-50331904,M.fg|=16777216|L-30):L>=40&&L<=47?(M.bg&=-50331904,M.bg|=16777216|L-40):L>=90&&L<=97?(M.fg&=-50331904,M.fg|=16777224|L-90):L>=100&&L<=107?(M.bg&=-50331904,M.bg|=16777224|L-100):L===0?this._processSGR0(M):L===1?M.fg|=134217728:L===3?M.bg|=67108864:L===4?(M.fg|=268435456,this._processUnderline(b.hasSubParams($)?b.getSubParams($)[0]:1,M)):L===5?M.fg|=536870912:L===7?M.fg|=67108864:L===8?M.fg|=1073741824:L===9?M.fg|=2147483648:L===2?M.bg|=134217728:L===21?this._processUnderline(2,M):L===22?(M.fg&=-134217729,M.bg&=-134217729):L===23?M.bg&=-67108865:L===24?(M.fg&=-268435457,this._processUnderline(0,M)):L===25?M.fg&=-536870913:L===27?M.fg&=-67108865:L===28?M.fg&=-1073741825:L===29?M.fg&=2147483647:L===39?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):L===49?(M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?$+=this._extractColor(b,$,M):L===53?M.bg|=1073741824:L===55?M.bg&=-1073741825:L===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):L===100?(M.fg&=-67108864,M.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${L}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){let E=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${L}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=c.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 L=E%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(b){let E=b.params[0]||1,L;return(b.length<2||(L=b.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(b){if(!F(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(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.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: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=[],L=b.split(";");for(;L.length>1;){let M=L.shift(),$=L.shift();if(/^\d+$/.exec(M)){let K=parseInt(M);if(O(K))if($==="?")E.push({type:0,index:K});else{let Y=(0,x.parseColor)($);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 L=b.split(":"),M,$=L.findIndex((K=>K.startsWith("id=")));return $!==-1&&(M=L[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,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 L=b.split(";");for(let M=0;M<L.length&&!(E>=this._specialColors.length);++M,++E)if(L[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{let $=(0,x.parseColor)(L[M]);$&&this._onColor.fire([{type:1,index:this._specialColors[E],color:$}])}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=[],L=b.split(";");for(let M=0;M<L.length;++M)if(/^\d+$/.exec(L[M])){let $=parseInt(L[M]);O($)&&E.push({type:2,index:$})}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,_.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(T[b[0]],_.CHARSETS[b[1]]||_.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=c.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=c.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 u.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 L=this._activeBuffer.ybase+this._activeBuffer.y+E,M=this._activeBuffer.lines.get(L);M&&(M.fill(b),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,E){let L=this._bufferService.buffer,M=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${$}${n.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,E){this._dirtyRowTracker.markRangeDirty(b,E)}}r.InputHandler=B;let D=class{constructor(P){this._bufferService=P,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(P){P<this.start?this.start=P:P>this.end&&(this.end=P)}markRangeDirty(P,b){P>b&&(z=P,P=b,b=z),P<this.start&&(this.start=P),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function O(P){return 0<=P&&P<256}D=a([f(0,C.IBufferService)],D)},844:(h,r)=>{function s(a){for(let f of a)f.dispose();a.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 a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){let f=this._disposables.indexOf(a);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){this._isDisposed||a===this._value||(this._value?.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(a){return{dispose:a}},r.disposeArray=s,r.getDisposeArrayDisposable=function(a){return{dispose:()=>s(a)}}},1505:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class s{constructor(){this._data={}}set(f,n,_){this._data[f]||(this._data[f]={}),this._data[f][n]=_}get(f,n){return this._data[f]?this._data[f][n]:void 0}clear(){this._data={}}}r.TwoKeyMap=s,r.FourKeyMap=class{constructor(){this._data=new s}set(a,f,n,_,g){this._data.get(a,f)||this._data.set(a,f,new s),this._data.get(a,f).set(n,_,g)}get(a,f,n,_){return this._data.get(a,f)?.get(n,_)}clear(){this._data.clear()}}},6114:(h,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 s=r.isNode?"node":navigator.userAgent,a=r.isNode?"node":navigator.platform;r.isFirefox=s.includes("Firefox"),r.isLegacyEdge=s.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(s),r.getSafariVersion=function(){if(!r.isSafari)return 0;let f=s.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),r.isIpad=a==="iPad",r.isIphone=a==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),r.isLinux=a.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(s)},6106:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let s=0;r.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(s=this._search(this._getKey(a)),this._array.splice(s,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let f=this._getKey(a);if(f===void 0||(s=this._search(f),s===-1)||this._getKey(this._array[s])!==f)return!1;do if(this._array[s]===a)return this._array.splice(s,1),!0;while(++s<this._array.length&&this._getKey(this._array[s])===f);return!1}*getKeyIterator(a){if(this._array.length!==0&&(s=this._search(a),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===a))do yield this._array[s];while(++s<this._array.length&&this._getKey(this._array[s])===a)}forEachByKey(a,f){if(this._array.length!==0&&(s=this._search(a),!(s<0||s>=this._array.length)&&this._getKey(this._array[s])===a))do f(this._array[s]);while(++s<this._array.length&&this._getKey(this._array[s])===a)}values(){return[...this._array].values()}_search(a){let f=0,n=this._array.length-1;for(;n>=f;){let _=f+n>>1,g=this._getKey(this._array[_]);if(g>a)n=_-1;else{if(!(g<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}f=_+1}}return f}}},7226:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;let a=s(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let S=0,p=0,c=g.timeRemaining(),d=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),p=Math.max(S,p),d=g.timeRemaining(),1.5*p>d)return c-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-S))}ms`),void this._start();c=d}this.clear()}}class n extends f{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){let S=Date.now()+g;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;let a=s(643);r.updateWindowsModeWrappedState=function(f){let n=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),_=n?.get(f.cols-1),g=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);g&&_&&(g.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class s{constructor(){this.fg=0,this.bg=0,this.extended=new a}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 s;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=s;class a{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,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=a},9092:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;let a=s(6349),f=s(7226),n=s(3734),_=s(8437),g=s(4634),S=s(511),p=s(643),c=s(4863),d=s(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(l,u,v){this._hasScrollback=l,this._optionsService=u,this._bufferService=v,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.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 a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,u){return new _.BufferLine(this._bufferService.cols,this.getNullCell(l),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;let u=l+this._optionsService.rawOptions.scrollback;return u>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:u}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=_.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=0,w=this._getCorrectBufferLength(u);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<l)for(let m=0;m<this.lines.length;m++)C+=+this.lines.get(m).resize(l,v);let y=0;if(this._rows<u)for(let m=this._rows;m<u;m++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(l,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+y+1?(this.ybase--,y++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(l,v)));else for(let m=this._rows;m>u;m--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){let m=this.lines.length-w;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=w}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,u-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(l,u),this._cols>l))for(let y=0;y<this.lines.length;y++)C+=+this.lines.get(y).resize(l,v);this._cols=l,this._rows=u,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return l}get _isReflowEnabled(){let l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,u){this._cols!==l&&(l>this._cols?this._reflowLarger(l,u):this._reflowSmaller(l,u))}_reflowLarger(l,u){let v=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(v.length>0){let C=(0,g.reflowLargerCreateNewLayout)(this.lines,v);(0,g.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(l,u,C.countRemoved)}}_reflowLargerAdjustViewport(l,u,v){let C=this.getNullCell(_.DEFAULT_ATTR_DATA),w=v;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new _.BufferLine(l,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(l,u){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),C=[],w=0;for(let y=this.lines.length-1;y>=0;y--){let m=this.lines.get(y);if(!m||!m.isWrapped&&m.getTrimmedLength()<=l)continue;let x=[m];for(;m.isWrapped&&y>0;)m=this.lines.get(--y),x.unshift(m);let T=this.ybase+this.y;if(T>=y&&T<y+x.length)continue;let I=x[x.length-1].getTrimmedLength(),F=(0,g.reflowSmallerGetNewLineLengths)(x,this._cols,l),R=F.length-x.length,z;z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+R):Math.max(0,this.lines.length-this.lines.maxLength+R);let B=[];for(let L=0;L<R;L++){let M=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(M)}B.length>0&&(C.push({start:y+x.length+w,newLines:B}),w+=B.length),x.push(...B);let D=F.length-1,O=F[D];O===0&&(D--,O=F[D]);let P=x.length-R-1,b=I;for(;P>=0;){let L=Math.min(b,O);if(x[D]===void 0)break;if(x[D].copyCellsFrom(x[P],b-L,O-L,L,!0),O-=L,O===0&&(D--,O=F[D]),b-=L,b===0){P--;let M=Math.max(P,0);b=(0,g.getWrappedLineTrimmedLength)(x,M,this._cols)}}for(let L=0;L<x.length;L++)F[L]<l&&x[L].setCell(F[L],v);let E=R-z;for(;E-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+R,this.ybase+u-1)}if(C.length>0){let y=[],m=[];for(let D=0;D<this.lines.length;D++)m.push(this.lines.get(D));let x=this.lines.length,T=x-1,I=0,F=C[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let R=0;for(let D=Math.min(this.lines.maxLength-1,x+w-1);D>=0;D--)if(F&&F.start>T+R){for(let O=F.newLines.length-1;O>=0;O--)this.lines.set(D--,F.newLines[O]);D++,y.push({index:T+1,amount:F.newLines.length}),R+=F.newLines.length,F=C[++I]}else this.lines.set(D,m[T--]);let z=0;for(let D=y.length-1;D>=0;D--)y[D].index+=z,this.lines.onInsertEmitter.fire(y[D]),z+=y[D].amount;let B=Math.max(0,x+w-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(l,u,v=0,C){let w=this.lines.get(l);return w?w.translateToString(u,v,C):""}getWrappedRangeForLine(l){let u=l,v=l;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:u,last:v}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===l&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){let u=new c.Marker(l);return this.markers.push(u),u.register(this.lines.onTrim((v=>{u.line-=v,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((v=>{u.line>=v.index&&(u.line+=v.amount)}))),u.register(this.lines.onDelete((v=>{u.line>=v.index&&u.line<v.index+v.amount&&u.dispose(),u.line>v.index&&(u.line-=v.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;let a=s(3734),f=s(511),n=s(643),_=s(482);r.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let g=0;class S{constructor(c,d,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let u=d||f.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let v=0;v<c;++v)this.setCell(v,u);this.length=c}get(c){let d=this._data[3*c+0],l=2097151&d;return[this._data[3*c+1],2097152&d?this._combined[c]:l?(0,_.stringFromCodePoint)(l):"",d>>22,2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):l]}set(c,d){this._data[3*c+1]=d[n.CHAR_DATA_ATTR_INDEX],d[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=d[1],this._data[3*c+0]=2097152|c|d[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=d[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(c){return this._data[3*c+0]>>22}hasWidth(c){return 12582912&this._data[3*c+0]}getFg(c){return this._data[3*c+1]}getBg(c){return this._data[3*c+2]}hasContent(c){return 4194303&this._data[3*c+0]}getCodePoint(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&d}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let d=this._data[3*c+0];return 2097152&d?this._combined[c]:2097151&d?(0,_.stringFromCodePoint)(2097151&d):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,d){return g=3*c,d.content=this._data[g+0],d.fg=this._data[g+1],d.bg=this._data[g+2],2097152&d.content&&(d.combinedData=this._combined[c]),268435456&d.bg&&(d.extended=this._extendedAttrs[c]),d}setCell(c,d){2097152&d.content&&(this._combined[c]=d.combinedData),268435456&d.bg&&(this._extendedAttrs[c]=d.extended),this._data[3*c+0]=d.content,this._data[3*c+1]=d.fg,this._data[3*c+2]=d.bg}setCellFromCodepoint(c,d,l,u){268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=d|l<<22,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}addCodepointToCell(c,d,l){let u=this._data[3*c+0];2097152&u?this._combined[c]+=(0,_.stringFromCodePoint)(d):2097151&u?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&u)+(0,_.stringFromCodePoint)(d),u&=-2097152,u|=2097152):u=d|4194304,l&&(u&=-12582913,u|=l<<22),this._data[3*c+0]=u}insertCells(c,d,l){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length-c){let u=new f.CellData;for(let v=this.length-c-d-1;v>=0;--v)this.setCell(c+d+v,this.loadCell(c+v,u));for(let v=0;v<d;++v)this.setCell(c+v,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(c,d,l){if(c%=this.length,d<this.length-c){let u=new f.CellData;for(let v=0;v<this.length-c-d;++v)this.setCell(c+v,this.loadCell(c+d+v,u));for(let v=this.length-d;v<this.length;++v)this.setCell(v,l)}else for(let u=c;u<this.length;++u)this.setCell(u,l);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,l)}replaceCells(c,d,l,u=!1){if(u)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&!this.isProtected(d)&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.isProtected(c)||this.setCell(c,l),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,l),d<this.length&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d,0,1,l);c<d&&c<this.length;)this.setCell(c++,l)}resize(c,d){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let l=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{let u=new Uint32Array(l);u.set(this._data),this._data=u}for(let u=this.length;u<c;++u)this.setCell(u,d)}else{this._data=this._data.subarray(0,l);let u=Object.keys(this._combined);for(let C=0;C<u.length;C++){let w=parseInt(u[C],10);w>=c&&delete this._combined[w]}let v=Object.keys(this._extendedAttrs);for(let C=0;C<v.length;C++){let w=parseInt(v[C],10);w>=c&&delete this._extendedAttrs[w]}}return this.length=c,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let c=new Uint32Array(this._data.length);return c.set(this._data),this._data=c,1}return 0}fill(c,d=!1){if(d)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,c);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,c)}}copyFrom(c){this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={};for(let d in c._combined)this._combined[d]=c._combined[d];this._extendedAttrs={};for(let d in c._extendedAttrs)this._extendedAttrs[d]=c._extendedAttrs[d];this.isWrapped=c.isWrapped}clone(){let c=new S(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let d in this._combined)c._combined[d]=this._combined[d];for(let d in this._extendedAttrs)c._extendedAttrs[d]=this._extendedAttrs[d];return c.isWrapped=this.isWrapped,c}getTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0}getNoBgTrimmedLength(){for(let c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0]||50331648&this._data[3*c+2])return c+(this._data[3*c+0]>>22);return 0}copyCellsFrom(c,d,l,u,v){let C=c._data;if(v)for(let y=u-1;y>=0;y--){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}else for(let y=0;y<u;y++){for(let m=0;m<3;m++)this._data[3*(l+y)+m]=C[3*(d+y)+m];268435456&C[3*(d+y)+2]&&(this._extendedAttrs[l+y]=c._extendedAttrs[d+y])}let w=Object.keys(c._combined);for(let y=0;y<w.length;y++){let m=parseInt(w[y],10);m>=d&&(this._combined[m-d+l]=c._combined[m])}}translateToString(c,d,l,u){d=d??0,l=l??this.length,c&&(l=Math.min(l,this.getTrimmedLength())),u&&(u.length=0);let v="";for(;d<l;){let C=this._data[3*d+0],w=2097151&C,y=2097152&C?this._combined[d]:w?(0,_.stringFromCodePoint)(w):n.WHITESPACE_CELL_CHAR;if(v+=y,u)for(let m=0;m<y.length;++m)u.push(d);d+=C>>22||1}return u&&u.push(d),v}}r.BufferLine=S},4841:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(s,a){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return a*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}},4634:(h,r)=>{function s(a,f,n){if(f===a.length-1)return a[f].getTrimmedLength();let _=!a[f].hasContent(n-1)&&a[f].getWidth(n-1)===1,g=a[f+1].getWidth(0)===2;return _&&g?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(a,f,n,_,g){let S=[];for(let p=0;p<a.length-1;p++){let c=p,d=a.get(++c);if(!d.isWrapped)continue;let l=[a.get(p)];for(;c<a.length&&d.isWrapped;)l.push(d),d=a.get(++c);if(_>=p&&_<c){p+=l.length-1;continue}let u=0,v=s(l,u,f),C=1,w=0;for(;C<l.length;){let m=s(l,C,f),x=m-w,T=n-v,I=Math.min(x,T);l[u].copyCellsFrom(l[C],w,v,I,!1),v+=I,v===n&&(u++,v=0),w+=I,w===m&&(C++,w=0),v===0&&u!==0&&l[u-1].getWidth(n-1)===2&&(l[u].copyCellsFrom(l[u-1],n-1,v++,1,!1),l[u-1].setCell(n-1,g))}l[u].replaceCells(v,n,g);let y=0;for(let m=l.length-1;m>0&&(m>u||l[m].getTrimmedLength()===0);m--)y++;y>0&&(S.push(p+l.length-y),S.push(y)),p+=l.length-1}return S},r.reflowLargerCreateNewLayout=function(a,f){let n=[],_=0,g=f[_],S=0;for(let p=0;p<a.length;p++)if(g===p){let c=f[++_];a.onDeleteEmitter.fire({index:p-S,amount:c}),p+=c-1,S+=c,g=f[++_]}else n.push(p);return{layout:n,countRemoved:S}},r.reflowLargerApplyNewLayout=function(a,f){let n=[];for(let _=0;_<f.length;_++)n.push(a.get(f[_]));for(let _=0;_<n.length;_++)a.set(_,n[_]);a.length=f.length},r.reflowSmallerGetNewLineLengths=function(a,f,n){let _=[],g=a.map(((d,l)=>s(a,l,f))).reduce(((d,l)=>d+l)),S=0,p=0,c=0;for(;c<g;){if(g-c<n){_.push(g-c);break}S+=n;let d=s(a,p,f);S>d&&(S-=d,p++);let l=a[p].getWidth(S-1)===2;l&&S--;let u=l?n-1:n;_.push(u),c+=u}return _},r.getWrappedLineTrimmedLength=s},5295:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;let a=s(8460),f=s(844),n=s(9092);class _ extends f.Disposable{constructor(S,p){super(),this._optionsService=S,this._bufferService=p,this._onBufferActivate=this.register(new a.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,p){this._normal.resize(S,p),this._alt.resize(S,p),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}r.BufferSet=_},511:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;let a=s(482),f=s(643),n=s(3734);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(S){let p=new _;return p.setFromCharData(S),p}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(S[f.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(S[f.CHAR_DATA_CHAR_INDEX].length===2){let c=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let d=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=d&&d<=57343?this.content=1024*(c-55296)+d-56320+65536|S[f.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=S[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[f.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=S[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(h,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:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;let a=s(8460),f=s(844);class n{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new a.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(g){return this._disposables.push(g),g}}r.Marker=n,n._nextId=1},7116:(h,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:(h,r)=>{var s,a,f;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=`
|
|
8
|
+
`,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"})(s||(r.C0=s={})),(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"})(a||(r.C1=a={})),(function(n){n.ST=`${s.ESC}\\`})(f||(r.C1_ESCAPED=f={}))},7399:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;let a=s(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:["'",'"']};r.evaluateKeyboardEvent=function(n,_,g,S){let p={type:0,cancel:!1,key:void 0},c=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=n.ctrlKey?"\b":a.C0.DEL,n.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(n.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=n.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,n.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(g?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(g?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",g||p.key!==a.C0.ESC+"[1;3A"||(p.key=a.C0.ESC+"[1;5A")):p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(n.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",g||p.key!==a.C0.ESC+"[1;3B"||(p.key=a.C0.ESC+"[1;5B")):p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(p.key=a.C0.ESC+"[2~");break;case 46:p.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:p.key=c?a.C0.ESC+"[1;"+(c+1)+"H":_?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:p.key=c?a.C0.ESC+"[1;"+(c+1)+"F":_?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:n.shiftKey?p.type=2:n.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:n.shiftKey?p.type=3:n.ctrlKey?p.key=a.C0.ESC+"[6;"+(c+1)+"~":p.key=a.C0.ESC+"[6~";break;case 112:p.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:p.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:p.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:p.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:p.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:p.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:p.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:p.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:p.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:p.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:p.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:p.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(g&&!S||!n.altKey||n.metaKey)!g||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?p.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(p.key=a.C0.US),n.key==="@"&&(p.key=a.C0.NUL)):n.keyCode===65&&(p.type=1);else{let d=f[n.keyCode],l=d?.[n.shiftKey?1:0];if(l)p.key=a.C0.ESC+l;else if(n.keyCode>=65&&n.keyCode<=90){let u=n.ctrlKey?n.keyCode-64:n.keyCode+32,v=String.fromCharCode(u);n.shiftKey&&(v=v.toUpperCase()),p.key=a.C0.ESC+v}else if(n.keyCode===32)p.key=a.C0.ESC+(n.ctrlKey?a.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let u=n.code.slice(3,4);n.shiftKey||(u=u.toLowerCase()),p.key=a.C0.ESC+u,p.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?p.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?p.key=a.C0.NUL:n.keyCode>=51&&n.keyCode<=55?p.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?p.key=a.C0.DEL:n.keyCode===219?p.key=a.C0.ESC:n.keyCode===220?p.key=a.C0.FS:n.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(s){return s>65535?(s-=65536,String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)},r.utf32ToString=function(s,a=0,f=s.length){let n="";for(let _=a;_<f;++_){let g=s[_];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(s,a){let f=s.length;if(!f)return 0;let n=0,_=0;if(this._interim){let g=s.charCodeAt(_++);56320<=g&&g<=57343?a[n++]=1024*(this._interim-55296)+g-56320+65536:(a[n++]=this._interim,a[n++]=g),this._interim=0}for(let g=_;g<f;++g){let S=s.charCodeAt(g);if(55296<=S&&S<=56319){if(++g>=f)return this._interim=S,n;let p=s.charCodeAt(g);56320<=p&&p<=57343?a[n++]=1024*(S-55296)+p-56320+65536:(a[n++]=S,a[n++]=p)}else S!==65279&&(a[n++]=S)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(s,a){let f=s.length;if(!f)return 0;let n,_,g,S,p=0,c=0,d=0;if(this.interim[0]){let v=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,y=0;for(;(w=63&this.interim[++y])&&y<4;)C<<=6,C|=w;let m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=m-y;for(;d<x;){if(d>=f)return 0;if(w=s[d++],(192&w)!=128){d--,v=!0;break}this.interim[y++]=w,C<<=6,C|=63&w}v||(m===2?C<128?d--:a[p++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(a[p++]=C):C<65536||C>1114111||(a[p++]=C)),this.interim.fill(0)}let l=f-4,u=d;for(;u<f;){for(;!(!(u<l)||128&(n=s[u])||128&(_=s[u+1])||128&(g=s[u+2])||128&(S=s[u+3]));)a[p++]=n,a[p++]=_,a[p++]=g,a[p++]=S,u+=4;if(n=s[u++],n<128)a[p++]=n;else if((224&n)==192){if(u>=f)return this.interim[0]=n,p;if(_=s[u++],(192&_)!=128){u--;continue}if(c=(31&n)<<6|63&_,c<128){u--;continue}a[p++]=c}else if((240&n)==224){if(u>=f)return this.interim[0]=n,p;if(_=s[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,p;if(g=s[u++],(192&g)!=128){u--;continue}if(c=(15&n)<<12|(63&_)<<6|63&g,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&n)==240){if(u>=f)return this.interim[0]=n,p;if(_=s[u++],(192&_)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,p;if(g=s[u++],(192&g)!=128){u--;continue}if(u>=f)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,p;if(S=s[u++],(192&S)!=128){u--;continue}if(c=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&S,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;let a=s(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]],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]],_;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let g=0;g<f.length;++g)_.fill(0,f[g][0],f[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?_[g]:(function(S,p){let c,d=0,l=p.length-1;if(S<p[0][0]||S>p[l][1])return!1;for(;l>=d;)if(c=d+l>>1,S>p[c][1])d=c+1;else{if(!(S<p[c][0]))return!0;l=c-1}return!1})(g,n)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,S){let p=this.wcwidth(g),c=p===0&&S!==0;if(c){let d=a.UnicodeService.extractWidth(S);d===0?c=!1:d>p&&(p=d)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;let a=s(8460),f=s(844);class n extends f.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let p;for(this._isSyncWriting=!0;p=this._writeBuffer.shift();){this._action(p);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,S){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+=g.length,this._writeBuffer.push(g),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(S)}_innerWrite(g=0,S=!0){let p=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],d=this._action(c,S);if(d){let u=v=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(p,v);return void d.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(u)}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-p>=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:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;let s=/^([\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})$/,a=/^[\da-f]+$/;function f(n,_){let g=n.toString(16),S=g.length<2?"0"+g:g;switch(_){case 4:return g[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}r.parseColor=function(n){if(!n)return;let _=n.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let g=s.exec(_);if(g){let S=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/S*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/S*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/S*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let g=_.length/3,S=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(g*p,g*p+g),16);S[p]=g===1?c<<4:g===2?c:g===3?c>>4:c>>8}return S}},r.toRgbString=function(n,_=16){let[g,S,p]=n;return`rgb:${f(g,_)}/${f(S,_)}/${f(p,_)}`}},5770:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;let a=s(482),f=s(8742),n=s(5770),_=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(S,p){this._handlers[S]===void 0&&(this._handlers[S]=[]);let c=this._handlers[S];return c.push(p),{dispose:()=>{let d=c.indexOf(p);d!==-1&&c.splice(d,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(S,p){if(this.reset(),this._ident=S,this._active=this._handlers[S]||_,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(p);else this._handlerFb(this._ident,"HOOK",p)}put(S,p,c){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(S,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(S,p,c))}unhook(S,p=!0){if(this._active.length){let c=!1,d=this._active.length-1,l=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,c=p,l=this._stack.fallThrough,this._stack.paused=!1),!l&&c===!1){for(;d>=0&&(c=this._active[d].unhook(S),c!==!0);d--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,c;d--}for(;d>=0;d--)if(c=this._active[d].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",S);this._active=_,this._ident=0}};let g=new f.Params;g.addParam(0),r.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=g,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():g,this._data="",this._hitLimit=!1}put(S,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(S,p,c),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let p=!1;if(this._hitLimit)p=!1;else if(S&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=g,this._data="",this._hitLimit=!1,c)));return this._params=g,this._data="",this._hitLimit=!1,p}}},2015:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;let a=s(844),f=s(8742),n=s(6242),_=s(6351);class g{constructor(d){this.table=new Uint8Array(d)}setDefault(d,l){this.table.fill(d<<4|l)}add(d,l,u,v){this.table[l<<8|d]=u<<4|v}addMany(d,l,u,v){for(let C=0;C<d.length;C++)this.table[l<<8|d[C]]=u<<4|v}}r.TransitionTable=g;let S=160;r.VT500_TRANSITION_TABLE=(function(){let c=new g(4095),d=Array.apply(null,Array(256)).map(((y,m)=>m)),l=(y,m)=>d.slice(y,m),u=l(32,127),v=l(0,24);v.push(25),v.push.apply(v,l(28,32));let C=l(0,14),w;for(w in c.setDefault(1,0),c.addMany(u,0,2,0),C)c.addMany([24,26,153,154],w,3,0),c.addMany(l(128,144),w,3,0),c.addMany(l(144,152),w,3,0),c.add(156,w,0,0),c.add(27,w,11,1),c.add(157,w,4,8),c.addMany([152,158,159],w,0,7),c.add(155,w,11,3),c.add(144,w,11,9);return c.addMany(v,0,3,0),c.addMany(v,1,3,1),c.add(127,1,0,1),c.addMany(v,8,0,8),c.addMany(v,3,3,3),c.add(127,3,0,3),c.addMany(v,4,3,4),c.add(127,4,0,4),c.addMany(v,6,3,6),c.addMany(v,5,3,5),c.add(127,5,0,5),c.addMany(v,2,3,2),c.add(127,2,0,2),c.add(93,1,4,8),c.addMany(u,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(l(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(u,7,0,7),c.addMany(v,7,0,7),c.add(156,7,0,0),c.add(127,7,0,7),c.add(91,1,11,3),c.addMany(l(64,127),3,7,0),c.addMany(l(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(l(48,60),4,8,4),c.addMany(l(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(l(32,64),6,0,6),c.add(127,6,0,6),c.addMany(l(64,127),6,0,0),c.addMany(l(32,48),3,9,5),c.addMany(l(32,48),5,9,5),c.addMany(l(48,64),5,0,6),c.addMany(l(64,127),5,7,0),c.addMany(l(32,48),4,9,5),c.addMany(l(32,48),1,9,2),c.addMany(l(32,48),2,9,2),c.addMany(l(48,127),2,10,0),c.addMany(l(48,80),1,10,0),c.addMany(l(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(l(96,127),1,10,0),c.add(80,1,11,9),c.addMany(v,9,0,9),c.add(127,9,0,9),c.addMany(l(28,32),9,0,9),c.addMany(l(32,48),9,9,12),c.addMany(l(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(v,11,0,11),c.addMany(l(32,128),11,0,11),c.addMany(l(28,32),11,0,11),c.addMany(v,10,0,10),c.add(127,10,0,10),c.addMany(l(28,32),10,0,10),c.addMany(l(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(l(32,48),10,9,12),c.addMany(v,12,0,12),c.add(127,12,0,12),c.addMany(l(28,32),12,0,12),c.addMany(l(32,48),12,9,12),c.addMany(l(48,64),12,0,11),c.addMany(l(64,127),12,12,13),c.addMany(l(64,127),10,12,13),c.addMany(l(64,127),9,12,13),c.addMany(v,13,13,13),c.addMany(u,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(S,0,2,0),c.add(S,8,5,8),c.add(S,6,0,6),c.add(S,11,0,11),c.add(S,13,13,13),c})();class p extends a.Disposable{constructor(d=r.VT500_TRANSITION_TABLE){super(),this._transitions=d,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=(l,u,v)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,u)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,a.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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(d,l=[64,126]){let u=0;if(d.prefix){if(d.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=d.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(d.intermediates){if(d.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<d.intermediates.length;++C){let w=d.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=w}}if(d.final.length!==1)throw new Error("final must be a single byte");let v=d.final.charCodeAt(0);if(l[0]>v||v>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return u<<=8,u|=v,u}identToString(d){let l=[];for(;d;)l.push(String.fromCharCode(255&d)),d>>=8;return l.reverse().join("")}setPrintHandler(d){this._printHandler=d}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(d,l){let u=this._identifier(d,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);let v=this._escHandlers[u];return v.push(l),{dispose:()=>{let C=v.indexOf(l);C!==-1&&v.splice(C,1)}}}clearEscHandler(d){this._escHandlers[this._identifier(d,[48,126])]&&delete this._escHandlers[this._identifier(d,[48,126])]}setEscHandlerFallback(d){this._escHandlerFb=d}setExecuteHandler(d,l){this._executeHandlers[d.charCodeAt(0)]=l}clearExecuteHandler(d){this._executeHandlers[d.charCodeAt(0)]&&delete this._executeHandlers[d.charCodeAt(0)]}setExecuteHandlerFallback(d){this._executeHandlerFb=d}registerCsiHandler(d,l){let u=this._identifier(d);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);let v=this._csiHandlers[u];return v.push(l),{dispose:()=>{let C=v.indexOf(l);C!==-1&&v.splice(C,1)}}}clearCsiHandler(d){this._csiHandlers[this._identifier(d)]&&delete this._csiHandlers[this._identifier(d)]}setCsiHandlerFallback(d){this._csiHandlerFb=d}registerDcsHandler(d,l){return this._dcsParser.registerHandler(this._identifier(d),l)}clearDcsHandler(d){this._dcsParser.clearHandler(this._identifier(d))}setDcsHandlerFallback(d){this._dcsParser.setHandlerFallback(d)}registerOscHandler(d,l){return this._oscParser.registerHandler(d,l)}clearOscHandler(d){this._oscParser.clearHandler(d)}setOscHandlerFallback(d){this._oscParser.setHandlerFallback(d)}setErrorHandler(d){this._errorHandler=d}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(d,l,u,v,C){this._parseStack.state=d,this._parseStack.handlers=l,this._parseStack.handlerPos=u,this._parseStack.transition=v,this._parseStack.chunkPos=C}parse(d,l,u){let v,C=0,w=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let m=this._parseStack.handlers,x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](this._params),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 4:if(u===!1&&x>-1){for(;x>=0&&(v=m[x](),v!==!0);x--)if(v instanceof Promise)return this._parseStack.handlerPos=x,v}this._parseStack.handlers=[];break;case 6:if(C=d[this._parseStack.chunkPos],v=this._dcsParser.unhook(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=d[this._parseStack.chunkPos],v=this._oscParser.end(C!==24&&C!==26,u),v)return v;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let m=y;m<l;++m){switch(C=d[m],w=this._transitions.table[this.currentState<<8|(C<160?C:S)],w>>4){case 2:for(let R=m+1;;++R){if(R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}if(++R>=l||(C=d[R])<32||C>126&&C<S){this._printHandler(d,m,R),m=R-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:m,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let x=this._csiHandlers[this._collect<<8|C],T=x?x.length-1:-1;for(;T>=0&&(v=x[T](this._params),v!==!0);T--)if(v instanceof Promise)return this._preserveStack(3,x,T,w,m),v;T<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++m<l&&(C=d[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:let I=this._escHandlers[this._collect<<8|C],F=I?I.length-1:-1;for(;F>=0&&(v=I[F](),v!==!0);F--)if(v instanceof Promise)return this._preserveStack(4,I,F,w,m),v;F<0&&this._escHandlerFb(this._collect<<8|C),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|C,this._params);break;case 13:for(let R=m+1;;++R)if(R>=l||(C=d[R])===24||C===26||C===27||C>127&&C<S){this._dcsParser.put(d,m,R),m=R-1;break}break;case 14:if(v=this._dcsParser.unhook(C!==24&&C!==26),v)return this._preserveStack(6,[],0,w,m),v;C===27&&(w|=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 R=m+1;;R++)if(R>=l||(C=d[R])<32||C>127&&C<S){this._oscParser.put(d,m,R),m=R-1;break}break;case 6:if(v=this._oscParser.end(C!==24&&C!==26),v)return this._preserveStack(5,[],0,w,m),v;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}r.EscapeSequenceParser=p},6242:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;let a=s(5770),f=s(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(_,g){this._handlers[_]===void 0&&(this._handlers[_]=[]);let S=this._handlers[_];return S.push(g),{dispose:()=>{let p=S.indexOf(g);p!==-1&&S.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].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 _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,g,S){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,g,S);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(_,g,S))}start(){this.reset(),this._state=1}put(_,g,S){if(this._state!==3){if(this._state===1)for(;g<S;){let p=_[g++];if(p===59){this._state=2,this._start();break}if(p<48||57<p)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+p-48}this._state===2&&S-g>0&&this._put(_,g,S)}}end(_,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,S=g,c=this._stack.fallThrough,this._stack.paused=!1),!c&&S===!1){for(;p>=0&&(S=this._active[p].end(_),S!==!0);p--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,S;p--}for(;p>=0;p--)if(S=this._active[p].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",_);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,g,S){this._hitLimit||(this._data+=(0,f.utf32ToString)(_,g,S),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let g=!1;if(this._hitLimit)g=!1;else if(_&&(g=this._handler(this._data),g instanceof Promise))return g.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,g}}},8742:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;let s=2147483647;class a{static fromArray(n){let _=new a;if(!n.length)return _;for(let g=Array.isArray(n[0])?1:0;g<n.length;++g){let S=n[g];if(Array.isArray(S))for(let p=0;p<S.length;++p)_.addSubParam(S[p]);else _.addParam(S)}return _}constructor(n=32,_=32){if(this.maxLength=n,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let n=new a(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 _=0;_<this.length;++_){n.push(this.params[_]);let g=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-g>0&&n.push(Array.prototype.slice.call(this._subParams,g,S))}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>s?s: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>s?s:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let _=this._subParamsIdx[n]>>8,g=255&this._subParamsIdx[n];return g-_>0?this._subParams.subarray(_,g):null}getSubParamsAll(){let n={};for(let _=0;_<this.length;++_){let g=this._subParamsIdx[_]>>8,S=255&this._subParamsIdx[_];S-g>0&&(n[_]=this._subParams.slice(g,S))}return n}addDigit(n){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let g=this._digitIsSub?this._subParams:this.params,S=g[_-1];g[_-1]=~S?Math.min(10*S+n,s):n}}r.Params=a},5741:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let s=this._addons.length-1;s>=0;s--)this._addons[s].instance.dispose()}loadAddon(s,a){let f={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(f),a.dispose=()=>this._wrappedAddonDispose(f),a.activate(s)}_wrappedAddonDispose(s){if(s.isDisposed)return;let a=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===s){a=f;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");s.isDisposed=!0,s.dispose.apply(s.instance),this._addons.splice(a,1)}}},8771:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;let a=s(3785),f=s(511);r.BufferApiView=class{constructor(n,_){this._buffer=n,this.type=_}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 _=this._buffer.lines.get(n);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new f.CellData}}},3785:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;let a=s(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,n){if(!(f<0||f>=this._line.length))return n?(this._line.loadCell(f,n),n):this._line.loadCell(f,new a.CellData)}translateToString(f,n,_){return this._line.translateToString(f,n,_)}}},8285:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;let a=s(8771),f=s(8460),n=s(844);class _ extends n.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new a.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new a.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=_},7975:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(s){this._core=s}registerCsiHandler(s,a){return this._core.registerCsiHandler(s,(f=>a(f.toArray())))}addCsiHandler(s,a){return this.registerCsiHandler(s,a)}registerDcsHandler(s,a){return this._core.registerDcsHandler(s,((f,n)=>a(f,n.toArray())))}addDcsHandler(s,a){return this.registerDcsHandler(s,a)}registerEscHandler(s,a){return this._core.registerEscHandler(s,a)}addEscHandler(s,a){return this.registerEscHandler(s,a)}registerOscHandler(s,a){return this._core.registerOscHandler(s,a)}addOscHandler(s,a){return this.registerOscHandler(s,a)}}},7090:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(s){this._core=s}register(s){this._core.unicodeService.register(s)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(s){this._core.unicodeService.activeVersion=s}}},744:function(h,r,s){var a=this&&this.__decorate||function(c,d,l,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(v=c[y])&&(w=(C<3?v(w):C>3?v(d,l,w):v(d,l))||w);return C>3&&w&&Object.defineProperty(d,l,w),w},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;let n=s(8460),_=s(844),g=s(5295),S=s(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let p=r.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(c){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(c.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(c.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(c,this))}resize(c,d){this.cols=c,this.rows=d,this.buffers.resize(c,d),this._onResize.fire({cols:c,rows:d})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,d=!1){let l=this.buffer,u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===c.fg&&u.getBg(0)===c.bg||(u=l.getBlankLine(c,d),this._cachedBlankLine=u),u.isWrapped=d;let v=l.ybase+l.scrollTop,C=l.ybase+l.scrollBottom;if(l.scrollTop===0){let w=l.lines.isFull;C===l.lines.length-1?w?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(C+1,0,u.clone()),w?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{let w=C-v+1;l.lines.shiftElements(v+1,w-1,-1),l.lines.set(C,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(c,d,l){let u=this.buffer;if(c<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else c+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);let v=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+c,u.ybase),0),v!==u.ydisp&&(d||this._onScroll.fire(u.ydisp))}};r.BufferService=p=a([f(0,S.IOptionsService)],p)},7994:(h,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(s){this.glevel=s,this.charset=this._charsets[s]}setgCharset(s,a){this._charsets[s]=a,this.glevel===s&&(this.charset=a)}}},1753:function(h,r,s){var a=this&&this.__decorate||function(u,v,C,w){var y,m=arguments.length,x=m<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,v,C,w);else for(var T=u.length-1;T>=0;T--)(y=u[T])&&(x=(m<3?y(x):m>3?y(v,C,x):y(v,C))||x);return m>3&&x&&Object.defineProperty(v,C,x),x},f=this&&this.__param||function(u,v){return function(C,w){v(C,w,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;let n=s(2585),_=s(8460),g=s(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function p(u,v){let C=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(C|=64,C|=u.action):(C|=3&u.button,4&u.button&&(C|=64),8&u.button&&(C|=128),u.action===32?C|=32:u.action!==0||v||(C|=3)),C}let c=String.fromCharCode,d={DEFAULT:u=>{let v=[p(u,!1)+32,u.col+32,u.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.col};${u.row}${v}`},SGR_PIXELS:u=>{let v=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${p(u,!0)};${u.x};${u.y}${v}`}},l=r.CoreMouseService=class extends g.Disposable{constructor(u,v){super(),this._bufferService=u,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let C of Object.keys(S))this.addProtocol(C,S[C]);for(let C of Object.keys(d))this.addEncoding(C,d[C]);this.reset()}addProtocol(u,v){this._protocols[u]=v}addEncoding(u,v){this._encodings[u]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;let v=this._encodings[this._activeEncoding](u);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,v,C){if(C){if(u.x!==v.x||u.y!==v.y)return!1}else if(u.col!==v.col||u.row!==v.row)return!1;return u.button===v.button&&u.action===v.action&&u.ctrl===v.ctrl&&u.alt===v.alt&&u.shift===v.shift}};r.CoreMouseService=l=a([f(0,n.IBufferService),f(1,n.ICoreService)],l)},6975:function(h,r,s){var a=this&&this.__decorate||function(l,u,v,C){var w,y=arguments.length,m=y<3?u:C===null?C=Object.getOwnPropertyDescriptor(u,v):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(l,u,v,C);else for(var x=l.length-1;x>=0;x--)(w=l[x])&&(m=(y<3?w(m):y>3?w(u,v,m):w(u,v))||m);return y>3&&m&&Object.defineProperty(u,v,m),m},f=this&&this.__param||function(l,u){return function(v,C){u(v,C,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;let n=s(1439),_=s(8460),g=s(844),S=s(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=r.CoreService=class extends g.Disposable{constructor(l,u,v){super(),this._bufferService=l,this._logService=u,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}reset(){this.modes=(0,n.clone)(p),this.decPrivateModes=(0,n.clone)(c)}triggerDataEvent(l,u=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(l))}};r.CoreService=d=a([f(0,S.IBufferService),f(1,S.ILogService),f(2,S.IOptionsService)],d)},9074:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;let a=s(8055),f=s(8460),n=s(844),_=s(6106),g=0,S=0;class p extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((l=>l?.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,n.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;let u=new c(l);if(u){let v=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),v.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(let l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,u,v){let C=0,w=0;for(let y of this._decorations.getKeyIterator(u))C=y.options.x??0,w=C+(y.options.width??1),l>=C&&l<w&&(!v||(y.options.layer??"bottom")===v)&&(yield y)}forEachDecorationAtCell(l,u,v,C){this._decorations.forEachByKey(u,(w=>{g=w.options.x??0,S=g+(w.options.width??1),l>=g&&l<S&&(!v||(w.options.layer??"bottom")===v)&&C(w)}))}}r.DecorationService=p;class c extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=a.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=a.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,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=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;let a=s(2585),f=s(8343);class n{constructor(...g){this._entries=new Map;for(let[S,p]of g)this.set(S,p)}set(g,S){let p=this._entries.get(g);return this._entries.set(g,S),p}forEach(g){for(let[S,p]of this._entries.entries())g(S,p)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(a.IInstantiationService,this)}setService(_,g){this._services.set(_,g)}getService(_){return this._services.get(_)}createInstance(_,...g){let S=(0,f.getServiceDependencies)(_).sort(((d,l)=>d.index-l.index)),p=[];for(let d of S){let l=this._services.get(d.id);if(!l)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${d.id}.`);p.push(l)}let c=S.length>0?S[0].index:g.length;if(g.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${g.length} static arguments`);return new _(...g,...p)}}},7866:function(h,r,s){var a=this&&this.__decorate||function(c,d,l,u){var v,C=arguments.length,w=C<3?d:u===null?u=Object.getOwnPropertyDescriptor(d,l):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(c,d,l,u);else for(var y=c.length-1;y>=0;y--)(v=c[y])&&(w=(C<3?v(w):C>3?v(d,l,w):v(d,l))||w);return C>3&&w&&Object.defineProperty(d,l,w),w},f=this&&this.__param||function(c,d){return function(l,u){d(l,u,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;let n=s(844),_=s(2585),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},S,p=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let d=0;d<c.length;d++)typeof c[d]=="function"&&(c[d]=c[d]())}_log(c,d,l){this._evalLazyOptionalParams(l),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+d,...l)}trace(c,...d){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,d)}debug(c,...d){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,d)}info(c,...d){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,d)}warn(c,...d){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,d)}error(c,...d){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,d)}};r.LogService=p=a([f(0,_.IOptionsService)],p),r.setTraceLogger=function(c){S=c},r.traceCall=function(c,d,l){if(typeof l.value!="function")throw new Error("not supported");let u=l.value;l.value=function(...v){if(S.logLevel!==_.LogLevelEnum.TRACE)return u.apply(this,v);S.trace(`GlyphRenderer#${u.name}(${v.map((w=>JSON.stringify(w))).join(", ")})`);let C=u.apply(this,v);return S.trace(`GlyphRenderer#${u.name} return`,C),C}}},7302:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;let a=s(8460),f=s(844),n=s(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 _=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends f.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...r.DEFAULT_OPTIONS};for(let d in p)if(d in c)try{let l=p[d];c[d]=this._sanitizeAndValidateOption(d,l)}catch(l){console.error(l)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((d=>{d===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((d=>{p.indexOf(d)!==-1&&c()}))}_setupOptions(){let p=d=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);return this.rawOptions[d]},c=(d,l)=>{if(!(d in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${d}"`);l=this._sanitizeAndValidateOption(d,l),this.rawOptions[d]!==l&&(this.rawOptions[d]=l,this._onOptionChange.fire(d))};for(let d in this.rawOptions){let l={get:p.bind(this,d),set:c.bind(this,d)};Object.defineProperty(this.options,d,l)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=r.DEFAULT_OPTIONS[p]),!(function(d){return d==="block"||d==="underline"||d==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${p}`);break;case"wordSeparator":c||(c=r.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=_.includes(c)?c:r.DEFAULT_OPTIONS[p];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${p} cannot be less than 1, value: ${c}`);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(`${p} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${p} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${p} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}r.OptionsService=g},2660:function(h,r,s){var a=this&&this.__decorate||function(g,S,p,c){var d,l=arguments.length,u=l<3?S:c===null?c=Object.getOwnPropertyDescriptor(S,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(g,S,p,c);else for(var v=g.length-1;v>=0;v--)(d=g[v])&&(u=(l<3?d(u):l>3?d(S,p,u):d(S,p))||u);return l>3&&u&&Object.defineProperty(S,p,u),u},f=this&&this.__param||function(g,S){return function(p,c){S(p,c,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;let n=s(2585),_=r.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){let S=this._bufferService.buffer;if(g.id===void 0){let v=S.addMarker(S.ybase+S.y),C={data:g,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(C,v))),this._dataByLinkId.set(C.id,C),C.id}let p=g,c=this._getEntryIdKey(p),d=this._entriesWithId.get(c);if(d)return this.addLineToLink(d.id,S.ybase+S.y),d.id;let l=S.addMarker(S.ybase+S.y),u={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(u,l))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(g,S){let p=this._dataByLinkId.get(g);if(p&&p.lines.every((c=>c.line!==S))){let c=this._bufferService.buffer.addMarker(S);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(g){return this._dataByLinkId.get(g)?.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,S){let p=g.lines.indexOf(S);p!==-1&&(g.lines.splice(p,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};r.OscLinkService=_=a([f(0,n.IBufferService)],_)},8343:(h,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;let s="di$target",a="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[a]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);let n=function(_,g,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,d){c[s]===c?c[a].push({id:p,index:d}):(c[a]=[{id:p,index:d}],c[s]=c)})(n,_,S)};return n.toString=()=>f,r.serviceRegistry.set(f,n),n}},2585:(h,r,s)=>{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 a=s(8343);var f;r.IBufferService=(0,a.createDecorator)("BufferService"),r.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),r.ICoreService=(0,a.createDecorator)("CoreService"),r.ICharsetService=(0,a.createDecorator)("CharsetService"),r.IInstantiationService=(0,a.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"})(f||(r.LogLevelEnum=f={})),r.ILogService=(0,a.createDecorator)("LogService"),r.IOptionsService=(0,a.createDecorator)("OptionsService"),r.IOscLinkService=(0,a.createDecorator)("OscLinkService"),r.IUnicodeService=(0,a.createDecorator)("UnicodeService"),r.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(h,r,s)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;let a=s(8460),f=s(225);class n{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,S,p=!1){return(16777215&g)<<3|(3&S)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let g=new f.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let S=0,p=0,c=g.length;for(let d=0;d<c;++d){let l=g.charCodeAt(d);if(55296<=l&&l<=56319){if(++d>=c)return S+this.wcwidth(l);let C=g.charCodeAt(d);56320<=C&&C<=57343?l=1024*(l-55296)+C-56320+65536:S+=this.wcwidth(C)}let u=this.charProperties(l,p),v=n.extractWidth(u);n.extractShouldJoin(u)&&(v-=n.extractWidth(p)),S+=v,p=u}return S}charProperties(g,S){return this._activeProvider.charProperties(g,S)}}r.UnicodeService=n}},t={};function i(h){var r=t[h];if(r!==void 0)return r.exports;var s=t[h]={exports:{}};return e[h].call(s.exports,s,s.exports,i),s.exports}var o={};return(()=>{var h=o;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;let r=i(9042),s=i(3236),a=i(844),f=i(5741),n=i(8285),_=i(7975),g=i(7090),S=["cols","rows"];class p extends a.Disposable{constructor(d){super(),this._core=this.register(new s.Terminal(d)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};let l=v=>this._core.options[v],u=(v,C)=>{this._checkReadonlyOptions(v),this._core.options[v]=C};for(let v in this._core.options){let C={get:l.bind(this,v),set:u.bind(this,v)};Object.defineProperty(this._publicOptions,v,C)}}_checkReadonlyOptions(d){if(S.includes(d))throw new Error(`Option "${d}" 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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.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 d=this._core.coreService.decPrivateModes,l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:d.applicationCursorKeys,applicationKeypadMode:d.applicationKeypad,bracketedPasteMode:d.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:d.origin,reverseWraparoundMode:d.reverseWraparound,sendFocusMode:d.sendFocus,wraparoundMode:d.wraparound}}get options(){return this._publicOptions}set options(d){for(let l in d)this._publicOptions[l]=d[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(d,l=!0){this._core.input(d,l)}resize(d,l){this._verifyIntegers(d,l),this._core.resize(d,l)}open(d){this._core.open(d)}attachCustomKeyEventHandler(d){this._core.attachCustomKeyEventHandler(d)}attachCustomWheelEventHandler(d){this._core.attachCustomWheelEventHandler(d)}registerLinkProvider(d){return this._core.registerLinkProvider(d)}registerCharacterJoiner(d){return this._checkProposedApi(),this._core.registerCharacterJoiner(d)}deregisterCharacterJoiner(d){this._checkProposedApi(),this._core.deregisterCharacterJoiner(d)}registerMarker(d=0){return this._verifyIntegers(d),this._core.registerMarker(d)}registerDecoration(d){return this._checkProposedApi(),this._verifyPositiveIntegers(d.x??0,d.width??0,d.height??0),this._core.registerDecoration(d)}hasSelection(){return this._core.hasSelection()}select(d,l,u){this._verifyIntegers(d,l,u),this._core.select(d,l,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(d,l){this._verifyIntegers(d,l),this._core.selectLines(d,l)}dispose(){super.dispose()}scrollLines(d){this._verifyIntegers(d),this._core.scrollLines(d)}scrollPages(d){this._verifyIntegers(d),this._core.scrollPages(d)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(d){this._verifyIntegers(d),this._core.scrollToLine(d)}clear(){this._core.clear()}write(d,l){this._core.write(d,l)}writeln(d,l){this._core.write(d),this._core.write(`\r
|
|
9
|
+
`,l)}paste(d){this._core.paste(d)}refresh(d,l){this._verifyIntegers(d,l),this._core.refresh(d,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(d){this._addonManager.loadAddon(this,d)}static get strings(){return r}_verifyIntegers(...d){for(let l of d)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...d){for(let l of d)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}h.Terminal=p})(),o})()))});var en=Xs((Oi,Ar)=>{(function(e,t){typeof Oi=="object"&&typeof Ar=="object"?Ar.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Oi=="object"?Oi.FitAddon=t():e.FitAddon=t()})(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){let i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;let o=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(o._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let i=this._terminal._core,o=i._renderService.dimensions;if(o.css.cell.width===0||o.css.cell.height===0)return;let h=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),n=s-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),_=a-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(_/o.css.cell.width)),rows:Math.max(1,Math.floor(n/o.css.cell.height))}}}})(),e})()))});var oa=Js(Qs(),1),aa=Js(en(),1);var Va=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?tn.isErrorNoTelemetry(e)?new tn(e.message+`
|
|
10
10
|
|
|
11
11
|
`+e.stack):new Error(e.message+`
|
|
12
12
|
|
|
13
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},
|
|
14
|
-
`).map(
|
|
15
|
-
`),f)}o.sort(
|
|
16
|
-
`)).size}/${o.length} leaks) at ${S}`;let p=
|
|
17
|
-
`)),c=
|
|
13
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Ya=new Va;function Dr(e){Xa(e)||Ya.onUnexpectedError(e)}var Or="Canceled";function Xa(e){return e instanceof Ja?!0:e instanceof Error&&e.name===Or&&e.message===Or}var Ja=class extends Error{constructor(){super(Or),this.name=this.message}},tn=class Ir extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ir)return t;let i=new Ir;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Za(e,t,i=0,o=e.length){let h=i,r=o;for(;h<r;){let s=Math.floor((h+r)/2);t(e[s])?h=s+1:r=s}return h-1}var Qa=class _n{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(_n.assertInvariants){if(this._prevFindLastPredicate){for(let o of this._array)if(this._prevFindLastPredicate(o)&&!t(o))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Za(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Qa.assertInvariants=!1;var Nr;(e=>{function t(r){return r<0}e.isLessThan=t;function i(r){return r<=0}e.isLessThanOrEqual=i;function o(r){return r>0}e.isGreaterThan=o;function h(r){return r===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Nr||(Nr={}));function el(e,t){return(i,o)=>t(e(i),e(o))}var tl=(e,t)=>e-t,rn=class Hr{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new Hr(i=>this.iterate(o=>t(o)?i(o):!0))}map(t){return new Hr(i=>this.iterate(o=>i(t(o))))}some(t){let i=!1;return this.iterate(o=>(i=t(o),!i)),i}findFirst(t){let i;return this.iterate(o=>t(o)?(i=o,!1):!0),i}findLast(t){let i;return this.iterate(o=>(t(o)&&(i=o),!0)),i}findLastMaxBy(t){let i,o=!0;return this.iterate(h=>((o||Nr.isGreaterThan(t(h,i)))&&(o=!1,i=h),!0)),i}};rn.empty=new rn(e=>{});function il(e,t){let i=Object.create(null);for(let o of e){let h=t(o),r=i[h];r||(r=i[h]=[]),r.push(o)}return i}var sn,nn,Qu=class{constructor(e,t){this.toKey=t,this._map=new Map,this[sn]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[(nn=Symbol.iterator,sn=Symbol.toStringTag,nn)](){return this.values()}},rl=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function sl(e,t){let i=this,o=!1,h;return function(){if(o)return h;if(o=!0,t)try{h=e.apply(i,arguments)}finally{t()}else h=e.apply(i,arguments);return h}}var Fr;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function o(){return i}e.empty=o;function*h(w){yield w}e.single=h;function r(w){return t(w)?w:h(w)}e.wrap=r;function s(w){return w||i}e.from=s;function*a(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=a;function f(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=f;function n(w){return w[Symbol.iterator]().next().value}e.first=n;function _(w,y){let m=0;for(let x of w)if(y(x,m++))return!0;return!1}e.some=_;function g(w,y){for(let m of w)if(y(m))return m}e.find=g;function*S(w,y){for(let m of w)y(m)&&(yield m)}e.filter=S;function*p(w,y){let m=0;for(let x of w)yield y(x,m++)}e.map=p;function*c(w,y){let m=0;for(let x of w)yield*y(x,m++)}e.flatMap=c;function*d(...w){for(let y of w)yield*y}e.concat=d;function l(w,y,m){let x=m;for(let T of w)x=y(x,T);return x}e.reduce=l;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let x=w[Symbol.iterator]();for(let T=0;T<y;T++){let I=x.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(Fr||(Fr={}));var nl=!1,It=null,ol=class pn{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:pn.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=new Error().stack)}setParent(t,i){let o=this.getDisposableData(t);o.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let o=i.get(t);if(o)return o;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,h),h}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let o;if(i)o=i;else{let f=new Map,n=[...this.livingDisposables.values()].filter(g=>g.source!==null&&!this.getRootParent(g,f).isSingleton);if(n.length===0)return;let _=new Set(n.map(g=>g.value));if(o=n.filter(g=>!(g.parent&&_.has(g.parent))),o.length===0)throw new Error("There are cyclic diposable chains!")}if(!o)return;function h(f){function n(g,S){for(;g.length>0&&S.some(p=>typeof p=="string"?p===g[0]:g[0].match(p));)g.shift()}let _=f.source.split(`
|
|
14
|
+
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return n(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new rl;for(let f of o){let n=h(f);for(let _=0;_<=n.length;_++)r.add(n.slice(0,_).join(`
|
|
15
|
+
`),f)}o.sort(el(f=>f.idx,tl));let s="",a=0;for(let f of o.slice(0,t)){a++;let n=h(f),_=[];for(let g=0;g<n.length;g++){let S=n[g];S=`(shared with ${r.get(n.slice(0,g+1).join(`
|
|
16
|
+
`)).size}/${o.length} leaks) at ${S}`;let p=r.get(n.slice(0,g).join(`
|
|
17
|
+
`)),c=il([...p].map(d=>h(d)[g]),d=>d);delete c[n[g]];for(let[d,l]of Object.entries(c))_.unshift(` - stacktraces of ${l.length} other leaks continue with ${d}`);_.unshift(S)}s+=`
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
==================== Leaking disposable ${a}/${o.length}: ${f.value.constructor.name} ====================
|
|
@@ -22,25 +22,25 @@ ${_.join(`
|
|
|
22
22
|
`)}
|
|
23
23
|
============================================================
|
|
24
24
|
|
|
25
|
-
`}return o.length>t&&(
|
|
25
|
+
`}return o.length>t&&(s+=`
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
... and ${o.length-t} more leaking disposables
|
|
29
29
|
|
|
30
|
-
`),{leaks:o,details:
|
|
30
|
+
`),{leaks:o,details:s}}};ol.idx=0;function al(e){It=e}if(nl){let e="__is_disposable_tracked__";al(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==qe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==qe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Ui(e){return It?.trackDisposable(e),e}function ji(e){It?.markAsDisposed(e)}function ni(e,t){It?.setParent(e,t)}function ll(e,t){if(It)for(let i of e)It.setParent(i,t)}function si(e){if(Fr.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(o){t.push(o)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function gn(...e){let t=Nt(()=>si(e));return ll(e,t),t}function Nt(e){let t=Ui({dispose:sl(()=>{ji(t),e()})});return t}var vn=class mn{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ui(this)}dispose(){this._isDisposed||(ji(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{si(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return ni(t,this),this._isDisposed?mn.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),ni(t,null))}};vn.DISABLE_DISPOSED_WARNING=!1;var Kr=vn,qe=class{constructor(){this._store=new Kr,Ui(this),ni(this._store,this)}dispose(){ji(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};qe.None=Object.freeze({dispose(){}});var $i=class{constructor(){this._isDisposed=!1,Ui(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ni(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ji(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ni(e,null),e}},on=class Wr{constructor(t){this.element=t,this.next=Wr.Undefined,this.prev=Wr.Undefined}};on.Undefined=new on(void 0);var cl=globalThis.performance&&typeof globalThis.performance.now=="function",hl=class bn{static create(t){return new bn(t)}constructor(t){this._now=cl&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},dl=!1,an=!1,ul=!1,zi;(e=>{e.None=()=>qe.None;function t(B){if(ul){let{onDidAddListener:D}=B,O=Ur.create(),P=0;B.onDidAddListener=()=>{++P===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),D?.()}}}function i(B,D){return S(B,()=>{},0,void 0,!0,void 0,D)}e.defer=i;function o(B){return(D,O=null,P)=>{let b=!1,E;return E=B(L=>{if(!b)return E?E.dispose():b=!0,D.call(O,L)},null,P),b&&E.dispose(),E}}e.once=o;function h(B,D,O){return _((P,b=null,E)=>B(L=>P.call(b,D(L)),null,E),O)}e.map=h;function r(B,D,O){return _((P,b=null,E)=>B(L=>{D(L),P.call(b,L)},null,E),O)}e.forEach=r;function s(B,D,O){return _((P,b=null,E)=>B(L=>D(L)&&P.call(b,L),null,E),O)}e.filter=s;function a(B){return B}e.signal=a;function f(...B){return(D,O=null,P)=>{let b=gn(...B.map(E=>E(L=>D.call(O,L))));return g(b,P)}}e.any=f;function n(B,D,O,P){let b=O;return h(B,E=>(b=D(b,E),b),P)}e.reduce=n;function _(B,D){let O,P={onWillAddFirstListener(){O=B(b.fire,b)},onDidRemoveLastListener(){O?.dispose()}};D||t(P);let b=new je(P);return D?.add(b),b.event}function g(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function S(B,D,O=100,P=!1,b=!1,E,L){let M,$,K,Y=0,U,A={leakWarningThreshold:E,onWillAddFirstListener(){M=B(N=>{Y++,$=D($,N),P&&!K&&(k.fire($),$=void 0),U=()=>{let H=$;$=void 0,K=void 0,(!P||Y>1)&&k.fire(H),Y=0},typeof O=="number"?(clearTimeout(K),K=setTimeout(U,O)):K===void 0&&(K=0,queueMicrotask(U))})},onWillRemoveListener(){b&&Y>0&&U?.()},onDidRemoveLastListener(){U=void 0,M.dispose()}};L||t(A);let k=new je(A);return L?.add(k),k.event}e.debounce=S;function p(B,D=0,O){return e.debounce(B,(P,b)=>P?(P.push(b),P):[b],D,void 0,!0,void 0,O)}e.accumulate=p;function c(B,D=(P,b)=>P===b,O){let P=!0,b;return s(B,E=>{let L=P||!D(E,b);return P=!1,b=E,L},O)}e.latch=c;function d(B,D,O){return[e.filter(B,D,O),e.filter(B,P=>!D(P),O)]}e.split=d;function l(B,D=!1,O=[],P){let b=O.slice(),E=B($=>{b?b.push($):M.fire($)});P&&P.add(E);let L=()=>{b?.forEach($=>M.fire($)),b=null},M=new je({onWillAddFirstListener(){E||(E=B($=>M.fire($)),P&&P.add(E))},onDidAddFirstListener(){b&&(D?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return P&&P.add(M),M.event}e.buffer=l;function u(B,D){return(O,P,b)=>{let E=D(new C);return B(function(L){let M=E.evaluate(L);M!==v&&O.call(P,M)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(O=>(D(O),O)),this}filter(D){return this.steps.push(O=>D(O)?O:v),this}reduce(D,O){let P=O;return this.steps.push(b=>(P=D(P,b),P)),this}latch(D=(O,P)=>O===P){let O=!0,P;return this.steps.push(b=>{let E=O||!D(b,P);return O=!1,P=b,E?b:v}),this}evaluate(D){for(let O of this.steps)if(D=O(D),D===v)break;return D}}function w(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.on(D,P),E=()=>B.removeListener(D,P),L=new je({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=w;function y(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.addEventListener(D,P),E=()=>B.removeEventListener(D,P),L=new je({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(D=>o(B)(D))}e.toPromise=m;function x(B){let D=new je;return B.then(O=>{D.fire(O)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=x;function T(B,D){return B(O=>D.fire(O))}e.forward=T;function I(B,D,O){return D(O),B(P=>D(P))}e.runAndSubscribe=I;class F{constructor(D,O){this._observable=D,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};O||t(P),this.emitter=new je(P),O&&O.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,O){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,D){return new F(B,D).emitter.event}e.fromObservable=R;function z(B){return(D,O,P)=>{let b=0,E=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,D.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let M={dispose(){B.removeObserver(L)}};return P instanceof Kr?P.add(M):Array.isArray(P)&&P.push(M),M}}e.fromObservableLight=z})(zi||(zi={}));var $r=class zr{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${zr._idPool++}`,zr.all.add(this)}start(t){this._stopWatch=new hl,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};$r.all=new Set,$r._idPool=0;var fl=$r,ln=-1,wn=class Sn{constructor(t,i,o=(Sn._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let o=this.threshold;if(o<=0||i<o)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;let[r,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(r);let f=new pl(a,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(t.value)||0;this._stacks.set(t.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[o,h]of this._stacks)(!t||i<h)&&(t=[o,h],i=h);return t}};wn._idPool=1;var _l=wn,Ur=class Cn{constructor(t){this.value=t}static create(){let t=new Error;return new Cn(t.stack??"")}print(){console.warn(this.value.split(`
|
|
31
31
|
`).slice(2).join(`
|
|
32
|
-
`))}},
|
|
33
|
-
`)),e.length=0)},3e3),
|
|
32
|
+
`))}},pl=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},gl=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},vl=0,Ni=class{constructor(e){this.value=e,this.id=vl++}},ml=2,bl=(e,t)=>{if(e instanceof Ni)t(e);else for(let i=0;i<e.length;i++){let o=e[i];o&&t(o)}},Hi;if(dl){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
33
|
+
`)),e.length=0)},3e3),Hi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var je=class{constructor(e){this._size=0,this._options=e,this._leakageMon=ln>0||this._options?.leakWarningThreshold?new _l(e?.onListenerError??Dr,this._options?.leakWarningThreshold??ln):void 0,this._perfMon=this._options?._profName?new fl(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(an){let e=this._listeners;queueMicrotask(()=>{bl(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new gl(`${a}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Dr)(n),qe.None}if(this._disposed)return qe.None;t&&(e=e.bind(t));let o=new Ni(e),h,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=Ur.create(),h=this._leakageMon.check(o.stack,this._size+1)),an&&(o.stack=r??Ur.create()),this._listeners?this._listeners instanceof Ni?(this._deliveryQueue??(this._deliveryQueue=new wl),this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=Nt(()=>{Hi?.unregister(s),h?.(),this._removeListener(o)});if(i instanceof Kr?i.add(s):Array.isArray(i)&&i.push(s),Hi){let a=new Error().stack.split(`
|
|
34
34
|
`).slice(2,3).join(`
|
|
35
|
-
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Ii.register(r,f?.[2]??a,r)}return r}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let o=this._deliveryQueue.current===this;if(this._size*pl<=t.length){let h=0;for(let s=0;s<t.length;s++)t[s]?t[h++]=t[s]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Ts;if(!i){e.value(t);return}try{e.value(t)}catch(o){i(o)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Oi)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},gl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wn=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),on;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof ml?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Wi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:wn})})(on||(on={}));var ml=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?wn:(this._emitter||(this._emitter=new je),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Bt="en",zs=!1,Us=!1,Ni=!1,bl=!1,wl=!1,Sn=!1,Sl=!1,Cl=!1,yl=!1,xl=!1,Pi,Hi=Bt,an=Bt,kl,et,tt=globalThis,Be;typeof tt.vscode<"u"&&typeof tt.vscode.process<"u"?Be=tt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Be=process);var Cn=typeof Be?.versions?.electron=="string",El=Cn&&Be?.type==="renderer";if(typeof Be=="object"){zs=Be.platform==="win32",Us=Be.platform==="darwin",Ni=Be.platform==="linux",bl=Ni&&!!Be.env.SNAP&&!!Be.env.SNAP_REVISION,Sl=Cn,yl=!!Be.env.CI||!!Be.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Pi=Bt,Hi=Bt;let e=Be.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Pi=t.userLocale,an=t.osLocale,Hi=t.resolvedLanguage||Bt,kl=t.languagePack?.translationsConfigFile}catch{}wl=!0}else typeof navigator=="object"&&!El?(et=navigator.userAgent,zs=et.indexOf("Windows")>=0,Us=et.indexOf("Macintosh")>=0,Cl=(et.indexOf("Macintosh")>=0||et.indexOf("iPad")>=0||et.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ni=et.indexOf("Linux")>=0,xl=et?.indexOf("Mobi")>=0,Sn=!0,Hi=globalThis._VSCODE_NLS_LANGUAGE||Bt,Pi=navigator.language.toLowerCase(),an=Pi):console.error("Unable to resolve platform.");var As=0;Us?As=1:zs?As=3:Ni&&(As=2);var Ll=Sn&&typeof tt.importScripts=="function",Xu=Ll?tt.origin:void 0,Ke=et,ct=Hi,ln;(e=>{function t(){return ct}e.value=t;function i(){return ct.length===2?ct==="en":ct.length>=3?ct[0]==="e"&&ct[1]==="n"&&ct[2]==="-":!1}e.isDefaultVariant=i;function o(){return ct==="en"}e.isDefault=o})(ln||(ln={}));var Ml=typeof tt.postMessage=="function"&&!tt.importScripts,Rl=(()=>{if(Ml){let e=[];tt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let o=0,h=e.length;o<h;o++){let s=e[o];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(o,1),s.callback();return}}});let t=0;return i=>{let o=++t;e.push({id:o,callback:i}),tt.postMessage({vscodeScheduleAsyncWork:o},"*")}}return e=>setTimeout(e)})(),Tl=!!(Ke&&Ke.indexOf("Chrome")>=0),Ju=!!(Ke&&Ke.indexOf("Firefox")>=0),Zu=!!(!Tl&&Ke&&Ke.indexOf("Safari")>=0),Qu=!!(Ke&&Ke.indexOf("Edg/")>=0),ef=!!(Ke&&Ke.indexOf("Android")>=0);function yn(e,t=0,i){let o=setTimeout(()=>{e(),i&&h.dispose()},t),h=Ot(()=>{clearTimeout(o),i?.deleteAndLeak(h)});return i?.add(h),h}var Al,Ds;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Ds=(e,t)=>{Rl(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Ds=(e,t,i)=>{let o=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(o))}}},Al=e=>Ds(globalThis,e)})();var cn;(e=>{async function t(o){let h,s=await Promise.all(o.map(r=>r.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return s}e.settled=t;function i(o){return new Promise(async(h,s)=>{try{await o(h,s)}catch(r){s(r)}})}e.withAsyncBody=i})(cn||(cn={}));var hn=class Ie{static fromArray(t){return new Ie(i=>{i.emitMany(t)})}static fromPromise(t){return new Ie(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ie(async i=>{await Promise.all(t.map(async o=>i.emitOne(await o)))})}static merge(t){return new Ie(async i=>{await Promise.all(t.map(async o=>{for await(let h of o)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new je,queueMicrotask(async()=>{let o={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(o)),this.resolve()}catch(h){this.reject(h)}finally{o.emitOne=void 0,o.emitMany=void 0,o.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Wi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ie(async o=>{for await(let h of t)o.emitOne(i(h))})}map(t){return Ie.map(this,t)}static filter(t,i){return new Ie(async o=>{for await(let h of t)i(h)&&o.emitOne(h)})}filter(t){return Ie.filter(this,t)}static coalesce(t){return Ie.filter(t,i=>!!i)}coalesce(){return Ie.coalesce(this)}static async toPromise(t){let i=[];for await(let o of t)i.push(o);return i}toPromise(){return Ie.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};hn.EMPTY=hn.fromArray([]);var Dl=class extends qe{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Fi),this._linesCacheDisposables=this._register(new Fi),this._register(Ot(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=fn(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=yn(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],o=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let s=this._terminal.buffer.active.getLine(e+1),r=s?s.isWrapped:!1,a=h.translateToString(!r&&t);if(r&&s){let f=h.getCell(h.length-1);f&&f.getCode()===0&&f.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),r)o.push(o[o.length-1]+a.length);else break;e++,h=s}return[i.join(""),o]}},Bl=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Pl=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,o){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let h={startRow:t,startCol:i},s=this._findInLine(e,h,o);if(!s)for(let r=t+1;r<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=r,h.startCol=0,s=this._findInLine(e,h,o),!s);r++);return s}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,s=0;o&&(i===e?(h=o.end.x,s=o.end.y):(h=o.start.x,s=o.start.y)),this._lineCache.initLinesCache();let r={startRow:s,startCol:h},a=this._findInLine(e,r,t);if(!a)for(let f=s+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=f,r.startCol=0,a=this._findInLine(e,r,t),!a);f++);if(!a&&s!==0)for(let f=0;f<s&&(r.startRow=f,r.startCol=0,a=this._findInLine(e,r,t),!a);f++);return!a&&o&&(r.startRow=o.start.y,r.startCol=0,a=this._findInLine(e,r,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,r=!0;this._lineCache.initLinesCache();let a={startRow:h,startCol:s},f;if(o&&(a.startRow=h=o.start.y,a.startCol=s=o.start.x,i!==e&&(f=this._findInLine(e,a,t,!1),f||(a.startRow=h=o.end.y,a.startCol=s=o.end.x))),f||(f=this._findInLine(e,a,t,r)),!f){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let n=h-1;n>=0&&(a.startRow=n,f=this._findInLine(e,a,t,r),!f);n--);}if(!f&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=h&&(a.startRow=n,f=this._findInLine(e,a,t,r),!f);n--);return f}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},o=!1){let h=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(o){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let r=this._lineCache.getLineFromCache(h);r||(r=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,r));let[a,f]=r,n=this._bufferColsToStringOffset(h,s),_=e,v=a;i.regex||(_=i.caseSensitive?e:e.toLowerCase(),v=i.caseSensitive?a:a.toLowerCase());let S=-1;if(i.regex){let p=RegExp(_,i.caseSensitive?"g":"gi"),c;if(o)for(;c=p.exec(v.slice(0,n));)S=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(v.slice(n)),c&&c[0].length>0&&(S=n+(p.lastIndex-c[0].length),e=c[0])}else o?n-_.length>=0&&(S=v.lastIndexOf(_,n-_.length)):S=v.indexOf(_,n);if(S>=0){if(i.wholeWord&&!this._isWholeWord(S,v,e))return;let p=0;for(;p<f.length-1&&S>=f[p+1];)p++;let c=p;for(;c<f.length-1&&S+e.length>=f[c+1];)c++;let d=S-f[p],l=S+e.length-f[c],u=this._stringLengthToBufferSize(h+p,d),g=this._stringLengthToBufferSize(h+c,l)-u+this._terminal.cols*(c-p);return{term:e,col:u,row:h+p,size:g}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let o=0;o<t;o++){let h=i.getCell(o);if(!h)break;let s=h.getChars();s.length>1&&(t-=s.length-1);let r=i.getCell(o+1);r&&r.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,o=0,h=this._terminal.buffer.active.getLine(i);for(;t>0&&h;){for(let s=0;s<t&&s<this._terminal.cols;s++){let r=h.getCell(s);if(!r)break;r.getWidth()&&(o+=r.getCode()===0?1:r.getChars().length)}if(i++,h=this._terminal.buffer.active.getLine(i),h&&!h.isWrapped)break;t-=this._terminal.cols}return o}},Ol=class extends qe{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Ot(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let o=this._createResultDecorations(i,t,!1);if(o)for(let h of o)this._storeDecoration(h,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){si(i)}}}clearHighlightDecorations(){si(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let o=[],h=e.col,s=e.size,r=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let f=Math.min(this._terminal.cols-h,s);o.push([r,h,f]),h=0,s-=f,r++}let a=[];for(let f of o){let n=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:n,x:f[1],width:f[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(n.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let v=[];v.push(n),v.push(_.onRender(S=>this._applyStyles(S,i?t.activeMatchBorder:t.matchBorder,!1))),v.push(_.onDispose(()=>si(v))),a.push(_)}}return a.length===0?void 0:a}},Il=class extends qe{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new je)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},xn=class extends qe{constructor(e){super(),this._highlightTimeout=this._register(new Fi),this._lineCache=this._register(new Fi),this._state=new Bl,this._resultTracker=this._register(new Il),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Dl(e),this._engine=new Pl(e,this._lineCache.value),this._decorationManager=new Ol(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ot(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=yn(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let o=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,o}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],o,h=this._engine.find(e,0,0,t);for(;h&&(o?.row!==h.row||o?.col!==h.col)&&!(i.length>=this._highlightLimit);)o=h,i.push(o),h=this._engine.find(e,o.col+o.term.length>=this._terminal.cols?o.row+1:o.row,o.col+o.term.length>=this._terminal.cols?0:o.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let o=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(o,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let o=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,o}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let o=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(o,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let o=this._decorationManager.createActiveDecoration(e,t);o&&(this._resultTracker.selectedDecoration=o)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let o=e.row-this._terminal.buffer.active.viewportY;o-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(o)}return!0}};var Nl=class{constructor(e,t,i,o={}){this._terminal=e,this._regex=t,this._handler=i,this._options=o}provideLinks(e,t){let i=Fl.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,o)=>{if(this._options.hover){let{range:h}=t;this._options.hover(i,o,h)}},t))}};function Hl(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Fl=class Ui{static computeLink(t,i,o,h){let s=new RegExp(i.source,(i.flags||"")+"g"),[r,a]=Ui._getWindowedLineStrings(t-1,o),f=r.join(""),n,_=[];for(;n=s.exec(f);){let v=n[0];if(!Hl(v))continue;let[S,p]=Ui._mapStrIdx(o,a,0,n.index),[c,d]=Ui._mapStrIdx(o,S,p,v.length);if(S===-1||p===-1||c===-1||d===-1)continue;let l={start:{x:p+1,y:S+1},end:{x:d,y:c+1}};_.push({range:l,text:v,activate:h})}return _}static _getWindowedLineStrings(t,i){let o,h=t,s=t,r=0,a="",f=[];if(o=i.buffer.active.getLine(t)){let n=o.translateToString(!0);if(o.isWrapped&&n[0]!==" "){for(r=0;(o=i.buffer.active.getLine(--h))&&r<2048&&(a=o.translateToString(!0),r+=a.length,f.push(a),!(!o.isWrapped||a.indexOf(" ")!==-1)););f.reverse()}for(f.push(n),r=0;(o=i.buffer.active.getLine(++s))&&o.isWrapped&&r<2048&&(a=o.translateToString(!0),r+=a.length,f.push(a),a.indexOf(" ")===-1););}return[f,h]}static _mapStrIdx(t,i,o,h){let s=t.buffer.active,r=s.getNullCell(),a=o;for(;h;){let f=s.getLine(i);if(!f)return[-1,-1];for(let n=a;n<f.length;++n){f.getCell(n,r);let _=r.getChars();if(r.getWidth()&&(h-=_.length||1,n===f.length-1&&_==="")){let v=s.getLine(i+1);v&&v.isWrapped&&(v.getCell(0,r),r.getWidth()===2&&(h+=1))}if(h<0)return[i,n]}i++,a=0}return[i,a]}},Wl=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function $l(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var kn=class{constructor(e=$l,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Wl;this._linkProvider=this._terminal.registerLinkProvider(new Nl(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var zl=Object.defineProperty,Ul=Object.getOwnPropertyDescriptor,jl=(e,t,i,o)=>{for(var h=o>1?void 0:o?Ul(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(h=(o?r(t,i,h):r(h))||h);return o&&h&&zl(t,i,h),h},ql=(e,t)=>(i,o)=>t(i,o,e),Kl=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?En.isErrorNoTelemetry(e)?new En(e.message+`
|
|
35
|
+
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Hi.register(s,f?.[2]??a,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let o=this._deliveryQueue.current===this;if(this._size*ml<=t.length){let h=0;for(let r=0;r<t.length;r++)t[r]?t[h++]=t[r]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Dr;if(!i){e.value(t);return}try{e.value(t)}catch(o){i(o)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ni)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},wl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},yn=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),cn;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Sl?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:zi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:yn})})(cn||(cn={}));var Sl=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?yn:(this._emitter||(this._emitter=new je),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ot="en",jr=!1,qr=!1,Fi=!1,Cl=!1,yl=!1,xn=!1,xl=!1,kl=!1,El=!1,Ll=!1,Ii,Wi=Ot,hn=Ot,Ml,et,tt=globalThis,Be;typeof tt.vscode<"u"&&typeof tt.vscode.process<"u"?Be=tt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Be=process);var kn=typeof Be?.versions?.electron=="string",Rl=kn&&Be?.type==="renderer";if(typeof Be=="object"){jr=Be.platform==="win32",qr=Be.platform==="darwin",Fi=Be.platform==="linux",Cl=Fi&&!!Be.env.SNAP&&!!Be.env.SNAP_REVISION,xl=kn,El=!!Be.env.CI||!!Be.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ii=Ot,Wi=Ot;let e=Be.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ii=t.userLocale,hn=t.osLocale,Wi=t.resolvedLanguage||Ot,Ml=t.languagePack?.translationsConfigFile}catch{}yl=!0}else typeof navigator=="object"&&!Rl?(et=navigator.userAgent,jr=et.indexOf("Windows")>=0,qr=et.indexOf("Macintosh")>=0,kl=(et.indexOf("Macintosh")>=0||et.indexOf("iPad")>=0||et.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Fi=et.indexOf("Linux")>=0,Ll=et?.indexOf("Mobi")>=0,xn=!0,Wi=globalThis._VSCODE_NLS_LANGUAGE||Ot,Ii=navigator.language.toLowerCase(),hn=Ii):console.error("Unable to resolve platform.");var Br=0;qr?Br=1:jr?Br=3:Fi&&(Br=2);var Tl=xn&&typeof tt.importScripts=="function",ef=Tl?tt.origin:void 0,Ke=et,ct=Wi,dn;(e=>{function t(){return ct}e.value=t;function i(){return ct.length===2?ct==="en":ct.length>=3?ct[0]==="e"&&ct[1]==="n"&&ct[2]==="-":!1}e.isDefaultVariant=i;function o(){return ct==="en"}e.isDefault=o})(dn||(dn={}));var Al=typeof tt.postMessage=="function"&&!tt.importScripts,Dl=(()=>{if(Al){let e=[];tt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let o=0,h=e.length;o<h;o++){let r=e[o];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(o,1),r.callback();return}}});let t=0;return i=>{let o=++t;e.push({id:o,callback:i}),tt.postMessage({vscodeScheduleAsyncWork:o},"*")}}return e=>setTimeout(e)})(),Bl=!!(Ke&&Ke.indexOf("Chrome")>=0),tf=!!(Ke&&Ke.indexOf("Firefox")>=0),rf=!!(!Bl&&Ke&&Ke.indexOf("Safari")>=0),sf=!!(Ke&&Ke.indexOf("Edg/")>=0),nf=!!(Ke&&Ke.indexOf("Android")>=0);function En(e,t=0,i){let o=setTimeout(()=>{e(),i&&h.dispose()},t),h=Nt(()=>{clearTimeout(o),i?.deleteAndLeak(h)});return i?.add(h),h}var Pl,Pr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Pr=(e,t)=>{Dl(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Pr=(e,t,i)=>{let o=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(o))}}},Pl=e=>Pr(globalThis,e)})();var un;(e=>{async function t(o){let h,r=await Promise.all(o.map(s=>s.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return r}e.settled=t;function i(o){return new Promise(async(h,r)=>{try{await o(h,r)}catch(s){r(s)}})}e.withAsyncBody=i})(un||(un={}));var fn=class Ie{static fromArray(t){return new Ie(i=>{i.emitMany(t)})}static fromPromise(t){return new Ie(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ie(async i=>{await Promise.all(t.map(async o=>i.emitOne(await o)))})}static merge(t){return new Ie(async i=>{await Promise.all(t.map(async o=>{for await(let h of o)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new je,queueMicrotask(async()=>{let o={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(o)),this.resolve()}catch(h){this.reject(h)}finally{o.emitOne=void 0,o.emitMany=void 0,o.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await zi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ie(async o=>{for await(let h of t)o.emitOne(i(h))})}map(t){return Ie.map(this,t)}static filter(t,i){return new Ie(async o=>{for await(let h of t)i(h)&&o.emitOne(h)})}filter(t){return Ie.filter(this,t)}static coalesce(t){return Ie.filter(t,i=>!!i)}coalesce(){return Ie.coalesce(this)}static async toPromise(t){let i=[];for await(let o of t)i.push(o);return i}toPromise(){return Ie.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};fn.EMPTY=fn.fromArray([]);var Ol=class extends qe{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new $i),this._linesCacheDisposables=this._register(new $i),this._register(Nt(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=gn(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=En(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],o=[0],h=this._terminal.buffer.active.getLine(e);for(;h;){let r=this._terminal.buffer.active.getLine(e+1),s=r?r.isWrapped:!1,a=h.translateToString(!s&&t);if(s&&r){let f=h.getCell(h.length-1);f&&f.getCode()===0&&f.getWidth()===1&&r.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),s)o.push(o[o.length-1]+a.length);else break;e++,h=r}return[i.join(""),o]}},Il=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Nl=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,o){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let h={startRow:t,startCol:i},r=this._findInLine(e,h,o);if(!r)for(let s=t+1;s<this._terminal.buffer.active.baseY+this._terminal.rows&&(h.startRow=s,h.startCol=0,r=this._findInLine(e,h,o),!r);s++);return r}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=0,r=0;o&&(i===e?(h=o.end.x,r=o.end.y):(h=o.start.x,r=o.start.y)),this._lineCache.initLinesCache();let s={startRow:r,startCol:h},a=this._findInLine(e,s,t);if(!a)for(let f=r+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=f,s.startCol=0,a=this._findInLine(e,s,t),!a);f++);if(!a&&r!==0)for(let f=0;f<r&&(s.startRow=f,s.startCol=0,a=this._findInLine(e,s,t),!a);f++);return!a&&o&&(s.startRow=o.start.y,s.startCol=0,a=this._findInLine(e,s,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let h=this._terminal.buffer.active.baseY+this._terminal.rows-1,r=this._terminal.cols,s=!0;this._lineCache.initLinesCache();let a={startRow:h,startCol:r},f;if(o&&(a.startRow=h=o.start.y,a.startCol=r=o.start.x,i!==e&&(f=this._findInLine(e,a,t,!1),f||(a.startRow=h=o.end.y,a.startCol=r=o.end.x))),f||(f=this._findInLine(e,a,t,s)),!f){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let n=h-1;n>=0&&(a.startRow=n,f=this._findInLine(e,a,t,s),!f);n--);}if(!f&&h!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=h&&(a.startRow=n,f=this._findInLine(e,a,t,s),!f);n--);return f}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},o=!1){let h=t.startRow,r=t.startCol;if(this._terminal.buffer.active.getLine(h)?.isWrapped){if(o){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let s=this._lineCache.getLineFromCache(h);s||(s=this._lineCache.translateBufferLineToStringWithWrap(h,!0),this._lineCache.setLineInCache(h,s));let[a,f]=s,n=this._bufferColsToStringOffset(h,r),_=e,g=a;i.regex||(_=i.caseSensitive?e:e.toLowerCase(),g=i.caseSensitive?a:a.toLowerCase());let S=-1;if(i.regex){let p=RegExp(_,i.caseSensitive?"g":"gi"),c;if(o)for(;c=p.exec(g.slice(0,n));)S=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(g.slice(n)),c&&c[0].length>0&&(S=n+(p.lastIndex-c[0].length),e=c[0])}else o?n-_.length>=0&&(S=g.lastIndexOf(_,n-_.length)):S=g.indexOf(_,n);if(S>=0){if(i.wholeWord&&!this._isWholeWord(S,g,e))return;let p=0;for(;p<f.length-1&&S>=f[p+1];)p++;let c=p;for(;c<f.length-1&&S+e.length>=f[c+1];)c++;let d=S-f[p],l=S+e.length-f[c],u=this._stringLengthToBufferSize(h+p,d),v=this._stringLengthToBufferSize(h+c,l)-u+this._terminal.cols*(c-p);return{term:e,col:u,row:h+p,size:v}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let o=0;o<t;o++){let h=i.getCell(o);if(!h)break;let r=h.getChars();r.length>1&&(t-=r.length-1);let s=i.getCell(o+1);s&&s.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,o=0,h=this._terminal.buffer.active.getLine(i);for(;t>0&&h;){for(let r=0;r<t&&r<this._terminal.cols;r++){let s=h.getCell(r);if(!s)break;s.getWidth()&&(o+=s.getCode()===0?1:s.getChars().length)}if(i++,h=this._terminal.buffer.active.getLine(i),h&&!h.isWrapped)break;t-=this._terminal.cols}return o}},Hl=class extends qe{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Nt(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let o=this._createResultDecorations(i,t,!1);if(o)for(let h of o)this._storeDecoration(h,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){si(i)}}}clearHighlightDecorations(){si(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let o=[],h=e.col,r=e.size,s=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;r>0;){let f=Math.min(this._terminal.cols-h,r);o.push([s,h,f]),h=0,r-=f,s++}let a=[];for(let f of o){let n=this._terminal.registerMarker(f[0]),_=this._terminal.registerDecoration({marker:n,x:f[1],width:f[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(n.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let g=[];g.push(n),g.push(_.onRender(S=>this._applyStyles(S,i?t.activeMatchBorder:t.matchBorder,!1))),g.push(_.onDispose(()=>si(g))),a.push(_)}}return a.length===0?void 0:a}},Fl=class extends qe{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new je)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Ln=class extends qe{constructor(e){super(),this._highlightTimeout=this._register(new $i),this._lineCache=this._register(new $i),this._state=new Il,this._resultTracker=this._register(new Fl),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Ol(e),this._engine=new Nl(e,this._lineCache.value),this._decorationManager=new Hl(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Nt(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=En(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let o=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,o}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],o,h=this._engine.find(e,0,0,t);for(;h&&(o?.row!==h.row||o?.col!==h.col)&&!(i.length>=this._highlightLimit);)o=h,i.push(o),h=this._engine.find(e,o.col+o.term.length>=this._terminal.cols?o.row+1:o.row,o.col+o.term.length>=this._terminal.cols?0:o.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let o=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(o,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let o=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,o}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let o=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(o,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let o=this._decorationManager.createActiveDecoration(e,t);o&&(this._resultTracker.selectedDecoration=o)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let o=e.row-this._terminal.buffer.active.viewportY;o-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(o)}return!0}};var Wl=class{constructor(e,t,i,o={}){this._terminal=e,this._regex=t,this._handler=i,this._options=o}provideLinks(e,t){let i=zl.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,o)=>{if(this._options.hover){let{range:h}=t;this._options.hover(i,o,h)}},t))}};function $l(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var zl=class qi{static computeLink(t,i,o,h){let r=new RegExp(i.source,(i.flags||"")+"g"),[s,a]=qi._getWindowedLineStrings(t-1,o),f=s.join(""),n,_=[];for(;n=r.exec(f);){let g=n[0];if(!$l(g))continue;let[S,p]=qi._mapStrIdx(o,a,0,n.index),[c,d]=qi._mapStrIdx(o,S,p,g.length);if(S===-1||p===-1||c===-1||d===-1)continue;let l={start:{x:p+1,y:S+1},end:{x:d,y:c+1}};_.push({range:l,text:g,activate:h})}return _}static _getWindowedLineStrings(t,i){let o,h=t,r=t,s=0,a="",f=[];if(o=i.buffer.active.getLine(t)){let n=o.translateToString(!0);if(o.isWrapped&&n[0]!==" "){for(s=0;(o=i.buffer.active.getLine(--h))&&s<2048&&(a=o.translateToString(!0),s+=a.length,f.push(a),!(!o.isWrapped||a.indexOf(" ")!==-1)););f.reverse()}for(f.push(n),s=0;(o=i.buffer.active.getLine(++r))&&o.isWrapped&&s<2048&&(a=o.translateToString(!0),s+=a.length,f.push(a),a.indexOf(" ")===-1););}return[f,h]}static _mapStrIdx(t,i,o,h){let r=t.buffer.active,s=r.getNullCell(),a=o;for(;h;){let f=r.getLine(i);if(!f)return[-1,-1];for(let n=a;n<f.length;++n){f.getCell(n,s);let _=s.getChars();if(s.getWidth()&&(h-=_.length||1,n===f.length-1&&_==="")){let g=r.getLine(i+1);g&&g.isWrapped&&(g.getCell(0,s),s.getWidth()===2&&(h+=1))}if(h<0)return[i,n]}i++,a=0}return[i,a]}},Ul=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function jl(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Mn=class{constructor(e=jl,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Ul;this._linkProvider=this._terminal.registerLinkProvider(new Wl(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var ql=Object.defineProperty,Kl=Object.getOwnPropertyDescriptor,Gl=(e,t,i,o)=>{for(var h=o>1?void 0:o?Kl(t,i):t,r=e.length-1,s;r>=0;r--)(s=e[r])&&(h=(o?s(t,i,h):s(h))||h);return o&&h&&ql(t,i,h),h},Vl=(e,t)=>(i,o)=>t(i,o,e),Yl=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Rn.isErrorNoTelemetry(e)?new Rn(e.message+`
|
|
36
36
|
|
|
37
37
|
`+e.stack):new Error(e.message+`
|
|
38
38
|
|
|
39
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},
|
|
40
|
-
`).map(
|
|
41
|
-
`),f)}o.sort(
|
|
42
|
-
`)).size}/${o.length} leaks) at ${S}`;let p=
|
|
43
|
-
`)),c=
|
|
39
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Xl=new Yl;function Xi(e){Jl(e)||Xl.onUnexpectedError(e)}var as="Canceled";function Jl(e){return e instanceof Zl?!0:e instanceof Error&&e.name===as&&e.message===as}var Zl=class extends Error{constructor(){super(as),this.name=this.message}},Rn=class ls extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ls)return t;let i=new ls;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Ql(e,t,i=0,o=e.length){let h=i,r=o;for(;h<r;){let s=Math.floor((h+r)/2);t(e[s])?h=s+1:r=s}return h-1}var ec=class mo{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(mo.assertInvariants){if(this._prevFindLastPredicate){for(let o of this._array)if(this._prevFindLastPredicate(o)&&!t(o))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Ql(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};ec.assertInvariants=!1;var cs;(e=>{function t(r){return r<0}e.isLessThan=t;function i(r){return r<=0}e.isLessThanOrEqual=i;function o(r){return r>0}e.isGreaterThan=o;function h(r){return r===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(cs||(cs={}));function tc(e,t){return(i,o)=>t(e(i),e(o))}var ic=(e,t)=>e-t,Tn=class hs{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new hs(i=>this.iterate(o=>t(o)?i(o):!0))}map(t){return new hs(i=>this.iterate(o=>i(t(o))))}some(t){let i=!1;return this.iterate(o=>(i=t(o),!i)),i}findFirst(t){let i;return this.iterate(o=>t(o)?(i=o,!1):!0),i}findLast(t){let i;return this.iterate(o=>(t(o)&&(i=o),!0)),i}findLastMaxBy(t){let i,o=!0;return this.iterate(h=>((o||cs.isGreaterThan(t(h,i)))&&(o=!1,i=h),!0)),i}};Tn.empty=new Tn(e=>{});function rc(e,t){let i=Object.create(null);for(let o of e){let h=t(o),r=i[h];r||(r=i[h]=[]),r.push(o)}return i}var An,Dn,Rf=class{constructor(e,t){this.toKey=t,this._map=new Map,this[An]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[(Dn=Symbol.iterator,An=Symbol.toStringTag,Dn)](){return this.values()}},sc=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function nc(e,t){let i=this,o=!1,h;return function(){if(o)return h;if(o=!0,t)try{h=e.apply(i,arguments)}finally{t()}else h=e.apply(i,arguments);return h}}var ds;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function o(){return i}e.empty=o;function*h(w){yield w}e.single=h;function r(w){return t(w)?w:h(w)}e.wrap=r;function s(w){return w||i}e.from=s;function*a(w){for(let y=w.length-1;y>=0;y--)yield w[y]}e.reverse=a;function f(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=f;function n(w){return w[Symbol.iterator]().next().value}e.first=n;function _(w,y){let m=0;for(let x of w)if(y(x,m++))return!0;return!1}e.some=_;function g(w,y){for(let m of w)if(y(m))return m}e.find=g;function*S(w,y){for(let m of w)y(m)&&(yield m)}e.filter=S;function*p(w,y){let m=0;for(let x of w)yield y(x,m++)}e.map=p;function*c(w,y){let m=0;for(let x of w)yield*y(x,m++)}e.flatMap=c;function*d(...w){for(let y of w)yield*y}e.concat=d;function l(w,y,m){let x=m;for(let T of w)x=y(x,T);return x}e.reduce=l;function*u(w,y,m=w.length){for(y<0&&(y+=w.length),m<0?m+=w.length:m>w.length&&(m=w.length);y<m;y++)yield w[y]}e.slice=u;function v(w,y=Number.POSITIVE_INFINITY){let m=[];if(y===0)return[m,w];let x=w[Symbol.iterator]();for(let T=0;T<y;T++){let I=x.next();if(I.done)return[m,e.empty()];m.push(I.value)}return[m,{[Symbol.iterator](){return x}}]}e.consume=v;async function C(w){let y=[];for await(let m of w)y.push(m);return Promise.resolve(y)}e.asyncToArray=C})(ds||(ds={}));var oc=!1,jt=null,ac=class bo{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:bo.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=new Error().stack)}setParent(t,i){let o=this.getDisposableData(t);o.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let o=i.get(t);if(o)return o;let h=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,h),h}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let o;if(i)o=i;else{let f=new Map,n=[...this.livingDisposables.values()].filter(g=>g.source!==null&&!this.getRootParent(g,f).isSingleton);if(n.length===0)return;let _=new Set(n.map(g=>g.value));if(o=n.filter(g=>!(g.parent&&_.has(g.parent))),o.length===0)throw new Error("There are cyclic diposable chains!")}if(!o)return;function h(f){function n(g,S){for(;g.length>0&&S.some(p=>typeof p=="string"?p===g[0]:g[0].match(p));)g.shift()}let _=f.source.split(`
|
|
40
|
+
`).map(g=>g.trim().replace("at ","")).filter(g=>g!=="");return n(_,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),_.reverse()}let r=new sc;for(let f of o){let n=h(f);for(let _=0;_<=n.length;_++)r.add(n.slice(0,_).join(`
|
|
41
|
+
`),f)}o.sort(tc(f=>f.idx,ic));let s="",a=0;for(let f of o.slice(0,t)){a++;let n=h(f),_=[];for(let g=0;g<n.length;g++){let S=n[g];S=`(shared with ${r.get(n.slice(0,g+1).join(`
|
|
42
|
+
`)).size}/${o.length} leaks) at ${S}`;let p=r.get(n.slice(0,g).join(`
|
|
43
|
+
`)),c=rc([...p].map(d=>h(d)[g]),d=>d);delete c[n[g]];for(let[d,l]of Object.entries(c))_.unshift(` - stacktraces of ${l.length} other leaks continue with ${d}`);_.unshift(S)}s+=`
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
==================== Leaking disposable ${a}/${o.length}: ${f.value.constructor.name} ====================
|
|
@@ -48,17 +48,17 @@ ${_.join(`
|
|
|
48
48
|
`)}
|
|
49
49
|
============================================================
|
|
50
50
|
|
|
51
|
-
`}return o.length>t&&(
|
|
51
|
+
`}return o.length>t&&(s+=`
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
... and ${o.length-t} more leaking disposables
|
|
55
55
|
|
|
56
|
-
`),{leaks:o,details:r}}};rc.idx=0;function nc(e){zt=e}if(sc){let e="__is_disposable_tracked__";nc(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function rs(e){return zt?.trackDisposable(e),e}function ns(e){zt?.markAsDisposed(e)}function hi(e,t){zt?.setParent(e,t)}function oc(e,t){if(zt)for(let i of e)zt.setParent(i,t)}function go(e){if(cr.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(o){t.push(o)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function mo(...e){let t=Le(()=>go(e));return oc(e,t),t}function Le(e){let t=rs({dispose:ic(()=>{ns(t),e()})});return t}var bo=class wo{constructor(){this._toDispose=new Set,this._isDisposed=!1,rs(this)}dispose(){this._isDisposed||(ns(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{go(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return hi(t,this),this._isDisposed?wo.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),hi(t,null))}};bo.DISABLE_DISPOSED_WARNING=!1;var $t=bo,Oe=class{constructor(){this._store=new $t,rs(this),hi(this._store,this)}dispose(){ns(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var ni=class{constructor(){this._isDisposed=!1,rs(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&hi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ns(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&hi(e,null),e}},mr=typeof process<"u"&&"title"in process,ui=mr?"node":navigator.userAgent,br=mr?"node":navigator.platform,ac=ui.includes("Firefox"),lc=ui.includes("Edge"),So=/^((?!chrome|android).)*safari/i.test(ui);function cc(){if(!So)return 0;let e=ui.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ef=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(br),Lf=["Windows","Win16","Win32","WinCE"].includes(br),Mf=br.indexOf("Linux")>=0,Rf=/\bCrOS\b/.test(ui),hc="",Ce=0,ye=0,xe=0,pe=0,Ne={css:"#00000000",rgba:0},Re;(e=>{function t(h,s,r,a){return a!==void 0?`#${Ct(h)}${Ct(s)}${Ct(r)}${Ct(a)}`:`#${Ct(h)}${Ct(s)}${Ct(r)}`}e.toCss=t;function i(h,s,r,a=255){return(h<<24|s<<16|r<<8|a)>>>0}e.toRgba=i;function o(h,s,r,a){return{css:e.toCss(h,s,r,a),rgba:e.toRgba(h,s,r,a)}}e.toColor=o})(Re||(Re={}));var Ht;(e=>{function t(f,n){if(pe=(n.rgba&255)/255,pe===1)return{css:n.css,rgba:n.rgba};let _=n.rgba>>24&255,v=n.rgba>>16&255,S=n.rgba>>8&255,p=f.rgba>>24&255,c=f.rgba>>16&255,d=f.rgba>>8&255;Ce=p+Math.round((_-p)*pe),ye=c+Math.round((v-c)*pe),xe=d+Math.round((S-d)*pe);let l=Re.toCss(Ce,ye,xe),u=Re.toRgba(Ce,ye,xe);return{css:l,rgba:u}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function o(f,n,_){let v=_t.ensureContrastRatio(f.rgba,n.rgba,_);if(v)return Re.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=o;function h(f){let n=(f.rgba|255)>>>0;return[Ce,ye,xe]=_t.toChannels(n),{css:Re.toCss(Ce,ye,xe),rgba:n}}e.opaque=h;function s(f,n){return pe=Math.round(n*255),[Ce,ye,xe]=_t.toChannels(f.rgba),{css:Re.toCss(Ce,ye,xe,pe),rgba:Re.toRgba(Ce,ye,xe,pe)}}e.opacity=s;function r(f,n){return pe=f.rgba&255,s(f,pe*n/255)}e.multiplyOpacity=r;function a(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=a})(Ht||(Ht={}));var Tn;(e=>{let t,i;try{let h=document.createElement("canvas");h.width=1,h.height=1;let s=h.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function o(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return Ce=parseInt(h.slice(1,2).repeat(2),16),ye=parseInt(h.slice(2,3).repeat(2),16),xe=parseInt(h.slice(3,4).repeat(2),16),Re.toColor(Ce,ye,xe);case 5:return Ce=parseInt(h.slice(1,2).repeat(2),16),ye=parseInt(h.slice(2,3).repeat(2),16),xe=parseInt(h.slice(3,4).repeat(2),16),pe=parseInt(h.slice(4,5).repeat(2),16),Re.toColor(Ce,ye,xe,pe);case 7:return{css:h,rgba:(parseInt(h.slice(1),16)<<8|255)>>>0};case 9:return{css:h,rgba:parseInt(h.slice(1),16)>>>0}}let s=h.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Ce=parseInt(s[1]),ye=parseInt(s[2]),xe=parseInt(s[3]),pe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Re.toColor(Ce,ye,xe,pe);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ce,ye,xe,pe]=t.getImageData(0,0,1,1).data,pe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Re.toRgba(Ce,ye,xe,pe),css:h}}e.toColor=o})(Tn||(Tn={}));var Me;(e=>{function t(o){return i(o>>16&255,o>>8&255,o&255)}e.relativeLuminance=t;function i(o,h,s){let r=o/255,a=h/255,f=s/255,n=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return n*.2126+_*.7152+v*.0722}e.relativeLuminance2=i})(Me||(Me={}));var _t;(e=>{function t(r,a){if(pe=(a&255)/255,pe===1)return a;let f=a>>24&255,n=a>>16&255,_=a>>8&255,v=r>>24&255,S=r>>16&255,p=r>>8&255;return Ce=v+Math.round((f-v)*pe),ye=S+Math.round((n-S)*pe),xe=p+Math.round((_-p)*pe),Re.toRgba(Ce,ye,xe)}e.blend=t;function i(r,a,f){let n=Me.relativeLuminance(r>>8),_=Me.relativeLuminance(a>>8);if(it(n,_)<f){if(_<n){let p=o(r,a,f),c=it(n,Me.relativeLuminance(p>>8));if(c<f){let d=h(r,a,f),l=it(n,Me.relativeLuminance(d>>8));return c>l?p:d}return p}let v=h(r,a,f),S=it(n,Me.relativeLuminance(v>>8));if(S<f){let p=o(r,a,f),c=it(n,Me.relativeLuminance(p>>8));return S>c?v:p}return v}}e.ensureContrastRatio=i;function o(r,a,f){let n=r>>24&255,_=r>>16&255,v=r>>8&255,S=a>>24&255,p=a>>16&255,c=a>>8&255,d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,v));for(;d<f&&(S>0||p>0||c>0);)S-=Math.max(0,Math.ceil(S*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,v));return(S<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=o;function h(r,a,f){let n=r>>24&255,_=r>>16&255,v=r>>8&255,S=a>>24&255,p=a>>16&255,c=a>>8&255,d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,v));for(;d<f&&(S<255||p<255||c<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,v));return(S<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=h;function s(r){return[r>>24&255,r>>16&255,r>>8&255,r&255]}e.toChannels=s})(_t||(_t={}));function Ct(e){let t=e.toString(16);return t.length<2?"0"+t:t}function it(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function be(e){if(!e)throw new Error("value must not be falsy");return e}function wr(e){return 57508<=e&&e<=57558}function dc(e){return 57520<=e&&e<=57527}function uc(e){return 57344<=e&&e<=63743}function fc(e){return 9472<=e&&e<=9631}function _c(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function pc(e,t,i,o){return t===1&&i>Math.ceil(o*1.5)&&e!==void 0&&e>255&&!_c(e)&&!wr(e)&&!uc(e)}function Co(e){return wr(e)||fc(e)}function vc(){return{css:{canvas:ji(),cell:ji()},device:{canvas:ji(),cell:ji(),char:{width:0,height:0,left:0,top:0}}}}function ji(){return{width:0,height:0}}function gc(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Ee=0,Se=0,Ge=!1,st=!1,qi=!1,Ae,qs=0,mc=class{constructor(e,t,i,o,h,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=o,this._coreBrowserService=h,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,o){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Se=0,Ee=0,st=!1,Ge=!1,qi=!1,Ae=this._themeService.colors,qs=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));qs=t*o%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",h=>{h.backgroundColorRGB&&(Se=h.backgroundColorRGB.rgba>>8&16777215,st=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Ge=!0)}),qi=this._selectionRenderModel.isCellSelected(this._terminal,t,i),qi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Se=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Se=(this.result.fg&16777215)<<8|255;break;default:Se=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Se=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Se=(this.result.bg&16777215)<<8|255;break}Se=_t.blend(Se,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Se=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(st=!0,Ae.selectionForeground&&(Ee=Ae.selectionForeground.rgba>>8&16777215,Ge=!0),Co(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ee=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ee=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ee=(this.result.fg&16777215)<<8|255;break;default:Ee=this._themeService.colors.foreground.rgba}Ee=_t.blend(Ee,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ge=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",h=>{h.backgroundColorRGB&&(Se=h.backgroundColorRGB.rgba>>8&16777215,st=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Ge=!0)}),st&&(qi?Se=e.bg&-16777216&-134217729|Se|50331648:Se=e.bg&-16777216|Se|50331648),Ge&&(Ee=e.fg&-16777216&-67108865|Ee|50331648),this.result.fg&67108864&&(st&&!Ge&&((this.result.bg&50331648)===0?Ee=this.result.fg&-134217728|Ae.background.rgba>>8&16777215&16777215|50331648:Ee=this.result.fg&-134217728|this.result.bg&67108863,Ge=!0),!st&&Ge&&((this.result.fg&50331648)===0?Se=this.result.bg&-67108864|Ae.foreground.rgba>>8&16777215&16777215|50331648:Se=this.result.bg&-67108864|this.result.fg&67108863,st=!0)),Ae=void 0,this.result.bg=st?Se:this.result.bg,this.result.fg=Ge?Ee:this.result.fg,this.result.ext&=536870911,this.result.ext|=qs<<29&3758096384}},bc=.5,yo=ac||lc?"bottom":"ideographic",wc={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:8,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Sc={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]},Cc={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2551":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2552":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u2553":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"\u2554":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2555":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"\u2556":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"\u2557":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"\u2558":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"\u2559":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u255A":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"\u255B":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"\u255C":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"\u255D":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"\u255E":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u255F":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"\u2560":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2561":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"\u2562":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2563":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"\u2564":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"\u2565":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"\u2566":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2567":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2568":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u2569":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u256A":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u256B":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u256C":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"\u256E":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"\u256F":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"\u2570":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},di={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};di["\uE0BB"]=di["\uE0BD"];di["\uE0BF"]=di["\uE0B9"];function yc(e,t,i,o,h,s,r,a){let f=wc[t];if(f)return xc(e,f,i,o,h,s),!0;let n=Sc[t];if(n)return kc(e,n,i,o,h,s),!0;let _=Cc[t];if(_)return Ec(e,_,i,o,h,s,a),!0;let v=di[t];return v?(Lc(e,v,i,o,h,s,r,a),!0):!1}function xc(e,t,i,o,h,s){for(let r=0;r<t.length;r++){let a=t[r],f=h/8,n=s/8;e.fillRect(i+a.x*f,o+a.y*n,a.w*f,a.h*n)}}var An=new Map;function kc(e,t,i,o,h,s){let r=An.get(t);r||(r=new Map,An.set(t,r));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let f=r.get(a);if(!f){let n=t[0].length,_=t.length,v=e.canvas.ownerDocument.createElement("canvas");v.width=n,v.height=_;let S=be(v.getContext("2d")),p=new ImageData(n,_),c,d,l,u;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),l=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,d,l,u]=a.substring(5,a.length-1).split(",").map(g=>parseFloat(g));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let g=0;g<_;g++)for(let C=0;C<n;C++)p.data[(g*n+C)*4]=c,p.data[(g*n+C)*4+1]=d,p.data[(g*n+C)*4+2]=l,p.data[(g*n+C)*4+3]=t[g][C]*(u*255);S.putImageData(p,0,0),f=be(e.createPattern(v,null)),r.set(a,f)}e.fillStyle=f,e.fillRect(i,o,h,s)}function Ec(e,t,i,o,h,s,r){e.strokeStyle=e.fillStyle;for(let[a,f]of Object.entries(t)){e.beginPath(),e.lineWidth=r*Number.parseInt(a);let n;if(typeof f=="function"){let _=.15/s*h;n=f(.15,_)}else n=f;for(let _ of n.split(" ")){let v=_[0],S=xo[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,ko(p,h,s,i,o,!0,r))}e.stroke(),e.closePath()}}function Lc(e,t,i,o,h,s,r,a){let f=new Path2D;f.rect(i,o,h,s),e.clip(f),e.beginPath();let n=r/12;e.lineWidth=a*n;for(let _ of t.d.split(" ")){let v=_[0],S=xo[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,ko(p,h,s,i,o,!1,a,(t.leftPadding??0)*(n/2),(t.rightPadding??0)*(n/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Dn(e,t,i=0){return Math.max(Math.min(e,t),i)}var xo={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function ko(e,t,i,o,h,s,r,a=0,f=0){let n=e.map(_=>parseFloat(_)||parseInt(_));if(n.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<n.length;_+=2)n[_]*=t-a*r-f*r,s&&n[_]!==0&&(n[_]=Dn(Math.round(n[_]+.5)-.5,t,0)),n[_]+=o+a*r;for(let _=1;_<n.length;_+=2)n[_]*=i,s&&n[_]!==0&&(n[_]=Dn(Math.round(n[_]+.5)-.5,i,0)),n[_]+=h;return n}var Bn=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Pn=class{constructor(){this._data=new Bn}set(e,t,i,o,h){this._data.get(e,t)||this._data.set(e,t,new Bn),this._data.get(e,t).set(i,o,h)}get(e,t,i,o){return this._data.get(e,t)?.get(i,o)}clear(){this._data.clear()}},Eo=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,i=0,o=e.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),h=e.timeRemaining(),i*1.5>h){o-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(o-t))}ms`),this._start();return}o=h}this.clear()}},Mc=class extends Eo{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Rc=class extends Eo{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Tc=!mr&&"requestIdleCallback"in window?Rc:Mc,Ft=class Lo{constructor(){this.fg=0,this.bg=0,this.extended=new Mo}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Lo;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Mo=class Ro{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Ro(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},On=class hr{constructor(t){this.element=t,this.next=hr.Undefined,this.prev=hr.Undefined}};On.Undefined=new On(void 0);var Ac=globalThis.performance&&typeof globalThis.performance.now=="function",Dc=class To{static create(t){return new To(t)}constructor(t){this._now=Ac&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Bc=!1,In=!1,Pc=!1,Ve;(e=>{e.None=()=>Oe.None;function t(B){if(Pc){let{onDidAddListener:D}=B,O=fr.create(),P=0;B.onDidAddListener=()=>{++P===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),D?.()}}}function i(B,D){return S(B,()=>{},0,void 0,!0,void 0,D)}e.defer=i;function o(B){return(D,O=null,P)=>{let b=!1,E;return E=B(L=>{if(!b)return E?E.dispose():b=!0,D.call(O,L)},null,P),b&&E.dispose(),E}}e.once=o;function h(B,D,O){return _((P,b=null,E)=>B(L=>P.call(b,D(L)),null,E),O)}e.map=h;function s(B,D,O){return _((P,b=null,E)=>B(L=>{D(L),P.call(b,L)},null,E),O)}e.forEach=s;function r(B,D,O){return _((P,b=null,E)=>B(L=>D(L)&&P.call(b,L),null,E),O)}e.filter=r;function a(B){return B}e.signal=a;function f(...B){return(D,O=null,P)=>{let b=mo(...B.map(E=>E(L=>D.call(O,L))));return v(b,P)}}e.any=f;function n(B,D,O,P){let b=O;return h(B,E=>(b=D(b,E),b),P)}e.reduce=n;function _(B,D){let O,P={onWillAddFirstListener(){O=B(b.fire,b)},onDidRemoveLastListener(){O?.dispose()}};D||t(P);let b=new de(P);return D?.add(b),b.event}function v(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function S(B,D,O=100,P=!1,b=!1,E,L){let M,$,K,Y=0,U,A={leakWarningThreshold:E,onWillAddFirstListener(){M=B(N=>{Y++,$=D($,N),P&&!K&&(k.fire($),$=void 0),U=()=>{let H=$;$=void 0,K=void 0,(!P||Y>1)&&k.fire(H),Y=0},typeof O=="number"?(clearTimeout(K),K=setTimeout(U,O)):K===void 0&&(K=0,queueMicrotask(U))})},onWillRemoveListener(){b&&Y>0&&U?.()},onDidRemoveLastListener(){U=void 0,M.dispose()}};L||t(A);let k=new de(A);return L?.add(k),k.event}e.debounce=S;function p(B,D=0,O){return e.debounce(B,(P,b)=>P?(P.push(b),P):[b],D,void 0,!0,void 0,O)}e.accumulate=p;function c(B,D=(P,b)=>P===b,O){let P=!0,b;return r(B,E=>{let L=P||!D(E,b);return P=!1,b=E,L},O)}e.latch=c;function d(B,D,O){return[e.filter(B,D,O),e.filter(B,P=>!D(P),O)]}e.split=d;function l(B,D=!1,O=[],P){let b=O.slice(),E=B($=>{b?b.push($):M.fire($)});P&&P.add(E);let L=()=>{b?.forEach($=>M.fire($)),b=null},M=new de({onWillAddFirstListener(){E||(E=B($=>M.fire($)),P&&P.add(E))},onDidAddFirstListener(){b&&(D?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return P&&P.add(M),M.event}e.buffer=l;function u(B,D){return(O,P,b)=>{let E=D(new C);return B(function(L){let M=E.evaluate(L);M!==g&&O.call(P,M)},void 0,b)}}e.chain=u;let g=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(O=>(D(O),O)),this}filter(D){return this.steps.push(O=>D(O)?O:g),this}reduce(D,O){let P=O;return this.steps.push(b=>(P=D(P,b),P)),this}latch(D=(O,P)=>O===P){let O=!0,P;return this.steps.push(b=>{let E=O||!D(b,P);return O=!1,P=b,E?b:g}),this}evaluate(D){for(let O of this.steps)if(D=O(D),D===g)break;return D}}function w(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.on(D,P),E=()=>B.removeListener(D,P),L=new de({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=w;function y(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.addEventListener(D,P),E=()=>B.removeEventListener(D,P),L=new de({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(D=>o(B)(D))}e.toPromise=m;function x(B){let D=new de;return B.then(O=>{D.fire(O)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=x;function T(B,D){return B(O=>D.fire(O))}e.forward=T;function I(B,D,O){return D(O),B(P=>D(P))}e.runAndSubscribe=I;class F{constructor(D,O){this._observable=D,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};O||t(P),this.emitter=new de(P),O&&O.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,O){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,D){return new F(B,D).emitter.event}e.fromObservable=R;function z(B){return(D,O,P)=>{let b=0,E=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,D.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let M={dispose(){B.removeObserver(L)}};return P instanceof $t?P.add(M):Array.isArray(P)&&P.push(M),M}}e.fromObservableLight=z})(Ve||(Ve={}));var dr=class ur{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ur._idPool++}`,ur.all.add(this)}start(t){this._stopWatch=new Dc,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};dr.all=new Set,dr._idPool=0;var Oc=dr,Nn=-1,Ao=class Do{constructor(t,i,o=(Do._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let o=this.threshold;if(o<=0||i<o)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;let[s,r]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(a),console.warn(s);let f=new Nc(a,s);this._errorHandler(f)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[o,h]of this._stacks)(!t||i<h)&&(t=[o,h],i=h);return t}};Ao._idPool=1;var Ic=Ao,fr=class Bo{constructor(t){this.value=t}static create(){let t=new Error;return new Bo(t.stack??"")}print(){console.warn(this.value.split(`
|
|
56
|
+
`),{leaks:o,details:s}}};ac.idx=0;function lc(e){jt=e}if(oc){let e="__is_disposable_tracked__";lc(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Oe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function or(e){return jt?.trackDisposable(e),e}function ar(e){jt?.markAsDisposed(e)}function di(e,t){jt?.setParent(e,t)}function cc(e,t){if(jt)for(let i of e)jt.setParent(i,t)}function wo(e){if(ds.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(o){t.push(o)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function So(...e){let t=Le(()=>wo(e));return cc(e,t),t}function Le(e){let t=or({dispose:nc(()=>{ar(t),e()})});return t}var Co=class yo{constructor(){this._toDispose=new Set,this._isDisposed=!1,or(this)}dispose(){this._isDisposed||(ar(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return di(t,this),this._isDisposed?yo.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),di(t,null))}};Co.DISABLE_DISPOSED_WARNING=!1;var Ut=Co,Oe=class{constructor(){this._store=new Ut,or(this),di(this._store,this)}dispose(){ar(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var oi=class{constructor(){this._isDisposed=!1,or(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&di(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ar(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&di(e,null),e}},ws=typeof process<"u"&&"title"in process,fi=ws?"node":navigator.userAgent,Ss=ws?"node":navigator.platform,hc=fi.includes("Firefox"),dc=fi.includes("Edge"),xo=/^((?!chrome|android).)*safari/i.test(fi);function uc(){if(!xo)return 0;let e=fi.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Tf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ss),Af=["Windows","Win16","Win32","WinCE"].includes(Ss),Df=Ss.indexOf("Linux")>=0,Bf=/\bCrOS\b/.test(fi),fc="",Ce=0,ye=0,xe=0,pe=0,Ne={css:"#00000000",rgba:0},Re;(e=>{function t(h,r,s,a){return a!==void 0?`#${Ct(h)}${Ct(r)}${Ct(s)}${Ct(a)}`:`#${Ct(h)}${Ct(r)}${Ct(s)}`}e.toCss=t;function i(h,r,s,a=255){return(h<<24|r<<16|s<<8|a)>>>0}e.toRgba=i;function o(h,r,s,a){return{css:e.toCss(h,r,s,a),rgba:e.toRgba(h,r,s,a)}}e.toColor=o})(Re||(Re={}));var Wt;(e=>{function t(f,n){if(pe=(n.rgba&255)/255,pe===1)return{css:n.css,rgba:n.rgba};let _=n.rgba>>24&255,g=n.rgba>>16&255,S=n.rgba>>8&255,p=f.rgba>>24&255,c=f.rgba>>16&255,d=f.rgba>>8&255;Ce=p+Math.round((_-p)*pe),ye=c+Math.round((g-c)*pe),xe=d+Math.round((S-d)*pe);let l=Re.toCss(Ce,ye,xe),u=Re.toRgba(Ce,ye,xe);return{css:l,rgba:u}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function o(f,n,_){let g=_t.ensureContrastRatio(f.rgba,n.rgba,_);if(g)return Re.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=o;function h(f){let n=(f.rgba|255)>>>0;return[Ce,ye,xe]=_t.toChannels(n),{css:Re.toCss(Ce,ye,xe),rgba:n}}e.opaque=h;function r(f,n){return pe=Math.round(n*255),[Ce,ye,xe]=_t.toChannels(f.rgba),{css:Re.toCss(Ce,ye,xe,pe),rgba:Re.toRgba(Ce,ye,xe,pe)}}e.opacity=r;function s(f,n){return pe=f.rgba&255,r(f,pe*n/255)}e.multiplyOpacity=s;function a(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=a})(Wt||(Wt={}));var Bn;(e=>{let t,i;try{let h=document.createElement("canvas");h.width=1,h.height=1;let r=h.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function o(h){if(h.match(/#[\da-f]{3,8}/i))switch(h.length){case 4:return Ce=parseInt(h.slice(1,2).repeat(2),16),ye=parseInt(h.slice(2,3).repeat(2),16),xe=parseInt(h.slice(3,4).repeat(2),16),Re.toColor(Ce,ye,xe);case 5:return Ce=parseInt(h.slice(1,2).repeat(2),16),ye=parseInt(h.slice(2,3).repeat(2),16),xe=parseInt(h.slice(3,4).repeat(2),16),pe=parseInt(h.slice(4,5).repeat(2),16),Re.toColor(Ce,ye,xe,pe);case 7:return{css:h,rgba:(parseInt(h.slice(1),16)<<8|255)>>>0};case 9:return{css:h,rgba:parseInt(h.slice(1),16)>>>0}}let r=h.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Ce=parseInt(r[1]),ye=parseInt(r[2]),xe=parseInt(r[3]),pe=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Re.toColor(Ce,ye,xe,pe);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=h,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ce,ye,xe,pe]=t.getImageData(0,0,1,1).data,pe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Re.toRgba(Ce,ye,xe,pe),css:h}}e.toColor=o})(Bn||(Bn={}));var Me;(e=>{function t(o){return i(o>>16&255,o>>8&255,o&255)}e.relativeLuminance=t;function i(o,h,r){let s=o/255,a=h/255,f=r/255,n=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return n*.2126+_*.7152+g*.0722}e.relativeLuminance2=i})(Me||(Me={}));var _t;(e=>{function t(s,a){if(pe=(a&255)/255,pe===1)return a;let f=a>>24&255,n=a>>16&255,_=a>>8&255,g=s>>24&255,S=s>>16&255,p=s>>8&255;return Ce=g+Math.round((f-g)*pe),ye=S+Math.round((n-S)*pe),xe=p+Math.round((_-p)*pe),Re.toRgba(Ce,ye,xe)}e.blend=t;function i(s,a,f){let n=Me.relativeLuminance(s>>8),_=Me.relativeLuminance(a>>8);if(it(n,_)<f){if(_<n){let p=o(s,a,f),c=it(n,Me.relativeLuminance(p>>8));if(c<f){let d=h(s,a,f),l=it(n,Me.relativeLuminance(d>>8));return c>l?p:d}return p}let g=h(s,a,f),S=it(n,Me.relativeLuminance(g>>8));if(S<f){let p=o(s,a,f),c=it(n,Me.relativeLuminance(p>>8));return S>c?g:p}return g}}e.ensureContrastRatio=i;function o(s,a,f){let n=s>>24&255,_=s>>16&255,g=s>>8&255,S=a>>24&255,p=a>>16&255,c=a>>8&255,d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,g));for(;d<f&&(S>0||p>0||c>0);)S-=Math.max(0,Math.ceil(S*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,g));return(S<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=o;function h(s,a,f){let n=s>>24&255,_=s>>16&255,g=s>>8&255,S=a>>24&255,p=a>>16&255,c=a>>8&255,d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,g));for(;d<f&&(S<255||p<255||c<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),d=it(Me.relativeLuminance2(S,p,c),Me.relativeLuminance2(n,_,g));return(S<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=h;function r(s){return[s>>24&255,s>>16&255,s>>8&255,s&255]}e.toChannels=r})(_t||(_t={}));function Ct(e){let t=e.toString(16);return t.length<2?"0"+t:t}function it(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function be(e){if(!e)throw new Error("value must not be falsy");return e}function Cs(e){return 57508<=e&&e<=57558}function _c(e){return 57520<=e&&e<=57527}function pc(e){return 57344<=e&&e<=63743}function gc(e){return 9472<=e&&e<=9631}function vc(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function mc(e,t,i,o){return t===1&&i>Math.ceil(o*1.5)&&e!==void 0&&e>255&&!vc(e)&&!Cs(e)&&!pc(e)}function ko(e){return Cs(e)||gc(e)}function bc(){return{css:{canvas:Ki(),cell:Ki()},device:{canvas:Ki(),cell:Ki(),char:{width:0,height:0,left:0,top:0}}}}function Ki(){return{width:0,height:0}}function wc(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Ee=0,Se=0,Ge=!1,rt=!1,Gi=!1,Ae,Gr=0,Sc=class{constructor(e,t,i,o,h,r){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=o,this._coreBrowserService=h,this._themeService=r,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,o){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Se=0,Ee=0,rt=!1,Ge=!1,Gi=!1,Ae=this._themeService.colors,Gr=0,e.getCode()!==0&&e.extended.underlineStyle===4){let h=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Gr=t*o%(Math.round(h)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",h=>{h.backgroundColorRGB&&(Se=h.backgroundColorRGB.rgba>>8&16777215,rt=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Ge=!0)}),Gi=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Gi){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Se=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Se=(this.result.fg&16777215)<<8|255;break;default:Se=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Se=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Se=(this.result.bg&16777215)<<8|255;break}Se=_t.blend(Se,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Se=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(rt=!0,Ae.selectionForeground&&(Ee=Ae.selectionForeground.rgba>>8&16777215,Ge=!0),ko(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ee=(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ee=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ee=(this.result.fg&16777215)<<8|255;break;default:Ee=this._themeService.colors.foreground.rgba}Ee=_t.blend(Ee,(this._coreBrowserService.isFocused?Ae.selectionBackgroundOpaque:Ae.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ge=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",h=>{h.backgroundColorRGB&&(Se=h.backgroundColorRGB.rgba>>8&16777215,rt=!0),h.foregroundColorRGB&&(Ee=h.foregroundColorRGB.rgba>>8&16777215,Ge=!0)}),rt&&(Gi?Se=e.bg&-16777216&-134217729|Se|50331648:Se=e.bg&-16777216|Se|50331648),Ge&&(Ee=e.fg&-16777216&-67108865|Ee|50331648),this.result.fg&67108864&&(rt&&!Ge&&((this.result.bg&50331648)===0?Ee=this.result.fg&-134217728|Ae.background.rgba>>8&16777215&16777215|50331648:Ee=this.result.fg&-134217728|this.result.bg&67108863,Ge=!0),!rt&&Ge&&((this.result.fg&50331648)===0?Se=this.result.bg&-67108864|Ae.foreground.rgba>>8&16777215&16777215|50331648:Se=this.result.bg&-67108864|this.result.fg&67108863,rt=!0)),Ae=void 0,this.result.bg=rt?Se:this.result.bg,this.result.fg=Ge?Ee:this.result.fg,this.result.ext&=536870911,this.result.ext|=Gr<<29&3758096384}},Cc=.5,Eo=hc||dc?"bottom":"ideographic",yc={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:8,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},xc={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]},kc={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2551":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2552":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u2553":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"\u2554":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2555":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"\u2556":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"\u2557":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"\u2558":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"\u2559":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u255A":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"\u255B":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"\u255C":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"\u255D":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"\u255E":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"\u255F":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"\u2560":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2561":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"\u2562":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u2563":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"\u2564":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"\u2565":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"\u2566":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"\u2567":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u2568":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"\u2569":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u256A":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"\u256B":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"\u256C":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"\u256E":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"\u256F":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"\u2570":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},ui={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};ui["\uE0BB"]=ui["\uE0BD"];ui["\uE0BF"]=ui["\uE0B9"];function Ec(e,t,i,o,h,r,s,a){let f=yc[t];if(f)return Lc(e,f,i,o,h,r),!0;let n=xc[t];if(n)return Mc(e,n,i,o,h,r),!0;let _=kc[t];if(_)return Rc(e,_,i,o,h,r,a),!0;let g=ui[t];return g?(Tc(e,g,i,o,h,r,s,a),!0):!1}function Lc(e,t,i,o,h,r){for(let s=0;s<t.length;s++){let a=t[s],f=h/8,n=r/8;e.fillRect(i+a.x*f,o+a.y*n,a.w*f,a.h*n)}}var Pn=new Map;function Mc(e,t,i,o,h,r){let s=Pn.get(t);s||(s=new Map,Pn.set(t,s));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let f=s.get(a);if(!f){let n=t[0].length,_=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=n,g.height=_;let S=be(g.getContext("2d")),p=new ImageData(n,_),c,d,l,u;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),l=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,d,l,u]=a.substring(5,a.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let v=0;v<_;v++)for(let C=0;C<n;C++)p.data[(v*n+C)*4]=c,p.data[(v*n+C)*4+1]=d,p.data[(v*n+C)*4+2]=l,p.data[(v*n+C)*4+3]=t[v][C]*(u*255);S.putImageData(p,0,0),f=be(e.createPattern(g,null)),s.set(a,f)}e.fillStyle=f,e.fillRect(i,o,h,r)}function Rc(e,t,i,o,h,r,s){e.strokeStyle=e.fillStyle;for(let[a,f]of Object.entries(t)){e.beginPath(),e.lineWidth=s*Number.parseInt(a);let n;if(typeof f=="function"){let _=.15/r*h;n=f(.15,_)}else n=f;for(let _ of n.split(" ")){let g=_[0],S=Lo[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,Mo(p,h,r,i,o,!0,s))}e.stroke(),e.closePath()}}function Tc(e,t,i,o,h,r,s,a){let f=new Path2D;f.rect(i,o,h,r),e.clip(f),e.beginPath();let n=s/12;e.lineWidth=a*n;for(let _ of t.d.split(" ")){let g=_[0],S=Lo[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||S(e,Mo(p,h,r,i,o,!1,a,(t.leftPadding??0)*(n/2),(t.rightPadding??0)*(n/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function On(e,t,i=0){return Math.max(Math.min(e,t),i)}var Lo={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function Mo(e,t,i,o,h,r,s,a=0,f=0){let n=e.map(_=>parseFloat(_)||parseInt(_));if(n.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<n.length;_+=2)n[_]*=t-a*s-f*s,r&&n[_]!==0&&(n[_]=On(Math.round(n[_]+.5)-.5,t,0)),n[_]+=o+a*s;for(let _=1;_<n.length;_+=2)n[_]*=i,r&&n[_]!==0&&(n[_]=On(Math.round(n[_]+.5)-.5,i,0)),n[_]+=h;return n}var In=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Nn=class{constructor(){this._data=new In}set(e,t,i,o,h){this._data.get(e,t)||this._data.set(e,t,new In),this._data.get(e,t).set(i,o,h)}get(e,t,i,o){return this._data.get(e,t)?.get(i,o)}clear(){this._data.clear()}},Ro=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,i=0,o=e.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),h=e.timeRemaining(),i*1.5>h){o-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(o-t))}ms`),this._start();return}o=h}this.clear()}},Ac=class extends Ro{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Dc=class extends Ro{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Bc=!ws&&"requestIdleCallback"in window?Dc:Ac,$t=class To{constructor(){this.fg=0,this.bg=0,this.extended=new Ao}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new To;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ao=class Do{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Do(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hn=class us{constructor(t){this.element=t,this.next=us.Undefined,this.prev=us.Undefined}};Hn.Undefined=new Hn(void 0);var Pc=globalThis.performance&&typeof globalThis.performance.now=="function",Oc=class Bo{static create(t){return new Bo(t)}constructor(t){this._now=Pc&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ic=!1,Fn=!1,Nc=!1,Ve;(e=>{e.None=()=>Oe.None;function t(B){if(Nc){let{onDidAddListener:D}=B,O=ps.create(),P=0;B.onDidAddListener=()=>{++P===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),O.print()),D?.()}}}function i(B,D){return S(B,()=>{},0,void 0,!0,void 0,D)}e.defer=i;function o(B){return(D,O=null,P)=>{let b=!1,E;return E=B(L=>{if(!b)return E?E.dispose():b=!0,D.call(O,L)},null,P),b&&E.dispose(),E}}e.once=o;function h(B,D,O){return _((P,b=null,E)=>B(L=>P.call(b,D(L)),null,E),O)}e.map=h;function r(B,D,O){return _((P,b=null,E)=>B(L=>{D(L),P.call(b,L)},null,E),O)}e.forEach=r;function s(B,D,O){return _((P,b=null,E)=>B(L=>D(L)&&P.call(b,L),null,E),O)}e.filter=s;function a(B){return B}e.signal=a;function f(...B){return(D,O=null,P)=>{let b=So(...B.map(E=>E(L=>D.call(O,L))));return g(b,P)}}e.any=f;function n(B,D,O,P){let b=O;return h(B,E=>(b=D(b,E),b),P)}e.reduce=n;function _(B,D){let O,P={onWillAddFirstListener(){O=B(b.fire,b)},onDidRemoveLastListener(){O?.dispose()}};D||t(P);let b=new de(P);return D?.add(b),b.event}function g(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function S(B,D,O=100,P=!1,b=!1,E,L){let M,$,K,Y=0,U,A={leakWarningThreshold:E,onWillAddFirstListener(){M=B(N=>{Y++,$=D($,N),P&&!K&&(k.fire($),$=void 0),U=()=>{let H=$;$=void 0,K=void 0,(!P||Y>1)&&k.fire(H),Y=0},typeof O=="number"?(clearTimeout(K),K=setTimeout(U,O)):K===void 0&&(K=0,queueMicrotask(U))})},onWillRemoveListener(){b&&Y>0&&U?.()},onDidRemoveLastListener(){U=void 0,M.dispose()}};L||t(A);let k=new de(A);return L?.add(k),k.event}e.debounce=S;function p(B,D=0,O){return e.debounce(B,(P,b)=>P?(P.push(b),P):[b],D,void 0,!0,void 0,O)}e.accumulate=p;function c(B,D=(P,b)=>P===b,O){let P=!0,b;return s(B,E=>{let L=P||!D(E,b);return P=!1,b=E,L},O)}e.latch=c;function d(B,D,O){return[e.filter(B,D,O),e.filter(B,P=>!D(P),O)]}e.split=d;function l(B,D=!1,O=[],P){let b=O.slice(),E=B($=>{b?b.push($):M.fire($)});P&&P.add(E);let L=()=>{b?.forEach($=>M.fire($)),b=null},M=new de({onWillAddFirstListener(){E||(E=B($=>M.fire($)),P&&P.add(E))},onDidAddFirstListener(){b&&(D?setTimeout(L):L())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return P&&P.add(M),M.event}e.buffer=l;function u(B,D){return(O,P,b)=>{let E=D(new C);return B(function(L){let M=E.evaluate(L);M!==v&&O.call(P,M)},void 0,b)}}e.chain=u;let v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(O=>(D(O),O)),this}filter(D){return this.steps.push(O=>D(O)?O:v),this}reduce(D,O){let P=O;return this.steps.push(b=>(P=D(P,b),P)),this}latch(D=(O,P)=>O===P){let O=!0,P;return this.steps.push(b=>{let E=O||!D(b,P);return O=!1,P=b,E?b:v}),this}evaluate(D){for(let O of this.steps)if(D=O(D),D===v)break;return D}}function w(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.on(D,P),E=()=>B.removeListener(D,P),L=new de({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromNodeEventEmitter=w;function y(B,D,O=P=>P){let P=(...M)=>L.fire(O(...M)),b=()=>B.addEventListener(D,P),E=()=>B.removeEventListener(D,P),L=new de({onWillAddFirstListener:b,onDidRemoveLastListener:E});return L.event}e.fromDOMEventEmitter=y;function m(B){return new Promise(D=>o(B)(D))}e.toPromise=m;function x(B){let D=new de;return B.then(O=>{D.fire(O)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=x;function T(B,D){return B(O=>D.fire(O))}e.forward=T;function I(B,D,O){return D(O),B(P=>D(P))}e.runAndSubscribe=I;class F{constructor(D,O){this._observable=D,this._counter=0,this._hasChanged=!1;let P={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};O||t(P),this.emitter=new de(P),O&&O.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,O){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(B,D){return new F(B,D).emitter.event}e.fromObservable=R;function z(B){return(D,O,P)=>{let b=0,E=!1,L={beginUpdate(){b++},endUpdate(){b--,b===0&&(B.reportChanges(),E&&(E=!1,D.call(O)))},handlePossibleChange(){},handleChange(){E=!0}};B.addObserver(L),B.reportChanges();let M={dispose(){B.removeObserver(L)}};return P instanceof Ut?P.add(M):Array.isArray(P)&&P.push(M),M}}e.fromObservableLight=z})(Ve||(Ve={}));var fs=class _s{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${_s._idPool++}`,_s.all.add(this)}start(t){this._stopWatch=new Oc,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};fs.all=new Set,fs._idPool=0;var Hc=fs,Wn=-1,Po=class Oo{constructor(t,i,o=(Oo._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let o=this.threshold;if(o<=0||i<o)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;let[r,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(r);let f=new Wc(a,r);this._errorHandler(f)}return()=>{let r=this._stacks.get(t.value)||0;this._stacks.set(t.value,r-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[o,h]of this._stacks)(!t||i<h)&&(t=[o,h],i=h);return t}};Po._idPool=1;var Fc=Po,ps=class Io{constructor(t){this.value=t}static create(){let t=new Error;return new Io(t.stack??"")}print(){console.warn(this.value.split(`
|
|
57
57
|
`).slice(2).join(`
|
|
58
|
-
`))}},
|
|
59
|
-
`)),e.length=0)},3e3),
|
|
58
|
+
`))}},Wc=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},$c=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},zc=0,Ji=class{constructor(e){this.value=e,this.id=zc++}},Uc=2,jc=(e,t)=>{if(e instanceof Ji)t(e);else for(let i=0;i<e.length;i++){let o=e[i];o&&t(o)}},Zi;if(Ic){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
59
|
+
`)),e.length=0)},3e3),Zi=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var de=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Wn>0||this._options?.leakWarningThreshold?new Fc(e?.onListenerError??Xi,this._options?.leakWarningThreshold??Wn):void 0,this._perfMon=this._options?._profName?new Hc(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Fn){let e=this._listeners;queueMicrotask(()=>{jc(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new $c(`${a}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Xi)(n),Oe.None}if(this._disposed)return Oe.None;t&&(e=e.bind(t));let o=new Ji(e),h,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=ps.create(),h=this._leakageMon.check(o.stack,this._size+1)),Fn&&(o.stack=r??ps.create()),this._listeners?this._listeners instanceof Ji?(this._deliveryQueue??(this._deliveryQueue=new qc),this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let s=Le(()=>{Zi?.unregister(s),h?.(),this._removeListener(o)});if(i instanceof Ut?i.add(s):Array.isArray(i)&&i.push(s),Zi){let a=new Error().stack.split(`
|
|
60
60
|
`).slice(2,3).join(`
|
|
61
|
-
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Xi.register(r,f?.[2]??a,r)}return r}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let o=this._deliveryQueue.current===this;if(this._size*Wc<=t.length){let h=0;for(let s=0;s<t.length;s++)t[s]?t[h++]=t[s]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Vi;if(!i){e.value(t);return}try{e.value(t)}catch(o){i(o)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Yi)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},zc=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Hn={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},oi=2,ai,ut=class Nt{constructor(t,i,o){this._document=t,this._config=i,this._unicodeService=o,this._didWarmUp=!1,this._cacheMap=new Pn,this._cacheMapCombined=new Pn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ft,this._textureSize=512,this._onAddTextureAtlasCanvas=new de,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new de,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Po(t,this._config.deviceCellWidth*4+oi*2,this._config.deviceCellHeight+oi*2),this._tmpCtx=be(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Tc;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let o=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,o)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Nt.maxAtlasPages&&this._pages.length>=Math.max(4,Nt.maxAtlasPages)){let i=this._pages.filter(n=>n.canvas.width*2<=(Nt.maxTextureSize||4096)).sort((n,_)=>_.canvas.width!==n.canvas.width?_.canvas.width-n.canvas.width:_.percentageUsed-n.percentageUsed),o=-1,h=0;for(let n=0;n<i.length;n++)if(i[n].canvas.width!==h)o=n,h=i[n].canvas.width;else if(n-o===3)break;let s=i.slice(o,o+4),r=s.map(n=>n.glyphs[0].texturePage).sort((n,_)=>n>_?1:-1),a=this.pages.length-s.length,f=this._mergePages(s,a);f.version++;for(let n=r.length-1;n>=0;n--)this._deletePage(r[n]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new Ks(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let o=t[0].canvas.width*2,h=new Ks(this._document,o,t);for(let[s,r]of t.entries()){let a=s*r.canvas.width%o,f=Math.floor(s/2)*r.canvas.height;h.ctx.drawImage(r.canvas,a,f);for(let _ of r.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/o,_.sizeClipSpace.y=_.size.y/o,_.texturePosition.x+=a,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/o,_.texturePositionClipSpace.y=_.texturePosition.y/o;this._onRemoveTextureAtlasCanvas.fire(r.canvas);let n=this._activePages.indexOf(r);n!==-1&&this._activePages.splice(n,1)}return h}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let o=this._pages[i];for(let h of o.glyphs)h.texturePage--;o.version++}}getRasterizedGlyphCombinedChar(t,i,o,h,s,r){return this._getFromCacheMap(this._cacheMapCombined,t,i,o,h,s,r)}getRasterizedGlyph(t,i,o,h,s,r){return this._getFromCacheMap(this._cacheMap,t,i,o,h,s,r)}_getFromCacheMap(t,i,o,h,s,r,a){return ai=t.get(i,o,h,s),ai||(ai=this._drawToCache(i,o,h,s,r,a),t.set(i,o,h,s,ai)),ai}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,o,h){if(this._config.allowTransparency)return Ne;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(i);break;case 50331648:let r=Ft.toColorRGB(i);s=Re.toColor(r[0],r[1],r[2]);break;default:o?s=Ht.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=Ht.opaque(s)),s}_getForegroundColor(t,i,o,h,s,r,a,f,n,_){let v=this._getMinimumContrastColor(t,i,o,h,s,r,a,n,f,_);if(v)return v;let S;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),S=this._getColorFromAnsiIndex(r);break;case 50331648:let p=Ft.toColorRGB(r);S=Re.toColor(p[0],p[1],p[2]);break;default:a?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Ht.opaque(S)),f&&(S=Ht.multiplyOpacity(S,bc)),S}_resolveBackgroundRgba(t,i,o){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return o?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,o,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return o?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,o,h,s,r,a,f,n,_){if(this._config.minimumContrastRatio===1||_)return;let v=this._getContrastCache(n),S=v.getColor(t,h);if(S!==void 0)return S||void 0;let p=this._resolveBackgroundRgba(i,o,a),c=this._resolveForegroundRgba(s,r,a,f),d=_t.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(n?2:1));if(!d){v.setColor(t,h,null);return}let l=Re.toColor(d>>24&255,d>>16&255,d>>8&255);return v.setColor(t,h,l),l}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,o,h,s,r){let a=typeof t=="number"?String.fromCharCode(t):t;r&&this._tmpCanvas.parentElement!==r&&(this._tmpCanvas.style.display="none",r.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+oi*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let n=Math.min(this._config.deviceCellHeight+oi*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=o,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return Hn;let _=!!this._workAttributeData.isBold(),v=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),l=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(v){let M=u;u=C,C=M;let $=g;g=w,w=$}let y=this._getBackgroundColor(w,C,v,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let m=_?this._config.fontWeightBold:this._config.fontWeight,x=p?"italic":"";this._tmpCtx.font=`${x} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=yo;let T=a.length===1&&wr(a.charCodeAt(0)),I=a.length===1&&dc(a.charCodeAt(0)),F=this._getForegroundColor(i,w,C,o,g,u,v,S,_,Co(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let R=I?0:oi*2,z=!1;this._config.customGlyphs!==!1&&(z=yc(this._tmpCtx,a,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!T,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=M%2===1?.5:0;if(this._tmpCtx.lineWidth=M,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${Ft.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let N=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&N<8&&(N+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(N).css}this._tmpCtx.beginPath();let K=R,Y=Math.ceil(R+this._config.deviceCharHeight)-$-(s?M*2:0),U=Y+M,A=Y+M*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let N=0;N<D;N++){this._tmpCtx.save();let H=K+N*this._config.deviceCellWidth,q=K+(N+1)*this._config.deviceCellWidth,j=H+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y),this._tmpCtx.moveTo(H,A),this._tmpCtx.lineTo(q,A);break;case 3:let Q=M<=1?A:Math.ceil(R+this._config.deviceCharHeight-M/2)-$,ee=M<=1?Y:Math.ceil(R+this._config.deviceCharHeight+M/2)-$,G=new Path2D;G.rect(H,Y,this._config.deviceCellWidth,A-Y),this._tmpCtx.clip(G),this._tmpCtx.moveTo(H-this._config.deviceCellWidth/2,U),this._tmpCtx.bezierCurveTo(H-this._config.deviceCellWidth/2,ee,H,ee,H,U),this._tmpCtx.bezierCurveTo(H,Q,j,Q,j,U),this._tmpCtx.bezierCurveTo(j,ee,q,ee,q,U),this._tmpCtx.bezierCurveTo(q,Q,q+this._config.deviceCellWidth/2,Q,q+this._config.deviceCellWidth/2,U);break;case 4:let J=k===0?0:k>=M?M*2-k:M-k;k>=M||J===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H+J,Y),this._tmpCtx.lineTo(q,Y)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(H+J,Y),this._tmpCtx.moveTo(H+J+M,Y),this._tmpCtx.lineTo(q,Y)),k=gc(q-H,M,k);break;case 5:let Z=.6,oe=.3,ae=q-H,me=Math.floor(Z*ae),we=Math.floor(oe*ae),fe=ae-me-we;this._tmpCtx.setLineDash([me,we,fe]),this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y);break;default:this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!z&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let N=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in N&&N.actualBoundingBoxDescent>0){this._tmpCtx.save();let H=new Path2D;H.rect(K,Y-Math.ceil(M/2),this._config.deviceCellWidth*D,A-Y+Math.ceil(M/2)),this._tmpCtx.clip(H),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(a,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(l){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+$),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+$),this._tmpCtx.stroke()}if(z||this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let M=Gs(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B);if(M)for(let $=1;$<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight-$),M=Gs(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B),!!M);$++);}if(d){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),$=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.stroke()}this._tmpCtx.restore();let O=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=Uc(O):P=Gs(O,y,F,B),P)return Hn;let b=this._findGlyphBoundingBox(O,this._workBoundingBox,f,I,z,R),E,L;for(;;){if(this._activePages.length===0){let M=this._createNewPage();E=M,L=M.currentRow,L.height=b.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let M of this._activePages)b.size.y<=M.currentRow.height&&(E=M,L=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let $ of this._activePages[M].fixedRows)$.height<=L.height&&b.size.y<=$.height&&(E=this._activePages[M],L=$);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Ks(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+b.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+b.size.y>=E.canvas.height||L.height>b.size.y+2){let M=!1;if(E.currentRow.y+E.currentRow.height+b.size.y>=E.canvas.height){let $;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y<K.canvas.height){$=K;break}if($)E=$;else if(Nt.maxAtlasPages&&this._pages.length>=Nt.maxAtlasPages&&L.y+b.size.y<=E.canvas.height&&L.height>=b.size.y&&L.x+b.size.x<=E.canvas.width)M=!0;else{let K=this._createNewPage();E=K,L=K.currentRow,L.height=b.size.y,M=!0}}M||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:b.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+b.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return b.texturePage=this._pages.indexOf(E),b.texturePosition.x=L.x,b.texturePosition.y=L.y,b.texturePositionClipSpace.x=L.x/E.canvas.width,b.texturePositionClipSpace.y=L.y/E.canvas.height,b.sizeClipSpace.x/=E.canvas.width,b.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,b.size.y),L.x+=b.size.x,E.ctx.putImageData(O,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),E.addGlyph(b),E.version++,b}_findGlyphBoundingBox(t,i,o,h,s,r){i.top=0;let a=h?this._config.deviceCellHeight:this._tmpCanvas.height,f=h?this._config.deviceCellWidth:o,n=!1;for(let _=0;_<a;_++){for(let v=0;v<f;v++){let S=_*this._tmpCanvas.width*4+v*4+3;if(t.data[S]!==0){i.top=_,n=!0;break}}if(n)break}i.left=0,n=!1;for(let _=0;_<r+f;_++){for(let v=0;v<a;v++){let S=v*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.left=_,n=!0;break}}if(n)break}i.right=f,n=!1;for(let _=r+f-1;_>=r;_--){for(let v=0;v<a;v++){let S=v*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.right=_,n=!0;break}}if(n)break}i.bottom=a,n=!1;for(let _=a-1;_>=0;_--){for(let v=0;v<f;v++){let S=_*this._tmpCanvas.width*4+v*4+3;if(t.data[S]!==0){i.bottom=_,n=!0;break}}if(n)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+r+(h||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+r+(h||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Ks=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let o of i)this._glyphs.push(...o.glyphs),this._usedPixels+=o._usedPixels;this.canvas=Po(e,t,t),this.ctx=be(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Gs(e,t,i,o){let h=t.rgba>>>24,s=t.rgba>>>16&255,r=t.rgba>>>8&255,a=i.rgba>>>24,f=i.rgba>>>16&255,n=i.rgba>>>8&255,_=Math.floor((Math.abs(h-a)+Math.abs(s-f)+Math.abs(r-n))/12),v=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===h&&e.data[S+1]===s&&e.data[S+2]===r||o&&Math.abs(e.data[S]-h)+Math.abs(e.data[S+1]-s)+Math.abs(e.data[S+2]-r)<_?e.data[S+3]=0:v=!1;return v}function Uc(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function Po(e,t,i){let o=e.createElement("canvas");return o.width=t,o.height=i,o}function jc(e,t,i,o,h,s,r,a){let f={foreground:s.foreground,background:s.background,cursor:Ne,cursorAccent:Ne,selectionForeground:Ne,selectionBackgroundTransparent:Ne,selectionBackgroundOpaque:Ne,selectionInactiveBackgroundTransparent:Ne,selectionInactiveBackgroundOpaque:Ne,overviewRulerBorder:Ne,scrollbarSliderBackground:Ne,scrollbarSliderHoverBackground:Ne,scrollbarSliderActiveBackground:Ne,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:r,deviceMaxTextureSize:a,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:o,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:f}}function Fn(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function qc(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Fe=[];function Oo(e,t,i,o,h,s,r,a,f){let n=jc(o,h,s,r,t,i,a,f);for(let S=0;S<Fe.length;S++){let p=Fe[S],c=p.ownedBy.indexOf(e);if(c>=0){if(Fn(p.config,n))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),Fe.splice(S,1)):p.ownedBy.splice(c,1);break}}for(let S=0;S<Fe.length;S++){let p=Fe[S];if(Fn(p.config,n))return p.ownedBy.push(e),p.atlas}let _=e._core,v={atlas:new ut(document,n,_.unicodeService),config:n,ownedBy:[e]};return Fe.push(v),v.atlas}function Wn(e){for(let t=0;t<Fe.length;t++){let i=Fe[t].ownedBy.indexOf(e);if(i!==-1){Fe[t].ownedBy.length===1?(Fe[t].atlas.dispose(),Fe.splice(t,1)):Fe[t].ownedBy.splice(i,1);break}}}var Ki=600,Kc=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Ki){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Ki-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Ki-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Ki)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function $n(e,t,i){let o=new t.ResizeObserver(h=>{let s=h.find(f=>f.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){o?.disconnect(),o=void 0;return}let r=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;r>0&&a>0&&i(r,a)});try{o.observe(e,{box:["device-pixel-content-box"]})}catch{o.disconnect(),o=void 0}return Le(()=>o?.disconnect())}function Gc(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var zn=class Io extends Ft{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Mo,this.combinedData=""}static fromCharData(t){let i=new Io;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Gc(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let o=t[1].charCodeAt(0);if(55296<=o&&o<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(o-55296)*1024+h-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},No=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Ho(e,t,i){let o=be(e.createProgram());if(e.attachShader(o,be(Un(e,e.VERTEX_SHADER,t))),e.attachShader(o,be(Un(e,e.FRAGMENT_SHADER,i))),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return o;console.error(e.getProgramInfoLog(o)),e.deleteProgram(o)}function Un(e,t,i){let o=be(e.createShader(t));if(e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;console.error(e.getShaderInfoLog(o)),e.deleteShader(o)}function Vc(e,t){let i=Math.min(e.length*2,t),o=new Float32Array(i);for(let h=0;h<e.length;h++)o[h]=e[h];return o}var Yc=class{constructor(e){this.texture=e,this.version=-1}},Xc=`#version 300 es
|
|
61
|
+
`).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Zi.register(s,f?.[2]??a,s)}return s}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let o=this._deliveryQueue.current===this;if(this._size*Uc<=t.length){let h=0;for(let r=0;r<t.length;r++)t[r]?t[h++]=t[r]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Xi;if(!i){e.value(t);return}try{e.value(t)}catch(o){i(o)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ji)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},qc=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$n={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},ai=2,li,ut=class Ft{constructor(t,i,o){this._document=t,this._config=i,this._unicodeService=o,this._didWarmUp=!1,this._cacheMap=new Nn,this._cacheMapCombined=new Nn,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new $t,this._textureSize=512,this._onAddTextureAtlasCanvas=new de,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new de,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=No(t,this._config.deviceCellWidth*4+ai*2,this._config.deviceCellHeight+ai*2),this._tmpCtx=be(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Bc;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let o=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,o)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ft.maxAtlasPages&&this._pages.length>=Math.max(4,Ft.maxAtlasPages)){let i=this._pages.filter(n=>n.canvas.width*2<=(Ft.maxTextureSize||4096)).sort((n,_)=>_.canvas.width!==n.canvas.width?_.canvas.width-n.canvas.width:_.percentageUsed-n.percentageUsed),o=-1,h=0;for(let n=0;n<i.length;n++)if(i[n].canvas.width!==h)o=n,h=i[n].canvas.width;else if(n-o===3)break;let r=i.slice(o,o+4),s=r.map(n=>n.glyphs[0].texturePage).sort((n,_)=>n>_?1:-1),a=this.pages.length-r.length,f=this._mergePages(r,a);f.version++;for(let n=s.length-1;n>=0;n--)this._deletePage(s[n]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new Vr(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let o=t[0].canvas.width*2,h=new Vr(this._document,o,t);for(let[r,s]of t.entries()){let a=r*s.canvas.width%o,f=Math.floor(r/2)*s.canvas.height;h.ctx.drawImage(s.canvas,a,f);for(let _ of s.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/o,_.sizeClipSpace.y=_.size.y/o,_.texturePosition.x+=a,_.texturePosition.y+=f,_.texturePositionClipSpace.x=_.texturePosition.x/o,_.texturePositionClipSpace.y=_.texturePosition.y/o;this._onRemoveTextureAtlasCanvas.fire(s.canvas);let n=this._activePages.indexOf(s);n!==-1&&this._activePages.splice(n,1)}return h}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let o=this._pages[i];for(let h of o.glyphs)h.texturePage--;o.version++}}getRasterizedGlyphCombinedChar(t,i,o,h,r,s){return this._getFromCacheMap(this._cacheMapCombined,t,i,o,h,r,s)}getRasterizedGlyph(t,i,o,h,r,s){return this._getFromCacheMap(this._cacheMap,t,i,o,h,r,s)}_getFromCacheMap(t,i,o,h,r,s,a){return li=t.get(i,o,h,r),li||(li=this._drawToCache(i,o,h,r,s,a),t.set(i,o,h,r,li)),li}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,o,h){if(this._config.allowTransparency)return Ne;let r;switch(t){case 16777216:case 33554432:r=this._getColorFromAnsiIndex(i);break;case 50331648:let s=$t.toColorRGB(i);r=Re.toColor(s[0],s[1],s[2]);break;default:o?r=Wt.opaque(this._config.colors.foreground):r=this._config.colors.background;break}return this._config.allowTransparency||(r=Wt.opaque(r)),r}_getForegroundColor(t,i,o,h,r,s,a,f,n,_){let g=this._getMinimumContrastColor(t,i,o,h,r,s,a,n,f,_);if(g)return g;let S;switch(r){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&n&&s<8&&(s+=8),S=this._getColorFromAnsiIndex(s);break;case 50331648:let p=$t.toColorRGB(s);S=Re.toColor(p[0],p[1],p[2]);break;default:a?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Wt.opaque(S)),f&&(S=Wt.multiplyOpacity(S,Cc)),S}_resolveBackgroundRgba(t,i,o){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return o?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,o,h){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&h&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return o?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,o,h,r,s,a,f,n,_){if(this._config.minimumContrastRatio===1||_)return;let g=this._getContrastCache(n),S=g.getColor(t,h);if(S!==void 0)return S||void 0;let p=this._resolveBackgroundRgba(i,o,a),c=this._resolveForegroundRgba(r,s,a,f),d=_t.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(n?2:1));if(!d){g.setColor(t,h,null);return}let l=Re.toColor(d>>24&255,d>>16&255,d>>8&255);return g.setColor(t,h,l),l}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,o,h,r,s){let a=typeof t=="number"?String.fromCharCode(t):t;s&&this._tmpCanvas.parentElement!==s&&(this._tmpCanvas.style.display="none",s.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+ai*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let n=Math.min(this._config.deviceCellHeight+ai*4,this._textureSize);if(this._tmpCanvas.height<n&&(this._tmpCanvas.height=n),this._tmpCtx.save(),this._workAttributeData.fg=o,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=h,!!this._workAttributeData.isInvisible())return $n;let _=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),d=!!this._workAttributeData.isStrikethrough(),l=!!this._workAttributeData.isOverline(),u=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(g){let M=u;u=C,C=M;let $=v;v=w,w=$}let y=this._getBackgroundColor(w,C,g,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let m=_?this._config.fontWeightBold:this._config.fontWeight,x=p?"italic":"";this._tmpCtx.font=`${x} ${m} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Eo;let T=a.length===1&&Cs(a.charCodeAt(0)),I=a.length===1&&_c(a.charCodeAt(0)),F=this._getForegroundColor(i,w,C,o,v,u,g,S,_,ko(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let R=I?0:ai*2,z=!1;this._config.customGlyphs!==!1&&(z=Ec(this._tmpCtx,a,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!T,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=M%2===1?.5:0;if(this._tmpCtx.lineWidth=M,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${$t.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let N=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&N<8&&(N+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(N).css}this._tmpCtx.beginPath();let K=R,Y=Math.ceil(R+this._config.deviceCharHeight)-$-(r?M*2:0),U=Y+M,A=Y+M*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let N=0;N<D;N++){this._tmpCtx.save();let H=K+N*this._config.deviceCellWidth,q=K+(N+1)*this._config.deviceCellWidth,j=H+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y),this._tmpCtx.moveTo(H,A),this._tmpCtx.lineTo(q,A);break;case 3:let Q=M<=1?A:Math.ceil(R+this._config.deviceCharHeight-M/2)-$,ee=M<=1?Y:Math.ceil(R+this._config.deviceCharHeight+M/2)-$,G=new Path2D;G.rect(H,Y,this._config.deviceCellWidth,A-Y),this._tmpCtx.clip(G),this._tmpCtx.moveTo(H-this._config.deviceCellWidth/2,U),this._tmpCtx.bezierCurveTo(H-this._config.deviceCellWidth/2,ee,H,ee,H,U),this._tmpCtx.bezierCurveTo(H,Q,j,Q,j,U),this._tmpCtx.bezierCurveTo(j,ee,q,ee,q,U),this._tmpCtx.bezierCurveTo(q,Q,q+this._config.deviceCellWidth/2,Q,q+this._config.deviceCellWidth/2,U);break;case 4:let J=k===0?0:k>=M?M*2-k:M-k;k>=M||J===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H+J,Y),this._tmpCtx.lineTo(q,Y)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(H+J,Y),this._tmpCtx.moveTo(H+J+M,Y),this._tmpCtx.lineTo(q,Y)),k=wc(q-H,M,k);break;case 5:let Z=.6,oe=.3,ae=q-H,me=Math.floor(Z*ae),we=Math.floor(oe*ae),fe=ae-me-we;this._tmpCtx.setLineDash([me,we,fe]),this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y);break;default:this._tmpCtx.moveTo(H,Y),this._tmpCtx.lineTo(q,Y);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!z&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let N=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in N&&N.actualBoundingBoxDescent>0){this._tmpCtx.save();let H=new Path2D;H.rect(K,Y-Math.ceil(M/2),this._config.deviceCellWidth*D,A-Y+Math.ceil(M/2)),this._tmpCtx.clip(H),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=y.css,this._tmpCtx.strokeText(a,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(l){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),$=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+$),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+$),this._tmpCtx.stroke()}if(z||this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let M=Yr(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B);if(M)for(let $=1;$<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight-$),M=Yr(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),y,F,B),!!M);$++);}if(d){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),$=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*D,R+Math.floor(this._config.deviceCharHeight/2)-$),this._tmpCtx.stroke()}this._tmpCtx.restore();let O=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=Kc(O):P=Yr(O,y,F,B),P)return $n;let b=this._findGlyphBoundingBox(O,this._workBoundingBox,f,I,z,R),E,L;for(;;){if(this._activePages.length===0){let M=this._createNewPage();E=M,L=M.currentRow,L.height=b.size.y;break}E=this._activePages[this._activePages.length-1],L=E.currentRow;for(let M of this._activePages)b.size.y<=M.currentRow.height&&(E=M,L=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let $ of this._activePages[M].fixedRows)$.height<=L.height&&b.size.y<=$.height&&(E=this._activePages[M],L=$);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Vr(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,L=this._overflowSizePage.currentRow,L.x+b.size.x>=E.canvas.width&&(L.x=0,L.y+=L.height,L.height=0);break}if(L.y+b.size.y>=E.canvas.height||L.height>b.size.y+2){let M=!1;if(E.currentRow.y+E.currentRow.height+b.size.y>=E.canvas.height){let $;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y<K.canvas.height){$=K;break}if($)E=$;else if(Ft.maxAtlasPages&&this._pages.length>=Ft.maxAtlasPages&&L.y+b.size.y<=E.canvas.height&&L.height>=b.size.y&&L.x+b.size.x<=E.canvas.width)M=!0;else{let K=this._createNewPage();E=K,L=K.currentRow,L.height=b.size.y,M=!0}}M||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),L={x:0,y:E.currentRow.y+E.currentRow.height,height:b.size.y},E.fixedRows.push(L),E.currentRow={x:0,y:L.y+L.height,height:0})}if(L.x+b.size.x<=E.canvas.width)break;L===E.currentRow?(L.x=0,L.y+=L.height,L.height=0):E.fixedRows.splice(E.fixedRows.indexOf(L),1)}return b.texturePage=this._pages.indexOf(E),b.texturePosition.x=L.x,b.texturePosition.y=L.y,b.texturePositionClipSpace.x=L.x/E.canvas.width,b.texturePositionClipSpace.y=L.y/E.canvas.height,b.sizeClipSpace.x/=E.canvas.width,b.sizeClipSpace.y/=E.canvas.height,L.height=Math.max(L.height,b.size.y),L.x+=b.size.x,E.ctx.putImageData(O,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),E.addGlyph(b),E.version++,b}_findGlyphBoundingBox(t,i,o,h,r,s){i.top=0;let a=h?this._config.deviceCellHeight:this._tmpCanvas.height,f=h?this._config.deviceCellWidth:o,n=!1;for(let _=0;_<a;_++){for(let g=0;g<f;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.top=_,n=!0;break}}if(n)break}i.left=0,n=!1;for(let _=0;_<s+f;_++){for(let g=0;g<a;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.left=_,n=!0;break}}if(n)break}i.right=f,n=!1;for(let _=s+f-1;_>=s;_--){for(let g=0;g<a;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.right=_,n=!0;break}}if(n)break}i.bottom=a,n=!1;for(let _=a-1;_>=0;_--){for(let g=0;g<f;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.bottom=_,n=!0;break}}if(n)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+s+(h||r?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+s+(h||r?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Vr=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let o of i)this._glyphs.push(...o.glyphs),this._usedPixels+=o._usedPixels;this.canvas=No(e,t,t),this.ctx=be(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Yr(e,t,i,o){let h=t.rgba>>>24,r=t.rgba>>>16&255,s=t.rgba>>>8&255,a=i.rgba>>>24,f=i.rgba>>>16&255,n=i.rgba>>>8&255,_=Math.floor((Math.abs(h-a)+Math.abs(r-f)+Math.abs(s-n))/12),g=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===h&&e.data[S+1]===r&&e.data[S+2]===s||o&&Math.abs(e.data[S]-h)+Math.abs(e.data[S+1]-r)+Math.abs(e.data[S+2]-s)<_?e.data[S+3]=0:g=!1;return g}function Kc(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function No(e,t,i){let o=e.createElement("canvas");return o.width=t,o.height=i,o}function Gc(e,t,i,o,h,r,s,a){let f={foreground:r.foreground,background:r.background,cursor:Ne,cursorAccent:Ne,selectionForeground:Ne,selectionBackgroundTransparent:Ne,selectionBackgroundOpaque:Ne,selectionInactiveBackgroundTransparent:Ne,selectionInactiveBackgroundOpaque:Ne,overviewRulerBorder:Ne,scrollbarSliderBackground:Ne,scrollbarSliderHoverBackground:Ne,scrollbarSliderActiveBackground:Ne,ansi:r.ansi.slice(),contrastCache:r.contrastCache,halfContrastCache:r.halfContrastCache};return{customGlyphs:h.customGlyphs,devicePixelRatio:s,deviceMaxTextureSize:a,letterSpacing:h.letterSpacing,lineHeight:h.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:o,fontFamily:h.fontFamily,fontSize:h.fontSize,fontWeight:h.fontWeight,fontWeightBold:h.fontWeightBold,allowTransparency:h.allowTransparency,drawBoldTextInBrightColors:h.drawBoldTextInBrightColors,minimumContrastRatio:h.minimumContrastRatio,colors:f}}function zn(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function Vc(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Fe=[];function Ho(e,t,i,o,h,r,s,a,f){let n=Gc(o,h,r,s,t,i,a,f);for(let S=0;S<Fe.length;S++){let p=Fe[S],c=p.ownedBy.indexOf(e);if(c>=0){if(zn(p.config,n))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),Fe.splice(S,1)):p.ownedBy.splice(c,1);break}}for(let S=0;S<Fe.length;S++){let p=Fe[S];if(zn(p.config,n))return p.ownedBy.push(e),p.atlas}let _=e._core,g={atlas:new ut(document,n,_.unicodeService),config:n,ownedBy:[e]};return Fe.push(g),g.atlas}function Un(e){for(let t=0;t<Fe.length;t++){let i=Fe[t].ownedBy.indexOf(e);if(i!==-1){Fe[t].ownedBy.length===1?(Fe[t].atlas.dispose(),Fe.splice(t,1)):Fe[t].ownedBy.splice(i,1);break}}}var Vi=600,Yc=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Vi){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Vi-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Vi-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Vi)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function jn(e,t,i){let o=new t.ResizeObserver(h=>{let r=h.find(f=>f.target===e);if(!r)return;if(!("devicePixelContentBoxSize"in r)){o?.disconnect(),o=void 0;return}let s=r.devicePixelContentBoxSize[0].inlineSize,a=r.devicePixelContentBoxSize[0].blockSize;s>0&&a>0&&i(s,a)});try{o.observe(e,{box:["device-pixel-content-box"]})}catch{o.disconnect(),o=void 0}return Le(()=>o?.disconnect())}function Xc(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var qn=class Fo extends $t{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ao,this.combinedData=""}static fromCharData(t){let i=new Fo;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Xc(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let o=t[1].charCodeAt(0);if(55296<=o&&o<=56319){let h=t[1].charCodeAt(1);56320<=h&&h<=57343?this.content=(o-55296)*1024+h-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Wo=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function $o(e,t,i){let o=be(e.createProgram());if(e.attachShader(o,be(Kn(e,e.VERTEX_SHADER,t))),e.attachShader(o,be(Kn(e,e.FRAGMENT_SHADER,i))),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return o;console.error(e.getProgramInfoLog(o)),e.deleteProgram(o)}function Kn(e,t,i){let o=be(e.createShader(t));if(e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;console.error(e.getShaderInfoLog(o)),e.deleteShader(o)}function Jc(e,t){let i=Math.min(e.length*2,t),o=new Float32Array(i);for(let h=0;h<e.length;h++)o[h]=e[h];return o}var Zc=class{constructor(e){this.texture=e,this.version=-1}},Qc=`#version 300 es
|
|
62
62
|
layout (location = 0) in vec2 a_unitquad;
|
|
63
63
|
layout (location = 1) in vec2 a_cellpos;
|
|
64
64
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -78,7 +78,7 @@ void main() {
|
|
|
78
78
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
79
79
|
v_texpage = int(a_texpage);
|
|
80
80
|
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
81
|
-
}`;function
|
|
81
|
+
}`;function eh(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
82
82
|
precision lowp float;
|
|
83
83
|
|
|
84
84
|
in vec2 v_texcoord;
|
|
@@ -92,7 +92,7 @@ void main() {
|
|
|
92
92
|
if (v_texpage == 0) {
|
|
93
93
|
outColor = texture(u_texture[0], v_texcoord);
|
|
94
94
|
} ${t}
|
|
95
|
-
}`}var ft=11,
|
|
95
|
+
}`}var ft=11,Ht=ft*Float32Array.BYTES_PER_ELEMENT,th=2,_e=0,ue,Xr=0,ci=0,ih=class extends Oe{constructor(e,t,i,o){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=o,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let h=this._gl;ut.maxAtlasPages===void 0&&(ut.maxAtlasPages=Math.min(32,be(h.getParameter(h.MAX_TEXTURE_IMAGE_UNITS))),ut.maxTextureSize=be(h.getParameter(h.MAX_TEXTURE_SIZE))),this._program=be($o(h,Qc,eh(ut.maxAtlasPages))),this._register(Le(()=>h.deleteProgram(this._program))),this._projectionLocation=be(h.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=be(h.getUniformLocation(this._program,"u_resolution")),this._textureLocation=be(h.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let r=new Float32Array([0,0,1,0,0,1,1,1]),s=h.createBuffer();this._register(Le(()=>h.deleteBuffer(s))),h.bindBuffer(h.ARRAY_BUFFER,s),h.bufferData(h.ARRAY_BUFFER,r,h.STATIC_DRAW),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=h.createBuffer();this._register(Le(()=>h.deleteBuffer(f))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f),h.bufferData(h.ELEMENT_ARRAY_BUFFER,a,h.STATIC_DRAW),this._attributesBuffer=be(h.createBuffer()),this._register(Le(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,2,h.FLOAT,!1,Ht,0),h.vertexAttribDivisor(2,1),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,h.FLOAT,!1,Ht,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(3,1),h.enableVertexAttribArray(4),h.vertexAttribPointer(4,1,h.FLOAT,!1,Ht,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(4,1),h.enableVertexAttribArray(5),h.vertexAttribPointer(5,2,h.FLOAT,!1,Ht,5*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(5,1),h.enableVertexAttribArray(6),h.vertexAttribPointer(6,2,h.FLOAT,!1,Ht,7*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(6,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,Ht,9*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.useProgram(this._program);let n=new Int32Array(ut.maxAtlasPages);for(let _=0;_<ut.maxAtlasPages;_++)n[_]=_;h.uniform1iv(this._textureLocation,n),h.uniformMatrix4fv(this._projectionLocation,!1,Wo),this._atlasTextures=[];for(let _=0;_<ut.maxAtlasPages;_++){let g=new Zc(be(h.createTexture()));this._register(Le(()=>h.deleteTexture(g.texture))),h.activeTexture(h.TEXTURE0+_),h.bindTexture(h.TEXTURE_2D,g.texture),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,1,1,0,h.RGBA,h.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=g}h.enable(h.BLEND),h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,o,h,r,s,a,f){this._updateCell(this._vertices.attributes,e,t,i,o,h,r,s,a,f)}_updateCell(e,t,i,o,h,r,s,a,f,n){if(_e=(i*this._terminal.cols+t)*ft,o===0||o===void 0){e.fill(0,_e,_e+ft-1-th);return}this._atlas&&(a&&a.length>1?ue=this._atlas.getRasterizedGlyphCombinedChar(a,h,r,s,!1,this._terminal.element):ue=this._atlas.getRasterizedGlyph(o,h,r,s,!1,this._terminal.element),Xr=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),h!==n&&ue.offset.x>Xr?(ci=ue.offset.x-Xr,e[_e]=-(ue.offset.x-ci)+this._dimensions.device.char.left,e[_e+1]=-ue.offset.y+this._dimensions.device.char.top,e[_e+2]=(ue.size.x-ci)/this._dimensions.device.canvas.width,e[_e+3]=ue.size.y/this._dimensions.device.canvas.height,e[_e+4]=ue.texturePage,e[_e+5]=ue.texturePositionClipSpace.x+ci/this._atlas.pages[ue.texturePage].canvas.width,e[_e+6]=ue.texturePositionClipSpace.y,e[_e+7]=ue.sizeClipSpace.x-ci/this._atlas.pages[ue.texturePage].canvas.width,e[_e+8]=ue.sizeClipSpace.y):(e[_e]=-ue.offset.x+this._dimensions.device.char.left,e[_e+1]=-ue.offset.y+this._dimensions.device.char.top,e[_e+2]=ue.size.x/this._dimensions.device.canvas.width,e[_e+3]=ue.size.y/this._dimensions.device.canvas.height,e[_e+4]=ue.texturePage,e[_e+5]=ue.texturePositionClipSpace.x,e[_e+6]=ue.texturePositionClipSpace.y,e[_e+7]=ue.sizeClipSpace.x,e[_e+8]=ue.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&mc(o,f,ue.size.x,this._dimensions.device.cell.width)&&(e[_e+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ft;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let o=0;o<e.rows;o++)for(let h=0;h<e.cols;h++)this._vertices.attributes[i+9]=h/e.cols,this._vertices.attributes[i+10]=o/e.rows,i+=ft}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],o=0;for(let h=0;h<e.lineLengths.length;h++){let r=h*this._terminal.cols*ft,s=this._vertices.attributes.subarray(r,r+e.lineLengths[h]*ft);i.set(s,o),o+=s.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,o),t.STREAM_DRAW);for(let h=0;h<this._atlas.pages.length;h++)this._atlas.pages[h].version!==this._atlasTextures[h].version&&this._bindAtlasPageTexture(t,this._atlas,h);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,o/ft)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},rh=class{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(e,t,i,o=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let h=e.buffers.active.ydisp,r=t[1]-h,s=i[1]-h,a=Math.max(r,0),f=Math.min(s,e.rows-1);if(a>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=o,this.viewportStartRow=r,this.viewportEndRow=s,this.viewportCappedStartRow=a,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function sh(){return new rh}var nr=4,Qi=1,er=2,Jr=3,nh=2147483648,oh=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=sh()}resize(e,t){let i=e*t*nr;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},ah=`#version 300 es
|
|
96
96
|
layout (location = 0) in vec2 a_position;
|
|
97
97
|
layout (location = 1) in vec2 a_size;
|
|
98
98
|
layout (location = 2) in vec4 a_color;
|
|
@@ -106,7 +106,7 @@ void main() {
|
|
|
106
106
|
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
107
107
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
108
108
|
v_color = a_color;
|
|
109
|
-
}`,
|
|
109
|
+
}`,lh=`#version 300 es
|
|
110
110
|
precision lowp float;
|
|
111
111
|
|
|
112
112
|
in vec4 v_color;
|
|
@@ -115,7 +115,7 @@ out vec4 outColor;
|
|
|
115
115
|
|
|
116
116
|
void main() {
|
|
117
117
|
outColor = v_color;
|
|
118
|
-
}`,ot=8,Xs=ot*Float32Array.BYTES_PER_ELEMENT,oh=20*ot,jn=class{constructor(){this.attributes=new Float32Array(oh),this.count=0}},rt=0,qn=0,Kn=0,Gn=0,Vn=0,Yn=0,Xn=0,ah=class extends Oe{constructor(e,t,i,o){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=o,this._vertices=new jn,this._verticesCursor=new jn;let h=this._gl;this._program=be(Ho(h,rh,nh)),this._register(Le(()=>h.deleteProgram(this._program))),this._projectionLocation=be(h.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),r=h.createBuffer();this._register(Le(()=>h.deleteBuffer(r))),h.bindBuffer(h.ARRAY_BUFFER,r),h.bufferData(h.ARRAY_BUFFER,s,h.STATIC_DRAW),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=h.createBuffer();this._register(Le(()=>h.deleteBuffer(f))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f),h.bufferData(h.ELEMENT_ARRAY_BUFFER,a,h.STATIC_DRAW),this._attributesBuffer=be(h.createBuffer()),this._register(Le(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,Xs,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,Xs,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,Xs,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this._register(this._themeService.onChangeColors(n=>{this._updateCachedColors(n),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,No),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,o=1,h,s,r,a,f,n,_,v,S,p,c;for(h=0;h<t.rows;h++){for(r=-1,a=0,f=0,n=!1,s=0;s<t.cols;s++)_=(h*t.cols+s)*ss,v=e.cells[_+Ji],S=e.cells[_+Zi],p=!!(S&67108864),(v!==a||S!==f&&(n||p))&&((a!==0||n&&f!==0)&&(c=o++*ot,this._updateRectangle(i,c,f,a,r,s,h)),r=s,a=v,f=S,n=p);(a!==0||n&&f!==0)&&(c=o++*ot,this._updateRectangle(i,c,f,a,r,t.cols,h))}i.count=o}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let o,h=0;(i.style==="bar"||i.style==="outline")&&(o=h++*ot,this._addRectangleFloat(t.attributes,o,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(o=h++*ot,this._addRectangleFloat(t.attributes,o,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(o=h++*ot,this._addRectangleFloat(t.attributes,o,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),o=h++*ot,this._addRectangleFloat(t.attributes,o,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=h}_updateRectangle(e,t,i,o,h,s,r){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:rt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:rt=(i&16777215)<<8;break;default:rt=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:rt=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:rt=(o&16777215)<<8;break;default:rt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=Vc(e.attributes,this._terminal.rows*this._terminal.cols*ot)),qn=h*this._dimensions.device.cell.width,Kn=r*this._dimensions.device.cell.height,Gn=(rt>>24&255)/255,Vn=(rt>>16&255)/255,Yn=(rt>>8&255)/255,Xn=1,this._addRectangle(e.attributes,t,qn,Kn,(s-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Gn,Vn,Yn,Xn)}_addRectangle(e,t,i,o,h,s,r,a,f,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=o/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r,e[t+5]=a,e[t+6]=f,e[t+7]=n}_addRectangleFloat(e,t,i,o,h,s,r){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=o/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=r[0],e[t+5]=r[1],e[t+6]=r[2],e[t+7]=r[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},lh=class extends Oe{constructor(e,t,i,o,h,s,r,a){super(),this._container=t,this._alpha=h,this._coreBrowserService=s,this._optionsService=r,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(e,f),this.reset(e)})),this._register(Le(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=be(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,o=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Oo(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,o){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,o){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=yo,this._clipCell(i,o,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let o=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${o} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},ch=class extends lh{constructor(e,t,i,o,h,s,r){super(i,e,"link",t,!0,h,s,r),this._register(o.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(o.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&qc(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ze=typeof window=="object"?window:globalThis,_r=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let o=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(o,t),this._onDidChangeZoomLevel.fire(o)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let o=this.getWindowId(i);this.mapWindowIdToFullScreen.set(o,t),this._onDidChangeFullscreen.fire(o)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};_r.INSTANCE=new _r;var Fo=_r;function hh(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var Af=Fo.INSTANCE.onDidChangeZoomLevel,Df=Fo.INSTANCE.onDidChangeFullscreen,Ut=typeof navigator=="object"?navigator.userAgent:"",Bf=Ut.indexOf("Firefox")>=0,Js=Ut.indexOf("AppleWebKit")>=0,dh=Ut.indexOf("Chrome")>=0,uh=!dh&&Ut.indexOf("Safari")>=0,Pf=Ut.indexOf("Electron/")>=0,Of=Ut.indexOf("Android")>=0,Qi=!1;if(typeof ze.matchMedia=="function"){let e=ze.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ze.matchMedia("(display-mode: fullscreen)");Qi=e.matches,hh(ze,e,({matches:i})=>{Qi&&t.matches||(Qi=i)})}function fh(){return Qi}var Wt="en",pr=!1,vr=!1,es=!1,_h=!1,Wo=!1,$o=!1,ph=!1,vh=!1,gh=!1,mh=!1,Gi,ts=Wt,Jn=Wt,bh,nt,lt=globalThis,Pe;typeof lt.vscode<"u"&&typeof lt.vscode.process<"u"?Pe=lt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Pe=process);var zo=typeof Pe?.versions?.electron=="string",wh=zo&&Pe?.type==="renderer";if(typeof Pe=="object"){pr=Pe.platform==="win32",vr=Pe.platform==="darwin",es=Pe.platform==="linux",_h=es&&!!Pe.env.SNAP&&!!Pe.env.SNAP_REVISION,ph=zo,gh=!!Pe.env.CI||!!Pe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Gi=Wt,ts=Wt;let e=Pe.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Gi=t.userLocale,Jn=t.osLocale,ts=t.resolvedLanguage||Wt,bh=t.languagePack?.translationsConfigFile}catch{}Wo=!0}else typeof navigator=="object"&&!wh?(nt=navigator.userAgent,pr=nt.indexOf("Windows")>=0,vr=nt.indexOf("Macintosh")>=0,vh=(nt.indexOf("Macintosh")>=0||nt.indexOf("iPad")>=0||nt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,es=nt.indexOf("Linux")>=0,mh=nt?.indexOf("Mobi")>=0,$o=!0,ts=globalThis._VSCODE_NLS_LANGUAGE||Wt,Gi=navigator.language.toLowerCase(),Jn=Gi):console.error("Unable to resolve platform.");var Zs=0;vr?Zs=1:pr?Zs=3:es&&(Zs=2);var Qs=Wo,Sh=$o&&typeof lt.importScripts=="function",If=Sh?lt.origin:void 0,Ye=nt,ht=ts,Zn;(e=>{function t(){return ht}e.value=t;function i(){return ht.length===2?ht==="en":ht.length>=3?ht[0]==="e"&&ht[1]==="n"&&ht[2]==="-":!1}e.isDefaultVariant=i;function o(){return ht==="en"}e.isDefault=o})(Zn||(Zn={}));var Ch=typeof lt.postMessage=="function"&&!lt.importScripts,yh=(()=>{if(Ch){let e=[];lt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let o=0,h=e.length;o<h;o++){let s=e[o];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(o,1),s.callback();return}}});let t=0;return i=>{let o=++t;e.push({id:o,callback:i}),lt.postMessage({vscodeScheduleAsyncWork:o},"*")}}return e=>setTimeout(e)})(),xh=!!(Ye&&Ye.indexOf("Chrome")>=0),Nf=!!(Ye&&Ye.indexOf("Firefox")>=0),Hf=!!(!xh&&Ye&&Ye.indexOf("Safari")>=0),Ff=!!(Ye&&Ye.indexOf("Edg/")>=0),Wf=!!(Ye&&Ye.indexOf("Android")>=0),dt=typeof navigator=="object"?navigator:{},$f={clipboard:{writeText:Qs||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(dt&&dt.clipboard&&dt.clipboard.writeText),readText:Qs||!!(dt&&dt.clipboard&&dt.clipboard.readText)},keyboard:Qs||fh()?0:dt.keyboard||uh?1:2,touch:"ontouchstart"in ze||dt.maxTouchPoints>0,pointerEvents:ze.PointerEvent&&("ontouchstart"in ze||navigator.maxTouchPoints>0)},Sr=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},er=new Sr,Qn=new Sr,eo=new Sr,zf=new Array(230),to;(e=>{function t(a){return er.keyCodeToStr(a)}e.toString=t;function i(a){return er.strToKeyCode(a)}e.fromString=i;function o(a){return Qn.keyCodeToStr(a)}e.toUserSettingsUS=o;function h(a){return eo.keyCodeToStr(a)}e.toUserSettingsGeneral=h;function s(a){return Qn.strToKeyCode(a)||eo.strToKeyCode(a)}e.fromUserSettings=s;function r(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return er.keyCodeToStr(a)}e.toElectronAccelerator=r})(to||(to={}));var Uo=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),io;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof kh?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ve.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Uo})})(io||(io={}));var kh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Uo:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Eh,tr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?tr=(e,t)=>{yh(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:tr=(e,t,i)=>{let o=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(o))}}},Eh=e=>tr(globalThis,e)})();var so;(e=>{async function t(o){let h,s=await Promise.all(o.map(r=>r.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return s}e.settled=t;function i(o){return new Promise(async(h,s)=>{try{await o(h,s)}catch(r){s(r)}})}e.withAsyncBody=i})(so||(so={}));var ro=class He{static fromArray(t){return new He(i=>{i.emitMany(t)})}static fromPromise(t){return new He(async i=>{i.emitMany(await t)})}static fromPromises(t){return new He(async i=>{await Promise.all(t.map(async o=>i.emitOne(await o)))})}static merge(t){return new He(async i=>{await Promise.all(t.map(async o=>{for await(let h of o)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new de,queueMicrotask(async()=>{let o={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(o)),this.resolve()}catch(h){this.reject(h)}finally{o.emitOne=void 0,o.emitMany=void 0,o.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ve.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new He(async o=>{for await(let h of t)o.emitOne(i(h))})}map(t){return He.map(this,t)}static filter(t,i){return new He(async o=>{for await(let h of t)i(h)&&o.emitOne(h)})}filter(t){return He.filter(this,t)}static coalesce(t){return He.filter(t,i=>!!i)}coalesce(){return He.coalesce(this)}static async toPromise(t){let i=[];for await(let o of t)i.push(o);return i}toPromise(){return He.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};ro.EMPTY=ro.fromArray([]);function Lh(e){return 55296<=e&&e<=56319}function no(e){return 56320<=e&&e<=57343}function Mh(e,t){return(e-55296<<10)+(t-56320)+65536}function Rh(e){return Cr(e,0)}function Cr(e,t){switch(typeof e){case"object":return e===null?at(349,t):Array.isArray(e)?Ah(e,t):Dh(e,t);case"string":return jo(e,t);case"boolean":return Th(e,t);case"number":return at(e,t);case"undefined":return at(937,t);default:return at(617,t)}}function at(e,t){return(t<<5)-t+e|0}function Th(e,t){return at(e?433:863,t)}function jo(e,t){t=at(149417,t);for(let i=0,o=e.length;i<o;i++)t=at(e.charCodeAt(i),t);return t}function Ah(e,t){return t=at(104579,t),e.reduce((i,o)=>Cr(o,i),t)}function Dh(e,t){return t=at(181387,t),Object.keys(e).sort().reduce((i,o)=>(i=jo(o,i),Cr(e[o],i)),t)}function ir(e,t,i=32){let o=i-t,h=~((1<<o)-1);return(e<<t|(h&e)>>>o)>>>0}function oo(e,t=0,i=e.byteLength,o=0){for(let h=0;h<i;h++)e[t+h]=o}function Bh(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function ci(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):Bh((e>>>0).toString(16),t/4)}var Ph=class qo{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let o=this._buff,h=this._buffLen,s=this._leftoverHighSurrogate,r,a;for(s!==0?(r=s,a=-1,s=0):(r=t.charCodeAt(0),a=0);;){let f=r;if(Lh(r))if(a+1<i){let n=t.charCodeAt(a+1);no(n)?(a++,f=Mh(r,n)):f=65533}else{s=r;break}else no(r)&&(f=65533);if(h=this._push(o,h,f),a++,a<i)r=t.charCodeAt(a);else break}this._buffLen=h,this._leftoverHighSurrogate=s}_push(t,i,o){return o<128?t[i++]=o:o<2048?(t[i++]=192|(o&1984)>>>6,t[i++]=128|(o&63)>>>0):o<65536?(t[i++]=224|(o&61440)>>>12,t[i++]=128|(o&4032)>>>6,t[i++]=128|(o&63)>>>0):(t[i++]=240|(o&1835008)>>>18,t[i++]=128|(o&258048)>>>12,t[i++]=128|(o&4032)>>>6,t[i++]=128|(o&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ci(this._h0)+ci(this._h1)+ci(this._h2)+ci(this._h3)+ci(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,oo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),oo(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=qo._bigBlock32,i=this._buffDV;for(let v=0;v<64;v+=4)t.setUint32(v,i.getUint32(v,!1),!1);for(let v=64;v<320;v+=4)t.setUint32(v,ir(t.getUint32(v-12,!1)^t.getUint32(v-32,!1)^t.getUint32(v-56,!1)^t.getUint32(v-64,!1),1),!1);let o=this._h0,h=this._h1,s=this._h2,r=this._h3,a=this._h4,f,n,_;for(let v=0;v<80;v++)v<20?(f=h&s|~h&r,n=1518500249):v<40?(f=h^s^r,n=1859775393):v<60?(f=h&s|h&r|s&r,n=2400959708):(f=h^s^r,n=3395469782),_=ir(o,5)+f+a+n+t.getUint32(v*4,!1)&4294967295,a=r,r=s,s=ir(h,30),h=o,o=_;this._h0=this._h0+o&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+a&4294967295}};Ph._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Uf,getWindow:Oh,getDocument:jf,getWindows:qf,getWindowsCount:Kf,getWindowId:ao,getWindowById:Gf,hasWindow:Vf,onDidRegisterWindow:Yf,onWillUnregisterWindow:Xf,onDidUnregisterWindow:Jf}=(function(){let e=new Map,t={window:ze,disposables:new $t};e.set(ze.vscodeWindowId,t);let i=new de,o=new de,h=new de;function s(r,a){return(typeof r=="number"?e.get(r):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:o.event,registerWindow(r){if(e.has(r.vscodeWindowId))return Oe.None;let a=new $t,f={window:r,disposables:a.add(new $t)};return e.set(r.vscodeWindowId,f),a.add(Le(()=>{e.delete(r.vscodeWindowId),o.fire(r)})),a.add(gr(r,Hh.BEFORE_UNLOAD,()=>{h.fire(r)})),i.fire(f),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return e.has(r)},getWindowById:s,getWindow(r){let a=r;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let f=r;return f?.view?f.view.window:ze},getDocument(r){return Oh(r).document}}})(),Ih=class{constructor(e,t,i,o){this._node=e,this._type=t,this._handler=i,this._options=o||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function gr(e,t,i,o){return new Ih(e,t,i,o)}var Nh,lo,sr=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Vi(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,o=new Map,h=s=>{i.set(s,!1);let r=e.get(s)??[];for(t.set(s,r),e.set(s,[]),o.set(s,!0);r.length>0;)r.sort(sr.sort),r.shift().execute();o.set(s,!1)};lo=(s,r,a=0)=>{let f=ao(s),n=new sr(r,a),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(n),i.get(f)||(i.set(f,!0),s.requestAnimationFrame(()=>h(f))),n},Nh=(s,r,a)=>{let f=ao(s);if(o.get(f)){let n=new sr(r,a),_=t.get(f);return _||(_=[],t.set(f,_)),_.push(n),n}else return lo(s,r,a)}})();var co=class is{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new is(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof is?t:new is(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};co.None=new co(0,0);var Zf=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let o=this.mutationObservers.get(e);o||(o=new Map,this.mutationObservers.set(e,o));let h=Rh(i),s=o.get(h);if(s)s.users+=1;else{let r=new de,a=new MutationObserver(n=>r.fire(n));a.observe(e,i);let f=s={users:1,observer:a,onDidMutate:r.event};t.add(Le(()=>{f.users-=1,f.users===0&&(r.dispose(),a.disconnect(),o?.delete(h),o?.size===0&&this.mutationObservers.delete(e))})),o.set(h,s)}return s.onDidMutate}},Hh={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Js?"webkitAnimationStart":"animationstart",ANIMATION_END:Js?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Js?"webkitAnimationIteration":"animationiteration"},Fh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Ko(e,t,i,...o){let h=Fh.exec(t);if(!h)throw new Error("Bad use of emmet");let s=h[1]||"div",r;return e!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(e,s):r=document.createElement(s),h[3]&&(r.id=h[3]),h[4]&&(r.className=h[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,f])=>{typeof f>"u"||(/^on\w+$/.test(a)?r[a]=f:a==="selected"?f&&r.setAttribute(a,"true"):r.setAttribute(a,f))}),r.append(...o),r}function Wh(e,t,...i){return Ko("http://www.w3.org/1999/xhtml",e,t,...i)}Wh.SVG=function(e,t,...i){return Ko("http://www.w3.org/2000/svg",e,t,...i)};var $h=class extends Oe{constructor(e,t,i,o,h,s,r,a,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=o,this._coreService=h,this._decorationService=s,this._optionsService=r,this._themeService=a,this._cursorBlinkStateManager=new ni,this._charAtlasDisposable=this._register(new ni),this._observerDisposable=this._register(new ni),this._model=new sh,this._workCell=new zn,this._workCell2=new zn,this._rectangleRenderer=this._register(new ni),this._glyphRenderer=this._register(new ni),this._onChangeTextureAtlas=this._register(new de),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new de),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new de),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new de),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new de),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let n={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",n),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new mc(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new ch(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,r,this._themeService)],this.dimensions=vc(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(r.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(gr(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(gr(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Wn(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=$n(this._canvas,this._coreBrowserService.window,(_,v)=>this._setCanvasDevicePixelDimensions(_,v)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=$n(this._canvas,_,(v,S)=>this._setCanvasDevicePixelDimensions(v,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Le(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),Wn(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new ah(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Qc(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Oo(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=mo(Ve.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ve.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Kc(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,o=this._workCell,h,s,r,a,f,n,_=0,v=!0,S,p,c,d,l,u,g,C,w;e=ho(e,i.rows-1,0),t=ho(t,i.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=m-i.buffer.ydisp,T=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,F=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let R=!1;for(s=e;s<=t;s++)for(r=s+i.buffer.ydisp,a=i.buffer.lines.get(r),this._model.lineLengths[s]=0,c=m===r,_=0,f=this._characterJoinerService.getJoinedCharacters(r),C=0;C<i.cols;C++){if(h=this._cellColorResolver.result.bg,a.loadCell(C,o),C===0&&(h=this._cellColorResolver.result.bg),n=!1,v=C>=_,S=C,f.length>0&&C===f[0][0]&&v){p=f.shift();let z=this._model.selection.isCellSelected(this._terminal,p[0],r);for(g=p[0]+1;g<p[1];g++)v&&(v=z===this._model.selection.isCellSelected(this._terminal,g,r));v&&(v=!c||T<p[0]||T>=p[1]),v?(n=!0,o=new zh(o,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),S=p[1]-1):_=p[1]}if(d=o.getChars(),l=o.getCode(),g=(s*i.cols+C)*ss,this._cellColorResolver.resolve(o,C,r,this.dimensions.device.cell.width),F&&r===m&&(C===T&&(this._model.cursor={x:T,y:x,width:o.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=T+o.getWidth()-1),C>=T&&C<=I&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),l!==0&&(this._model.lineLengths[s]=C+1),!(this._model.cells[g]===l&&this._model.cells[g+Ji]===this._cellColorResolver.result.bg&&this._model.cells[g+Zi]===this._cellColorResolver.result.fg&&this._model.cells[g+Ys]===this._cellColorResolver.result.ext)&&(R=!0,d.length>1&&(l|=ih),this._model.cells[g]=l,this._model.cells[g+Ji]=this._cellColorResolver.result.bg,this._model.cells[g+Zi]=this._cellColorResolver.result.fg,this._model.cells[g+Ys]=this._cellColorResolver.result.ext,u=o.getWidth(),this._glyphRenderer.value.updateCell(C,s,l,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,h),n)){for(o=this._workCell,C++;C<=S;C++)w=(s*i.cols+C)*ss,this._glyphRenderer.value.updateCell(C,s,0,0,0,0,hc,0,0),this._model.cells[w]=0,this._model.cells[w+Ji]=this._cellColorResolver.result.bg,this._model.cells[w+Zi]=this._cellColorResolver.result.fg,this._model.cells[w+Ys]=this._cellColorResolver.result.ext;C--}}R&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},zh=class extends Ft{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}};function ho(e,t,i=0){return Math.max(Math.min(e,t),i)}var uo="di$target",fo="di$dependencies",rr=new Map;function Xe(e){if(rr.has(e))return rr.get(e);let t=function(i,o,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Uh(t,i,h)};return t._id=e,rr.set(e,t),t}function Uh(e,t,i){t[uo]===t?t[fo].push({id:e,index:i}):(t[fo]=[{id:e,index:i}],t[uo]=t)}var Qf=Xe("BufferService"),e_=Xe("CoreMouseService"),t_=Xe("CoreService"),i_=Xe("CharsetService"),s_=Xe("InstantiationService"),r_=Xe("LogService"),jh=Xe("OptionsService"),n_=Xe("OscLinkService"),o_=Xe("UnicodeService"),a_=Xe("DecorationService"),qh={trace:0,debug:1,info:2,warn:3,error:4,off:5},Kh="xterm.js: ",_o=class extends Oe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Go=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=qh[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":Kh)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};_o=jl([ql(0,jh)],_o);var Go;function Gh(e){Go=e}var Vo=class extends Oe{constructor(e){if(So&&cc()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new de),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new de),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new de),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new de),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,o=t.optionsService,h=t,s=h._renderService,r=h._characterJoinerService,a=h._charSizeService,f=h._coreBrowserService,n=h._decorationService,_=h._logService,v=h._themeService;Gh(_),this._renderer=this._register(new $h(e,r,a,f,i,n,o,v,this._preserveDrawingBuffer)),this._register(Ve.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ve.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ve.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ve.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(Le(()=>{if(this._terminal._core._store._isDisposed)return;let S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Yo=`/**
|
|
118
|
+
}`,ot=8,Zr=ot*Float32Array.BYTES_PER_ELEMENT,ch=20*ot,Gn=class{constructor(){this.attributes=new Float32Array(ch),this.count=0}},st=0,Vn=0,Yn=0,Xn=0,Jn=0,Zn=0,Qn=0,hh=class extends Oe{constructor(e,t,i,o){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=o,this._vertices=new Gn,this._verticesCursor=new Gn;let h=this._gl;this._program=be($o(h,ah,lh)),this._register(Le(()=>h.deleteProgram(this._program))),this._projectionLocation=be(h.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=h.createVertexArray(),h.bindVertexArray(this._vertexArrayObject);let r=new Float32Array([0,0,1,0,0,1,1,1]),s=h.createBuffer();this._register(Le(()=>h.deleteBuffer(s))),h.bindBuffer(h.ARRAY_BUFFER,s),h.bufferData(h.ARRAY_BUFFER,r,h.STATIC_DRAW),h.enableVertexAttribArray(3),h.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),f=h.createBuffer();this._register(Le(()=>h.deleteBuffer(f))),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f),h.bufferData(h.ELEMENT_ARRAY_BUFFER,a,h.STATIC_DRAW),this._attributesBuffer=be(h.createBuffer()),this._register(Le(()=>h.deleteBuffer(this._attributesBuffer))),h.bindBuffer(h.ARRAY_BUFFER,this._attributesBuffer),h.enableVertexAttribArray(0),h.vertexAttribPointer(0,2,h.FLOAT,!1,Zr,0),h.vertexAttribDivisor(0,1),h.enableVertexAttribArray(1),h.vertexAttribPointer(1,2,h.FLOAT,!1,Zr,2*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(1,1),h.enableVertexAttribArray(2),h.vertexAttribPointer(2,4,h.FLOAT,!1,Zr,4*Float32Array.BYTES_PER_ELEMENT),h.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this._register(this._themeService.onChangeColors(n=>{this._updateCachedColors(n),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,Wo),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,o=1,h,r,s,a,f,n,_,g,S,p,c;for(h=0;h<t.rows;h++){for(s=-1,a=0,f=0,n=!1,r=0;r<t.cols;r++)_=(h*t.cols+r)*nr,g=e.cells[_+Qi],S=e.cells[_+er],p=!!(S&67108864),(g!==a||S!==f&&(n||p))&&((a!==0||n&&f!==0)&&(c=o++*ot,this._updateRectangle(i,c,f,a,s,r,h)),s=r,a=g,f=S,n=p);(a!==0||n&&f!==0)&&(c=o++*ot,this._updateRectangle(i,c,f,a,s,t.cols,h))}i.count=o}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let o,h=0;(i.style==="bar"||i.style==="outline")&&(o=h++*ot,this._addRectangleFloat(t.attributes,o,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(o=h++*ot,this._addRectangleFloat(t.attributes,o,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(o=h++*ot,this._addRectangleFloat(t.attributes,o,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),o=h++*ot,this._addRectangleFloat(t.attributes,o,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=h}_updateRectangle(e,t,i,o,h,r,s){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:st=(i&16777215)<<8;break;default:st=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:st=(o&16777215)<<8;break;default:st=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=Jc(e.attributes,this._terminal.rows*this._terminal.cols*ot)),Vn=h*this._dimensions.device.cell.width,Yn=s*this._dimensions.device.cell.height,Xn=(st>>24&255)/255,Jn=(st>>16&255)/255,Zn=(st>>8&255)/255,Qn=1,this._addRectangle(e.attributes,t,Vn,Yn,(r-h)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Xn,Jn,Zn,Qn)}_addRectangle(e,t,i,o,h,r,s,a,f,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=o/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=r/this._dimensions.device.canvas.height,e[t+4]=s,e[t+5]=a,e[t+6]=f,e[t+7]=n}_addRectangleFloat(e,t,i,o,h,r,s){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=o/this._dimensions.device.canvas.height,e[t+2]=h/this._dimensions.device.canvas.width,e[t+3]=r/this._dimensions.device.canvas.height,e[t+4]=s[0],e[t+5]=s[1],e[t+6]=s[2],e[t+7]=s[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},dh=class extends Oe{constructor(e,t,i,o,h,r,s,a){super(),this._container=t,this._alpha=h,this._coreBrowserService=r,this._optionsService=s,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(e,f),this.reset(e)})),this._register(Le(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=be(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,o=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Ho(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,o){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,o){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Eo,this._clipCell(i,o,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let o=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${o} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},uh=class extends dh{constructor(e,t,i,o,h,r,s){super(i,e,"link",t,!0,h,r,s),this._register(o.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(o.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Vc(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ze=typeof window=="object"?window:globalThis,gs=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let o=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(o,t),this._onDidChangeZoomLevel.fire(o)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let o=this.getWindowId(i);this.mapWindowIdToFullScreen.set(o,t),this._onDidChangeFullscreen.fire(o)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};gs.INSTANCE=new gs;var zo=gs;function fh(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var Of=zo.INSTANCE.onDidChangeZoomLevel,If=zo.INSTANCE.onDidChangeFullscreen,qt=typeof navigator=="object"?navigator.userAgent:"",Nf=qt.indexOf("Firefox")>=0,Qr=qt.indexOf("AppleWebKit")>=0,_h=qt.indexOf("Chrome")>=0,ph=!_h&&qt.indexOf("Safari")>=0,Hf=qt.indexOf("Electron/")>=0,Ff=qt.indexOf("Android")>=0,tr=!1;if(typeof ze.matchMedia=="function"){let e=ze.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ze.matchMedia("(display-mode: fullscreen)");tr=e.matches,fh(ze,e,({matches:i})=>{tr&&t.matches||(tr=i)})}function gh(){return tr}var zt="en",vs=!1,ms=!1,ir=!1,vh=!1,Uo=!1,jo=!1,mh=!1,bh=!1,wh=!1,Sh=!1,Yi,rr=zt,eo=zt,Ch,nt,lt=globalThis,Pe;typeof lt.vscode<"u"&&typeof lt.vscode.process<"u"?Pe=lt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Pe=process);var qo=typeof Pe?.versions?.electron=="string",yh=qo&&Pe?.type==="renderer";if(typeof Pe=="object"){vs=Pe.platform==="win32",ms=Pe.platform==="darwin",ir=Pe.platform==="linux",vh=ir&&!!Pe.env.SNAP&&!!Pe.env.SNAP_REVISION,mh=qo,wh=!!Pe.env.CI||!!Pe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Yi=zt,rr=zt;let e=Pe.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Yi=t.userLocale,eo=t.osLocale,rr=t.resolvedLanguage||zt,Ch=t.languagePack?.translationsConfigFile}catch{}Uo=!0}else typeof navigator=="object"&&!yh?(nt=navigator.userAgent,vs=nt.indexOf("Windows")>=0,ms=nt.indexOf("Macintosh")>=0,bh=(nt.indexOf("Macintosh")>=0||nt.indexOf("iPad")>=0||nt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ir=nt.indexOf("Linux")>=0,Sh=nt?.indexOf("Mobi")>=0,jo=!0,rr=globalThis._VSCODE_NLS_LANGUAGE||zt,Yi=navigator.language.toLowerCase(),eo=Yi):console.error("Unable to resolve platform.");var es=0;ms?es=1:vs?es=3:ir&&(es=2);var ts=Uo,xh=jo&&typeof lt.importScripts=="function",Wf=xh?lt.origin:void 0,Ye=nt,ht=rr,to;(e=>{function t(){return ht}e.value=t;function i(){return ht.length===2?ht==="en":ht.length>=3?ht[0]==="e"&&ht[1]==="n"&&ht[2]==="-":!1}e.isDefaultVariant=i;function o(){return ht==="en"}e.isDefault=o})(to||(to={}));var kh=typeof lt.postMessage=="function"&&!lt.importScripts,Eh=(()=>{if(kh){let e=[];lt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let o=0,h=e.length;o<h;o++){let r=e[o];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(o,1),r.callback();return}}});let t=0;return i=>{let o=++t;e.push({id:o,callback:i}),lt.postMessage({vscodeScheduleAsyncWork:o},"*")}}return e=>setTimeout(e)})(),Lh=!!(Ye&&Ye.indexOf("Chrome")>=0),$f=!!(Ye&&Ye.indexOf("Firefox")>=0),zf=!!(!Lh&&Ye&&Ye.indexOf("Safari")>=0),Uf=!!(Ye&&Ye.indexOf("Edg/")>=0),jf=!!(Ye&&Ye.indexOf("Android")>=0),dt=typeof navigator=="object"?navigator:{},qf={clipboard:{writeText:ts||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(dt&&dt.clipboard&&dt.clipboard.writeText),readText:ts||!!(dt&&dt.clipboard&&dt.clipboard.readText)},keyboard:ts||gh()?0:dt.keyboard||ph?1:2,touch:"ontouchstart"in ze||dt.maxTouchPoints>0,pointerEvents:ze.PointerEvent&&("ontouchstart"in ze||navigator.maxTouchPoints>0)},ys=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},is=new ys,io=new ys,ro=new ys,Kf=new Array(230),so;(e=>{function t(a){return is.keyCodeToStr(a)}e.toString=t;function i(a){return is.strToKeyCode(a)}e.fromString=i;function o(a){return io.keyCodeToStr(a)}e.toUserSettingsUS=o;function h(a){return ro.keyCodeToStr(a)}e.toUserSettingsGeneral=h;function r(a){return io.strToKeyCode(a)||ro.strToKeyCode(a)}e.fromUserSettings=r;function s(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return is.keyCodeToStr(a)}e.toElectronAccelerator=s})(so||(so={}));var Ko=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),no;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Mh?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ve.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ko})})(no||(no={}));var Mh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Ko:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Rh,rs;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?rs=(e,t)=>{Eh(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:rs=(e,t,i)=>{let o=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),h=!1;return{dispose(){h||(h=!0,e.cancelIdleCallback(o))}}},Rh=e=>rs(globalThis,e)})();var oo;(e=>{async function t(o){let h,r=await Promise.all(o.map(s=>s.then(a=>a,a=>{h||(h=a)})));if(typeof h<"u")throw h;return r}e.settled=t;function i(o){return new Promise(async(h,r)=>{try{await o(h,r)}catch(s){r(s)}})}e.withAsyncBody=i})(oo||(oo={}));var ao=class He{static fromArray(t){return new He(i=>{i.emitMany(t)})}static fromPromise(t){return new He(async i=>{i.emitMany(await t)})}static fromPromises(t){return new He(async i=>{await Promise.all(t.map(async o=>i.emitOne(await o)))})}static merge(t){return new He(async i=>{await Promise.all(t.map(async o=>{for await(let h of o)i.emitOne(h)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new de,queueMicrotask(async()=>{let o={emitOne:h=>this.emitOne(h),emitMany:h=>this.emitMany(h),reject:h=>this.reject(h)};try{await Promise.resolve(t(o)),this.resolve()}catch(h){this.reject(h)}finally{o.emitOne=void 0,o.emitMany=void 0,o.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ve.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new He(async o=>{for await(let h of t)o.emitOne(i(h))})}map(t){return He.map(this,t)}static filter(t,i){return new He(async o=>{for await(let h of t)i(h)&&o.emitOne(h)})}filter(t){return He.filter(this,t)}static coalesce(t){return He.filter(t,i=>!!i)}coalesce(){return He.coalesce(this)}static async toPromise(t){let i=[];for await(let o of t)i.push(o);return i}toPromise(){return He.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};ao.EMPTY=ao.fromArray([]);function Th(e){return 55296<=e&&e<=56319}function lo(e){return 56320<=e&&e<=57343}function Ah(e,t){return(e-55296<<10)+(t-56320)+65536}function Dh(e){return xs(e,0)}function xs(e,t){switch(typeof e){case"object":return e===null?at(349,t):Array.isArray(e)?Ph(e,t):Oh(e,t);case"string":return Go(e,t);case"boolean":return Bh(e,t);case"number":return at(e,t);case"undefined":return at(937,t);default:return at(617,t)}}function at(e,t){return(t<<5)-t+e|0}function Bh(e,t){return at(e?433:863,t)}function Go(e,t){t=at(149417,t);for(let i=0,o=e.length;i<o;i++)t=at(e.charCodeAt(i),t);return t}function Ph(e,t){return t=at(104579,t),e.reduce((i,o)=>xs(o,i),t)}function Oh(e,t){return t=at(181387,t),Object.keys(e).sort().reduce((i,o)=>(i=Go(o,i),xs(e[o],i)),t)}function ss(e,t,i=32){let o=i-t,h=~((1<<o)-1);return(e<<t|(h&e)>>>o)>>>0}function co(e,t=0,i=e.byteLength,o=0){for(let h=0;h<i;h++)e[t+h]=o}function Ih(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function hi(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):Ih((e>>>0).toString(16),t/4)}var Nh=class Vo{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let o=this._buff,h=this._buffLen,r=this._leftoverHighSurrogate,s,a;for(r!==0?(s=r,a=-1,r=0):(s=t.charCodeAt(0),a=0);;){let f=s;if(Th(s))if(a+1<i){let n=t.charCodeAt(a+1);lo(n)?(a++,f=Ah(s,n)):f=65533}else{r=s;break}else lo(s)&&(f=65533);if(h=this._push(o,h,f),a++,a<i)s=t.charCodeAt(a);else break}this._buffLen=h,this._leftoverHighSurrogate=r}_push(t,i,o){return o<128?t[i++]=o:o<2048?(t[i++]=192|(o&1984)>>>6,t[i++]=128|(o&63)>>>0):o<65536?(t[i++]=224|(o&61440)>>>12,t[i++]=128|(o&4032)>>>6,t[i++]=128|(o&63)>>>0):(t[i++]=240|(o&1835008)>>>18,t[i++]=128|(o&258048)>>>12,t[i++]=128|(o&4032)>>>6,t[i++]=128|(o&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),hi(this._h0)+hi(this._h1)+hi(this._h2)+hi(this._h3)+hi(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,co(this._buff,this._buffLen),this._buffLen>56&&(this._step(),co(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Vo._bigBlock32,i=this._buffDV;for(let g=0;g<64;g+=4)t.setUint32(g,i.getUint32(g,!1),!1);for(let g=64;g<320;g+=4)t.setUint32(g,ss(t.getUint32(g-12,!1)^t.getUint32(g-32,!1)^t.getUint32(g-56,!1)^t.getUint32(g-64,!1),1),!1);let o=this._h0,h=this._h1,r=this._h2,s=this._h3,a=this._h4,f,n,_;for(let g=0;g<80;g++)g<20?(f=h&r|~h&s,n=1518500249):g<40?(f=h^r^s,n=1859775393):g<60?(f=h&r|h&s|r&s,n=2400959708):(f=h^r^s,n=3395469782),_=ss(o,5)+f+a+n+t.getUint32(g*4,!1)&4294967295,a=s,s=r,r=ss(h,30),h=o,o=_;this._h0=this._h0+o&4294967295,this._h1=this._h1+h&4294967295,this._h2=this._h2+r&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};Nh._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Gf,getWindow:Hh,getDocument:Vf,getWindows:Yf,getWindowsCount:Xf,getWindowId:ho,getWindowById:Jf,hasWindow:Zf,onDidRegisterWindow:Qf,onWillUnregisterWindow:e_,onDidUnregisterWindow:t_}=(function(){let e=new Map,t={window:ze,disposables:new Ut};e.set(ze.vscodeWindowId,t);let i=new de,o=new de,h=new de;function r(s,a){return(typeof s=="number"?e.get(s):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:h.event,onDidUnregisterWindow:o.event,registerWindow(s){if(e.has(s.vscodeWindowId))return Oe.None;let a=new Ut,f={window:s,disposables:a.add(new Ut)};return e.set(s.vscodeWindowId,f),a.add(Le(()=>{e.delete(s.vscodeWindowId),o.fire(s)})),a.add(bs(s,$h.BEFORE_UNLOAD,()=>{h.fire(s)})),i.fire(f),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(s){return s.vscodeWindowId},hasWindow(s){return e.has(s)},getWindowById:r,getWindow(s){let a=s;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let f=s;return f?.view?f.view.window:ze},getDocument(s){return Hh(s).document}}})(),Fh=class{constructor(e,t,i,o){this._node=e,this._type=t,this._handler=i,this._options=o||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function bs(e,t,i,o){return new Fh(e,t,i,o)}var Wh,uo,ns=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Xi(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,o=new Map,h=r=>{i.set(r,!1);let s=e.get(r)??[];for(t.set(r,s),e.set(r,[]),o.set(r,!0);s.length>0;)s.sort(ns.sort),s.shift().execute();o.set(r,!1)};uo=(r,s,a=0)=>{let f=ho(r),n=new ns(s,a),_=e.get(f);return _||(_=[],e.set(f,_)),_.push(n),i.get(f)||(i.set(f,!0),r.requestAnimationFrame(()=>h(f))),n},Wh=(r,s,a)=>{let f=ho(r);if(o.get(f)){let n=new ns(s,a),_=t.get(f);return _||(_=[],t.set(f,_)),_.push(n),n}else return uo(r,s,a)}})();var fo=class sr{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new sr(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof sr?t:new sr(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};fo.None=new fo(0,0);var i_=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let o=this.mutationObservers.get(e);o||(o=new Map,this.mutationObservers.set(e,o));let h=Dh(i),r=o.get(h);if(r)r.users+=1;else{let s=new de,a=new MutationObserver(n=>s.fire(n));a.observe(e,i);let f=r={users:1,observer:a,onDidMutate:s.event};t.add(Le(()=>{f.users-=1,f.users===0&&(s.dispose(),a.disconnect(),o?.delete(h),o?.size===0&&this.mutationObservers.delete(e))})),o.set(h,r)}return r.onDidMutate}},$h={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Qr?"webkitAnimationStart":"animationstart",ANIMATION_END:Qr?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Qr?"webkitAnimationIteration":"animationiteration"},zh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Yo(e,t,i,...o){let h=zh.exec(t);if(!h)throw new Error("Bad use of emmet");let r=h[1]||"div",s;return e!=="http://www.w3.org/1999/xhtml"?s=document.createElementNS(e,r):s=document.createElement(r),h[3]&&(s.id=h[3]),h[4]&&(s.className=h[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,f])=>{typeof f>"u"||(/^on\w+$/.test(a)?s[a]=f:a==="selected"?f&&s.setAttribute(a,"true"):s.setAttribute(a,f))}),s.append(...o),s}function Uh(e,t,...i){return Yo("http://www.w3.org/1999/xhtml",e,t,...i)}Uh.SVG=function(e,t,...i){return Yo("http://www.w3.org/2000/svg",e,t,...i)};var jh=class extends Oe{constructor(e,t,i,o,h,r,s,a,f){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=o,this._coreService=h,this._decorationService=r,this._optionsService=s,this._themeService=a,this._cursorBlinkStateManager=new oi,this._charAtlasDisposable=this._register(new oi),this._observerDisposable=this._register(new oi),this._model=new oh,this._workCell=new qn,this._workCell2=new qn,this._rectangleRenderer=this._register(new oi),this._glyphRenderer=this._register(new oi),this._onChangeTextureAtlas=this._register(new de),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new de),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new de),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new de),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new de),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let n={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",n),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Sc(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new uh(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,s,this._themeService)],this.dimensions=bc(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(s.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(bs(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(bs(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Un(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=jn(this._canvas,this._coreBrowserService.window,(_,g)=>this._setCanvasDevicePixelDimensions(_,g)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=jn(this._canvas,_,(g,S)=>this._setCanvasDevicePixelDimensions(g,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Le(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),Un(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new hh(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new ih(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Ho(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=So(Ve.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ve.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Yc(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,o=this._workCell,h,r,s,a,f,n,_=0,g=!0,S,p,c,d,l,u,v,C,w;e=_o(e,i.rows-1,0),t=_o(t,i.rows-1,0);let y=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",m=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=m-i.buffer.ydisp,T=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,F=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let R=!1;for(r=e;r<=t;r++)for(s=r+i.buffer.ydisp,a=i.buffer.lines.get(s),this._model.lineLengths[r]=0,c=m===s,_=0,f=this._characterJoinerService.getJoinedCharacters(s),C=0;C<i.cols;C++){if(h=this._cellColorResolver.result.bg,a.loadCell(C,o),C===0&&(h=this._cellColorResolver.result.bg),n=!1,g=C>=_,S=C,f.length>0&&C===f[0][0]&&g){p=f.shift();let z=this._model.selection.isCellSelected(this._terminal,p[0],s);for(v=p[0]+1;v<p[1];v++)g&&(g=z===this._model.selection.isCellSelected(this._terminal,v,s));g&&(g=!c||T<p[0]||T>=p[1]),g?(n=!0,o=new qh(o,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),S=p[1]-1):_=p[1]}if(d=o.getChars(),l=o.getCode(),v=(r*i.cols+C)*nr,this._cellColorResolver.resolve(o,C,s,this.dimensions.device.cell.width),F&&s===m&&(C===T&&(this._model.cursor={x:T,y:x,width:o.getWidth(),style:this._coreBrowserService.isFocused?y:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=T+o.getWidth()-1),C>=T&&C<=I&&(this._coreBrowserService.isFocused&&y==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),l!==0&&(this._model.lineLengths[r]=C+1),!(this._model.cells[v]===l&&this._model.cells[v+Qi]===this._cellColorResolver.result.bg&&this._model.cells[v+er]===this._cellColorResolver.result.fg&&this._model.cells[v+Jr]===this._cellColorResolver.result.ext)&&(R=!0,d.length>1&&(l|=nh),this._model.cells[v]=l,this._model.cells[v+Qi]=this._cellColorResolver.result.bg,this._model.cells[v+er]=this._cellColorResolver.result.fg,this._model.cells[v+Jr]=this._cellColorResolver.result.ext,u=o.getWidth(),this._glyphRenderer.value.updateCell(C,r,l,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,h),n)){for(o=this._workCell,C++;C<=S;C++)w=(r*i.cols+C)*nr,this._glyphRenderer.value.updateCell(C,r,0,0,0,0,fc,0,0),this._model.cells[w]=0,this._model.cells[w+Qi]=this._cellColorResolver.result.bg,this._model.cells[w+er]=this._cellColorResolver.result.fg,this._model.cells[w+Jr]=this._cellColorResolver.result.ext;C--}}R&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},qh=class extends $t{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}};function _o(e,t,i=0){return Math.max(Math.min(e,t),i)}var po="di$target",go="di$dependencies",os=new Map;function Xe(e){if(os.has(e))return os.get(e);let t=function(i,o,h){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Kh(t,i,h)};return t._id=e,os.set(e,t),t}function Kh(e,t,i){t[po]===t?t[go].push({id:e,index:i}):(t[go]=[{id:e,index:i}],t[po]=t)}var r_=Xe("BufferService"),s_=Xe("CoreMouseService"),n_=Xe("CoreService"),o_=Xe("CharsetService"),a_=Xe("InstantiationService"),l_=Xe("LogService"),Gh=Xe("OptionsService"),c_=Xe("OscLinkService"),h_=Xe("UnicodeService"),d_=Xe("DecorationService"),Vh={trace:0,debug:1,info:2,warn:3,error:4,off:5},Yh="xterm.js: ",vo=class extends Oe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Xo=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Vh[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":Yh)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};vo=Gl([Vl(0,Gh)],vo);var Xo;function Xh(e){Xo=e}var Jo=class extends Oe{constructor(e){if(xo&&uc()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new de),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new de),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new de),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new de),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,o=t.optionsService,h=t,r=h._renderService,s=h._characterJoinerService,a=h._charSizeService,f=h._coreBrowserService,n=h._decorationService,_=h._logService,g=h._themeService;Xh(_),this._renderer=this._register(new jh(e,s,a,f,i,n,o,g,this._preserveDrawingBuffer)),this._register(Ve.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ve.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ve.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ve.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this._register(Le(()=>{if(this._terminal._core._store._isDisposed)return;let S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Zo=`/**
|
|
119
119
|
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
120
120
|
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
121
121
|
* https://github.com/chjj/term.js
|
|
@@ -333,7 +333,7 @@ void main() {
|
|
|
333
333
|
z-index: 2;
|
|
334
334
|
position: relative;
|
|
335
335
|
}
|
|
336
|
-
`;var
|
|
336
|
+
`;var Qo=`/* eslint-disable */
|
|
337
337
|
/**
|
|
338
338
|
* @hyzyn/dsh-tty \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
|
|
339
339
|
*
|
|
@@ -462,10 +462,15 @@ void main() {
|
|
|
462
462
|
|
|
463
463
|
.tt_sidebarEntry {
|
|
464
464
|
position: relative;
|
|
465
|
+
/* \u5BBF\u4E3B\u4E0D\u5BF9\u63D2\u4EF6 DOM \u505A\u5168\u5C40 box-sizing reset\uFF08\u5B83\u81EA\u5DF1\u7684\u7EC4\u4EF6\u90FD\u9010\u4E2A\u663E\u5F0F\u58F0\u660E\uFF09\uFF1A
|
|
466
|
+
width:100% + \u5DE6\u53F3\u5404 12px padding \u5728 content-box \u4E0B\u4F1A\u6BD4\u5BB9\u5668\u5BBD 24px\uFF0C\u591A\u51FA\u7684\u53F3\u4FA7
|
|
467
|
+
12px \u6B63\u597D\u662F\u5FBD\u6807\u6240\u5728\u5904\uFF0C\u88AB\u4FA7\u8FB9\u680F\u88C1\u6389 \u2192 \u5FBD\u6807\u8D34\u6B7B\u88C1\u5207\u7EBF\u3001\u672B\u4F4D\u5B57\u7B26\u88AB\u5207\u4E00\u534A\u3002 */
|
|
468
|
+
box-sizing: border-box;
|
|
465
469
|
display: flex;
|
|
466
470
|
align-items: center;
|
|
467
471
|
gap: var(--tt-gap-md);
|
|
468
472
|
width: 100%;
|
|
473
|
+
min-width: 0;
|
|
469
474
|
height: 32px;
|
|
470
475
|
padding: 0 12px;
|
|
471
476
|
border: none;
|
|
@@ -507,6 +512,9 @@ void main() {
|
|
|
507
512
|
[data-sidebar-collapsed] .tt_sidebarEntry {
|
|
508
513
|
justify-content: center;
|
|
509
514
|
width: 100%;
|
|
515
|
+
/* \u6298\u53E0 rail \u91CC\u5BBF\u4E3B\u7684\u884C\u662F 36\xD736\uFF08.hHd-Xa_collapsed .hHd-Xa_panelRow\uFF09\uFF0C\u8DDF\u9F50\uFF0C
|
|
516
|
+
\u5426\u5219\u672C\u63D2\u4EF6\u5165\u53E3\u6BD4\u540C\u680F\u5176\u5B83\u5165\u53E3\u77EE 4px */
|
|
517
|
+
height: 36px;
|
|
510
518
|
padding: 0;
|
|
511
519
|
}
|
|
512
520
|
[data-sidebar-collapsed] .tt_sidebarEntryLabel {
|
|
@@ -526,7 +534,13 @@ void main() {
|
|
|
526
534
|
.tt_sidebarEntry[data-minimized] .tt_sidebarEntryBadge {
|
|
527
535
|
display: inline-flex;
|
|
528
536
|
}
|
|
537
|
+
/* \u6298\u53E0\u6001\u5FBD\u6807\u53EA\u5269\u4E00\u4E2A\u72B6\u6001\u70B9\uFF1A\u5FC5\u987B\u8131\u79BB flex \u6D41\u5F53\u89D2\u6807\u3002\u7559\u5728\u6D41\u91CC\u7684\u8BDD\uFF0C\u5B83\u548C\u56FE\u6807\u4E00\u8D77\u88AB
|
|
538
|
+
justify-content:center \u5C45\u4E2D\uFF0818 \u56FE\u6807 + 8 \u95F4\u8DDD + 7 \u70B9 = 33px\uFF09\uFF0C\u56FE\u6807\u88AB\u9876\u504F 7.5px\uFF0C
|
|
539
|
+
\u4E0E\u540C\u680F\u5176\u5B83\u6298\u53E0\u5165\u53E3\u7684\u56FE\u6807\u9519\u4F4D\u3002 */
|
|
529
540
|
[data-sidebar-collapsed] .tt_sidebarEntryBadge {
|
|
541
|
+
position: absolute;
|
|
542
|
+
top: 3px;
|
|
543
|
+
right: 3px;
|
|
530
544
|
margin-left: 0;
|
|
531
545
|
padding-left: 0;
|
|
532
546
|
}
|
|
@@ -1530,6 +1544,9 @@ void main() {
|
|
|
1530
1544
|
flex-direction: row;
|
|
1531
1545
|
align-items: center;
|
|
1532
1546
|
gap: 10px;
|
|
1547
|
+
/* \u540C\u4E3A content-box \u9677\u9631\uFF1A\u83DC\u5355\u53EA\u6709 6px \u5185\u8FB9\u8DDD\u4E14\u4E0D\u88C1\u526A\uFF0C\u6761\u76EE\u6309 content-box \u4F1A\u5F80\u53F3
|
|
1548
|
+
\u6233\u51FA\u8FB9\u6846\u7EA6 14px\uFF08hover \u5E95\u8272\u5916\u6EA2\uFF09 */
|
|
1549
|
+
box-sizing: border-box;
|
|
1533
1550
|
width: 100%;
|
|
1534
1551
|
padding: 7px 10px;
|
|
1535
1552
|
border: none;
|
|
@@ -2209,6 +2226,20 @@ void main() {
|
|
|
2209
2226
|
font-weight: 600;
|
|
2210
2227
|
line-height: 1.4;
|
|
2211
2228
|
}
|
|
2229
|
+
/* dsh-plugin-kit \u5957\u4EF6\u5FBD\u6807\uFF08\u7EA6\u5B9A\u89C1 @hyzyn/dsh-kit README\uFF1A\u5168\u90E8 kit \u8BBE\u7F6E\u5361\u7247\u5171\u7528\uFF09 */
|
|
2230
|
+
.dshkit_badge {
|
|
2231
|
+
flex: none;
|
|
2232
|
+
margin-left: auto;
|
|
2233
|
+
padding: 1px 8px;
|
|
2234
|
+
border-radius: 999px;
|
|
2235
|
+
font-size: 11px;
|
|
2236
|
+
font-weight: 600;
|
|
2237
|
+
line-height: 16px;
|
|
2238
|
+
letter-spacing: 0.02em;
|
|
2239
|
+
color: var(--tt-label-3);
|
|
2240
|
+
background: var(--tt-bg-2, var(--dsw-alias-bg-layer-2));
|
|
2241
|
+
border: 1px solid var(--tt-border, var(--dsw-alias-border-l1));
|
|
2242
|
+
}
|
|
2212
2243
|
.tt_cardDescription {
|
|
2213
2244
|
color: var(--tt-label-3);
|
|
2214
2245
|
font-size: 13px;
|
|
@@ -2340,8 +2371,8 @@ void main() {
|
|
|
2340
2371
|
transition: none !important;
|
|
2341
2372
|
}
|
|
2342
2373
|
}
|
|
2343
|
-
`;var
|
|
2344
|
-
`+Yo,document.head.appendChild(os))}var Cs='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',Zh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.4"/><path d="M10.4 10.4L14 14"/></svg>',Qh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 4.5h11"/><path d="M6 4.5V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.5"/><path d="M4.5 4.5l.7 8.1a1 1 0 0 0 1 .9h3.6a1 1 0 0 0 1-.9l.7-8.1"/></svg>',ed='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.4"/><path d="M3.5 10.5h-1v-8h8v1"/></svg>',td='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" fill="var(--dsw-alias-bg-base,#fff)"/></svg>',id='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.5 8a5.5 5.5 0 1 1-1.6-3.9"/><path d="M13.7 1.8v2.7H11"/></svg>',sd='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.8 12.8V4.2a1 1 0 0 1 1-1h3l1.4 1.6h6a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2.8a1 1 0 0 1-1-1z"/></svg>',rd='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4.5 5.5L2 8l2.5 2.5"/><path d="M11.5 5.5L14 8l-2.5 2.5"/><path d="M2.8 8h10.4"/></svg>',nd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4 8h8"/></svg>',ys='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7"/><path d="M11.5 4.5l-7 7"/></svg>',od='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.6v8.8"/><path d="M3.6 8h8.8"/></svg>',Si='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/></svg>',na='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 2.6h4.4l3.6 3.6v7.2a.9.9 0 0 1-.9.9H4.9a.9.9 0 0 1-.9-.9V3.5a.9.9 0 0 1 .9-.9z"/><path d="M8.2 2.7v3.4h3.4"/></svg>',oa='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.4 9.6l3.2-3.2"/><path d="M9.2 4.6l1-1a2.5 2.5 0 0 1 3.5 3.5l-1 1"/><path d="M6.8 11.4l-1 1a2.5 2.5 0 0 1-3.5-3.5l1-1"/></svg>',Pr='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 12.6V4.2"/><path d="M4.4 7.8L8 4.2l3.6 3.6"/></svg>',aa='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',ad='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 10.4V3.2"/><path d="M5 6.2L8 3.2l3 3"/><path d="M3.4 12.8h9.2"/></svg>',Or='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.2 2.9l1.9 1.9-7.3 7.3-2.4.5.5-2.4z"/></svg>',Gt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4.6h10"/><path d="M6.2 4.6V3.4a.8.8 0 0 1 .8-.8h2a.8.8 0 0 1 .8.8v1.2"/><path d="M4.6 4.6l.6 8a.9.9 0 0 0 .9.8h3.8a.9.9 0 0 0 .9-.8l.6-8"/></svg>',Ir='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',la='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/><path d="M8 6.6v3.6"/><path d="M6.2 8.4h3.6"/></svg>',ca='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.4 8h9"/><path d="M9.2 4.8L12.4 8l-3.2 3.2"/></svg>',ha='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.6 8h-9"/><path d="M6.8 4.8L3.6 8l3.2 3.2"/></svg>',ld='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3.4v9"/><path d="M4.8 9.2L8 12.4l3.2-3.2"/></svg>',cd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.4" y="3.2" width="11.2" height="4" rx="1.2"/><rect x="2.4" y="8.8" width="11.2" height="4" rx="1.2"/><path d="M5 5.2h.01"/><path d="M5 10.8h.01"/></svg>',hd='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6l5.8 10.4H2.2z"/><path d="M8 6.4v3.2"/><path d="M8 11.6h.01"/></svg>',dd='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M8 7.2v3.6"/><path d="M8 5.1h.01"/></svg>',da='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M6 6l4 4"/><path d="M10 6l-4 4"/></svg>',ud='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.8v5"/><path d="M11.6 4.6a5.2 5.2 0 1 1-7.2 0"/></svg>',ua='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5.6" cy="6" r="2.8"/><path d="M7.8 7.9l5.4 5.4"/><path d="M10.6 10.7l1.2-1.2"/></svg>',fa=null,he=null,se=null,us=null,Qt=null,Mt=null,vt=null,_i=null,pi=null,fs=null,We=null,vi=null,Vt=null,bt=null,De=null,Yt=null,Ci=!1,gi=null,Ue=!1,Te=null,_s=null,ei=null,Rt=null,ps=null,kt=null,mi=1e3,vs="dsh-tty:tabs",re=new Map,Mi=new Set,Nr=()=>Mi.size>0,kr=new Set,Tt=null,xs=0,as=!1,$e=null,Xt=null,St=[],Er=new Set;function ks(e){return Er.add(e),()=>Er.delete(e)}ks(({tab:e,addAction:t})=>{e.exited&&t(id,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>Hr(e.sid))});ks(({tab:e,addAction:t})=>{t(sd,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>jr(e.spawnSpec))});ks(({bookName:e,addAction:t})=>{let i=e!==""?ya(e):0;i>0&&t(rd,"\u96A7\u9053 "+i,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",o=>Td(o.currentTarget,e))});function yt(e,t){if(Qt===null)return;Qt.textContent=e,Mt.dataset.state=t,us!==null&&(us.style.display=t==="connected"?"none":""),ei!==null&&(ei.textContent=e),Rt!==null&&(Rt.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function ke(e){he!==null&&he.readyState===WebSocket.OPEN&&he.send(JSON.stringify(e))}function gt(){return Tt!==null?re.get(Tt):void 0}function Jo(){try{let e=fa?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function fd(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),ke({t:"refresh",sid:e.sid})}}var ls=null;function _a(e){ls!==null&&clearTimeout(ls),ls=setTimeout(()=>{ls=null;let t=gt();t!==void 0&&fd(t)},e??200)}function At(){try{let e=[...re.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||se===null?sessionStorage.removeItem(vs):sessionStorage.setItem(vs,JSON.stringify(e)),_d([...re.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var Lr="dsh-tty:persist-specs";function _d(e){try{let t=e.filter(i=>Ai(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(Lr):localStorage.setItem(Lr,JSON.stringify(t))}catch{}}function pd(){try{let e=localStorage.getItem(Lr);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Ai(i.spawnSpec)):[]}catch{return[]}}function vd(){try{let e=sessionStorage.getItem(vs);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&typeof i.sid=="string"&&i.sid!==""&&i.spawnSpec!==null&&typeof i.spawnSpec=="object"):[]}catch{return[]}}function gs(e,t){return new Promise(i=>{let o=s=>{let r;try{r=JSON.parse(s.data)}catch{return}r.t===e&&(clearTimeout(h),he.removeEventListener("message",o),i(r))},h=setTimeout(()=>{he.removeEventListener("message",o),i(null)},t);he.addEventListener("message",o)})}function Ri(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&ke({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function gd(e){if(e===void 0||e.fit===void 0)return;let t=e.term,i=t!==null&&t.buffer!==void 0?t.buffer.active:null,o=i==null?null:{atBottom:i.viewportY>=i.baseY,line:i.viewportY};try{e.fit.fit()}catch{return}if(o!==null)try{o.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(o.line,t.buffer.active.baseY))}catch{}e.exited||Ri(e)}function jt(e,t,i,o){if(e.overlayEl===null||e.overlayEl===void 0)return;let h=e.overlayEl;if(t===""||t===void 0){h.textContent="";return}let s=o==="error"||o==="info"?o:"exited";h.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?da:s==="info"?Ir:ud)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(i===void 0||i===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",h.querySelector(".tt_overlayMain").textContent=t,i!==void 0&&i!==""&&(h.querySelector(".tt_overlayHint").textContent=i)}function md(e,t){try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i!==""?i:t}catch{return t}}function Ti(e){let t=md("--dsw-alias-state-business-primary","#7c9cff"),i=new sa.Terminal({cursorBlink:!0,cursorStyle:"bar",cursorInactiveStyle:"outline",fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontWeight:400,fontWeightBold:600,lineHeight:1.35,scrollback:5e3,convertEol:!1,allowProposedApi:!0,theme:{background:"#0b0e14",foreground:"#d7dce5",cursor:t,cursorAccent:"#0b0e14",selectionBackground:"rgba(124, 156, 255, .30)",black:"#1b2028",red:"#f07178",green:"#7ec699",yellow:"#e6b673",blue:"#7aa2f7",magenta:"#c792ea",cyan:"#7fdbca",white:"#c8d0dc",brightBlack:"#556070",brightRed:"#ff8b92",brightGreen:"#9fe0b4",brightYellow:"#f5cc8c",brightBlue:"#9ab8ff",brightMagenta:"#dbb3ff",brightCyan:"#a3f0e2",brightWhite:"#eef2f8"}}),o=new ra.FitAddon,h=new xn;i.loadAddon(o),i.loadAddon(h),i.loadAddon(new kn);let s=document.createElement("div");s.className="tt_term";let r=document.createElement("div");r.className="tt_overlay",r.addEventListener("click",()=>{r.textContent="",Hr(e.sid)}),s.appendChild(r),i.open(s);try{o.fit()}catch{}try{let a=new Vo;a.onContextLoss(()=>{try{a.dispose()}catch{}}),i.loadAddon(a)}catch{}i.onData(a=>{ke({t:"input",sid:e.sid,d:a})}),i.onResize(()=>{Ai(e.spawnSpec)&&_a(200)}),i.attachCustomKeyEventHandler(a=>e.embedded===!0?!0:(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="f"?(a.preventDefault(),Pa(),!1):!0),e.term=i,e.fit=o,e.search=h,e.termEl=s,e.overlayEl=r}function yi(e,t){let i=Ss(),o={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??Ud(),label:t};return Ti(o),re.set(i,o),xs+=1,Qe(),ii(i),Es(o),At(),o}function bd(e){let t={sid:e.sid,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Ti(t),re.set(t.sid,t),xs+=1,Qe(),ii(t.sid),ke({t:"attach",sid:t.sid})}function Es(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0,i={...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24};if(he===null||he.readyState!==WebSocket.OPEN){kr.add({tab:e,frame:i});return}ke(i)}function Zo(e){let t={sid:Ss(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Ti(t),re.set(t.sid,t),xs+=1,Qe(),ii(t.sid),Es(t)}function Hr(e){let t=re.get(e);if(t===void 0)return;if(t.embedded===!0){ma(t);return}let i=t.spawnSpec,o=t.label;if(t.exited||ke({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),re.delete(e);let h={sid:Ss(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:o};Ti(h),re.set(h.sid,h),Qe(),ii(h.sid),Es(h),At()}function wd(e){let t=re.get(e);if(t!==void 0){if(t.exited||ke({t:"kill",sid:e}),re.delete(e),Mi.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),Tt===e){Tt=null;let i=[...re.keys()].pop()??null;i!==null&&ii(i)}Qe(),[...re.values()].some(i=>i.embedded!==!0)?At():Ls()}}function pa(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error("ttyTerminal \u9700\u8981 command");if(/[\r\n\0]/.test(t))throw new Error("command \u5FC5\u987B\u662F\u5355\u884C");return t}function va(e,t){return typeof e?.book=="string"&&e.book!==""?{t:"ssh",name:e.book,command:t}:e?.spec!==null&&typeof e?.spec=="object"?{t:"ssh",...e.spec,command:t}:{t:"spawn",...typeof e?.cwd=="string"&&e.cwd!==""?{cwd:e.cwd}:{},command:t}}function Sd(e){let t=e.controller;t===void 0||t.observer!==null||(t.observer=new ResizeObserver(()=>{if(!(t.disposed||t.tab!==e||e.term===null)){try{e.fit.fit()}catch{return}e.spawned&&!e.exited&&Ri(e)}}),t.observer.observe(t.hostEl))}function ga(e,t,i){let o={sid:Ss(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:i};return Ti(o),re.set(o.sid,o),Mi.add(o.sid),e.hostEl.appendChild(o.termEl),Sd(o),Es(o),o}function ma(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||ke({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),re.delete(e.sid),Mi.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=ga(t,e.spawnSpec,e.label),t.tab}}function Cd(e,t){if(!(e instanceof HTMLElement))throw new Error("ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9");let i=pa(t),o=va(t,i),h=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Li();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=ga(s,o,h),jd(),()=>yd(s)}function yd(e){if(e.disposed)return;e.disposed=!0,e.observer!==null&&(e.observer.disconnect(),e.observer=null);let t=e.tab;if(t!==null){t.exited||ke({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),re.delete(t.sid),Mi.delete(t.sid),e.tab=null}if(se===null&&!Nr()&&he!==null){Ci=!0;try{he.close()}catch{}he=null}}var xd=460,kd=280,Ed=320,Ld=160,Et=null,qt=xd,Kt=Ed;function Fr(){let e=se!==null?se.querySelector(".tt_modal"):null,t=e!==null?e:se;return t!==null?t.getBoundingClientRect():null}var Wr=e=>e==="bottom"?Ld:kd;function Md(e){let t=Fr();if(t===null)return 900;let i=e==="bottom"?t.height:t.width;return Math.max(Wr(e),Math.round(i*.72))}function bi(e,t){return Math.min(Md(e),Math.max(Wr(e),Math.round(t)))}function cs(){let e=Et;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){Kt=bi("bottom",Kt),e.el.style.width="",e.el.style.height=String(Kt)+"px",e.el.style.flexBasis=String(Kt)+"px";return}qt=bi("right",qt),e.el.style.height="",e.el.style.width=String(qt)+"px",e.el.style.flexBasis=String(qt)+"px"}}function hs(e){let t=Et;if(t!==null){if(Et=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(i){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(i instanceof Error?i.message:String(i)))}try{t.el.remove()}catch{}bt!==null&&delete bt.dataset.side}}function ba(e){if(se===null&&qr(),bt===null)throw new Error("ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA");Et!==null&&hs(!0),Li();let t=e?.side==="bottom"?"bottom":"right",i=Math.max(t==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:Wr(t)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let p=bi(t,e.size);t==="bottom"?Kt=p:qt=p}let o=document.createElement("div");o.className="tt_dockPane",o.dataset.side=t,bt.dataset.side=t,o.innerHTML='<div class="tt_dockPaneResize" title="'+(t==="bottom"?"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6")+'"></div><div class="tt_dockPaneHead"><span class="tt_dockPaneTitle"></span><span class="tt_dockPaneHint"></span><span class="tt_dockPaneSpacer"></span><button class="tt_dockPaneFold" type="button"></button><button class="tt_dockPaneClose" type="button" title="\u5173\u95ED\u4FA7\u680F">'+ys+'</button></div><div class="tt_dockPaneBody"></div>',bt.appendChild(o);let h=o.querySelector(".tt_dockPaneTitle"),s=o.querySelector(".tt_dockPaneHint"),r=o.querySelector(".tt_dockPaneBody"),a=o.querySelector(".tt_dockPaneFold"),f=o.querySelector(".tt_dockPaneClose"),n=o.querySelector(".tt_dockPaneResize"),_={el:o,element:r,disposed:!1,collapsed:!1,side:t,minSize:i,onClose:typeof e?.onClose=="function"?e.onClose:null},v=()=>t==="bottom"?_.collapsed?Pr:ld:_.collapsed?ha:ca,S=p=>{_.collapsed=p===!0,_.collapsed?o.dataset.collapsed="1":delete o.dataset.collapsed,a.innerHTML=v(),a.title=_.collapsed?"\u5C55\u5F00\u4FA7\u680F":"\u6536\u8D77\u4FA7\u680F",a.setAttribute("aria-label",a.title),cs()};return _.setTitle=p=>{h.textContent=typeof p=="string"?p:""},_.setHint=p=>{s.textContent=typeof p=="string"?p:""},_.isCollapsed=()=>_.collapsed===!0,_.collapse=()=>S(!0),_.expand=()=>S(!1),_.toggle=()=>S(!_.collapsed),_.dispose=()=>{_.disposed||Et!==_||hs(!1)},n.addEventListener("mousedown",p=>{if(p.button!==0||_.collapsed)return;p.preventDefault();let c=p.clientX,d=p.clientY,l=o.getBoundingClientRect(),u=C=>{t==="bottom"?Kt=bi("bottom",Math.max(i,l.height+(d-C.clientY))):qt=bi("right",Math.max(i,l.width+(c-C.clientX))),cs()},g=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",g),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",u),document.addEventListener("mouseup",g)}),n.addEventListener("dblclick",()=>S(!_.collapsed)),a.addEventListener("click",()=>S(!_.collapsed)),f.addEventListener("click",()=>hs(!0)),_.setTitle(typeof e?.title=="string"?e.title:""),_.setHint(typeof e?.hint=="string"?e.hint:""),S(e?.collapsed===!0),Et=_,cs(),_}function ii(e){let t=re.get(e);if(t!==void 0){Tt=e;for(let[i,o]of re)o.embedded!==!0&&o.termEl!==null&&(o.termEl.style.display=i===e?"":"none");t.embedded!==!0&&Vt!==null&&t.termEl!==null&&t.termEl.parentElement!==Vt&&Vt.appendChild(t.termEl),Qe(),Jt();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&Ri(t),jt(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA":"",t.exited?"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"","exited")}}function yr(e){if(vt===null)return;let t=re.get(e);if(t===void 0)return;let o=vt.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");o!=null&&(o.dataset.state=t.exited?"exited":t.live===!0?"connected":t.errored===!0?"error":"connecting")}function Qe(){if(vt===null)return;vt.textContent="";for(let[t,i]of re){if(i.embedded===!0)continue;let o=document.createElement("button");o.className="tt_tab",o.dataset.sid=t,t===Tt&&(o.dataset.active="");let h=document.createElement("span");h.className="tt_tabDot",h.dataset.state=i.exited?"exited":i.live===!0?"connected":i.errored===!0?"error":"connecting",o.appendChild(h);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=i.label||"\u7EC8\u7AEF "+wa(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),Ad(t,o)});let r=document.createElement("span");r.className="tt_tabClose",r.title="\u5173\u95ED",r.textContent="\u2715",o.title=s.textContent,o.appendChild(s),o.appendChild(r),o.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),wd(t);return}ii(t)}),vt.appendChild(o)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.innerHTML=od,e.addEventListener("click",()=>{Pd(e)}),vt.appendChild(e)}function Rd(e){return e?.direction==="remote"?`\u8FDC\u7A0B:${e.remoteHost||"127.0.0.1"}:${String(e.remotePort??0)} \u2192 \u672C\u673A:${String(e.localTargetPort??0)}`:`\u672C\u673A:${String(e?.localPort??0)} \u2192 ${e?.remoteHost??"?"}:${String(e?.remotePort??0)}`}function Jt(){if(_i===null||fs===null||vi===null||pi===null)return;vi.textContent="";let e=gt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){_i.dataset.hidden="";return}delete _i.dataset.hidden;let i=Number(t.port);fs.textContent=typeof e.target=="string"&&e.target!==""?e.target:typeof t.name=="string"&&t.name!==""?t.name:String(t.username??"")+"@"+String(t.host??"")+(Number.isInteger(i)&&i!==22?":"+i:""),We!==null&&(e.persistTmux===!0?(We.textContent="tmux",We.dataset.state="ok",We.title="\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A"):t.persist===!0&&e.spawned===!0?(We.textContent="\u672A\u6301\u4E45\u5316",We.dataset.state="warn",We.title="\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD"):(We.textContent="",delete We.dataset.state,We.removeAttribute("title")));let o=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";pi.dataset.state=o,pi.title=o==="connected"?"\u5DF2\u8FDE\u63A5":o==="connecting"?"\u8FDE\u63A5\u4E2D":o==="error"?"\u8FDE\u63A5\u51FA\u9519":"\u4F1A\u8BDD\u5DF2\u9000\u51FA";let h=(r,a,f,n)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=f,_.innerHTML=r+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",n),vi.appendChild(_)},s=typeof t.name=="string"?t.name:"";for(let r of Er)try{r({tab:e,spec:t,bookName:s,addAction:h})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}var xt=null,ds=null;function Mr(){ds!==null&&(document.removeEventListener("mousedown",ds,!0),ds=null),xt!==null&&(xt.remove(),xt=null)}function Td(e,t){if(xt!==null){Mr();return}let i=document.createElement("div");i.className="tt_tunnelPop";let o=document.createElement("div");o.className="tt_tunnelPopTitle",o.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(o);let h=document.createElement("div");h.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(h);let s=document.createElement("span");s.className="tt_cardHint",s.textContent="\u589E\u5220/\u542F\u505C\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4",i.appendChild(s),document.body.appendChild(i),xt=i;let r=e.getBoundingClientRect();i.style.top=String(r.bottom+6)+"px",i.style.left=String(Math.max(8,r.right-340))+"px";let a=f=>{xt===i&&(i.contains(f.target)||e.contains(f.target)||Mr())};ds=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let f=[];try{let v=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();v.ok&&Array.isArray(v.tunnels)&&(f=v.tunnels)}catch{}if(xt!==i)return;h.textContent="";let n=$r.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(n.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent="\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053",h.appendChild(_);return}for(let _ of n){let v=f.find(l=>l?.name===_?.name),S=v?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=S==="active"?"connected":S==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(v?.error??v?.lastForwardError??""),d.textContent=Rd(_)+" \xB7 "+S,p.appendChild(c),p.appendChild(d),h.appendChild(p)}})()}function wa(e){let t=1;for(let i of re.keys()){if(i===e)return String(t);t+=1}return String(t)}function Ad(e,t){let i=re.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let o=t.querySelector(".tt_tabLabel");if(o===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=i.label||"\u7EC8\u7AEF "+wa(e),o.replaceWith(h),h.focus(),h.select();let s=!1,r=()=>{if(s)return;s=!0;let f=h.value.trim();i.label=f!==""?f:void 0,Qe(),At()},a=()=>{s||(s=!0,Qe())};h.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"?r():f.key==="Escape"&&a()}),h.addEventListener("blur",r),h.addEventListener("click",f=>f.stopPropagation())}var $r=[],Sa="dialog",Lt="off",wt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},Zt=null,mt=null;function xi(e){e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(St=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&($r=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Sa=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(Lt=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(wt={...wt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(Zt=e.maxSessions)}function Dd(e,t){let i=t==="error"||t==="info"?t:"warn",o=document.createElement("div");o.className="tt_toast",o.dataset.kind=i,o.innerHTML='<span class="tt_toastIcon">'+(i==="error"?da:i==="info"?dd:hd)+'</span><span class="tt_toastText"></span>',o.lastElementChild.textContent=e,document.body.appendChild(o),setTimeout(()=>o.remove(),4e3)}async function Ca(){try{ke({t:"sessions"});let e=await gs("sessions",3e3);if(e!==null&&Array.isArray(e.list))return mt=e.list.length,mt}catch{}return null}async function ms(){if(await Ca(),Zt===null||mt===null||mt<Zt)return null;let e=[...re.values()].filter(o=>!o.exited).length,t=Math.max(0,mt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${mt} \u4E2A / \u4E0A\u9650 ${Zt}\uFF1A\u672C\u7A97\u53E3 ${e} \u4E2A${t>0?" + \u5176\u4ED6\u7A97\u53E3 "+t+" \u4E2A":""}\uFF09\u2014\u2014\u5173\u95ED\u4E0D\u7528\u7684\u7A97\u53E3/\u6807\u7B7E\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\u300D`;return Dd(i),i}function Bd(){return Zt!==null&&mt!==null&&mt>=Zt}function zr(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function ya(e){return $r.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function Rr(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",o=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+o+h}async function xa(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),o=await i.json().catch(()=>({}));return o&&o.ok===!1&&o.error?{error:String(o.error)}:o&&o.result?{result:o.result}:{error:String(o&&o.error?o.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function ka(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,o=typeof i.tcp?.ms=="number"?i.tcp.ms:null,h=typeof i.auth?.ms=="number"?i.auth.ms:null,s=[];i.tcp?.ok&&s.push("TCP "+(o!==null?o+"ms":"\u901A")),i.banner?.ok&&s.push("banner \u6B63\u5E38");let r=i.hostkey?.state;if(r==="matched"?s.push("\u4E3B\u673A\u5BC6\u94A5\u5339\u914D"):r==="recorded"?s.push("\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09"):r==="mismatch"&&s.push("\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01"),i.auth?.ok)return"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A"+(h!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+h+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(s.length?" \xB7 "+s.join(" \xB7 "):"");let a=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+a+(s.length?" \xB7 "+s.join(" \xB7 "):"")}async function Ea(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let i=St;xi(t.config),$e!==null&&St!==i&&Tr($e)}}catch{}}function La(e){$e!==null&&(e.target instanceof Element&&($e.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||Je())}function Pd(e){if($e!==null){Je();return}Ea(),Ca().then(()=>{$e!==null&&Tr($e)});let t=document.createElement("div");t.className="tt_addMenu",$e=t,Tr(t),document.body.appendChild(t);let i=e.getBoundingClientRect(),o=t.offsetWidth,s=i.left+o>window.innerWidth-8?i.right-o:i.left;t.style.left=Math.max(8,Math.min(s,window.innerWidth-o-8))+"px",t.style.top=i.bottom+6+"px",document.addEventListener("mousedown",La,!0)}function Je(){$e!==null&&(document.removeEventListener("mousedown",La,!0),$e.remove(),$e=null)}function Qo(e,t,i,o,h,s){let r=document.createElement("button");if(r.type="button",r.className="tt_addMenuItem",h===!0&&(r.setAttribute("data-soldout",""),r.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E"),s!==void 0){let n=document.createElement("span");n.className="tt_addMenuIcon",n.innerHTML=s,r.appendChild(n)}let a=document.createElement("span");a.className="tt_addMenuText";let f=document.createElement("span");if(f.className="tt_addMenuMain",f.textContent=t,a.appendChild(f),i!==""){let n=document.createElement("span");n.className="tt_addMenuSub",n.textContent=i,a.appendChild(n)}r.appendChild(a),r.addEventListener("click",o),e.appendChild(r)}function Tr(e){e.textContent="";let t=Bd();Qo(e,"\u672C\u5730\u7EC8\u7AEF",Lt==="tmux"?"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",async()=>{await ms()||(Je(),yi())},t,Cs);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let o=document.createElement("div");o.className="tt_addMenuTitle",o.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(o);for(let s of St){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let r=document.createElement("div");r.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let f=document.createElement("span");f.className="tt_addMenuIcon",f.innerHTML=cd;let n=document.createElement("span");n.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=s.name;let v=document.createElement("span");v.className="tt_addMenuSub";let S=ya(s.name);v.textContent=Rr(s)+(S>0?" \xB7 \u21C4"+String(S):""),n.appendChild(_),n.appendChild(v),a.appendChild(f),a.appendChild(n),a.addEventListener("click",async()=>{if(await ms())return;Je();let d=Lt==="tmux"?{persist:!0,persistName:zr()}:{};yi({t:"ssh",name:s.name,...d},s.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.innerHTML=Si,p.addEventListener("click",()=>{Je(),jr({name:s.name})});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title="\u7F16\u8F91\u8FDE\u63A5",c.innerHTML=Or,c.addEventListener("click",()=>{Je(),ea(s)}),r.appendChild(a),r.appendChild(p),r.appendChild(c),e.appendChild(r)}if(St.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(s)}let h=document.createElement("div");h.className="tt_addMenuSep",e.appendChild(h),Qo(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{Je(),ea()},!1,ua)}function ea(e){if(Xt!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,o=document.createElement("div");o.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=ua+"<span></span>",s.lastElementChild.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \xB7 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(s);let r=A=>{let k=document.createElement("div");return k.className="tt_sshSection",k.textContent=A,k},a={},f=(A,k,N)=>{let H=document.createElement("label");H.className="tt_sshRow";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=k,H.appendChild(q);let j;if(N?.select!==void 0){j=document.createElement("select");for(let Q of N.select){let ee=document.createElement("option");ee.value=Q.value,ee.textContent=Q.label,j.appendChild(ee)}}else j=document.createElement("input"),j.type=N?.type??"text",j.placeholder=N?.placeholder??"";return j.className="tt_cardInput",j.autocomplete="off",j.spellcheck=!1,H.appendChild(j),a[A]=j,H};h.appendChild(r("\u8FDE\u63A5"));let n=document.createElement("div");n.className="tt_sshGrid",n.appendChild(f("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),n.appendChild(f("port","\u7AEF\u53E3",{placeholder:"22"})),h.appendChild(n),h.appendChild(f("username","\u7528\u6237\u540D",{placeholder:"root"})),h.appendChild(r("\u8BA4\u8BC1")),h.appendChild(f("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let _=f("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),v=f("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),S=f("password","\u5BC6\u7801",{type:"password"}),p=A=>{let k=document.createElement("div");k.className="tt_sshRow";let N=document.createElement("input");N.type="text",N.className="tt_cardInput",N.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",N.autocomplete="off",N.spellcheck=!1;let H=document.createElement("div");H.className="tt_envList",H.dataset.hidden="";let q=[],j=()=>{if(H.textContent="",q.length===0){let G=document.createElement("span");G.className="tt_cardHint",G.textContent="env \u63D2\u4EF6\u8FD8\u6CA1\u6709\u6258\u7BA1\u53D8\u91CF \u2014 \u5728\u5176\u8BBE\u7F6E\u5361\u7247\u6DFB\u52A0\u540E\u8FD9\u91CC\u53EF\u9009\uFF0C\u4E5F\u53EF\u624B\u8F93 env:NAME",H.appendChild(G);return}let Q=N.value.trim().toUpperCase(),ee=Q===""?q:q.filter(G=>G.toUpperCase().includes(Q));for(let G of ee.slice(0,30)){let J=document.createElement("button");J.type="button",J.className="tt_envItem",J.textContent=G;let Z="env:"+G,oe=null,ae=()=>{oe!==null&&(clearTimeout(oe),oe=null),J.textContent=G,delete J.dataset.danger};J.addEventListener("mousedown",me=>me.preventDefault()),J.addEventListener("click",()=>{let me=A.value;if(me===""||me.startsWith("env:")||oe!==null){ae(),A.value=Z,A.focus();return}J.textContent=G+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",J.dataset.danger="",oe=setTimeout(ae,4e3)}),H.appendChild(J)}if(ee.length>30){let G=document.createElement("span");G.className="tt_envMore",G.textContent="\u8FD8\u6709 "+(ee.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",H.appendChild(G)}else if(ee.length===0){let G=document.createElement("span");G.className="tt_envMore",G.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",H.appendChild(G)}};return N.addEventListener("input",j),N.addEventListener("focus",()=>{delete H.dataset.hidden}),N.addEventListener("blur",()=>{N.value.trim()===""&&(H.dataset.hidden="")}),k.appendChild(N),k.appendChild(H),{row:k,setNames(Q){q=Array.isArray(Q)?Q:[],j()}}},c=p(a.passphrase),d=p(a.password),l=!1;(async()=>{if(!l){l=!0;try{let k=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();k.ok&&Array.isArray(k.names)&&(c.setNames(k.names),d.setNames(k.names))}catch{}}})(),h.appendChild(_),h.appendChild(v),h.appendChild(c.row),h.appendChild(S),h.appendChild(d.row),h.appendChild(r("\u9009\u9879"));let g=document.createElement("label");g.className="tt_cardRow";let C=document.createElement("input");C.type="checkbox",C.className="tt_cardCheckbox";let w=document.createElement("span");w.className="tt_cardLabel",w.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",g.appendChild(C),g.appendChild(w),h.appendChild(g);let y=document.createElement("label");y.className="tt_cardRow";let m=document.createElement("input");m.type="checkbox",m.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent="\u6301\u4E45\u4F1A\u8BDD\uFF08tmux \u6258\u7BA1\uFF0C\u65AD\u7EBF/\u91CD\u542F\u540E\u6062\u590D\u73B0\u573A\uFF1B\u8FDC\u7A0B\u9700\u5B89\u88C5 tmux\uFF09",y.appendChild(m),y.appendChild(x),m.checked=Lt==="tmux",Lt==="tmux"&&h.appendChild(y);let T=document.createElement("label");T.className="tt_cardRow";let I=document.createElement("input");I.type="checkbox",I.className="tt_cardCheckbox";let F=document.createElement("span");F.className="tt_cardLabel",F.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",T.appendChild(I),T.appendChild(F),h.appendChild(T);let R=f("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});R.style.display="none",h.appendChild(R),I.addEventListener("change",()=>{R.style.display=I.checked?"":"none",I.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),I.checked&&a.name.focus()}),i&&(T.style.display="none",a.name.value=String(t.name??""),R.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??""),C.checked=t.agentForward===!0,m.checked=Lt==="tmux");let z=document.createElement("div");z.className="tt_sshStatus";let B=document.createElement("div");B.className="tt_sshError";let D=document.createElement("div");D.className="tt_sshProbeResult",z.appendChild(B),z.appendChild(D),h.appendChild(z);let O=()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),A===""||k==="")return B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let H=a.auth.value,q={host:A,port:N,username:k,auth:H};if(H==="key"){let j=a.keyPath.value.trim();if(j==="")return B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;q.keyPath=j;let Q=a.passphrase.value;Q!==""&&(q.passphrase=Q)}if(H==="password"){let j=a.password.value;if(j==="")return B.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;q.password=j}return C.checked&&(q.agentForward=!0),q},P=document.createElement("div");P.className="tt_sshActions";let b=document.createElement("div");b.className="tt_sshActionsGroup";let E=document.createElement("div");E.className="tt_sshActionsGroup",P.appendChild(b),P.appendChild(E);let L=document.createElement("button");L.type="button",L.className="tt_toolBtn",L.textContent="\u53D6\u6D88";let M=document.createElement("button");M.type="button",M.className="tt_cardSave",M.textContent="\u8FDE\u63A5",b.appendChild(L);let $=document.createElement("button");$.type="button",$.className="tt_toolBtn",$.textContent="\u6587\u4EF6\u6D4F\u89C8",$.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",$.addEventListener("click",()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),A===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let H=a.auth.value,q={host:A,port:N,username:k,auth:H};if(H==="key"){let j=a.keyPath.value.trim();if(j===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}q.keyPath=j;let Q=a.passphrase.value;Q!==""&&(q.passphrase=Q)}if(H==="password"){let j=a.password.value;if(j===""){B.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}q.password=j}C.checked&&(q.agentForward=!0),pt(),jr(q)}),b.appendChild($);let K=null;i&&(K=document.createElement("button"),K.type="button",K.className="tt_toolBtn",K.textContent="\u4FDD\u5B58\u4FEE\u6539",K.addEventListener("click",()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim();if(A===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let N=Number(a.port.value);(!Number.isInteger(N)||N<1||N>65535)&&(N=22);let H=a.auth.value,j={name:a.name.value.trim()||A,host:A,port:N,username:k,auth:H,keyPath:H==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:C.checked,persist:m.checked};if(H==="key"&&j.keyPath===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}K!==null&&(K.disabled=!0),Id(String(t.name??""),j).then(Q=>{if(K!==null&&(K.disabled=!1),Q!==void 0){B.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+Q;return}pt()})}),b.appendChild(K));let Y=document.createElement("button");Y.type="button",Y.className="tt_toolBtn",Y.textContent="\u8BD5\u8FDE",Y.title="\u6309\u5F53\u524D\u586B\u5199\u8BCA\u65AD\u8FDE\u63A5\uFF08TCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\uFF09\uFF1B\u4E0D\u4F1A\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u4E5F\u4E0D\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9",Y.addEventListener("click",()=>{let A=O();A!==null&&(D.className="tt_sshProbeResult",D.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",Y.disabled=!0,xa(A,!1).then(k=>{Y.disabled=!1,k.result?(D.className="tt_sshProbeResult"+(k.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),D.textContent=ka(k.result)):(D.className="tt_sshProbeResult tt_sshProbeBad",D.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(k.error||"\u672A\u77E5\u9519\u8BEF"))}))}),b.appendChild(Y),E.appendChild(M),h.appendChild(P);let U=()=>{_.style.display=a.auth.value==="key"?"":"none",v.style.display=a.auth.value==="key"?"":"none",c.row.style.display=a.auth.value==="key"?"":"none",S.style.display=a.auth.value==="password"?"":"none",d.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",U),U(),L.addEventListener("click",()=>pt()),o.addEventListener("mousedown",A=>{A.target===o&&pt()}),M.addEventListener("click",async()=>{B.textContent="";let A=await ms();if(A!==null){B.textContent=A;return}let k=a.host.value.trim(),N=a.username.value.trim(),H=Number(a.port.value);if((!Number.isInteger(H)||H<1||H>65535)&&(H=22),k===""||N===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let q=a.auth.value,j={t:"ssh",host:k,port:H,username:N,auth:q};if(q==="key"){let J=a.keyPath.value.trim();J!==""&&(j.keyPath=J);let Z=a.passphrase.value;Z!==""&&(j.passphrase=Z)}if(q==="password"){let J=a.password.value;J!==""&&(j.password=J)}C.checked&&(j.agentForward=!0),m.checked&&(j.persist=!0,j.persistName=zr());let Q=H!==22?N+"@"+k+":"+H:N+"@"+k,ee=J=>{pt(),se!==null&&yi(j,J!==""?J:Q)};if(!I.checked){ee("");return}let G=a.name.value.trim()||k;M.disabled=!0,Od({name:G,host:k,port:H,username:N,auth:q,keyPath:j.keyPath??"",passphrase:j.passphrase??"",password:j.password??"",agentForward:C.checked,persist:m.checked}).then(J=>{if(M.disabled=!1,J!==void 0){B.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+J;return}ee(G)})}),o.appendChild(h),document.body.appendChild(o),Xt=o,a.host.focus()}function pt(){Xt!==null&&(Xt.remove(),Xt=null)}async function Od(e){let t=[...St.filter(i=>i?.name!==e.name),e];try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),o=await i.json().catch(()=>({}));if(!i.ok||!o.ok)return String(o.error||"HTTP "+i.status);xi(o.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function Id(e,t){if(t.name!==e&&St.some(o=>o?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=St.map(o=>o?.name===e?t:o);try{let o=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),h=await o.json().catch(()=>({}));if(!o.ok||!h.ok)return String(h.error||"HTTP "+o.status);xi(h.config);return}catch(o){return String(o&&o.message?o.message:o)}}function Nd(e,t){if(Ur())return;let i=document.createElement("div");i.className="tt_sftpDualCard";let o=document.createElement("div");o.className="tt_sftpTitleRow";let h=document.createElement("div");h.className="tt_sshTitle",h.innerHTML=Si+"<span></span>",h.lastElementChild.textContent="SFTP \u53CC\u680F \xB7 "+t;let s=document.createElement("button");s.type="button",s.className="tt_close",s.title="\u5173\u95ED",s.innerHTML=ys,s.addEventListener("click",Dt),o.appendChild(h),o.appendChild(s),i.appendChild(o);let r=document.createElement("div");r.className="tt_sftpStatus";let a=(O,P)=>{r.textContent=O,P===void 0?delete r.dataset.state:r.dataset.state=P},f=!1,n=(O,P)=>{if(!(f||v.local.busy||v.remote.busy)){f=!0;for(let b of[v.local,v.remote])b.setBusy(!0);a(O,"busy"),Promise.resolve().then(P).catch(b=>{(b===null||typeof b!="object"||b.name!=="TransferCanceledError")&&R.fail("\u5931\u8D25"),a(String(b&&b.message?b.message:b),"error")}).finally(()=>{f=!1;for(let b of[v.local,v.remote])b.setBusy(!1)})}},_=O=>{v[O].bar.after(p),p.style.display="",c.focus(),c.select()},v={},S=(O,P)=>{let b={kind:O,path:"",busy:!1},E=document.createElement("div");E.className="tt_sftpPane";let L=document.createElement("div");L.className="tt_sftpPaneHead";let M=document.createElement("span");M.textContent=P;let $=document.createElement("span");$.className="tt_sftpPaneMeta",L.appendChild(M),L.appendChild($),E.appendChild(L);let K=document.createElement("div");K.className="tt_sftpBar";let Y=document.createElement("input");Y.type="text",Y.className="tt_sftpPath",Y.placeholder=O==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",Y.spellcheck=!1,Y.autocomplete="off";let U=document.createElement("button");U.type="button",U.className="tt_toolBtn",U.innerHTML=Ir+"<span>\u5237\u65B0</span>";let A=document.createElement("button");A.type="button",A.className="tt_toolBtn",A.innerHTML=la+"<span>\u65B0\u5EFA\u76EE\u5F55</span>",K.appendChild(Y),K.appendChild(U),K.appendChild(A),E.appendChild(K);let k=document.createElement("div");k.className="tt_sftpList",E.appendChild(k),b.bar=K;let N=G=>{b.busy=G;for(let J of[U,A])J.disabled=G;Y.disabled=G},H=async(G,J)=>{let Z=O==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",oe=O==="local"?J:{...e,...J},ae=await fetch(Z+G,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(oe)}),me=await ae.json().catch(()=>({}));if(!ae.ok||me.ok!==!0)throw new Error(String(me.error||"HTTP "+ae.status));return me},q=(G,J)=>{if(!(b.busy||f))return N(!0),a(G,"busy"),Promise.resolve().then(J).catch(Z=>a(String(Z&&Z.message?Z.message:Z),"error")).finally(()=>N(!1))},j=(G,J)=>G.endsWith("/")||G.endsWith("\\")?G+J:G+"/"+J,Q=G=>{let J=j(b.path,G.name),Z=[];G.isDir===!0?Z.push("\u76EE\u5F55"):Z.push(Ze(Number(G.size))||"\u2014");let oe=Ra(Number(G.mtime));oe!==""&&Z.push(oe);let ae=C(G.isDir?Si:G.isSymlink?oa:na,G.name,Z.join(" \xB7 "),G.isDir===!0?"dir":G.isSymlink===!0?"link":"file"),me=()=>b.loadDir(b.path),we=O==="local"?v.remote:v.local;return G.isDir===!0&&ae.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||b.loadDir(J)}),w(ae,O==="local"?ca:ha,"\u4F20\u8F93\u5230"+(O==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+we.path,()=>{R.reset(),R.pulse(0),n("\u4F20\u8F93 "+G.name+"\u2026",async()=>{let fe=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:O==="local"?"up":"down",...e,localPath:O==="local"?J:j(we.path,G.name),remotePath:O==="local"?j(we.path,G.name):J})}),W=await fe.json().catch(()=>({}));if(!fe.ok||W.ok!==!0)throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(W.error||"HTTP "+fe.status));let V=W.job?.id;if(typeof V!="string"||V==="")throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id");await z(V,G.name)==="canceled"?(R.reset(),a("\u5DF2\u53D6\u6D88\u4F20\u8F93 "+G.name)):(R.done("\u5B8C\u6210"),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4F20\u8F93 "+G.name)),await we.loadDir(we.path)})}),O!=="local"&&G.isDir!==!0&&w(ae,aa,"\u4E0B\u8F7D "+G.name,()=>{m(G,J)}),w(ae,Or,"\u91CD\u547D\u540D "+G.name,()=>{c.placeholder="\u65B0\u540D\u79F0",c.value=G.name,_(O),u=async()=>{let fe=c.value.trim();fe===""||fe===G.name||(g(),await b.runTask("\u91CD\u547D\u540D "+G.name+"\u2026",async()=>{await H("rename",{from:J,to:j(b.path,fe)}),await me()}))}}),y(ae,()=>b.runTask("\u5220\u9664 "+G.name+"\u2026",async()=>{await H("remove",{path:J,recursive:G.isDir===!0}),await me(),a("\u5DF2\u5220\u9664 "+G.name)}),G),ae},ee=G=>{if(k.textContent="",b.path!==""&&b.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(b.path)===!1){let Z=C(Pr,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");Z.addEventListener("click",()=>{b.loadDir(Ta(b.path))}),k.appendChild(Z)}let J=Array.isArray(G)?G:[];if(J.length===0){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",k.appendChild(Z);return}for(let Z of J)Z===null||typeof Z!="object"||typeof Z.name!="string"||Z.name===""||k.appendChild(Q(Z))};return b.loadDir=async G=>{try{let J=await H("list",{path:G??b.path});b.path=typeof J.path=="string"&&J.path!==""?J.path:b.path,Y.value=b.path;let Z=Array.isArray(J.entries)?J.entries.length:0;ee(J.entries),$.textContent=String(Z)+" \u9879",a(b.path)}catch(J){a(String(J&&J.message?J.message:J),"error")}},b.runTask=q,b.setBusy=N,v[O]=b,U.addEventListener("click",()=>{b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(b.path))}),A.addEventListener("click",()=>{b.busy||f||(c.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",c.value="",_(O),u=async()=>{let G=c.value.trim();G!==""&&(g(),await b.runTask("\u521B\u5EFA\u76EE\u5F55 "+G+"\u2026",async()=>{await H("mkdir",{path:j(b.path,G),parents:!0}),await b.loadDir(b.path)}))})}),Y.addEventListener("keydown",G=>{if(G.key!=="Enter"||(G.preventDefault(),b.busy||f))return;let J=Y.value.trim();J!==""&&b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(J))}),E},p=document.createElement("div");p.className="tt_sftpEditor",p.style.display="none";let c=document.createElement("input");c.type="text",c.className="tt_cardInput",c.spellcheck=!1,c.autocomplete="off";let d=document.createElement("button");d.type="button",d.className="tt_toolBtn",d.textContent="\u786E\u5B9A";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u53D6\u6D88",p.appendChild(c),p.appendChild(d),p.appendChild(l);let u=null,g=()=>{p.style.display="none",c.value="",u=null};d.addEventListener("click",()=>{u?.()}),l.addEventListener("click",g),c.addEventListener("keydown",O=>{O.key==="Enter"?(O.preventDefault(),u?.()):O.key==="Escape"&&(O.stopPropagation(),g())});let C=(O,P,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpRow";let M=document.createElement("span");M.className="tt_sftpIcon",M.innerHTML=O,E!==void 0&&(M.dataset.kind=E);let $=document.createElement("span");if($.className="tt_sftpName",$.textContent=P,$.title=P,L.appendChild(M),L.appendChild($),b!==""){let K=document.createElement("span");K.className="tt_sftpMeta",K.textContent=b,L.appendChild(K)}return L},w=(O,P,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpAct",L.innerHTML=P,L.title=b,L.addEventListener("click",M=>{M.stopPropagation(),E()}),O.appendChild(L)},y=(O,P,b)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpAct",E.innerHTML=Gt,E.title="\u5220\u9664 "+b.name+(b.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let L=null;E.addEventListener("click",M=>{if(M.stopPropagation(),L!==null){clearTimeout(L),L=null,E.innerHTML=Gt,delete E.dataset.danger,P();return}E.textContent="\u786E\u8BA4?",E.dataset.danger="",L=setTimeout(()=>{L=null,E.innerHTML=Gt,delete E.dataset.danger},4e3)}),O.appendChild(E)},m=(O,P)=>v.remote.runTask("\u4E0B\u8F7D "+O.name+"\u2026",async()=>{R.reset();let b;try{b=await Da("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:P})},(E,L)=>{R.set(E,L)},wt.maxDownloadMb,E=>R.setCancel(E))}catch(E){if(Ar(E)){R.reset(),a("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+O.name);return}throw R.fail("\u4E0B\u8F7D\u5931\u8D25"),E}R.done("\u5B8C\u6210"),Ba(b,O.name),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4E0B\u8F7D "+O.name+"\uFF08"+(Ze(b.size)||String(b.size)+" B")+"\uFF09")}),x=S("local","\u672C\u673A"),T=S("remote","\u8FDC\u7A0B");v.local.wrap=x,v.remote.wrap=T;let I=document.createElement("div");I.className="tt_sftpDual",I.appendChild(x),I.appendChild(T),i.appendChild(I),i.appendChild(p);let F=document.createElement("div");F.className="tt_sftpFoot";let R=Aa();F.appendChild(R.el),F.appendChild(r),i.appendChild(F);let z=async(O,P)=>{let b=!1;R.setCancel(()=>{b||(b=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:O})}).catch(()=>{}))});try{for(;;){await new Promise($=>setTimeout($,400));let E=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:O})}),L=await E.json().catch(()=>({}));if(!E.ok||L.ok!==!0){if(b)return"canceled";throw new Error(String(L.error||"HTTP "+E.status))}let M=L.job;if(M===null||typeof M!="object")throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001");if(M.state==="running"){let $=typeof M.current=="string"&&M.current!==""?M.current:P;a("\u4F20\u8F93 "+$+"\u2026","busy"),Number.isFinite(M.total)&&M.total>0?R.set(Number(M.bytes)||0,M.total):R.pulse(Number(M.bytes)||0);continue}if(M.state==="canceled")return"canceled";if(M.state!=="done")throw new Error(String(M.error||"\u4F20\u8F93\u5931\u8D25"));return"done"}}finally{R.setCancel(null)}},B=Fr(),D=B===null?420:Math.round(B.height*.56);Ma(i,"SFTP \u53CC\u680F \xB7 "+t,D),v.local.loadDir(""),v.remote.loadDir("")}var ki=null,bs=null,Ur=()=>ki!==null||bs!==null;function Ma(e,t,i){if(se!==null&&!Ue&&bt!==null&&Et===null)try{let h=ba({title:t,side:"bottom",size:i,min:200,onClose:()=>Dt()});h.element.appendChild(e),bs=h;return}catch(h){console.warn("[dsh-tty] SFTP \u6302\u5230\u53F3\u4FA7\u4FA7\u680F\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(h instanceof Error?h.message:String(h)))}let o=document.createElement("div");o.className="tt_sshBackdrop",o.appendChild(e),o.addEventListener("mousedown",h=>{h.target===o&&Dt()}),document.body.appendChild(o),ki=o}var wi=null;function Hd(){let e=wi;if(wi=null,e!==null)try{e.click()}catch{}}function Fd(e){let t=new TextEncoder().encode(e),i="";for(let o of t)i+=String.fromCharCode(o);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ze(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,o=-1;do i/=1024,o+=1;while(i>=1024&&o<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[o]}function xr(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,o=-1;do i/=1024,o+=1;while(i>=1024&&o<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[o]+"/s"}function Ra(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=o=>String(o).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function Ta(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function fi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Aa(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let i=document.createElement("div");i.className="tt_sftpFill",t.appendChild(i);let o=document.createElement("span");o.className="tt_sftpPct",o.textContent="";let h=document.createElement("button");h.type="button",h.className="tt_sftpCancel",h.title="\u53D6\u6D88\u4F20\u8F93",h.textContent="\u2715",h.style.display="none";let s=null;h.addEventListener("click",p=>{p.stopPropagation();let c=s;c!==null&&(h.disabled=!0,c())}),e.appendChild(t),e.appendChild(o),e.appendChild(h);let r=p=>{o.textContent=p},a="",f=-1,n=p=>{p!==a&&(a=p,o.textContent=p)},_=p=>{let c=Math.round(p);c!==f&&(f=c,i.style.width=c+"%")},v=()=>{s=null,wi===h&&(wi=null),h.style.display="none",h.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",f=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",o.textContent="",v()},setCancel(p){if(p==null){v();return}s=p,wi=h,h.disabled=!1,h.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let d=Date.now();if(this._last!==void 0&&d>this._lastAt){let l=(p-this._last)/((d-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}if(this._last=p,this._lastAt=d,Number.isFinite(c)&&c>0){let l=Math.min(100,Math.max(0,p/c*100));_(l);let u=this._rate!==void 0&&this._rate>=0?xr(this._rate):"";n(Math.round(l)+"%"+(u!==""?" \xB7 "+u:""))}else{i.style.width="";let l=this._rate!==void 0&&this._rate>=0?xr(this._rate):"";n(Ze(p)+(l!==""?" \xB7 "+l:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let l=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}this._last=p,this._lastAt=c;let d=this._rate!==void 0&&this._rate>=0?xr(this._rate):"";n((Number.isFinite(p)?Ze(p):"\u2026")+(d!==""?" \xB7 "+d:""))},done(p){e.dataset.active="",e.dataset.state="done",i.style.width="100%",f=100,v(),n(p!==void 0&&p!==""?p:"\u5B8C\u6210")},fail(p){e.dataset.active="",e.dataset.state="error",v(),n(p!==void 0&&p!==""?p:"\u5931\u8D25")},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",o.textContent=""):(e.dataset.active="",i.style.width="",f=-1,n(p))}}}async function Da(e,t,i,o=0,h=null){let s=o>0?o*1024*1024:0,r=typeof AbortController=="function"?new AbortController:null,a=!1;r!==null&&(t={...t,signal:r.signal},typeof h=="function"&&h(()=>{a=!0,r.abort()}));let f=await fetch(e,t);if(!f.ok){let d="HTTP "+f.status;try{let l=await f.json();l!==null&&typeof l=="object"&&typeof l.error=="string"&&(d=l.error)}catch{}throw new Error(d)}let n=Number(f.headers.get("content-length")),_=Number.isFinite(n)&&n>0;if(s>0&&_&&n>s){try{await f.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ze(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let v=f.body;if(v===null||typeof v.getReader!="function"){let d=await f.blob();if(s>0&&d.size>s)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ze(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return _&&i(n,n),d}let S=v.getReader(),p=[],c=0;try{for(;;){let{done:d,value:l}=await S.read();if(d)break;if(l!==void 0&&l.byteLength>0){if(c+=l.byteLength,s>0&&c>s){try{await S.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ze(s)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}p.push(l),i(c,_?n:NaN)}}}catch(d){if(a||d!==null&&typeof d=="object"&&d.name==="AbortError"){try{await S.cancel()}catch{}throw new ti}throw d}return new Blob(p,{type:"application/octet-stream"})}var ti=class extends Error{constructor(){super("\u5DF2\u53D6\u6D88"),this.name="TransferCanceledError"}};function Ar(e){return e instanceof ti}function Ba(e,t){let i=URL.createObjectURL(e),o=document.createElement("a");o.href=i,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function Wd(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],i=[];for(let n of t){let _=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():null;_!==null&&i.push(_)}if(i.length===0)return[...e.files??[]].map(n=>({relPath:n.name,file:n}));let o=[],h=wt.maxUploadFiles,s=wt.maxUploadMb>0?wt.maxUploadMb*1024*1024:0,r=()=>h>0&&o.length>=h,a=0,f=(n,_)=>new Promise(v=>{if(r()){v();return}if(n.isFile===!0){n.file(c=>{s>0&&a+(c.size??0)>s?o._limitExceeded=!0:(o.push({relPath:_+n.name,file:c}),a+=c.size??0),v()},()=>v());return}if(n.isDirectory!==!0){v();return}let S=n.createReader(),p=()=>{S.readEntries(async c=>{if(c.length===0){v();return}for(let d of c){if(r())break;await f(d,_+n.name+"/")}if(r()){v();return}p()},()=>v())};p()});for(let n of i)await f(n,"");return o}function jr(e){if(Ur())return;let t=e!==null&&typeof e=="object"?e:{},i={};if(typeof t.name=="string"&&t.name!=="")i.name=t.name;else{for(let A of["host","username","auth","keyPath","passphrase","password"])typeof t[A]=="string"&&t[A]!==""&&(i[A]=t[A]);let U=Number(t.port);Number.isInteger(U)&&U>=1&&U<=65535&&(i.port=U),t.agentForward===!0&&(i.agentForward=!0)}let o=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(Sa==="dual"){Nd(i,o);return}let h=document.createElement("div");h.className="tt_sftpCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let r=document.createElement("div");r.className="tt_sshTitle",r.innerHTML=Si+"<span></span>",r.lastElementChild.textContent="SFTP \xB7 "+o;let a=document.createElement("button");a.type="button",a.className="tt_close",a.title="\u5173\u95ED",a.innerHTML=ys,a.addEventListener("click",Dt),s.appendChild(r),s.appendChild(a),h.appendChild(s);let f=document.createElement("div");f.className="tt_sftpBar";let n=document.createElement("input");n.type="text",n.className="tt_sftpPath",n.placeholder="\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",n.spellcheck=!1,n.autocomplete="off";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=Ir+"<span>\u5237\u65B0</span>";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.innerHTML=la+"<span>\u65B0\u5EFA\u76EE\u5F55</span>";let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.innerHTML=ad+"<span>\u4E0A\u4F20</span>",S.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let p=document.createElement("input");p.type="file",p.multiple=!0,p.style.display="none",f.appendChild(n),f.appendChild(_),f.appendChild(v),f.appendChild(S),h.appendChild(f),h.appendChild(p);let c=document.createElement("div");c.className="tt_sftpEditor",c.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",c.appendChild(d),c.appendChild(l),c.appendChild(u),h.appendChild(c);let g=null,C=()=>{c.style.display="none",g=null};l.addEventListener("click",()=>{g?.()}),u.addEventListener("click",C),d.addEventListener("keydown",U=>{U.key==="Enter"?(U.preventDefault(),g?.()):U.key==="Escape"&&(U.stopPropagation(),C())});let w=document.createElement("div");w.className="tt_sftpList",h.appendChild(w);let y=document.createElement("div");y.className="tt_sftpFoot";let m=document.createElement("div");m.className="tt_sftpStatus";let x=Aa();y.appendChild(x.el),y.appendChild(m),h.appendChild(y);let T={path:"",busy:!1},I=(U,A)=>{m.textContent=U,A===void 0?delete m.dataset.state:m.dataset.state=A},F=U=>{T.busy=U;for(let A of[_,v,S])A.disabled=U;n.disabled=U},R=async(U,A)=>{let k=await fetch("/api/dsh-tty/sftp/"+U,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...A})}),N=await k.json().catch(()=>({}));if(!k.ok||N.ok!==!0)throw new Error(String(N.error||"HTTP "+k.status));return N},z=async(U,A)=>{if(!T.busy){F(!0),I(U,"busy");try{await A()}catch(k){I(String(k&&k.message?k.message:k),"error")}finally{F(!1)}}},B=(U,A,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let q=document.createElement("span");q.className="tt_sftpIcon",q.innerHTML=U,N!==void 0&&(q.dataset.kind=N);let j=document.createElement("span");if(j.className="tt_sftpName",j.textContent=A,j.title=A,H.appendChild(q),H.appendChild(j),k!==""){let Q=document.createElement("span");Q.className="tt_sftpMeta",Q.textContent=k,H.appendChild(Q)}return H},D=(U,A,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=A,H.title=k,H.addEventListener("click",q=>{q.stopPropagation(),N()}),U.appendChild(H)},O=(U,A,k)=>{let N=document.createElement("button");N.type="button",N.className="tt_sftpAct",N.innerHTML=Gt,N.title="\u5220\u9664 "+A.name+(A.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let H=null;N.addEventListener("click",q=>{if(q.stopPropagation(),!T.busy){if(H!==null){clearTimeout(H),H=null,N.innerHTML=Gt,delete N.dataset.danger,z("\u5220\u9664 "+A.name+"\u2026",async()=>{await R("remove",{path:k,recursive:A.isDir===!0}),await b(T.path),I("\u5DF2\u5220\u9664 "+A.name)});return}N.textContent="\u786E\u8BA4?",N.dataset.danger="",H=setTimeout(()=>{H=null,N.innerHTML=Gt,delete N.dataset.danger},4e3)}}),U.appendChild(N)},P=U=>{if(w.textContent="",T.path!==""&&T.path!=="/"){let k=B(Pr,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");k.addEventListener("click",()=>{z("\u52A0\u8F7D\u4E2D\u2026",()=>b(Ta(T.path)))}),w.appendChild(k)}let A=Array.isArray(U)?U:[];if(A.length===0){let k=document.createElement("div");k.className="tt_addMenuTitle",k.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",w.appendChild(k);return}for(let k of A){if(k===null||typeof k!="object"||typeof k.name!="string"||k.name==="")continue;let N=fi(T.path,k.name),H=[];k.isDir===!0?H.push("\u76EE\u5F55"):H.push(Ze(Number(k.size))||"\u2014");let q=Ra(Number(k.mtime));q!==""&&H.push(q);let j=B(k.isDir?Si:k.isSymlink?oa:na,k.name,H.join(" \xB7 "),k.isDir===!0?"dir":k.isSymlink===!0?"link":"file");k.isDir===!0?j.addEventListener("click",Q=>{Q.target instanceof Element&&Q.target.closest(".tt_sftpAct")!==null||z("\u52A0\u8F7D\u4E2D\u2026",()=>b(N))}):(j.addEventListener("click",Q=>{Q.target instanceof Element&&Q.target.closest(".tt_sftpAct")!==null||E(k,N)}),D(j,aa,"\u4E0B\u8F7D "+k.name,()=>{E(k,N)})),D(j,Or,"\u91CD\u547D\u540D "+k.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=k.name,c.style.display="",d.focus(),d.select(),g=async()=>{let Q=d.value.trim();Q===""||Q===k.name||(C(),await z("\u91CD\u547D\u540D "+k.name+"\u2026",async()=>{await R("rename",{from:N,to:fi(T.path,Q)}),await b(T.path)}))}}),O(j,k,N),w.appendChild(j)}},b=async U=>{try{let A=await R("list",{path:U??T.path});T.path=typeof A.path=="string"&&A.path!==""?A.path:"/",n.value=T.path;let k=Array.isArray(A.entries)?A.entries.length:0;P(A.entries),I(T.path+" \u2014 "+String(k)+" \u9879")}catch(A){I(String(A&&A.message?A.message:A),"error")}},E=(U,A)=>z("\u4E0B\u8F7D "+U.name+"\u2026",async()=>{x.reset();let k;try{k=await Da("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:A})},(N,H)=>{x.set(N,H)},wt.maxDownloadMb,N=>x.setCancel(N))}catch(N){if(Ar(N)){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+U.name);return}throw x.fail("\u4E0B\u8F7D\u5931\u8D25"),N}x.done("\u5B8C\u6210"),Ba(k,U.name),setTimeout(()=>x.reset(),1500),I("\u5DF2\u4E0B\u8F7D "+U.name+"\uFF08"+(Ze(k.size)||String(k.size)+" B")+"\uFF09")}),L=(U,A,k,N,H)=>new Promise((q,j)=>{let Q=Fd(JSON.stringify({...i,path:fi(T.path,A)})),ee=new XMLHttpRequest;H.abort=()=>{H.stopped=!0,ee.abort()},ee.open("POST","/api/dsh-tty/sftp/upload"),ee.setRequestHeader("x-dsh-sftp-meta",Q);let G=N>1?String(k)+"/"+String(N)+" ":"";I("\u4E0A\u4F20 "+G+A,"busy"),ee.upload.addEventListener("progress",oe=>{oe.lengthComputable?x.set(oe.loaded,oe.total):x.pulse(0)});let J=!1,Z=oe=>{J||(J=!0,oe===null?q():j(oe))};ee.addEventListener("load",()=>{if(ee.status===200){N===1&&x.done("\u4E0A\u4F20\u5B8C\u6210"),Z(null);return}if(H.stopped)return;x.fail("\u4E0A\u4F20\u5931\u8D25");let oe="HTTP "+ee.status;try{let ae=JSON.parse(ee.responseText);ae!==null&&typeof ae=="object"&&typeof ae.error=="string"&&(oe=ae.error)}catch{}Z(new Error(oe))}),ee.addEventListener("error",()=>{if(H.stopped){Z(new ti);return}x.fail("\u4E0A\u4F20\u5931\u8D25"),Z(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),ee.addEventListener("abort",()=>{Z(new ti)}),ee.send(U)}),M=async U=>z("\u4E0A\u4F20\u4E2D\u2026",async()=>{let A=wt;if(A.maxUploadFiles>0&&U.length>A.maxUploadFiles){I("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(A.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(U.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),x.fail("\u8D85\u9650");return}let k=A.maxUploadMb>0?A.maxUploadMb*1024*1024:0,N=U.find(ee=>k>0&&(ee.file?.size??0)>k);if(N!==void 0){I("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+Ze(k)+"\uFF09\uFF1A"+String(N.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),x.fail("\u8D85\u9650");return}if(U._limitExceeded===!0){I("\u6587\u4EF6\u603B\u5927\u5C0F\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF1A\u8BF7\u5206\u6279\u4E0A\u4F20\uFF08\u6216\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\uFF09","error"),x.fail("\u8D85\u9650");return}let H=new Set;for(let ee of U){let G=ee.relPath.lastIndexOf("/");if(G<=0)continue;let J=ee.relPath.slice(0,G);H.has(J)||(H.add(J),await R("mkdir",{path:fi(T.path,J),parents:!0}).catch(()=>{}))}x.reset();let q={stopped:!1,abort:null};x.setCancel(()=>q.abort?.());let j=0,Q=0;try{for(let ee of U){if(q.stopped)break;j+=1,q.abort=null;try{await L(ee.file,ee.relPath,j,U.length,q),Q+=1}catch(G){if(Ar(G)||q.stopped)break;throw G}}}finally{x.setCancel(null)}if(q.stopped){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 "+String(Q)+"/"+String(U.length)+" \u4E2A\uFF09"),await b(T.path);return}x.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>x.reset(),1500),I("\u4E0A\u4F20\u5B8C\u6210 "+String(U.length)+" \u4E2A\u6587\u4EF6"),await b(T.path)});_.addEventListener("click",()=>{z("\u52A0\u8F7D\u4E2D\u2026",()=>b(T.path))}),v.addEventListener("click",()=>{T.busy||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",c.style.display="",d.focus(),g=async()=>{let U=d.value.trim();U!==""&&(C(),await z("\u521B\u5EFA\u76EE\u5F55 "+U+"\u2026",async()=>{await R("mkdir",{path:fi(T.path,U)}),await b(T.path)}))})}),S.addEventListener("click",()=>{T.busy===!1&&p.click()}),p.addEventListener("change",()=>{let U=[...p.files??[]].map(A=>({relPath:A.name,file:A}));p.value="",U.length>0&&M(U)});let $=0,K=U=>{U?w.dataset.drag="":delete w.dataset.drag};h.addEventListener("dragenter",U=>{U.preventDefault(),$+=1,K(!0)}),h.addEventListener("dragover",U=>{U.preventDefault()}),h.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&K(!1)}),h.addEventListener("drop",U=>{U.preventDefault(),$=0,K(!1),!T.busy&&Wd(U.dataTransfer).then(A=>{(A.length>0||A._limitExceeded===!0)&&M(A)})}),n.addEventListener("keydown",U=>{if(U.key!=="Enter"||(U.preventDefault(),T.busy))return;let A=n.value.trim();A!==""&&z("\u52A0\u8F7D\u4E2D\u2026",()=>b(A))});let Y=Fr();Ma(h,"SFTP \xB7 "+o,Y===null?340:Math.round(Y.height*.46)),z("\u8FDE\u63A5\u4E2D\u2026",()=>b(""))}function Dt(){if(!Ur())return;Hd();let e=ki,t=bs;ki=null,bs=null,e!==null&&e.remove(),t!==null&&t.dispose()}function Pa(){if(De===null)return;let e=De.style.display==="none"||De.style.display==="";De.style.display=e?"":"none";let t=se!==null?se.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&De.focus()}var $d={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function zd(e){let t=gt();if(t===void 0||t.search===void 0)return;let i=De.value;if(i==="")return;let o={decorations:$d};e?t.search.findPrevious(i,o):t.search.findNext(i,o)}function ta(){Ci||se===null&&!Nr()||kt!==null||(kt=setTimeout(()=>{kt=null,ws()},mi),mi=Math.min(mi*2,5e3))}function Ai(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Dr(e){return Ai(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function Ud(){return Lt==="tmux"?{t:"spawn",cwd:Jo(),persist:!0,persistName:zr()}:{t:"spawn",cwd:Jo()}}async function Oa(){if(await Ea(),se===null){await qd();return}let e=vd(),t=pd();if(![...re.values()].some(r=>r.embedded!==!0)){if(e.length>0||t.length>0){ke({t:"sessions"});let r=await gs("sessions",4e3),a=new Map;if(r!==null&&Array.isArray(r.list))for(let n of r.list)n!==null&&typeof n=="object"&&n.attachable===!0&&a.set(n.sid,n);let f=new Set;for(let n of e){if(a.has(n.sid))bd(n);else if(Dr(n.spawnSpec))Zo(n);else continue;Ai(n.spawnSpec)&&f.add(n.spawnSpec.persistName)}for(let n of t){let _=n.spawnSpec.persistName;f.has(_)||(Zo(n),f.add(_))}At()}if(![...re.values()].some(r=>r.embedded!==!0)){if(await ms())return;yi()}return}let i=[...re.values()].filter(r=>!r.exited&&(r.embedded!==!0||r.spawned===!0)),o=i.filter(r=>Dr(r.spawnSpec)),h=null;if(o.length>0){ke({t:"sessions"});let r=await gs("sessions",4e3),a=new Set((r!==null&&Array.isArray(r.list)?r.list:[]).map(f=>f?.sid).filter(f=>typeof f=="string"));h=o.filter(f=>!a.has(f.sid));for(let f of h)Hr(f.sid)}let s=h!==null?new Set(h.map(r=>r.sid)):new Set;for(let r of i)s.has(r.sid)||ke({t:"attach",sid:r.sid})}function jd(){he!==null&&(he.readyState===WebSocket.OPEN||he.readyState===WebSocket.CONNECTING)||ws()}async function qd(){let e=[...re.values()].filter(o=>o.embedded===!0&&!o.exited);if(e.length===0)return;ke({t:"sessions"});let t=await gs("sessions",4e3),i=new Set((t!==null&&Array.isArray(t.list)?t.list:[]).map(o=>o?.sid).filter(o=>typeof o=="string"));for(let o of e)o.spawned===!0&&(i.has(o.sid)?ke({t:"attach",sid:o.sid}):Dr(o.spawnSpec)?ma(o):(o.exited=!0,o.live=!1,jt(o,"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","\u70B9\u51FB\u91CD\u65B0\u6267\u884C","exited")))}function ws(){if(he!==null){try{he.close()}catch{}he=null}Ci=!1,clearTimeout(kt),kt=null,as=!0,yt("\u8FDE\u63A5\u4E2D\u2026","");try{he=new WebSocket(Jh())}catch(e){as=!1,yt("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),ta();return}he.onopen=()=>{as=!1,mi=1e3,yt("\u5DF2\u8FDE\u63A5","connected");for(let e of[...kr])kr.delete(e),re.has(e.tab.sid)&&ke(e.frame);Oa()},he.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let o=typeof t.target=="string"?t.target:"";yt(t.kind==="ssh"?"SSH "+(o!==""?o+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=re.get(i);if(h!==void 0){if(h.exited=!1,h.spawned=!0,h.live=!0,h.errored=!1,h.target=o,h.persistTmux=t.persist===!0,t.kind==="ssh"&&o!==""&&!h.label&&(h.label=o,Qe()),Jt(),yr(i),jt(h,""),Ri(h),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(r=>setTimeout(r,500))]).then(()=>_a(150))}Ei(),At()}}else if(t.t==="data"){let o=re.get(i);o!==void 0&&o.term!==null&&(o.term.write(String(t.d??"")),Vd())}else if(t.t==="exit"){let o=re.get(i);if(o!==void 0){o.exited=!0,o.live=!1;let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";yt("\u5DF2\u9000\u51FA "+[h,s].filter(Boolean).join(" "),""),Jt(),yr(i),jt(o,"\u4F1A\u8BDD\u5DF2\u9000\u51FA","\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","exited"),Ei(),At()}}else if(t.t==="error")if(yt("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let o=re.get(i);o!==void 0&&(o.live||(o.errored=!0),Jt(),yr(i),jt(o,"\u8FDE\u63A5\u51FA\u9519",String(t.m??"")+" \xB7 \u70B9\u51FB\u91CD\u8BD5","error"))}else Kd("\u70B9\u51FB\u91CD\u8BD5")},he.onclose=()=>{if(as=!1,!Ci){yt("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of re.values())e.exited||jt(e,"\u8FDE\u63A5\u65AD\u5F00","\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","info");ta()}},he.onerror=()=>{}}function Kd(e){Yt!==null&&(Yt.textContent=e)}function qr(){if(se!==null){Ue&&Ia();return}Li(),se=document.createElement("div"),se.className="tt_modalBackdrop",se.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+Cs+'</span><div class="tt_tabs"></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+Zh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+Qh+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+ed+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+td+'</button></span><span class="tt_winGroup"><button class="tt_min" title="\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09">'+nd+'</button><button class="tt_close" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">'+ys+'</button></span></div><div class="tt_connbar" data-hidden><div class="tt_connArea"><span class="tt_connDot"></span><span class="tt_connTarget">\u2014</span><span class="tt_connBadge"></span></div><div class="tt_connActions"></div></div><div class="tt_work"><div class="tt_body"><div class="tt_overlay"></div></div></div></div>',document.body.appendChild(se),us=se.querySelector(".tt_status"),Qt=se.querySelector(".tt_statusText"),Mt=se.querySelector(".tt_statusDot"),vt=se.querySelector(".tt_tabs"),_i=se.querySelector(".tt_connbar"),pi=se.querySelector(".tt_connDot"),fs=se.querySelector(".tt_connTarget"),We=se.querySelector(".tt_connBadge"),vi=se.querySelector(".tt_connActions"),bt=se.querySelector(".tt_work"),Vt=se.querySelector(".tt_body"),Yt=se.querySelector(".tt_body > .tt_overlay"),De=se.querySelector(".tt_searchInput"),Yt.addEventListener("click",()=>{Yt.textContent="",ws()});let e=se.querySelector("[data-act=search]");e.addEventListener("click",()=>{Pa(),De.style.display!=="none"&&De.focus()}),e.dataset.on="",De.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),zd(t.shiftKey)):t.key==="Escape"&&(t.stopPropagation(),De.style.display="none")}),se.querySelector("[data-act=clear]").addEventListener("click",()=>{let t=gt();t!==void 0&&t.term!==null&&t.term.clear()}),se.querySelector("[data-act=copy]").addEventListener("click",()=>{let t=gt();if(t===void 0||t.term===null)return;let i=t.term.getSelection();i!==""&&navigator.clipboard.writeText(i).catch(()=>{})}),se.querySelector("[data-act=paste]").addEventListener("click",()=>{let t=gt();t!==void 0&&navigator.clipboard.readText().then(i=>{ke({t:"input",sid:t.sid,d:i})}).catch(()=>{})}),se.querySelector(".tt_min").addEventListener("click",()=>{Br()}),se.querySelector(".tt_close").addEventListener("click",()=>{Ls()}),se.addEventListener("mousedown",t=>{t.target===se&&Br()}),document.addEventListener("keydown",Na),gi=new ResizeObserver(()=>{Ue||(cs(),gd(gt()))}),gi.observe(Vt),Qe(),Jt(),he!==null&&he.readyState===WebSocket.OPEN?Oa():ws()}function Gd(){Te=document.createElement("div"),Te.className="tt_dock",Te.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Te.innerHTML='<span class="tt_dockTitle">'+Cs+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button>',_s=Te.querySelector(".tt_dockCount"),ei=Te.querySelector(".tt_dockStatus"),Rt=Te.querySelector(".tt_dockDot");let e=[...re.values()].filter(t=>!t.exited).length;_s.textContent=re.size>0?"\xB7 "+e+"/"+re.size:"",Qt!==null&&(ei.textContent=Qt.textContent),Mt!==null&&(Rt.dataset.state=Mt.dataset.state??""),Te.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),Ls();return}Ia()}),document.body.appendChild(Te)}function Br(){se===null||Ue||(Je(),pt(),Dt(),Ue=!0,De!==null&&(De.style.display="none"),se.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?Ei():(Gd(),Te.classList.add("tt_dockCompact")))}function Ei(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ue){t!==null&&t.remove(),delete e.dataset.minimized,e.removeAttribute("title");return}t===null&&(t=document.createElement("span"),t.className="tt_sidebarEntryBadge",t.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',e.appendChild(t)),e.dataset.minimized="",e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let i=[...re.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+re.size;let o=t.querySelector(".tt_sidebarBadgeDot");o!==null&&Mt!==null&&(o.dataset.state=Mt.dataset.state??"")}function Vd(){if(!Ue)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Rt;e!==null&&(e.dataset.active="",clearTimeout(ps),ps=setTimeout(()=>{delete e.dataset.active},900))}function Ia(){if(se===null||!Ue)return;Ue=!1,delete se.dataset.minimized,clearTimeout(ps),Te!==null&&(Te.remove(),Te=null),_s=null,ei=null,Rt=null,Ei();let e=gt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&Ri(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Ls(){if(se===null)return;hs(!0);let e=Nr();if(Ci=!e,Ue=!1,Je(),pt(),Dt(),clearTimeout(ps),clearTimeout(kt),kt=null,mi=1e3,Te!==null&&(Te.remove(),Te=null),_s=null,ei=null,Rt=null,Ei(),he!==null){for(let t of re.values())!t.exited&&t.embedded!==!0&&ke({t:"kill",sid:t.sid});if(!e){try{he.close()}catch{}he=null}}gi!==null&&(gi.disconnect(),gi=null);for(let[t,i]of[...re])if(i.embedded!==!0){if(i.term!==null)try{i.term.dispose()}catch{}re.delete(t)}Tt=null,document.removeEventListener("keydown",Na),se.remove(),se=null,bt=null,us=null,Qt=null,Mt=null,vt=null,_i=null,pi=null,fs=null,We=null,vi=null,Mr(),Vt=null,Yt=null,De=null,xs=0;try{sessionStorage.removeItem(vs)}catch{}}function Na(e){if(e.key==="Escape"&&se!==null){if(e.preventDefault(),ki!==null){Dt();return}if(Xt!==null){pt();return}if($e!==null){Je();return}Br()}}function Yd(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function Xd(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let i of e.children)if(i.tagName==="BUTTON")return i}function Jd(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label","\u7EC8\u7AEF"),e.innerHTML='<span class="tt_sidebarEntryIcon">'+Cs+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),qr()}),e}function ia(e,t){let i=Xd(e);if(i===void 0)return!1;if(t.parentElement!==e){let o=i.closest('[class*="logoRow"]'),h=o!==null&&o.parentElement===e?o:i,s=Array.from(e.children).filter(r=>r instanceof HTMLElement&&r.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(s.length>0){let r=s[s.length-1];e.insertBefore(t,r.nextSibling)}else e.insertBefore(t,h.nextElementSibling)}return!0}function Zd(){if(Li(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=Jd(),t,i=!1,o=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,i=!1),i){if(document.body.contains(e))return;s.disconnect(),t=void 0,i=!1}t??(t=Yd()),t!==void 0&&(i=ia(t,e),i&&s.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{o()});h.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,o();return}t.contains(e)||(i=ia(t,e))});return o(),()=>{h.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:o,jsxs:h}=e("react/jsx-runtime"),s="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function r(){let[a,f]=i.useState(!1),[n,_]=i.useState(null),[v,S]=i.useState(!1),[p,c]=i.useState(!1),[d,l]=i.useState({kind:"",text:""}),[u,g]=i.useState([]),[C,w]=i.useState(!1),y=W=>o("div",{className:"tt_cardSection",children:W}),m=async()=>{try{let V=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();V.ok&&typeof V.config=="object"&&V.config!==null?(_(V.config),xi(V.config)):l({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},x=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&g(V.shells)}catch{}};i.useEffect(()=>{a&&!v&&(S(!0),m(),x())},[a]);let T=(W,V)=>_(X=>({...X||{},[W]:V})),I=(W,V)=>_(X=>({...X||{},sftpLimits:{...X?.sftpLimits??{},[W]:V}})),[F,R]=i.useState(null),[z,B]=i.useState(null),[D,O]=i.useState(""),[P,b]=i.useState({}),[E,L]=i.useState([]),[M,$]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!a)return;let W=!0,V=async()=>{try{let ne=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();W&&ne.ok&&Array.isArray(ne.tunnels)&&L(ne.tunnels)}catch{}};V();let X=setInterval(V,2e3);return()=>{W=!1,clearInterval(X)}},[a]);let K=W=>V=>$(X=>({...X||{},[W]:V.target.value})),Y=W=>W?.direction==="remote"?`\u8FDC\u7A0B:${W.remoteHost||"127.0.0.1"}:${String(W.remotePort??0)} \u2192 \u672C\u673A:${String(W.localTargetPort??0)}`:`\u672C\u673A:${String(W?.localPort??0)} \u2192 ${W?.remoteHost??"?"}:${String(W?.remotePort??0)}`,U=(n?.sshHosts??[]).find(W=>W?.name===M?.bookName),A=async W=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:W})}),X=await V.json().catch(()=>({}));return!V.ok||!X.ok?(l({kind:"error",text:String(X.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return l({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},k=()=>{l({kind:"",text:""});let W=M||{},V=W.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(V===""){l({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let X=ge=>{let le=Number(ge);return Number.isInteger(le)&&le>=1&&le<=65535?le:0},te;if(W.direction==="remote"){if(te={name:"",bookName:V,direction:"remote",remotePort:X(W.remotePort),localTargetHost:"",localTargetPort:X(W.localTargetPort),enabled:!0},te.remotePort<1||te.localTargetPort<1){l({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}te.name=`${V}-R${String(te.remotePort)}`}else{if(te={name:"",bookName:V,direction:"local",localPort:X(W.localPort),remoteHost:W.remoteHost.trim(),remotePort:X(W.remotePort),enabled:!0},te.localPort<1||te.remoteHost===""||te.remotePort<1){l({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}te.name=`${V}-L${String(te.localPort)}`}let ne=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(ge=>ge?.name)),ce=te.name,ve=2;for(;ne.has(ce);)ce=`${te.name}-${String(ve)}`,ve+=1;te.name=ce;let ie=[...Array.isArray(n?.tunnels)?n.tunnels:[],te];_(ge=>({...ge||{},tunnels:ie})),$(ge=>({...ge||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),A(ie).then(ge=>{ge&&l({kind:"ok",text:`\u96A7\u9053\u300C${ce}\u300D\u5DF2\u751F\u6548`})})},N=W=>{let V=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(X=>X?.name!==W);_(X=>({...X||{},tunnels:V})),A(V)},H=(W,V)=>{let X=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(te=>te?.name===W?{...te,enabled:V}:te);_(te=>({...te||{},tunnels:X})),A(X)},q=W=>{R(W?.name??null),O(""),B({name:W?.name??"",host:W?.host??"",port:String(W?.port??22),username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0})},j=()=>{R(null),B(null),O("")},Q=()=>{if(z===null)return;let W=z.name.trim(),V=z.host.trim(),X=z.username.trim();if(W===""||V===""||X===""){O("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let te=Number(z.port);if((!Number.isInteger(te)||te<1||te>65535)&&(te=22),(n?.sshHosts??[]).some(ne=>ne?.name===W&&W!==F)){O("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+W);return}if(z.auth==="key"&&z.keyPath.trim()===""){O("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}_(ne=>({...ne||{},sshHosts:(Array.isArray(ne?.sshHosts)?ne.sshHosts:[]).map(ce=>ce?.name===F?{name:W,host:V,port:te,username:X,auth:z.auth,keyPath:z.keyPath.trim(),passphrase:z.passphrase,password:z.password,agentForward:z.agentForward}:ce)})),R(null),B(null),O(""),l({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+W+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},ee=W=>{F===W&&j(),b(V=>{let X={...V};return delete X[W],X}),_(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(X=>X?.name!==W)}))},G=async W=>{let V=W?.name??"";if(V==="")return;let X={host:W?.host??"",port:Number(W?.port)||22,username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0};b(ne=>({...ne,[V]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let te=await xa(X,!0);b(ne=>{let ce=ne[V]||{};if(te.result){let ve=te.result.auth?.ok===!0;return{...ne,[V]:{running:!1,ok:ve,text:ka(te.result)}}}return{...ne,[V]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(te.error||"\u672A\u77E5\u9519\u8BEF")}}})},J=async W=>{let V=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(X=>!(X?.host===W?.host&&Number(X?.port)===Number(W?.port)));_(X=>({...X||{},hostKeys:V}));try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),te=await X.json().catch(()=>({}));!X.ok||!te.ok?l({kind:"error",text:String(te.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):l({kind:"ok",text:"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09"})}catch(X){l({kind:"error",text:String(X&&X.message?X.message:X)})}},Z=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],ne=new Set(te.map(ie=>ie?.name)),ce=0,ve=0;for(let ie of X)if(!(ie===null||typeof ie!="object"||typeof ie.name!="string")){if(ne.has(ie.name)){ve+=1;continue}ne.add(ie.name),te.push({name:ie.name,host:String(ie.host??ie.name),port:Number(ie.port)||22,username:String(ie.username??""),auth:ie.auth==="key"?"key":"agent",keyPath:String(ie.keyPath??""),passphrase:"",password:"",agentForward:!1}),ce+=1}_(ie=>({...ie||{},sshHosts:te})),l(ce===0?{kind:"ok",text:ve>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${ve} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09`:"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"}:{kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ce} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${ve} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},oe=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],ne=new Set(te.map(ie=>String(ie?.host??"")+":"+String(ie?.port??22))),ce=0,ve=0;for(let ie of X){if(ie===null||typeof ie!="object"||typeof ie.host!="string"||typeof ie.fingerprint!="string")continue;let ge=ie.host+":"+String(ie.port??22);if(ne.has(ge)){ve+=1;continue}ne.add(ge),te.push({host:ie.host,port:Number(ie.port)||22,fingerprint:ie.fingerprint}),ce+=1}if(ce===0){l({kind:"ok",text:ve>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${ve} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}_(ie=>({...ie||{},hostKeys:te}));try{let ie=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:te})}),ge=await ie.json().catch(()=>({}));if(!ie.ok||!ge.ok){l({kind:"error",text:String(ge.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}l({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ce} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${ve} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(ie){l({kind:"error",text:String(ie&&ie.message?ie.message:ie)})}}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},ae=async()=>{c(!0),l({kind:"",text:""});let W={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose"]){let X=(n||{})[V];X!==void 0&&X!==""&&(W[V]=X)}W.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],W.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[],n?.sftpLimits&&typeof n.sftpLimits=="object"&&(W.sftpLimits={maxDownloadMb:Number(n.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(n.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(n.sftpLimits.maxUploadFiles)||0});try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(W)}),X=await V.json();!V.ok||!X.ok?l({kind:"error",text:String(X.error||"\u4FDD\u5B58\u5931\u8D25")}):(l({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),X.config&&(_(X.config),xi(X.config)))}catch(V){l({kind:"error",text:String(V&&V.message?V.message:V)})}c(!1)},me=()=>{if(z===null)return null;let W=(V,X,te,ne)=>h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:V}),o("input",{className:"tt_cardInput",type:ne??"text",value:z[X]??"",placeholder:te??"",autoComplete:"off",spellCheck:!1,onChange:ce=>B(ve=>({...ve||{},[X]:ce.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[W("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),W("\u7AEF\u53E3","port","22")]}),W("\u4E3B\u673A","host","example.com \u6216 IP"),W("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:z.auth,onChange:V=>B(X=>({...X||{},auth:V.target.value})),children:[o("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),o("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),o("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...z.auth==="key"?[W("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),W("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...z.auth==="password"?[W("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z.agentForward===!0,onChange:V=>B(X=>({...X||{},agentForward:V.target.checked}))}),o("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),D!==""?o("span",{className:"tt_cardMessage tt_cardMessageError",children:D}):null,h("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_cardSave",onClick:Q,children:"\u5E94\u7528"}),o("button",{type:"button",className:"tt_toolBtn",onClick:j,children:"\u53D6\u6D88"})]})]})},we=(W,V,X,te)=>h("label",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:W}),o("input",{className:"tt_cardInput",value:n[V]??"",placeholder:X??"",onChange:ne=>T(V,ne.target.value)}),te?o("span",{className:"tt_cardHint",children:te}):null]}),fe=(W,V)=>h("label",{className:"tt_cardField tt_cardRow",children:[o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[V]===!0,onChange:X=>T(V,X.target.checked)}),o("span",{className:"tt_cardLabel",children:W})]});return h("li",{className:a?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":a,onClick:()=>f(W=>!W),children:[h("span",{className:"tt_cardHeadText",children:[o("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),o("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\u4E0E\u4E3B\u673A\u6307\u7EB9\u9489\u624E\u3001tmux \u4F1A\u8BDD\u6301\u4E45\u5316\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),o("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:o("path",{d:s,fill:"currentColor"})})]}),a?h("div",{className:"tt_cardBody",children:[n===null?o("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[y("\u57FA\u7840"),fe("\u542F\u7528\u63D2\u4EF6\uFF08\u9700\u91CD\u542F\u751F\u6548\uFF09","enabled"),fe("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),fe("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),y("SFTP \u6587\u4EF6\u4F20\u8F93"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),h("select",{className:"tt_cardInput",value:n.sftpStyle==="dual"?"dual":"dialog",onChange:W=>T("sftpStyle",W.target.value),children:[o("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),o("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),o("span",{className:"tt_cardHint",children:"\u53CC\u680F\u5728\u672C\u673A\u4E0E\u8FDC\u7A0B\u4E4B\u95F4\u5BF9\u62F7\u6587\u4EF6\uFF08\u76EE\u5F55\u9012\u5F52\u3001\u540C\u540D\u8986\u76D6\uFF09\uFF1B\u91CD\u65B0\u6253\u5F00 SFTP \u540E\u751F\u6548"})]}),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),h("div",{className:"tt_limitGrid",children:[h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxDownloadMb))?Number(n.sftpLimits.maxDownloadMb):1024),onChange:W=>I("maxDownloadMb",Number(W.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadMb))?Number(n.sftpLimits.maxUploadMb):2048),onChange:W=>I("maxUploadMb",Number(W.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadFiles))?Number(n.sftpLimits.maxUploadFiles):1e3),onChange:W=>I("maxUploadFiles",Number(W.target.value)||0)})]})]}),o("span",{className:"tt_cardHint",children:"\u6D4F\u89C8\u5668\u4FA7\u4FDD\u62A4\uFF1A\u5355\u4E2A\u6587\u4EF6\u8D85\u8FC7\u4E0A\u9650\u65F6\u4E2D\u6B62\u4E0B\u8F7D/\u4E0A\u4F20\uFF08\u5927\u6587\u4EF6\u8BF7\u7528\u53CC\u680F \u21E8/\u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync\uFF0C\u4E0D\u5360\u6D4F\u89C8\u5668\u5185\u5B58\uFF09\uFF1B\u6587\u4EF6\u6570\u4E0A\u9650\u9488\u5BF9\u4E00\u6B21\u6279\u91CF/\u62D6\u62FD\u4E0A\u4F20\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"})]}),y("\u4F1A\u8BDD"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),h("select",{className:"tt_cardInput",value:n.persistence==="tmux"?"tmux":"off",onChange:W=>T("persistence",W.target.value),children:[o("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),o("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),o("span",{className:"tt_cardHint",children:"\u5F00\u542F\u540E\u6240\u6709\u65B0\u6807\u7B7E\uFF08\u672C\u5730/SSH \u8FDE\u63A5\u7C3F/SSH \u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF09\u9ED8\u8BA4\u7531 tmux \u6258\u7BA1\u3001\u53EF\u8DE8\u5BBF\u4E3B\u91CD\u542F\u6062\u590D\uFF1B\u9700\u672C\u673A/\u8FDC\u7A0B\u5B89\u88C5 tmux\uFF1BSSH \u5BF9\u8BDD\u6846\u53EF\u5BF9\u5355\u6B21\u8FDE\u63A5\u53D6\u6D88\u52FE\u9009\uFF1B\u5DF2\u6709\u6807\u7B7E\u4E0D\u53D7\u5F71\u54CD"}),fe("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),o("span",{className:"tt_cardHint",children:"\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6574\u4E2A\u9875\u9762\u5173\u95ED\u65F6\u6301\u4E45\u4F1A\u8BDD\u7559\u5B58\uFF08\u4FDD\u6D3B\u671F\u540E\u53EF\u518D\u6062\u590D\uFF09\uFF1B\u5F00\u542F\u5219\u9875\u9762\u65AD\u5F00\u4E14\u4FDD\u6D3B\u671F\u7ED3\u675F\u65F6\u8FDE tmux \u4F1A\u8BDD\u4E00\u8D77\u7ED3\u675F\u2014\u2014\u6CE8\u610F\u5237\u65B0\u9875\u9762\u5728\u4FDD\u6D3B\u671F\u5185\u4E0D\u53D7\u5F71\u54CD"})]}),we("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),h("div",{className:"tt_cardField",onBlur:W=>{W.currentTarget.contains(W.relatedTarget)||w(!1)},children:[o("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),o("input",{className:"tt_cardInput",value:n.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>w(!0),onClick:()=>w(!0),onKeyDown:W=>{W.key==="Escape"&&w(!1)},onChange:W=>{T("shell",W.target.value),w(!0)}}),...C?[o("div",{className:"tt_envList tt_shellList",children:(()=>{let W=(n.shell??"").trim().toLowerCase(),V=W===""?u:u.filter(X=>X.toLowerCase().includes(W));return V.length===0?o("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF"}):V.map(X=>o("button",{type:"button",className:"tt_envItem",onMouseDown:te=>te.preventDefault(),onClick:()=>{T("shell",X),w(!1)},children:X},X))})()},"shell-list")]:[],o("span",{className:"tt_cardHint",children:"\u53EF\u4E0B\u62C9\u9009\u62E9\u672C\u673A\u5DF2\u5B89\u88C5 shell\uFF08$SHELL \u4F18\u5148\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bzsh / bash \u652F\u6301 shell \u96C6\u6210"})]},"shell-field"),we("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),we("COLORTERM","colorTerm","truecolor",""),we("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),we("\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","reconnectGraceSec","120","\u5237\u65B0\u9875\u9762/\u7F51\u7EDC\u6296\u52A8\u540E\u4F1A\u8BDD\u4FDD\u6D3B\u7B49\u5F85\u91CD\u8FDE\uFF0C\u8D85\u65F6\u540E\u7ED3\u675F\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),y("SSH \u8FDE\u63A5"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[o("div",{className:"tt_hostList",children:n.sshHosts.map(W=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:W?.name??""}),o("span",{className:"tt_sshHostTarget",children:Rr(W??{})})]}),o("button",{type:"button",className:"tt_toolBtn",disabled:P[W?.name]?.running===!0,onClick:()=>{G(W)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:P[W?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>q(W),children:"\u7F16\u8F91"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>ee(W?.name),children:"\u5220\u9664"})]}),P[W?.name]&&P[W?.name].text?o("div",{className:"tt_sshProbeResult"+(P[W?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:P[W?.name].text}):null,F===W?.name?me():null]},String(W?.name??"")))})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],h("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),o("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),o("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),h("div",{className:"tt_cardField",children:[h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[o("div",{children:n.tunnels.map(W=>{let V=E.find(te=>te.name===W?.name),X=V?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[o("span",{className:"tt_tunnelDot","data-state":X,title:X}),o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:(W?.name??"")+" \xB7 "+Y(W??{})}),o("span",{className:"tt_sshHostTarget",children:(W?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:W?.enabled!==!1,title:"\u542F\u7528",onChange:te=>H(W?.name,te.target.checked)}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>N(W?.name),children:"\u5220\u9664"})]},String(W?.name??""))})})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3"})],h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_cardRow",children:[h("select",{className:"tt_cardInput",value:M.direction,onChange:K("direction"),children:[o("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),o("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),h("select",{className:"tt_cardInput",value:M.bookName,onChange:K("bookName"),children:[o("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map(W=>o("option",{value:W?.name??"",children:W?.name??""})):[]]})]}),o("span",{className:"tt_cardHint",children:U!==void 0?"\u7ECF "+Rr(U)+" \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE":"\u9009\u62E9\u8FD9\u6761\u96A7\u9053\u8981\u8D70\u54EA\u53F0 SSH \u8FDE\u63A5\uFF08\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8FDE\u63A5\u7C3F\uFF09"}),M.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[o("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:M.localPort,autoComplete:"off",onChange:K("localPort")}),o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:M.remoteHost,autoComplete:"off",onChange:K("remoteHost")}),o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:K("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:K("remotePort")}),o("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:M.localTargetPort,autoComplete:"off",onChange:K("localTargetPort")})]}),o("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_cardSave",onClick:k,children:"\u6DFB\u52A0\u96A7\u9053"}),o("span",{className:"tt_cardHint",children:"\u6DFB\u52A0\u540E\u7ACB\u5373\u751F\u6548\uFF1B\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\uFF1B\u672C\u5730\u7AEF\u53E3\u5EFA\u8BAE 1024 \u4EE5\u4E0A\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF08127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09"})]})]})]}),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{oe()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[o("div",{className:"tt_hostList",children:n.hostKeys.map(W=>h("div",{className:"tt_sshHostRow",children:[o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:String(W?.host??"")+":"+String(W?.port??22)}),o("span",{className:"tt_sshHostTarget",children:"sha256:"+String(W?.fingerprint??"")})]}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{J(W)},children:"\u5220\u9664"})]},String(W?.host??"")+":"+String(W?.port??22)))})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9"})],o("span",{className:"tt_cardHint",children:"\u4E3B\u673A\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE"})]}),h("div",{className:"tt_cardField tt_cardRow",children:[o("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ae()},children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),o("span",{className:"tt_cardMessage"+(d.kind==="ok"?" tt_cardMessageOk":d.kind==="error"?" tt_cardMessageError":""),children:d.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=a=>{fa=a.sessions,Zd(),a.slots.inject("settings.plugin.item",()=>a.slots.register({name:"settings.plugin.item",key:"tty",order:110},r));let f=a.provide("ttyConnbar",{version:1,addAction:ks,requestRender(){Jt()}}),n=a.provide("ttyTerminal",{version:2,open(v){let S=pa(v),p=va(v,S),c=typeof v?.label=="string"&&v.label!==""?v.label:void 0;Li(),se===null&&qr(),yi(p,c)},mount(v,S){return Cd(v,S)}}),_=a.provide("ttyPanel",{version:1,isOpen(){return se!==null&&!Ue},mountPane(v){return ba(v)}});return()=>{_(),n(),f(),Ls()}},t}});})();
|
|
2374
|
+
`;var Qh="/api/dsh-tty/ws";function ed(){return(location.protocol==="https:"?"wss:":"ws:")+"//"+location.host+Qh}function xr(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var lr;function Ri(){document.getElementById("dsh-tty-style")||(lr=document.createElement("style"),lr.id="dsh-tty-style",lr.textContent=Qo+`
|
|
2375
|
+
`+Zo,document.head.appendChild(lr))}var kr='<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 5l3.5 3L3 11"/><path d="M8.5 11H13"/></svg>',td='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="7" cy="7" r="4.4"/><path d="M10.4 10.4L14 14"/></svg>',id='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 4.5h11"/><path d="M6 4.5V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.5"/><path d="M4.5 4.5l.7 8.1a1 1 0 0 0 1 .9h3.6a1 1 0 0 0 1-.9l.7-8.1"/></svg>',rd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.4"/><path d="M3.5 10.5h-1v-8h8v1"/></svg>',sd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3" width="9" height="11" rx="1.4"/><rect x="5.5" y="1.5" width="5" height="3" rx="1" fill="var(--dsw-alias-bg-base,#fff)"/></svg>',nd='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.5 8a5.5 5.5 0 1 1-1.6-3.9"/><path d="M13.7 1.8v2.7H11"/></svg>',od='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.8 12.8V4.2a1 1 0 0 1 1-1h3l1.4 1.6h6a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2.8a1 1 0 0 1-1-1z"/></svg>',ad='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4.5 5.5L2 8l2.5 2.5"/><path d="M11.5 5.5L14 8l-2.5 2.5"/><path d="M2.8 8h10.4"/></svg>',ld='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4 8h8"/></svg>',Er='<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7"/><path d="M11.5 4.5l-7 7"/></svg>',cd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M8 3.6v8.8"/><path d="M3.6 8h8.8"/></svg>',Ci='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/></svg>',la='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 2.6h4.4l3.6 3.6v7.2a.9.9 0 0 1-.9.9H4.9a.9.9 0 0 1-.9-.9V3.5a.9.9 0 0 1 .9-.9z"/><path d="M8.2 2.7v3.4h3.4"/></svg>',ca='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.4 9.6l3.2-3.2"/><path d="M9.2 4.6l1-1a2.5 2.5 0 0 1 3.5 3.5l-1 1"/><path d="M6.8 11.4l-1 1a2.5 2.5 0 0 1-3.5-3.5l1-1"/></svg>',Is='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 12.6V4.2"/><path d="M4.4 7.8L8 4.2l3.6 3.6"/></svg>',ha='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3v7.2"/><path d="M5 7.4L8 10.4l3-3"/><path d="M3.4 12.8h9.2"/></svg>',hd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 10.4V3.2"/><path d="M5 6.2L8 3.2l3 3"/><path d="M3.4 12.8h9.2"/></svg>',Ns='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.2 2.9l1.9 1.9-7.3 7.3-2.4.5.5-2.4z"/></svg>',Yt='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 4.6h10"/><path d="M6.2 4.6V3.4a.8.8 0 0 1 .8-.8h2a.8.8 0 0 1 .8.8v1.2"/><path d="M4.6 4.6l.6 8a.9.9 0 0 0 .9.8h3.8a.9.9 0 0 0 .9-.8l.6-8"/></svg>',Hs='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 8a5.2 5.2 0 1 1-1.5-3.7"/><path d="M13.4 2.2v2.6h-2.6"/></svg>',da='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12.4V3.9a.9.9 0 0 1 .9-.9h2.9l1.4 1.6h5.9a.9.9 0 0 1 .9.9v6.9a.9.9 0 0 1-.9.9H2.9a.9.9 0 0 1-.9-.9z"/><path d="M8 6.6v3.6"/><path d="M6.2 8.4h3.6"/></svg>',ua='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.4 8h9"/><path d="M9.2 4.8L12.4 8l-3.2 3.2"/></svg>',fa='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.6 8h-9"/><path d="M6.8 4.8L3.6 8l3.2 3.2"/></svg>',dd='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3.4v9"/><path d="M4.8 9.2L8 12.4l3.2-3.2"/></svg>',ud='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.4" y="3.2" width="11.2" height="4" rx="1.2"/><rect x="2.4" y="8.8" width="11.2" height="4" rx="1.2"/><path d="M5 5.2h.01"/><path d="M5 10.8h.01"/></svg>',fd='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.6l5.8 10.4H2.2z"/><path d="M8 6.4v3.2"/><path d="M8 11.6h.01"/></svg>',_d='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M8 7.2v3.6"/><path d="M8 5.1h.01"/></svg>',_a='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="5.6"/><path d="M6 6l4 4"/><path d="M10 6l-4 4"/></svg>',pd='<svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2.8v5"/><path d="M11.6 4.6a5.2 5.2 0 1 1-7.2 0"/></svg>',pa='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="5.6" cy="6" r="2.8"/><path d="M7.8 7.9l5.4 5.4"/><path d="M10.6 10.7l1.2-1.2"/></svg>',ga=null,he=null,re=null,_r=null,ei=null,Tt=null,gt=null,pi=null,gi=null,pr=null,We=null,vi=null,Xt=null,bt=null,De=null,Jt=null,yi=!1,mi=null,Ue=!1,Te=null,gr=null,ti=null,At=null,vr=null,kt=null,bi=1e3,mr="dsh-tty:tabs",se=new Map,Ti=new Set,Fs=()=>Ti.size>0,Ls=new Set,Dt=null,Lr=0,cr=!1,$e=null,Zt=null,St=[],Ms=new Set;function Mr(e){return Ms.add(e),()=>Ms.delete(e)}Mr(({tab:e,addAction:t})=>{Rt&&e.exited&&t(nd,"\u91CD\u65B0\u6253\u5F00","\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD",()=>Ws(e.sid))});Mr(({tab:e,addAction:t})=>{Rt&&t(od,"SFTP","\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09",()=>Gs(e.spawnSpec))});Mr(({bookName:e,addAction:t})=>{if(!Rt)return;let i=e!==""?La(e):0;i>0&&t(ad,"\u96A7\u9053 "+i,"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053",o=>Bd(o.currentTarget,e))});function yt(e,t){if(ei===null)return;ei.textContent=e,Tt.dataset.state=t,_r!==null&&(_r.style.display=t==="connected"?"none":""),ti!==null&&(ti.textContent=e),At!==null&&(At.dataset.state=t);let i=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");i!==null&&(i.dataset.state=t)}function ke(e){he!==null&&he.readyState===WebSocket.OPEN&&he.send(JSON.stringify(e))}function vt(){return Dt!==null?se.get(Dt):void 0}function ea(){try{let e=ga?.list?.getSnapshot?.(),t=e?.byId?.[e?.current]?.cwd;return typeof t=="string"&&t!==""?t:void 0}catch{return}}function gd(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),ke({t:"refresh",sid:e.sid})}}var hr=null;function va(e){hr!==null&&clearTimeout(hr),hr=setTimeout(()=>{hr=null;let t=vt();t!==void 0&&gd(t)},e??200)}function Bt(){try{let e=[...se.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:t.spawnSpec,label:t.label}));e.length===0||re===null?sessionStorage.removeItem(mr):sessionStorage.setItem(mr,JSON.stringify(e)),vd([...se.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:t.spawnSpec,label:t.label})))}catch{}}var Rs="dsh-tty:persist-specs";function vd(e){try{let t=e.filter(i=>Bi(i.spawnSpec)).map(i=>({spawnSpec:i.spawnSpec,label:i.label}));t.length===0?localStorage.removeItem(Rs):localStorage.setItem(Rs,JSON.stringify(t))}catch{}}function md(){try{let e=localStorage.getItem(Rs);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&Bi(i.spawnSpec)):[]}catch{return[]}}function bd(){try{let e=sessionStorage.getItem(mr);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>i!==null&&typeof i=="object"&&typeof i.sid=="string"&&i.sid!==""&&i.spawnSpec!==null&&typeof i.spawnSpec=="object"):[]}catch{return[]}}function br(e,t){return new Promise(i=>{let o=r=>{let s;try{s=JSON.parse(r.data)}catch{return}s.t===e&&(clearTimeout(h),he.removeEventListener("message",o),i(s))},h=setTimeout(()=>{he.removeEventListener("message",o),i(null)},t);he.addEventListener("message",o)})}function Ai(e){if(e===void 0||e.fit===void 0)return;let t=e.fit.proposeDimensions();t!==void 0&&ke({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows})}function wd(e){if(e===void 0||e.fit===void 0)return;let t=e.term,i=t!==null&&t.buffer!==void 0?t.buffer.active:null,o=i==null?null:{atBottom:i.viewportY>=i.baseY,line:i.viewportY};try{e.fit.fit()}catch{return}if(o!==null)try{o.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(o.line,t.buffer.active.baseY))}catch{}e.exited||Ai(e)}function Kt(e,t,i,o){if(e.overlayEl===null||e.overlayEl===void 0)return;let h=e.overlayEl;if(t===""||t===void 0){h.textContent="";return}let r=o==="error"||o==="info"?o:"exited";h.innerHTML='<div class="tt_overlayCard" data-kind="'+r+'"><span class="tt_overlayIcon">'+(r==="error"?_a:r==="info"?Hs:pd)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(i===void 0||i===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",h.querySelector(".tt_overlayMain").textContent=t,i!==void 0&&i!==""&&(h.querySelector(".tt_overlayHint").textContent=i)}function Sd(e,t){try{let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i!==""?i:t}catch{return t}}function Di(e){let t=Sd("--dsw-alias-state-business-primary","#7c9cff"),i=new oa.Terminal({cursorBlink:!0,cursorStyle:"bar",cursorInactiveStyle:"outline",fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontWeight:400,fontWeightBold:600,lineHeight:1.35,scrollback:5e3,convertEol:!1,allowProposedApi:!0,theme:{background:"#0b0e14",foreground:"#d7dce5",cursor:t,cursorAccent:"#0b0e14",selectionBackground:"rgba(124, 156, 255, .30)",black:"#1b2028",red:"#f07178",green:"#7ec699",yellow:"#e6b673",blue:"#7aa2f7",magenta:"#c792ea",cyan:"#7fdbca",white:"#c8d0dc",brightBlack:"#556070",brightRed:"#ff8b92",brightGreen:"#9fe0b4",brightYellow:"#f5cc8c",brightBlue:"#9ab8ff",brightMagenta:"#dbb3ff",brightCyan:"#a3f0e2",brightWhite:"#eef2f8"}}),o=new aa.FitAddon,h=new Ln;i.loadAddon(o),i.loadAddon(h),i.loadAddon(new Mn);let r=document.createElement("div");r.className="tt_term";let s=document.createElement("div");s.className="tt_overlay",s.addEventListener("click",()=>{s.textContent="",Ws(e.sid)}),r.appendChild(s),i.open(r);try{o.fit()}catch{}try{let a=new Jo;a.onContextLoss(()=>{try{a.dispose()}catch{}}),i.loadAddon(a)}catch{}i.onData(a=>{ke({t:"input",sid:e.sid,d:a})}),i.onResize(()=>{Bi(e.spawnSpec)&&va(200)}),i.attachCustomKeyEventHandler(a=>e.embedded===!0?!0:(a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="f"?(a.preventDefault(),Na(),!1):!0),e.term=i,e.fit=o,e.search=h,e.termEl=r,e.overlayEl=s}function xi(e,t){let i=xr(),o={sid:i,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??Gd(),label:t};return Di(o),se.set(i,o),Lr+=1,Qe(),ri(i),Rr(o),Bt(),o}function Cd(e){let t={sid:e.sid,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Di(t),se.set(t.sid,t),Lr+=1,Qe(),ri(t.sid),ke({t:"attach",sid:t.sid})}function Rr(e){let t=e.fit!==null?e.fit.proposeDimensions():void 0,i={...e.spawnSpec,sid:e.sid,cols:t!==void 0?t.cols:80,rows:t!==void 0?t.rows:24};if(he===null||he.readyState!==WebSocket.OPEN){Ls.add({tab:e,frame:i});return}ke(i)}function ta(e){let t={sid:xr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e.spawnSpec,label:typeof e.label=="string"?e.label:void 0};Di(t),se.set(t.sid,t),Lr+=1,Qe(),ri(t.sid),Rr(t)}function Ws(e){let t=se.get(e);if(t===void 0)return;if(t.embedded===!0){Sa(t);return}let i=t.spawnSpec,o=t.label;if(t.exited||ke({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),se.delete(e);let h={sid:xr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:i,label:o};Di(h),se.set(h.sid,h),Qe(),ri(h.sid),Rr(h),Bt()}function yd(e){let t=se.get(e);if(t!==void 0){if(t.exited||ke({t:"kill",sid:e}),se.delete(e),Ti.delete(e),t.term!==null)try{t.term.dispose()}catch{}if(t.termEl!==null&&t.termEl.remove(),Dt===e){Dt=null;let i=[...se.keys()].pop()??null;i!==null&&ri(i)}Qe(),[...se.values()].some(i=>i.embedded!==!0)?Bt():Mi()}}function ma(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error("ttyTerminal \u9700\u8981 command");if(/[\r\n\0]/.test(t))throw new Error("command \u5FC5\u987B\u662F\u5355\u884C");return t}function ba(e,t){return typeof e?.book=="string"&&e.book!==""?{t:"ssh",name:e.book,command:t}:e?.spec!==null&&typeof e?.spec=="object"?{t:"ssh",...e.spec,command:t}:{t:"spawn",...typeof e?.cwd=="string"&&e.cwd!==""?{cwd:e.cwd}:{},command:t}}function xd(e){let t=e.controller;t===void 0||t.observer!==null||(t.observer=new ResizeObserver(()=>{if(!(t.disposed||t.tab!==e||e.term===null)){try{e.fit.fit()}catch{return}e.spawned&&!e.exited&&Ai(e)}}),t.observer.observe(t.hostEl))}function wa(e,t,i){let o={sid:xr(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:i};return Di(o),se.set(o.sid,o),Ti.add(o.sid),e.hostEl.appendChild(o.termEl),xd(o),Rr(o),o}function Sa(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||ke({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),se.delete(e.sid),Ti.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=wa(t,e.spawnSpec,e.label),t.tab}}function kd(e,t){if(!(e instanceof HTMLElement))throw new Error("ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9");let i=ma(t),o=ba(t,i),h=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Ri();let r={hostEl:e,tab:null,observer:null,disposed:!1};return r.tab=wa(r,o,h),Vd(),()=>Ed(r)}function Ed(e){if(e.disposed)return;e.disposed=!0,e.observer!==null&&(e.observer.disconnect(),e.observer=null);let t=e.tab;if(t!==null){t.exited||ke({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),se.delete(t.sid),Ti.delete(t.sid),e.tab=null}if(re===null&&!Fs()&&he!==null){yi=!0;try{he.close()}catch{}he=null}}var Ld=460,Md=280,Rd=320,Td=160,Et=null,Gt=Ld,Vt=Rd;function $s(){let e=re!==null?re.querySelector(".tt_modal"):null,t=e!==null?e:re;return t!==null?t.getBoundingClientRect():null}var zs=e=>e==="bottom"?Td:Md;function Ad(e){let t=$s();if(t===null)return 900;let i=e==="bottom"?t.height:t.width;return Math.max(zs(e),Math.round(i*.72))}function wi(e,t){return Math.min(Ad(e),Math.max(zs(e),Math.round(t)))}function dr(){let e=Et;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){Vt=wi("bottom",Vt),e.el.style.width="",e.el.style.height=String(Vt)+"px",e.el.style.flexBasis=String(Vt)+"px";return}Gt=wi("right",Gt),e.el.style.height="",e.el.style.width=String(Gt)+"px",e.el.style.flexBasis=String(Gt)+"px"}}function ur(e){let t=Et;if(t!==null){if(Et=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(i){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(i instanceof Error?i.message:String(i)))}try{t.el.remove()}catch{}bt!==null&&delete bt.dataset.side}}function Ca(e){if(re===null&&Vs(),bt===null)throw new Error("ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA");Et!==null&&ur(!0),Ri();let t=e?.side==="bottom"?"bottom":"right",i=Math.max(t==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:zs(t)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let p=wi(t,e.size);t==="bottom"?Vt=p:Gt=p}let o=document.createElement("div");o.className="tt_dockPane",o.dataset.side=t,bt.dataset.side=t,o.innerHTML='<div class="tt_dockPaneResize" title="'+(t==="bottom"?"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6")+'"></div><div class="tt_dockPaneHead"><span class="tt_dockPaneTitle"></span><span class="tt_dockPaneHint"></span><span class="tt_dockPaneSpacer"></span><button class="tt_dockPaneFold" type="button"></button><button class="tt_dockPaneClose" type="button" title="\u5173\u95ED\u4FA7\u680F">'+Er+'</button></div><div class="tt_dockPaneBody"></div>',bt.appendChild(o);let h=o.querySelector(".tt_dockPaneTitle"),r=o.querySelector(".tt_dockPaneHint"),s=o.querySelector(".tt_dockPaneBody"),a=o.querySelector(".tt_dockPaneFold"),f=o.querySelector(".tt_dockPaneClose"),n=o.querySelector(".tt_dockPaneResize"),_={el:o,element:s,disposed:!1,collapsed:!1,side:t,minSize:i,onClose:typeof e?.onClose=="function"?e.onClose:null},g=()=>t==="bottom"?_.collapsed?Is:dd:_.collapsed?fa:ua,S=p=>{_.collapsed=p===!0,_.collapsed?o.dataset.collapsed="1":delete o.dataset.collapsed,a.innerHTML=g(),a.title=_.collapsed?"\u5C55\u5F00\u4FA7\u680F":"\u6536\u8D77\u4FA7\u680F",a.setAttribute("aria-label",a.title),dr()};return _.setTitle=p=>{h.textContent=typeof p=="string"?p:""},_.setHint=p=>{r.textContent=typeof p=="string"?p:""},_.isCollapsed=()=>_.collapsed===!0,_.collapse=()=>S(!0),_.expand=()=>S(!1),_.toggle=()=>S(!_.collapsed),_.dispose=()=>{_.disposed||Et!==_||ur(!1)},n.addEventListener("mousedown",p=>{if(p.button!==0||_.collapsed)return;p.preventDefault();let c=p.clientX,d=p.clientY,l=o.getBoundingClientRect(),u=C=>{t==="bottom"?Vt=wi("bottom",Math.max(i,l.height+(d-C.clientY))):Gt=wi("right",Math.max(i,l.width+(c-C.clientX))),dr()},v=()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",v),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",u),document.addEventListener("mouseup",v)}),n.addEventListener("dblclick",()=>S(!_.collapsed)),a.addEventListener("click",()=>S(!_.collapsed)),f.addEventListener("click",()=>ur(!0)),_.setTitle(typeof e?.title=="string"?e.title:""),_.setHint(typeof e?.hint=="string"?e.hint:""),S(e?.collapsed===!0),Et=_,dr(),_}function ri(e){let t=se.get(e);if(t!==void 0){Dt=e;for(let[i,o]of se)o.embedded!==!0&&o.termEl!==null&&(o.termEl.style.display=i===e?"":"none");t.embedded!==!0&&Xt!==null&&t.termEl!==null&&t.termEl.parentElement!==Xt&&Xt.appendChild(t.termEl),Qe(),Lt();try{t.fit.fit()}catch{}t.spawned&&!t.exited&&Ai(t),Kt(t,t.exited?"\u4F1A\u8BDD\u5DF2\u9000\u51FA":"",t.exited?"\u70B9\u51FB\u91CD\u65B0\u6253\u5F00":"","exited")}}function ks(e){if(gt===null)return;let t=se.get(e);if(t===void 0)return;let o=gt.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");o!=null&&(o.dataset.state=t.exited?"exited":t.live===!0?"connected":t.errored===!0?"error":"connecting")}function Qe(){if(gt===null)return;gt.textContent="";for(let[t,i]of se){if(i.embedded===!0)continue;let o=document.createElement("button");o.className="tt_tab",o.dataset.sid=t,t===Dt&&(o.dataset.active="");let h=document.createElement("span");h.className="tt_tabDot",h.dataset.state=i.exited?"exited":i.live===!0?"connected":i.errored===!0?"error":"connecting",o.appendChild(h);let r=document.createElement("span");r.className="tt_tabLabel",r.textContent=i.label||"\u7EC8\u7AEF "+ya(t),r.addEventListener("dblclick",a=>{a.stopPropagation(),Pd(t,o)});let s=document.createElement("span");s.className="tt_tabClose",s.title="\u5173\u95ED",s.textContent="\u2715",o.title=r.textContent,o.appendChild(r),o.appendChild(s),o.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),yd(t);return}ri(t)}),gt.appendChild(o)}let e=document.createElement("button");e.className="tt_tabAdd",e.title="\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09",e.innerHTML=cd,e.addEventListener("click",()=>{Hd(e)}),gt.appendChild(e)}function Dd(e){return e?.direction==="remote"?`\u8FDC\u7A0B:${e.remoteHost||"127.0.0.1"}:${String(e.remotePort??0)} \u2192 \u672C\u673A:${String(e.localTargetPort??0)}`:`\u672C\u673A:${String(e?.localPort??0)} \u2192 ${e?.remoteHost??"?"}:${String(e?.remotePort??0)}`}function Lt(){if(pi===null||pr===null||vi===null||gi===null)return;vi.textContent="";let e=vt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){pi.dataset.hidden="";return}delete pi.dataset.hidden;let i=Number(t.port);pr.textContent=typeof e.target=="string"&&e.target!==""?e.target:typeof t.name=="string"&&t.name!==""?t.name:String(t.username??"")+"@"+String(t.host??"")+(Number.isInteger(i)&&i!==22?":"+i:""),We!==null&&(e.persistTmux===!0?(We.textContent="tmux",We.dataset.state="ok",We.title="\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A"):t.persist===!0&&e.spawned===!0?(We.textContent="\u672A\u6301\u4E45\u5316",We.dataset.state="warn",We.title="\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD"):(We.textContent="",delete We.dataset.state,We.removeAttribute("title")));let o=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";gi.dataset.state=o,gi.title=o==="connected"?"\u5DF2\u8FDE\u63A5":o==="connecting"?"\u8FDE\u63A5\u4E2D":o==="error"?"\u8FDE\u63A5\u51FA\u9519":"\u4F1A\u8BDD\u5DF2\u9000\u51FA";let h=(s,a,f,n)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=f,_.innerHTML=s+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",n),vi.appendChild(_)},r=typeof t.name=="string"?t.name:"";for(let s of Ms)try{s({tab:e,spec:t,bookName:r,addAction:h})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}var xt=null,fr=null;function Ts(){fr!==null&&(document.removeEventListener("mousedown",fr,!0),fr=null),xt!==null&&(xt.remove(),xt=null)}function Bd(e,t){if(xt!==null){Ts();return}let i=document.createElement("div");i.className="tt_tunnelPop";let o=document.createElement("div");o.className="tt_tunnelPopTitle",o.textContent="\u7AEF\u53E3\u8F6C\u53D1 \u2014 "+t,i.appendChild(o);let h=document.createElement("div");h.textContent="\u52A0\u8F7D\u4E2D\u2026",i.appendChild(h);let r=document.createElement("span");r.className="tt_cardHint",r.textContent="\u589E\u5220/\u542F\u505C\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4",i.appendChild(r),document.body.appendChild(i),xt=i;let s=e.getBoundingClientRect();i.style.top=String(s.bottom+6)+"px",i.style.left=String(Math.max(8,s.right-340))+"px";let a=f=>{xt===i&&(i.contains(f.target)||e.contains(f.target)||Ts())};fr=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let f=[];try{let g=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();g.ok&&Array.isArray(g.tunnels)&&(f=g.tunnels)}catch{}if(xt!==i)return;h.textContent="";let n=Us.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(n.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent="\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053",h.appendChild(_);return}for(let _ of n){let g=f.find(l=>l?.name===_?.name),S=g?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=S==="active"?"connected":S==="error"?"error":"connecting";let d=document.createElement("span");d.className="tt_connTarget",d.title=String(g?.error??g?.lastForwardError??""),d.textContent=Dd(_)+" \xB7 "+S,p.appendChild(c),p.appendChild(d),h.appendChild(p)}})()}function ya(e){let t=1;for(let i of se.keys()){if(i===e)return String(t);t+=1}return String(t)}function Pd(e,t){let i=se.get(e);if(i===void 0||t.querySelector(".tt_tabRename")!==null)return;let o=t.querySelector(".tt_tabLabel");if(o===null)return;let h=document.createElement("input");h.className="tt_tabRename",h.value=i.label||"\u7EC8\u7AEF "+ya(e),o.replaceWith(h),h.focus(),h.select();let r=!1,s=()=>{if(r)return;r=!0;let f=h.value.trim();i.label=f!==""?f:void 0,Qe(),Bt()},a=()=>{r||(r=!0,Qe())};h.addEventListener("keydown",f=>{f.stopPropagation(),f.key==="Enter"?s():f.key==="Escape"&&a()}),h.addEventListener("blur",s),h.addEventListener("click",f=>f.stopPropagation())}var Us=[],xa="dialog",Mt="off",wt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},Qt=null,mt=null,wr=null,Rt=!1;function ka(e){Rt=e,wr!==null&&wr.set(e)}function Od(e){ka(!(e!==null&&typeof e=="object"&&e.enabled===!1))}function ki(e){Od(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(St=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(Us=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(xa=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(Mt=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(wt={...wt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(Qt=e.maxSessions)}function Id(e,t){let i=t==="error"||t==="info"?t:"warn",o=document.createElement("div");o.className="tt_toast",o.dataset.kind=i,o.innerHTML='<span class="tt_toastIcon">'+(i==="error"?_a:i==="info"?_d:fd)+'</span><span class="tt_toastText"></span>',o.lastElementChild.textContent=e,document.body.appendChild(o),setTimeout(()=>o.remove(),4e3)}async function Ea(){try{ke({t:"sessions"});let e=await br("sessions",3e3);if(e!==null&&Array.isArray(e.list))return mt=e.list.length,mt}catch{}return null}async function Sr(){if(await Ea(),Qt===null||mt===null||mt<Qt)return null;let e=[...se.values()].filter(o=>!o.exited).length,t=Math.max(0,mt-e),i=`\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 ${mt} \u4E2A / \u4E0A\u9650 ${Qt}\uFF1A\u672C\u7A97\u53E3 ${e} \u4E2A${t>0?" + \u5176\u4ED6\u7A97\u53E3 "+t+" \u4E2A":""}\uFF09\u2014\u2014\u5173\u95ED\u4E0D\u7528\u7684\u7A97\u53E3/\u6807\u7B7E\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u8C03\u5927\u300C\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\u300D`;return Id(i),i}function Nd(){return Qt!==null&&mt!==null&&mt>=Qt}function js(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function La(e){return Us.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function As(e){let t=Number(e?.port),i=Number.isInteger(t)&&t!==22?":"+t:"",o=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",h=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+i+" \xB7 "+o+h}async function Ma(e,t){let i=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),o=await i.json().catch(()=>({}));return o&&o.ok===!1&&o.error?{error:String(o.error)}:o&&o.result?{result:o.result}:{error:String(o&&o.error?o.error:"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP "+i.status+"\uFF09")}}function Ra(e,t){if(!e)return"\u8FDE\u63A5\u6D4B\u8BD5\u2026";let i=e,o=typeof i.tcp?.ms=="number"?i.tcp.ms:null,h=typeof i.auth?.ms=="number"?i.auth.ms:null,r=[];i.tcp?.ok&&r.push("TCP "+(o!==null?o+"ms":"\u901A")),i.banner?.ok&&r.push("banner \u6B63\u5E38");let s=i.hostkey?.state;if(s==="matched"?r.push("\u4E3B\u673A\u5BC6\u94A5\u5339\u914D"):s==="recorded"?r.push("\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09"):s==="mismatch"&&r.push("\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01"),i.auth?.ok)return"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A"+(h!==null?"\u8BA4\u8BC1\u901A\u8FC7\uFF08"+h+"ms\uFF09":"\u8BA4\u8BC1\u901A\u8FC7")+(r.length?" \xB7 "+r.join(" \xB7 "):"");let a=i.auth?.error||i.tcp?.error||"\u672A\u77E5\u9519\u8BEF";return(t?.prefix||"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A")+a+(r.length?" \xB7 "+r.join(" \xB7 "):"")}async function qs(){try{let t=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();if(t.ok&&typeof t.config=="object"&&t.config!==null){let i=St;ki(t.config),$e!==null&&St!==i&&Ds($e)}}catch{}}function Ta(e){$e!==null&&(e.target instanceof Element&&($e.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||Je())}function Hd(e){if($e!==null){Je();return}qs(),Ea().then(()=>{$e!==null&&Ds($e)});let t=document.createElement("div");t.className="tt_addMenu",$e=t,Ds(t),document.body.appendChild(t);let i=e.getBoundingClientRect(),o=t.offsetWidth,r=i.left+o>window.innerWidth-8?i.right-o:i.left;t.style.left=Math.max(8,Math.min(r,window.innerWidth-o-8))+"px",t.style.top=i.bottom+6+"px",document.addEventListener("mousedown",Ta,!0)}function Je(){$e!==null&&(document.removeEventListener("mousedown",Ta,!0),$e.remove(),$e=null)}function ia(e,t,i,o,h,r){let s=document.createElement("button");if(s.type="button",s.className="tt_addMenuItem",h===!0&&(s.setAttribute("data-soldout",""),s.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E"),r!==void 0){let n=document.createElement("span");n.className="tt_addMenuIcon",n.innerHTML=r,s.appendChild(n)}let a=document.createElement("span");a.className="tt_addMenuText";let f=document.createElement("span");if(f.className="tt_addMenuMain",f.textContent=t,a.appendChild(f),i!==""){let n=document.createElement("span");n.className="tt_addMenuSub",n.textContent=i,a.appendChild(n)}s.appendChild(a),s.addEventListener("click",o),e.appendChild(s)}function Ds(e){e.textContent="";let t=Nd();ia(e,"\u672C\u5730\u7EC8\u7AEF",Mt==="tmux"?"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00",async()=>{await Sr()||(Je(),xi())},t,kr);let i=document.createElement("div");i.className="tt_addMenuSep",e.appendChild(i);let o=document.createElement("div");o.className="tt_addMenuTitle",o.textContent="SSH \u8FDE\u63A5\u7C3F",e.appendChild(o);for(let r of St){if(r===null||typeof r!="object"||typeof r.name!="string"||r.name==="")continue;let s=document.createElement("div");s.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title="\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E");let f=document.createElement("span");f.className="tt_addMenuIcon",f.innerHTML=ud;let n=document.createElement("span");n.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=r.name;let g=document.createElement("span");g.className="tt_addMenuSub";let S=La(r.name);g.textContent=As(r)+(S>0?" \xB7 \u21C4"+String(S):""),n.appendChild(_),n.appendChild(g),a.appendChild(f),a.appendChild(n),a.addEventListener("click",async()=>{if(await Sr())return;Je();let d=Mt==="tmux"?{persist:!0,persistName:js()}:{};xi({t:"ssh",name:r.name,...d},r.name)});let p=document.createElement("button");p.type="button",p.className="tt_addMenuEdit",p.title="SFTP \u6587\u4EF6\u6D4F\u89C8",p.innerHTML=Ci,p.addEventListener("click",()=>{Je(),Gs({name:r.name})});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title="\u7F16\u8F91\u8FDE\u63A5",c.innerHTML=Ns,c.addEventListener("click",()=>{Je(),ra(r)}),s.appendChild(a),s.appendChild(p),s.appendChild(c),e.appendChild(s)}if(St.length===0){let r=document.createElement("div");r.className="tt_addMenuTitle",r.textContent="\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09",e.appendChild(r)}let h=document.createElement("div");h.className="tt_addMenuSep",e.appendChild(h),ia(e,"SSH \u8FDE\u63A5\u2026","\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F",()=>{Je(),ra()},!1,pa)}function ra(e){if(Zt!==null)return;let t=e!==null&&typeof e=="object"?e:null,i=t!==null,o=document.createElement("div");o.className="tt_sshBackdrop";let h=document.createElement("div");h.className="tt_sshCard";let r=document.createElement("div");r.className="tt_sshTitle",r.innerHTML=pa+"<span></span>",r.lastElementChild.textContent=i?"\u7F16\u8F91\u8FDE\u63A5 \xB7 "+String(t.name??""):"SSH \u8FDE\u63A5",h.appendChild(r);let s=A=>{let k=document.createElement("div");return k.className="tt_sshSection",k.textContent=A,k},a={},f=(A,k,N)=>{let H=document.createElement("label");H.className="tt_sshRow";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=k,H.appendChild(q);let j;if(N?.select!==void 0){j=document.createElement("select");for(let Q of N.select){let ee=document.createElement("option");ee.value=Q.value,ee.textContent=Q.label,j.appendChild(ee)}}else j=document.createElement("input"),j.type=N?.type??"text",j.placeholder=N?.placeholder??"";return j.className="tt_cardInput",j.autocomplete="off",j.spellcheck=!1,H.appendChild(j),a[A]=j,H};h.appendChild(s("\u8FDE\u63A5"));let n=document.createElement("div");n.className="tt_sshGrid",n.appendChild(f("host","\u4E3B\u673A",{placeholder:"example.com \u6216 IP"})),n.appendChild(f("port","\u7AEF\u53E3",{placeholder:"22"})),h.appendChild(n),h.appendChild(f("username","\u7528\u6237\u540D",{placeholder:"root"})),h.appendChild(s("\u8BA4\u8BC1")),h.appendChild(f("auth","\u8BA4\u8BC1\u65B9\u5F0F",{select:[{value:"agent",label:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"},{value:"key",label:"key \u2014 \u79C1\u94A5\u6587\u4EF6"},{value:"password",label:"password \u2014 \u5BC6\u7801"}]}));let _=f("keyPath","\u79C1\u94A5\u8DEF\u5F84",{placeholder:"~/.ssh/id_ed25519"}),g=f("passphrase","\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09",{type:"password"}),S=f("password","\u5BC6\u7801",{type:"password"}),p=A=>{let k=document.createElement("div");k.className="tt_sshRow";let N=document.createElement("input");N.type="text",N.className="tt_cardInput",N.placeholder="\u7B5B\u9009 env \u6258\u7BA1\u53D8\u91CF\u540E\u70B9\u51FB\u586B\u5165",N.autocomplete="off",N.spellcheck=!1;let H=document.createElement("div");H.className="tt_envList",H.dataset.hidden="";let q=[],j=()=>{if(H.textContent="",q.length===0){let G=document.createElement("span");G.className="tt_cardHint",G.textContent="env \u63D2\u4EF6\u8FD8\u6CA1\u6709\u6258\u7BA1\u53D8\u91CF \u2014 \u5728\u5176\u8BBE\u7F6E\u5361\u7247\u6DFB\u52A0\u540E\u8FD9\u91CC\u53EF\u9009\uFF0C\u4E5F\u53EF\u624B\u8F93 env:NAME",H.appendChild(G);return}let Q=N.value.trim().toUpperCase(),ee=Q===""?q:q.filter(G=>G.toUpperCase().includes(Q));for(let G of ee.slice(0,30)){let J=document.createElement("button");J.type="button",J.className="tt_envItem",J.textContent=G;let Z="env:"+G,oe=null,ae=()=>{oe!==null&&(clearTimeout(oe),oe=null),J.textContent=G,delete J.dataset.danger};J.addEventListener("mousedown",me=>me.preventDefault()),J.addEventListener("click",()=>{let me=A.value;if(me===""||me.startsWith("env:")||oe!==null){ae(),A.value=Z,A.focus();return}J.textContent=G+"\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09",J.dataset.danger="",oe=setTimeout(ae,4e3)}),H.appendChild(J)}if(ee.length>30){let G=document.createElement("span");G.className="tt_envMore",G.textContent="\u8FD8\u6709 "+(ee.length-30)+" \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009",H.appendChild(G)}else if(ee.length===0){let G=document.createElement("span");G.className="tt_envMore",G.textContent="\u6CA1\u6709\u5339\u914D\u7684\u53D8\u91CF",H.appendChild(G)}};return N.addEventListener("input",j),N.addEventListener("focus",()=>{delete H.dataset.hidden}),N.addEventListener("blur",()=>{N.value.trim()===""&&(H.dataset.hidden="")}),k.appendChild(N),k.appendChild(H),{row:k,setNames(Q){q=Array.isArray(Q)?Q:[],j()}}},c=p(a.passphrase),d=p(a.password),l=!1;(async()=>{if(!l){l=!0;try{let k=await(await fetch("/api/dsh-tty/env-vars",{cache:"no-store"})).json();k.ok&&Array.isArray(k.names)&&(c.setNames(k.names),d.setNames(k.names))}catch{}}})(),h.appendChild(_),h.appendChild(g),h.appendChild(c.row),h.appendChild(S),h.appendChild(d.row),h.appendChild(s("\u9009\u9879"));let v=document.createElement("label");v.className="tt_cardRow";let C=document.createElement("input");C.type="checkbox",C.className="tt_cardCheckbox";let w=document.createElement("span");w.className="tt_cardLabel",w.textContent="agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09",v.appendChild(C),v.appendChild(w),h.appendChild(v);let y=document.createElement("label");y.className="tt_cardRow";let m=document.createElement("input");m.type="checkbox",m.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent="\u6301\u4E45\u4F1A\u8BDD\uFF08tmux \u6258\u7BA1\uFF0C\u65AD\u7EBF/\u91CD\u542F\u540E\u6062\u590D\u73B0\u573A\uFF1B\u8FDC\u7A0B\u9700\u5B89\u88C5 tmux\uFF09",y.appendChild(m),y.appendChild(x),m.checked=Mt==="tmux",Mt==="tmux"&&h.appendChild(y);let T=document.createElement("label");T.className="tt_cardRow";let I=document.createElement("input");I.type="checkbox",I.className="tt_cardCheckbox";let F=document.createElement("span");F.className="tt_cardLabel",F.textContent="\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09",T.appendChild(I),T.appendChild(F),h.appendChild(T);let R=f("name","\u8FDE\u63A5\u7C3F\u540D\u79F0",{placeholder:"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D"});R.style.display="none",h.appendChild(R),I.addEventListener("change",()=>{R.style.display=I.checked?"":"none",I.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),I.checked&&a.name.focus()}),i&&(T.style.display="none",a.name.value=String(t.name??""),R.style.display="",a.host.value=String(t.host??""),a.port.value=String(t.port??22),a.username.value=String(t.username??""),a.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",a.keyPath.value=String(t.keyPath??""),a.passphrase.value=String(t.passphrase??""),a.password.value=String(t.password??""),C.checked=t.agentForward===!0,m.checked=Mt==="tmux");let z=document.createElement("div");z.className="tt_sshStatus";let B=document.createElement("div");B.className="tt_sshError";let D=document.createElement("div");D.className="tt_sshProbeResult",z.appendChild(B),z.appendChild(D),h.appendChild(z);let O=()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),A===""||k==="")return B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B",null;let H=a.auth.value,q={host:A,port:N,username:k,auth:H};if(H==="key"){let j=a.keyPath.value.trim();if(j==="")return B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84",null;q.keyPath=j;let Q=a.passphrase.value;Q!==""&&(q.passphrase=Q)}if(H==="password"){let j=a.password.value;if(j==="")return B.textContent="auth=password \u9700\u8981\u5BC6\u7801",null;q.password=j}return C.checked&&(q.agentForward=!0),q},P=document.createElement("div");P.className="tt_sshActions";let b=document.createElement("div");b.className="tt_sshActionsGroup";let E=document.createElement("div");E.className="tt_sshActionsGroup",P.appendChild(b),P.appendChild(E);let L=document.createElement("button");L.type="button",L.className="tt_toolBtn",L.textContent="\u53D6\u6D88";let M=document.createElement("button");M.type="button",M.className="tt_cardSave",M.textContent="\u8FDE\u63A5",b.appendChild(L);let $=document.createElement("button");$.type="button",$.className="tt_toolBtn",$.textContent="\u6587\u4EF6\u6D4F\u89C8",$.title="\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8",$.addEventListener("click",()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim(),N=Number(a.port.value);if((!Number.isInteger(N)||N<1||N>65535)&&(N=22),A===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let H=a.auth.value,q={host:A,port:N,username:k,auth:H};if(H==="key"){let j=a.keyPath.value.trim();if(j===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}q.keyPath=j;let Q=a.passphrase.value;Q!==""&&(q.passphrase=Q)}if(H==="password"){let j=a.password.value;if(j===""){B.textContent="auth=password \u9700\u8981\u5BC6\u7801";return}q.password=j}C.checked&&(q.agentForward=!0),pt(),Gs(q)}),b.appendChild($);let K=null;i&&(K=document.createElement("button"),K.type="button",K.className="tt_toolBtn",K.textContent="\u4FDD\u5B58\u4FEE\u6539",K.addEventListener("click",()=>{B.textContent="";let A=a.host.value.trim(),k=a.username.value.trim();if(A===""||k===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let N=Number(a.port.value);(!Number.isInteger(N)||N<1||N>65535)&&(N=22);let H=a.auth.value,j={name:a.name.value.trim()||A,host:A,port:N,username:k,auth:H,keyPath:H==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:C.checked,persist:m.checked};if(H==="key"&&j.keyPath===""){B.textContent="auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84";return}K!==null&&(K.disabled=!0),Wd(String(t.name??""),j).then(Q=>{if(K!==null&&(K.disabled=!1),Q!==void 0){B.textContent="\u4FDD\u5B58\u5931\u8D25\uFF1A"+Q;return}pt()})}),b.appendChild(K));let Y=document.createElement("button");Y.type="button",Y.className="tt_toolBtn",Y.textContent="\u8BD5\u8FDE",Y.title="\u6309\u5F53\u524D\u586B\u5199\u8BCA\u65AD\u8FDE\u63A5\uFF08TCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\uFF09\uFF1B\u4E0D\u4F1A\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u4E5F\u4E0D\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9",Y.addEventListener("click",()=>{let A=O();A!==null&&(D.className="tt_sshProbeResult",D.textContent="\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026",Y.disabled=!0,Ma(A,!1).then(k=>{Y.disabled=!1,k.result?(D.className="tt_sshProbeResult"+(k.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),D.textContent=Ra(k.result)):(D.className="tt_sshProbeResult tt_sshProbeBad",D.textContent="\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(k.error||"\u672A\u77E5\u9519\u8BEF"))}))}),b.appendChild(Y),E.appendChild(M),h.appendChild(P);let U=()=>{_.style.display=a.auth.value==="key"?"":"none",g.style.display=a.auth.value==="key"?"":"none",c.row.style.display=a.auth.value==="key"?"":"none",S.style.display=a.auth.value==="password"?"":"none",d.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",U),U(),L.addEventListener("click",()=>pt()),o.addEventListener("mousedown",A=>{A.target===o&&pt()}),M.addEventListener("click",async()=>{B.textContent="";let A=await Sr();if(A!==null){B.textContent=A;return}let k=a.host.value.trim(),N=a.username.value.trim(),H=Number(a.port.value);if((!Number.isInteger(H)||H<1||H>65535)&&(H=22),k===""||N===""){B.textContent="\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B";return}let q=a.auth.value,j={t:"ssh",host:k,port:H,username:N,auth:q};if(q==="key"){let J=a.keyPath.value.trim();J!==""&&(j.keyPath=J);let Z=a.passphrase.value;Z!==""&&(j.passphrase=Z)}if(q==="password"){let J=a.password.value;J!==""&&(j.password=J)}C.checked&&(j.agentForward=!0),m.checked&&(j.persist=!0,j.persistName=js());let Q=H!==22?N+"@"+k+":"+H:N+"@"+k,ee=J=>{pt(),re!==null&&xi(j,J!==""?J:Q)};if(!I.checked){ee("");return}let G=a.name.value.trim()||k;M.disabled=!0,Fd({name:G,host:k,port:H,username:N,auth:q,keyPath:j.keyPath??"",passphrase:j.passphrase??"",password:j.password??"",agentForward:C.checked,persist:m.checked}).then(J=>{if(M.disabled=!1,J!==void 0){B.textContent="\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A"+J;return}ee(G)})}),o.appendChild(h),document.body.appendChild(o),Zt=o,a.host.focus()}function pt(){Zt!==null&&(Zt.remove(),Zt=null)}async function Fd(e){let t=[...St.filter(i=>i?.name!==e.name),e];try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),o=await i.json().catch(()=>({}));if(!i.ok||!o.ok)return String(o.error||"HTTP "+i.status);ki(o.config);return}catch(i){return String(i&&i.message?i.message:i)}}async function Wd(e,t){if(t.name!==e&&St.some(o=>o?.name===t.name))return"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+t.name;let i=St.map(o=>o?.name===e?t:o);try{let o=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:i})}),h=await o.json().catch(()=>({}));if(!o.ok||!h.ok)return String(h.error||"HTTP "+o.status);ki(h.config);return}catch(o){return String(o&&o.message?o.message:o)}}function $d(e,t){if(Ks())return;let i=document.createElement("div");i.className="tt_sftpDualCard";let o=document.createElement("div");o.className="tt_sftpTitleRow";let h=document.createElement("div");h.className="tt_sshTitle",h.innerHTML=Ci+"<span></span>",h.lastElementChild.textContent="SFTP \u53CC\u680F \xB7 "+t;let r=document.createElement("button");r.type="button",r.className="tt_close",r.title="\u5173\u95ED",r.innerHTML=Er,r.addEventListener("click",Pt),o.appendChild(h),o.appendChild(r),i.appendChild(o);let s=document.createElement("div");s.className="tt_sftpStatus";let a=(O,P)=>{s.textContent=O,P===void 0?delete s.dataset.state:s.dataset.state=P},f=!1,n=(O,P)=>{if(!(f||g.local.busy||g.remote.busy)){f=!0;for(let b of[g.local,g.remote])b.setBusy(!0);a(O,"busy"),Promise.resolve().then(P).catch(b=>{(b===null||typeof b!="object"||b.name!=="TransferCanceledError")&&R.fail("\u5931\u8D25"),a(String(b&&b.message?b.message:b),"error")}).finally(()=>{f=!1;for(let b of[g.local,g.remote])b.setBusy(!1)})}},_=O=>{g[O].bar.after(p),p.style.display="",c.focus(),c.select()},g={},S=(O,P)=>{let b={kind:O,path:"",busy:!1},E=document.createElement("div");E.className="tt_sftpPane";let L=document.createElement("div");L.className="tt_sftpPaneHead";let M=document.createElement("span");M.textContent=P;let $=document.createElement("span");$.className="tt_sftpPaneMeta",L.appendChild(M),L.appendChild($),E.appendChild(L);let K=document.createElement("div");K.className="tt_sftpBar";let Y=document.createElement("input");Y.type="text",Y.className="tt_sftpPath",Y.placeholder=O==="local"?"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",Y.spellcheck=!1,Y.autocomplete="off";let U=document.createElement("button");U.type="button",U.className="tt_toolBtn",U.innerHTML=Hs+"<span>\u5237\u65B0</span>";let A=document.createElement("button");A.type="button",A.className="tt_toolBtn",A.innerHTML=da+"<span>\u65B0\u5EFA\u76EE\u5F55</span>",K.appendChild(Y),K.appendChild(U),K.appendChild(A),E.appendChild(K);let k=document.createElement("div");k.className="tt_sftpList",E.appendChild(k),b.bar=K;let N=G=>{b.busy=G;for(let J of[U,A])J.disabled=G;Y.disabled=G},H=async(G,J)=>{let Z=O==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",oe=O==="local"?J:{...e,...J},ae=await fetch(Z+G,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(oe)}),me=await ae.json().catch(()=>({}));if(!ae.ok||me.ok!==!0)throw new Error(String(me.error||"HTTP "+ae.status));return me},q=(G,J)=>{if(!(b.busy||f))return N(!0),a(G,"busy"),Promise.resolve().then(J).catch(Z=>a(String(Z&&Z.message?Z.message:Z),"error")).finally(()=>N(!1))},j=(G,J)=>G.endsWith("/")||G.endsWith("\\")?G+J:G+"/"+J,Q=G=>{let J=j(b.path,G.name),Z=[];G.isDir===!0?Z.push("\u76EE\u5F55"):Z.push(Ze(Number(G.size))||"\u2014");let oe=Da(Number(G.mtime));oe!==""&&Z.push(oe);let ae=C(G.isDir?Ci:G.isSymlink?ca:la,G.name,Z.join(" \xB7 "),G.isDir===!0?"dir":G.isSymlink===!0?"link":"file"),me=()=>b.loadDir(b.path),we=O==="local"?g.remote:g.local;return G.isDir===!0&&ae.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||b.loadDir(J)}),w(ae,O==="local"?ua:fa,"\u4F20\u8F93\u5230"+(O==="local"?"\u8FDC\u7A0B":"\u672C\u673A")+"\uFF1A"+we.path,()=>{R.reset(),R.pulse(0),n("\u4F20\u8F93 "+G.name+"\u2026",async()=>{let fe=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:O==="local"?"up":"down",...e,localPath:O==="local"?J:j(we.path,G.name),remotePath:O==="local"?j(we.path,G.name):J})}),W=await fe.json().catch(()=>({}));if(!fe.ok||W.ok!==!0)throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error(String(W.error||"HTTP "+fe.status));let V=W.job?.id;if(typeof V!="string"||V==="")throw R.fail("\u4F20\u8F93\u5931\u8D25"),new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id");await z(V,G.name)==="canceled"?(R.reset(),a("\u5DF2\u53D6\u6D88\u4F20\u8F93 "+G.name)):(R.done("\u5B8C\u6210"),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4F20\u8F93 "+G.name)),await we.loadDir(we.path)})}),O!=="local"&&G.isDir!==!0&&w(ae,ha,"\u4E0B\u8F7D "+G.name,()=>{m(G,J)}),w(ae,Ns,"\u91CD\u547D\u540D "+G.name,()=>{c.placeholder="\u65B0\u540D\u79F0",c.value=G.name,_(O),u=async()=>{let fe=c.value.trim();fe===""||fe===G.name||(v(),await b.runTask("\u91CD\u547D\u540D "+G.name+"\u2026",async()=>{await H("rename",{from:J,to:j(b.path,fe)}),await me()}))}}),y(ae,()=>b.runTask("\u5220\u9664 "+G.name+"\u2026",async()=>{await H("remove",{path:J,recursive:G.isDir===!0}),await me(),a("\u5DF2\u5220\u9664 "+G.name)}),G),ae},ee=G=>{if(k.textContent="",b.path!==""&&b.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(b.path)===!1){let Z=C(Is,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");Z.addEventListener("click",()=>{b.loadDir(Ba(b.path))}),k.appendChild(Z)}let J=Array.isArray(G)?G:[];if(J.length===0){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",k.appendChild(Z);return}for(let Z of J)Z===null||typeof Z!="object"||typeof Z.name!="string"||Z.name===""||k.appendChild(Q(Z))};return b.loadDir=async G=>{try{let J=await H("list",{path:G??b.path});b.path=typeof J.path=="string"&&J.path!==""?J.path:b.path,Y.value=b.path;let Z=Array.isArray(J.entries)?J.entries.length:0;ee(J.entries),$.textContent=String(Z)+" \u9879",a(b.path)}catch(J){a(String(J&&J.message?J.message:J),"error")}},b.runTask=q,b.setBusy=N,g[O]=b,U.addEventListener("click",()=>{b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(b.path))}),A.addEventListener("click",()=>{b.busy||f||(c.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",c.value="",_(O),u=async()=>{let G=c.value.trim();G!==""&&(v(),await b.runTask("\u521B\u5EFA\u76EE\u5F55 "+G+"\u2026",async()=>{await H("mkdir",{path:j(b.path,G),parents:!0}),await b.loadDir(b.path)}))})}),Y.addEventListener("keydown",G=>{if(G.key!=="Enter"||(G.preventDefault(),b.busy||f))return;let J=Y.value.trim();J!==""&&b.runTask("\u52A0\u8F7D\u4E2D\u2026",()=>b.loadDir(J))}),E},p=document.createElement("div");p.className="tt_sftpEditor",p.style.display="none";let c=document.createElement("input");c.type="text",c.className="tt_cardInput",c.spellcheck=!1,c.autocomplete="off";let d=document.createElement("button");d.type="button",d.className="tt_toolBtn",d.textContent="\u786E\u5B9A";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u53D6\u6D88",p.appendChild(c),p.appendChild(d),p.appendChild(l);let u=null,v=()=>{p.style.display="none",c.value="",u=null};d.addEventListener("click",()=>{u?.()}),l.addEventListener("click",v),c.addEventListener("keydown",O=>{O.key==="Enter"?(O.preventDefault(),u?.()):O.key==="Escape"&&(O.stopPropagation(),v())});let C=(O,P,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpRow";let M=document.createElement("span");M.className="tt_sftpIcon",M.innerHTML=O,E!==void 0&&(M.dataset.kind=E);let $=document.createElement("span");if($.className="tt_sftpName",$.textContent=P,$.title=P,L.appendChild(M),L.appendChild($),b!==""){let K=document.createElement("span");K.className="tt_sftpMeta",K.textContent=b,L.appendChild(K)}return L},w=(O,P,b,E)=>{let L=document.createElement("button");L.type="button",L.className="tt_sftpAct",L.innerHTML=P,L.title=b,L.addEventListener("click",M=>{M.stopPropagation(),E()}),O.appendChild(L)},y=(O,P,b)=>{let E=document.createElement("button");E.type="button",E.className="tt_sftpAct",E.innerHTML=Yt,E.title="\u5220\u9664 "+b.name+(b.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let L=null;E.addEventListener("click",M=>{if(M.stopPropagation(),L!==null){clearTimeout(L),L=null,E.innerHTML=Yt,delete E.dataset.danger,P();return}E.textContent="\u786E\u8BA4?",E.dataset.danger="",L=setTimeout(()=>{L=null,E.innerHTML=Yt,delete E.dataset.danger},4e3)}),O.appendChild(E)},m=(O,P)=>g.remote.runTask("\u4E0B\u8F7D "+O.name+"\u2026",async()=>{R.reset();let b;try{b=await Oa("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:P})},(E,L)=>{R.set(E,L)},wt.maxDownloadMb,E=>R.setCancel(E))}catch(E){if(Bs(E)){R.reset(),a("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+O.name);return}throw R.fail("\u4E0B\u8F7D\u5931\u8D25"),E}R.done("\u5B8C\u6210"),Ia(b,O.name),setTimeout(()=>R.reset(),1500),a("\u5DF2\u4E0B\u8F7D "+O.name+"\uFF08"+(Ze(b.size)||String(b.size)+" B")+"\uFF09")}),x=S("local","\u672C\u673A"),T=S("remote","\u8FDC\u7A0B");g.local.wrap=x,g.remote.wrap=T;let I=document.createElement("div");I.className="tt_sftpDual",I.appendChild(x),I.appendChild(T),i.appendChild(I),i.appendChild(p);let F=document.createElement("div");F.className="tt_sftpFoot";let R=Pa();F.appendChild(R.el),F.appendChild(s),i.appendChild(F);let z=async(O,P)=>{let b=!1;R.setCancel(()=>{b||(b=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:O})}).catch(()=>{}))});try{for(;;){await new Promise($=>setTimeout($,400));let E=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:O})}),L=await E.json().catch(()=>({}));if(!E.ok||L.ok!==!0){if(b)return"canceled";throw new Error(String(L.error||"HTTP "+E.status))}let M=L.job;if(M===null||typeof M!="object")throw new Error("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001");if(M.state==="running"){let $=typeof M.current=="string"&&M.current!==""?M.current:P;a("\u4F20\u8F93 "+$+"\u2026","busy"),Number.isFinite(M.total)&&M.total>0?R.set(Number(M.bytes)||0,M.total):R.pulse(Number(M.bytes)||0);continue}if(M.state==="canceled")return"canceled";if(M.state!=="done")throw new Error(String(M.error||"\u4F20\u8F93\u5931\u8D25"));return"done"}}finally{R.setCancel(null)}},B=$s(),D=B===null?420:Math.round(B.height*.56);Aa(i,"SFTP \u53CC\u680F \xB7 "+t,D),g.local.loadDir(""),g.remote.loadDir("")}var Ei=null,Cr=null,Ks=()=>Ei!==null||Cr!==null;function Aa(e,t,i){if(re!==null&&!Ue&&bt!==null&&Et===null)try{let h=Ca({title:t,side:"bottom",size:i,min:200,onClose:()=>Pt()});h.element.appendChild(e),Cr=h;return}catch(h){console.warn("[dsh-tty] SFTP \u6302\u5230\u53F3\u4FA7\u4FA7\u680F\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(h instanceof Error?h.message:String(h)))}let o=document.createElement("div");o.className="tt_sshBackdrop",o.appendChild(e),o.addEventListener("mousedown",h=>{h.target===o&&Pt()}),document.body.appendChild(o),Ei=o}var Si=null;function zd(){let e=Si;if(Si=null,e!==null)try{e.click()}catch{}}function Ud(e){let t=new TextEncoder().encode(e),i="";for(let o of t)i+=String.fromCharCode(o);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ze(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],i=e,o=-1;do i/=1024,o+=1;while(i>=1024&&o<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[o]}function Es(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],i=e,o=-1;do i/=1024,o+=1;while(i>=1024&&o<t.length-1);return(i>=100?i.toFixed(0):i.toFixed(1))+" "+t[o]+"/s"}function Da(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let i=o=>String(o).padStart(2,"0");return t.getFullYear()+"-"+i(t.getMonth()+1)+"-"+i(t.getDate())+" "+i(t.getHours())+":"+i(t.getMinutes())}function Ba(e){let t=String(e).replace(/\/+$/,""),i=t.lastIndexOf("/");return i<=0?"/":t.slice(0,i)}function _i(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Pa(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let i=document.createElement("div");i.className="tt_sftpFill",t.appendChild(i);let o=document.createElement("span");o.className="tt_sftpPct",o.textContent="";let h=document.createElement("button");h.type="button",h.className="tt_sftpCancel",h.title="\u53D6\u6D88\u4F20\u8F93",h.textContent="\u2715",h.style.display="none";let r=null;h.addEventListener("click",p=>{p.stopPropagation();let c=r;c!==null&&(h.disabled=!0,c())}),e.appendChild(t),e.appendChild(o),e.appendChild(h);let s=p=>{o.textContent=p},a="",f=-1,n=p=>{p!==a&&(a=p,o.textContent=p)},_=p=>{let c=Math.round(p);c!==f&&(f=c,i.style.width=c+"%")},g=()=>{r=null,Si===h&&(Si=null),h.style.display="none",h.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",f=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,i.style.width="0%",o.textContent="",g()},setCancel(p){if(p==null){g();return}r=p,Si=h,h.disabled=!1,h.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let d=Date.now();if(this._last!==void 0&&d>this._lastAt){let l=(p-this._last)/((d-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}if(this._last=p,this._lastAt=d,Number.isFinite(c)&&c>0){let l=Math.min(100,Math.max(0,p/c*100));_(l);let u=this._rate!==void 0&&this._rate>=0?Es(this._rate):"";n(Math.round(l)+"%"+(u!==""?" \xB7 "+u:""))}else{i.style.width="";let l=this._rate!==void 0&&this._rate>=0?Es(this._rate):"";n(Ze(p)+(l!==""?" \xB7 "+l:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,i.style.width="45%",i.style.transition="none",setTimeout(()=>{i.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let l=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?l:this._rate*.7+l*.3}this._last=p,this._lastAt=c;let d=this._rate!==void 0&&this._rate>=0?Es(this._rate):"";n((Number.isFinite(p)?Ze(p):"\u2026")+(d!==""?" \xB7 "+d:""))},done(p){e.dataset.active="",e.dataset.state="done",i.style.width="100%",f=100,g(),n(p!==void 0&&p!==""?p:"\u5B8C\u6210")},fail(p){e.dataset.active="",e.dataset.state="error",g(),n(p!==void 0&&p!==""?p:"\u5931\u8D25")},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",o.textContent=""):(e.dataset.active="",i.style.width="",f=-1,n(p))}}}async function Oa(e,t,i,o=0,h=null){let r=o>0?o*1024*1024:0,s=typeof AbortController=="function"?new AbortController:null,a=!1;s!==null&&(t={...t,signal:s.signal},typeof h=="function"&&h(()=>{a=!0,s.abort()}));let f=await fetch(e,t);if(!f.ok){let d="HTTP "+f.status;try{let l=await f.json();l!==null&&typeof l=="object"&&typeof l.error=="string"&&(d=l.error)}catch{}throw new Error(d)}let n=Number(f.headers.get("content-length")),_=Number.isFinite(n)&&n>0;if(r>0&&_&&n>r){try{await f.body?.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ze(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}let g=f.body;if(g===null||typeof g.getReader!="function"){let d=await f.blob();if(r>0&&d.size>r)throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ze(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync");return _&&i(n,n),d}let S=g.getReader(),p=[],c=0;try{for(;;){let{done:d,value:l}=await S.read();if(d)break;if(l!==void 0&&l.byteLength>0){if(c+=l.byteLength,r>0&&c>r){try{await S.cancel()}catch{}throw new Error("\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08"+Ze(r)+"\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync")}p.push(l),i(c,_?n:NaN)}}}catch(d){if(a||d!==null&&typeof d=="object"&&d.name==="AbortError"){try{await S.cancel()}catch{}throw new ii}throw d}return new Blob(p,{type:"application/octet-stream"})}var ii=class extends Error{constructor(){super("\u5DF2\u53D6\u6D88"),this.name="TransferCanceledError"}};function Bs(e){return e instanceof ii}function Ia(e,t){let i=URL.createObjectURL(e),o=document.createElement("a");o.href=i,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}async function jd(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],i=[];for(let n of t){let _=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():null;_!==null&&i.push(_)}if(i.length===0)return[...e.files??[]].map(n=>({relPath:n.name,file:n}));let o=[],h=wt.maxUploadFiles,r=wt.maxUploadMb>0?wt.maxUploadMb*1024*1024:0,s=()=>h>0&&o.length>=h,a=0,f=(n,_)=>new Promise(g=>{if(s()){g();return}if(n.isFile===!0){n.file(c=>{r>0&&a+(c.size??0)>r?o._limitExceeded=!0:(o.push({relPath:_+n.name,file:c}),a+=c.size??0),g()},()=>g());return}if(n.isDirectory!==!0){g();return}let S=n.createReader(),p=()=>{S.readEntries(async c=>{if(c.length===0){g();return}for(let d of c){if(s())break;await f(d,_+n.name+"/")}if(s()){g();return}p()},()=>g())};p()});for(let n of i)await f(n,"");return o}function Gs(e){if(Ks())return;let t=e!==null&&typeof e=="object"?e:{},i={};if(typeof t.name=="string"&&t.name!=="")i.name=t.name;else{for(let A of["host","username","auth","keyPath","passphrase","password"])typeof t[A]=="string"&&t[A]!==""&&(i[A]=t[A]);let U=Number(t.port);Number.isInteger(U)&&U>=1&&U<=65535&&(i.port=U),t.agentForward===!0&&(i.agentForward=!0)}let o=i.name??(i.username!==void 0?i.username+"@"+String(i.host??""):String(i.host??""));if(xa==="dual"){$d(i,o);return}let h=document.createElement("div");h.className="tt_sftpCard";let r=document.createElement("div");r.className="tt_sftpTitleRow";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=Ci+"<span></span>",s.lastElementChild.textContent="SFTP \xB7 "+o;let a=document.createElement("button");a.type="button",a.className="tt_close",a.title="\u5173\u95ED",a.innerHTML=Er,a.addEventListener("click",Pt),r.appendChild(s),r.appendChild(a),h.appendChild(r);let f=document.createElement("div");f.className="tt_sftpBar";let n=document.createElement("input");n.type="text",n.className="tt_sftpPath",n.placeholder="\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09",n.spellcheck=!1,n.autocomplete="off";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=Hs+"<span>\u5237\u65B0</span>";let g=document.createElement("button");g.type="button",g.className="tt_toolBtn",g.innerHTML=da+"<span>\u65B0\u5EFA\u76EE\u5F55</span>";let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.innerHTML=hd+"<span>\u4E0A\u4F20</span>",S.title="\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868";let p=document.createElement("input");p.type="file",p.multiple=!0,p.style.display="none",f.appendChild(n),f.appendChild(_),f.appendChild(g),f.appendChild(S),h.appendChild(f),h.appendChild(p);let c=document.createElement("div");c.className="tt_sftpEditor",c.style.display="none";let d=document.createElement("input");d.type="text",d.className="tt_cardInput",d.spellcheck=!1,d.autocomplete="off";let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent="\u786E\u5B9A";let u=document.createElement("button");u.type="button",u.className="tt_toolBtn",u.textContent="\u53D6\u6D88",c.appendChild(d),c.appendChild(l),c.appendChild(u),h.appendChild(c);let v=null,C=()=>{c.style.display="none",v=null};l.addEventListener("click",()=>{v?.()}),u.addEventListener("click",C),d.addEventListener("keydown",U=>{U.key==="Enter"?(U.preventDefault(),v?.()):U.key==="Escape"&&(U.stopPropagation(),C())});let w=document.createElement("div");w.className="tt_sftpList",h.appendChild(w);let y=document.createElement("div");y.className="tt_sftpFoot";let m=document.createElement("div");m.className="tt_sftpStatus";let x=Pa();y.appendChild(x.el),y.appendChild(m),h.appendChild(y);let T={path:"",busy:!1},I=(U,A)=>{m.textContent=U,A===void 0?delete m.dataset.state:m.dataset.state=A},F=U=>{T.busy=U;for(let A of[_,g,S])A.disabled=U;n.disabled=U},R=async(U,A)=>{let k=await fetch("/api/dsh-tty/sftp/"+U,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,...A})}),N=await k.json().catch(()=>({}));if(!k.ok||N.ok!==!0)throw new Error(String(N.error||"HTTP "+k.status));return N},z=async(U,A)=>{if(!T.busy){F(!0),I(U,"busy");try{await A()}catch(k){I(String(k&&k.message?k.message:k),"error")}finally{F(!1)}}},B=(U,A,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let q=document.createElement("span");q.className="tt_sftpIcon",q.innerHTML=U,N!==void 0&&(q.dataset.kind=N);let j=document.createElement("span");if(j.className="tt_sftpName",j.textContent=A,j.title=A,H.appendChild(q),H.appendChild(j),k!==""){let Q=document.createElement("span");Q.className="tt_sftpMeta",Q.textContent=k,H.appendChild(Q)}return H},D=(U,A,k,N)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=A,H.title=k,H.addEventListener("click",q=>{q.stopPropagation(),N()}),U.appendChild(H)},O=(U,A,k)=>{let N=document.createElement("button");N.type="button",N.className="tt_sftpAct",N.innerHTML=Yt,N.title="\u5220\u9664 "+A.name+(A.isDir?"\uFF08\u542B\u5185\u5BB9\uFF09":"");let H=null;N.addEventListener("click",q=>{if(q.stopPropagation(),!T.busy){if(H!==null){clearTimeout(H),H=null,N.innerHTML=Yt,delete N.dataset.danger,z("\u5220\u9664 "+A.name+"\u2026",async()=>{await R("remove",{path:k,recursive:A.isDir===!0}),await b(T.path),I("\u5DF2\u5220\u9664 "+A.name)});return}N.textContent="\u786E\u8BA4?",N.dataset.danger="",H=setTimeout(()=>{H=null,N.innerHTML=Yt,delete N.dataset.danger},4e3)}}),U.appendChild(N)},P=U=>{if(w.textContent="",T.path!==""&&T.path!=="/"){let k=B(Is,"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","","up");k.addEventListener("click",()=>{z("\u52A0\u8F7D\u4E2D\u2026",()=>b(Ba(T.path)))}),w.appendChild(k)}let A=Array.isArray(U)?U:[];if(A.length===0){let k=document.createElement("div");k.className="tt_addMenuTitle",k.textContent="\uFF08\u7A7A\u76EE\u5F55\uFF09",w.appendChild(k);return}for(let k of A){if(k===null||typeof k!="object"||typeof k.name!="string"||k.name==="")continue;let N=_i(T.path,k.name),H=[];k.isDir===!0?H.push("\u76EE\u5F55"):H.push(Ze(Number(k.size))||"\u2014");let q=Da(Number(k.mtime));q!==""&&H.push(q);let j=B(k.isDir?Ci:k.isSymlink?ca:la,k.name,H.join(" \xB7 "),k.isDir===!0?"dir":k.isSymlink===!0?"link":"file");k.isDir===!0?j.addEventListener("click",Q=>{Q.target instanceof Element&&Q.target.closest(".tt_sftpAct")!==null||z("\u52A0\u8F7D\u4E2D\u2026",()=>b(N))}):(j.addEventListener("click",Q=>{Q.target instanceof Element&&Q.target.closest(".tt_sftpAct")!==null||E(k,N)}),D(j,ha,"\u4E0B\u8F7D "+k.name,()=>{E(k,N)})),D(j,Ns,"\u91CD\u547D\u540D "+k.name,()=>{d.placeholder="\u65B0\u540D\u79F0",d.value=k.name,c.style.display="",d.focus(),d.select(),v=async()=>{let Q=d.value.trim();Q===""||Q===k.name||(C(),await z("\u91CD\u547D\u540D "+k.name+"\u2026",async()=>{await R("rename",{from:N,to:_i(T.path,Q)}),await b(T.path)}))}}),O(j,k,N),w.appendChild(j)}},b=async U=>{try{let A=await R("list",{path:U??T.path});T.path=typeof A.path=="string"&&A.path!==""?A.path:"/",n.value=T.path;let k=Array.isArray(A.entries)?A.entries.length:0;P(A.entries),I(T.path+" \u2014 "+String(k)+" \u9879")}catch(A){I(String(A&&A.message?A.message:A),"error")}},E=(U,A)=>z("\u4E0B\u8F7D "+U.name+"\u2026",async()=>{x.reset();let k;try{k=await Oa("/api/dsh-tty/sftp/download",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...i,path:A})},(N,H)=>{x.set(N,H)},wt.maxDownloadMb,N=>x.setCancel(N))}catch(N){if(Bs(N)){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0B\u8F7D "+U.name);return}throw x.fail("\u4E0B\u8F7D\u5931\u8D25"),N}x.done("\u5B8C\u6210"),Ia(k,U.name),setTimeout(()=>x.reset(),1500),I("\u5DF2\u4E0B\u8F7D "+U.name+"\uFF08"+(Ze(k.size)||String(k.size)+" B")+"\uFF09")}),L=(U,A,k,N,H)=>new Promise((q,j)=>{let Q=Ud(JSON.stringify({...i,path:_i(T.path,A)})),ee=new XMLHttpRequest;H.abort=()=>{H.stopped=!0,ee.abort()},ee.open("POST","/api/dsh-tty/sftp/upload"),ee.setRequestHeader("x-dsh-sftp-meta",Q);let G=N>1?String(k)+"/"+String(N)+" ":"";I("\u4E0A\u4F20 "+G+A,"busy"),ee.upload.addEventListener("progress",oe=>{oe.lengthComputable?x.set(oe.loaded,oe.total):x.pulse(0)});let J=!1,Z=oe=>{J||(J=!0,oe===null?q():j(oe))};ee.addEventListener("load",()=>{if(ee.status===200){N===1&&x.done("\u4E0A\u4F20\u5B8C\u6210"),Z(null);return}if(H.stopped)return;x.fail("\u4E0A\u4F20\u5931\u8D25");let oe="HTTP "+ee.status;try{let ae=JSON.parse(ee.responseText);ae!==null&&typeof ae=="object"&&typeof ae.error=="string"&&(oe=ae.error)}catch{}Z(new Error(oe))}),ee.addEventListener("error",()=>{if(H.stopped){Z(new ii);return}x.fail("\u4E0A\u4F20\u5931\u8D25"),Z(new Error("\u7F51\u7EDC\u9519\u8BEF"))}),ee.addEventListener("abort",()=>{Z(new ii)}),ee.send(U)}),M=async U=>z("\u4E0A\u4F20\u4E2D\u2026",async()=>{let A=wt;if(A.maxUploadFiles>0&&U.length>A.maxUploadFiles){I("\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08"+String(A.maxUploadFiles)+"\uFF09\uFF1A\u672C\u6B21 "+String(U.length)+" \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","error"),x.fail("\u8D85\u9650");return}let k=A.maxUploadMb>0?A.maxUploadMb*1024*1024:0,N=U.find(ee=>k>0&&(ee.file?.size??0)>k);if(N!==void 0){I("\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08"+Ze(k)+"\uFF09\uFF1A"+String(N.relPath??"")+"\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error"),x.fail("\u8D85\u9650");return}if(U._limitExceeded===!0){I("\u6587\u4EF6\u603B\u5927\u5C0F\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF1A\u8BF7\u5206\u6279\u4E0A\u4F20\uFF08\u6216\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\uFF09","error"),x.fail("\u8D85\u9650");return}let H=new Set;for(let ee of U){let G=ee.relPath.lastIndexOf("/");if(G<=0)continue;let J=ee.relPath.slice(0,G);H.has(J)||(H.add(J),await R("mkdir",{path:_i(T.path,J),parents:!0}).catch(()=>{}))}x.reset();let q={stopped:!1,abort:null};x.setCancel(()=>q.abort?.());let j=0,Q=0;try{for(let ee of U){if(q.stopped)break;j+=1,q.abort=null;try{await L(ee.file,ee.relPath,j,U.length,q),Q+=1}catch(G){if(Bs(G)||q.stopped)break;throw G}}}finally{x.setCancel(null)}if(q.stopped){x.reset(),I("\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 "+String(Q)+"/"+String(U.length)+" \u4E2A\uFF09"),await b(T.path);return}x.done("\u5168\u90E8\u5B8C\u6210"),setTimeout(()=>x.reset(),1500),I("\u4E0A\u4F20\u5B8C\u6210 "+String(U.length)+" \u4E2A\u6587\u4EF6"),await b(T.path)});_.addEventListener("click",()=>{z("\u52A0\u8F7D\u4E2D\u2026",()=>b(T.path))}),g.addEventListener("click",()=>{T.busy||(d.placeholder="\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09",d.value="",c.style.display="",d.focus(),v=async()=>{let U=d.value.trim();U!==""&&(C(),await z("\u521B\u5EFA\u76EE\u5F55 "+U+"\u2026",async()=>{await R("mkdir",{path:_i(T.path,U)}),await b(T.path)}))})}),S.addEventListener("click",()=>{T.busy===!1&&p.click()}),p.addEventListener("change",()=>{let U=[...p.files??[]].map(A=>({relPath:A.name,file:A}));p.value="",U.length>0&&M(U)});let $=0,K=U=>{U?w.dataset.drag="":delete w.dataset.drag};h.addEventListener("dragenter",U=>{U.preventDefault(),$+=1,K(!0)}),h.addEventListener("dragover",U=>{U.preventDefault()}),h.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&K(!1)}),h.addEventListener("drop",U=>{U.preventDefault(),$=0,K(!1),!T.busy&&jd(U.dataTransfer).then(A=>{(A.length>0||A._limitExceeded===!0)&&M(A)})}),n.addEventListener("keydown",U=>{if(U.key!=="Enter"||(U.preventDefault(),T.busy))return;let A=n.value.trim();A!==""&&z("\u52A0\u8F7D\u4E2D\u2026",()=>b(A))});let Y=$s();Aa(h,"SFTP \xB7 "+o,Y===null?340:Math.round(Y.height*.46)),z("\u8FDE\u63A5\u4E2D\u2026",()=>b(""))}function Pt(){if(!Ks())return;zd();let e=Ei,t=Cr;Ei=null,Cr=null,e!==null&&e.remove(),t!==null&&t.dispose()}function Na(){if(De===null)return;let e=De.style.display==="none"||De.style.display==="";De.style.display=e?"":"none";let t=re!==null?re.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&De.focus()}var qd={matchBackground:"#3d2b00",matchBorder:"#8a5a00",activeMatchBackground:"#b06a00",activeMatchBorder:"#ffb84d",matchOverviewRuler:"#8a5a00",activeMatchColorOverviewRuler:"#ffb84d"};function Kd(e){let t=vt();if(t===void 0||t.search===void 0)return;let i=De.value;if(i==="")return;let o={decorations:qd};e?t.search.findPrevious(i,o):t.search.findNext(i,o)}function sa(){yi||re===null&&!Fs()||kt!==null||(kt=setTimeout(()=>{kt=null,yr()},bi),bi=Math.min(bi*2,5e3))}function Bi(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Ps(e){return Bi(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function Gd(){return Mt==="tmux"?{t:"spawn",cwd:ea(),persist:!0,persistName:js()}:{t:"spawn",cwd:ea()}}async function Ha(){if(await qs(),re===null){await Yd();return}let e=bd(),t=md();if(![...se.values()].some(s=>s.embedded!==!0)){if(e.length>0||t.length>0){ke({t:"sessions"});let s=await br("sessions",4e3),a=new Map;if(s!==null&&Array.isArray(s.list))for(let n of s.list)n!==null&&typeof n=="object"&&n.attachable===!0&&a.set(n.sid,n);let f=new Set;for(let n of e){if(a.has(n.sid))Cd(n);else if(Ps(n.spawnSpec))ta(n);else continue;Bi(n.spawnSpec)&&f.add(n.spawnSpec.persistName)}for(let n of t){let _=n.spawnSpec.persistName;f.has(_)||(ta(n),f.add(_))}Bt()}if(![...se.values()].some(s=>s.embedded!==!0)){if(await Sr())return;xi()}return}let i=[...se.values()].filter(s=>!s.exited&&(s.embedded!==!0||s.spawned===!0)),o=i.filter(s=>Ps(s.spawnSpec)),h=null;if(o.length>0){ke({t:"sessions"});let s=await br("sessions",4e3),a=new Set((s!==null&&Array.isArray(s.list)?s.list:[]).map(f=>f?.sid).filter(f=>typeof f=="string"));h=o.filter(f=>!a.has(f.sid));for(let f of h)Ws(f.sid)}let r=h!==null?new Set(h.map(s=>s.sid)):new Set;for(let s of i)r.has(s.sid)||ke({t:"attach",sid:s.sid})}function Vd(){he!==null&&(he.readyState===WebSocket.OPEN||he.readyState===WebSocket.CONNECTING)||yr()}async function Yd(){let e=[...se.values()].filter(o=>o.embedded===!0&&!o.exited);if(e.length===0)return;ke({t:"sessions"});let t=await br("sessions",4e3),i=new Set((t!==null&&Array.isArray(t.list)?t.list:[]).map(o=>o?.sid).filter(o=>typeof o=="string"));for(let o of e)o.spawned===!0&&(i.has(o.sid)?ke({t:"attach",sid:o.sid}):Ps(o.spawnSpec)?Sa(o):(o.exited=!0,o.live=!1,Kt(o,"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","\u70B9\u51FB\u91CD\u65B0\u6267\u884C","exited")))}function yr(){if(he!==null){try{he.close()}catch{}he=null}yi=!1,clearTimeout(kt),kt=null,cr=!0,yt("\u8FDE\u63A5\u4E2D\u2026","");try{he=new WebSocket(ed())}catch(e){cr=!1,yt("\u8FDE\u63A5\u5931\u8D25\uFF1A"+e.message,"error"),sa();return}he.onopen=()=>{cr=!1,bi=1e3,yt("\u5DF2\u8FDE\u63A5","connected");for(let e of[...Ls])Ls.delete(e),se.has(e.tab.sid)&&ke(e.frame);Ha()},he.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let i=t.sid;if(t.t==="ready"){let o=typeof t.target=="string"?t.target:"";yt(t.kind==="ssh"?"SSH "+(o!==""?o+" ":"")+"\u5DF2\u8FDE\u63A5":"\u5DF2\u8FDE\u63A5 pid="+t.pid,"connected");let h=se.get(i);if(h!==void 0){if(h.exited=!1,h.spawned=!0,h.live=!0,h.errored=!1,h.target=o,h.persistTmux=t.persist===!0,t.kind==="ssh"&&o!==""&&!h.label&&(h.label=o,Qe()),Lt(),ks(i),Kt(h,""),Ai(h),t.persist===!0){let r=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([r,new Promise(s=>setTimeout(s,500))]).then(()=>va(150))}Li(),Bt()}}else if(t.t==="data"){let o=se.get(i);o!==void 0&&o.term!==null&&(o.term.write(String(t.d??"")),Zd())}else if(t.t==="exit"){let o=se.get(i);if(o!==void 0){o.exited=!0,o.live=!1;let h=t.code!==null&&t.code!==void 0?"code="+t.code:"",r=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";yt("\u5DF2\u9000\u51FA "+[h,r].filter(Boolean).join(" "),""),Lt(),ks(i),Kt(o,"\u4F1A\u8BDD\u5DF2\u9000\u51FA","\u70B9\u51FB\u91CD\u65B0\u6253\u5F00","exited"),Li(),Bt()}}else if(t.t==="error")if(yt("\u9519\u8BEF\uFF1A"+String(t.m??""),"error"),typeof i=="string"){let o=se.get(i);o!==void 0&&(o.live||(o.errored=!0),Lt(),ks(i),Kt(o,"\u8FDE\u63A5\u51FA\u9519",String(t.m??"")+" \xB7 \u70B9\u51FB\u91CD\u8BD5","error"))}else Xd("\u70B9\u51FB\u91CD\u8BD5")},he.onclose=()=>{if(cr=!1,!yi){yt("\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","error");for(let e of se.values())e.exited||Kt(e,"\u8FDE\u63A5\u65AD\u5F00","\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","info");sa()}},he.onerror=()=>{}}function Xd(e){Jt!==null&&(Jt.textContent=e)}function Vs(){if(re!==null){Ue&&Fa();return}Ri(),re=document.createElement("div"),re.className="tt_modalBackdrop",re.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+kr+'</span><div class="tt_tabs"></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">\u521D\u59CB\u5316\u2026</span></div><input class="tt_searchInput" style="display:none" placeholder="\u641C\u7D22 (Enter \u4E0B\u4E00\u4E2A, Shift+Enter \u4E0A\u4E00\u4E2A)" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="\u641C\u7D22 (Ctrl+F)">'+td+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="\u6E05\u5C4F">'+id+'</button><button class="tt_toolBtn tt_iconBtn" data-act="copy" title="\u590D\u5236\u9009\u4E2D\u5185\u5BB9">'+rd+'</button><button class="tt_toolBtn tt_iconBtn" data-act="paste" title="\u7C98\u8D34">'+sd+'</button></span><span class="tt_winGroup"><button class="tt_min" title="\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09">'+ld+'</button><button class="tt_close" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">'+Er+'</button></span></div><div class="tt_connbar" data-hidden><div class="tt_connArea"><span class="tt_connDot"></span><span class="tt_connTarget">\u2014</span><span class="tt_connBadge"></span></div><div class="tt_connActions"></div></div><div class="tt_work"><div class="tt_body"><div class="tt_overlay"></div></div></div></div>',document.body.appendChild(re),_r=re.querySelector(".tt_status"),ei=re.querySelector(".tt_statusText"),Tt=re.querySelector(".tt_statusDot"),gt=re.querySelector(".tt_tabs"),pi=re.querySelector(".tt_connbar"),gi=re.querySelector(".tt_connDot"),pr=re.querySelector(".tt_connTarget"),We=re.querySelector(".tt_connBadge"),vi=re.querySelector(".tt_connActions"),bt=re.querySelector(".tt_work"),Xt=re.querySelector(".tt_body"),Jt=re.querySelector(".tt_body > .tt_overlay"),De=re.querySelector(".tt_searchInput"),Jt.addEventListener("click",()=>{Jt.textContent="",yr()});let e=re.querySelector("[data-act=search]");e.addEventListener("click",()=>{Na(),De.style.display!=="none"&&De.focus()}),e.dataset.on="",De.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),Kd(t.shiftKey)):t.key==="Escape"&&(t.stopPropagation(),De.style.display="none")}),re.querySelector("[data-act=clear]").addEventListener("click",()=>{let t=vt();t!==void 0&&t.term!==null&&t.term.clear()}),re.querySelector("[data-act=copy]").addEventListener("click",()=>{let t=vt();if(t===void 0||t.term===null)return;let i=t.term.getSelection();i!==""&&navigator.clipboard.writeText(i).catch(()=>{})}),re.querySelector("[data-act=paste]").addEventListener("click",()=>{let t=vt();t!==void 0&&navigator.clipboard.readText().then(i=>{ke({t:"input",sid:t.sid,d:i})}).catch(()=>{})}),re.querySelector(".tt_min").addEventListener("click",()=>{Os()}),re.querySelector(".tt_close").addEventListener("click",()=>{Mi()}),re.addEventListener("mousedown",t=>{t.target===re&&Os()}),document.addEventListener("keydown",Wa),mi=new ResizeObserver(()=>{Ue||(dr(),wd(vt()))}),mi.observe(Xt),Qe(),Lt(),he!==null&&he.readyState===WebSocket.OPEN?Ha():yr()}function Jd(){Te=document.createElement("div"),Te.className="tt_dock",Te.title="\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3",Te.innerHTML='<span class="tt_dockTitle">'+kr+'<span>\u7EC8\u7AEF</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="\u5173\u95ED\u9762\u677F\uFF08\u7ED3\u675F\u4F1A\u8BDD\uFF0C\u6807\u7B7E\u4FDD\u7559\uFF0C\u91CD\u5F00\u5373\u6062\u590D\u5217\u8868\uFF09">\u2715</button>',gr=Te.querySelector(".tt_dockCount"),ti=Te.querySelector(".tt_dockStatus"),At=Te.querySelector(".tt_dockDot");let e=[...se.values()].filter(t=>!t.exited).length;gr.textContent=se.size>0?"\xB7 "+e+"/"+se.size:"",ei!==null&&(ti.textContent=ei.textContent),Tt!==null&&(At.dataset.state=Tt.dataset.state??""),Te.addEventListener("click",t=>{if(t.target.closest(".tt_dockClose")!==null){t.stopPropagation(),Mi();return}Fa()}),document.body.appendChild(Te)}function Os(){re===null||Ue||(Je(),pt(),Pt(),Ue=!0,De!==null&&(De.style.display="none"),re.dataset.minimized="",document.querySelector("[data-dsh-tty-entry]")!==null?Li():(Jd(),Te.classList.add("tt_dockCompact")))}function Li(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ue){t!==null&&t.remove(),delete e.dataset.minimized,e.removeAttribute("title");return}t===null&&(t=document.createElement("span"),t.className="tt_sidebarEntryBadge",t.innerHTML='<span class="tt_sidebarBadgeDot"></span><span class="tt_sidebarBadgeCount"></span>',e.appendChild(t)),e.dataset.minimized="",e.title="\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D";let i=[...se.values()].filter(h=>!h.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=i+"/"+se.size;let o=t.querySelector(".tt_sidebarBadgeDot");o!==null&&Tt!==null&&(o.dataset.state=Tt.dataset.state??"")}function Zd(){if(!Ue)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??At;e!==null&&(e.dataset.active="",clearTimeout(vr),vr=setTimeout(()=>{delete e.dataset.active},900))}function Fa(){if(re===null||!Ue)return;Ue=!1,delete re.dataset.minimized,clearTimeout(vr),Te!==null&&(Te.remove(),Te=null),gr=null,ti=null,At=null,Li();let e=vt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&Ai(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Mi(){if(re===null)return;ur(!0);let e=Fs();if(yi=!e,Ue=!1,Je(),pt(),Pt(),clearTimeout(vr),clearTimeout(kt),kt=null,bi=1e3,Te!==null&&(Te.remove(),Te=null),gr=null,ti=null,At=null,Li(),he!==null){for(let t of se.values())!t.exited&&t.embedded!==!0&&ke({t:"kill",sid:t.sid});if(!e){try{he.close()}catch{}he=null}}mi!==null&&(mi.disconnect(),mi=null);for(let[t,i]of[...se])if(i.embedded!==!0){if(i.term!==null)try{i.term.dispose()}catch{}se.delete(t)}Dt=null,document.removeEventListener("keydown",Wa),re.remove(),re=null,bt=null,_r=null,ei=null,Tt=null,gt=null,pi=null,gi=null,pr=null,We=null,vi=null,Ts(),Xt=null,Jt=null,De=null,Lr=0;try{sessionStorage.removeItem(mr)}catch{}}function Wa(e){if(e.key==="Escape"&&re!==null){if(e.preventDefault(),Ei!==null){Pt();return}if(Zt!==null){pt();return}if($e!==null){Je();return}Os()}}function Qd(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function eu(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let i of e.children)if(i.tagName==="BUTTON")return i}function tu(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label","\u7EC8\u7AEF"),e.innerHTML='<span class="tt_sidebarEntryIcon">'+kr+'</span><span class="tt_sidebarEntryLabel">\u7EC8\u7AEF</span>',e.addEventListener("click",t=>{t.preventDefault(),Vs()}),e}function na(e,t){let i=eu(e);if(i===void 0)return!1;if(t.parentElement!==e){let o=i.closest('[class*="logoRow"]'),h=o!==null&&o.parentElement===e?o:i,r=Array.from(e.children).filter(s=>s instanceof HTMLElement&&s.matches("[data-dsh-global-search-entry], [data-dsh-rss-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry], [data-dsh-tty-entry]"));if(r.length>0){let s=r[r.length-1];e.insertBefore(t,s.nextSibling)}else e.insertBefore(t,h.nextElementSibling)}return!0}function iu(){if(Ri(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=tu(),t,i=!1,o=()=>{if(t!==void 0&&!t.isConnected&&(r.disconnect(),t=void 0,i=!1),i){if(document.body.contains(e))return;r.disconnect(),t=void 0,i=!1}t??(t=Qd()),t!==void 0&&(i=na(t,e),i&&r.observe(t,{childList:!0,subtree:!0}))},h=new MutationObserver(()=>{o()});h.observe(document.body,{childList:!0,subtree:!0});let r=new MutationObserver(()=>{if(t===void 0||!t.isConnected){i=!1,o();return}t.contains(e)||(i=na(t,e))});return o(),()=>{h.disconnect(),r.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},i=e("react"),{jsx:o,jsxs:h}=e("react/jsx-runtime"),r="M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 9.13382 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z";function s(){let[a,f]=i.useState(!1),[n,_]=i.useState(null),[g,S]=i.useState(!1),[p,c]=i.useState(!1),[d,l]=i.useState({kind:"",text:""}),[u,v]=i.useState([]),[C,w]=i.useState(!1),y=W=>o("div",{className:"tt_cardSection",children:W}),m=async()=>{try{let V=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();V.ok&&typeof V.config=="object"&&V.config!==null?(_(V.config),ki(V.config)):l({kind:"error",text:String(V.error||"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25")})}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},x=async()=>{try{let V=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();V.ok&&Array.isArray(V.shells)&&v(V.shells)}catch{}};i.useEffect(()=>{a&&!g&&(S(!0),m(),x())},[a]);let T=(W,V)=>_(X=>({...X||{},[W]:V})),I=(W,V)=>_(X=>({...X||{},sftpLimits:{...X?.sftpLimits??{},[W]:V}})),[F,R]=i.useState(null),[z,B]=i.useState(null),[D,O]=i.useState(""),[P,b]=i.useState({}),[E,L]=i.useState([]),[M,$]=i.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""});i.useEffect(()=>{if(!a)return;let W=!0,V=async()=>{try{let ne=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();W&&ne.ok&&Array.isArray(ne.tunnels)&&L(ne.tunnels)}catch{}};V();let X=setInterval(V,2e3);return()=>{W=!1,clearInterval(X)}},[a]);let K=W=>V=>$(X=>({...X||{},[W]:V.target.value})),Y=W=>W?.direction==="remote"?`\u8FDC\u7A0B:${W.remoteHost||"127.0.0.1"}:${String(W.remotePort??0)} \u2192 \u672C\u673A:${String(W.localTargetPort??0)}`:`\u672C\u673A:${String(W?.localPort??0)} \u2192 ${W?.remoteHost??"?"}:${String(W?.remotePort??0)}`,U=(n?.sshHosts??[]).find(W=>W?.name===M?.bookName),A=async W=>{try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:W})}),X=await V.json().catch(()=>({}));return!V.ok||!X.ok?(l({kind:"error",text:String(X.error||"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25")}),!1):!0}catch(V){return l({kind:"error",text:String(V&&V.message?V.message:V)}),!1}},k=()=>{l({kind:"",text:""});let W=M||{},V=W.bookName||(Array.isArray(n?.sshHosts)?n.sshHosts[0]?.name:"")||"";if(V===""){l({kind:"error",text:"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE"});return}let X=ve=>{let le=Number(ve);return Number.isInteger(le)&&le>=1&&le<=65535?le:0},te;if(W.direction==="remote"){if(te={name:"",bookName:V,direction:"remote",remotePort:X(W.remotePort),localTargetHost:"",localTargetPort:X(W.localTargetPort),enabled:!0},te.remotePort<1||te.localTargetPort<1){l({kind:"error",text:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09"});return}te.name=`${V}-R${String(te.remotePort)}`}else{if(te={name:"",bookName:V,direction:"local",localPort:X(W.localPort),remoteHost:W.remoteHost.trim(),remotePort:X(W.remotePort),enabled:!0},te.localPort<1||te.remoteHost===""||te.remotePort<1){l({kind:"error",text:"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B"});return}te.name=`${V}-L${String(te.localPort)}`}let ne=new Set((Array.isArray(n?.tunnels)?n.tunnels:[]).map(ve=>ve?.name)),ce=te.name,ge=2;for(;ne.has(ce);)ce=`${te.name}-${String(ge)}`,ge+=1;te.name=ce;let ie=[...Array.isArray(n?.tunnels)?n.tunnels:[],te];_(ve=>({...ve||{},tunnels:ie})),$(ve=>({...ve||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),A(ie).then(ve=>{ve&&l({kind:"ok",text:`\u96A7\u9053\u300C${ce}\u300D\u5DF2\u751F\u6548`})})},N=W=>{let V=(Array.isArray(n?.tunnels)?n.tunnels:[]).filter(X=>X?.name!==W);_(X=>({...X||{},tunnels:V})),A(V)},H=(W,V)=>{let X=(Array.isArray(n?.tunnels)?n.tunnels:[]).map(te=>te?.name===W?{...te,enabled:V}:te);_(te=>({...te||{},tunnels:X})),A(X)},q=W=>{R(W?.name??null),O(""),B({name:W?.name??"",host:W?.host??"",port:String(W?.port??22),username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0})},j=()=>{R(null),B(null),O("")},Q=()=>{if(z===null)return;let W=z.name.trim(),V=z.host.trim(),X=z.username.trim();if(W===""||V===""||X===""){O("\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B");return}let te=Number(z.port);if((!Number.isInteger(te)||te<1||te>65535)&&(te=22),(n?.sshHosts??[]).some(ne=>ne?.name===W&&W!==F)){O("\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: "+W);return}if(z.auth==="key"&&z.keyPath.trim()===""){O("auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84");return}_(ne=>({...ne||{},sshHosts:(Array.isArray(ne?.sshHosts)?ne.sshHosts:[]).map(ce=>ce?.name===F?{name:W,host:V,port:te,username:X,auth:z.auth,keyPath:z.keyPath.trim(),passphrase:z.passphrase,password:z.password,agentForward:z.agentForward}:ce)})),R(null),B(null),O(""),l({kind:"ok",text:"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C"+W+"\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})},ee=W=>{F===W&&j(),b(V=>{let X={...V};return delete X[W],X}),_(V=>({...V||{},sshHosts:(Array.isArray(V?.sshHosts)?V.sshHosts:[]).filter(X=>X?.name!==W)}))},G=async W=>{let V=W?.name??"";if(V==="")return;let X={host:W?.host??"",port:Number(W?.port)||22,username:W?.username??"",auth:W?.auth==="key"||W?.auth==="password"?W.auth:"agent",keyPath:W?.keyPath??"",passphrase:W?.passphrase??"",password:W?.password??"",agentForward:W?.agentForward===!0};b(ne=>({...ne,[V]:{running:!0,text:"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026"}}));let te=await Ma(X,!0);b(ne=>{let ce=ne[V]||{};if(te.result){let ge=te.result.auth?.ok===!0;return{...ne,[V]:{running:!1,ok:ge,text:Ra(te.result)}}}return{...ne,[V]:{running:!1,ok:!1,text:"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A"+String(te.error||"\u672A\u77E5\u9519\u8BEF")}}})},J=async W=>{let V=(Array.isArray(n?.hostKeys)?n.hostKeys:[]).filter(X=>!(X?.host===W?.host&&Number(X?.port)===Number(W?.port)));_(X=>({...X||{},hostKeys:V}));try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:V})}),te=await X.json().catch(()=>({}));!X.ok||!te.ok?l({kind:"error",text:String(te.error||"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25")}):l({kind:"ok",text:"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09"})}catch(X){l({kind:"error",text:String(X&&X.message?X.message:X)})}},Z=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(n?.sshHosts)?n.sshHosts:[]],ne=new Set(te.map(ie=>ie?.name)),ce=0,ge=0;for(let ie of X)if(!(ie===null||typeof ie!="object"||typeof ie.name!="string")){if(ne.has(ie.name)){ge+=1;continue}ne.add(ie.name),te.push({name:ie.name,host:String(ie.host??ie.name),port:Number(ie.port)||22,username:String(ie.username??""),auth:ie.auth==="key"?"key":"agent",keyPath:String(ie.keyPath??""),passphrase:"",password:"",agentForward:!1}),ce+=1}_(ie=>({...ie||{},sshHosts:te})),l(ce===0?{kind:"ok",text:ge>0?`\u6CA1\u6709\u65B0\u6761\u76EE\uFF08${ge} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09`:"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"}:{kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ce} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 ${ge} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E`})}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},oe=async()=>{l({kind:"",text:""});try{let V=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!V.ok){l({kind:"error",text:String(V.error||"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25")});return}let X=Array.isArray(V.entries)?V.entries:[],te=[...Array.isArray(n?.hostKeys)?n.hostKeys:[]],ne=new Set(te.map(ie=>String(ie?.host??"")+":"+String(ie?.port??22))),ce=0,ge=0;for(let ie of X){if(ie===null||typeof ie!="object"||typeof ie.host!="string"||typeof ie.fingerprint!="string")continue;let ve=ie.host+":"+String(ie.port??22);if(ne.has(ve)){ge+=1;continue}ne.add(ve),te.push({host:ie.host,port:Number(ie.port)||22,fingerprint:ie.fingerprint}),ce+=1}if(ce===0){l({kind:"ok",text:ge>0?`\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08${ge} \u6761\u5DF2\u5B58\u5728\uFF09`:"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A"});return}_(ie=>({...ie||{},hostKeys:te}));try{let ie=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:te})}),ve=await ie.json().catch(()=>({}));if(!ie.ok||!ve.ok){l({kind:"error",text:String(ve.error||"\u4FDD\u5B58 hostKeys \u5931\u8D25")});return}l({kind:"ok",text:`\u5DF2\u5BFC\u5165 ${ce} \u6761\u6307\u7EB9\uFF08\u8DF3\u8FC7 ${ge} \u6761\u5DF2\u5B58\u5728\uFF09`})}catch(ie){l({kind:"error",text:String(ie&&ie.message?ie.message:ie)})}}catch(W){l({kind:"error",text:String(W&&W.message?W.message:W)})}},ae=async()=>{c(!0),l({kind:"",text:""});let W={};for(let V of["enabled","announceToAgent","maxSessions","shell","term","colorTerm","cwd","reconnectGraceSec","shellIntegration","sftpStyle","persistence","endOnPageClose"]){let X=(n||{})[V];X!==void 0&&X!==""&&(W[V]=X)}W.sshHosts=Array.isArray(n?.sshHosts)?n.sshHosts:[],W.tunnels=Array.isArray(n?.tunnels)?n.tunnels:[],n?.sftpLimits&&typeof n.sftpLimits=="object"&&(W.sftpLimits={maxDownloadMb:Number(n.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(n.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(n.sftpLimits.maxUploadFiles)||0});try{let V=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(W)}),X=await V.json();!V.ok||!X.ok?l({kind:"error",text:String(X.error||"\u4FDD\u5B58\u5931\u8D25")}):(l({kind:"ok",text:"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548"}),X.config&&(_(X.config),ki(X.config)))}catch(V){l({kind:"error",text:String(V&&V.message?V.message:V)})}c(!1)},me=()=>{if(z===null)return null;let W=(V,X,te,ne)=>h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:V}),o("input",{className:"tt_cardInput",type:ne??"text",value:z[X]??"",placeholder:te??"",autoComplete:"off",spellCheck:!1,onChange:ce=>B(ge=>({...ge||{},[X]:ce.target.value}))})]});return h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_sshGrid",children:[W("\u540D\u79F0","name","\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD"),W("\u7AEF\u53E3","port","22")]}),W("\u4E3B\u673A","host","example.com \u6216 IP"),W("\u7528\u6237\u540D","username","root"),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u8BA4\u8BC1\u65B9\u5F0F"}),h("select",{className:"tt_cardInput",value:z.auth,onChange:V=>B(X=>({...X||{},auth:V.target.value})),children:[o("option",{value:"agent",children:"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent"}),o("option",{value:"key",children:"key \u2014 \u79C1\u94A5\u6587\u4EF6"}),o("option",{value:"password",children:"password \u2014 \u5BC6\u7801"})]})]}),...z.auth==="key"?[W("\u79C1\u94A5\u8DEF\u5F84","keyPath","~/.ssh/id_ed25519"),W("\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF0C\u652F\u6301 env:VAR\uFF09","passphrase","","password")]:[],...z.auth==="password"?[W("\u5BC6\u7801\uFF08\u652F\u6301 env:VAR\uFF09","password","","password")]:[],h("label",{className:"tt_cardRow",children:[o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z.agentForward===!0,onChange:V=>B(X=>({...X||{},agentForward:V.target.checked}))}),o("span",{className:"tt_cardLabel",children:"agent forwarding"})]}),D!==""?o("span",{className:"tt_cardMessage tt_cardMessageError",children:D}):null,h("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_cardSave",onClick:Q,children:"\u5E94\u7528"}),o("button",{type:"button",className:"tt_toolBtn",onClick:j,children:"\u53D6\u6D88"})]})]})},we=(W,V,X,te)=>h("label",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:W}),o("input",{className:"tt_cardInput",value:n[V]??"",placeholder:X??"",onChange:ne=>T(V,ne.target.value)}),te?o("span",{className:"tt_cardHint",children:te}):null]}),fe=(W,V)=>h("label",{className:"tt_cardField tt_cardRow",children:[o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:n[V]===!0,onChange:X=>T(V,X.target.checked)}),o("span",{className:"tt_cardLabel",children:W})]});return h("li",{className:a?"tt_card tt_cardOpen":"tt_card",children:[h("button",{type:"button",className:"tt_cardHeader","aria-expanded":a,onClick:()=>f(W=>!W),children:[h("span",{className:"tt_cardHeadText",children:[o("span",{className:"tt_cardName",children:"\u7EC8\u7AEF\u9762\u677F"}),o("span",{className:"tt_cardDescription",children:"xterm \u7EC8\u7AEF\u9762\u677F\uFF1A\u591A\u6807\u7B7E\u9875\u3001\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\u3001cwd \u8DDF\u968F\u4F1A\u8BDD\u3001SSH \u8FDE\u63A5\u7C3F\u4E0E\u4E3B\u673A\u6307\u7EB9\u9489\u624E\u3001tmux \u4F1A\u8BDD\u6301\u4E45\u5316\uFF1Bshell / TERM / \u5E76\u53D1\u4E0A\u9650\u7B49\u4FDD\u5B58\u5373\u70ED\u751F\u6548\u3002"})]}),o("span",{className:"dshkit_badge",children:"Kit"}),o("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:o("path",{d:r,fill:"currentColor"})})]}),a?h("div",{className:"tt_cardBody",children:[n===null?o("div",{className:"tt_cardMessage",children:"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026"}):h("div",{children:[y("\u57FA\u7840"),fe("\u542F\u7528\u63D2\u4EF6\uFF08\u4FDD\u5B58\u5373\u70ED\u751F\u6548\uFF1A\u5DE5\u5177\u4E0E\u9762\u677F\u5165\u53E3\u7ACB\u523B\u6536\u8D77\uFF0C\u4F1A\u8BDD\u8F6C\u4FDD\u6D3B\uFF09","enabled"),fe("\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","announceToAgent"),fe("shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","shellIntegration"),y("SFTP \u6587\u4EF6\u4F20\u8F93"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C"}),h("select",{className:"tt_cardInput",value:n.sftpStyle==="dual"?"dual":"dialog",onChange:W=>T("sftpStyle",W.target.value),children:[o("option",{value:"dialog",children:"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD"}),o("option",{value:"dual",children:"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20"})]}),o("span",{className:"tt_cardHint",children:"\u53CC\u680F\u5728\u672C\u673A\u4E0E\u8FDC\u7A0B\u4E4B\u95F4\u5BF9\u62F7\u6587\u4EF6\uFF08\u76EE\u5F55\u9012\u5F52\u3001\u540C\u540D\u8986\u76D6\uFF09\uFF1B\u91CD\u65B0\u6253\u5F00 SFTP \u540E\u751F\u6548"})]}),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09"}),h("div",{className:"tt_limitGrid",children:[h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u4E0B\u8F7D\u4E0A\u9650 (MB)"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxDownloadMb))?Number(n.sftpLimits.maxDownloadMb):1024),onChange:W=>I("maxDownloadMb",Number(W.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u4E0A\u4F20\u4E0A\u9650 (MB)"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadMb))?Number(n.sftpLimits.maxUploadMb):2048),onChange:W=>I("maxUploadMb",Number(W.target.value)||0)})]}),h("label",{className:"tt_sshRow",children:[o("span",{className:"tt_cardLabel",children:"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650"}),o("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(n?.sftpLimits?.maxUploadFiles))?Number(n.sftpLimits.maxUploadFiles):1e3),onChange:W=>I("maxUploadFiles",Number(W.target.value)||0)})]})]}),o("span",{className:"tt_cardHint",children:"\u6D4F\u89C8\u5668\u4FA7\u4FDD\u62A4\uFF1A\u5355\u4E2A\u6587\u4EF6\u8D85\u8FC7\u4E0A\u9650\u65F6\u4E2D\u6B62\u4E0B\u8F7D/\u4E0A\u4F20\uFF08\u5927\u6587\u4EF6\u8BF7\u7528\u53CC\u680F \u21E8/\u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync\uFF0C\u4E0D\u5360\u6D4F\u89C8\u5668\u5185\u5B58\uFF09\uFF1B\u6587\u4EF6\u6570\u4E0A\u9650\u9488\u5BF9\u4E00\u6B21\u6279\u91CF/\u62D6\u62FD\u4E0A\u4F20\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"})]}),y("\u4F1A\u8BDD"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09"}),h("select",{className:"tt_cardInput",value:n.persistence==="tmux"?"tmux":"off",onChange:W=>T("persistence",W.target.value),children:[o("option",{value:"off",children:"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09"}),o("option",{value:"tmux",children:"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316"})]}),o("span",{className:"tt_cardHint",children:"\u5F00\u542F\u540E\u6240\u6709\u65B0\u6807\u7B7E\uFF08\u672C\u5730/SSH \u8FDE\u63A5\u7C3F/SSH \u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF09\u9ED8\u8BA4\u7531 tmux \u6258\u7BA1\u3001\u53EF\u8DE8\u5BBF\u4E3B\u91CD\u542F\u6062\u590D\uFF1B\u9700\u672C\u673A/\u8FDC\u7A0B\u5B89\u88C5 tmux\uFF1BSSH \u5BF9\u8BDD\u6846\u53EF\u5BF9\u5355\u6B21\u8FDE\u63A5\u53D6\u6D88\u52FE\u9009\uFF1B\u5DF2\u6709\u6807\u7B7E\u4E0D\u53D7\u5F71\u54CD"}),fe("\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","endOnPageClose"),o("span",{className:"tt_cardHint",children:"\u9ED8\u8BA4\u5173\u95ED\uFF1A\u6574\u4E2A\u9875\u9762\u5173\u95ED\u65F6\u6301\u4E45\u4F1A\u8BDD\u7559\u5B58\uFF08\u4FDD\u6D3B\u671F\u540E\u53EF\u518D\u6062\u590D\uFF09\uFF1B\u5F00\u542F\u5219\u9875\u9762\u65AD\u5F00\u4E14\u4FDD\u6D3B\u671F\u7ED3\u675F\u65F6\u8FDE tmux \u4F1A\u8BDD\u4E00\u8D77\u7ED3\u675F\u2014\u2014\u6CE8\u610F\u5237\u65B0\u9875\u9762\u5728\u4FDD\u6D3B\u671F\u5185\u4E0D\u53D7\u5F71\u54CD"})]}),we("\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","maxSessions","4","\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),h("div",{className:"tt_cardField",onBlur:W=>{W.currentTarget.contains(W.relatedTarget)||w(!1)},children:[o("span",{className:"tt_cardLabel",children:"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09"}),o("input",{className:"tt_cardInput",value:n.shell??"",placeholder:"\u7559\u7A7A\u4F7F\u7528 $SHELL",autoComplete:"off",spellCheck:!1,onFocus:()=>w(!0),onClick:()=>w(!0),onKeyDown:W=>{W.key==="Escape"&&w(!1)},onChange:W=>{T("shell",W.target.value),w(!0)}}),...C?[o("div",{className:"tt_envList tt_shellList",children:(()=>{let W=(n.shell??"").trim().toLowerCase(),V=W===""?u:u.filter(X=>X.toLowerCase().includes(W));return V.length===0?o("span",{className:"tt_envMore",children:"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF"}):V.map(X=>o("button",{type:"button",className:"tt_envItem",onMouseDown:te=>te.preventDefault(),onClick:()=>{T("shell",X),w(!1)},children:X},X))})()},"shell-list")]:[],o("span",{className:"tt_cardHint",children:"\u53EF\u4E0B\u62C9\u9009\u62E9\u672C\u673A\u5DF2\u5B89\u88C5 shell\uFF08$SHELL \u4F18\u5148\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bzsh / bash \u652F\u6301 shell \u96C6\u6210"})]},"shell-field"),we("TERM","term","xterm-256color","TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C"),we("COLORTERM","colorTerm","truecolor",""),we("\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","cwd","","\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55"),we("\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","reconnectGraceSec","120","\u5237\u65B0\u9875\u9762/\u7F51\u7EDC\u6296\u52A8\u540E\u4F1A\u8BDD\u4FDD\u6D3B\u7B49\u5F85\u91CD\u8FDE\uFF0C\u8D85\u65F6\u540E\u7ED3\u675F\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548"),y("SSH \u8FDE\u63A5"),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SSH \u8FDE\u63A5\u7C3F"}),...Array.isArray(n.sshHosts)&&n.sshHosts.length>0?[o("div",{className:"tt_hostList",children:n.sshHosts.map(W=>h("div",{children:[h("div",{className:"tt_sshHostRow",children:[o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:W?.name??""}),o("span",{className:"tt_sshHostTarget",children:As(W??{})})]}),o("button",{type:"button",className:"tt_toolBtn",disabled:P[W?.name]?.running===!0,onClick:()=>{G(W)},title:"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD",children:P[W?.name]?.running===!0?"\u6D4B\u8BD5\u4E2D\u2026":"\u6D4B\u8BD5"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>q(W),children:"\u7F16\u8F91"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>ee(W?.name),children:"\u5220\u9664"})]}),P[W?.name]&&P[W?.name].text?o("div",{className:"tt_sshProbeResult"+(P[W?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:P[W?.name].text}):null,F===W?.name?me():null]},String(W?.name??"")))})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u6761\u76EE \u2014 \u7EC8\u7AEF\u9762\u677F\u300C+\u300D\u2192 SSH \u8FDE\u63A5\u2026 \u52FE\u9009\u300C\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\u300D\u5373\u53EF\u6DFB\u52A0"})],h("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z()},children:"\u4ECE ~/.ssh/config \u5BFC\u5165"}),o("span",{className:"tt_cardHint",children:"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E"})]}),o("span",{className:"tt_cardHint",children:"\u968F\u300C\u4FDD\u5B58\u300D\u4E00\u5E76\u5199\u5165\u914D\u7F6E\uFF1B\u5BC6\u7801/\u53E3\u4EE4\u652F\u6301 env:VAR \u5F15\u7528\uFF0C\u907F\u514D\u660E\u6587\u5165\u5E93"})]}),h("div",{className:"tt_cardField",children:[h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"\u7AEF\u53E3\u8F6C\u53D1"}),...Array.isArray(n.tunnels)&&n.tunnels.length>0?[o("div",{children:n.tunnels.map(W=>{let V=E.find(te=>te.name===W?.name),X=V?.state??"stopped";return h("div",{className:"tt_sshHostRow",children:[o("span",{className:"tt_tunnelDot","data-state":X,title:X}),o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:(W?.name??"")+" \xB7 "+Y(W??{})}),o("span",{className:"tt_sshHostTarget",children:(W?.bookName??"")+(V?.error?" \xB7 "+V.error:"")+(V?.lastForwardError?" \xB7 "+V.lastForwardError:"")})]}),o("input",{type:"checkbox",className:"tt_cardCheckbox",checked:W?.enabled!==!1,title:"\u542F\u7528",onChange:te=>H(W?.name,te.target.checked)}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>N(W?.name),children:"\u5220\u9664"})]},String(W?.name??""))})})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3"})],h("div",{className:"tt_sshEdit",children:[h("div",{className:"tt_cardRow",children:[h("select",{className:"tt_cardInput",value:M.direction,onChange:K("direction"),children:[o("option",{value:"local",children:"\u672C\u5730\u8F6C\u53D1\uFF08-L\uFF09\uFF1A\u672C\u673A\u7AEF\u53E3 \u2192 \u8FDC\u7A0B\u670D\u52A1"}),o("option",{value:"remote",children:"\u8FDC\u7A0B\u8F6C\u53D1\uFF08-R\uFF09\uFF1A\u8FDC\u7A0B\u7AEF\u53E3 \u2192 \u672C\u673A\u670D\u52A1"})]}),h("select",{className:"tt_cardInput",value:M.bookName,onChange:K("bookName"),children:[o("option",{value:"",children:"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE"}),...Array.isArray(n?.sshHosts)?n.sshHosts.map(W=>o("option",{value:W?.name??"",children:W?.name??""})):[]]})]}),o("span",{className:"tt_cardHint",children:U!==void 0?"\u7ECF "+As(U)+" \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE":"\u9009\u62E9\u8FD9\u6761\u96A7\u9053\u8981\u8D70\u54EA\u53F0 SSH \u8FDE\u63A5\uFF08\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8FDE\u63A5\u7C3F\uFF09"}),M.direction==="local"?h("div",{className:"tt_tunnelGridLocal",children:[o("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u7AEF\u53E3",value:M.localPort,autoComplete:"off",onChange:K("localPort")}),o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u4E3B\u673A\uFF08\u4ECE\u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF0C\u5982 db.internal\uFF09",value:M.remoteHost,autoComplete:"off",onChange:K("remoteHost")}),o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:K("remotePort")})]}):h("div",{className:"tt_tunnelGrid",children:[o("input",{className:"tt_cardInput",placeholder:"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3",value:M.remotePort,autoComplete:"off",onChange:K("remotePort")}),o("input",{className:"tt_cardInput",placeholder:"\u672C\u5730\u76EE\u6807\u7AEF\u53E3",value:M.localTargetPort,autoComplete:"off",onChange:K("localTargetPort")})]}),o("div",{className:"tt_cardRow",children:[o("button",{type:"button",className:"tt_cardSave",onClick:k,children:"\u6DFB\u52A0\u96A7\u9053"}),o("span",{className:"tt_cardHint",children:"\u6DFB\u52A0\u540E\u7ACB\u5373\u751F\u6548\uFF1B\u65AD\u7EBF\u81EA\u52A8\u91CD\u8FDE\uFF1B\u672C\u5730\u7AEF\u53E3\u5EFA\u8BAE 1024 \u4EE5\u4E0A\uFF1B\u8FDC\u7A0B\u4E3B\u673A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF08127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09"})]})]})]}),h("div",{className:"tt_cardField",children:[o("span",{className:"tt_cardLabel",children:"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09"}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{oe()},children:"\u4ECE known_hosts \u5BFC\u5165"})]}),...Array.isArray(n.hostKeys)&&n.hostKeys.length>0?[o("div",{className:"tt_hostList",children:n.hostKeys.map(W=>h("div",{className:"tt_sshHostRow",children:[o("div",{className:"tt_sshHostMeta",children:[o("span",{className:"tt_sshHostName",children:String(W?.host??"")+":"+String(W?.port??22)}),o("span",{className:"tt_sshHostTarget",children:"sha256:"+String(W?.fingerprint??"")})]}),o("button",{type:"button",className:"tt_toolBtn",onClick:()=>{J(W)},children:"\u5220\u9664"})]},String(W?.host??"")+":"+String(W?.port??22)))})]:[o("span",{className:"tt_cardHint",children:"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9"})],o("span",{className:"tt_cardHint",children:"\u4E3B\u673A\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF1B\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE"})]}),h("div",{className:"tt_cardField tt_cardRow",children:[o("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ae()},children:p?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"}),o("span",{className:"tt_cardMessage"+(d.kind==="ok"?" tt_cardMessageOk":d.kind==="error"?" tt_cardMessageError":""),children:d.text})]})]})]}):null]})}return t.inject=["slots","sessions"],t.apply=a=>{ga=a.sessions;let f=!1,n=()=>{};wr={set(p){if(p!==f){if(f=p,p){n=iu();return}n(),n=()=>{},Mi(),Lt()}}},ka(!0),qs(),a.slots.inject("settings.plugin.item",()=>a.slots.register({name:"settings.plugin.item",key:"tty",order:100},s));let _=a.provide("ttyConnbar",{version:1,addAction:Mr,requestRender(){Lt()}}),g=a.provide("ttyTerminal",{version:2,open(p){if(!Rt)return;let c=ma(p),d=ba(p,c),l=typeof p?.label=="string"&&p.label!==""?p.label:void 0;Ri(),re===null&&Vs(),xi(d,l)},mount(p,c){return Rt?kd(p,c):()=>{}}}),S=a.provide("ttyPanel",{version:1,isOpen(){return re!==null&&!Ue},mountPane(p){return Ca(p)}});return()=>{wr=null,Rt=!1,n(),S(),g(),_(),Mi()}},t}});})();
|
|
2345
2376
|
/*! Bundled license information:
|
|
2346
2377
|
|
|
2347
2378
|
@xterm/addon-search/lib/addon-search.mjs:
|