@hyzyn/dsh-tty 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +43 -14
- package/README.md +37 -10
- package/client.js +145 -45
- package/lib/index.d.ts +61 -7
- package/lib/index.js +109 -13
- package/lib/index.js.map +1 -1
- package/lib/shell-integration.d.ts +10 -0
- package/lib/shell-integration.js +148 -7
- package/lib/shell-integration.js.map +1 -1
- package/package.json +1 -1
- package/scripts/preview/harness.js +140 -7
- package/scripts/preview/mock-host.js +19 -0
- package/scripts/preview.mjs +11 -1
- package/scripts/pty-kill-probe.cjs +123 -0
- package/scripts/pty-kill-repro-plugin.mjs +72 -0
- package/scripts/pty-kill-repro.mjs +101 -0
- package/scripts/windows-smoke.mjs +97 -2
package/client.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`)))),this.register(this._terminal.onA11yTab((
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(h){this._clearLiveRegion(),/\p{Control}/u.test(h)||this._charsToConsume.push(h)}_refreshRows(h,f){this._liveRegionDebouncer.refresh(h,f,this._terminal.rows)}_renderRows(h,f){let v=this._terminal.buffer,S=v.lines.length.toString();for(let g=h;g<=f;g++){let x=v.lines.get(v.ydisp+g),w=[],E=x?.translateToString(!0,void 0,void 0,w)||"",P=(v.ydisp+g+1).toString(),O=this._rowElements[g];O&&(E.length===0?(O.innerText="\xA0",this._rowColumns.set(O,[0,1])):(O.textContent=E,this._rowColumns.set(O,w)),O.setAttribute("aria-posinset",P),O.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,f){let v=h.target,S=this._rowElements[f===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(f===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==S)return;let g,x;if(f===0?(g=v,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(g=this._rowElements.shift(),x=v,this._rowContainer.removeChild(g)),g.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),f===0){let w=this._createAccessibilityTreeNode();this._rowElements.unshift(w),this._rowContainer.insertAdjacentElement("afterbegin",w)}else{let w=this._createAccessibilityTreeNode();this._rowElements.push(w),this._rowContainer.appendChild(w)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(f===0?-1:1),this._rowElements[f===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let h=document.getSelection();if(!h)return;if(h.isCollapsed)return void(this._rowContainer.contains(h.anchorNode)&&this._terminal.clearSelection());if(!h.anchorNode||!h.focusNode)return void console.error("anchorNode and/or focusNode are null");let f={node:h.anchorNode,offset:h.anchorOffset},v={node:h.focusNode,offset:h.focusOffset};if((f.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||f.node===v.node&&f.offset>v.offset)&&([f,v]=[v,f]),f.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(f={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(f.node))return;let S=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:S,offset:S.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let g=({node:E,offset:P})=>{let O=E instanceof Text?E.parentNode:E,F=parseInt(O?.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(O);if(!A)return console.warn("columns is null. Race condition?"),null;let V=P<A.length?A[P]:A.slice(-1)[0]+1;return V>=this._terminal.cols&&(++F,V=0),{row:F,column:V}},x=g(f),w=g(v);if(x&&w){if(x.row>w.row||x.row===w.row&&x.column>=w.column)throw new Error("invalid range");this._terminal.select(x.column,x.row,(w.row-x.row)*this._terminal.cols-x.column+w.column)}}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let f=this._rowContainer.children.length;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let h=this._coreBrowserService.mainDocument.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_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 h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=u=a([d(1,p.IInstantiationService),d(2,y.ICoreBrowserService),d(3,y.IRenderService)],u)},3614:(n,s)=>{function o(_){return _.replace(/\r?\n/g,"\r")}function a(_,m){return m?"\x1B[200~"+_+"\x1B[201~":_}function d(_,m,y,p){_=a(_=o(_),y.decPrivateModes.bracketedPasteMode&&p.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(_,!0),m.value=""}function l(_,m,y){let p=y.getBoundingClientRect(),c=_.clientX-p.left-10,u=_.clientY-p.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${c}px`,m.style.top=`${u}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=a,s.copyHandler=function(_,m){_.clipboardData&&_.clipboardData.setData("text/plain",m.selectionText),_.preventDefault()},s.handlePasteEvent=function(_,m,y,p){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),m,y,p)},s.paste=d,s.moveTextAreaUnderMouseCursor=l,s.rightClickHandler=function(_,m,y,p,c){l(_,m,y),c&&p.rightClickSelect(_),m.value=p.selectionText,m.select()}},7239:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=o(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(d,l,_){this._css.set(d,l,_)}getCss(d,l){return this._css.get(d,l)}setColor(d,l,_){this._color.set(d,l,_)}getColor(d,l){return this._color.get(d,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,a,d,l){o.addEventListener(a,d,l);let _=!1;return{dispose:()=>{_||(_=!0,o.removeEventListener(a,d,l))}}}},3551:function(n,s,o){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let l=o(3656),_=o(8460),m=o(844),y=o(2585),p=o(4725),c=s.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(u,h,f,v,S){super(),this._element=u,this._mouseService=h,this._renderService=f,this._bufferService=v,this._linkProviderService=S,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,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(u){this._lastMouseEvent=u;let h=this._positionFromMouseEvent(u,this._element,this._mouseService);if(!h)return;this._isMouseOut=!1;let f=u.composedPath();for(let v=0;v<f.length;v++){let S=f[v];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&h.x===this._lastBufferCell.x&&h.y===this._lastBufferCell.y||(this._handleHover(h),this._lastBufferCell=h)}_handleHover(u){if(this._activeLine!==u.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(u,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,u)||(this._clearCurrentLink(),this._askForLink(u,!0))}_askForLink(u,h){this._activeProviderReplies&&h||(this._activeProviderReplies?.forEach((v=>{v?.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=u.y);let f=!1;for(let[v,S]of this._linkProviderService.linkProviders.entries())h?this._activeProviderReplies?.get(v)&&(f=this._checkLinkProviderResult(v,u,f)):S.provideLinks(u.y,(g=>{if(this._isMouseOut)return;let x=g?.map((w=>({link:w})));this._activeProviderReplies?.set(v,x),f=this._checkLinkProviderResult(v,u,f),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(u.y,this._activeProviderReplies)}))}_removeIntersectingLinks(u,h){let f=new Set;for(let v=0;v<h.size;v++){let S=h.get(v);if(S)for(let g=0;g<S.length;g++){let x=S[g],w=x.link.range.start.y<u?0:x.link.range.start.x,E=x.link.range.end.y>u?this._bufferService.cols:x.link.range.end.x;for(let P=w;P<=E;P++){if(f.has(P)){S.splice(g--,1);break}f.add(P)}}}}_checkLinkProviderResult(u,h,f){if(!this._activeProviderReplies)return f;let v=this._activeProviderReplies.get(u),S=!1;for(let g=0;g<u;g++)this._activeProviderReplies.has(g)&&!this._activeProviderReplies.get(g)||(S=!0);if(!S&&v){let g=v.find((x=>this._linkAtPosition(x.link,h)));g&&(f=!0,this._handleNewLink(g))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!f)for(let g=0;g<this._activeProviderReplies.size;g++){let x=this._activeProviderReplies.get(g)?.find((w=>this._linkAtPosition(w.link,h)));if(x){f=!0,this._handleNewLink(x);break}}return f}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(u){if(!this._currentLink)return;let h=this._positionFromMouseEvent(u,this._element,this._mouseService);h&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(u,this._currentLink.link.text)}_clearCurrentLink(u,h){this._currentLink&&this._lastMouseEvent&&(!u||!h||this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=h)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(u){if(!this._lastMouseEvent)return;let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._linkAtPosition(u.link,h)&&(this._currentLink=u,this._currentLink.state={decorations:{underline:u.link.decorations===void 0||u.link.decorations.underline,pointerCursor:u.link.decorations===void 0||u.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,u.link,this._lastMouseEvent),u.link.decorations={},Object.defineProperties(u.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:f=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==f&&(this._currentLink.state.decorations.pointerCursor=f,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",f))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:f=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==f&&(this._currentLink.state.decorations.underline=f,this._currentLink.state.isHovered&&this._fireUnderlineEvent(u.link,f))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((f=>{if(!this._currentLink)return;let v=f.start===0?0:f.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+f.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(v,S),this._lastMouseEvent)){let g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._askForLink(g,!1)}}))))}_linkHover(u,h,f){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&u.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(f,h.text)}_fireUnderlineEvent(u,h){let f=u.range,v=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(f.start.x-1,f.start.y-v-1,f.end.x,f.end.y-v-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(u,h,f){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&u.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(f,h.text)}_linkAtPosition(u,h){let f=u.range.start.y*this._bufferService.cols+u.range.start.x,v=u.range.end.y*this._bufferService.cols+u.range.end.x,S=h.y*this._bufferService.cols+h.x;return f<=S&&S<=v}_positionFromMouseEvent(u,h,f){let v=f.getCoords(u,h,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(u,h,f,v,S){return{x1:u,y1:h,x2:f,y2:v,cols:this._bufferService.cols,fg:S}}};s.Linkifier=c=a([d(1,p.IMouseService),d(2,p.IRenderService),d(3,y.IBufferService),d(4,p.ILinkProviderService)],c)},9042:(n,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(n,s,o){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let l=o(511),_=o(2585),m=s.OscLinkProvider=class{constructor(p,c,u){this._bufferService=p,this._optionsService=c,this._oscLinkService=u}provideLinks(p,c){let u=this._bufferService.buffer.lines.get(p-1);if(!u)return void c(void 0);let h=[],f=this._optionsService.rawOptions.linkHandler,v=new l.CellData,S=u.getTrimmedLength(),g=-1,x=-1,w=!1;for(let E=0;E<S;E++)if(x!==-1||u.hasContent(E)){if(u.loadCell(E,v),v.hasExtendedAttrs()&&v.extended.urlId){if(x===-1){x=E,g=v.extended.urlId;continue}w=v.extended.urlId!==g}else x!==-1&&(w=!0);if(w||x!==-1&&E===S-1){let P=this._oscLinkService.getLinkData(g)?.uri;if(P){let O={start:{x:x+1,y:p},end:{x:E+(w||E!==S-1?0:1),y:p}},F=!1;if(!f?.allowNonHttpProtocols)try{let A=new URL(P);["http:","https:"].includes(A.protocol)||(F=!0)}catch{F=!0}F||h.push({text:P,range:O,activate:(A,V)=>f?f.activate(A,V,O):y(0,V),hover:(A,V)=>f?.hover?.(A,V,O),leave:(A,V)=>f?.leave?.(A,V,O)})}w=!1,v.hasExtendedAttrs()&&v.extended.urlId?(x=E,g=v.extended.urlId):(x=-1,g=-1)}}c(h)}};function y(p,c){if(confirm(`Do you want to navigate to ${c}?
|
|
1
|
+
"use strict";(()=>{var nu=Object.create;var Ta=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var au=Object.getOwnPropertyNames;var lu=Object.getPrototypeOf,cu=Object.prototype.hasOwnProperty;var Ma=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var hu=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of au(t))!cu.call(e,o)&&o!==r&&Ta(e,o,{get:()=>t[o],enumerable:!(i=ou(t,o))||i.enumerable});return e};var Ra=(e,t,r)=>(r=e!=null?nu(lu(e)):{},hu(t||!e||!e.__esModule?Ta(r,"default",{value:e,enumerable:!0}):r,e));var Da=Ma((cs,Ln)=>{(function(e,t){if(typeof cs=="object"&&typeof Ln=="object")Ln.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var i in r)(typeof cs=="object"?cs:e)[i]=r[i]}})(globalThis,(()=>(()=>{"use strict";var e={4567:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;let l=n(9042),d=n(9924),m=n(844),y=n(4725),_=n(2585),c=n(3656),f=s.AccessibilityManager=class extends m.Disposable{constructor(h,p,v,S){super(),this._terminal=h,this._coreBrowserService=v,this._renderService=S,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 b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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 d.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((b=>this._handleResize(b.rows)))),this.register(this._terminal.onRender((b=>this._refreshRows(b.start,b.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((b=>this._handleChar(b)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2
|
+
`)))),this.register(this._terminal.onA11yTab((b=>this._handleTab(b)))),this.register(this._terminal.onKey((b=>this._handleKey(b.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,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(h){for(let p=0;p<h;p++)this._handleChar(" ")}_handleChar(h){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
|
|
3
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(h){this._clearLiveRegion(),/\p{Control}/u.test(h)||this._charsToConsume.push(h)}_refreshRows(h,p){this._liveRegionDebouncer.refresh(h,p,this._terminal.rows)}_renderRows(h,p){let v=this._terminal.buffer,S=v.lines.length.toString();for(let b=h;b<=p;b++){let x=v.lines.get(v.ydisp+b),w=[],E=x?.translateToString(!0,void 0,void 0,w)||"",B=(v.ydisp+b+1).toString(),P=this._rowElements[b];P&&(E.length===0?(P.innerText="\xA0",this._rowColumns.set(P,[0,1])):(P.textContent=E,this._rowColumns.set(P,w)),P.setAttribute("aria-posinset",B),P.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,p){let v=h.target,S=this._rowElements[p===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==S)return;let b,x;if(p===0?(b=v,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(b=this._rowElements.shift(),x=v,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){let w=this._createAccessibilityTreeNode();this._rowElements.unshift(w),this._rowContainer.insertAdjacentElement("afterbegin",w)}else{let w=this._createAccessibilityTreeNode();this._rowElements.push(w),this._rowContainer.appendChild(w)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let h=document.getSelection();if(!h)return;if(h.isCollapsed)return void(this._rowContainer.contains(h.anchorNode)&&this._terminal.clearSelection());if(!h.anchorNode||!h.focusNode)return void console.error("anchorNode and/or focusNode are null");let p={node:h.anchorNode,offset:h.anchorOffset},v={node:h.focusNode,offset:h.focusOffset};if((p.node.compareDocumentPosition(v.node)&Node.DOCUMENT_POSITION_PRECEDING||p.node===v.node&&p.offset>v.offset)&&([p,v]=[v,p]),p.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(p={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(p.node))return;let S=this._rowElements.slice(-1)[0];if(v.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(v={node:S,offset:S.textContent?.length??0}),!this._rowContainer.contains(v.node))return;let b=({node:E,offset:B})=>{let P=E instanceof Text?E.parentNode:E,W=parseInt(P?.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;let A=this._rowColumns.get(P);if(!A)return console.warn("columns is null. Race condition?"),null;let V=B<A.length?A[B]:A.slice(-1)[0]+1;return V>=this._terminal.cols&&(++W,V=0),{row:W,column:V}},x=b(p),w=b(v);if(x&&w){if(x.row>w.row||x.row===w.row&&x.column>=w.column)throw new Error("invalid range");this._terminal.select(x.column,x.row,(w.row-x.row)*this._terminal.cols-x.column+w.column)}}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let h=this._coreBrowserService.mainDocument.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_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 h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=f=a([u(1,_.IInstantiationService),u(2,y.ICoreBrowserService),u(3,y.IRenderService)],f)},3614:(o,s)=>{function n(d){return d.replace(/\r?\n/g,"\r")}function a(d,m){return m?"\x1B[200~"+d+"\x1B[201~":d}function u(d,m,y,_){d=a(d=n(d),y.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(d,!0),m.value=""}function l(d,m,y){let _=y.getBoundingClientRect(),c=d.clientX-_.left-10,f=d.clientY-_.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${c}px`,m.style.top=`${f}px`,m.style.zIndex="1000",m.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=n,s.bracketTextForPaste=a,s.copyHandler=function(d,m){d.clipboardData&&d.clipboardData.setData("text/plain",m.selectionText),d.preventDefault()},s.handlePasteEvent=function(d,m,y,_){d.stopPropagation(),d.clipboardData&&u(d.clipboardData.getData("text/plain"),m,y,_)},s.paste=u,s.moveTextAreaUnderMouseCursor=l,s.rightClickHandler=function(d,m,y,_,c){l(d,m,y),c&&_.rightClickSelect(d),m.value=_.selectionText,m.select()}},7239:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;let a=n(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(u,l,d){this._css.set(u,l,d)}getCss(u,l){return this._css.get(u,l)}setColor(u,l,d){this._color.set(u,l,d)}getColor(u,l){return this._color.get(u,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(n,a,u,l){n.addEventListener(a,u,l);let d=!1;return{dispose:()=>{d||(d=!0,n.removeEventListener(a,u,l))}}}},3551:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,v){var S,b=arguments.length,x=b<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,v);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,v){h(p,v,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;let l=n(3656),d=n(8460),m=n(844),y=n(2585),_=n(4725),c=s.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(f,h,p,v,S){super(),this._element=f,this._mouseService=h,this._renderService=p,this._bufferService=v,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;let h=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!h)return;this._isMouseOut=!1;let p=f.composedPath();for(let v=0;v<p.length;v++){let S=p[v];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&h.x===this._lastBufferCell.x&&h.y===this._lastBufferCell.y||(this._handleHover(h),this._lastBufferCell=h)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,h){this._activeProviderReplies&&h||(this._activeProviderReplies?.forEach((v=>{v?.forEach((S=>{S.link.dispose&&S.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=f.y);let p=!1;for(let[v,S]of this._linkProviderService.linkProviders.entries())h?this._activeProviderReplies?.get(v)&&(p=this._checkLinkProviderResult(v,f,p)):S.provideLinks(f.y,(b=>{if(this._isMouseOut)return;let x=b?.map((w=>({link:w})));this._activeProviderReplies?.set(v,x),p=this._checkLinkProviderResult(v,f,p),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)}))}_removeIntersectingLinks(f,h){let p=new Set;for(let v=0;v<h.size;v++){let S=h.get(v);if(S)for(let b=0;b<S.length;b++){let x=S[b],w=x.link.range.start.y<f?0:x.link.range.start.x,E=x.link.range.end.y>f?this._bufferService.cols:x.link.range.end.x;for(let B=w;B<=E;B++){if(p.has(B)){S.splice(b--,1);break}p.add(B)}}}}_checkLinkProviderResult(f,h,p){if(!this._activeProviderReplies)return p;let v=this._activeProviderReplies.get(f),S=!1;for(let b=0;b<f;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(S=!0);if(!S&&v){let b=v.find((x=>this._linkAtPosition(x.link,h)));b&&(p=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!p)for(let b=0;b<this._activeProviderReplies.size;b++){let x=this._activeProviderReplies.get(b)?.find((w=>this._linkAtPosition(w.link,h)));if(x){p=!0,this._handleNewLink(x);break}}return p}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;let h=this._positionFromMouseEvent(f,this._element,this._mouseService);h&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,h)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,h){this._currentLink&&this._lastMouseEvent&&(!f||!h||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=h)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._linkAtPosition(f.link,h)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:p=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==p&&(this._currentLink.state.decorations.pointerCursor=p,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",p))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:p=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==p&&(this._currentLink.state.decorations.underline=p,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,p))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((p=>{if(!this._currentLink)return;let v=p.start===0?0:p.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+p.end;if(this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(v,S),this._lastMouseEvent)){let b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(f,h,p){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),h.hover&&h.hover(p,h.text)}_fireUnderlineEvent(f,h){let p=f.range,v=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-v-1,p.end.x,p.end.y-v-1,void 0);(h?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(f,h,p){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(h,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),h.leave&&h.leave(p,h.text)}_linkAtPosition(f,h){let p=f.range.start.y*this._bufferService.cols+f.range.start.x,v=f.range.end.y*this._bufferService.cols+f.range.end.x,S=h.y*this._bufferService.cols+h.x;return p<=S&&S<=v}_positionFromMouseEvent(f,h,p){let v=p.getCoords(f,h,this._bufferService.cols,this._bufferService.rows);if(v)return{x:v[0],y:v[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,h,p,v,S){return{x1:f,y1:h,x2:p,y2:v,cols:this._bufferService.cols,fg:S}}};s.Linkifier=c=a([u(1,_.IMouseService),u(2,_.IRenderService),u(3,y.IBufferService),u(4,_.ILinkProviderService)],c)},9042:(o,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(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(v<3?p(S):v>3?p(c,f,S):p(c,f))||S);return v>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;let l=n(511),d=n(2585),m=s.OscLinkProvider=class{constructor(_,c,f){this._bufferService=_,this._optionsService=c,this._oscLinkService=f}provideLinks(_,c){let f=this._bufferService.buffer.lines.get(_-1);if(!f)return void c(void 0);let h=[],p=this._optionsService.rawOptions.linkHandler,v=new l.CellData,S=f.getTrimmedLength(),b=-1,x=-1,w=!1;for(let E=0;E<S;E++)if(x!==-1||f.hasContent(E)){if(f.loadCell(E,v),v.hasExtendedAttrs()&&v.extended.urlId){if(x===-1){x=E,b=v.extended.urlId;continue}w=v.extended.urlId!==b}else x!==-1&&(w=!0);if(w||x!==-1&&E===S-1){let B=this._oscLinkService.getLinkData(b)?.uri;if(B){let P={start:{x:x+1,y:_},end:{x:E+(w||E!==S-1?0:1),y:_}},W=!1;if(!p?.allowNonHttpProtocols)try{let A=new URL(B);["http:","https:"].includes(A.protocol)||(W=!0)}catch{W=!0}W||h.push({text:B,range:P,activate:(A,V)=>p?p.activate(A,V,P):y(0,V),hover:(A,V)=>p?.hover?.(A,V,P),leave:(A,V)=>p?.leave?.(A,V,P)})}w=!1,v.hasExtendedAttrs()&&v.extended.urlId?(x=E,b=v.extended.urlId):(x=-1,b=-1)}}c(h)}};function y(_,c){if(confirm(`Do you want to navigate to ${c}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){let u=window.open();if(u){try{u.opener=null}catch{}u.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=m=a([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],m)},6193:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,a){this._renderCallback=o,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,a,d){this._rowCount=d,o=o!==void 0?o:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 o=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=o(3614),d=o(3656),l=o(3551),_=o(9042),m=o(3730),y=o(1680),p=o(3107),c=o(5744),u=o(2950),h=o(1296),f=o(428),v=o(4269),S=o(5114),g=o(8934),x=o(3230),w=o(9312),E=o(4725),P=o(6731),O=o(8055),F=o(8969),A=o(8460),V=o(844),B=o(6114),R=o(8437),z=o(2584),I=o(7399),C=o(5941),L=o(9074),T=o(2585),D=o(5435),N=o(4567),G=o(779);class j 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(H={}){super(H),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new V.MutableDisposable),this._onCursorMove=this.register(new A.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new A.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new A.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new A.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new A.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new A.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new A.EventEmitter),this._onBlur=this.register(new A.EventEmitter),this._onA11yCharEmitter=this.register(new A.EventEmitter),this._onA11yTabEmitter=this.register(new A.EventEmitter),this._onWillOpen=this.register(new A.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(G.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,W)=>this.refresh(k,W)))),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,A.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,A.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((k=>this._afterResize(k.cols,k.rows)))),this.register((0,V.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(H){if(this._themeService)for(let k of H){let W,q="";switch(k.index){case 256:W="foreground",q="10";break;case 257:W="background",q="11";break;case 258:W="cursor",q="12";break;default:W="ansi",q="4;"+k.index}switch(k.type){case 0:let $=O.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${z.C0.ESC}]${q};${(0,C.toRgbString)($)}${z.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors((X=>X.ansi[k.index]=O.channels.toColor(...k.color)));else{let X=W;this._themeService.modifyColors((J=>J[X]=O.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(H){H?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(H){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.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(z.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 H=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(H);if(!k)return;let W=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,$=k.getWidth(W),X=this._renderService.dimensions.css.cell.width*$,J=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=J+"px",this.textarea.style.width=X+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let H=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,d.addDisposableDomListener)(this.element,"paste",H)),B.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(H=>this._keyUp(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(H=>this._keyDown(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(H=>this._keyPress(H)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(H=>this._compositionHelper.compositionupdate(H)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",(H=>this._inputEvent(H)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(H){if(!H)throw new Error("Terminal requires a parent element.");if(H.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=H.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"),H.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,d.addDisposableDomListener)(this.screenElement,"mousemove",(W=>this.updateCursorStyle(W)))),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(S.CoreBrowserService,this.textarea,H.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",(W=>this._handleTextAreaFocus(W)))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(P.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((W=>this._onRender.fire(W)))),this.onResize((W=>this._renderService.resize(W.cols,W.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(u.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.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(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((W=>this.scrollLines(W.amount,W.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(w.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((W=>this.scrollLines(W.amount,W.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(p.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(W=>this._selectionService.handleMouseDown(W)))),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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(W=>this._handleScreenReaderModeOptionChange(W)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(W=>{!this._overviewRulerRenderer&&W&&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(h.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let H=this,k=this.element;function W(X){let J=H._mouseService.getMouseReportCoords(X,H.screenElement);if(!J)return!1;let ce,de;switch(X.overrideType||X.type){case"mousemove":de=32,X.buttons===void 0?(ce=3,X.button!==void 0&&(ce=X.button<3?X.button:3)):ce=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":de=0,ce=X.button<3?X.button:3;break;case"mousedown":de=1,ce=X.button<3?X.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(X)===!1||H.viewport.getLinesScrolled(X)===0)return!1;de=X.deltaY<0?0:1,ce=4;break;default:return!1}return!(de===void 0||ce===void 0||ce>4)&&H.coreMouseService.triggerMouseEvent({col:J.col,row:J.row,x:J.x,y:J.y,button:ce,action:de,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}let q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:X=>(W(X),X.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(X)),wheel:X=>(W(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&W(X)},mousemove:X=>{X.buttons||W(X)}};this.register(this.coreMouseService.onProtocolChange((X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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&X?q.mousemove||(k.addEventListener("mousemove",$.mousemove),q.mousemove=$.mousemove):(k.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&X?q.wheel||(k.addEventListener("wheel",$.wheel,{passive:!1}),q.wheel=$.wheel):(k.removeEventListener("wheel",q.wheel),q.wheel=null),2&X?q.mouseup||(q.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&X?q.mousedrag||(q.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(k,"mousedown",(X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return W(X),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(X)}))),this.register((0,d.addDisposableDomListener)(k,"wheel",(X=>{if(!q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(X)===!1)return!1;if(!this.buffer.hasScrollback){let J=this.viewport.getLinesScrolled(X);if(J===0)return;let ce=z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B"),de="";for(let me=0;me<Math.abs(J);me++)de+=ce;return this.coreService.triggerDataEvent(de,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(k,"touchstart",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(k,"touchmove",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)}),{passive:!1}))}refresh(H,k){this._renderService?.refreshRows(H,k)}updateCursorStyle(H){this._selectionService?.shouldColumnSelect(H)?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(H,k,W=0){W===1?(super.scrollLines(H,k,W),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(H)}paste(H){(0,a.paste)(H,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(H){this._customKeyEventHandler=H}attachCustomWheelEventHandler(H){this._customWheelEventHandler=H}registerLinkProvider(H){return this._linkProviderService.registerLinkProvider(H)}registerCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(H);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(H)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(H){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+H)}registerDecoration(H){return this._decorationService.registerDecoration(H)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(H,k,W){this._selectionService.setSelection(H,k,W)}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(H,k){this._selectionService?.selectLines(H,k)}_keyDown(H){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&H.altKey;if(!k&&!this._compositionHelper.keydown(H))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||H.key!=="Dead"&&H.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let W=(0,I.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),W.type===3||W.type===2){let q=this.rows-1;return this.scrollLines(W.type===2?-q:q),this.cancel(H,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(W.cancel&&this.cancel(H,!0),!W.key||!!(H.key&&!H.ctrlKey&&!H.altKey&&!H.metaKey&&H.key.length===1&&H.key.charCodeAt(0)>=65&&H.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==z.C0.ETX&&W.key!==z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let W=H.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||H.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||H.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?W:W&&(!k.keyCode||k.keyCode>47)}_keyUp(H){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(H)||this.focus(),this.updateCursorStyle(H),this._keyPressHandled=!1)}_keyPress(H){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;if(this.cancel(H),H.charCode)k=H.charCode;else if(H.which===null||H.which===void 0)k=H.keyCode;else{if(H.which===0||H.charCode===0)return!1;k=H.which}return!(!k||(H.altKey||H.ctrlKey||H.metaKey)&&!this._isThirdLevelShift(this.browser,H)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(H){if(H.data&&H.inputType==="insertText"&&(!H.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=H.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(H),!0}return!1}resize(H,k){H!==this.cols||k!==this.rows?super.resize(H,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(H,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 H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(R.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 H=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(z.C0.ESC+"[I"):this.coreService.triggerDataEvent(z.C0.ESC+"[O")}_reportWindowsOptions(H){if(this._renderService)switch(H){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[4;${W};${k}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let q=this._renderService.dimensions.css.cell.width.toFixed(0),$=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[6;${$};${q}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}s.Terminal=j},9924:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,a=1e3){this._renderCallback=o,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,a,d){this._rowCount=d,o=o!==void 0?o:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let _=l-this._lastRefreshMs,m=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let o=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,a)}}},1680:function(n,s,o){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let l=o(3656),_=o(4725),m=o(8460),y=o(844),p=o(2585),c=s.Viewport=class extends y.Disposable{constructor(u,h,f,v,S,g,x,w){super(),this._viewportElement=u,this._scrollArea=h,this._bufferService=f,this._optionsService=v,this._charSizeService=S,this._renderService=g,this._coreBrowserService=x,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 m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(w.colors),this.register(w.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(u){this._viewportElement.style.backgroundColor=u.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(u){if(u)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 h=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==h&&(this._lastRecordedBufferHeight=h,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==u&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=u),this._refreshAnimationFrame=null}syncScrollArea(u=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(u);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(u)}_handleScroll(u){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 h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let u=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(u*(this._smoothScrollState.target-this._smoothScrollState.origin)),u<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(u,h){let f=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&f<this._lastRecordedBufferHeight)||(u.cancelable&&u.preventDefault(),!1)}handleWheel(u){let h=this._getPixelsScrolled(u);return h!==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+h:this._smoothScrollState.target+=h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=h,this._bubbleScroll(u,h))}scrollLines(u){if(u!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let h=u*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:u,suppressScrollEvent:!1})}_getPixelsScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let h=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(u,h){let f,v="",S=[],g=h??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let w=u;w<g;w++){let E=x.get(w);if(!E)continue;let P=x.get(w+1)?.isWrapped;if(v+=E.translateToString(!P),!P||w===x.length-1){let O=document.createElement("div");O.textContent=v,S.push(O),v.length>0&&(f=O),v=""}}return{bufferElements:S,cursorElement:f}}getLinesScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let h=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(u,h){let f=this._optionsService.rawOptions.fastScrollModifier;return f==="alt"&&h.altKey||f==="ctrl"&&h.ctrlKey||f==="shift"&&h.shiftKey?u*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:u*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(u){this._lastTouchY=u.touches[0].pageY}handleTouchMove(u){let h=this._lastTouchY-u.touches[0].pageY;return this._lastTouchY=u.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(u,h))}};s.Viewport=c=a([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,_.ICharSizeService),d(5,_.IRenderService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],c)},3107:function(n,s,o){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let l=o(4725),_=o(844),m=o(2585),y=s.BufferDecorationRenderer=class extends _.Disposable{constructor(p,c,u,h,f){super(),this._screenElement=p,this._bufferService=c,this._coreBrowserService=u,this._decorationService=h,this._renderService=f,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 u=p.options.x??0;return u&&u>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 u=this._decorationElements.get(p);u||(u=this._createElement(p),p.element=u,this._decorationElements.set(p,u),this._container.appendChild(u),p.onDispose((()=>{this._decorationElements.delete(p),u.remove()}))),u.style.top=c*this._renderService.dimensions.css.cell.height+"px",u.style.display=this._altBufferIsActive?"none":"block",p.onRenderEmitter.fire(u)}}_refreshXPosition(p,c=p.element){if(!c)return;let u=p.options.x??0;(p.options.anchor||"left")==="right"?c.style.right=u?u*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=u?u*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(p){this._decorationElements.get(p)?.remove(),this._decorationElements.delete(p),p.dispose()}};s.BufferDecorationRenderer=y=a([d(1,m.IBufferService),d(2,l.ICoreBrowserService),d(3,m.IDecorationService),d(4,l.IRenderService)],y)},5871:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(let a of this._zones)if(a.color===o.options.overviewRulerOptions.color&&a.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,o.marker.line))return;if(this._lineAdjacentToZone(a,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(a,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,a){return a>=o.startBufferLine&&a<=o.endBufferLine}_lineAdjacentToZone(o,a,d){return a>=o.startBufferLine-this._linePadding[d||"full"]&&a<=o.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(o,a){o.startBufferLine=Math.min(o.startBufferLine,a),o.endBufferLine=Math.max(o.endBufferLine,a)}}},5744:function(n,s,o){var a=this&&this.__decorate||function(f,v,S,g){var x,w=arguments.length,E=w<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,v,S,g);else for(var P=f.length-1;P>=0;P--)(x=f[P])&&(E=(w<3?x(E):w>3?x(v,S,E):x(v,S))||E);return w>3&&E&&Object.defineProperty(v,S,E),E},d=this&&this.__param||function(f,v){return function(S,g){v(S,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let l=o(5871),_=o(4725),m=o(844),y=o(2585),p={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},h=s.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(f,v,S,g,x,w,E){super(),this._viewportElement=f,this._screenElement=v,this._bufferService=S,this._decorationService=g,this._renderService=x,this._optionsService=w,this._coreBrowserService=E,this._colorZoneStore=new l.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 P=this._canvas.getContext("2d");if(!P)throw new Error("Ctx cannot be null");this._ctx=P,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,m.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 f=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=f,c.center=v,c.right=f,this._refreshDrawHeightConstants(),u.full=0,u.left=0,u.center=c.left,u.right=c.left+c.center}_refreshDrawHeightConstants(){p.full=Math.round(2*this._coreBrowserService.dpr);let f=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(f,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 f=this._colorZoneStore.zones;for(let v of f)v.position!=="full"&&this._renderColorZone(v);for(let v of f)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(u[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-p[f.position||"full"]/2),c[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+p[f.position||"full"]))}_queueRefresh(f,v){this._shouldUpdateDimensions=f||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=h=a([d(2,y.IBufferService),d(3,y.IDecorationService),d(4,_.IRenderService),d(5,y.IOptionsService),d(6,_.ICoreBrowserService)],h)},2950:function(n,s,o){var a=this&&this.__decorate||function(p,c,u,h){var f,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,u):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,c,u,h);else for(var g=p.length-1;g>=0;g--)(f=p[g])&&(S=(v<3?f(S):v>3?f(c,u,S):f(c,u))||S);return v>3&&S&&Object.defineProperty(c,u,S),S},d=this&&this.__param||function(p,c){return function(u,h){c(u,h,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let l=o(4725),_=o(2585),m=o(2584),y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(p,c,u,h,f,v){this._textarea=p,this._compositionView=c,this._bufferService=u,this._optionsService=h,this._coreService=f,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 u;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,u=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),u.length>0&&this._coreService.triggerDataEvent(u,!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,u=c.replace(p,"");this._dataAlreadySent=u,c.length>p.length?this._coreService.triggerDataEvent(u,!0):c.length<p.length?this._coreService.triggerDataEvent(`${m.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),u=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,f=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=f+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"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=f+"px",this._textarea.style.top=h+"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)}}};s.CompositionHelper=y=a([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,l.IRenderService)],y)},9806:(n,s)=>{function o(a,d,l){let _=l.getBoundingClientRect(),m=a.getComputedStyle(l),y=parseInt(m.getPropertyValue("padding-left")),p=parseInt(m.getPropertyValue("padding-top"));return[d.clientX-_.left-y,d.clientY-_.top-p]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(a,d,l,_,m,y,p,c,u){if(!y)return;let h=o(a,d,l);return h?(h[0]=Math.ceil((h[0]+(u?p/2:0))/p),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),_+(u?1:0)),h[1]=Math.min(Math.max(h[1],1),m),h):void 0}},9504:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=o(2584);function d(c,u,h,f){let v=c-l(c,h),S=u-l(u,h),g=Math.abs(v-S)-(function(x,w,E){let P=0,O=x-l(x,E),F=w-l(w,E);for(let A=0;A<Math.abs(O-F);A++){let V=_(x,w)==="A"?-1:1;E.buffer.lines.get(O+V*A)?.isWrapped&&P++}return P})(c,u,h);return p(g,y(_(c,u),f))}function l(c,u){let h=0,f=u.buffer.lines.get(c),v=f?.isWrapped;for(;v&&c>=0&&c<u.rows;)h++,f=u.buffer.lines.get(--c),v=f?.isWrapped;return h}function _(c,u){return c>u?"A":"B"}function m(c,u,h,f,v,S){let g=c,x=u,w="";for(;g!==h||x!==f;)g+=v?1:-1,v&&g>S.cols-1?(w+=S.buffer.translateBufferLineToString(x,!1,c,g),g=0,c=0,x++):!v&&g<0&&(w+=S.buffer.translateBufferLineToString(x,!1,0,c+1),g=S.cols-1,c=g,x--);return w+S.buffer.translateBufferLineToString(x,!1,c,g)}function y(c,u){let h=u?"O":"[";return a.C0.ESC+h+c}function p(c,u){c=Math.floor(c);let h="";for(let f=0;f<c;f++)h+=u;return h}s.moveToCellSequence=function(c,u,h,f){let v=h.buffer.x,S=h.buffer.y;if(!h.buffer.hasScrollback)return(function(w,E,P,O,F,A){return d(E,O,F,A).length===0?"":p(m(w,E,w,E-l(E,F),!1,F).length,y("D",A))})(v,S,0,u,h,f)+d(S,u,h,f)+(function(w,E,P,O,F,A){let V;V=d(E,O,F,A).length>0?O-l(O,F):E;let B=O,R=(function(z,I,C,L,T,D){let N;return N=d(C,L,T,D).length>0?L-l(L,T):I,z<C&&N<=L||z>=C&&N<L?"C":"D"})(w,E,P,O,F,A);return p(m(w,V,P,B,R==="C",F).length,y(R,A))})(v,S,c,u,h,f);let g;if(S===u)return g=v>c?"D":"C",p(Math.abs(v-c),y(g,f));g=S>u?"D":"C";let x=Math.abs(S-u);return p((function(w,E){return E.cols-w})(S>u?c:v,h)+(x-1)*h.cols+1+((S>u?v:c)-1),y(g,f))}},1296:function(n,s,o){var a=this&&this.__decorate||function(A,V,B,R){var z,I=arguments.length,C=I<3?V:R===null?R=Object.getOwnPropertyDescriptor(V,B):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(A,V,B,R);else for(var L=A.length-1;L>=0;L--)(z=A[L])&&(C=(I<3?z(C):I>3?z(V,B,C):z(V,B))||C);return I>3&&C&&Object.defineProperty(V,B,C),C},d=this&&this.__param||function(A,V){return function(B,R){V(B,R,A)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let l=o(3787),_=o(2550),m=o(2223),y=o(6171),p=o(6052),c=o(4725),u=o(8055),h=o(8460),f=o(844),v=o(2585),S="xterm-dom-renderer-owner-",g="xterm-rows",x="xterm-fg-",w="xterm-bg-",E="xterm-focus",P="xterm-selection",O=1,F=s.DomRenderer=class extends f.Disposable{constructor(A,V,B,R,z,I,C,L,T,D,N,G,j){super(),this._terminal=A,this._document=V,this._element=B,this._screenElement=R,this._viewportElement=z,this._helperContainer=I,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=N,this._coreBrowserService=G,this._themeService=j,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,p.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new h.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(g),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(P),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Y=>this._injectCss(Y)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Y=>this._handleLinkHover(Y)))),this.register(this._linkifier2.onHideLinkUnderline((Y=>this._handleLinkLeave(Y)))),this.register((0,f.toDisposable)((()=>{this._element.classList.remove(S+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 A=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*A,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*A),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/A),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/A),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 V=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=V,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(A){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let V=`${this._terminalSelector} .${g} { color: ${A.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;V+=`${this._terminalSelector} .${g} .xterm-dim { color: ${u.color.multiplyOpacity(A.foreground,.5).css};}`,V+=`${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}`,R=`blink_bar_${this._terminalClass}`,z=`blink_block_${this._terminalClass}`;V+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${R} { 50% { box-shadow: none; }}`,V+=`@keyframes ${z} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,V+=`${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${R} 1s step-end infinite;}${this._terminalSelector} .${g}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,V+=`${this._terminalSelector} .${P} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${P} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${P} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(let[I,C]of A.ansi.entries())V+=`${this._terminalSelector} .${x}${I} { color: ${C.css}; }${this._terminalSelector} .${x}${I}.xterm-dim { color: ${u.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${w}${I} { background-color: ${C.css}; }`;V+=`${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(A.background).css}; }${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${w}${m.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=V}_setDefaultSpacing(){let A=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${A}px`,this._rowFactory.defaultSpacing=A}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(A,V){for(let B=this._rowElements.length;B<=V;B++){let R=this._document.createElement("div");this._rowContainer.appendChild(R),this._rowElements.push(R)}for(;this._rowElements.length>V;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,V){this._refreshRowElements(A,V),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,V,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,V,B),this.renderRows(0,this._bufferService.rows-1),!A||!V)return;this._selectionRenderModel.update(this._terminal,A,V,B);let R=this._selectionRenderModel.viewportStartRow,z=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||C<0)return;let L=this._document.createDocumentFragment();if(B){let T=A[0]>V[0];L.appendChild(this._createSelectionElement(I,T?V[0]:A[0],T?A[0]:V[0],C-I+1))}else{let T=R===I?A[0]:0,D=I===z?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,T,D));let N=C-I-1;if(L.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,N)),I!==C){let G=z===C?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,G))}}this._selectionContainer.appendChild(L)}_createSelectionElement(A,V,B,R=1){let z=this._document.createElement("div"),I=V*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(B-V);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),z.style.height=R*this.dimensions.css.cell.height+"px",z.style.top=A*this.dimensions.css.cell.height+"px",z.style.left=`${I}px`,z.style.width=`${C}px`,z}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 A of this._rowElements)A.replaceChildren()}renderRows(A,V){let B=this._bufferService.buffer,R=B.ybase+B.y,z=Math.min(B.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=A;T<=V;T++){let D=T+B.ydisp,N=this._rowElements[T],G=B.lines.get(D);if(!N||!G)break;N.replaceChildren(...this._rowFactory.createRow(G,D,D===R,C,L,z,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${this._terminalClass}`}_handleLinkHover(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!0)}_handleLinkLeave(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!1)}_setCellUnderline(A,V,B,R,z,I){B<0&&(A=0),R<0&&(V=0);let C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),R=Math.max(Math.min(R,C),0),z=Math.min(z,this._bufferService.cols);let L=this._bufferService.buffer,T=L.ybase+L.y,D=Math.min(L.x,z-1),N=this._optionsService.rawOptions.cursorBlink,G=this._optionsService.rawOptions.cursorStyle,j=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=B;Y<=R;++Y){let H=Y+L.ydisp,k=this._rowElements[Y],W=L.lines.get(H);if(!k||!W)break;k.replaceChildren(...this._rowFactory.createRow(W,H,H===T,G,j,D,N,this.dimensions.css.cell.width,this._widthCache,I?Y===B?A:0:-1,I?(Y===R?V:z)-1:-1))}}};s.DomRenderer=F=a([d(7,v.IInstantiationService),d(8,c.ICharSizeService),d(9,v.IOptionsService),d(10,v.IBufferService),d(11,c.ICoreBrowserService),d(12,c.IThemeService)],F)},3787:function(n,s,o){var a=this&&this.__decorate||function(g,x,w,E){var P,O=arguments.length,F=O<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(g,x,w,E);else for(var A=g.length-1;A>=0;A--)(P=g[A])&&(F=(O<3?P(F):O>3?P(x,w,F):P(x,w))||F);return O>3&&F&&Object.defineProperty(x,w,F),F},d=this&&this.__param||function(g,x){return function(w,E){x(w,E,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let l=o(2223),_=o(643),m=o(511),y=o(2585),p=o(8055),c=o(4725),u=o(4269),h=o(6171),f=o(3734),v=s.DomRendererRowFactory=class{constructor(g,x,w,E,P,O,F){this._document=g,this._characterJoinerService=x,this._optionsService=w,this._coreBrowserService=E,this._coreService=P,this._decorationService=O,this._themeService=F,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(g,x,w){this._selectionStart=g,this._selectionEnd=x,this._columnSelectMode=w}createRow(g,x,w,E,P,O,F,A,V,B,R){let z=[],I=this._characterJoinerService.getJoinedCharacters(x),C=this._themeService.colors,L,T=g.getNoBgTrimmedLength();w&&T<O+1&&(T=O+1);let D=0,N="",G=0,j=0,Y=0,H=!1,k=0,W=!1,q=0,$=[],X=B!==-1&&R!==-1;for(let J=0;J<T;J++){g.loadCell(J,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let de=!1,me=J,te=this._workCell;if(I.length>0&&J===I[0][0]){de=!0;let he=I.shift();te=new u.JoinedCellData(this._workCell,g.translateToString(!0,he[0],he[1]),he[1]-he[0]),me=he[1]-1,ce=te.getWidth()}let Be=this._isCellInSelection(J,x),fe=w&&J===O,Oe=X&&J>=B&&J<=R,We=!1;this._decorationService.forEachDecorationAtCell(J,x,void 0,(he=>{We=!0}));let ke=te.getChars()||_.WHITESPACE_CELL_CHAR;if(ke===" "&&(te.isUnderline()||te.isOverline())&&(ke="\xA0"),q=ce*A-V.get(ke,te.isBold(),te.isItalic()),L){if(D&&(Be&&W||!Be&&!W&&te.bg===G)&&(Be&&W&&C.selectionForeground||te.fg===j)&&te.extended.ext===Y&&Oe===H&&q===k&&!fe&&!de&&!We){te.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=ke,D++;continue}D&&(L.textContent=N),L=this._document.createElement("span"),D=0,N=""}else L=this._document.createElement("span");if(G=te.bg,j=te.fg,Y=te.extended.ext,H=Oe,k=q,W=Be,de&&O>=J&&O<=me&&(O=J),!this._coreService.isCursorHidden&&fe&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&$.push("xterm-cursor-blink"),$.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(P)switch(P){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline")}}if(te.isBold()&&$.push("xterm-bold"),te.isItalic()&&$.push("xterm-italic"),te.isDim()&&$.push("xterm-dim"),N=te.isInvisible()?_.WHITESPACE_CELL_CHAR:te.getChars()||_.WHITESPACE_CELL_CHAR,te.isUnderline()&&($.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N="\xA0"),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let he=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&he<8&&(he+=8),L.style.textDecorationColor=C.ansi[he].css}te.isOverline()&&($.push("xterm-overline"),N===" "&&(N="\xA0")),te.isStrikethrough()&&$.push("xterm-strikethrough"),Oe&&(L.style.textDecoration="underline");let ee=te.getFgColor(),pe=te.getFgColorMode(),ve=te.getBgColor(),Z=te.getBgColorMode(),re=!!te.isInverse();if(re){let he=ee;ee=ve,ve=he;let ye=pe;pe=Z,Z=ye}let ne,oe,ie,ae=!1;switch(this._decorationService.forEachDecorationAtCell(J,x,void 0,(he=>{he.options.layer!=="top"&&ae||(he.backgroundColorRGB&&(Z=50331648,ve=he.backgroundColorRGB.rgba>>8&16777215,ne=he.backgroundColorRGB),he.foregroundColorRGB&&(pe=50331648,ee=he.foregroundColorRGB.rgba>>8&16777215,oe=he.foregroundColorRGB),ae=he.options.layer==="top")})),!ae&&Be&&(ne=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ve=ne.rgba>>8&16777215,Z=50331648,ae=!0,C.selectionForeground&&(pe=50331648,ee=C.selectionForeground.rgba>>8&16777215,oe=C.selectionForeground)),ae&&$.push("xterm-decoration-top"),Z){case 16777216:case 33554432:ie=C.ansi[ve],$.push(`xterm-bg-${ve}`);break;case 50331648:ie=p.channels.toColor(ve>>16,ve>>8&255,255&ve),this._addStyle(L,`background-color:#${S((ve>>>0).toString(16),"0",6)}`);break;default:re?(ie=C.foreground,$.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):ie=C.background}switch(ne||te.isDim()&&(ne=p.color.multiplyOpacity(ie,.5)),pe){case 16777216:case 33554432:te.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(L,ie,C.ansi[ee],te,ne,void 0)||$.push(`xterm-fg-${ee}`);break;case 50331648:let he=p.channels.toColor(ee>>16&255,ee>>8&255,255&ee);this._applyMinimumContrast(L,ie,he,te,ne,oe)||this._addStyle(L,`color:#${S(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,ie,C.foreground,te,ne,oe)||re&&$.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}$.length&&(L.className=$.join(" "),$.length=0),fe||de||We?L.textContent=N:D++,q!==this.defaultSpacing&&(L.style.letterSpacing=`${q}px`),z.push(L),J=me}return L&&D&&(L.textContent=N),z}_applyMinimumContrast(g,x,w,E,P,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let F=this._getContrastCache(E),A;if(P||O||(A=F.getColor(x.rgba,w.rgba)),A===void 0){let V=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);A=p.color.ensureContrastRatio(P||x,O||w,V),F.setColor((P||x).rgba,(O||w).rgba,A??null)}return!!A&&(this._addStyle(g,`color:${A.css}`),!0)}_getContrastCache(g){return g.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(g,x){g.setAttribute("style",`${g.getAttribute("style")||""}${x};`)}_isCellInSelection(g,x){let w=this._selectionStart,E=this._selectionEnd;return!(!w||!E)&&(this._columnSelectMode?w[0]<=E[0]?g>=w[0]&&x>=w[1]&&g<E[0]&&x<=E[1]:g<w[0]&&x>=w[1]&&g>=E[0]&&x<=E[1]:x>w[1]&&x<E[1]||w[1]===E[1]&&x===w[1]&&g>=w[0]&&g<E[0]||w[1]<E[1]&&x===E[1]&&g<E[0]||w[1]<E[1]&&x===w[1]&&g>=w[0])}};function S(g,x,w){for(;g.length<w;)g=x+g;return g}s.DomRendererRowFactory=v=a([d(1,c.ICharacterJoinerService),d(2,y.IOptionsService),d(3,c.ICoreBrowserService),d(4,y.ICoreService),d(5,y.IDecorationService),d(6,c.IThemeService)],v)},2550:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let d=o.createElement("span");d.classList.add("xterm-char-measure-element");let l=o.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";let m=o.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[d,l,_,m],this._container.appendChild(d),this._container.appendChild(l),this._container.appendChild(_),this._container.appendChild(m),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(o,a,d,l){o===this._font&&a===this._fontSize&&d===this._weight&&l===this._weightBold||(this._font=o,this._fontSize=a,this._weight=d,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(o,a,d){let l=0;if(!a&&!d&&o.length===1&&(l=o.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let y=this._measure(o,0);return y>0&&(this._flat[l]=y),y}let _=o;a&&(_+="B"),d&&(_+="I");let m=this._holey.get(_);if(m===void 0){let y=0;a&&(y|=1),d&&(y|=2),m=this._measure(o,y),m>0&&this._holey.set(_,m)}return m}_measure(o,a){let d=this._measureElements[a];return d.textContent=o.repeat(32),d.offsetWidth/32}}},2223:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(n,s)=>{function o(d){return 57508<=d&&d<=57558}function a(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=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(d){if(!d)throw new Error("value must not be falsy");return d},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},s.isEmoji=a,s.allowRescaling=function(d,l,_,m){return l===1&&_>Math.ceil(1.5*m)&&d!==void 0&&d>255&&!a(d)&&!o(d)&&!(function(y){return 57344<=y&&y<=63743})(d)},s.treatGlyphAsBackgroundColor=function(d){return o(d)||(function(l){return 9472<=l&&l<=9631})(d)},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(d,l,_=0){return(d-(2*Math.round(l)-_))%(2*Math.round(l))}},6052:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(d,l,_,m=!1){if(this.selectionStart=l,this.selectionEnd=_,!l||!_||l[0]===_[0]&&l[1]===_[1])return void this.clear();let y=d.buffers.active.ydisp,p=l[1]-y,c=_[1]-y,u=Math.max(p,0),h=Math.min(c,d.rows-1);u>=d.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=p,this.viewportEndRow=c,this.viewportCappedStartRow=u,this.viewportCappedEndRow=h,this.startCol=l[0],this.endCol=_[0])}isCellSelected(d,l,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&_>=this.viewportCappedStartRow&&l<this.endCol&&_<=this.viewportCappedEndRow:l<this.startCol&&_>=this.viewportCappedStartRow&&l>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&l>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let o=this.selectionStart,a=this.selectionEnd;return!(!o||!a)&&(o[1]>a[1]||o[1]===a[1]&&o[0]>a[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let l=o(2585),_=o(8460),m=o(844),y=s.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(h,f,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 u(this._optionsService))}catch{this._measureStrategy=this.register(new c(h,f,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let h=this._measureStrategy.measure();h.width===this.width&&h.height===this.height||(this.width=h.width,this.height=h.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=a([d(2,l.IOptionsService)],y);class p extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(f,v){f!==void 0&&f>0&&v!==void 0&&v>0&&(this._result.width=f,this._result.height=v)}}class c extends p{constructor(f,v,S){super(),this._document=f,this._parentElement=v,this._optionsService=S,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 u extends p{constructor(f){super(),this._optionsService=f,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 f=this._ctx.measureText("W");return this._validateAndSet(f.width,f.fontBoundingBoxAscent+f.fontBoundingBoxDescent),this._result}}},4269:function(n,s,o){var a=this&&this.__decorate||function(u,h,f,v){var S,g=arguments.length,x=g<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(u,h,f,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(x=(g<3?S(x):g>3?S(h,f,x):S(h,f))||x);return g>3&&x&&Object.defineProperty(h,f,x),x},d=this&&this.__param||function(u,h){return function(f,v){h(f,v,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let l=o(3734),_=o(643),m=o(511),y=o(2585);class p extends l.AttributeData{constructor(h,f,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=f,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(h){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=p;let c=s.CharacterJoinerService=class La{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(h){let f={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(f),f.id}deregister(h){for(let f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===h)return this._characterJoiners.splice(f,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];let f=this._bufferService.buffer.lines.get(h);if(!f||f.length===0)return[];let v=[],S=f.translateToString(!0),g=0,x=0,w=0,E=f.getFg(0),P=f.getBg(0);for(let O=0;O<f.getTrimmedLength();O++)if(f.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==P){if(O-g>1){let F=this._getJoinedRanges(S,w,x,f,g);for(let A=0;A<F.length;A++)v.push(F[A])}g=O,w=x,E=this._workCell.fg,P=this._workCell.bg}x+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-g>1){let O=this._getJoinedRanges(S,w,x,f,g);for(let F=0;F<O.length;F++)v.push(O[F])}return v}_getJoinedRanges(h,f,v,S,g){let x=h.substring(f,v),w=[];try{w=this._characterJoiners[0].handler(x)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{let P=this._characterJoiners[E].handler(x);for(let O=0;O<P.length;O++)La._mergeRanges(w,P[O])}catch(P){console.error(P)}return this._stringRangesToCellRanges(w,S,g),w}_stringRangesToCellRanges(h,f,v){let S=0,g=!1,x=0,w=h[S];if(w){for(let E=v;E<this._bufferService.cols;E++){let P=f.getWidth(E),O=f.getString(E).length||_.WHITESPACE_CELL_CHAR.length;if(P!==0){if(!g&&w[0]<=x&&(w[0]=E,g=!0),w[1]<=x){if(w[1]=E,w=h[++S],!w)break;w[0]<=x?(w[0]=E,g=!0):g=!1}x+=O}}w&&(w[1]=this._bufferService.cols)}}static _mergeRanges(h,f){let v=!1;for(let S=0;S<h.length;S++){let g=h[S];if(v){if(f[1]<=g[0])return h[S-1][1]=f[1],h;if(f[1]<=g[1])return h[S-1][1]=Math.max(f[1],g[1]),h.splice(S,1),h;h.splice(S,1),S--}else{if(f[1]<=g[0])return h.splice(S,0,f),h;if(f[1]<=g[1])return g[0]=Math.min(f[0],g[0]),h;f[0]<g[1]&&(g[0]=Math.min(f[0],g[0]),v=!0)}}return v?h[h.length-1][1]=f[1]:h.push(f),h}};s.CharacterJoinerService=c=a([d(0,y.IBufferService)],c)},5114:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=o(844),d=o(8460),l=o(3656);class _ extends a.Disposable{constructor(p,c,u){super(),this._textarea=p,this._window=c,this.mainDocument=u,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((h=>this._screenDprMonitor.setWindow(h)))),this.register((0,d.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 m extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new d.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,l.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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=o(844);class d extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{let m=this.linkProviders.indexOf(_);m!==-1&&this.linkProviders.splice(m,1)}}}}s.LinkProviderService=d},8934:function(n,s,o){var a=this&&this.__decorate||function(y,p,c,u){var h,f=arguments.length,v=f<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,c):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(y,p,c,u);else for(var S=y.length-1;S>=0;S--)(h=y[S])&&(v=(f<3?h(v):f>3?h(p,c,v):h(p,c))||v);return f>3&&v&&Object.defineProperty(p,c,v),v},d=this&&this.__param||function(y,p){return function(c,u){p(c,u,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let l=o(4725),_=o(9806),m=s.MouseService=class{constructor(y,p){this._renderService=y,this._charSizeService=p}getCoords(y,p,c,u,h){return(0,_.getCoords)(window,y,p,c,u,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,p){let c=(0,_.getCoordsRelativeToElement)(window,y,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=m=a([d(0,l.IRenderService),d(1,l.ICharSizeService)],m)},3230:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let l=o(6193),_=o(4725),m=o(8460),y=o(844),p=o(7226),c=o(2585),u=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(h,f,v,S,g,x,w,E){super(),this._rowCount=h,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new p.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer(((P,O)=>this._renderRows(P,O)),w),this.register(this._renderDebouncer),this.register(w.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(x.onResize((()=>this._fullRefresh()))),this.register(x.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(v.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(g.onDecorationRegistered((()=>this._fullRefresh()))),this.register(g.onDecorationRemoved((()=>this._fullRefresh()))),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(x.cols,x.rows),this._fullRefresh()}))),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(x.buffer.y,x.buffer.y,!0)))),this.register(E.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(w.window,f),this.register(w.onWindowChange((P=>this._registerIntersectionObserver(P,f))))}_registerIntersectionObserver(h,f){if("IntersectionObserver"in h){let v=new h.IntersectionObserver((S=>this._handleIntersectionChange(S[S.length-1])),{threshold:0});v.observe(f),this._observerDisposable.value=(0,y.toDisposable)((()=>v.disconnect()))}}_handleIntersectionChange(h){this._isPaused=h.isIntersecting===void 0?h.intersectionRatio===0:!h.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(h,f,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(h,f,this._rowCount))}_renderRows(h,f){this._renderer.value&&(h=Math.min(h,this._rowCount-1),f=Math.min(f,this._rowCount-1),this._renderer.value.renderRows(h,f),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:h,end:f}),this._onRender.fire({start:h,end:f}),this._isNextRenderRedrawOnly=!0)}resize(h,f){this._rowCount=f,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(h){this._renderer.value=h,this._renderer.value&&(this._renderer.value.onRequestRedraw((f=>this.refreshRows(f.start,f.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(h){return this._renderDebouncer.addRefreshCallback(h)}_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(h,f){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(h,f))):this._renderer.value.handleResize(h,f),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(h,f,v){this._selectionState.start=h,this._selectionState.end=f,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(h,f,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=u=a([d(2,c.IOptionsService),d(3,_.ICharSizeService),d(4,c.IDecorationService),d(5,c.IBufferService),d(6,_.ICoreBrowserService),d(7,_.IThemeService)],u)},9312:function(n,s,o){var a=this&&this.__decorate||function(w,E,P,O){var F,A=arguments.length,V=A<3?E:O===null?O=Object.getOwnPropertyDescriptor(E,P):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(w,E,P,O);else for(var B=w.length-1;B>=0;B--)(F=w[B])&&(V=(A<3?F(V):A>3?F(E,P,V):F(E,P))||V);return A>3&&V&&Object.defineProperty(E,P,V),V},d=this&&this.__param||function(w,E){return function(P,O){E(P,O,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let l=o(9806),_=o(9504),m=o(456),y=o(4725),p=o(8460),c=o(844),u=o(6114),h=o(4841),f=o(511),v=o(2585),S="\xA0",g=new RegExp(S,"g"),x=s.SelectionService=class extends c.Disposable{constructor(w,E,P,O,F,A,V,B,R){super(),this._element=w,this._screenElement=E,this._linkifier=P,this._bufferService=O,this._coreService=F,this._mouseService=A,this._optionsService=V,this._renderService=B,this._coreBrowserService=R,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.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=z=>this._handleMouseMove(z),this._mouseUpListener=z=>this._handleMouseUp(z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((z=>this._handleTrim(z))),this.register(this._bufferService.buffers.onBufferActivate((z=>this._handleBufferActivate(z)))),this.enable(),this._model=new m.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 w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!w||!E||w[0]===E[0]&&w[1]===E[1])}get selectionText(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!w||!E)return"";let P=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(w[0]===E[0])return"";let F=w[0]<E[0]?w[0]:E[0],A=w[0]<E[0]?E[0]:w[0];for(let V=w[1];V<=E[1];V++){let B=P.translateBufferLineToString(V,!0,F,A);O.push(B)}}else{let F=w[1]===E[1]?E[0]:void 0;O.push(P.translateBufferLineToString(w[1],!0,w[0],F));for(let A=w[1]+1;A<=E[1]-1;A++){let V=P.lines.get(A),B=P.translateBufferLineToString(A,!0);V?.isWrapped?O[O.length-1]+=B:O.push(B)}if(w[1]!==E[1]){let A=P.lines.get(E[1]),V=P.translateBufferLineToString(E[1],!0,0,E[0]);A&&A.isWrapped?O[O.length-1]+=V:O.push(V)}}return O.map((F=>F.replace(g," "))).join(u.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){let f=window.open();if(f){try{f.opener=null}catch{}f.location.href=c}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=m=a([u(0,d.IBufferService),u(1,d.IOptionsService),u(2,d.IOscLinkService)],m)},6193:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(n,a){this._renderCallback=n,this._coreBrowserService=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(n){return this._refreshCallbacks.push(n),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let n of this._refreshCallbacks)n(0);this._refreshCallbacks=[]}}},3236:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;let a=n(3614),u=n(3656),l=n(3551),d=n(9042),m=n(3730),y=n(1680),_=n(3107),c=n(5744),f=n(2950),h=n(1296),p=n(428),v=n(4269),S=n(5114),b=n(8934),x=n(3230),w=n(9312),E=n(4725),B=n(6731),P=n(8055),W=n(8969),A=n(8460),V=n(844),O=n(6114),R=n(8437),F=n(2584),I=n(7399),C=n(5941),L=n(9074),T=n(2585),D=n(5435),N=n(4567),G=n(779);class $ extends W.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(H={}){super(H),this.browser=O,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new V.MutableDisposable),this._onCursorMove=this.register(new A.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new A.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new A.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new A.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new A.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new A.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new A.EventEmitter),this._onBlur=this.register(new A.EventEmitter),this._onA11yCharEmitter=this.register(new A.EventEmitter),this._onA11yTabEmitter=this.register(new A.EventEmitter),this._onWillOpen=this.register(new A.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(G.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((k,j)=>this.refresh(k,j)))),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,A.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,A.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((k=>this._afterResize(k.cols,k.rows)))),this.register((0,V.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(H){if(this._themeService)for(let k of H){let j,q="";switch(k.index){case 256:j="foreground",q="10";break;case 257:j="background",q="11";break;case 258:j="cursor",q="12";break;default:j="ansi",q="4;"+k.index}switch(k.type){case 0:let U=P.color.toColorRGB(j==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[j]);this.coreService.triggerDataEvent(`${F.C0.ESC}]${q};${(0,C.toRgbString)(U)}${F.C1_ESCAPED.ST}`);break;case 1:if(j==="ansi")this._themeService.modifyColors((J=>J.ansi[k.index]=P.channels.toColor(...k.color)));else{let J=j;this._themeService.modifyColors((Z=>Z[J]=P.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(H){H?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(H){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.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(F.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 H=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(H);if(!k)return;let j=Math.min(this.buffer.x,this.cols-1),q=this._renderService.dimensions.css.cell.height,U=k.getWidth(j),J=this._renderService.dimensions.css.cell.width*U,Z=this.buffer.y*this._renderService.dimensions.css.cell.height,se=j*this._renderService.dimensions.css.cell.width;this.textarea.style.left=se+"px",this.textarea.style.top=Z+"px",this.textarea.style.width=J+"px",this.textarea.style.height=q+"px",this.textarea.style.lineHeight=q+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,u.addDisposableDomListener)(this.element,"copy",(k=>{this.hasSelection()&&(0,a.copyHandler)(k,this._selectionService)})));let H=k=>(0,a.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,u.addDisposableDomListener)(this.textarea,"paste",H)),this.register((0,u.addDisposableDomListener)(this.element,"paste",H)),O.isFirefox?this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(k=>{k.button===2&&(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,u.addDisposableDomListener)(this.element,"contextmenu",(k=>{(0,a.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),O.isLinux&&this.register((0,u.addDisposableDomListener)(this.element,"auxclick",(k=>{k.button===1&&(0,a.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,u.addDisposableDomListener)(this.textarea,"keyup",(H=>this._keyUp(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keydown",(H=>this._keyDown(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"keypress",(H=>this._keyPress(H)),!0)),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionupdate",(H=>this._compositionHelper.compositionupdate(H)))),this.register((0,u.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,u.addDisposableDomListener)(this.textarea,"input",(H=>this._inputEvent(H)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(H){if(!H)throw new Error("Terminal requires a parent element.");if(H.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=H.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"),H.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,u.addDisposableDomListener)(this.screenElement,"mousemove",(j=>this.updateCursorStyle(j)))),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",d.promptLabel),O.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(S.CoreBrowserService,this.textarea,H.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,u.addDisposableDomListener)(this.textarea,"focus",(j=>this._handleTextAreaFocus(j)))),this.register((0,u.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(v.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((j=>this._onRender.fire(j)))),this.onResize((j=>this._renderService.resize(j.cols,j.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.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(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((j=>this.scrollLines(j.amount,j.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(w.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((j=>this.scrollLines(j.amount,j.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((j=>this._renderService.handleSelectionChanged(j.start,j.end,j.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((j=>{this.textarea.value=j,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((j=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,u.addDisposableDomListener)(this.element,"mousedown",(j=>this._selectionService.handleMouseDown(j)))),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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(j=>this._handleScreenReaderModeOptionChange(j)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(c.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(j=>{!this._overviewRulerRenderer&&j&&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(h.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let H=this,k=this.element;function j(J){let Z=H._mouseService.getMouseReportCoords(J,H.screenElement);if(!Z)return!1;let se,he;switch(J.overrideType||J.type){case"mousemove":he=32,J.buttons===void 0?(se=3,J.button!==void 0&&(se=J.button<3?J.button:3)):se=1&J.buttons?0:4&J.buttons?1:2&J.buttons?2:3;break;case"mouseup":he=0,se=J.button<3?J.button:3;break;case"mousedown":he=1,se=J.button<3?J.button:3;break;case"wheel":if(H._customWheelEventHandler&&H._customWheelEventHandler(J)===!1||H.viewport.getLinesScrolled(J)===0)return!1;he=J.deltaY<0?0:1,se=4;break;default:return!1}return!(he===void 0||se===void 0||se>4)&&H.coreMouseService.triggerMouseEvent({col:Z.col,row:Z.row,x:Z.x,y:Z.y,button:se,action:he,ctrl:J.ctrlKey,alt:J.altKey,shift:J.shiftKey})}let q={mouseup:null,wheel:null,mousedrag:null,mousemove:null},U={mouseup:J=>(j(J),J.buttons||(this._document.removeEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.removeEventListener("mousemove",q.mousedrag)),this.cancel(J)),wheel:J=>(j(J),this.cancel(J,!0)),mousedrag:J=>{J.buttons&&j(J)},mousemove:J=>{J.buttons||j(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?q.mousemove||(k.addEventListener("mousemove",U.mousemove),q.mousemove=U.mousemove):(k.removeEventListener("mousemove",q.mousemove),q.mousemove=null),16&J?q.wheel||(k.addEventListener("wheel",U.wheel,{passive:!1}),q.wheel=U.wheel):(k.removeEventListener("wheel",q.wheel),q.wheel=null),2&J?q.mouseup||(q.mouseup=U.mouseup):(this._document.removeEventListener("mouseup",q.mouseup),q.mouseup=null),4&J?q.mousedrag||(q.mousedrag=U.mousedrag):(this._document.removeEventListener("mousemove",q.mousedrag),q.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,u.addDisposableDomListener)(k,"mousedown",(J=>{if(J.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(J))return j(J),q.mouseup&&this._document.addEventListener("mouseup",q.mouseup),q.mousedrag&&this._document.addEventListener("mousemove",q.mousedrag),this.cancel(J)}))),this.register((0,u.addDisposableDomListener)(k,"wheel",(J=>{if(!q.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(J)===!1)return!1;if(!this.buffer.hasScrollback){let Z=this.viewport.getLinesScrolled(J);if(Z===0)return;let se=F.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(J.deltaY<0?"A":"B"),he="";for(let fe=0;fe<Math.abs(Z);fe++)he+=se;return this.coreService.triggerDataEvent(he,!0),this.cancel(J,!0)}return this.viewport.handleWheel(J)?this.cancel(J):void 0}}),{passive:!1})),this.register((0,u.addDisposableDomListener)(k,"touchstart",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(J),this.cancel(J)}),{passive:!0})),this.register((0,u.addDisposableDomListener)(k,"touchmove",(J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(J)?void 0:this.cancel(J)}),{passive:!1}))}refresh(H,k){this._renderService?.refreshRows(H,k)}updateCursorStyle(H){this._selectionService?.shouldColumnSelect(H)?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(H,k,j=0){j===1?(super.scrollLines(H,k,j),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(H)}paste(H){(0,a.paste)(H,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(H){this._customKeyEventHandler=H}attachCustomWheelEventHandler(H){this._customWheelEventHandler=H}registerLinkProvider(H){return this._linkProviderService.registerLinkProvider(H)}registerCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let k=this._characterJoinerService.register(H);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(H){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(H)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(H){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+H)}registerDecoration(H){return this._decorationService.registerDecoration(H)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(H,k,j){this._selectionService.setSelection(H,k,j)}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(H,k){this._selectionService?.selectLines(H,k)}_keyDown(H){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;let k=this.browser.isMac&&this.options.macOptionIsMeta&&H.altKey;if(!k&&!this._compositionHelper.keydown(H))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||H.key!=="Dead"&&H.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let j=(0,I.evaluateKeyboardEvent)(H,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(H),j.type===3||j.type===2){let q=this.rows-1;return this.scrollLines(j.type===2?-q:q),this.cancel(H,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,H)||(j.cancel&&this.cancel(H,!0),!j.key||!!(H.key&&!H.ctrlKey&&!H.altKey&&!H.metaKey&&H.key.length===1&&H.key.charCodeAt(0)>=65&&H.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(j.key!==F.C0.ETX&&j.key!==F.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(j.key,!0),!this.optionsService.rawOptions.screenReaderMode||H.altKey||H.ctrlKey?this.cancel(H,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(H,k){let j=H.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||H.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||H.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?j:j&&(!k.keyCode||k.keyCode>47)}_keyUp(H){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1||((function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18})(H)||this.focus(),this.updateCursorStyle(H),this._keyPressHandled=!1)}_keyPress(H){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(H)===!1)return!1;if(this.cancel(H),H.charCode)k=H.charCode;else if(H.which===null||H.which===void 0)k=H.keyCode;else{if(H.which===0||H.charCode===0)return!1;k=H.which}return!(!k||(H.altKey||H.ctrlKey||H.metaKey)&&!this._isThirdLevelShift(this.browser,H)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:H}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(H){if(H.data&&H.inputType==="insertText"&&(!H.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let k=H.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(H),!0}return!1}resize(H,k){H!==this.cols||k!==this.rows?super.resize(H,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(H,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 H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(R.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 H=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(F.C0.ESC+"[I"):this.coreService.triggerDataEvent(F.C0.ESC+"[O")}_reportWindowsOptions(H){if(this._renderService)switch(H){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let k=this._renderService.dimensions.css.canvas.width.toFixed(0),j=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[4;${j};${k}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let q=this._renderService.dimensions.css.cell.width.toFixed(0),U=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.C0.ESC}[6;${U};${q}t`)}}cancel(H,k){if(this.options.cancelEvents||k)return H.preventDefault(),H.stopPropagation(),!1}}s.Terminal=$},9924:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(n,a=1e3){this._renderCallback=n,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(n,a,u){this._rowCount=u,n=n!==void 0?n:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,n):n,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;let l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let d=l-this._lastRefreshMs,m=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let n=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(n,a)}}},1680:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,v){var S,b=arguments.length,x=b<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,v);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,v){h(p,v,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;let l=n(3656),d=n(4725),m=n(8460),y=n(844),_=n(2585),c=s.Viewport=class extends y.Disposable{constructor(f,h,p,v,S,b,x,w){super(),this._viewportElement=f,this._scrollArea=h,this._bufferService=p,this._optionsService=v,this._charSizeService=S,this._renderService=b,this._coreBrowserService=x,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 m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(w.colors),this.register(w.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.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(f){if(f)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 h=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==h&&(this._lastRecordedBufferHeight=h,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){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 h=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<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(f,h){let p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(h<0&&this._viewportElement.scrollTop!==0||h>0&&p<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){let h=this._getPixelsScrolled(f);return h!==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+h:this._smoothScrollState.target+=h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let h=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+h,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?h*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._currentRowHeight*this._bufferService.rows),h}getBufferElements(f,h){let p,v="",S=[],b=h??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let w=f;w<b;w++){let E=x.get(w);if(!E)continue;let B=x.get(w+1)?.isWrapped;if(v+=E.translateToString(!B),!B||w===x.length-1){let P=document.createElement("div");P.textContent=v,S.push(P),v.length>0&&(p=P),v=""}}return{bufferElements:S,cursorElement:p}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let h=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(h/=this._currentRowHeight+0,this._wheelPartialScroll+=h,h=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(h*=this._bufferService.rows),h}_applyScrollModifier(f,h){let p=this._optionsService.rawOptions.fastScrollModifier;return p==="alt"&&h.altKey||p==="ctrl"&&h.ctrlKey||p==="shift"&&h.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){let h=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,h!==0&&(this._viewportElement.scrollTop+=h,this._bubbleScroll(f,h))}};s.Viewport=c=a([u(2,_.IBufferService),u(3,_.IOptionsService),u(4,d.ICharSizeService),u(5,d.IRenderService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],c)},3107:function(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(v<3?p(S):v>3?p(c,f,S):p(c,f))||S);return v>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;let l=n(4725),d=n(844),m=n(2585),y=s.BufferDecorationRenderer=class extends d.Disposable{constructor(_,c,f,h,p){super(),this._screenElement=_,this._bufferService=c,this._coreBrowserService=f,this._decorationService=h,this._renderService=p,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,d.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 _ of this._decorationService.decorations)this._renderDecoration(_);this._dimensionsChanged=!1}_renderDecoration(_){this._refreshStyle(_),this._dimensionsChanged&&this._refreshXPosition(_)}_createElement(_){let c=this._coreBrowserService.mainDocument.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",_?.options?.layer==="top"),c.style.width=`${Math.round((_.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(_.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(_.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 f=_.options.x??0;return f&&f>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(_,c),c}_refreshStyle(_){let c=_.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)_.element&&(_.element.style.display="none",_.onRenderEmitter.fire(_.element));else{let f=this._decorationElements.get(_);f||(f=this._createElement(_),_.element=f,this._decorationElements.set(_,f),this._container.appendChild(f),_.onDispose((()=>{this._decorationElements.delete(_),f.remove()}))),f.style.top=c*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",_.onRenderEmitter.fire(f)}}_refreshXPosition(_,c=_.element){if(!c)return;let f=_.options.x??0;(_.options.anchor||"left")==="right"?c.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(_){this._decorationElements.get(_)?.remove(),this._decorationElements.delete(_),_.dispose()}};s.BufferDecorationRenderer=y=a([u(1,m.IBufferService),u(2,l.ICoreBrowserService),u(3,m.IDecorationService),u(4,l.IRenderService)],y)},5871:(o,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(n){if(n.options.overviewRulerOptions){for(let a of this._zones)if(a.color===n.options.overviewRulerOptions.color&&a.position===n.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,n.marker.line))return;if(this._lineAdjacentToZone(a,n.marker.line,n.options.overviewRulerOptions.position))return void this._addLineToZone(a,n.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=n.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=n.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=n.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=n.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:n.options.overviewRulerOptions.color,position:n.options.overviewRulerOptions.position,startBufferLine:n.marker.line,endBufferLine:n.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(n){this._linePadding=n}_lineIntersectsZone(n,a){return a>=n.startBufferLine&&a<=n.endBufferLine}_lineAdjacentToZone(n,a,u){return a>=n.startBufferLine-this._linePadding[u||"full"]&&a<=n.endBufferLine+this._linePadding[u||"full"]}_addLineToZone(n,a){n.startBufferLine=Math.min(n.startBufferLine,a),n.endBufferLine=Math.max(n.endBufferLine,a)}}},5744:function(o,s,n){var a=this&&this.__decorate||function(p,v,S,b){var x,w=arguments.length,E=w<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(p,v,S,b);else for(var B=p.length-1;B>=0;B--)(x=p[B])&&(E=(w<3?x(E):w>3?x(v,S,E):x(v,S))||E);return w>3&&E&&Object.defineProperty(v,S,E),E},u=this&&this.__param||function(p,v){return function(S,b){v(S,b,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;let l=n(5871),d=n(4725),m=n(844),y=n(2585),_={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},h=s.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,v,S,b,x,w,E){super(),this._viewportElement=p,this._screenElement=v,this._bufferService=S,this._decorationService=b,this._renderService=x,this._optionsService=w,this._coreBrowserService=E,this._colorZoneStore=new l.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 B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,m.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 p=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=p,c.center=v,c.right=p,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=c.left,f.right=c.left+c.center}_refreshDrawHeightConstants(){_.full=Math.round(2*this._coreBrowserService.dpr);let p=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowserService.dpr);_.left=v,_.center=v,_.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.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 p=this._colorZoneStore.zones;for(let v of p)v.position!=="full"&&this._renderColorZone(v);for(let v of p)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(f[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-_[p.position||"full"]/2),c[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+_[p.position||"full"]))}_queueRefresh(p,v){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=h=a([u(2,y.IBufferService),u(3,y.IDecorationService),u(4,d.IRenderService),u(5,y.IOptionsService),u(6,d.ICoreBrowserService)],h)},2950:function(o,s,n){var a=this&&this.__decorate||function(_,c,f,h){var p,v=arguments.length,S=v<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,c,f,h);else for(var b=_.length-1;b>=0;b--)(p=_[b])&&(S=(v<3?p(S):v>3?p(c,f,S):p(c,f))||S);return v>3&&S&&Object.defineProperty(c,f,S),S},u=this&&this.__param||function(_,c){return function(f,h){c(f,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;let l=n(4725),d=n(2585),m=n(2584),y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,c,f,h,p,v){this._textarea=_,this._compositionView=c,this._bufferService=f,this._optionsService=h,this._coreService=p,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(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){let c={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,c.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(c.start,c.end):this._textarea.value.substring(c.start),f.length>0&&this._coreService.triggerDataEvent(f,!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 _=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let c=this._textarea.value,f=c.replace(_,"");this._dataAlreadySent=f,c.length>_.length?this._coreService.triggerDataEvent(f,!0):c.length<_.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):c.length===_.length&&c!==_&&this._coreService.triggerDataEvent(c,!0)}}),0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let c=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,h=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,p=c*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=p+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"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=p+"px",this._textarea.style.top=h+"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"}_||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=y=a([u(2,d.IBufferService),u(3,d.IOptionsService),u(4,d.ICoreService),u(5,l.IRenderService)],y)},9806:(o,s)=>{function n(a,u,l){let d=l.getBoundingClientRect(),m=a.getComputedStyle(l),y=parseInt(m.getPropertyValue("padding-left")),_=parseInt(m.getPropertyValue("padding-top"));return[u.clientX-d.left-y,u.clientY-d.top-_]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=n,s.getCoords=function(a,u,l,d,m,y,_,c,f){if(!y)return;let h=n(a,u,l);return h?(h[0]=Math.ceil((h[0]+(f?_/2:0))/_),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),d+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),m),h):void 0}},9504:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;let a=n(2584);function u(c,f,h,p){let v=c-l(c,h),S=f-l(f,h),b=Math.abs(v-S)-(function(x,w,E){let B=0,P=x-l(x,E),W=w-l(w,E);for(let A=0;A<Math.abs(P-W);A++){let V=d(x,w)==="A"?-1:1;E.buffer.lines.get(P+V*A)?.isWrapped&&B++}return B})(c,f,h);return _(b,y(d(c,f),p))}function l(c,f){let h=0,p=f.buffer.lines.get(c),v=p?.isWrapped;for(;v&&c>=0&&c<f.rows;)h++,p=f.buffer.lines.get(--c),v=p?.isWrapped;return h}function d(c,f){return c>f?"A":"B"}function m(c,f,h,p,v,S){let b=c,x=f,w="";for(;b!==h||x!==p;)b+=v?1:-1,v&&b>S.cols-1?(w+=S.buffer.translateBufferLineToString(x,!1,c,b),b=0,c=0,x++):!v&&b<0&&(w+=S.buffer.translateBufferLineToString(x,!1,0,c+1),b=S.cols-1,c=b,x--);return w+S.buffer.translateBufferLineToString(x,!1,c,b)}function y(c,f){let h=f?"O":"[";return a.C0.ESC+h+c}function _(c,f){c=Math.floor(c);let h="";for(let p=0;p<c;p++)h+=f;return h}s.moveToCellSequence=function(c,f,h,p){let v=h.buffer.x,S=h.buffer.y;if(!h.buffer.hasScrollback)return(function(w,E,B,P,W,A){return u(E,P,W,A).length===0?"":_(m(w,E,w,E-l(E,W),!1,W).length,y("D",A))})(v,S,0,f,h,p)+u(S,f,h,p)+(function(w,E,B,P,W,A){let V;V=u(E,P,W,A).length>0?P-l(P,W):E;let O=P,R=(function(F,I,C,L,T,D){let N;return N=u(C,L,T,D).length>0?L-l(L,T):I,F<C&&N<=L||F>=C&&N<L?"C":"D"})(w,E,B,P,W,A);return _(m(w,V,B,O,R==="C",W).length,y(R,A))})(v,S,c,f,h,p);let b;if(S===f)return b=v>c?"D":"C",_(Math.abs(v-c),y(b,p));b=S>f?"D":"C";let x=Math.abs(S-f);return _((function(w,E){return E.cols-w})(S>f?c:v,h)+(x-1)*h.cols+1+((S>f?v:c)-1),y(b,p))}},1296:function(o,s,n){var a=this&&this.__decorate||function(A,V,O,R){var F,I=arguments.length,C=I<3?V:R===null?R=Object.getOwnPropertyDescriptor(V,O):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(A,V,O,R);else for(var L=A.length-1;L>=0;L--)(F=A[L])&&(C=(I<3?F(C):I>3?F(V,O,C):F(V,O))||C);return I>3&&C&&Object.defineProperty(V,O,C),C},u=this&&this.__param||function(A,V){return function(O,R){V(O,R,A)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;let l=n(3787),d=n(2550),m=n(2223),y=n(6171),_=n(6052),c=n(4725),f=n(8055),h=n(8460),p=n(844),v=n(2585),S="xterm-dom-renderer-owner-",b="xterm-rows",x="xterm-fg-",w="xterm-bg-",E="xterm-focus",B="xterm-selection",P=1,W=s.DomRenderer=class extends p.Disposable{constructor(A,V,O,R,F,I,C,L,T,D,N,G,$){super(),this._terminal=A,this._document=V,this._element=O,this._screenElement=R,this._viewportElement=F,this._helperContainer=I,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=N,this._coreBrowserService=G,this._themeService=$,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,_.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new h.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(b),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Y=>this._injectCss(Y)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Y=>this._handleLinkHover(Y)))),this.register(this._linkifier2.onHideLinkUnderline((Y=>this._handleLinkLeave(Y)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.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 A=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*A,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*A),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/A),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/A),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 O of this._rowElements)O.style.width=`${this.dimensions.css.canvas.width}px`,O.style.height=`${this.dimensions.css.cell.height}px`,O.style.lineHeight=`${this.dimensions.css.cell.height}px`,O.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let V=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=V,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(A){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let V=`${this._terminalSelector} .${b} { color: ${A.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;V+=`${this._terminalSelector} .${b} .xterm-dim { color: ${f.color.multiplyOpacity(A.foreground,.5).css};}`,V+=`${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 O=`blink_underline_${this._terminalClass}`,R=`blink_bar_${this._terminalClass}`,F=`blink_block_${this._terminalClass}`;V+=`@keyframes ${O} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${R} { 50% { box-shadow: none; }}`,V+=`@keyframes ${F} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,V+=`${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${O} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${R} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,V+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(let[I,C]of A.ansi.entries())V+=`${this._terminalSelector} .${x}${I} { color: ${C.css}; }${this._terminalSelector} .${x}${I}.xterm-dim { color: ${f.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${w}${I} { background-color: ${C.css}; }`;V+=`${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(A.background).css}; }${this._terminalSelector} .${x}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${w}${m.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=V}_setDefaultSpacing(){let A=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${A}px`,this._rowFactory.defaultSpacing=A}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(A,V){for(let O=this._rowElements.length;O<=V;O++){let R=this._document.createElement("div");this._rowContainer.appendChild(R),this._rowElements.push(R)}for(;this._rowElements.length>V;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,V){this._refreshRowElements(A,V),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,V,O){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,V,O),this.renderRows(0,this._bufferService.rows-1),!A||!V)return;this._selectionRenderModel.update(this._terminal,A,V,O);let R=this._selectionRenderModel.viewportStartRow,F=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||C<0)return;let L=this._document.createDocumentFragment();if(O){let T=A[0]>V[0];L.appendChild(this._createSelectionElement(I,T?V[0]:A[0],T?A[0]:V[0],C-I+1))}else{let T=R===I?A[0]:0,D=I===F?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,T,D));let N=C-I-1;if(L.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,N)),I!==C){let G=F===C?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(C,0,G))}}this._selectionContainer.appendChild(L)}_createSelectionElement(A,V,O,R=1){let F=this._document.createElement("div"),I=V*this.dimensions.css.cell.width,C=this.dimensions.css.cell.width*(O-V);return I+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-I),F.style.height=R*this.dimensions.css.cell.height+"px",F.style.top=A*this.dimensions.css.cell.height+"px",F.style.left=`${I}px`,F.style.width=`${C}px`,F}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 A of this._rowElements)A.replaceChildren()}renderRows(A,V){let O=this._bufferService.buffer,R=O.ybase+O.y,F=Math.min(O.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=A;T<=V;T++){let D=T+O.ydisp,N=this._rowElements[T],G=O.lines.get(D);if(!N||!G)break;N.replaceChildren(...this._rowFactory.createRow(G,D,D===R,C,L,F,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${this._terminalClass}`}_handleLinkHover(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!0)}_handleLinkLeave(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!1)}_setCellUnderline(A,V,O,R,F,I){O<0&&(A=0),R<0&&(V=0);let C=this._bufferService.rows-1;O=Math.max(Math.min(O,C),0),R=Math.max(Math.min(R,C),0),F=Math.min(F,this._bufferService.cols);let L=this._bufferService.buffer,T=L.ybase+L.y,D=Math.min(L.x,F-1),N=this._optionsService.rawOptions.cursorBlink,G=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=O;Y<=R;++Y){let H=Y+L.ydisp,k=this._rowElements[Y],j=L.lines.get(H);if(!k||!j)break;k.replaceChildren(...this._rowFactory.createRow(j,H,H===T,G,$,D,N,this.dimensions.css.cell.width,this._widthCache,I?Y===O?A:0:-1,I?(Y===R?V:F)-1:-1))}}};s.DomRenderer=W=a([u(7,v.IInstantiationService),u(8,c.ICharSizeService),u(9,v.IOptionsService),u(10,v.IBufferService),u(11,c.ICoreBrowserService),u(12,c.IThemeService)],W)},3787:function(o,s,n){var a=this&&this.__decorate||function(b,x,w,E){var B,P=arguments.length,W=P<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(b,x,w,E);else for(var A=b.length-1;A>=0;A--)(B=b[A])&&(W=(P<3?B(W):P>3?B(x,w,W):B(x,w))||W);return P>3&&W&&Object.defineProperty(x,w,W),W},u=this&&this.__param||function(b,x){return function(w,E){x(w,E,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;let l=n(2223),d=n(643),m=n(511),y=n(2585),_=n(8055),c=n(4725),f=n(4269),h=n(6171),p=n(3734),v=s.DomRendererRowFactory=class{constructor(b,x,w,E,B,P,W){this._document=b,this._characterJoinerService=x,this._optionsService=w,this._coreBrowserService=E,this._coreService=B,this._decorationService=P,this._themeService=W,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,x,w){this._selectionStart=b,this._selectionEnd=x,this._columnSelectMode=w}createRow(b,x,w,E,B,P,W,A,V,O,R){let F=[],I=this._characterJoinerService.getJoinedCharacters(x),C=this._themeService.colors,L,T=b.getNoBgTrimmedLength();w&&T<P+1&&(T=P+1);let D=0,N="",G=0,$=0,Y=0,H=!1,k=0,j=!1,q=0,U=[],J=O!==-1&&R!==-1;for(let Z=0;Z<T;Z++){b.loadCell(Z,this._workCell);let se=this._workCell.getWidth();if(se===0)continue;let he=!1,fe=Z,te=this._workCell;if(I.length>0&&Z===I[0][0]){he=!0;let we=I.shift();te=new f.JoinedCellData(this._workCell,b.translateToString(!0,we[0],we[1]),we[1]-we[0]),fe=we[1]-1,se=te.getWidth()}let qe=this._isCellInSelection(Z,x),le=w&&Z===P,Me=J&&Z>=O&&Z<=R,st=!1;this._decorationService.forEachDecorationAtCell(Z,x,void 0,(we=>{st=!0}));let He=te.getChars()||d.WHITESPACE_CELL_CHAR;if(He===" "&&(te.isUnderline()||te.isOverline())&&(He="\xA0"),q=se*A-V.get(He,te.isBold(),te.isItalic()),L){if(D&&(qe&&j||!qe&&!j&&te.bg===G)&&(qe&&j&&C.selectionForeground||te.fg===$)&&te.extended.ext===Y&&Me===H&&q===k&&!le&&!he&&!st){te.isInvisible()?N+=d.WHITESPACE_CELL_CHAR:N+=He,D++;continue}D&&(L.textContent=N),L=this._document.createElement("span"),D=0,N=""}else L=this._document.createElement("span");if(G=te.bg,$=te.fg,Y=te.extended.ext,H=Me,k=q,j=qe,he&&P>=Z&&P<=fe&&(P=Z),!this._coreService.isCursorHidden&&le&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&U.push("xterm-cursor-blink"),U.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline")}}if(te.isBold()&&U.push("xterm-bold"),te.isItalic()&&U.push("xterm-italic"),te.isDim()&&U.push("xterm-dim"),N=te.isInvisible()?d.WHITESPACE_CELL_CHAR:te.getChars()||d.WHITESPACE_CELL_CHAR,te.isUnderline()&&(U.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N="\xA0"),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let we=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&we<8&&(we+=8),L.style.textDecorationColor=C.ansi[we].css}te.isOverline()&&(U.push("xterm-overline"),N===" "&&(N="\xA0")),te.isStrikethrough()&&U.push("xterm-strikethrough"),Me&&(L.style.textDecoration="underline");let ee=te.getFgColor(),ne=te.getFgColorMode(),ge=te.getBgColor(),be=te.getBgColorMode(),je=!!te.isInverse();if(je){let we=ee;ee=ge,ge=we;let _t=ne;ne=be,be=_t}let Oe,ze,Re,We=!1;switch(this._decorationService.forEachDecorationAtCell(Z,x,void 0,(we=>{we.options.layer!=="top"&&We||(we.backgroundColorRGB&&(be=50331648,ge=we.backgroundColorRGB.rgba>>8&16777215,Oe=we.backgroundColorRGB),we.foregroundColorRGB&&(ne=50331648,ee=we.foregroundColorRGB.rgba>>8&16777215,ze=we.foregroundColorRGB),We=we.options.layer==="top")})),!We&&qe&&(Oe=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ge=Oe.rgba>>8&16777215,be=50331648,We=!0,C.selectionForeground&&(ne=50331648,ee=C.selectionForeground.rgba>>8&16777215,ze=C.selectionForeground)),We&&U.push("xterm-decoration-top"),be){case 16777216:case 33554432:Re=C.ansi[ge],U.push(`xterm-bg-${ge}`);break;case 50331648:Re=_.channels.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(L,`background-color:#${S((ge>>>0).toString(16),"0",6)}`);break;default:je?(Re=C.foreground,U.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):Re=C.background}switch(Oe||te.isDim()&&(Oe=_.color.multiplyOpacity(Re,.5)),ne){case 16777216:case 33554432:te.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(L,Re,C.ansi[ee],te,Oe,void 0)||U.push(`xterm-fg-${ee}`);break;case 50331648:let we=_.channels.toColor(ee>>16&255,ee>>8&255,255&ee);this._applyMinimumContrast(L,Re,we,te,Oe,ze)||this._addStyle(L,`color:#${S(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Re,C.foreground,te,Oe,ze)||je&&U.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}U.length&&(L.className=U.join(" "),U.length=0),le||he||st?L.textContent=N:D++,q!==this.defaultSpacing&&(L.style.letterSpacing=`${q}px`),F.push(L),Z=fe}return L&&D&&(L.textContent=N),F}_applyMinimumContrast(b,x,w,E,B,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,h.treatGlyphAsBackgroundColor)(E.getCode()))return!1;let W=this._getContrastCache(E),A;if(B||P||(A=W.getColor(x.rgba,w.rgba)),A===void 0){let V=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);A=_.color.ensureContrastRatio(B||x,P||w,V),W.setColor((B||x).rgba,(P||w).rgba,A??null)}return!!A&&(this._addStyle(b,`color:${A.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,x){b.setAttribute("style",`${b.getAttribute("style")||""}${x};`)}_isCellInSelection(b,x){let w=this._selectionStart,E=this._selectionEnd;return!(!w||!E)&&(this._columnSelectMode?w[0]<=E[0]?b>=w[0]&&x>=w[1]&&b<E[0]&&x<=E[1]:b<w[0]&&x>=w[1]&&b>=E[0]&&x<=E[1]:x>w[1]&&x<E[1]||w[1]===E[1]&&x===w[1]&&b>=w[0]&&b<E[0]||w[1]<E[1]&&x===E[1]&&b<E[0]||w[1]<E[1]&&x===w[1]&&b>=w[0])}};function S(b,x,w){for(;b.length<w;)b=x+b;return b}s.DomRendererRowFactory=v=a([u(1,c.ICharacterJoinerService),u(2,y.IOptionsService),u(3,c.ICoreBrowserService),u(4,y.ICoreService),u(5,y.IDecorationService),u(6,c.IThemeService)],v)},2550:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(n,a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=n.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let u=n.createElement("span");u.classList.add("xterm-char-measure-element");let l=n.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let d=n.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";let m=n.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[u,l,d,m],this._container.appendChild(u),this._container.appendChild(l),this._container.appendChild(d),this._container.appendChild(m),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(n,a,u,l){n===this._font&&a===this._fontSize&&u===this._weight&&l===this._weightBold||(this._font=n,this._fontSize=a,this._weight=u,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${u}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${u}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(n,a,u){let l=0;if(!a&&!u&&n.length===1&&(l=n.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let y=this._measure(n,0);return y>0&&(this._flat[l]=y),y}let d=n;a&&(d+="B"),u&&(d+="I");let m=this._holey.get(d);if(m===void 0){let y=0;a&&(y|=1),u&&(y|=2),m=this._measure(n,y),m>0&&this._holey.set(d,m)}return m}_measure(n,a){let u=this._measureElements[a];return u.textContent=n.repeat(32),u.offsetWidth/32}}},2223:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;let a=n(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(o,s)=>{function n(u){return 57508<=u&&u<=57558}function a(u){return u>=128512&&u<=128591||u>=127744&&u<=128511||u>=128640&&u<=128767||u>=9728&&u<=9983||u>=9984&&u<=10175||u>=65024&&u<=65039||u>=129280&&u<=129535||u>=127462&&u<=127487}Object.defineProperty(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(u){if(!u)throw new Error("value must not be falsy");return u},s.isPowerlineGlyph=n,s.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},s.isEmoji=a,s.allowRescaling=function(u,l,d,m){return l===1&&d>Math.ceil(1.5*m)&&u!==void 0&&u>255&&!a(u)&&!n(u)&&!(function(y){return 57344<=y&&y<=63743})(u)},s.treatGlyphAsBackgroundColor=function(u){return n(u)||(function(l){return 9472<=l&&l<=9631})(u)},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(u,l,d=0){return(u-(2*Math.round(l)-d))%(2*Math.round(l))}},6052:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(u,l,d,m=!1){if(this.selectionStart=l,this.selectionEnd=d,!l||!d||l[0]===d[0]&&l[1]===d[1])return void this.clear();let y=u.buffers.active.ydisp,_=l[1]-y,c=d[1]-y,f=Math.max(_,0),h=Math.min(c,u.rows-1);f>=u.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=_,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=h,this.startCol=l[0],this.endCol=d[0])}isCellSelected(u,l,d){return!!this.hasSelection&&(d-=u.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&d>=this.viewportCappedStartRow&&l<this.endCol&&d<=this.viewportCappedEndRow:l<this.startCol&&d>=this.viewportCappedStartRow&&l>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol)}}s.createSelectionRenderModel=function(){return new n}},456:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(n){this._bufferService=n,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?n%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)-1]:[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[n,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let n=this.selectionStart[0]+this.selectionStartLength;return n>this._bufferService.cols?[n%this._bufferService.cols,this.selectionStart[1]+Math.floor(n/this._bufferService.cols)]:[Math.max(n,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let n=this.selectionStart,a=this.selectionEnd;return!(!n||!a)&&(n[1]>a[1]||n[1]===a[1]&&n[0]>a[0])}handleTrim(n){return this.selectionStart&&(this.selectionStart[1]-=n),this.selectionEnd&&(this.selectionEnd[1]-=n),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;let l=n(2585),d=n(8460),m=n(844),y=s.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(h,p,v){super(),this._optionsService=v,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new c(h,p,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){let h=this._measureStrategy.measure();h.width===this.width&&h.height===this.height||(this.width=h.width,this.height=h.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=a([u(2,l.IOptionsService)],y);class _ extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(p,v){p!==void 0&&p>0&&v!==void 0&&v>0&&(this._result.width=p,this._result.height=v)}}class c extends _{constructor(p,v,S){super(),this._document=p,this._parentElement=v,this._optionsService=S,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 f extends _{constructor(p){super(),this._optionsService=p,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 p=this._ctx.measureText("W");return this._validateAndSet(p.width,p.fontBoundingBoxAscent+p.fontBoundingBoxDescent),this._result}}},4269:function(o,s,n){var a=this&&this.__decorate||function(f,h,p,v){var S,b=arguments.length,x=b<3?h:v===null?v=Object.getOwnPropertyDescriptor(h,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(f,h,p,v);else for(var w=f.length-1;w>=0;w--)(S=f[w])&&(x=(b<3?S(x):b>3?S(h,p,x):S(h,p))||x);return b>3&&x&&Object.defineProperty(h,p,x),x},u=this&&this.__param||function(f,h){return function(p,v){h(p,v,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;let l=n(3734),d=n(643),m=n(511),y=n(2585);class _ extends l.AttributeData{constructor(h,p,v){super(),this.content=0,this.combinedData="",this.fg=h.fg,this.bg=h.bg,this.combinedData=p,this._width=v}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(h){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=_;let c=s.CharacterJoinerService=class Aa{constructor(h){this._bufferService=h,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(h){let p={id:this._nextCharacterJoinerId++,handler:h};return this._characterJoiners.push(p),p.id}deregister(h){for(let p=0;p<this._characterJoiners.length;p++)if(this._characterJoiners[p].id===h)return this._characterJoiners.splice(p,1),!0;return!1}getJoinedCharacters(h){if(this._characterJoiners.length===0)return[];let p=this._bufferService.buffer.lines.get(h);if(!p||p.length===0)return[];let v=[],S=p.translateToString(!0),b=0,x=0,w=0,E=p.getFg(0),B=p.getBg(0);for(let P=0;P<p.getTrimmedLength();P++)if(p.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==B){if(P-b>1){let W=this._getJoinedRanges(S,w,x,p,b);for(let A=0;A<W.length;A++)v.push(W[A])}b=P,w=x,E=this._workCell.fg,B=this._workCell.bg}x+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){let P=this._getJoinedRanges(S,w,x,p,b);for(let W=0;W<P.length;W++)v.push(P[W])}return v}_getJoinedRanges(h,p,v,S,b){let x=h.substring(p,v),w=[];try{w=this._characterJoiners[0].handler(x)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{let B=this._characterJoiners[E].handler(x);for(let P=0;P<B.length;P++)Aa._mergeRanges(w,B[P])}catch(B){console.error(B)}return this._stringRangesToCellRanges(w,S,b),w}_stringRangesToCellRanges(h,p,v){let S=0,b=!1,x=0,w=h[S];if(w){for(let E=v;E<this._bufferService.cols;E++){let B=p.getWidth(E),P=p.getString(E).length||d.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!b&&w[0]<=x&&(w[0]=E,b=!0),w[1]<=x){if(w[1]=E,w=h[++S],!w)break;w[0]<=x?(w[0]=E,b=!0):b=!1}x+=P}}w&&(w[1]=this._bufferService.cols)}}static _mergeRanges(h,p){let v=!1;for(let S=0;S<h.length;S++){let b=h[S];if(v){if(p[1]<=b[0])return h[S-1][1]=p[1],h;if(p[1]<=b[1])return h[S-1][1]=Math.max(p[1],b[1]),h.splice(S,1),h;h.splice(S,1),S--}else{if(p[1]<=b[0])return h.splice(S,0,p),h;if(p[1]<=b[1])return b[0]=Math.min(p[0],b[0]),h;p[0]<b[1]&&(b[0]=Math.min(p[0],b[0]),v=!0)}}return v?h[h.length-1][1]=p[1]:h.push(p),h}};s.CharacterJoinerService=c=a([u(0,y.IBufferService)],c)},5114:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;let a=n(844),u=n(8460),l=n(3656);class d extends a.Disposable{constructor(_,c,f){super(),this._textarea=_,this._window=c,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new u.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((h=>this._screenDprMonitor.setWindow(h)))),this.register((0,u.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(_){this._window!==_&&(this._window=_,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=d;class m extends a.Disposable{constructor(_){super(),this._parentWindow=_,this._windowResizeListener=this.register(new a.MutableDisposable),this._onDprChange=this.register(new u.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,a.toDisposable)((()=>this.clearListener())))}setWindow(_){this._parentWindow=_,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;let a=n(844);class u extends a.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,a.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{let m=this.linkProviders.indexOf(d);m!==-1&&this.linkProviders.splice(m,1)}}}}s.LinkProviderService=u},8934:function(o,s,n){var a=this&&this.__decorate||function(y,_,c,f){var h,p=arguments.length,v=p<3?_:f===null?f=Object.getOwnPropertyDescriptor(_,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(y,_,c,f);else for(var S=y.length-1;S>=0;S--)(h=y[S])&&(v=(p<3?h(v):p>3?h(_,c,v):h(_,c))||v);return p>3&&v&&Object.defineProperty(_,c,v),v},u=this&&this.__param||function(y,_){return function(c,f){_(c,f,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;let l=n(4725),d=n(9806),m=s.MouseService=class{constructor(y,_){this._renderService=y,this._charSizeService=_}getCoords(y,_,c,f,h){return(0,d.getCoords)(window,y,_,c,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,h)}getMouseReportCoords(y,_){let c=(0,d.getCoordsRelativeToElement)(window,y,_);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=m=a([u(0,l.IRenderService),u(1,l.ICharSizeService)],m)},3230:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;let l=n(6193),d=n(4725),m=n(8460),y=n(844),_=n(7226),c=n(2585),f=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(h,p,v,S,b,x,w,E){super(),this._rowCount=h,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new _.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer(((B,P)=>this._renderRows(B,P)),w),this.register(this._renderDebouncer),this.register(w.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(x.onResize((()=>this._fullRefresh()))),this.register(x.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(v.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(b.onDecorationRegistered((()=>this._fullRefresh()))),this.register(b.onDecorationRemoved((()=>this._fullRefresh()))),this.register(v.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(x.cols,x.rows),this._fullRefresh()}))),this.register(v.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(x.buffer.y,x.buffer.y,!0)))),this.register(E.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(w.window,p),this.register(w.onWindowChange((B=>this._registerIntersectionObserver(B,p))))}_registerIntersectionObserver(h,p){if("IntersectionObserver"in h){let v=new h.IntersectionObserver((S=>this._handleIntersectionChange(S[S.length-1])),{threshold:0});v.observe(p),this._observerDisposable.value=(0,y.toDisposable)((()=>v.disconnect()))}}_handleIntersectionChange(h){this._isPaused=h.isIntersecting===void 0?h.intersectionRatio===0:!h.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(h,p,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(h,p,this._rowCount))}_renderRows(h,p){this._renderer.value&&(h=Math.min(h,this._rowCount-1),p=Math.min(p,this._rowCount-1),this._renderer.value.renderRows(h,p),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:h,end:p}),this._onRender.fire({start:h,end:p}),this._isNextRenderRedrawOnly=!0)}resize(h,p){this._rowCount=p,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(h){this._renderer.value=h,this._renderer.value&&(this._renderer.value.onRequestRedraw((p=>this.refreshRows(p.start,p.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(h){return this._renderDebouncer.addRefreshCallback(h)}_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(h,p){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(h,p))):this._renderer.value.handleResize(h,p),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(h,p,v){this._selectionState.start=h,this._selectionState.end=p,this._selectionState.columnSelectMode=v,this._renderer.value?.handleSelectionChanged(h,p,v)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};s.RenderService=f=a([u(2,c.IOptionsService),u(3,d.ICharSizeService),u(4,c.IDecorationService),u(5,c.IBufferService),u(6,d.ICoreBrowserService),u(7,d.IThemeService)],f)},9312:function(o,s,n){var a=this&&this.__decorate||function(w,E,B,P){var W,A=arguments.length,V=A<3?E:P===null?P=Object.getOwnPropertyDescriptor(E,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(w,E,B,P);else for(var O=w.length-1;O>=0;O--)(W=w[O])&&(V=(A<3?W(V):A>3?W(E,B,V):W(E,B))||V);return A>3&&V&&Object.defineProperty(E,B,V),V},u=this&&this.__param||function(w,E){return function(B,P){E(B,P,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;let l=n(9806),d=n(9504),m=n(456),y=n(4725),_=n(8460),c=n(844),f=n(6114),h=n(4841),p=n(511),v=n(2585),S="\xA0",b=new RegExp(S,"g"),x=s.SelectionService=class extends c.Disposable{constructor(w,E,B,P,W,A,V,O,R){super(),this._element=w,this._screenElement=E,this._linkifier=B,this._bufferService=P,this._coreService=W,this._mouseService=A,this._optionsService=V,this._renderService=O,this._coreBrowserService=R,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=F=>this._handleMouseMove(F),this._mouseUpListener=F=>this._handleMouseUp(F),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((F=>this._handleTrim(F))),this.register(this._bufferService.buffers.onBufferActivate((F=>this._handleBufferActivate(F)))),this.enable(),this._model=new m.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 w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!w||!E||w[0]===E[0]&&w[1]===E[1])}get selectionText(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!w||!E)return"";let B=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(w[0]===E[0])return"";let W=w[0]<E[0]?w[0]:E[0],A=w[0]<E[0]?E[0]:w[0];for(let V=w[1];V<=E[1];V++){let O=B.translateBufferLineToString(V,!0,W,A);P.push(O)}}else{let W=w[1]===E[1]?E[0]:void 0;P.push(B.translateBufferLineToString(w[1],!0,w[0],W));for(let A=w[1]+1;A<=E[1]-1;A++){let V=B.lines.get(A),O=B.translateBufferLineToString(A,!0);V?.isWrapped?P[P.length-1]+=O:P.push(O)}if(w[1]!==E[1]){let A=B.lines.get(E[1]),V=B.translateBufferLineToString(E[1],!0,0,E[0]);A&&A.isWrapped?P[P.length-1]+=V:P.push(V)}}return P.map((W=>W.replace(b," "))).join(f.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(w){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),u.isLinux&&w&&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(w){let E=this._getMouseBufferCoords(w),P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(P&&O&&E)&&this._areCoordsInSelection(E,P,O)}isCellInSelection(w,E){let P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!P||!O)&&this._areCoordsInSelection([w,E],P,O)}_areCoordsInSelection(w,E,P){return w[1]>E[1]&&w[1]<P[1]||E[1]===P[1]&&w[1]===E[1]&&w[0]>=E[0]&&w[0]<P[0]||E[1]<P[1]&&w[1]===P[1]&&w[0]<P[0]||E[1]<P[1]&&w[1]===E[1]&&w[0]>=E[0]}_selectWordAtCursor(w,E){let P=this._linkifier.currentLink?.link?.range;if(P)return this._model.selectionStart=[P.start.x-1,P.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(P,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let O=this._getMouseBufferCoords(w);return!!O&&(this._selectWordAt(O,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(w,E){this._model.clearSelection(),w=Math.max(w,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,w],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(w){this._model.handleTrim(w)&&this.refresh()}_getMouseBufferCoords(w){let E=this._mouseService.getCoords(w,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(w){let E=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,w,this._screenElement)[1],P=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=P?0:(E>P&&(E-=P),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(w){return u.isMac?w.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:w.shiftKey}handleMouseDown(w){if(this._mouseDownTimeStamp=w.timeStamp,(w.button!==2||!this.hasSelection)&&w.button===0){if(!this._enabled){if(!this.shouldForceSelection(w))return;w.stopPropagation()}w.preventDefault(),this._dragScrollAmount=0,this._enabled&&w.shiftKey?this._handleIncrementalClick(w):w.detail===1?this._handleSingleClick(w):w.detail===2?this._handleDoubleClick(w):w.detail===3&&this._handleTripleClick(w),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(w){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(w))}_handleSingleClick(w){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(w)?3:0,this._model.selectionStart=this._getMouseBufferCoords(w),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(w){this._selectWordAtCursor(w,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(w){let E=this._getMouseBufferCoords(w);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(w){return w.altKey&&!(u.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(w){if(w.stopImmediatePropagation(),!this._model.selectionStart)return;let E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(w),!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(w),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let P=this._bufferService.buffer;if(this._model.selectionEnd[1]<P.lines.length){let O=P.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let w=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(w.ydisp+this._bufferService.rows,w.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=w.ydisp),this.refresh()}}_handleMouseUp(w){let E=w.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&w.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let P=this._mouseService.getCoords(w,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(P&&P[0]!==void 0&&P[1]!==void 0){let O=(0,_.moveToCellSequence)(P[0]-1,P[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,P=!(!w||!E||w[0]===E[0]&&w[1]===E[1]);P?w&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&w[0]===this._oldSelectionStart[0]&&w[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(w,E,P)):this._oldHasSelection&&this._fireOnSelectionChange(w,E,P)}_fireOnSelectionChange(w,E,P){this._oldSelectionStart=w,this._oldSelectionEnd=E,this._oldHasSelection=P,this._onSelectionChange.fire()}_handleBufferActivate(w){this.clearSelection(),this._trimListener.dispose(),this._trimListener=w.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(w,E){let P=E;for(let O=0;E>=O;O++){let F=w.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?P--:F>1&&E!==O&&(P+=F-1)}return P}setSelection(w,E,P){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[w,E],this._model.selectionStartLength=P,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(w){this._isClickInSelection(w)||(this._selectWordAtCursor(w,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(w,E,P=!0,O=!0){if(w[0]>=this._bufferService.cols)return;let F=this._bufferService.buffer,A=F.lines.get(w[1]);if(!A)return;let V=F.translateBufferLineToString(w[1],!1),B=this._convertViewportColToCharacterIndex(A,w[0]),R=B,z=w[0]-B,I=0,C=0,L=0,T=0;if(V.charAt(B)===" "){for(;B>0&&V.charAt(B-1)===" ";)B--;for(;R<V.length&&V.charAt(R+1)===" ";)R++}else{let G=w[0],j=w[0];A.getWidth(G)===0&&(I++,G--),A.getWidth(j)===2&&(C++,j++);let Y=A.getString(j).length;for(Y>1&&(T+=Y-1,R+=Y-1);G>0&&B>0&&!this._isCharWordSeparator(A.loadCell(G-1,this._workCell));){A.loadCell(G-1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,G--):H>1&&(L+=H-1,B-=H-1),B--,G--}for(;j<A.length&&R+1<V.length&&!this._isCharWordSeparator(A.loadCell(j+1,this._workCell));){A.loadCell(j+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,j++):H>1&&(T+=H-1,R+=H-1),R++,j++}}R++;let D=B+z-I+L,N=Math.min(this._bufferService.cols,R-B+I+C-L-T);if(E||V.slice(B,R).trim()!==""){if(P&&D===0&&A.getCodePoint(0)!==32){let G=F.lines.get(w[1]-1);if(G&&A.isWrapped&&G.getCodePoint(this._bufferService.cols-1)!==32){let j=this._getWordAt([this._bufferService.cols-1,w[1]-1],!1,!0,!1);if(j){let Y=this._bufferService.cols-j.start;D-=Y,N+=Y}}}if(O&&D+N===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let G=F.lines.get(w[1]+1);if(G?.isWrapped&&G.getCodePoint(0)!==32){let j=this._getWordAt([0,w[1]+1],!1,!1,!0);j&&(N+=j.length)}}return{start:D,length:N}}}_selectWordAt(w,E){let P=this._getWordAt(w,E);if(P){for(;P.start<0;)P.start+=this._bufferService.cols,w[1]--;this._model.selectionStart=[P.start,w[1]],this._model.selectionStartLength=P.length}}_selectToWordAt(w){let E=this._getWordAt(w,!0);if(E){let P=w[1];for(;E.start<0;)E.start+=this._bufferService.cols,P--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,P++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,P]}}_isCharWordSeparator(w){return w.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(w.getChars())>=0}_selectLineAt(w){let E=this._bufferService.buffer.getWrappedRangeForLine(w),P={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(P,this._bufferService.cols)}};s.SelectionService=x=a([d(3,v.IBufferService),d(4,v.ICoreService),d(5,y.IMouseService),d(6,v.IOptionsService),d(7,y.IRenderService),d(8,y.ICoreBrowserService)],x)},4725:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;let a=o(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(n,s,o){var a=this&&this.__decorate||function(x,w,E,P){var O,F=arguments.length,A=F<3?w:P===null?P=Object.getOwnPropertyDescriptor(w,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,w,E,P);else for(var V=x.length-1;V>=0;V--)(O=x[V])&&(A=(F<3?O(A):F>3?O(w,E,A):O(w,E))||A);return F>3&&A&&Object.defineProperty(w,E,A),A},d=this&&this.__param||function(x,w){return function(E,P){w(E,P,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let l=o(7239),_=o(8055),m=o(8460),y=o(844),p=o(2585),c=_.css.toColor("#ffffff"),u=_.css.toColor("#000000"),h=_.css.toColor("#ffffff"),f=_.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let x=[_.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")],w=[0,95,135,175,215,255];for(let E=0;E<216;E++){let P=w[E/36%6|0],O=w[E/6%6|0],F=w[E%6];x.push({css:_.channels.toCss(P,O,F),rgba:_.channels.toRgba(P,O,F)})}for(let E=0;E<24;E++){let P=8+10*E;x.push({css:_.channels.toCss(P,P,P),rgba:_.channels.toRgba(P,P,P)})}return x})());let S=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(x){super(),this._optionsService=x,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:u,cursor:h,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:_.color.blend(u,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:_.color.blend(u,v),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(x={}){let w=this._colors;if(w.foreground=g(x.foreground,c),w.background=g(x.background,u),w.cursor=g(x.cursor,h),w.cursorAccent=g(x.cursorAccent,f),w.selectionBackgroundTransparent=g(x.selectionBackground,v),w.selectionBackgroundOpaque=_.color.blend(w.background,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundTransparent=g(x.selectionInactiveBackground,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundOpaque=_.color.blend(w.background,w.selectionInactiveBackgroundTransparent),w.selectionForeground=x.selectionForeground?g(x.selectionForeground,_.NULL_COLOR):void 0,w.selectionForeground===_.NULL_COLOR&&(w.selectionForeground=void 0),_.color.isOpaque(w.selectionBackgroundTransparent)&&(w.selectionBackgroundTransparent=_.color.opacity(w.selectionBackgroundTransparent,.3)),_.color.isOpaque(w.selectionInactiveBackgroundTransparent)&&(w.selectionInactiveBackgroundTransparent=_.color.opacity(w.selectionInactiveBackgroundTransparent,.3)),w.ansi=s.DEFAULT_ANSI_COLORS.slice(),w.ansi[0]=g(x.black,s.DEFAULT_ANSI_COLORS[0]),w.ansi[1]=g(x.red,s.DEFAULT_ANSI_COLORS[1]),w.ansi[2]=g(x.green,s.DEFAULT_ANSI_COLORS[2]),w.ansi[3]=g(x.yellow,s.DEFAULT_ANSI_COLORS[3]),w.ansi[4]=g(x.blue,s.DEFAULT_ANSI_COLORS[4]),w.ansi[5]=g(x.magenta,s.DEFAULT_ANSI_COLORS[5]),w.ansi[6]=g(x.cyan,s.DEFAULT_ANSI_COLORS[6]),w.ansi[7]=g(x.white,s.DEFAULT_ANSI_COLORS[7]),w.ansi[8]=g(x.brightBlack,s.DEFAULT_ANSI_COLORS[8]),w.ansi[9]=g(x.brightRed,s.DEFAULT_ANSI_COLORS[9]),w.ansi[10]=g(x.brightGreen,s.DEFAULT_ANSI_COLORS[10]),w.ansi[11]=g(x.brightYellow,s.DEFAULT_ANSI_COLORS[11]),w.ansi[12]=g(x.brightBlue,s.DEFAULT_ANSI_COLORS[12]),w.ansi[13]=g(x.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),w.ansi[14]=g(x.brightCyan,s.DEFAULT_ANSI_COLORS[14]),w.ansi[15]=g(x.brightWhite,s.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){let E=Math.min(w.ansi.length-16,x.extendedAnsi.length);for(let P=0;P<E;P++)w.ansi[P+16]=g(x.extendedAnsi[P],s.DEFAULT_ANSI_COLORS[P+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(x){this._restoreColor(x),this._onChangeColors.fire(this.colors)}_restoreColor(x){if(x!==void 0)switch(x){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[x]=this._restoreColors.ansi[x]}else for(let w=0;w<this._restoreColors.ansi.length;++w)this._colors.ansi[w]=this._restoreColors.ansi[w]}modifyColors(x){x(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 g(x,w){if(x!==void 0)try{return _.css.toColor(x)}catch{}return w}s.ThemeService=S=a([d(0,p.IOptionsService)],S)},6349:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=o(8460),d=o(844);class l extends d.Disposable{constructor(m){super(),this._maxLength=m,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(m){if(this._maxLength===m)return;let y=new Array(m);for(let p=0;p<Math.min(m,this.length);p++)y[p]=this._array[this._getCyclicIndex(p)];this._array=y,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let y=this._length;y<m;y++)this._array[y]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,y){this._array[this._getCyclicIndex(m)]=y}push(m){this._array[this._getCyclicIndex(this._length)]=m,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(m,y,...p){if(y){for(let c=m;c<this._length-y;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+y)];this._length-=y,this.onDeleteEmitter.fire({index:m,amount:y})}for(let c=this._length-1;c>=m;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(m+c)]=p[c];if(p.length&&this.onInsertEmitter.fire({index:m,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(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,p){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(let u=y-1;u>=0;u--)this.set(m+u+p,this.get(m+u));let c=m+y+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<y;c++)this.set(m+c+p,this.get(m+c))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}s.CircularList=l},1439:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(a,d=5){if(typeof a!="object")return a;let l=Array.isArray(a)?[]:{};for(let _ in a)l[_]=d<=1?a[_]:a[_]&&o(a[_],d-1);return l}},8055:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,a=0,d=0,l=0;var _,m,y,p,c;function u(f){let v=f.toString(16);return v.length<2?"0"+v:v}function h(f,v){return f<v?(v+.05)/(f+.05):(f+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(v,S,g,x){return x!==void 0?`#${u(v)}${u(S)}${u(g)}${u(x)}`:`#${u(v)}${u(S)}${u(g)}`},f.toRgba=function(v,S,g,x=255){return(v<<24|S<<16|g<<8|x)>>>0},f.toColor=function(v,S,g,x){return{css:f.toCss(v,S,g,x),rgba:f.toRgba(v,S,g,x)}}})(_||(s.channels=_={})),(function(f){function v(S,g){return l=Math.round(255*g),[o,a,d]=c.toChannels(S.rgba),{css:_.toCss(o,a,d,l),rgba:_.toRgba(o,a,d,l)}}f.blend=function(S,g){if(l=(255&g.rgba)/255,l===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,w=g.rgba>>16&255,E=g.rgba>>8&255,P=S.rgba>>24&255,O=S.rgba>>16&255,F=S.rgba>>8&255;return o=P+Math.round((x-P)*l),a=O+Math.round((w-O)*l),d=F+Math.round((E-F)*l),{css:_.toCss(o,a,d),rgba:_.toRgba(o,a,d)}},f.isOpaque=function(S){return(255&S.rgba)==255},f.ensureContrastRatio=function(S,g,x){let w=c.ensureContrastRatio(S.rgba,g.rgba,x);if(w)return _.toColor(w>>24&255,w>>16&255,w>>8&255)},f.opaque=function(S){let g=(255|S.rgba)>>>0;return[o,a,d]=c.toChannels(g),{css:_.toCss(o,a,d),rgba:g}},f.opacity=v,f.multiplyOpacity=function(S,g){return l=255&S.rgba,v(S,l*g/255)},f.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(m||(s.color=m={})),(function(f){let v,S;try{let g=document.createElement("canvas");g.width=1,g.height=1;let x=g.getContext("2d",{willReadFrequently:!0});x&&(v=x,v.globalCompositeOperation="copy",S=v.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return o=parseInt(g.slice(1,2).repeat(2),16),a=parseInt(g.slice(2,3).repeat(2),16),d=parseInt(g.slice(3,4).repeat(2),16),_.toColor(o,a,d);case 5:return o=parseInt(g.slice(1,2).repeat(2),16),a=parseInt(g.slice(2,3).repeat(2),16),d=parseInt(g.slice(3,4).repeat(2),16),l=parseInt(g.slice(4,5).repeat(2),16),_.toColor(o,a,d,l);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}let x=g.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(x)return o=parseInt(x[1]),a=parseInt(x[2]),d=parseInt(x[3]),l=Math.round(255*(x[5]===void 0?1:parseFloat(x[5]))),_.toColor(o,a,d,l);if(!v||!S)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=S,v.fillStyle=g,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[o,a,d,l]=v.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(o,a,d,l),css:g}}})(y||(s.css=y={})),(function(f){function v(S,g,x){let w=S/255,E=g/255,P=x/255;return .2126*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))}f.relativeLuminance=function(S){return v(S>>16&255,S>>8&255,255&S)},f.relativeLuminance2=v})(p||(s.rgb=p={})),(function(f){function v(g,x,w){let E=g>>24&255,P=g>>16&255,O=g>>8&255,F=x>>24&255,A=x>>16&255,V=x>>8&255,B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));for(;B<w&&(F>0||A>0||V>0);)F-=Math.max(0,Math.ceil(.1*F)),A-=Math.max(0,Math.ceil(.1*A)),V-=Math.max(0,Math.ceil(.1*V)),B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));return(F<<24|A<<16|V<<8|255)>>>0}function S(g,x,w){let E=g>>24&255,P=g>>16&255,O=g>>8&255,F=x>>24&255,A=x>>16&255,V=x>>8&255,B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));for(;B<w&&(F<255||A<255||V<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),A=Math.min(255,A+Math.ceil(.1*(255-A))),V=Math.min(255,V+Math.ceil(.1*(255-V))),B=h(p.relativeLuminance2(F,A,V),p.relativeLuminance2(E,P,O));return(F<<24|A<<16|V<<8|255)>>>0}f.blend=function(g,x){if(l=(255&x)/255,l===1)return x;let w=x>>24&255,E=x>>16&255,P=x>>8&255,O=g>>24&255,F=g>>16&255,A=g>>8&255;return o=O+Math.round((w-O)*l),a=F+Math.round((E-F)*l),d=A+Math.round((P-A)*l),_.toRgba(o,a,d)},f.ensureContrastRatio=function(g,x,w){let E=p.relativeLuminance(g>>8),P=p.relativeLuminance(x>>8);if(h(E,P)<w){if(P<E){let A=v(g,x,w),V=h(E,p.relativeLuminance(A>>8));if(V<w){let B=S(g,x,w);return V>h(E,p.relativeLuminance(B>>8))?A:B}return A}let O=S(g,x,w),F=h(E,p.relativeLuminance(O>>8));if(F<w){let A=v(g,x,w);return F>h(E,p.relativeLuminance(A>>8))?O:A}return O}},f.reduceLuminance=v,f.increaseLuminance=S,f.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]}})(c||(s.rgba=c={})),s.toPaddedHex=u,s.contrastRatio=h},8969:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=o(844),d=o(2585),l=o(4348),_=o(7866),m=o(744),y=o(7302),p=o(6975),c=o(8460),u=o(1753),h=o(1480),f=o(7994),v=o(9282),S=o(5435),g=o(5981),x=o(2660),w=!1;class E extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((O=>{this._onScrollApi?.fire(O.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(O){for(let F in O)this.optionsService.options[F]=O[F]}constructor(O){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 l.InstantiationService,this.optionsService=this.register(new y.OptionsService(O)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(p.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(u.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,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 g.WriteBuffer(((F,A)=>this._inputHandler.parse(F,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,F){this._writeBuffer.write(O,F)}writeSync(O,F){this._logService.logLevel<=d.LogLevelEnum.WARN&&!w&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w=!0),this._writeBuffer.writeSync(O,F)}input(O,F=!0){this.coreService.triggerDataEvent(O,F)}resize(O,F){isNaN(O)||isNaN(F)||(O=Math.max(O,m.MINIMUM_COLS),F=Math.max(F,m.MINIMUM_ROWS),this._bufferService.resize(O,F))}scroll(O,F=!1){this._bufferService.scroll(O,F)}scrollLines(O,F,A){this._bufferService.scrollLines(O,F,A)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){let F=O-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(O,F){return this._inputHandler.registerEscHandler(O,F)}registerDcsHandler(O,F){return this._inputHandler.registerDcsHandler(O,F)}registerCsiHandler(O,F){return this._inputHandler.registerCsiHandler(O,F)}registerOscHandler(O,F){return this._inputHandler.registerOscHandler(O,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1,F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?O=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let O=[];O.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let F of O)F.dispose()}))}}}s.CoreTerminal=E},8460:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===o)return void this._listeners.splice(a,1)}}})),this._event}fire(o,a){let d=[];for(let l=0;l<this._listeners.length;l++)d.push(this._listeners[l]);for(let l=0;l<d.length;l++)d[l].call(void 0,o,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,a){return o((d=>a.fire(d)))},s.runAndSubscribe=function(o,a){return a(void 0),o((d=>a(d)))}},5435:function(n,s,o){var a=this&&this.__decorate||function(I,C,L,T){var D,N=arguments.length,G=N<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(I,C,L,T);else for(var j=I.length-1;j>=0;j--)(D=I[j])&&(G=(N<3?D(G):N>3?D(C,L,G):D(C,L))||G);return N>3&&G&&Object.defineProperty(C,L,G),G},d=this&&this.__param||function(I,C){return function(L,T){C(L,T,I)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let l=o(2584),_=o(7116),m=o(2015),y=o(844),p=o(482),c=o(8437),u=o(8460),h=o(643),f=o(511),v=o(3734),S=o(2585),g=o(1480),x=o(6242),w=o(6351),E=o(5941),P={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function F(I,C){if(I>24)return C.setWinLines||!1;switch(I){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var A;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(s.WindowsOptionsReportType=A={}));let V=0;class B extends y.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,T,D,N,G,j,Y,H=new m.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=T,this._logService=D,this._optionsService=N,this._oscLinkService=G,this._coreMouseService=j,this._unicodeService=Y,this._parser=H,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p.StringToUtf32,this._utf8Decoder=new p.Utf8ToUtf32,this._workCell=new f.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 u.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new u.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new u.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new u.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new u.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new u.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new u.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new u.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new u.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new u.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new u.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 R(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:W.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,W,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:W,data:q})})),this._parser.setDcsHandlerFallback(((k,W,q)=>{W==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:W,payload:q})})),this._parser.setPrintHandler(((k,W,q)=>this.print(k,W,q))),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(l.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(l.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(l.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(l.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(l.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(l.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(l.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(l.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(l.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new x.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new x.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new x.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new x.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new x.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new x.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new x.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new x.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new x.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new x.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new x.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new x.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 w.DcsHandler(((k,W)=>this.requestStatusString(k,W))))}_preserveStack(C,L,T,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=T,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,T)=>setTimeout((()=>T("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let T,D=this._activeBuffer.x,N=this._activeBuffer.y,G=0,j=this._parseStack.paused;if(j){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(T),T;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>O&&(G=this._parseStack.position+O)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(k=>String.fromCharCode(k))).join("")}"`),typeof C=="string"?C.split("").map((k=>k.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<O&&(this._parseBuffer=new Uint32Array(Math.min(C.length,O))),j||this._dirtyRowTracker.clearRange(),C.length>O)for(let k=G;k<C.length;k+=O){let W=k+O<C.length?k+O:C.length,q=typeof C=="string"?this._stringDecoder.decode(C.substring(k,W),this._parseBuffer):this._utf8Decoder.decode(C.subarray(k,W),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,q))return this._preserveStack(D,N,q,k),this._logSlowResolvingAsync(T),T}else if(!j){let k=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,k))return this._preserveStack(D,N,k,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire();let Y=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),H=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);H<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(H,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(C,L,T){let D,N,G=this._charsetService.charset,j=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,H=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,W=this._curAttrData,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-L>0&&q.getWidth(this._activeBuffer.x-1)===2&&q.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let $=this._parser.precedingJoinState;for(let X=L;X<T;++X){if(D=C[X],D<127&&G){let me=G[String.fromCharCode(D)];me&&(D=me.charCodeAt(0))}let J=this._unicodeService.charProperties(D,$);N=g.UnicodeService.extractWidth(J);let ce=g.UnicodeService.extractShouldJoin(J),de=ce?g.UnicodeService.extractWidth($):0;if($=J,j&&this._onA11yChar.fire((0,p.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-de>Y){if(H){let me=q,te=this._activeBuffer.x-de;for(this._activeBuffer.x=de,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),q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),de>0&&q instanceof c.BufferLine&&q.copyCellsFrom(me,te,0,de,!1);te<Y;)me.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(ce&&this._activeBuffer.x){let me=q.getWidth(this._activeBuffer.x-1)?1:2;q.addCodepointToCell(this._activeBuffer.x-me,D,N);for(let te=N-de;--te>=0;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(k&&(q.insertCells(this._activeBuffer.x,N-de,this._activeBuffer.getNullCell(W)),q.getWidth(Y-1)===2&&q.setCellFromCodepoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,W)),q.setCellFromCodepoint(this._activeBuffer.x++,D,N,W),N>0)for(;--N;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=$,this._activeBuffer.x<Y&&T-L>0&&q.getWidth(this._activeBuffer.x)===0&&!q.hasContent(this._activeBuffer.x)&&q.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(T=>!F(T.params[0],this._optionsService.rawOptions.windowOptions)||L(T)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new w.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new x.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,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(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){let L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){let L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,T,D=!1,N=!1){let G=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);G.replaceCells(L,T,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(G.isWrapped=!1)}_resetBufferLine(C,L=!1){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),T.isWrapped=!1)}eraseInDisplay(C,L=!1){let T;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);T<this._bufferService.rows;T++)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 3:let D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;L--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){let L=this._parser.precedingJoinState;if(!L)return!0;let T=C.params[0]||1,D=g.UnicodeService.extractWidth(L),N=this._activeBuffer.x-D,G=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),j=new Uint32Array(G.length*T),Y=0;for(let k=0;k<G.length;){let W=G.codePointAt(k)||0;j[Y++]=W,k+=W>65535?2:1}let H=Y;for(let k=1;k<T;++k)j.copyWithin(H,0,Y),H+=Y;return this.print(j,0,H),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){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(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,L){let T=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,G=this._coreService,{buffers:j,cols:Y}=this._bufferService,{active:H,alt:k}=j,W=this._optionsService.rawOptions,q=ce=>ce?1:2,$=C.params[0];return X=$,J=L?$===2?4:$===4?q(G.modes.insertMode):$===12?3:$===20?q(W.convertEol):0:$===1?q(T.applicationCursorKeys):$===3?W.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:$===6?q(T.origin):$===7?q(T.wraparound):$===8?3:$===9?q(D==="X10"):$===12?q(W.cursorBlink):$===25?q(!G.isCursorHidden):$===45?q(T.reverseWraparound):$===66?q(T.applicationKeypad):$===67?4:$===1e3?q(D==="VT200"):$===1002?q(D==="DRAG"):$===1003?q(D==="ANY"):$===1004?q(T.sendFocus):$===1005?4:$===1006?q(N==="SGR"):$===1015?4:$===1016?q(N==="SGR_PIXELS"):$===1048?1:$===47||$===1047||$===1049?q(H===k):$===2004?q(T.bracketedPasteMode):0,G.triggerDataEvent(`${l.C0.ESC}[${L?"":"?"}${X};${J}$y`),!0;var X,J}_updateAttrColor(C,L,T,D,N){return L===2?(C|=50331648,C&=-16777216,C|=v.AttributeData.fromColorRGB([T,D,N])):L===5&&(C&=-50331904,C|=33554432|255&T),C}_extractColor(C,L,T){let D=[0,0,-1,0,0,0],N=0,G=0;do{if(D[G+N]=C.params[L+G],C.hasSubParams(L+G)){let j=C.getSubParams(L+G),Y=0;do D[1]===5&&(N=1),D[G+Y+1+N]=j[Y];while(++Y<j.length&&Y+G+1+N<D.length);break}if(D[1]===5&&G+N>=2||D[1]===2&&G+N>=5)break;D[1]&&(N=1)}while(++G+L<C.length&&G+N<D.length);for(let j=2;j<D.length;++j)D[j]===-1&&(D[j]=0);switch(D[0]){case 38:T.fg=this._updateAttrColor(T.fg,D[1],D[3],D[4],D[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,D[1],D[3],D[4],D[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,D[1],D[3],D[4],D[5])}return G}_processUnderline(C,L){L.extended=L.extended.clone(),(!~C||C>5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=c.DEFAULT_ATTR_DATA.fg,C.bg=c.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;let L=C.length,T,D=this._curAttrData;for(let N=0;N<L;N++)T=C.params[N],T>=30&&T<=37?(D.fg&=-50331904,D.fg|=16777216|T-30):T>=40&&T<=47?(D.bg&=-50331904,D.bg|=16777216|T-40):T>=90&&T<=97?(D.fg&=-50331904,D.fg|=16777224|T-90):T>=100&&T<=107?(D.bg&=-50331904,D.bg|=16777224|T-100):T===0?this._processSGR0(D):T===1?D.fg|=134217728:T===3?D.bg|=67108864:T===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,D)):T===5?D.fg|=536870912:T===7?D.fg|=67108864:T===8?D.fg|=1073741824:T===9?D.fg|=2147483648:T===2?D.bg|=134217728:T===21?this._processUnderline(2,D):T===22?(D.fg&=-134217729,D.bg&=-134217729):T===23?D.bg&=-67108865:T===24?(D.fg&=-268435457,this._processUnderline(0,D)):T===25?D.fg&=-536870913:T===27?D.fg&=-67108865:T===28?D.fg&=-1073741825:T===29?D.fg&=2147483647:T===39?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):T===49?(D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?N+=this._extractColor(C,N,D):T===53?D.bg|=1073741824:T===55?D.bg&=-1073741825:T===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):T===100?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${L};${T}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${L};${T}R`)}return!0}softReset(C){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(C){let L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let T=L%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(C){let L=C.params[0]||1,T;return(C.length<2||(T=C.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(C){if(!F(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){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(C){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(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){let L=[],T=C.split(";");for(;T.length>1;){let D=T.shift(),N=T.shift();if(/^\d+$/.exec(D)){let G=parseInt(D);if(z(G))if(N==="?")L.push({type:0,index:G});else{let j=(0,E.parseColor)(N);j&&L.push({type:1,index:G,color:j})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){let L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();let T=C.split(":"),D,N=T.findIndex((G=>G.startsWith("id=")));return N!==-1&&(D=T[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){let T=C.split(";");for(let D=0;D<T.length&&!(L>=this._specialColors.length);++D,++L)if(T[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{let N=(0,E.parseColor)(T[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;let L=[],T=C.split(";");for(let D=0;D<T.length;++D)if(/^\d+$/.exec(T[D])){let N=parseInt(T[D]);z(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){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(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(P[C[0]],_.CHARSETS[C[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 C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,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(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){let C=new f.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){let T=this._activeBuffer.ybase+this._activeBuffer.y+L,D=this._activeBuffer.lines.get(T);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,L){let T=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${N}${l.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}s.InputHandler=B;let R=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,C){I>C&&(V=I,I=C,C=V),I<this.start&&(this.start=I),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function z(I){return 0<=I&&I<256}R=a([d(0,S.IBufferService)],R)},844:(n,s)=>{function o(a){for(let d of a)d.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 d=this._disposables.indexOf(a);d!==-1&&this._disposables.splice(d,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=o,s.getDisposeArrayDisposable=function(a){return{dispose:()=>o(a)}}},1505:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(d,l,_){this._data[d]||(this._data[d]={}),this._data[d][l]=_}get(d,l){return this._data[d]?this._data[d][l]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(a,d,l,_,m){this._data.get(a,d)||this._data.set(a,d,new o),this._data.get(a,d).set(l,_,m)}get(a,d,l,_){return this._data.get(a,d)?.get(l,_)}clear(){this._data.clear()}}},6114:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;let o=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;let d=o.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[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(o)},6106:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(o=this._search(this._getKey(a)),this._array.splice(o,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let d=this._getKey(a);if(d===void 0||(o=this._search(d),o===-1)||this._getKey(this._array[o])!==d)return!1;do if(this._array[o]===a)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===d);return!1}*getKeyIterator(a){if(this._array.length!==0&&(o=this._search(a),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===a))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===a)}forEachByKey(a,d){if(this._array.length!==0&&(o=this._search(a),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===a))do d(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===a)}values(){return[...this._array].values()}_search(a){let d=0,l=this._array.length-1;for(;l>=d;){let _=d+l>>1,m=this._getKey(this._array[_]);if(m>a)l=_-1;else{if(!(m<a)){for(;_>0&&this._getKey(this._array[_-1])===a;)_--;return _}d=_+1}}return d}}},7226:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=o(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(m){this._idleCallback=void 0;let y=0,p=0,c=m.timeRemaining(),u=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),p=Math.max(y,p),u=m.timeRemaining(),1.5*p>u)return c-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-y))}ms`),void this._start();c=u}this.clear()}}class l extends d{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){let y=Date.now()+m;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=l,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:l,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=o(643);s.updateWindowsModeWrappedState=function(d){let l=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=l?.get(d.cols-1),m=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);m&&_&&(m.isWrapped=_[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&_[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){let l=new o;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}s.AttributeData=o;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){let l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,_=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=_}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=o(6349),d=o(7226),l=o(3734),_=o(8437),m=o(4634),y=o(511),p=o(643),c=o(4863),u=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(h,f,v){this._hasScrollback=h,this._optionsService=f,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=u.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,p.WHITESPACE_CELL_CHAR,p.WHITESPACE_CELL_WIDTH,p.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.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(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,f){return new _.BufferLine(this._bufferService.cols,this.getNullCell(h),f)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;let f=h+this._optionsService.rawOptions.scrollback;return f>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:f}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=_.DEFAULT_ATTR_DATA);let f=this._rows;for(;f--;)this.lines.push(this.getBlankLine(h))}}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(h,f){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),S=0,g=this._getCorrectBufferLength(f);if(g>this.lines.maxLength&&(this.lines.maxLength=g),this.lines.length>0){if(this._cols<h)for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(h,v);let x=0;if(this._rows<f)for(let w=this._rows;w<f;w++)this.lines.length<f+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(h,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+x+1?(this.ybase--,x++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(h,v)));else for(let w=this._rows;w>f;w--)this.lines.length>f+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(g<this.lines.maxLength){let w=this.lines.length-g;w>0&&(this.lines.trimStart(w),this.ybase=Math.max(this.ybase-w,0),this.ydisp=Math.max(this.ydisp-w,0),this.savedY=Math.max(this.savedY-w,0)),this.lines.maxLength=g}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,f-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=f-1,this._isReflowEnabled&&(this._reflow(h,f),this._cols>h))for(let x=0;x<this.lines.length;x++)S+=+this.lines.get(x).resize(h,v);this._cols=h,this._rows=f,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let f=0;for(;this._memoryCleanupPosition<this.lines.length;)if(f+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),f>100)return!0;return h}get _isReflowEnabled(){let h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,f){this._cols!==h&&(h>this._cols?this._reflowLarger(h,f):this._reflowSmaller(h,f))}_reflowLarger(h,f){let v=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(v.length>0){let S=(0,m.reflowLargerCreateNewLayout)(this.lines,v);(0,m.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(h,f,S.countRemoved)}}_reflowLargerAdjustViewport(h,f,v){let S=this.getNullCell(_.DEFAULT_ATTR_DATA),g=v;for(;g-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<f&&this.lines.push(new _.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,f){let v=this.getNullCell(_.DEFAULT_ATTR_DATA),S=[],g=0;for(let x=this.lines.length-1;x>=0;x--){let w=this.lines.get(x);if(!w||!w.isWrapped&&w.getTrimmedLength()<=h)continue;let E=[w];for(;w.isWrapped&&x>0;)w=this.lines.get(--x),E.unshift(w);let P=this.ybase+this.y;if(P>=x&&P<x+E.length)continue;let O=E[E.length-1].getTrimmedLength(),F=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,h),A=F.length-E.length,V;V=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+A):Math.max(0,this.lines.length-this.lines.maxLength+A);let B=[];for(let T=0;T<A;T++){let D=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);B.push(D)}B.length>0&&(S.push({start:x+E.length+g,newLines:B}),g+=B.length),E.push(...B);let R=F.length-1,z=F[R];z===0&&(R--,z=F[R]);let I=E.length-A-1,C=O;for(;I>=0;){let T=Math.min(C,z);if(E[R]===void 0)break;if(E[R].copyCellsFrom(E[I],C-T,z-T,T,!0),z-=T,z===0&&(R--,z=F[R]),C-=T,C===0){I--;let D=Math.max(I,0);C=(0,m.getWrappedLineTrimmedLength)(E,D,this._cols)}}for(let T=0;T<E.length;T++)F[T]<h&&E[T].setCell(F[T],v);let L=A-V;for(;L-- >0;)this.ybase===0?this.y<f-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+g)-f&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+f-1)}if(S.length>0){let x=[],w=[];for(let R=0;R<this.lines.length;R++)w.push(this.lines.get(R));let E=this.lines.length,P=E-1,O=0,F=S[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+g);let A=0;for(let R=Math.min(this.lines.maxLength-1,E+g-1);R>=0;R--)if(F&&F.start>P+A){for(let z=F.newLines.length-1;z>=0;z--)this.lines.set(R--,F.newLines[z]);R++,x.push({index:P+1,amount:F.newLines.length}),A+=F.newLines.length,F=S[++O]}else this.lines.set(R,w[P--]);let V=0;for(let R=x.length-1;R>=0;R--)x[R].index+=V,this.lines.onInsertEmitter.fire(x[R]),V+=x[R].amount;let B=Math.max(0,E+g-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(h,f,v=0,S){let g=this.lines.get(h);return g?g.translateToString(f,v,S):""}getWrappedRangeForLine(h){let f=h,v=h;for(;f>0&&this.lines.get(f).isWrapped;)f--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:f,last:v}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let f=0;f<this.markers.length;f++)this.markers[f].line===h&&(this.markers[f].dispose(),this.markers.splice(f--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){let f=new c.Marker(h);return this.markers.push(f),f.register(this.lines.onTrim((v=>{f.line-=v,f.line<0&&f.dispose()}))),f.register(this.lines.onInsert((v=>{f.line>=v.index&&(f.line+=v.amount)}))),f.register(this.lines.onDelete((v=>{f.line>=v.index&&f.line<v.index+v.amount&&f.dispose(),f.line>v.index&&(f.line-=v.amount)}))),f.register(f.onDispose((()=>this._removeMarker(f)))),f}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=o(3734),d=o(511),l=o(643),_=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let m=0;class y{constructor(c,u,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let f=u||d.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let v=0;v<c;++v)this.setCell(v,f);this.length=c}get(c){let u=this._data[3*c+0],h=2097151&u;return[this._data[3*c+1],2097152&u?this._combined[c]:h?(0,_.stringFromCodePoint)(h):"",u>>22,2097152&u?this._combined[c].charCodeAt(this._combined[c].length-1):h]}set(c,u){this._data[3*c+1]=u[l.CHAR_DATA_ATTR_INDEX],u[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=u[1],this._data[3*c+0]=2097152|c|u[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=u[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[l.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 u=this._data[3*c+0];return 2097152&u?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&u}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let u=this._data[3*c+0];return 2097152&u?this._combined[c]:2097151&u?(0,_.stringFromCodePoint)(2097151&u):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,u){return m=3*c,u.content=this._data[m+0],u.fg=this._data[m+1],u.bg=this._data[m+2],2097152&u.content&&(u.combinedData=this._combined[c]),268435456&u.bg&&(u.extended=this._extendedAttrs[c]),u}setCell(c,u){2097152&u.content&&(this._combined[c]=u.combinedData),268435456&u.bg&&(this._extendedAttrs[c]=u.extended),this._data[3*c+0]=u.content,this._data[3*c+1]=u.fg,this._data[3*c+2]=u.bg}setCellFromCodepoint(c,u,h,f){268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=u|h<<22,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}addCodepointToCell(c,u,h){let f=this._data[3*c+0];2097152&f?this._combined[c]+=(0,_.stringFromCodePoint)(u):2097151&f?(this._combined[c]=(0,_.stringFromCodePoint)(2097151&f)+(0,_.stringFromCodePoint)(u),f&=-2097152,f|=2097152):f=u|4194304,h&&(f&=-12582913,f|=h<<22),this._data[3*c+0]=f}insertCells(c,u,h){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length-c){let f=new d.CellData;for(let v=this.length-c-u-1;v>=0;--v)this.setCell(c+u+v,this.loadCell(c+v,f));for(let v=0;v<u;++v)this.setCell(c+v,h)}else for(let f=c;f<this.length;++f)this.setCell(f,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(c,u,h){if(c%=this.length,u<this.length-c){let f=new d.CellData;for(let v=0;v<this.length-c-u;++v)this.setCell(c+v,this.loadCell(c+u+v,f));for(let v=this.length-u;v<this.length;++v)this.setCell(v,h)}else for(let f=c;f<this.length;++f)this.setCell(f,h);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,h)}replaceCells(c,u,h,f=!1){if(f)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length&&this.getWidth(u-1)===2&&!this.isProtected(u)&&this.setCellFromCodepoint(u,0,1,h);c<u&&c<this.length;)this.isProtected(c)||this.setCell(c,h),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),u<this.length&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u,0,1,h);c<u&&c<this.length;)this.setCell(c++,h)}resize(c,u){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let h=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{let f=new Uint32Array(h);f.set(this._data),this._data=f}for(let f=this.length;f<c;++f)this.setCell(f,u)}else{this._data=this._data.subarray(0,h);let f=Object.keys(this._combined);for(let S=0;S<f.length;S++){let g=parseInt(f[S],10);g>=c&&delete this._combined[g]}let v=Object.keys(this._extendedAttrs);for(let S=0;S<v.length;S++){let g=parseInt(v[S],10);g>=c&&delete this._extendedAttrs[g]}}return this.length=c,4*h*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,u=!1){if(u)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,c);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,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 u in c._combined)this._combined[u]=c._combined[u];this._extendedAttrs={};for(let u in c._extendedAttrs)this._extendedAttrs[u]=c._extendedAttrs[u];this.isWrapped=c.isWrapped}clone(){let c=new y(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let u in this._combined)c._combined[u]=this._combined[u];for(let u in this._extendedAttrs)c._extendedAttrs[u]=this._extendedAttrs[u];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,u,h,f,v){let S=c._data;if(v)for(let x=f-1;x>=0;x--){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(u+x)+w];268435456&S[3*(u+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[u+x])}else for(let x=0;x<f;x++){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(u+x)+w];268435456&S[3*(u+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[u+x])}let g=Object.keys(c._combined);for(let x=0;x<g.length;x++){let w=parseInt(g[x],10);w>=u&&(this._combined[w-u+h]=c._combined[w])}}translateToString(c,u,h,f){u=u??0,h=h??this.length,c&&(h=Math.min(h,this.getTrimmedLength())),f&&(f.length=0);let v="";for(;u<h;){let S=this._data[3*u+0],g=2097151&S,x=2097152&S?this._combined[u]:g?(0,_.stringFromCodePoint)(g):l.WHITESPACE_CELL_CHAR;if(v+=x,f)for(let w=0;w<x.length;++w)f.push(u);u+=S>>22||1}return f&&f.push(u),v}}s.BufferLine=y},4841:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,a){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return a*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(n,s)=>{function o(a,d,l){if(d===a.length-1)return a[d].getTrimmedLength();let _=!a[d].hasContent(l-1)&&a[d].getWidth(l-1)===1,m=a[d+1].getWidth(0)===2;return _&&m?l-1:l}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,d,l,_,m){let y=[];for(let p=0;p<a.length-1;p++){let c=p,u=a.get(++c);if(!u.isWrapped)continue;let h=[a.get(p)];for(;c<a.length&&u.isWrapped;)h.push(u),u=a.get(++c);if(_>=p&&_<c){p+=h.length-1;continue}let f=0,v=o(h,f,d),S=1,g=0;for(;S<h.length;){let w=o(h,S,d),E=w-g,P=l-v,O=Math.min(E,P);h[f].copyCellsFrom(h[S],g,v,O,!1),v+=O,v===l&&(f++,v=0),g+=O,g===w&&(S++,g=0),v===0&&f!==0&&h[f-1].getWidth(l-1)===2&&(h[f].copyCellsFrom(h[f-1],l-1,v++,1,!1),h[f-1].setCell(l-1,m))}h[f].replaceCells(v,l,m);let x=0;for(let w=h.length-1;w>0&&(w>f||h[w].getTrimmedLength()===0);w--)x++;x>0&&(y.push(p+h.length-x),y.push(x)),p+=h.length-1}return y},s.reflowLargerCreateNewLayout=function(a,d){let l=[],_=0,m=d[_],y=0;for(let p=0;p<a.length;p++)if(m===p){let c=d[++_];a.onDeleteEmitter.fire({index:p-y,amount:c}),p+=c-1,y+=c,m=d[++_]}else l.push(p);return{layout:l,countRemoved:y}},s.reflowLargerApplyNewLayout=function(a,d){let l=[];for(let _=0;_<d.length;_++)l.push(a.get(d[_]));for(let _=0;_<l.length;_++)a.set(_,l[_]);a.length=d.length},s.reflowSmallerGetNewLineLengths=function(a,d,l){let _=[],m=a.map(((u,h)=>o(a,h,d))).reduce(((u,h)=>u+h)),y=0,p=0,c=0;for(;c<m;){if(m-c<l){_.push(m-c);break}y+=l;let u=o(a,p,d);y>u&&(y-=u,p++);let h=a[p].getWidth(y-1)===2;h&&y--;let f=h?l-1:l;_.push(f),c+=f}return _},s.getWrappedLineTrimmedLength=o},5295:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=o(8460),d=o(844),l=o(9092);class _ extends d.Disposable{constructor(y,p){super(),this._optionsService=y,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 l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,p){this._normal.resize(y,p),this._alt.resize(y,p),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=_},511:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=o(482),d=o(643),l=o(3734);class _ extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(y){let p=new _;return p.setFromCharData(y),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(y){this.fg=y[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let p=!1;if(y[d.CHAR_DATA_CHAR_INDEX].length>2)p=!0;else if(y[d.CHAR_DATA_CHAR_INDEX].length===2){let c=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let u=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=u&&u<=57343?this.content=1024*(c-55296)+u-56320+65536|y[d.CHAR_DATA_WIDTH_INDEX]<<22:p=!0}else p=!0}else this.content=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22;p&&(this.combinedData=y[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=_},643:(n,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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=o(8460),d=o(844);class l{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=l._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,d.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}s.Marker=l,l._nextId=1},7116:(n,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:(n,s)=>{var o,a,d;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
|
|
8
|
-
`,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL="\x7F"})(o||(s.C0=o={})),(function(l){l.PAD="\x80",l.HOP="\x81",l.BPH="\x82",l.NBH="\x83",l.IND="\x84",l.NEL="\x85",l.SSA="\x86",l.ESA="\x87",l.HTS="\x88",l.HTJ="\x89",l.VTS="\x8A",l.PLD="\x8B",l.PLU="\x8C",l.RI="\x8D",l.SS2="\x8E",l.SS3="\x8F",l.DCS="\x90",l.PU1="\x91",l.PU2="\x92",l.STS="\x93",l.CCH="\x94",l.MW="\x95",l.SPA="\x96",l.EPA="\x97",l.SOS="\x98",l.SGCI="\x99",l.SCI="\x9A",l.CSI="\x9B",l.ST="\x9C",l.OSC="\x9D",l.PM="\x9E",l.APC="\x9F"})(a||(s.C1=a={})),(function(l){l.ST=`${o.ESC}\\`})(d||(s.C1_ESCAPED=d={}))},7399:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=o(2584),d={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(l,_,m,y){let p={type:0,cancel:!1,key:void 0},c=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?p.key=_?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(p.key=_?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:p.key=l.ctrlKey?"\b":a.C0.DEL,l.altKey&&(p.key=a.C0.ESC+p.key);break;case 9:if(l.shiftKey){p.key=a.C0.ESC+"[Z";break}p.key=a.C0.HT,p.cancel=!0;break;case 13:p.key=l.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,p.cancel=!0;break;case 27:p.key=a.C0.ESC,l.altKey&&(p.key=a.C0.ESC+a.C0.ESC),p.cancel=!0;break;case 37:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"D",p.key===a.C0.ESC+"[1;3D"&&(p.key=a.C0.ESC+(m?"b":"[1;5D"))):p.key=_?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"C",p.key===a.C0.ESC+"[1;3C"&&(p.key=a.C0.ESC+(m?"f":"[1;5C"))):p.key=_?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"A",m||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(l.metaKey)break;c?(p.key=a.C0.ESC+"[1;"+(c+1)+"B",m||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:l.shiftKey||l.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:l.shiftKey?p.type=2:l.ctrlKey?p.key=a.C0.ESC+"[5;"+(c+1)+"~":p.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?p.type=3:l.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(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(m&&!y||!l.altKey||l.metaKey)!m||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?p.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(p.key=a.C0.US),l.key==="@"&&(p.key=a.C0.NUL)):l.keyCode===65&&(p.type=1);else{let u=d[l.keyCode],h=u?.[l.shiftKey?1:0];if(h)p.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){let f=l.ctrlKey?l.keyCode-64:l.keyCode+32,v=String.fromCharCode(f);l.shiftKey&&(v=v.toUpperCase()),p.key=a.C0.ESC+v}else if(l.keyCode===32)p.key=a.C0.ESC+(l.ctrlKey?a.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let f=l.code.slice(3,4);l.shiftKey||(f=f.toLowerCase()),p.key=a.C0.ESC+f,p.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?p.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?p.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?p.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?p.key=a.C0.DEL:l.keyCode===219?p.key=a.C0.ESC:l.keyCode===220?p.key=a.C0.FS:l.keyCode===221&&(p.key=a.C0.GS)}return p}},482:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,a=0,d=o.length){let l="";for(let _=a;_<d;++_){let m=o[_];m>65535?(m-=65536,l+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):l+=String.fromCharCode(m)}return l},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,a){let d=o.length;if(!d)return 0;let l=0,_=0;if(this._interim){let m=o.charCodeAt(_++);56320<=m&&m<=57343?a[l++]=1024*(this._interim-55296)+m-56320+65536:(a[l++]=this._interim,a[l++]=m),this._interim=0}for(let m=_;m<d;++m){let y=o.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=d)return this._interim=y,l;let p=o.charCodeAt(m);56320<=p&&p<=57343?a[l++]=1024*(y-55296)+p-56320+65536:(a[l++]=y,a[l++]=p)}else y!==65279&&(a[l++]=y)}return l}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,a){let d=o.length;if(!d)return 0;let l,_,m,y,p=0,c=0,u=0;if(this.interim[0]){let v=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let g,x=0;for(;(g=63&this.interim[++x])&&x<4;)S<<=6,S|=g;let w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=w-x;for(;u<E;){if(u>=d)return 0;if(g=o[u++],(192&g)!=128){u--,v=!0;break}this.interim[x++]=g,S<<=6,S|=63&g}v||(w===2?S<128?u--:a[p++]=S:w===3?S<2048||S>=55296&&S<=57343||S===65279||(a[p++]=S):S<65536||S>1114111||(a[p++]=S)),this.interim.fill(0)}let h=d-4,f=u;for(;f<d;){for(;!(!(f<h)||128&(l=o[f])||128&(_=o[f+1])||128&(m=o[f+2])||128&(y=o[f+3]));)a[p++]=l,a[p++]=_,a[p++]=m,a[p++]=y,f+=4;if(l=o[f++],l<128)a[p++]=l;else if((224&l)==192){if(f>=d)return this.interim[0]=l,p;if(_=o[f++],(192&_)!=128){f--;continue}if(c=(31&l)<<6|63&_,c<128){f--;continue}a[p++]=c}else if((240&l)==224){if(f>=d)return this.interim[0]=l,p;if(_=o[f++],(192&_)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,p;if(m=o[f++],(192&m)!=128){f--;continue}if(c=(15&l)<<12|(63&_)<<6|63&m,c<2048||c>=55296&&c<=57343||c===65279)continue;a[p++]=c}else if((248&l)==240){if(f>=d)return this.interim[0]=l,p;if(_=o[f++],(192&_)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,p;if(m=o[f++],(192&m)!=128){f--;continue}if(f>=d)return this.interim[0]=l,this.interim[1]=_,this.interim[2]=m,p;if(y=o[f++],(192&y)!=128){f--;continue}if(c=(7&l)<<18|(63&_)<<12|(63&m)<<6|63&y,c<65536||c>1114111)continue;a[p++]=c}}return p}}},225:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=o(1480),d=[[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]],l=[[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 m=0;m<d.length;++m)_.fill(0,d[m][0],d[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?_[m]:(function(y,p){let c,u=0,h=p.length-1;if(y<p[0][0]||y>p[h][1])return!1;for(;h>=u;)if(c=u+h>>1,y>p[c][1])u=c+1;else{if(!(y<p[c][0]))return!0;h=c-1}return!1})(m,l)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,y){let p=this.wcwidth(m),c=p===0&&y!==0;if(c){let u=a.UnicodeService.extractWidth(y);u===0?c=!1:u>p&&(p=u)}return a.UnicodeService.createPropertyValue(0,p,c)}}},5981:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=o(8460),d=o(844);class l extends d.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let 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(m,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y)}_innerWrite(m=0,y=!0){let p=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],u=this._action(c,y);if(u){let f=v=>Date.now()-p>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(p,v);return void u.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(f)}let h=this._callbacks[this._bufferOffset];if(h&&h(),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=l},5941:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function d(l,_){let m=l.toString(16),y=m.length<2?"0"+m:m;switch(_){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(l){if(!l)return;let _=l.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);let m=o.exec(_);if(m){let y=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/y*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/y*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/y*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),a.exec(_)&&[3,6,9,12].includes(_.length))){let m=_.length/3,y=[0,0,0];for(let p=0;p<3;++p){let c=parseInt(_.slice(m*p,m*p+m),16);y[p]=m===1?c<<4:m===2?c:m===3?c>>4:c>>8}return y}},s.toRgbString=function(l,_=16){let[m,y,p]=l;return`rgb:${d(m,_)}/${d(y,_)}/${d(p,_)}`}},5770:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=o(482),d=o(8742),l=o(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(y,p){this._handlers[y]===void 0&&(this._handlers[y]=[]);let c=this._handlers[y];return c.push(p),{dispose:()=>{let u=c.indexOf(p);u!==-1&&c.splice(u,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(y,p){if(this.reset(),this._ident=y,this._active=this._handlers[y]||_,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(y,p,c){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(y,p,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,p,c))}unhook(y,p=!0){if(this._active.length){let c=!1,u=this._active.length-1,h=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,c=p,h=this._stack.fallThrough,this._stack.paused=!1),!h&&c===!1){for(;u>=0&&(c=this._active[u].unhook(y),c!==!0);u--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,c;u--}for(;u>=0;u--)if(c=this._active[u].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",y);this._active=_,this._ident=0}};let m=new d.Params;m.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=m,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():m,this._data="",this._hitLimit=!1}put(y,p,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,p,c),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let p=!1;if(this._hitLimit)p=!1;else if(y&&(p=this._handler(this._data,this._params),p instanceof Promise))return p.then((c=>(this._params=m,this._data="",this._hitLimit=!1,c)));return this._params=m,this._data="",this._hitLimit=!1,p}}},2015:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=o(844),d=o(8742),l=o(6242),_=o(6351);class m{constructor(u){this.table=new Uint8Array(u)}setDefault(u,h){this.table.fill(u<<4|h)}add(u,h,f,v){this.table[h<<8|u]=f<<4|v}addMany(u,h,f,v){for(let S=0;S<u.length;S++)this.table[h<<8|u[S]]=f<<4|v}}s.TransitionTable=m;let y=160;s.VT500_TRANSITION_TABLE=(function(){let c=new m(4095),u=Array.apply(null,Array(256)).map(((x,w)=>w)),h=(x,w)=>u.slice(x,w),f=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));let S=h(0,14),g;for(g in c.setDefault(1,0),c.addMany(f,0,2,0),S)c.addMany([24,26,153,154],g,3,0),c.addMany(h(128,144),g,3,0),c.addMany(h(144,152),g,3,0),c.add(156,g,0,0),c.add(27,g,11,1),c.add(157,g,4,8),c.addMany([152,158,159],g,0,7),c.add(155,g,11,3),c.add(144,g,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(f,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(h(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(f,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(h(64,127),3,7,0),c.addMany(h(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(h(48,60),4,8,4),c.addMany(h(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(h(32,64),6,0,6),c.add(127,6,0,6),c.addMany(h(64,127),6,0,0),c.addMany(h(32,48),3,9,5),c.addMany(h(32,48),5,9,5),c.addMany(h(48,64),5,0,6),c.addMany(h(64,127),5,7,0),c.addMany(h(32,48),4,9,5),c.addMany(h(32,48),1,9,2),c.addMany(h(32,48),2,9,2),c.addMany(h(48,127),2,10,0),c.addMany(h(48,80),1,10,0),c.addMany(h(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(h(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(h(28,32),9,0,9),c.addMany(h(32,48),9,9,12),c.addMany(h(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(v,11,0,11),c.addMany(h(32,128),11,0,11),c.addMany(h(28,32),11,0,11),c.addMany(v,10,0,10),c.add(127,10,0,10),c.addMany(h(28,32),10,0,10),c.addMany(h(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(h(32,48),10,9,12),c.addMany(v,12,0,12),c.add(127,12,0,12),c.addMany(h(28,32),12,0,12),c.addMany(h(32,48),12,9,12),c.addMany(h(48,64),12,0,11),c.addMany(h(64,127),12,12,13),c.addMany(h(64,127),10,12,13),c.addMany(h(64,127),9,12,13),c.addMany(v,13,13,13),c.addMany(f,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(y,0,2,0),c.add(y,8,5,8),c.add(y,6,0,6),c.add(y,11,0,11),c.add(y,13,13,13),c})();class p extends a.Disposable{constructor(u=s.VT500_TRANSITION_TABLE){super(),this._transitions=u,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,f,v)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,f)=>{},this._escHandlerFb=h=>{},this._errorHandlerFb=h=>h,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 l.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(u,h=[64,126]){let f=0;if(u.prefix){if(u.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=u.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(u.intermediates){if(u.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<u.intermediates.length;++S){let g=u.intermediates.charCodeAt(S);if(32>g||g>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=g}}if(u.final.length!==1)throw new Error("final must be a single byte");let v=u.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return f<<=8,f|=v,f}identToString(u){let h=[];for(;u;)h.push(String.fromCharCode(255&u)),u>>=8;return h.reverse().join("")}setPrintHandler(u){this._printHandler=u}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(u,h){let f=this._identifier(u,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);let v=this._escHandlers[f];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearEscHandler(u){this._escHandlers[this._identifier(u,[48,126])]&&delete this._escHandlers[this._identifier(u,[48,126])]}setEscHandlerFallback(u){this._escHandlerFb=u}setExecuteHandler(u,h){this._executeHandlers[u.charCodeAt(0)]=h}clearExecuteHandler(u){this._executeHandlers[u.charCodeAt(0)]&&delete this._executeHandlers[u.charCodeAt(0)]}setExecuteHandlerFallback(u){this._executeHandlerFb=u}registerCsiHandler(u,h){let f=this._identifier(u);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);let v=this._csiHandlers[f];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearCsiHandler(u){this._csiHandlers[this._identifier(u)]&&delete this._csiHandlers[this._identifier(u)]}setCsiHandlerFallback(u){this._csiHandlerFb=u}registerDcsHandler(u,h){return this._dcsParser.registerHandler(this._identifier(u),h)}clearDcsHandler(u){this._dcsParser.clearHandler(this._identifier(u))}setDcsHandlerFallback(u){this._dcsParser.setHandlerFallback(u)}registerOscHandler(u,h){return this._oscParser.registerHandler(u,h)}clearOscHandler(u){this._oscParser.clearHandler(u)}setOscHandlerFallback(u){this._oscParser.setHandlerFallback(u)}setErrorHandler(u){this._errorHandler=u}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(u,h,f,v,S){this._parseStack.state=u,this._parseStack.handlers=h,this._parseStack.handlerPos=f,this._parseStack.transition=v,this._parseStack.chunkPos=S}parse(u,h,f){let v,S=0,g=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(f===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let w=this._parseStack.handlers,E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(f===!1&&E>-1){for(;E>=0&&(v=w[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(f===!1&&E>-1){for(;E>=0&&(v=w[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(S=u[this._parseStack.chunkPos],v=this._dcsParser.unhook(S!==24&&S!==26,f),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=u[this._parseStack.chunkPos],v=this._oscParser.end(S!==24&&S!==26,f),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,x=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let w=x;w<h;++w){switch(S=u[w],g=this._transitions.table[this.currentState<<8|(S<160?S:y)],g>>4){case 2:for(let A=w+1;;++A){if(A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}if(++A>=h||(S=u[A])<32||S>126&&S<y){this._printHandler(u,w,A),w=A-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:w,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let E=this._csiHandlers[this._collect<<8|S],P=E?E.length-1:-1;for(;P>=0&&(v=E[P](this._params),v!==!0);P--)if(v instanceof Promise)return this._preserveStack(3,E,P,g,w),v;P<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++w<h&&(S=u[w])>47&&S<60);w--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:let O=this._escHandlers[this._collect<<8|S],F=O?O.length-1:-1;for(;F>=0&&(v=O[F](),v!==!0);F--)if(v instanceof Promise)return this._preserveStack(4,O,F,g,w),v;F<0&&this._escHandlerFb(this._collect<<8|S),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|S,this._params);break;case 13:for(let A=w+1;;++A)if(A>=h||(S=u[A])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(u,w,A),w=A-1;break}break;case 14:if(v=this._dcsParser.unhook(S!==24&&S!==26),v)return this._preserveStack(6,[],0,g,w),v;S===27&&(g|=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 A=w+1;;A++)if(A>=h||(S=u[A])<32||S>127&&S<y){this._oscParser.put(u,w,A),w=A-1;break}break;case 6:if(v=this._oscParser.end(S!==24&&S!==26),v)return this._preserveStack(5,[],0,g,w),v;S===27&&(g|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&g}}}s.EscapeSequenceParser=p},6242:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=o(5770),d=o(482),l=[];s.OscParser=class{constructor(){this._state=0,this._active=l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,m){this._handlers[_]===void 0&&(this._handlers[_]=[]);let y=this._handlers[_];return y.push(m),{dispose:()=>{let p=y.indexOf(m);p!==-1&&y.splice(p,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}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=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,m,y){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(_,m,y);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(_,m,y))}start(){this.reset(),this._state=1}put(_,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){let p=_[m++];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&&y-m>0&&this._put(_,m,y)}}end(_,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,p=this._active.length-1,c=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,y=m,c=this._stack.fallThrough,this._stack.paused=!1),!c&&y===!1){for(;p>=0&&(y=this._active[p].end(_),y!==!0);p--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,y;p--}for(;p>=0;p--)if(y=this._active[p].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",_);this._active=l,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,m,y){this._hitLimit||(this._data+=(0,d.utf32ToString)(_,m,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let m=!1;if(this._hitLimit)m=!1;else if(_&&(m=this._handler(this._data),m instanceof Promise))return m.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,m}}},8742:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let o=2147483647;class a{static fromArray(l){let _=new a;if(!l.length)return _;for(let m=Array.isArray(l[0])?1:0;m<l.length;++m){let y=l[m];if(Array.isArray(y))for(let p=0;p<y.length;++p)_.addSubParam(y[p]);else _.addParam(y)}return _}constructor(l=32,_=32){if(this.maxLength=l,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let l=new a(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){let l=[];for(let _=0;_<this.length;++_){l.push(this.params[_]);let m=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];y-m>0&&l.push(Array.prototype.slice.call(this._subParams,m,y))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>o?o:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>o?o:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){let _=this._subParamsIdx[l]>>8,m=255&this._subParamsIdx[l];return m-_>0?this._subParams.subarray(_,m):null}getSubParamsAll(){let l={};for(let _=0;_<this.length;++_){let m=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];y-m>0&&(l[_]=this._subParams.slice(m,y))}return l}addDigit(l){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let m=this._digitIsSub?this._subParams:this.params,y=m[_-1];m[_-1]=~y?Math.min(10*y+l,o):l}}s.Params=a},5741:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,a){let d={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(d),a.dispose=()=>this._wrappedAddonDispose(d),a.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let a=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===o){a=d;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(a,1)}}},8771:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=o(3785),d=o(511);s.BufferApiView=class{constructor(l,_){this._buffer=l,this.type=_}init(l){return this._buffer=l,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(l){let _=this._buffer.lines.get(l);if(_)return new a.BufferLineApiView(_)}getNullCell(){return new d.CellData}}},3785:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=o(511);s.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,l){if(!(d<0||d>=this._line.length))return l?(this._line.loadCell(d,l),l):this._line.loadCell(d,new a.CellData)}translateToString(d,l,_){return this._line.translateToString(d,l,_)}}},8285:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=o(8771),d=o(8460),l=o(844);class _ extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new d.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:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,a){return this._core.registerCsiHandler(o,(d=>a(d.toArray())))}addCsiHandler(o,a){return this.registerCsiHandler(o,a)}registerDcsHandler(o,a){return this._core.registerDcsHandler(o,((d,l)=>a(d,l.toArray())))}addDcsHandler(o,a){return this.registerDcsHandler(o,a)}registerEscHandler(o,a){return this._core.registerEscHandler(o,a)}addEscHandler(o,a){return this.registerEscHandler(o,a)}registerOscHandler(o,a){return this._core.registerOscHandler(o,a)}addOscHandler(o,a){return this.registerOscHandler(o,a)}}},7090:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(n,s,o){var a=this&&this.__decorate||function(c,u,h,f){var v,S=arguments.length,g=S<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,u,h,f);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(g=(S<3?v(g):S>3?v(u,h,g):v(u,h))||g);return S>3&&g&&Object.defineProperty(u,h,g),g},d=this&&this.__param||function(c,u){return function(h,f){u(h,f,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let l=o(8460),_=o(844),m=o(5295),y=o(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 l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.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 m.BufferSet(c,this))}resize(c,u){this.cols=c,this.rows=u,this.buffers.resize(c,u),this._onResize.fire({cols:c,rows:u})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,u=!1){let h=this.buffer,f;f=this._cachedBlankLine,f&&f.length===this.cols&&f.getFg(0)===c.fg&&f.getBg(0)===c.bg||(f=h.getBlankLine(c,u),this._cachedBlankLine=f),f.isWrapped=u;let v=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let g=h.lines.isFull;S===h.lines.length-1?g?h.lines.recycle().copyFrom(f):h.lines.push(f.clone()):h.lines.splice(S+1,0,f.clone()),g?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let g=S-v+1;h.lines.shiftElements(v+1,g-1,-1),h.lines.set(S,f.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(c,u,h){let f=this.buffer;if(c<0){if(f.ydisp===0)return;this.isUserScrolling=!0}else c+f.ydisp>=f.ybase&&(this.isUserScrolling=!1);let v=f.ydisp;f.ydisp=Math.max(Math.min(f.ydisp+c,f.ybase),0),v!==f.ydisp&&(u||this._onScroll.fire(f.ydisp))}};s.BufferService=p=a([d(0,y.IOptionsService)],p)},7994:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,a){this._charsets[o]=a,this.glevel===o&&(this.charset=a)}}},1753:function(n,s,o){var a=this&&this.__decorate||function(f,v,S,g){var x,w=arguments.length,E=w<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,v,S,g);else for(var P=f.length-1;P>=0;P--)(x=f[P])&&(E=(w<3?x(E):w>3?x(v,S,E):x(v,S))||E);return w>3&&E&&Object.defineProperty(v,S,E),E},d=this&&this.__param||function(f,v){return function(S,g){v(S,g,f)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let l=o(2585),_=o(8460),m=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:f=>f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)},VT200:{events:19,restrict:f=>f.action!==32},DRAG:{events:23,restrict:f=>f.action!==32||f.button!==3},ANY:{events:31,restrict:f=>!0}};function p(f,v){let S=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(S|=64,S|=f.action):(S|=3&f.button,4&f.button&&(S|=64),8&f.button&&(S|=128),f.action===32?S|=32:f.action!==0||v||(S|=3)),S}let c=String.fromCharCode,u={DEFAULT:f=>{let v=[p(f,!1)+32,f.col+32,f.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:f=>{let v=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${p(f,!0)};${f.col};${f.row}${v}`},SGR_PIXELS:f=>{let v=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${p(f,!0)};${f.x};${f.y}${v}`}},h=s.CoreMouseService=class extends m.Disposable{constructor(f,v){super(),this._bufferService=f,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 S of Object.keys(y))this.addProtocol(S,y[S]);for(let S of Object.keys(u))this.addEncoding(S,u[S]);this.reset()}addProtocol(f,v){this._protocols[f]=v}addEncoding(f,v){this._encodings[f]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(f){if(!this._protocols[f])throw new Error(`unknown protocol "${f}"`);this._activeProtocol=f,this._onProtocolChange.fire(this._protocols[f].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(f){if(!this._encodings[f])throw new Error(`unknown encoding "${f}"`);this._activeEncoding=f}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(f){if(f.col<0||f.col>=this._bufferService.cols||f.row<0||f.row>=this._bufferService.rows||f.button===4&&f.action===32||f.button===3&&f.action!==32||f.button!==4&&(f.action===2||f.action===3)||(f.col++,f.row++,f.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,f,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(f))return!1;let v=this._encodings[this._activeEncoding](f);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=f,!0}explainEvents(f){return{down:!!(1&f),up:!!(2&f),drag:!!(4&f),move:!!(8&f),wheel:!!(16&f)}}_equalEvents(f,v,S){if(S){if(f.x!==v.x||f.y!==v.y)return!1}else if(f.col!==v.col||f.row!==v.row)return!1;return f.button===v.button&&f.action===v.action&&f.ctrl===v.ctrl&&f.alt===v.alt&&f.shift===v.shift}};s.CoreMouseService=h=a([d(0,l.IBufferService),d(1,l.ICoreService)],h)},6975:function(n,s,o){var a=this&&this.__decorate||function(h,f,v,S){var g,x=arguments.length,w=x<3?f:S===null?S=Object.getOwnPropertyDescriptor(f,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,f,v,S);else for(var E=h.length-1;E>=0;E--)(g=h[E])&&(w=(x<3?g(w):x>3?g(f,v,w):g(f,v))||w);return x>3&&w&&Object.defineProperty(f,v,w),w},d=this&&this.__param||function(h,f){return function(v,S){f(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let l=o(1439),_=o(8460),m=o(844),y=o(2585),p=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),u=s.CoreService=class extends m.Disposable{constructor(h,f,v){super(),this._bufferService=h,this._logService=f,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,l.clone)(p),this.decPrivateModes=(0,l.clone)(c)}reset(){this.modes=(0,l.clone)(p),this.decPrivateModes=(0,l.clone)(c)}triggerDataEvent(h,f=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;f&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),f&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((S=>S.charCodeAt(0))))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`,(()=>h.split("").map((f=>f.charCodeAt(0))))),this._onBinary.fire(h))}};s.CoreService=u=a([d(0,y.IBufferService),d(1,y.ILogService),d(2,y.IOptionsService)],u)},9074:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=o(8055),d=o(8460),l=o(844),_=o(6106),m=0,y=0;class p extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;let f=new c(h);if(f){let v=f.marker.onDispose((()=>f.dispose()));f.onDispose((()=>{f&&(this._decorations.delete(f)&&this._onDecorationRemoved.fire(f),v.dispose())})),this._decorations.insert(f),this._onDecorationRegistered.fire(f)}return f}reset(){for(let h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,f,v){let S=0,g=0;for(let x of this._decorations.getKeyIterator(f))S=x.options.x??0,g=S+(x.options.width??1),h>=S&&h<g&&(!v||(x.options.layer??"bottom")===v)&&(yield x)}forEachDecorationAtCell(h,f,v,S){this._decorations.forEachByKey(f,(g=>{m=g.options.x??0,y=m+(g.options.width??1),h>=m&&h<y&&(!v||(g.options.layer??"bottom")===v)&&S(g)}))}}s.DecorationService=p;class c extends l.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(h){super(),this.options=h,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=h.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=o(2585),d=o(8343);class l{constructor(...m){this._entries=new Map;for(let[y,p]of m)this.set(y,p)}set(m,y){let p=this._entries.get(m);return this._entries.set(m,y),p}forEach(m){for(let[y,p]of this._entries.entries())m(y,p)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}s.ServiceCollection=l,s.InstantiationService=class{constructor(){this._services=new l,this._services.set(a.IInstantiationService,this)}setService(_,m){this._services.set(_,m)}getService(_){return this._services.get(_)}createInstance(_,...m){let y=(0,d.getServiceDependencies)(_).sort(((u,h)=>u.index-h.index)),p=[];for(let u of y){let h=this._services.get(u.id);if(!h)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${u.id}.`);p.push(h)}let c=y.length>0?y[0].index:m.length;if(m.length!==c)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${c+1} conflicts with ${m.length} static arguments`);return new _(...m,...p)}}},7866:function(n,s,o){var a=this&&this.__decorate||function(c,u,h,f){var v,S=arguments.length,g=S<3?u:f===null?f=Object.getOwnPropertyDescriptor(u,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,u,h,f);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(g=(S<3?v(g):S>3?v(u,h,g):v(u,h))||g);return S>3&&g&&Object.defineProperty(u,h,g),g},d=this&&this.__param||function(c,u){return function(h,f){u(h,f,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let l=o(844),_=o(2585),m={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF},y,p=s.LogService=class extends l.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()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let u=0;u<c.length;u++)typeof c[u]=="function"&&(c[u]=c[u]())}_log(c,u,h){this._evalLazyOptionalParams(h),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+u,...h)}trace(c,...u){this._logLevel<=_.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,u)}debug(c,...u){this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,u)}info(c,...u){this._logLevel<=_.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,u)}warn(c,...u){this._logLevel<=_.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,u)}error(c,...u){this._logLevel<=_.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,u)}};s.LogService=p=a([d(0,_.IOptionsService)],p),s.setTraceLogger=function(c){y=c},s.traceCall=function(c,u,h){if(typeof h.value!="function")throw new Error("not supported");let f=h.value;h.value=function(...v){if(y.logLevel!==_.LogLevelEnum.TRACE)return f.apply(this,v);y.trace(`GlyphRenderer#${f.name}(${v.map((g=>JSON.stringify(g))).join(", ")})`);let S=f.apply(this,v);return y.trace(`GlyphRenderer#${f.name} return`,S),S}}},7302:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=o(8460),d=o(844),l=o(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:l.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 m extends d.Disposable{constructor(p){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let u in p)if(u in c)try{let h=p[u];c[u]=this._sanitizeAndValidateOption(u,h)}catch(h){console.error(h)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,d.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(p,c){return this.onOptionChange((u=>{u===p&&c(this.rawOptions[p])}))}onMultipleOptionChange(p,c){return this.onOptionChange((u=>{p.indexOf(u)!==-1&&c()}))}_setupOptions(){let p=u=>{if(!(u in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);return this.rawOptions[u]},c=(u,h)=>{if(!(u in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);h=this._sanitizeAndValidateOption(u,h),this.rawOptions[u]!==h&&(this.rawOptions[u]=h,this._onOptionChange.fire(u))};for(let u in this.rawOptions){let h={get:p.bind(this,u),set:c.bind(this,u)};Object.defineProperty(this.options,u,h)}}_sanitizeAndValidateOption(p,c){switch(p){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[p]),!(function(u){return u==="block"||u==="underline"||u==="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=m},2660:function(n,s,o){var a=this&&this.__decorate||function(m,y,p,c){var u,h=arguments.length,f=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,p):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(m,y,p,c);else for(var v=m.length-1;v>=0;v--)(u=m[v])&&(f=(h<3?u(f):h>3?u(y,p,f):u(y,p))||f);return h>3&&f&&Object.defineProperty(y,p,f),f},d=this&&this.__param||function(m,y){return function(p,c){y(p,c,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let l=o(2585),_=s.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){let y=this._bufferService.buffer;if(m.id===void 0){let v=y.addMarker(y.ybase+y.y),S={data:m,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(S,v))),this._dataByLinkId.set(S.id,S),S.id}let p=m,c=this._getEntryIdKey(p),u=this._entriesWithId.get(c);if(u)return this.addLineToLink(u.id,y.ybase+y.y),u.id;let h=y.addMarker(y.ybase+y.y),f={id:this._nextId++,key:this._getEntryIdKey(p),data:p,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(f,h))),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(m,y){let p=this._dataByLinkId.get(m);if(p&&p.lines.every((c=>c.line!==y))){let c=this._bufferService.buffer.addMarker(y);p.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(p,c)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){let p=m.lines.indexOf(y);p!==-1&&(m.lines.splice(p,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};s.OscLinkService=_=a([d(0,l.IBufferService)],_)},8343:(n,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let o="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(d){return d[a]||[]},s.createDecorator=function(d){if(s.serviceRegistry.has(d))return s.serviceRegistry.get(d);let l=function(_,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(p,c,u){c[o]===c?c[a].push({id:p,index:u}):(c[a]=[{id:p,index:u}],c[o]=c)})(l,_,y)};return l.toString=()=>d,s.serviceRegistry.set(d,l),l}},2585:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;let a=o(8343);var d;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(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"})(d||(s.LogLevelEnum=d={})),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:(n,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=o(8460),d=o(225);class l{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,y,p=!1){return(16777215&m)<<3|(3&y)<<1|(p?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let m=new d.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let y=0,p=0,c=m.length;for(let u=0;u<c;++u){let h=m.charCodeAt(u);if(55296<=h&&h<=56319){if(++u>=c)return y+this.wcwidth(h);let S=m.charCodeAt(u);56320<=S&&S<=57343?h=1024*(h-55296)+S-56320+65536:y+=this.wcwidth(S)}let f=this.charProperties(h,p),v=l.extractWidth(f);l.extractShouldJoin(f)&&(v-=l.extractWidth(p)),y+=v,p=f}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}s.UnicodeService=l}},t={};function r(n){var s=t[n];if(s!==void 0)return s.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var i={};return(()=>{var n=i;Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;let s=r(9042),o=r(3236),a=r(844),d=r(5741),l=r(8285),_=r(7975),m=r(7090),y=["cols","rows"];class p extends a.Disposable{constructor(u){super(),this._core=this.register(new o.Terminal(u)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};let h=v=>this._core.options[v],f=(v,S)=>{this._checkReadonlyOptions(v),this._core.options[v]=S};for(let v in this._core.options){let S={get:h.bind(this,v),set:f.bind(this,v)};Object.defineProperty(this._publicOptions,v,S)}}_checkReadonlyOptions(u){if(y.includes(u))throw new Error(`Option "${u}" 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 m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let u=this._core.coreService.decPrivateModes,h="none";switch(this._core.coreMouseService.activeProtocol){case"X10":h="x10";break;case"VT200":h="vt200";break;case"DRAG":h="drag";break;case"ANY":h="any"}return{applicationCursorKeysMode:u.applicationCursorKeys,applicationKeypadMode:u.applicationKeypad,bracketedPasteMode:u.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:u.origin,reverseWraparoundMode:u.reverseWraparound,sendFocusMode:u.sendFocus,wraparoundMode:u.wraparound}}get options(){return this._publicOptions}set options(u){for(let h in u)this._publicOptions[h]=u[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(u,h=!0){this._core.input(u,h)}resize(u,h){this._verifyIntegers(u,h),this._core.resize(u,h)}open(u){this._core.open(u)}attachCustomKeyEventHandler(u){this._core.attachCustomKeyEventHandler(u)}attachCustomWheelEventHandler(u){this._core.attachCustomWheelEventHandler(u)}registerLinkProvider(u){return this._core.registerLinkProvider(u)}registerCharacterJoiner(u){return this._checkProposedApi(),this._core.registerCharacterJoiner(u)}deregisterCharacterJoiner(u){this._checkProposedApi(),this._core.deregisterCharacterJoiner(u)}registerMarker(u=0){return this._verifyIntegers(u),this._core.registerMarker(u)}registerDecoration(u){return this._checkProposedApi(),this._verifyPositiveIntegers(u.x??0,u.width??0,u.height??0),this._core.registerDecoration(u)}hasSelection(){return this._core.hasSelection()}select(u,h,f){this._verifyIntegers(u,h,f),this._core.select(u,h,f)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(u,h){this._verifyIntegers(u,h),this._core.selectLines(u,h)}dispose(){super.dispose()}scrollLines(u){this._verifyIntegers(u),this._core.scrollLines(u)}scrollPages(u){this._verifyIntegers(u),this._core.scrollPages(u)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(u){this._verifyIntegers(u),this._core.scrollToLine(u)}clear(){this._core.clear()}write(u,h){this._core.write(u,h)}writeln(u,h){this._core.write(u),this._core.write(`\r
|
|
9
|
-
`,h)}paste(
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(w){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&w&&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(w){let E=this._getMouseBufferCoords(w),B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(B&&P&&E)&&this._areCoordsInSelection(E,B,P)}isCellInSelection(w,E){let B=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!B||!P)&&this._areCoordsInSelection([w,E],B,P)}_areCoordsInSelection(w,E,B){return w[1]>E[1]&&w[1]<B[1]||E[1]===B[1]&&w[1]===E[1]&&w[0]>=E[0]&&w[0]<B[0]||E[1]<B[1]&&w[1]===B[1]&&w[0]<B[0]||E[1]<B[1]&&w[1]===E[1]&&w[0]>=E[0]}_selectWordAtCursor(w,E){let B=this._linkifier.currentLink?.link?.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let P=this._getMouseBufferCoords(w);return!!P&&(this._selectWordAt(P,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(w,E){this._model.clearSelection(),w=Math.max(w,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,w],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(w){this._model.handleTrim(w)&&this.refresh()}_getMouseBufferCoords(w){let E=this._mouseService.getCoords(w,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(w){let E=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,w,this._screenElement)[1],B=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=B?0:(E>B&&(E-=B),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(w){return f.isMac?w.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:w.shiftKey}handleMouseDown(w){if(this._mouseDownTimeStamp=w.timeStamp,(w.button!==2||!this.hasSelection)&&w.button===0){if(!this._enabled){if(!this.shouldForceSelection(w))return;w.stopPropagation()}w.preventDefault(),this._dragScrollAmount=0,this._enabled&&w.shiftKey?this._handleIncrementalClick(w):w.detail===1?this._handleSingleClick(w):w.detail===2?this._handleDoubleClick(w):w.detail===3&&this._handleTripleClick(w),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(w){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(w))}_handleSingleClick(w){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(w)?3:0,this._model.selectionStart=this._getMouseBufferCoords(w),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(w){this._selectWordAtCursor(w,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(w){let E=this._getMouseBufferCoords(w);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(w){return w.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(w){if(w.stopImmediatePropagation(),!this._model.selectionStart)return;let E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(w),!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(w),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let B=this._bufferService.buffer;if(this._model.selectionEnd[1]<B.lines.length){let P=B.lines.get(this._model.selectionEnd[1]);P&&P.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let w=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(w.ydisp+this._bufferService.rows,w.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=w.ydisp),this.refresh()}}_handleMouseUp(w){let E=w.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&w.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let B=this._mouseService.getCoords(w,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){let P=(0,d.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let w=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,B=!(!w||!E||w[0]===E[0]&&w[1]===E[1]);B?w&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&w[0]===this._oldSelectionStart[0]&&w[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(w,E,B)):this._oldHasSelection&&this._fireOnSelectionChange(w,E,B)}_fireOnSelectionChange(w,E,B){this._oldSelectionStart=w,this._oldSelectionEnd=E,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(w){this.clearSelection(),this._trimListener.dispose(),this._trimListener=w.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(w,E){let B=E;for(let P=0;E>=P;P++){let W=w.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:W>1&&E!==P&&(B+=W-1)}return B}setSelection(w,E,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[w,E],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(w){this._isClickInSelection(w)||(this._selectWordAtCursor(w,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(w,E,B=!0,P=!0){if(w[0]>=this._bufferService.cols)return;let W=this._bufferService.buffer,A=W.lines.get(w[1]);if(!A)return;let V=W.translateBufferLineToString(w[1],!1),O=this._convertViewportColToCharacterIndex(A,w[0]),R=O,F=w[0]-O,I=0,C=0,L=0,T=0;if(V.charAt(O)===" "){for(;O>0&&V.charAt(O-1)===" ";)O--;for(;R<V.length&&V.charAt(R+1)===" ";)R++}else{let G=w[0],$=w[0];A.getWidth(G)===0&&(I++,G--),A.getWidth($)===2&&(C++,$++);let Y=A.getString($).length;for(Y>1&&(T+=Y-1,R+=Y-1);G>0&&O>0&&!this._isCharWordSeparator(A.loadCell(G-1,this._workCell));){A.loadCell(G-1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,G--):H>1&&(L+=H-1,O-=H-1),O--,G--}for(;$<A.length&&R+1<V.length&&!this._isCharWordSeparator(A.loadCell($+1,this._workCell));){A.loadCell($+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,$++):H>1&&(T+=H-1,R+=H-1),R++,$++}}R++;let D=O+F-I+L,N=Math.min(this._bufferService.cols,R-O+I+C-L-T);if(E||V.slice(O,R).trim()!==""){if(B&&D===0&&A.getCodePoint(0)!==32){let G=W.lines.get(w[1]-1);if(G&&A.isWrapped&&G.getCodePoint(this._bufferService.cols-1)!==32){let $=this._getWordAt([this._bufferService.cols-1,w[1]-1],!1,!0,!1);if($){let Y=this._bufferService.cols-$.start;D-=Y,N+=Y}}}if(P&&D+N===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){let G=W.lines.get(w[1]+1);if(G?.isWrapped&&G.getCodePoint(0)!==32){let $=this._getWordAt([0,w[1]+1],!1,!1,!0);$&&(N+=$.length)}}return{start:D,length:N}}}_selectWordAt(w,E){let B=this._getWordAt(w,E);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,w[1]--;this._model.selectionStart=[B.start,w[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(w){let E=this._getWordAt(w,!0);if(E){let B=w[1];for(;E.start<0;)E.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,B]}}_isCharWordSeparator(w){return w.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(w.getChars())>=0}_selectLineAt(w){let E=this._bufferService.buffer.getWrappedRangeForLine(w),B={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(B,this._bufferService.cols)}};s.SelectionService=x=a([u(3,v.IBufferService),u(4,v.ICoreService),u(5,y.IMouseService),u(6,v.IOptionsService),u(7,y.IRenderService),u(8,y.ICoreBrowserService)],x)},4725:(o,s,n)=>{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=n(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(o,s,n){var a=this&&this.__decorate||function(x,w,E,B){var P,W=arguments.length,A=W<3?w:B===null?B=Object.getOwnPropertyDescriptor(w,E):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,w,E,B);else for(var V=x.length-1;V>=0;V--)(P=x[V])&&(A=(W<3?P(A):W>3?P(w,E,A):P(w,E))||A);return W>3&&A&&Object.defineProperty(w,E,A),A},u=this&&this.__param||function(x,w){return function(E,B){w(E,B,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;let l=n(7239),d=n(8055),m=n(8460),y=n(844),_=n(2585),c=d.css.toColor("#ffffff"),f=d.css.toColor("#000000"),h=d.css.toColor("#ffffff"),p=d.css.toColor("#000000"),v={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let x=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],w=[0,95,135,175,215,255];for(let E=0;E<216;E++){let B=w[E/36%6|0],P=w[E/6%6|0],W=w[E%6];x.push({css:d.channels.toCss(B,P,W),rgba:d.channels.toRgba(B,P,W)})}for(let E=0;E<24;E++){let B=8+10*E;x.push({css:d.channels.toCss(B,B,B),rgba:d.channels.toRgba(B,B,B)})}return x})());let S=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(x){super(),this._optionsService=x,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:c,background:f,cursor:h,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:v,selectionBackgroundOpaque:d.color.blend(f,v),selectionInactiveBackgroundTransparent:v,selectionInactiveBackgroundOpaque:d.color.blend(f,v),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(x={}){let w=this._colors;if(w.foreground=b(x.foreground,c),w.background=b(x.background,f),w.cursor=b(x.cursor,h),w.cursorAccent=b(x.cursorAccent,p),w.selectionBackgroundTransparent=b(x.selectionBackground,v),w.selectionBackgroundOpaque=d.color.blend(w.background,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundTransparent=b(x.selectionInactiveBackground,w.selectionBackgroundTransparent),w.selectionInactiveBackgroundOpaque=d.color.blend(w.background,w.selectionInactiveBackgroundTransparent),w.selectionForeground=x.selectionForeground?b(x.selectionForeground,d.NULL_COLOR):void 0,w.selectionForeground===d.NULL_COLOR&&(w.selectionForeground=void 0),d.color.isOpaque(w.selectionBackgroundTransparent)&&(w.selectionBackgroundTransparent=d.color.opacity(w.selectionBackgroundTransparent,.3)),d.color.isOpaque(w.selectionInactiveBackgroundTransparent)&&(w.selectionInactiveBackgroundTransparent=d.color.opacity(w.selectionInactiveBackgroundTransparent,.3)),w.ansi=s.DEFAULT_ANSI_COLORS.slice(),w.ansi[0]=b(x.black,s.DEFAULT_ANSI_COLORS[0]),w.ansi[1]=b(x.red,s.DEFAULT_ANSI_COLORS[1]),w.ansi[2]=b(x.green,s.DEFAULT_ANSI_COLORS[2]),w.ansi[3]=b(x.yellow,s.DEFAULT_ANSI_COLORS[3]),w.ansi[4]=b(x.blue,s.DEFAULT_ANSI_COLORS[4]),w.ansi[5]=b(x.magenta,s.DEFAULT_ANSI_COLORS[5]),w.ansi[6]=b(x.cyan,s.DEFAULT_ANSI_COLORS[6]),w.ansi[7]=b(x.white,s.DEFAULT_ANSI_COLORS[7]),w.ansi[8]=b(x.brightBlack,s.DEFAULT_ANSI_COLORS[8]),w.ansi[9]=b(x.brightRed,s.DEFAULT_ANSI_COLORS[9]),w.ansi[10]=b(x.brightGreen,s.DEFAULT_ANSI_COLORS[10]),w.ansi[11]=b(x.brightYellow,s.DEFAULT_ANSI_COLORS[11]),w.ansi[12]=b(x.brightBlue,s.DEFAULT_ANSI_COLORS[12]),w.ansi[13]=b(x.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),w.ansi[14]=b(x.brightCyan,s.DEFAULT_ANSI_COLORS[14]),w.ansi[15]=b(x.brightWhite,s.DEFAULT_ANSI_COLORS[15]),x.extendedAnsi){let E=Math.min(w.ansi.length-16,x.extendedAnsi.length);for(let B=0;B<E;B++)w.ansi[B+16]=b(x.extendedAnsi[B],s.DEFAULT_ANSI_COLORS[B+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(x){this._restoreColor(x),this._onChangeColors.fire(this.colors)}_restoreColor(x){if(x!==void 0)switch(x){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[x]=this._restoreColors.ansi[x]}else for(let w=0;w<this._restoreColors.ansi.length;++w)this._colors.ansi[w]=this._restoreColors.ansi[w]}modifyColors(x){x(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function b(x,w){if(x!==void 0)try{return d.css.toColor(x)}catch{}return w}s.ThemeService=S=a([u(0,_.IOptionsService)],S)},6349:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;let a=n(8460),u=n(844);class l extends u.Disposable{constructor(m){super(),this._maxLength=m,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(m){if(this._maxLength===m)return;let y=new Array(m);for(let _=0;_<Math.min(m,this.length);_++)y[_]=this._array[this._getCyclicIndex(_)];this._array=y,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let y=this._length;y<m;y++)this._array[y]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,y){this._array[this._getCyclicIndex(m)]=y}push(m){this._array[this._getCyclicIndex(this._length)]=m,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(m,y,..._){if(y){for(let c=m;c<this._length-y;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+y)];this._length-=y,this.onDeleteEmitter.fire({index:m,amount:y})}for(let c=this._length-1;c>=m;c--)this._array[this._getCyclicIndex(c+_.length)]=this._array[this._getCyclicIndex(c)];for(let c=0;c<_.length;c++)this._array[this._getCyclicIndex(m+c)]=_[c];if(_.length&&this.onInsertEmitter.fire({index:m,amount:_.length}),this._length+_.length>this._maxLength){let c=this._length+_.length-this._maxLength;this._startIndex+=c,this._length=this._maxLength,this.onTrimEmitter.fire(c)}else this._length+=_.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,_){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let f=y-1;f>=0;f--)this.set(m+f+_,this.get(m+f));let c=m+y+_-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<y;c++)this.set(m+c+_,this.get(m+c))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}s.CircularList=l},1439:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function n(a,u=5){if(typeof a!="object")return a;let l=Array.isArray(a)?[]:{};for(let d in a)l[d]=u<=1?a[d]:a[d]&&n(a[d],u-1);return l}},8055:(o,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 n=0,a=0,u=0,l=0;var d,m,y,_,c;function f(p){let v=p.toString(16);return v.length<2?"0"+v:v}function h(p,v){return p<v?(v+.05)/(p+.05):(p+.05)/(v+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(v,S,b,x){return x!==void 0?`#${f(v)}${f(S)}${f(b)}${f(x)}`:`#${f(v)}${f(S)}${f(b)}`},p.toRgba=function(v,S,b,x=255){return(v<<24|S<<16|b<<8|x)>>>0},p.toColor=function(v,S,b,x){return{css:p.toCss(v,S,b,x),rgba:p.toRgba(v,S,b,x)}}})(d||(s.channels=d={})),(function(p){function v(S,b){return l=Math.round(255*b),[n,a,u]=c.toChannels(S.rgba),{css:d.toCss(n,a,u,l),rgba:d.toRgba(n,a,u,l)}}p.blend=function(S,b){if(l=(255&b.rgba)/255,l===1)return{css:b.css,rgba:b.rgba};let x=b.rgba>>24&255,w=b.rgba>>16&255,E=b.rgba>>8&255,B=S.rgba>>24&255,P=S.rgba>>16&255,W=S.rgba>>8&255;return n=B+Math.round((x-B)*l),a=P+Math.round((w-P)*l),u=W+Math.round((E-W)*l),{css:d.toCss(n,a,u),rgba:d.toRgba(n,a,u)}},p.isOpaque=function(S){return(255&S.rgba)==255},p.ensureContrastRatio=function(S,b,x){let w=c.ensureContrastRatio(S.rgba,b.rgba,x);if(w)return d.toColor(w>>24&255,w>>16&255,w>>8&255)},p.opaque=function(S){let b=(255|S.rgba)>>>0;return[n,a,u]=c.toChannels(b),{css:d.toCss(n,a,u),rgba:b}},p.opacity=v,p.multiplyOpacity=function(S,b){return l=255&S.rgba,v(S,l*b/255)},p.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(m||(s.color=m={})),(function(p){let v,S;try{let b=document.createElement("canvas");b.width=1,b.height=1;let x=b.getContext("2d",{willReadFrequently:!0});x&&(v=x,v.globalCompositeOperation="copy",S=v.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return n=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),u=parseInt(b.slice(3,4).repeat(2),16),d.toColor(n,a,u);case 5:return n=parseInt(b.slice(1,2).repeat(2),16),a=parseInt(b.slice(2,3).repeat(2),16),u=parseInt(b.slice(3,4).repeat(2),16),l=parseInt(b.slice(4,5).repeat(2),16),d.toColor(n,a,u,l);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}let x=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(x)return n=parseInt(x[1]),a=parseInt(x[2]),u=parseInt(x[3]),l=Math.round(255*(x[5]===void 0?1:parseFloat(x[5]))),d.toColor(n,a,u,l);if(!v||!S)throw new Error("css.toColor: Unsupported css format");if(v.fillStyle=S,v.fillStyle=b,typeof v.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(v.fillRect(0,0,1,1),[n,a,u,l]=v.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(n,a,u,l),css:b}}})(y||(s.css=y={})),(function(p){function v(S,b,x){let w=S/255,E=b/255,B=x/255;return .2126*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}p.relativeLuminance=function(S){return v(S>>16&255,S>>8&255,255&S)},p.relativeLuminance2=v})(_||(s.rgb=_={})),(function(p){function v(b,x,w){let E=b>>24&255,B=b>>16&255,P=b>>8&255,W=x>>24&255,A=x>>16&255,V=x>>8&255,O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));for(;O<w&&(W>0||A>0||V>0);)W-=Math.max(0,Math.ceil(.1*W)),A-=Math.max(0,Math.ceil(.1*A)),V-=Math.max(0,Math.ceil(.1*V)),O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));return(W<<24|A<<16|V<<8|255)>>>0}function S(b,x,w){let E=b>>24&255,B=b>>16&255,P=b>>8&255,W=x>>24&255,A=x>>16&255,V=x>>8&255,O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));for(;O<w&&(W<255||A<255||V<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),A=Math.min(255,A+Math.ceil(.1*(255-A))),V=Math.min(255,V+Math.ceil(.1*(255-V))),O=h(_.relativeLuminance2(W,A,V),_.relativeLuminance2(E,B,P));return(W<<24|A<<16|V<<8|255)>>>0}p.blend=function(b,x){if(l=(255&x)/255,l===1)return x;let w=x>>24&255,E=x>>16&255,B=x>>8&255,P=b>>24&255,W=b>>16&255,A=b>>8&255;return n=P+Math.round((w-P)*l),a=W+Math.round((E-W)*l),u=A+Math.round((B-A)*l),d.toRgba(n,a,u)},p.ensureContrastRatio=function(b,x,w){let E=_.relativeLuminance(b>>8),B=_.relativeLuminance(x>>8);if(h(E,B)<w){if(B<E){let A=v(b,x,w),V=h(E,_.relativeLuminance(A>>8));if(V<w){let O=S(b,x,w);return V>h(E,_.relativeLuminance(O>>8))?A:O}return A}let P=S(b,x,w),W=h(E,_.relativeLuminance(P>>8));if(W<w){let A=v(b,x,w);return W>h(E,_.relativeLuminance(A>>8))?P:A}return P}},p.reduceLuminance=v,p.increaseLuminance=S,p.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}})(c||(s.rgba=c={})),s.toPaddedHex=f,s.contrastRatio=h},8969:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;let a=n(844),u=n(2585),l=n(4348),d=n(7866),m=n(744),y=n(7302),_=n(6975),c=n(8460),f=n(1753),h=n(1480),p=n(7994),v=n(9282),S=n(5435),b=n(5981),x=n(2660),w=!1;class E extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new c.EventEmitter),this._onScroll.event((P=>{this._onScrollApi?.fire(P.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(P){for(let W in P)this.optionsService.options[W]=P[W]}constructor(P){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 l.InstantiationService,this.optionsService=this.register(new y.OptionsService(P)),this._instantiationService.setService(u.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(u.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(u.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(_.CoreService)),this._instantiationService.setService(u.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(u.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(u.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(u.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(x.OscLinkService),this._instantiationService.setService(u.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,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((W=>{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((W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new b.WriteBuffer(((W,A)=>this._inputHandler.parse(W,A)))),this.register((0,c.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,W){this._writeBuffer.write(P,W)}writeSync(P,W){this._logService.logLevel<=u.LogLevelEnum.WARN&&!w&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w=!0),this._writeBuffer.writeSync(P,W)}input(P,W=!0){this.coreService.triggerDataEvent(P,W)}resize(P,W){isNaN(P)||isNaN(W)||(P=Math.max(P,m.MINIMUM_COLS),W=Math.max(W,m.MINIMUM_ROWS),this._bufferService.resize(P,W))}scroll(P,W=!1){this._bufferService.scroll(P,W)}scrollLines(P,W,A){this._bufferService.scrollLines(P,W,A)}scrollPages(P){this.scrollLines(P*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(P){let W=P-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(P,W){return this._inputHandler.registerEscHandler(P,W)}registerDcsHandler(P,W){return this._inputHandler.registerDcsHandler(P,W)}registerCsiHandler(P,W){return this._inputHandler.registerCsiHandler(P,W)}registerOscHandler(P,W){return this._inputHandler.registerOscHandler(P,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1,W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?P=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let P=[];P.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},(()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(let W of P)W.dispose()}))}}}s.CoreTerminal=E},8460:(o,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=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===n)return void this._listeners.splice(a,1)}}})),this._event}fire(n,a){let u=[];for(let l=0;l<this._listeners.length;l++)u.push(this._listeners[l]);for(let l=0;l<u.length;l++)u[l].call(void 0,n,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(n,a){return n((u=>a.fire(u)))},s.runAndSubscribe=function(n,a){return a(void 0),n((u=>a(u)))}},5435:function(o,s,n){var a=this&&this.__decorate||function(I,C,L,T){var D,N=arguments.length,G=N<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(I,C,L,T);else for(var $=I.length-1;$>=0;$--)(D=I[$])&&(G=(N<3?D(G):N>3?D(C,L,G):D(C,L))||G);return N>3&&G&&Object.defineProperty(C,L,G),G},u=this&&this.__param||function(I,C){return function(L,T){C(L,T,I)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;let l=n(2584),d=n(7116),m=n(2015),y=n(844),_=n(482),c=n(8437),f=n(8460),h=n(643),p=n(511),v=n(3734),S=n(2585),b=n(1480),x=n(6242),w=n(6351),E=n(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function W(I,C){if(I>24)return C.setWinLines||!1;switch(I){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var A;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(s.WindowsOptionsReportType=A={}));let V=0;class O extends y.Disposable{getAttrData(){return this._curAttrData}constructor(C,L,T,D,N,G,$,Y,H=new m.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=L,this._coreService=T,this._logService=D,this._optionsService=N,this._oscLinkService=G,this._coreMouseService=$,this._unicodeService=Y,this._parser=H,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new p.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 f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.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 R(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((k=>this._activeBuffer=k.activeBuffer))),this._parser.setCsiHandlerFallback(((k,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:j.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,j,q)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:j,data:q})})),this._parser.setDcsHandlerFallback(((k,j,q)=>{j==="HOOK"&&(q=q.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:j,payload:q})})),this._parser.setPrintHandler(((k,j,q)=>this.print(k,j,q))),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(l.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(l.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(l.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(l.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(l.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(l.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(l.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(l.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(l.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new x.OscHandler((k=>(this.setTitle(k),this.setIconName(k),!0)))),this._parser.registerOscHandler(1,new x.OscHandler((k=>this.setIconName(k)))),this._parser.registerOscHandler(2,new x.OscHandler((k=>this.setTitle(k)))),this._parser.registerOscHandler(4,new x.OscHandler((k=>this.setOrReportIndexedColor(k)))),this._parser.registerOscHandler(8,new x.OscHandler((k=>this.setHyperlink(k)))),this._parser.registerOscHandler(10,new x.OscHandler((k=>this.setOrReportFgColor(k)))),this._parser.registerOscHandler(11,new x.OscHandler((k=>this.setOrReportBgColor(k)))),this._parser.registerOscHandler(12,new x.OscHandler((k=>this.setOrReportCursorColor(k)))),this._parser.registerOscHandler(104,new x.OscHandler((k=>this.restoreIndexedColor(k)))),this._parser.registerOscHandler(110,new x.OscHandler((k=>this.restoreFgColor(k)))),this._parser.registerOscHandler(111,new x.OscHandler((k=>this.restoreBgColor(k)))),this._parser.registerOscHandler(112,new x.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 d.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 w.DcsHandler(((k,j)=>this.requestStatusString(k,j))))}_preserveStack(C,L,T,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=T,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([C,new Promise(((L,T)=>setTimeout((()=>T("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,L){let T,D=this._activeBuffer.x,N=this._activeBuffer.y,G=0,$=this._parseStack.paused;if($){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(T),T;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>P&&(G=this._parseStack.position+P)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(k=>String.fromCharCode(k))).join("")}"`),typeof C=="string"?C.split("").map((k=>k.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(C.length,P))),$||this._dirtyRowTracker.clearRange(),C.length>P)for(let k=G;k<C.length;k+=P){let j=k+P<C.length?k+P:C.length,q=typeof C=="string"?this._stringDecoder.decode(C.substring(k,j),this._parseBuffer):this._utf8Decoder.decode(C.subarray(k,j),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,q))return this._preserveStack(D,N,q,k),this._logSlowResolvingAsync(T),T}else if(!$){let k=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,k))return this._preserveStack(D,N,k,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire();let Y=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),H=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);H<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(H,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(C,L,T){let D,N,G=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,H=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,j=this._curAttrData,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-L>0&&q.getWidth(this._activeBuffer.x-1)===2&&q.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let U=this._parser.precedingJoinState;for(let J=L;J<T;++J){if(D=C[J],D<127&&G){let fe=G[String.fromCharCode(D)];fe&&(D=fe.charCodeAt(0))}let Z=this._unicodeService.charProperties(D,U);N=b.UnicodeService.extractWidth(Z);let se=b.UnicodeService.extractShouldJoin(Z),he=se?b.UnicodeService.extractWidth(U):0;if(U=Z,$&&this._onA11yChar.fire((0,_.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>Y){if(H){let fe=q,te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&q instanceof c.BufferLine&&q.copyCellsFrom(fe,te,0,he,!1);te<Y;)fe.setCellFromCodepoint(te++,0,1,j)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(se&&this._activeBuffer.x){let fe=q.getWidth(this._activeBuffer.x-1)?1:2;q.addCodepointToCell(this._activeBuffer.x-fe,D,N);for(let te=N-he;--te>=0;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(k&&(q.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(j)),q.getWidth(Y-1)===2&&q.setCellFromCodepoint(Y-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,j)),q.setCellFromCodepoint(this._activeBuffer.x++,D,N,j),N>0)for(;--N;)q.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=U,this._activeBuffer.x<Y&&T-L>0&&q.getWidth(this._activeBuffer.x)===0&&!q.hasContent(this._activeBuffer.x)&&q.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,L){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,L):this._parser.registerCsiHandler(C,(T=>!W(T.params[0],this._optionsService.rawOptions.windowOptions)||L(T)))}registerDcsHandler(C,L){return this._parser.registerDcsHandler(C,new w.DcsHandler(L))}registerEscHandler(C,L){return this._parser.registerEscHandler(C,L)}registerOscHandler(C,L){return this._parser.registerOscHandler(C,new x.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,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(C,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=C,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+L)}cursorUp(C){let L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){let L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){let L=C.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=C.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){let L=C.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,L,T,D=!1,N=!1){let G=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);G.replaceCells(L,T,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(G.isWrapped=!1)}_resetBufferLine(C,L=!1){let T=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),T.isWrapped=!1)}eraseInDisplay(C,L=!1){let T;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);T<this._bufferService.rows;T++)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,L);this._dirtyRowTracker.markDirty(0);break;case 3:let D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,L=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let L=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let T=this._activeBuffer.ybase+this._activeBuffer.y,D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;L--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let L=C.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(c.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let L=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){let D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();let L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){let L=this._parser.precedingJoinState;if(!L)return!0;let T=C.params[0]||1,D=b.UnicodeService.extractWidth(L),N=this._activeBuffer.x-D,G=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),$=new Uint32Array(G.length*T),Y=0;for(let k=0;k<G.length;){let j=G.codePointAt(k)||0;$[Y++]=j,k+=j>65535?2:1}let H=Y;for(let k=1;k<T;++k)$.copyWithin(H,0,Y),H+=Y;return this.print($,0,H),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.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(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let L=0;L<C.length;L++)switch(C.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,L){let T=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,G=this._coreService,{buffers:$,cols:Y}=this._bufferService,{active:H,alt:k}=$,j=this._optionsService.rawOptions,q=se=>se?1:2,U=C.params[0];return J=U,Z=L?U===2?4:U===4?q(G.modes.insertMode):U===12?3:U===20?q(j.convertEol):0:U===1?q(T.applicationCursorKeys):U===3?j.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:U===6?q(T.origin):U===7?q(T.wraparound):U===8?3:U===9?q(D==="X10"):U===12?q(j.cursorBlink):U===25?q(!G.isCursorHidden):U===45?q(T.reverseWraparound):U===66?q(T.applicationKeypad):U===67?4:U===1e3?q(D==="VT200"):U===1002?q(D==="DRAG"):U===1003?q(D==="ANY"):U===1004?q(T.sendFocus):U===1005?4:U===1006?q(N==="SGR"):U===1015?4:U===1016?q(N==="SGR_PIXELS"):U===1048?1:U===47||U===1047||U===1049?q(H===k):U===2004?q(T.bracketedPasteMode):0,G.triggerDataEvent(`${l.C0.ESC}[${L?"":"?"}${J};${Z}$y`),!0;var J,Z}_updateAttrColor(C,L,T,D,N){return L===2?(C|=50331648,C&=-16777216,C|=v.AttributeData.fromColorRGB([T,D,N])):L===5&&(C&=-50331904,C|=33554432|255&T),C}_extractColor(C,L,T){let D=[0,0,-1,0,0,0],N=0,G=0;do{if(D[G+N]=C.params[L+G],C.hasSubParams(L+G)){let $=C.getSubParams(L+G),Y=0;do D[1]===5&&(N=1),D[G+Y+1+N]=$[Y];while(++Y<$.length&&Y+G+1+N<D.length);break}if(D[1]===5&&G+N>=2||D[1]===2&&G+N>=5)break;D[1]&&(N=1)}while(++G+L<C.length&&G+N<D.length);for(let $=2;$<D.length;++$)D[$]===-1&&(D[$]=0);switch(D[0]){case 38:T.fg=this._updateAttrColor(T.fg,D[1],D[3],D[4],D[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,D[1],D[3],D[4],D[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,D[1],D[3],D[4],D[5])}return G}_processUnderline(C,L){L.extended=L.extended.clone(),(!~C||C>5)&&(C=1),L.extended.underlineStyle=C,L.fg|=268435456,C===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(C){C.fg=c.DEFAULT_ATTR_DATA.fg,C.bg=c.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;let L=C.length,T,D=this._curAttrData;for(let N=0;N<L;N++)T=C.params[N],T>=30&&T<=37?(D.fg&=-50331904,D.fg|=16777216|T-30):T>=40&&T<=47?(D.bg&=-50331904,D.bg|=16777216|T-40):T>=90&&T<=97?(D.fg&=-50331904,D.fg|=16777224|T-90):T>=100&&T<=107?(D.bg&=-50331904,D.bg|=16777224|T-100):T===0?this._processSGR0(D):T===1?D.fg|=134217728:T===3?D.bg|=67108864:T===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(N)?C.getSubParams(N)[0]:1,D)):T===5?D.fg|=536870912:T===7?D.fg|=67108864:T===8?D.fg|=1073741824:T===9?D.fg|=2147483648:T===2?D.bg|=134217728:T===21?this._processUnderline(2,D):T===22?(D.fg&=-134217729,D.bg&=-134217729):T===23?D.bg&=-67108865:T===24?(D.fg&=-268435457,this._processUnderline(0,D)):T===25?D.fg&=-536870913:T===27?D.fg&=-67108865:T===28?D.fg&=-1073741825:T===29?D.fg&=2147483647:T===39?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg):T===49?(D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?N+=this._extractColor(C,N,D):T===53?D.bg|=1073741824:T===55?D.bg&=-1073741825:T===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):T===100?(D.fg&=-67108864,D.fg|=16777215&c.DEFAULT_ATTR_DATA.fg,D.bg&=-67108864,D.bg|=16777215&c.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${L};${T}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){let L=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${L};${T}R`)}return!0}softReset(C){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(C){let L=C.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let T=L%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(C){let L=C.params[0]||1,T;return(C.length<2||(T=C.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(C){if(!W(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;let L=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){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(C){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(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){let L=[],T=C.split(";");for(;T.length>1;){let D=T.shift(),N=T.shift();if(/^\d+$/.exec(D)){let G=parseInt(D);if(F(G))if(N==="?")L.push({type:0,index:G});else{let $=(0,E.parseColor)(N);$&&L.push({type:1,index:G,color:$})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(C){let L=C.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(C,L){this._getCurrentLinkId()&&this._finishHyperlink();let T=C.split(":"),D,N=T.findIndex((G=>G.startsWith("id=")));return N!==-1&&(D=T[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,L){let T=C.split(";");for(let D=0;D<T.length&&!(L>=this._specialColors.length);++D,++L)if(T[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{let N=(0,E.parseColor)(T[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;let L=[],T=C.split(";");for(let D=0;D<T.length;++D)if(/^\d+$/.exec(T[D])){let N=parseInt(T[D]);F(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){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,d.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(B[C[0]],d.CHARSETS[C[1]]||d.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 C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,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(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){let C=new p.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){let T=this._activeBuffer.ybase+this._activeBuffer.y+L,D=this._activeBuffer.lines.get(T);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,L){let T=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${N}${l.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,L){this._dirtyRowTracker.markRangeDirty(C,L)}}s.InputHandler=O;let R=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,C){I>C&&(V=I,I=C,C=V),I<this.start&&(this.start=I),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(I){return 0<=I&&I<256}R=a([u(0,S.IBufferService)],R)},844:(o,s)=>{function n(a){for(let u of a)u.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 u=this._disposables.indexOf(a);u!==-1&&this._disposables.splice(u,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=n,s.getDisposeArrayDisposable=function(a){return{dispose:()=>n(a)}}},1505:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(u,l,d){this._data[u]||(this._data[u]={}),this._data[u][l]=d}get(u,l){return this._data[u]?this._data[u][l]:void 0}clear(){this._data={}}}s.TwoKeyMap=n,s.FourKeyMap=class{constructor(){this._data=new n}set(a,u,l,d,m){this._data.get(a,u)||this._data.set(a,u,new n),this._data.get(a,u).set(l,d,m)}get(a,u,l,d){return this._data.get(a,u)?.get(l,d)}clear(){this._data.clear()}}},6114:(o,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 n=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=n.includes("Firefox"),s.isLegacyEdge=n.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(n),s.getSafariVersion=function(){if(!s.isSafari)return 0;let u=n.match(/Version\/(\d+)/);return u===null||u.length<2?0:parseInt(u[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(n)},6106:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let n=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(n=this._search(this._getKey(a)),this._array.splice(n,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;let u=this._getKey(a);if(u===void 0||(n=this._search(u),n===-1)||this._getKey(this._array[n])!==u)return!1;do if(this._array[n]===a)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===u);return!1}*getKeyIterator(a){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===a)}forEachByKey(a,u){if(this._array.length!==0&&(n=this._search(a),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===a))do u(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===a)}values(){return[...this._array].values()}_search(a){let u=0,l=this._array.length-1;for(;l>=u;){let d=u+l>>1,m=this._getKey(this._array[d]);if(m>a)l=d-1;else{if(!(m<a)){for(;d>0&&this._getKey(this._array[d-1])===a;)d--;return d}u=d+1}}return u}}},7226:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;let a=n(6114);class u{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(m){this._idleCallback=void 0;let y=0,_=0,c=m.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),_=Math.max(y,_),f=m.timeRemaining(),1.5*_>f)return c-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(c-y))}ms`),void this._start();c=f}this.clear()}}class l extends u{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){let y=Date.now()+m;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=l,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends u{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:l,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;let a=n(643);s.updateWindowsModeWrappedState=function(u){let l=u.buffer.lines.get(u.buffer.ybase+u.buffer.y-1),d=l?.get(u.cols-1),m=u.buffer.lines.get(u.buffer.ybase+u.buffer.y);m&&d&&(m.isWrapped=d[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&d[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){let l=new n;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}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=n;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){let l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,d=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=d}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;let a=n(6349),u=n(7226),l=n(3734),d=n(8437),m=n(4634),y=n(511),_=n(643),c=n(4863),f=n(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(h,p,v){this._hasScrollback=h,this._optionsService=p,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=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new u.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(h){return h?(this._nullCell.fg=h.fg,this._nullCell.bg=h.bg,this._nullCell.extended=h.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(h){return h?(this._whitespaceCell.fg=h.fg,this._whitespaceCell.bg=h.bg,this._whitespaceCell.extended=h.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(h,p){return new d.BufferLine(this._bufferService.cols,this.getNullCell(h),p)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let h=this.ybase+this.y-this.ydisp;return h>=0&&h<this._rows}_getCorrectBufferLength(h){if(!this._hasScrollback)return h;let p=h+this._optionsService.rawOptions.scrollback;return p>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:p}fillViewportRows(h){if(this.lines.length===0){h===void 0&&(h=d.DEFAULT_ATTR_DATA);let p=this._rows;for(;p--;)this.lines.push(this.getBlankLine(h))}}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(h,p){let v=this.getNullCell(d.DEFAULT_ATTR_DATA),S=0,b=this._getCorrectBufferLength(p);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<h)for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(h,v);let x=0;if(this._rows<p)for(let w=this._rows;w<p;w++)this.lines.length<p+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(h,v)):this.ybase>0&&this.lines.length<=this.ybase+this.y+x+1?(this.ybase--,x++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(h,v)));else for(let w=this._rows;w>p;w--)this.lines.length>p+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){let w=this.lines.length-b;w>0&&(this.lines.trimStart(w),this.ybase=Math.max(this.ybase-w,0),this.ydisp=Math.max(this.ydisp-w,0),this.savedY=Math.max(this.savedY-w,0)),this.lines.maxLength=b}this.x=Math.min(this.x,h-1),this.y=Math.min(this.y,p-1),x&&(this.y+=x),this.savedX=Math.min(this.savedX,h-1),this.scrollTop=0}if(this.scrollBottom=p-1,this._isReflowEnabled&&(this._reflow(h,p),this._cols>h))for(let x=0;x<this.lines.length;x++)S+=+this.lines.get(x).resize(h,v);this._cols=h,this._rows=p,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let h=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,h=!1);let p=0;for(;this._memoryCleanupPosition<this.lines.length;)if(p+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),p>100)return!0;return h}get _isReflowEnabled(){let h=this._optionsService.rawOptions.windowsPty;return h&&h.buildNumber?this._hasScrollback&&h.backend==="conpty"&&h.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(h,p){this._cols!==h&&(h>this._cols?this._reflowLarger(h,p):this._reflowSmaller(h,p))}_reflowLarger(h,p){let v=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,h,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(v.length>0){let S=(0,m.reflowLargerCreateNewLayout)(this.lines,v);(0,m.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(h,p,S.countRemoved)}}_reflowLargerAdjustViewport(h,p,v){let S=this.getNullCell(d.DEFAULT_ATTR_DATA),b=v;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<p&&this.lines.push(new d.BufferLine(h,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-v,0)}_reflowSmaller(h,p){let v=this.getNullCell(d.DEFAULT_ATTR_DATA),S=[],b=0;for(let x=this.lines.length-1;x>=0;x--){let w=this.lines.get(x);if(!w||!w.isWrapped&&w.getTrimmedLength()<=h)continue;let E=[w];for(;w.isWrapped&&x>0;)w=this.lines.get(--x),E.unshift(w);let B=this.ybase+this.y;if(B>=x&&B<x+E.length)continue;let P=E[E.length-1].getTrimmedLength(),W=(0,m.reflowSmallerGetNewLineLengths)(E,this._cols,h),A=W.length-E.length,V;V=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+A):Math.max(0,this.lines.length-this.lines.maxLength+A);let O=[];for(let T=0;T<A;T++){let D=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);O.push(D)}O.length>0&&(S.push({start:x+E.length+b,newLines:O}),b+=O.length),E.push(...O);let R=W.length-1,F=W[R];F===0&&(R--,F=W[R]);let I=E.length-A-1,C=P;for(;I>=0;){let T=Math.min(C,F);if(E[R]===void 0)break;if(E[R].copyCellsFrom(E[I],C-T,F-T,T,!0),F-=T,F===0&&(R--,F=W[R]),C-=T,C===0){I--;let D=Math.max(I,0);C=(0,m.getWrappedLineTrimmedLength)(E,D,this._cols)}}for(let T=0;T<E.length;T++)W[T]<h&&E[T].setCell(W[T],v);let L=A-V;for(;L-- >0;)this.ybase===0?this.y<p-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-p&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+p-1)}if(S.length>0){let x=[],w=[];for(let R=0;R<this.lines.length;R++)w.push(this.lines.get(R));let E=this.lines.length,B=E-1,P=0,W=S[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let A=0;for(let R=Math.min(this.lines.maxLength-1,E+b-1);R>=0;R--)if(W&&W.start>B+A){for(let F=W.newLines.length-1;F>=0;F--)this.lines.set(R--,W.newLines[F]);R++,x.push({index:B+1,amount:W.newLines.length}),A+=W.newLines.length,W=S[++P]}else this.lines.set(R,w[B--]);let V=0;for(let R=x.length-1;R>=0;R--)x[R].index+=V,this.lines.onInsertEmitter.fire(x[R]),V+=x[R].amount;let O=Math.max(0,E+b-this.lines.maxLength);O>0&&this.lines.onTrimEmitter.fire(O)}}translateBufferLineToString(h,p,v=0,S){let b=this.lines.get(h);return b?b.translateToString(p,v,S):""}getWrappedRangeForLine(h){let p=h,v=h;for(;p>0&&this.lines.get(p).isWrapped;)p--;for(;v+1<this.lines.length&&this.lines.get(v+1).isWrapped;)v++;return{first:p,last:v}}setupTabStops(h){for(h!=null?this.tabs[h]||(h=this.prevStop(h)):(this.tabs={},h=0);h<this._cols;h+=this._optionsService.rawOptions.tabStopWidth)this.tabs[h]=!0}prevStop(h){for(h==null&&(h=this.x);!this.tabs[--h]&&h>0;);return h>=this._cols?this._cols-1:h<0?0:h}nextStop(h){for(h==null&&(h=this.x);!this.tabs[++h]&&h<this._cols;);return h>=this._cols?this._cols-1:h<0?0:h}clearMarkers(h){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].line===h&&(this.markers[p].dispose(),this.markers.splice(p--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].dispose(),this.markers.splice(h--,1);this._isClearing=!1}addMarker(h){let p=new c.Marker(h);return this.markers.push(p),p.register(this.lines.onTrim((v=>{p.line-=v,p.line<0&&p.dispose()}))),p.register(this.lines.onInsert((v=>{p.line>=v.index&&(p.line+=v.amount)}))),p.register(this.lines.onDelete((v=>{p.line>=v.index&&p.line<v.index+v.amount&&p.dispose(),p.line>v.index&&(p.line-=v.amount)}))),p.register(p.onDispose((()=>this._removeMarker(p)))),p}_removeMarker(h){this._isClearing||this.markers.splice(this.markers.indexOf(h),1)}}},8437:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;let a=n(3734),u=n(511),l=n(643),d=n(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let m=0;class y{constructor(c,f,h=!1){this.isWrapped=h,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);let p=f||u.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let v=0;v<c;++v)this.setCell(v,p);this.length=c}get(c){let f=this._data[3*c+0],h=2097151&f;return[this._data[3*c+1],2097152&f?this._combined[c]:h?(0,d.stringFromCodePoint)(h):"",f>>22,2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):h]}set(c,f){this._data[3*c+1]=f[l.CHAR_DATA_ATTR_INDEX],f[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=f[1],this._data[3*c+0]=2097152|c|f[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.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 f=this._data[3*c+0];return 2097152&f?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&f}isCombined(c){return 2097152&this._data[3*c+0]}getString(c){let f=this._data[3*c+0];return 2097152&f?this._combined[c]:2097151&f?(0,d.stringFromCodePoint)(2097151&f):""}isProtected(c){return 536870912&this._data[3*c+2]}loadCell(c,f){return m=3*c,f.content=this._data[m+0],f.fg=this._data[m+1],f.bg=this._data[m+2],2097152&f.content&&(f.combinedData=this._combined[c]),268435456&f.bg&&(f.extended=this._extendedAttrs[c]),f}setCell(c,f){2097152&f.content&&(this._combined[c]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[c]=f.extended),this._data[3*c+0]=f.content,this._data[3*c+1]=f.fg,this._data[3*c+2]=f.bg}setCellFromCodepoint(c,f,h,p){268435456&p.bg&&(this._extendedAttrs[c]=p.extended),this._data[3*c+0]=f|h<<22,this._data[3*c+1]=p.fg,this._data[3*c+2]=p.bg}addCodepointToCell(c,f,h){let p=this._data[3*c+0];2097152&p?this._combined[c]+=(0,d.stringFromCodePoint)(f):2097151&p?(this._combined[c]=(0,d.stringFromCodePoint)(2097151&p)+(0,d.stringFromCodePoint)(f),p&=-2097152,p|=2097152):p=f|4194304,h&&(p&=-12582913,p|=h<<22),this._data[3*c+0]=p}insertCells(c,f,h){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length-c){let p=new u.CellData;for(let v=this.length-c-f-1;v>=0;--v)this.setCell(c+f+v,this.loadCell(c+v,p));for(let v=0;v<f;++v)this.setCell(c+v,h)}else for(let p=c;p<this.length;++p)this.setCell(p,h);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,h)}deleteCells(c,f,h){if(c%=this.length,f<this.length-c){let p=new u.CellData;for(let v=0;v<this.length-c-f;++v)this.setCell(c+v,this.loadCell(c+f+v,p));for(let v=this.length-f;v<this.length;++v)this.setCell(v,h)}else for(let p=c;p<this.length;++p)this.setCell(p,h);c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodepoint(c,0,1,h)}replaceCells(c,f,h,p=!1){if(p)for(c&&this.getWidth(c-1)===2&&!this.isProtected(c-1)&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,h);c<f&&c<this.length;)this.isProtected(c)||this.setCell(c,h),c++;else for(c&&this.getWidth(c-1)===2&&this.setCellFromCodepoint(c-1,0,1,h),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,h);c<f&&c<this.length;)this.setCell(c++,h)}resize(c,f){if(c===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let h=3*c;if(c>this.length){if(this._data.buffer.byteLength>=4*h)this._data=new Uint32Array(this._data.buffer,0,h);else{let p=new Uint32Array(h);p.set(this._data),this._data=p}for(let p=this.length;p<c;++p)this.setCell(p,f)}else{this._data=this._data.subarray(0,h);let p=Object.keys(this._combined);for(let S=0;S<p.length;S++){let b=parseInt(p[S],10);b>=c&&delete this._combined[b]}let v=Object.keys(this._extendedAttrs);for(let S=0;S<v.length;S++){let b=parseInt(v[S],10);b>=c&&delete this._extendedAttrs[b]}}return this.length=c,4*h*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,f=!1){if(f)for(let h=0;h<this.length;++h)this.isProtected(h)||this.setCell(h,c);else{this._combined={},this._extendedAttrs={};for(let h=0;h<this.length;++h)this.setCell(h,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 f in c._combined)this._combined[f]=c._combined[f];this._extendedAttrs={};for(let f in c._extendedAttrs)this._extendedAttrs[f]=c._extendedAttrs[f];this.isWrapped=c.isWrapped}clone(){let c=new y(0);c._data=new Uint32Array(this._data),c.length=this.length;for(let f in this._combined)c._combined[f]=this._combined[f];for(let f in this._extendedAttrs)c._extendedAttrs[f]=this._extendedAttrs[f];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,f,h,p,v){let S=c._data;if(v)for(let x=p-1;x>=0;x--){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(f+x)+w];268435456&S[3*(f+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[f+x])}else for(let x=0;x<p;x++){for(let w=0;w<3;w++)this._data[3*(h+x)+w]=S[3*(f+x)+w];268435456&S[3*(f+x)+2]&&(this._extendedAttrs[h+x]=c._extendedAttrs[f+x])}let b=Object.keys(c._combined);for(let x=0;x<b.length;x++){let w=parseInt(b[x],10);w>=f&&(this._combined[w-f+h]=c._combined[w])}}translateToString(c,f,h,p){f=f??0,h=h??this.length,c&&(h=Math.min(h,this.getTrimmedLength())),p&&(p.length=0);let v="";for(;f<h;){let S=this._data[3*f+0],b=2097151&S,x=2097152&S?this._combined[f]:b?(0,d.stringFromCodePoint)(b):l.WHITESPACE_CELL_CHAR;if(v+=x,p)for(let w=0;w<x.length;++w)p.push(f);f+=S>>22||1}return p&&p.push(f),v}}s.BufferLine=y},4841:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(n,a){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return a*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(o,s)=>{function n(a,u,l){if(u===a.length-1)return a[u].getTrimmedLength();let d=!a[u].hasContent(l-1)&&a[u].getWidth(l-1)===1,m=a[u+1].getWidth(0)===2;return d&&m?l-1:l}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,u,l,d,m){let y=[];for(let _=0;_<a.length-1;_++){let c=_,f=a.get(++c);if(!f.isWrapped)continue;let h=[a.get(_)];for(;c<a.length&&f.isWrapped;)h.push(f),f=a.get(++c);if(d>=_&&d<c){_+=h.length-1;continue}let p=0,v=n(h,p,u),S=1,b=0;for(;S<h.length;){let w=n(h,S,u),E=w-b,B=l-v,P=Math.min(E,B);h[p].copyCellsFrom(h[S],b,v,P,!1),v+=P,v===l&&(p++,v=0),b+=P,b===w&&(S++,b=0),v===0&&p!==0&&h[p-1].getWidth(l-1)===2&&(h[p].copyCellsFrom(h[p-1],l-1,v++,1,!1),h[p-1].setCell(l-1,m))}h[p].replaceCells(v,l,m);let x=0;for(let w=h.length-1;w>0&&(w>p||h[w].getTrimmedLength()===0);w--)x++;x>0&&(y.push(_+h.length-x),y.push(x)),_+=h.length-1}return y},s.reflowLargerCreateNewLayout=function(a,u){let l=[],d=0,m=u[d],y=0;for(let _=0;_<a.length;_++)if(m===_){let c=u[++d];a.onDeleteEmitter.fire({index:_-y,amount:c}),_+=c-1,y+=c,m=u[++d]}else l.push(_);return{layout:l,countRemoved:y}},s.reflowLargerApplyNewLayout=function(a,u){let l=[];for(let d=0;d<u.length;d++)l.push(a.get(u[d]));for(let d=0;d<l.length;d++)a.set(d,l[d]);a.length=u.length},s.reflowSmallerGetNewLineLengths=function(a,u,l){let d=[],m=a.map(((f,h)=>n(a,h,u))).reduce(((f,h)=>f+h)),y=0,_=0,c=0;for(;c<m;){if(m-c<l){d.push(m-c);break}y+=l;let f=n(a,_,u);y>f&&(y-=f,_++);let h=a[_].getWidth(y-1)===2;h&&y--;let p=h?l-1:l;d.push(p),c+=p}return d},s.getWrappedLineTrimmedLength=n},5295:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;let a=n(8460),u=n(844),l=n(9092);class d extends u.Disposable{constructor(y,_){super(),this._optionsService=y,this._bufferService=_,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 l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,_){this._normal.resize(y,_),this._alt.resize(y,_),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=d},511:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;let a=n(482),u=n(643),l=n(3734);class d extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(y){let _=new d;return _.setFromCharData(y),_}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(y){this.fg=y[u.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(y[u.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(y[u.CHAR_DATA_CHAR_INDEX].length===2){let c=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=c&&c<=56319){let f=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(c-55296)+f-56320+65536|y[u.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=y[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[u.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=y[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[u.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=d},643:(o,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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;let a=n(8460),u=n(844);class l{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=l._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,u.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}s.Marker=l,l._nextId=1},7116:(o,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:(o,s)=>{var n,a,u;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
|
|
8
|
+
`,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL="\x7F"})(n||(s.C0=n={})),(function(l){l.PAD="\x80",l.HOP="\x81",l.BPH="\x82",l.NBH="\x83",l.IND="\x84",l.NEL="\x85",l.SSA="\x86",l.ESA="\x87",l.HTS="\x88",l.HTJ="\x89",l.VTS="\x8A",l.PLD="\x8B",l.PLU="\x8C",l.RI="\x8D",l.SS2="\x8E",l.SS3="\x8F",l.DCS="\x90",l.PU1="\x91",l.PU2="\x92",l.STS="\x93",l.CCH="\x94",l.MW="\x95",l.SPA="\x96",l.EPA="\x97",l.SOS="\x98",l.SGCI="\x99",l.SCI="\x9A",l.CSI="\x9B",l.ST="\x9C",l.OSC="\x9D",l.PM="\x9E",l.APC="\x9F"})(a||(s.C1=a={})),(function(l){l.ST=`${n.ESC}\\`})(u||(s.C1_ESCAPED=u={}))},7399:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;let a=n(2584),u={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};s.evaluateKeyboardEvent=function(l,d,m,y){let _={type:0,cancel:!1,key:void 0},c=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?_.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?_.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?_.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(_.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:_.key=l.ctrlKey?"\b":a.C0.DEL,l.altKey&&(_.key=a.C0.ESC+_.key);break;case 9:if(l.shiftKey){_.key=a.C0.ESC+"[Z";break}_.key=a.C0.HT,_.cancel=!0;break;case 13:_.key=l.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,_.cancel=!0;break;case 27:_.key=a.C0.ESC,l.altKey&&(_.key=a.C0.ESC+a.C0.ESC),_.cancel=!0;break;case 37:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"D",_.key===a.C0.ESC+"[1;3D"&&(_.key=a.C0.ESC+(m?"b":"[1;5D"))):_.key=d?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"C",_.key===a.C0.ESC+"[1;3C"&&(_.key=a.C0.ESC+(m?"f":"[1;5C"))):_.key=d?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"A",m||_.key!==a.C0.ESC+"[1;3A"||(_.key=a.C0.ESC+"[1;5A")):_.key=d?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(l.metaKey)break;c?(_.key=a.C0.ESC+"[1;"+(c+1)+"B",m||_.key!==a.C0.ESC+"[1;3B"||(_.key=a.C0.ESC+"[1;5B")):_.key=d?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(_.key=a.C0.ESC+"[2~");break;case 46:_.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:_.key=c?a.C0.ESC+"[1;"+(c+1)+"H":d?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:_.key=c?a.C0.ESC+"[1;"+(c+1)+"F":d?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:l.shiftKey?_.type=2:l.ctrlKey?_.key=a.C0.ESC+"[5;"+(c+1)+"~":_.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?_.type=3:l.ctrlKey?_.key=a.C0.ESC+"[6;"+(c+1)+"~":_.key=a.C0.ESC+"[6~";break;case 112:_.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:_.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:_.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:_.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:_.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:_.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:_.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:_.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:_.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:_.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:_.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:_.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(m&&!y||!l.altKey||l.metaKey)!m||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?_.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(_.key=a.C0.US),l.key==="@"&&(_.key=a.C0.NUL)):l.keyCode===65&&(_.type=1);else{let f=u[l.keyCode],h=f?.[l.shiftKey?1:0];if(h)_.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){let p=l.ctrlKey?l.keyCode-64:l.keyCode+32,v=String.fromCharCode(p);l.shiftKey&&(v=v.toUpperCase()),_.key=a.C0.ESC+v}else if(l.keyCode===32)_.key=a.C0.ESC+(l.ctrlKey?a.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let p=l.code.slice(3,4);l.shiftKey||(p=p.toLowerCase()),_.key=a.C0.ESC+p,_.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?_.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?_.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?_.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?_.key=a.C0.DEL:l.keyCode===219?_.key=a.C0.ESC:l.keyCode===220?_.key=a.C0.FS:l.keyCode===221&&(_.key=a.C0.GS)}return _}},482:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},s.utf32ToString=function(n,a=0,u=n.length){let l="";for(let d=a;d<u;++d){let m=n[d];m>65535?(m-=65536,l+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):l+=String.fromCharCode(m)}return l},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,a){let u=n.length;if(!u)return 0;let l=0,d=0;if(this._interim){let m=n.charCodeAt(d++);56320<=m&&m<=57343?a[l++]=1024*(this._interim-55296)+m-56320+65536:(a[l++]=this._interim,a[l++]=m),this._interim=0}for(let m=d;m<u;++m){let y=n.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=u)return this._interim=y,l;let _=n.charCodeAt(m);56320<=_&&_<=57343?a[l++]=1024*(y-55296)+_-56320+65536:(a[l++]=y,a[l++]=_)}else y!==65279&&(a[l++]=y)}return l}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,a){let u=n.length;if(!u)return 0;let l,d,m,y,_=0,c=0,f=0;if(this.interim[0]){let v=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,x=0;for(;(b=63&this.interim[++x])&&x<4;)S<<=6,S|=b;let w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=w-x;for(;f<E;){if(f>=u)return 0;if(b=n[f++],(192&b)!=128){f--,v=!0;break}this.interim[x++]=b,S<<=6,S|=63&b}v||(w===2?S<128?f--:a[_++]=S:w===3?S<2048||S>=55296&&S<=57343||S===65279||(a[_++]=S):S<65536||S>1114111||(a[_++]=S)),this.interim.fill(0)}let h=u-4,p=f;for(;p<u;){for(;!(!(p<h)||128&(l=n[p])||128&(d=n[p+1])||128&(m=n[p+2])||128&(y=n[p+3]));)a[_++]=l,a[_++]=d,a[_++]=m,a[_++]=y,p+=4;if(l=n[p++],l<128)a[_++]=l;else if((224&l)==192){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(c=(31&l)<<6|63&d,c<128){p--;continue}a[_++]=c}else if((240&l)==224){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,_;if(m=n[p++],(192&m)!=128){p--;continue}if(c=(15&l)<<12|(63&d)<<6|63&m,c<2048||c>=55296&&c<=57343||c===65279)continue;a[_++]=c}else if((248&l)==240){if(p>=u)return this.interim[0]=l,_;if(d=n[p++],(192&d)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,_;if(m=n[p++],(192&m)!=128){p--;continue}if(p>=u)return this.interim[0]=l,this.interim[1]=d,this.interim[2]=m,_;if(y=n[p++],(192&y)!=128){p--;continue}if(c=(7&l)<<18|(63&d)<<12|(63&m)<<6|63&y,c<65536||c>1114111)continue;a[_++]=c}}return _}}},225:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;let a=n(1480),u=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],l=[[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]],d;s.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let m=0;m<u.length;++m)d.fill(0,u[m][0],u[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?d[m]:(function(y,_){let c,f=0,h=_.length-1;if(y<_[0][0]||y>_[h][1])return!1;for(;h>=f;)if(c=f+h>>1,y>_[c][1])f=c+1;else{if(!(y<_[c][0]))return!0;h=c-1}return!1})(m,l)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,y){let _=this.wcwidth(m),c=_===0&&y!==0;if(c){let f=a.UnicodeService.extractWidth(y);f===0?c=!1:f>_&&(_=f)}return a.UnicodeService.createPropertyValue(0,_,c)}}},5981:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;let a=n(8460),u=n(844);class l extends u.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);let c=this._callbacks.shift();c&&c()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y)}_innerWrite(m=0,y=!0){let _=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let c=this._writeBuffer[this._bufferOffset],f=this._action(c,y);if(f){let p=v=>Date.now()-_>=12?setTimeout((()=>this._innerWrite(0,v))):this._innerWrite(_,v);return void f.catch((v=>(queueMicrotask((()=>{throw v})),Promise.resolve(!1)))).then(p)}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=c.length,Date.now()-_>=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=l},5941:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,a=/^[\da-f]+$/;function u(l,d){let m=l.toString(16),y=m.length<2?"0"+m:m;switch(d){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(l){if(!l)return;let d=l.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);let m=n.exec(d);if(m){let y=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/y*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/y*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/y*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),a.exec(d)&&[3,6,9,12].includes(d.length))){let m=d.length/3,y=[0,0,0];for(let _=0;_<3;++_){let c=parseInt(d.slice(m*_,m*_+m),16);y[_]=m===1?c<<4:m===2?c:m===3?c>>4:c>>8}return y}},s.toRgbString=function(l,d=16){let[m,y,_]=l;return`rgb:${u(m,d)}/${u(y,d)}/${u(_,d)}`}},5770:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;let a=n(482),u=n(8742),l=n(5770),d=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(y,_){this._handlers[y]===void 0&&(this._handlers[y]=[]);let c=this._handlers[y];return c.push(_),{dispose:()=>{let f=c.indexOf(_);f!==-1&&c.splice(f,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(y,_){if(this.reset(),this._ident=y,this._active=this._handlers[y]||d,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(y,_,c){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,_,c);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,_,c))}unhook(y,_=!0){if(this._active.length){let c=!1,f=this._active.length-1,h=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,c=_,h=this._stack.fallThrough,this._stack.paused=!1),!h&&c===!1){for(;f>=0&&(c=this._active[f].unhook(y),c!==!0);f--)if(c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,c;f--}for(;f>=0;f--)if(c=this._active[f].unhook(!1),c instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,c}else this._handlerFb(this._ident,"UNHOOK",y);this._active=d,this._ident=0}};let m=new u.Params;m.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=m,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():m,this._data="",this._hitLimit=!1}put(y,_,c){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,_,c),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let _=!1;if(this._hitLimit)_=!1;else if(y&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then((c=>(this._params=m,this._data="",this._hitLimit=!1,c)));return this._params=m,this._data="",this._hitLimit=!1,_}}},2015:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;let a=n(844),u=n(8742),l=n(6242),d=n(6351);class m{constructor(f){this.table=new Uint8Array(f)}setDefault(f,h){this.table.fill(f<<4|h)}add(f,h,p,v){this.table[h<<8|f]=p<<4|v}addMany(f,h,p,v){for(let S=0;S<f.length;S++)this.table[h<<8|f[S]]=p<<4|v}}s.TransitionTable=m;let y=160;s.VT500_TRANSITION_TABLE=(function(){let c=new m(4095),f=Array.apply(null,Array(256)).map(((x,w)=>w)),h=(x,w)=>f.slice(x,w),p=h(32,127),v=h(0,24);v.push(25),v.push.apply(v,h(28,32));let S=h(0,14),b;for(b in c.setDefault(1,0),c.addMany(p,0,2,0),S)c.addMany([24,26,153,154],b,3,0),c.addMany(h(128,144),b,3,0),c.addMany(h(144,152),b,3,0),c.add(156,b,0,0),c.add(27,b,11,1),c.add(157,b,4,8),c.addMany([152,158,159],b,0,7),c.add(155,b,11,3),c.add(144,b,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(p,8,5,8),c.add(127,8,5,8),c.addMany([156,27,24,26,7],8,6,0),c.addMany(h(28,32),8,0,8),c.addMany([88,94,95],1,0,7),c.addMany(p,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(h(64,127),3,7,0),c.addMany(h(48,60),3,8,4),c.addMany([60,61,62,63],3,9,4),c.addMany(h(48,60),4,8,4),c.addMany(h(64,127),4,7,0),c.addMany([60,61,62,63],4,0,6),c.addMany(h(32,64),6,0,6),c.add(127,6,0,6),c.addMany(h(64,127),6,0,0),c.addMany(h(32,48),3,9,5),c.addMany(h(32,48),5,9,5),c.addMany(h(48,64),5,0,6),c.addMany(h(64,127),5,7,0),c.addMany(h(32,48),4,9,5),c.addMany(h(32,48),1,9,2),c.addMany(h(32,48),2,9,2),c.addMany(h(48,127),2,10,0),c.addMany(h(48,80),1,10,0),c.addMany(h(81,88),1,10,0),c.addMany([89,90,92],1,10,0),c.addMany(h(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(h(28,32),9,0,9),c.addMany(h(32,48),9,9,12),c.addMany(h(48,60),9,8,10),c.addMany([60,61,62,63],9,9,10),c.addMany(v,11,0,11),c.addMany(h(32,128),11,0,11),c.addMany(h(28,32),11,0,11),c.addMany(v,10,0,10),c.add(127,10,0,10),c.addMany(h(28,32),10,0,10),c.addMany(h(48,60),10,8,10),c.addMany([60,61,62,63],10,0,11),c.addMany(h(32,48),10,9,12),c.addMany(v,12,0,12),c.add(127,12,0,12),c.addMany(h(28,32),12,0,12),c.addMany(h(32,48),12,9,12),c.addMany(h(48,64),12,0,11),c.addMany(h(64,127),12,12,13),c.addMany(h(64,127),10,12,13),c.addMany(h(64,127),9,12,13),c.addMany(v,13,13,13),c.addMany(p,13,13,13),c.add(127,13,0,13),c.addMany([27,156,24,26],13,14,0),c.add(y,0,2,0),c.add(y,8,5,8),c.add(y,6,0,6),c.add(y,11,0,11),c.add(y,13,13,13),c})();class _ extends a.Disposable{constructor(f=s.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(h,p,v)=>{},this._executeHandlerFb=h=>{},this._csiHandlerFb=(h,p)=>{},this._escHandlerFb=h=>{},this._errorHandlerFb=h=>h,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 l.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,h=[64,126]){let p=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(p=f.prefix.charCodeAt(0),p&&60>p||p>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<f.intermediates.length;++S){let b=f.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=b}}if(f.final.length!==1)throw new Error("final must be a single byte");let v=f.final.charCodeAt(0);if(h[0]>v||v>h[1])throw new Error(`final must be in range ${h[0]} .. ${h[1]}`);return p<<=8,p|=v,p}identToString(f){let h=[];for(;f;)h.push(String.fromCharCode(255&f)),f>>=8;return h.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,h){let p=this._identifier(f,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);let v=this._escHandlers[p];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,h){this._executeHandlers[f.charCodeAt(0)]=h}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,h){let p=this._identifier(f);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);let v=this._csiHandlers[p];return v.push(h),{dispose:()=>{let S=v.indexOf(h);S!==-1&&v.splice(S,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,h){return this._dcsParser.registerHandler(this._identifier(f),h)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,h){return this._oscParser.registerHandler(f,h)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,h,p,v,S){this._parseStack.state=f,this._parseStack.handlers=h,this._parseStack.handlerPos=p,this._parseStack.transition=v,this._parseStack.chunkPos=S}parse(f,h,p){let v,S=0,b=0,x=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,x=this._parseStack.chunkPos+1;else{if(p===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let w=this._parseStack.handlers,E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(p===!1&&E>-1){for(;E>=0&&(v=w[E](this._params),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 4:if(p===!1&&E>-1){for(;E>=0&&(v=w[E](),v!==!0);E--)if(v instanceof Promise)return this._parseStack.handlerPos=E,v}this._parseStack.handlers=[];break;case 6:if(S=f[this._parseStack.chunkPos],v=this._dcsParser.unhook(S!==24&&S!==26,p),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=f[this._parseStack.chunkPos],v=this._oscParser.end(S!==24&&S!==26,p),v)return v;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,x=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let w=x;w<h;++w){switch(S=f[w],b=this._transitions.table[this.currentState<<8|(S<160?S:y)],b>>4){case 2:for(let A=w+1;;++A){if(A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}if(++A>=h||(S=f[A])<32||S>126&&S<y){this._printHandler(f,w,A),w=A-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:w,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let E=this._csiHandlers[this._collect<<8|S],B=E?E.length-1:-1;for(;B>=0&&(v=E[B](this._params),v!==!0);B--)if(v instanceof Promise)return this._preserveStack(3,E,B,b,w),v;B<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++w<h&&(S=f[w])>47&&S<60);w--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:let P=this._escHandlers[this._collect<<8|S],W=P?P.length-1:-1;for(;W>=0&&(v=P[W](),v!==!0);W--)if(v instanceof Promise)return this._preserveStack(4,P,W,b,w),v;W<0&&this._escHandlerFb(this._collect<<8|S),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|S,this._params);break;case 13:for(let A=w+1;;++A)if(A>=h||(S=f[A])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(f,w,A),w=A-1;break}break;case 14:if(v=this._dcsParser.unhook(S!==24&&S!==26),v)return this._preserveStack(6,[],0,b,w),v;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let A=w+1;;A++)if(A>=h||(S=f[A])<32||S>127&&S<y){this._oscParser.put(f,w,A),w=A-1;break}break;case 6:if(v=this._oscParser.end(S!==24&&S!==26),v)return this._preserveStack(5,[],0,b,w),v;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}s.EscapeSequenceParser=_},6242:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;let a=n(5770),u=n(482),l=[];s.OscParser=class{constructor(){this._state=0,this._active=l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,m){this._handlers[d]===void 0&&(this._handlers[d]=[]);let y=this._handlers[d];return y.push(m),{dispose:()=>{let _=y.indexOf(m);_!==-1&&y.splice(_,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,m,y){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(d,m,y);else this._handlerFb(this._id,"PUT",(0,u.utf32ToString)(d,m,y))}start(){this.reset(),this._state=1}put(d,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){let _=d[m++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&y-m>0&&this._put(d,m,y)}}end(d,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,_=this._active.length-1,c=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,y=m,c=this._stack.fallThrough,this._stack.paused=!1),!c&&y===!1){for(;_>=0&&(y=this._active[_].end(d),y!==!0);_--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,y;_--}for(;_>=0;_--)if(y=this._active[_].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",d);this._active=l,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,m,y){this._hitLimit||(this._data+=(0,u.utf32ToString)(d,m,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let m=!1;if(this._hitLimit)m=!1;else if(d&&(m=this._handler(this._data),m instanceof Promise))return m.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,m}}},8742:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;let n=2147483647;class a{static fromArray(l){let d=new a;if(!l.length)return d;for(let m=Array.isArray(l[0])?1:0;m<l.length;++m){let y=l[m];if(Array.isArray(y))for(let _=0;_<y.length;++_)d.addSubParam(y[_]);else d.addParam(y)}return d}constructor(l=32,d=32){if(this.maxLength=l,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let l=new a(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){let l=[];for(let d=0;d<this.length;++d){l.push(this.params[d]);let m=this._subParamsIdx[d]>>8,y=255&this._subParamsIdx[d];y-m>0&&l.push(Array.prototype.slice.call(this._subParams,m,y))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>n?n:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>n?n:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){let d=this._subParamsIdx[l]>>8,m=255&this._subParamsIdx[l];return m-d>0?this._subParams.subarray(d,m):null}getSubParamsAll(){let l={};for(let d=0;d<this.length;++d){let m=this._subParamsIdx[d]>>8,y=255&this._subParamsIdx[d];y-m>0&&(l[d]=this._subParams.slice(m,y))}return l}addDigit(l){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let m=this._digitIsSub?this._subParams:this.params,y=m[d-1];m[d-1]=~y?Math.min(10*y+l,n):l}}s.Params=a},5741:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,a){let u={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(u),a.dispose=()=>this._wrappedAddonDispose(u),a.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let a=-1;for(let u=0;u<this._addons.length;u++)if(this._addons[u]===n){a=u;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(a,1)}}},8771:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;let a=n(3785),u=n(511);s.BufferApiView=class{constructor(l,d){this._buffer=l,this.type=d}init(l){return this._buffer=l,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(l){let d=this._buffer.lines.get(l);if(d)return new a.BufferLineApiView(d)}getNullCell(){return new u.CellData}}},3785:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;let a=n(511);s.BufferLineApiView=class{constructor(u){this._line=u}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(u,l){if(!(u<0||u>=this._line.length))return l?(this._line.loadCell(u,l),l):this._line.loadCell(u,new a.CellData)}translateToString(u,l,d){return this._line.translateToString(u,l,d)}}},8285:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;let a=n(8771),u=n(8460),l=n(844);class d extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new u.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=d},7975:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,a){return this._core.registerCsiHandler(n,(u=>a(u.toArray())))}addCsiHandler(n,a){return this.registerCsiHandler(n,a)}registerDcsHandler(n,a){return this._core.registerDcsHandler(n,((u,l)=>a(u,l.toArray())))}addDcsHandler(n,a){return this.registerDcsHandler(n,a)}registerEscHandler(n,a){return this._core.registerEscHandler(n,a)}addEscHandler(n,a){return this.registerEscHandler(n,a)}registerOscHandler(n,a){return this._core.registerOscHandler(n,a)}addOscHandler(n,a){return this.registerOscHandler(n,a)}}},7090:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(o,s,n){var a=this&&this.__decorate||function(c,f,h,p){var v,S=arguments.length,b=S<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,f,h,p);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(b=(S<3?v(b):S>3?v(f,h,b):v(f,h))||b);return S>3&&b&&Object.defineProperty(f,h,b),b},u=this&&this.__param||function(c,f){return function(h,p){f(h,p,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;let l=n(8460),d=n(844),m=n(5295),y=n(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let _=s.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(c){super(),this.isUserScrolling=!1,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.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 m.BufferSet(c,this))}resize(c,f){this.cols=c,this.rows=f,this.buffers.resize(c,f),this._onResize.fire({cols:c,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(c,f=!1){let h=this.buffer,p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===c.fg&&p.getBg(0)===c.bg||(p=h.getBlankLine(c,f),this._cachedBlankLine=p),p.isWrapped=f;let v=h.ybase+h.scrollTop,S=h.ybase+h.scrollBottom;if(h.scrollTop===0){let b=h.lines.isFull;S===h.lines.length-1?b?h.lines.recycle().copyFrom(p):h.lines.push(p.clone()):h.lines.splice(S+1,0,p.clone()),b?this.isUserScrolling&&(h.ydisp=Math.max(h.ydisp-1,0)):(h.ybase++,this.isUserScrolling||h.ydisp++)}else{let b=S-v+1;h.lines.shiftElements(v+1,b-1,-1),h.lines.set(S,p.clone())}this.isUserScrolling||(h.ydisp=h.ybase),this._onScroll.fire(h.ydisp)}scrollLines(c,f,h){let p=this.buffer;if(c<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else c+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);let v=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+c,p.ybase),0),v!==p.ydisp&&(f||this._onScroll.fire(p.ydisp))}};s.BufferService=_=a([u(0,y.IOptionsService)],_)},7994:(o,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(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,a){this._charsets[n]=a,this.glevel===n&&(this.charset=a)}}},1753:function(o,s,n){var a=this&&this.__decorate||function(p,v,S,b){var x,w=arguments.length,E=w<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(p,v,S,b);else for(var B=p.length-1;B>=0;B--)(x=p[B])&&(E=(w<3?x(E):w>3?x(v,S,E):x(v,S))||E);return w>3&&E&&Object.defineProperty(v,S,E),E},u=this&&this.__param||function(p,v){return function(S,b){v(S,b,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;let l=n(2585),d=n(8460),m=n(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:p=>p.button!==4&&p.action===1&&(p.ctrl=!1,p.alt=!1,p.shift=!1,!0)},VT200:{events:19,restrict:p=>p.action!==32},DRAG:{events:23,restrict:p=>p.action!==32||p.button!==3},ANY:{events:31,restrict:p=>!0}};function _(p,v){let S=(p.ctrl?16:0)|(p.shift?4:0)|(p.alt?8:0);return p.button===4?(S|=64,S|=p.action):(S|=3&p.button,4&p.button&&(S|=64),8&p.button&&(S|=128),p.action===32?S|=32:p.action!==0||v||(S|=3)),S}let c=String.fromCharCode,f={DEFAULT:p=>{let v=[_(p,!1)+32,p.col+32,p.row+32];return v[0]>255||v[1]>255||v[2]>255?"":`\x1B[M${c(v[0])}${c(v[1])}${c(v[2])}`},SGR:p=>{let v=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${_(p,!0)};${p.col};${p.row}${v}`},SGR_PIXELS:p=>{let v=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${_(p,!0)};${p.x};${p.y}${v}`}},h=s.CoreMouseService=class extends m.Disposable{constructor(p,v){super(),this._bufferService=p,this._coreService=v,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let S of Object.keys(y))this.addProtocol(S,y[S]);for(let S of Object.keys(f))this.addEncoding(S,f[S]);this.reset()}addProtocol(p,v){this._protocols[p]=v}addEncoding(p,v){this._encodings[p]=v}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(p){if(!this._protocols[p])throw new Error(`unknown protocol "${p}"`);this._activeProtocol=p,this._onProtocolChange.fire(this._protocols[p].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(p){if(!this._encodings[p])throw new Error(`unknown encoding "${p}"`);this._activeEncoding=p}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(p){if(p.col<0||p.col>=this._bufferService.cols||p.row<0||p.row>=this._bufferService.rows||p.button===4&&p.action===32||p.button===3&&p.action!==32||p.button!==4&&(p.action===2||p.action===3)||(p.col++,p.row++,p.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,p,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(p))return!1;let v=this._encodings[this._activeEncoding](p);return v&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(v):this._coreService.triggerDataEvent(v,!0)),this._lastEvent=p,!0}explainEvents(p){return{down:!!(1&p),up:!!(2&p),drag:!!(4&p),move:!!(8&p),wheel:!!(16&p)}}_equalEvents(p,v,S){if(S){if(p.x!==v.x||p.y!==v.y)return!1}else if(p.col!==v.col||p.row!==v.row)return!1;return p.button===v.button&&p.action===v.action&&p.ctrl===v.ctrl&&p.alt===v.alt&&p.shift===v.shift}};s.CoreMouseService=h=a([u(0,l.IBufferService),u(1,l.ICoreService)],h)},6975:function(o,s,n){var a=this&&this.__decorate||function(h,p,v,S){var b,x=arguments.length,w=x<3?p:S===null?S=Object.getOwnPropertyDescriptor(p,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,p,v,S);else for(var E=h.length-1;E>=0;E--)(b=h[E])&&(w=(x<3?b(w):x>3?b(p,v,w):b(p,v))||w);return x>3&&w&&Object.defineProperty(p,v,w),w},u=this&&this.__param||function(h,p){return function(v,S){p(v,S,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;let l=n(1439),d=n(8460),m=n(844),y=n(2585),_=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=s.CoreService=class extends m.Disposable{constructor(h,p,v){super(),this._bufferService=h,this._logService=p,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(c)}reset(){this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(c)}triggerDataEvent(h,p=!1){if(this._optionsService.rawOptions.disableStdin)return;let v=this._bufferService.buffer;p&&this._optionsService.rawOptions.scrollOnUserInput&&v.ybase!==v.ydisp&&this._onRequestScrollToBottom.fire(),p&&this._onUserInput.fire(),this._logService.debug(`sending data "${h}"`,(()=>h.split("").map((S=>S.charCodeAt(0))))),this._onData.fire(h)}triggerBinaryEvent(h){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${h}"`,(()=>h.split("").map((p=>p.charCodeAt(0))))),this._onBinary.fire(h))}};s.CoreService=f=a([u(0,y.IBufferService),u(1,y.ILogService),u(2,y.IOptionsService)],f)},9074:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;let a=n(8055),u=n(8460),l=n(844),d=n(6106),m=0,y=0;class _ extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((h=>h?.marker.line)),this._onDecorationRegistered=this.register(new u.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new u.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)((()=>this.reset())))}registerDecoration(h){if(h.marker.isDisposed)return;let p=new c(h);if(p){let v=p.marker.onDispose((()=>p.dispose()));p.onDispose((()=>{p&&(this._decorations.delete(p)&&this._onDecorationRemoved.fire(p),v.dispose())})),this._decorations.insert(p),this._onDecorationRegistered.fire(p)}return p}reset(){for(let h of this._decorations.values())h.dispose();this._decorations.clear()}*getDecorationsAtCell(h,p,v){let S=0,b=0;for(let x of this._decorations.getKeyIterator(p))S=x.options.x??0,b=S+(x.options.width??1),h>=S&&h<b&&(!v||(x.options.layer??"bottom")===v)&&(yield x)}forEachDecorationAtCell(h,p,v,S){this._decorations.forEachByKey(p,(b=>{m=b.options.x??0,y=m+(b.options.width??1),h>=m&&h<y&&(!v||(b.options.layer??"bottom")===v)&&S(b)}))}}s.DecorationService=_;class c extends l.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(h){super(),this.options=h,this.onRenderEmitter=this.register(new u.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=h.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;let a=n(2585),u=n(8343);class l{constructor(...m){this._entries=new Map;for(let[y,_]of m)this.set(y,_)}set(m,y){let _=this._entries.get(m);return this._entries.set(m,y),_}forEach(m){for(let[y,_]of this._entries.entries())m(y,_)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}s.ServiceCollection=l,s.InstantiationService=class{constructor(){this._services=new l,this._services.set(a.IInstantiationService,this)}setService(d,m){this._services.set(d,m)}getService(d){return this._services.get(d)}createInstance(d,...m){let y=(0,u.getServiceDependencies)(d).sort(((f,h)=>f.index-h.index)),_=[];for(let f of y){let h=this._services.get(f.id);if(!h)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${f.id}.`);_.push(h)}let c=y.length>0?y[0].index:m.length;if(m.length!==c)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${c+1} conflicts with ${m.length} static arguments`);return new d(...m,..._)}}},7866:function(o,s,n){var a=this&&this.__decorate||function(c,f,h,p){var v,S=arguments.length,b=S<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,h):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,f,h,p);else for(var x=c.length-1;x>=0;x--)(v=c[x])&&(b=(S<3?v(b):S>3?v(f,h,b):v(f,h))||b);return S>3&&b&&Object.defineProperty(f,h,b),b},u=this&&this.__param||function(c,f){return function(h,p){f(h,p,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;let l=n(844),d=n(2585),m={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF},y,_=s.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(c){super(),this._optionsService=c,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(c){for(let f=0;f<c.length;f++)typeof c[f]=="function"&&(c[f]=c[f]())}_log(c,f,h){this._evalLazyOptionalParams(h),c.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...h)}trace(c,...f){this._logLevel<=d.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,c,f)}debug(c,...f){this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,c,f)}info(c,...f){this._logLevel<=d.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,c,f)}warn(c,...f){this._logLevel<=d.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,c,f)}error(c,...f){this._logLevel<=d.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,c,f)}};s.LogService=_=a([u(0,d.IOptionsService)],_),s.setTraceLogger=function(c){y=c},s.traceCall=function(c,f,h){if(typeof h.value!="function")throw new Error("not supported");let p=h.value;h.value=function(...v){if(y.logLevel!==d.LogLevelEnum.TRACE)return p.apply(this,v);y.trace(`GlyphRenderer#${p.name}(${v.map((b=>JSON.stringify(b))).join(", ")})`);let S=p.apply(this,v);return y.trace(`GlyphRenderer#${p.name} return`,S),S}}},7302:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;let a=n(8460),u=n(844),l=n(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:l.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let d=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends u.Disposable{constructor(_){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;let c={...s.DEFAULT_OPTIONS};for(let f in _)if(f in c)try{let h=_[f];c[f]=this._sanitizeAndValidateOption(f,h)}catch(h){console.error(h)}this.rawOptions=c,this.options={...c},this._setupOptions(),this.register((0,u.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(_,c){return this.onOptionChange((f=>{f===_&&c(this.rawOptions[_])}))}onMultipleOptionChange(_,c){return this.onOptionChange((f=>{_.indexOf(f)!==-1&&c()}))}_setupOptions(){let _=f=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},c=(f,h)=>{if(!(f in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);h=this._sanitizeAndValidateOption(f,h),this.rawOptions[f]!==h&&(this.rawOptions[f]=h,this._onOptionChange.fire(f))};for(let f in this.rawOptions){let h={get:_.bind(this,f),set:c.bind(this,f)};Object.defineProperty(this.options,f,h)}}_sanitizeAndValidateOption(_,c){switch(_){case"cursorStyle":if(c||(c=s.DEFAULT_OPTIONS[_]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(c))throw new Error(`"${c}" is not a valid value for ${_}`);break;case"wordSeparator":c||(c=s.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof c=="number"&&1<=c&&c<=1e3)break;c=d.includes(c)?c:s.DEFAULT_OPTIONS[_];break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(`${_} 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(`${_} cannot be less than 0, value: ${c}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${c}`);break;case"rows":case"cols":if(!c&&c!==0)throw new Error(`${_} must be numeric, value: ${c}`);break;case"windowsPty":c=c??{}}return c}}s.OptionsService=m},2660:function(o,s,n){var a=this&&this.__decorate||function(m,y,_,c){var f,h=arguments.length,p=h<3?y:c===null?c=Object.getOwnPropertyDescriptor(y,_):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(m,y,_,c);else for(var v=m.length-1;v>=0;v--)(f=m[v])&&(p=(h<3?f(p):h>3?f(y,_,p):f(y,_))||p);return h>3&&p&&Object.defineProperty(y,_,p),p},u=this&&this.__param||function(m,y){return function(_,c){y(_,c,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;let l=n(2585),d=s.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){let y=this._bufferService.buffer;if(m.id===void 0){let v=y.addMarker(y.ybase+y.y),S={data:m,id:this._nextId++,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(S,v))),this._dataByLinkId.set(S.id,S),S.id}let _=m,c=this._getEntryIdKey(_),f=this._entriesWithId.get(c);if(f)return this.addLineToLink(f.id,y.ybase+y.y),f.id;let h=y.addMarker(y.ybase+y.y),p={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(p,h))),this._entriesWithId.set(p.key,p),this._dataByLinkId.set(p.id,p),p.id}addLineToLink(m,y){let _=this._dataByLinkId.get(m);if(_&&_.lines.every((c=>c.line!==y))){let c=this._bufferService.buffer.addMarker(y);_.lines.push(c),c.onDispose((()=>this._removeMarkerFromLink(_,c)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){let _=m.lines.indexOf(y);_!==-1&&(m.lines.splice(_,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};s.OscLinkService=d=a([u(0,l.IBufferService)],d)},8343:(o,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;let n="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(u){return u[a]||[]},s.createDecorator=function(u){if(s.serviceRegistry.has(u))return s.serviceRegistry.get(u);let l=function(d,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,c,f){c[n]===c?c[a].push({id:_,index:f}):(c[a]=[{id:_,index:f}],c[n]=c)})(l,d,y)};return l.toString=()=>u,s.serviceRegistry.set(u,l),l}},2585:(o,s,n)=>{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=n(8343);var u;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(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"})(u||(s.LogLevelEnum=u={})),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:(o,s,n)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;let a=n(8460),u=n(225);class l{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,y,_=!1){return(16777215&m)<<3|(3&y)<<1|(_?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;let m=new u.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let y=0,_=0,c=m.length;for(let f=0;f<c;++f){let h=m.charCodeAt(f);if(55296<=h&&h<=56319){if(++f>=c)return y+this.wcwidth(h);let S=m.charCodeAt(f);56320<=S&&S<=57343?h=1024*(h-55296)+S-56320+65536:y+=this.wcwidth(S)}let p=this.charProperties(h,_),v=l.extractWidth(p);l.extractShouldJoin(p)&&(v-=l.extractWidth(_)),y+=v,_=p}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}s.UnicodeService=l}},t={};function r(o){var s=t[o];if(s!==void 0)return s.exports;var n=t[o]={exports:{}};return e[o].call(n.exports,n,n.exports,r),n.exports}var i={};return(()=>{var o=i;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;let s=r(9042),n=r(3236),a=r(844),u=r(5741),l=r(8285),d=r(7975),m=r(7090),y=["cols","rows"];class _ extends a.Disposable{constructor(f){super(),this._core=this.register(new n.Terminal(f)),this._addonManager=this.register(new u.AddonManager),this._publicOptions={...this._core.options};let h=v=>this._core.options[v],p=(v,S)=>{this._checkReadonlyOptions(v),this._core.options[v]=S};for(let v in this._core.options){let S={get:h.bind(this,v),set:p.bind(this,v)};Object.defineProperty(this._publicOptions,v,S)}}_checkReadonlyOptions(f){if(y.includes(f))throw new Error(`Option "${f}" 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 d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let f=this._core.coreService.decPrivateModes,h="none";switch(this._core.coreMouseService.activeProtocol){case"X10":h="x10";break;case"VT200":h="vt200";break;case"DRAG":h="drag";break;case"ANY":h="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:h,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(let h in f)this._publicOptions[h]=f[h]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,h=!0){this._core.input(f,h)}resize(f,h){this._verifyIntegers(f,h),this._core.resize(f,h)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,h,p){this._verifyIntegers(f,h,p),this._core.select(f,h,p)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,h){this._verifyIntegers(f,h),this._core.selectLines(f,h)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,h){this._core.write(f,h)}writeln(f,h){this._core.write(f),this._core.write(`\r
|
|
9
|
+
`,h)}paste(f){this._core.paste(f)}refresh(f,h){this._verifyIntegers(f,h),this._core.refresh(f,h)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return s}_verifyIntegers(...f){for(let h of f)if(h===1/0||isNaN(h)||h%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(let h of f)if(h&&(h===1/0||isNaN(h)||h%1!=0||h<0))throw new Error("This API only accepts positive integers")}}o.Terminal=_})(),i})()))});var Pa=Ma((hs,Tn)=>{(function(e,t){typeof hs=="object"&&typeof Tn=="object"?Tn.exports=t():typeof define=="function"&&define.amd?define([],t):typeof hs=="object"?hs.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(r){this._terminal=r}dispose(){}fit(){let r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;let i=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(i._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let r=this._terminal._core,i=r._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;let o=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),l=n-(parseInt(u.getPropertyValue("padding-top"))+parseInt(u.getPropertyValue("padding-bottom"))),d=a-(parseInt(u.getPropertyValue("padding-right"))+parseInt(u.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(d/i.css.cell.width)),rows:Math.max(1,Math.floor(l/i.css.cell.height))}}}})(),e})()))});var Sh=Ra(Da(),1),Ch=Ra(Pa(),1);var du=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ba.isErrorNoTelemetry(e)?new Ba(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(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(
|
|
15
|
-
`),
|
|
16
|
-
`)).size}/${i.length} leaks) at ${y}`;let
|
|
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)}},uu=new du;function Mn(e){fu(e)||uu.onUnexpectedError(e)}var Dn="Canceled";function fu(e){return e instanceof pu?!0:e instanceof Error&&e.name===Dn&&e.message===Dn}var pu=class extends Error{constructor(){super(Dn),this.name=this.message}},Ba=class Pn extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Pn)return t;let r=new Pn;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function _u(e,t,r=0,i=e.length){let o=r,s=i;for(;o<s;){let n=Math.floor((o+s)/2);t(e[n])?o=n+1:s=n}return o-1}var mu=class Ka{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Ka.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=_u(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};mu.assertInvariants=!1;var Bn;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function o(s){return s===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Bn||(Bn={}));function gu(e,t){return(r,i)=>t(e(r),e(i))}var vu=(e,t)=>e-t,Oa=class On{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new On(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new On(r=>this.iterate(i=>r(t(i))))}some(t){let r=!1;return this.iterate(i=>(r=t(i),!r)),r}findFirst(t){let r;return this.iterate(i=>t(i)?(r=i,!1):!0),r}findLast(t){let r;return this.iterate(i=>(t(i)&&(r=i),!0)),r}findLastMaxBy(t){let r,i=!0;return this.iterate(o=>((i||Bn.isGreaterThan(t(o,r)))&&(i=!1,r=o),!0)),r}};Oa.empty=new Oa(e=>{});function bu(e,t){let r=Object.create(null);for(let i of e){let o=t(i),s=r[o];s||(s=r[o]=[]),s.push(i)}return r}var Ia,Na,bv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Ia]="SetWithKey";for(let r of e)this.add(r)}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(r=>e.call(t,r,r,this))}[(Na=Symbol.iterator,Ia=Symbol.toStringTag,Na)](){return this.values()}},wu=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function yu(e,t){let r=this,i=!1,o;return function(){if(i)return o;if(i=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var In;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(b){yield b}e.single=o;function s(b){return t(b)?b:o(b)}e.wrap=s;function n(b){return b||r}e.from=n;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function u(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=u;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let w=0;for(let E of b)if(x(E,w++))return!0;return!1}e.some=d;function m(b,x){for(let w of b)if(x(w))return w}e.find=m;function*y(b,x){for(let w of b)x(w)&&(yield w)}e.filter=y;function*_(b,x){let w=0;for(let E of b)yield x(E,w++)}e.map=_;function*c(b,x){let w=0;for(let E of b)yield*x(E,w++)}e.flatMap=c;function*f(...b){for(let x of b)yield*x}e.concat=f;function h(b,x,w){let E=w;for(let B of b)E=x(E,B);return E}e.reduce=h;function*p(b,x,w=b.length){for(x<0&&(x+=b.length),w<0?w+=b.length:w>b.length&&(w=b.length);x<w;x++)yield b[x]}e.slice=p;function v(b,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,b];let E=b[Symbol.iterator]();for(let B=0;B<x;B++){let P=E.next();if(P.done)return[w,e.empty()];w.push(P.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(b){let x=[];for await(let w of b)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(In||(In={}));var Su=!1,Ur=null,Cu=class Ga{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:Ga.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let i=this.getDisposableData(t);i.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let i=r.get(t);if(i)return i;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let i;if(r)i=r;else{let u=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,u).isSingleton);if(l.length===0)return;let d=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&d.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(u){function l(m,y){for(;m.length>0&&y.some(_=>typeof _=="string"?_===m[0]:m[0].match(_));)m.shift()}let d=u.source.split(`
|
|
14
|
+
`).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let s=new wu;for(let u of i){let l=o(u);for(let d=0;d<=l.length;d++)s.add(l.slice(0,d).join(`
|
|
15
|
+
`),u)}i.sort(gu(u=>u.idx,vu));let n="",a=0;for(let u of i.slice(0,t)){a++;let l=o(u),d=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${s.get(l.slice(0,m+1).join(`
|
|
16
|
+
`)).size}/${i.length} leaks) at ${y}`;let _=s.get(l.slice(0,m).join(`
|
|
17
|
+
`)),c=bu([..._].map(f=>o(f)[m]),f=>f);delete c[l[m]];for(let[f,h]of Object.entries(c))d.unshift(` - stacktraces of ${h.length} other leaks continue with ${f}`);d.unshift(y)}n+=`
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
==================== Leaking disposable ${a}/${i.length}: ${
|
|
21
|
-
${
|
|
20
|
+
==================== Leaking disposable ${a}/${i.length}: ${u.value.constructor.name} ====================
|
|
21
|
+
${d.join(`
|
|
22
22
|
`)}
|
|
23
23
|
============================================================
|
|
24
24
|
|
|
25
|
-
`}return i.length>t&&(
|
|
25
|
+
`}return i.length>t&&(n+=`
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
... and ${i.length-t} more leaking disposables
|
|
29
29
|
|
|
30
|
-
`),{leaks:i,details:
|
|
30
|
+
`),{leaks:i,details:n}}};Cu.idx=0;function xu(e){Ur=e}if(Su){let e="__is_disposable_tracked__";xu(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==It.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==It.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function vs(e){return Ur?.trackDisposable(e),e}function bs(e){Ur?.markAsDisposed(e)}function Ci(e,t){Ur?.setParent(e,t)}function ku(e,t){if(Ur)for(let r of e)Ur.setParent(r,t)}function Si(e){if(In.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Va(...e){let t=$r(()=>Si(e));return ku(e,t),t}function $r(e){let t=vs({dispose:yu(()=>{bs(t),e()})});return t}var Ya=class Ja{constructor(){this._toDispose=new Set,this._isDisposed=!1,vs(this)}dispose(){this._isDisposed||(bs(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 Ci(t,this),this._isDisposed?Ja.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),Ci(t,null))}};Ya.DISABLE_DISPOSED_WARNING=!1;var Un=Ya,It=class{constructor(){this._store=new Un,vs(this),Ci(this._store,this)}dispose(){bs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};It.None=Object.freeze({dispose(){}});var ms=class{constructor(){this._isDisposed=!1,vs(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ci(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,bs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ci(e,null),e}},Ha=class Nn{constructor(t){this.element=t,this.next=Nn.Undefined,this.prev=Nn.Undefined}};Ha.Undefined=new Ha(void 0);var Eu=globalThis.performance&&typeof globalThis.performance.now=="function",Lu=class Xa{static create(t){return new Xa(t)}constructor(t){this._now=Eu&&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}},Tu=!1,Fa=!1,Mu=!1,gs;(e=>{e.None=()=>It.None;function t(O){if(Mu){let{onDidAddListener:R}=O,F=Wn.create(),I=0;O.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),F.print()),R?.()}}}function r(O,R){return y(O,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(O){return(R,F=null,I)=>{let C=!1,L;return L=O(T=>{if(!C)return L?L.dispose():C=!0,R.call(F,T)},null,I),C&&L.dispose(),L}}e.once=i;function o(O,R,F){return d((I,C=null,L)=>O(T=>I.call(C,R(T)),null,L),F)}e.map=o;function s(O,R,F){return d((I,C=null,L)=>O(T=>{R(T),I.call(C,T)},null,L),F)}e.forEach=s;function n(O,R,F){return d((I,C=null,L)=>O(T=>R(T)&&I.call(C,T),null,L),F)}e.filter=n;function a(O){return O}e.signal=a;function u(...O){return(R,F=null,I)=>{let C=Va(...O.map(L=>L(T=>R.call(F,T))));return m(C,I)}}e.any=u;function l(O,R,F,I){let C=F;return o(O,L=>(C=R(C,L),C),I)}e.reduce=l;function d(O,R){let F,I={onWillAddFirstListener(){F=O(C.fire,C)},onDidRemoveLastListener(){F?.dispose()}};R||t(I);let C=new Ot(I);return R?.add(C),C.event}function m(O,R){return R instanceof Array?R.push(O):R&&R.add(O),O}function y(O,R,F=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=O(j=>{$++,N=R(N,j),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||$>1)&&k.fire(q),$=0},typeof F=="number"?(clearTimeout(G),G=setTimeout(Y,F)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Ot(H);return T?.add(k),k.event}e.debounce=y;function _(O,R=0,F){return e.debounce(O,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,F)}e.accumulate=_;function c(O,R=(I,C)=>I===C,F){let I=!0,C;return n(O,L=>{let T=I||!R(L,C);return I=!1,C=L,T},F)}e.latch=c;function f(O,R,F){return[e.filter(O,R,F),e.filter(O,I=>!R(I),F)]}e.split=f;function h(O,R=!1,F=[],I){let C=F.slice(),L=O(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Ot({onWillAddFirstListener(){L||(L=O(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function p(O,R){return(F,I,C)=>{let L=R(new S);return O(function(T){let D=L.evaluate(T);D!==v&&F.call(I,D)},void 0,C)}}e.chain=p;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(F=>(R(F),F)),this}filter(R){return this.steps.push(F=>R(F)?F:v),this}reduce(R,F){let I=F;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(F,I)=>F===I){let F=!0,I;return this.steps.push(C=>{let L=F||!R(C,I);return F=!1,I=C,L?C:v}),this}evaluate(R){for(let F of this.steps)if(R=F(R),R===v)break;return R}}function b(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.on(R,I),L=()=>O.removeListener(R,I),T=new Ot({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=b;function x(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.addEventListener(R,I),L=()=>O.removeEventListener(R,I),T=new Ot({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(O){return new Promise(R=>i(O)(R))}e.toPromise=w;function E(O){let R=new Ot;return O.then(F=>{R.fire(F)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function B(O,R){return O(F=>R.fire(F))}e.forward=B;function P(O,R,F){return R(F),O(I=>R(I))}e.runAndSubscribe=P;class W{constructor(R,F){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};F||t(I),this.emitter=new Ot(I),F&&F.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,F){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,R){return new W(O,R).emitter.event}e.fromObservable=A;function V(O){return(R,F,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(O.reportChanges(),L&&(L=!1,R.call(F)))},handlePossibleChange(){},handleChange(){L=!0}};O.addObserver(T),O.reportChanges();let D={dispose(){O.removeObserver(T)}};return I instanceof Un?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(gs||(gs={}));var Hn=class Fn{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Fn._idPool++}`,Fn.all.add(this)}start(t){this._stopWatch=new Lu,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}}};Hn.all=new Set,Hn._idPool=0;var Ru=Hn,Wa=-1,Za=class Qa{constructor(t,r,i=(Qa._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(s);let u=new Du(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};Za._idPool=1;var Au=Za,Wn=class el{constructor(t){this.value=t}static create(){let t=new Error;return new el(t.stack??"")}print(){console.warn(this.value.split(`
|
|
31
31
|
`).slice(2).join(`
|
|
32
|
-
`))}},
|
|
33
|
-
`)),e.length=0)},3e3),
|
|
32
|
+
`))}},Du=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Pu=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Bu=0,us=class{constructor(e){this.value=e,this.id=Bu++}},Ou=2,Iu=(e,t)=>{if(e instanceof us)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},fs;if(Tu){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),fs=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Ot=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Wa>0||this._options?.leakWarningThreshold?new Au(e?.onListenerError??Mn,this._options?.leakWarningThreshold??Wa):void 0,this._perfMon=this._options?._profName?new Ru(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(Fa){let e=this._listeners;queueMicrotask(()=>{Iu(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,r)=>{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 u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Pu(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||Mn)(l),It.None}if(this._disposed)return It.None;t&&(e=e.bind(t));let i=new us(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Wn.create(),o=this._leakageMon.check(i.stack,this._size+1)),Fa&&(i.stack=s??Wn.create()),this._listeners?this._listeners instanceof us?(this._deliveryQueue??(this._deliveryQueue=new Nu),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=$r(()=>{fs?.unregister(n),o?.(),this._removeListener(i)});if(r instanceof Un?r.add(n):Array.isArray(r)&&r.push(n),fs){let a=new Error().stack.split(`
|
|
34
34
|
`).slice(2,3).join(`
|
|
35
|
-
`).trim(),d=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);as.register(o,d?.[2]??a,o)}return o}),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,r=t.indexOf(e);if(r===-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[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Ru<=t.length){let n=0;for(let s=0;s<t.length;s++)t[s]?t[n++]=t[s]:i&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=n}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||Sn;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 os)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}},Du=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ja=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Na;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Pu?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ds.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ja})})(Na||(Na={}));var Pu=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?Ja:(this._emitter||(this._emitter=new Lt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ir="en",Bn=!1,On=!1,ls=!1,Bu=!1,Ou=!1,Za=!1,Iu=!1,Nu=!1,Hu=!1,Fu=!1,ns,cs=Ir,Ha=Ir,Wu,zt,Ut=globalThis,at;typeof Ut.vscode<"u"&&typeof Ut.vscode.process<"u"?at=Ut.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(at=process);var Qa=typeof at?.versions?.electron=="string",zu=Qa&&at?.type==="renderer";if(typeof at=="object"){Bn=at.platform==="win32",On=at.platform==="darwin",ls=at.platform==="linux",Bu=ls&&!!at.env.SNAP&&!!at.env.SNAP_REVISION,Iu=Qa,Hu=!!at.env.CI||!!at.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ns=Ir,cs=Ir;let e=at.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ns=t.userLocale,Ha=t.osLocale,cs=t.resolvedLanguage||Ir,Wu=t.languagePack?.translationsConfigFile}catch{}Ou=!0}else typeof navigator=="object"&&!zu?(zt=navigator.userAgent,Bn=zt.indexOf("Windows")>=0,On=zt.indexOf("Macintosh")>=0,Nu=(zt.indexOf("Macintosh")>=0||zt.indexOf("iPad")>=0||zt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ls=zt.indexOf("Linux")>=0,Fu=zt?.indexOf("Mobi")>=0,Za=!0,cs=globalThis._VSCODE_NLS_LANGUAGE||Ir,ns=navigator.language.toLowerCase(),Ha=ns):console.error("Unable to resolve platform.");var Cn=0;On?Cn=1:Bn?Cn=3:ls&&(Cn=2);var Uu=Za&&typeof Ut.importScripts=="function",pv=Uu?Ut.origin:void 0,Mt=zt,ir=cs,Fa;(e=>{function t(){return ir}e.value=t;function r(){return ir.length===2?ir==="en":ir.length>=3?ir[0]==="e"&&ir[1]==="n"&&ir[2]==="-":!1}e.isDefaultVariant=r;function i(){return ir==="en"}e.isDefault=i})(Fa||(Fa={}));var ju=typeof Ut.postMessage=="function"&&!Ut.importScripts,$u=(()=>{if(ju){let e=[];Ut.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Ut.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),qu=!!(Mt&&Mt.indexOf("Chrome")>=0),_v=!!(Mt&&Mt.indexOf("Firefox")>=0),mv=!!(!qu&&Mt&&Mt.indexOf("Safari")>=0),gv=!!(Mt&&Mt.indexOf("Edg/")>=0),vv=!!(Mt&&Mt.indexOf("Android")>=0);function el(e,t=0,r){let i=setTimeout(()=>{e(),r&&n.dispose()},t),n=Hr(()=>{clearTimeout(i),r?.deleteAndLeak(n)});return r?.add(n),n}var Ku,xn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?xn=(e,t)=>{$u(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:xn=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),n=!1;return{dispose(){n||(n=!0,e.cancelIdleCallback(i))}}},Ku=e=>xn(globalThis,e)})();var Wa;(e=>{async function t(i){let n,s=await Promise.all(i.map(o=>o.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return s}e.settled=t;function r(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(o){s(o)}})}e.withAsyncBody=r})(Wa||(Wa={}));var za=class ht{static fromArray(t){return new ht(r=>{r.emitMany(t)})}static fromPromise(t){return new ht(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ht(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new ht(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Lt,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 ds.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new ht(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return ht.map(this,t)}static filter(t,r){return new ht(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return ht.filter(this,t)}static coalesce(t){return ht.filter(t,r=>!!r)}coalesce(){return ht.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return ht.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())}};za.EMPTY=za.fromArray([]);var Gu=class extends Tt{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new hs),this._linesCacheDisposables=this._register(new hs),this._register(Hr(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=$a(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=el(()=>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 r=[],i=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let s=this._terminal.buffer.active.getLine(e+1),o=s?s.isWrapped:!1,a=n.translateToString(!o&&t);if(o&&s){let d=n.getCell(n.length-1);d&&d.getCode()===0&&d.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(r.push(a),o)i.push(i[i.length-1]+a.length);else break;e++,n=s}return[r.join(""),i]}},Vu=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}},Yu=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let n={startRow:t,startCol:r},s=this._findInLine(e,n,i);if(!s)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=o,n.startCol=0,s=this._findInLine(e,n,i),!s);o++);return s}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=0,s=0;i&&(r===e?(n=i.end.x,s=i.end.y):(n=i.start.x,s=i.start.y)),this._lineCache.initLinesCache();let o={startRow:s,startCol:n},a=this._findInLine(e,o,t);if(!a)for(let d=s+1;d<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=d,o.startCol=0,a=this._findInLine(e,o,t),!a);d++);if(!a&&s!==0)for(let d=0;d<s&&(o.startRow=d,o.startCol=0,a=this._findInLine(e,o,t),!a);d++);return!a&&i&&(o.startRow=i.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a={startRow:n,startCol:s},d;if(i&&(a.startRow=n=i.start.y,a.startCol=s=i.start.x,r!==e&&(d=this._findInLine(e,a,t,!1),d||(a.startRow=n=i.end.y,a.startCol=s=i.end.x))),d||(d=this._findInLine(e,a,t,o)),!d){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=n-1;l>=0&&(a.startRow=l,d=this._findInLine(e,a,t,o),!d);l--);}if(!d&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=n&&(a.startRow=l,d=this._findInLine(e,a,t,o),!d);l--);return d}_isWholeWord(e,t,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+r.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+r.length]))}_findInLine(e,t,r={},i=!1){let n=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(n)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let o=this._lineCache.getLineFromCache(n);o||(o=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,o));let[a,d]=o,l=this._bufferColsToStringOffset(n,s),_=e,m=a;r.regex||(_=r.caseSensitive?e:e.toLowerCase(),m=r.caseSensitive?a:a.toLowerCase());let y=-1;if(r.regex){let p=RegExp(_,r.caseSensitive?"g":"gi"),c;if(i)for(;c=p.exec(m.slice(0,l));)y=p.lastIndex-c[0].length,e=c[0],p.lastIndex-=e.length-1;else c=p.exec(m.slice(l)),c&&c[0].length>0&&(y=l+(p.lastIndex-c[0].length),e=c[0])}else i?l-_.length>=0&&(y=m.lastIndexOf(_,l-_.length)):y=m.indexOf(_,l);if(y>=0){if(r.wholeWord&&!this._isWholeWord(y,m,e))return;let p=0;for(;p<d.length-1&&y>=d[p+1];)p++;let c=p;for(;c<d.length-1&&y+e.length>=d[c+1];)c++;let u=y-d[p],h=y+e.length-d[c],f=this._stringLengthToBufferSize(n+p,u),v=this._stringLengthToBufferSize(n+c,h)-f+this._terminal.cols*(c-p);return{term:e,col:f,row:n+p,size:v}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let i=0;i<t;i++){let n=r.getCell(i);if(!n)break;let s=n.getChars();s.length>1&&(t-=s.length-1);let o=r.getCell(i+1);o&&o.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,i=0,n=this._terminal.buffer.active.getLine(r);for(;t>0&&n;){for(let s=0;s<t&&s<this._terminal.cols;s++){let o=n.getCell(s);if(!o)break;o.getWidth()&&(i+=o.getCode()===0?1:o.getChars().length)}if(r++,n=this._terminal.buffer.active.getLine(r),n&&!n.isWrapped)break;t-=this._terminal.cols}return i}},Xu=class extends Tt{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Hr(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let i=this._createResultDecorations(r,t,!1);if(i)for(let n of i)this._storeDecoration(n,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){gi(r)}}}clearHighlightDecorations(){gi(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,r){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),r&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,r){let i=[],n=e.col,s=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let d=Math.min(this._terminal.cols-n,s);i.push([o,n,d]),n=0,s-=d,o++}let a=[];for(let d of i){let l=this._terminal.registerMarker(d[0]),_=this._terminal.registerDecoration({marker:l,x:d[1],width:d[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(_){let m=[];m.push(l),m.push(_.onRender(y=>this._applyStyles(y,r?t.activeMatchBorder:t.matchBorder,!1))),m.push(_.onDispose(()=>gi(m))),a.push(_)}}return a.length===0?void 0:a}},Ju=class extends Tt{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Lt)}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 r=this._searchResults[t];if(r.row===e.row&&r.col===e.col&&r.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()}},tl=class extends Tt{constructor(e){super(),this._highlightTimeout=this._register(new hs),this._lineCache=this._register(new hs),this._state=new Vu,this._resultTracker=this._register(new Ju),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Gu(e),this._engine=new Yu(e,this._lineCache.value),this._decorationManager=new Xu(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Hr(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=el(()=>{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,r){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 i=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_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 r=[],i,n=this._engine.find(e,0,0,t);for(;n&&(i?.row!==n.row||i?.col!==n.col)&&!(r.length>=this._highlightLimit);)i=n,r.push(i),n=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}findPrevious(e,t,r){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 i=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}_selectResult(e,t,r){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 i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var Zu=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=ef.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:n}=t;this._options.hover(r,i,n)}},t))}};function Qu(e){try{let t=new URL(e),r=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(r.toLocaleLowerCase())}catch{return!1}}var ef=class ps{static computeLink(t,r,i,n){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,a]=ps._getWindowedLineStrings(t-1,i),d=o.join(""),l,_=[];for(;l=s.exec(d);){let m=l[0];if(!Qu(m))continue;let[y,p]=ps._mapStrIdx(i,a,0,l.index),[c,u]=ps._mapStrIdx(i,y,p,m.length);if(y===-1||p===-1||c===-1||u===-1)continue;let h={start:{x:p+1,y:y+1},end:{x:u,y:c+1}};_.push({range:h,text:m,activate:n})}return _}static _getWindowedLineStrings(t,r){let i,n=t,s=t,o=0,a="",d=[];if(i=r.buffer.active.getLine(t)){let l=i.translateToString(!0);if(i.isWrapped&&l[0]!==" "){for(o=0;(i=r.buffer.active.getLine(--n))&&o<2048&&(a=i.translateToString(!0),o+=a.length,d.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););d.reverse()}for(d.push(l),o=0;(i=r.buffer.active.getLine(++s))&&i.isWrapped&&o<2048&&(a=i.translateToString(!0),o+=a.length,d.push(a),a.indexOf(" ")===-1););}return[d,n]}static _mapStrIdx(t,r,i,n){let s=t.buffer.active,o=s.getNullCell(),a=i;for(;n;){let d=s.getLine(r);if(!d)return[-1,-1];for(let l=a;l<d.length;++l){d.getCell(l,o);let _=o.getChars();if(o.getWidth()&&(n-=_.length||1,l===d.length-1&&_==="")){let m=s.getLine(r+1);m&&m.isWrapped&&(m.getCell(0,o),o.getWidth()===2&&(n+=1))}if(n<0)return[r,l]}r++,a=0}return[r,a]}},tf=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function rf(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var rl=class{constructor(e=rf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||tf;this._linkProvider=this._terminal.registerLinkProvider(new Zu(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var sf=Object.defineProperty,nf=Object.getOwnPropertyDescriptor,of=(e,t,r,i)=>{for(var n=i>1?void 0:i?nf(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(n=(i?o(t,r,n):o(n))||n);return i&&n&&sf(t,r,n),n},af=(e,t)=>(r,i)=>t(r,i,e),lf=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?il.isErrorNoTelemetry(e)?new il(e.message+`
|
|
35
|
+
`).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);fs.register(n,u?.[2]??a,n)}return n}),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,r=t.indexOf(e);if(r===-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[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Ou<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||Mn;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 us)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}},Nu=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},tl=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),ja;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Hu?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:gs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tl})})(ja||(ja={}));var Hu=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?tl:(this._emitter||(this._emitter=new Ot),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zr="en",jn=!1,zn=!1,ps=!1,Fu=!1,Wu=!1,rl=!1,ju=!1,zu=!1,Uu=!1,$u=!1,ds,_s=zr,za=zr,qu,Vt,Yt=globalThis,mt;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?mt=Yt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(mt=process);var il=typeof mt?.versions?.electron=="string",Ku=il&&mt?.type==="renderer";if(typeof mt=="object"){jn=mt.platform==="win32",zn=mt.platform==="darwin",ps=mt.platform==="linux",Fu=ps&&!!mt.env.SNAP&&!!mt.env.SNAP_REVISION,ju=il,Uu=!!mt.env.CI||!!mt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ds=zr,_s=zr;let e=mt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ds=t.userLocale,za=t.osLocale,_s=t.resolvedLanguage||zr,qu=t.languagePack?.translationsConfigFile}catch{}Wu=!0}else typeof navigator=="object"&&!Ku?(Vt=navigator.userAgent,jn=Vt.indexOf("Windows")>=0,zn=Vt.indexOf("Macintosh")>=0,zu=(Vt.indexOf("Macintosh")>=0||Vt.indexOf("iPad")>=0||Vt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ps=Vt.indexOf("Linux")>=0,$u=Vt?.indexOf("Mobi")>=0,rl=!0,_s=globalThis._VSCODE_NLS_LANGUAGE||zr,ds=navigator.language.toLowerCase(),za=ds):console.error("Unable to resolve platform.");var Rn=0;zn?Rn=1:jn?Rn=3:ps&&(Rn=2);var Gu=rl&&typeof Yt.importScripts=="function",wv=Gu?Yt.origin:void 0,Nt=Vt,dr=_s,Ua;(e=>{function t(){return dr}e.value=t;function r(){return dr.length===2?dr==="en":dr.length>=3?dr[0]==="e"&&dr[1]==="n"&&dr[2]==="-":!1}e.isDefaultVariant=r;function i(){return dr==="en"}e.isDefault=i})(Ua||(Ua={}));var Vu=typeof Yt.postMessage=="function"&&!Yt.importScripts,Yu=(()=>{if(Vu){let e=[];Yt.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Yt.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),Ju=!!(Nt&&Nt.indexOf("Chrome")>=0),yv=!!(Nt&&Nt.indexOf("Firefox")>=0),Sv=!!(!Ju&&Nt&&Nt.indexOf("Safari")>=0),Cv=!!(Nt&&Nt.indexOf("Edg/")>=0),xv=!!(Nt&&Nt.indexOf("Android")>=0);function sl(e,t=0,r){let i=setTimeout(()=>{e(),r&&o.dispose()},t),o=$r(()=>{clearTimeout(i),r?.deleteAndLeak(o)});return r?.add(o),o}var Xu,An;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?An=(e,t)=>{Yu(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:An=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Xu=e=>An(globalThis,e)})();var $a;(e=>{async function t(i){let o,s=await Promise.all(i.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}e.settled=t;function r(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(n){s(n)}})}e.withAsyncBody=r})($a||($a={}));var qa=class bt{static fromArray(t){return new bt(r=>{r.emitMany(t)})}static fromPromise(t){return new bt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new bt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new bt(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Ot,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 gs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new bt(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return bt.map(this,t)}static filter(t,r){return new bt(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return bt.filter(this,t)}static coalesce(t){return bt.filter(t,r=>!!r)}coalesce(){return bt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return bt.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())}};qa.EMPTY=qa.fromArray([]);var Zu=class extends It{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ms),this._linesCacheDisposables=this._register(new ms),this._register($r(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Va(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=sl(()=>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 r=[],i=[0],o=this._terminal.buffer.active.getLine(e);for(;o;){let s=this._terminal.buffer.active.getLine(e+1),n=s?s.isWrapped:!1,a=o.translateToString(!n&&t);if(n&&s){let u=o.getCell(o.length-1);u&&u.getCode()===0&&u.getWidth()===1&&s.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(r.push(a),n)i.push(i[i.length-1]+a.length);else break;e++,o=s}return[r.join(""),i]}},Qu=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}},ef=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,r,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let o={startRow:t,startCol:r},s=this._findInLine(e,o,i);if(!s)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,i),!s);n++);return s}findNextWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=0,s=0;i&&(r===e?(o=i.end.x,s=i.end.y):(o=i.start.x,s=i.start.y)),this._lineCache.initLinesCache();let n={startRow:s,startCol:o},a=this._findInLine(e,n,t);if(!a)for(let u=s+1;u<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=u,n.startCol=0,a=this._findInLine(e,n,t),!a);u++);if(!a&&s!==0)for(let u=0;u<s&&(n.startRow=u,n.startCol=0,a=this._findInLine(e,n,t),!a);u++);return!a&&i&&(n.startRow=i.start.y,n.startCol=0,a=this._findInLine(e,n,t)),a}findPreviousWithSelection(e,t,r){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let o=this._terminal.buffer.active.baseY+this._terminal.rows-1,s=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let a={startRow:o,startCol:s},u;if(i&&(a.startRow=o=i.start.y,a.startCol=s=i.start.x,r!==e&&(u=this._findInLine(e,a,t,!1),u||(a.startRow=o=i.end.y,a.startCol=s=i.end.x))),u||(u=this._findInLine(e,a,t,n)),!u){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=o-1;l>=0&&(a.startRow=l,u=this._findInLine(e,a,t,n),!u);l--);}if(!u&&o!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=o&&(a.startRow=l,u=this._findInLine(e,a,t,n),!u);l--);return u}_isWholeWord(e,t,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+r.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+r.length]))}_findInLine(e,t,r={},i=!1){let o=t.startRow,s=t.startCol;if(this._terminal.buffer.active.getLine(o)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,r)}let n=this._lineCache.getLineFromCache(o);n||(n=this._lineCache.translateBufferLineToStringWithWrap(o,!0),this._lineCache.setLineInCache(o,n));let[a,u]=n,l=this._bufferColsToStringOffset(o,s),d=e,m=a;r.regex||(d=r.caseSensitive?e:e.toLowerCase(),m=r.caseSensitive?a:a.toLowerCase());let y=-1;if(r.regex){let _=RegExp(d,r.caseSensitive?"g":"gi"),c;if(i)for(;c=_.exec(m.slice(0,l));)y=_.lastIndex-c[0].length,e=c[0],_.lastIndex-=e.length-1;else c=_.exec(m.slice(l)),c&&c[0].length>0&&(y=l+(_.lastIndex-c[0].length),e=c[0])}else i?l-d.length>=0&&(y=m.lastIndexOf(d,l-d.length)):y=m.indexOf(d,l);if(y>=0){if(r.wholeWord&&!this._isWholeWord(y,m,e))return;let _=0;for(;_<u.length-1&&y>=u[_+1];)_++;let c=_;for(;c<u.length-1&&y+e.length>=u[c+1];)c++;let f=y-u[_],h=y+e.length-u[c],p=this._stringLengthToBufferSize(o+_,f),v=this._stringLengthToBufferSize(o+c,h)-p+this._terminal.cols*(c-_);return{term:e,col:p,row:o+_,size:v}}}_stringLengthToBufferSize(e,t){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let i=0;i<t;i++){let o=r.getCell(i);if(!o)break;let s=o.getChars();s.length>1&&(t-=s.length-1);let n=r.getCell(i+1);n&&n.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let r=e,i=0,o=this._terminal.buffer.active.getLine(r);for(;t>0&&o;){for(let s=0;s<t&&s<this._terminal.cols;s++){let n=o.getCell(s);if(!n)break;n.getWidth()&&(i+=n.getCode()===0?1:n.getChars().length)}if(r++,o=this._terminal.buffer.active.getLine(r),o&&!o.isWrapped)break;t-=this._terminal.cols}return i}},tf=class extends It{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register($r(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let r of e){let i=this._createResultDecorations(r,t,!1);if(i)for(let o of i)this._storeDecoration(o,r)}}createActiveDecoration(e,t){let r=this._createResultDecorations(e,t,!0);if(r)return{decorations:r,match:e,dispose(){Si(r)}}}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,r){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),r&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,r){let i=[],o=e.col,s=e.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;s>0;){let u=Math.min(this._terminal.cols-o,s);i.push([n,o,u]),o=0,s-=u,n++}let a=[];for(let u of i){let l=this._terminal.registerMarker(u[0]),d=this._terminal.registerDecoration({marker:l,x:u[1],width:u[2],backgroundColor:r?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:r?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(d){let m=[];m.push(l),m.push(d.onRender(y=>this._applyStyles(y,r?t.activeMatchBorder:t.matchBorder,!1))),m.push(d.onDispose(()=>Si(m))),a.push(d)}}return a.length===0?void 0:a}},rf=class extends It{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Ot)}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 r=this._searchResults[t];if(r.row===e.row&&r.col===e.col&&r.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()}},nl=class extends It{constructor(e){super(),this._highlightTimeout=this._register(new ms),this._lineCache=this._register(new ms),this._state=new Qu,this._resultTracker=this._register(new rf),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Zu(e),this._engine=new ef(e,this._lineCache.value),this._decorationManager=new tf(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register($r(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=sl(()=>{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,r){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 i=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_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 r=[],i,o=this._engine.find(e,0,0,t);for(;o&&(i?.row!==o.row||i?.col!==o.col)&&!(r.length>=this._highlightLimit);)i=o,r.push(i),o=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}findPrevious(e,t,r){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 i=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,r?.noScroll)}_selectResult(e,t,r){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 i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var sf=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=of.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,i,o)}},t))}};function nf(e){try{let t=new URL(e),r=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(r.toLocaleLowerCase())}catch{return!1}}var of=class ws{static computeLink(t,r,i,o){let s=new RegExp(r.source,(r.flags||"")+"g"),[n,a]=ws._getWindowedLineStrings(t-1,i),u=n.join(""),l,d=[];for(;l=s.exec(u);){let m=l[0];if(!nf(m))continue;let[y,_]=ws._mapStrIdx(i,a,0,l.index),[c,f]=ws._mapStrIdx(i,y,_,m.length);if(y===-1||_===-1||c===-1||f===-1)continue;let h={start:{x:_+1,y:y+1},end:{x:f,y:c+1}};d.push({range:h,text:m,activate:o})}return d}static _getWindowedLineStrings(t,r){let i,o=t,s=t,n=0,a="",u=[];if(i=r.buffer.active.getLine(t)){let l=i.translateToString(!0);if(i.isWrapped&&l[0]!==" "){for(n=0;(i=r.buffer.active.getLine(--o))&&n<2048&&(a=i.translateToString(!0),n+=a.length,u.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););u.reverse()}for(u.push(l),n=0;(i=r.buffer.active.getLine(++s))&&i.isWrapped&&n<2048&&(a=i.translateToString(!0),n+=a.length,u.push(a),a.indexOf(" ")===-1););}return[u,o]}static _mapStrIdx(t,r,i,o){let s=t.buffer.active,n=s.getNullCell(),a=i;for(;o;){let u=s.getLine(r);if(!u)return[-1,-1];for(let l=a;l<u.length;++l){u.getCell(l,n);let d=n.getChars();if(n.getWidth()&&(o-=d.length||1,l===u.length-1&&d==="")){let m=s.getLine(r+1);m&&m.isWrapped&&(m.getCell(0,n),n.getWidth()===2&&(o+=1))}if(o<0)return[r,l]}r++,a=0}return[r,a]}},af=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function lf(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var ol=class{constructor(e=lf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||af;this._linkProvider=this._terminal.registerLinkProvider(new sf(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var cf=Object.defineProperty,hf=Object.getOwnPropertyDescriptor,df=(e,t,r,i)=>{for(var o=i>1?void 0:i?hf(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&cf(t,r,o),o},uf=(e,t)=>(r,i)=>t(r,i,e),ff=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?al.isErrorNoTelemetry(e)?new al(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(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(
|
|
41
|
-
`),
|
|
42
|
-
`)).size}/${i.length} leaks) at ${y}`;let
|
|
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)}},pf=new ff;function ks(e){_f(e)||pf.onUnexpectedError(e)}var so="Canceled";function _f(e){return e instanceof mf?!0:e instanceof Error&&e.name===so&&e.message===so}var mf=class extends Error{constructor(){super(so),this.name=this.message}},al=class no extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof no)return t;let r=new no;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function gf(e,t,r=0,i=e.length){let o=r,s=i;for(;o<s;){let n=Math.floor((o+s)/2);t(e[n])?o=n+1:s=n}return o-1}var vf=class Yl{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Yl.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let r=gf(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=r+1,r===-1?void 0:this._array[r]}};vf.assertInvariants=!1;var oo;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function i(s){return s>0}e.isGreaterThan=i;function o(s){return s===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(oo||(oo={}));function bf(e,t){return(r,i)=>t(e(r),e(i))}var wf=(e,t)=>e-t,ll=class ao{constructor(t){this.iterate=t}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new ao(r=>this.iterate(i=>t(i)?r(i):!0))}map(t){return new ao(r=>this.iterate(i=>r(t(i))))}some(t){let r=!1;return this.iterate(i=>(r=t(i),!r)),r}findFirst(t){let r;return this.iterate(i=>t(i)?(r=i,!1):!0),r}findLast(t){let r;return this.iterate(i=>(t(i)&&(r=i),!0)),r}findLastMaxBy(t){let r,i=!0;return this.iterate(o=>((i||oo.isGreaterThan(t(o,r)))&&(i=!1,r=o),!0)),r}};ll.empty=new ll(e=>{});function yf(e,t){let r=Object.create(null);for(let i of e){let o=t(i),s=r[o];s||(s=r[o]=[]),s.push(i)}return r}var cl,hl,Vv=class{constructor(e,t){this.toKey=t,this._map=new Map,this[cl]="SetWithKey";for(let r of e)this.add(r)}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(r=>e.call(t,r,r,this))}[(hl=Symbol.iterator,cl=Symbol.toStringTag,hl)](){return this.values()}},Sf=class{constructor(){this.map=new Map}add(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}delete(e,t){let r=this.map.get(e);r&&(r.delete(t),r.size===0&&this.map.delete(e))}forEach(e,t){let r=this.map.get(e);r&&r.forEach(t)}get(e){return this.map.get(e)||new Set}};function Cf(e,t){let r=this,i=!1,o;return function(){if(i)return o;if(i=!0,t)try{o=e.apply(r,arguments)}finally{t()}else o=e.apply(r,arguments);return o}}var lo;(e=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(b){yield b}e.single=o;function s(b){return t(b)?b:o(b)}e.wrap=s;function n(b){return b||r}e.from=n;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function u(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=u;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let w=0;for(let E of b)if(x(E,w++))return!0;return!1}e.some=d;function m(b,x){for(let w of b)if(x(w))return w}e.find=m;function*y(b,x){for(let w of b)x(w)&&(yield w)}e.filter=y;function*_(b,x){let w=0;for(let E of b)yield x(E,w++)}e.map=_;function*c(b,x){let w=0;for(let E of b)yield*x(E,w++)}e.flatMap=c;function*f(...b){for(let x of b)yield*x}e.concat=f;function h(b,x,w){let E=w;for(let B of b)E=x(E,B);return E}e.reduce=h;function*p(b,x,w=b.length){for(x<0&&(x+=b.length),w<0?w+=b.length:w>b.length&&(w=b.length);x<w;x++)yield b[x]}e.slice=p;function v(b,x=Number.POSITIVE_INFINITY){let w=[];if(x===0)return[w,b];let E=b[Symbol.iterator]();for(let B=0;B<x;B++){let P=E.next();if(P.done)return[w,e.empty()];w.push(P.value)}return[w,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(b){let x=[];for await(let w of b)x.push(w);return Promise.resolve(x)}e.asyncToArray=S})(lo||(lo={}));var xf=!1,Xr=null,kf=class Jl{constructor(){this.livingDisposables=new Map}getDisposableData(t){let r=this.livingDisposables.get(t);return r||(r={parent:null,source:null,isSingleton:!1,value:t,idx:Jl.idx++},this.livingDisposables.set(t,r)),r}trackDisposable(t){let r=this.getDisposableData(t);r.source||(r.source=new Error().stack)}setParent(t,r){let i=this.getDisposableData(t);i.parent=r}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,r){let i=r.get(t);if(i)return i;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),r):t;return r.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,r])=>r.source!==null&&!this.getRootParent(r,t).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(t=10,r){let i;if(r)i=r;else{let u=new Map,l=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,u).isSingleton);if(l.length===0)return;let d=new Set(l.map(m=>m.value));if(i=l.filter(m=>!(m.parent&&d.has(m.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(u){function l(m,y){for(;m.length>0&&y.some(_=>typeof _=="string"?_===m[0]:m[0].match(_));)m.shift()}let d=u.source.split(`
|
|
40
|
+
`).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let s=new Sf;for(let u of i){let l=o(u);for(let d=0;d<=l.length;d++)s.add(l.slice(0,d).join(`
|
|
41
|
+
`),u)}i.sort(bf(u=>u.idx,wf));let n="",a=0;for(let u of i.slice(0,t)){a++;let l=o(u),d=[];for(let m=0;m<l.length;m++){let y=l[m];y=`(shared with ${s.get(l.slice(0,m+1).join(`
|
|
42
|
+
`)).size}/${i.length} leaks) at ${y}`;let _=s.get(l.slice(0,m).join(`
|
|
43
|
+
`)),c=yf([..._].map(f=>o(f)[m]),f=>f);delete c[l[m]];for(let[f,h]of Object.entries(c))d.unshift(` - stacktraces of ${h.length} other leaks continue with ${f}`);d.unshift(y)}n+=`
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
==================== Leaking disposable ${a}/${i.length}: ${
|
|
47
|
-
${
|
|
46
|
+
==================== Leaking disposable ${a}/${i.length}: ${u.value.constructor.name} ====================
|
|
47
|
+
${d.join(`
|
|
48
48
|
`)}
|
|
49
49
|
============================================================
|
|
50
50
|
|
|
51
|
-
`}return i.length>t&&(
|
|
51
|
+
`}return i.length>t&&(n+=`
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
... and ${i.length-t} more leaking disposables
|
|
55
55
|
|
|
56
|
-
`),{leaks:i,details:o}}};wf.idx=0;function yf(e){qr=e}if(bf){let e="__is_disposable_tracked__";yf(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==ct.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==ct.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Ms(e){return qr?.trackDisposable(e),e}function Rs(e){qr?.markAsDisposed(e)}function xi(e,t){qr?.setParent(e,t)}function Sf(e,t){if(qr)for(let r of e)qr.setParent(r,t)}function Gl(e){if(to.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Vl(...e){let t=Ye(()=>Gl(e));return Sf(e,t),t}function Ye(e){let t=Ms({dispose:vf(()=>{Rs(t),e()})});return t}var Yl=class Xl{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ms(this)}dispose(){this._isDisposed||(Rs(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Gl(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 xi(t,this),this._isDisposed?Xl.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),xi(t,null))}};Yl.DISABLE_DISPOSED_WARNING=!1;var $r=Yl,ct=class{constructor(){this._store=new $r,Ms(this),xi(this._store,this)}dispose(){Rs(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ct.None=Object.freeze({dispose(){}});var bi=class{constructor(){this._isDisposed=!1,Ms(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&xi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Rs(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&xi(e,null),e}},ho=typeof process<"u"&&"title"in process,Ei=ho?"node":navigator.userAgent,uo=ho?"node":navigator.platform,Cf=Ei.includes("Firefox"),xf=Ei.includes("Edge"),Jl=/^((?!chrome|android).)*safari/i.test(Ei);function kf(){if(!Jl)return 0;let e=Ei.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var jv=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(uo),$v=["Windows","Win16","Win32","WinCE"].includes(uo),qv=uo.indexOf("Linux")>=0,Kv=/\bCrOS\b/.test(Ei),Ef="",$e=0,qe=0,Ke=0,Fe=0,dt={css:"#00000000",rgba:0},et;(e=>{function t(n,s,o,a){return a!==void 0?`#${gr(n)}${gr(s)}${gr(o)}${gr(a)}`:`#${gr(n)}${gr(s)}${gr(o)}`}e.toCss=t;function r(n,s,o,a=255){return(n<<24|s<<16|o<<8|a)>>>0}e.toRgba=r;function i(n,s,o,a){return{css:e.toCss(n,s,o,a),rgba:e.toRgba(n,s,o,a)}}e.toColor=i})(et||(et={}));var zr;(e=>{function t(d,l){if(Fe=(l.rgba&255)/255,Fe===1)return{css:l.css,rgba:l.rgba};let _=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,p=d.rgba>>24&255,c=d.rgba>>16&255,u=d.rgba>>8&255;$e=p+Math.round((_-p)*Fe),qe=c+Math.round((m-c)*Fe),Ke=u+Math.round((y-u)*Fe);let h=et.toCss($e,qe,Ke),f=et.toRgba($e,qe,Ke);return{css:h,rgba:f}}e.blend=t;function r(d){return(d.rgba&255)===255}e.isOpaque=r;function i(d,l,_){let m=lr.ensureContrastRatio(d.rgba,l.rgba,_);if(m)return et.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=i;function n(d){let l=(d.rgba|255)>>>0;return[$e,qe,Ke]=lr.toChannels(l),{css:et.toCss($e,qe,Ke),rgba:l}}e.opaque=n;function s(d,l){return Fe=Math.round(l*255),[$e,qe,Ke]=lr.toChannels(d.rgba),{css:et.toCss($e,qe,Ke,Fe),rgba:et.toRgba($e,qe,Ke,Fe)}}e.opacity=s;function o(d,l){return Fe=d.rgba&255,s(d,Fe*l/255)}e.multiplyOpacity=o;function a(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=a})(zr||(zr={}));var al;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let s=n.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return $e=parseInt(n.slice(1,2).repeat(2),16),qe=parseInt(n.slice(2,3).repeat(2),16),Ke=parseInt(n.slice(3,4).repeat(2),16),et.toColor($e,qe,Ke);case 5:return $e=parseInt(n.slice(1,2).repeat(2),16),qe=parseInt(n.slice(2,3).repeat(2),16),Ke=parseInt(n.slice(3,4).repeat(2),16),Fe=parseInt(n.slice(4,5).repeat(2),16),et.toColor($e,qe,Ke,Fe);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let s=n.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 $e=parseInt(s[1]),qe=parseInt(s[2]),Ke=parseInt(s[3]),Fe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),et.toColor($e,qe,Ke,Fe);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[$e,qe,Ke,Fe]=t.getImageData(0,0,1,1).data,Fe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:et.toRgba($e,qe,Ke,Fe),css:n}}e.toColor=i})(al||(al={}));var Qe;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,n,s){let o=i/255,a=n/255,d=s/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return l*.2126+_*.7152+m*.0722}e.relativeLuminance2=r})(Qe||(Qe={}));var lr;(e=>{function t(o,a){if(Fe=(a&255)/255,Fe===1)return a;let d=a>>24&255,l=a>>16&255,_=a>>8&255,m=o>>24&255,y=o>>16&255,p=o>>8&255;return $e=m+Math.round((d-m)*Fe),qe=y+Math.round((l-y)*Fe),Ke=p+Math.round((_-p)*Fe),et.toRgba($e,qe,Ke)}e.blend=t;function r(o,a,d){let l=Qe.relativeLuminance(o>>8),_=Qe.relativeLuminance(a>>8);if(jt(l,_)<d){if(_<l){let p=i(o,a,d),c=jt(l,Qe.relativeLuminance(p>>8));if(c<d){let u=n(o,a,d),h=jt(l,Qe.relativeLuminance(u>>8));return c>h?p:u}return p}let m=n(o,a,d),y=jt(l,Qe.relativeLuminance(m>>8));if(y<d){let p=i(o,a,d),c=jt(l,Qe.relativeLuminance(p>>8));return y>c?m:p}return m}}e.ensureContrastRatio=r;function i(o,a,d){let l=o>>24&255,_=o>>16&255,m=o>>8&255,y=a>>24&255,p=a>>16&255,c=a>>8&255,u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));for(;u<d&&(y>0||p>0||c>0);)y-=Math.max(0,Math.ceil(y*.1)),p-=Math.max(0,Math.ceil(p*.1)),c-=Math.max(0,Math.ceil(c*.1)),u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));return(y<<24|p<<16|c<<8|255)>>>0}e.reduceLuminance=i;function n(o,a,d){let l=o>>24&255,_=o>>16&255,m=o>>8&255,y=a>>24&255,p=a>>16&255,c=a>>8&255,u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));for(;u<d&&(y<255||p<255||c<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),u=jt(Qe.relativeLuminance2(y,p,c),Qe.relativeLuminance2(l,_,m));return(y<<24|p<<16|c<<8|255)>>>0}e.increaseLuminance=n;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(lr||(lr={}));function gr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function jt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function ze(e){if(!e)throw new Error("value must not be falsy");return e}function fo(e){return 57508<=e&&e<=57558}function Lf(e){return 57520<=e&&e<=57527}function Tf(e){return 57344<=e&&e<=63743}function Mf(e){return 9472<=e&&e<=9631}function Rf(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 Af(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Rf(e)&&!fo(e)&&!Tf(e)}function Zl(e){return fo(e)||Mf(e)}function Df(){return{css:{canvas:_s(),cell:_s()},device:{canvas:_s(),cell:_s(),char:{width:0,height:0,left:0,top:0}}}}function _s(){return{width:0,height:0}}function Pf(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Ve=0,je=0,Rt=!1,$t=!1,ms=!1,st,Nn=0,Bf=class{constructor(e,t,r,i,n,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=n,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,je=0,Ve=0,$t=!1,Rt=!1,ms=!1,st=this._themeService.colors,Nn=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Nn=t*i%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(je=n.backgroundColorRGB.rgba>>8&16777215,$t=!0),n.foregroundColorRGB&&(Ve=n.foregroundColorRGB.rgba>>8&16777215,Rt=!0)}),ms=this._selectionRenderModel.isCellSelected(this._terminal,t,r),ms){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:je=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:je=(this.result.fg&16777215)<<8|255;break;default:je=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:je=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:je=(this.result.bg&16777215)<<8|255;break}je=lr.blend(je,(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else je=(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if($t=!0,st.selectionForeground&&(Ve=st.selectionForeground.rgba>>8&16777215,Rt=!0),Zl(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ve=(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ve=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ve=(this.result.fg&16777215)<<8|255;break;default:Ve=this._themeService.colors.foreground.rgba}Ve=lr.blend(Ve,(this._coreBrowserService.isFocused?st.selectionBackgroundOpaque:st.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Rt=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(je=n.backgroundColorRGB.rgba>>8&16777215,$t=!0),n.foregroundColorRGB&&(Ve=n.foregroundColorRGB.rgba>>8&16777215,Rt=!0)}),$t&&(ms?je=e.bg&-16777216&-134217729|je|50331648:je=e.bg&-16777216|je|50331648),Rt&&(Ve=e.fg&-16777216&-67108865|Ve|50331648),this.result.fg&67108864&&($t&&!Rt&&((this.result.bg&50331648)===0?Ve=this.result.fg&-134217728|st.background.rgba>>8&16777215&16777215|50331648:Ve=this.result.fg&-134217728|this.result.bg&67108863,Rt=!0),!$t&&Rt&&((this.result.fg&50331648)===0?je=this.result.bg&-67108864|st.foreground.rgba>>8&16777215&16777215|50331648:je=this.result.bg&-67108864|this.result.fg&67108863,$t=!0)),st=void 0,this.result.bg=$t?je:this.result.bg,this.result.fg=Rt?Ve:this.result.fg,this.result.ext&=536870911,this.result.ext|=Nn<<29&3758096384}},Of=.5,Ql=Cf||xf?"bottom":"ideographic",If={"\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}]},Nf={"\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]]},Hf={"\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`}},ki={"\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}};ki["\uE0BB"]=ki["\uE0BD"];ki["\uE0BF"]=ki["\uE0B9"];function Ff(e,t,r,i,n,s,o,a){let d=If[t];if(d)return Wf(e,d,r,i,n,s),!0;let l=Nf[t];if(l)return zf(e,l,r,i,n,s),!0;let _=Hf[t];if(_)return Uf(e,_,r,i,n,s,a),!0;let m=ki[t];return m?(jf(e,m,r,i,n,s,o,a),!0):!1}function Wf(e,t,r,i,n,s){for(let o=0;o<t.length;o++){let a=t[o],d=n/8,l=s/8;e.fillRect(r+a.x*d,i+a.y*l,a.w*d,a.h*l)}}var ll=new Map;function zf(e,t,r,i,n,s){let o=ll.get(t);o||(o=new Map,ll.set(t,o));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let d=o.get(a);if(!d){let l=t[0].length,_=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=l,m.height=_;let y=ze(m.getContext("2d")),p=new ImageData(l,_),c,u,h,f;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),u=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),f=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,u,h,f]=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 S=0;S<l;S++)p.data[(v*l+S)*4]=c,p.data[(v*l+S)*4+1]=u,p.data[(v*l+S)*4+2]=h,p.data[(v*l+S)*4+3]=t[v][S]*(f*255);y.putImageData(p,0,0),d=ze(e.createPattern(m,null)),o.set(a,d)}e.fillStyle=d,e.fillRect(r,i,n,s)}function Uf(e,t,r,i,n,s,o){e.strokeStyle=e.fillStyle;for(let[a,d]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(a);let l;if(typeof d=="function"){let _=.15/s*n;l=d(.15,_)}else l=d;for(let _ of l.split(" ")){let m=_[0],y=ec[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||y(e,tc(p,n,s,r,i,!0,o))}e.stroke(),e.closePath()}}function jf(e,t,r,i,n,s,o,a){let d=new Path2D;d.rect(r,i,n,s),e.clip(d),e.beginPath();let l=o/12;e.lineWidth=a*l;for(let _ of t.d.split(" ")){let m=_[0],y=ec[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let p=_.substring(1).split(",");!p[0]||!p[1]||y(e,tc(p,n,s,r,i,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function cl(e,t,r=0){return Math.max(Math.min(e,t),r)}var ec={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 tc(e,t,r,i,n,s,o,a=0,d=0){let l=e.map(_=>parseFloat(_)||parseInt(_));if(l.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<l.length;_+=2)l[_]*=t-a*o-d*o,s&&l[_]!==0&&(l[_]=cl(Math.round(l[_]+.5)-.5,t,0)),l[_]+=i+a*o;for(let _=1;_<l.length;_+=2)l[_]*=r,s&&l[_]!==0&&(l[_]=cl(Math.round(l[_]+.5)-.5,r,0)),l[_]+=n;return l}var hl=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},dl=class{constructor(){this._data=new hl}set(e,t,r,i,n){this._data.get(e,t)||this._data.set(e,t,new hl),this._data.get(e,t).set(r,i,n)}get(e,t,r,i){return this._data.get(e,t)?.get(r,i)}clear(){this._data.clear()}},rc=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,r=0,i=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=n}this.clear()}},$f=class extends rc{_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())}}},qf=class extends rc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Kf=!ho&&"requestIdleCallback"in window?qf:$f,Ur=class ic{constructor(){this.fg=0,this.bg=0,this.extended=new sc}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 ic;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}},sc=class nc{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}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 nc(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ul=class ro{constructor(t){this.element=t,this.next=ro.Undefined,this.prev=ro.Undefined}};ul.Undefined=new ul(void 0);var Gf=globalThis.performance&&typeof globalThis.performance.now=="function",Vf=class oc{static create(t){return new oc(t)}constructor(t){this._now=Gf&&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}},Yf=!1,fl=!1,Xf=!1,At;(e=>{e.None=()=>ct.None;function t(B){if(Xf){let{onDidAddListener:R}=B,z=no.create(),I=0;B.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),z.print()),R?.()}}}function r(B,R){return y(B,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(B){return(R,z=null,I)=>{let C=!1,L;return L=B(T=>{if(!C)return L?L.dispose():C=!0,R.call(z,T)},null,I),C&&L.dispose(),L}}e.once=i;function n(B,R,z){return _((I,C=null,L)=>B(T=>I.call(C,R(T)),null,L),z)}e.map=n;function s(B,R,z){return _((I,C=null,L)=>B(T=>{R(T),I.call(C,T)},null,L),z)}e.forEach=s;function o(B,R,z){return _((I,C=null,L)=>B(T=>R(T)&&I.call(C,T),null,L),z)}e.filter=o;function a(B){return B}e.signal=a;function d(...B){return(R,z=null,I)=>{let C=Vl(...B.map(L=>L(T=>R.call(z,T))));return m(C,I)}}e.any=d;function l(B,R,z,I){let C=z;return n(B,L=>(C=R(C,L),C),I)}e.reduce=l;function _(B,R){let z,I={onWillAddFirstListener(){z=B(C.fire,C)},onDidRemoveLastListener(){z?.dispose()}};R||t(I);let C=new Me(I);return R?.add(C),C.event}function m(B,R){return R instanceof Array?R.push(B):R&&R.add(B),B}function y(B,R,z=100,I=!1,C=!1,L,T){let D,N,G,j=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=B(W=>{j++,N=R(N,W),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||j>1)&&k.fire(q),j=0},typeof z=="number"?(clearTimeout(G),G=setTimeout(Y,z)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&j>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Me(H);return T?.add(k),k.event}e.debounce=y;function p(B,R=0,z){return e.debounce(B,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,z)}e.accumulate=p;function c(B,R=(I,C)=>I===C,z){let I=!0,C;return o(B,L=>{let T=I||!R(L,C);return I=!1,C=L,T},z)}e.latch=c;function u(B,R,z){return[e.filter(B,R,z),e.filter(B,I=>!R(I),z)]}e.split=u;function h(B,R=!1,z=[],I){let C=z.slice(),L=B(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Me({onWillAddFirstListener(){L||(L=B(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function f(B,R){return(z,I,C)=>{let L=R(new S);return B(function(T){let D=L.evaluate(T);D!==v&&z.call(I,D)},void 0,C)}}e.chain=f;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(z=>(R(z),z)),this}filter(R){return this.steps.push(z=>R(z)?z:v),this}reduce(R,z){let I=z;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(z,I)=>z===I){let z=!0,I;return this.steps.push(C=>{let L=z||!R(C,I);return z=!1,I=C,L?C:v}),this}evaluate(R){for(let z of this.steps)if(R=z(R),R===v)break;return R}}function g(B,R,z=I=>I){let I=(...D)=>T.fire(z(...D)),C=()=>B.on(R,I),L=()=>B.removeListener(R,I),T=new Me({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=g;function x(B,R,z=I=>I){let I=(...D)=>T.fire(z(...D)),C=()=>B.addEventListener(R,I),L=()=>B.removeEventListener(R,I),T=new Me({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(B){return new Promise(R=>i(B)(R))}e.toPromise=w;function E(B){let R=new Me;return B.then(z=>{R.fire(z)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function P(B,R){return B(z=>R.fire(z))}e.forward=P;function O(B,R,z){return R(z),B(I=>R(I))}e.runAndSubscribe=O;class F{constructor(R,z){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};z||t(I),this.emitter=new Me(I),z&&z.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,z){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(B,R){return new F(B,R).emitter.event}e.fromObservable=A;function V(B){return(R,z,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(B.reportChanges(),L&&(L=!1,R.call(z)))},handlePossibleChange(){},handleChange(){L=!0}};B.addObserver(T),B.reportChanges();let D={dispose(){B.removeObserver(T)}};return I instanceof $r?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(At||(At={}));var io=class so{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${so._idPool++}`,so.all.add(this)}start(t){this._stopWatch=new Vf,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}}};io.all=new Set,io._idPool=0;var Jf=io,pl=-1,ac=class lc{constructor(t,r,i=(lc._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let d=new Qf(a,s);this._errorHandler(d)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};ac._idPool=1;var Zf=ac,no=class cc{constructor(t){this.value=t}static create(){let t=new Error;return new cc(t.stack??"")}print(){console.warn(this.value.split(`
|
|
56
|
+
`),{leaks:i,details:n}}};kf.idx=0;function Ef(e){Xr=e}if(xf){let e="__is_disposable_tracked__";Ef(new class{trackDisposable(t){let r=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(r)},3e3)}setParent(t,r){if(t&&t!==vt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==vt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Os(e){return Xr?.trackDisposable(e),e}function Is(e){Xr?.markAsDisposed(e)}function Mi(e,t){Xr?.setParent(e,t)}function Lf(e,t){if(Xr)for(let r of e)Xr.setParent(r,t)}function Xl(e){if(lo.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}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 Zl(...e){let t=tt(()=>Xl(e));return Lf(e,t),t}function tt(e){let t=Os({dispose:Cf(()=>{Is(t),e()})});return t}var Ql=class ec{constructor(){this._toDispose=new Set,this._isDisposed=!1,Os(this)}dispose(){this._isDisposed||(Is(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Xl(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 Mi(t,this),this._isDisposed?ec.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),Mi(t,null))}};Ql.DISABLE_DISPOSED_WARNING=!1;var Jr=Ql,vt=class{constructor(){this._store=new Jr,Os(this),Mi(this._store,this)}dispose(){Is(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};vt.None=Object.freeze({dispose(){}});var xi=class{constructor(){this._isDisposed=!1,Os(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Mi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Is(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Mi(e,null),e}},vo=typeof process<"u"&&"title"in process,Ai=vo?"node":navigator.userAgent,bo=vo?"node":navigator.platform,Tf=Ai.includes("Firefox"),Mf=Ai.includes("Edge"),tc=/^((?!chrome|android).)*safari/i.test(Ai);function Rf(){if(!tc)return 0;let e=Ai.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Yv=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(bo),Jv=["Windows","Win16","Win32","WinCE"].includes(bo),Xv=bo.indexOf("Linux")>=0,Zv=/\bCrOS\b/.test(Ai),Af="",Ve=0,Ye=0,Je=0,$e=0,wt={css:"#00000000",rgba:0},lt;(e=>{function t(o,s,n,a){return a!==void 0?`#${Cr(o)}${Cr(s)}${Cr(n)}${Cr(a)}`:`#${Cr(o)}${Cr(s)}${Cr(n)}`}e.toCss=t;function r(o,s,n,a=255){return(o<<24|s<<16|n<<8|a)>>>0}e.toRgba=r;function i(o,s,n,a){return{css:e.toCss(o,s,n,a),rgba:e.toRgba(o,s,n,a)}}e.toColor=i})(lt||(lt={}));var Gr;(e=>{function t(u,l){if($e=(l.rgba&255)/255,$e===1)return{css:l.css,rgba:l.rgba};let d=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,_=u.rgba>>24&255,c=u.rgba>>16&255,f=u.rgba>>8&255;Ve=_+Math.round((d-_)*$e),Ye=c+Math.round((m-c)*$e),Je=f+Math.round((y-f)*$e);let h=lt.toCss(Ve,Ye,Je),p=lt.toRgba(Ve,Ye,Je);return{css:h,rgba:p}}e.blend=t;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,l,d){let m=mr.ensureContrastRatio(u.rgba,l.rgba,d);if(m)return lt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=i;function o(u){let l=(u.rgba|255)>>>0;return[Ve,Ye,Je]=mr.toChannels(l),{css:lt.toCss(Ve,Ye,Je),rgba:l}}e.opaque=o;function s(u,l){return $e=Math.round(l*255),[Ve,Ye,Je]=mr.toChannels(u.rgba),{css:lt.toCss(Ve,Ye,Je,$e),rgba:lt.toRgba(Ve,Ye,Je,$e)}}e.opacity=s;function n(u,l){return $e=u.rgba&255,s(u,$e*l/255)}e.multiplyOpacity=n;function a(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=a})(Gr||(Gr={}));var dl;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let s=o.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Ve=parseInt(o.slice(1,2).repeat(2),16),Ye=parseInt(o.slice(2,3).repeat(2),16),Je=parseInt(o.slice(3,4).repeat(2),16),lt.toColor(Ve,Ye,Je);case 5:return Ve=parseInt(o.slice(1,2).repeat(2),16),Ye=parseInt(o.slice(2,3).repeat(2),16),Je=parseInt(o.slice(3,4).repeat(2),16),$e=parseInt(o.slice(4,5).repeat(2),16),lt.toColor(Ve,Ye,Je,$e);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let s=o.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 Ve=parseInt(s[1]),Ye=parseInt(s[2]),Je=parseInt(s[3]),$e=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),lt.toColor(Ve,Ye,Je,$e);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ve,Ye,Je,$e]=t.getImageData(0,0,1,1).data,$e!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lt.toRgba(Ve,Ye,Je,$e),css:o}}e.toColor=i})(dl||(dl={}));var at;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,o,s){let n=i/255,a=o/255,u=s/255,l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),m=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return l*.2126+d*.7152+m*.0722}e.relativeLuminance2=r})(at||(at={}));var mr;(e=>{function t(n,a){if($e=(a&255)/255,$e===1)return a;let u=a>>24&255,l=a>>16&255,d=a>>8&255,m=n>>24&255,y=n>>16&255,_=n>>8&255;return Ve=m+Math.round((u-m)*$e),Ye=y+Math.round((l-y)*$e),Je=_+Math.round((d-_)*$e),lt.toRgba(Ve,Ye,Je)}e.blend=t;function r(n,a,u){let l=at.relativeLuminance(n>>8),d=at.relativeLuminance(a>>8);if(Jt(l,d)<u){if(d<l){let _=i(n,a,u),c=Jt(l,at.relativeLuminance(_>>8));if(c<u){let f=o(n,a,u),h=Jt(l,at.relativeLuminance(f>>8));return c>h?_:f}return _}let m=o(n,a,u),y=Jt(l,at.relativeLuminance(m>>8));if(y<u){let _=i(n,a,u),c=Jt(l,at.relativeLuminance(_>>8));return y>c?m:_}return m}}e.ensureContrastRatio=r;function i(n,a,u){let l=n>>24&255,d=n>>16&255,m=n>>8&255,y=a>>24&255,_=a>>16&255,c=a>>8&255,f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));for(;f<u&&(y>0||_>0||c>0);)y-=Math.max(0,Math.ceil(y*.1)),_-=Math.max(0,Math.ceil(_*.1)),c-=Math.max(0,Math.ceil(c*.1)),f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));return(y<<24|_<<16|c<<8|255)>>>0}e.reduceLuminance=i;function o(n,a,u){let l=n>>24&255,d=n>>16&255,m=n>>8&255,y=a>>24&255,_=a>>16&255,c=a>>8&255,f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));for(;f<u&&(y<255||_<255||c<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),f=Jt(at.relativeLuminance2(y,_,c),at.relativeLuminance2(l,d,m));return(y<<24|_<<16|c<<8|255)>>>0}e.increaseLuminance=o;function s(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=s})(mr||(mr={}));function Cr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Jt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ke(e){if(!e)throw new Error("value must not be falsy");return e}function wo(e){return 57508<=e&&e<=57558}function Df(e){return 57520<=e&&e<=57527}function Pf(e){return 57344<=e&&e<=63743}function Bf(e){return 9472<=e&&e<=9631}function Of(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 If(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Of(e)&&!wo(e)&&!Pf(e)}function rc(e){return wo(e)||Bf(e)}function Nf(){return{css:{canvas:ys(),cell:ys()},device:{canvas:ys(),cell:ys(),char:{width:0,height:0,left:0,top:0}}}}function ys(){return{width:0,height:0}}function Hf(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var et=0,Ge=0,Ht=!1,Xt=!1,Ss=!1,ft,$n=0,Ff=class{constructor(e,t,r,i,o,s){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=o,this._themeService=s,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Ge=0,et=0,Xt=!1,Ht=!1,Ss=!1,ft=this._themeService.colors,$n=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));$n=t*i%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",o=>{o.backgroundColorRGB&&(Ge=o.backgroundColorRGB.rgba>>8&16777215,Xt=!0),o.foregroundColorRGB&&(et=o.foregroundColorRGB.rgba>>8&16777215,Ht=!0)}),Ss=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Ss){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ge=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ge=(this.result.fg&16777215)<<8|255;break;default:Ge=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ge=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ge=(this.result.bg&16777215)<<8|255;break}Ge=mr.blend(Ge,(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ge=(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Xt=!0,ft.selectionForeground&&(et=ft.selectionForeground.rgba>>8&16777215,Ht=!0),rc(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)et=(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:et=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:et=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:et=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:et=(this.result.fg&16777215)<<8|255;break;default:et=this._themeService.colors.foreground.rgba}et=mr.blend(et,(this._coreBrowserService.isFocused?ft.selectionBackgroundOpaque:ft.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Ht=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",o=>{o.backgroundColorRGB&&(Ge=o.backgroundColorRGB.rgba>>8&16777215,Xt=!0),o.foregroundColorRGB&&(et=o.foregroundColorRGB.rgba>>8&16777215,Ht=!0)}),Xt&&(Ss?Ge=e.bg&-16777216&-134217729|Ge|50331648:Ge=e.bg&-16777216|Ge|50331648),Ht&&(et=e.fg&-16777216&-67108865|et|50331648),this.result.fg&67108864&&(Xt&&!Ht&&((this.result.bg&50331648)===0?et=this.result.fg&-134217728|ft.background.rgba>>8&16777215&16777215|50331648:et=this.result.fg&-134217728|this.result.bg&67108863,Ht=!0),!Xt&&Ht&&((this.result.fg&50331648)===0?Ge=this.result.bg&-67108864|ft.foreground.rgba>>8&16777215&16777215|50331648:Ge=this.result.bg&-67108864|this.result.fg&67108863,Xt=!0)),ft=void 0,this.result.bg=Xt?Ge:this.result.bg,this.result.fg=Ht?et:this.result.fg,this.result.ext&=536870911,this.result.ext|=$n<<29&3758096384}},Wf=.5,ic=Tf||Mf?"bottom":"ideographic",jf={"\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}]},zf={"\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]]},Uf={"\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`}},Ri={"\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}};Ri["\uE0BB"]=Ri["\uE0BD"];Ri["\uE0BF"]=Ri["\uE0B9"];function $f(e,t,r,i,o,s,n,a){let u=jf[t];if(u)return qf(e,u,r,i,o,s),!0;let l=zf[t];if(l)return Kf(e,l,r,i,o,s),!0;let d=Uf[t];if(d)return Gf(e,d,r,i,o,s,a),!0;let m=Ri[t];return m?(Vf(e,m,r,i,o,s,n,a),!0):!1}function qf(e,t,r,i,o,s){for(let n=0;n<t.length;n++){let a=t[n],u=o/8,l=s/8;e.fillRect(r+a.x*u,i+a.y*l,a.w*u,a.h*l)}}var ul=new Map;function Kf(e,t,r,i,o,s){let n=ul.get(t);n||(n=new Map,ul.set(t,n));let a=e.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let u=n.get(a);if(!u){let l=t[0].length,d=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=l,m.height=d;let y=Ke(m.getContext("2d")),_=new ImageData(l,d),c,f,h,p;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),f=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),p=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,f,h,p]=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<d;v++)for(let S=0;S<l;S++)_.data[(v*l+S)*4]=c,_.data[(v*l+S)*4+1]=f,_.data[(v*l+S)*4+2]=h,_.data[(v*l+S)*4+3]=t[v][S]*(p*255);y.putImageData(_,0,0),u=Ke(e.createPattern(m,null)),n.set(a,u)}e.fillStyle=u,e.fillRect(r,i,o,s)}function Gf(e,t,r,i,o,s,n){e.strokeStyle=e.fillStyle;for(let[a,u]of Object.entries(t)){e.beginPath(),e.lineWidth=n*Number.parseInt(a);let l;if(typeof u=="function"){let d=.15/s*o;l=u(.15,d)}else l=u;for(let d of l.split(" ")){let m=d[0],y=sc[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||y(e,nc(_,o,s,r,i,!0,n))}e.stroke(),e.closePath()}}function Vf(e,t,r,i,o,s,n,a){let u=new Path2D;u.rect(r,i,o,s),e.clip(u),e.beginPath();let l=n/12;e.lineWidth=a*l;for(let d of t.d.split(" ")){let m=d[0],y=sc[m];if(!y){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||y(e,nc(_,o,s,r,i,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function fl(e,t,r=0){return Math.max(Math.min(e,t),r)}var sc={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 nc(e,t,r,i,o,s,n,a=0,u=0){let l=e.map(d=>parseFloat(d)||parseInt(d));if(l.length<2)throw new Error("Too few arguments for instruction");for(let d=0;d<l.length;d+=2)l[d]*=t-a*n-u*n,s&&l[d]!==0&&(l[d]=fl(Math.round(l[d]+.5)-.5,t,0)),l[d]+=i+a*n;for(let d=1;d<l.length;d+=2)l[d]*=r,s&&l[d]!==0&&(l[d]=fl(Math.round(l[d]+.5)-.5,r,0)),l[d]+=o;return l}var pl=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},_l=class{constructor(){this._data=new pl}set(e,t,r,i,o){this._data.get(e,t)||this._data.set(e,t,new pl),this._data.get(e,t).set(r,i,o)}get(e,t,r,i){return this._data.get(e,t)?.get(r,i)}clear(){this._data.clear()}},oc=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,r=0,i=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=o}this.clear()}},Yf=class extends oc{_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())}}},Jf=class extends oc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Xf=!vo&&"requestIdleCallback"in window?Jf:Yf,Vr=class ac{constructor(){this.fg=0,this.bg=0,this.extended=new lc}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 ac;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}},lc=class cc{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}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 cc(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ml=class co{constructor(t){this.element=t,this.next=co.Undefined,this.prev=co.Undefined}};ml.Undefined=new ml(void 0);var Zf=globalThis.performance&&typeof globalThis.performance.now=="function",Qf=class hc{static create(t){return new hc(t)}constructor(t){this._now=Zf&&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}},ep=!1,gl=!1,tp=!1,Ft;(e=>{e.None=()=>vt.None;function t(O){if(tp){let{onDidAddListener:R}=O,F=fo.create(),I=0;O.onDidAddListener=()=>{++I===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),F.print()),R?.()}}}function r(O,R){return y(O,()=>{},0,void 0,!0,void 0,R)}e.defer=r;function i(O){return(R,F=null,I)=>{let C=!1,L;return L=O(T=>{if(!C)return L?L.dispose():C=!0,R.call(F,T)},null,I),C&&L.dispose(),L}}e.once=i;function o(O,R,F){return d((I,C=null,L)=>O(T=>I.call(C,R(T)),null,L),F)}e.map=o;function s(O,R,F){return d((I,C=null,L)=>O(T=>{R(T),I.call(C,T)},null,L),F)}e.forEach=s;function n(O,R,F){return d((I,C=null,L)=>O(T=>R(T)&&I.call(C,T),null,L),F)}e.filter=n;function a(O){return O}e.signal=a;function u(...O){return(R,F=null,I)=>{let C=Zl(...O.map(L=>L(T=>R.call(F,T))));return m(C,I)}}e.any=u;function l(O,R,F,I){let C=F;return o(O,L=>(C=R(C,L),C),I)}e.reduce=l;function d(O,R){let F,I={onWillAddFirstListener(){F=O(C.fire,C)},onDidRemoveLastListener(){F?.dispose()}};R||t(I);let C=new Pe(I);return R?.add(C),C.event}function m(O,R){return R instanceof Array?R.push(O):R&&R.add(O),O}function y(O,R,F=100,I=!1,C=!1,L,T){let D,N,G,$=0,Y,H={leakWarningThreshold:L,onWillAddFirstListener(){D=O(j=>{$++,N=R(N,j),I&&!G&&(k.fire(N),N=void 0),Y=()=>{let q=N;N=void 0,G=void 0,(!I||$>1)&&k.fire(q),$=0},typeof F=="number"?(clearTimeout(G),G=setTimeout(Y,F)):G===void 0&&(G=0,queueMicrotask(Y))})},onWillRemoveListener(){C&&$>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,D.dispose()}};T||t(H);let k=new Pe(H);return T?.add(k),k.event}e.debounce=y;function _(O,R=0,F){return e.debounce(O,(I,C)=>I?(I.push(C),I):[C],R,void 0,!0,void 0,F)}e.accumulate=_;function c(O,R=(I,C)=>I===C,F){let I=!0,C;return n(O,L=>{let T=I||!R(L,C);return I=!1,C=L,T},F)}e.latch=c;function f(O,R,F){return[e.filter(O,R,F),e.filter(O,I=>!R(I),F)]}e.split=f;function h(O,R=!1,F=[],I){let C=F.slice(),L=O(N=>{C?C.push(N):D.fire(N)});I&&I.add(L);let T=()=>{C?.forEach(N=>D.fire(N)),C=null},D=new Pe({onWillAddFirstListener(){L||(L=O(N=>D.fire(N)),I&&I.add(L))},onDidAddFirstListener(){C&&(R?setTimeout(T):T())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return I&&I.add(D),D.event}e.buffer=h;function p(O,R){return(F,I,C)=>{let L=R(new S);return O(function(T){let D=L.evaluate(T);D!==v&&F.call(I,D)},void 0,C)}}e.chain=p;let v=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(F=>(R(F),F)),this}filter(R){return this.steps.push(F=>R(F)?F:v),this}reduce(R,F){let I=F;return this.steps.push(C=>(I=R(I,C),I)),this}latch(R=(F,I)=>F===I){let F=!0,I;return this.steps.push(C=>{let L=F||!R(C,I);return F=!1,I=C,L?C:v}),this}evaluate(R){for(let F of this.steps)if(R=F(R),R===v)break;return R}}function b(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.on(R,I),L=()=>O.removeListener(R,I),T=new Pe({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromNodeEventEmitter=b;function x(O,R,F=I=>I){let I=(...D)=>T.fire(F(...D)),C=()=>O.addEventListener(R,I),L=()=>O.removeEventListener(R,I),T=new Pe({onWillAddFirstListener:C,onDidRemoveLastListener:L});return T.event}e.fromDOMEventEmitter=x;function w(O){return new Promise(R=>i(O)(R))}e.toPromise=w;function E(O){let R=new Pe;return O.then(F=>{R.fire(F)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=E;function B(O,R){return O(F=>R.fire(F))}e.forward=B;function P(O,R,F){return R(F),O(I=>R(I))}e.runAndSubscribe=P;class W{constructor(R,F){this._observable=R,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};F||t(I),this.emitter=new Pe(I),F&&F.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,F){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(O,R){return new W(O,R).emitter.event}e.fromObservable=A;function V(O){return(R,F,I)=>{let C=0,L=!1,T={beginUpdate(){C++},endUpdate(){C--,C===0&&(O.reportChanges(),L&&(L=!1,R.call(F)))},handlePossibleChange(){},handleChange(){L=!0}};O.addObserver(T),O.reportChanges();let D={dispose(){O.removeObserver(T)}};return I instanceof Jr?I.add(D):Array.isArray(I)&&I.push(D),D}}e.fromObservableLight=V})(Ft||(Ft={}));var ho=class uo{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${uo._idPool++}`,uo.all.add(this)}start(t){this._stopWatch=new Qf,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}}};ho.all=new Set,ho._idPool=0;var rp=ho,vl=-1,dc=class uc{constructor(t,r,i=(uc._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[s,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(s);let u=new sp(a,s);this._errorHandler(u)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};dc._idPool=1;var ip=dc,fo=class fc{constructor(t){this.value=t}static create(){let t=new Error;return new fc(t.stack??"")}print(){console.warn(this.value.split(`
|
|
57
57
|
`).slice(2).join(`
|
|
58
|
-
`))}},
|
|
59
|
-
`)),e.length=0)},3e3),
|
|
58
|
+
`))}},sp=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},np=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},op=0,Es=class{constructor(e){this.value=e,this.id=op++}},ap=2,lp=(e,t)=>{if(e instanceof Es)t(e);else for(let r=0;r<e.length;r++){let i=e[r];i&&t(i)}},Ls;if(ep){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),Ls=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}var Pe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=vl>0||this._options?.leakWarningThreshold?new ip(e?.onListenerError??ks,this._options?.leakWarningThreshold??vl):void 0,this._perfMon=this._options?._profName?new rp(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(gl){let e=this._listeners;queueMicrotask(()=>{lp(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,r)=>{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 u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new np(`${a}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||ks)(l),vt.None}if(this._disposed)return vt.None;t&&(e=e.bind(t));let i=new Es(e),o,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=fo.create(),o=this._leakageMon.check(i.stack,this._size+1)),gl&&(i.stack=s??fo.create()),this._listeners?this._listeners instanceof Es?(this._deliveryQueue??(this._deliveryQueue=new cp),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=tt(()=>{Ls?.unregister(n),o?.(),this._removeListener(i)});if(r instanceof Jr?r.add(n):Array.isArray(r)&&r.push(n),Ls){let a=new Error().stack.split(`
|
|
60
60
|
`).slice(2,3).join(`
|
|
61
|
-
`).trim(),d=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);ys.register(o,d?.[2]??a,o)}return o}),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,r=t.indexOf(e);if(r===-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[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*rp<=t.length){let n=0;for(let s=0;s<t.length;s++)t[s]?t[n++]=t[s]:i&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=n}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||bs;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 ws)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}},sp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},_l={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}},wi=2,yi,or=class Wr{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new dl,this._cacheMapCombined=new dl,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ur,this._textureSize=512,this._onAddTextureAtlasCanvas=new Me,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Me,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=hc(t,this._config.deviceCellWidth*4+wi*2,this._config.deviceCellHeight+wi*2),this._tmpCtx=ze(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 Kf;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}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(Wr.maxAtlasPages&&this._pages.length>=Math.max(4,Wr.maxAtlasPages)){let r=this._pages.filter(l=>l.canvas.width*2<=(Wr.maxTextureSize||4096)).sort((l,_)=>_.canvas.width!==l.canvas.width?_.canvas.width-l.canvas.width:_.percentageUsed-l.percentageUsed),i=-1,n=0;for(let l=0;l<r.length;l++)if(r[l].canvas.width!==n)i=l,n=r[l].canvas.width;else if(l-i===3)break;let s=r.slice(i,i+4),o=s.map(l=>l.glyphs[0].texturePage).sort((l,_)=>l>_?1:-1),a=this.pages.length-s.length,d=this._mergePages(s,a);d.version++;for(let l=o.length-1;l>=0;l--)this._deletePage(o[l]);this.pages.push(d),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(d.canvas)}let t=new Hn(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,n=new Hn(this._document,i,t);for(let[s,o]of t.entries()){let a=s*o.canvas.width%i,d=Math.floor(s/2)*o.canvas.height;n.ctx.drawImage(o.canvas,a,d);for(let _ of o.glyphs)_.texturePage=r,_.sizeClipSpace.x=_.size.x/i,_.sizeClipSpace.y=_.size.y/i,_.texturePosition.x+=a,_.texturePosition.y+=d,_.texturePositionClipSpace.x=_.texturePosition.x/i,_.texturePositionClipSpace.y=_.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let l=this._activePages.indexOf(o);l!==-1&&this._activePages.splice(l,1)}return n}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let n of i.glyphs)n.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,n,s,o){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,n,s,o)}getRasterizedGlyph(t,r,i,n,s,o){return this._getFromCacheMap(this._cacheMap,t,r,i,n,s,o)}_getFromCacheMap(t,r,i,n,s,o,a){return yi=t.get(r,i,n,s),yi||(yi=this._drawToCache(r,i,n,s,o,a),t.set(r,i,n,s,yi)),yi}_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,r,i,n){if(this._config.allowTransparency)return dt;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(r);break;case 50331648:let o=Ur.toColorRGB(r);s=et.toColor(o[0],o[1],o[2]);break;default:i?s=zr.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=zr.opaque(s)),s}_getForegroundColor(t,r,i,n,s,o,a,d,l,_){let m=this._getMinimumContrastColor(t,r,i,n,s,o,a,l,d,_);if(m)return m;let y;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&o<8&&(o+=8),y=this._getColorFromAnsiIndex(o);break;case 50331648:let p=Ur.toColorRGB(o);y=et.toColor(p[0],p[1],p[2]);break;default:a?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=zr.opaque(y)),d&&(y=zr.multiplyOpacity(y,Of)),y}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,n){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,n,s,o,a,d,l,_){if(this._config.minimumContrastRatio===1||_)return;let m=this._getContrastCache(l),y=m.getColor(t,n);if(y!==void 0)return y||void 0;let p=this._resolveBackgroundRgba(r,i,a),c=this._resolveForegroundRgba(s,o,a,d),u=lr.ensureContrastRatio(p,c,this._config.minimumContrastRatio/(l?2:1));if(!u){m.setColor(t,n,null);return}let h=et.toColor(u>>24&255,u>>16&255,u>>8&255);return m.setColor(t,n,h),h}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,n,s,o){let a=typeof t=="number"?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let d=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+wi*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<d&&(this._tmpCanvas.width=d);let l=Math.min(this._config.deviceCellHeight+wi*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=n,!!this._workAttributeData.isInvisible())return _l;let _=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),u=!!this._workAttributeData.isStrikethrough(),h=!!this._workAttributeData.isOverline(),f=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),g=this._workAttributeData.getBgColorMode();if(m){let D=f;f=S,S=D;let N=v;v=g,g=N}let x=this._getBackgroundColor(g,S,m,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let w=_?this._config.fontWeightBold:this._config.fontWeight,E=p?"italic":"";this._tmpCtx.font=`${E} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ql;let P=a.length===1&&fo(a.charCodeAt(0)),O=a.length===1&&Lf(a.charCodeAt(0)),F=this._getForegroundColor(r,g,S,i,v,f,m,y,_,Zl(a.charCodeAt(0)));this._tmpCtx.fillStyle=F.css;let A=O?0:wi*2,V=!1;this._config.customGlyphs!==!1&&(V=Ff(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!P,R;if(typeof t=="number"?R=this._unicodeService.wcwidth(t):R=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${Ur.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let W=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&W<8&&(W+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(W).css}this._tmpCtx.beginPath();let G=A,j=Math.ceil(A+this._config.deviceCharHeight)-N-(s?D*2:0),Y=j+D,H=j+D*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let W=0;W<R;W++){this._tmpCtx.save();let q=G+W*this._config.deviceCellWidth,$=G+(W+1)*this._config.deviceCellWidth,X=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo($,j),this._tmpCtx.moveTo(q,H),this._tmpCtx.lineTo($,H);break;case 3:let J=D<=1?H:Math.ceil(A+this._config.deviceCharHeight-D/2)-N,ce=D<=1?j:Math.ceil(A+this._config.deviceCharHeight+D/2)-N,de=new Path2D;de.rect(q,j,this._config.deviceCellWidth,H-j),this._tmpCtx.clip(de),this._tmpCtx.moveTo(q-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(q-this._config.deviceCellWidth/2,ce,q,ce,q,Y),this._tmpCtx.bezierCurveTo(q,J,X,J,X,Y),this._tmpCtx.bezierCurveTo(X,ce,$,ce,$,Y),this._tmpCtx.bezierCurveTo($,J,$+this._config.deviceCellWidth/2,J,$+this._config.deviceCellWidth/2,Y);break;case 4:let me=k===0?0:k>=D?D*2-k:D-k;k>=D||me===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+me,j),this._tmpCtx.lineTo($,j)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo(q+me,j),this._tmpCtx.moveTo(q+me+D,j),this._tmpCtx.lineTo($,j)),k=Pf($-q,D,k);break;case 5:let te=.6,Be=.3,fe=$-q,Oe=Math.floor(te*fe),We=Math.floor(Be*fe),ke=fe-Oe-We;this._tmpCtx.setLineDash([Oe,We,ke]),this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo($,j);break;default:this._tmpCtx.moveTo(q,j),this._tmpCtx.lineTo($,j);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!V&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let W=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in W&&W.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(G,j-Math.ceil(D/2),this._config.deviceCellWidth*R,H-j+Math.ceil(D/2)),this._tmpCtx.clip(q),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(h){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+N),this._tmpCtx.stroke()}if(V||this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=Fn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,F,B);if(D)for(let N=1;N<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight-N),D=Fn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,F,B),!!D);N++);}if(u){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),N=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.stroke()}this._tmpCtx.restore();let z=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(this._config.allowTransparency?I=np(z):I=Fn(z,x,F,B),I)return _l;let C=this._findGlyphBoundingBox(z,this._workBoundingBox,d,O,V,A),L,T;for(;;){if(this._activePages.length===0){let D=this._createNewPage();L=D,T=D.currentRow,T.height=C.size.y;break}L=this._activePages[this._activePages.length-1],T=L.currentRow;for(let D of this._activePages)C.size.y<=D.currentRow.height&&(L=D,T=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let N of this._activePages[D].fixedRows)N.height<=T.height&&C.size.y<=N.height&&(L=this._activePages[D],T=N);if(C.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Hn(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,T=this._overflowSizePage.currentRow,T.x+C.size.x>=L.canvas.width&&(T.x=0,T.y+=T.height,T.height=0);break}if(T.y+C.size.y>=L.canvas.height||T.height>C.size.y+2){let D=!1;if(L.currentRow.y+L.currentRow.height+C.size.y>=L.canvas.height){let N;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+C.size.y<G.canvas.height){N=G;break}if(N)L=N;else if(Wr.maxAtlasPages&&this._pages.length>=Wr.maxAtlasPages&&T.y+C.size.y<=L.canvas.height&&T.height>=C.size.y&&T.x+C.size.x<=L.canvas.width)D=!0;else{let G=this._createNewPage();L=G,T=G.currentRow,T.height=C.size.y,D=!0}}D||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),T={x:0,y:L.currentRow.y+L.currentRow.height,height:C.size.y},L.fixedRows.push(T),L.currentRow={x:0,y:T.y+T.height,height:0})}if(T.x+C.size.x<=L.canvas.width)break;T===L.currentRow?(T.x=0,T.y+=T.height,T.height=0):L.fixedRows.splice(L.fixedRows.indexOf(T),1)}return C.texturePage=this._pages.indexOf(L),C.texturePosition.x=T.x,C.texturePosition.y=T.y,C.texturePositionClipSpace.x=T.x/L.canvas.width,C.texturePositionClipSpace.y=T.y/L.canvas.height,C.sizeClipSpace.x/=L.canvas.width,C.sizeClipSpace.y/=L.canvas.height,T.height=Math.max(T.height,C.size.y),T.x+=C.size.x,L.ctx.putImageData(z,C.texturePosition.x-this._workBoundingBox.left,C.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,C.size.x,C.size.y),L.addGlyph(C),L.version++,C}_findGlyphBoundingBox(t,r,i,n,s,o){r.top=0;let a=n?this._config.deviceCellHeight:this._tmpCanvas.height,d=n?this._config.deviceCellWidth:i,l=!1;for(let _=0;_<a;_++){for(let m=0;m<d;m++){let y=_*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.top=_,l=!0;break}}if(l)break}r.left=0,l=!1;for(let _=0;_<o+d;_++){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+_*4+3;if(t.data[y]!==0){r.left=_,l=!0;break}}if(l)break}r.right=d,l=!1;for(let _=o+d-1;_>=o;_--){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+_*4+3;if(t.data[y]!==0){r.right=_,l=!0;break}}if(l)break}r.bottom=a,l=!1;for(let _=a-1;_>=0;_--){for(let m=0;m<d;m++){let y=_*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.bottom=_,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+o+(n||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+o+(n||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Hn=class{constructor(e,t,r){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],r)for(let i of r)this._glyphs.push(...i.glyphs),this._usedPixels+=i._usedPixels;this.canvas=hc(e,t,t),this.ctx=ze(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 Fn(e,t,r,i){let n=t.rgba>>>24,s=t.rgba>>>16&255,o=t.rgba>>>8&255,a=r.rgba>>>24,d=r.rgba>>>16&255,l=r.rgba>>>8&255,_=Math.floor((Math.abs(n-a)+Math.abs(s-d)+Math.abs(o-l))/12),m=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===n&&e.data[y+1]===s&&e.data[y+2]===o||i&&Math.abs(e.data[y]-n)+Math.abs(e.data[y+1]-s)+Math.abs(e.data[y+2]-o)<_?e.data[y+3]=0:m=!1;return m}function np(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function hc(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function op(e,t,r,i,n,s,o,a){let d={foreground:s.foreground,background:s.background,cursor:dt,cursorAccent:dt,selectionForeground:dt,selectionBackgroundTransparent:dt,selectionBackgroundOpaque:dt,selectionInactiveBackgroundTransparent:dt,selectionInactiveBackgroundOpaque:dt,overviewRulerBorder:dt,scrollbarSliderBackground:dt,scrollbarSliderHoverBackground:dt,scrollbarSliderActiveBackground:dt,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:n.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontWeightBold:n.fontWeightBold,allowTransparency:n.allowTransparency,drawBoldTextInBrightColors:n.drawBoldTextInBrightColors,minimumContrastRatio:n.minimumContrastRatio,colors:d}}function ml(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].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 ap(e){return(e&50331648)===16777216||(e&50331648)===33554432}var ft=[];function dc(e,t,r,i,n,s,o,a,d){let l=op(i,n,s,o,t,r,a,d);for(let y=0;y<ft.length;y++){let p=ft[y],c=p.ownedBy.indexOf(e);if(c>=0){if(ml(p.config,l))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),ft.splice(y,1)):p.ownedBy.splice(c,1);break}}for(let y=0;y<ft.length;y++){let p=ft[y];if(ml(p.config,l))return p.ownedBy.push(e),p.atlas}let _=e._core,m={atlas:new or(document,l,_.unicodeService),config:l,ownedBy:[e]};return ft.push(m),m.atlas}function gl(e){for(let t=0;t<ft.length;t++){let r=ft[t].ownedBy.indexOf(e);if(r!==-1){ft[t].ownedBy.length===1?(ft[t].atlas.dispose(),ft.splice(t,1)):ft[t].ownedBy.splice(r,1);break}}}var gs=600,lp=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=gs){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=gs-(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=gs-(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})},gs)},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 vl(e,t,r){let i=new t.ResizeObserver(n=>{let s=n.find(d=>d.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}let o=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&r(o,a)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ye(()=>i?.disconnect())}function cp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var bl=class uc extends Ur{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new sc,this.combinedData=""}static fromCharData(t){let r=new uc;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?cp(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fc=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function pc(e,t,r){let i=ze(e.createProgram());if(e.attachShader(i,ze(wl(e,e.VERTEX_SHADER,t))),e.attachShader(i,ze(wl(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function wl(e,t,r){let i=ze(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function hp(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let n=0;n<e.length;n++)i[n]=e[n];return i}var dp=class{constructor(e){this.texture=e,this.version=-1}},up=`#version 300 es
|
|
61
|
+
`).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Ls.register(n,u?.[2]??a,n)}return n}),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,r=t.indexOf(e);if(r===-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[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*ap<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let r=this._options?.onListenerError||ks;if(!r){e.value(t);return}try{e.value(t)}catch(i){r(i)}}_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 Es)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}},cp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},bl={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}},ki=2,Ei,pr=class Kr{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new _l,this._cacheMapCombined=new _l,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Vr,this._textureSize=512,this._onAddTextureAtlasCanvas=new Pe,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Pe,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=pc(t,this._config.deviceCellWidth*4+ki*2,this._config.deviceCellHeight+ki*2),this._tmpCtx=Ke(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 Xf;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}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(Kr.maxAtlasPages&&this._pages.length>=Math.max(4,Kr.maxAtlasPages)){let r=this._pages.filter(l=>l.canvas.width*2<=(Kr.maxTextureSize||4096)).sort((l,d)=>d.canvas.width!==l.canvas.width?d.canvas.width-l.canvas.width:d.percentageUsed-l.percentageUsed),i=-1,o=0;for(let l=0;l<r.length;l++)if(r[l].canvas.width!==o)i=l,o=r[l].canvas.width;else if(l-i===3)break;let s=r.slice(i,i+4),n=s.map(l=>l.glyphs[0].texturePage).sort((l,d)=>l>d?1:-1),a=this.pages.length-s.length,u=this._mergePages(s,a);u.version++;for(let l=n.length-1;l>=0;l--)this._deletePage(n[l]);this.pages.push(u),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(u.canvas)}let t=new qn(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,o=new qn(this._document,i,t);for(let[s,n]of t.entries()){let a=s*n.canvas.width%i,u=Math.floor(s/2)*n.canvas.height;o.ctx.drawImage(n.canvas,a,u);for(let d of n.glyphs)d.texturePage=r,d.sizeClipSpace.x=d.size.x/i,d.sizeClipSpace.y=d.size.y/i,d.texturePosition.x+=a,d.texturePosition.y+=u,d.texturePositionClipSpace.x=d.texturePosition.x/i,d.texturePositionClipSpace.y=d.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let l=this._activePages.indexOf(n);l!==-1&&this._activePages.splice(l,1)}return o}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let o of i.glyphs)o.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,o,s,n){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,o,s,n)}getRasterizedGlyph(t,r,i,o,s,n){return this._getFromCacheMap(this._cacheMap,t,r,i,o,s,n)}_getFromCacheMap(t,r,i,o,s,n,a){return Ei=t.get(r,i,o,s),Ei||(Ei=this._drawToCache(r,i,o,s,n,a),t.set(r,i,o,s,Ei)),Ei}_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,r,i,o){if(this._config.allowTransparency)return wt;let s;switch(t){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(r);break;case 50331648:let n=Vr.toColorRGB(r);s=lt.toColor(n[0],n[1],n[2]);break;default:i?s=Gr.opaque(this._config.colors.foreground):s=this._config.colors.background;break}return this._config.allowTransparency||(s=Gr.opaque(s)),s}_getForegroundColor(t,r,i,o,s,n,a,u,l,d){let m=this._getMinimumContrastColor(t,r,i,o,s,n,a,l,u,d);if(m)return m;let y;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),y=this._getColorFromAnsiIndex(n);break;case 50331648:let _=Vr.toColorRGB(n);y=lt.toColor(_[0],_[1],_[2]);break;default:a?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=Gr.opaque(y)),u&&(y=Gr.multiplyOpacity(y,Wf)),y}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,o){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&o&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,o,s,n,a,u,l,d){if(this._config.minimumContrastRatio===1||d)return;let m=this._getContrastCache(l),y=m.getColor(t,o);if(y!==void 0)return y||void 0;let _=this._resolveBackgroundRgba(r,i,a),c=this._resolveForegroundRgba(s,n,a,u),f=mr.ensureContrastRatio(_,c,this._config.minimumContrastRatio/(l?2:1));if(!f){m.setColor(t,o,null);return}let h=lt.toColor(f>>24&255,f>>16&255,f>>8&255);return m.setColor(t,o,h),h}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,o,s,n){let a=typeof t=="number"?String.fromCharCode(t):t;n&&this._tmpCanvas.parentElement!==n&&(this._tmpCanvas.style.display="none",n.append(this._tmpCanvas));let u=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+ki*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<u&&(this._tmpCanvas.width=u);let l=Math.min(this._config.deviceCellHeight+ki*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return bl;let d=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),c=!!this._workAttributeData.isUnderline(),f=!!this._workAttributeData.isStrikethrough(),h=!!this._workAttributeData.isOverline(),p=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(m){let D=p;p=S,S=D;let N=v;v=b,b=N}let x=this._getBackgroundColor(b,S,m,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let w=d?this._config.fontWeightBold:this._config.fontWeight,E=_?"italic":"";this._tmpCtx.font=`${E} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ic;let B=a.length===1&&wo(a.charCodeAt(0)),P=a.length===1&&Df(a.charCodeAt(0)),W=this._getForegroundColor(r,b,S,i,v,p,m,y,d,rc(a.charCodeAt(0)));this._tmpCtx.fillStyle=W.css;let A=P?0:ki*2,V=!1;this._config.customGlyphs!==!1&&(V=$f(this._tmpCtx,a,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let O=!B,R;if(typeof t=="number"?R=this._unicodeService.wcwidth(t):R=this._unicodeService.getStringCellWidth(t),c){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())O=!1,this._tmpCtx.strokeStyle=`rgb(${Vr.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{O=!1;let j=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&j<8&&(j+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(j).css}this._tmpCtx.beginPath();let G=A,$=Math.ceil(A+this._config.deviceCharHeight)-N-(s?D*2:0),Y=$+D,H=$+D*2,k=this._workAttributeData.getUnderlineVariantOffset();for(let j=0;j<R;j++){this._tmpCtx.save();let q=G+j*this._config.deviceCellWidth,U=G+(j+1)*this._config.deviceCellWidth,J=q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$),this._tmpCtx.moveTo(q,H),this._tmpCtx.lineTo(U,H);break;case 3:let Z=D<=1?H:Math.ceil(A+this._config.deviceCharHeight-D/2)-N,se=D<=1?$:Math.ceil(A+this._config.deviceCharHeight+D/2)-N,he=new Path2D;he.rect(q,$,this._config.deviceCellWidth,H-$),this._tmpCtx.clip(he),this._tmpCtx.moveTo(q-this._config.deviceCellWidth/2,Y),this._tmpCtx.bezierCurveTo(q-this._config.deviceCellWidth/2,se,q,se,q,Y),this._tmpCtx.bezierCurveTo(q,Z,J,Z,J,Y),this._tmpCtx.bezierCurveTo(J,se,U,se,U,Y),this._tmpCtx.bezierCurveTo(U,Z,U+this._config.deviceCellWidth/2,Z,U+this._config.deviceCellWidth/2,Y);break;case 4:let fe=k===0?0:k>=D?D*2-k:D-k;k>=D||fe===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q+fe,$),this._tmpCtx.lineTo(U,$)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(q+fe,$),this._tmpCtx.moveTo(q+fe+D,$),this._tmpCtx.lineTo(U,$)),k=Hf(U-q,D,k);break;case 5:let te=.6,qe=.3,le=U-q,Me=Math.floor(te*le),st=Math.floor(qe*le),He=le-Me-st;this._tmpCtx.setLineDash([Me,st,He]),this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$);break;default:this._tmpCtx.moveTo(q,$),this._tmpCtx.lineTo(U,$);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!V&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let j=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in j&&j.actualBoundingBoxDescent>0){this._tmpCtx.save();let q=new Path2D;q.rect(G,$-Math.ceil(D/2),this._config.deviceCellWidth*R,H-$+Math.ceil(D/2)),this._tmpCtx.clip(q),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(h){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),N=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+N),this._tmpCtx.stroke()}if(V||this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=Kn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,W,O);if(D)for(let N=1;N<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,A,A+this._config.deviceCharHeight-N),D=Kn(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),x,W,O),!!D);N++);}if(f){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),N=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*R,A+Math.floor(this._config.deviceCharHeight/2)-N),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),I;if(this._config.allowTransparency?I=hp(F):I=Kn(F,x,W,O),I)return bl;let C=this._findGlyphBoundingBox(F,this._workBoundingBox,u,P,V,A),L,T;for(;;){if(this._activePages.length===0){let D=this._createNewPage();L=D,T=D.currentRow,T.height=C.size.y;break}L=this._activePages[this._activePages.length-1],T=L.currentRow;for(let D of this._activePages)C.size.y<=D.currentRow.height&&(L=D,T=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let N of this._activePages[D].fixedRows)N.height<=T.height&&C.size.y<=N.height&&(L=this._activePages[D],T=N);if(C.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new qn(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,T=this._overflowSizePage.currentRow,T.x+C.size.x>=L.canvas.width&&(T.x=0,T.y+=T.height,T.height=0);break}if(T.y+C.size.y>=L.canvas.height||T.height>C.size.y+2){let D=!1;if(L.currentRow.y+L.currentRow.height+C.size.y>=L.canvas.height){let N;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+C.size.y<G.canvas.height){N=G;break}if(N)L=N;else if(Kr.maxAtlasPages&&this._pages.length>=Kr.maxAtlasPages&&T.y+C.size.y<=L.canvas.height&&T.height>=C.size.y&&T.x+C.size.x<=L.canvas.width)D=!0;else{let G=this._createNewPage();L=G,T=G.currentRow,T.height=C.size.y,D=!0}}D||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),T={x:0,y:L.currentRow.y+L.currentRow.height,height:C.size.y},L.fixedRows.push(T),L.currentRow={x:0,y:T.y+T.height,height:0})}if(T.x+C.size.x<=L.canvas.width)break;T===L.currentRow?(T.x=0,T.y+=T.height,T.height=0):L.fixedRows.splice(L.fixedRows.indexOf(T),1)}return C.texturePage=this._pages.indexOf(L),C.texturePosition.x=T.x,C.texturePosition.y=T.y,C.texturePositionClipSpace.x=T.x/L.canvas.width,C.texturePositionClipSpace.y=T.y/L.canvas.height,C.sizeClipSpace.x/=L.canvas.width,C.sizeClipSpace.y/=L.canvas.height,T.height=Math.max(T.height,C.size.y),T.x+=C.size.x,L.ctx.putImageData(F,C.texturePosition.x-this._workBoundingBox.left,C.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,C.size.x,C.size.y),L.addGlyph(C),L.version++,C}_findGlyphBoundingBox(t,r,i,o,s,n){r.top=0;let a=o?this._config.deviceCellHeight:this._tmpCanvas.height,u=o?this._config.deviceCellWidth:i,l=!1;for(let d=0;d<a;d++){for(let m=0;m<u;m++){let y=d*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.top=d,l=!0;break}}if(l)break}r.left=0,l=!1;for(let d=0;d<n+u;d++){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+d*4+3;if(t.data[y]!==0){r.left=d,l=!0;break}}if(l)break}r.right=u,l=!1;for(let d=n+u-1;d>=n;d--){for(let m=0;m<a;m++){let y=m*this._tmpCanvas.width*4+d*4+3;if(t.data[y]!==0){r.right=d,l=!0;break}}if(l)break}r.bottom=a,l=!1;for(let d=a-1;d>=0;d--){for(let m=0;m<u;m++){let y=d*this._tmpCanvas.width*4+m*4+3;if(t.data[y]!==0){r.bottom=d,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+n+(o||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+n+(o||s?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},qn=class{constructor(e,t,r){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],r)for(let i of r)this._glyphs.push(...i.glyphs),this._usedPixels+=i._usedPixels;this.canvas=pc(e,t,t),this.ctx=Ke(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 Kn(e,t,r,i){let o=t.rgba>>>24,s=t.rgba>>>16&255,n=t.rgba>>>8&255,a=r.rgba>>>24,u=r.rgba>>>16&255,l=r.rgba>>>8&255,d=Math.floor((Math.abs(o-a)+Math.abs(s-u)+Math.abs(n-l))/12),m=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===o&&e.data[y+1]===s&&e.data[y+2]===n||i&&Math.abs(e.data[y]-o)+Math.abs(e.data[y+1]-s)+Math.abs(e.data[y+2]-n)<d?e.data[y+3]=0:m=!1;return m}function hp(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function pc(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function dp(e,t,r,i,o,s,n,a){let u={foreground:s.foreground,background:s.background,cursor:wt,cursorAccent:wt,selectionForeground:wt,selectionBackgroundTransparent:wt,selectionBackgroundOpaque:wt,selectionInactiveBackgroundTransparent:wt,selectionInactiveBackgroundOpaque:wt,overviewRulerBorder:wt,scrollbarSliderBackground:wt,scrollbarSliderHoverBackground:wt,scrollbarSliderActiveBackground:wt,ansi:s.ansi.slice(),contrastCache:s.contrastCache,halfContrastCache:s.halfContrastCache};return{customGlyphs:o.customGlyphs,devicePixelRatio:n,deviceMaxTextureSize:a,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:u}}function wl(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].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 up(e){return(e&50331648)===16777216||(e&50331648)===33554432}var St=[];function _c(e,t,r,i,o,s,n,a,u){let l=dp(i,o,s,n,t,r,a,u);for(let y=0;y<St.length;y++){let _=St[y],c=_.ownedBy.indexOf(e);if(c>=0){if(wl(_.config,l))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),St.splice(y,1)):_.ownedBy.splice(c,1);break}}for(let y=0;y<St.length;y++){let _=St[y];if(wl(_.config,l))return _.ownedBy.push(e),_.atlas}let d=e._core,m={atlas:new pr(document,l,d.unicodeService),config:l,ownedBy:[e]};return St.push(m),m.atlas}function yl(e){for(let t=0;t<St.length;t++){let r=St[t].ownedBy.indexOf(e);if(r!==-1){St[t].ownedBy.length===1?(St[t].atlas.dispose(),St.splice(t,1)):St[t].ownedBy.splice(r,1);break}}}var Cs=600,fp=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=Cs){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Cs-(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=Cs-(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})},Cs)},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 Sl(e,t,r){let i=new t.ResizeObserver(o=>{let s=o.find(u=>u.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}let n=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;n>0&&a>0&&r(n,a)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return tt(()=>i?.disconnect())}function pp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Cl=class mc extends Vr{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new lc,this.combinedData=""}static fromCharData(t){let r=new mc;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pp(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(i-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gc=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function vc(e,t,r){let i=Ke(e.createProgram());if(e.attachShader(i,Ke(xl(e,e.VERTEX_SHADER,t))),e.attachShader(i,Ke(xl(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function xl(e,t,r){let i=Ke(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function _p(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let o=0;o<e.length;o++)i[o]=e[o];return i}var mp=class{constructor(e){this.texture=e,this.version=-1}},gp=`#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 vp(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], 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
|
|
95
|
+
}`}var _r=11,qr=_r*Float32Array.BYTES_PER_ELEMENT,bp=2,Ue=0,Ie,Gn=0,Li=0,wp=class extends vt{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._optionsService=i,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;pr.maxAtlasPages===void 0&&(pr.maxAtlasPages=Math.min(32,Ke(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),pr.maxTextureSize=Ke(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=Ke(vc(o,gp,vp(pr.maxAtlasPages))),this._register(tt(()=>o.deleteProgram(this._program))),this._projectionLocation=Ke(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ke(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ke(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(tt(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,s,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=o.createBuffer();this._register(tt(()=>o.deleteBuffer(u))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=Ke(o.createBuffer()),this._register(tt(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,qr,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,qr,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,qr,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,qr,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,qr,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,qr,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let l=new Int32Array(pr.maxAtlasPages);for(let d=0;d<pr.maxAtlasPages;d++)l[d]=d;o.uniform1iv(this._textureLocation,l),o.uniformMatrix4fv(this._projectionLocation,!1,gc),this._atlasTextures=[];for(let d=0;d<pr.maxAtlasPages;d++){let m=new mp(Ke(o.createTexture()));this._register(tt(()=>o.deleteTexture(m.texture))),o.activeTexture(o.TEXTURE0+d),o.bindTexture(o.TEXTURE_2D,m.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=m}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,r,i,o,s,n,a,u){this._updateCell(this._vertices.attributes,e,t,r,i,o,s,n,a,u)}_updateCell(e,t,r,i,o,s,n,a,u,l){if(Ue=(r*this._terminal.cols+t)*_r,i===0||i===void 0){e.fill(0,Ue,Ue+_r-1-bp);return}this._atlas&&(a&&a.length>1?Ie=this._atlas.getRasterizedGlyphCombinedChar(a,o,s,n,!1,this._terminal.element):Ie=this._atlas.getRasterizedGlyph(i,o,s,n,!1,this._terminal.element),Gn=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==l&&Ie.offset.x>Gn?(Li=Ie.offset.x-Gn,e[Ue]=-(Ie.offset.x-Li)+this._dimensions.device.char.left,e[Ue+1]=-Ie.offset.y+this._dimensions.device.char.top,e[Ue+2]=(Ie.size.x-Li)/this._dimensions.device.canvas.width,e[Ue+3]=Ie.size.y/this._dimensions.device.canvas.height,e[Ue+4]=Ie.texturePage,e[Ue+5]=Ie.texturePositionClipSpace.x+Li/this._atlas.pages[Ie.texturePage].canvas.width,e[Ue+6]=Ie.texturePositionClipSpace.y,e[Ue+7]=Ie.sizeClipSpace.x-Li/this._atlas.pages[Ie.texturePage].canvas.width,e[Ue+8]=Ie.sizeClipSpace.y):(e[Ue]=-Ie.offset.x+this._dimensions.device.char.left,e[Ue+1]=-Ie.offset.y+this._dimensions.device.char.top,e[Ue+2]=Ie.size.x/this._dimensions.device.canvas.width,e[Ue+3]=Ie.size.y/this._dimensions.device.canvas.height,e[Ue+4]=Ie.texturePage,e[Ue+5]=Ie.texturePositionClipSpace.x,e[Ue+6]=Ie.texturePositionClipSpace.y,e[Ue+7]=Ie.sizeClipSpace.x,e[Ue+8]=Ie.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&If(i,u,Ie.size.x,this._dimensions.device.cell.width)&&(e[Ue+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*_r;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let r=0;for(;r<this._vertices.attributesBuffers.length;r++)this._vertices.count!==t?this._vertices.attributesBuffers[r]=new Float32Array(t):this._vertices.attributesBuffers[r].fill(0);this._vertices.count=t,r=0;for(let i=0;i<e.rows;i++)for(let o=0;o<e.cols;o++)this._vertices.attributes[r+9]=o/e.cols,this._vertices.attributes[r+10]=i/e.rows,r+=_r}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 r=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let o=0;o<e.lineLengths.length;o++){let s=o*this._terminal.cols*_r,n=this._vertices.attributes.subarray(s,s+e.lineLengths[o]*_r);r.set(n,i),i+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,r.subarray(0,i),t.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(t,this._atlas,o);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,i/_r)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,r){e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[r].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[r].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[r].version=t.pages[r].version}setDimensions(e){this._dimensions=e}},yp=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,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,s=t[1]-o,n=r[1]-o,a=Math.max(s,0),u=Math.min(n,e.rows-1);if(a>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=s,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function Sp(){return new yp}var Bs=4,Ts=1,Ms=2,Vn=3,Cp=2147483648,xp=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Sp()}resize(e,t){let r=e*t*Bs;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},kp=`#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
|
+
}`,Ep=`#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
|
-
}`,Gt=8,Un=Gt*Float32Array.BYTES_PER_ELEMENT,Sp=20*Gt,yl=class{constructor(){this.attributes=new Float32Array(Sp),this.count=0}},qt=0,Sl=0,Cl=0,xl=0,kl=0,El=0,Ll=0,Cp=class extends ct{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new yl,this._verticesCursor=new yl;let n=this._gl;this._program=ze(pc(n,wp,yp)),this._register(Ye(()=>n.deleteProgram(this._program))),this._projectionLocation=ze(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),o=n.createBuffer();this._register(Ye(()=>n.deleteBuffer(o))),n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,s,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),d=n.createBuffer();this._register(Ye(()=>n.deleteBuffer(d))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,d),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=ze(n.createBuffer()),this._register(Ye(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,Un,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Un,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,Un,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),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,fc),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,r=this._vertices,i=1,n,s,o,a,d,l,_,m,y,p,c;for(n=0;n<t.rows;n++){for(o=-1,a=0,d=0,l=!1,s=0;s<t.cols;s++)_=(n*t.cols+s)*Ts,m=e.cells[_+Ss],y=e.cells[_+Cs],p=!!(y&67108864),(m!==a||y!==d&&(l||p))&&((a!==0||l&&d!==0)&&(c=i++*Gt,this._updateRectangle(r,c,d,a,o,s,n)),o=s,a=m,d=y,l=p);(a!==0||l&&d!==0)&&(c=i++*Gt,this._updateRectangle(r,c,d,a,o,t.cols,n))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,n=0;(r.style==="bar"||r.style==="outline")&&(i=n++*Gt,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=n++*Gt,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=n++*Gt,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=n++*Gt,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=n}_updateRectangle(e,t,r,i,n,s,o){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:qt=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:qt=(r&16777215)<<8;break;default:qt=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:qt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:qt=(i&16777215)<<8;break;default:qt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=hp(e.attributes,this._terminal.rows*this._terminal.cols*Gt)),Sl=n*this._dimensions.device.cell.width,Cl=o*this._dimensions.device.cell.height,xl=(qt>>24&255)/255,kl=(qt>>16&255)/255,El=(qt>>8&255)/255,Ll=1,this._addRectangle(e.attributes,t,Sl,Cl,(s-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,xl,kl,El,Ll)}_addRectangle(e,t,r,i,n,s,o,a,d,l){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=d,e[t+7]=l}_addRectangleFloat(e,t,r,i,n,s,o){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[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])}},xp=class extends ct{constructor(e,t,r,i,n,s,o,a){super(),this._container=t,this._alpha=n,this._coreBrowserService=s,this._optionsService=o,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(d=>{this._refreshCharAtlas(e,d),this.reset(e)})),this._register(Ye(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ze(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,i=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=dc(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,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*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,r,i){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,i){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Ql,this._clipCell(r,i,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let i=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${i} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},kp=class extends xp{constructor(e,t,r,i,n,s,o){super(r,e,"link",t,!0,n,s,o),this._register(i.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(i.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&&ap(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()}},wt=typeof window=="object"?window:globalThis,oo=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Me,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Me,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};oo.INSTANCE=new oo;var _c=oo;function Ep(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var Vv=_c.INSTANCE.onDidChangeZoomLevel,Yv=_c.INSTANCE.onDidChangeFullscreen,Kr=typeof navigator=="object"?navigator.userAgent:"",Xv=Kr.indexOf("Firefox")>=0,jn=Kr.indexOf("AppleWebKit")>=0,Lp=Kr.indexOf("Chrome")>=0,Tp=!Lp&&Kr.indexOf("Safari")>=0,Jv=Kr.indexOf("Electron/")>=0,Zv=Kr.indexOf("Android")>=0,xs=!1;if(typeof wt.matchMedia=="function"){let e=wt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=wt.matchMedia("(display-mode: fullscreen)");xs=e.matches,Ep(wt,e,({matches:r})=>{xs&&t.matches||(xs=r)})}function Mp(){return xs}var jr="en",ao=!1,lo=!1,ks=!1,Rp=!1,mc=!1,gc=!1,Ap=!1,Dp=!1,Pp=!1,Bp=!1,vs,Es=jr,Tl=jr,Op,Kt,Yt=globalThis,lt;typeof Yt.vscode<"u"&&typeof Yt.vscode.process<"u"?lt=Yt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(lt=process);var vc=typeof lt?.versions?.electron=="string",Ip=vc&<?.type==="renderer";if(typeof lt=="object"){ao=lt.platform==="win32",lo=lt.platform==="darwin",ks=lt.platform==="linux",Rp=ks&&!!lt.env.SNAP&&!!lt.env.SNAP_REVISION,Ap=vc,Pp=!!lt.env.CI||!!lt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,vs=jr,Es=jr;let e=lt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);vs=t.userLocale,Tl=t.osLocale,Es=t.resolvedLanguage||jr,Op=t.languagePack?.translationsConfigFile}catch{}mc=!0}else typeof navigator=="object"&&!Ip?(Kt=navigator.userAgent,ao=Kt.indexOf("Windows")>=0,lo=Kt.indexOf("Macintosh")>=0,Dp=(Kt.indexOf("Macintosh")>=0||Kt.indexOf("iPad")>=0||Kt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ks=Kt.indexOf("Linux")>=0,Bp=Kt?.indexOf("Mobi")>=0,gc=!0,Es=globalThis._VSCODE_NLS_LANGUAGE||jr,vs=navigator.language.toLowerCase(),Tl=vs):console.error("Unable to resolve platform.");var $n=0;lo?$n=1:ao?$n=3:ks&&($n=2);var qn=mc,Np=gc&&typeof Yt.importScripts=="function",Qv=Np?Yt.origin:void 0,Dt=Kt,sr=Es,Ml;(e=>{function t(){return sr}e.value=t;function r(){return sr.length===2?sr==="en":sr.length>=3?sr[0]==="e"&&sr[1]==="n"&&sr[2]==="-":!1}e.isDefaultVariant=r;function i(){return sr==="en"}e.isDefault=i})(Ml||(Ml={}));var Hp=typeof Yt.postMessage=="function"&&!Yt.importScripts,Fp=(()=>{if(Hp){let e=[];Yt.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Yt.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),Wp=!!(Dt&&Dt.indexOf("Chrome")>=0),eb=!!(Dt&&Dt.indexOf("Firefox")>=0),tb=!!(!Wp&&Dt&&Dt.indexOf("Safari")>=0),rb=!!(Dt&&Dt.indexOf("Edg/")>=0),ib=!!(Dt&&Dt.indexOf("Android")>=0),nr=typeof navigator=="object"?navigator:{},sb={clipboard:{writeText:qn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(nr&&nr.clipboard&&nr.clipboard.writeText),readText:qn||!!(nr&&nr.clipboard&&nr.clipboard.readText)},keyboard:qn||Mp()?0:nr.keyboard||Tp?1:2,touch:"ontouchstart"in wt||nr.maxTouchPoints>0,pointerEvents:wt.PointerEvent&&("ontouchstart"in wt||navigator.maxTouchPoints>0)},po=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}},Kn=new po,Rl=new po,Al=new po,nb=new Array(230),Dl;(e=>{function t(a){return Kn.keyCodeToStr(a)}e.toString=t;function r(a){return Kn.strToKeyCode(a)}e.fromString=r;function i(a){return Rl.keyCodeToStr(a)}e.toUserSettingsUS=i;function n(a){return Al.keyCodeToStr(a)}e.toUserSettingsGeneral=n;function s(a){return Rl.strToKeyCode(a)||Al.strToKeyCode(a)}e.fromUserSettings=s;function o(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 Kn.keyCodeToStr(a)}e.toElectronAccelerator=o})(Dl||(Dl={}));var bc=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Pl;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof zp?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:At.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bc})})(Pl||(Pl={}));var zp=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?bc:(this._emitter||(this._emitter=new Me),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Up,Gn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Gn=(e,t)=>{Fp(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:Gn=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),n=!1;return{dispose(){n||(n=!0,e.cancelIdleCallback(i))}}},Up=e=>Gn(globalThis,e)})();var Bl;(e=>{async function t(i){let n,s=await Promise.all(i.map(o=>o.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return s}e.settled=t;function r(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(o){s(o)}})}e.withAsyncBody=r})(Bl||(Bl={}));var Ol=class ut{static fromArray(t){return new ut(r=>{r.emitMany(t)})}static fromPromise(t){return new ut(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ut(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new ut(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Me,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 At.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new ut(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return ut.map(this,t)}static filter(t,r){return new ut(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return ut.filter(this,t)}static coalesce(t){return ut.filter(t,r=>!!r)}coalesce(){return ut.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return ut.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())}};Ol.EMPTY=Ol.fromArray([]);function jp(e){return 55296<=e&&e<=56319}function Il(e){return 56320<=e&&e<=57343}function $p(e,t){return(e-55296<<10)+(t-56320)+65536}function qp(e){return _o(e,0)}function _o(e,t){switch(typeof e){case"object":return e===null?Vt(349,t):Array.isArray(e)?Gp(e,t):Vp(e,t);case"string":return wc(e,t);case"boolean":return Kp(e,t);case"number":return Vt(e,t);case"undefined":return Vt(937,t);default:return Vt(617,t)}}function Vt(e,t){return(t<<5)-t+e|0}function Kp(e,t){return Vt(e?433:863,t)}function wc(e,t){t=Vt(149417,t);for(let r=0,i=e.length;r<i;r++)t=Vt(e.charCodeAt(r),t);return t}function Gp(e,t){return t=Vt(104579,t),e.reduce((r,i)=>_o(i,r),t)}function Vp(e,t){return t=Vt(181387,t),Object.keys(e).sort().reduce((r,i)=>(r=wc(i,r),_o(e[i],r)),t)}function Vn(e,t,r=32){let i=r-t,n=~((1<<i)-1);return(e<<t|(n&e)>>>i)>>>0}function Nl(e,t=0,r=e.byteLength,i=0){for(let n=0;n<r;n++)e[t+n]=i}function Yp(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function Ci(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):Yp((e>>>0).toString(16),t/4)}var Xp=class yc{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 r=t.length;if(r===0)return;let i=this._buff,n=this._buffLen,s=this._leftoverHighSurrogate,o,a;for(s!==0?(o=s,a=-1,s=0):(o=t.charCodeAt(0),a=0);;){let d=o;if(jp(o))if(a+1<r){let l=t.charCodeAt(a+1);Il(l)?(a++,d=$p(o,l)):d=65533}else{s=o;break}else Il(o)&&(d=65533);if(n=this._push(i,n,d),a++,a<r)o=t.charCodeAt(a);else break}this._buffLen=n,this._leftoverHighSurrogate=s}_push(t,r,i){return i<128?t[r++]=i:i<2048?(t[r++]=192|(i&1984)>>>6,t[r++]=128|(i&63)>>>0):i<65536?(t[r++]=224|(i&61440)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0):(t[r++]=240|(i&1835008)>>>18,t[r++]=128|(i&258048)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0),r>=64&&(this._step(),r-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),r}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,Nl(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Nl(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=yc._bigBlock32,r=this._buffDV;for(let m=0;m<64;m+=4)t.setUint32(m,r.getUint32(m,!1),!1);for(let m=64;m<320;m+=4)t.setUint32(m,Vn(t.getUint32(m-12,!1)^t.getUint32(m-32,!1)^t.getUint32(m-56,!1)^t.getUint32(m-64,!1),1),!1);let i=this._h0,n=this._h1,s=this._h2,o=this._h3,a=this._h4,d,l,_;for(let m=0;m<80;m++)m<20?(d=n&s|~n&o,l=1518500249):m<40?(d=n^s^o,l=1859775393):m<60?(d=n&s|n&o|s&o,l=2400959708):(d=n^s^o,l=3395469782),_=Vn(i,5)+d+a+l+t.getUint32(m*4,!1)&4294967295,a=o,o=s,s=Vn(n,30),n=i,i=_;this._h0=this._h0+i&4294967295,this._h1=this._h1+n&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};Xp._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:ob,getWindow:Jp,getDocument:ab,getWindows:lb,getWindowsCount:cb,getWindowId:Hl,getWindowById:hb,hasWindow:db,onDidRegisterWindow:ub,onWillUnregisterWindow:fb,onDidUnregisterWindow:pb}=(function(){let e=new Map,t={window:wt,disposables:new $r};e.set(wt.vscodeWindowId,t);let r=new Me,i=new Me,n=new Me;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ct.None;let a=new $r,d={window:o,disposables:a.add(new $r)};return e.set(o.vscodeWindowId,d),a.add(Ye(()=>{e.delete(o.vscodeWindowId),i.fire(o)})),a.add(co(o,e_.BEFORE_UNLOAD,()=>{n.fire(o)})),r.fire(d),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let d=o;return d?.view?d.view.window:wt},getDocument(o){return Jp(o).document}}})(),Zp=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!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 co(e,t,r,i){return new Zp(e,t,r,i)}var Qp,Fl,Yn=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){bs(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,n=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),i.set(s,!0);o.length>0;)o.sort(Yn.sort),o.shift().execute();i.set(s,!1)};Fl=(s,o,a=0)=>{let d=Hl(s),l=new Yn(o,a),_=e.get(d);return _||(_=[],e.set(d,_)),_.push(l),r.get(d)||(r.set(d,!0),s.requestAnimationFrame(()=>n(d))),l},Qp=(s,o,a)=>{let d=Hl(s);if(i.get(d)){let l=new Yn(o,a),_=t.get(d);return _||(_=[],t.set(d,_)),_.push(l),l}else return Fl(s,o,a)}})();var Wl=class Ls{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new Ls(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Ls?t:new Ls(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};Wl.None=new Wl(0,0);var _b=new class{constructor(){this.mutationObservers=new Map}observe(e,t,r){let i=this.mutationObservers.get(e);i||(i=new Map,this.mutationObservers.set(e,i));let n=qp(r),s=i.get(n);if(s)s.users+=1;else{let o=new Me,a=new MutationObserver(l=>o.fire(l));a.observe(e,r);let d=s={users:1,observer:a,onDidMutate:o.event};t.add(Ye(()=>{d.users-=1,d.users===0&&(o.dispose(),a.disconnect(),i?.delete(n),i?.size===0&&this.mutationObservers.delete(e))})),i.set(n,s)}return s.onDidMutate}},e_={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:jn?"webkitAnimationStart":"animationstart",ANIMATION_END:jn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:jn?"webkitAnimationIteration":"animationiteration"},t_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Sc(e,t,r,...i){let n=t_.exec(t);if(!n)throw new Error("Bad use of emmet");let s=n[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,s):o=document.createElement(s),n[3]&&(o.id=n[3]),n[4]&&(o.className=n[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([a,d])=>{typeof d>"u"||(/^on\w+$/.test(a)?o[a]=d:a==="selected"?d&&o.setAttribute(a,"true"):o.setAttribute(a,d))}),o.append(...i),o}function r_(e,t,...r){return Sc("http://www.w3.org/1999/xhtml",e,t,...r)}r_.SVG=function(e,t,...r){return Sc("http://www.w3.org/2000/svg",e,t,...r)};var i_=class extends ct{constructor(e,t,r,i,n,s,o,a,d){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=i,this._coreService=n,this._decorationService=s,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new bi,this._charAtlasDisposable=this._register(new bi),this._observerDisposable=this._register(new bi),this._model=new bp,this._workCell=new bl,this._workCell2=new bl,this._rectangleRenderer=this._register(new bi),this._glyphRenderer=this._register(new bi),this._onChangeTextureAtlas=this._register(new Me),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Me),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Me),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Me),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Me),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:d};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Bf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new kp(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Df(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(co(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(co(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,gl(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=vl(this._canvas,this._coreBrowserService.window,(_,m)=>this._setCanvasDevicePixelDimensions(_,m)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=vl(this._canvas,_,(m,y)=>this._setCanvasDevicePixelDimensions(m,y))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ye(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),gl(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 r of this._renderLayers)r.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,r){for(let i of this._renderLayers)i.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),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 Cp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _p(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=dc(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=Vl(At.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),At.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 r of this._renderLayers)r.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 lp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,i=this._workCell,n,s,o,a,d,l,_=0,m=!0,y,p,c,u,h,f,v,S,g;e=zl(e,r.rows-1,0),t=zl(t,r.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",w=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,E=w-r.buffer.ydisp,P=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),O=-1,F=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(s=e;s<=t;s++)for(o=s+r.buffer.ydisp,a=r.buffer.lines.get(o),this._model.lineLengths[s]=0,c=w===o,_=0,d=this._characterJoinerService.getJoinedCharacters(o),S=0;S<r.cols;S++){if(n=this._cellColorResolver.result.bg,a.loadCell(S,i),S===0&&(n=this._cellColorResolver.result.bg),l=!1,m=S>=_,y=S,d.length>0&&S===d[0][0]&&m){p=d.shift();let V=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)m&&(m=V===this._model.selection.isCellSelected(this._terminal,v,o));m&&(m=!c||P<p[0]||P>=p[1]),m?(l=!0,i=new s_(i,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),y=p[1]-1):_=p[1]}if(u=i.getChars(),h=i.getCode(),v=(s*r.cols+S)*Ts,this._cellColorResolver.resolve(i,S,o,this.dimensions.device.cell.width),F&&o===w&&(S===P&&(this._model.cursor={x:P,y:E,width:i.getWidth(),style:this._coreBrowserService.isFocused?x:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},O=P+i.getWidth()-1),S>=P&&S<=O&&(this._coreBrowserService.isFocused&&x==="block"||this._coreBrowserService.isFocused===!1&&r.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)),h!==0&&(this._model.lineLengths[s]=S+1),!(this._model.cells[v]===h&&this._model.cells[v+Ss]===this._cellColorResolver.result.bg&&this._model.cells[v+Cs]===this._cellColorResolver.result.fg&&this._model.cells[v+zn]===this._cellColorResolver.result.ext)&&(A=!0,u.length>1&&(h|=vp),this._model.cells[v]=h,this._model.cells[v+Ss]=this._cellColorResolver.result.bg,this._model.cells[v+Cs]=this._cellColorResolver.result.fg,this._model.cells[v+zn]=this._cellColorResolver.result.ext,f=i.getWidth(),this._glyphRenderer.value.updateCell(S,s,h,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,u,f,n),l)){for(i=this._workCell,S++;S<=y;S++)g=(s*r.cols+S)*Ts,this._glyphRenderer.value.updateCell(S,s,0,0,0,0,Ef,0,0),this._model.cells[g]=0,this._model.cells[g+Ss]=this._cellColorResolver.result.bg,this._model.cells[g+Cs]=this._cellColorResolver.result.fg,this._model.cells[g+zn]=this._cellColorResolver.result.ext;S--}}A&&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})}},s_=class extends Ur{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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 zl(e,t,r=0){return Math.max(Math.min(e,t),r)}var Ul="di$target",jl="di$dependencies",Xn=new Map;function Pt(e){if(Xn.has(e))return Xn.get(e);let t=function(r,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");n_(t,r,n)};return t._id=e,Xn.set(e,t),t}function n_(e,t,r){t[Ul]===t?t[jl].push({id:e,index:r}):(t[jl]=[{id:e,index:r}],t[Ul]=t)}var mb=Pt("BufferService"),gb=Pt("CoreMouseService"),vb=Pt("CoreService"),bb=Pt("CharsetService"),wb=Pt("InstantiationService"),yb=Pt("LogService"),o_=Pt("OptionsService"),Sb=Pt("OscLinkService"),Cb=Pt("UnicodeService"),xb=Pt("DecorationService"),a_={trace:0,debug:1,info:2,warn:3,error:4,off:5},l_="xterm.js: ",$l=class extends ct{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Cc=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=a_[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,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":l_)+t,...r)}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)}};$l=of([af(0,o_)],$l);var Cc;function c_(e){Cc=e}var xc=class extends ct{constructor(e){if(Jl&&kf()<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 Me),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Me),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Me),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Me),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 r=t.coreService,i=t.optionsService,n=t,s=n._renderService,o=n._characterJoinerService,a=n._charSizeService,d=n._coreBrowserService,l=n._decorationService,_=n._logService,m=n._themeService;c_(_),this._renderer=this._register(new i_(e,o,a,d,r,l,i,m,this._preserveDrawingBuffer)),this._register(At.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(At.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(At.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(At.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(Ye(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var kc=`/**
|
|
118
|
+
}`,er=8,Yn=er*Float32Array.BYTES_PER_ELEMENT,Lp=20*er,kl=class{constructor(){this.attributes=new Float32Array(Lp),this.count=0}},Zt=0,El=0,Ll=0,Tl=0,Ml=0,Rl=0,Al=0,Tp=class extends vt{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new kl,this._verticesCursor=new kl;let o=this._gl;this._program=Ke(vc(o,kp,Ep)),this._register(tt(()=>o.deleteProgram(this._program))),this._projectionLocation=Ke(o.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let s=new Float32Array([0,0,1,0,0,1,1,1]),n=o.createBuffer();this._register(tt(()=>o.deleteBuffer(n))),o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,s,o.STATIC_DRAW),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),u=o.createBuffer();this._register(tt(()=>o.deleteBuffer(u))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,a,o.STATIC_DRAW),this._attributesBuffer=Ke(o.createBuffer()),this._register(tt(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,Yn,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Yn,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,Yn,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),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,gc),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,r=this._vertices,i=1,o,s,n,a,u,l,d,m,y,_,c;for(o=0;o<t.rows;o++){for(n=-1,a=0,u=0,l=!1,s=0;s<t.cols;s++)d=(o*t.cols+s)*Bs,m=e.cells[d+Ts],y=e.cells[d+Ms],_=!!(y&67108864),(m!==a||y!==u&&(l||_))&&((a!==0||l&&u!==0)&&(c=i++*er,this._updateRectangle(r,c,u,a,n,s,o)),n=s,a=m,u=y,l=_);(a!==0||l&&u!==0)&&(c=i++*er,this._updateRectangle(r,c,u,a,n,t.cols,o))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,o=0;(r.style==="bar"||r.style==="outline")&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=o++*er,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=o++*er,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=o}_updateRectangle(e,t,r,i,o,s,n){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:Zt=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Zt=(r&16777215)<<8;break;default:Zt=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Zt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Zt=(i&16777215)<<8;break;default:Zt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=_p(e.attributes,this._terminal.rows*this._terminal.cols*er)),El=o*this._dimensions.device.cell.width,Ll=n*this._dimensions.device.cell.height,Tl=(Zt>>24&255)/255,Ml=(Zt>>16&255)/255,Rl=(Zt>>8&255)/255,Al=1,this._addRectangle(e.attributes,t,El,Ll,(s-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Tl,Ml,Rl,Al)}_addRectangle(e,t,r,i,o,s,n,a,u,l){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=n,e[t+5]=a,e[t+6]=u,e[t+7]=l}_addRectangleFloat(e,t,r,i,o,s,n){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=s/this._dimensions.device.canvas.height,e[t+4]=n[0],e[t+5]=n[1],e[t+6]=n[2],e[t+7]=n[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])}},Mp=class extends vt{constructor(e,t,r,i,o,s,n,a){super(),this._container=t,this._alpha=o,this._coreBrowserService=s,this._optionsService=n,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-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(u=>{this._refreshCharAtlas(e,u),this.reset(e)})),this._register(tt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ke(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,i=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=_c(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,r=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*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,r,i){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(e,t,r,i){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ic,this._clipCell(r,i,t.getWidth()),this._ctx.fillText(t.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,r){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,r){let i=t?e.options.fontWeightBold:e.options.fontWeight;return`${r?"italic":""} ${i} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Rp=class extends Mp{constructor(e,t,r,i,o,s,n){super(r,e,"link",t,!0,o,s,n),this._register(i.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(i.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&&up(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()}},Mt=typeof window=="object"?window:globalThis,po=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Pe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Pe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};po.INSTANCE=new po;var bc=po;function Ap(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}var e0=bc.INSTANCE.onDidChangeZoomLevel,t0=bc.INSTANCE.onDidChangeFullscreen,Zr=typeof navigator=="object"?navigator.userAgent:"",r0=Zr.indexOf("Firefox")>=0,Jn=Zr.indexOf("AppleWebKit")>=0,Dp=Zr.indexOf("Chrome")>=0,Pp=!Dp&&Zr.indexOf("Safari")>=0,i0=Zr.indexOf("Electron/")>=0,s0=Zr.indexOf("Android")>=0,Rs=!1;if(typeof Mt.matchMedia=="function"){let e=Mt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Mt.matchMedia("(display-mode: fullscreen)");Rs=e.matches,Ap(Mt,e,({matches:r})=>{Rs&&t.matches||(Rs=r)})}function Bp(){return Rs}var Yr="en",_o=!1,mo=!1,As=!1,Op=!1,wc=!1,yc=!1,Ip=!1,Np=!1,Hp=!1,Fp=!1,xs,Ds=Yr,Dl=Yr,Wp,Qt,rr=globalThis,gt;typeof rr.vscode<"u"&&typeof rr.vscode.process<"u"?gt=rr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(gt=process);var Sc=typeof gt?.versions?.electron=="string",jp=Sc&>?.type==="renderer";if(typeof gt=="object"){_o=gt.platform==="win32",mo=gt.platform==="darwin",As=gt.platform==="linux",Op=As&&!!gt.env.SNAP&&!!gt.env.SNAP_REVISION,Ip=Sc,Hp=!!gt.env.CI||!!gt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,xs=Yr,Ds=Yr;let e=gt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);xs=t.userLocale,Dl=t.osLocale,Ds=t.resolvedLanguage||Yr,Wp=t.languagePack?.translationsConfigFile}catch{}wc=!0}else typeof navigator=="object"&&!jp?(Qt=navigator.userAgent,_o=Qt.indexOf("Windows")>=0,mo=Qt.indexOf("Macintosh")>=0,Np=(Qt.indexOf("Macintosh")>=0||Qt.indexOf("iPad")>=0||Qt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,As=Qt.indexOf("Linux")>=0,Fp=Qt?.indexOf("Mobi")>=0,yc=!0,Ds=globalThis._VSCODE_NLS_LANGUAGE||Yr,xs=navigator.language.toLowerCase(),Dl=xs):console.error("Unable to resolve platform.");var Xn=0;mo?Xn=1:_o?Xn=3:As&&(Xn=2);var Zn=wc,zp=yc&&typeof rr.importScripts=="function",n0=zp?rr.origin:void 0,Wt=Qt,ur=Ds,Pl;(e=>{function t(){return ur}e.value=t;function r(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=r;function i(){return ur==="en"}e.isDefault=i})(Pl||(Pl={}));var Up=typeof rr.postMessage=="function"&&!rr.importScripts,$p=(()=>{if(Up){let e=[];rr.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let s=e[i];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),rr.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),qp=!!(Wt&&Wt.indexOf("Chrome")>=0),o0=!!(Wt&&Wt.indexOf("Firefox")>=0),a0=!!(!qp&&Wt&&Wt.indexOf("Safari")>=0),l0=!!(Wt&&Wt.indexOf("Edg/")>=0),c0=!!(Wt&&Wt.indexOf("Android")>=0),fr=typeof navigator=="object"?navigator:{},h0={clipboard:{writeText:Zn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(fr&&fr.clipboard&&fr.clipboard.writeText),readText:Zn||!!(fr&&fr.clipboard&&fr.clipboard.readText)},keyboard:Zn||Bp()?0:fr.keyboard||Pp?1:2,touch:"ontouchstart"in Mt||fr.maxTouchPoints>0,pointerEvents:Mt.PointerEvent&&("ontouchstart"in Mt||navigator.maxTouchPoints>0)},yo=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}},Qn=new yo,Bl=new yo,Ol=new yo,d0=new Array(230),Il;(e=>{function t(a){return Qn.keyCodeToStr(a)}e.toString=t;function r(a){return Qn.strToKeyCode(a)}e.fromString=r;function i(a){return Bl.keyCodeToStr(a)}e.toUserSettingsUS=i;function o(a){return Ol.keyCodeToStr(a)}e.toUserSettingsGeneral=o;function s(a){return Bl.strToKeyCode(a)||Ol.strToKeyCode(a)}e.fromUserSettings=s;function n(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 Qn.keyCodeToStr(a)}e.toElectronAccelerator=n})(Il||(Il={}));var Cc=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),Nl;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof Kp?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ft.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Cc})})(Nl||(Nl={}));var Kp=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?Cc:(this._emitter||(this._emitter=new Pe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Gp,eo;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?eo=(e,t)=>{$p(()=>{if(r)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:eo=(e,t,r)=>{let i=e.requestIdleCallback(t,typeof r=="number"?{timeout:r}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},Gp=e=>eo(globalThis,e)})();var Hl;(e=>{async function t(i){let o,s=await Promise.all(i.map(n=>n.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return s}e.settled=t;function r(i){return new Promise(async(o,s)=>{try{await i(o,s)}catch(n){s(n)}})}e.withAsyncBody=r})(Hl||(Hl={}));var Fl=class yt{static fromArray(t){return new yt(r=>{r.emitMany(t)})}static fromPromise(t){return new yt(async r=>{r.emitMany(await t)})}static fromPromises(t){return new yt(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new yt(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Pe,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 Ft.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new yt(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return yt.map(this,t)}static filter(t,r){return new yt(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return yt.filter(this,t)}static coalesce(t){return yt.filter(t,r=>!!r)}coalesce(){return yt.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return yt.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())}};Fl.EMPTY=Fl.fromArray([]);function Vp(e){return 55296<=e&&e<=56319}function Wl(e){return 56320<=e&&e<=57343}function Yp(e,t){return(e-55296<<10)+(t-56320)+65536}function Jp(e){return So(e,0)}function So(e,t){switch(typeof e){case"object":return e===null?tr(349,t):Array.isArray(e)?Zp(e,t):Qp(e,t);case"string":return xc(e,t);case"boolean":return Xp(e,t);case"number":return tr(e,t);case"undefined":return tr(937,t);default:return tr(617,t)}}function tr(e,t){return(t<<5)-t+e|0}function Xp(e,t){return tr(e?433:863,t)}function xc(e,t){t=tr(149417,t);for(let r=0,i=e.length;r<i;r++)t=tr(e.charCodeAt(r),t);return t}function Zp(e,t){return t=tr(104579,t),e.reduce((r,i)=>So(i,r),t)}function Qp(e,t){return t=tr(181387,t),Object.keys(e).sort().reduce((r,i)=>(r=xc(i,r),So(e[i],r)),t)}function to(e,t,r=32){let i=r-t,o=~((1<<i)-1);return(e<<t|(o&e)>>>i)>>>0}function jl(e,t=0,r=e.byteLength,i=0){for(let o=0;o<r;o++)e[t+o]=i}function e_(e,t,r="0"){for(;e.length<t;)e=r+e;return e}function Ti(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""):e_((e>>>0).toString(16),t/4)}var t_=class kc{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 r=t.length;if(r===0)return;let i=this._buff,o=this._buffLen,s=this._leftoverHighSurrogate,n,a;for(s!==0?(n=s,a=-1,s=0):(n=t.charCodeAt(0),a=0);;){let u=n;if(Vp(n))if(a+1<r){let l=t.charCodeAt(a+1);Wl(l)?(a++,u=Yp(n,l)):u=65533}else{s=n;break}else Wl(n)&&(u=65533);if(o=this._push(i,o,u),a++,a<r)n=t.charCodeAt(a);else break}this._buffLen=o,this._leftoverHighSurrogate=s}_push(t,r,i){return i<128?t[r++]=i:i<2048?(t[r++]=192|(i&1984)>>>6,t[r++]=128|(i&63)>>>0):i<65536?(t[r++]=224|(i&61440)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0):(t[r++]=240|(i&1835008)>>>18,t[r++]=128|(i&258048)>>>12,t[r++]=128|(i&4032)>>>6,t[r++]=128|(i&63)>>>0),r>=64&&(this._step(),r-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),r}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()),Ti(this._h0)+Ti(this._h1)+Ti(this._h2)+Ti(this._h3)+Ti(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,jl(this._buff,this._buffLen),this._buffLen>56&&(this._step(),jl(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=kc._bigBlock32,r=this._buffDV;for(let m=0;m<64;m+=4)t.setUint32(m,r.getUint32(m,!1),!1);for(let m=64;m<320;m+=4)t.setUint32(m,to(t.getUint32(m-12,!1)^t.getUint32(m-32,!1)^t.getUint32(m-56,!1)^t.getUint32(m-64,!1),1),!1);let i=this._h0,o=this._h1,s=this._h2,n=this._h3,a=this._h4,u,l,d;for(let m=0;m<80;m++)m<20?(u=o&s|~o&n,l=1518500249):m<40?(u=o^s^n,l=1859775393):m<60?(u=o&s|o&n|s&n,l=2400959708):(u=o^s^n,l=3395469782),d=to(i,5)+u+a+l+t.getUint32(m*4,!1)&4294967295,a=n,n=s,s=to(o,30),o=i,i=d;this._h0=this._h0+i&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+n&4294967295,this._h4=this._h4+a&4294967295}};t_._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:u0,getWindow:r_,getDocument:f0,getWindows:p0,getWindowsCount:_0,getWindowId:zl,getWindowById:m0,hasWindow:g0,onDidRegisterWindow:v0,onWillUnregisterWindow:b0,onDidUnregisterWindow:w0}=(function(){let e=new Map,t={window:Mt,disposables:new Jr};e.set(Mt.vscodeWindowId,t);let r=new Pe,i=new Pe,o=new Pe;function s(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:i.event,registerWindow(n){if(e.has(n.vscodeWindowId))return vt.None;let a=new Jr,u={window:n,disposables:a.add(new Jr)};return e.set(n.vscodeWindowId,u),a.add(tt(()=>{e.delete(n.vscodeWindowId),i.fire(n)})),a.add(go(n,n_.BEFORE_UNLOAD,()=>{o.fire(n)})),r.fire(u),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:s,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let u=n;return u?.view?u.view.window:Mt},getDocument(n){return r_(n).document}}})(),i_=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!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 go(e,t,r,i){return new i_(e,t,r,i)}var s_,Ul,ro=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){ks(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,o=s=>{r.set(s,!1);let n=e.get(s)??[];for(t.set(s,n),e.set(s,[]),i.set(s,!0);n.length>0;)n.sort(ro.sort),n.shift().execute();i.set(s,!1)};Ul=(s,n,a=0)=>{let u=zl(s),l=new ro(n,a),d=e.get(u);return d||(d=[],e.set(u,d)),d.push(l),r.get(u)||(r.set(u,!0),s.requestAnimationFrame(()=>o(u))),l},s_=(s,n,a)=>{let u=zl(s);if(i.get(u)){let l=new ro(n,a),d=t.get(u);return d||(d=[],t.set(u,d)),d.push(l),l}else return Ul(s,n,a)}})();var $l=class Ps{constructor(t,r){this.width=t,this.height=r}with(t=this.width,r=this.height){return t!==this.width||r!==this.height?new Ps(t,r):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Ps?t:new Ps(t.width,t.height)}static equals(t,r){return t===r?!0:!t||!r?!1:t.width===r.width&&t.height===r.height}};$l.None=new $l(0,0);var y0=new class{constructor(){this.mutationObservers=new Map}observe(e,t,r){let i=this.mutationObservers.get(e);i||(i=new Map,this.mutationObservers.set(e,i));let o=Jp(r),s=i.get(o);if(s)s.users+=1;else{let n=new Pe,a=new MutationObserver(l=>n.fire(l));a.observe(e,r);let u=s={users:1,observer:a,onDidMutate:n.event};t.add(tt(()=>{u.users-=1,u.users===0&&(n.dispose(),a.disconnect(),i?.delete(o),i?.size===0&&this.mutationObservers.delete(e))})),i.set(o,s)}return s.onDidMutate}},n_={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:Jn?"webkitAnimationStart":"animationstart",ANIMATION_END:Jn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Jn?"webkitAnimationIteration":"animationiteration"},o_=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Ec(e,t,r,...i){let o=o_.exec(t);if(!o)throw new Error("Bad use of emmet");let s=o[1]||"div",n;return e!=="http://www.w3.org/1999/xhtml"?n=document.createElementNS(e,s):n=document.createElement(s),o[3]&&(n.id=o[3]),o[4]&&(n.className=o[4].replace(/\./g," ").trim()),r&&Object.entries(r).forEach(([a,u])=>{typeof u>"u"||(/^on\w+$/.test(a)?n[a]=u:a==="selected"?u&&n.setAttribute(a,"true"):n.setAttribute(a,u))}),n.append(...i),n}function a_(e,t,...r){return Ec("http://www.w3.org/1999/xhtml",e,t,...r)}a_.SVG=function(e,t,...r){return Ec("http://www.w3.org/2000/svg",e,t,...r)};var l_=class extends vt{constructor(e,t,r,i,o,s,n,a,u){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=i,this._coreService=o,this._decorationService=s,this._optionsService=n,this._themeService=a,this._cursorBlinkStateManager=new xi,this._charAtlasDisposable=this._register(new xi),this._observerDisposable=this._register(new xi),this._model=new xp,this._workCell=new Cl,this._workCell2=new Cl,this._rectangleRenderer=this._register(new xi),this._glyphRenderer=this._register(new xi),this._onChangeTextureAtlas=this._register(new Pe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Pe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Pe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Pe),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Pe),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:u};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Ff(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Rp(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,n,this._themeService)],this.dimensions=Nf(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(n.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(go(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this._register(go(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,yl(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Sl(this._canvas,this._coreBrowserService.window,(d,m)=>this._setCanvasDevicePixelDimensions(d,m)),this._register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=Sl(this._canvas,d,(m,y)=>this._setCanvasDevicePixelDimensions(m,y))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(tt(()=>{for(let d of this._renderLayers)d.dispose();this._canvas.parentElement?.removeChild(this._canvas),yl(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 r of this._renderLayers)r.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,r){for(let i of this._renderLayers)i.handleSelectionChanged(this._terminal,e,t,r);this._model.selection.update(this._core,e,t,r),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 Tp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new wp(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=_c(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=Zl(Ft.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ft.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 r of this._renderLayers)r.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 fp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,i=this._workCell,o,s,n,a,u,l,d=0,m=!0,y,_,c,f,h,p,v,S,b;e=ql(e,r.rows-1,0),t=ql(t,r.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",w=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,E=w-r.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),P=-1,W=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(s=e;s<=t;s++)for(n=s+r.buffer.ydisp,a=r.buffer.lines.get(n),this._model.lineLengths[s]=0,c=w===n,d=0,u=this._characterJoinerService.getJoinedCharacters(n),S=0;S<r.cols;S++){if(o=this._cellColorResolver.result.bg,a.loadCell(S,i),S===0&&(o=this._cellColorResolver.result.bg),l=!1,m=S>=d,y=S,u.length>0&&S===u[0][0]&&m){_=u.shift();let V=this._model.selection.isCellSelected(this._terminal,_[0],n);for(v=_[0]+1;v<_[1];v++)m&&(m=V===this._model.selection.isCellSelected(this._terminal,v,n));m&&(m=!c||B<_[0]||B>=_[1]),m?(l=!0,i=new c_(i,a.translateToString(!0,_[0],_[1]),_[1]-_[0]),y=_[1]-1):d=_[1]}if(f=i.getChars(),h=i.getCode(),v=(s*r.cols+S)*Bs,this._cellColorResolver.resolve(i,S,n,this.dimensions.device.cell.width),W&&n===w&&(S===B&&(this._model.cursor={x:B,y:E,width:i.getWidth(),style:this._coreBrowserService.isFocused?x:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},P=B+i.getWidth()-1),S>=B&&S<=P&&(this._coreBrowserService.isFocused&&x==="block"||this._coreBrowserService.isFocused===!1&&r.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)),h!==0&&(this._model.lineLengths[s]=S+1),!(this._model.cells[v]===h&&this._model.cells[v+Ts]===this._cellColorResolver.result.bg&&this._model.cells[v+Ms]===this._cellColorResolver.result.fg&&this._model.cells[v+Vn]===this._cellColorResolver.result.ext)&&(A=!0,f.length>1&&(h|=Cp),this._model.cells[v]=h,this._model.cells[v+Ts]=this._cellColorResolver.result.bg,this._model.cells[v+Ms]=this._cellColorResolver.result.fg,this._model.cells[v+Vn]=this._cellColorResolver.result.ext,p=i.getWidth(),this._glyphRenderer.value.updateCell(S,s,h,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,f,p,o),l)){for(i=this._workCell,S++;S<=y;S++)b=(s*r.cols+S)*Bs,this._glyphRenderer.value.updateCell(S,s,0,0,0,0,Af,0,0),this._model.cells[b]=0,this._model.cells[b+Ts]=this._cellColorResolver.result.bg,this._model.cells[b+Ms]=this._cellColorResolver.result.fg,this._model.cells[b+Vn]=this._cellColorResolver.result.ext;S--}}A&&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})}},c_=class extends Vr{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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 ql(e,t,r=0){return Math.max(Math.min(e,t),r)}var Kl="di$target",Gl="di$dependencies",io=new Map;function jt(e){if(io.has(e))return io.get(e);let t=function(r,i,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h_(t,r,o)};return t._id=e,io.set(e,t),t}function h_(e,t,r){t[Kl]===t?t[Gl].push({id:e,index:r}):(t[Gl]=[{id:e,index:r}],t[Kl]=t)}var S0=jt("BufferService"),C0=jt("CoreMouseService"),x0=jt("CoreService"),k0=jt("CharsetService"),E0=jt("InstantiationService"),L0=jt("LogService"),d_=jt("OptionsService"),T0=jt("OscLinkService"),M0=jt("UnicodeService"),R0=jt("DecorationService"),u_={trace:0,debug:1,info:2,warn:3,error:4,off:5},f_="xterm.js: ",Vl=class extends vt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Lc=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=u_[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,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":f_)+t,...r)}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)}};Vl=df([uf(0,d_)],Vl);var Lc;function p_(e){Lc=e}var Tc=class extends vt{constructor(e){if(tc&&Rf()<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 Pe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Pe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Pe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Pe),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 r=t.coreService,i=t.optionsService,o=t,s=o._renderService,n=o._characterJoinerService,a=o._charSizeService,u=o._coreBrowserService,l=o._decorationService,d=o._logService,m=o._themeService;p_(d),this._renderer=this._register(new l_(e,n,a,u,r,l,i,m,this._preserveDrawingBuffer)),this._register(Ft.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ft.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ft.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ft.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),s.setRenderer(this._renderer),this._register(tt(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var Mc=`/**
|
|
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 Rc=`/* eslint-disable */
|
|
337
337
|
/**
|
|
338
338
|
* @hyzyn/dsh-tty \u2014 \u9762\u677F\u6837\u5F0F\u8868\u3002
|
|
339
339
|
*
|
|
@@ -2226,20 +2226,49 @@ void main() {
|
|
|
2226
2226
|
backdrop-filter: blur(3px);
|
|
2227
2227
|
animation: ttFadeIn .16s var(--tt-ease);
|
|
2228
2228
|
}
|
|
2229
|
+
/*
|
|
2230
|
+
* \u5361\u7247\u672C\u8EAB**\u4E0D\u518D\u662F\u6EDA\u52A8\u5BB9\u5668**\uFF080.31.0\uFF09\uFF1A\u6539\u6210\u5934 / \u8EAB / \u5C3E\u4E09\u6BB5\uFF0C\u53EA\u6709 \`.tt_sshBody\` \u6EDA\u3002
|
|
2231
|
+
* \u6B64\u524D \`overflow-y: auto\` \u5199\u5728\u5361\u7247\u4E0A\uFF0C\u6807\u9898\u4E0E\u5E95\u90E8\u52A8\u4F5C\u884C\u4F1A\u8DDF\u7740\u5185\u5BB9\u4E00\u8D77\u6EDA\u8D70\u2014\u2014\u5B9E\u6D4B
|
|
2232
|
+
* 1680\xD71050 \u4E0B\u6253\u5F00\u8FDE\u63A5\u5BF9\u8BDD\u6846\uFF0C\u5E95\u90E8\u90A3\u9897\u300C\u8FDE\u63A5\u300D\u521D\u59CB\u6839\u672C\u4E0D\u5728\u89C6\u53E3\u91CC\u3002
|
|
2233
|
+
* \u4E09\u6BB5\u7684\u5185\u8FB9\u8DDD / \u95F4\u8DDD\u6CBF\u7528\u6539\u7248\u524D\u7684\u503C\uFF0820px \u5916\u8FB9\u8DDD\u300111px \u884C\u8DDD\uFF09\uFF0C\u53EA\u6709\u6EDA\u52A8\u5F52\u5C5E\u53D8\u4E86\u3002
|
|
2234
|
+
*/
|
|
2229
2235
|
.tt_sshCard {
|
|
2230
2236
|
display: flex;
|
|
2231
2237
|
flex-direction: column;
|
|
2232
|
-
gap: 11px;
|
|
2233
2238
|
width: min(460px, 92vw);
|
|
2234
2239
|
max-height: 86vh;
|
|
2235
|
-
padding:
|
|
2236
|
-
overflow
|
|
2240
|
+
padding: 0;
|
|
2241
|
+
overflow: hidden;
|
|
2237
2242
|
border: 0;
|
|
2238
2243
|
border-radius: var(--tt-r-2xl);
|
|
2239
2244
|
color: var(--tt-label);
|
|
2240
2245
|
box-shadow: var(--dsw-elevation-prominent);
|
|
2241
2246
|
animation: ttModalIn .18s var(--tt-ease);
|
|
2242
2247
|
}
|
|
2248
|
+
.tt_sshHead {
|
|
2249
|
+
flex: none;
|
|
2250
|
+
/* \u5E95\u90E8\u7559\u4E00\u6863\u884C\u8DDD\uFF1A\u4E2D\u6BB5\u6EDA\u52A8\u65F6\u5185\u5BB9\u5728\u79BB\u6807\u9898 11px \u5904\u88AB\u88C1\uFF0C\u4E0D\u4F1A\u8D34\u7740\u6807\u9898 */
|
|
2251
|
+
padding: 20px 20px 11px;
|
|
2252
|
+
}
|
|
2253
|
+
/* \u552F\u4E00\u7684\u6EDA\u52A8\u533A\uFF1A\`min-height: 0\` \u662F flex \u5B50\u9879\u80FD\u88AB\u538B\u7F29\u7684\u524D\u63D0\uFF08\u5426\u5219\u5185\u5BB9\u4F1A\u628A\u5361\u7247\u9876\u51FA max-height\uFF09 */
|
|
2254
|
+
.tt_sshBody {
|
|
2255
|
+
flex: 1 1 auto;
|
|
2256
|
+
min-height: 0;
|
|
2257
|
+
display: flex;
|
|
2258
|
+
flex-direction: column;
|
|
2259
|
+
gap: 11px;
|
|
2260
|
+
padding: 0 20px 11px;
|
|
2261
|
+
overflow-y: auto;
|
|
2262
|
+
/* \u6EDA\u5230\u5E95\u4E0D\u8981\u628A\u6EDA\u52A8\u94FE\u4F20\u7ED9\u5916\u5C42\uFF08\u9762\u677F/\u5BBF\u4E3B\u9875\u9762\uFF09\uFF0C\u5426\u5219\u5BF9\u8BDD\u6846\u91CC\u6EDA\u4E00\u4E0B\u6574\u9875\u8DDF\u7740\u52A8 */
|
|
2263
|
+
overscroll-behavior: contain;
|
|
2264
|
+
}
|
|
2265
|
+
.tt_sshFoot {
|
|
2266
|
+
flex: none;
|
|
2267
|
+
display: flex;
|
|
2268
|
+
flex-direction: column;
|
|
2269
|
+
gap: 11px;
|
|
2270
|
+
padding: 0 20px 20px;
|
|
2271
|
+
}
|
|
2243
2272
|
.tt_sshTitle {
|
|
2244
2273
|
display: flex;
|
|
2245
2274
|
align-items: center;
|
|
@@ -2270,10 +2299,10 @@ void main() {
|
|
|
2270
2299
|
* \uFF08\`.tt_routeList\` / \`.tt_shellList\`\uFF0C\`position: fixed\` + placePopover\uFF0C\u89C1\u4E0B\uFF09\uFF0C\u90A3\u8FB9\u7531 JS \u9010\u6B21
|
|
2271
2300
|
* \u5B9A\u4F4D\u3001\u5929\u7136\u9003\u51FA\u5361\u7247\u7684 overflow\uFF0C\u4E0E\u8FD9\u91CC\u7684 absolute \u7248\u5404\u7BA1\u4E00\u5904\uFF0C\u522B\u4E00\u8D77\u6539\u3002
|
|
2272
2301
|
*
|
|
2273
|
-
* \u5DF2\u77E5\u8FB9\u754C\uFF1A\
|
|
2274
|
-
* \uFF08\u79C1\u94A5\u53E3\u4EE4 / \u5BC6\u7801\uFF09\u90FD\u5728\u5BF9\u8BDD\u6846\u4E2D\u6BB5\uFF0C180px \u653E\u5F97\u4E0B\uFF1B\u771F\u9047\u5230\u8D34\u5E95\u7684\u4F4D\u7F6E\uFF0C\u518D\u6539\u6210
|
|
2275
|
-
* + \`getBoundingClientRect()\` \u5B9A\u4F4D\u2014\u2014\u90A3\u53CD\u800C\u5929\u7136\u9003\u51FA\
|
|
2276
|
-
* \`backdrop-filter\`\uFF0Cfixed \u4F1A\u4EE5\u5B83\u4E3A\u5305\u542B\u5757\uFF09\u3002
|
|
2302
|
+
* \u5DF2\u77E5\u8FB9\u754C\uFF1A\u6EDA\u52A8\u533A\u662F \`.tt_sshBody\`\uFF080.31.0 \u8D77\u5361\u7247\u672C\u8EAB\u4E0D\u518D\u6EDA\uFF09\uFF0C\u6D6E\u5C42\u5982\u679C\u8D34\u5230\u5B83\u7684\u4E0B\u7F18\u4F1A\u88AB\u88C1\u3002
|
|
2303
|
+
* \u5F53\u524D\u4E24\u4E2A\u9009\u62E9\u5668\uFF08\u79C1\u94A5\u53E3\u4EE4 / \u5BC6\u7801\uFF09\u90FD\u5728\u5BF9\u8BDD\u6846\u4E2D\u6BB5\uFF0C180px \u653E\u5F97\u4E0B\uFF1B\u771F\u9047\u5230\u8D34\u5E95\u7684\u4F4D\u7F6E\uFF0C\u518D\u6539\u6210
|
|
2304
|
+
* \`position: fixed\` + \`getBoundingClientRect()\` \u5B9A\u4F4D\u2014\u2014\u90A3\u53CD\u800C\u5929\u7136\u9003\u51FA\u6EDA\u52A8\u533A\u7684 overflow
|
|
2305
|
+
* \uFF08backdrop \u6709 \`backdrop-filter\`\uFF0Cfixed \u4F1A\u4EE5\u5B83\u4E3A\u5305\u542B\u5757\uFF09\u3002
|
|
2277
2306
|
*/
|
|
2278
2307
|
.tt_sshRow > .tt_envList {
|
|
2279
2308
|
position: absolute;
|
|
@@ -2339,6 +2368,77 @@ void main() {
|
|
|
2339
2368
|
grid-template-columns: 1fr 112px;
|
|
2340
2369
|
gap: 11px;
|
|
2341
2370
|
}
|
|
2371
|
+
/*
|
|
2372
|
+
* \u300C\u9AD8\u7EA7\u300D\u6298\u53E0\u533A\uFF080.31.0\uFF09\uFF1A\u8DF3\u677F\u673A / \u4EE3\u7406\u547D\u4EE4 / \u4E3B\u673A\u5BC6\u94A5\u522B\u540D\u4E09\u6BB5\u5728\u6761\u76EE\u91CC\u6CA1\u914D\u8FC7\u65F6\u9ED8\u8BA4\u6536\u8D77\uFF0C
|
|
2373
|
+
* \u628A\u5E38\u7528\u5B57\u6BB5\uFF08\u4E3B\u673A / \u7528\u6237\u540D / \u8BA4\u8BC1 / \u4FDD\u5B58\uFF09\u7559\u5728\u9996\u5C4F\u3002
|
|
2374
|
+
*
|
|
2375
|
+
* \u5B83\u662F**\u62AB\u9732\u63A7\u4EF6**\uFF08chevron + \u6807\u9898 + \u5143\u4FE1\u606F\uFF09\uFF0C\u4E0D\u662F\u6309\u94AE\u65CF\u7684\u53D8\u4F53\u2014\u2014\u6240\u4EE5\u7C7B\u540D\u4E0D\u5E26 \`btn\` \u6807\u8BB0\uFF0C
|
|
2376
|
+
* \u514D\u5F97\u88AB\u68C0\u67E5\u5341\u4E8C\u5F53\u6210 \`.tt_toolBtn\` \u7684\u5E76\u5217\u53D8\u4F53\u53BB\u6BD4\u5C3A\u5BF8\uFF1B\u51E0\u4F55\u6309\u5BBF\u4E3B\u7684\u300C\u5B57\u6BB5\u6807\u7B7E\u300D\u89D2\u8272\u53D6
|
|
2377
|
+
* \uFF0812px / 18px / 500\uFF09\uFF0C\u70B9\u51FB\u76EE\u6807\u9AD8\u5EA6\u4E0E\u540C\u680F\u8F93\u5165\u6846\u5BF9\u9F50\u3002
|
|
2378
|
+
*/
|
|
2379
|
+
.tt_sshAdvToggle {
|
|
2380
|
+
display: flex;
|
|
2381
|
+
align-items: center;
|
|
2382
|
+
gap: var(--tt-gap-sm);
|
|
2383
|
+
width: 100%;
|
|
2384
|
+
height: var(--tt-h-lg);
|
|
2385
|
+
margin: 0;
|
|
2386
|
+
padding: 0;
|
|
2387
|
+
border: 0;
|
|
2388
|
+
background: 0 0;
|
|
2389
|
+
color: var(--tt-label-2);
|
|
2390
|
+
font: inherit;
|
|
2391
|
+
font-size: 12px;
|
|
2392
|
+
line-height: 18px;
|
|
2393
|
+
font-weight: 500;
|
|
2394
|
+
text-align: left;
|
|
2395
|
+
cursor: pointer;
|
|
2396
|
+
}
|
|
2397
|
+
.tt_sshAdvToggle:hover {
|
|
2398
|
+
color: var(--tt-label);
|
|
2399
|
+
}
|
|
2400
|
+
.tt_sshAdvToggle:focus-visible {
|
|
2401
|
+
outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
2402
|
+
border-radius: var(--tt-r-xs);
|
|
2403
|
+
}
|
|
2404
|
+
/*
|
|
2405
|
+
* \u5C55\u5F00\u56FE\u6807\uFF1A16px \u56FE\u6807\u76D2\u91CC\u653E 14px \u7684\u5C16\u62EC\u53F7\uFF0C\u4E0E\u5BBF\u4E3B disclosure \u7684 leading \u540C\u6B3E
|
|
2406
|
+
* \uFF08\`DisclosureRow.module.css\`\uFF1A\u76D2\u5B50 \`16px\`\u3001\`svg { width/height: 14px }\`\uFF09\u3002
|
|
2407
|
+
* \u5F62\u72B6\u662F**\u5BBF\u4E3B\u7684**\u90A3\u4E00\u5BF9\u63CF\u8FB9\u5C16\u62EC\u53F7\uFF08\u6536\u8D77\u53F3 / \u5C55\u5F00\u4E0B\uFF0C\u89C1 index.js \u7684 ICON_CHEVRON_*\uFF09\uFF0C
|
|
2408
|
+
* \u6240\u4EE5\u8FD9\u91CC\u4E0D\u5199 transform \u65CB\u8F6C\u2014\u2014\u76F4\u63A5\u6362\u56FE\u6807\uFF0C\u4E0E\u5B98\u65B9 provider \u5361\u7247\u7684\u884C\u4E3A\u4E00\u81F4\u3002
|
|
2409
|
+
*/
|
|
2410
|
+
.tt_sshAdvChevron {
|
|
2411
|
+
display: inline-flex;
|
|
2412
|
+
align-items: center;
|
|
2413
|
+
justify-content: center;
|
|
2414
|
+
flex: none;
|
|
2415
|
+
width: 16px;
|
|
2416
|
+
height: 16px;
|
|
2417
|
+
color: var(--tt-label-3);
|
|
2418
|
+
}
|
|
2419
|
+
.tt_sshAdvText {
|
|
2420
|
+
flex: none;
|
|
2421
|
+
}
|
|
2422
|
+
/* \u300C\u91CC\u9762\u914D\u4E86\u4EC0\u4E48 / \u8FD9\u4E00\u6BB5\u662F\u5E72\u4EC0\u4E48\u7684\u300D\uFF1A\u53F3\u5BF9\u9F50\u7070\u5B57\uFF0C\u957F\u4E86\u4E00\u884C\u7701\u7565 */
|
|
2423
|
+
.tt_sshAdvMeta {
|
|
2424
|
+
flex: 1 1 auto;
|
|
2425
|
+
min-width: 0;
|
|
2426
|
+
overflow: hidden;
|
|
2427
|
+
white-space: nowrap;
|
|
2428
|
+
text-overflow: ellipsis;
|
|
2429
|
+
color: var(--tt-label-3);
|
|
2430
|
+
font-weight: 400;
|
|
2431
|
+
text-align: right;
|
|
2432
|
+
}
|
|
2433
|
+
.tt_sshAdvBody {
|
|
2434
|
+
display: flex;
|
|
2435
|
+
flex-direction: column;
|
|
2436
|
+
gap: 11px;
|
|
2437
|
+
}
|
|
2438
|
+
/* \u7528 hidden \u5C5E\u6027\u63A7\u663E\u9690\u65F6\uFF0C\u522B\u88AB\u4E0A\u9762\u7684 display: flex \u76D6\u6389 */
|
|
2439
|
+
.tt_sshAdvBody[hidden] {
|
|
2440
|
+
display: none;
|
|
2441
|
+
}
|
|
2342
2442
|
.tt_sshActions {
|
|
2343
2443
|
display: flex;
|
|
2344
2444
|
align-items: center;
|
|
@@ -3662,8 +3762,8 @@ void main() {
|
|
|
3662
3762
|
transition: none !important;
|
|
3663
3763
|
}
|
|
3664
3764
|
}
|
|
3665
|
-
`;function mo(e){let t=typeof e=="string"?e.trim():"";if(t==="")return;let r=t,i="",n=r.lastIndexOf("@");n>0&&(i=r.slice(0,n).trim(),r=r.slice(n+1).trim());let s=r,o=22,a=/^\[([^\]]+)\](?::(\d+))?$/.exec(r)??/^([^:]+):(\d+)$/.exec(r);if(a!==null){s=a[1];let l=Number(a[2]);Number.isInteger(l)&&l>=1&&l<=65535&&(o=l)}if(s==="")return;let d={host:s,port:o};return i!==""&&(d.username=i),d}function go(e){if(e===null||typeof e!="object")return"";let t=e,r=typeof t.host=="string"?t.host.trim():"";if(r==="")return"";let i=Number.isInteger(t.port)&&Number(t.port)>=1&&Number(t.port)<=65535?Number(t.port):22,n=typeof t.username=="string"&&t.username.trim()!==""?t.username.trim()+"@":"",s=r.includes(":")&&!r.startsWith("[")?`[${r}]`:r;return`${n}${s}${i===22?"":":"+String(i)}`}var vo="\0global";function Gr(e,t){return e===null?vo:typeof e=="string"&&e!==""?e:typeof t=="string"&&t!==""?t:vo}function bo(e,t){return e===vo?!0:typeof t=="string"&&t!==""&&e===t}var u_="/api/dsh-tty/ws";function Lc(e,t){let r=new URL(t??e,e);return(r.protocol==="https:"?"wss:":"ws:")+"//"+r.host+u_}function wo(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Tc(e,t,r,i){let n=wo(r),s=wo(e);if(n===""||s==="")return"";let o=wo(t),a=["DSH_TTY",n,s];return o!==""&&o!=="22"&&a.push(o),a.push(i),a.join("_")}function As(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=65535?t:0}function Mc(e,t,r){return`${e}-${t==="remote"?"R":"L"}${String(r)}`}function Rc(e,t=[],r=i=>i){let i=e??{},n=String(i.bookName??"")||String(t[0]??"")||"";if(n==="")return{ok:!1,error:r("error.tunnelNoBook")};if(i.direction==="remote"){let d=As(i.remotePort),l=As(i.localTargetPort);return d<1||l<1?{ok:!1,error:r("error.tunnelRemotePortRequired")}:{ok:!0,tunnel:{name:Mc(n,"remote",d),bookName:n,direction:"remote",remotePort:d,localTargetHost:"",localTargetPort:l,enabled:!0}}}let s=As(i.localPort),o=String(i.remoteHost??"").trim(),a=As(i.remotePort);return s<1||o===""||a<1?{ok:!1,error:r("error.tunnelLocalRequired")}:{ok:!0,tunnel:{name:Mc(n,"local",s),bookName:n,direction:"local",localPort:s,remoteHost:o,remotePort:a,enabled:!0}}}function Ac(e,t){return(Array.isArray(e)?e:[]).find(r=>String(r?.name??"")===String(t))}function f_(e,t,r){return(Array.isArray(e)?e:[]).find(i=>String(i?.name??"")!==String(t)&&String(i?.name??"")===String(r))}function Dc(e,t,r,i){let n=Array.isArray(e)?e:[],s=n.find(d=>String(d?.name??"")===String(t));if(s===void 0)return{ok:!1,reason:"missing",error:i("error.tunnelMissing",{name:String(t)})};if(f_(n,t,r.name)!==void 0)return{ok:!1,reason:"clash",error:i("error.tunnelClash",{name:String(r.name)})};let a={...r,enabled:s.enabled!==!1};return{ok:!0,tunnels:n.map(d=>String(d?.name??"")===String(t)?a:d)}}function p_(e){let t=e?.byId;if(!(t===null||typeof t!="object"))for(let r of Object.keys(t)){let i=t[r]?.retainedBy?.mainView??0;if(typeof i=="number"&&i>0)return r}}function __(e){let t=e?.current;return typeof t=="string"&&t!==""?t:p_(e)}function Pc(e){let t=__(e);if(t===void 0)return;let r=e?.byId?.[t]?.cwd;return typeof r=="string"&&r!==""?r:void 0}function m_(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0}function Bc(e,t){if(e==null)return;let r=Math.floor(Number(e.cols)),i=Math.floor(Number(e.rows));if(!(!Number.isFinite(r)||!Number.isFinite(i))&&!(r<20||i<3)&&!(t==null||!m_(Number(t.width),Number(t.height))))return{cols:Math.min(500,r),rows:Math.min(200,i)}}function Oc(e){return e!==null&&typeof e=="object"&&e.exited!==!0}function Ic(e){if(!Array.isArray(e))return 0;let t=0;for(let r of e)Oc(r)&&(t+=1);return t}function yo(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)Oc(r)&&typeof r.sid=="string"&&r.sid!==""&&t.add(r.sid);return t}function Nc(e){let t=new Set,r=new Set,i=new Set;if(!Array.isArray(e))return{present:t,retained:r,live:i};for(let n of e){if(n===null||typeof n!="object")continue;let s=typeof n.sid=="string"?n.sid:"";s!==""&&(t.add(s),n.exited===!0?r.add(s):i.add(s))}return{present:t,retained:r,live:i}}function Hc(e,t){if(e===null||typeof e!="object"||e.agentOwned!==!0||e.embedded===!0)return"keep";let r=typeof e.sid=="string"?e.sid:"";return r===""||t===null||typeof t!="object"?"keep":t.present.has(r)?t.retained.has(r)?"mark-exited":"keep":"remove"}function Fc(e){let t={live:0,agentLive:0,confirm:!1};if(e==null||typeof e[Symbol.iterator]!="function")return t;let r=0,i=0;for(let n of e)n===null||typeof n!="object"||n.embedded!==!0&&n.exited!==!0&&(r+=1,n.agentOwned===!0&&(i+=1));return{live:r,agentLive:i,confirm:r>0}}var Ds=Object.freeze({sids:[],live:0,agentLive:0,confirm:!1});function Wc(e){let t=[];if(e==null||typeof e[Symbol.iterator]!="function")return t;for(let r of e){if(r===null||typeof r!="object"||r.embedded===!0)continue;let i=r.sid;typeof i!="string"||i===""||t.push({sid:i,exited:r.exited===!0,agentOwned:r.agentOwned===!0})}return t}function zc(e){return Wc(e).length}function Ps(e){let t=e.map(i=>i.sid),r=e.filter(i=>i.exited!==!0);return{sids:t,live:r.length,agentLive:r.filter(i=>i.agentOwned===!0).length,confirm:r.length>=2}}function Uc(e,t){let r=Wc(e);if(r.length===0)return{others:Ds,left:Ds,right:Ds,exited:Ds};let i=typeof t=="string"?t:"",n=r.findIndex(s=>s.sid===i);return{others:Ps(n<0?r:r.filter(s=>s.sid!==i)),left:Ps(n<0?[]:r.slice(0,n)),right:Ps(n<0?[]:r.slice(n+1)),exited:Ps(r.filter(s=>s.exited===!0))}}function vr(e){return e!==null&&typeof e=="object"&&e.hidden===!0}function So(e){return!(e===null||typeof e!="object"||e.agentOwned===!0||e.embedded===!0)}function Co(e,t){let r=e!==null&&typeof e=="object"?{...e}:{};return t===!0?(r.hidden=!0,r):(delete r.hidden,r)}function jc(e){return e===!0?"btn.showToAgent":"btn.hideFromAgent"}function $c(e){let t=Number(e?.received),r=Number(e?.attempt),i=Number.isInteger(e?.maxAttempts)?e.maxAttempts:3,n=e?.total===null||e?.total===void 0?null:Number(e.total);return e?.canceled===!0?{resume:!1,reason:"canceled"}:!Number.isFinite(t)||t<=0?{resume:!1,reason:"noProgress"}:!Number.isInteger(r)||r<1?{resume:!1,reason:"badAttempt"}:r>i?{resume:!1,reason:"attemptsExhausted"}:n!==null&&Number.isFinite(n)&&n>0&&t>=n?{resume:!1,reason:"complete"}:{resume:!0,offset:t}}function g_(e){return typeof e!="string"||e===""||e==="."||e===".."?!1:e.startsWith(".")}function Bs(e,t){let i=(Array.isArray(e)?e:[]).filter(n=>n!==null&&typeof n=="object"&&typeof n.name=="string"&&n.name!=="");return t===!0?i:i.filter(n=>!g_(n.name))}function qc(e,t){return e!=="remote"?{accept:!1,reason:"wrongPane"}:(Array.isArray(t?.types)?t.types:[]).includes("Files")?Number(t?.files?.length??0)>0?{accept:!0}:{accept:!1,reason:"empty"}:{accept:!1,reason:"notFiles"}}function Kc(e){let t=new Set;for(let r of Array.isArray(e)?e:[]){let i=typeof r?.relPath=="string"?r.relPath:"",n=i.lastIndexOf("/");n<=0||t.add(i.slice(0,n))}return[...t].sort((r,i)=>r.split("/").length-i.split("/").length||r.localeCompare(i))}function Gc(e,t){return e==null?{text:"",state:""}:e.exited===!0?{text:e.statusText??t("status.exited"),state:e.statusState??""}:e.live===!0?{text:e.statusText??t("status.connected"),state:e.statusState??"connected"}:e.errored===!0?{text:e.statusText??t("status.errored"),state:e.statusState??"error"}:{text:e.statusText??t("status.connectingEllipsis"),state:e.statusState??""}}function Vc(e,t){return typeof e!="string"||e===""?!0:e===t}function Yc(e,t){return e===null?!1:e!==t}var Xc="block",xo="none";function v_(e){return e===Xc}function Jc(e){return e===!0?Xc:xo}function Zc(e){return!v_(e)}function tt(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]}function Li(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]+"/s"}function eh(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function Qc(e,t){return!Number.isFinite(e)||e<0?t("list.none"):e<1024?Math.round(e)+" B/s":Li(e)||t("list.none")}function b_(e,t){if(!Number.isFinite(e)||e<0)return t("list.none");let r=Math.floor(e),i=Math.floor(r/604800),n=Math.floor(r%604800/86400),s=Math.floor(r%86400/3600),o=Math.floor(r%3600/60),a=[];return i>0&&a.push(i+"w"),(i>0||n>0)&&a.push(n+"d"),(i>0||n>0||s>0)&&a.push(s+"h"),(i>0||n>0||s>0||o>0)&&a.push(o+"m"),a.length>0?a.join(""):r+"s"}function w_(e,t,r){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?r("list.none"):(tt(e)||"0 B")+"/"+(tt(t)||"0 B")}function th(e,t){let r=e[t];return Number.isFinite(r)?t==="tempC"?r>-100&&r<200?r:null:t==="cores"?r>=1&&r<=4096?r:null:t==="cpuPct"||t==="memPct"||t==="diskPct"?r>=0&&r<=100?r:null:t==="uptimeSec"?r>=0&&r<=100*365*24*3600?r:null:t==="tcpConns"?r>=0&&r<=1e7?r:null:t==="rxRate"||t==="txRate"?r>=0&&r<=2**40?r:null:r>=0&&r<=2**50?r:null:null}var y_=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function rh(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:y_.some(t=>th(e,t)!==null)}var S_=8e3;function ih(e,t=Date.now()){return t-(e||0)<=S_}var sh=23;function ko(e){return[{key:"cpuPct",label:"CPU",kind:"pct",slot:4},{key:"memPct",label:e("meta.mem"),kind:"pct",slot:4},{key:"diskPct",label:e("meta.disk"),kind:"pct",slot:4},{key:"cores",label:e("meta.cores"),kind:"count",slot:4},{key:"mem",label:e("meta.mem"),kind:"pair",slot:17,used:"memUsed",total:"memTotal"},{key:"uptimeSec",label:e("meta.uptime"),kind:"uptime",slot:13},{key:"tcpConns",label:"TCP",kind:"count",slot:6},{key:"disk",label:e("meta.disk"),kind:"pair",slot:17,used:"diskUsed",total:"diskTotal"},{key:"tempC",label:e("meta.temp"),kind:"temp",slot:8},{key:"net",label:e("meta.net"),kind:"net",slot:sh}]}function nh(e,t){let r=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},i=s=>th(r,s),n=(s,o,a,d=s.slot)=>({key:s.key,label:s.label,kind:s.kind,slot:d,pct:a??null,value:o,title:s.label+": "+o});return ko(t).map(s=>{if(s.kind==="pct"){let a=i(s.key);return n(s,a===null?t("list.none"):Math.round(a)+"%",a)}if(s.kind==="pair")return n(s,w_(i(s.used),i(s.total),t),null);if(s.kind==="uptime")return n(s,b_(i(s.key),t),null);if(s.kind==="temp"){let a=i(s.key);return n(s,a===null?t("list.none"):a.toFixed(1)+"\xB0C",null)}if(s.kind==="net"){let a=i("rxRate"),d=i("txRate");return a===null&&d===null?n(s,t("list.none"),null,0):n(s,"\u2193"+Qc(a,t)+" \u2191"+Qc(d,t),null,sh)}let o=i(s.key);return n(s,o===null?t("list.none"):String(o),null)})}var Eo="tty",$s={"error.credServiceMissing":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09","error.credServiceIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574","error.credStoreUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u5B58\u5165","error.credStoreFailed":"\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u5931\u8D25\uFF1A{error}","error.credClearUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u6E05\u9664","error.credClearFailed":"\u6E05\u9664\u5931\u8D25\uFF1A{error}","error.credRefNeedsHost":"\u5148\u586B\u300C\u4E3B\u673A\u300D\u548C\u300C\u7528\u6237\u540D\u300D\u518D\u5B58\u5165\u2014\u2014\u5F15\u7528\u540D\u7531\u8FD9\u4E24\u8005\u6D3E\u751F","btn.reopen":"\u91CD\u65B0\u6253\u5F00","btn.reopenTitle":"\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD","btn.sftpTitle":"\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09","btn.tunnels":"\u96A7\u9053 {count}","btn.tunnelsTitle":"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053","btn.more":"\u66F4\u591A","btn.moreTitle":"\u66F4\u591A\u64CD\u4F5C\uFF08\u7AEF\u53E3\u8F6C\u53D1\u2026\uFF09","btn.reopenSession":"\u91CD\u65B0\u6253\u5F00\u4F1A\u8BDD","status.exited":"\u4F1A\u8BDD\u5DF2\u9000\u51FA","status.ended":"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","btn.clickRerun":"\u70B9\u51FB\u91CD\u65B0\u6267\u884C","status.aiEnded":"AI \u5DF2\u7ED3\u675F\u8FD9\u4E2A\u4F1A\u8BDD","hint.aiEndedTab":"\u5185\u5BB9\u5148\u7559\u7740\uFF1A\u5207\u8D70\u6216\u70B9\u300C\u6536\u8D77\u300D\u5373\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E","btn.dismiss":"\u6536\u8D77","btn.dismissTitle":"\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E\uFF08\u4F1A\u8BDD\u5DF2\u7ECF\u7ED3\u675F\u4E86\uFF09","hint.reopenWithSpec":"\u6309\u539F\u89C4\u683C\u91CD\u5F00\u4E00\u6761\u4F1A\u8BDD\uFF08\u6301\u4E45\u6807\u7B7E\u63A5\u56DE tmux\uFF0C\u547D\u4EE4\u6807\u7B7E\u91CD\u8DD1\u4E00\u6B21\uFF09","btn.newLocalTerminal":"\u65B0\u5F00\u672C\u5730\u7EC8\u7AEF","hint.reopenAgentLocal":"\u8FD9\u6761\u4F1A\u8BDD\u662F AI \u5F00\u7684\u3001\u5DF2\u7ECF\u7ED3\u675F\uFF1A\u70B9\u4E86\u4F1A\u65B0\u5F00\u4E00\u4E2A\u672C\u5730\u7EC8\u7AEF\uFF0C\u4E0D\u4F1A\u63A5\u56DE\u539F\u6765\u90A3\u6761","msg.passwordNotStored":"\u51FA\u4E8E\u5B89\u5168\u8003\u8651\uFF0C\u660E\u6587\u5BC6\u7801/\u53E3\u4EE4\u4E0D\u968F\u6D4F\u89C8\u5668\u5B58\u50A8\u4FDD\u7559\uFF0C\u672C\u6B21\u8FDE\u63A5\u9700\u8981\u91CD\u65B0\u8F93\u5165\uFF1A\u91CD\u5F00\u6807\u7B7E\u65F6\u518D\u586B\u4E00\u6B21\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u628A\u51ED\u636E\u6362\u6210 env: \u5F15\u7528\uFF08\u503C\u5B58\u5BBF\u4E3B\u51ED\u636E\u5B58\u50A8\uFF09\u3002","error.terminalNeedsCommand":"ttyTerminal \u9700\u8981 command","error.terminalCommandSingleLine":"command \u5FC5\u987B\u662F\u5355\u884C","error.terminalNeedsHost":"ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9","error.panelNotReady":"ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA","panel.dragHeight":"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6","panel.dragWidth":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6","btn.closePane":"\u5173\u95ED\u4FA7\u680F","btn.expandPane":"\u5C55\u5F00\u4FA7\u680F","btn.collapsePane":"\u6536\u8D77\u4FA7\u680F","panel.tabLabel":"\u7EC8\u7AEF {n}","btn.close":"\u5173\u95ED","btn.closeTabAria":"\u5173\u95ED\u6807\u7B7E\uFF1A{label}","btn.newTab":"\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09","btn.tabList":"\u6807\u7B7E\u5217\u8868","btn.tabListTitle":"\u6807\u7B7E\u5217\u8868\uFF08{n} \u4E2A\uFF09","list.tabsAllVisible":"\u6CA1\u6709\u85CF\u5728\u89C6\u91CE\u5916\u7684\u6807\u7B7E","list.cleanExited":"\u6E05\u7406\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\uFF08{n}\uFF09","btn.closeTab":"\u5173\u95ED\u6B64\u6807\u7B7E","btn.hideFromAgent":"\u5BF9 AI \u9690\u85CF\u6B64\u6807\u7B7E","btn.showToAgent":"\u53D6\u6D88\u9690\u85CF\uFF08\u8BA9 AI \u53EF\u7528\uFF09","btn.hiddenMark":"\u5BF9 AI \u4E0D\u53EF\u89C1","btn.closeLeft":"\u5173\u95ED\u5DE6\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","btn.closeOthers":"\u5173\u95ED\u5176\u4ED6\u6807\u7B7E\uFF08{n}\uFF09","btn.closeRight":"\u5173\u95ED\u53F3\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","list.subLive":"\u5176\u4E2D {n} \u4E2A\u8FD8\u5F00\u7740","meta.tunnelRemote":"\u8FDC\u7A0B:{host}:{port} \u2192 \u672C\u673A:{local}","meta.tunnelLocal":"\u672C\u673A:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A","status.notPersisted":"\u672A\u6301\u4E45\u5316","status.tmuxUnavailableTitle":"\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD","status.connected":"\u5DF2\u8FDE\u63A5","status.connecting":"\u8FDE\u63A5\u4E2D","status.errored":"\u8FDE\u63A5\u51FA\u9519","panel.tunnels":"\u7AEF\u53E3\u8F6C\u53D1","hint.tunnelsSettings":"\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u91CC\u914D\u7F6E","panel.tunnelsFor":"\u7AEF\u53E3\u8F6C\u53D1 \u2014 {name}","list.loading":"\u52A0\u8F7D\u4E2D\u2026","hint.tunnelsCard":"\u589E\u5220/\u542F\u505C\u5728 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4","list.noActiveTunnels":"\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053","status.fatalSuffix":"\uFF08\u4E0D\u91CD\u8BD5\uFF0C\u9700\u4FEE\u914D\u7F6E\uFF09","msg.maxSessions":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 {live} \u4E2A / \u4E0A\u9650 {max}\uFF1A\u672C\u7A97\u53E3 {own} \u4E2A{others}\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","msg.maxSessionsOthers":" + \u5176\u4ED6\u7A97\u53E3 {count} \u4E2A","error.probeHttp":"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP {status}\uFF09","msg.probing":"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026","meta.reachable":"\u901A","meta.unreachable":"\u4E0D\u901A","meta.probeBanner":"banner \u6B63\u5E38","meta.hostKeyMatched":"\u4E3B\u673A\u5BC6\u94A5\u5339\u914D","meta.hostKeyRecorded":"\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09","meta.hostKeyMismatch":"\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01","meta.authOkMs":"\u8BA4\u8BC1\u901A\u8FC7\uFF08{ms}ms\uFF09","meta.authOk":"\u8BA4\u8BC1\u901A\u8FC7","meta.probeOk":"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A{detail}","error.unknown":"\u672A\u77E5\u9519\u8BEF","btn.maxSessionsTitle":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E","option.localTerminal":"\u672C\u5730\u7EC8\u7AEF","hint.tmuxHosted":"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D","hint.openInSessionCwd":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00","panel.sshBook":"SSH \u8FDE\u63A5\u7C3F","btn.sftpFileBrowse":"SFTP \u6587\u4EF6\u6D4F\u89C8","btn.editConnection":"\u7F16\u8F91\u8FDE\u63A5","list.emptySshBook":"\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09","option.sshConnect":"SSH \u8FDE\u63A5\u2026","hint.sshConnect":"\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F","panel.editConnection":"\u7F16\u8F91\u8FDE\u63A5 \xB7 {name}","panel.sshConnect":"SSH \u8FDE\u63A5","section.jump":"\u8DF3\u677F\u673A","field.jumpHost":"\u8DF3\u677F\u673A\uFF08[\u7528\u6237@]\u4E3B\u673A[:\u7AEF\u53E3]\uFF0C\u7559\u7A7A = \u76F4\u8FDE\uFF09","placeholder.jumpHost":"\u4F8B\u5982 bastion.corp:2222","check.jumpOwnCred":"\u8DF3\u677F\u673A\u4F7F\u7528\u72EC\u7ACB\u51ED\u636E","field.jumpUsername":"\u8DF3\u677F\u673A\u7528\u6237\u540D\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","field.jumpAuth":"\u8DF3\u677F\u673A\u8BA4\u8BC1\u65B9\u5F0F\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","hint.jumpInherit":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u4E0A\u9762\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\uFF1B\u8DF3\u677F\u673A\u8FDE\u4E0D\u4E0A\u65F6\u9519\u8BEF\u6587\u6848\u4F1A\u70B9\u540D\u5B83\uFF08\u4E0D\u4F1A\u4F2A\u88C5\u6210\u76EE\u6807\u8D85\u65F6\uFF09\u3002","meta.jumpStage":"\u8DF3\u677F\u673A {label}","meta.viaJump":"\u21E2 \u7ECF {label}","meta.viaProxy":"\u21E2 \u7ECF\u4EE3\u7406\u547D\u4EE4","section.proxyCommand":"\u4EE3\u7406\u547D\u4EE4","field.proxyCommand":"\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF0C\u7559\u7A7A = \u4E0D\u7528\uFF09","placeholder.proxyCommand":"\u4F8B\u5982 ssh -W %h:%p bastion","hint.proxyCommand":"\u672C\u673A\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u5B83\u7684 stdin/stdout \u5C31\u662F\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u652F\u6301 %h \u76EE\u6807\u4E3B\u673A\u3001%p \u7AEF\u53E3\u3001%r \u7528\u6237\u540D\u3001%n \u4E3B\u673A\u3001%% \u5B57\u9762 %\uFF1B\u5176\u4F59\u5199\u6CD5\u539F\u6837\u4FDD\u7559\u3002\u4E0E\u8DF3\u677F\u673A\u540C\u65F6\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\uFF08OpenSSH \u8BED\u4E49\uFF09\u3002\u9700\u8981\u4E0B\u9762\u90A3\u4E2A\u5F00\u5173\uFF0C~/.ssh/config \u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\u5B83\u3002","hint.proxyCommandDisabled":"\u26A0 \u5F53\u524D\u300C\u5141\u8BB8 ProxyCommand\u300D\u672A\u6253\u5F00\uFF1A\u8FD9\u6761\u547D\u4EE4\u4E0D\u4F1A\u6267\u884C\uFF0C\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002\u5230 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u6253\u5F00\u5F00\u5173\u540E\u751F\u6548\u3002","hint.proxyCommandNotGranted":"\u26A0 \u8FD9\u6761\u80FD\u529B\u672A\u83B7\u5BBF\u4E3B\u6388\u6743\uFF1A\u70B9\u8FD9\u4E2A\u5F00\u5173\u4F1A\u5C31\u5730\u53D1\u8D77\u4E00\u6B21\u6388\u6743\uFF08\u9762\u677F\u7ED9\u4E00\u6761\u5728\u5BBF\u4E3B\u7EC8\u7AEF\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u514D\u91CD\u542F\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u8D70\u6700\u4E25\u7684\u90A3\u6761\u2014\u2014\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export DSH_TTY_ALLOW_PROXY_COMMAND=1 \u540E\u91CD\u542F\u5BBF\u4E3B\uFF08\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u4E0D\u7B97\u6388\u6743\uFF09\u3002\u8FD9\u6837\u5B89\u6392\u662F\u56E0\u4E3A\u8DE8\u7AD9\u9875\u9762\u4E0E\u9875\u5185\u811A\u672C\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\u2014\u2014\u82E5\u914D\u7F6E\u754C\u9762\u80FD\u51ED\u7A7A\u63D0\u6743\uFF0C\u8FD9\u9053\u95F8\u95E8\u7B49\u4E8E\u6CA1\u6709\uFF1B\u5173\u6389\u5B83\u5219\u968F\u65F6\u53EF\u7528\u3002","badge.notEffective":"\u672A\u751F\u6548\uFF1A\u672A\u83B7\u5BBF\u4E3B\u6388\u6743","elev.title":"\u5C31\u5730\u6388\u6743\uFF08\u514D\u91CD\u542F\uFF09","elev.lockedWhy":"\u672C\u673A\u4EFB\u610F\u8FDB\u7A0B\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\uFF0C\u6240\u4EE5\u300C\u6253\u5F00\u5371\u9669\u80FD\u529B\u300D\u8FD9\u4EF6\u4E8B\u4E0D\u80FD\u7531\u8FD9\u4E2A\u9875\u9762\u81EA\u5DF1\u8BF4\u4E86\u7B97\u2014\u2014\u5FC5\u987B\u5728\u5BBF\u4E3B\u7684\u6587\u4EF6\u7CFB\u7EDF\u4E0A\u786E\u8BA4\u4E00\u6B21\u3002","elev.step":"\u5728\u5BBF\u4E3B\u7684\u7EC8\u7AEF\u91CC\u6267\u884C\u4E0B\u4E00\u6761\u547D\u4EE4\uFF0C\u5F00\u5173\u4F1A\u81EA\u52A8\u89E3\u9501\uFF1A","elev.copy":"\u590D\u5236\u547D\u4EE4","elev.copied":"\u5DF2\u590D\u5236","elev.copyManual":"\u5F53\u524D\u73AF\u5883\u62FF\u4E0D\u5230\u526A\u8D34\u677F\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u4E0A\u9762\u90A3\u6761\u547D\u4EE4\u590D\u5236\u3002","elev.expiresIn":"{sec} \u79D2\u540E\u5931\u6548","elev.expired":"\u672C\u6B21\u786E\u8BA4\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002","elev.waiting":"\u7B49\u5F85\u786E\u8BA4\u2026\u6267\u884C\u5B8C\u547D\u4EE4\u8FD9\u91CC\u4F1A\u81EA\u52A8\u53D8\u6210\u5DF2\u6388\u6743\u3002","elev.regenerate":"\u91CD\u65B0\u751F\u6210","elev.loading":"\u6B63\u5728\u751F\u6210\u786E\u8BA4\u547D\u4EE4\u2026","elev.granted":"\u5DF2\u6388\u6743\u5E76\u751F\u6548\u3002","elev.grantedNeedSave":"\u5DF2\u6388\u6743\u3002\u70B9\u300C\u4FDD\u5B58\u300D\u540E\u751F\u6548\u3002","elev.grantedAt":"\u5DF2\u6388\u6743 \xB7 {time}","elev.revoke":"\u64A4\u9500\u5BBF\u4E3B\u6388\u6743","elev.revoked":"\u5DF2\u64A4\u9500\u5BBF\u4E3B\u6388\u6743\uFF08\u914D\u7F6E\u5F00\u5173\u4FDD\u6301\u4E0D\u53D8\uFF0C\u91CD\u65B0\u6388\u6743\u540E\u4F1A\u7ACB\u523B\u751F\u6548\uFF09\u3002","elev.viaEnv":"\u7531\u542F\u52A8\u73AF\u5883\u53D8\u91CF\u6388\u6743\uFF1B\u8981\u64A4\u9500\u9700\u5728\u542F\u52A8\u73AF\u5883\u91CC\u53BB\u6389\u5B83\u5E76\u91CD\u542F\u5BBF\u4E3B\u3002","elev.close":"\u6536\u8D77","elev.disableFirst":"\u5148\u5173\u6389\u8FD9\u4E2A\u914D\u7F6E\u5F00\u5173","elev.otherWay":"\u53E6\u4E00\u79CD\u65B9\u5F0F\uFF08\u6700\u5F3A\uFF0C\u9700\u8981\u91CD\u542F\u5BBF\u4E3B\uFF09","elev.envHow":"\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export {env}=1\uFF0C\u7136\u540E\u91CD\u542F\u5BBF\u4E3B\u3002\u6CE8\u610F\uFF1A\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u3001\u6216\u5199\u8FDB\u522B\u7684\u914D\u7F6E\u6587\u4EF6\u90FD\u4E0D\u7B97\u6388\u6743\u2014\u2014\u8FD9\u9053\u95F8\u95E8\u9632\u7684\u5C31\u662F\u300C\u8FD0\u884C\u671F\u80FD\u6539\u7684\u4E1C\u897F\u5192\u5145\u6388\u6743\u300D\u3002","elev.error":"\u5C31\u5730\u6388\u6743\u6CA1\u6210\u529F\uFF1A","meta.probeProxy":"\u4EE3\u7406\u547D\u4EE4","meta.probeProxyOff":"\u4EE3\u7406\u547D\u4EE4\uFF08\u672A\u542F\u7528\uFF09","meta.probeTcpSkipped":"\u76F4\u8FDE\u9884\u68C0\u5DF2\u8DF3\u8FC7\uFF08\u8D70\u4EE3\u7406\u547D\u4EE4\uFF09","section.connection":"\u8FDE\u63A5","field.host":"\u4E3B\u673A","placeholder.host":"example.com \u6216 IP","field.port":"\u7AEF\u53E3","field.username":"\u7528\u6237\u540D","section.auth":"\u8BA4\u8BC1","field.authMethod":"\u8BA4\u8BC1\u65B9\u5F0F","option.authInherit":"\uFF08\u6CBF\u7528\u76EE\u6807\uFF09","option.authAgent":"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent","option.authKey":"key \u2014 \u79C1\u94A5\u6587\u4EF6","option.authPassword":"password \u2014 \u5BC6\u7801","field.keyPath":"\u79C1\u94A5\u8DEF\u5F84","field.hostKeyAlias":"\u4E3B\u673A\u5BC6\u94A5\u522B\u540D","field.passphrase":"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09","field.password":"\u5BC6\u7801","placeholder.credRef":"\u6216\uFF1A\u9009\u62E9\u51ED\u636E\u5B58\u50A8\u91CC\u7684\u5F15\u7528\u540D","hint.credRefCandidates":"\u5019\u9009 = \u51ED\u636E\u5B58\u50A8\u91CC\u5DF2\u6709\u7684\u5F15\u7528\u540D + \u672C\u673A\u8FDE\u63A5\u7C3F\u91CC\u5728\u7528\u7684\u5F15\u7528\u540D","list.credOverwrite":"{name}\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09","list.moreMatches":"\u8FD8\u6709 {count} \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009","list.noCredRef":"\u6CA1\u6709\u5339\u914D\u7684\u5F15\u7528","check.rememberCredential":"\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.rememberCredential":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u4FDD\u5B58\u4FEE\u6539\u300D\u6216\u300C\u8FDE\u63A5\uFF08\u5E76\u4FDD\u5B58\uFF09\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","btn.clearCredential":"\u6E05\u9664\u5DF2\u5B58\u51ED\u636E","error.credPlainUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","error.credPlainIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","status.credUnreported":"\u5F15\u7528 {ref}\uFF1A\u5BBF\u4E3B\u672A\u62A5\u544A\u72B6\u6001","error.credStatusFailed":"\u8BFB\u53D6\u51ED\u636E\u72B6\u6001\u5931\u8D25\uFF1A{error}","status.credStored":"\u5DF2\u5B58\u5165{source} \xB7 {ref}","meta.credSource":"\uFF08\u6765\u6E90 {source}\uFF09","status.credUnknown":"\u5F15\u7528 {ref}\uFF1A\u5B58\u50A8\u91CC\u8FD8\u6CA1\u6709\u8FD9\u4E2A\u503C","hint.noCredRefPassphrase":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u53EF\u5728\u79C1\u94A5\u53E3\u4EE4\u6846\u76F4\u63A5\u624B\u8F93 env:NAME","hint.noCredRefPassword":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","section.options":"\u9009\u9879","check.agentForward":"agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09","hint.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\u8BB0\u4F4F\u6307\u7EB9\u3002\u540C\u4E00\u53F0\u4E3B\u673A\u7ECF\u4E0D\u540C\u5730\u5740\uFF08\u8DF3\u677F\u673A\u540E / \u7AEF\u53E3\u8F6C\u53D1\uFF09\u89E6\u8FBE\u65F6\uFF0C\u586B\u540C\u4E00\u4E2A\u522B\u540D\u53EF\u8BA9\u5B83\u4EEC\u5171\u7528\u4E00\u6761\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF0C\u907F\u514D\u6BCF\u6B21\u5207\u6362\u5730\u5740\u90FD\u62A5\u300C\u6307\u7EB9\u53D8\u66F4\u300D\uFF1B\u53EA\u5F71\u54CD\u6307\u7EB9\u8BB0\u5728\u54EA\uFF0C\u4E0D\u6539\u8FDE\u63A5\u5730\u5740","placeholder.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740","check.persist":"\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","check.saveToBook":"\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09","field.bookName":"\u8FDE\u63A5\u7C3F\u540D\u79F0","placeholder.bookName":"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D","error.hostUserRequired":"\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B","error.keyPathRequired":"auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84","error.passwordRequired":"auth=password \u9700\u8981\u5BC6\u7801","btn.cancel":"\u53D6\u6D88","btn.connect":"\u8FDE\u63A5","btn.fileBrowse":"\u6587\u4EF6\u6D4F\u89C8","btn.browseTitle":"\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8","btn.probe":"\u8BD5\u8FDE","btn.probeTitle":"\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","error.saveCredFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","btn.saveEdit":"\u4FDD\u5B58\u4FEE\u6539","error.saveBookFailed":"\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A{error}","error.bookNameTaken":"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: {name}","panel.sftpDual":"SFTP \u53CC\u680F \xB7 {label}","status.failed":"\u5931\u8D25","status.done":"\u5B8C\u6210","placeholder.localPath":"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","placeholder.remotePath":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","btn.refresh":"\u5237\u65B0","btn.mkdir":"\u65B0\u5EFA\u76EE\u5F55","btn.hiddenFiles":"\u9690\u85CF\u6587\u4EF6","btn.hiddenFilesTitle":"\u663E\u793A / \u9690\u85CF\u4EE5 . \u5F00\u5934\u7684\u6587\u4EF6\uFF08.env\u3001.gitignore \u7B49\uFF09","error.dirNotReady":"\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210","meta.dir":"\u76EE\u5F55","btn.transferTo":"\u4F20\u8F93\u5230{target}\uFF1A{path}","meta.local":"\u672C\u673A","meta.remote":"\u8FDC\u7A0B","error.transferDirsNotReady":"\u4E24\u4FA7\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210\uFF0C\u7B49\u5217\u8868\u52A0\u8F7D\u540E\u518D\u4F20\u8F93","msg.transferring":"\u4F20\u8F93 {name}\u2026","error.transferFailed":"\u4F20\u8F93\u5931\u8D25","error.noTaskId":"\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id","msg.transferCanceled":"\u5DF2\u53D6\u6D88\u4F20\u8F93 {name}","msg.transferred":"\u5DF2\u4F20\u8F93 {name}","btn.download":"\u4E0B\u8F7D {name}","btn.rename":"\u91CD\u547D\u540D {name}","placeholder.newName":"\u65B0\u540D\u79F0","btn.deleteEntry":"\u5220\u9664 {name}","btn.deleteEntryDir":"\u5220\u9664 {name}\uFF08\u542B\u5185\u5BB9\uFF09","msg.deleted":"\u5DF2\u5220\u9664 {name}","list.parentDir":"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","list.emptyDir":"\uFF08\u7A7A\u76EE\u5F55\uFF09","list.hiddenOnly":"\uFF08\u8FD9\u91CC\u53EA\u6709\u9690\u85CF\u6587\u4EF6 \u2014 \u70B9\u680F\u4E0A\u7684\u300C\u9690\u85CF\u6587\u4EF6\u300D\u663E\u793A\uFF09","error.dropOnLocalPane":"\u62D6\u5230\u672C\u673A\u680F\u6CA1\u6709\u53EF\u6267\u884C\u7684\u52A8\u4F5C\uFF1A\u672C\u673A\u6587\u4EF6\u8981\u4F20\u5230\u5BF9\u9762\uFF0C\u8BF7\u62D6\u5230\u53F3\u4FA7\u300C\u8FDC\u7A0B\u300D\u680F","list.truncated":"\u2026\u5176\u4F59 {rest} \u9879\u672A\u6E32\u67D3\uFF08\u5171 {total} \u9879\uFF09\u2014\u2014\u7528\u4E0A\u65B9\u8DEF\u5F84\u6846\u8DF3\u8F6C\u5230\u5B50\u76EE\u5F55\u5B9A\u4F4D","list.itemCount":"{count} \u9879","placeholder.newDirName":"\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09","msg.creatingDir":"\u521B\u5EFA\u76EE\u5F55 {name}\u2026","btn.ok":"\u786E\u5B9A","btn.confirm":"\u786E\u8BA4?","btn.cancelTransfer":"\u53D6\u6D88\u4F20\u8F93","msg.downloadCanceled":"\u5DF2\u53D6\u6D88\u4E0B\u8F7D {name}","msg.downloadResuming":"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u4ECE {offset} \u5904\u7EED\u4F20 {name}\u2026","error.downloadFailed":"\u4E0B\u8F7D\u5931\u8D25","msg.downloaded":"\u5DF2\u4E0B\u8F7D {name}\uFF08{size}\uFF09","error.downloadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08{size}\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","msg.canceled":"\u5DF2\u53D6\u6D88","btn.upload":"\u4E0A\u4F20","btn.uploadTitle":"\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868","msg.uploading":"\u4E0A\u4F20\u4E2D\u2026","msg.uploadDone":"\u4E0A\u4F20\u5B8C\u6210","error.uploadFailed":"\u4E0A\u4F20\u5931\u8D25","error.networkError":"\u7F51\u7EDC\u9519\u8BEF","error.uploadCountExceeded":"\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08{max}\uFF09\uFF1A\u672C\u6B21 {count} \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","status.overLimit":"\u8D85\u9650","error.uploadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\uFF1A{name}\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error.uploadTotalTooBig":"\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","msg.uploadCanceled":"\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 {done}/{total} \u4E2A\uFF09","status.allDone":"\u5168\u90E8\u5B8C\u6210","msg.uploadDoneCount":"\u4E0A\u4F20\u5B8C\u6210 {count} \u4E2A\u6587\u4EF6","error.connectFailed":"\u8FDE\u63A5\u5931\u8D25\uFF1A{error}","status.connectingEllipsis":"\u8FDE\u63A5\u4E2D\u2026","status.connectedPid":"\u5DF2\u8FDE\u63A5 pid={pid}","status.connectedSsh":"SSH {target}\u5DF2\u8FDE\u63A5","status.exitedWith":"\u5DF2\u9000\u51FA {detail}","status.error":"\u9519\u8BEF\uFF1A{message}","status.retryHint":"{message} \xB7 \u70B9\u51FB\u91CD\u8BD5","btn.clickRetry":"\u70B9\u51FB\u91CD\u8BD5","status.disconnectedReconnecting":"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","status.disconnected":"\u8FDE\u63A5\u65AD\u5F00","status.reconnecting":"\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","error.copyFailed":"\u590D\u5236\u5931\u8D25\uFF1A\u5F53\u524D\u73AF\u5883\u4E0D\u5141\u8BB8\u8BBF\u95EE\u526A\u8D34\u677F\uFF08http \u8BBF\u95EE\u65F6\u8BF7\u6539\u7528 localhost \u6216\u7EC8\u7AEF\u5185\u5FEB\u6377\u952E\uFF09","status.initializing":"\u521D\u59CB\u5316\u2026","placeholder.search":"\u641C\u7D22 (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"\u641C\u7D22 (Ctrl+F)\uFF1AEnter \u4E0B\u4E00\u4E2A / Shift+Enter \u4E0A\u4E00\u4E2A","btn.clearTitle":"\u6E05\u5C4F","btn.minimizeTitle":"\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09","btn.minimize":"\u6700\u5C0F\u5316","btn.closePanelTitle":"\u5173\u95ED\u9762\u677F\u5E76\u7ED3\u675F\u5168\u90E8\u4F1A\u8BDD\uFF08\u6709\u4F1A\u8BDD\u8FD8\u5F00\u7740\u65F6\u4F1A\u5148\u786E\u8BA4\uFF1B\u53EA\u662F\u60F3\u6536\u8D77\u5C31\u70B9\u300C\u2014\u300D\uFF0C\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09","confirm.closeTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED\u9762\u677F\uFF1F","confirm.closeText":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF08\u9762\u677F\u91CC\u7684\u6807\u7B7E\u4F1A\u8DDF\u7740\u5173\u6389\uFF09\u3002","confirm.closeTextAgent":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.closeHint":"\u53EA\u662F\u60F3\u7ED9\u522B\u7684\u7A97\u53E3\u817E\u5730\u65B9\uFF1F\u70B9\u300C\u6700\u5C0F\u5316\u300D\u2014\u2014 \u4F1A\u8BDD\u4E0E\u8F93\u51FA\u90FD\u4FDD\u6301\u8FD0\u884C\u3002","confirm.closeOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED","confirm.tabsTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u6389\u8FD9\u4E9B\u6807\u7B7E\uFF1F","confirm.tabsText":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF0C\u5B83\u4EEC\u7684\u6807\u7B7E\u4E5F\u8DDF\u7740\u5173\u6389\u3002","confirm.tabsTextAgent":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.tabsHint":"\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\u53EA\u662F\u53EA\u8BFB\u4FDD\u7559\uFF0C\u6E05\u6389\u5B83\u4EEC\u4E0D\u4E22\u4EFB\u4F55\u4E1C\u897F\u3002","confirm.tabsOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD","btn.restoreDock":"\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3","panel.title":"\u7EC8\u7AEF","status.minimized":"\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D","error.configLoadFailed":"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25","error.saveTunnelFailed":"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25","error.tunnelNameTaken":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u540C\u4E00\u300C\u8FDE\u63A5\u7C3F\u6761\u76EE + \u65B9\u5411 + \u7AEF\u53E3\u300D\u53EA\u80FD\u6709\u4E00\u6761\u3002\u6539\u7AEF\u53E3\u4F1A\u5F97\u5230\u65B0\u540D\u5B57\uFF0C\u6216\u5148\u5220\u6389\u65E7\u7684\u90A3\u6761\u3002","msg.tunnelApplied":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u751F\u6548","msg.tunnelUpdated":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u66F4\u65B0","error.nameHostUserRequired":"\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B","msg.hostEdited":"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C{name}\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.probeFailed":"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A{error}","error.hostKeyDeleteFailed":"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25","msg.hostKeyDeleted":"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09","error.sshConfigReadFailed":"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25","msg.proxySkipped":"{count} \u6761\u7528\u4E86\u8DF3\u677F\u673A\u4F46\u89E3\u6790\u4E0D\u51FA\u8DF3\u677F\u673A\uFF08\u522B\u540D\u7F3A\u5931 / \u522B\u540D\u81EA\u5DF1\u8FD8\u4F9D\u8D56\u8DF3\u677F\u673A\uFF09\u672A\u5BFC\u5165\uFF1A{names}","msg.proxyCommandSkipped":"{count} \u6761\u53EA\u914D\u4E86\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF09\u672A\u5BFC\u5165\uFF1A{names} \u2014\u2014 \u4EE3\u7406\u547D\u4EE4\u662F\u300C\u672C\u673A\u6267\u884C\u4E00\u6761\u547D\u4EE4\u300D\u90A3\u4E00\u6863\uFF0C\u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\uFF1B\u9700\u8981\u65F6\u5728\u8FDE\u63A5\u7C3F\u91CC\u624B\u586B\u5E76\u6253\u5F00\u300C\u5141\u8BB8 ProxyCommand\u300D","msg.skippedNotConcrete":"{count} \u6761\u4E0D\u662F\u5177\u4F53\u4E3B\u673A\uFF08\u901A\u914D / \u65E0 User\uFF09","list.separator":"\u3001","meta.etc":" \u7B49","msg.importOverflow":"\u8D85\u8FC7\u5BFC\u5165\u4E0A\u9650\u7684 {count} \u6761\u672A\u5BFC\u5165","list.separatorFull":"\uFF1B","msg.noNewEntries":"\u6CA1\u6709\u65B0\u6761\u76EE\uFF08{count} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09","msg.noImportableHosts":"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","msg.importedHosts":"\u5DF2\u5BFC\u5165 {added} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 {skipped} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.knownHostsReadFailed":"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25","msg.noNewFingerprints":"\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08{count} \u6761\u5DF2\u5B58\u5728\uFF09","msg.noImportableKnownHosts":"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","error.saveHostKeysFailed":"\u4FDD\u5B58 hostKeys \u5931\u8D25","msg.importedFingerprints":"\u5DF2\u5BFC\u5165 {added} \u6761\u4E3B\u673A\u7684\u6307\u7EB9\uFF08\u8DF3\u8FC7 {skipped} \u6761\u5DF2\u5B58\u5728\uFF09","hint.knownHostsTruncated":"\uFF1B\u6CE8\u610F\uFF1Aknown_hosts \u8D85\u8FC7 500 \u6761\u4E3B\u673A\uFF0C\u672C\u6B21\u4EC5\u5BFC\u5165\u524D 500 \u6761","error.saveFailed":"\u4FDD\u5B58\u5931\u8D25","msg.saved":"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548","check.rememberCredentialApply":"\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.appliedOnSave":"\u968F\u5361\u7247\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","card.name":"\u7EC8\u7AEF\u9762\u677F","card.desc":"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\u3002","card.descFull":"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","list.loadingConfig":"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026","section.basic":"\u57FA\u7840","check.enabled":"\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","check.announce":"\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","check.shellIntegration":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF09","check.shellIntegrationWindows":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF0Ctty_capture{last} \u4E0E cwd \u8DDF\u968F\u4F9D\u8D56\u5B83\uFF09","hint.shellIntegrationWindows":"Windows \u5BBF\u4E3B\u4E0A\u4E0D\u9002\u7528\uFF1A\u6CE8\u5165\u8D70\u7684\u662F POSIX \u7684 `-c` \u5305\u88C5\u5C42\u4E0E rc \u6869\uFF0Ccmd / PowerShell \u4E0A\u90FD\u4E0D\u6210\u7ACB\uFF08\u5B9E\u6D4B cmd \u5FFD\u7565 `-c` \u7A7A\u8DD1\u3001PowerShell \u62A5 export \u4E0D\u5B58\u5728\uFF09\u3002\u56E0\u6B64\u300C\u672C\u5730\u300D\u6807\u7B7E\u7684 cwd \u8DDF\u968F\u4E0E tty_capture{last} \u4E0D\u53EF\u7528\uFF1B\u8FDC\u7A0B Linux / macOS \u4E3B\u673A\u7167\u65E7\u652F\u6301\u3002","section.sftp":"SFTP \u6587\u4EF6\u4F20\u8F93","field.sftpStyle":"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C","option.sftpDialog":"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD","option.sftpDual":"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20","hint.sftpDual":"\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","field.sftpLimits":"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09","field.downloadLimit":"\u4E0B\u8F7D\u4E0A\u9650 (MB)","field.uploadLimit":"\u4E0A\u4F20\u4E0A\u9650 (MB)","field.uploadCountLimit":"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650","hint.sftpLimits":"\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","section.session":"\u4F1A\u8BDD","field.persistence":"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09","option.persistOff":"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09","option.persistTmux":"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316","hint.persistence":"\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","hint.persistenceWindows":"\uFF1BWindows \u5BBF\u4E3B\u4E0A tmux \u4E0D\u53EF\u7528\uFF0C\u672C\u5730\u6807\u7B7E\u4F1A\u7167\u5E38\u6253\u5F00\u4F46\u4E0D\u53D7\u6258\u7BA1","check.endOnPageClose":"\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","check.statsEnabled":"\u670D\u52A1\u5668\u72B6\u6001\u6761\uFF08CPU / \u5185\u5B58 / \u78C1\u76D8 / \u5728\u7EBF / TCP / \u7F51\u901F\uFF1B\u91C7\u4E0D\u5230\u7684\u9879\u663E\u793A\u300C\u65E0\u300D\uFF09","hint.statsEnabled":"\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","check.allowProxyCommand":"\u5141\u8BB8 ProxyCommand\uFF08\u672C\u673A\u6267\u884C\u547D\u4EE4\uFF1B\u9ED8\u8BA4\u5173\uFF09","hint.allowProxyCommand":"\u6253\u5F00\u540E\uFF0C\u8FDE\u63A5\u7C3F\u6761\u76EE\u91CC\u586B\u7684\u4EE3\u7406\u547D\u4EE4\u4F1A\u5728\u8FD9\u53F0\u673A\u5668\u4E0A\u6267\u884C\uFF0C\u5B83\u7684 stdin/stdout \u5F53\u4F5C\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u8FD9\u662F\u672C\u63D2\u4EF6\u552F\u4E00\u300C\u914D\u7F6E\u91CC\u5199\u4E00\u884C\u5C31\u5728\u672C\u673A\u8DD1\u547D\u4EE4\u300D\u7684\u5F00\u5173\uFF0C\u6240\u4EE5\u9ED8\u8BA4\u5173\uFF1A\u5173\u7740\u65F6\u643A\u5E26\u4EE3\u7406\u547D\u4EE4\u7684\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002~/.ssh/config \u5BFC\u5165\u6C38\u4E0D\u81EA\u52A8\u5E26\u5165\u4EE3\u7406\u547D\u4EE4\u3002","field.maxSessions":"\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","hint.maxSessions":"\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548","field.shell":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","field.shellWindows":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 %COMSPEC%\uFF09","placeholder.shell":"\u7559\u7A7A\u4F7F\u7528 $SHELL","placeholder.shellWindows":"\u7559\u7A7A\u4F7F\u7528 %COMSPEC%\uFF08\u4E5F\u53EF\u586B powershell.exe / pwsh.exe \u5B8C\u6574\u8DEF\u5F84\uFF09","list.noShellCandidate":"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF","hint.shellCandidatesWindows":"Windows \u5BBF\u4E3B\uFF1A\u5019\u9009\u6765\u81EA %COMSPEC% \u4E0E\u5DF2\u5B89\u88C5\u7684 PowerShell\uFF08Windows PowerShell 5.1 / PowerShell 7\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1Bcmd / PowerShell \u6CA1\u6709 POSIX \u7684\u547D\u4EE4\u8FB9\u754C\u94A9\u5B50\uFF0C\u6240\u4EE5\u8FD9\u4E24\u8005\u4E0D\u652F\u6301 shell \u96C6\u6210","hint.shellCandidates":"\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","hint.term":"TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C","field.cwd":"\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","placeholder.cwd":"\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55","field.grace":"\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","hint.grace":"\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","section.assist":"AI \u8F85\u52A9","check.assistEnabled":"\u5931\u8D25\u5373\u89E3\u91CA\uFF08\u547D\u4EE4\u975E\u96F6\u9000\u51FA\u65F6\u95EE\u6A21\u578B\u300C\u4E3A\u4EC0\u4E48 / \u4E0B\u4E00\u6B65\u300D\uFF09","hint.assistEnabled":"\u9ED8\u8BA4\u5173\u3002\u5F00\u542F\u540E\uFF0C\u547D\u4EE4\u4EE5\u975E\u96F6\u72B6\u6001\u7ED3\u675F\u65F6\u7EC8\u7AEF\u53F3\u4E0B\u89D2\u4F1A\u51FA\u73B0\u4E00\u679A\u5FBD\u6807\uFF1B\u70B9\u5B83\u624D\u628A\u90A3\u6761\u547D\u4EE4\u7684\u300C\u8F93\u51FA\u5C3E\u90E8\u300D\uFF08\u5265\u79BB\u989C\u8272\u4E0E\u8FDB\u5EA6\u6761\u3001\u6298\u6389\u91CD\u590D\u884C\u3001\u5BC6\u94A5/token \u5DF2\u906E\u76D6\uFF09\u8FDE\u540C\u5F53\u524D\u5C4F\u5E55\u53D1\u7ED9\u6A21\u578B\uFF0C\u4E0D\u53D1 scrollback\u3002\u6A21\u578B\u7ED9\u7684\u547D\u4EE4\u53EA\u4F1A\u300C\u586B\u5165\u300D\u547D\u4EE4\u884C\uFF0C\u6C38\u4E0D\u66FF\u4F60\u56DE\u8F66\u3002","field.assistRoute":"\u6A21\u578B\u8DEF\u7531\uFF08\u53EF\u9009\uFF09","hint.assistRoute":"\u7559\u7A7A\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","option.followHostModel":"\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","list.modelLoading":"\u6B63\u5728\u53D6\u5019\u9009\u2026","list.noModelCandidate":"\u5BBF\u4E3B\u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B","list.modelCatalogFailed":"\u62FF\u4E0D\u5230\u5019\u9009\uFF1A\u5BBF\u4E3B\u53EF\u80FD\u8FD8\u6CA1\u91CD\u542F\uFF0C\u6216\u6CA1\u6709\u63D0\u4F9B\u6A21\u578B\u76EE\u5F55\uFF08\u624B\u8F93\u8BF7\u6309 provider/model\uFF09","badge.assistFailed":"\u547D\u4EE4\u5931\u8D25\uFF08{code}\uFF09\xB7 \u89E3\u91CA\u4E00\u4E0B","panel.assistTitle":"\u8FD9\u6761\u547D\u4EE4\u4E3A\u4EC0\u4E48\u5931\u8D25","panel.assistCommand":"\u5EFA\u8BAE\u547D\u4EE4","status.assistThinking":"\u6B63\u5728\u95EE\u6A21\u578B\u2026","error.assistRequest":"\u89E3\u91CA\u5931\u8D25\uFF1A{message}","btn.assistFill":"\u586B\u5165\u547D\u4EE4\u884C","btn.assistCopy":"\u590D\u5236\u7B54\u6848","btn.assistCopyError":"\u590D\u5236\u62A5\u9519","btn.assistClose":"\u5173\u95ED","hint.assistFillNoEnter":"\u53EA\u5199\u8FDB\u547D\u4EE4\u884C\uFF0C\u4E0D\u4F1A\u66FF\u4F60\u56DE\u8F66","hint.assistNoCommand":"\u6A21\u578B\u6CA1\u7ED9\u51FA\u53EF\u76F4\u63A5\u586B\u7684\u547D\u4EE4 \u2014 \u7528\u300C\u590D\u5236\u300D\u81EA\u5DF1\u6311","section.ssh":"SSH \u8FDE\u63A5","btn.probeRowTitle":"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD","msg.testing":"\u6D4B\u8BD5\u4E2D\u2026","btn.test":"\u6D4B\u8BD5","btn.edit":"\u7F16\u8F91","btn.delete":"\u5220\u9664","list.emptySshHosts":"\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","btn.importSshConfig":"\u4ECE ~/.ssh/config \u5BFC\u5165","hint.importSshConfig":"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","hint.sshBook":"\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","check.tunnelEnabled":"\u542F\u7528","list.emptyTunnels":"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3","field.direction":"\u8F6C\u53D1\u65B9\u5411","option.localForwardTitle":"\u672C\u5730\u8F6C\u53D1 -L\uFF1A\u672C\u673A\u76D1\u542C\uFF0C\u8FDE\u5230 SSH \u670D\u52A1\u5668\u4FA7\u7684\u76EE\u6807","option.localForward":"\u672C\u5730 -L","option.remoteForwardTitle":"\u8FDC\u7A0B\u8F6C\u53D1 -R\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C\uFF0C\u62E8\u56DE\u672C\u673A\u670D\u52A1","option.remoteForward":"\u8FDC\u7A0B -R","option.selectBook":"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelViaBook":"\u7ECF {book} \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelBookEmpty":"\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","hint.localListenFixed":"\u672C\u673A\u76D1\u542C\u5730\u5740\u56FA\u5B9A 127.0.0.1\uFF08\u4E0D\u66B4\u9732\u5230\u5C40\u57DF\u7F51\uFF09","placeholder.localPort":"\u672C\u673A\u7AEF\u53E3","field.localListenPort":"\u672C\u673A\u76D1\u542C\u7AEF\u53E3","hint.flowLocalToRemote":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2192 SSH \u670D\u52A1\u5668\u4FA7","placeholder.remoteHost":"\u670D\u52A1\u5668\u4FA7\u4E3B\u673A","hint.remoteHostTitle":"\u76EE\u6807\u4E3B\u673A\u540D\u6216 IP\uFF08\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF1B127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09","field.remoteHost":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u4E3B\u673A","placeholder.port":"\u7AEF\u53E3","field.remotePort":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u7AEF\u53E3","placeholder.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","hint.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740\uFF08\u7F3A\u7701 127.0.0.1\uFF1B\u7559\u7A7A\u5373\u53EA\u8BA9\u670D\u52A1\u5668\u81EA\u5DF1\u8BBF\u95EE\uFF09","field.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","placeholder.listenPort":"\u76D1\u542C\u7AEF\u53E3","field.remoteListenPort":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u7AEF\u53E3","hint.flowRemoteToLocal":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2190 SSH \u670D\u52A1\u5668\u4FA7","hint.localDialFixed":"\u672C\u673A\u62E8\u53F7\u5730\u5740\u56FA\u5B9A 127.0.0.1","placeholder.localTargetPort":"\u672C\u673A\u670D\u52A1\u7AEF\u53E3","field.localTargetPort":"\u672C\u673A\u76EE\u6807\u7AEF\u53E3","hint.tunnelLocalSummary":"\u5DE6\uFF1A\u672C\u673A\u76D1\u542C\uFF08\u56FA\u5B9A 127.0.0.1\uFF09\u2192 \u53F3\uFF1A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\u7684\u76EE\u6807","hint.tunnelRemoteSummary":"\u5DE6\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C \u2192 \u53F3\uFF1A\u672C\u673A\u88AB\u8BBF\u95EE\u7684\u670D\u52A1\uFF08\u56FA\u5B9A 127.0.0.1\uFF09","btn.addTunnel":"\u6DFB\u52A0\u96A7\u9053","hint.tunnelAdd":"\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","hint.tunnelEditing":"\u6B63\u5728\u7F16\u8F91\u300C{name}\u300D\u2014\u2014\u6539\u7AEF\u53E3/\u6761\u76EE\u4F1A\u6309\u89C4\u5219\u751F\u6210\u65B0\u540D\u5B57\uFF1B\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548","panel.hostKeys":"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09","btn.importKnownHosts":"\u4ECE known_hosts \u5BFC\u5165","list.emptyHostKeys":"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9","hint.hostKeys":"\u4E00\u673A\u591A\u628A\u94A5\u5319\uFF08\u5982 rsa + ed25519\uFF09\u5404\u8BB0\u4E00\u6761\u6307\u7EB9\uFF0C\u4EFB\u4E00\u5339\u914D\u5373\u653E\u884C\uFF1B\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF0C\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE","msg.saving":"\u4FDD\u5B58\u4E2D\u2026","btn.save":"\u4FDD\u5B58","list.none":"\u65E0","meta.mem":"\u5185\u5B58","meta.disk":"\u78C1\u76D8","meta.cores":"\u6838\u5FC3","meta.uptime":"\u5728\u7EBF","meta.temp":"CPU\u6E29\u5EA6","meta.net":"\u7F51\u7EDC","error.tunnelNoBook":"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE","error.tunnelRemotePortRequired":"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09","error.tunnelLocalRequired":"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B","error.tunnelMissing":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u4E0D\u5B58\u5728\uFF08\u53EF\u80FD\u88AB\u53E6\u4E00\u4E2A\u7A97\u53E3\u5220\u9664\uFF09","error.tunnelClash":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u8BF7\u5148\u5904\u7406\u90A3\u6761\u540C\u540D\u7684\u3002","msg.renaming":"\u91CD\u547D\u540D {name}\u2026","msg.deleting":"\u5220\u9664 {name}\u2026","msg.downloading":"\u4E0B\u8F7D {name}\u2026","msg.uploadingName":"\u4E0A\u4F20 {name}","error.invalidTaskState":"\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001","hint.rememberCredentialApply":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u5E94\u7528\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","hint.noCredRefPasswordApply":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","hint.bookNameConflict":"\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD","btn.apply":"\u5E94\u7528"},k_={"error.credServiceMissing":"The host does not provide the credential service (remote.credentials)","error.credServiceIncomplete":"The credential service is incomplete","error.credStoreUnavailable":"The host does not provide the credential service (remote.credentials); cannot store","error.credStoreFailed":"Failed to store the credential: {error}","error.credClearUnavailable":"The host does not provide the credential service (remote.credentials); cannot clear","error.credClearFailed":"Failed to clear: {error}","error.credRefNeedsHost":"Fill in host and username first \u2014 the reference name is derived from them","btn.reopen":"Reopen","btn.reopenTitle":"Reopen the session with the original connection settings","btn.sftpTitle":"Open the SFTP file browser for this connection","btn.tunnels":"Tunnels {count}","btn.tunnelsTitle":"View the port-forwarding tunnels of this connection","btn.more":"More","btn.moreTitle":"More actions (port forwarding\u2026)","btn.reopenSession":"Reopen session","status.exited":"Session exited","status.ended":"Session ended","btn.clickRerun":"Click to run again","status.aiEnded":"The AI finished this session","hint.aiEndedTab":"The content stays for now: switch away or hit \u201CDismiss\u201D to close this tab","btn.dismiss":"Dismiss","btn.dismissTitle":"Close this tab (the session has already ended)","hint.reopenWithSpec":"Open a session again from the same spec (persistent tabs reattach to tmux, command tabs run again)","btn.newLocalTerminal":"New local terminal","hint.reopenAgentLocal":"This session was opened by the AI and has ended: this opens a new local terminal, it does not reattach to the original one","msg.passwordNotStored":"For security, plaintext passwords/passphrases are not kept in browser storage, so this connection needs them again: re-enter them when reopening the tab, or switch the credential to an env: reference in the settings card (the value lives in the host credential store).","error.terminalNeedsCommand":"ttyTerminal requires a command","error.terminalCommandSingleLine":"command must be a single line","error.terminalNeedsHost":"ttyTerminal.mount requires an HTMLElement as the mount point","error.panelNotReady":"ttyPanel.mountPane: the terminal panel is not ready","panel.dragHeight":"Drag to resize height","panel.dragWidth":"Drag to resize width","btn.closePane":"Close the side pane","btn.expandPane":"Expand the side pane","btn.collapsePane":"Collapse the side pane","panel.tabLabel":"Terminal {n}","btn.close":"Close","btn.closeTabAria":"Close tab: {label}","btn.newTab":"New (local / SSH)","btn.tabList":"Tab list","btn.tabListTitle":"Tab list ({n})","list.tabsAllVisible":"No tabs are out of view","list.cleanExited":"Clean up exited tabs ({n})","btn.closeTab":"Close this tab","btn.hideFromAgent":"Hide this tab from the AI","btn.showToAgent":"Unhide (make it available to the AI)","btn.hiddenMark":"Hidden from AI","btn.closeLeft":"Close tabs to the left ({n})","btn.closeOthers":"Close other tabs ({n})","btn.closeRight":"Close tabs to the right ({n})","list.subLive":"{n} of them are still open","meta.tunnelRemote":"remote:{host}:{port} \u2192 local:{local}","meta.tunnelLocal":"local:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"Hosted by tmux \u2014 the session is reattached by name after a disconnect or host restart","status.notPersisted":"Not persisted","status.tmuxUnavailableTitle":"A persistent session was requested but tmux is unavailable \u2014 this is a plain session","status.connected":"Connected","status.connecting":"Connecting","status.errored":"Connection error","panel.tunnels":"Port forwarding","hint.tunnelsSettings":"Configure in Settings \u2192 Plugins \u2192 Terminal panel","panel.tunnelsFor":"Port forwarding \u2014 {name}","list.loading":"Loading\u2026","hint.tunnelsCard":"Add, remove, enable, or disable tunnels in the port-forwarding section of Settings \u2192 Plugins \u2192 Terminal panel","list.noActiveTunnels":"No enabled tunnels for this connection","status.fatalSuffix":" (no retry; fix the config)","msg.maxSessions":"Session limit reached ({live} total / max {max}: {own} in this window{others}) \u2014 close unused windows or tabs, or raise \u201CConcurrent session limit\u201D in the settings card","msg.maxSessionsOthers":" + {count} in other windows","error.probeHttp":"Connection test failed (HTTP {status})","msg.probing":"Testing the connection\u2026","meta.reachable":"reachable","meta.unreachable":"unreachable","meta.probeBanner":"banner ok","meta.hostKeyMatched":"Host key matched","meta.hostKeyRecorded":"Host key recorded (TOFU)","meta.hostKeyMismatch":"Host key mismatch!","meta.authOkMs":"Authenticated ({ms}ms)","meta.authOk":"Authenticated","meta.probeOk":"\u2705 Connected: {detail}","error.unknown":"Unknown error","btn.maxSessionsTitle":"Session limit reached \u2014 click to see what to do","option.localTerminal":"Local terminal","hint.tmuxHosted":"Hosted by tmux \xB7 recoverable after a host restart","hint.openInSessionCwd":"Open in the current session working directory","panel.sshBook":"SSH host book","btn.sftpFileBrowse":"SFTP file browser","btn.editConnection":"Edit connection","list.emptySshBook":"(empty \u2014 save one in the settings card or via \u201CSSH connection\u2026\u201D)","option.sshConnect":"SSH connection\u2026","hint.sshConnect":"Fill in host, user, and authentication manually","panel.editConnection":"Edit connection \xB7 {name}","panel.sshConnect":"SSH connection","section.jump":"Jump host","field.jumpHost":"Jump host ([user@]host[:port]; empty = direct)","placeholder.jumpHost":"e.g. bastion.corp:2222","check.jumpOwnCred":"Use separate credentials for the jump host","field.jumpUsername":"Jump host user (empty = same as the target)","field.jumpAuth":"Jump host auth (empty = same as the target)","hint.jumpInherit":"Empty credentials reuse the target host\u2019s auth method and keys. When the jump host itself is unreachable the error names it (it will not masquerade as a target timeout).","meta.jumpStage":"Jump host {label}","meta.viaJump":"\u21E2 via {label}","meta.viaProxy":"\u21E2 via proxy command","section.proxyCommand":"Proxy command","field.proxyCommand":"Proxy command (ProxyCommand; empty = unused)","placeholder.proxyCommand":"e.g. ssh -W %h:%p bastion","hint.proxyCommand":"A command run on this machine whose stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). Supports %h host, %p port, %r user, %n host and %% for a literal %; anything else is left as written. If a jump host is set too, the jump host wins (OpenSSH semantics). It needs the switch below, and importing ~/.ssh/config never fills it in.","hint.proxyCommandDisabled":"\u26A0 \u201CAllow ProxyCommand\u201D is off right now: this command will not run and the connection fails explicitly (it does not fall back to a direct connection). Turn it on in Plugin settings \u2192 Terminal panel.","hint.proxyCommandNotGranted":"\u26A0 Not granted by the host: clicking this switch starts a grant in place (the panel shows one command to run in a terminal on the host \u2014 no restart), or use the strictest route \u2014 export DSH_TTY_ALLOW_PROXY_COMMAND=1 in the environment that launched dsh and restart the host (setting it after launch does not count). The reason: cross-site pages and in-page scripts can both send loopback requests, so if the settings UI could raise it out of thin air this gate would be pointless. Turning it off always works.","badge.notEffective":"Not effective: not granted by the host","elev.title":"Grant in place (no restart)","elev.lockedWhy":"Any local process can send loopback requests, so \u201Cturn on a dangerous capability\u201D cannot be decided by this page alone \u2014 it has to be confirmed on the host\u2019s filesystem once.","elev.step":"Run the command below in a terminal on the host and the switch unlocks by itself:","elev.copy":"Copy command","elev.copied":"Copied","elev.copyManual":"The clipboard is unavailable here \u2014 select the command above and copy it manually.","elev.expiresIn":"expires in {sec}s","elev.expired":"This confirmation has expired \u2014 generate a new one.","elev.waiting":"Waiting for confirmation\u2026 once you run the command this turns into \u201Cgranted\u201D automatically.","elev.regenerate":"Generate a new one","elev.loading":"Generating the confirmation command\u2026","elev.granted":"Granted and now in effect.","elev.grantedNeedSave":"Granted. Press \u201CSave\u201D to apply.","elev.grantedAt":"Granted \xB7 {time}","elev.revoke":"Revoke host grant","elev.revoked":"Host grant revoked (the config switch is left untouched; granting again takes effect immediately).","elev.viaEnv":"Granted by a launch environment variable; to revoke, remove it from the launch environment and restart the host.","elev.close":"Collapse","elev.disableFirst":"Turn this config switch off first","elev.otherWay":"The other way (strongest, needs a host restart)","elev.envHow":"In the environment that launched dsh: export {env}=1, then restart the host. Setting it after launch \u2014 or writing it into some other config file \u2014 does not count as a grant; that is exactly what this gate guards against.","elev.error":"In-place grant failed: ","meta.probeProxy":"Proxy command","meta.probeProxyOff":"Proxy command (disabled)","meta.probeTcpSkipped":"Direct TCP check skipped (using the proxy command)","section.connection":"Connection","field.host":"Host","placeholder.host":"example.com or IP","field.port":"Port","field.username":"Username","section.auth":"Authentication","field.authMethod":"Auth method","option.authInherit":"(same as the target)","option.authAgent":"agent \u2014 use the local ssh-agent","option.authKey":"key \u2014 private key file","option.authPassword":"password \u2014 password","field.keyPath":"Private key path","field.hostKeyAlias":"Host key alias","field.passphrase":"Key passphrase (optional)","field.password":"Password","placeholder.credRef":"Or: pick a reference name from the credential store","hint.credRefCandidates":"Candidates = reference names already in the credential store + those in use by the local host book","list.credOverwrite":"{name} (click again to overwrite)","list.moreMatches":"{count} more \u2014 keep typing to filter","list.noCredRef":"No matching reference","check.rememberCredential":"Store in the credential store on save","hint.rememberCredential":"When checked, \u201CSave changes\u201D or \u201CConnect (and save)\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","btn.clearCredential":"Clear stored credential","error.credPlainUnavailable":"The host does not provide the credential service (remote.credentials); plaintext save only","error.credPlainIncomplete":"The credential service is incomplete; plaintext save only","status.credUnreported":"Reference {ref}: the host reported no status","error.credStatusFailed":"Failed to read the credential status: {error}","status.credStored":"Stored{source} \xB7 {ref}","meta.credSource":" (source: {source})","status.credUnknown":"Reference {ref}: the store does not have this value yet","hint.noCredRefPassphrase":"No other connection uses a credential reference yet \u2014 you can type env:NAME straight into the passphrase box","hint.noCredRefPassword":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on save\u201D above to create one, or type env:NAME straight into the password box","section.options":"Options","check.agentForward":"agent forwarding (the remote side can use local ssh-agent keys, e.g. remote git clone)","hint.hostKeyAlias":"Empty = pin the fingerprint by host address. When one host is reached through different addresses (behind a bastion / via port forwarding), give them the same alias so they share one host-key record instead of reporting a fingerprint change on every switch; it only decides where the fingerprint is stored, never the connection address","placeholder.hostKeyAlias":"Empty = by host address","check.persist":"Persistent session (hosted by tmux, survives a disconnect/restart; tmux must be installed on the remote)","check.saveToBook":"Save to the host book (overwrite the same name)","field.bookName":"Host book name","placeholder.bookName":"Leave empty to use the host name","error.hostUserRequired":"Host and username are required","error.keyPathRequired":"auth=key requires a private key path","error.passwordRequired":"auth=password requires a password","btn.cancel":"Cancel","btn.connect":"Connect","btn.fileBrowse":"File browser","btn.browseTitle":"Open the SFTP file browser with the values currently filled in, without touching a terminal","btn.probe":"Test","btn.probeTitle":"Diagnose the connection with the values currently filled in (TCP \u2192 host key \u2192 authentication); no session is created and no host fingerprint is recorded","error.saveCredFailed":"Save failed: {error}","btn.saveEdit":"Save changes","error.saveBookFailed":"Failed to save the host book: {error}","error.bookNameTaken":"The host book already has an entry named: {name}","panel.sftpDual":"SFTP dual pane \xB7 {label}","status.failed":"Failed","status.done":"Done","placeholder.localPath":"Local path (Enter to go)","placeholder.remotePath":"Remote path (Enter to go)","btn.refresh":"Refresh","btn.mkdir":"New folder","btn.hiddenFiles":"Hidden files","btn.hiddenFilesTitle":"Show / hide dot-files (.env, .gitignore, \u2026)","error.dirNotReady":"The directory is not resolved yet","meta.dir":"folder","btn.transferTo":"Transfer to {target}: {path}","meta.local":"local","meta.remote":"remote","error.transferDirsNotReady":"Both directories are not resolved yet; wait for the lists to load before transferring","msg.transferring":"Transferring {name}\u2026","error.transferFailed":"Transfer failed","error.noTaskId":"The server returned no task id","msg.transferCanceled":"Transfer canceled: {name}","msg.transferred":"Transferred {name}","btn.download":"Download {name}","btn.rename":"Rename {name}","placeholder.newName":"New name","btn.deleteEntry":"Delete {name}","btn.deleteEntryDir":"Delete {name} (with contents)","msg.deleted":"Deleted {name}","list.parentDir":".. (parent folder)","list.emptyDir":"(empty folder)","list.hiddenOnly":"(only hidden files here \u2014 click \u201CHidden files\u201D on the pane header to show them)","error.dropOnLocalPane":"Dropping onto the local pane has no action: to send local files to the other side, drop them on the right-hand \u201CRemote\u201D pane","list.truncated":"\u2026{rest} more not rendered ({total} total) \u2014 use the path box above to jump to a subfolder","list.itemCount":"{count} items","placeholder.newDirName":"New folder name (relative to the current folder)","msg.creatingDir":"Creating folder {name}\u2026","btn.ok":"OK","btn.confirm":"Confirm?","btn.cancelTransfer":"Cancel transfer","msg.downloadCanceled":"Download canceled: {name}","msg.downloadResuming":"Connection dropped \u2014 resuming {name} from {offset}\u2026","error.downloadFailed":"Download failed","msg.downloaded":"Downloaded {name} ({size})","error.downloadTooBig":"The file exceeds the download limit ({size}); use dual-pane \u21E6 direct transfer or scp/rsync in the terminal","msg.canceled":"Canceled","btn.upload":"Upload","btn.uploadTitle":"Pick files to upload, or drag files/folders straight into the list","msg.uploading":"Uploading\u2026","msg.uploadDone":"Upload finished","error.uploadFailed":"Upload failed","error.networkError":"Network error","error.uploadCountExceeded":"Too many files (limit {max}): {count} this time \u2014 upload in batches","status.overLimit":"Over the limit","error.uploadTooBig":"The file exceeds the upload limit ({size}): {name} \u2014 use dual-pane \u21E8 direct transfer or scp/rsync in the terminal","error.uploadTotalTooBig":"The total size exceeds the upload limit: upload in batches (or use dual-pane \u21E8 direct transfer)","msg.uploadCanceled":"Upload canceled ({done}/{total} done)","status.allDone":"All done","msg.uploadDoneCount":"Uploaded {count} files","error.connectFailed":"Connection failed: {error}","status.connectingEllipsis":"Connecting\u2026","status.connectedPid":"Connected pid={pid}","status.connectedSsh":"SSH {target}connected","status.exitedWith":"Exited {detail}","status.error":"Error: {message}","status.retryHint":"{message} \xB7 click to retry","btn.clickRetry":"Click to retry","status.disconnectedReconnecting":"Disconnected \u2014 reconnecting","status.disconnected":"Disconnected","status.reconnecting":"Reconnecting\u2026","error.copyFailed":"Copy failed: this environment does not allow clipboard access (over http, use localhost or the terminal's own shortcuts)","status.initializing":"Initializing\u2026","placeholder.search":"Search (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"Search (Ctrl+F) \u2014 Enter next / Shift+Enter previous","btn.clearTitle":"Clear","btn.minimizeTitle":"Minimize (sessions keep running; the status moves into the sidebar entry)","btn.minimize":"Minimize","btn.closePanelTitle":"Close the panel and end every session (you are asked first when sessions are still open; to just put it away hit \u201C\u2014\u201D, sessions keep running)","confirm.closeTitle":"End {n} sessions and close the panel?","confirm.closeText":"Closing the panel ends these {n} sessions that are still open (the tabs go with them).","confirm.closeTextAgent":"Closing the panel ends these {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.closeHint":"Only need room for other windows? Hit \u201CMinimize\u201D \u2014 sessions and output keep running.","confirm.closeOk":"End {n} sessions and close","confirm.tabsTitle":"End {n} sessions and close those tabs?","confirm.tabsText":"This ends {n} sessions that are still open, and their tabs go with them.","confirm.tabsTextAgent":"This ends {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.tabsHint":"Already-exited tabs are read-only leftovers \u2014 cleaning those loses nothing.","confirm.tabsOk":"End {n} sessions","btn.restoreDock":"Click to restore the terminal window","panel.title":"Terminal","status.minimized":"Terminal minimized \u2014 click to restore","error.configLoadFailed":"Failed to load the config","error.saveTunnelFailed":"Failed to save the tunnel","error.tunnelNameTaken":"A tunnel named \u201C{name}\u201D already exists \u2014 each \u201Chost book entry + direction + port\u201D combination can appear once. Change the port to get a new name, or delete the old one first.","msg.tunnelApplied":"Tunnel \u201C{name}\u201D is active","msg.tunnelUpdated":"Tunnel \u201C{name}\u201D updated","error.nameHostUserRequired":"Name, host, and username are required","msg.hostEdited":"Entry \u201C{name}\u201D updated \u2014 written to the config on \u201CSave\u201D","error.probeFailed":"\u274C Connection failed: {error}","error.hostKeyDeleteFailed":"Failed to delete the host key record","msg.hostKeyDeleted":"Host key record deleted (the fingerprint is recorded again on the next connection)","error.sshConfigReadFailed":"Failed to read ~/.ssh/config","msg.proxySkipped":"{count} entries use a jump host that could not be resolved (missing alias, or the alias itself needs a jump host) and were not imported: {names}","msg.proxyCommandSkipped":"{count} entries only set a proxy command (ProxyCommand) and were not imported: {names} \u2014 a proxy command is local command execution, so importing never fills it in; add it by hand on the connection-book entry and turn on \u201CAllow ProxyCommand\u201D","msg.skippedNotConcrete":"{count} entries are not a concrete host (wildcard / no User)","list.separator":", ","meta.etc":" etc.","msg.importOverflow":"{count} entries beyond the import limit were not imported","list.separatorFull":"; ","msg.noNewEntries":"No new entries ({count} skipped as duplicates)","msg.noImportableHosts":"~/.ssh/config has no concrete hosts to import","msg.importedHosts":"Imported {added} (skipped {skipped} duplicates); written to the config on \u201CSave\u201D","error.knownHostsReadFailed":"Failed to read ~/.ssh/known_hosts","msg.noNewFingerprints":"No new fingerprints ({count} already exist)","msg.noImportableKnownHosts":"known_hosts has no concrete hosts to import","error.saveHostKeysFailed":"Failed to save hostKeys","msg.importedFingerprints":"Imported fingerprints for {added} hosts (skipped {skipped} that already existed)","hint.knownHostsTruncated":"; note: known_hosts has more than 500 hosts \u2014 only the first 500 were imported","error.saveFailed":"Save failed","msg.saved":"Saved and applied live","check.rememberCredentialApply":"Store in the credential store on apply","hint.appliedOnSave":"Written to the config with the card's \u201CSave\u201D","card.name":"Terminal panel","card.desc":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence.","card.descFull":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence; shell / TERM / concurrency limits apply live on save.","list.loadingConfig":"Loading the config\u2026","section.basic":"Basics","check.enabled":"Enable the plugin (applies live on save: tools and the panel entry are withdrawn immediately, sessions move to keepalive)","check.announce":"Announce the terminal panel capabilities to the agent","check.shellIntegration":"Shell integration (OSC 133/7 injection)","check.shellIntegrationWindows":"Shell integration (OSC 133/7 injection; tty_capture{last} and cwd following depend on it)","hint.shellIntegrationWindows":"Not applicable on Windows hosts: injection relies on the POSIX `-c` wrapper and rc stubs, which do not hold for cmd / PowerShell (cmd ignores `-c` and exits, PowerShell reports that export does not exist). So cwd following and tty_capture{last} are unavailable for \u201Clocal\u201D tabs; remote Linux / macOS hosts are unaffected.","section.sftp":"SFTP file transfer","field.sftpStyle":"SFTP file browser style","option.sftpDialog":"Single pane \u2014 remote directory + upload/download/drag","option.sftpDual":"Dual pane \u2014 local on the left, remote on the right, direct transfer on selection","hint.sftpDual":"Dual pane copies files between local and remote (recursive, overwriting same names); takes effect after reopening SFTP","field.sftpLimits":"SFTP transfer limits (0 = unlimited)","field.downloadLimit":"Download limit (MB)","field.uploadLimit":"Upload limit (MB)","field.uploadCountLimit":"Batch file count limit","hint.sftpLimits":"Browser-side guard: a single file over the limit aborts the download/upload (for large files use dual-pane \u21E8/\u21E6 direct transfer or scp/rsync in the terminal; they do not consume browser memory); the file count limit applies to one batch/drag upload; applies live on save","section.session":"Sessions","field.persistence":"Session persistence (tmux)","option.persistOff":"Off \u2014 sessions end with the panel/host (default)","option.persistTmux":"tmux \u2014 new terminal/SSH tabs are persistent by default","hint.persistence":"When on, all new tabs (local / SSH host book / SSH connection dialog) are hosted by tmux by default and survive a host restart; tmux must be installed locally/remotely; the SSH dialog can opt out per connection; existing tabs are unaffected","hint.persistenceWindows":"; tmux is unavailable on Windows hosts, so local tabs still open but are not hosted","check.endOnPageClose":"End persistent sessions when the page closes (no keepalive)","check.statsEnabled":"Server stats bar (CPU / memory / disk / uptime / TCP / network; items that cannot be sampled show \u201CN/A\u201D)","hint.statsEnabled":"Off by default: persistent sessions survive closing the whole page (recoverable after the keepalive window); when on, they end together with the tmux session once the page disconnects and the keepalive window expires \u2014 note that refreshing the page within the keepalive window is unaffected","check.allowProxyCommand":"Allow ProxyCommand (runs a command on this machine; off by default)","hint.allowProxyCommand":"When on, a proxy command set on a connection-book entry runs on this machine, and its stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). This is the only switch in this plugin that turns a settings field into local command execution, so it is off by default: while off, a connection carrying a proxy command fails explicitly (it does not fall back to a direct connection). Importing ~/.ssh/config never fills one in.","field.maxSessions":"Concurrent session limit (1\u201316)","hint.maxSessions":"New tabs beyond the limit are rejected; applies live on save","field.shell":"Shell path (defaults to $SHELL)","field.shellWindows":"Shell path (defaults to %COMSPEC%)","placeholder.shell":"Leave empty to use $SHELL","placeholder.shellWindows":"Leave empty to use %COMSPEC% (or enter the full path to powershell.exe / pwsh.exe)","list.noShellCandidate":"No matching candidate \u2014 just type any path","hint.shellCandidatesWindows":"Windows host: candidates come from %COMSPEC% and the installed PowerShell (Windows PowerShell 5.1 / PowerShell 7), and you can type any path; cmd / PowerShell have no POSIX command-boundary hooks, so shell integration is unsupported for them","hint.shellCandidates":"Pick an installed shell from the list ($SHELL first) or type any path; zsh / bash support shell integration","hint.term":"TUI programs depend on this value","field.cwd":"Fallback working directory (the client's current session cwd wins)","placeholder.cwd":"Leave empty to use the host process start directory","field.grace":"Disconnect keepalive (seconds, 0 = end immediately)","hint.grace":"Sessions are kept alive for reconnect after a page refresh or network hiccup and end on timeout; applies live on save","section.assist":"AI assist","check.assistEnabled":'Explain failures (ask the model "why / what next" when a command exits non-zero)',"hint.assistEnabled":"Off by default. When on, a chip appears in the corner of the terminal after a command exits non-zero; clicking it sends that command's output tail (colors and progress bars stripped, repeated lines collapsed, keys/tokens masked) together with the current screen to the model \u2014 never the scrollback. A suggested command is only ever typed into the prompt line, never submitted for you.","field.assistRoute":"Model route (optional)","hint.assistRoute":"Empty follows the host default model","option.followHostModel":"Follow the host default model","list.modelLoading":"Loading candidates\u2026","list.noModelCandidate":"The host advertises no models","list.modelCatalogFailed":"Candidates unavailable \u2014 the host may not have restarted, or serves no model catalog (type provider/model to enter one manually)","badge.assistFailed":"Command failed ({code}) \xB7 explain","panel.assistTitle":"Why this command failed","panel.assistCommand":"Suggested command","status.assistThinking":"Asking the model\u2026","error.assistRequest":"Explanation failed: {message}","btn.assistFill":"Insert command","btn.assistCopy":"Copy answer","btn.assistCopyError":"Copy error","btn.assistClose":"Close","hint.assistFillNoEnter":"Types it into the prompt line; never submits","hint.assistNoCommand":"The model gave no directly-insertable command \u2014 use Copy and pick one yourself","section.ssh":"SSH connections","btn.probeRowTitle":"Test this entry: per-stage diagnosis of TCP \u2192 host key \u2192 authentication","msg.testing":"Testing\u2026","btn.test":"Test","btn.edit":"Edit","btn.delete":"Delete","list.emptySshHosts":"No entries \u2014 add one via the terminal panel's \u201C+\u201D \u2192 SSH connection\u2026 and check \u201CSave to the host book\u201D","btn.importSshConfig":"Import from ~/.ssh/config","hint.importSshConfig":"Same names are skipped; written to the config on \u201CSave\u201D","hint.sshBook":"Written to the config together with \u201CSave\u201D; passwords/passphrases support env:VAR references to avoid plaintext storage","check.tunnelEnabled":"Enable","list.emptyTunnels":"No tunnels \u2014 map a remote database or internal service to a local port","field.direction":"Forwarding direction","option.localForwardTitle":"Local forward -L: listen locally and connect to a target on the SSH server side","option.localForward":"Local -L","option.remoteForwardTitle":"Remote forward -R: listen on the SSH server side and dial back to a local service","option.remoteForward":"Remote -R","option.selectBook":"Pick a host book entry","hint.tunnelViaBook":"Connects via {book} \u2014 the tunnel's host and credentials come from that host book entry","hint.tunnelBookEmpty":"Pick which SSH connection this tunnel uses (host and credentials come from the host book)","hint.localListenFixed":"The local listen address is fixed to 127.0.0.1 (not exposed to the LAN)","placeholder.localPort":"Local port","field.localListenPort":"Local listen port","hint.flowLocalToRemote":"Traffic flow: local \u2192 SSH server side","placeholder.remoteHost":"Server-side host","hint.remoteHostTitle":"Target host name or IP (reached from the SSH server side; 127.0.0.1 = the server itself)","field.remoteHost":"Server-side target host","placeholder.port":"Port","field.remotePort":"Server-side target port","placeholder.remoteListenHost":"Server-side listen address","hint.remoteListenHost":"Server-side listen address (defaults to 127.0.0.1; leave empty to allow only the server itself)","field.remoteListenHost":"Server-side listen address","placeholder.listenPort":"Listen port","field.remoteListenPort":"Server-side listen port","hint.flowRemoteToLocal":"Traffic flow: local \u2190 SSH server side","hint.localDialFixed":"The local dial address is fixed to 127.0.0.1","placeholder.localTargetPort":"Local service port","field.localTargetPort":"Local target port","hint.tunnelLocalSummary":"Left: local listener (fixed 127.0.0.1) \u2192 Right: target reached from the SSH server side","hint.tunnelRemoteSummary":"Left: SSH server-side listener \u2192 Right: local service being reached (fixed 127.0.0.1)","btn.addTunnel":"Add tunnel","hint.tunnelAdd":"Takes effect immediately; reconnects automatically after a drop; prefer local ports above 1024; remote hosts are reached from the SSH server side (127.0.0.1 = the server itself)","hint.tunnelEditing":"Editing \u201C{name}\u201D \u2014 changing the port/entry derives a new name by rule; takes effect immediately on save","panel.hostKeys":"SSH host key records (TOFU)","btn.importKnownHosts":"Import from known_hosts","list.emptyHostKeys":"No records \u2014 the host fingerprint is recorded automatically after the first successful SSH connection","hint.hostKeys":"A host with several keys (e.g. rsa + ed25519) gets one fingerprint each and any match is accepted; a changed fingerprint rejects the connection (MITM protection) \u2014 delete that record once you are sure it is safe, then reconnect","msg.saving":"Saving\u2026","btn.save":"Save","list.none":"N/A","meta.mem":"Memory","meta.disk":"Disk","meta.cores":"Cores","meta.uptime":"Uptime","meta.temp":"CPU temp","meta.net":"Network","error.tunnelNoBook":"Add an SSH entry to the host book first","error.tunnelRemotePortRequired":"A remote listen port and a local target port are required (1\u201365535)","error.tunnelLocalRequired":"Local port, remote host, and remote port are required","error.tunnelMissing":"Tunnel \u201C{name}\u201D no longer exists (it may have been deleted by another window)","error.tunnelClash":"A tunnel named \u201C{name}\u201D already exists \u2014 handle that one first.","msg.renaming":"Renaming {name}\u2026","msg.deleting":"Deleting {name}\u2026","msg.downloading":"Downloading {name}\u2026","msg.uploadingName":"Uploading {name}","error.invalidTaskState":"The server returned an invalid task state","hint.rememberCredentialApply":"When checked, \u201CApply\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","hint.noCredRefPasswordApply":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on apply\u201D above to create one, or type env:NAME straight into the password box","hint.bookNameConflict":"A same-name conflict is rejected","btn.apply":"Apply"};function E_(e,t){return t===void 0?e:String(e).replace(/\{(\w+)\}/g,(r,i)=>t[i]===void 0?"":String(t[i]))}function mh(e,t){return E_($s[e]!==void 0?$s[e]:e,t)}var b=mh;function L_(e){e.inject(["locale"],t=>{let r=t.locale.register(Eo,"zh",$s),i=t.locale.register(Eo,"en",k_);return b=t.locale.bind(Eo),()=>{i(),r(),b=mh}})}function T_(){return Lc(document.baseURI,globalThis.__DSH_TRANSPORT__?.streamBaseUrl)}function oi(){return Ot!==null&&typeof Ot.describe=="function"?Ot:null}function Jr(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function M_(){let e=new Set;for(let t of Zt)for(let r of[t?.password,t?.passphrase]){let i=Jr(r);i!==""&&e.add(i)}return[...e]}async function R_(){try{let t=await(await fetch("/api/dsh-tty/credential-refs",{cache:"no-store"})).json();if(t.ok&&Array.isArray(t.names))return t.names.filter(r=>typeof r=="string"&&r!=="")}catch{}return[]}async function gh(){return[...new Set([...M_(),...await R_()])].sort()}async function vh(e){let t=oi();if(t===null)return{error:b(Ot===null?"error.credServiceMissing":"error.credServiceIncomplete")};try{let r=await t.describe([e]),i=r?.ok===!0?r.value?.[e]:void 0;return i===void 0?{unreported:!0}:{view:{configured:i.configured===!0,writable:i.writable===!0,source:typeof i.source=="string"?i.source:""}}}catch(r){return{error:r instanceof Error?r.message:String(r)}}}async function A_(e,t){let r=oi();if(r===null||typeof r.set!="function")return{error:b("error.credStoreUnavailable")};try{return await r.set(e,t),{value:"env:"+e}}catch(i){return{error:b("error.credStoreFailed",{error:i instanceof Error?i.message:String(i)})}}}async function bh(e){let t=oi();if(t===null||typeof t.unset!="function")return{error:b("error.credClearUnavailable")};try{return await t.unset(e),{}}catch(r){return{error:b("error.credClearFailed",{error:r instanceof Error?r.message:String(r)})}}}async function wh(e,t,r,i,n,s){if(e!==!0)return{};let o=String(t??"").trim();if(o===""||o.startsWith("env:"))return{};let a=Tc(r,i,n,s);return a===""?{error:b("error.credRefNeedsHost")}:A_(a,o)}function on(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var Os;function Yi(){document.getElementById("dsh-tty-style")||(Os=document.createElement("style"),Os.id="dsh-tty-style",Os.textContent=Ec+`
|
|
3666
|
-
`+kc,document.head.appendChild(Os))}var an='<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>',D_='<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>',yh='<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>',P_='<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>',B_='<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>',Sh='<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>',Ch='<svg viewBox="0 0 16 16" width="13" height="13" fill="currentColor" stroke="none" aria-hidden="true"><circle cx="3.4" cy="8" r="1.35"/><circle cx="8" cy="8" r="1.35"/><circle cx="12.6" cy="8" r="1.35"/></svg>',O_='<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>',ln='<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>',Xi='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>',I_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/></svg>',N_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/><path d="M3 13L13 3"/></svg>',H_='<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>',Fi='<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>',xh='<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>',kh='<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>',Xo='<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>',Eh='<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>',F_='<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>',Jo='<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>',Sr='<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>',Zo='<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>',Lh='<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>',Qo='<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>',ea='<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>',W_='<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>',z_='<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>',U_='<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>',j_='<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>',Th='<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>',$_='<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>',Mh='<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>',Rh=null,Re=null,ue=null,qs=null,Wi=null,Ot=null,Cr=null,Tr=null,Ee=null,Bt=null,Ri=null,Ai=null,Ks=null,pt=null,Di=null,Je=null,mt=null,Xt=null,Zr=null,zi=!1,Pi=null,Ge=!1,Xe=null,Ui=null,ai=null,Mr=null,Gs=null,xr=null,Bi=1e3,Vs="dsh-tty:tabs",le=new Map,Ji=new Set,ta=()=>Ji.size>0,Ao=new Set,Se=null,Zi=0,Is=!1,gt=null,Ys=!1,fr=new Map,kr=null,Rr=null,Qr=null,cr=null,Xs=null,nt=null,ei=null,Zt=[],Js=!0,yt=null,It=null,ji="",ti=null,Do=null,St=null,Oi=null,Mi=null,Po=null,Bo=new Set;function cn(e){return Bo.add(e),()=>Bo.delete(e)}cn(({tab:e,addAction:t})=>{Lr&&e.exited&&t(P_,b("btn.reopen"),b("btn.reopenTitle"),()=>qi(e.sid))});cn(({tab:e,addAction:t})=>{Lr&&t(B_,"SFTP",b("btn.sftpTitle"),()=>pn(e.spawnSpec,e.sid))});cn(({bookName:e,addAction:t})=>{if(!Lr)return;let r=e!==""?Zh(e):0;if(r>0){t(Sh,b("btn.tunnels",{count:r}),b("btn.tunnelsTitle"),i=>qh(i.currentTarget,e));return}e!==""&&t(Ch,b("btn.more"),b("btn.moreTitle"),i=>xm(i.currentTarget,e))});function hn(e,t){if(Cr===null)return;Cr.textContent=e.split("\u2014\u2014")[0],Cr.title=e,Tr.dataset.state=t,qs!==null&&(qs.style.display=t==="connected"?"none":""),ai!==null&&(ai.textContent=e),Mr!==null&&(Mr.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function Lo(e,t,r){let i=typeof e=="string"&&e!==""?e:null;if(i!==null){let n=le.get(i);n!==void 0&&(n.statusText=t,n.statusState=r)}Vc(i,Se)&&(Wi=i,hn(t,r))}function Ns(e,t){Wi=null,hn(e,t)}function ra(){if(!Yc(Wi,Se))return;let e=Se===null?void 0:le.get(Se);Wi=e===void 0?null:Se;let t=Gc(e,b);hn(t.text,t.state)}function Pe(e){Re!==null&&Re.readyState===WebSocket.OPEN&&Re.send(JSON.stringify(e))}function q_(){let e=[],t=document.createDocumentFragment();for(let r of ko(b)){let i=document.createElement("span");i.className="tt_statsItem";let n=document.createElement("span");n.className="tt_statsLabel",n.textContent=r.label,i.appendChild(n);let s=null,o=null;r.kind==="pct"&&(s=document.createElement("span"),s.className="tt_statsMeter",o=document.createElement("span"),o.className="tt_statsMeterFill",s.appendChild(o),i.appendChild(s));let a=document.createElement("span");a.className="tt_statsValue",i.appendChild(a),t.appendChild(i),e.push({item:i,value:a,meter:s,fill:o,slot:null})}return yt!==null&&yt.appendChild(t),e}function K_(e,t){let r=nh(t!==void 0?t.stats:null,b);for(let i=0;i<e.length;i+=1){let n=e[i],s=r[i];if(s!==void 0&&(n.slot!==s.slot&&(n.slot=s.slot,n.value.style.minWidth=s.slot>0?s.slot+"ch":""),n.value.textContent!==s.value&&(n.value.textContent=s.value),n.item.getAttribute("title")!==s.title&&n.item.setAttribute("title",s.title),n.fill!==null&&n.meter!==null)){let o=s.pct===null?"0%":Math.max(0,Math.min(100,s.pct)).toFixed(1)+"%";n.fill.style.width!==o&&(n.fill.style.width=o);let a=eh(s.pct);n.meter.dataset.level!==a&&(n.meter.dataset.level=a)}}}function dn(){Mi=null,Po=null}function G_(){if(ue===null||Ge||!Js)return!1;let e=xt();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:ih(e.statsAt)}function Zs(){if(Ge)return;let e=xt();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&ui(e)}catch{}}}function Ar(){try{V_()}catch(e){console.warn("[dsh-tty] \u72B6\u6001\u6761\u6E32\u67D3\u5931\u8D25\uFF08\u5DF2\u6536\u8D77\uFF09: "+(e instanceof Error?e.message:String(e)));try{yt!==null&&(yt.hidden=!0,yt.textContent=""),dn(),Je!==null&&delete Je.dataset.stats}catch{}}}function V_(){if(Je===null||yt===null)return;let e=G_(),t=Je.dataset.stats!==void 0!==e;if(!e){t&&delete Je.dataset.stats,yt.hidden=!0,Mi!==null&&(yt.textContent="",dn()),t&&Zs();return}yt.hidden=!1,Mi===null&&(Mi=q_());let r=xt(),i=r===void 0?"":r.sid+":"+String(r.statsAt||0);i!==Po&&(Po=i,K_(Mi,r)),t&&(Je.dataset.stats="",Zs())}function Ah(){Oi===null&&(Oi=setInterval(()=>Ar(),1e3))}function Dh(){Oi!==null&&(clearInterval(Oi),Oi=null)}function Ph(){if(ue===null||Ge||!Js)return null;let e=xt();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function Qi(){let e=Ph();e!==St&&(St!==null&&Pe({t:"statsOff",sid:St}),St=e,e!==null&&Pe({t:"statsOn",sid:e}))}function Y_(e){if(e!==Ph()){Qi();return}St!==null&&St!==e&&Pe({t:"statsOff",sid:St}),St=e,Pe({t:"statsOn",sid:e})}function X_(){let e=xt();return e===void 0||e.embedded===!0?null:e.releasePending===!0?{kind:"released",tab:e}:e.exited===!0?{kind:"exited",tab:e}:null}function es(){if(Je===null||It===null)return;let e=X_(),t=e!==null,r=Je.dataset.exited!==void 0!==t;if(!t){It.hidden=!0,It.textContent="",ji="",r&&(delete Je.dataset.exited,Zs());return}It.hidden=!1,J_(e),r&&(Je.dataset.exited="",Zs())}function J_(e){let{kind:t,tab:r}=e,i=typeof r.exitDetail=="string"?r.exitDetail:"",n=t+":"+r.sid+":"+i;if(n===ji)return;ji=n,It.textContent="";let s=document.createElement("span");s.className="tt_exitBarText",s.textContent=t==="released"?b("status.aiEnded"):i===""?b("status.exited"):b("status.exitedWith",{detail:i}),t==="released"&&(s.title=b("hint.aiEndedTab")),It.appendChild(s);let o=document.createElement("span");if(o.className="tt_exitBarSpacer",It.appendChild(o),t==="released"){oh(b("btn.dismiss"),b("btn.dismissTitle"),()=>{Ft(r.sid,{silent:!0})});return}if(r.spawnSpec===null||typeof r.spawnSpec!="object")return;let a=r.agentOwned===!0;oh(b(a?"btn.newLocalTerminal":"btn.reopenSession"),b(a?"hint.reopenAgentLocal":"hint.reopenWithSpec"),()=>qi(r.sid))}function oh(e,t,r){let i=document.createElement("button");i.type="button",i.className="tt_toolBtn tt_exitBarBtn",i.textContent=e,typeof t=="string"&&t!==""&&(i.title=t),i.addEventListener("click",r),It.appendChild(i)}function xt(){return Se!==null?le.get(Se):void 0}function Oo(){try{return Pc(Rh?.list?.getSnapshot?.())}catch{return}}function Z_(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Pe({t:"refresh",sid:e.sid})}}var Hs=null;function Bh(e){Hs!==null&&clearTimeout(Hs),Hs=setTimeout(()=>{Hs=null;let t=xt();t!==void 0&&Z_(t)},e??200)}var Q_=["password","passphrase"];function ah(e){if(e===null||typeof e!="object"||e.t!=="ssh")return e;let t=e.credsStripped===!0,r={...e};for(let i of Q_){let n=r[i];typeof n=="string"&&n!==""&&!n.startsWith("env:")&&(delete r[i],t=!0)}return t&&(r.credsStripped=!0),r}var Oh=1;function Ht(){try{let e=[...le.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:ah(t.spawnSpec),label:t.label}));e.length===0||ue===null?sessionStorage.removeItem(Vs):sessionStorage.setItem(Vs,JSON.stringify({v:Oh,tabs:e})),em([...le.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:ah(t.spawnSpec),label:t.label})))}catch(e){console.warn("[dsh-tty] \u6807\u7B7E\u6301\u4E45\u5316\u5931\u8D25\uFF08\u672C\u6B21\u5237\u65B0\u540E\u6807\u7B7E\u5217\u8868\u53EF\u80FD\u4E22\u5931\uFF09: "+(e instanceof Error?e.message:String(e)))}}var Io="dsh-tty:persist-specs";function em(e){try{let t=e.filter(r=>rs(r.spawnSpec)).map(r=>({spawnSpec:r.spawnSpec,label:r.label}));t.length===0?localStorage.removeItem(Io):localStorage.setItem(Io,JSON.stringify(t))}catch{}}function tm(){try{let e=localStorage.getItem(Io);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&rs(r.spawnSpec)):[]}catch{return[]}}function rm(){try{let e=sessionStorage.getItem(Vs);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):t!==null&&typeof t=="object"&&t.v===Oh&&Array.isArray(t.tabs)?t.tabs.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):[]}catch{return[]}}function Qs(e,t){let r=Re;return new Promise(i=>{let n=null,s=o=>{let a;try{a=JSON.parse(o.data)}catch{return}a.t===e&&(n!==null&&clearTimeout(n),r.removeEventListener("message",s),i(r===Re?a:null))};n=setTimeout(()=>{r.removeEventListener("message",s),i(null)},t),r.addEventListener("message",s)})}function im(e){return e===void 0?null:e.embedded===!0?e.controller!==void 0&&e.controller!==null?e.controller.hostEl:null:e.termEl}function Ih(e){if(e===void 0||e.fit===null||e.fit===void 0)return;let t;try{t=e.fit.proposeDimensions()}catch{return}let r=im(e);return Bc(t,r==null?null:{width:r.clientWidth,height:r.clientHeight})}function ui(e){if(e===void 0||e.fit===void 0)return;let t=Ih(e);t!==void 0&&(e.lastDims=t,Pe({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows}))}function sm(e){if(e===void 0||e.fit===void 0)return;let t=e.term,r=t!==null&&t.buffer!==void 0?t.buffer.active:null,i=r==null?null:{atBottom:r.viewportY>=r.baseY,line:r.viewportY};try{e.fit.fit()}catch{return}if(i!==null)try{i.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(i.line,t.buffer.active.baseY))}catch{}e.exited||ui(e)}function Vr(e,t,r,i){if(e.overlayEl===null||e.overlayEl===void 0)return;let n=e.overlayEl,s=i==="error"||i==="info"?i:"exited";if(s==="exited"&&e.embedded!==!0){n.textContent="";return}if(t===""||t===void 0){n.textContent="";return}n.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?Th:s==="info"?Zo:$_)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(r===void 0||r===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",n.querySelector(".tt_overlayMain").textContent=t,r!==void 0&&r!==""&&(n.querySelector(".tt_overlayHint").textContent=r)}function Te(e,t=""){try{let r=getComputedStyle(document.body).getPropertyValue(e).trim();return r!==""?r:t}catch{return t}}function fi(e){let t=Te("--tt-accent"),r={};r.background=Te("--tt-term-bg"),r.foreground=Te("--tt-term-fg"),r.cursor=t,r.cursorAccent=Te("--tt-term-cursor-accent"),r.selectionBackground=Te("--tt-term-selection"),r.black=Te("--tt-an-black"),r.red=Te("--tt-an-red"),r.green=Te("--tt-an-green"),r.yellow=Te("--tt-an-yellow"),r.blue=Te("--tt-an-blue"),r.magenta=Te("--tt-an-magenta"),r.cyan=Te("--tt-an-cyan"),r.white=Te("--tt-an-white"),r.brightBlack=Te("--tt-an-bright-black"),r.brightRed=Te("--tt-an-bright-red"),r.brightGreen=Te("--tt-an-bright-green"),r.brightYellow=Te("--tt-an-bright-yellow"),r.brightBlue=Te("--tt-an-bright-blue"),r.brightMagenta=Te("--tt-an-bright-magenta"),r.brightCyan=Te("--tt-an-bright-cyan"),r.brightWhite=Te("--tt-an-bright-white");let i=new ph.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:r}),n=new _h.FitAddon,s=new tl;i.loadAddon(n),i.loadAddon(s),i.loadAddon(new rl);let o=document.createElement("div");o.className="tt_term";let a=document.createElement("div");a.className="tt_overlay",a.addEventListener("click",()=>{a.textContent="",qi(e.sid)}),a.setAttribute("role","button"),a.setAttribute("aria-label",b("btn.reopenSession")),a.tabIndex=0,a.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(d.preventDefault(),a.textContent="",qi(e.sid))}),o.appendChild(a),i.open(o);try{n.fit()}catch{}try{let d=new xc;d.onContextLoss(()=>{try{d.dispose()}catch{}}),i.loadAddon(d)}catch{}i.onData(d=>{Pe({t:"input",sid:e.sid,d}),fr.delete(e.sid)&&Pr()}),i.onResize(()=>{rs(e.spawnSpec)&&Bh(200)}),i.attachCustomKeyEventHandler(d=>e.embedded===!0?!0:(d.ctrlKey||d.metaKey)&&d.key.toLowerCase()==="f"?(d.preventDefault(),bd(),!1):!0),e.term=i,e.fit=n,e.search=s,e.termEl=o,e.overlayEl=a}function lh(e){return e===null||typeof e!="object"?"":["t","name","host","port","username","command","cwd","persist","persistName","hidden"].map(r=>r+"="+String(e[r]??"")).join("\0")}function nm(e){let t=lh(e);if(t==="")return null;for(let r of le.values())if(r.exited!==!0&&r.embedded!==!0&&lh(r.spawnSpec)===t)return r;return null}function $i(e,t){let r=on(),i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??sg(),label:t};return fi(i),le.set(r,i),Zi+=1,it(),tr(r,{user:!0}),un(i),Ht(),i}function om(e){if(Array.isArray(e))for(let t of e){if(t===null||typeof t!="object"||t.owner!=="agent"||t.exited===!0)continue;let r=typeof t.sid=="string"?t.sid:"";if(r===""||le.has(r))continue;let i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,agentOwned:!0,spawnSpec:{t:"spawn",cwd:typeof t.cwd=="string"?t.cwd:Oo()},label:"agent"+(t.kind==="ssh"&&typeof t.target=="string"&&t.target!==""?" \xB7 "+t.target:"")};fi(i),le.set(r,i),Zi+=1,it(),Nh()&&i.termEl!==null&&Je!==null&&Se===null&&tr(r),Pe({t:"attach",sid:r}),am()}}function Nh(){return ue!==null&&Ge!==!0}function am(){try{Ht()}catch{}}function lm(e){if(om(e),!Array.isArray(e))return;for(let i of e){if(i===null||typeof i!="object"||i.owner!=="agent")continue;let n=typeof i.sid=="string"?le.get(i.sid):void 0;n!==void 0&&n.embedded!==!0&&n.agentOwned!==!0&&(n.agentOwned=!0)}let t=Nc(e),r=!1;for(let[i,n]of[...le]){let s=Hc(n,t);if(s!=="keep"){if(s==="mark-exited"){n.exited!==!0&&(n.exited=!0,n.live=!1,r=!0);continue}cm(n)||Ft(i,{silent:!0})}}r&&(it(),_n())}function cm(e){return!Nh()||e.watched!==!0||e.sid!==Se?!1:(e.releasePending===!0||(e.releasePending=!0,es()),!0)}function hm(e){if(le.has(e.sid))return le.get(e.sid);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};fi(t),le.set(t.sid,t),Zi+=1,it(),tr(t.sid),Pe({t:"attach",sid:t.sid})}function dm(e){if(!(e?.spawnSpec?.credsStripped!==!0||e.term===null))try{e.term.writeln("\x1B[2m[dsh-tty] "+b("msg.passwordNotStored")+"\x1B[0m")}catch{}}function un(e){dm(e);let t=Ih(e);t!==void 0&&(e.lastDims=t);let r=t!==void 0?t:e.lastDims!==void 0?e.lastDims:{cols:80,rows:24},i={...e.spawnSpec,sid:e.sid,cols:r.cols,rows:r.rows};if(Re===null||Re.readyState!==WebSocket.OPEN){Ao.add({tab:e,frame:i});return}Pe(i)}function um(e,t){let r=le.get(e);if(r===void 0||r.embedded===!0||t===!0&&!So(r))return;let i=t===!0;vr(r.spawnSpec)!==i&&(r.spawnSpec=Co(r.spawnSpec,i),Pe({t:"hidden",sid:e,hidden:i}),Ht(),it(),li())}var fm="\u{1F648}";function Hh(e){let t=le.get(e),r=t===void 0?"":t.label||b("panel.tabLabel",{n:fn(e)});return t===void 0||!vr(t.spawnSpec)?r:`${fm} ${r}`}function ch(e){let t={sid:on(),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};fi(t),le.set(t.sid,t),Zi+=1,it(),tr(t.sid),un(t)}function qi(e){let t=le.get(e);if(t===void 0)return;if(t.embedded===!0){Uh(t);return}let r=t.spawnSpec,i=t.label;if(Pe({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),le.delete(e);let n={sid:on(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:i};fi(n),le.set(n.sid,n),it(),tr(n.sid,{user:!0}),un(n),Ht()}function Ft(e,t){let r=le.get(e);if(r===void 0)return;let i=t?.silent===!0;if(Ct!==null&&Ct.ownerKey===e&&Ni(!0),i||Pe({t:"kill",sid:e}),le.delete(e),Qt(),Rr===e&&kt(),fr.delete(e),Pr(),Ji.delete(e),r.term!==null)try{r.term.dispose()}catch{}if(r.termEl!==null&&r.termEl.remove(),Se===e){Se=null;let n=[...le.entries()].filter(([,s])=>s.embedded!==!0).map(([s])=>s).pop()??null;n!==null&&tr(n)}it(),ra(),es(),di(),Xe!==null&&_n(),[...le.values()].some(n=>n.embedded!==!0)?Ht():Vi()}function Fh(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error(b("error.terminalNeedsCommand"));if(/[\r\n\0]/.test(t))throw new Error(b("error.terminalCommandSingleLine"));return t}function Wh(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 pm(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&&ui(e)}}),t.observer.observe(t.hostEl))}function zh(e,t,r){let i={sid:on(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:r};return fi(i),le.set(i.sid,i),Ji.add(i.sid),e.hostEl.appendChild(i.termEl),pm(i),un(i),i}function Uh(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||Pe({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),le.delete(e.sid),Ji.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=zh(t,e.spawnSpec,e.label),Se===e.sid&&(Se=t.tab.sid,ra()),t.tab}}function _m(e,t){if(!(e instanceof HTMLElement))throw new Error(b("error.terminalNeedsHost"));let r=Fh(t),i=Wh(t,r),n=typeof t?.label=="string"&&t.label!==""?t.label:void 0;Yi();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=zh(s,i,n),og(),()=>mm(s)}function mm(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||Pe({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),le.delete(t.sid),Ji.delete(t.sid),e.tab=null}if(ue===null&&!ta()&&Re!==null){zi=!0;try{Re.close()}catch{}Re=null}}var gm=460,vm=280,bm=320,wm=160,Ct=null,Yr=gm,Xr=bm;function ia(){let e=ue!==null?ue.querySelector(".tt_modal"):null,t=e!==null?e:ue;return t!==null?t.getBoundingClientRect():null}var sa=e=>e==="bottom"?wm:vm;function ym(e){let t=ia();if(t===null)return 900;let r=e==="bottom"?t.height:t.width;return Math.max(sa(e),Math.round(r*.72))}function Ii(e,t){return Math.min(ym(e),Math.max(sa(e),Math.round(t)))}function Ws(){let e=Ct;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){Xr=Ii("bottom",Xr),e.el.style.width="",e.el.style.height=String(Xr)+"px",e.el.style.flexBasis=String(Xr)+"px";return}Yr=Ii("right",Yr),e.el.style.height="",e.el.style.width=String(Yr)+"px",e.el.style.flexBasis=String(Yr)+"px"}}function Ni(e){let t=Ct;if(t!==null){if(Ct=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(r){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(r instanceof Error?r.message:String(r)))}try{t.el.remove()}catch{}mt!==null&&delete mt.dataset.side}}function jh(e){if(Vo(),mt===null)throw new Error(b("error.panelNotReady"));Ct!==null&&Ni(!0),Yi();let t=Gr(e?.ownerSid,Se),r=e?.side==="bottom"?"bottom":"right",i=Math.max(r==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:sa(r)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let c=Ii(r,e.size);r==="bottom"?Xr=c:Yr=c}let n=document.createElement("div");n.className="tt_dockPane",n.dataset.side=r,mt.dataset.side=r,n.innerHTML='<div class="tt_dockPaneResize" title="'+b(r==="bottom"?"panel.dragHeight":"panel.dragWidth")+'"></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="'+b("btn.closePane")+'">'+ln+'</button></div><div class="tt_dockPaneBody"></div>',mt.appendChild(n);let s=n.querySelector(".tt_dockPaneTitle"),o=n.querySelector(".tt_dockPaneHint"),a=n.querySelector(".tt_dockPaneBody"),d=n.querySelector(".tt_dockPaneFold"),l=n.querySelector(".tt_dockPaneClose"),_=n.querySelector(".tt_dockPaneResize"),m={el:n,element:a,disposed:!1,collapsed:!1,side:r,minSize:i,ownerKey:t,onClose:typeof e?.onClose=="function"?e.onClose:null},y=()=>r==="bottom"?m.collapsed?Xo:W_:m.collapsed?ea:Qo,p=c=>{m.collapsed=c===!0,m.collapsed?n.dataset.collapsed="1":delete n.dataset.collapsed,d.innerHTML=y(),d.title=m.collapsed?b("btn.expandPane"):b("btn.collapsePane"),d.setAttribute("aria-label",d.title),Ws()};return m.setTitle=c=>{s.textContent=typeof c=="string"?c:""},m.setHint=c=>{o.textContent=typeof c=="string"?c:""},m.isCollapsed=()=>m.collapsed===!0,m.collapse=()=>p(!0),m.expand=()=>p(!1),m.toggle=()=>p(!m.collapsed),m.dispose=()=>{m.disposed||Ct!==m||Ni(!1)},_.addEventListener("mousedown",c=>{if(c.button!==0||m.collapsed)return;c.preventDefault();let u=c.clientX,h=c.clientY,f=n.getBoundingClientRect(),v=g=>{r==="bottom"?Xr=Ii("bottom",Math.max(i,f.height+(h-g.clientY))):Yr=Ii("right",Math.max(i,f.width+(u-g.clientX))),Ws()},S=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)}),_.addEventListener("dblclick",()=>p(!m.collapsed)),d.addEventListener("click",()=>p(!m.collapsed)),l.addEventListener("click",()=>Ni(!0)),m.setTitle(typeof e?.title=="string"?e.title:""),m.setHint(typeof e?.hint=="string"?e.hint:""),p(e?.collapsed===!0),Ct=m,Ws(),$h(),m}function $h(){let e=Ct;if(e!==null){if(bo(e.ownerKey,Se)){delete e.el.dataset.dockHidden,mt!==null&&(mt.dataset.side=e.side);return}e.el.dataset.dockHidden="1",mt!==null&&delete mt.dataset.side}}function tr(e,t){let r=le.get(e);if(r===void 0||r.embedded===!0)return;t?.user===!0&&(r.watched=!0);let i=Se!==null?le.get(Se):void 0;if(!(i!==void 0&&i.releasePending===!0&&i.sid!==e&&le.size>1&&(Ft(i.sid,{silent:!0}),le.get(e)===void 0))){Se=e,kt(),Pr();for(let[n,s]of le)s.embedded!==!0&&s.termEl!==null&&(s.termEl.style.display=n===e?"":"none");r.embedded!==!0&&Je!==null&&r.termEl!==null&&r.termEl.parentElement!==Je&&Je.appendChild(r.termEl),Qi(),Ar(),it(),Er(),$h();try{r.fit.fit()}catch{}r.spawned&&!r.exited&&ui(r),Vr(r,""),es(),ra()}}function To(e){if(Ee===null)return;let t=le.get(e);if(t===void 0)return;let i=Ee.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");if(i==null)return;i.dataset.state=en(t);let n=nt===null?null:nt.querySelector('[data-sid="'+e+'"] .tt_tabDot');n!==null&&(n.dataset.state=en(t))}var Mo=!1;function it(){if(Ee===null)return;if(Ee.querySelector(".tt_tabRename")!==null){Mo||(Mo=!0,setTimeout(()=>{Mo=!1,it()},1e3));return}Ee.textContent="";for(let[t,r]of le){if(r.embedded===!0)continue;let i=document.createElement("button");i.className="tt_tab",i.dataset.sid=t,t===Se&&(i.dataset.active="");let n=document.createElement("span");n.className="tt_tabDot",n.dataset.state=en(r),i.appendChild(n);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=Hh(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),km(t,i)});let o=document.createElement("span");o.className="tt_tabClose",o.title=b("btn.close"),o.innerHTML=Xi,o.setAttribute("role","button"),o.setAttribute("aria-label",b("btn.closeTabAria",{label:r.label||""})),o.tabIndex=0,o.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" "||a.key==="Spacebar")&&(a.preventDefault(),a.stopPropagation(),Ft(t))}),i.title=vr(r.spawnSpec)?`${s.textContent} \u2014 ${b("btn.hiddenMark")}`:s.textContent,i.appendChild(s),i.appendChild(o),i.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),Ft(t);return}tr(t,{user:!0})}),Ee.appendChild(i)}let e=Ee.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"}),li(),nt!==null&&le.size===0&&vt()}function li(){if(Ee===null)return;let e=Ee.scrollWidth-Ee.clientWidth,t=e>1,r=zc(id()),i=t||ld().length>0||r>=2;if(Bt!==null&&(Bt.hidden=!i,i?Bt.title=b("btn.tabListTitle",{n:String(r)}):nt!==null&&vt()),!t){delete Ee.dataset.edge,nt!==null&&Uo();return}let n=Ee.scrollLeft>1,s=Ee.scrollLeft<e-1;Ee.dataset.edge=n&&s?"both":s?"end":"start",nt!==null&&Uo()}function en(e){return e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting"}function Sm(e){if(Ee===null||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let t=Ee.scrollWidth-Ee.clientWidth;if(t<=1)return;let r=Math.max(0,Math.min(t,Ee.scrollLeft+e.deltaY));r!==Ee.scrollLeft&&(e.preventDefault(),Ee.scrollLeft=r)}function Cm(e){return e?.direction==="remote"?b("meta.tunnelRemote",{host:e.remoteHost||"127.0.0.1",port:String(e.remotePort??0),local:String(e.localTargetPort??0)}):b("meta.tunnelLocal",{local:String(e?.localPort??0),host:e?.remoteHost??"?",port:String(e?.remotePort??0)})}function Er(){if(Ri===null||Ks===null||Di===null||Ai===null)return;Di.textContent="";let e=xt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){Ri.dataset.hidden="";return}delete Ri.dataset.hidden;let r=Number(t.port);Ks.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(r)&&r!==22?":"+r:""),pt!==null&&(e.persistTmux===!0?(pt.textContent="tmux",pt.dataset.state="ok",pt.title=b("status.tmuxPersistedTitle")):t.persist===!0&&e.spawned===!0?(pt.textContent=b("status.notPersisted"),pt.dataset.state="warn",pt.title=b("status.tmuxUnavailableTitle")):(pt.textContent="",delete pt.dataset.state,pt.removeAttribute("title")));let i=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Ai.dataset.state=i,Ai.title=b(i==="connected"?"status.connected":i==="connecting"?"status.connecting":i==="error"?"status.errored":"status.exited");let n=(o,a,d,l)=>{let _=document.createElement("button");_.type="button",_.className="tt_toolBtn tt_connAct",_.title=d,_.innerHTML=o+"<span></span>",_.lastElementChild.textContent=a,_.addEventListener("click",l),Di.appendChild(_)};if(typeof t.command=="string"&&t.command!=="")return;let s=typeof t.name=="string"?t.name:"";for(let o of Bo)try{o({tab:e,spec:t,bookName:s,addAction:n})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}function xm(e,t){if(ri!==null){zs();return}let r=document.createElement("div");r.className="tt_addMenu tt_connMore",ri=r,Dr(r,b("panel.tunnels"),b("hint.tunnelsSettings"),()=>{zs(),qh(e,t)},void 0,Sh),document.body.appendChild(r);let i=e.getBoundingClientRect(),n=r.offsetWidth,o=i.left+n>window.innerWidth-8?i.right-n:i.left;r.style.left=Math.max(8,Math.min(o,window.innerWidth-n-8))+"px",r.style.top=i.bottom+6+"px";let a=d=>{ri===r&&(r.contains(d.target)||e.contains(d.target)||zs())};js=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0)}function zs(){js!==null&&(document.removeEventListener("mousedown",js,!0),js=null),ri!==null&&(ri.remove(),ri=null)}var wr=null,Us=null,ri=null,js=null;function tn(){Us!==null&&(document.removeEventListener("mousedown",Us,!0),Us=null),wr!==null&&(wr.remove(),wr=null)}function qh(e,t){if(wr!==null){tn();return}let r=document.createElement("div");r.className="tt_tunnelPop";let i=document.createElement("div");i.className="tt_tunnelPopTitle",i.textContent=b("panel.tunnelsFor",{name:t}),r.appendChild(i);let n=document.createElement("div");n.textContent=b("list.loading"),r.appendChild(n);let s=document.createElement("span");s.className="tt_cardHint",s.textContent=b("hint.tunnelsCard"),r.appendChild(s),document.body.appendChild(r),wr=r;let o=e.getBoundingClientRect();r.style.top=String(o.bottom+6)+"px",r.style.left=String(Math.max(8,o.right-340))+"px";let a=d=>{wr===r&&(r.contains(d.target)||e.contains(d.target)||tn())};Us=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let d=[];try{let m=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();m.ok&&Array.isArray(m.tunnels)&&(d=m.tunnels)}catch{}if(wr!==r)return;n.textContent="";let l=na.filter(_=>_?.bookName===t&&_?.enabled!==!1);if(l.length===0){let _=document.createElement("span");_.className="tt_cardHint",_.textContent=b("list.noActiveTunnels"),n.appendChild(_);return}for(let _ of l){let m=d.find(h=>h?.name===_?.name),y=m?.state??"stopped",p=document.createElement("div");p.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=y==="active"?"connected":y==="error"?"error":"connecting";let u=document.createElement("span");u.className="tt_connTarget",u.title=String(m?.error??m?.lastForwardError??""),u.textContent=Cm(_)+" \xB7 "+y+(m?.fatal===!0?b("status.fatalSuffix"):""),p.appendChild(c),p.appendChild(u),n.appendChild(p)}})()}function fn(e){let t=1;for(let r of le.keys()){if(r===e)return String(t);t+=1}return String(t)}function km(e,t){let r=le.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let i=t.querySelector(".tt_tabLabel");if(i===null)return;let n=document.createElement("input");n.className="tt_tabRename",n.value=r.label||b("panel.tabLabel",{n:fn(e)}),i.replaceWith(n),n.focus(),n.select();let s=!1,o=()=>{if(s)return;s=!0;let d=n.value.trim();r.label=d!==""?d:void 0,it(),Ht()},a=()=>{s||(s=!0,it())};n.addEventListener("keydown",d=>{d.stopPropagation(),d.key==="Enter"?o():d.key==="Escape"&&a()}),n.addEventListener("blur",o),n.addEventListener("click",d=>d.stopPropagation())}var na=[],Kh="dialog",ur="off",Jt={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},Gh="dsh-tty:show-hidden",yr=(()=>{try{return localStorage.getItem(Gh)==="1"}catch{return!1}})();function Em(e){yr=e===!0;try{localStorage.setItem(Gh,yr?"1":"0")}catch{}for(let t of No)try{t(yr)}catch{}}var No=new Set,Ho=null,ii=null,Vh=!1,Yh=!1,dr=null,rn=null,Lr=!1;function Xh(e){Lr=e,rn!==null&&rn.set(e)}function Lm(e){Xh(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==Js&&(Js=e.statsEnabled,Qi(),Ar())}function Ki(e){Lm(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(Zt=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(na=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(Kh=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(ur=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(Jt={...Jt,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(ii=e.maxSessions),e!==null&&typeof e=="object"&&typeof e.allowProxyCommand=="boolean"&&(Vh=e.allowProxyCommand),e!==null&&typeof e=="object"&&typeof e.assistEnabled=="boolean"&&(Ys=e.assistEnabled,Ys||kt(),Pr()),e!==null&&typeof e=="object"&&typeof e.allowProxyCommandGranted=="boolean"&&(Yh=e.allowProxyCommandGranted)}function Tm(e,t){let r=t==="error"||t==="info"?t:"warn",i=document.createElement("div");i.className="tt_toast",i.dataset.kind=r,i.innerHTML='<span class="tt_toastIcon">'+(r==="error"?Th:r==="info"?j_:U_)+'</span><span class="tt_toastText"></span>',i.lastElementChild.textContent=e,document.body.appendChild(i),setTimeout(()=>i.remove(),4e3)}async function Jh(){try{Pe({t:"sessions"});let e=await Qs("sessions",3e3);if(e!==null&&Array.isArray(e.list))return dr=Ic(e.list),dr}catch{}return null}async function sn(){if(await Jh(),ii===null||dr===null||dr<ii)return null;let e=[...le.values()].filter(n=>!n.exited).length,t=Math.max(0,dr-e),r=t>0?b("msg.maxSessionsOthers",{count:t}):"",i=b("msg.maxSessions",{live:dr,max:ii,own:e,others:r});return Tm(i),i}function Mm(){return ii!==null&&dr!==null&&dr>=ii}function oa(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function Zh(e){return na.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function Fo(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",i=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",n=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+i+n}async function Wo(e,t){let r=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),i=await r.json().catch(()=>({}));return i&&i.ok===!1&&i.error?{error:String(i.error)}:i&&i.result?{result:i.result}:{error:String(i&&i.error?i.error:b("error.probeHttp",{status:r.status}))}}function zo(e,t){if(!e)return b("msg.probing");let r=e,i=typeof r.tcp?.ms=="number"?r.tcp.ms:null,n=typeof r.auth?.ms=="number"?r.auth.ms:null,s=[];if(r.jump!==null&&typeof r.jump=="object"&&typeof r.jump.label=="string"&&r.jump.label!==""){let _=typeof r.jump.tcp?.ms=="number"?r.jump.tcp.ms:null,m=r.jump.tcp?.ok?_!==null?_+"ms":b("meta.reachable"):b("meta.unreachable");s.push(b("meta.jumpStage",{label:r.jump.label})+" "+m)}r.proxy!==null&&typeof r.proxy=="object"&&s.push(r.proxy.active===!0?b("meta.probeProxy"):b("meta.probeProxyOff")),r.tcp?.ok?s.push("TCP "+(i!==null?i+"ms":b("meta.reachable"))):r.tcp?.skipped===!0&&s.push(b("meta.probeTcpSkipped")),r.banner?.ok&&s.push(b("meta.probeBanner"));let o=r.hostkey?.state;if(o==="matched"?s.push(b("meta.hostKeyMatched")):o==="recorded"?s.push(b("meta.hostKeyRecorded")):o==="mismatch"&&s.push(b("meta.hostKeyMismatch")),r.auth?.ok){let _=n!==null?b("meta.authOkMs",{ms:n}):b("meta.authOk");return b("meta.probeOk",{detail:_+(s.length?" \xB7 "+s.join(" \xB7 "):"")})}let a=r.tcp?.skipped===!0?"":r.tcp?.error,l=(r.auth?.error||a||b("error.unknown"))+(s.length?" \xB7 "+s.join(" \xB7 "):"");return t?.prefix!==void 0?t.prefix+l:b("error.probeFailed",{detail:l})}async function aa(){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 r=Zt;Ki(t.config),gt!==null&&Zt!==r&&Ko(gt)}}catch{}}function Qh(e){gt!==null&&(e.target instanceof Element&&(gt.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||_t())}function ts(e,t){ed(e,t.getBoundingClientRect())}function ed(e,t){let r=e.offsetWidth,i=e.offsetHeight,s=t.left+r>window.innerWidth-8?t.right-r:t.left;e.style.left=Math.max(8,Math.min(s,window.innerWidth-r-8))+"px";let o=t.bottom+6,a=t.top-i-6;e.style.top=(o+i>window.innerHeight-8&&a>=8?a:Math.min(o,Math.max(8,window.innerHeight-i-8)))+"px"}function Rm(e){if(gt!==null){_t();return}vt(),aa(),Jh().then(()=>{gt!==null&&Ko(gt)});let t=document.createElement("div");t.className="tt_addMenu",gt=t,Ko(t),document.body.appendChild(t),ts(t,e),document.addEventListener("mousedown",Qh,!0)}function _t(){gt!==null&&(document.removeEventListener("mousedown",Qh,!0),gt.remove(),gt=null)}function Am(e){if(nt!==null){vt();return}_t();let t=document.createElement("div");t.className="tt_addMenu tt_tabMenu",nt=t,Uo(),document.body.appendChild(t),ts(t,e),document.addEventListener("mousedown",td,!0),document.addEventListener("keydown",rd,!0)}function vt(){nt!==null&&(document.removeEventListener("mousedown",td,!0),document.removeEventListener("keydown",rd,!0),nt.remove(),nt=null)}function td(e){nt!==null&&(e.target instanceof Element&&(nt.contains(e.target)||e.target.closest(".tt_tabMore")!==null)||vt())}function rd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),vt())}function Uo(){let e=nt;if(e===null)return;e.textContent="";let t=Fm();if(t.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=b("list.tabsAllVisible"),e.appendChild(i),jo(e,Se),$o(e);return}for(let[i,n]of t){let s=Hh(i)||n.label||b("panel.tabLabel",{n:fn(i)}),o=Wm(n),a=document.createElement("div");a.className="tt_addMenuRow tt_tabMenuRow",a.dataset.sid=i;let d=document.createElement("button");d.type="button",d.className="tt_addMenuItem tt_tabMenuItem",i===Se&&(d.dataset.active="");let l=document.createElement("span");l.className="tt_tabDot",l.dataset.state=en(n),d.appendChild(l);let _=document.createElement("span");_.className="tt_addMenuText tt_tabMenuText";let m=document.createElement("span");if(m.className="tt_addMenuMain",m.textContent=s,_.appendChild(m),o!==""){let p=document.createElement("span");p.className="tt_tabMenuMeta",p.textContent=o,_.appendChild(p)}d.appendChild(_),d.title=o===""?s:s+" \xB7 "+o,d.addEventListener("click",()=>{tr(i,{user:!0}),vt()}),a.appendChild(d);let y=document.createElement("button");y.type="button",y.className="tt_addMenuEdit",y.innerHTML=Xi,y.title=b("btn.close"),y.setAttribute("aria-label",b("btn.closeTabAria",{label:s})),y.addEventListener("click",()=>{Ft(i)}),a.appendChild(y),e.appendChild(a)}let r=e.querySelector(".tt_tabMenuItem[data-active]");r!==null&&typeof r.scrollIntoView=="function"&&r.scrollIntoView({block:"nearest"}),jo(e,Se),$o(e)}function id(){return[...le].map(([e,t])=>({sid:e,embedded:t.embedded===!0,exited:t.exited===!0,agentOwned:t.agentOwned===!0}))}function jo(e,t){let r=Uc(id(),t),i=[[b("btn.closeOthers",{n:String(r.others.sids.length)}),r.others,Sr],[b("btn.closeLeft",{n:String(r.left.sids.length)}),r.left,ea],[b("btn.closeRight",{n:String(r.right.sids.length)}),r.right,Qo]].filter(([,s])=>s.sids.length>0);if(i.length===0)return;let n=document.createElement("div");n.className="tt_addMenuSep",e.appendChild(n);for(let[s,o,a]of i)Dr(e,s,o.live>0?b("list.subLive",{n:String(o.live)}):"",()=>{Dm(o)},void 0,a)}function Dm(e){if(Qt(),vt(),e.sids.length===0)return;let t=e.sids.slice(),r=()=>{for(let i of t)Ft(i)};if(e.confirm!==!0){r();return}Cd({title:b("confirm.tabsTitle",{n:String(e.live)}),text:e.agentLive>0?b("confirm.tabsTextAgent",{n:String(e.live),agent:String(e.agentLive)}):b("confirm.tabsText",{n:String(e.live)}),hint:b("confirm.tabsHint"),okLabel:b("confirm.tabsOk",{n:String(e.live)}),onOk:r})}var si=null,sd=null;function Pm(e,t,r){if(le.get(e)===void 0)return;Qt(),_t(),vt();let i=document.createElement("div");i.className="tt_addMenu tt_tabCtxMenu",si=i,sd=e,Bm(i,e),document.body.appendChild(i),ed(i,{left:t,right:t,top:r,bottom:r}),document.addEventListener("mousedown",nd,!0),document.addEventListener("keydown",od,!0)}function Qt(){si!==null&&(document.removeEventListener("mousedown",nd,!0),document.removeEventListener("keydown",od,!0),si.remove(),si=null,sd=null)}function nd(e){si!==null&&(e.target instanceof Element&&si.contains(e.target)||Qt())}function od(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Qt())}function Bm(e,t){let r=le.get(t);if(r===void 0)return;let i=r.label||b("panel.tabLabel",{n:fn(t)});if(Dr(e,b("btn.closeTab"),i,()=>{Qt(),Ft(t)},void 0,Xi),So(r)){let n=vr(r.spawnSpec);Dr(e,b(jc(n)),i,()=>{Qt(),um(t,!n)},void 0,n?N_:I_)}jo(e,t),$o(e)}function Om(e){let t=ad(e.target);if(t===null)return;e.preventDefault();let r=e.clientX,i=e.clientY;if(r===0&&i===0){let n=e.target instanceof Element?e.target.closest(".tt_tab"):null;if(n!==null){let s=n.getBoundingClientRect();r=s.left,i=s.bottom}}Pm(t,r,i)}function Im(e){if(e.button!==1)return;let t=ad(e.target);t!==null&&(e.preventDefault(),Ft(t))}function ad(e){if(!(e instanceof Element))return null;let t=e.closest(".tt_tab");if(t===null)return null;let r=t.dataset.sid;return r===void 0||r===""||!le.has(r)?null:r}function ld(){return[...le.values()].filter(e=>e.embedded!==!0&&e.exited===!0)}function $o(e){let t=ld();if(t.length===0)return;let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r),Dr(e,b("list.cleanExited",{n:String(t.length)}),"",()=>{vt(),Qt();for(let i of t)Ft(i.sid)},void 0,yh)}var Nm=40;function Hm(e,t){let r=e.getBoundingClientRect();return Math.max(0,Math.min(r.right,t.right)-Math.max(r.left,t.left))}function Fm(){let e=[];if(Ee===null)return e;let t=Ee.getBoundingClientRect();for(let[r,i]of le){if(i.embedded===!0)continue;let n=Ee.querySelector('[data-sid="'+r+'"]');n!==null&&Hm(n,t)<Nm&&e.push([r,i])}return e}function Wm(e){return typeof e.target=="string"?e.target:""}function zm(){return b("panel.assistTitle")===$s["panel.assistTitle"]?"zh":"en"}function Um(e){let t=e!=null&&typeof e.exitCode=="number"?String(e.exitCode):"?";return b("badge.assistFailed",{code:t})}function Pr(){if(cr===null)return;let e=Se===null?void 0:fr.get(Se),t=Ys&&e!==void 0&&e.dismissed!==!0;if(cr.hidden=!t,t){let r=cr.querySelector(".tt_assistBadgeText");r!==null&&(r.textContent=Um(e))}}function kt(){Qr!==null&&(Qr.abort(),Qr=null),kr!==null&&(kr.remove(),kr=null),Rr=null,Xs=null}function jm(e){kr!==null&&(e.target instanceof Element&&(kr.contains(e.target)||e.target.closest(".tt_assistBadge")!==null)||kt())}function $m(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),kt())}function qm(e){let t=Se;if(t===null)return;kt();let r=document.createElement("div");r.className="tt_addMenu tt_assistMenu",kr=r,Rr=t,Xs=e,document.body.appendChild(r),document.addEventListener("mousedown",jm,!0),document.addEventListener("keydown",$m,!0),qo(),ts(r,e),Km(t)}async function Km(e){let t=fr.get(e);if(t===void 0||t.busy===!0||(t.error===null||t.error===void 0)&&t.answer!==null&&t.answer!==void 0)return;t.busy=!0,t.answer=null,t.command="",t.error=null,qo();let r=new AbortController;Qr=r;try{let i=await fetch("/api/dsh-tty/assist",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({sid:e,kind:"failure",lang:zm()}),signal:r.signal}),n=await i.json().catch(()=>null);if(Rr!==e)return;t.busy=!1,i.ok&&n!==null&&n.ok===!0?(t.answer=String(n.answer!==void 0?n.answer:""),t.command=String(n.command!==void 0?n.command:"")):t.error=n!==null&&n.error!==void 0?String(n.error):"HTTP "+String(i.status)}catch(i){if(r.signal.aborted||Rr!==e)return;t.busy=!1,t.error=i instanceof Error?i.message:String(i)}finally{Qr===r&&(Qr=null),t.busy=!1,qo()}}function qo(){let e=kr;if(e===null)return;let t=Rr,r=t===null?void 0:fr.get(t);e.textContent="";let i=document.createElement("div");i.className="tt_assistHead";let n=document.createElement("span");if(n.className="tt_assistTitle",n.textContent=b("panel.assistTitle"),i.appendChild(n),r!==void 0&&typeof r.exitCode=="number"){let m=document.createElement("span");m.className="tt_assistCode",m.textContent="exit="+String(r.exitCode),i.appendChild(m)}e.appendChild(i);let s=r!==void 0&&typeof r.error=="string"&&r.error!=="",o=document.createElement("div");if(o.className="tt_assistBody",r===void 0||r.busy===!0){o.classList.add("tt_assistMuted","tt_assistBusy");let m=document.createElement("span");m.className="tt_assistSpin",o.appendChild(m),o.appendChild(document.createTextNode(b("status.assistThinking")))}else if(s)o.textContent=b("error.assistRequest",{message:r.error}),o.classList.add("tt_assistError");else{let m=r.answer!==null&&r.answer!==void 0?r.answer:"";o.textContent=m,o.classList.add("tt_assistAnswer"),m===""&&(o.hidden=!0)}if(e.appendChild(o),r===void 0||r.busy===!0)return;let a=r.command!=="";if(a){let m=document.createElement("div");m.className="tt_assistCmdWrap";let y=document.createElement("span");y.className="tt_assistCmdLabel",y.textContent=b("panel.assistCommand"),m.appendChild(y);let p=document.createElement("div");p.className="tt_assistCmd",p.textContent=r.command,m.appendChild(p),e.appendChild(m)}let d=document.createElement("div");if(d.className="tt_assistFoot",a){let m=document.createElement("button");m.type="button",m.className="tt_toolBtn tt_assistFill",m.textContent=b("btn.assistFill"),m.title=b("hint.assistFillNoEnter"),m.addEventListener("click",Gm),d.appendChild(m)}let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent=b(s?"btn.assistCopyError":"btn.assistCopy"),l.addEventListener("click",()=>{if(s){uh(b("error.assistRequest",{message:r.error}));return}uh(r.answer!==null&&r.answer!==void 0?r.answer:"")}),d.appendChild(l);let _=document.createElement("button");if(_.type="button",_.className="tt_toolBtn tt_assistClose",_.textContent=b("btn.assistClose"),_.addEventListener("click",()=>{kt()}),d.appendChild(_),e.appendChild(d),!s){let m=document.createElement("span");m.className="tt_assistNote",m.textContent=b(a?"hint.assistFillNoEnter":"hint.assistNoCommand"),e.appendChild(m)}Xs!==null&&ts(e,Xs)}function Gm(){let e=Rr,t=e===null?void 0:fr.get(e);if(e===null||t===void 0||t.command==="")return;Pe({t:"input",sid:e,d:""+t.command});let r=le.get(e);kt(),Vm(e),r!==void 0&&r.term!==null&&r.term.focus()}function Vm(e){let t=fr.get(e);t!==void 0&&(t.dismissed=!0),Pr()}function Dr(e,t,r,i,n,s){let o=document.createElement("button");if(o.type="button",o.className="tt_addMenuItem",n===!0&&(o.setAttribute("data-soldout",""),o.title=b("btn.maxSessionsTitle")),s!==void 0){let l=document.createElement("span");l.className="tt_addMenuIcon",l.innerHTML=s,o.appendChild(l)}let a=document.createElement("span");a.className="tt_addMenuText";let d=document.createElement("span");if(d.className="tt_addMenuMain",d.textContent=t,a.appendChild(d),r!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=r,a.appendChild(l)}o.appendChild(a),o.addEventListener("click",i),e.appendChild(o)}function Ko(e){e.textContent="";let t=Mm();Dr(e,b("option.localTerminal"),b(ur==="tmux"?"hint.tmuxHosted":"hint.openInSessionCwd"),async()=>{await sn()||(_t(),$i())},t,an);let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r);let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=b("panel.sshBook"),e.appendChild(i);for(let s of Zt){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let o=document.createElement("div");o.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title=b("btn.maxSessionsTitle"));let d=document.createElement("span");d.className="tt_addMenuIcon",d.innerHTML=z_;let l=document.createElement("span");l.className="tt_addMenuText";let _=document.createElement("span");_.className="tt_addMenuMain",_.textContent=s.name;let m=document.createElement("span");m.className="tt_addMenuSub";let y=Zh(s.name),p=go(s.jump);m.textContent=Fo(s)+(p===""?"":" "+b("meta.viaJump",{label:p}))+(typeof s.proxyCommand=="string"&&s.proxyCommand.trim()!==""?" "+b("meta.viaProxy"):"")+(y>0?" \xB7 \u21C4"+String(y):""),l.appendChild(_),l.appendChild(m),a.appendChild(d),a.appendChild(l),a.addEventListener("click",async()=>{if(await sn())return;_t();let h=ur==="tmux"&&s.persist!==!1?{persist:!0,persistName:oa()}:{};$i({t:"ssh",name:s.name,...h},s.name)});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title=b("btn.sftpFileBrowse"),c.innerHTML=Fi,c.addEventListener("click",()=>{_t(),pn({name:s.name})});let u=document.createElement("button");u.type="button",u.className="tt_addMenuEdit",u.title=b("btn.editConnection"),u.innerHTML=Jo,u.addEventListener("click",()=>{_t(),hh(s)}),o.appendChild(a),o.appendChild(c),o.appendChild(u),e.appendChild(o)}if(Zt.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=b("list.emptySshBook"),e.appendChild(s)}let n=document.createElement("div");n.className="tt_addMenuSep",e.appendChild(n),Dr(e,b("option.sshConnect"),b("hint.sshConnect"),()=>{_t(),hh()},!1,Mh)}function hh(e){if(ei!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,i=document.createElement("div");i.className="tt_sshBackdrop";let n=document.createElement("div");n.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshTitle",s.innerHTML=Mh+"<span></span>",s.lastElementChild.textContent=r?b("panel.editConnection",{name:String(t.name??"")}):b("panel.sshConnect"),n.appendChild(s);let o=Z=>{let re=document.createElement("div");return re.className="tt_sshSection",re.textContent=Z,re},a={},d=(Z,re,ne)=>{let oe=document.createElement("label");oe.className="tt_sshRow";let ie=document.createElement("span");ie.className="tt_cardLabel",ie.textContent=re,oe.appendChild(ie);let ae;if(ne?.select!==void 0){ae=document.createElement("select");for(let he of ne.select){let ye=document.createElement("option");ye.value=he.value,ye.textContent=he.label,ae.appendChild(ye)}}else ae=document.createElement("input"),ae.type=ne?.type??"text",ae.placeholder=ne?.placeholder??"";return ae.className="tt_cardInput",ae.autocomplete="off",ae.spellcheck=!1,oe.appendChild(ae),a[Z]=ae,oe};n.appendChild(o(b("section.connection")));let l=document.createElement("div");l.className="tt_sshGrid",l.appendChild(d("host",b("field.host"),{placeholder:b("placeholder.host")})),l.appendChild(d("port",b("field.port"),{placeholder:"22"})),n.appendChild(l),n.appendChild(d("username",b("field.username"),{placeholder:"root"})),n.appendChild(o(b("section.auth"))),n.appendChild(d("auth",b("field.authMethod"),{select:[{value:"agent",label:b("option.authAgent")},{value:"key",label:b("option.authKey")},{value:"password",label:b("option.authPassword")}]}));let _=d("keyPath",b("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),m=d("passphrase",b("field.passphrase"),{type:"password"}),y=d("password",b("field.password"),{type:"password"}),p=(Z,re)=>{let ne=document.createElement("div");ne.className="tt_sshRow tt_envRow";let oe=document.createElement("input");oe.type="text",oe.className="tt_cardInput",oe.placeholder=b("placeholder.credRef"),oe.title=b("hint.credRefCandidates"),oe.autocomplete="off",oe.spellcheck=!1;let ie=document.createElement("span");ie.className="tt_cardHint tt_envEmpty",ie.textContent=re,ie.hidden=!0,oe.hidden=!0;let ae=document.createElement("div");ae.className="tt_envList",ae.dataset.hidden="";let he=[],ye=()=>{if(ae.textContent="",he.length===0){let Ae=document.createElement("span");Ae.className="tt_cardHint",Ae.textContent=re,ae.appendChild(Ae);return}let be=oe.value.trim().toUpperCase(),Le=be===""?he:he.filter(Ae=>Ae.toUpperCase().includes(be));for(let Ae of Le.slice(0,30)){let we=document.createElement("button");we.type="button",we.className="tt_envItem",we.textContent=Ae;let Ce="env:"+Ae,Ne=null,Ue=()=>{Ne!==null&&(clearTimeout(Ne),Ne=null),we.textContent=Ae,delete we.dataset.danger};we.addEventListener("mousedown",Wt=>Wt.preventDefault()),we.addEventListener("click",()=>{let Wt=Z.value;if(Wt===""||Wt.startsWith("env:")||Ne!==null){Ue(),Z.value=Ce,Z.focus(),Z.dispatchEvent(new Event("change"));return}we.textContent=b("list.credOverwrite",{name:Ae}),we.dataset.danger="",Ne=setTimeout(Ue,4e3)}),ae.appendChild(we)}if(Le.length>30){let Ae=document.createElement("span");Ae.className="tt_envMore",Ae.textContent=b("list.moreMatches",{count:Le.length-30}),ae.appendChild(Ae)}else if(Le.length===0){let Ae=document.createElement("span");Ae.className="tt_envMore",Ae.textContent=b("list.noCredRef"),ae.appendChild(Ae)}};return oe.addEventListener("input",ye),oe.addEventListener("focus",()=>{he.length>0&&delete ae.dataset.hidden}),oe.addEventListener("blur",()=>{oe.value.trim()===""&&(ae.dataset.hidden="")}),ne.appendChild(oe),ne.appendChild(ie),ne.appendChild(ae),{row:ne,setNames(be){he=Array.isArray(be)?be:[];let Le=he.length>0;oe.hidden=!Le,ie.hidden=Le,ye()}}},c=(Z,re)=>{let ne=document.createElement("div");ne.className="tt_sshRow tt_credRow";let oe=document.createElement("label");oe.className="tt_credToggle";let ie=document.createElement("input");ie.type="checkbox",ie.className="tt_cardCheckbox";let ae=document.createElement("span");ae.textContent=b("check.rememberCredential"),oe.appendChild(ie),oe.appendChild(ae),ie.checked=Ot!==null,oe.title=b("hint.rememberCredential");let he=document.createElement("button");he.type="button",he.className="tt_toolBtn tt_credClear",he.textContent=b("btn.clearCredential"),he.dataset.hidden="";let ye=document.createElement("span");ye.className="tt_credStatus",ne.appendChild(oe),ne.appendChild(he),ne.appendChild(ye);let be=(we,Ce)=>{ye.textContent=we,ye.dataset.kind=Ce},Le=async()=>{let we=Jr(Z.value),Ce=we!=="";if(oe.hidden=Ce,he.hidden=!Ce,ye.hidden=!1,oi()===null){ie.disabled=!0,ie.checked=!1,he.disabled=!0,be(b(Ot===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),"muted");return}if(ie.disabled=!1,!Ce){ye.hidden=!0,be("","plain");return}let Ne=await vh(we);if(Ne.unreported===!0){be(b("status.credUnreported",{ref:we}),"plain");return}if(Ne.error!==void 0){be(b("error.credStatusFailed",{error:Ne.error}),"error");return}let Ue=Ne.view;be(Ue.configured?b("status.credStored",{ref:we,source:Ue.source!==""?b("meta.credSource",{source:Ue.source}):""}):b("status.credUnknown",{ref:we}),Ue.configured?"ok":"plain"),he.disabled=Ue.configured!==!0||Ue.writable!==!0};he.addEventListener("click",()=>{(async()=>{let we=Jr(Z.value);if(we==="")return;let Ce=await bh(we);if(Ce.error!==void 0){be(Ce.error,"error");return}Z.value="",await Le()})()});let Ae=async()=>{let we=await wh(ie.checked===!0,Z.value,a.host.value,a.port.value,a.username.value,re);return we.value!==void 0&&(Z.value=we.value,await Le()),we};return Z.addEventListener("change",()=>{Le()}),{row:ne,refresh:Le,storeIfRequested:Ae}},u=p(a.passphrase,b("hint.noCredRefPassphrase")),h=p(a.password,b("hint.noCredRefPassword")),f=c(a.password,"PASSWORD");(async()=>{let Z=await gh();u.setNames(Z),h.setNames(Z)})(),n.appendChild(_),n.appendChild(m),n.appendChild(u.row),n.appendChild(y),n.appendChild(f.row),n.appendChild(h.row),n.appendChild(o(b("section.jump")));let v=d("jumpHost",b("field.jumpHost"),{placeholder:b("placeholder.jumpHost")});n.appendChild(v);let S=document.createElement("label");S.className="tt_sshRow";let g=document.createElement("input");g.type="checkbox",g.className="tt_cardCheckbox";let x=document.createElement("span");x.className="tt_cardLabel",x.textContent=b("check.jumpOwnCred"),S.appendChild(g),S.appendChild(x),n.appendChild(S);let w=d("jumpUsername",b("field.jumpUsername"),{placeholder:"root"}),E=d("jumpAuth",b("field.jumpAuth"),{select:[{value:"",label:b("option.authInherit")},{value:"agent",label:b("option.authAgent")},{value:"key",label:b("option.authKey")},{value:"password",label:b("option.authPassword")}]}),P=d("jumpKeyPath",b("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),O=d("jumpPassphrase",b("field.passphrase"),{type:"password"}),F=d("jumpPassword",b("field.password"),{type:"password"});for(let Z of[w,E,P,O,F])n.appendChild(Z);let A=document.createElement("div");A.className="tt_cardHint",A.textContent=b("hint.jumpInherit"),n.appendChild(A),n.appendChild(o(b("section.proxyCommand")));let V=d("proxyCommand",b("field.proxyCommand"),{placeholder:b("placeholder.proxyCommand")});n.appendChild(V);let B=document.createElement("div");B.className="tt_cardHint",B.textContent=b("hint.proxyCommand"),n.appendChild(B);let R=document.createElement("div");R.className="tt_cardHint tt_sshProbeWarn",R.textContent=b("hint.proxyCommandDisabled"),n.appendChild(R);let z=()=>{let Z=a.proxyCommand.value.trim()!=="",re=Yh,ne=re&&Vh;R.textContent=b(re?"hint.proxyCommandDisabled":"hint.proxyCommandNotGranted"),R.style.display=Z&&!ne?"":"none"};a.proxyCommand.addEventListener("input",z),z();let I=()=>{let Z=mo(a.jumpHost.value);if(Z===void 0)return;if(g.checked!==!0)return Z;let re={...Z},ne=a.jumpUsername.value.trim();ne!==""&&(re.username=ne);let oe=a.jumpAuth.value;(oe==="agent"||oe==="key"||oe==="password")&&(re.auth=oe);let ie=a.jumpKeyPath.value.trim();return ie!==""&&(re.keyPath=ie),a.jumpPassphrase.value!==""&&(re.passphrase=a.jumpPassphrase.value),a.jumpPassword.value!==""&&(re.password=a.jumpPassword.value),re},C=()=>{let Z=a.proxyCommand.value.trim();return Z===""?void 0:Z},L=()=>{let Z=mo(a.jumpHost.value)!==void 0,re=Z&&g.checked===!0;S.style.display=Z?"":"none";for(let ne of[w,E,P,O,F])ne.style.display=re?"":"none";P.style.display=re&&a.jumpAuth.value==="key"?"":"none",O.style.display=re&&a.jumpAuth.value==="key"?"":"none",F.style.display=re&&a.jumpAuth.value==="password"?"":"none",A.style.display=Z?"":"none"};a.jumpHost.addEventListener("input",L),a.jumpAuth.addEventListener("change",L),g.addEventListener("change",L),n.appendChild(o(b("section.options")));let T=document.createElement("label");T.className="tt_cardRow";let D=document.createElement("input");D.type="checkbox",D.className="tt_cardCheckbox";let N=document.createElement("span");N.className="tt_cardLabel",N.textContent=b("check.agentForward"),T.appendChild(D),T.appendChild(N),n.appendChild(T),n.appendChild(d("hostKeyAlias",b("field.hostKeyAlias"),{placeholder:b("placeholder.hostKeyAlias")}));let G=document.createElement("span");G.className="tt_cardHint",G.textContent=b("hint.hostKeyAlias"),n.appendChild(G);let j=document.createElement("label");j.className="tt_cardRow";let Y=document.createElement("input");Y.type="checkbox",Y.className="tt_cardCheckbox";let H=document.createElement("span");H.className="tt_cardLabel",H.textContent=b("check.persist"),j.appendChild(Y),j.appendChild(H),Y.checked=ur==="tmux",ur==="tmux"&&n.appendChild(j);let k=document.createElement("label");k.className="tt_cardRow";let W=document.createElement("input");W.type="checkbox",W.className="tt_cardCheckbox";let q=document.createElement("span");q.className="tt_cardLabel",q.textContent=b("check.saveToBook"),k.appendChild(W),k.appendChild(q),n.appendChild(k);let $=d("name",b("field.bookName"),{placeholder:b("placeholder.bookName")});if($.style.display="none",n.appendChild($),W.addEventListener("change",()=>{$.style.display=W.checked?"":"none",W.checked&&a.name.value.trim()===""&&a.host.value.trim()!==""&&(a.name.value=a.host.value.trim()),W.checked&&a.name.focus()}),r){k.style.display="none",a.name.value=String(t.name??""),$.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??"");let Z=t.jump!==null&&typeof t.jump=="object"?t.jump:null;if(a.jumpHost.value=go(Z),Z!==null){let re=Z.auth!==void 0||Z.keyPath!==void 0||Z.password!==void 0||Z.passphrase!==void 0;g.checked=re,re&&(a.jumpUsername.value=String(Z.username??""),a.jumpAuth.value=Z.auth==="key"||Z.auth==="password"?String(Z.auth):"",a.jumpKeyPath.value=String(Z.keyPath??""),a.jumpPassphrase.value=String(Z.passphrase??""),a.jumpPassword.value=String(Z.password??""))}D.checked=t.agentForward===!0,a.hostKeyAlias.value=String(t.hostKeyAlias??""),a.proxyCommand.value=String(t.proxyCommand??""),z(),Y.checked=ur==="tmux"}let X=document.createElement("div");X.className="tt_sshStatus";let J=document.createElement("div");J.className="tt_sshError";let ce=document.createElement("div");ce.className="tt_sshProbeResult",X.appendChild(J),X.appendChild(ce),n.appendChild(X),L();let de=()=>a.hostKeyAlias.value.trim(),me=()=>{J.textContent="";let Z=a.host.value.trim(),re=a.username.value.trim(),ne=Number(a.port.value);if((!Number.isInteger(ne)||ne<1||ne>65535)&&(ne=22),Z===""||re==="")return J.textContent=b("error.hostUserRequired"),null;let oe=a.auth.value,ie={host:Z,port:ne,username:re,auth:oe},ae=I();ae!==void 0&&(ie.jump=ae);let he=C();if(he!==void 0&&(ie.proxyCommand=he),oe==="key"){let be=a.keyPath.value.trim();if(be==="")return J.textContent=b("error.keyPathRequired"),null;ie.keyPath=be;let Le=a.passphrase.value;Le!==""&&(ie.passphrase=Le)}if(oe==="password"){let be=a.password.value;if(be==="")return J.textContent=b("error.passwordRequired"),null;ie.password=be}D.checked&&(ie.agentForward=!0);let ye=de();return ye!==""&&(ie.hostKeyAlias=ye),ie},te=document.createElement("div");te.className="tt_sshActions";let Be=document.createElement("div");Be.className="tt_sshActionsGroup";let fe=document.createElement("div");fe.className="tt_sshActionsGroup",te.appendChild(Be),te.appendChild(fe);let Oe=document.createElement("button");Oe.type="button",Oe.className="tt_toolBtn",Oe.textContent=b("btn.cancel");let We=document.createElement("button");We.type="button",We.className="tt_cardSave",We.textContent=b("btn.connect"),Be.appendChild(Oe);let ke=document.createElement("button");ke.type="button",ke.className="tt_toolBtn",ke.textContent=b("btn.fileBrowse"),ke.title=b("btn.browseTitle"),ke.addEventListener("click",()=>{J.textContent="";let Z=a.host.value.trim(),re=a.username.value.trim(),ne=Number(a.port.value);if((!Number.isInteger(ne)||ne<1||ne>65535)&&(ne=22),Z===""||re===""){J.textContent=b("error.hostUserRequired");return}let oe=a.auth.value,ie={host:Z,port:ne,username:re,auth:oe},ae=I();ae!==void 0&&(ie.jump=ae);let he=C();if(he!==void 0&&(ie.proxyCommand=he),oe==="key"){let be=a.keyPath.value.trim();if(be===""){J.textContent=b("error.keyPathRequired");return}ie.keyPath=be;let Le=a.passphrase.value;Le!==""&&(ie.passphrase=Le)}if(oe==="password"){let be=a.password.value;if(be===""){J.textContent=b("error.passwordRequired");return}ie.password=be}D.checked&&(ie.agentForward=!0);let ye=de();ye!==""&&(ie.hostKeyAlias=ye),hr(),pn(ie)}),Be.appendChild(ke);let ee=null;r&&(ee=document.createElement("button"),ee.type="button",ee.className="tt_toolBtn",ee.textContent=b("btn.saveEdit"),ee.addEventListener("click",()=>{J.textContent="";let Z=a.host.value.trim(),re=a.username.value.trim();if(Z===""||re===""){J.textContent=b("error.hostUserRequired");return}let ne=Number(a.port.value);(!Number.isInteger(ne)||ne<1||ne>65535)&&(ne=22);let oe=a.auth.value,ae={name:a.name.value.trim()||Z,host:Z,port:ne,username:re,auth:oe,keyPath:oe==="key"?a.keyPath.value.trim():"",passphrase:a.passphrase.value,password:a.password.value,agentForward:D.checked,hostKeyAlias:de(),persist:Y.checked},he=I();if(he!==void 0&&(ae.jump=he),ae.proxyCommand=a.proxyCommand.value.trim(),oe==="key"&&ae.keyPath===""){J.textContent=b("error.keyPathRequired");return}ee!==null&&(ee.disabled=!0),(async()=>{let ye=await f.storeIfRequested();if(ye.error!==void 0){J.textContent=ye.error,ee!==null&&(ee.disabled=!1);return}ye.value!==void 0&&(ae.password=ye.value);let be=await Xm(String(t.name??""),ae);if(ee!==null&&(ee.disabled=!1),be!==void 0){J.textContent=b("error.saveCredFailed",{error:be});return}hr()})()}),Be.appendChild(ee));let pe=document.createElement("button");pe.type="button",pe.className="tt_toolBtn",pe.textContent=b("btn.probe"),pe.title=b("btn.probeTitle"),pe.addEventListener("click",()=>{let Z=me();Z!==null&&(ce.className="tt_sshProbeResult",ce.textContent=b("msg.probing"),pe.disabled=!0,Wo(Z,!1).then(re=>{pe.disabled=!1,re.result?(ce.className="tt_sshProbeResult"+(re.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),ce.textContent=zo(re.result)):(ce.className="tt_sshProbeResult tt_sshProbeBad",ce.textContent=b("error.probeFailed",{detail:String(re.error||b("error.unknown"))}))}))}),Be.appendChild(pe),fe.appendChild(We),n.appendChild(te);let ve=()=>{_.style.display=a.auth.value==="key"?"":"none",m.style.display=a.auth.value==="key"?"":"none",u.row.style.display=a.auth.value==="key"?"":"none",y.style.display=a.auth.value==="password"?"":"none",h.row.style.display=a.auth.value==="password"?"":"none",f.row.style.display=a.auth.value==="password"?"":"none"};a.auth.addEventListener("change",ve),ve(),f.refresh(),Oe.addEventListener("click",()=>hr()),i.addEventListener("mousedown",Z=>{Z.target===i&&hr()}),We.addEventListener("click",async()=>{J.textContent="";let Z=await sn();if(Z!==null){J.textContent=Z;return}let re=a.host.value.trim(),ne=a.username.value.trim(),oe=Number(a.port.value);if((!Number.isInteger(oe)||oe<1||oe>65535)&&(oe=22),re===""||ne===""){J.textContent=b("error.hostUserRequired");return}let ie=a.auth.value,ae={t:"ssh",host:re,port:oe,username:ne,auth:ie},he=I();he!==void 0&&(ae.jump=he);let ye=C();if(ye!==void 0&&(ae.proxyCommand=ye),ie==="key"){let Ce=a.keyPath.value.trim();Ce!==""&&(ae.keyPath=Ce);let Ne=a.passphrase.value;Ne!==""&&(ae.passphrase=Ne)}if(ie==="password"){let Ce=a.password.value;Ce!==""&&(ae.password=Ce)}D.checked&&(ae.agentForward=!0);let be=de();be!==""&&(ae.hostKeyAlias=be),Y.checked&&(ae.persist=!0,ae.persistName=oa());let Le=oe!==22?ne+"@"+re+":"+oe:ne+"@"+re,Ae=Ce=>{hr(),ue!==null&&$i(ae,Ce!==""?Ce:Le)};if(!W.checked){Ae("");return}let we=a.name.value.trim()||re;We.disabled=!0,(async()=>{let Ce=await f.storeIfRequested();if(Ce.error!==void 0){J.textContent=Ce.error,We.disabled=!1;return}let Ne=Ce.value??ae.password??"",Ue=await Ym({name:we,host:re,port:oe,username:ne,auth:ie,keyPath:ae.keyPath??"",passphrase:ae.passphrase??"",password:Ne,agentForward:D.checked,hostKeyAlias:de(),persist:Y.checked,...he!==void 0?{jump:he}:{},proxyCommand:a.proxyCommand.value.trim()});if(We.disabled=!1,Ue!==void 0){J.textContent=b("error.saveBookFailed",{error:Ue});return}Ae(we)})()}),i.appendChild(n),document.body.appendChild(i),ei=i,a.host.focus()}function hr(){ei!==null&&(ei.remove(),ei=null)}async function Ym(e){let t=[...Zt.filter(r=>r?.name!==e.name),e];try{let r=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok)return String(i.error||"HTTP "+r.status);Ki(i.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function Xm(e,t){if(t.name!==e&&Zt.some(i=>i?.name===t.name))return b("error.bookNameTaken",{name:t.name});let r=Zt.map(i=>i?.name===e?t:i);try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:r})}),n=await i.json().catch(()=>({}));if(!i.ok||!n.ok)return String(n.error||"HTTP "+i.status);Ki(n.config);return}catch(i){return String(i&&i.message?i.message:i)}}function Jm(e,t,r){let i=Gr(r,Se);if(hd(i))return;let n=document.createElement("div");n.className="tt_sftpDualCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let o=document.createElement("div");o.className="tt_sshTitle",o.innerHTML=Fi+"<span></span>",o.lastElementChild.textContent=b("panel.sftpDual",{label:t});let a=document.createElement("button");a.type="button",a.className="tt_close",a.title=b("btn.close"),a.innerHTML=ln,a.addEventListener("click",()=>hi(i)),s.appendChild(o),s.appendChild(a),n.appendChild(s);let d=document.createElement("div");d.className="tt_sftpStatus";let l=(N,G)=>{d.textContent=N,G===void 0?delete d.dataset.state:d.dataset.state=G},_=!1,m=(N,G)=>{if(!(_||p.local.busy||p.remote.busy)){_=!0;for(let j of[p.local,p.remote])j.setBusy(!0);l(N,"busy"),Promise.resolve().then(G).catch(j=>{(j===null||typeof j!="object"||j.name!=="TransferCanceledError")&&R.fail(b("status.failed")),l(String(j&&j.message?j.message:j),"error")}).finally(()=>{_=!1;for(let j of[p.local,p.remote])j.setBusy(!1)})}},y=N=>{p[N].bar.after(h),h.style.display="",f.focus(),f.select()},p={},c=(N,G)=>{if(N===void 0||N==="")throw new Error(b("error.dirNotReady"));return N.endsWith("/")||N.endsWith("\\")?N+G:N+"/"+G},u=(N,G)=>{let j={kind:N,path:"",busy:!1},Y=document.createElement("div");Y.className="tt_sftpPane";let H=document.createElement("div");H.className="tt_sftpPaneHead";let k=document.createElement("span");k.textContent=G;let W=document.createElement("span");W.className="tt_sftpPaneMeta",H.appendChild(k),H.appendChild(W),Y.appendChild(H);let q=document.createElement("div");q.className="tt_sftpBar";let $=document.createElement("input");$.type="text",$.className="tt_sftpPath",$.placeholder=b(N==="local"?"placeholder.localPath":"placeholder.remotePath"),$.spellcheck=!1,$.autocomplete="off";let X=document.createElement("button");X.type="button",X.className="tt_toolBtn",X.innerHTML=Zo+"<span>"+b("btn.refresh")+"</span>";let J=document.createElement("button");J.type="button",J.className="tt_toolBtn",J.innerHTML=Lh+"<span>"+b("btn.mkdir")+"</span>";let ce=document.createElement("button");ce.type="button",ce.className="tt_toolBtn tt_toolToggle",ce.textContent=b("btn.hiddenFiles"),ce.title=b("btn.hiddenFilesTitle"),yr&&(ce.dataset.on=""),q.appendChild($),q.appendChild(X),q.appendChild(J),q.appendChild(ce),Y.appendChild(q);let de=document.createElement("div");de.className="tt_sftpList",Y.appendChild(de),j.bar=q;let me=ee=>{j.busy=ee;for(let pe of[X,J])pe.disabled=ee;$.disabled=ee},te=async(ee,pe)=>{let ve=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",Z=N==="local"?pe:{...e,...pe},re=await fetch(ve+ee,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Z)}),ne=await re.json().catch(()=>({}));if(!re.ok||ne.ok!==!0)throw new Error(String(ne.error||"HTTP "+re.status));return ne},Be=(ee,pe)=>{if(!(j.busy||_))return me(!0),l(ee,"busy"),Promise.resolve().then(pe).catch(ve=>l(String(ve&&ve.message?ve.message:ve),"error")).finally(()=>me(!1))},fe=(ee,pe)=>{if(ee===void 0||ee==="")throw new Error(b("error.dirNotReady"));return ee.endsWith("/")||ee.endsWith("\\")?ee+pe:ee+"/"+pe},Oe=ee=>{let pe=fe(j.path,ee.name),ve=[];ee.isDir===!0?ve.push(b("meta.dir")):ve.push(tt(Number(ee.size))||"\u2014");let Z=fd(Number(ee.mtime));Z!==""&&ve.push(Z);let re=w(ee.isDir?Fi:ee.isSymlink?kh:xh,ee.name,ve.join(" \xB7 "),ee.isDir===!0?"dir":ee.isSymlink===!0?"link":"file"),ne=()=>j.loadDir(j.path),oe=N==="local"?p.remote:p.local;return ee.isDir===!0&&re.addEventListener("click",ie=>{ie.target instanceof Element&&ie.target.closest(".tt_sftpAct")!==null||j.loadDir(pe)}),E(re,N==="local"?Qo:ea,b("btn.transferTo",{target:b(N==="local"?"meta.remote":"meta.local"),path:oe.path}),()=>{if(j.path===""||oe.path===""){l(b("error.transferDirsNotReady"),"error");return}R.reset(),R.pulse(0),m(b("msg.transferring",{name:ee.name}),async()=>{let ie=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:N==="local"?"up":"down",...e,localPath:N==="local"?pe:fe(oe.path,ee.name),remotePath:N==="local"?fe(oe.path,ee.name):pe})}),ae=await ie.json().catch(()=>({}));if(!ie.ok||ae.ok!==!0)throw R.fail(b("error.transferFailed")),new Error(String(ae.error||"HTTP "+ie.status));let he=ae.job?.id;if(typeof he!="string"||he==="")throw R.fail(b("error.transferFailed")),new Error(b("error.noTaskId"));await z(he,ee.name)==="canceled"?(R.reset(),l(b("msg.transferCanceled",{name:ee.name}))):(R.done(b("status.done")),setTimeout(()=>R.reset(),1500),l(b("msg.transferred",{name:ee.name}))),await oe.loadDir(oe.path)})}),N!=="local"&&ee.isDir!==!0&&E(re,Eh,b("btn.download",{name:ee.name}),()=>{O(ee,pe)}),E(re,Jo,b("btn.rename",{name:ee.name}),()=>{f.placeholder=b("placeholder.newName"),f.value=ee.name,y(N),g=async()=>{let ie=f.value.trim();ie===""||ie===ee.name||(x(),await j.runTask(b("msg.renaming",{name:ee.name}),async()=>{await te("rename",{from:pe,to:fe(j.path,ie)}),await ne()}))}}),P(re,()=>j.runTask(b("msg.deleting",{name:ee.name}),async()=>{await te("remove",{path:pe,recursive:ee.isDir===!0}),await ne(),l(b("msg.deleted",{name:ee.name}))}),ee),re},We=ee=>{if(de.textContent="",j.path!==""&&j.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test(j.path)===!1){let Z=w(Xo,b("list.parentDir"),"","up");Z.addEventListener("click",()=>{let re=N==="local"?eg(j.path):pd(j.path);re!==null&&j.loadDir(re)}),de.appendChild(Z)}let pe=Bs(ee,yr);if(pe.length===0){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent=ee.length>0?b("list.hiddenOnly"):b("list.emptyDir"),de.appendChild(Z);return}let ve=500;for(let Z of pe.slice(0,ve))Z===null||typeof Z!="object"||typeof Z.name!="string"||Z.name===""||de.appendChild(Oe(Z));if(pe.length>ve){let Z=document.createElement("div");Z.className="tt_addMenuTitle",Z.textContent=b("list.truncated",{rest:pe.length-ve,total:pe.length}),de.appendChild(Z)}};j.loadDir=async ee=>{try{let pe=await te("list",{path:ee??j.path});j.path=typeof pe.path=="string"&&pe.path!==""?pe.path:j.path,$.value=j.path;let ve=Array.isArray(pe.entries)?pe.entries:[];j.rawEntries=ve,We(ve),W.textContent=b("list.itemCount",{count:Bs(ve,yr).length}),l(j.path)}catch(pe){l(String(pe&&pe.message?pe.message:pe),"error")}},j.runTask=Be,j.setBusy=me,p[N]=j,ce.addEventListener("click",()=>{Em(!yr)});let ke=ee=>{ce!==null&&(ee?ce.dataset.on="":delete ce.dataset.on),j.rawEntries=j.rawEntries??[],We(j.rawEntries),W.textContent=b("list.itemCount",{count:Bs(j.rawEntries,ee).length})};return No.add(ke),j.onShowHidden=ke,X.addEventListener("click",()=>{j.runTask(b("list.loading"),()=>j.loadDir(j.path))}),J.addEventListener("click",()=>{j.busy||_||(f.placeholder=b("placeholder.newDirName"),f.value="",y(N),g=async()=>{let ee=f.value.trim();ee!==""&&(x(),await j.runTask(b("msg.creatingDir",{name:ee}),async()=>{await te("mkdir",{path:fe(j.path,ee),parents:!0}),await j.loadDir(j.path)}))})}),$.addEventListener("keydown",ee=>{if(ee.key!=="Enter"||(ee.preventDefault(),j.busy||_))return;let pe=$.value.trim();pe!==""&&j.runTask(b("list.loading"),()=>j.loadDir(pe))}),Y},h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let f=document.createElement("input");f.type="text",f.className="tt_cardInput",f.spellcheck=!1,f.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=b("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=b("btn.cancel"),h.appendChild(f),h.appendChild(v),h.appendChild(S);let g=null,x=()=>{h.style.display="none",f.value="",g=null};v.addEventListener("click",()=>{g?.()}),S.addEventListener("click",x),f.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),g?.()):N.key==="Escape"&&(N.stopPropagation(),x())});let w=(N,G,j,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let k=document.createElement("span");k.className="tt_sftpIcon",k.innerHTML=N,Y!==void 0&&(k.dataset.kind=Y);let W=document.createElement("span");if(W.className="tt_sftpName",W.textContent=G,W.title=G,H.appendChild(k),H.appendChild(W),j!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=j,H.appendChild(q)}return H},E=(N,G,j,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=G,H.title=j,H.addEventListener("click",k=>{k.stopPropagation(),Y()}),N.appendChild(H)},P=(N,G,j)=>{let Y=document.createElement("button");Y.type="button",Y.className="tt_sftpAct",Y.innerHTML=Sr,Y.title=j.isDir?b("btn.deleteEntryDir",{name:j.name}):b("btn.deleteEntry",{name:j.name});let H=null;Y.addEventListener("click",k=>{if(k.stopPropagation(),H!==null){clearTimeout(H),H=null,Y.innerHTML=Sr,delete Y.dataset.danger,G();return}Y.textContent=b("btn.confirm"),Y.dataset.danger="",H=setTimeout(()=>{H=null,Y.innerHTML=Sr,delete Y.dataset.danger},4e3)}),N.appendChild(Y)},O=(N,G)=>p.remote.runTask(b("msg.downloading",{name:N.name}),async()=>{R.reset();let j;try{j=await md({makeBody:Y=>({...e,path:G,...Y>0?{offset:Y}:{}}),onProgress:(Y,H)=>R.set(Y,H),maxMb:Jt.maxDownloadMb,registerCancel:Y=>R.setCancel(Y),onResume:Y=>l(b("msg.downloadResuming",{name:N.name,offset:tt(Y)||String(Y)+" B"}),"busy")})}catch(Y){if(ni(Y)){R.reset(),l(b("msg.downloadCanceled",{name:N.name}));return}throw R.fail(b("error.downloadFailed")),Y}R.done(b("status.done")),gd(j,N.name),setTimeout(()=>R.reset(),1500),l(b("msg.downloaded",{name:N.name,size:tt(j.size)||String(j.size)+" B"}))}),F=u("local",b("meta.local")),A=u("remote",b("meta.remote"));p.local.wrap=F,p.remote.wrap=A;let V=document.createElement("div");V.className="tt_sftpDual",V.appendChild(F),V.appendChild(A),n.appendChild(V),n.appendChild(h);let B=document.createElement("div");B.className="tt_sftpFoot";let R=_d();B.appendChild(R.el),B.appendChild(d),n.appendChild(B);let z=async(N,G)=>{let j=!1;R.setCancel(()=>{j||(j=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:N})}).catch(()=>{}))});try{for(;;){await new Promise(W=>setTimeout(W,400));let Y=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:N})}),H=await Y.json().catch(()=>({}));if(!Y.ok||H.ok!==!0){if(j)return"canceled";throw new Error(String(H.error||"HTTP "+Y.status))}let k=H.job;if(k===null||typeof k!="object")throw new Error(b("error.invalidTaskState"));if(k.state==="running"){let W=typeof k.current=="string"&&k.current!==""?k.current:G;l(b("msg.transferring",{name:W}),"busy"),Number.isFinite(k.total)&&k.total>0?R.set(Number(k.bytes)||0,k.total):R.pulse(Number(k.bytes)||0);continue}if(k.state==="canceled")return"canceled";if(k.state!=="done")throw new Error(String(k.error||b("error.transferFailed")));return"done"}}finally{R.setCancel(null)}},I=(N,G)=>{G?N.wrap.dataset.drag="":delete N.wrap.dataset.drag},C=N=>Array.isArray(N?.types)&&N.types.includes("Files");for(let N of[p.local,p.remote]){let G=N.wrap,j=0;G.addEventListener("dragenter",Y=>{N.kind!=="remote"||!C(Y.dataTransfer)||(Y.preventDefault(),j+=1,I(N,!0))}),G.addEventListener("dragover",Y=>{N.kind==="remote"&&(Y.preventDefault(),Y.dataTransfer!==null&&(Y.dataTransfer.dropEffect="copy"))}),G.addEventListener("dragleave",()=>{j=Math.max(0,j-1),j===0&&I(N,!1)}),G.addEventListener("drop",Y=>{j=0,I(N,!1);let H=qc(N.kind,Y.dataTransfer);if(!H.accept){H.reason==="wrongPane"&&(Y.preventDefault(),l(b("error.dropOnLocalPane"),"error"));return}Y.preventDefault(),!(_||p.remote.busy)&&vd(Y.dataTransfer).then(k=>{(k.length>0||k._limitExceeded===!0)&&L(p.remote,k)})})}let L=async(N,G)=>{let j=Jt;if(j.maxUploadFiles>0&&G.length>j.maxUploadFiles){l(b("error.uploadCountExceeded",{max:j.maxUploadFiles,count:G.length}),"error");return}let Y=j.maxUploadMb>0?j.maxUploadMb*1024*1024:0,H=G.find(k=>Y>0&&(k.file?.size??0)>Y);if(H!==void 0){l(b("error.uploadTooBig",{size:tt(Y),name:String(H.relPath??"")}),"error");return}if(G._limitExceeded===!0){l(b("error.uploadTotalTooBig"),"error");return}await m(b("msg.uploading"),async()=>{if(N.path===""){l(b("error.transferDirsNotReady"),"error");return}for(let q of Kc(G))await fetch("/api/dsh-tty/sftp/mkdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:c(N.path,q),parents:!0})}).catch(()=>{});R.reset();let k={stopped:!1,abort:null};R.setCancel(()=>k.abort?.());let W=0;try{let q=0;for(let $ of G){if(k.stopped)break;q+=1,k.abort=null;try{await ud($.file,c(N.path,$.relPath),{spec:e,label:`${String(q)}/${String(G.length)} ${$.relPath}`,cancelRef:k,onProgress:(X,J)=>Number.isFinite(J)&&J>0?R.set(X,J):R.pulse(X),onLabel:X=>l(b("msg.uploadingName",{name:X}),"busy")}),W+=1}catch(X){if(ni(X)||k.stopped)break;throw X}}}finally{R.setCancel(null)}k.stopped?(R.reset(),l(b("msg.uploadCanceled",{done:W,total:G.length}))):(R.done(b("status.allDone")),setTimeout(()=>R.reset(),1500),l(b("msg.uploadDoneCount",{count:G.length}))),await N.loadDir(N.path)})},T=ia(),D=T===null?420:Math.round(T.height*.56);dd(n,b("panel.sftpDual",{label:t}),D,i),p.local.loadDir(""),p.remote.loadDir(""),Ho=()=>{for(let N of[p.local,p.remote])N!==void 0&&typeof N.onShowHidden=="function"&&No.delete(N.onShowHidden)}}var er=null,Nt=null;function cd(){return Nt!==null&&bo(Nt.ownerKey,Se)?Nt.ownerKey:Gr(void 0,Se)}var hd=(e=cd())=>er!==null||Nt!==null&&Nt.ownerKey===e;function dd(e,t,r,i){let n=Gr(i,Se),s=Ct!==null&&Ct.ownerKey===n;if(ue!==null&&!Ge&&mt!==null&&!s)try{let a=jh({title:t,side:"bottom",size:r,min:200,ownerSid:n,onClose:()=>hi(n)});a.element.appendChild(e),Nt=a;return}catch(a){console.warn("[dsh-tty] SFTP \u6302\u5230\u7EC8\u7AEF\u6302\u8F7D\u4F4D\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(a instanceof Error?a.message:String(a)))}let o=document.createElement("div");o.className="tt_sshBackdrop",o.appendChild(e),o.addEventListener("mousedown",a=>{a.target===o&&hi()}),document.body.appendChild(o),er=o}var Hi=null;function Zm(){let e=Hi;if(Hi=null,e!==null)try{e.click()}catch{}}function Qm(e){let t=new TextEncoder().encode(e),r="";for(let i of t)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ud(e,t,r){let{spec:i,label:n="",cancelRef:s,onProgress:o,onLabel:a,onDone:d}=r;return n!==""&&typeof a=="function"&&a(n),new Promise((l,_)=>{let m=Qm(JSON.stringify({...i,path:t})),y=new XMLHttpRequest;s.abort=()=>{s.stopped=!0,y.abort()},y.open("POST","/api/dsh-tty/sftp/upload"),y.setRequestHeader("x-dsh-sftp-meta",m),y.upload.addEventListener("progress",u=>{u.lengthComputable?o(u.loaded,u.total):o(0,NaN)});let p=!1,c=u=>{p||(p=!0,u===null?l():_(u))};y.addEventListener("load",()=>{if(y.status===200){d?.(),c(null);return}if(s.stopped)return;let u="HTTP "+y.status;try{let h=JSON.parse(y.responseText);h!==null&&typeof h=="object"&&typeof h.error=="string"&&(u=h.error)}catch{}c(new Error(u))}),y.addEventListener("error",()=>{if(s.stopped){c(new ci);return}c(new Error(b("error.networkError")))}),y.addEventListener("abort",()=>{c(new ci)}),y.send(e)})}function fd(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=i=>String(i).padStart(2,"0");return t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())+" "+r(t.getHours())+":"+r(t.getMinutes())}function pd(e){let t=String(e).replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function eg(e){let t=String(e).trim();if(t===""||(t=t.replace(/[\\/]+$/,""),t===""))return null;let r=t.match(/^([A-Za-z]:)(.*)$/);if(r!==null){let n=r[2];if(n==="")return null;let s=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return s<=0?r[1]+"\\":r[1]+n.slice(0,s)}if(t.startsWith("\\\\")||t.startsWith("//")){let n=t.slice(2);if(n.split(/[\\/]/).filter(a=>a!=="").length<=2)return null;let o=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return t.slice(0,2)+n.slice(0,o)}let i=t.lastIndexOf("/");return i<=0?i===0?"/":null:t.slice(0,i)}function Ti(e,t){return e.endsWith("/")?e+t:e+"/"+t}function _d(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let r=document.createElement("div");r.className="tt_sftpFill",t.appendChild(r);let i=document.createElement("span");i.className="tt_sftpPct",i.textContent="";let n=document.createElement("button");n.type="button",n.className="tt_sftpCancel",n.title=b("btn.cancelTransfer"),n.innerHTML=Xi,n.style.display="none";let s=null;n.addEventListener("click",p=>{p.stopPropagation();let c=s;c!==null&&(n.disabled=!0,c())}),e.appendChild(t),e.appendChild(i),e.appendChild(n);let o=p=>{i.textContent=p},a="",d=-1,l=p=>{p!==a&&(a=p,i.textContent=p)},_=p=>{let c=Math.round(p);c!==d&&(d=c,r.style.width=c+"%")},m=()=>{s=null,Hi===n&&(Hi=null),n.style.display="none",n.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",d=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,r.style.width="0%",i.textContent="",m()},setCancel(p){if(p==null){m();return}s=p,Hi=n,n.disabled=!1,n.style.display=""},set(p,c){e.dataset.active="",delete e.dataset.state;let u=Date.now();if(this._last!==void 0&&u>this._lastAt){let h=(p-this._last)/((u-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}if(this._last=p,this._lastAt=u,Number.isFinite(c)&&c>0){let h=Math.min(100,Math.max(0,p/c*100));_(h);let f=this._rate!==void 0&&this._rate>=0?Li(this._rate):"";l(Math.round(h)+"%"+(f!==""?" \xB7 "+f:""))}else{r.style.width="";let h=this._rate!==void 0&&this._rate>=0?Li(this._rate):"";l(tt(p)+(h!==""?" \xB7 "+h:""))}},pulse(p){e.dataset.active="",delete e.dataset.state,r.style.width="45%",r.style.transition="none",setTimeout(()=>{r.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let h=(p-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}this._last=p,this._lastAt=c;let u=this._rate!==void 0&&this._rate>=0?Li(this._rate):"";l((Number.isFinite(p)?tt(p):"\u2026")+(u!==""?" \xB7 "+u:""))},done(p){e.dataset.active="",e.dataset.state="done",r.style.width="100%",d=100,m(),l(p!==void 0&&p!==""?p:b("status.done"))},fail(p){e.dataset.active="",e.dataset.state="error",m(),l(p!==void 0&&p!==""?p:b("status.failed"))},text(p){delete e.dataset.state,p===void 0||p===""?(e.dataset.active="",a="",i.textContent=""):(e.dataset.active="",r.style.width="",d=-1,l(p))}}}async function tg(e,t,r,i=0,n=null,s=0){let o=i>0?i*1024*1024:0,a=Number.isFinite(s)&&s>0?s:0,d=typeof AbortController=="function"?new AbortController:null,l=!1;d!==null&&(t={...t,signal:d.signal},typeof n=="function"&&n(()=>{l=!0,d.abort()}));let _=a,m=null,y;try{if(y=await fetch(e,t),!y.ok){let S="HTTP "+y.status;try{let g=await y.json();g!==null&&typeof g=="object"&&typeof g.error=="string"&&(S=g.error)}catch{}throw new Error(S)}let p=Number(y.headers.get("content-length")),c=y.headers.get("content-range")??"",u=Number(/\/(\d+)\s*$/.exec(c)?.[1]);Number.isFinite(u)&&u>0?m=u:Number.isFinite(p)&&p>0&&(m=a+p);let h=y.body;if(h===null||typeof h.getReader!="function"){let S=await y.blob();if(o>0&&a+S.size>o)throw new Error(b("error.downloadTooBig",{size:tt(o)}));return m!==null&&r(m,m),S}if(o>0&&m!==null&&m>o){try{await h.cancel()}catch{}throw new Error(b("error.downloadTooBig",{size:tt(o)}))}let f=h.getReader(),v=[];for(;;){let{done:S,value:g}=await f.read();if(S)break;if(g!==void 0&&g.byteLength>0){if(_+=g.byteLength,o>0&&_>o){try{await f.cancel()}catch{}throw new Error(b("error.downloadTooBig",{size:tt(o)}))}v.push(g),r(_,m!==null?m:NaN)}}return new Blob(v,{type:"application/octet-stream"})}catch(p){if(l||p!==null&&typeof p=="object"&&p.name==="AbortError")throw new ci;if(p!==null&&typeof p=="object")throw p.received=_,p.total=m,p;let c=new Error(String(p));throw c.received=_,c.total=m,c}}async function md({url:e="/api/dsh-tty/sftp/download",makeBody:t,onProgress:r,maxMb:i=0,registerCancel:n=null,onResume:s=null}){let o=0,a=0;for(;;)try{return await tg(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t(o))},r,i,n,o)}catch(d){if(ni(d))throw d;a+=1;let l=$c({received:d?.received??0,total:d?.total??null,attempt:a});if(!l.resume)throw d;o=l.offset,typeof s=="function"&&s(o)}}var ci=class extends Error{constructor(){super(b("msg.canceled")),this.name="TransferCanceledError"}};function ni(e){return e instanceof ci}function gd(e,t){let r=URL.createObjectURL(e),i=document.createElement("a");i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}async function vd(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],r=[];for(let l of t){let _=typeof l.webkitGetAsEntry=="function"?l.webkitGetAsEntry():null;_!==null&&r.push(_)}if(r.length===0)return[...e.files??[]].map(l=>({relPath:l.name,file:l}));let i=[],n=Jt.maxUploadFiles,s=Jt.maxUploadMb>0?Jt.maxUploadMb*1024*1024:0,o=()=>n>0&&i.length>=n,a=0,d=(l,_)=>new Promise(m=>{if(o()){m();return}if(l.isFile===!0){l.file(c=>{s>0&&a+(c.size??0)>s?i._limitExceeded=!0:(i.push({relPath:_+l.name,file:c}),a+=c.size??0),m()},()=>m());return}if(l.isDirectory!==!0){m();return}let y=l.createReader(),p=()=>{y.readEntries(async c=>{if(c.length===0){m();return}for(let u of c){if(o())break;await d(u,_+l.name+"/")}if(o()){m();return}p()},()=>m())};p()});for(let l of r)await d(l,"");return i}function pn(e,t){let r=Gr(t,Se);if(hd(r))return;let i=e!==null&&typeof e=="object"?e:{},n={};if(typeof i.name=="string"&&i.name!=="")n.name=i.name;else{for(let W of["host","username","auth","keyPath","passphrase","password"])typeof i[W]=="string"&&i[W]!==""&&(n[W]=i[W]);let k=Number(i.port);Number.isInteger(k)&&k>=1&&k<=65535&&(n.port=k),i.agentForward===!0&&(n.agentForward=!0)}let s=n.name??(n.username!==void 0?n.username+"@"+String(n.host??""):String(n.host??""));if(Kh==="dual"){Jm(n,s,r);return}let o=document.createElement("div");o.className="tt_sftpCard";let a=document.createElement("div");a.className="tt_sftpTitleRow";let d=document.createElement("div");d.className="tt_sshTitle",d.innerHTML=Fi+"<span></span>",d.lastElementChild.textContent="SFTP \xB7 "+s;let l=document.createElement("button");l.type="button",l.className="tt_close",l.title=b("btn.close"),l.innerHTML=ln,l.addEventListener("click",()=>hi(r)),a.appendChild(d),a.appendChild(l),o.appendChild(a);let _=document.createElement("div");_.className="tt_sftpBar";let m=document.createElement("input");m.type="text",m.className="tt_sftpPath",m.placeholder=b("placeholder.remotePath"),m.spellcheck=!1,m.autocomplete="off";let y=document.createElement("button");y.type="button",y.className="tt_toolBtn",y.innerHTML=Zo+"<span>"+b("btn.refresh")+"</span>";let p=document.createElement("button");p.type="button",p.className="tt_toolBtn",p.innerHTML=Lh+"<span>"+b("btn.mkdir")+"</span>";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.innerHTML=F_+"<span>"+b("btn.upload")+"</span>",c.title=b("btn.uploadTitle");let u=document.createElement("input");u.type="file",u.multiple=!0,u.style.display="none",_.appendChild(m),_.appendChild(y),_.appendChild(p),_.appendChild(c),o.appendChild(_),o.appendChild(u);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let f=document.createElement("input");f.type="text",f.className="tt_cardInput",f.spellcheck=!1,f.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=b("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=b("btn.cancel"),h.appendChild(f),h.appendChild(v),h.appendChild(S),o.appendChild(h);let g=null,x=()=>{h.style.display="none",g=null};v.addEventListener("click",()=>{g?.()}),S.addEventListener("click",x),f.addEventListener("keydown",k=>{k.key==="Enter"?(k.preventDefault(),g?.()):k.key==="Escape"&&(k.stopPropagation(),x())});let w=document.createElement("div");w.className="tt_sftpList",o.appendChild(w);let E=document.createElement("div");E.className="tt_sftpFoot";let P=document.createElement("div");P.className="tt_sftpStatus";let O=_d();E.appendChild(O.el),E.appendChild(P),o.appendChild(E);let F={path:"",busy:!1},A=(k,W)=>{P.textContent=k,W===void 0?delete P.dataset.state:P.dataset.state=W},V=k=>{F.busy=k;for(let W of[y,p,c])W.disabled=k;m.disabled=k},B=async(k,W)=>{let q=await fetch("/api/dsh-tty/sftp/"+k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...n,...W})}),$=await q.json().catch(()=>({}));if(!q.ok||$.ok!==!0)throw new Error(String($.error||"HTTP "+q.status));return $},R=async(k,W)=>{if(!F.busy){V(!0),A(k,"busy");try{await W()}catch(q){A(String(q&&q.message?q.message:q),"error")}finally{V(!1)}}},z=(k,W,q,$)=>{let X=document.createElement("button");X.type="button",X.className="tt_sftpRow";let J=document.createElement("span");J.className="tt_sftpIcon",J.innerHTML=k,$!==void 0&&(J.dataset.kind=$);let ce=document.createElement("span");if(ce.className="tt_sftpName",ce.textContent=W,ce.title=W,X.appendChild(J),X.appendChild(ce),q!==""){let de=document.createElement("span");de.className="tt_sftpMeta",de.textContent=q,X.appendChild(de)}return X},I=(k,W,q,$)=>{let X=document.createElement("button");X.type="button",X.className="tt_sftpAct",X.innerHTML=W,X.title=q,X.addEventListener("click",J=>{J.stopPropagation(),$()}),k.appendChild(X)},C=(k,W,q)=>{let $=document.createElement("button");$.type="button",$.className="tt_sftpAct",$.innerHTML=Sr,$.title=W.isDir?b("btn.deleteEntryDir",{name:W.name}):b("btn.deleteEntry",{name:W.name});let X=null;$.addEventListener("click",J=>{if(J.stopPropagation(),!F.busy){if(X!==null){clearTimeout(X),X=null,$.innerHTML=Sr,delete $.dataset.danger,R(b("msg.deleting",{name:W.name}),async()=>{await B("remove",{path:q,recursive:W.isDir===!0}),await T(F.path),A(b("msg.deleted",{name:W.name}))});return}$.textContent=b("btn.confirm"),$.dataset.danger="",X=setTimeout(()=>{X=null,$.innerHTML=Sr,delete $.dataset.danger},4e3)}}),k.appendChild($)},L=k=>{if(w.textContent="",F.path!==""&&F.path!=="/"){let $=z(Xo,b("list.parentDir"),"","up");$.addEventListener("click",()=>{R(b("list.loading"),()=>T(pd(F.path)))}),w.appendChild($)}let W=Array.isArray(k)?k:[];if(W.length===0){let $=document.createElement("div");$.className="tt_addMenuTitle",$.textContent=b("list.emptyDir"),w.appendChild($);return}let q=500;for(let $ of W.slice(0,q)){if($===null||typeof $!="object"||typeof $.name!="string"||$.name==="")continue;let X=Ti(F.path,$.name),J=[];$.isDir===!0?J.push(b("meta.dir")):J.push(tt(Number($.size))||"\u2014");let ce=fd(Number($.mtime));ce!==""&&J.push(ce);let de=z($.isDir?Fi:$.isSymlink?kh:xh,$.name,J.join(" \xB7 "),$.isDir===!0?"dir":$.isSymlink===!0?"link":"file");$.isDir===!0?de.addEventListener("click",me=>{me.target instanceof Element&&me.target.closest(".tt_sftpAct")!==null||R(b("list.loading"),()=>T(X))}):(de.addEventListener("click",me=>{me.target instanceof Element&&me.target.closest(".tt_sftpAct")!==null||D($,X)}),I(de,Eh,b("btn.download",{name:$.name}),()=>{D($,X)})),I(de,Jo,b("btn.rename",{name:$.name}),()=>{f.placeholder=b("placeholder.newName"),f.value=$.name,h.style.display="",f.focus(),f.select(),g=async()=>{let me=f.value.trim();me===""||me===$.name||(x(),await R(b("msg.renaming",{name:$.name}),async()=>{await B("rename",{from:X,to:Ti(F.path,me)}),await T(F.path)}))}}),C(de,$,X),w.appendChild(de)}if(W.length>q){let $=document.createElement("div");$.className="tt_addMenuTitle",$.textContent=b("list.truncated",{rest:W.length-q,total:W.length}),w.appendChild($)}},T=async k=>{try{let W=await B("list",{path:k??F.path});F.path=typeof W.path=="string"&&W.path!==""?W.path:"/",m.value=F.path;let q=Array.isArray(W.entries)?W.entries.length:0;L(W.entries),A(F.path+" \u2014 "+b("list.itemCount",{count:q}))}catch(W){A(String(W&&W.message?W.message:W),"error")}},D=(k,W)=>R(b("msg.downloading",{name:k.name}),async()=>{O.reset();let q;try{q=await md({makeBody:$=>({...n,path:W,...$>0?{offset:$}:{}}),onProgress:($,X)=>O.set($,X),maxMb:Jt.maxDownloadMb,registerCancel:$=>O.setCancel($),onResume:$=>A(b("msg.downloadResuming",{name:k.name,offset:tt($)||String($)+" B"}),"busy")})}catch($){if(ni($)){O.reset(),A(b("msg.downloadCanceled",{name:k.name}));return}throw O.fail(b("error.downloadFailed")),$}O.done(b("status.done")),gd(q,k.name),setTimeout(()=>O.reset(),1500),A(b("msg.downloaded",{name:k.name,size:tt(q.size)||String(q.size)+" B"}))}),N=(k,W,q,$,X)=>ud(k,Ti(F.path,W),{spec:n,label:($>1?String(q)+"/"+String($)+" ":"")+W,cancelRef:X,onProgress:(J,ce)=>{Number.isFinite(ce)&&ce>0?O.set(J,ce):O.pulse(J)},onLabel:J=>A(b("msg.uploadingName",{name:J}),"busy"),onDone:()=>{$===1&&O.done(b("msg.uploadDone"))}}).catch(J=>{throw ni(J)||O.fail(b("error.uploadFailed")),J}),G=async k=>R(b("msg.uploading"),async()=>{let W=Jt;if(W.maxUploadFiles>0&&k.length>W.maxUploadFiles){A(b("error.uploadCountExceeded",{max:W.maxUploadFiles,count:k.length}),"error"),O.fail(b("status.overLimit"));return}let q=W.maxUploadMb>0?W.maxUploadMb*1024*1024:0,$=k.find(me=>q>0&&(me.file?.size??0)>q);if($!==void 0){A(b("error.uploadTooBig",{size:tt(q),name:String($.relPath??"")}),"error"),O.fail(b("status.overLimit"));return}if(k._limitExceeded===!0){A(b("error.uploadTotalTooBig"),"error"),O.fail(b("status.overLimit"));return}let X=new Set;for(let me of k){let te=me.relPath.lastIndexOf("/");if(te<=0)continue;let Be=me.relPath.slice(0,te);X.has(Be)||(X.add(Be),await B("mkdir",{path:Ti(F.path,Be),parents:!0}).catch(()=>{}))}O.reset();let J={stopped:!1,abort:null};O.setCancel(()=>J.abort?.());let ce=0,de=0;try{for(let me of k){if(J.stopped)break;ce+=1,J.abort=null;try{await N(me.file,me.relPath,ce,k.length,J),de+=1}catch(te){if(ni(te)||J.stopped)break;throw te}}}finally{O.setCancel(null)}if(J.stopped){O.reset(),A(b("msg.uploadCanceled",{done:de,total:k.length})),await T(F.path);return}O.done(b("status.allDone")),setTimeout(()=>O.reset(),1500),A(b("msg.uploadDoneCount",{count:k.length})),await T(F.path)});y.addEventListener("click",()=>{R(b("list.loading"),()=>T(F.path))}),p.addEventListener("click",()=>{F.busy||(f.placeholder=b("placeholder.newDirName"),f.value="",h.style.display="",f.focus(),g=async()=>{let k=f.value.trim();k!==""&&(x(),await R(b("msg.creatingDir",{name:k}),async()=>{await B("mkdir",{path:Ti(F.path,k)}),await T(F.path)}))})}),c.addEventListener("click",()=>{F.busy===!1&&u.click()}),u.addEventListener("change",()=>{let k=[...u.files??[]].map(W=>({relPath:W.name,file:W}));u.value="",k.length>0&&G(k)});let j=0,Y=k=>{k?w.dataset.drag="":delete w.dataset.drag};o.addEventListener("dragenter",k=>{k.preventDefault(),j+=1,Y(!0)}),o.addEventListener("dragover",k=>{k.preventDefault()}),o.addEventListener("dragleave",()=>{j=Math.max(0,j-1),j===0&&Y(!1)}),o.addEventListener("drop",k=>{k.preventDefault(),j=0,Y(!1),!F.busy&&vd(k.dataTransfer).then(W=>{(W.length>0||W._limitExceeded===!0)&&G(W)})}),m.addEventListener("keydown",k=>{if(k.key!=="Enter"||(k.preventDefault(),F.busy))return;let W=m.value.trim();W!==""&&R(b("list.loading"),()=>T(W))});let H=ia();dd(o,"SFTP \xB7 "+s,H===null?340:Math.round(H.height*.46),r),R(b("status.connectingEllipsis"),()=>T(""))}function hi(e){let t=e===void 0?cd():e,r=er,i=Nt!==null&&Nt.ownerKey===t?Nt:null;if(r===null&&i===null)return;Zm();let n=Ho;Ho=null,n?.(),er=null,i!==null&&(Nt=null),r!==null&&r.remove(),i!==null&&i.dispose()}function la(e){if(Xt===null)return;Xt.style.display=Jc(e);let t=ue!==null?ue.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&Xt.focus()}function bd(){Xt!==null&&la(Zc(Xt.style.display))}function rg(){return{matchBackground:Te("--tt-term-search-match"),matchBorder:Te("--tt-term-search-match-border"),activeMatchBackground:Te("--tt-term-search-active"),activeMatchBorder:Te("--tt-term-search-active-border"),matchOverviewRuler:Te("--tt-term-search-match-border"),activeMatchColorOverviewRuler:Te("--tt-term-search-active-border")}}function ig(e){let t=xt();if(t===void 0||t.search===void 0)return;let r=Xt.value;if(r==="")return;let i={decorations:rg()};e?t.search.findPrevious(r,i):t.search.findNext(r,i)}function dh(){zi||ue===null&&!ta()||xr!==null||(xr=setTimeout(()=>{xr=null,nn()},Bi),Bi=Math.min(Bi*2,5e3))}function rs(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Go(e){return rs(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function sg(){return ur==="tmux"?{t:"spawn",cwd:Oo(),persist:!0,persistName:oa()}:{t:"spawn",cwd:Oo()}}async function wd(){if(!Ro){Ro=!0;try{await ng()}finally{Ro=!1}}}var Ro=!1;async function ng(){if(await aa(),ue===null){await ag();return}let e=rm(),t=tm();if(![...le.values()].some(o=>o.embedded!==!0)){if(e.length>0||t.length>0){Pe({t:"sessions"});let o=await Qs("sessions",4e3),a=new Map;if(o!==null&&Array.isArray(o.list))for(let l of o.list)l!==null&&typeof l=="object"&&l.attachable===!0&&a.set(l.sid,l);let d=new Set;for(let l of e){if(a.has(l.sid))hm(l);else if(Go(l.spawnSpec))ch(l);else continue;rs(l.spawnSpec)&&d.add(l.spawnSpec.persistName)}for(let l of t){let _=l.spawnSpec.persistName;d.has(_)||(ch(l),d.add(_))}Ht()}if(![...le.values()].some(o=>o.embedded!==!0)){if(await sn())return;$i()}return}let r=[...le.values()].filter(o=>!o.exited&&(o.embedded!==!0||o.spawned===!0)),i=r.filter(o=>Go(o.spawnSpec)),n=null;if(i.length>0){Pe({t:"sessions"});let o=await Qs("sessions",4e3),a=yo(o!==null?o.list:[]);n=i.filter(d=>!a.has(d.sid));for(let d of n)qi(d.sid)}let s=n!==null?new Set(n.map(o=>o.sid)):new Set;for(let o of r)s.has(o.sid)||Pe({t:"attach",sid:o.sid})}function og(){Re!==null&&(Re.readyState===WebSocket.OPEN||Re.readyState===WebSocket.CONNECTING)||nn()}async function ag(){let e=[...le.values()].filter(i=>i.embedded===!0&&!i.exited);if(e.length===0)return;Pe({t:"sessions"});let t=await Qs("sessions",4e3),r=yo(t!==null?t.list:[]);for(let i of e)i.spawned===!0&&(r.has(i.sid)?Pe({t:"attach",sid:i.sid}):Go(i.spawnSpec)?Uh(i):(i.exited=!0,i.live=!1,Vr(i,b("status.ended"),b("btn.clickRerun"),"exited")))}function nn(){if(Re!==null){try{Re.close()}catch{}Re=null}zi=!1,clearTimeout(xr),xr=null,Is=!0,Ns(b("status.connectingEllipsis"),"");try{Re=new WebSocket(T_())}catch(e){Is=!1,Ns(b("error.connectFailed",{error:e.message}),"error"),dh();return}Re.onopen=()=>{Is=!1,Bi=1e3,St=null,Ns(b("status.connected"),"connected");for(let e of[...Ao])Ao.delete(e),le.has(e.tab.sid)&&Pe(e.frame);wd()},Re.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=t.sid;if(t.t==="ready"){let i=typeof t.target=="string"?t.target:"";Lo(r,t.kind==="ssh"?b("status.connectedSsh",{target:i!==""?i+" ":""}):b("status.connectedPid",{pid:t.pid}),"connected");let n=le.get(r);if(n!==void 0){if(n.exited=!1,n.spawned=!0,n.live=!0,n.errored=!1,n.target=i,n.persistTmux=t.persist===!0,t.kind==="ssh"&&i!==""&&!n.label&&(n.label=i,it()),Er(),To(r),Vr(n,""),ui(n),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(o=>setTimeout(o,500))]).then(()=>Bh(150))}di(),Y_(r),vr(n.spawnSpec)&&Pe({t:"hidden",sid:r,hidden:!0}),Ht()}}else if(t.t==="hidden"){let i=le.get(r);if(i!==void 0&&i.embedded!==!0){let n=t.hidden===!0;vr(i.spawnSpec)!==n&&(i.spawnSpec=Co(i.spawnSpec,n),Ht(),it(),li())}}else if(t.t==="sessions")lm(t.list);else if(t.t==="data"){let i=le.get(r);i!==void 0&&i.term!==null&&(i.term.write(String(t.d??"")),dg())}else if(t.t==="exit"){let i=le.get(r);if(i!==void 0){i.exited=!0,i.live=!1,i.stats=null,r===Se&&Ar();let n=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";i.exitDetail=[n,s].filter(Boolean).join(" "),Lo(r,b("status.exitedWith",{detail:i.exitDetail}),""),Er(),To(r),Vr(i,""),es(),li(),di(),_n(),Ht()}}else if(t.t==="stats")try{let i=le.get(r);if(i!==void 0){let n=t.stats;i.stats=rh(n)?n:null,i.statsAt=Date.now(),r===Se&&Ar()}}catch(i){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(i instanceof Error?i.message:String(i)))}else if(t.t==="hint"){if(!Ys||t.kind!=="failure"||typeof r!="string"||r==="")return;fr.set(r,{exitCode:typeof t.exitCode=="number"?t.exitCode:null,at:typeof t.at=="number"?t.at:Date.now(),dismissed:!1,busy:!1,answer:null,command:"",error:null}),r===Se&&Pr()}else if(t.t==="error")if(Lo(r,b("status.error",{message:String(t.m??"")}),"error"),typeof r=="string"){let i=le.get(r);i!==void 0&&(i.live||(i.errored=!0),Er(),To(r),Vr(i,b("status.errored"),b("status.retryHint",{message:String(t.m??"")}),"error"))}else lg(b("btn.clickRetry"))},Re.onclose=()=>{if(Is=!1,!zi){Ns(b("status.disconnectedReconnecting"),"error");for(let e of le.values())e.exited||Vr(e,b("status.disconnected"),b("status.reconnecting"),"info");dh()}},Re.onerror=()=>{}}function lg(e){Zr!==null&&(Zr.textContent=e)}function Vo(){(ue===null||Ge)&&Yo()}var Fs="DSH_TTY_ALLOW_PROXY_COMMAND";function cg(e){let t=new Date(Number(e)*1e3);if(Number.isNaN(t.getTime()))return String(e);let r=i=>String(i).padStart(2,"0");return`${String(t.getFullYear())}-${r(t.getMonth()+1)}-${r(t.getDate())} ${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`}function yd(){return typeof navigator<"u"&&navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText=="function"}async function uh(e){if(yd())try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}return t.remove(),r||hn(b("error.copyFailed"),"error"),r}function Yo(){if(ue!==null){Ge&&ca();return}Yi(),ue=document.createElement("div"),ue.className="tt_modalBackdrop",ue.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+an+'</span><div class="tt_tabbar"><div class="tt_tabs"></div><button type="button" class="tt_tabMore" hidden></button><button type="button" class="tt_tabAdd"></button></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">'+b("status.initializing")+'</span></div><input class="tt_searchInput" style="display:'+xo+'" placeholder="'+b("placeholder.search")+'" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="'+b("btn.searchTitle")+'">'+D_+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="'+b("btn.clearTitle")+'">'+yh+'</button></span><span class="tt_winGroup"><button class="tt_min" title="'+b("btn.minimizeTitle")+'">'+O_+'</button><button class="tt_close" title="'+b("btn.closePanelTitle")+'">'+ln+'</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_statsBar" hidden></div><div class="tt_exitBar" hidden></div><button type="button" class="tt_assistBadge" hidden><span class="tt_assistDot"></span><span class="tt_assistBadgeText"></span></button><div class="tt_overlay"></div></div></div></div>',document.body.appendChild(ue),qs=ue.querySelector(".tt_status"),Cr=ue.querySelector(".tt_statusText"),Tr=ue.querySelector(".tt_statusDot"),Ee=ue.querySelector(".tt_tabs");let e=ue.querySelector(".tt_tabAdd");e!==null&&(e.title=b("btn.newTab"),e.innerHTML=H_,e.addEventListener("click",()=>{Rm(e)})),Bt=ue.querySelector(".tt_tabMore"),Bt!==null&&(Bt.innerHTML=Ch,Bt.title=b("btn.tabList"),Bt.addEventListener("click",()=>{Am(Bt)})),Ee.addEventListener("scroll",li),Ee.addEventListener("wheel",Sm,{passive:!1}),Ee.addEventListener("contextmenu",Om),Ee.addEventListener("auxclick",Im),Ri=ue.querySelector(".tt_connbar"),Ai=ue.querySelector(".tt_connDot"),Ks=ue.querySelector(".tt_connTarget"),pt=ue.querySelector(".tt_connBadge"),Di=ue.querySelector(".tt_connActions"),mt=ue.querySelector(".tt_work"),Je=ue.querySelector(".tt_body"),yt=ue.querySelector(".tt_statsBar"),It=ue.querySelector(".tt_exitBar"),ji="",dn(),St=null,Ah(),Zr=ue.querySelector(".tt_body > .tt_overlay"),cr=ue.querySelector(".tt_assistBadge"),cr!==null&&cr.addEventListener("click",()=>{cr!==null&&qm(cr)}),kt(),Pr(),Xt=ue.querySelector(".tt_searchInput"),Zr.addEventListener("click",()=>{Zr.textContent="",nn()}),ue.querySelector("[data-act=search]").addEventListener("click",()=>{bd()}),Xt.addEventListener("keydown",r=>{r.key==="Enter"?(r.preventDefault(),ig(r.shiftKey)):r.key==="Escape"&&(r.stopPropagation(),la(!1))}),ue.querySelector("[data-act=clear]").addEventListener("click",()=>{let r=xt();r!==void 0&&r.term!==null&&r.term.clear()}),ue.querySelector(".tt_min").addEventListener("click",()=>{Gi()}),ue.querySelector(".tt_close").addEventListener("click",()=>{Sd()}),ue.addEventListener("mousedown",r=>{ti===null&&r.target===ue&&Gi()}),document.addEventListener("keydown",xd),Pi=new ResizeObserver(()=>{Ge||(Ws(),sm(xt()),li())}),Pi.observe(Je),it(),Er(),Re!==null&&Re.readyState===WebSocket.OPEN?wd():nn()}function _n(){if(Ui===null)return;let e=[...le.values()].filter(t=>!t.exited).length;Ui.textContent=le.size>0?"\xB7 "+e+"/"+le.size:""}function hg(){Xe=document.createElement("div"),Xe.className="tt_dock",Xe.title=b("btn.restoreDock"),Xe.innerHTML='<span class="tt_dockTitle">'+an+"<span>"+b("panel.title")+'</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="'+b("btn.closePanelTitle")+'">'+Xi+"</button>",Ui=Xe.querySelector(".tt_dockCount"),ai=Xe.querySelector(".tt_dockStatus"),Mr=Xe.querySelector(".tt_dockDot"),_n(),Cr!==null&&(ai.textContent=Cr.textContent),Tr!==null&&(Mr.dataset.state=Tr.dataset.state??""),Xe.addEventListener("click",e=>{if(e.target.closest(".tt_dockClose")!==null){e.stopPropagation(),Sd();return}ca()}),document.body.appendChild(Xe)}function Gi(){ue===null||Ge||(_t(),vt(),kt(),hr(),Ge=!0,er!==null&&(er.style.display="none"),la(!1),ue.dataset.minimized="",Dh(),Qi(),Ar(),document.querySelector("[data-dsh-tty-entry]")!==null?di():(hg(),Xe.classList.add("tt_dockCompact")))}function di(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Ge){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=b("status.minimized");let r=[...le.values()].filter(n=>!n.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+le.size;let i=t.querySelector(".tt_sidebarBadgeDot");i!==null&&Tr!==null&&(i.dataset.state=Tr.dataset.state??"")}function dg(){if(!Ge)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Mr;e!==null&&(e.dataset.active="",clearTimeout(Gs),Gs=setTimeout(()=>{delete e.dataset.active},900))}function ca(){if(ue===null||!Ge)return;Ge=!1,delete ue.dataset.minimized,er!==null&&(er.style.display=""),clearTimeout(Gs),Xe!==null&&(Xe.remove(),Xe=null),Ui=null,ai=null,Mr=null,di(),Ah(),Qi(),Ar(),es();let e=xt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&ui(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Sd(){let e=Fc(le.values());if(!e.confirm){Vi();return}Ge&&ca(),ug(e)}function br(){if(ti===null)return;ti.remove(),ti=null;let e=Do;if(Do=null,e!==null&&typeof e.focus=="function")try{e.focus()}catch{}}function Cd(e){if(ue===null)return;br();let t=ue.querySelector(".tt_modal");if(t===null)return;let r=document.createElement("div");r.className="tt_confirmLayer",r.innerHTML='<div class="tt_confirmCard" role="dialog" aria-modal="true"><div class="tt_confirmTitle"></div><div class="tt_confirmText"></div><div class="tt_confirmHint"></div><div class="tt_confirmActions"><button type="button" class="tt_toolBtn tt_confirmCancel"></button>'+(e.minimize===!0?'<button type="button" class="tt_toolBtn tt_confirmMin"></button>':"")+'<button type="button" class="tt_toolBtn tt_btnDanger tt_confirmOk"></button></div></div>',r.querySelector(".tt_confirmTitle").textContent=e.title,r.querySelector(".tt_confirmText").textContent=e.text,r.querySelector(".tt_confirmHint").textContent=e.hint;let i=r.querySelector(".tt_confirmCancel");if(i.textContent=b("btn.cancel"),i.addEventListener("click",()=>br()),e.minimize===!0){let s=r.querySelector(".tt_confirmMin");s.textContent=b("btn.minimize"),s.addEventListener("click",()=>{br(),Gi()})}let n=r.querySelector(".tt_confirmOk");n.textContent=e.okLabel,n.addEventListener("click",()=>{br(),e.onOk()}),r.addEventListener("mousedown",s=>{s.target===r&&br()}),Do=document.activeElement instanceof HTMLElement?document.activeElement:null,t.appendChild(r),ti=r;try{i.focus()}catch{}}function ug(e){Cd({title:b("confirm.closeTitle",{n:String(e.live)}),text:e.agentLive>0?b("confirm.closeTextAgent",{n:String(e.live),agent:String(e.agentLive)}):b("confirm.closeText",{n:String(e.live)}),hint:b("confirm.closeHint"),okLabel:b("confirm.closeOk",{n:String(e.live)}),onOk:Vi,minimize:!0})}function Vi(){if(ue===null)return;br(),Ni(!0);let e=ta();if(zi=!e,Ge=!1,_t(),vt(),Qt(),kt(),zs(),tn(),hr(),hi(),clearTimeout(Gs),clearTimeout(xr),xr=null,Bi=1e3,Xe!==null&&(Xe.remove(),Xe=null),Ui=null,ai=null,Mr=null,di(),Re!==null){for(let t of le.values())!t.exited&&t.embedded!==!0&&Pe({t:"kill",sid:t.sid});if(!e){try{Re.close()}catch{}Re=null}}Pi!==null&&(Pi.disconnect(),Pi=null);for(let[t,r]of[...le])if(r.embedded!==!0){if(r.term!==null)try{r.term.dispose()}catch{}le.delete(t)}Se=null,Wi=null,document.removeEventListener("keydown",xd),ue.remove(),ue=null,mt=null,qs=null,Cr=null,Tr=null,Ee=null,Bt=null,Ri=null,Ai=null,Ks=null,pt=null,Di=null,tn(),Dh(),yt=null,dn(),St=null,It=null,ji="",Je=null,Zr=null,Xt=null,Zi=0;try{sessionStorage.removeItem(Vs)}catch{}}function xd(e){if(e.key==="Escape"&&ue!==null){if(e.preventDefault(),ti!==null){br();return}if(er!==null){hi();return}if(ei!==null){hr();return}if(gt!==null){_t();return}Gi()}}function fg(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function pg(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let r of e.children)if(r.tagName==="BUTTON")return r}function _g(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label",b("panel.title")),e.tabIndex=0,e.innerHTML='<span class="tt_sidebarEntryIcon">'+an+'</span><span class="tt_sidebarEntryLabel">'+b("panel.title")+"</span>",e.addEventListener("click",t=>{t.preventDefault(),Yo()}),e.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" "||t.key==="Spacebar")&&(t.preventDefault(),Yo())}),e}function fh(e,t){let r=pg(e);if(r===void 0)return!1;if(t.parentElement!==e){let i=r.closest('[class*="logoRow"]'),n=i!==null&&i.parentElement===e?i:r,s=Array.from(e.children).filter(o=>o instanceof HTMLElement&&o.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 o=s[s.length-1];e.insertBefore(t,o.nextSibling)}else e.insertBefore(t,n.nextElementSibling)}return!0}function mg(){if(Yi(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=_g(),t,r=!1,i=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,r=!1),r){if(document.body.contains(e))return;s.disconnect(),t=void 0,r=!1}t??(t=fg()),t!==void 0&&(r=fh(t,e),r&&s.observe(t,{childList:!0,subtree:!0}))},n=new MutationObserver(()=>{i()});n.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){r=!1,i();return}t.contains(e)||(r=fh(t,e))});return i(),()=>{n.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:i,jsxs:n}=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 o(d){let l=d&&d.view,_=l==="page",[m,y]=r.useState(_),[p,c]=r.useState(null),[u,h]=r.useState(!1),[f,v]=r.useState(!1),[S,g]=r.useState({kind:"",text:""}),[x,w]=r.useState(null),[E,P]=r.useState(""),[O,F]=r.useState(!1),[A,V]=r.useState(Date.now()),B=r.useRef(null),R=r.useRef(null),[z,I]=r.useState([]),[C,L]=r.useState(!1),[T,D]=r.useState({groups:[],loading:!1,failed:!1}),[N,G]=r.useState(!1),j=r.useRef(null),Y=r.useRef(null),H=r.useRef(0),k=M=>i("div",{className:"tt_cardSection",children:M}),W=async()=>{try{let U=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();U.ok&&typeof U.config=="object"&&U.config!==null?(B.current=U.config,R.current=JSON.stringify(de(U.config)),c(U.config),Ki(U.config)):g({kind:"error",text:String(U.error||b("error.configLoadFailed"))})}catch(M){g({kind:"error",text:String(M&&M.message?M.message:M)})}},q=async()=>{try{let U=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();U.ok&&Array.isArray(U.shells)&&I(U.shells)}catch{}},$=(M,U)=>{let K=M.current,Q=K===null||K.parentElement===null?null:K.parentElement.querySelector(U);K===null||Q===null||(Q.style.width=String(Math.round(K.getBoundingClientRect().width))+"px",ts(Q,K))};r.useLayoutEffect(()=>{if(!N&&!C)return;let M=()=>{N&&$(j,".tt_routeList"),C&&$(Y,".tt_shellList")};return M(),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[N,C,T.loading,T.failed,T.groups,z,p?.shell]);let X=async()=>{let M=H.current+1;H.current=M,D(U=>({...U,loading:!0}));try{let K=await(await fetch("/api/dsh-tty/model-catalog",{cache:"no-store"})).json();if(K.ok===!0&&M===H.current){D({groups:Array.isArray(K.groups)?K.groups:[],loading:!1,failed:!1});return}}catch{}M===H.current&&D({groups:[],loading:!1,failed:!0})};r.useEffect(()=>{m&&!u&&(h(!0),W(),q(),X())},[m]);let J=(M,U)=>c(K=>{let Q={...K||{},[M]:U};return B.current=Q,Q}),ce=new Set(["toolsRegistered","platform","allowProxyCommandGranted","allowProxyCommandGrantSource","allowProxyCommandGrantedAt"]),de=M=>{let U={};for(let[K,Q]of Object.entries(M||{}))ce.has(K)||Q!==void 0&&(U[K]=Q);return U.sshHosts=Array.isArray(M?.sshHosts)?M.sshHosts:[],U.tunnels=Array.isArray(M?.tunnels)?M.tunnels:[],M?.sftpLimits&&typeof M.sftpLimits=="object"&&(U.sftpLimits={maxDownloadMb:Number(M.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(M.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(M.sftpLimits.maxUploadFiles)||0}),U};B.current=p;let me=(M,U)=>c(K=>({...K||{},sftpLimits:{...K?.sftpLimits??{},[M]:U}})),[te,Be]=r.useState(null),[fe,Oe]=r.useState(null),[We,ke]=r.useState(""),[ee,pe]=r.useState(null),[ve,Z]=r.useState(""),[re,ne]=r.useState(""),[oe,ie]=r.useState(""),ae=r.useRef(null),[he,ye]=r.useState(!1),[be,Le]=r.useState({text:"",kind:""}),[Ae,we]=r.useState(!1),[Ce,Ne]=r.useState({running:!1,ok:!1,text:""}),[Ue,Wt]=r.useState({}),[kd,Ed]=r.useState([]),[ot,pr]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""}),[Et,pi]=r.useState(null);r.useEffect(()=>{if(!m)return;let M=!0,U=async()=>{try{let se=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();M&&se.ok&&Array.isArray(se.tunnels)&&Ed(se.tunnels)}catch{}};U();let K=setInterval(U,2e3);return()=>{M=!1,clearInterval(K)}},[m]);let _r=M=>U=>pr(K=>({...K||{},[M]:U.target.value})),ha=(M,U)=>pr(K=>({...K||{},[M]:U})),Ld=M=>M?.direction==="remote"?b("meta.tunnelRemote",{host:M.remoteHost||"127.0.0.1",port:String(M.remotePort??0),local:String(M.localTargetPort??0)}):b("meta.tunnelLocal",{local:String(M?.localPort??0),host:M?.remoteHost??"?",port:String(M?.remotePort??0)}),da=(p?.sshHosts??[]).find(M=>M?.name===ot?.bookName),mn=async M=>{try{let U=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:M})}),K=await U.json().catch(()=>({}));return!U.ok||!K.ok?(g({kind:"error",text:String(K.error||b("error.saveTunnelFailed"))}),{ok:!1,warnings:[]}):{ok:!0,warnings:Array.isArray(K.warnings)?K.warnings.map(se=>String(se)).filter(se=>se!==""):[]}}catch(U){return g({kind:"error",text:String(U&&U.message?U.message:U)}),{ok:!1,warnings:[]}}},ua=(M,U)=>{if(M.warnings.length>0){g({kind:"warn",text:M.warnings.join(" ")});return}g({kind:"ok",text:U})},fa=()=>Rc(ot,(Array.isArray(p?.sshHosts)?p.sshHosts:[]).map(M=>M?.name),b),Td=M=>{g({kind:"",text:""}),pi(String(M?.name??"")),pr({direction:M?.direction==="remote"?"remote":"local",bookName:String(M?.bookName??""),localPort:M?.localPort?String(M.localPort):"",remoteHost:String(M?.remoteHost??""),remotePort:M?.remotePort?String(M.remotePort):"",localTargetPort:M?.localTargetPort?String(M.localTargetPort):""})},Md=()=>{pi(null),g({kind:"",text:""}),pr(M=>({...M||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))},Rd=()=>{g({kind:"",text:""});let M=fa();if(!M.ok){g({kind:"error",text:M.error});return}let U=M.tunnel,K=Array.isArray(p?.tunnels)?p.tunnels:[];if(Ac(K,U.name)!==void 0){g({kind:"error",text:b("error.tunnelNameTaken",{name:U.name})});return}let Q=[...K,U];c(se=>({...se||{},tunnels:Q})),pr(se=>({...se||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),mn(Q).then(se=>{se.ok&&ua(se,b("msg.tunnelApplied",{name:U.name}))})},Ad=()=>{if(Et===null)return;g({kind:"",text:""});let M=fa();if(!M.ok){g({kind:"error",text:M.error});return}let U=Array.isArray(p?.tunnels)?p.tunnels:[],K=Dc(U,Et,M.tunnel,b);if(!K.ok){K.reason==="missing"&&pi(null),g({kind:"error",text:K.error});return}let Q=K.tunnels;c(se=>({...se||{},tunnels:Q})),mn(Q).then(se=>{if(se.ok!==!0){c(_e=>({..._e||{},tunnels:U}));return}pi(null),pr(_e=>({..._e||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),ua(se,b("msg.tunnelUpdated",{name:M.tunnel.name}))})},pa=(M,U)=>{c(K=>({...K||{},tunnels:M})),mn(M).then(K=>{if(K.ok!==!0){c(Q=>({...Q||{},tunnels:U}));return}K.warnings.length>0&&g({kind:"warn",text:K.warnings.join(" ")})})},Dd=M=>{let U=Array.isArray(p?.tunnels)?p.tunnels:[];Et!==null&&String(M??"")===Et&&(pi(null),pr(K=>({...K||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))),pa(U.filter(K=>K?.name!==M),U)},Pd=(M,U)=>{let K=Array.isArray(p?.tunnels)?p.tunnels:[];pa(K.map(Q=>Q?.name===M?{...Q,enabled:U}:Q),K)},Bd=M=>{Be(M?.name??null),ke(""),Ne({running:!1,ok:!1,text:""}),Z(""),ne(""),vn(),ye(Ot!==null),Oe({name:M?.name??"",host:M?.host??"",port:String(M?.port??22),username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:M?.hostKeyAlias??"",persist:M?.persist!==!1}),gh().then(U=>pe(U)),bn(M?.password??"")},_a=()=>{Be(null),Oe(null),ke(""),Ne({running:!1,ok:!1,text:""}),Z(""),ne(""),vn()},Od=async()=>{if(fe===null)return;let M=fe.name.trim(),U=fe.host.trim(),K=fe.username.trim();if(M===""||U===""||K===""){ke(b("error.nameHostUserRequired"));return}let Q=Number(fe.port);if((!Number.isInteger(Q)||Q<1||Q>65535)&&(Q=22),(p?.sshHosts??[]).some(_e=>_e?.name===M&&M!==te)){ke(b("error.bookNameTaken",{name:M}));return}if(fe.auth==="key"&&fe.keyPath.trim()===""){ke(b("error.keyPathRequired"));return}ke("");let se=fe.password;if(fe.auth==="password"){let _e=await wh(he,fe.password,U,Q,K,"PASSWORD");if(_e.error!==void 0){ke(_e.error);return}_e.value!==void 0&&(se=_e.value)}c(_e=>({..._e||{},sshHosts:(Array.isArray(_e?.sshHosts)?_e.sshHosts:[]).map(xe=>xe?.name===te?{name:M,host:U,port:Q,username:K,auth:fe.auth,keyPath:fe.keyPath.trim(),passphrase:fe.passphrase,password:se,agentForward:fe.agentForward,hostKeyAlias:String(fe.hostKeyAlias??"").trim(),persist:fe.persist===!0}:xe)})),Wt(_e=>{let xe={..._e};return delete xe[M],te!==M&&delete xe[te],xe}),Be(null),Oe(null),Ne({running:!1,ok:!1,text:""}),g({kind:"ok",text:b("msg.hostEdited",{name:M})})},Id=M=>{te===M&&_a(),Wt(U=>{let K={...U};return delete K[M],K}),c(U=>({...U||{},sshHosts:(Array.isArray(U?.sshHosts)?U.sshHosts:[]).filter(K=>K?.name!==M)}))},Nd=async M=>{let U=M?.name??"";if(U==="")return;let K={host:M?.host??"",port:Number(M?.port)||22,username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:typeof M?.hostKeyAlias=="string"?M.hostKeyAlias:""};Wt(se=>({...se,[U]:{running:!0,text:b("msg.probing")}}));let Q=await Wo(K,!0);Wt(se=>{let _e=se[U]||{};if(Q.result){let xe=Q.result.auth?.ok===!0;return{...se,[U]:{running:!1,ok:xe,text:zo(Q.result)}}}return{...se,[U]:{running:!1,ok:!1,text:b("error.probeFailed",{detail:String(Q.error||b("error.unknown"))})}}})},Hd=async M=>{let U=(Array.isArray(p?.hostKeys)?p.hostKeys:[]).filter(K=>!(K?.host===M?.host&&Number(K?.port)===Number(M?.port)));c(K=>({...K||{},hostKeys:U}));try{let K=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:U})}),Q=await K.json().catch(()=>({}));!K.ok||!Q.ok?g({kind:"error",text:String(Q.error||b("error.hostKeyDeleteFailed"))}):g({kind:"ok",text:b("msg.hostKeyDeleted")})}catch(K){g({kind:"error",text:String(K&&K.message?K.message:K)})}},Fd=async()=>{g({kind:"",text:""});try{let U=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!U.ok){g({kind:"error",text:String(U.error||b("error.sshConfigReadFailed"))});return}let K=Array.isArray(U.entries)?U.entries:[],Q=[...Array.isArray(p?.sshHosts)?p.sshHosts:[]],se=new Set(Q.map(Ie=>Ie?.name)),_e=0,xe=0;for(let Ie of K)if(!(Ie===null||typeof Ie!="object"||typeof Ie.name!="string")){if(se.has(Ie.name)){xe+=1;continue}se.add(Ie.name),Q.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,hostKeyAlias:typeof Ie.hostKeyAlias=="string"?Ie.hostKeyAlias:""}),_e+=1}c(Ie=>({...Ie||{},sshHosts:Q}));let ge=Array.isArray(U.proxy)?U.proxy.filter(Ie=>typeof Ie=="string"):[],Ze=Number.isInteger(U.proxyCount)?U.proxyCount:ge.length,mr=Array.isArray(U.proxyCommand)?U.proxyCommand.filter(Ie=>typeof Ie=="string"):[],rt=Number.isInteger(U.proxyCommandCount)?U.proxyCommandCount:mr.length,Or=Number.isInteger(U.skippedOther)?U.skippedOther:0,rr=Number.isInteger(U.droppedOverflow)?U.droppedOverflow:0,bt=[];Ze>0&&bt.push(b("msg.proxySkipped",{count:Ze,names:ge.slice(0,5).join(b("list.separator"))+(Ze>5?b("meta.etc"):"")})),rt>0&&bt.push(b("msg.proxyCommandSkipped",{count:rt,names:mr.slice(0,5).join(b("list.separator"))+(rt>5?b("meta.etc"):"")})),Or>0&&bt.push(b("msg.skippedNotConcrete",{count:Or})),rr>0&&bt.push(b("msg.importOverflow",{count:rr}));let Ca=bt.length>0?b("list.separatorFull")+bt.join(b("list.separatorFull")):"";if(_e===0){let Ie=xe>0?b("msg.noNewEntries",{count:xe}):b("msg.noImportableHosts");g({kind:bt.length>0?"error":"ok",text:Ie+Ca})}else g({kind:bt.length>0?"error":"ok",text:b("msg.importedHosts",{added:_e,skipped:xe})+Ca})}catch(M){g({kind:"error",text:String(M&&M.message?M.message:M)})}},ma=M=>M===null||typeof M!="object"?[]:Array.isArray(M.fingerprints)?M.fingerprints.filter(U=>typeof U=="string"&&U!==""):typeof M.fingerprint=="string"&&M.fingerprint!==""?[M.fingerprint]:[],Wd=async()=>{g({kind:"",text:""});try{let U=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!U.ok){g({kind:"error",text:String(U.error||b("error.knownHostsReadFailed"))});return}let K=Array.isArray(U.entries)?U.entries:[],Q=[...Array.isArray(p?.hostKeys)?p.hostKeys:[]],se=new Map;for(let ge of Q)ge===null||typeof ge!="object"||se.set(String(ge.host??"")+":"+String(ge.port??22),{record:ge,fps:new Set(ma(ge))});let _e=0,xe=0;for(let ge of K){if(ge===null||typeof ge!="object"||typeof ge.host!="string")continue;let Ze=Array.isArray(ge.fingerprints)?ge.fingerprints.filter(rr=>typeof rr=="string"&&rr!==""):[];if(typeof ge.fingerprint=="string"&&ge.fingerprint!==""&&Ze.push(ge.fingerprint),Ze.length===0)continue;let mr=ge.host+":"+String(ge.port??22),rt=se.get(mr);if(rt!==void 0){let rr=!1;for(let bt of Ze)rt.fps.has(bt)||rt.fps.size>=8||(rt.fps.add(bt),rr=!0);if(!rr){xe+=1;continue}delete rt.record.fingerprint,rt.record.fingerprints=[...rt.fps],_e+=1;continue}let Or={host:ge.host,port:Number(ge.port)||22,fingerprints:[...new Set(Ze)].slice(0,8)};se.set(mr,{record:Or,fps:new Set(Or.fingerprints)}),Q.push(Or),_e+=1}if(_e===0){g({kind:"ok",text:xe>0?b("msg.noNewFingerprints",{count:xe}):b("msg.noImportableKnownHosts")});return}c(ge=>({...ge||{},hostKeys:Q}));try{let ge=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:Q})}),Ze=await ge.json().catch(()=>({}));if(!ge.ok||!Ze.ok){g({kind:"error",text:String(Ze.error||b("error.saveHostKeysFailed"))});return}g({kind:"ok",text:b("msg.importedFingerprints",{added:_e,skipped:xe})+(U.truncated===!0?b("hint.knownHostsTruncated"):"")})}catch(ge){g({kind:"error",text:String(ge&&ge.message?ge.message:ge)})}}catch(M){g({kind:"error",text:String(M&&M.message?M.message:M)})}},ga=async M=>{let U=M??B.current??p;v(!0),g({kind:"",text:""});let K=de(U);try{let Q=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(K)}),se=await Q.json();!Q.ok||!se.ok?g({kind:"error",text:String(se.error||b("error.saveFailed"))}):(g({kind:"ok",text:b("msg.saved")}),R.current=JSON.stringify(K),se.config&&(B.current=se.config,c(se.config),Ki(se.config)))}catch(Q){g({kind:"error",text:String(Q&&Q.message?Q.message:Q)})}v(!1)},gn=M=>"/api/dsh-tty/elevate"+M,va=async()=>{try{let U=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json(),K=U&&typeof U.config=="object"&&U.config!==null?U.config:null;if(K===null)return;c(Q=>{if(Q===null)return Q;let se={...Q,allowProxyCommandGranted:K.allowProxyCommandGranted===!0,allowProxyCommandGrantSource:K.allowProxyCommandGrantSource??null,allowProxyCommandGrantedAt:Number.isFinite(K.allowProxyCommandGrantedAt)?K.allowProxyCommandGrantedAt:null};return B.current=se,se})}catch{}},ba=async()=>{w(null),F(!1);let M=B.current||{},U=R.current!==null&&JSON.stringify(de(M))===R.current,K={...M,allowProxyCommand:!0};B.current=K,c(K),await va(),U?(await ga(K),P(b("elev.granted"))):P(b("elev.grantedNeedSave"))},wa=async()=>{F(!1),P(""),w({phase:"loading"});try{let M=await fetch(gn(""),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Fs})}),U=await M.json().catch(()=>({}));if(!M.ok){w({phase:"error",error:String(U.error||M.status)});return}if(U.status==="granted"){await ba();return}w({phase:"pending",command:String(U.command??""),expiresAt:Number(U.expiresAt)||0})}catch(M){w({phase:"error",error:String(M&&M.message?M.message:M)})}},zd=async()=>{P("");try{let M=await fetch(gn("/revoke"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Fs})}),U=await M.json().catch(()=>({}));if(!M.ok){P(b("elev.error")+String(U.error||M.status));return}await va(),P(b("elev.revoked"))}catch(M){P(b("elev.error")+String(M&&M.message?M.message:M))}},Ud=async()=>{let M=x===null?"":String(x.command??"");if(M!==""){if(yd())try{await navigator.clipboard.writeText(M),F(!0);return}catch{}F(!1),P(b("elev.copyManual"))}};r.useEffect(()=>{if(x===null||x.phase!=="pending")return;let M=setInterval(()=>V(Date.now()),1e3),U=setInterval(()=>{fetch(gn("/status"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Fs})}).then(K=>K.json()).then(K=>{K.status==="granted"&&ba()}).catch(()=>{})},1500);return()=>{clearInterval(M),clearInterval(U)}},[x]);let jd=()=>{if(p.allowProxyCommandGrantSource==="env")return i("span",{className:"tt_cardHint",children:b("elev.viaEnv")});let M=p.allowProxyCommandGrantedAt;return n("span",{className:"tt_capState",children:[Number.isFinite(M)?i("span",{children:b("elev.grantedAt",{time:cg(M)})}):null,i("button",{type:"button",className:"tt_toolBtn tt_capRevoke",onClick:()=>{zd()},children:b("elev.revoke")})]})},$d=()=>{let M=String(x.command??""),U=x.expiresAt>0?Math.max(0,Math.ceil((x.expiresAt-A)/1e3)):0,K=x.phase==="pending"&&x.expiresAt>0&&U===0,Q=()=>{w(null),F(!1)};return n("div",{className:"tt_elevPanel",children:[n("div",{className:"tt_elevHead",children:[i("span",{className:"tt_cardLabel",children:b("elev.title")}),i("button",{type:"button",className:"tt_toolBtn",onClick:Q,children:b("elev.close")})]}),i("span",{className:"tt_cardHint",children:b("elev.lockedWhy")}),x.phase==="error"?i("span",{className:"tt_cardHint tt_sshProbeWarn",children:b("elev.error")+String(x.error??"")}):null,x.phase==="loading"?i("span",{className:"tt_cardHint",children:b("elev.loading")}):null,M===""?null:n("div",{className:"tt_elevSteps",children:[i("span",{className:"tt_cardHint",children:b("elev.step")}),i("div",{className:"tt_elevCommand",children:i("code",{children:M})}),n("div",{className:"tt_elevActions",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Ud()},children:b(O?"elev.copied":"elev.copy")}),K?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{wa()},children:b("elev.regenerate")}):i("span",{className:"tt_cardHint",children:b("elev.expiresIn",{sec:U})})]}),i("span",{className:"tt_cardHint",children:b(K?"elev.expired":"elev.waiting")})]}),p.allowProxyCommand===!0&&p.allowProxyCommandGranted!==!0?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{J("allowProxyCommand",!1),Q()},children:b("elev.disableFirst")}):null,i("span",{className:"tt_cardHint",children:b("elev.otherWay")}),i("span",{className:"tt_cardHint",children:b("elev.envHow",{env:Fs})})]})},qd=()=>{let M=p.allowProxyCommandGranted===!0,U=p.allowProxyCommand===!0;return n("div",{className:"tt_capBlock",children:[n("label",{className:"tt_cardField tt_cardRow tt_cardToggle tt_cardDanger",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:U,onChange:K=>{if(!M){wa();return}J("allowProxyCommand",K.target.checked)}}),i("span",{className:"tt_cardLabel",children:b("check.allowProxyCommand")}),U&&!M?i("span",{className:"tt_badgeWarn",children:b("badge.notEffective")}):null]}),i("span",{className:"tt_cardHint",children:b("hint.allowProxyCommand")}),M?jd():i("span",{className:"tt_cardHint tt_sshProbeWarn",children:b("hint.proxyCommandNotGranted")}),E===""?null:i("span",{className:"tt_cardHint",children:E}),x===null?null:$d()]})},vn=()=>{ae.current!==null&&(clearTimeout(ae.current),ae.current=null),ie("")},bn=async M=>{let U=Jr(M);if(oi()===null){ye(!1),we(!1),Le({text:b(Ot===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),kind:"muted"});return}if(U===""){we(!1),Le({text:"",kind:""});return}let K=await vh(U);if(K.unreported===!0){we(!1),Le({text:b("status.credUnreported",{ref:U}),kind:"plain"});return}if(K.error!==void 0){we(!1),Le({text:b("error.credStatusFailed",{error:K.error}),kind:"error"});return}let Q=K.view;Le({text:Q.configured?b("status.credStored",{ref:U,source:Q.source!==""?b("meta.credSource",{source:Q.source}):""}):b("status.credUnknown",{ref:U}),kind:Q.configured?"ok":"plain"}),we(Q.configured===!0&&Q.writable===!0)},Kd=async()=>{let M=Jr(fe?.password??"");if(M==="")return;let U=await bh(M);if(U.error!==void 0){Le({text:U.error,kind:"error"});return}Oe(K=>({...K||{},password:""})),Le({text:"",kind:""}),we(!1)},Gd=(M,U)=>{let K=String(fe?.[M]??"");if(K===""||K.startsWith("env:")||oe===U){vn(),Oe(Q=>({...Q||{},[M]:"env:"+U})),Z(""),M==="password"&&bn("env:"+U);return}ie(U),ae.current!==null&&clearTimeout(ae.current),ae.current=setTimeout(()=>{ae.current=null,ie("")},4e3)},ya=(M,U)=>{if(ee===null)return null;if(ee.length===0)return i("span",{className:"tt_cardHint",children:U});let K=ve===M,Q=re.trim().toUpperCase(),se=Q===""?ee:ee.filter(_e=>_e.toUpperCase().includes(Q));return n("div",{className:"tt_credPicker",children:[i("input",{className:"tt_cardInput",value:K?re:"",placeholder:b("placeholder.credRef"),title:b("hint.credRefCandidates"),autoComplete:"off",spellCheck:!1,onFocus:()=>{Z(M),ne("")},onBlur:_e=>{_e.currentTarget.parentElement.contains(_e.relatedTarget)||Z("")},onChange:_e=>{ne(_e.target.value),Z(M)}}),...K?[i("div",{className:"tt_envList",children:[...se.length===0?[i("span",{className:"tt_envMore",children:b("list.noCredRef")})]:se.slice(0,30).map(_e=>i("button",{type:"button",className:"tt_envItem","data-danger":oe===_e?"":void 0,onMouseDown:xe=>xe.preventDefault(),onClick:()=>Gd(M,_e),children:oe===_e?b("list.credOverwrite",{name:_e}):_e},_e)),...se.length>30?[i("span",{className:"tt_envMore",children:b("list.moreMatches",{count:se.length-30})})]:[]]},"cred-list-"+M)]:[]]})},Vd=()=>{let U=Jr(fe?.password??"")!=="",K=oi()===null;return n("div",{className:"tt_sshRow tt_credRow",children:[U?i("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:Ae!==!0,onClick:()=>{Kd()},children:b("btn.clearCredential")}):i("label",{className:"tt_credToggle",title:b("hint.rememberCredentialApply"),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:he,disabled:K,onChange:Q=>ye(Q.target.checked)}),i("span",{children:b("check.rememberCredentialApply")})]}),be.text===""?null:i("span",{className:"tt_credStatus","data-kind":be.kind,children:be.text}),K&&be.text===""?i("span",{className:"tt_credStatus","data-kind":"muted",children:b("error.credPlainUnavailable")}):null]})},Sa=()=>{let M=String(fe?.host??"").trim(),U=String(fe?.username??"").trim(),K=Number(fe?.port);if((!Number.isInteger(K)||K<1||K>65535)&&(K=22),M===""||U==="")return ke(b("error.hostUserRequired")),null;let Q=fe?.auth,se={host:M,port:K,username:U,auth:Q};if(Q==="key"){let xe=String(fe?.keyPath??"").trim();if(xe==="")return ke(b("error.keyPathRequired")),null;se.keyPath=xe,fe?.passphrase!==""&&(se.passphrase=fe.passphrase)}if(Q==="password"){let xe=String(fe?.password??"");if(xe==="")return ke(b("error.passwordRequired")),null;se.password=xe}fe?.agentForward===!0&&(se.agentForward=!0);let _e=String(fe?.hostKeyAlias??"").trim();return _e!==""&&(se.hostKeyAlias=_e),se},Yd=()=>{ke("");let M=Sa();M!==null&&(Ne({running:!0,ok:!1,text:b("msg.probing")}),Wo(M,!1).then(U=>{if(U.result){let K=U.result.auth?.ok===!0;Ne({running:!1,ok:K,text:zo(U.result)});return}Ne({running:!1,ok:!1,text:b("error.probeFailed",{detail:String(U.error||b("error.unknown"))})})}))},Xd=()=>{ke("");let M=Sa();M!==null&&pn(M)},Jd=()=>{if(fe===null)return null;let M=(U,K,Q,se,_e)=>n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:U}),i("input",{className:"tt_cardInput",type:se??"text",value:fe[K]??"",placeholder:Q??"",autoComplete:"off",spellCheck:!1,onChange:xe=>{let ge=xe.target.value;Oe(Ze=>({...Ze||{},[K]:ge}))},..._e??{}})]});return n("div",{className:"tt_sshEdit",children:[i("div",{className:"tt_sshSection",children:b("section.connection")}),n("div",{className:"tt_sshGrid",children:[M(b("field.bookName"),"name",b("hint.bookNameConflict")),M(b("field.port"),"port","22")]}),M(b("field.host"),"host",b("placeholder.host")),M(b("field.username"),"username","root"),i("div",{className:"tt_sshSection",children:b("section.auth")}),n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.authMethod")}),n("select",{className:"tt_cardInput",value:fe.auth,onChange:U=>Oe(K=>({...K||{},auth:U.target.value})),children:[i("option",{value:"agent",children:b("option.authAgent")}),i("option",{value:"key",children:b("option.authKey")}),i("option",{value:"password",children:b("option.authPassword")})]})]}),...fe.auth==="key"?[M(b("field.keyPath"),"keyPath","~/.ssh/id_ed25519"),M(b("field.passphrase"),"passphrase","","password"),ya("passphrase",b("hint.noCredRefPassphrase"))]:[],...fe.auth==="password"?[M(b("field.password"),"password","","password",{onBlur:()=>{bn(fe.password)}}),Vd(),ya("password",b("hint.noCredRefPasswordApply"))]:[],i("div",{className:"tt_sshSection",children:b("section.options")}),n("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:fe.agentForward===!0,onChange:U=>Oe(K=>({...K||{},agentForward:U.target.checked}))}),i("span",{className:"tt_cardLabel",children:b("check.agentForward")})]}),M(b("field.hostKeyAlias"),"hostKeyAlias",b("placeholder.hostKeyAlias")),i("span",{className:"tt_cardHint",children:b("hint.hostKeyAlias")}),ur==="tmux"?n("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:fe.persist===!0,onChange:U=>Oe(K=>({...K||{},persist:U.target.checked}))}),i("span",{className:"tt_cardLabel",children:b("check.persist")})]}):null,Ce.text!==""?i("div",{className:"tt_sshProbeResult"+(!Ce.running&&Ce.ok?" tt_sshProbeOk":"")+(!Ce.running&&!Ce.ok?" tt_sshProbeBad":""),children:Ce.text}):null,We!==""?i("span",{className:"tt_cardMessage tt_cardMessageError",children:We}):null,n("div",{className:"tt_sshActions",children:[n("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:_a,children:b("btn.cancel")}),i("button",{type:"button",className:"tt_toolBtn",title:b("btn.browseTitle"),onClick:Xd,children:b("btn.fileBrowse")}),i("button",{type:"button",className:"tt_toolBtn",disabled:Ce.running,title:b("btn.probeTitle"),onClick:Yd,children:Ce.running?b("msg.probing"):b("btn.probe")})]}),n("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_cardSave",onClick:()=>{Od()},children:b("btn.apply")}),i("span",{className:"tt_cardHint",children:b("hint.appliedOnSave")})]})]})]})},Zd=M=>{let U=typeof M?.assistProvider=="string"?M.assistProvider.trim():"",K=typeof M?.assistModel=="string"?M.assistModel.trim():"";return U!==""&&K!==""?U+"/"+K:U!==""?U:K},Qd=()=>{if(T.loading)return i("span",{className:"tt_envMore",children:b("list.modelLoading")});if(T.failed)return i("span",{className:"tt_envMore",children:b("list.modelCatalogFailed")});let M=[],U=(p?.assistProvider??"")===""&&(p?.assistModel??"")==="";M.push(i("button",{type:"button",className:"tt_envItem",...U?{"data-active":""}:{},onMouseDown:K=>K.preventDefault(),onClick:()=>{c(K=>({...K||{},assistProvider:"",assistModel:""})),G(!1)},children:b("option.followHostModel")},"assist-route-default"));for(let K of T.groups){let Q=String(K.id??"");if(Q==="")continue;let se=String(K.name??Q),_e=Array.isArray(K.models)?K.models:[];if(_e.length!==0){M.push(i("span",{className:"tt_envMore",children:se},"group-"+Q));for(let xe of _e){let ge=String(xe.id??"");if(ge==="")continue;let Ze=String(xe.name??"")===""?ge:String(xe.name),mr=(p?.assistProvider??"")===Q&&(p?.assistModel??"")===ge;M.push(i("button",{type:"button",className:"tt_envItem",...mr?{"data-active":""}:{},title:Q+"/"+ge,onMouseDown:rt=>rt.preventDefault(),onClick:()=>{c(rt=>({...rt||{},assistProvider:Q,assistModel:ge})),G(!1)},children:Ze===ge?ge:Ze},Q+"/"+ge))}}}return T.groups.length===0&&M.push(i("span",{className:"tt_envMore",children:b("list.noModelCandidate")},"assist-route-empty")),M},_i=(M,U,K,Q)=>n("label",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:M}),i("input",{className:"tt_cardInput",value:p[U]??"",placeholder:K??"",onChange:se=>J(U,se.target.value)}),Q?i("span",{className:"tt_cardHint",children:Q}):null]}),Br=(M,U,K,Q)=>n("label",{className:"tt_cardField tt_cardRow tt_cardToggle"+(typeof K=="string"&&K!==""?" "+K:""),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:p[U]===!0,disabled:Q===!0&&p[U]!==!0,onChange:se=>J(U,se.target.checked)}),i("span",{className:"tt_cardLabel",children:M})]}),mi=p?.platform==="win32";return l==="summary"?b("card.desc"):n(_?"div":"li",{className:_?"tt_pageHost":m?"tt_card tt_cardOpen":"tt_card",children:[_?null:n("button",{type:"button",className:"tt_cardHeader","aria-expanded":m,onClick:()=>y(M=>!M),children:[n("span",{className:"tt_cardHeadText",children:[i("span",{className:"tt_cardName",children:b("card.name")}),i("span",{className:"tt_cardDescription",children:b("card.descFull")})]}),i("span",{className:"dshkit_badge",children:"Kit"}),i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:m?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:i("path",{d:s,fill:"currentColor"})})]}),_||m?n("div",{className:"tt_cardBody",children:[p===null?i("div",{className:"tt_cardMessage",children:b("list.loadingConfig")}):n("div",{children:[k(b("section.basic")),Br(b("check.enabled"),"enabled"),Br(b("check.announce"),"announceToAgent"),mi?n("div",{className:"tt_cardField",children:[n("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:!1,disabled:!0}),i("span",{className:"tt_cardLabel",children:b("check.shellIntegration")})]}),i("span",{className:"tt_cardHint",children:b("hint.shellIntegrationWindows")})]}):Br(b("check.shellIntegrationWindows"),"shellIntegration"),k(b("section.sftp")),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("field.sftpStyle")}),n("select",{className:"tt_cardInput",value:p.sftpStyle==="dual"?"dual":"dialog",onChange:M=>J("sftpStyle",M.target.value),children:[i("option",{value:"dialog",children:b("option.sftpDialog")}),i("option",{value:"dual",children:b("option.sftpDual")})]}),i("span",{className:"tt_cardHint",children:b("hint.sftpDual")})]}),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("field.sftpLimits")}),n("div",{className:"tt_limitGrid",children:[n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.downloadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxDownloadMb))?Number(p.sftpLimits.maxDownloadMb):1024),onChange:M=>me("maxDownloadMb",Number(M.target.value)||0)})]}),n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.uploadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxUploadMb))?Number(p.sftpLimits.maxUploadMb):2048),onChange:M=>me("maxUploadMb",Number(M.target.value)||0)})]}),n("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:b("field.uploadCountLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(p?.sftpLimits?.maxUploadFiles))?Number(p.sftpLimits.maxUploadFiles):1e3),onChange:M=>me("maxUploadFiles",Number(M.target.value)||0)})]})]}),i("span",{className:"tt_cardHint",children:b("hint.sftpLimits")})]}),k(b("section.session")),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("field.persistence")}),n("select",{className:"tt_cardInput",value:p.persistence==="tmux"?"tmux":"off",onChange:M=>J("persistence",M.target.value),children:[i("option",{value:"off",children:b("option.persistOff")}),i("option",{value:"tmux",children:b("option.persistTmux")})]}),i("span",{className:"tt_cardHint",children:b("hint.persistence")+(mi?b("hint.persistenceWindows"):"")}),Br(b("check.endOnPageClose"),"endOnPageClose"),Br(b("check.statsEnabled"),"statsEnabled"),i("span",{className:"tt_cardHint",children:b("hint.statsEnabled")}),qd()]}),k(b("section.assist")),Br(b("check.assistEnabled"),"assistEnabled"),i("span",{className:"tt_cardHint",children:b("hint.assistEnabled")}),n("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||G(!1)},children:[i("span",{className:"tt_cardLabel",children:b("field.assistRoute")}),i("input",{className:"tt_cardInput tt_routeInput",ref:j,readOnly:!0,value:Zd(p),autoComplete:"off",spellCheck:!1,onFocus:()=>{G(!0),T.groups.length===0&&!T.loading&&X()},onClick:()=>{G(!0),T.groups.length===0&&!T.loading&&X()},onKeyDown:M=>{M.key==="Escape"&&G(!1)}}),...N?[i("div",{className:"tt_envList tt_routeList",children:Qd()},"assist-route-list")]:[],i("span",{className:"tt_cardHint",children:b("hint.assistRoute")})]},"assist-route-field"),_i(b("field.maxSessions"),"maxSessions","4",b("hint.maxSessions")),n("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||L(!1)},children:[i("span",{className:"tt_cardLabel",children:b(mi?"field.shellWindows":"field.shell")}),i("input",{className:"tt_cardInput",ref:Y,value:p.shell??"",placeholder:b(mi?"placeholder.shellWindows":"placeholder.shell"),autoComplete:"off",spellCheck:!1,onFocus:()=>L(!0),onClick:()=>L(!0),onKeyDown:M=>{M.key==="Escape"&&L(!1)},onChange:M=>{J("shell",M.target.value),L(!0)}}),...C?[i("div",{className:"tt_envList tt_shellList",children:(()=>{let M=(p.shell??"").trim().toLowerCase(),U=M===""?z:z.filter(K=>K.toLowerCase().includes(M));return U.length===0?i("span",{className:"tt_envMore",children:b("list.noShellCandidate")}):U.map(K=>i("button",{type:"button",className:"tt_envItem",onMouseDown:Q=>Q.preventDefault(),onClick:()=>{J("shell",K),L(!1)},children:K},K))})()},"shell-list")]:[],i("span",{className:"tt_cardHint",children:b(mi?"hint.shellCandidatesWindows":"hint.shellCandidates")})]},"shell-field"),_i("TERM","term","xterm-256color",b("hint.term")),_i("COLORTERM","colorTerm","truecolor",""),_i(b("field.cwd"),"cwd","",b("placeholder.cwd")),_i(b("field.grace"),"reconnectGraceSec","120",b("hint.grace")),k(b("section.ssh")),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("panel.sshBook")}),...Array.isArray(p.sshHosts)&&p.sshHosts.length>0?[i("div",{className:"tt_hostList","data-editing":te!==null?"":void 0,children:p.sshHosts.map(M=>n("div",{children:[n("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:M?.name??""}),i("span",{className:"tt_sshHostTarget",children:Fo(M??{})})]}),i("button",{type:"button",className:"tt_toolBtn",disabled:Ue[M?.name]?.running===!0,onClick:()=>{Nd(M)},title:b("btn.probeRowTitle"),children:Ue[M?.name]?.running===!0?b("msg.testing"):b("btn.test")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Bd(M),children:b("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Id(M?.name),children:b("btn.delete")})]}),Ue[M?.name]&&Ue[M?.name].text?i("div",{className:"tt_sshProbeResult"+(Ue[M?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:Ue[M?.name].text}):null,te===M?.name?Jd():null]},String(M?.name??"")))})]:[i("span",{className:"tt_cardHint",children:b("list.emptySshHosts")})],n("div",{className:"tt_cardRow",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Fd()},children:b("btn.importSshConfig")}),i("span",{className:"tt_cardHint",children:b("hint.importSshConfig")})]}),i("span",{className:"tt_cardHint",children:b("hint.sshBook")})]}),n("div",{className:"tt_cardField",children:[n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("panel.tunnels")}),...Array.isArray(p.tunnels)&&p.tunnels.length>0?[i("div",{children:p.tunnels.map(M=>{let U=kd.find(se=>se.name===M?.name),K=U?.state??"stopped",Q=Et!==null&&String(M?.name??"")===Et;return n("div",{className:"tt_sshHostRow","data-editing":Q?"":void 0,children:[i("span",{className:"tt_tunnelDot","data-state":K,title:K}),i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:(M?.name??"")+" \xB7 "+Ld(M??{})}),i("span",{className:"tt_sshHostTarget",children:(M?.bookName??"")+(U?.error?" \xB7 "+U.error:"")+(U?.lastForwardError?" \xB7 "+U.lastForwardError:"")})]}),i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:M?.enabled!==!1,title:b("check.tunnelEnabled"),onChange:se=>Pd(M?.name,se.target.checked)}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Td(M),children:b("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Dd(M?.name),children:b("btn.delete")})]},String(M?.name??""))})})]:[i("span",{className:"tt_cardHint",children:b("list.emptyTunnels")})],n("div",{className:"tt_sshEdit",children:[n("div",{className:"tt_cardRow tt_tunnelHead",children:[n("div",{className:"tt_segmented",role:"group","aria-label":b("field.direction"),children:[i("button",{type:"button",className:"tt_segmentedBtn","data-active":ot.direction!=="remote"?"":void 0,title:b("option.localForwardTitle"),onClick:()=>ha("direction","local"),children:b("option.localForward")}),i("button",{type:"button",className:"tt_segmentedBtn","data-active":ot.direction==="remote"?"":void 0,title:b("option.remoteForwardTitle"),onClick:()=>ha("direction","remote"),children:b("option.remoteForward")})]}),n("select",{className:"tt_cardInput",value:ot.bookName,onChange:_r("bookName"),children:[i("option",{value:"",children:b("option.selectBook")}),...Array.isArray(p?.sshHosts)?p.sshHosts.map(M=>i("option",{value:M?.name??"",children:M?.name??""})):[]]})]}),i("span",{className:"tt_cardHint",children:da!==void 0?b("hint.tunnelViaBook",{book:Fo(da)}):b("hint.tunnelBookEmpty")}),ot.direction==="local"?n("div",{className:"tt_tunnelEndpoints",children:[n("div",{className:"tt_tunnelHop",children:[n("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:b("hint.localListenFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.localPort"),value:ot.localPort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.localListenPort"),onChange:_r("localPort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"local",title:b("hint.flowLocalToRemote"),"aria-hidden":"true",children:"\u2192"})]}),n("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:b("placeholder.remoteHost"),title:b("hint.remoteHostTitle"),value:ot.remoteHost,autoComplete:"off","aria-label":b("field.remoteHost"),onChange:_r("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.port"),value:ot.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.remotePort"),onChange:_r("remotePort")})]})]}):n("div",{className:"tt_tunnelEndpoints",children:[n("div",{className:"tt_tunnelHop",children:[n("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:b("placeholder.remoteListenHost"),title:b("hint.remoteListenHost"),value:ot.remoteHost,autoComplete:"off","aria-label":b("field.remoteListenHost"),onChange:_r("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.listenPort"),value:ot.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.remoteListenPort"),onChange:_r("remotePort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"remote",title:b("hint.flowRemoteToLocal"),"aria-hidden":"true",children:"\u2192"})]}),n("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:b("hint.localDialFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:b("placeholder.localTargetPort"),value:ot.localTargetPort,autoComplete:"off",inputMode:"numeric","aria-label":b("field.localTargetPort"),onChange:_r("localTargetPort")})]})]}),i("div",{className:"tt_tunnelEndpoints",children:[i("span",{className:"tt_tunnelEndLabel",children:ot.direction==="local"?b("hint.tunnelLocalSummary"):b("hint.tunnelRemoteSummary")})]}),i("div",{className:"tt_cardRow tt_tunnelActions",children:[Et===null?i("button",{type:"button",className:"tt_cardSave",onClick:Rd,children:b("btn.addTunnel")}):i("button",{type:"button",className:"tt_cardSave",onClick:Ad,children:b("btn.saveEdit")}),Et===null?null:i("button",{type:"button",className:"tt_toolBtn",onClick:Md,children:b("btn.cancel")}),i("span",{className:"tt_cardHint",children:Et===null?b("hint.tunnelAdd"):b("hint.tunnelEditing",{name:Et})})]})]})]}),n("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:b("panel.hostKeys")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Wd()},children:b("btn.importKnownHosts")})]}),...Array.isArray(p.hostKeys)&&p.hostKeys.length>0?[i("div",{className:"tt_hostList",children:p.hostKeys.map((M,U)=>n("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:String(M?.host??"")+":"+String(M?.port??22)}),i("span",{className:"tt_sshHostTarget",children:ma(M).map(K=>"sha256:"+K).join(" / ")})]}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>{Hd(M)},children:b("btn.delete")})]},String(M?.host??"")+":"+String(M?.port??22)+"#"+String(U)))})]:[i("span",{className:"tt_cardHint",children:b("list.emptyHostKeys")})],i("span",{className:"tt_cardHint",children:b("hint.hostKeys")})]}),n("div",{className:"tt_cardField tt_cardRow",children:[i("button",{className:"tt_cardSave",disabled:f,onClick:()=>{ga()},children:b(f?"msg.saving":"btn.save")}),i("span",{className:"tt_cardMessage"+(S.kind==="ok"?" tt_cardMessageOk":S.kind==="error"?" tt_cardMessageError":S.kind==="warn"?" tt_cardMessageWarn":""),children:S.text})]})]})]}):null]})}t.inject=["slots","sessions"];let a=["@hyzyn/dsh-tty#tty","@hyzyn/dsh-all#tty"];return t.apply=d=>{L_(d),Rh=d.sessions,d.inject(["remote","remote.credentials"],S=>(Ot=S.remote?.credentials??S["remote.credentials"]??null,()=>{Ot=null}));let l=!1,_=()=>{};rn={set(S){if(S!==l){if(l=S,S){_=mg();return}_(),_=()=>{},Vi(),Er()}}},Xh(!0),aa();let m="@hyzyn/dsh-all",p=[...new Set(a.map(S=>S.split("#")[0]))].find(S=>S!==m),c=!1,u=[];p!==void 0&&d.slots.inject("plugins.bundle.config",()=>{for(c=!0;u.length>0;){let S=u.pop();typeof S=="function"&&S()}return d.slots.register({name:"plugins.bundle.config",key:p},o)});for(let S of a)d.slots.inject("plugins.row.config",()=>{let g=S.split("#")[0]===p;if(g&&c)return;let x=d.slots.register({name:"plugins.row.config",key:S},o);return g&&u.push(x),x});d.slots.inject("settings.kit.item",()=>d.slots.register({name:"settings.kit.item",id:"tty",order:80,label:()=>b("card.name")},o)),d.slots.inject("settings.plugin.item",()=>d.slots.register({name:"settings.plugin.item",key:"tty",order:100},o));let h=d.provide("ttyConnbar",{version:1,addAction:cn,requestRender(){Er()}}),f=d.provide("ttyTerminal",{version:3,open(S){if(!Lr)return;let g=Fh(S),x=Wh(S,g),w=typeof S?.label=="string"&&S.label!==""?S.label:void 0;if(Yi(),S?.reuse!==!1){let E=nm(x);if(E!==null)return Vo(),tr(E.sid,{user:!0}),E}return Vo(),$i(x,w)},mount(S,g){return Lr?_m(S,g):()=>{}}}),v=d.provide("ttyPanel",{version:2,isOpen(){return ue!==null&&!Ge},mountPane(S){return jh(S)},minimize(){return Gi(),ue!==null&&Ge}});return()=>{rn=null,Lr=!1,_(),v(),f(),h(),Vi()}},t}});})();
|
|
3765
|
+
`;function Ns(e){let t=typeof e=="string"?e.trim():"";if(t==="")return;let r=t,i="",o=r.lastIndexOf("@");o>0&&(i=r.slice(0,o).trim(),r=r.slice(o+1).trim());let s=r,n=22,a=/^\[([^\]]+)\](?::(\d+))?$/.exec(r)??/^([^:]+):(\d+)$/.exec(r);if(a!==null){s=a[1];let l=Number(a[2]);Number.isInteger(l)&&l>=1&&l<=65535&&(n=l)}if(s==="")return;let u={host:s,port:n};return i!==""&&(u.username=i),u}function Co(e){if(e===null||typeof e!="object")return"";let t=e,r=typeof t.host=="string"?t.host.trim():"";if(r==="")return"";let i=Number.isInteger(t.port)&&Number(t.port)>=1&&Number(t.port)<=65535?Number(t.port):22,o=typeof t.username=="string"&&t.username.trim()!==""?t.username.trim()+"@":"",s=r.includes(":")&&!r.startsWith("[")?`[${r}]`:r;return`${o}${s}${i===22?"":":"+String(i)}`}function Ac(e){return String(e??"").trim()!==""}function Dc(e){return Ac(e)}function Pc(e,t,r){return e!==!0?"":Ac(t)?String(t):String(r??"").trim()}var xo="\0global";function Qr(e,t){return e===null?xo:typeof e=="string"&&e!==""?e:typeof t=="string"&&t!==""?t:xo}function ko(e,t){return e===xo?!0:typeof t=="string"&&t!==""&&e===t}var g_="/api/dsh-tty/ws";function Bc(e,t){let r=new URL(t??e,e);return(r.protocol==="https:"?"wss:":"ws:")+"//"+r.host+g_}function Eo(e){return String(e??"").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Oc(e,t,r,i){let o=Eo(r),s=Eo(e);if(o===""||s==="")return"";let n=Eo(t),a=["DSH_TTY",o,s];return n!==""&&n!=="22"&&a.push(n),a.push(i),a.join("_")}function Hs(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=65535?t:0}function Ic(e,t,r){return`${e}-${t==="remote"?"R":"L"}${String(r)}`}function Nc(e,t=[],r=i=>i){let i=e??{},o=String(i.bookName??"")||String(t[0]??"")||"";if(o==="")return{ok:!1,error:r("error.tunnelNoBook")};if(i.direction==="remote"){let u=Hs(i.remotePort),l=Hs(i.localTargetPort);return u<1||l<1?{ok:!1,error:r("error.tunnelRemotePortRequired")}:{ok:!0,tunnel:{name:Ic(o,"remote",u),bookName:o,direction:"remote",remotePort:u,localTargetHost:"",localTargetPort:l,enabled:!0}}}let s=Hs(i.localPort),n=String(i.remoteHost??"").trim(),a=Hs(i.remotePort);return s<1||n===""||a<1?{ok:!1,error:r("error.tunnelLocalRequired")}:{ok:!0,tunnel:{name:Ic(o,"local",s),bookName:o,direction:"local",localPort:s,remoteHost:n,remotePort:a,enabled:!0}}}function Hc(e,t){return(Array.isArray(e)?e:[]).find(r=>String(r?.name??"")===String(t))}function v_(e,t,r){return(Array.isArray(e)?e:[]).find(i=>String(i?.name??"")!==String(t)&&String(i?.name??"")===String(r))}function Fc(e,t,r,i){let o=Array.isArray(e)?e:[],s=o.find(u=>String(u?.name??"")===String(t));if(s===void 0)return{ok:!1,reason:"missing",error:i("error.tunnelMissing",{name:String(t)})};if(v_(o,t,r.name)!==void 0)return{ok:!1,reason:"clash",error:i("error.tunnelClash",{name:String(r.name)})};let a={...r,enabled:s.enabled!==!1};return{ok:!0,tunnels:o.map(u=>String(u?.name??"")===String(t)?a:u)}}function b_(e){let t=e?.byId;if(!(t===null||typeof t!="object"))for(let r of Object.keys(t)){let i=t[r]?.retainedBy?.mainView??0;if(typeof i=="number"&&i>0)return r}}function w_(e){let t=e?.current;return typeof t=="string"&&t!==""?t:b_(e)}function Wc(e){let t=w_(e);if(t===void 0)return;let r=e?.byId?.[t]?.cwd;return typeof r=="string"&&r!==""?r:void 0}function y_(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0}function jc(e,t){if(e==null)return;let r=Math.floor(Number(e.cols)),i=Math.floor(Number(e.rows));if(!(!Number.isFinite(r)||!Number.isFinite(i))&&!(r<20||i<3)&&!(t==null||!y_(Number(t.width),Number(t.height))))return{cols:Math.min(500,r),rows:Math.min(200,i)}}function zc(e){return e!==null&&typeof e=="object"&&e.exited!==!0}function Uc(e){if(!Array.isArray(e))return 0;let t=0;for(let r of e)zc(r)&&(t+=1);return t}function Lo(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)zc(r)&&typeof r.sid=="string"&&r.sid!==""&&t.add(r.sid);return t}function $c(e){let t=new Set,r=new Set,i=new Set;if(!Array.isArray(e))return{present:t,retained:r,live:i};for(let o of e){if(o===null||typeof o!="object")continue;let s=typeof o.sid=="string"?o.sid:"";s!==""&&(t.add(s),o.exited===!0?r.add(s):i.add(s))}return{present:t,retained:r,live:i}}function qc(e,t){if(e===null||typeof e!="object"||e.agentOwned!==!0||e.embedded===!0)return"keep";let r=typeof e.sid=="string"?e.sid:"";return r===""||t===null||typeof t!="object"?"keep":t.present.has(r)?t.retained.has(r)?"mark-exited":"keep":"remove"}function Kc(e){let t={live:0,agentLive:0,confirm:!1};if(e==null||typeof e[Symbol.iterator]!="function")return t;let r=0,i=0;for(let o of e)o===null||typeof o!="object"||o.embedded!==!0&&o.exited!==!0&&(r+=1,o.agentOwned===!0&&(i+=1));return{live:r,agentLive:i,confirm:r>0}}var Fs=Object.freeze({sids:[],live:0,agentLive:0,confirm:!1});function Gc(e){let t=[];if(e==null||typeof e[Symbol.iterator]!="function")return t;for(let r of e){if(r===null||typeof r!="object"||r.embedded===!0)continue;let i=r.sid;typeof i!="string"||i===""||t.push({sid:i,exited:r.exited===!0,agentOwned:r.agentOwned===!0})}return t}function Vc(e){return Gc(e).length}function Ws(e){let t=e.map(i=>i.sid),r=e.filter(i=>i.exited!==!0);return{sids:t,live:r.length,agentLive:r.filter(i=>i.agentOwned===!0).length,confirm:r.length>=2}}function Yc(e,t){let r=Gc(e);if(r.length===0)return{others:Fs,left:Fs,right:Fs,exited:Fs};let i=typeof t=="string"?t:"",o=r.findIndex(s=>s.sid===i);return{others:Ws(o<0?r:r.filter(s=>s.sid!==i)),left:Ws(o<0?[]:r.slice(0,o)),right:Ws(o<0?[]:r.slice(o+1)),exited:Ws(r.filter(s=>s.exited===!0))}}function xr(e){return e!==null&&typeof e=="object"&&e.hidden===!0}function To(e){return!(e===null||typeof e!="object"||e.agentOwned===!0||e.embedded===!0)}function Mo(e,t){let r=e!==null&&typeof e=="object"?{...e}:{};return t===!0?(r.hidden=!0,r):(delete r.hidden,r)}function Jc(e){return e===!0?"btn.showToAgent":"btn.hideFromAgent"}function Xc(e){let t=Number(e?.received),r=Number(e?.attempt),i=Number.isInteger(e?.maxAttempts)?e.maxAttempts:3,o=e?.total===null||e?.total===void 0?null:Number(e.total);return e?.canceled===!0?{resume:!1,reason:"canceled"}:!Number.isFinite(t)||t<=0?{resume:!1,reason:"noProgress"}:!Number.isInteger(r)||r<1?{resume:!1,reason:"badAttempt"}:r>i?{resume:!1,reason:"attemptsExhausted"}:o!==null&&Number.isFinite(o)&&o>0&&t>=o?{resume:!1,reason:"complete"}:{resume:!0,offset:t}}function S_(e){return typeof e!="string"||e===""||e==="."||e===".."?!1:e.startsWith(".")}function js(e,t){let i=(Array.isArray(e)?e:[]).filter(o=>o!==null&&typeof o=="object"&&typeof o.name=="string"&&o.name!=="");return t===!0?i:i.filter(o=>!S_(o.name))}function Zc(e,t){return e!=="remote"?{accept:!1,reason:"wrongPane"}:(Array.isArray(t?.types)?t.types:[]).includes("Files")?Number(t?.files?.length??0)>0?{accept:!0}:{accept:!1,reason:"empty"}:{accept:!1,reason:"notFiles"}}function Qc(e){let t=new Set;for(let r of Array.isArray(e)?e:[]){let i=typeof r?.relPath=="string"?r.relPath:"",o=i.lastIndexOf("/");o<=0||t.add(i.slice(0,o))}return[...t].sort((r,i)=>r.split("/").length-i.split("/").length||r.localeCompare(i))}function eh(e,t){return e==null?{text:"",state:""}:e.exited===!0?{text:e.statusText??t("status.exited"),state:e.statusState??""}:e.live===!0?{text:e.statusText??t("status.connected"),state:e.statusState??"connected"}:e.errored===!0?{text:e.statusText??t("status.errored"),state:e.statusState??"error"}:{text:e.statusText??t("status.connectingEllipsis"),state:e.statusState??""}}function th(e,t){return typeof e!="string"||e===""?!0:e===t}function rh(e,t){return e===null?!1:e!==t}var ih="block",Ro="none";function C_(e){return e===ih}function sh(e){return e===!0?ih:Ro}function nh(e){return!C_(e)}function ct(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return String(e)+" B";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]}function Di(e){if(!Number.isFinite(e)||e<=0)return"";if(e<1024)return"<1 KB/s";let t=["KB","MB","GB","TB"],r=e,i=-1;do r/=1024,i+=1;while(r>=1024&&i<t.length-1);return(r>=100?r.toFixed(0):r.toFixed(1))+" "+t[i]+"/s"}function ah(e){return Number.isFinite(e)?e>=90?"danger":e>=70?"warn":"":""}function oh(e,t){return!Number.isFinite(e)||e<0?t("list.none"):e<1024?Math.round(e)+" B/s":Di(e)||t("list.none")}function x_(e,t){if(!Number.isFinite(e)||e<0)return t("list.none");let r=Math.floor(e),i=Math.floor(r/604800),o=Math.floor(r%604800/86400),s=Math.floor(r%86400/3600),n=Math.floor(r%3600/60),a=[];return i>0&&a.push(i+"w"),(i>0||o>0)&&a.push(o+"d"),(i>0||o>0||s>0)&&a.push(s+"h"),(i>0||o>0||s>0||n>0)&&a.push(n+"m"),a.length>0?a.join(""):r+"s"}function k_(e,t,r){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?r("list.none"):(ct(e)||"0 B")+"/"+(ct(t)||"0 B")}function lh(e,t){let r=e[t];return Number.isFinite(r)?t==="tempC"?r>-100&&r<200?r:null:t==="cores"?r>=1&&r<=4096?r:null:t==="cpuPct"||t==="memPct"||t==="diskPct"?r>=0&&r<=100?r:null:t==="uptimeSec"?r>=0&&r<=100*365*24*3600?r:null:t==="tcpConns"?r>=0&&r<=1e7?r:null:t==="rxRate"||t==="txRate"?r>=0&&r<=2**40?r:null:r>=0&&r<=2**50?r:null:null}var E_=["cpuPct","cores","memUsed","memTotal","memPct","diskUsed","diskTotal","diskPct","uptimeSec","tcpConns","rxRate","txRate","tempC"];function ch(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:E_.some(t=>lh(e,t)!==null)}var L_=8e3;function hh(e,t=Date.now()){return t-(e||0)<=L_}var dh=23;function Ao(e){return[{key:"cpuPct",label:"CPU",kind:"pct",slot:4},{key:"memPct",label:e("meta.mem"),kind:"pct",slot:4},{key:"diskPct",label:e("meta.disk"),kind:"pct",slot:4},{key:"cores",label:e("meta.cores"),kind:"count",slot:4},{key:"mem",label:e("meta.mem"),kind:"pair",slot:17,used:"memUsed",total:"memTotal"},{key:"uptimeSec",label:e("meta.uptime"),kind:"uptime",slot:13},{key:"tcpConns",label:"TCP",kind:"count",slot:6},{key:"disk",label:e("meta.disk"),kind:"pair",slot:17,used:"diskUsed",total:"diskTotal"},{key:"tempC",label:e("meta.temp"),kind:"temp",slot:8},{key:"net",label:e("meta.net"),kind:"net",slot:dh}]}function uh(e,t){let r=e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{},i=s=>lh(r,s),o=(s,n,a,u=s.slot)=>({key:s.key,label:s.label,kind:s.kind,slot:u,pct:a??null,value:n,title:s.label+": "+n});return Ao(t).map(s=>{if(s.kind==="pct"){let a=i(s.key);return o(s,a===null?t("list.none"):Math.round(a)+"%",a)}if(s.kind==="pair")return o(s,k_(i(s.used),i(s.total),t),null);if(s.kind==="uptime")return o(s,x_(i(s.key),t),null);if(s.kind==="temp"){let a=i(s.key);return o(s,a===null?t("list.none"):a.toFixed(1)+"\xB0C",null)}if(s.kind==="net"){let a=i("rxRate"),u=i("txRate");return a===null&&u===null?o(s,t("list.none"),null,0):o(s,"\u2193"+oh(a,t)+" \u2191"+oh(u,t),null,dh)}let n=i(s.key);return o(s,n===null?t("list.none"):String(n),null)})}var Do="tty",Xs={"error.credServiceMissing":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09","error.credServiceIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574","error.credStoreUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u5B58\u5165","error.credStoreFailed":"\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u5931\u8D25\uFF1A{error}","error.credClearUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u65E0\u6CD5\u6E05\u9664","error.credClearFailed":"\u6E05\u9664\u5931\u8D25\uFF1A{error}","error.credRefNeedsHost":"\u5148\u586B\u300C\u4E3B\u673A\u300D\u548C\u300C\u7528\u6237\u540D\u300D\u518D\u5B58\u5165\u2014\u2014\u5F15\u7528\u540D\u7531\u8FD9\u4E24\u8005\u6D3E\u751F","btn.reopen":"\u91CD\u65B0\u6253\u5F00","btn.reopenTitle":"\u4EE5\u539F\u8FDE\u63A5\u4FE1\u606F\u91CD\u5F00\u4F1A\u8BDD","btn.sftpTitle":"\u6253\u5F00\u8BE5\u8FDE\u63A5\u7684\u6587\u4EF6\u6D4F\u89C8\uFF08SFTP\uFF09","btn.tunnels":"\u96A7\u9053 {count}","btn.tunnelsTitle":"\u67E5\u770B\u8BE5\u8FDE\u63A5\u7684\u7AEF\u53E3\u8F6C\u53D1\u96A7\u9053","btn.more":"\u66F4\u591A","btn.moreTitle":"\u66F4\u591A\u64CD\u4F5C\uFF08\u7AEF\u53E3\u8F6C\u53D1\u2026\uFF09","btn.reopenSession":"\u91CD\u65B0\u6253\u5F00\u4F1A\u8BDD","status.exited":"\u4F1A\u8BDD\u5DF2\u9000\u51FA","status.ended":"\u4F1A\u8BDD\u5DF2\u7ED3\u675F","btn.clickRerun":"\u70B9\u51FB\u91CD\u65B0\u6267\u884C","status.aiEnded":"AI \u5DF2\u7ED3\u675F\u8FD9\u4E2A\u4F1A\u8BDD","hint.aiEndedTab":"\u5185\u5BB9\u5148\u7559\u7740\uFF1A\u5207\u8D70\u6216\u70B9\u300C\u6536\u8D77\u300D\u5373\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E","btn.dismiss":"\u6536\u8D77","btn.dismissTitle":"\u5173\u95ED\u8FD9\u4E2A\u6807\u7B7E\uFF08\u4F1A\u8BDD\u5DF2\u7ECF\u7ED3\u675F\u4E86\uFF09","hint.reopenWithSpec":"\u6309\u539F\u89C4\u683C\u91CD\u5F00\u4E00\u6761\u4F1A\u8BDD\uFF08\u6301\u4E45\u6807\u7B7E\u63A5\u56DE tmux\uFF0C\u547D\u4EE4\u6807\u7B7E\u91CD\u8DD1\u4E00\u6B21\uFF09","btn.newLocalTerminal":"\u65B0\u5F00\u672C\u5730\u7EC8\u7AEF","hint.reopenAgentLocal":"\u8FD9\u6761\u4F1A\u8BDD\u662F AI \u5F00\u7684\u3001\u5DF2\u7ECF\u7ED3\u675F\uFF1A\u70B9\u4E86\u4F1A\u65B0\u5F00\u4E00\u4E2A\u672C\u5730\u7EC8\u7AEF\uFF0C\u4E0D\u4F1A\u63A5\u56DE\u539F\u6765\u90A3\u6761","msg.passwordNotStored":"\u51FA\u4E8E\u5B89\u5168\u8003\u8651\uFF0C\u660E\u6587\u5BC6\u7801/\u53E3\u4EE4\u4E0D\u968F\u6D4F\u89C8\u5668\u5B58\u50A8\u4FDD\u7559\uFF0C\u672C\u6B21\u8FDE\u63A5\u9700\u8981\u91CD\u65B0\u8F93\u5165\uFF1A\u91CD\u5F00\u6807\u7B7E\u65F6\u518D\u586B\u4E00\u6B21\uFF0C\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u628A\u51ED\u636E\u6362\u6210 env: \u5F15\u7528\uFF08\u503C\u5B58\u5BBF\u4E3B\u51ED\u636E\u5B58\u50A8\uFF09\u3002","error.terminalNeedsCommand":"ttyTerminal \u9700\u8981 command","error.terminalCommandSingleLine":"command \u5FC5\u987B\u662F\u5355\u884C","error.terminalNeedsHost":"ttyTerminal.mount \u9700\u8981 HTMLElement \u4F5C\u4E3A\u6302\u8F7D\u70B9","error.panelNotReady":"ttyPanel.mountPane\uFF1A\u7EC8\u7AEF\u9762\u677F\u672A\u5C31\u7EEA","panel.dragHeight":"\u62D6\u52A8\u8C03\u6574\u9AD8\u5EA6","panel.dragWidth":"\u62D6\u52A8\u8C03\u6574\u5BBD\u5EA6","btn.closePane":"\u5173\u95ED\u4FA7\u680F","btn.expandPane":"\u5C55\u5F00\u4FA7\u680F","btn.collapsePane":"\u6536\u8D77\u4FA7\u680F","panel.tabLabel":"\u7EC8\u7AEF {n}","btn.close":"\u5173\u95ED","btn.closeTabAria":"\u5173\u95ED\u6807\u7B7E\uFF1A{label}","btn.newTab":"\u65B0\u5EFA\uFF08\u672C\u5730 / SSH\uFF09","btn.tabList":"\u6807\u7B7E\u5217\u8868","btn.tabListTitle":"\u6807\u7B7E\u5217\u8868\uFF08{n} \u4E2A\uFF09","list.tabsAllVisible":"\u6CA1\u6709\u85CF\u5728\u89C6\u91CE\u5916\u7684\u6807\u7B7E","list.cleanExited":"\u6E05\u7406\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\uFF08{n}\uFF09","btn.closeTab":"\u5173\u95ED\u6B64\u6807\u7B7E","btn.hideFromAgent":"\u5BF9 AI \u9690\u85CF\u6B64\u6807\u7B7E","btn.showToAgent":"\u53D6\u6D88\u9690\u85CF\uFF08\u8BA9 AI \u53EF\u7528\uFF09","btn.hiddenMark":"\u5BF9 AI \u4E0D\u53EF\u89C1","btn.closeLeft":"\u5173\u95ED\u5DE6\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","btn.closeOthers":"\u5173\u95ED\u5176\u4ED6\u6807\u7B7E\uFF08{n}\uFF09","btn.closeRight":"\u5173\u95ED\u53F3\u4FA7\u6807\u7B7E\uFF08{n}\uFF09","list.subLive":"\u5176\u4E2D {n} \u4E2A\u8FD8\u5F00\u7740","meta.tunnelRemote":"\u8FDC\u7A0B:{host}:{port} \u2192 \u672C\u673A:{local}","meta.tunnelLocal":"\u672C\u673A:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"\u5DF2\u7531 tmux \u6258\u7BA1 \u2014 \u65AD\u7EBF / \u5BBF\u4E3B\u91CD\u542F\u540E\u6309\u540D\u63A5\u56DE\u73B0\u573A","status.notPersisted":"\u672A\u6301\u4E45\u5316","status.tmuxUnavailableTitle":"\u8BF7\u6C42\u4E86\u6301\u4E45\u4F1A\u8BDD\uFF0C\u4F46 tmux \u4E0D\u53EF\u7528 \u2014 \u5F53\u524D\u4E3A\u666E\u901A\u4F1A\u8BDD","status.connected":"\u5DF2\u8FDE\u63A5","status.connecting":"\u8FDE\u63A5\u4E2D","status.errored":"\u8FDE\u63A5\u51FA\u9519","panel.tunnels":"\u7AEF\u53E3\u8F6C\u53D1","hint.tunnelsSettings":"\u5728 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 \u7EC8\u7AEF\u9762\u677F \u91CC\u914D\u7F6E","panel.tunnelsFor":"\u7AEF\u53E3\u8F6C\u53D1 \u2014 {name}","list.loading":"\u52A0\u8F7D\u4E2D\u2026","hint.tunnelsCard":"\u589E\u5220/\u542F\u505C\u5728 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u7684\u7AEF\u53E3\u8F6C\u53D1\u533A\u5757\u7EF4\u62A4","list.noActiveTunnels":"\u8BE5\u8FDE\u63A5\u6682\u65E0\u542F\u7528\u7684\u96A7\u9053","status.fatalSuffix":"\uFF08\u4E0D\u91CD\u8BD5\uFF0C\u9700\u4FEE\u914D\u7F6E\uFF09","msg.maxSessions":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\uFF08\u5171 {live} \u4E2A / \u4E0A\u9650 {max}\uFF1A\u672C\u7A97\u53E3 {own} \u4E2A{others}\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","msg.maxSessionsOthers":" + \u5176\u4ED6\u7A97\u53E3 {count} \u4E2A","error.probeHttp":"\u8FDE\u63A5\u6D4B\u8BD5\u5931\u8D25\uFF08HTTP {status}\uFF09","msg.probing":"\u8FDE\u63A5\u6D4B\u8BD5\u4E2D\u2026","meta.reachable":"\u901A","meta.unreachable":"\u4E0D\u901A","meta.probeBanner":"banner \u6B63\u5E38","meta.hostKeyMatched":"\u4E3B\u673A\u5BC6\u94A5\u5339\u914D","meta.hostKeyRecorded":"\u4E3B\u673A\u5BC6\u94A5\u5DF2\u8BB0\u5F55\uFF08TOFU\uFF09","meta.hostKeyMismatch":"\u4E3B\u673A\u5BC6\u94A5\u4E0D\u5339\u914D\uFF01","meta.authOkMs":"\u8BA4\u8BC1\u901A\u8FC7\uFF08{ms}ms\uFF09","meta.authOk":"\u8BA4\u8BC1\u901A\u8FC7","meta.probeOk":"\u2705 \u8FDE\u63A5\u6210\u529F\uFF1A{detail}","error.unknown":"\u672A\u77E5\u9519\u8BEF","btn.maxSessionsTitle":"\u4F1A\u8BDD\u6570\u5DF2\u8FBE\u4E0A\u9650\u2014\u2014\u70B9\u51FB\u67E5\u770B\u600E\u4E48\u529E","option.localTerminal":"\u672C\u5730\u7EC8\u7AEF","hint.tmuxHosted":"tmux \u6258\u7BA1 \xB7 \u5BBF\u4E3B\u91CD\u542F\u540E\u53EF\u6062\u590D","hint.openInSessionCwd":"\u5728\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u76EE\u5F55\u6253\u5F00","panel.sshBook":"SSH \u8FDE\u63A5\u7C3F","btn.sftpFileBrowse":"SFTP \u6587\u4EF6\u6D4F\u89C8","btn.editConnection":"\u7F16\u8F91\u8FDE\u63A5","list.emptySshBook":"\uFF08\u7A7A \u2014 \u5728\u8BBE\u7F6E\u5361\u7247\u6216\u300CSSH \u8FDE\u63A5\u2026\u300D\u91CC\u4FDD\u5B58\uFF09","option.sshConnect":"SSH \u8FDE\u63A5\u2026","hint.sshConnect":"\u624B\u52A8\u586B\u5199\u4E3B\u673A / \u7528\u6237 / \u8BA4\u8BC1\u65B9\u5F0F","panel.editConnection":"\u7F16\u8F91\u8FDE\u63A5 \xB7 {name}","panel.sshConnect":"SSH \u8FDE\u63A5","section.jump":"\u8DF3\u677F\u673A","field.jumpHost":"\u8DF3\u677F\u673A\uFF08[\u7528\u6237@]\u4E3B\u673A[:\u7AEF\u53E3]\uFF0C\u7559\u7A7A = \u76F4\u8FDE\uFF09","placeholder.jumpHost":"\u4F8B\u5982 bastion.corp:2222","check.jumpOwnCred":"\u8DF3\u677F\u673A\u4F7F\u7528\u72EC\u7ACB\u51ED\u636E","field.jumpUsername":"\u8DF3\u677F\u673A\u7528\u6237\u540D\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","field.jumpAuth":"\u8DF3\u677F\u673A\u8BA4\u8BC1\u65B9\u5F0F\uFF08\u7559\u7A7A\u6CBF\u7528\u76EE\u6807\uFF09","hint.jumpInherit":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u76EE\u6807\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\u3002","hint.jumpInheritFull":"\u7559\u7A7A\u51ED\u636E = \u6CBF\u7528\u4E0A\u9762\u90A3\u53F0\u4E3B\u673A\u7684\u8BA4\u8BC1\u65B9\u5F0F\u4E0E\u94A5\u5319\uFF1B\u8DF3\u677F\u673A\u8FDE\u4E0D\u4E0A\u65F6\u9519\u8BEF\u6587\u6848\u4F1A\u70B9\u540D\u5B83\uFF08\u4E0D\u4F1A\u4F2A\u88C5\u6210\u76EE\u6807\u8D85\u65F6\uFF09\u3002","meta.jumpStage":"\u8DF3\u677F\u673A {label}","meta.viaJump":"\u21E2 \u7ECF {label}","meta.viaProxy":"\u21E2 \u7ECF\u4EE3\u7406\u547D\u4EE4","section.proxyCommand":"\u4EE3\u7406\u547D\u4EE4","field.proxyCommand":"\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF0C\u7559\u7A7A = \u4E0D\u7528\uFF09","placeholder.proxyCommand":"\u4F8B\u5982 ssh -W %h:%p bastion","hint.proxyCommand":"\u672C\u673A\u547D\u4EE4\uFF0Cstdin/stdout \u5373\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF1B\u4E0E\u8DF3\u677F\u673A\u540C\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\u3002","hint.proxyCommandFull":"\u672C\u673A\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u5B83\u7684 stdin/stdout \u5C31\u662F\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u652F\u6301 %h \u76EE\u6807\u4E3B\u673A\u3001%p \u7AEF\u53E3\u3001%r \u7528\u6237\u540D\u3001%n \u4E3B\u673A\u3001%% \u5B57\u9762 %\uFF1B\u5176\u4F59\u5199\u6CD5\u539F\u6837\u4FDD\u7559\u3002\u4E0E\u8DF3\u677F\u673A\u540C\u65F6\u586B\u65F6\u8DF3\u677F\u673A\u4F18\u5148\uFF08OpenSSH \u8BED\u4E49\uFF09\u3002\u9700\u8981\u4E0B\u9762\u90A3\u4E2A\u5F00\u5173\uFF0C~/.ssh/config \u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\u5B83\u3002","hint.proxyCommandDisabled":"\u26A0 \u5F53\u524D\u300C\u5141\u8BB8 ProxyCommand\u300D\u672A\u6253\u5F00\uFF1A\u8FD9\u6761\u547D\u4EE4\u4E0D\u4F1A\u6267\u884C\uFF0C\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002\u5230 \u63D2\u4EF6\u914D\u7F6E \u2192 \u7EC8\u7AEF\u9762\u677F \u6253\u5F00\u5F00\u5173\u540E\u751F\u6548\u3002","hint.proxyCommandNotGranted":"\u26A0 \u8FD9\u6761\u80FD\u529B\u672A\u83B7\u5BBF\u4E3B\u6388\u6743\uFF1A\u70B9\u8FD9\u4E2A\u5F00\u5173\u4F1A\u5C31\u5730\u53D1\u8D77\u4E00\u6B21\u6388\u6743\uFF08\u9762\u677F\u7ED9\u4E00\u6761\u5728\u5BBF\u4E3B\u7EC8\u7AEF\u6267\u884C\u7684\u547D\u4EE4\uFF0C\u514D\u91CD\u542F\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u8D70\u6700\u4E25\u7684\u90A3\u6761\u2014\u2014\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export DSH_TTY_ALLOW_PROXY_COMMAND=1 \u540E\u91CD\u542F\u5BBF\u4E3B\uFF08\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u4E0D\u7B97\u6388\u6743\uFF09\u3002\u8FD9\u6837\u5B89\u6392\u662F\u56E0\u4E3A\u8DE8\u7AD9\u9875\u9762\u4E0E\u9875\u5185\u811A\u672C\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\u2014\u2014\u82E5\u914D\u7F6E\u754C\u9762\u80FD\u51ED\u7A7A\u63D0\u6743\uFF0C\u8FD9\u9053\u95F8\u95E8\u7B49\u4E8E\u6CA1\u6709\uFF1B\u5173\u6389\u5B83\u5219\u968F\u65F6\u53EF\u7528\u3002","badge.notEffective":"\u672A\u751F\u6548\uFF1A\u672A\u83B7\u5BBF\u4E3B\u6388\u6743","elev.title":"\u5C31\u5730\u6388\u6743\uFF08\u514D\u91CD\u542F\uFF09","elev.lockedWhy":"\u672C\u673A\u4EFB\u610F\u8FDB\u7A0B\u90FD\u80FD\u53D1\u56DE\u73AF\u8BF7\u6C42\uFF0C\u6240\u4EE5\u300C\u6253\u5F00\u5371\u9669\u80FD\u529B\u300D\u8FD9\u4EF6\u4E8B\u4E0D\u80FD\u7531\u8FD9\u4E2A\u9875\u9762\u81EA\u5DF1\u8BF4\u4E86\u7B97\u2014\u2014\u5FC5\u987B\u5728\u5BBF\u4E3B\u7684\u6587\u4EF6\u7CFB\u7EDF\u4E0A\u786E\u8BA4\u4E00\u6B21\u3002","elev.step":"\u5728\u5BBF\u4E3B\u7684\u7EC8\u7AEF\u91CC\u6267\u884C\u4E0B\u4E00\u6761\u547D\u4EE4\uFF0C\u5F00\u5173\u4F1A\u81EA\u52A8\u89E3\u9501\uFF1A","elev.copy":"\u590D\u5236\u547D\u4EE4","elev.copied":"\u5DF2\u590D\u5236","elev.copyManual":"\u5F53\u524D\u73AF\u5883\u62FF\u4E0D\u5230\u526A\u8D34\u677F\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u4E0A\u9762\u90A3\u6761\u547D\u4EE4\u590D\u5236\u3002","elev.expiresIn":"{sec} \u79D2\u540E\u5931\u6548","elev.expired":"\u672C\u6B21\u786E\u8BA4\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002","elev.waiting":"\u7B49\u5F85\u786E\u8BA4\u2026\u6267\u884C\u5B8C\u547D\u4EE4\u8FD9\u91CC\u4F1A\u81EA\u52A8\u53D8\u6210\u5DF2\u6388\u6743\u3002","elev.regenerate":"\u91CD\u65B0\u751F\u6210","elev.loading":"\u6B63\u5728\u751F\u6210\u786E\u8BA4\u547D\u4EE4\u2026","elev.granted":"\u5DF2\u6388\u6743\u5E76\u751F\u6548\u3002","elev.grantedNeedSave":"\u5DF2\u6388\u6743\u3002\u70B9\u300C\u4FDD\u5B58\u300D\u540E\u751F\u6548\u3002","elev.grantedAt":"\u5DF2\u6388\u6743 \xB7 {time}","elev.revoke":"\u64A4\u9500\u5BBF\u4E3B\u6388\u6743","elev.revoked":"\u5DF2\u64A4\u9500\u5BBF\u4E3B\u6388\u6743\uFF08\u914D\u7F6E\u5F00\u5173\u4FDD\u6301\u4E0D\u53D8\uFF0C\u91CD\u65B0\u6388\u6743\u540E\u4F1A\u7ACB\u523B\u751F\u6548\uFF09\u3002","elev.viaEnv":"\u7531\u542F\u52A8\u73AF\u5883\u53D8\u91CF\u6388\u6743\uFF1B\u8981\u64A4\u9500\u9700\u5728\u542F\u52A8\u73AF\u5883\u91CC\u53BB\u6389\u5B83\u5E76\u91CD\u542F\u5BBF\u4E3B\u3002","elev.close":"\u6536\u8D77","elev.disableFirst":"\u5148\u5173\u6389\u8FD9\u4E2A\u914D\u7F6E\u5F00\u5173","elev.otherWay":"\u53E6\u4E00\u79CD\u65B9\u5F0F\uFF08\u6700\u5F3A\uFF0C\u9700\u8981\u91CD\u542F\u5BBF\u4E3B\uFF09","elev.envHow":"\u5728\u300C\u542F\u52A8 dsh \u7684\u90A3\u4E2A\u73AF\u5883\u300D\u91CC export {env}=1\uFF0C\u7136\u540E\u91CD\u542F\u5BBF\u4E3B\u3002\u6CE8\u610F\uFF1A\u542F\u52A8\u4E4B\u540E\u518D\u8BBE\u3001\u6216\u5199\u8FDB\u522B\u7684\u914D\u7F6E\u6587\u4EF6\u90FD\u4E0D\u7B97\u6388\u6743\u2014\u2014\u8FD9\u9053\u95F8\u95E8\u9632\u7684\u5C31\u662F\u300C\u8FD0\u884C\u671F\u80FD\u6539\u7684\u4E1C\u897F\u5192\u5145\u6388\u6743\u300D\u3002","elev.error":"\u5C31\u5730\u6388\u6743\u6CA1\u6210\u529F\uFF1A","meta.probeProxy":"\u4EE3\u7406\u547D\u4EE4","meta.probeProxyOff":"\u4EE3\u7406\u547D\u4EE4\uFF08\u672A\u542F\u7528\uFF09","meta.probeTcpSkipped":"\u76F4\u8FDE\u9884\u68C0\u5DF2\u8DF3\u8FC7\uFF08\u8D70\u4EE3\u7406\u547D\u4EE4\uFF09","section.connection":"\u8FDE\u63A5","field.host":"\u4E3B\u673A","placeholder.host":"example.com \u6216 IP","field.port":"\u7AEF\u53E3","field.username":"\u7528\u6237\u540D","section.auth":"\u8BA4\u8BC1","field.authMethod":"\u8BA4\u8BC1\u65B9\u5F0F","option.authInherit":"\uFF08\u6CBF\u7528\u76EE\u6807\uFF09","option.authAgent":"agent \u2014 \u4F7F\u7528\u672C\u673A ssh-agent","option.authKey":"key \u2014 \u79C1\u94A5\u6587\u4EF6","option.authPassword":"password \u2014 \u5BC6\u7801","field.keyPath":"\u79C1\u94A5\u8DEF\u5F84","field.hostKeyAlias":"\u4E3B\u673A\u5BC6\u94A5\u522B\u540D","field.passphrase":"\u79C1\u94A5\u53E3\u4EE4\uFF08\u53EF\u7A7A\uFF09","field.password":"\u5BC6\u7801","placeholder.credRef":"\u6216\uFF1A\u9009\u62E9\u51ED\u636E\u5B58\u50A8\u91CC\u7684\u5F15\u7528\u540D","hint.credRefCandidates":"\u5019\u9009 = \u51ED\u636E\u5B58\u50A8\u91CC\u5DF2\u6709\u7684\u5F15\u7528\u540D + \u672C\u673A\u8FDE\u63A5\u7C3F\u91CC\u5728\u7528\u7684\u5F15\u7528\u540D","list.credOverwrite":"{name}\uFF08\u518D\u70B9\u8986\u76D6\u5DF2\u586B\uFF09","list.moreMatches":"\u8FD8\u6709 {count} \u4E2A \u2014 \u7EE7\u7EED\u8F93\u5165\u7B5B\u9009","list.noCredRef":"\u6CA1\u6709\u5339\u914D\u7684\u5F15\u7528","check.rememberCredential":"\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.rememberCredential":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u4FDD\u5B58\u4FEE\u6539\u300D\u6216\u300C\u8FDE\u63A5\uFF08\u5E76\u4FDD\u5B58\uFF09\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","btn.clearCredential":"\u6E05\u9664\u5DF2\u5B58\u51ED\u636E","error.credPlainUnavailable":"\u5BBF\u4E3B\u672A\u63D0\u4F9B\u51ED\u636E\u670D\u52A1\uFF08remote.credentials\uFF09\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","error.credPlainIncomplete":"\u51ED\u636E\u670D\u52A1\u4E0D\u5B8C\u6574\uFF0C\u53EA\u80FD\u660E\u6587\u4FDD\u5B58","status.credUnreported":"\u5F15\u7528 {ref}\uFF1A\u5BBF\u4E3B\u672A\u62A5\u544A\u72B6\u6001","error.credStatusFailed":"\u8BFB\u53D6\u51ED\u636E\u72B6\u6001\u5931\u8D25\uFF1A{error}","status.credStored":"\u5DF2\u5B58\u5165{source} \xB7 {ref}","meta.credSource":"\uFF08\u6765\u6E90 {source}\uFF09","status.credUnknown":"\u5F15\u7528 {ref}\uFF1A\u5B58\u50A8\u91CC\u8FD8\u6CA1\u6709\u8FD9\u4E2A\u503C","hint.noCredRefPassphrase":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u53EF\u5728\u79C1\u94A5\u53E3\u4EE4\u6846\u76F4\u63A5\u624B\u8F93 env:NAME","hint.noCredRefPassword":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u4FDD\u5B58\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","section.options":"\u9009\u9879","section.advanced":"\u9AD8\u7EA7","hint.advanced":"\u8DF3\u677F\u673A \xB7 \u4EE3\u7406\u547D\u4EE4 \xB7 \u4E3B\u673A\u5BC6\u94A5\u522B\u540D","meta.advancedConfigured":"\u5DF2\u914D\u7F6E\uFF1A{items}","check.agentForward":"agent forwarding\uFF08\u8FDC\u7A0B\u53EF\u7528\u672C\u5730 ssh-agent \u94A5\u5319\uFF0C\u5982\u8FDC\u7A0B git clone\uFF09","hint.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\uFF1B\u540C\u4E00\u4E3B\u673A\u7ECF\u591A\u5730\u5740\u89E6\u8FBE\u65F6\u586B\u522B\u540D\u53EF\u5171\u7528\u6307\u7EB9\u8BB0\u5F55\u3002","hint.hostKeyAliasFull":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740\u8BB0\u4F4F\u6307\u7EB9\u3002\u540C\u4E00\u53F0\u4E3B\u673A\u7ECF\u4E0D\u540C\u5730\u5740\uFF08\u8DF3\u677F\u673A\u540E / \u7AEF\u53E3\u8F6C\u53D1\uFF09\u89E6\u8FBE\u65F6\uFF0C\u586B\u540C\u4E00\u4E2A\u522B\u540D\u53EF\u8BA9\u5B83\u4EEC\u5171\u7528\u4E00\u6761\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF0C\u907F\u514D\u6BCF\u6B21\u5207\u6362\u5730\u5740\u90FD\u62A5\u300C\u6307\u7EB9\u53D8\u66F4\u300D\uFF1B\u53EA\u5F71\u54CD\u6307\u7EB9\u8BB0\u5728\u54EA\uFF0C\u4E0D\u6539\u8FDE\u63A5\u5730\u5740","placeholder.hostKeyAlias":"\u7559\u7A7A = \u6309\u4E3B\u673A\u5730\u5740","check.persist":"\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","check.saveToBook":"\u4FDD\u5B58\u5230\u8FDE\u63A5\u7C3F\uFF08\u540C\u540D\u8986\u76D6\uFF09","field.bookName":"\u8FDE\u63A5\u7C3F\u540D\u79F0","placeholder.bookName":"\u7559\u7A7A\u5219\u7528\u4E3B\u673A\u540D","error.hostUserRequired":"\u4E3B\u673A\u4E0E\u7528\u6237\u540D\u5FC5\u586B","error.keyPathRequired":"auth=key \u9700\u8981\u79C1\u94A5\u8DEF\u5F84","error.passwordRequired":"auth=password \u9700\u8981\u5BC6\u7801","btn.cancel":"\u53D6\u6D88","btn.connect":"\u8FDE\u63A5","btn.fileBrowse":"\u6587\u4EF6\u6D4F\u89C8","btn.browseTitle":"\u4E0D\u52A8\u7EC8\u7AEF\uFF0C\u76F4\u63A5\u4EE5\u5F53\u524D\u586B\u5199\u7684\u4FE1\u606F\u6253\u5F00 SFTP \u6587\u4EF6\u6D4F\u89C8","btn.probe":"\u8BD5\u8FDE","btn.probeTitle":"\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","error.saveCredFailed":"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}","btn.saveEdit":"\u4FDD\u5B58\u4FEE\u6539","error.saveBookFailed":"\u4FDD\u5B58\u8FDE\u63A5\u7C3F\u5931\u8D25\uFF1A{error}","error.bookNameTaken":"\u8FDE\u63A5\u7C3F\u91CC\u5DF2\u6709\u540C\u540D\u6761\u76EE: {name}","panel.sftpDual":"SFTP \u53CC\u680F \xB7 {label}","status.failed":"\u5931\u8D25","status.done":"\u5B8C\u6210","placeholder.localPath":"\u672C\u673A\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","placeholder.remotePath":"\u8FDC\u7A0B\u8DEF\u5F84\uFF08\u56DE\u8F66\u8DF3\u8F6C\uFF09","btn.refresh":"\u5237\u65B0","btn.mkdir":"\u65B0\u5EFA\u76EE\u5F55","btn.hiddenFiles":"\u9690\u85CF\u6587\u4EF6","btn.hiddenFilesTitle":"\u663E\u793A / \u9690\u85CF\u4EE5 . \u5F00\u5934\u7684\u6587\u4EF6\uFF08.env\u3001.gitignore \u7B49\uFF09","error.dirNotReady":"\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210","meta.dir":"\u76EE\u5F55","btn.transferTo":"\u4F20\u8F93\u5230{target}\uFF1A{path}","meta.local":"\u672C\u673A","meta.remote":"\u8FDC\u7A0B","error.transferDirsNotReady":"\u4E24\u4FA7\u76EE\u5F55\u5C1A\u672A\u5B9A\u4F4D\u5B8C\u6210\uFF0C\u7B49\u5217\u8868\u52A0\u8F7D\u540E\u518D\u4F20\u8F93","msg.transferring":"\u4F20\u8F93 {name}\u2026","error.transferFailed":"\u4F20\u8F93\u5931\u8D25","error.noTaskId":"\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u4EFB\u52A1 id","msg.transferCanceled":"\u5DF2\u53D6\u6D88\u4F20\u8F93 {name}","msg.transferred":"\u5DF2\u4F20\u8F93 {name}","btn.download":"\u4E0B\u8F7D {name}","btn.rename":"\u91CD\u547D\u540D {name}","placeholder.newName":"\u65B0\u540D\u79F0","btn.deleteEntry":"\u5220\u9664 {name}","btn.deleteEntryDir":"\u5220\u9664 {name}\uFF08\u542B\u5185\u5BB9\uFF09","msg.deleted":"\u5DF2\u5220\u9664 {name}","list.parentDir":"..\uFF08\u4E0A\u7EA7\u76EE\u5F55\uFF09","list.emptyDir":"\uFF08\u7A7A\u76EE\u5F55\uFF09","list.hiddenOnly":"\uFF08\u8FD9\u91CC\u53EA\u6709\u9690\u85CF\u6587\u4EF6 \u2014 \u70B9\u680F\u4E0A\u7684\u300C\u9690\u85CF\u6587\u4EF6\u300D\u663E\u793A\uFF09","error.dropOnLocalPane":"\u62D6\u5230\u672C\u673A\u680F\u6CA1\u6709\u53EF\u6267\u884C\u7684\u52A8\u4F5C\uFF1A\u672C\u673A\u6587\u4EF6\u8981\u4F20\u5230\u5BF9\u9762\uFF0C\u8BF7\u62D6\u5230\u53F3\u4FA7\u300C\u8FDC\u7A0B\u300D\u680F","list.truncated":"\u2026\u5176\u4F59 {rest} \u9879\u672A\u6E32\u67D3\uFF08\u5171 {total} \u9879\uFF09\u2014\u2014\u7528\u4E0A\u65B9\u8DEF\u5F84\u6846\u8DF3\u8F6C\u5230\u5B50\u76EE\u5F55\u5B9A\u4F4D","list.itemCount":"{count} \u9879","placeholder.newDirName":"\u65B0\u76EE\u5F55\u540D\uFF08\u76F8\u5BF9\u5F53\u524D\u76EE\u5F55\uFF09","msg.creatingDir":"\u521B\u5EFA\u76EE\u5F55 {name}\u2026","btn.ok":"\u786E\u5B9A","btn.confirm":"\u786E\u8BA4?","btn.cancelTransfer":"\u53D6\u6D88\u4F20\u8F93","msg.downloadCanceled":"\u5DF2\u53D6\u6D88\u4E0B\u8F7D {name}","msg.downloadResuming":"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u4ECE {offset} \u5904\u7EED\u4F20 {name}\u2026","error.downloadFailed":"\u4E0B\u8F7D\u5931\u8D25","msg.downloaded":"\u5DF2\u4E0B\u8F7D {name}\uFF08{size}\uFF09","error.downloadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0B\u8F7D\u4E0A\u9650\uFF08{size}\uFF09\uFF1A\u8BF7\u7528\u53CC\u680F \u21E6 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","msg.canceled":"\u5DF2\u53D6\u6D88","btn.upload":"\u4E0A\u4F20","btn.uploadTitle":"\u9009\u62E9\u6587\u4EF6\u4E0A\u4F20\uFF1B\u4E5F\u53EF\u4EE5\u628A\u6587\u4EF6 / \u6587\u4EF6\u5939\u76F4\u63A5\u62D6\u8FDB\u5217\u8868","msg.uploading":"\u4E0A\u4F20\u4E2D\u2026","msg.uploadDone":"\u4E0A\u4F20\u5B8C\u6210","error.uploadFailed":"\u4E0A\u4F20\u5931\u8D25","error.networkError":"\u7F51\u7EDC\u9519\u8BEF","error.uploadCountExceeded":"\u6587\u4EF6\u6570\u8D85\u8FC7\u4E0A\u9650\uFF08{max}\uFF09\uFF1A\u672C\u6B21 {count} \u4E2A\uFF0C\u8BF7\u5206\u6279\u4E0A\u4F20","status.overLimit":"\u8D85\u9650","error.uploadTooBig":"\u6587\u4EF6\u8D85\u8FC7\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\uFF1A{name}\uFF0C\u8BF7\u7528\u53CC\u680F \u21E8 \u76F4\u4F20\u6216\u7EC8\u7AEF scp/rsync","error.uploadTotalTooBig":"\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","msg.uploadCanceled":"\u5DF2\u53D6\u6D88\u4E0A\u4F20\uFF08\u5DF2\u4F20 {done}/{total} \u4E2A\uFF09","status.allDone":"\u5168\u90E8\u5B8C\u6210","msg.uploadDoneCount":"\u4E0A\u4F20\u5B8C\u6210 {count} \u4E2A\u6587\u4EF6","error.connectFailed":"\u8FDE\u63A5\u5931\u8D25\uFF1A{error}","status.connectingEllipsis":"\u8FDE\u63A5\u4E2D\u2026","status.connectedPid":"\u5DF2\u8FDE\u63A5 pid={pid}","status.connectedSsh":"SSH {target}\u5DF2\u8FDE\u63A5","status.exitedWith":"\u5DF2\u9000\u51FA {detail}","status.error":"\u9519\u8BEF\uFF1A{message}","status.retryHint":"{message} \xB7 \u70B9\u51FB\u91CD\u8BD5","btn.clickRetry":"\u70B9\u51FB\u91CD\u8BD5","status.disconnectedReconnecting":"\u8FDE\u63A5\u65AD\u5F00 \u2014 \u81EA\u52A8\u91CD\u8FDE\u4E2D","status.disconnected":"\u8FDE\u63A5\u65AD\u5F00","status.reconnecting":"\u81EA\u52A8\u91CD\u8FDE\u4E2D\u2026","error.copyFailed":"\u590D\u5236\u5931\u8D25\uFF1A\u5F53\u524D\u73AF\u5883\u4E0D\u5141\u8BB8\u8BBF\u95EE\u526A\u8D34\u677F\uFF08http \u8BBF\u95EE\u65F6\u8BF7\u6539\u7528 localhost \u6216\u7EC8\u7AEF\u5185\u5FEB\u6377\u952E\uFF09","status.initializing":"\u521D\u59CB\u5316\u2026","placeholder.search":"\u641C\u7D22 (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"\u641C\u7D22 (Ctrl+F)\uFF1AEnter \u4E0B\u4E00\u4E2A / Shift+Enter \u4E0A\u4E00\u4E2A","btn.clearTitle":"\u6E05\u5C4F","btn.minimizeTitle":"\u6700\u5C0F\u5316\uFF08\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF0C\u72B6\u6001\u5E76\u5165\u4FA7\u8FB9\u680F\u5165\u53E3\uFF09","btn.minimize":"\u6700\u5C0F\u5316","btn.closePanelTitle":"\u5173\u95ED\u9762\u677F\u5E76\u7ED3\u675F\u5168\u90E8\u4F1A\u8BDD\uFF08\u6709\u4F1A\u8BDD\u8FD8\u5F00\u7740\u65F6\u4F1A\u5148\u786E\u8BA4\uFF1B\u53EA\u662F\u60F3\u6536\u8D77\u5C31\u70B9\u300C\u2014\u300D\uFF0C\u4F1A\u8BDD\u4FDD\u6301\u8FD0\u884C\uFF09","confirm.closeTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED\u9762\u677F\uFF1F","confirm.closeText":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF08\u9762\u677F\u91CC\u7684\u6807\u7B7E\u4F1A\u8DDF\u7740\u5173\u6389\uFF09\u3002","confirm.closeTextAgent":"\u5173\u95ED\u9762\u677F\u4F1A\u4E00\u5E76\u7ED3\u675F\u8FD9 {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.closeHint":"\u53EA\u662F\u60F3\u7ED9\u522B\u7684\u7A97\u53E3\u817E\u5730\u65B9\uFF1F\u70B9\u300C\u6700\u5C0F\u5316\u300D\u2014\u2014 \u4F1A\u8BDD\u4E0E\u8F93\u51FA\u90FD\u4FDD\u6301\u8FD0\u884C\u3002","confirm.closeOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u95ED","confirm.tabsTitle":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\u5E76\u5173\u6389\u8FD9\u4E9B\u6807\u7B7E\uFF1F","confirm.tabsText":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u8FD8\u5F00\u7740\u7684\u4F1A\u8BDD\uFF0C\u5B83\u4EEC\u7684\u6807\u7B7E\u4E5F\u8DDF\u7740\u5173\u6389\u3002","confirm.tabsTextAgent":"\u8FD9\u4E00\u4E0B\u4F1A\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD\uFF0C\u5176\u4E2D {agent} \u4E2A\u662F AI \u5F00\u7684\uFF08\u53EF\u80FD\u6B63\u5728\u8DD1\u547D\u4EE4\uFF09\u3002","confirm.tabsHint":"\u5DF2\u9000\u51FA\u7684\u6807\u7B7E\u53EA\u662F\u53EA\u8BFB\u4FDD\u7559\uFF0C\u6E05\u6389\u5B83\u4EEC\u4E0D\u4E22\u4EFB\u4F55\u4E1C\u897F\u3002","confirm.tabsOk":"\u7ED3\u675F {n} \u4E2A\u4F1A\u8BDD","btn.restoreDock":"\u70B9\u51FB\u6062\u590D\u7EC8\u7AEF\u7A97\u53E3","panel.title":"\u7EC8\u7AEF","status.minimized":"\u7EC8\u7AEF\u5DF2\u6700\u5C0F\u5316 \u2014 \u70B9\u51FB\u6062\u590D","error.configLoadFailed":"\u8BFB\u53D6\u914D\u7F6E\u5931\u8D25","error.saveTunnelFailed":"\u4FDD\u5B58\u96A7\u9053\u5931\u8D25","error.tunnelNameTaken":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u540C\u4E00\u300C\u8FDE\u63A5\u7C3F\u6761\u76EE + \u65B9\u5411 + \u7AEF\u53E3\u300D\u53EA\u80FD\u6709\u4E00\u6761\u3002\u6539\u7AEF\u53E3\u4F1A\u5F97\u5230\u65B0\u540D\u5B57\uFF0C\u6216\u5148\u5220\u6389\u65E7\u7684\u90A3\u6761\u3002","msg.tunnelApplied":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u751F\u6548","msg.tunnelUpdated":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u66F4\u65B0","error.nameHostUserRequired":"\u540D\u79F0\u3001\u4E3B\u673A\u3001\u7528\u6237\u540D\u5FC5\u586B","msg.hostEdited":"\u5DF2\u4FEE\u6539\u6761\u76EE\u300C{name}\u300D\u2014 \u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.probeFailed":"\u274C \u8FDE\u63A5\u5931\u8D25\uFF1A{error}","error.hostKeyDeleteFailed":"\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\u5931\u8D25","msg.hostKeyDeleted":"\u5DF2\u5220\u9664\u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08\u4E0B\u6B21\u8FDE\u63A5\u91CD\u65B0\u8BB0\u5F55\u6307\u7EB9\uFF09","error.sshConfigReadFailed":"\u8BFB\u53D6 ~/.ssh/config \u5931\u8D25","msg.proxySkipped":"{count} \u6761\u7528\u4E86\u8DF3\u677F\u673A\u4F46\u89E3\u6790\u4E0D\u51FA\u8DF3\u677F\u673A\uFF08\u522B\u540D\u7F3A\u5931 / \u522B\u540D\u81EA\u5DF1\u8FD8\u4F9D\u8D56\u8DF3\u677F\u673A\uFF09\u672A\u5BFC\u5165\uFF1A{names}","msg.proxyCommandSkipped":"{count} \u6761\u53EA\u914D\u4E86\u4EE3\u7406\u547D\u4EE4\uFF08ProxyCommand\uFF09\u672A\u5BFC\u5165\uFF1A{names} \u2014\u2014 \u4EE3\u7406\u547D\u4EE4\u662F\u300C\u672C\u673A\u6267\u884C\u4E00\u6761\u547D\u4EE4\u300D\u90A3\u4E00\u6863\uFF0C\u5BFC\u5165\u4E0D\u4F1A\u81EA\u52A8\u5E26\u5165\uFF1B\u9700\u8981\u65F6\u5728\u8FDE\u63A5\u7C3F\u91CC\u624B\u586B\u5E76\u6253\u5F00\u300C\u5141\u8BB8 ProxyCommand\u300D","msg.skippedNotConcrete":"{count} \u6761\u4E0D\u662F\u5177\u4F53\u4E3B\u673A\uFF08\u901A\u914D / \u65E0 User\uFF09","list.separator":"\u3001","meta.etc":" \u7B49","msg.importOverflow":"\u8D85\u8FC7\u5BFC\u5165\u4E0A\u9650\u7684 {count} \u6761\u672A\u5BFC\u5165","list.separatorFull":"\uFF1B","msg.noNewEntries":"\u6CA1\u6709\u65B0\u6761\u76EE\uFF08{count} \u6761\u540C\u540D\u8DF3\u8FC7\uFF09","msg.noImportableHosts":"~/.ssh/config \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","msg.importedHosts":"\u5DF2\u5BFC\u5165 {added} \u6761\uFF08\u540C\u540D\u8DF3\u8FC7 {skipped} \u6761\uFF09\uFF0C\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","error.knownHostsReadFailed":"\u8BFB\u53D6 ~/.ssh/known_hosts \u5931\u8D25","msg.noNewFingerprints":"\u6CA1\u6709\u65B0\u6307\u7EB9\uFF08{count} \u6761\u5DF2\u5B58\u5728\uFF09","msg.noImportableKnownHosts":"known_hosts \u91CC\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5177\u4F53\u4E3B\u673A","error.saveHostKeysFailed":"\u4FDD\u5B58 hostKeys \u5931\u8D25","msg.importedFingerprints":"\u5DF2\u5BFC\u5165 {added} \u6761\u4E3B\u673A\u7684\u6307\u7EB9\uFF08\u8DF3\u8FC7 {skipped} \u6761\u5DF2\u5B58\u5728\uFF09","hint.knownHostsTruncated":"\uFF1B\u6CE8\u610F\uFF1Aknown_hosts \u8D85\u8FC7 500 \u6761\u4E3B\u673A\uFF0C\u672C\u6B21\u4EC5\u5BFC\u5165\u524D 500 \u6761","error.saveFailed":"\u4FDD\u5B58\u5931\u8D25","msg.saved":"\u5DF2\u4FDD\u5B58\u5E76\u70ED\u751F\u6548","check.rememberCredentialApply":"\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8","hint.appliedOnSave":"\u968F\u5361\u7247\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","card.name":"\u7EC8\u7AEF\u9762\u677F","card.desc":"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\u3002","card.descFull":"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","list.loadingConfig":"\u52A0\u8F7D\u914D\u7F6E\u4E2D\u2026","section.basic":"\u57FA\u7840","check.enabled":"\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","check.announce":"\u5411 agent \u516C\u544A\u7EC8\u7AEF\u9762\u677F\u80FD\u529B","check.shellIntegration":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF09","check.shellIntegrationWindows":"shell \u96C6\u6210\uFF08OSC 133/7 \u6CE8\u5165\uFF1Acwd \u8DDF\u968F\u3001\u9000\u51FA\u7801\u3001tty_expect \u4E0E\u300C\u6709\u6CA1\u6709\u547D\u4EE4\u5728\u8DD1\u300D\uFF09","hint.shellIntegrationWindows":"cmd \u6CA1\u6709\u547D\u4EE4\u5F00\u59CB/\u7ED3\u675F\u94A9\u5B50\uFF0C\u65E0\u6CD5\u6CE8\u5165\uFF1A\u628A\u300CShell \u8DEF\u5F84\u300D\u6362\u6210 powershell.exe \u6216 pwsh.exe\uFF08\u4E0B\u62C9\u5019\u9009\u91CC\u6709\uFF09\uFF0C\u518D\u786E\u8BA4\u8FD9\u4E2A\u5F00\u5173\u662F\u52FE\u4E0A\u7684\uFF08\u6B64\u524D\u7684 Windows \u88C5\u673A\u4E0A\u5B83\u53EF\u80FD\u5DF2\u88AB\u5B58\u6210\u5173\uFF09\u3002\u8FDC\u7A0B Linux / macOS \u4E3B\u673A\u7167\u65E7\u652F\u6301\u3002","hint.shellIntegrationPowerShell":"PowerShell \u5BB6\u65CF\u7531 `-File` \u6869\u6CE8\u5165\uFF1Acwd \u8DDF\u968F\u3001\u9000\u51FA\u7801\u3001tty_expect \u4E0E\u300C\u6709\u6CA1\u6709\u547D\u4EE4\u5728\u8DD1\u300D\u90FD\u53EF\u7528\u3002\u5DF2\u77E5\u9650\u5236\uFF1APowerShell 7 \u4E0A\u547D\u4EE4\u8F93\u51FA\u5728 ConPTY \u91CC\u665A\u4E8E D \u6807\u8BB0\u62B5\u8FBE\uFF0C`tty_capture{last}` \u53EF\u80FD\u53D6\u5230\u7A7A\u2014\u2014\u90A3\u91CC\u8BF7\u7528 `tty_capture` \u8BFB\u5C3E\u90E8\uFF08Windows PowerShell 5.1 \u4E0D\u53D7\u5F71\u54CD\uFF09\u3002","section.sftp":"SFTP \u6587\u4EF6\u4F20\u8F93","field.sftpStyle":"SFTP \u6587\u4EF6\u6D4F\u89C8\u98CE\u683C","option.sftpDialog":"\u5355\u7A97\u4F53 \u2014 \u8FDC\u7A0B\u76EE\u5F55 + \u4E0A\u4F20/\u4E0B\u8F7D/\u62D6\u62FD","option.sftpDual":"\u53CC\u680F \u2014 \u5DE6\u672C\u673A / \u53F3\u8FDC\u7A0B\uFF0C\u9009\u4E2D\u76F4\u4F20","hint.sftpDual":"\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","field.sftpLimits":"SFTP \u4F20\u8F93\u9650\u5236\uFF080 = \u4E0D\u9650\uFF09","field.downloadLimit":"\u4E0B\u8F7D\u4E0A\u9650 (MB)","field.uploadLimit":"\u4E0A\u4F20\u4E0A\u9650 (MB)","field.uploadCountLimit":"\u6279\u91CF\u6587\u4EF6\u6570\u4E0A\u9650","hint.sftpLimits":"\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","section.session":"\u4F1A\u8BDD","field.persistence":"\u4F1A\u8BDD\u6301\u4E45\u5316\uFF08tmux\uFF09","option.persistOff":"\u5173\u95ED \u2014 \u4F1A\u8BDD\u968F\u9762\u677F/\u5BBF\u4E3B\u7ED3\u675F\uFF08\u9ED8\u8BA4\uFF09","option.persistTmux":"tmux \u2014 \u65B0\u5F00\u7684\u7EC8\u7AEF/SSH \u6807\u7B7E\u9ED8\u8BA4\u6301\u4E45\u5316","hint.persistence":"\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","hint.persistenceWindows":"\uFF1BWindows \u5BBF\u4E3B\u4E0A tmux \u4E0D\u53EF\u7528\uFF0C\u672C\u5730\u6807\u7B7E\u4F1A\u7167\u5E38\u6253\u5F00\u4F46\u4E0D\u53D7\u6258\u7BA1","check.endOnPageClose":"\u5173\u95ED\u9875\u9762\u540E\u7ED3\u675F\u6301\u4E45\u4F1A\u8BDD\uFF08\u4E0D\u4FDD\u6D3B\uFF09","check.statsEnabled":"\u670D\u52A1\u5668\u72B6\u6001\u6761\uFF08CPU / \u5185\u5B58 / \u78C1\u76D8 / \u5728\u7EBF / TCP / \u7F51\u901F\uFF1B\u91C7\u4E0D\u5230\u7684\u9879\u663E\u793A\u300C\u65E0\u300D\uFF09","hint.statsEnabled":"\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","check.allowProxyCommand":"\u5141\u8BB8 ProxyCommand\uFF08\u672C\u673A\u6267\u884C\u547D\u4EE4\uFF1B\u9ED8\u8BA4\u5173\uFF09","hint.allowProxyCommand":"\u6253\u5F00\u540E\uFF0C\u8FDE\u63A5\u7C3F\u6761\u76EE\u91CC\u586B\u7684\u4EE3\u7406\u547D\u4EE4\u4F1A\u5728\u8FD9\u53F0\u673A\u5668\u4E0A\u6267\u884C\uFF0C\u5B83\u7684 stdin/stdout \u5F53\u4F5C\u5230\u76EE\u6807\u7684 SSH \u4F20\u8F93\uFF08\u7B49\u4EF7\u4E8E OpenSSH \u7684 ProxyCommand\uFF09\u3002\u8FD9\u662F\u672C\u63D2\u4EF6\u552F\u4E00\u300C\u914D\u7F6E\u91CC\u5199\u4E00\u884C\u5C31\u5728\u672C\u673A\u8DD1\u547D\u4EE4\u300D\u7684\u5F00\u5173\uFF0C\u6240\u4EE5\u9ED8\u8BA4\u5173\uFF1A\u5173\u7740\u65F6\u643A\u5E26\u4EE3\u7406\u547D\u4EE4\u7684\u8FDE\u63A5\u4F1A\u660E\u786E\u5931\u8D25\uFF08\u4E0D\u4F1A\u9000\u56DE\u76F4\u8FDE\uFF09\u3002~/.ssh/config \u5BFC\u5165\u6C38\u4E0D\u81EA\u52A8\u5E26\u5165\u4EE3\u7406\u547D\u4EE4\u3002","field.maxSessions":"\u5E76\u53D1\u4F1A\u8BDD\u4E0A\u9650\uFF081~16\uFF09","hint.maxSessions":"\u8D85\u8FC7\u4E0A\u9650\u7684\u65B0\u6807\u7B7E\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u4FDD\u5B58\u5373\u70ED\u751F\u6548","field.shell":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 $SHELL\uFF09","field.shellWindows":"Shell \u8DEF\u5F84\uFF08\u9ED8\u8BA4 %COMSPEC%\uFF09","placeholder.shell":"\u7559\u7A7A\u4F7F\u7528 $SHELL","placeholder.shellWindows":"\u7559\u7A7A\u4F7F\u7528 %COMSPEC%\uFF08\u4E5F\u53EF\u586B powershell.exe / pwsh.exe \u5B8C\u6574\u8DEF\u5F84\uFF09","list.noShellCandidate":"\u6CA1\u6709\u5339\u914D\u7684\u5019\u9009 \u2014 \u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\u5373\u53EF","hint.shellCandidatesWindows":"Windows \u5BBF\u4E3B\uFF1A\u5019\u9009\u6765\u81EA %COMSPEC% \u4E0E\u5DF2\u5B89\u88C5\u7684 PowerShell\uFF08Windows PowerShell 5.1 / PowerShell 7\uFF09\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u4EFB\u610F\u8DEF\u5F84\uFF1BPowerShell \u5BB6\u65CF\u652F\u6301 shell \u96C6\u6210\uFF08`-File` \u6869\u6CE8\u5165 OSC 133/7\uFF09\uFF0Ccmd \u6CA1\u6709\u547D\u4EE4\u8FB9\u754C\u94A9\u5B50\u3001\u4E0D\u652F\u6301","hint.shellCandidates":"\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","hint.term":"TUI \u7A0B\u5E8F\u4F9D\u8D56\u6B64\u503C","field.cwd":"\u515C\u5E95\u5DE5\u4F5C\u76EE\u5F55\uFF08\u5BA2\u6237\u7AEF\u5F53\u524D\u4F1A\u8BDD cwd \u4F18\u5148\uFF09","placeholder.cwd":"\u7559\u7A7A\u4F7F\u7528\u5BBF\u4E3B\u8FDB\u7A0B\u542F\u52A8\u76EE\u5F55","field.grace":"\u65AD\u7EBF\u4FDD\u6D3B\uFF08\u79D2\uFF0C0 = \u7ACB\u5373\u7ED3\u675F\uFF09","hint.grace":"\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","section.assist":"AI \u8F85\u52A9","check.assistEnabled":"\u5931\u8D25\u5373\u89E3\u91CA\uFF08\u547D\u4EE4\u975E\u96F6\u9000\u51FA\u65F6\u95EE\u6A21\u578B\u300C\u4E3A\u4EC0\u4E48 / \u4E0B\u4E00\u6B65\u300D\uFF09","hint.assistEnabled":"\u9ED8\u8BA4\u5173\u3002\u5F00\u542F\u540E\uFF0C\u547D\u4EE4\u4EE5\u975E\u96F6\u72B6\u6001\u7ED3\u675F\u65F6\u7EC8\u7AEF\u53F3\u4E0B\u89D2\u4F1A\u51FA\u73B0\u4E00\u679A\u5FBD\u6807\uFF1B\u70B9\u5B83\u624D\u628A\u90A3\u6761\u547D\u4EE4\u7684\u300C\u8F93\u51FA\u5C3E\u90E8\u300D\uFF08\u5265\u79BB\u989C\u8272\u4E0E\u8FDB\u5EA6\u6761\u3001\u6298\u6389\u91CD\u590D\u884C\u3001\u5BC6\u94A5/token \u5DF2\u906E\u76D6\uFF09\u8FDE\u540C\u5F53\u524D\u5C4F\u5E55\u53D1\u7ED9\u6A21\u578B\uFF0C\u4E0D\u53D1 scrollback\u3002\u6A21\u578B\u7ED9\u7684\u547D\u4EE4\u53EA\u4F1A\u300C\u586B\u5165\u300D\u547D\u4EE4\u884C\uFF0C\u6C38\u4E0D\u66FF\u4F60\u56DE\u8F66\u3002","field.assistRoute":"\u6A21\u578B\u8DEF\u7531\uFF08\u53EF\u9009\uFF09","hint.assistRoute":"\u7559\u7A7A\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","option.followHostModel":"\u8DDF\u968F\u5BBF\u4E3B\u9ED8\u8BA4\u6A21\u578B","list.modelLoading":"\u6B63\u5728\u53D6\u5019\u9009\u2026","list.noModelCandidate":"\u5BBF\u4E3B\u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B","list.modelCatalogFailed":"\u62FF\u4E0D\u5230\u5019\u9009\uFF1A\u5BBF\u4E3B\u53EF\u80FD\u8FD8\u6CA1\u91CD\u542F\uFF0C\u6216\u6CA1\u6709\u63D0\u4F9B\u6A21\u578B\u76EE\u5F55\uFF08\u624B\u8F93\u8BF7\u6309 provider/model\uFF09","badge.assistFailed":"\u547D\u4EE4\u5931\u8D25\uFF08{code}\uFF09\xB7 \u89E3\u91CA\u4E00\u4E0B","panel.assistTitle":"\u8FD9\u6761\u547D\u4EE4\u4E3A\u4EC0\u4E48\u5931\u8D25","panel.assistCommand":"\u5EFA\u8BAE\u547D\u4EE4","status.assistThinking":"\u6B63\u5728\u95EE\u6A21\u578B\u2026","error.assistRequest":"\u89E3\u91CA\u5931\u8D25\uFF1A{message}","btn.assistFill":"\u586B\u5165\u547D\u4EE4\u884C","btn.assistCopy":"\u590D\u5236\u7B54\u6848","btn.assistCopyError":"\u590D\u5236\u62A5\u9519","btn.assistClose":"\u5173\u95ED","hint.assistFillNoEnter":"\u53EA\u5199\u8FDB\u547D\u4EE4\u884C\uFF0C\u4E0D\u4F1A\u66FF\u4F60\u56DE\u8F66","hint.assistNoCommand":"\u6A21\u578B\u6CA1\u7ED9\u51FA\u53EF\u76F4\u63A5\u586B\u7684\u547D\u4EE4 \u2014 \u7528\u300C\u590D\u5236\u300D\u81EA\u5DF1\u6311","section.ssh":"SSH \u8FDE\u63A5","btn.probeRowTitle":"\u8BD5\u8FDE\u8BE5\u6761\u76EE\uFF1ATCP \u2192 \u4E3B\u673A\u5BC6\u94A5 \u2192 \u8BA4\u8BC1\u9010\u6BB5\u8BCA\u65AD","msg.testing":"\u6D4B\u8BD5\u4E2D\u2026","btn.test":"\u6D4B\u8BD5","btn.edit":"\u7F16\u8F91","btn.delete":"\u5220\u9664","list.emptySshHosts":"\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","btn.importSshConfig":"\u4ECE ~/.ssh/config \u5BFC\u5165","hint.importSshConfig":"\u540C\u540D\u8DF3\u8FC7\uFF1B\u968F\u300C\u4FDD\u5B58\u300D\u5199\u5165\u914D\u7F6E","hint.sshBook":"\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","check.tunnelEnabled":"\u542F\u7528","list.emptyTunnels":"\u6682\u65E0\u96A7\u9053 \u2014 \u628A\u8FDC\u7A0B\u6570\u636E\u5E93/\u5185\u90E8\u670D\u52A1\u6620\u5C04\u5230\u672C\u5730\u7AEF\u53E3","field.direction":"\u8F6C\u53D1\u65B9\u5411","option.localForwardTitle":"\u672C\u5730\u8F6C\u53D1 -L\uFF1A\u672C\u673A\u76D1\u542C\uFF0C\u8FDE\u5230 SSH \u670D\u52A1\u5668\u4FA7\u7684\u76EE\u6807","option.localForward":"\u672C\u5730 -L","option.remoteForwardTitle":"\u8FDC\u7A0B\u8F6C\u53D1 -R\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C\uFF0C\u62E8\u56DE\u672C\u673A\u670D\u52A1","option.remoteForward":"\u8FDC\u7A0B -R","option.selectBook":"\u9009\u62E9\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelViaBook":"\u7ECF {book} \u8FDE\u63A5 \u2014 \u96A7\u9053\u7684\u4E3B\u673A\u4E0E\u8BA4\u8BC1\u53D6\u81EA\u8BE5\u8FDE\u63A5\u7C3F\u6761\u76EE","hint.tunnelBookEmpty":"\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","hint.localListenFixed":"\u672C\u673A\u76D1\u542C\u5730\u5740\u56FA\u5B9A 127.0.0.1\uFF08\u4E0D\u66B4\u9732\u5230\u5C40\u57DF\u7F51\uFF09","placeholder.localPort":"\u672C\u673A\u7AEF\u53E3","field.localListenPort":"\u672C\u673A\u76D1\u542C\u7AEF\u53E3","hint.flowLocalToRemote":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2192 SSH \u670D\u52A1\u5668\u4FA7","placeholder.remoteHost":"\u670D\u52A1\u5668\u4FA7\u4E3B\u673A","hint.remoteHostTitle":"\u76EE\u6807\u4E3B\u673A\u540D\u6216 IP\uFF08\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\uFF1B127.0.0.1 = \u670D\u52A1\u5668\u81EA\u8EAB\uFF09","field.remoteHost":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u4E3B\u673A","placeholder.port":"\u7AEF\u53E3","field.remotePort":"\u670D\u52A1\u5668\u4FA7\u76EE\u6807\u7AEF\u53E3","placeholder.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","hint.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740\uFF08\u7F3A\u7701 127.0.0.1\uFF1B\u7559\u7A7A\u5373\u53EA\u8BA9\u670D\u52A1\u5668\u81EA\u5DF1\u8BBF\u95EE\uFF09","field.remoteListenHost":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u5730\u5740","placeholder.listenPort":"\u76D1\u542C\u7AEF\u53E3","field.remoteListenPort":"\u670D\u52A1\u5668\u4FA7\u76D1\u542C\u7AEF\u53E3","hint.flowRemoteToLocal":"\u6570\u636E\u6D41\u5411\uFF1A\u672C\u673A \u2190 SSH \u670D\u52A1\u5668\u4FA7","hint.localDialFixed":"\u672C\u673A\u62E8\u53F7\u5730\u5740\u56FA\u5B9A 127.0.0.1","placeholder.localTargetPort":"\u672C\u673A\u670D\u52A1\u7AEF\u53E3","field.localTargetPort":"\u672C\u673A\u76EE\u6807\u7AEF\u53E3","hint.tunnelLocalSummary":"\u5DE6\uFF1A\u672C\u673A\u76D1\u542C\uFF08\u56FA\u5B9A 127.0.0.1\uFF09\u2192 \u53F3\uFF1A\u7531 SSH \u670D\u52A1\u5668\u4FA7\u8BBF\u95EE\u7684\u76EE\u6807","hint.tunnelRemoteSummary":"\u5DE6\uFF1ASSH \u670D\u52A1\u5668\u4FA7\u76D1\u542C \u2192 \u53F3\uFF1A\u672C\u673A\u88AB\u8BBF\u95EE\u7684\u670D\u52A1\uFF08\u56FA\u5B9A 127.0.0.1\uFF09","btn.addTunnel":"\u6DFB\u52A0\u96A7\u9053","hint.tunnelAdd":"\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","hint.tunnelEditing":"\u6B63\u5728\u7F16\u8F91\u300C{name}\u300D\u2014\u2014\u6539\u7AEF\u53E3/\u6761\u76EE\u4F1A\u6309\u89C4\u5219\u751F\u6210\u65B0\u540D\u5B57\uFF1B\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548","panel.hostKeys":"SSH \u4E3B\u673A\u5BC6\u94A5\u8BB0\u5F55\uFF08TOFU\uFF09","btn.importKnownHosts":"\u4ECE known_hosts \u5BFC\u5165","list.emptyHostKeys":"\u6682\u65E0\u8BB0\u5F55 \u2014 \u9996\u6B21 SSH \u8FDE\u63A5\u6210\u529F\u540E\u81EA\u52A8\u8BB0\u5F55\u4E3B\u673A\u6307\u7EB9","hint.hostKeys":"\u4E00\u673A\u591A\u628A\u94A5\u5319\uFF08\u5982 rsa + ed25519\uFF09\u5404\u8BB0\u4E00\u6761\u6307\u7EB9\uFF0C\u4EFB\u4E00\u5339\u914D\u5373\u653E\u884C\uFF1B\u6307\u7EB9\u53D8\u66F4\u65F6\u8FDE\u63A5\u4F1A\u88AB\u62D2\u7EDD\uFF08\u9632\u4E2D\u95F4\u4EBA\uFF09\uFF0C\u786E\u8BA4\u5B89\u5168\u540E\u5220\u9664\u5BF9\u5E94\u8BB0\u5F55\u5373\u53EF\u91CD\u8FDE","msg.saving":"\u4FDD\u5B58\u4E2D\u2026","btn.save":"\u4FDD\u5B58","list.none":"\u65E0","meta.mem":"\u5185\u5B58","meta.disk":"\u78C1\u76D8","meta.cores":"\u6838\u5FC3","meta.uptime":"\u5728\u7EBF","meta.temp":"CPU\u6E29\u5EA6","meta.net":"\u7F51\u7EDC","error.tunnelNoBook":"\u8BF7\u5148\u5728\u8FDE\u63A5\u7C3F\u91CC\u6DFB\u52A0 SSH \u6761\u76EE","error.tunnelRemotePortRequired":"\u8FDC\u7A0B\u76D1\u542C\u7AEF\u53E3\u4E0E\u672C\u5730\u76EE\u6807\u7AEF\u53E3\u5FC5\u586B\uFF081~65535\uFF09","error.tunnelLocalRequired":"\u672C\u5730\u7AEF\u53E3\u3001\u8FDC\u7A0B\u4E3B\u673A\u3001\u8FDC\u7A0B\u7AEF\u53E3\u5FC5\u586B","error.tunnelMissing":"\u96A7\u9053\u300C{name}\u300D\u5DF2\u4E0D\u5B58\u5728\uFF08\u53EF\u80FD\u88AB\u53E6\u4E00\u4E2A\u7A97\u53E3\u5220\u9664\uFF09","error.tunnelClash":"\u5DF2\u5B58\u5728\u540C\u540D\u96A7\u9053\u300C{name}\u300D\u2014\u2014\u8BF7\u5148\u5904\u7406\u90A3\u6761\u540C\u540D\u7684\u3002","msg.renaming":"\u91CD\u547D\u540D {name}\u2026","msg.deleting":"\u5220\u9664 {name}\u2026","msg.downloading":"\u4E0B\u8F7D {name}\u2026","msg.uploadingName":"\u4E0A\u4F20 {name}","error.invalidTaskState":"\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u975E\u6CD5\u7684\u4EFB\u52A1\u72B6\u6001","hint.rememberCredentialApply":"\u52FE\u9009\u540E\uFF0C\u70B9\u300C\u5E94\u7528\u300D\u65F6\u628A\u5BC6\u7801\u5199\u8FDB\u5B98\u65B9\u51ED\u636E\u5B58\u50A8\uFF0C\u5B57\u6BB5\u91CC\u53EA\u7559 env: \u5F15\u7528\uFF08\u503C\u5728 ~/.dsh/.credentials.yaml\uFF0C\u4E0D\u8FDB\u73AF\u5883\u3001\u4E0D\u56DE\u4F20\u6D4F\u89C8\u5668\uFF1B\u6321\u4E0D\u4F4F\u540C\u7528\u6237\u8FDB\u7A0B\u4E0E agent\uFF09\u3002\u4E0D\u52FE\u9009\u5219\u6309\u73B0\u72B6\u660E\u6587\u5199\u8FDB\u8BBE\u7F6E\u6587\u4EF6\u3002\u80FD\u7528\u5BC6\u94A5 / agent \u5C31\u522B\u5B58\u5BC6\u7801\u3002","hint.noCredRefPasswordApply":"\u8FD8\u6CA1\u6709\u522B\u7684\u8FDE\u63A5\u7528\u8FC7\u51ED\u636E\u5F15\u7528 \u2014 \u52FE\u4E0A\u9762\u7684\u300C\u5E94\u7528\u65F6\u5B58\u5165\u51ED\u636E\u5B58\u50A8\u300D\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u6216\u76F4\u63A5\u5728\u5BC6\u7801\u6846\u624B\u8F93 env:NAME","hint.bookNameConflict":"\u540C\u540D\u51B2\u7A81\u4F1A\u88AB\u62D2\u7EDD","btn.apply":"\u5E94\u7528"},R_={"error.credServiceMissing":"The host does not provide the credential service (remote.credentials)","error.credServiceIncomplete":"The credential service is incomplete","error.credStoreUnavailable":"The host does not provide the credential service (remote.credentials); cannot store","error.credStoreFailed":"Failed to store the credential: {error}","error.credClearUnavailable":"The host does not provide the credential service (remote.credentials); cannot clear","error.credClearFailed":"Failed to clear: {error}","error.credRefNeedsHost":"Fill in host and username first \u2014 the reference name is derived from them","btn.reopen":"Reopen","btn.reopenTitle":"Reopen the session with the original connection settings","btn.sftpTitle":"Open the SFTP file browser for this connection","btn.tunnels":"Tunnels {count}","btn.tunnelsTitle":"View the port-forwarding tunnels of this connection","btn.more":"More","btn.moreTitle":"More actions (port forwarding\u2026)","btn.reopenSession":"Reopen session","status.exited":"Session exited","status.ended":"Session ended","btn.clickRerun":"Click to run again","status.aiEnded":"The AI finished this session","hint.aiEndedTab":"The content stays for now: switch away or hit \u201CDismiss\u201D to close this tab","btn.dismiss":"Dismiss","btn.dismissTitle":"Close this tab (the session has already ended)","hint.reopenWithSpec":"Open a session again from the same spec (persistent tabs reattach to tmux, command tabs run again)","btn.newLocalTerminal":"New local terminal","hint.reopenAgentLocal":"This session was opened by the AI and has ended: this opens a new local terminal, it does not reattach to the original one","msg.passwordNotStored":"For security, plaintext passwords/passphrases are not kept in browser storage, so this connection needs them again: re-enter them when reopening the tab, or switch the credential to an env: reference in the settings card (the value lives in the host credential store).","error.terminalNeedsCommand":"ttyTerminal requires a command","error.terminalCommandSingleLine":"command must be a single line","error.terminalNeedsHost":"ttyTerminal.mount requires an HTMLElement as the mount point","error.panelNotReady":"ttyPanel.mountPane: the terminal panel is not ready","panel.dragHeight":"Drag to resize height","panel.dragWidth":"Drag to resize width","btn.closePane":"Close the side pane","btn.expandPane":"Expand the side pane","btn.collapsePane":"Collapse the side pane","panel.tabLabel":"Terminal {n}","btn.close":"Close","btn.closeTabAria":"Close tab: {label}","btn.newTab":"New (local / SSH)","btn.tabList":"Tab list","btn.tabListTitle":"Tab list ({n})","list.tabsAllVisible":"No tabs are out of view","list.cleanExited":"Clean up exited tabs ({n})","btn.closeTab":"Close this tab","btn.hideFromAgent":"Hide this tab from the AI","btn.showToAgent":"Unhide (make it available to the AI)","btn.hiddenMark":"Hidden from AI","btn.closeLeft":"Close tabs to the left ({n})","btn.closeOthers":"Close other tabs ({n})","btn.closeRight":"Close tabs to the right ({n})","list.subLive":"{n} of them are still open","meta.tunnelRemote":"remote:{host}:{port} \u2192 local:{local}","meta.tunnelLocal":"local:{local} \u2192 {host}:{port}","status.tmuxPersistedTitle":"Hosted by tmux \u2014 the session is reattached by name after a disconnect or host restart","status.notPersisted":"Not persisted","status.tmuxUnavailableTitle":"A persistent session was requested but tmux is unavailable \u2014 this is a plain session","status.connected":"Connected","status.connecting":"Connecting","status.errored":"Connection error","panel.tunnels":"Port forwarding","hint.tunnelsSettings":"Configure in Settings \u2192 Plugins \u2192 Terminal panel","panel.tunnelsFor":"Port forwarding \u2014 {name}","list.loading":"Loading\u2026","hint.tunnelsCard":"Add, remove, enable, or disable tunnels in the port-forwarding section of Settings \u2192 Plugins \u2192 Terminal panel","list.noActiveTunnels":"No enabled tunnels for this connection","status.fatalSuffix":" (no retry; fix the config)","msg.maxSessions":"Session limit reached ({live} total / max {max}: {own} in this window{others}) \u2014 close unused windows or tabs, or raise \u201CConcurrent session limit\u201D in the settings card","msg.maxSessionsOthers":" + {count} in other windows","error.probeHttp":"Connection test failed (HTTP {status})","msg.probing":"Testing the connection\u2026","meta.reachable":"reachable","meta.unreachable":"unreachable","meta.probeBanner":"banner ok","meta.hostKeyMatched":"Host key matched","meta.hostKeyRecorded":"Host key recorded (TOFU)","meta.hostKeyMismatch":"Host key mismatch!","meta.authOkMs":"Authenticated ({ms}ms)","meta.authOk":"Authenticated","meta.probeOk":"\u2705 Connected: {detail}","error.unknown":"Unknown error","btn.maxSessionsTitle":"Session limit reached \u2014 click to see what to do","option.localTerminal":"Local terminal","hint.tmuxHosted":"Hosted by tmux \xB7 recoverable after a host restart","hint.openInSessionCwd":"Open in the current session working directory","panel.sshBook":"SSH host book","btn.sftpFileBrowse":"SFTP file browser","btn.editConnection":"Edit connection","list.emptySshBook":"(empty \u2014 save one in the settings card or via \u201CSSH connection\u2026\u201D)","option.sshConnect":"SSH connection\u2026","hint.sshConnect":"Fill in host, user, and authentication manually","panel.editConnection":"Edit connection \xB7 {name}","panel.sshConnect":"SSH connection","section.jump":"Jump host","field.jumpHost":"Jump host ([user@]host[:port]; empty = direct)","placeholder.jumpHost":"e.g. bastion.corp:2222","check.jumpOwnCred":"Use separate credentials for the jump host","field.jumpUsername":"Jump host user (empty = same as the target)","field.jumpAuth":"Jump host auth (empty = same as the target)","hint.jumpInherit":"Empty credentials reuse the target host\u2019s auth method and keys.","hint.jumpInheritFull":"Empty credentials reuse the target host\u2019s auth method and keys. When the jump host itself is unreachable the error names it (it will not masquerade as a target timeout).","meta.jumpStage":"Jump host {label}","meta.viaJump":"\u21E2 via {label}","meta.viaProxy":"\u21E2 via proxy command","section.proxyCommand":"Proxy command","field.proxyCommand":"Proxy command (ProxyCommand; empty = unused)","placeholder.proxyCommand":"e.g. ssh -W %h:%p bastion","hint.proxyCommand":"A command on this machine whose stdin/stdout become the SSH transport; a jump host wins if both are set.","hint.proxyCommandFull":"A command run on this machine whose stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). Supports %h host, %p port, %r user, %n host and %% for a literal %; anything else is left as written. If a jump host is set too, the jump host wins (OpenSSH semantics). It needs the switch below, and importing ~/.ssh/config never fills it in.","hint.proxyCommandDisabled":"\u26A0 \u201CAllow ProxyCommand\u201D is off right now: this command will not run and the connection fails explicitly (it does not fall back to a direct connection). Turn it on in Plugin settings \u2192 Terminal panel.","hint.proxyCommandNotGranted":"\u26A0 Not granted by the host: clicking this switch starts a grant in place (the panel shows one command to run in a terminal on the host \u2014 no restart), or use the strictest route \u2014 export DSH_TTY_ALLOW_PROXY_COMMAND=1 in the environment that launched dsh and restart the host (setting it after launch does not count). The reason: cross-site pages and in-page scripts can both send loopback requests, so if the settings UI could raise it out of thin air this gate would be pointless. Turning it off always works.","badge.notEffective":"Not effective: not granted by the host","elev.title":"Grant in place (no restart)","elev.lockedWhy":"Any local process can send loopback requests, so \u201Cturn on a dangerous capability\u201D cannot be decided by this page alone \u2014 it has to be confirmed on the host\u2019s filesystem once.","elev.step":"Run the command below in a terminal on the host and the switch unlocks by itself:","elev.copy":"Copy command","elev.copied":"Copied","elev.copyManual":"The clipboard is unavailable here \u2014 select the command above and copy it manually.","elev.expiresIn":"expires in {sec}s","elev.expired":"This confirmation has expired \u2014 generate a new one.","elev.waiting":"Waiting for confirmation\u2026 once you run the command this turns into \u201Cgranted\u201D automatically.","elev.regenerate":"Generate a new one","elev.loading":"Generating the confirmation command\u2026","elev.granted":"Granted and now in effect.","elev.grantedNeedSave":"Granted. Press \u201CSave\u201D to apply.","elev.grantedAt":"Granted \xB7 {time}","elev.revoke":"Revoke host grant","elev.revoked":"Host grant revoked (the config switch is left untouched; granting again takes effect immediately).","elev.viaEnv":"Granted by a launch environment variable; to revoke, remove it from the launch environment and restart the host.","elev.close":"Collapse","elev.disableFirst":"Turn this config switch off first","elev.otherWay":"The other way (strongest, needs a host restart)","elev.envHow":"In the environment that launched dsh: export {env}=1, then restart the host. Setting it after launch \u2014 or writing it into some other config file \u2014 does not count as a grant; that is exactly what this gate guards against.","elev.error":"In-place grant failed: ","meta.probeProxy":"Proxy command","meta.probeProxyOff":"Proxy command (disabled)","meta.probeTcpSkipped":"Direct TCP check skipped (using the proxy command)","section.connection":"Connection","field.host":"Host","placeholder.host":"example.com or IP","field.port":"Port","field.username":"Username","section.auth":"Authentication","field.authMethod":"Auth method","option.authInherit":"(same as the target)","option.authAgent":"agent \u2014 use the local ssh-agent","option.authKey":"key \u2014 private key file","option.authPassword":"password \u2014 password","field.keyPath":"Private key path","field.hostKeyAlias":"Host key alias","field.passphrase":"Key passphrase (optional)","field.password":"Password","placeholder.credRef":"Or: pick a reference name from the credential store","hint.credRefCandidates":"Candidates = reference names already in the credential store + those in use by the local host book","list.credOverwrite":"{name} (click again to overwrite)","list.moreMatches":"{count} more \u2014 keep typing to filter","list.noCredRef":"No matching reference","check.rememberCredential":"Store in the credential store on save","hint.rememberCredential":"When checked, \u201CSave changes\u201D or \u201CConnect (and save)\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","btn.clearCredential":"Clear stored credential","error.credPlainUnavailable":"The host does not provide the credential service (remote.credentials); plaintext save only","error.credPlainIncomplete":"The credential service is incomplete; plaintext save only","status.credUnreported":"Reference {ref}: the host reported no status","error.credStatusFailed":"Failed to read the credential status: {error}","status.credStored":"Stored{source} \xB7 {ref}","meta.credSource":" (source: {source})","status.credUnknown":"Reference {ref}: the store does not have this value yet","hint.noCredRefPassphrase":"No other connection uses a credential reference yet \u2014 you can type env:NAME straight into the passphrase box","hint.noCredRefPassword":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on save\u201D above to create one, or type env:NAME straight into the password box","section.options":"Options","section.advanced":"Advanced","hint.advanced":"Jump host \xB7 Proxy command \xB7 Host key alias","meta.advancedConfigured":"Configured: {items}","check.agentForward":"agent forwarding (the remote side can use local ssh-agent keys, e.g. remote git clone)","hint.hostKeyAlias":"Empty = pin by host address; one alias shares a fingerprint record across addresses.","hint.hostKeyAliasFull":"Empty = pin the fingerprint by host address. When one host is reached through different addresses (behind a bastion / via port forwarding), give them the same alias so they share one host-key record instead of reporting a fingerprint change on every switch; it only decides where the fingerprint is stored, never the connection address","placeholder.hostKeyAlias":"Empty = by host address","check.persist":"Persistent session (hosted by tmux, survives a disconnect/restart; tmux must be installed on the remote)","check.saveToBook":"Save to the host book (overwrite the same name)","field.bookName":"Host book name","placeholder.bookName":"Leave empty to use the host name","error.hostUserRequired":"Host and username are required","error.keyPathRequired":"auth=key requires a private key path","error.passwordRequired":"auth=password requires a password","btn.cancel":"Cancel","btn.connect":"Connect","btn.fileBrowse":"File browser","btn.browseTitle":"Open the SFTP file browser with the values currently filled in, without touching a terminal","btn.probe":"Test","btn.probeTitle":"Diagnose the connection with the values currently filled in (TCP \u2192 host key \u2192 authentication); no session is created and no host fingerprint is recorded","error.saveCredFailed":"Save failed: {error}","btn.saveEdit":"Save changes","error.saveBookFailed":"Failed to save the host book: {error}","error.bookNameTaken":"The host book already has an entry named: {name}","panel.sftpDual":"SFTP dual pane \xB7 {label}","status.failed":"Failed","status.done":"Done","placeholder.localPath":"Local path (Enter to go)","placeholder.remotePath":"Remote path (Enter to go)","btn.refresh":"Refresh","btn.mkdir":"New folder","btn.hiddenFiles":"Hidden files","btn.hiddenFilesTitle":"Show / hide dot-files (.env, .gitignore, \u2026)","error.dirNotReady":"The directory is not resolved yet","meta.dir":"folder","btn.transferTo":"Transfer to {target}: {path}","meta.local":"local","meta.remote":"remote","error.transferDirsNotReady":"Both directories are not resolved yet; wait for the lists to load before transferring","msg.transferring":"Transferring {name}\u2026","error.transferFailed":"Transfer failed","error.noTaskId":"The server returned no task id","msg.transferCanceled":"Transfer canceled: {name}","msg.transferred":"Transferred {name}","btn.download":"Download {name}","btn.rename":"Rename {name}","placeholder.newName":"New name","btn.deleteEntry":"Delete {name}","btn.deleteEntryDir":"Delete {name} (with contents)","msg.deleted":"Deleted {name}","list.parentDir":".. (parent folder)","list.emptyDir":"(empty folder)","list.hiddenOnly":"(only hidden files here \u2014 click \u201CHidden files\u201D on the pane header to show them)","error.dropOnLocalPane":"Dropping onto the local pane has no action: to send local files to the other side, drop them on the right-hand \u201CRemote\u201D pane","list.truncated":"\u2026{rest} more not rendered ({total} total) \u2014 use the path box above to jump to a subfolder","list.itemCount":"{count} items","placeholder.newDirName":"New folder name (relative to the current folder)","msg.creatingDir":"Creating folder {name}\u2026","btn.ok":"OK","btn.confirm":"Confirm?","btn.cancelTransfer":"Cancel transfer","msg.downloadCanceled":"Download canceled: {name}","msg.downloadResuming":"Connection dropped \u2014 resuming {name} from {offset}\u2026","error.downloadFailed":"Download failed","msg.downloaded":"Downloaded {name} ({size})","error.downloadTooBig":"The file exceeds the download limit ({size}); use dual-pane \u21E6 direct transfer or scp/rsync in the terminal","msg.canceled":"Canceled","btn.upload":"Upload","btn.uploadTitle":"Pick files to upload, or drag files/folders straight into the list","msg.uploading":"Uploading\u2026","msg.uploadDone":"Upload finished","error.uploadFailed":"Upload failed","error.networkError":"Network error","error.uploadCountExceeded":"Too many files (limit {max}): {count} this time \u2014 upload in batches","status.overLimit":"Over the limit","error.uploadTooBig":"The file exceeds the upload limit ({size}): {name} \u2014 use dual-pane \u21E8 direct transfer or scp/rsync in the terminal","error.uploadTotalTooBig":"The total size exceeds the upload limit: upload in batches (or use dual-pane \u21E8 direct transfer)","msg.uploadCanceled":"Upload canceled ({done}/{total} done)","status.allDone":"All done","msg.uploadDoneCount":"Uploaded {count} files","error.connectFailed":"Connection failed: {error}","status.connectingEllipsis":"Connecting\u2026","status.connectedPid":"Connected pid={pid}","status.connectedSsh":"SSH {target}connected","status.exitedWith":"Exited {detail}","status.error":"Error: {message}","status.retryHint":"{message} \xB7 click to retry","btn.clickRetry":"Click to retry","status.disconnectedReconnecting":"Disconnected \u2014 reconnecting","status.disconnected":"Disconnected","status.reconnecting":"Reconnecting\u2026","error.copyFailed":"Copy failed: this environment does not allow clipboard access (over http, use localhost or the terminal's own shortcuts)","status.initializing":"Initializing\u2026","placeholder.search":"Search (Enter \u2193 / Shift+Enter \u2191)","btn.searchTitle":"Search (Ctrl+F) \u2014 Enter next / Shift+Enter previous","btn.clearTitle":"Clear","btn.minimizeTitle":"Minimize (sessions keep running; the status moves into the sidebar entry)","btn.minimize":"Minimize","btn.closePanelTitle":"Close the panel and end every session (you are asked first when sessions are still open; to just put it away hit \u201C\u2014\u201D, sessions keep running)","confirm.closeTitle":"End {n} sessions and close the panel?","confirm.closeText":"Closing the panel ends these {n} sessions that are still open (the tabs go with them).","confirm.closeTextAgent":"Closing the panel ends these {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.closeHint":"Only need room for other windows? Hit \u201CMinimize\u201D \u2014 sessions and output keep running.","confirm.closeOk":"End {n} sessions and close","confirm.tabsTitle":"End {n} sessions and close those tabs?","confirm.tabsText":"This ends {n} sessions that are still open, and their tabs go with them.","confirm.tabsTextAgent":"This ends {n} sessions, {agent} of which the AI opened (they may be running commands).","confirm.tabsHint":"Already-exited tabs are read-only leftovers \u2014 cleaning those loses nothing.","confirm.tabsOk":"End {n} sessions","btn.restoreDock":"Click to restore the terminal window","panel.title":"Terminal","status.minimized":"Terminal minimized \u2014 click to restore","error.configLoadFailed":"Failed to load the config","error.saveTunnelFailed":"Failed to save the tunnel","error.tunnelNameTaken":"A tunnel named \u201C{name}\u201D already exists \u2014 each \u201Chost book entry + direction + port\u201D combination can appear once. Change the port to get a new name, or delete the old one first.","msg.tunnelApplied":"Tunnel \u201C{name}\u201D is active","msg.tunnelUpdated":"Tunnel \u201C{name}\u201D updated","error.nameHostUserRequired":"Name, host, and username are required","msg.hostEdited":"Entry \u201C{name}\u201D updated \u2014 written to the config on \u201CSave\u201D","error.probeFailed":"\u274C Connection failed: {error}","error.hostKeyDeleteFailed":"Failed to delete the host key record","msg.hostKeyDeleted":"Host key record deleted (the fingerprint is recorded again on the next connection)","error.sshConfigReadFailed":"Failed to read ~/.ssh/config","msg.proxySkipped":"{count} entries use a jump host that could not be resolved (missing alias, or the alias itself needs a jump host) and were not imported: {names}","msg.proxyCommandSkipped":"{count} entries only set a proxy command (ProxyCommand) and were not imported: {names} \u2014 a proxy command is local command execution, so importing never fills it in; add it by hand on the connection-book entry and turn on \u201CAllow ProxyCommand\u201D","msg.skippedNotConcrete":"{count} entries are not a concrete host (wildcard / no User)","list.separator":", ","meta.etc":" etc.","msg.importOverflow":"{count} entries beyond the import limit were not imported","list.separatorFull":"; ","msg.noNewEntries":"No new entries ({count} skipped as duplicates)","msg.noImportableHosts":"~/.ssh/config has no concrete hosts to import","msg.importedHosts":"Imported {added} (skipped {skipped} duplicates); written to the config on \u201CSave\u201D","error.knownHostsReadFailed":"Failed to read ~/.ssh/known_hosts","msg.noNewFingerprints":"No new fingerprints ({count} already exist)","msg.noImportableKnownHosts":"known_hosts has no concrete hosts to import","error.saveHostKeysFailed":"Failed to save hostKeys","msg.importedFingerprints":"Imported fingerprints for {added} hosts (skipped {skipped} that already existed)","hint.knownHostsTruncated":"; note: known_hosts has more than 500 hosts \u2014 only the first 500 were imported","error.saveFailed":"Save failed","msg.saved":"Saved and applied live","check.rememberCredentialApply":"Store in the credential store on apply","hint.appliedOnSave":"Written to the config with the card's \u201CSave\u201D","card.name":"Terminal panel","card.desc":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence.","card.descFull":"xterm terminal panel: multiple tabs, automatic reconnect after a drop, cwd follows the session, SSH host book with host-key pinning, tmux session persistence; shell / TERM / concurrency limits apply live on save.","list.loadingConfig":"Loading the config\u2026","section.basic":"Basics","check.enabled":"Enable the plugin (applies live on save: tools and the panel entry are withdrawn immediately, sessions move to keepalive)","check.announce":"Announce the terminal panel capabilities to the agent","check.shellIntegration":"Shell integration (OSC 133/7 injection)","check.shellIntegrationWindows":"Shell integration (OSC 133/7 injection: cwd following, exit codes, tty_expect and the running state)","hint.shellIntegrationWindows":"cmd has no command-boundary hooks, so nothing can be injected: switch \u201CShell path\u201D to powershell.exe or pwsh.exe (both are in the candidate list) and then make sure this switch is on (an earlier Windows install may have stored it as off). Remote Linux / macOS hosts are unaffected.","hint.shellIntegrationPowerShell":"The PowerShell family is instrumented through a `-File` stub: cwd following, exit codes, tty_expect and the running state all work. Known limit: on PowerShell 7 the command output reaches ConPTY after the D mark, so `tty_capture{last}` may come back empty \u2014 use `tty_capture` to read the tail there (Windows PowerShell 5.1 is unaffected).","section.sftp":"SFTP file transfer","field.sftpStyle":"SFTP file browser style","option.sftpDialog":"Single pane \u2014 remote directory + upload/download/drag","option.sftpDual":"Dual pane \u2014 local on the left, remote on the right, direct transfer on selection","hint.sftpDual":"Dual pane copies files between local and remote (recursive, overwriting same names); takes effect after reopening SFTP","field.sftpLimits":"SFTP transfer limits (0 = unlimited)","field.downloadLimit":"Download limit (MB)","field.uploadLimit":"Upload limit (MB)","field.uploadCountLimit":"Batch file count limit","hint.sftpLimits":"Browser-side guard: a single file over the limit aborts the download/upload (for large files use dual-pane \u21E8/\u21E6 direct transfer or scp/rsync in the terminal; they do not consume browser memory); the file count limit applies to one batch/drag upload; applies live on save","section.session":"Sessions","field.persistence":"Session persistence (tmux)","option.persistOff":"Off \u2014 sessions end with the panel/host (default)","option.persistTmux":"tmux \u2014 new terminal/SSH tabs are persistent by default","hint.persistence":"When on, all new tabs (local / SSH host book / SSH connection dialog) are hosted by tmux by default and survive a host restart; tmux must be installed locally/remotely; the SSH dialog can opt out per connection; existing tabs are unaffected","hint.persistenceWindows":"; tmux is unavailable on Windows hosts, so local tabs still open but are not hosted","check.endOnPageClose":"End persistent sessions when the page closes (no keepalive)","check.statsEnabled":"Server stats bar (CPU / memory / disk / uptime / TCP / network; items that cannot be sampled show \u201CN/A\u201D)","hint.statsEnabled":"Off by default: persistent sessions survive closing the whole page (recoverable after the keepalive window); when on, they end together with the tmux session once the page disconnects and the keepalive window expires \u2014 note that refreshing the page within the keepalive window is unaffected","check.allowProxyCommand":"Allow ProxyCommand (runs a command on this machine; off by default)","hint.allowProxyCommand":"When on, a proxy command set on a connection-book entry runs on this machine, and its stdin/stdout become the SSH transport to the target (the same idea as OpenSSH\u2019s ProxyCommand). This is the only switch in this plugin that turns a settings field into local command execution, so it is off by default: while off, a connection carrying a proxy command fails explicitly (it does not fall back to a direct connection). Importing ~/.ssh/config never fills one in.","field.maxSessions":"Concurrent session limit (1\u201316)","hint.maxSessions":"New tabs beyond the limit are rejected; applies live on save","field.shell":"Shell path (defaults to $SHELL)","field.shellWindows":"Shell path (defaults to %COMSPEC%)","placeholder.shell":"Leave empty to use $SHELL","placeholder.shellWindows":"Leave empty to use %COMSPEC% (or enter the full path to powershell.exe / pwsh.exe)","list.noShellCandidate":"No matching candidate \u2014 just type any path","hint.shellCandidatesWindows":"Windows host: candidates come from %COMSPEC% and the installed PowerShell (Windows PowerShell 5.1 / PowerShell 7), and you can type any path; the PowerShell family supports shell integration (OSC 133/7 injected by a `-File` stub), cmd has no command-boundary hooks and is unsupported","hint.shellCandidates":"Pick an installed shell from the list ($SHELL first) or type any path; zsh / bash support shell integration","hint.term":"TUI programs depend on this value","field.cwd":"Fallback working directory (the client's current session cwd wins)","placeholder.cwd":"Leave empty to use the host process start directory","field.grace":"Disconnect keepalive (seconds, 0 = end immediately)","hint.grace":"Sessions are kept alive for reconnect after a page refresh or network hiccup and end on timeout; applies live on save","section.assist":"AI assist","check.assistEnabled":'Explain failures (ask the model "why / what next" when a command exits non-zero)',"hint.assistEnabled":"Off by default. When on, a chip appears in the corner of the terminal after a command exits non-zero; clicking it sends that command's output tail (colors and progress bars stripped, repeated lines collapsed, keys/tokens masked) together with the current screen to the model \u2014 never the scrollback. A suggested command is only ever typed into the prompt line, never submitted for you.","field.assistRoute":"Model route (optional)","hint.assistRoute":"Empty follows the host default model","option.followHostModel":"Follow the host default model","list.modelLoading":"Loading candidates\u2026","list.noModelCandidate":"The host advertises no models","list.modelCatalogFailed":"Candidates unavailable \u2014 the host may not have restarted, or serves no model catalog (type provider/model to enter one manually)","badge.assistFailed":"Command failed ({code}) \xB7 explain","panel.assistTitle":"Why this command failed","panel.assistCommand":"Suggested command","status.assistThinking":"Asking the model\u2026","error.assistRequest":"Explanation failed: {message}","btn.assistFill":"Insert command","btn.assistCopy":"Copy answer","btn.assistCopyError":"Copy error","btn.assistClose":"Close","hint.assistFillNoEnter":"Types it into the prompt line; never submits","hint.assistNoCommand":"The model gave no directly-insertable command \u2014 use Copy and pick one yourself","section.ssh":"SSH connections","btn.probeRowTitle":"Test this entry: per-stage diagnosis of TCP \u2192 host key \u2192 authentication","msg.testing":"Testing\u2026","btn.test":"Test","btn.edit":"Edit","btn.delete":"Delete","list.emptySshHosts":"No entries \u2014 add one via the terminal panel's \u201C+\u201D \u2192 SSH connection\u2026 and check \u201CSave to the host book\u201D","btn.importSshConfig":"Import from ~/.ssh/config","hint.importSshConfig":"Same names are skipped; written to the config on \u201CSave\u201D","hint.sshBook":"Written to the config together with \u201CSave\u201D; passwords/passphrases support env:VAR references to avoid plaintext storage","check.tunnelEnabled":"Enable","list.emptyTunnels":"No tunnels \u2014 map a remote database or internal service to a local port","field.direction":"Forwarding direction","option.localForwardTitle":"Local forward -L: listen locally and connect to a target on the SSH server side","option.localForward":"Local -L","option.remoteForwardTitle":"Remote forward -R: listen on the SSH server side and dial back to a local service","option.remoteForward":"Remote -R","option.selectBook":"Pick a host book entry","hint.tunnelViaBook":"Connects via {book} \u2014 the tunnel's host and credentials come from that host book entry","hint.tunnelBookEmpty":"Pick which SSH connection this tunnel uses (host and credentials come from the host book)","hint.localListenFixed":"The local listen address is fixed to 127.0.0.1 (not exposed to the LAN)","placeholder.localPort":"Local port","field.localListenPort":"Local listen port","hint.flowLocalToRemote":"Traffic flow: local \u2192 SSH server side","placeholder.remoteHost":"Server-side host","hint.remoteHostTitle":"Target host name or IP (reached from the SSH server side; 127.0.0.1 = the server itself)","field.remoteHost":"Server-side target host","placeholder.port":"Port","field.remotePort":"Server-side target port","placeholder.remoteListenHost":"Server-side listen address","hint.remoteListenHost":"Server-side listen address (defaults to 127.0.0.1; leave empty to allow only the server itself)","field.remoteListenHost":"Server-side listen address","placeholder.listenPort":"Listen port","field.remoteListenPort":"Server-side listen port","hint.flowRemoteToLocal":"Traffic flow: local \u2190 SSH server side","hint.localDialFixed":"The local dial address is fixed to 127.0.0.1","placeholder.localTargetPort":"Local service port","field.localTargetPort":"Local target port","hint.tunnelLocalSummary":"Left: local listener (fixed 127.0.0.1) \u2192 Right: target reached from the SSH server side","hint.tunnelRemoteSummary":"Left: SSH server-side listener \u2192 Right: local service being reached (fixed 127.0.0.1)","btn.addTunnel":"Add tunnel","hint.tunnelAdd":"Takes effect immediately; reconnects automatically after a drop; prefer local ports above 1024; remote hosts are reached from the SSH server side (127.0.0.1 = the server itself)","hint.tunnelEditing":"Editing \u201C{name}\u201D \u2014 changing the port/entry derives a new name by rule; takes effect immediately on save","panel.hostKeys":"SSH host key records (TOFU)","btn.importKnownHosts":"Import from known_hosts","list.emptyHostKeys":"No records \u2014 the host fingerprint is recorded automatically after the first successful SSH connection","hint.hostKeys":"A host with several keys (e.g. rsa + ed25519) gets one fingerprint each and any match is accepted; a changed fingerprint rejects the connection (MITM protection) \u2014 delete that record once you are sure it is safe, then reconnect","msg.saving":"Saving\u2026","btn.save":"Save","list.none":"N/A","meta.mem":"Memory","meta.disk":"Disk","meta.cores":"Cores","meta.uptime":"Uptime","meta.temp":"CPU temp","meta.net":"Network","error.tunnelNoBook":"Add an SSH entry to the host book first","error.tunnelRemotePortRequired":"A remote listen port and a local target port are required (1\u201365535)","error.tunnelLocalRequired":"Local port, remote host, and remote port are required","error.tunnelMissing":"Tunnel \u201C{name}\u201D no longer exists (it may have been deleted by another window)","error.tunnelClash":"A tunnel named \u201C{name}\u201D already exists \u2014 handle that one first.","msg.renaming":"Renaming {name}\u2026","msg.deleting":"Deleting {name}\u2026","msg.downloading":"Downloading {name}\u2026","msg.uploadingName":"Uploading {name}","error.invalidTaskState":"The server returned an invalid task state","hint.rememberCredentialApply":"When checked, \u201CApply\u201D writes the password into the official credential store and leaves only an env: reference in the field (the value lives in ~/.dsh/.credentials.yaml; it is not put into the environment and is not sent back to the browser; it does not protect against same-user processes or the agent). Unchecked keeps today's plaintext write into the settings file. If a key or the agent works, do not store a password.","hint.noCredRefPasswordApply":"No other connection uses a credential reference yet \u2014 check \u201CStore in the credential store on apply\u201D above to create one, or type env:NAME straight into the password box","hint.bookNameConflict":"A same-name conflict is rejected","btn.apply":"Apply"};function A_(e,t){return t===void 0?e:String(e).replace(/\{(\w+)\}/g,(r,i)=>t[i]===void 0?"":String(t[i]))}function xh(e,t){return A_(Xs[e]!==void 0?Xs[e]:e,t)}var g=xh;function D_(e){e.inject(["locale"],t=>{let r=t.locale.register(Do,"zh",Xs),i=t.locale.register(Do,"en",R_);return g=t.locale.bind(Do),()=>{i(),r(),g=xh}})}function P_(){return Bc(document.baseURI,globalThis.__DSH_TRANSPORT__?.streamBaseUrl)}function ui(){return Ut!==null&&typeof Ut.describe=="function"?Ut:null}function ii(e){let t=String(e??"").trim();return t.startsWith("env:")?t.slice(4).trim():""}function B_(){let e=new Set;for(let t of nr)for(let r of[t?.password,t?.passphrase]){let i=ii(r);i!==""&&e.add(i)}return[...e]}async function O_(){try{let t=await(await fetch("/api/dsh-tty/credential-refs",{cache:"no-store"})).json();if(t.ok&&Array.isArray(t.names))return t.names.filter(r=>typeof r=="string"&&r!=="")}catch{}return[]}async function kh(){return[...new Set([...B_(),...await O_()])].sort()}async function Eh(e){let t=ui();if(t===null)return{error:g(Ut===null?"error.credServiceMissing":"error.credServiceIncomplete")};try{let r=await t.describe([e]),i=r?.ok===!0?r.value?.[e]:void 0;return i===void 0?{unreported:!0}:{view:{configured:i.configured===!0,writable:i.writable===!0,source:typeof i.source=="string"?i.source:""}}}catch(r){return{error:r instanceof Error?r.message:String(r)}}}async function I_(e,t){let r=ui();if(r===null||typeof r.set!="function")return{error:g("error.credStoreUnavailable")};try{return await r.set(e,t),{value:"env:"+e}}catch(i){return{error:g("error.credStoreFailed",{error:i instanceof Error?i.message:String(i)})}}}async function Lh(e){let t=ui();if(t===null||typeof t.unset!="function")return{error:g("error.credClearUnavailable")};try{return await t.unset(e),{}}catch(r){return{error:g("error.credClearFailed",{error:r instanceof Error?r.message:String(r)})}}}async function Th(e,t,r,i,o,s){if(e!==!0)return{};let n=String(t??"").trim();if(n===""||n.startsWith("env:"))return{};let a=Oc(r,i,o,s);return a===""?{error:g("error.credRefNeedsHost")}:I_(a,n)}function fn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"t"+Date.now().toString(36)+Math.random().toString(36).slice(2,10)}var zs;function es(){document.getElementById("dsh-tty-style")||(zs=document.createElement("style"),zs.id="dsh-tty-style",zs.textContent=Rc+`
|
|
3766
|
+
`+Mc,document.head.appendChild(zs))}var pn='<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>',N_='<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>',Mh='<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>',H_='<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>',F_='<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>',Rh='<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>',Ah='<svg viewBox="0 0 16 16" width="13" height="13" fill="currentColor" stroke="none" aria-hidden="true"><circle cx="3.4" cy="8" r="1.35"/><circle cx="8" cy="8" r="1.35"/><circle cx="12.6" cy="8" r="1.35"/></svg>',W_='<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>',_n='<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>',ts='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>',j_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/></svg>',z_='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1.6 8s2.4-4.2 6.4-4.2S14.4 8 14.4 8s-2.4 4.2-6.4 4.2S1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/><path d="M3 13L13 3"/></svg>',U_='<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>',$i='<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>',Dh='<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>',Ph='<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>',ra='<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>',Bh='<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>',$_='<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>',ia='<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>',Tr='<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>',sa='<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>',Oh='<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>',na='<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>',oa='<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>',q_='<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>',fh='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><path d="M6 12L9.29289 8.70711C9.68342 8.31658 9.68342 7.68342 9.29289 7.29289L6 4"/></svg>',K_='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><path d="M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6"/></svg>',G_='<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>',V_='<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>',Y_='<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>',Ih='<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>',J_='<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>',Nh='<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>',Hh=null,Be=null,ce=null,Zs=null,qi=null,Ut=null,Mr=null,Br=null,Te=null,zt=null,Oi=null,Ii=null,Qs=null,Ct=null,Ni=null,it=null,kt=null,ir=null,si=null,Ki=!1,Hi=null,Xe=!1,rt=null,Gi=null,fi=null,Or=null,en=null,Rr=null,Fi=1e3,tn="dsh-tty:tabs",ie=new Map,rs=new Set,aa=()=>rs.size>0,No=new Set,xe=null,is=0,Us=!1,Et=null,rn=!1,yr=new Map,Ar=null,Ir=null,ni=null,gr=null,sn=null,pt=null,oi=null,nr=[],nn=!0,Rt=null,$t=null,Vi="",ai=null,Ho=null,At=null,Wi=null,Bi=null,Fo=null,Wo=new Set;function mn(e){return Wo.add(e),()=>Wo.delete(e)}mn(({tab:e,addAction:t})=>{Pr&&e.exited&&t(H_,g("btn.reopen"),g("btn.reopenTitle"),()=>Ji(e.sid))});mn(({tab:e,addAction:t})=>{Pr&&t(F_,"SFTP",g("btn.sftpTitle"),()=>yn(e.spawnSpec,e.sid))});mn(({bookName:e,addAction:t})=>{if(!Pr)return;let r=e!==""?od(e):0;if(r>0){t(Rh,g("btn.tunnels",{count:r}),g("btn.tunnelsTitle"),i=>Qh(i.currentTarget,e));return}e!==""&&t(Ah,g("btn.more"),g("btn.moreTitle"),i=>Rm(i.currentTarget,e))});function gn(e,t){if(Mr===null)return;Mr.textContent=e.split("\u2014\u2014")[0],Mr.title=e,Br.dataset.state=t,Zs!==null&&(Zs.style.display=t==="connected"?"none":""),fi!==null&&(fi.textContent=e),Or!==null&&(Or.dataset.state=t);let r=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot");r!==null&&(r.dataset.state=t)}function Po(e,t,r){let i=typeof e=="string"&&e!==""?e:null;if(i!==null){let o=ie.get(i);o!==void 0&&(o.statusText=t,o.statusState=r)}th(i,xe)&&(qi=i,gn(t,r))}function $s(e,t){qi=null,gn(e,t)}function la(){if(!rh(qi,xe))return;let e=xe===null?void 0:ie.get(xe);qi=e===void 0?null:xe;let t=eh(e,g);gn(t.text,t.state)}function Ne(e){Be!==null&&Be.readyState===WebSocket.OPEN&&Be.send(JSON.stringify(e))}function X_(){let e=[],t=document.createDocumentFragment();for(let r of Ao(g)){let i=document.createElement("span");i.className="tt_statsItem";let o=document.createElement("span");o.className="tt_statsLabel",o.textContent=r.label,i.appendChild(o);let s=null,n=null;r.kind==="pct"&&(s=document.createElement("span"),s.className="tt_statsMeter",n=document.createElement("span"),n.className="tt_statsMeterFill",s.appendChild(n),i.appendChild(s));let a=document.createElement("span");a.className="tt_statsValue",i.appendChild(a),t.appendChild(i),e.push({item:i,value:a,meter:s,fill:n,slot:null})}return Rt!==null&&Rt.appendChild(t),e}function Z_(e,t){let r=uh(t!==void 0?t.stats:null,g);for(let i=0;i<e.length;i+=1){let o=e[i],s=r[i];if(s!==void 0&&(o.slot!==s.slot&&(o.slot=s.slot,o.value.style.minWidth=s.slot>0?s.slot+"ch":""),o.value.textContent!==s.value&&(o.value.textContent=s.value),o.item.getAttribute("title")!==s.title&&o.item.setAttribute("title",s.title),o.fill!==null&&o.meter!==null)){let n=s.pct===null?"0%":Math.max(0,Math.min(100,s.pct)).toFixed(1)+"%";o.fill.style.width!==n&&(o.fill.style.width=n);let a=ah(s.pct);o.meter.dataset.level!==a&&(o.meter.dataset.level=a)}}}function vn(){Bi=null,Fo=null}function Q_(){if(ce===null||Xe||!nn)return!1;let e=Pt();return e===void 0||e.embedded===!0||e.exited===!0||e.stats===null||e.stats===void 0?!1:hh(e.statsAt)}function on(){if(Xe)return;let e=Pt();if(!(e===void 0||e.embedded===!0||e.fit===null)){try{e.fit.fit()}catch{return}try{e.spawned&&!e.exited&&vi(e)}catch{}}}function Nr(){try{em()}catch(e){console.warn("[dsh-tty] \u72B6\u6001\u6761\u6E32\u67D3\u5931\u8D25\uFF08\u5DF2\u6536\u8D77\uFF09: "+(e instanceof Error?e.message:String(e)));try{Rt!==null&&(Rt.hidden=!0,Rt.textContent=""),vn(),it!==null&&delete it.dataset.stats}catch{}}}function em(){if(it===null||Rt===null)return;let e=Q_(),t=it.dataset.stats!==void 0!==e;if(!e){t&&delete it.dataset.stats,Rt.hidden=!0,Bi!==null&&(Rt.textContent="",vn()),t&&on();return}Rt.hidden=!1,Bi===null&&(Bi=X_());let r=Pt(),i=r===void 0?"":r.sid+":"+String(r.statsAt||0);i!==Fo&&(Fo=i,Z_(Bi,r)),t&&(it.dataset.stats="",on())}function Fh(){Wi===null&&(Wi=setInterval(()=>Nr(),1e3))}function Wh(){Wi!==null&&(clearInterval(Wi),Wi=null)}function jh(){if(ce===null||Xe||!nn)return null;let e=Pt();return e===void 0||e.embedded===!0||e.exited===!0?null:e.sid}function ss(){let e=jh();e!==At&&(At!==null&&Ne({t:"statsOff",sid:At}),At=e,e!==null&&Ne({t:"statsOn",sid:e}))}function tm(e){if(e!==jh()){ss();return}At!==null&&At!==e&&Ne({t:"statsOff",sid:At}),At=e,Ne({t:"statsOn",sid:e})}function rm(){let e=Pt();return e===void 0||e.embedded===!0?null:e.releasePending===!0?{kind:"released",tab:e}:e.exited===!0?{kind:"exited",tab:e}:null}function ns(){if(it===null||$t===null)return;let e=rm(),t=e!==null,r=it.dataset.exited!==void 0!==t;if(!t){$t.hidden=!0,$t.textContent="",Vi="",r&&(delete it.dataset.exited,on());return}$t.hidden=!1,im(e),r&&(it.dataset.exited="",on())}function im(e){let{kind:t,tab:r}=e,i=typeof r.exitDetail=="string"?r.exitDetail:"",o=t+":"+r.sid+":"+i;if(o===Vi)return;Vi=o,$t.textContent="";let s=document.createElement("span");s.className="tt_exitBarText",s.textContent=t==="released"?g("status.aiEnded"):i===""?g("status.exited"):g("status.exitedWith",{detail:i}),t==="released"&&(s.title=g("hint.aiEndedTab")),$t.appendChild(s);let n=document.createElement("span");if(n.className="tt_exitBarSpacer",$t.appendChild(n),t==="released"){ph(g("btn.dismiss"),g("btn.dismissTitle"),()=>{Gt(r.sid,{silent:!0})});return}if(r.spawnSpec===null||typeof r.spawnSpec!="object")return;let a=r.agentOwned===!0;ph(g(a?"btn.newLocalTerminal":"btn.reopenSession"),g(a?"hint.reopenAgentLocal":"hint.reopenWithSpec"),()=>Ji(r.sid))}function ph(e,t,r){let i=document.createElement("button");i.type="button",i.className="tt_toolBtn tt_exitBarBtn",i.textContent=e,typeof t=="string"&&t!==""&&(i.title=t),i.addEventListener("click",r),$t.appendChild(i)}function Pt(){return xe!==null?ie.get(xe):void 0}function jo(){try{return Wc(Hh?.list?.getSnapshot?.())}catch{return}}function sm(e){if(!(e.term===null||e.exited)){try{if(e.term.buffer.active.length<=e.term.rows)return}catch{return}e.term.reset(),Ne({t:"refresh",sid:e.sid})}}var qs=null;function zh(e){qs!==null&&clearTimeout(qs),qs=setTimeout(()=>{qs=null;let t=Pt();t!==void 0&&sm(t)},e??200)}var nm=["password","passphrase"];function _h(e){if(e===null||typeof e!="object"||e.t!=="ssh")return e;let t=e.credsStripped===!0,r={...e};for(let i of nm){let o=r[i];typeof o=="string"&&o!==""&&!o.startsWith("env:")&&(delete r[i],t=!0)}return t&&(r.credsStripped=!0),r}var Uh=1;function Kt(){try{let e=[...ie.values()].filter(t=>!t.exited&&t.embedded!==!0).map(t=>({sid:t.sid,spawnSpec:_h(t.spawnSpec),label:t.label}));e.length===0||ce===null?sessionStorage.removeItem(tn):sessionStorage.setItem(tn,JSON.stringify({v:Uh,tabs:e})),om([...ie.values()].filter(t=>t.embedded!==!0).map(t=>({spawnSpec:_h(t.spawnSpec),label:t.label})))}catch(e){console.warn("[dsh-tty] \u6807\u7B7E\u6301\u4E45\u5316\u5931\u8D25\uFF08\u672C\u6B21\u5237\u65B0\u540E\u6807\u7B7E\u5217\u8868\u53EF\u80FD\u4E22\u5931\uFF09: "+(e instanceof Error?e.message:String(e)))}}var zo="dsh-tty:persist-specs";function om(e){try{let t=e.filter(r=>as(r.spawnSpec)).map(r=>({spawnSpec:r.spawnSpec,label:r.label}));t.length===0?localStorage.removeItem(zo):localStorage.setItem(zo,JSON.stringify(t))}catch{}}function am(){try{let e=localStorage.getItem(zo);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&as(r.spawnSpec)):[]}catch{return[]}}function lm(){try{let e=sessionStorage.getItem(tn);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):t!==null&&typeof t=="object"&&t.v===Uh&&Array.isArray(t.tabs)?t.tabs.filter(r=>r!==null&&typeof r=="object"&&typeof r.sid=="string"&&r.sid!==""&&r.spawnSpec!==null&&typeof r.spawnSpec=="object"):[]}catch{return[]}}function an(e,t){let r=Be;return new Promise(i=>{let o=null,s=n=>{let a;try{a=JSON.parse(n.data)}catch{return}a.t===e&&(o!==null&&clearTimeout(o),r.removeEventListener("message",s),i(r===Be?a:null))};o=setTimeout(()=>{r.removeEventListener("message",s),i(null)},t),r.addEventListener("message",s)})}function cm(e){return e===void 0?null:e.embedded===!0?e.controller!==void 0&&e.controller!==null?e.controller.hostEl:null:e.termEl}function $h(e){if(e===void 0||e.fit===null||e.fit===void 0)return;let t;try{t=e.fit.proposeDimensions()}catch{return}let r=cm(e);return jc(t,r==null?null:{width:r.clientWidth,height:r.clientHeight})}function vi(e){if(e===void 0||e.fit===void 0)return;let t=$h(e);t!==void 0&&(e.lastDims=t,Ne({t:"resize",sid:e.sid,cols:t.cols,rows:t.rows}))}function hm(e){if(e===void 0||e.fit===void 0)return;let t=e.term,r=t!==null&&t.buffer!==void 0?t.buffer.active:null,i=r==null?null:{atBottom:r.viewportY>=r.baseY,line:r.viewportY};try{e.fit.fit()}catch{return}if(i!==null)try{i.atBottom?t.scrollToBottom():t.scrollToLine(Math.min(i.line,t.buffer.active.baseY))}catch{}e.exited||vi(e)}function ei(e,t,r,i){if(e.overlayEl===null||e.overlayEl===void 0)return;let o=e.overlayEl,s=i==="error"||i==="info"?i:"exited";if(s==="exited"&&e.embedded!==!0){o.textContent="";return}if(t===""||t===void 0){o.textContent="";return}o.innerHTML='<div class="tt_overlayCard" data-kind="'+s+'"><span class="tt_overlayIcon">'+(s==="error"?Ih:s==="info"?sa:J_)+'</span><span class="tt_overlayText"><span class="tt_overlayMain"></span>'+(r===void 0||r===""?"":'<span class="tt_overlayHint"></span>')+"</span></div>",o.querySelector(".tt_overlayMain").textContent=t,r!==void 0&&r!==""&&(o.querySelector(".tt_overlayHint").textContent=r)}function Ae(e,t=""){try{let r=getComputedStyle(document.body).getPropertyValue(e).trim();return r!==""?r:t}catch{return t}}function bi(e){let t=Ae("--tt-accent"),r={};r.background=Ae("--tt-term-bg"),r.foreground=Ae("--tt-term-fg"),r.cursor=t,r.cursorAccent=Ae("--tt-term-cursor-accent"),r.selectionBackground=Ae("--tt-term-selection"),r.black=Ae("--tt-an-black"),r.red=Ae("--tt-an-red"),r.green=Ae("--tt-an-green"),r.yellow=Ae("--tt-an-yellow"),r.blue=Ae("--tt-an-blue"),r.magenta=Ae("--tt-an-magenta"),r.cyan=Ae("--tt-an-cyan"),r.white=Ae("--tt-an-white"),r.brightBlack=Ae("--tt-an-bright-black"),r.brightRed=Ae("--tt-an-bright-red"),r.brightGreen=Ae("--tt-an-bright-green"),r.brightYellow=Ae("--tt-an-bright-yellow"),r.brightBlue=Ae("--tt-an-bright-blue"),r.brightMagenta=Ae("--tt-an-bright-magenta"),r.brightCyan=Ae("--tt-an-bright-cyan"),r.brightWhite=Ae("--tt-an-bright-white");let i=new Sh.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:r}),o=new Ch.FitAddon,s=new nl;i.loadAddon(o),i.loadAddon(s),i.loadAddon(new ol);let n=document.createElement("div");n.className="tt_term";let a=document.createElement("div");a.className="tt_overlay",a.addEventListener("click",()=>{a.textContent="",Ji(e.sid)}),a.setAttribute("role","button"),a.setAttribute("aria-label",g("btn.reopenSession")),a.tabIndex=0,a.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" "||u.key==="Spacebar")&&(u.preventDefault(),a.textContent="",Ji(e.sid))}),n.appendChild(a),i.open(n);try{o.fit()}catch{}try{let u=new Tc;u.onContextLoss(()=>{try{u.dispose()}catch{}}),i.loadAddon(u)}catch{}i.onData(u=>{Ne({t:"input",sid:e.sid,d:u}),yr.delete(e.sid)&&Fr()}),i.onResize(()=>{as(e.spawnSpec)&&zh(200)}),i.attachCustomKeyEventHandler(u=>e.embedded===!0?!0:(u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="f"?(u.preventDefault(),Ld(),!1):!0),e.term=i,e.fit=o,e.search=s,e.termEl=n,e.overlayEl=a}function mh(e){return e===null||typeof e!="object"?"":["t","name","host","port","username","command","cwd","persist","persistName","hidden"].map(r=>r+"="+String(e[r]??"")).join("\0")}function dm(e){let t=mh(e);if(t==="")return null;for(let r of ie.values())if(r.exited!==!0&&r.embedded!==!0&&mh(r.spawnSpec)===t)return r;return null}function Yi(e,t){let r=fn(),i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:e??hg(),label:t};return bi(i),ie.set(r,i),is+=1,ut(),lr(r,{user:!0}),bn(i),Kt(),i}function um(e){if(Array.isArray(e))for(let t of e){if(t===null||typeof t!="object"||t.owner!=="agent"||t.exited===!0)continue;let r=typeof t.sid=="string"?t.sid:"";if(r===""||ie.has(r))continue;let i={sid:r,term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,agentOwned:!0,spawnSpec:{t:"spawn",cwd:typeof t.cwd=="string"?t.cwd:jo()},label:"agent"+(t.kind==="ssh"&&typeof t.target=="string"&&t.target!==""?" \xB7 "+t.target:"")};bi(i),ie.set(r,i),is+=1,ut(),qh()&&i.termEl!==null&&it!==null&&xe===null&&lr(r),Ne({t:"attach",sid:r}),fm()}}function qh(){return ce!==null&&Xe!==!0}function fm(){try{Kt()}catch{}}function pm(e){if(um(e),!Array.isArray(e))return;for(let i of e){if(i===null||typeof i!="object"||i.owner!=="agent")continue;let o=typeof i.sid=="string"?ie.get(i.sid):void 0;o!==void 0&&o.embedded!==!0&&o.agentOwned!==!0&&(o.agentOwned=!0)}let t=$c(e),r=!1;for(let[i,o]of[...ie]){let s=qc(o,t);if(s!=="keep"){if(s==="mark-exited"){o.exited!==!0&&(o.exited=!0,o.live=!1,r=!0);continue}_m(o)||Gt(i,{silent:!0})}}r&&(ut(),Sn())}function _m(e){return!qh()||e.watched!==!0||e.sid!==xe?!1:(e.releasePending===!0||(e.releasePending=!0,ns()),!0)}function mm(e){if(ie.has(e.sid))return ie.get(e.sid);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};bi(t),ie.set(t.sid,t),is+=1,ut(),lr(t.sid),Ne({t:"attach",sid:t.sid})}function gm(e){if(!(e?.spawnSpec?.credsStripped!==!0||e.term===null))try{e.term.writeln("\x1B[2m[dsh-tty] "+g("msg.passwordNotStored")+"\x1B[0m")}catch{}}function bn(e){gm(e);let t=$h(e);t!==void 0&&(e.lastDims=t);let r=t!==void 0?t:e.lastDims!==void 0?e.lastDims:{cols:80,rows:24},i={...e.spawnSpec,sid:e.sid,cols:r.cols,rows:r.rows};if(Be===null||Be.readyState!==WebSocket.OPEN){No.add({tab:e,frame:i});return}Ne(i)}function vm(e,t){let r=ie.get(e);if(r===void 0||r.embedded===!0||t===!0&&!To(r))return;let i=t===!0;xr(r.spawnSpec)!==i&&(r.spawnSpec=Mo(r.spawnSpec,i),Ne({t:"hidden",sid:e,hidden:i}),Kt(),ut(),pi())}var bm="\u{1F648}";function Kh(e){let t=ie.get(e),r=t===void 0?"":t.label||g("panel.tabLabel",{n:wn(e)});return t===void 0||!xr(t.spawnSpec)?r:`${bm} ${r}`}function gh(e){let t={sid:fn(),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};bi(t),ie.set(t.sid,t),is+=1,ut(),lr(t.sid),bn(t)}function Ji(e){let t=ie.get(e);if(t===void 0)return;if(t.embedded===!0){Jh(t);return}let r=t.spawnSpec,i=t.label;if(Ne({t:"kill",sid:e}),t.term!==null)try{t.term.dispose()}catch{}t.termEl!==null&&t.termEl.remove(),ie.delete(e);let o={sid:fn(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,spawnSpec:r,label:i};bi(o),ie.set(o.sid,o),ut(),lr(o.sid,{user:!0}),bn(o),Kt()}function Gt(e,t){let r=ie.get(e);if(r===void 0)return;let i=t?.silent===!0;if(Dt!==null&&Dt.ownerKey===e&&zi(!0),i||Ne({t:"kill",sid:e}),ie.delete(e),or(),Ir===e&&Bt(),yr.delete(e),Fr(),rs.delete(e),r.term!==null)try{r.term.dispose()}catch{}if(r.termEl!==null&&r.termEl.remove(),xe===e){xe=null;let o=[...ie.entries()].filter(([,s])=>s.embedded!==!0).map(([s])=>s).pop()??null;o!==null&&lr(o)}ut(),la(),ns(),gi(),rt!==null&&Sn(),[...ie.values()].some(o=>o.embedded!==!0)?Kt():Qi()}function Gh(e){let t=typeof e?.command=="string"?e.command.trim():"";if(t==="")throw new Error(g("error.terminalNeedsCommand"));if(/[\r\n\0]/.test(t))throw new Error(g("error.terminalCommandSingleLine"));return t}function Vh(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 wm(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&&vi(e)}}),t.observer.observe(t.hostEl))}function Yh(e,t,r){let i={sid:fn(),term:null,fit:null,search:null,termEl:null,overlayEl:null,exited:!1,spawned:!1,embedded:!0,controller:e,spawnSpec:t,label:r};return bi(i),ie.set(i.sid,i),rs.add(i.sid),e.hostEl.appendChild(i.termEl),wm(i),bn(i),i}function Jh(e){let t=e.controller;if(!(t===void 0||t.disposed)){e.exited||Ne({t:"kill",sid:e.sid});try{e.term?.dispose()}catch{}return e.termEl?.remove(),ie.delete(e.sid),rs.delete(e.sid),t.observer!==null&&(t.observer.disconnect(),t.observer=null),t.tab=Yh(t,e.spawnSpec,e.label),xe===e.sid&&(xe=t.tab.sid,la()),t.tab}}function ym(e,t){if(!(e instanceof HTMLElement))throw new Error(g("error.terminalNeedsHost"));let r=Gh(t),i=Vh(t,r),o=typeof t?.label=="string"&&t.label!==""?t.label:void 0;es();let s={hostEl:e,tab:null,observer:null,disposed:!1};return s.tab=Yh(s,i,o),ug(),()=>Sm(s)}function Sm(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||Ne({t:"kill",sid:t.sid});try{t.term?.dispose()}catch{}t.termEl?.remove(),ie.delete(t.sid),rs.delete(t.sid),e.tab=null}if(ce===null&&!aa()&&Be!==null){Ki=!0;try{Be.close()}catch{}Be=null}}var Cm=460,xm=280,km=320,Em=160,Dt=null,ti=Cm,ri=km;function ca(){let e=ce!==null?ce.querySelector(".tt_modal"):null,t=e!==null?e:ce;return t!==null?t.getBoundingClientRect():null}var ha=e=>e==="bottom"?Em:xm;function Lm(e){let t=ca();if(t===null)return 900;let r=e==="bottom"?t.height:t.width;return Math.max(ha(e),Math.round(r*.72))}function ji(e,t){return Math.min(Lm(e),Math.max(ha(e),Math.round(t)))}function Gs(){let e=Dt;if(e!==null){if(e.collapsed){e.el.style.width="",e.el.style.height="",e.el.style.flexBasis="";return}if(e.side==="bottom"){ri=ji("bottom",ri),e.el.style.width="",e.el.style.height=String(ri)+"px",e.el.style.flexBasis=String(ri)+"px";return}ti=ji("right",ti),e.el.style.height="",e.el.style.width=String(ti)+"px",e.el.style.flexBasis=String(ti)+"px"}}function zi(e){let t=Dt;if(t!==null){if(Dt=null,t.disposed=!0,e&&t.onClose!==null)try{t.onClose()}catch(r){console.warn("[dsh-tty] ttyPanel.onClose \u629B\u9519\uFF1A"+(r instanceof Error?r.message:String(r)))}try{t.el.remove()}catch{}kt!==null&&delete kt.dataset.side}}function Xh(e){if(ea(),kt===null)throw new Error(g("error.panelNotReady"));Dt!==null&&zi(!0),es();let t=Qr(e?.ownerSid,xe),r=e?.side==="bottom"?"bottom":"right",i=Math.max(r==="bottom"?120:200,Math.round(typeof e?.min=="number"&&Number.isFinite(e.min)?e.min:ha(r)));if(typeof e?.size=="number"&&Number.isFinite(e.size)){let c=ji(r,e.size);r==="bottom"?ri=c:ti=c}let o=document.createElement("div");o.className="tt_dockPane",o.dataset.side=r,kt.dataset.side=r,o.innerHTML='<div class="tt_dockPaneResize" title="'+g(r==="bottom"?"panel.dragHeight":"panel.dragWidth")+'"></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="'+g("btn.closePane")+'">'+_n+'</button></div><div class="tt_dockPaneBody"></div>',kt.appendChild(o);let s=o.querySelector(".tt_dockPaneTitle"),n=o.querySelector(".tt_dockPaneHint"),a=o.querySelector(".tt_dockPaneBody"),u=o.querySelector(".tt_dockPaneFold"),l=o.querySelector(".tt_dockPaneClose"),d=o.querySelector(".tt_dockPaneResize"),m={el:o,element:a,disposed:!1,collapsed:!1,side:r,minSize:i,ownerKey:t,onClose:typeof e?.onClose=="function"?e.onClose:null},y=()=>r==="bottom"?m.collapsed?ra:q_:m.collapsed?oa:na,_=c=>{m.collapsed=c===!0,m.collapsed?o.dataset.collapsed="1":delete o.dataset.collapsed,u.innerHTML=y(),u.title=m.collapsed?g("btn.expandPane"):g("btn.collapsePane"),u.setAttribute("aria-label",u.title),Gs()};return m.setTitle=c=>{s.textContent=typeof c=="string"?c:""},m.setHint=c=>{n.textContent=typeof c=="string"?c:""},m.isCollapsed=()=>m.collapsed===!0,m.collapse=()=>_(!0),m.expand=()=>_(!1),m.toggle=()=>_(!m.collapsed),m.dispose=()=>{m.disposed||Dt!==m||zi(!1)},d.addEventListener("mousedown",c=>{if(c.button!==0||m.collapsed)return;c.preventDefault();let f=c.clientX,h=c.clientY,p=o.getBoundingClientRect(),v=b=>{r==="bottom"?ri=ji("bottom",Math.max(i,p.height+(h-b.clientY))):ti=ji("right",Math.max(i,p.width+(f-b.clientX))),Gs()},S=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S),document.body.style.userSelect=""};document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)}),d.addEventListener("dblclick",()=>_(!m.collapsed)),u.addEventListener("click",()=>_(!m.collapsed)),l.addEventListener("click",()=>zi(!0)),m.setTitle(typeof e?.title=="string"?e.title:""),m.setHint(typeof e?.hint=="string"?e.hint:""),_(e?.collapsed===!0),Dt=m,Gs(),Zh(),m}function Zh(){let e=Dt;if(e!==null){if(ko(e.ownerKey,xe)){delete e.el.dataset.dockHidden,kt!==null&&(kt.dataset.side=e.side);return}e.el.dataset.dockHidden="1",kt!==null&&delete kt.dataset.side}}function lr(e,t){let r=ie.get(e);if(r===void 0||r.embedded===!0)return;t?.user===!0&&(r.watched=!0);let i=xe!==null?ie.get(xe):void 0;if(!(i!==void 0&&i.releasePending===!0&&i.sid!==e&&ie.size>1&&(Gt(i.sid,{silent:!0}),ie.get(e)===void 0))){xe=e,Bt(),Fr();for(let[o,s]of ie)s.embedded!==!0&&s.termEl!==null&&(s.termEl.style.display=o===e?"":"none");r.embedded!==!0&&it!==null&&r.termEl!==null&&r.termEl.parentElement!==it&&it.appendChild(r.termEl),ss(),Nr(),ut(),Dr(),Zh();try{r.fit.fit()}catch{}r.spawned&&!r.exited&&vi(r),ei(r,""),ns(),la()}}function Bo(e){if(Te===null)return;let t=ie.get(e);if(t===void 0)return;let i=Te.querySelector(`[data-sid="${e}"]`)?.querySelector(".tt_tabDot");if(i==null)return;i.dataset.state=ln(t);let o=pt===null?null:pt.querySelector('[data-sid="'+e+'"] .tt_tabDot');o!==null&&(o.dataset.state=ln(t))}var Oo=!1;function ut(){if(Te===null)return;if(Te.querySelector(".tt_tabRename")!==null){Oo||(Oo=!0,setTimeout(()=>{Oo=!1,ut()},1e3));return}Te.textContent="";for(let[t,r]of ie){if(r.embedded===!0)continue;let i=document.createElement("button");i.className="tt_tab",i.dataset.sid=t,t===xe&&(i.dataset.active="");let o=document.createElement("span");o.className="tt_tabDot",o.dataset.state=ln(r),i.appendChild(o);let s=document.createElement("span");s.className="tt_tabLabel",s.textContent=Kh(t),s.addEventListener("dblclick",a=>{a.stopPropagation(),Am(t,i)});let n=document.createElement("span");n.className="tt_tabClose",n.title=g("btn.close"),n.innerHTML=ts,n.setAttribute("role","button"),n.setAttribute("aria-label",g("btn.closeTabAria",{label:r.label||""})),n.tabIndex=0,n.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" "||a.key==="Spacebar")&&(a.preventDefault(),a.stopPropagation(),Gt(t))}),i.title=xr(r.spawnSpec)?`${s.textContent} \u2014 ${g("btn.hiddenMark")}`:s.textContent,i.appendChild(s),i.appendChild(n),i.addEventListener("click",a=>{if(a.target.closest(".tt_tabClose")!==null){a.stopPropagation(),Gt(t);return}lr(t,{user:!0})}),Te.appendChild(i)}let e=Te.querySelector("[data-active]");e!==null&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest",inline:"nearest"}),pi(),pt!==null&&ie.size===0&&Lt()}function pi(){if(Te===null)return;let e=Te.scrollWidth-Te.clientWidth,t=e>1,r=Vc(dd()),i=t||md().length>0||r>=2;if(zt!==null&&(zt.hidden=!i,i?zt.title=g("btn.tabListTitle",{n:String(r)}):pt!==null&&Lt()),!t){delete Te.dataset.edge,pt!==null&&Vo();return}let o=Te.scrollLeft>1,s=Te.scrollLeft<e-1;Te.dataset.edge=o&&s?"both":s?"end":"start",pt!==null&&Vo()}function ln(e){return e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting"}function Tm(e){if(Te===null||Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let t=Te.scrollWidth-Te.clientWidth;if(t<=1)return;let r=Math.max(0,Math.min(t,Te.scrollLeft+e.deltaY));r!==Te.scrollLeft&&(e.preventDefault(),Te.scrollLeft=r)}function Mm(e){return e?.direction==="remote"?g("meta.tunnelRemote",{host:e.remoteHost||"127.0.0.1",port:String(e.remotePort??0),local:String(e.localTargetPort??0)}):g("meta.tunnelLocal",{local:String(e?.localPort??0),host:e?.remoteHost??"?",port:String(e?.remotePort??0)})}function Dr(){if(Oi===null||Qs===null||Ni===null||Ii===null)return;Ni.textContent="";let e=Pt(),t=e?.spawnSpec??{};if(e===void 0||t.t!=="ssh"){Oi.dataset.hidden="";return}delete Oi.dataset.hidden;let r=Number(t.port);Qs.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(r)&&r!==22?":"+r:""),Ct!==null&&(e.persistTmux===!0?(Ct.textContent="tmux",Ct.dataset.state="ok",Ct.title=g("status.tmuxPersistedTitle")):t.persist===!0&&e.spawned===!0?(Ct.textContent=g("status.notPersisted"),Ct.dataset.state="warn",Ct.title=g("status.tmuxUnavailableTitle")):(Ct.textContent="",delete Ct.dataset.state,Ct.removeAttribute("title")));let i=e.exited?"exited":e.live===!0?"connected":e.errored===!0?"error":"connecting";Ii.dataset.state=i,Ii.title=g(i==="connected"?"status.connected":i==="connecting"?"status.connecting":i==="error"?"status.errored":"status.exited");let o=(n,a,u,l)=>{let d=document.createElement("button");d.type="button",d.className="tt_toolBtn tt_connAct",d.title=u,d.innerHTML=n+"<span></span>",d.lastElementChild.textContent=a,d.addEventListener("click",l),Ni.appendChild(d)};if(typeof t.command=="string"&&t.command!=="")return;let s=typeof t.name=="string"?t.name:"";for(let n of Wo)try{n({tab:e,spec:t,bookName:s,addAction:o})}catch(a){console.warn("[dsh-tty] connbar action failed: "+(a instanceof Error?a.message:String(a)))}}function Rm(e,t){if(li!==null){Vs();return}let r=document.createElement("div");r.className="tt_addMenu tt_connMore",li=r,Hr(r,g("panel.tunnels"),g("hint.tunnelsSettings"),()=>{Vs(),Qh(e,t)},void 0,Rh),document.body.appendChild(r);let i=e.getBoundingClientRect(),o=r.offsetWidth,n=i.left+o>window.innerWidth-8?i.right-o:i.left;r.style.left=Math.max(8,Math.min(n,window.innerWidth-o-8))+"px",r.style.top=i.bottom+6+"px";let a=u=>{li===r&&(r.contains(u.target)||e.contains(u.target)||Vs())};Js=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0)}function Vs(){Js!==null&&(document.removeEventListener("mousedown",Js,!0),Js=null),li!==null&&(li.remove(),li=null)}var Er=null,Ys=null,li=null,Js=null;function cn(){Ys!==null&&(document.removeEventListener("mousedown",Ys,!0),Ys=null),Er!==null&&(Er.remove(),Er=null)}function Qh(e,t){if(Er!==null){cn();return}let r=document.createElement("div");r.className="tt_tunnelPop";let i=document.createElement("div");i.className="tt_tunnelPopTitle",i.textContent=g("panel.tunnelsFor",{name:t}),r.appendChild(i);let o=document.createElement("div");o.textContent=g("list.loading"),r.appendChild(o);let s=document.createElement("span");s.className="tt_cardHint",s.textContent=g("hint.tunnelsCard"),r.appendChild(s),document.body.appendChild(r),Er=r;let n=e.getBoundingClientRect();r.style.top=String(n.bottom+6)+"px",r.style.left=String(Math.max(8,n.right-340))+"px";let a=u=>{Er===r&&(r.contains(u.target)||e.contains(u.target)||cn())};Ys=a,setTimeout(()=>document.addEventListener("mousedown",a,!0),0),(async()=>{let u=[];try{let m=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();m.ok&&Array.isArray(m.tunnels)&&(u=m.tunnels)}catch{}if(Er!==r)return;o.textContent="";let l=da.filter(d=>d?.bookName===t&&d?.enabled!==!1);if(l.length===0){let d=document.createElement("span");d.className="tt_cardHint",d.textContent=g("list.noActiveTunnels"),o.appendChild(d);return}for(let d of l){let m=u.find(h=>h?.name===d?.name),y=m?.state??"stopped",_=document.createElement("div");_.className="tt_tunnelPopRow";let c=document.createElement("span");c.className="tt_connDot",c.dataset.state=y==="active"?"connected":y==="error"?"error":"connecting";let f=document.createElement("span");f.className="tt_connTarget",f.title=String(m?.error??m?.lastForwardError??""),f.textContent=Mm(d)+" \xB7 "+y+(m?.fatal===!0?g("status.fatalSuffix"):""),_.appendChild(c),_.appendChild(f),o.appendChild(_)}})()}function wn(e){let t=1;for(let r of ie.keys()){if(r===e)return String(t);t+=1}return String(t)}function Am(e,t){let r=ie.get(e);if(r===void 0||t.querySelector(".tt_tabRename")!==null)return;let i=t.querySelector(".tt_tabLabel");if(i===null)return;let o=document.createElement("input");o.className="tt_tabRename",o.value=r.label||g("panel.tabLabel",{n:wn(e)}),i.replaceWith(o),o.focus(),o.select();let s=!1,n=()=>{if(s)return;s=!0;let u=o.value.trim();r.label=u!==""?u:void 0,ut(),Kt()},a=()=>{s||(s=!0,ut())};o.addEventListener("keydown",u=>{u.stopPropagation(),u.key==="Enter"?n():u.key==="Escape"&&a()}),o.addEventListener("blur",n),o.addEventListener("click",u=>u.stopPropagation())}var da=[],ed="dialog",wr="off",sr={maxDownloadMb:1024,maxUploadMb:2048,maxUploadFiles:1e3},td="dsh-tty:show-hidden",Lr=(()=>{try{return localStorage.getItem(td)==="1"}catch{return!1}})();function Dm(e){Lr=e===!0;try{localStorage.setItem(td,Lr?"1":"0")}catch{}for(let t of Uo)try{t(Lr)}catch{}}var Uo=new Set,$o=null,ci=null,rd=!1,id=!1,br=null,hn=null,Pr=!1;function sd(e){Pr=e,hn!==null&&hn.set(e)}function Pm(e){sd(!(e!==null&&typeof e=="object"&&e.enabled===!1)),e!==null&&typeof e=="object"&&typeof e.statsEnabled=="boolean"&&e.statsEnabled!==nn&&(nn=e.statsEnabled,ss(),Nr())}function Xi(e){Pm(e),e!==null&&typeof e=="object"&&Array.isArray(e.sshHosts)&&(nr=e.sshHosts),e!==null&&typeof e=="object"&&Array.isArray(e.tunnels)&&(da=e.tunnels),e!==null&&typeof e=="object"&&(e.sftpStyle==="dual"||e.sftpStyle==="dialog")&&(ed=e.sftpStyle),e!==null&&typeof e=="object"&&(e.persistence==="tmux"||e.persistence==="off")&&(wr=e.persistence),e!==null&&typeof e=="object"&&typeof e.sftpLimits=="object"&&e.sftpLimits!==null&&(sr={...sr,...e.sftpLimits}),e!==null&&typeof e=="object"&&Number.isInteger(e.maxSessions)&&e.maxSessions>=1&&(ci=e.maxSessions),e!==null&&typeof e=="object"&&typeof e.allowProxyCommand=="boolean"&&(rd=e.allowProxyCommand),e!==null&&typeof e=="object"&&typeof e.assistEnabled=="boolean"&&(rn=e.assistEnabled,rn||Bt(),Fr()),e!==null&&typeof e=="object"&&typeof e.allowProxyCommandGranted=="boolean"&&(id=e.allowProxyCommandGranted)}function Bm(e,t){let r=t==="error"||t==="info"?t:"warn",i=document.createElement("div");i.className="tt_toast",i.dataset.kind=r,i.innerHTML='<span class="tt_toastIcon">'+(r==="error"?Ih:r==="info"?Y_:V_)+'</span><span class="tt_toastText"></span>',i.lastElementChild.textContent=e,document.body.appendChild(i),setTimeout(()=>i.remove(),4e3)}async function nd(){try{Ne({t:"sessions"});let e=await an("sessions",3e3);if(e!==null&&Array.isArray(e.list))return br=Uc(e.list),br}catch{}return null}async function dn(){if(await nd(),ci===null||br===null||br<ci)return null;let e=[...ie.values()].filter(o=>!o.exited).length,t=Math.max(0,br-e),r=t>0?g("msg.maxSessionsOthers",{count:t}):"",i=g("msg.maxSessions",{live:br,max:ci,own:e,others:r});return Bm(i),i}function Om(){return ci!==null&&br!==null&&br>=ci}function ua(){return Math.random().toString(36).slice(2,10)+Date.now().toString(36).slice(-4)}function od(e){return da.filter(t=>t?.bookName===e&&t?.enabled!==!1).length}function qo(e){let t=Number(e?.port),r=Number.isInteger(t)&&t!==22?":"+t:"",i=e?.auth==="key"?"key":e?.auth==="password"?"password":"agent",o=e?.agentForward===!0?" \xB7 fwd":"";return String(e?.username??"")+"@"+String(e?.host??"")+r+" \xB7 "+i+o}async function Ko(e,t){let r=await fetch("/api/dsh-tty/probe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,bookRecord:t===!0})}),i=await r.json().catch(()=>({}));return i&&i.ok===!1&&i.error?{error:String(i.error)}:i&&i.result?{result:i.result}:{error:String(i&&i.error?i.error:g("error.probeHttp",{status:r.status}))}}function Go(e,t){if(!e)return g("msg.probing");let r=e,i=typeof r.tcp?.ms=="number"?r.tcp.ms:null,o=typeof r.auth?.ms=="number"?r.auth.ms:null,s=[];if(r.jump!==null&&typeof r.jump=="object"&&typeof r.jump.label=="string"&&r.jump.label!==""){let d=typeof r.jump.tcp?.ms=="number"?r.jump.tcp.ms:null,m=r.jump.tcp?.ok?d!==null?d+"ms":g("meta.reachable"):g("meta.unreachable");s.push(g("meta.jumpStage",{label:r.jump.label})+" "+m)}r.proxy!==null&&typeof r.proxy=="object"&&s.push(r.proxy.active===!0?g("meta.probeProxy"):g("meta.probeProxyOff")),r.tcp?.ok?s.push("TCP "+(i!==null?i+"ms":g("meta.reachable"))):r.tcp?.skipped===!0&&s.push(g("meta.probeTcpSkipped")),r.banner?.ok&&s.push(g("meta.probeBanner"));let n=r.hostkey?.state;if(n==="matched"?s.push(g("meta.hostKeyMatched")):n==="recorded"?s.push(g("meta.hostKeyRecorded")):n==="mismatch"&&s.push(g("meta.hostKeyMismatch")),r.auth?.ok){let d=o!==null?g("meta.authOkMs",{ms:o}):g("meta.authOk");return g("meta.probeOk",{detail:d+(s.length?" \xB7 "+s.join(" \xB7 "):"")})}let a=r.tcp?.skipped===!0?"":r.tcp?.error,l=(r.auth?.error||a||g("error.unknown"))+(s.length?" \xB7 "+s.join(" \xB7 "):"");return t?.prefix!==void 0?t.prefix+l:g("error.probeFailed",{detail:l})}async function fa(){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 r=nr;Xi(t.config),Et!==null&&nr!==r&&Zo(Et)}}catch{}}function ad(e){Et!==null&&(e.target instanceof Element&&(Et.contains(e.target)||e.target.closest(".tt_tabAdd")!==null)||xt())}function os(e,t){ld(e,t.getBoundingClientRect())}function ld(e,t){let r=e.offsetWidth,i=e.offsetHeight,s=t.left+r>window.innerWidth-8?t.right-r:t.left;e.style.left=Math.max(8,Math.min(s,window.innerWidth-r-8))+"px";let n=t.bottom+6,a=t.top-i-6;e.style.top=(n+i>window.innerHeight-8&&a>=8?a:Math.min(n,Math.max(8,window.innerHeight-i-8)))+"px"}function Im(e){if(Et!==null){xt();return}Lt(),fa(),nd().then(()=>{Et!==null&&Zo(Et)});let t=document.createElement("div");t.className="tt_addMenu",Et=t,Zo(t),document.body.appendChild(t),os(t,e),document.addEventListener("mousedown",ad,!0)}function xt(){Et!==null&&(document.removeEventListener("mousedown",ad,!0),Et.remove(),Et=null)}function Nm(e){if(pt!==null){Lt();return}xt();let t=document.createElement("div");t.className="tt_addMenu tt_tabMenu",pt=t,Vo(),document.body.appendChild(t),os(t,e),document.addEventListener("mousedown",cd,!0),document.addEventListener("keydown",hd,!0)}function Lt(){pt!==null&&(document.removeEventListener("mousedown",cd,!0),document.removeEventListener("keydown",hd,!0),pt.remove(),pt=null)}function cd(e){pt!==null&&(e.target instanceof Element&&(pt.contains(e.target)||e.target.closest(".tt_tabMore")!==null)||Lt())}function hd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Lt())}function Vo(){let e=pt;if(e===null)return;e.textContent="";let t=qm();if(t.length===0){let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=g("list.tabsAllVisible"),e.appendChild(i),Yo(e,xe),Jo(e);return}for(let[i,o]of t){let s=Kh(i)||o.label||g("panel.tabLabel",{n:wn(i)}),n=Km(o),a=document.createElement("div");a.className="tt_addMenuRow tt_tabMenuRow",a.dataset.sid=i;let u=document.createElement("button");u.type="button",u.className="tt_addMenuItem tt_tabMenuItem",i===xe&&(u.dataset.active="");let l=document.createElement("span");l.className="tt_tabDot",l.dataset.state=ln(o),u.appendChild(l);let d=document.createElement("span");d.className="tt_addMenuText tt_tabMenuText";let m=document.createElement("span");if(m.className="tt_addMenuMain",m.textContent=s,d.appendChild(m),n!==""){let _=document.createElement("span");_.className="tt_tabMenuMeta",_.textContent=n,d.appendChild(_)}u.appendChild(d),u.title=n===""?s:s+" \xB7 "+n,u.addEventListener("click",()=>{lr(i,{user:!0}),Lt()}),a.appendChild(u);let y=document.createElement("button");y.type="button",y.className="tt_addMenuEdit",y.innerHTML=ts,y.title=g("btn.close"),y.setAttribute("aria-label",g("btn.closeTabAria",{label:s})),y.addEventListener("click",()=>{Gt(i)}),a.appendChild(y),e.appendChild(a)}let r=e.querySelector(".tt_tabMenuItem[data-active]");r!==null&&typeof r.scrollIntoView=="function"&&r.scrollIntoView({block:"nearest"}),Yo(e,xe),Jo(e)}function dd(){return[...ie].map(([e,t])=>({sid:e,embedded:t.embedded===!0,exited:t.exited===!0,agentOwned:t.agentOwned===!0}))}function Yo(e,t){let r=Yc(dd(),t),i=[[g("btn.closeOthers",{n:String(r.others.sids.length)}),r.others,Tr],[g("btn.closeLeft",{n:String(r.left.sids.length)}),r.left,oa],[g("btn.closeRight",{n:String(r.right.sids.length)}),r.right,na]].filter(([,s])=>s.sids.length>0);if(i.length===0)return;let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o);for(let[s,n,a]of i)Hr(e,s,n.live>0?g("list.subLive",{n:String(n.live)}):"",()=>{Hm(n)},void 0,a)}function Hm(e){if(or(),Lt(),e.sids.length===0)return;let t=e.sids.slice(),r=()=>{for(let i of t)Gt(i)};if(e.confirm!==!0){r();return}Ad({title:g("confirm.tabsTitle",{n:String(e.live)}),text:e.agentLive>0?g("confirm.tabsTextAgent",{n:String(e.live),agent:String(e.agentLive)}):g("confirm.tabsText",{n:String(e.live)}),hint:g("confirm.tabsHint"),okLabel:g("confirm.tabsOk",{n:String(e.live)}),onOk:r})}var hi=null,ud=null;function Fm(e,t,r){if(ie.get(e)===void 0)return;or(),xt(),Lt();let i=document.createElement("div");i.className="tt_addMenu tt_tabCtxMenu",hi=i,ud=e,Wm(i,e),document.body.appendChild(i),ld(i,{left:t,right:t,top:r,bottom:r}),document.addEventListener("mousedown",fd,!0),document.addEventListener("keydown",pd,!0)}function or(){hi!==null&&(document.removeEventListener("mousedown",fd,!0),document.removeEventListener("keydown",pd,!0),hi.remove(),hi=null,ud=null)}function fd(e){hi!==null&&(e.target instanceof Element&&hi.contains(e.target)||or())}function pd(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),or())}function Wm(e,t){let r=ie.get(t);if(r===void 0)return;let i=r.label||g("panel.tabLabel",{n:wn(t)});if(Hr(e,g("btn.closeTab"),i,()=>{or(),Gt(t)},void 0,ts),To(r)){let o=xr(r.spawnSpec);Hr(e,g(Jc(o)),i,()=>{or(),vm(t,!o)},void 0,o?z_:j_)}Yo(e,t),Jo(e)}function jm(e){let t=_d(e.target);if(t===null)return;e.preventDefault();let r=e.clientX,i=e.clientY;if(r===0&&i===0){let o=e.target instanceof Element?e.target.closest(".tt_tab"):null;if(o!==null){let s=o.getBoundingClientRect();r=s.left,i=s.bottom}}Fm(t,r,i)}function zm(e){if(e.button!==1)return;let t=_d(e.target);t!==null&&(e.preventDefault(),Gt(t))}function _d(e){if(!(e instanceof Element))return null;let t=e.closest(".tt_tab");if(t===null)return null;let r=t.dataset.sid;return r===void 0||r===""||!ie.has(r)?null:r}function md(){return[...ie.values()].filter(e=>e.embedded!==!0&&e.exited===!0)}function Jo(e){let t=md();if(t.length===0)return;let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r),Hr(e,g("list.cleanExited",{n:String(t.length)}),"",()=>{Lt(),or();for(let i of t)Gt(i.sid)},void 0,Mh)}var Um=40;function $m(e,t){let r=e.getBoundingClientRect();return Math.max(0,Math.min(r.right,t.right)-Math.max(r.left,t.left))}function qm(){let e=[];if(Te===null)return e;let t=Te.getBoundingClientRect();for(let[r,i]of ie){if(i.embedded===!0)continue;let o=Te.querySelector('[data-sid="'+r+'"]');o!==null&&$m(o,t)<Um&&e.push([r,i])}return e}function Km(e){return typeof e.target=="string"?e.target:""}function Gm(){return g("panel.assistTitle")===Xs["panel.assistTitle"]?"zh":"en"}function Vm(e){let t=e!=null&&typeof e.exitCode=="number"?String(e.exitCode):"?";return g("badge.assistFailed",{code:t})}function Fr(){if(gr===null)return;let e=xe===null?void 0:yr.get(xe),t=rn&&e!==void 0&&e.dismissed!==!0;if(gr.hidden=!t,t){let r=gr.querySelector(".tt_assistBadgeText");r!==null&&(r.textContent=Vm(e))}}function Bt(){ni!==null&&(ni.abort(),ni=null),Ar!==null&&(Ar.remove(),Ar=null),Ir=null,sn=null}function Ym(e){Ar!==null&&(e.target instanceof Element&&(Ar.contains(e.target)||e.target.closest(".tt_assistBadge")!==null)||Bt())}function Jm(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Bt())}function Xm(e){let t=xe;if(t===null)return;Bt();let r=document.createElement("div");r.className="tt_addMenu tt_assistMenu",Ar=r,Ir=t,sn=e,document.body.appendChild(r),document.addEventListener("mousedown",Ym,!0),document.addEventListener("keydown",Jm,!0),Xo(),os(r,e),Zm(t)}async function Zm(e){let t=yr.get(e);if(t===void 0||t.busy===!0||(t.error===null||t.error===void 0)&&t.answer!==null&&t.answer!==void 0)return;t.busy=!0,t.answer=null,t.command="",t.error=null,Xo();let r=new AbortController;ni=r;try{let i=await fetch("/api/dsh-tty/assist",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({sid:e,kind:"failure",lang:Gm()}),signal:r.signal}),o=await i.json().catch(()=>null);if(Ir!==e)return;t.busy=!1,i.ok&&o!==null&&o.ok===!0?(t.answer=String(o.answer!==void 0?o.answer:""),t.command=String(o.command!==void 0?o.command:"")):t.error=o!==null&&o.error!==void 0?String(o.error):"HTTP "+String(i.status)}catch(i){if(r.signal.aborted||Ir!==e)return;t.busy=!1,t.error=i instanceof Error?i.message:String(i)}finally{ni===r&&(ni=null),t.busy=!1,Xo()}}function Xo(){let e=Ar;if(e===null)return;let t=Ir,r=t===null?void 0:yr.get(t);e.textContent="";let i=document.createElement("div");i.className="tt_assistHead";let o=document.createElement("span");if(o.className="tt_assistTitle",o.textContent=g("panel.assistTitle"),i.appendChild(o),r!==void 0&&typeof r.exitCode=="number"){let m=document.createElement("span");m.className="tt_assistCode",m.textContent="exit="+String(r.exitCode),i.appendChild(m)}e.appendChild(i);let s=r!==void 0&&typeof r.error=="string"&&r.error!=="",n=document.createElement("div");if(n.className="tt_assistBody",r===void 0||r.busy===!0){n.classList.add("tt_assistMuted","tt_assistBusy");let m=document.createElement("span");m.className="tt_assistSpin",n.appendChild(m),n.appendChild(document.createTextNode(g("status.assistThinking")))}else if(s)n.textContent=g("error.assistRequest",{message:r.error}),n.classList.add("tt_assistError");else{let m=r.answer!==null&&r.answer!==void 0?r.answer:"";n.textContent=m,n.classList.add("tt_assistAnswer"),m===""&&(n.hidden=!0)}if(e.appendChild(n),r===void 0||r.busy===!0)return;let a=r.command!=="";if(a){let m=document.createElement("div");m.className="tt_assistCmdWrap";let y=document.createElement("span");y.className="tt_assistCmdLabel",y.textContent=g("panel.assistCommand"),m.appendChild(y);let _=document.createElement("div");_.className="tt_assistCmd",_.textContent=r.command,m.appendChild(_),e.appendChild(m)}let u=document.createElement("div");if(u.className="tt_assistFoot",a){let m=document.createElement("button");m.type="button",m.className="tt_toolBtn tt_assistFill",m.textContent=g("btn.assistFill"),m.title=g("hint.assistFillNoEnter"),m.addEventListener("click",Qm),u.appendChild(m)}let l=document.createElement("button");l.type="button",l.className="tt_toolBtn",l.textContent=g(s?"btn.assistCopyError":"btn.assistCopy"),l.addEventListener("click",()=>{if(s){wh(g("error.assistRequest",{message:r.error}));return}wh(r.answer!==null&&r.answer!==void 0?r.answer:"")}),u.appendChild(l);let d=document.createElement("button");if(d.type="button",d.className="tt_toolBtn tt_assistClose",d.textContent=g("btn.assistClose"),d.addEventListener("click",()=>{Bt()}),u.appendChild(d),e.appendChild(u),!s){let m=document.createElement("span");m.className="tt_assistNote",m.textContent=g(a?"hint.assistFillNoEnter":"hint.assistNoCommand"),e.appendChild(m)}sn!==null&&os(e,sn)}function Qm(){let e=Ir,t=e===null?void 0:yr.get(e);if(e===null||t===void 0||t.command==="")return;Ne({t:"input",sid:e,d:""+t.command});let r=ie.get(e);Bt(),eg(e),r!==void 0&&r.term!==null&&r.term.focus()}function eg(e){let t=yr.get(e);t!==void 0&&(t.dismissed=!0),Fr()}function Hr(e,t,r,i,o,s){let n=document.createElement("button");if(n.type="button",n.className="tt_addMenuItem",o===!0&&(n.setAttribute("data-soldout",""),n.title=g("btn.maxSessionsTitle")),s!==void 0){let l=document.createElement("span");l.className="tt_addMenuIcon",l.innerHTML=s,n.appendChild(l)}let a=document.createElement("span");a.className="tt_addMenuText";let u=document.createElement("span");if(u.className="tt_addMenuMain",u.textContent=t,a.appendChild(u),r!==""){let l=document.createElement("span");l.className="tt_addMenuSub",l.textContent=r,a.appendChild(l)}n.appendChild(a),n.addEventListener("click",i),e.appendChild(n)}function Zo(e){e.textContent="";let t=Om();Hr(e,g("option.localTerminal"),g(wr==="tmux"?"hint.tmuxHosted":"hint.openInSessionCwd"),async()=>{await dn()||(xt(),Yi())},t,pn);let r=document.createElement("div");r.className="tt_addMenuSep",e.appendChild(r);let i=document.createElement("div");i.className="tt_addMenuTitle",i.textContent=g("panel.sshBook"),e.appendChild(i);for(let s of nr){if(s===null||typeof s!="object"||typeof s.name!="string"||s.name==="")continue;let n=document.createElement("div");n.className="tt_addMenuRow";let a=document.createElement("button");a.type="button",a.className="tt_addMenuItem",t&&(a.setAttribute("data-soldout",""),a.title=g("btn.maxSessionsTitle"));let u=document.createElement("span");u.className="tt_addMenuIcon",u.innerHTML=G_;let l=document.createElement("span");l.className="tt_addMenuText";let d=document.createElement("span");d.className="tt_addMenuMain",d.textContent=s.name;let m=document.createElement("span");m.className="tt_addMenuSub";let y=od(s.name),_=Co(s.jump);m.textContent=qo(s)+(_===""?"":" "+g("meta.viaJump",{label:_}))+(typeof s.proxyCommand=="string"&&s.proxyCommand.trim()!==""?" "+g("meta.viaProxy"):"")+(y>0?" \xB7 \u21C4"+String(y):""),l.appendChild(d),l.appendChild(m),a.appendChild(u),a.appendChild(l),a.addEventListener("click",async()=>{if(await dn())return;xt();let h=wr==="tmux"&&s.persist!==!1?{persist:!0,persistName:ua()}:{};Yi({t:"ssh",name:s.name,...h},s.name)});let c=document.createElement("button");c.type="button",c.className="tt_addMenuEdit",c.title=g("btn.sftpFileBrowse"),c.innerHTML=$i,c.addEventListener("click",()=>{xt(),yn({name:s.name})});let f=document.createElement("button");f.type="button",f.className="tt_addMenuEdit",f.title=g("btn.editConnection"),f.innerHTML=ia,f.addEventListener("click",()=>{xt(),vh(s)}),n.appendChild(a),n.appendChild(c),n.appendChild(f),e.appendChild(n)}if(nr.length===0){let s=document.createElement("div");s.className="tt_addMenuTitle",s.textContent=g("list.emptySshBook"),e.appendChild(s)}let o=document.createElement("div");o.className="tt_addMenuSep",e.appendChild(o),Hr(e,g("option.sshConnect"),g("hint.sshConnect"),()=>{xt(),vh()},!1,Nh)}function vh(e){if(oi!==null)return;let t=e!==null&&typeof e=="object"?e:null,r=t!==null,i=document.createElement("div");i.className="tt_sshBackdrop";let o=document.createElement("div");o.className="tt_sshCard";let s=document.createElement("div");s.className="tt_sshHead";let n=document.createElement("div");n.className="tt_sshBody";let a=document.createElement("div");a.className="tt_sshFoot";let u=document.createElement("div");u.className="tt_sshTitle",u.innerHTML=Nh+"<span></span>",u.lastElementChild.textContent=r?g("panel.editConnection",{name:String(t.name??"")}):g("panel.sshConnect"),s.appendChild(u);let l=Q=>{let oe=document.createElement("div");return oe.className="tt_sshSection",oe.textContent=Q,oe},d={},m=(Q,oe,de)=>{let ae=document.createElement("label");ae.className="tt_sshRow";let pe=document.createElement("span");pe.className="tt_cardLabel",pe.textContent=oe,ae.appendChild(pe);let ue;if(de?.select!==void 0){ue=document.createElement("select");for(let Ce of de.select){let ve=document.createElement("option");ve.value=Ce.value,ve.textContent=Ce.label,ue.appendChild(ve)}}else ue=document.createElement("input"),ue.type=de?.type??"text",ue.placeholder=de?.placeholder??"";return ue.className="tt_cardInput",ue.autocomplete="off",ue.spellcheck=!1,ae.appendChild(ue),d[Q]=ue,ae};n.appendChild(l(g("section.connection")));let y=document.createElement("div");y.className="tt_sshGrid",y.appendChild(m("host",g("field.host"),{placeholder:g("placeholder.host")})),y.appendChild(m("port",g("field.port"),{placeholder:"22"})),n.appendChild(y),n.appendChild(m("username",g("field.username"),{placeholder:"root"})),n.appendChild(l(g("section.auth"))),n.appendChild(m("auth",g("field.authMethod"),{select:[{value:"agent",label:g("option.authAgent")},{value:"key",label:g("option.authKey")},{value:"password",label:g("option.authPassword")}]}));let _=m("keyPath",g("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),c=m("passphrase",g("field.passphrase"),{type:"password"}),f=m("password",g("field.password"),{type:"password"}),h=(Q,oe)=>{let de=document.createElement("div");de.className="tt_sshRow tt_envRow";let ae=document.createElement("input");ae.type="text",ae.className="tt_cardInput",ae.placeholder=g("placeholder.credRef"),ae.title=g("hint.credRefCandidates"),ae.autocomplete="off",ae.spellcheck=!1;let pe=document.createElement("span");pe.className="tt_cardHint tt_envEmpty",pe.textContent=oe,pe.hidden=!0,ae.hidden=!0;let ue=document.createElement("div");ue.className="tt_envList",ue.dataset.hidden="";let Ce=[],ve=()=>{if(ue.textContent="",Ce.length===0){let Le=document.createElement("span");Le.className="tt_cardHint",Le.textContent=oe,ue.appendChild(Le);return}let ye=ae.value.trim().toUpperCase(),Ee=ye===""?Ce:Ce.filter(Le=>Le.toUpperCase().includes(ye));for(let Le of Ee.slice(0,30)){let Se=document.createElement("button");Se.type="button",Se.className="tt_envItem",Se.textContent=Le;let De="env:"+Le,Qe=null,ht=()=>{Qe!==null&&(clearTimeout(Qe),Qe=null),Se.textContent=Le,delete Se.dataset.danger};Se.addEventListener("mousedown",cr=>cr.preventDefault()),Se.addEventListener("click",()=>{let cr=Q.value;if(cr===""||cr.startsWith("env:")||Qe!==null){ht(),Q.value=De,Q.focus(),Q.dispatchEvent(new Event("change"));return}Se.textContent=g("list.credOverwrite",{name:Le}),Se.dataset.danger="",Qe=setTimeout(ht,4e3)}),ue.appendChild(Se)}if(Ee.length>30){let Le=document.createElement("span");Le.className="tt_envMore",Le.textContent=g("list.moreMatches",{count:Ee.length-30}),ue.appendChild(Le)}else if(Ee.length===0){let Le=document.createElement("span");Le.className="tt_envMore",Le.textContent=g("list.noCredRef"),ue.appendChild(Le)}};return ae.addEventListener("input",ve),ae.addEventListener("focus",()=>{Ce.length>0&&delete ue.dataset.hidden}),ae.addEventListener("blur",()=>{ae.value.trim()===""&&(ue.dataset.hidden="")}),de.appendChild(ae),de.appendChild(pe),de.appendChild(ue),{row:de,setNames(ye){Ce=Array.isArray(ye)?ye:[];let Ee=Ce.length>0;ae.hidden=!Ee,pe.hidden=Ee,ve()}}},p=(Q,oe)=>{let de=document.createElement("div");de.className="tt_sshRow tt_credRow";let ae=document.createElement("label");ae.className="tt_credToggle";let pe=document.createElement("input");pe.type="checkbox",pe.className="tt_cardCheckbox";let ue=document.createElement("span");ue.textContent=g("check.rememberCredential"),ae.appendChild(pe),ae.appendChild(ue),pe.checked=Ut!==null,ae.title=g("hint.rememberCredential");let Ce=document.createElement("button");Ce.type="button",Ce.className="tt_toolBtn tt_credClear",Ce.textContent=g("btn.clearCredential"),Ce.dataset.hidden="";let ve=document.createElement("span");ve.className="tt_credStatus",de.appendChild(ae),de.appendChild(Ce),de.appendChild(ve);let ye=(Se,De)=>{ve.textContent=Se,ve.dataset.kind=De},Ee=async()=>{let Se=ii(Q.value),De=Se!=="";if(ae.hidden=De,Ce.hidden=!De,ve.hidden=!1,ui()===null){pe.disabled=!0,pe.checked=!1,Ce.disabled=!0,ye(g(Ut===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),"muted");return}if(pe.disabled=!1,!De){ve.hidden=!0,ye("","plain");return}let Qe=await Eh(Se);if(Qe.unreported===!0){ye(g("status.credUnreported",{ref:Se}),"plain");return}if(Qe.error!==void 0){ye(g("error.credStatusFailed",{error:Qe.error}),"error");return}let ht=Qe.view;ye(ht.configured?g("status.credStored",{ref:Se,source:ht.source!==""?g("meta.credSource",{source:ht.source}):""}):g("status.credUnknown",{ref:Se}),ht.configured?"ok":"plain"),Ce.disabled=ht.configured!==!0||ht.writable!==!0};Ce.addEventListener("click",()=>{(async()=>{let Se=ii(Q.value);if(Se==="")return;let De=await Lh(Se);if(De.error!==void 0){ye(De.error,"error");return}Q.value="",await Ee()})()});let Le=async()=>{let Se=await Th(pe.checked===!0,Q.value,d.host.value,d.port.value,d.username.value,oe);return Se.value!==void 0&&(Q.value=Se.value,await Ee()),Se};return Q.addEventListener("change",()=>{Ee()}),{row:de,refresh:Ee,storeIfRequested:Le}},v=h(d.passphrase,g("hint.noCredRefPassphrase")),S=h(d.password,g("hint.noCredRefPassword")),b=p(d.password,"PASSWORD");(async()=>{let Q=await kh();v.setNames(Q),S.setNames(Q)})(),n.appendChild(_),n.appendChild(c),n.appendChild(v.row),n.appendChild(f),n.appendChild(b.row),n.appendChild(S.row);let x=document.createElement("button");x.type="button",x.className="tt_sshAdvToggle",x.title=g("hint.advanced");let w=document.createElement("span");w.className="tt_sshAdvChevron",w.innerHTML=fh;let E=document.createElement("span");E.className="tt_sshAdvText",E.textContent=g("section.advanced");let B=document.createElement("span");B.className="tt_sshAdvMeta",x.appendChild(w),x.appendChild(E),x.appendChild(B);let P=document.createElement("div");P.className="tt_sshAdvBody";let W=()=>{let Q=[];return Ns(d.jumpHost.value)!==void 0&&Q.push(g("section.jump")),d.proxyCommand.value.trim()!==""&&Q.push(g("section.proxyCommand")),d.hostKeyAlias.value.trim()!==""&&Q.push(g("field.hostKeyAlias")),Q},A=()=>{let Q=P.hidden===!1;x.setAttribute("aria-expanded",Q?"true":"false"),w.innerHTML=Q?K_:fh;let oe=W();B.textContent=oe.length>0?g("meta.advancedConfigured",{items:oe.join(" \xB7 ")}):g("hint.advanced")},V=Q=>{P.hidden=!Q,A()};x.addEventListener("click",()=>V(P.hidden===!0)),P.hidden=!0,x.setAttribute("aria-expanded","false"),P.appendChild(l(g("section.jump")));let O=m("jumpHost",g("field.jumpHost"),{placeholder:g("placeholder.jumpHost")});P.appendChild(O);let R=document.createElement("label");R.className="tt_sshRow";let F=document.createElement("input");F.type="checkbox",F.className="tt_cardCheckbox";let I=document.createElement("span");I.className="tt_cardLabel",I.textContent=g("check.jumpOwnCred"),R.appendChild(F),R.appendChild(I),P.appendChild(R);let C=m("jumpUsername",g("field.jumpUsername"),{placeholder:"root"}),L=m("jumpAuth",g("field.jumpAuth"),{select:[{value:"",label:g("option.authInherit")},{value:"agent",label:g("option.authAgent")},{value:"key",label:g("option.authKey")},{value:"password",label:g("option.authPassword")}]}),T=m("jumpKeyPath",g("field.keyPath"),{placeholder:"~/.ssh/id_ed25519"}),D=m("jumpPassphrase",g("field.passphrase"),{type:"password"}),N=m("jumpPassword",g("field.password"),{type:"password"});for(let Q of[C,L,T,D,N])P.appendChild(Q);let G=document.createElement("div");G.className="tt_cardHint",G.textContent=g("hint.jumpInherit"),G.title=g("hint.jumpInheritFull"),P.appendChild(G),P.appendChild(l(g("section.proxyCommand")));let $=m("proxyCommand",g("field.proxyCommand"),{placeholder:g("placeholder.proxyCommand")});P.appendChild($);let Y=document.createElement("div");Y.className="tt_cardHint",Y.textContent=g("hint.proxyCommand"),Y.title=g("hint.proxyCommandFull"),P.appendChild(Y);let H=document.createElement("div");H.className="tt_cardHint tt_sshProbeWarn",H.textContent=g("hint.proxyCommandDisabled"),P.appendChild(H),P.appendChild(m("hostKeyAlias",g("field.hostKeyAlias"),{placeholder:g("placeholder.hostKeyAlias")}));let k=document.createElement("span");k.className="tt_cardHint",k.textContent=g("hint.hostKeyAlias"),k.title=g("hint.hostKeyAliasFull"),P.appendChild(k);let j=()=>{let Q=d.proxyCommand.value.trim()!=="",oe=id,de=oe&&rd;H.textContent=g(oe?"hint.proxyCommandDisabled":"hint.proxyCommandNotGranted"),H.style.display=Q&&!de?"":"none"};d.proxyCommand.addEventListener("input",j),j();let q=()=>{let Q=Ns(d.jumpHost.value);if(Q===void 0)return;if(F.checked!==!0)return Q;let oe={...Q},de=d.jumpUsername.value.trim();de!==""&&(oe.username=de);let ae=d.jumpAuth.value;(ae==="agent"||ae==="key"||ae==="password")&&(oe.auth=ae);let pe=d.jumpKeyPath.value.trim();return pe!==""&&(oe.keyPath=pe),d.jumpPassphrase.value!==""&&(oe.passphrase=d.jumpPassphrase.value),d.jumpPassword.value!==""&&(oe.password=d.jumpPassword.value),oe},U=()=>{let Q=d.proxyCommand.value.trim();return Q===""?void 0:Q},J=()=>{let Q=Ns(d.jumpHost.value)!==void 0,oe=Q&&F.checked===!0;R.style.display=Q?"":"none";for(let de of[C,L,T,D,N])de.style.display=oe?"":"none";T.style.display=oe&&d.jumpAuth.value==="key"?"":"none",D.style.display=oe&&d.jumpAuth.value==="key"?"":"none",N.style.display=oe&&d.jumpAuth.value==="password"?"":"none",G.style.display=Q?"":"none"};d.jumpHost.addEventListener("input",J),d.jumpAuth.addEventListener("change",J),F.addEventListener("change",J),n.appendChild(l(g("section.options")));let Z=document.createElement("label");Z.className="tt_cardRow";let se=document.createElement("input");se.type="checkbox",se.className="tt_cardCheckbox";let he=document.createElement("span");he.className="tt_cardLabel",he.textContent=g("check.agentForward"),Z.appendChild(se),Z.appendChild(he),n.appendChild(Z);let fe=document.createElement("label");fe.className="tt_cardRow";let te=document.createElement("input");te.type="checkbox",te.className="tt_cardCheckbox";let qe=document.createElement("span");qe.className="tt_cardLabel",qe.textContent=g("check.persist"),fe.appendChild(te),fe.appendChild(qe),te.checked=wr==="tmux",wr==="tmux"&&n.appendChild(fe);let le=document.createElement("label");le.className="tt_cardRow";let Me=document.createElement("input");Me.type="checkbox",Me.className="tt_cardCheckbox";let st=document.createElement("span");st.className="tt_cardLabel",st.textContent=g("check.saveToBook"),le.appendChild(Me),le.appendChild(st),n.appendChild(le);let He=m("name",g("field.bookName"),{placeholder:g("placeholder.bookName")});if(n.appendChild(He),n.appendChild(x),n.appendChild(P),Me.addEventListener("change",()=>{d.name.value=Pc(Me.checked,d.name.value,d.host.value),Me.checked&&d.name.focus()}),r||d.name.addEventListener("input",()=>{Me.checked=Dc(d.name.value)}),r){le.style.display="none",d.name.value=String(t.name??""),d.host.value=String(t.host??""),d.port.value=String(t.port??22),d.username.value=String(t.username??""),d.auth.value=t.auth==="key"||t.auth==="password"?String(t.auth):"agent",d.keyPath.value=String(t.keyPath??""),d.passphrase.value=String(t.passphrase??""),d.password.value=String(t.password??"");let Q=t.jump!==null&&typeof t.jump=="object"?t.jump:null;if(d.jumpHost.value=Co(Q),Q!==null){let oe=Q.auth!==void 0||Q.keyPath!==void 0||Q.password!==void 0||Q.passphrase!==void 0;F.checked=oe,oe&&(d.jumpUsername.value=String(Q.username??""),d.jumpAuth.value=Q.auth==="key"||Q.auth==="password"?String(Q.auth):"",d.jumpKeyPath.value=String(Q.keyPath??""),d.jumpPassphrase.value=String(Q.passphrase??""),d.jumpPassword.value=String(Q.password??""))}se.checked=t.agentForward===!0,d.hostKeyAlias.value=String(t.hostKeyAlias??""),d.proxyCommand.value=String(t.proxyCommand??""),j(),te.checked=wr==="tmux"}let ee=document.createElement("div");ee.className="tt_sshStatus";let ne=document.createElement("div");ne.className="tt_sshError";let ge=document.createElement("div");ge.className="tt_sshProbeResult",ee.appendChild(ne),ee.appendChild(ge),a.appendChild(ee),J(),V(W().length>0);for(let Q of[d.jumpHost,d.proxyCommand,d.hostKeyAlias])Q.addEventListener("input",A);let be=()=>d.hostKeyAlias.value.trim(),je=()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim(),de=Number(d.port.value);if((!Number.isInteger(de)||de<1||de>65535)&&(de=22),Q===""||oe==="")return ne.textContent=g("error.hostUserRequired"),null;let ae=d.auth.value,pe={host:Q,port:de,username:oe,auth:ae},ue=q();ue!==void 0&&(pe.jump=ue);let Ce=U();if(Ce!==void 0&&(pe.proxyCommand=Ce),ae==="key"){let ye=d.keyPath.value.trim();if(ye==="")return ne.textContent=g("error.keyPathRequired"),null;pe.keyPath=ye;let Ee=d.passphrase.value;Ee!==""&&(pe.passphrase=Ee)}if(ae==="password"){let ye=d.password.value;if(ye==="")return ne.textContent=g("error.passwordRequired"),null;pe.password=ye}se.checked&&(pe.agentForward=!0);let ve=be();return ve!==""&&(pe.hostKeyAlias=ve),pe},Oe=document.createElement("div");Oe.className="tt_sshActions";let ze=document.createElement("div");ze.className="tt_sshActionsGroup";let Re=document.createElement("div");Re.className="tt_sshActionsGroup",Oe.appendChild(ze),Oe.appendChild(Re);let We=document.createElement("button");We.type="button",We.className="tt_toolBtn",We.textContent=g("btn.cancel");let we=document.createElement("button");we.type="button",we.className="tt_cardSave",we.textContent=g("btn.connect"),ze.appendChild(We);let _t=document.createElement("button");_t.type="button",_t.className="tt_toolBtn",_t.textContent=g("btn.fileBrowse"),_t.title=g("btn.browseTitle"),_t.addEventListener("click",()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim(),de=Number(d.port.value);if((!Number.isInteger(de)||de<1||de>65535)&&(de=22),Q===""||oe===""){ne.textContent=g("error.hostUserRequired");return}let ae=d.auth.value,pe={host:Q,port:de,username:oe,auth:ae},ue=q();ue!==void 0&&(pe.jump=ue);let Ce=U();if(Ce!==void 0&&(pe.proxyCommand=Ce),ae==="key"){let ye=d.keyPath.value.trim();if(ye===""){ne.textContent=g("error.keyPathRequired");return}pe.keyPath=ye;let Ee=d.passphrase.value;Ee!==""&&(pe.passphrase=Ee)}if(ae==="password"){let ye=d.password.value;if(ye===""){ne.textContent=g("error.passwordRequired");return}pe.password=ye}se.checked&&(pe.agentForward=!0);let ve=be();ve!==""&&(pe.hostKeyAlias=ve),vr(),yn(pe)}),ze.appendChild(_t);let Ze=null;r&&(Ze=document.createElement("button"),Ze.type="button",Ze.className="tt_toolBtn",Ze.textContent=g("btn.saveEdit"),Ze.addEventListener("click",()=>{ne.textContent="";let Q=d.host.value.trim(),oe=d.username.value.trim();if(Q===""||oe===""){ne.textContent=g("error.hostUserRequired");return}let de=Number(d.port.value);(!Number.isInteger(de)||de<1||de>65535)&&(de=22);let ae=d.auth.value,ue={name:d.name.value.trim()||Q,host:Q,port:de,username:oe,auth:ae,keyPath:ae==="key"?d.keyPath.value.trim():"",passphrase:d.passphrase.value,password:d.password.value,agentForward:se.checked,hostKeyAlias:be(),persist:te.checked},Ce=q();if(Ce!==void 0&&(ue.jump=Ce),ue.proxyCommand=d.proxyCommand.value.trim(),ae==="key"&&ue.keyPath===""){ne.textContent=g("error.keyPathRequired");return}Ze!==null&&(Ze.disabled=!0),(async()=>{let ve=await b.storeIfRequested();if(ve.error!==void 0){ne.textContent=ve.error,Ze!==null&&(Ze.disabled=!1);return}ve.value!==void 0&&(ue.password=ve.value);let ye=await rg(String(t.name??""),ue);if(Ze!==null&&(Ze.disabled=!1),ye!==void 0){ne.textContent=g("error.saveCredFailed",{error:ye});return}vr()})()}),ze.appendChild(Ze));let nt=document.createElement("button");nt.type="button",nt.className="tt_toolBtn",nt.textContent=g("btn.probe"),nt.title=g("btn.probeTitle"),nt.addEventListener("click",()=>{let Q=je();Q!==null&&(ge.className="tt_sshProbeResult",ge.textContent=g("msg.probing"),nt.disabled=!0,Ko(Q,!1).then(oe=>{nt.disabled=!1,oe.result?(ge.className="tt_sshProbeResult"+(oe.result.auth?.ok===!0?" tt_sshProbeOk":" tt_sshProbeBad"),ge.textContent=Go(oe.result)):(ge.className="tt_sshProbeResult tt_sshProbeBad",ge.textContent=g("error.probeFailed",{detail:String(oe.error||g("error.unknown"))}))}))}),ze.appendChild(nt),Re.appendChild(we),a.appendChild(Oe);let ls=()=>{_.style.display=d.auth.value==="key"?"":"none",c.style.display=d.auth.value==="key"?"":"none",v.row.style.display=d.auth.value==="key"?"":"none",f.style.display=d.auth.value==="password"?"":"none",S.row.style.display=d.auth.value==="password"?"":"none",b.row.style.display=d.auth.value==="password"?"":"none"};d.auth.addEventListener("change",ls),ls(),b.refresh(),We.addEventListener("click",()=>vr()),i.addEventListener("mousedown",Q=>{Q.target===i&&vr()}),we.addEventListener("click",async()=>{ne.textContent="";let Q=await dn();if(Q!==null){ne.textContent=Q;return}let oe=d.host.value.trim(),de=d.username.value.trim(),ae=Number(d.port.value);if((!Number.isInteger(ae)||ae<1||ae>65535)&&(ae=22),oe===""||de===""){ne.textContent=g("error.hostUserRequired");return}let pe=d.auth.value,ue={t:"ssh",host:oe,port:ae,username:de,auth:pe},Ce=q();Ce!==void 0&&(ue.jump=Ce);let ve=U();if(ve!==void 0&&(ue.proxyCommand=ve),pe==="key"){let De=d.keyPath.value.trim();De!==""&&(ue.keyPath=De);let Qe=d.passphrase.value;Qe!==""&&(ue.passphrase=Qe)}if(pe==="password"){let De=d.password.value;De!==""&&(ue.password=De)}se.checked&&(ue.agentForward=!0);let ye=be();ye!==""&&(ue.hostKeyAlias=ye),te.checked&&(ue.persist=!0,ue.persistName=ua());let Ee=ae!==22?de+"@"+oe+":"+ae:de+"@"+oe,Le=De=>{vr(),ce!==null&&Yi(ue,De!==""?De:Ee)};if(!Me.checked){Le("");return}let Se=d.name.value.trim()||oe;we.disabled=!0,(async()=>{let De=await b.storeIfRequested();if(De.error!==void 0){ne.textContent=De.error,we.disabled=!1;return}let Qe=De.value??ue.password??"",ht=await tg({name:Se,host:oe,port:ae,username:de,auth:pe,keyPath:ue.keyPath??"",passphrase:ue.passphrase??"",password:Qe,agentForward:se.checked,hostKeyAlias:be(),persist:te.checked,...Ce!==void 0?{jump:Ce}:{},proxyCommand:d.proxyCommand.value.trim()});if(we.disabled=!1,ht!==void 0){ne.textContent=g("error.saveBookFailed",{error:ht});return}Le(Se)})()}),o.appendChild(s),o.appendChild(n),o.appendChild(a),i.appendChild(o),document.body.appendChild(i),oi=i,d.host.focus()}function vr(){oi!==null&&(oi.remove(),oi=null)}async function tg(e){let t=[...nr.filter(r=>r?.name!==e.name),e];try{let r=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:t})}),i=await r.json().catch(()=>({}));if(!r.ok||!i.ok)return String(i.error||"HTTP "+r.status);Xi(i.config);return}catch(r){return String(r&&r.message?r.message:r)}}async function rg(e,t){if(t.name!==e&&nr.some(i=>i?.name===t.name))return g("error.bookNameTaken",{name:t.name});let r=nr.map(i=>i?.name===e?t:i);try{let i=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sshHosts:r})}),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)}}function ig(e,t,r){let i=Qr(r,xe);if(vd(i))return;let o=document.createElement("div");o.className="tt_sftpDualCard";let s=document.createElement("div");s.className="tt_sftpTitleRow";let n=document.createElement("div");n.className="tt_sshTitle",n.innerHTML=$i+"<span></span>",n.lastElementChild.textContent=g("panel.sftpDual",{label:t});let a=document.createElement("button");a.type="button",a.className="tt_close",a.title=g("btn.close"),a.innerHTML=_n,a.addEventListener("click",()=>mi(i)),s.appendChild(n),s.appendChild(a),o.appendChild(s);let u=document.createElement("div");u.className="tt_sftpStatus";let l=(N,G)=>{u.textContent=N,G===void 0?delete u.dataset.state:u.dataset.state=G},d=!1,m=(N,G)=>{if(!(d||_.local.busy||_.remote.busy)){d=!0;for(let $ of[_.local,_.remote])$.setBusy(!0);l(N,"busy"),Promise.resolve().then(G).catch($=>{($===null||typeof $!="object"||$.name!=="TransferCanceledError")&&R.fail(g("status.failed")),l(String($&&$.message?$.message:$),"error")}).finally(()=>{d=!1;for(let $ of[_.local,_.remote])$.setBusy(!1)})}},y=N=>{_[N].bar.after(h),h.style.display="",p.focus(),p.select()},_={},c=(N,G)=>{if(N===void 0||N==="")throw new Error(g("error.dirNotReady"));return N.endsWith("/")||N.endsWith("\\")?N+G:N+"/"+G},f=(N,G)=>{let $={kind:N,path:"",busy:!1},Y=document.createElement("div");Y.className="tt_sftpPane";let H=document.createElement("div");H.className="tt_sftpPaneHead";let k=document.createElement("span");k.textContent=G;let j=document.createElement("span");j.className="tt_sftpPaneMeta",H.appendChild(k),H.appendChild(j),Y.appendChild(H);let q=document.createElement("div");q.className="tt_sftpBar";let U=document.createElement("input");U.type="text",U.className="tt_sftpPath",U.placeholder=g(N==="local"?"placeholder.localPath":"placeholder.remotePath"),U.spellcheck=!1,U.autocomplete="off";let J=document.createElement("button");J.type="button",J.className="tt_toolBtn",J.innerHTML=sa+"<span>"+g("btn.refresh")+"</span>";let Z=document.createElement("button");Z.type="button",Z.className="tt_toolBtn",Z.innerHTML=Oh+"<span>"+g("btn.mkdir")+"</span>";let se=document.createElement("button");se.type="button",se.className="tt_toolBtn tt_toolToggle",se.textContent=g("btn.hiddenFiles"),se.title=g("btn.hiddenFilesTitle"),Lr&&(se.dataset.on=""),q.appendChild(U),q.appendChild(J),q.appendChild(Z),q.appendChild(se),Y.appendChild(q);let he=document.createElement("div");he.className="tt_sftpList",Y.appendChild(he),$.bar=q;let fe=ee=>{$.busy=ee;for(let ne of[J,Z])ne.disabled=ee;U.disabled=ee},te=async(ee,ne)=>{let ge=N==="local"?"/api/dsh-tty/local-fs/":"/api/dsh-tty/sftp/",be=N==="local"?ne:{...e,...ne},je=await fetch(ge+ee,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(be)}),Oe=await je.json().catch(()=>({}));if(!je.ok||Oe.ok!==!0)throw new Error(String(Oe.error||"HTTP "+je.status));return Oe},qe=(ee,ne)=>{if(!($.busy||d))return fe(!0),l(ee,"busy"),Promise.resolve().then(ne).catch(ge=>l(String(ge&&ge.message?ge.message:ge),"error")).finally(()=>fe(!1))},le=(ee,ne)=>{if(ee===void 0||ee==="")throw new Error(g("error.dirNotReady"));return ee.endsWith("/")||ee.endsWith("\\")?ee+ne:ee+"/"+ne},Me=ee=>{let ne=le($.path,ee.name),ge=[];ee.isDir===!0?ge.push(g("meta.dir")):ge.push(ct(Number(ee.size))||"\u2014");let be=yd(Number(ee.mtime));be!==""&&ge.push(be);let je=w(ee.isDir?$i:ee.isSymlink?Ph:Dh,ee.name,ge.join(" \xB7 "),ee.isDir===!0?"dir":ee.isSymlink===!0?"link":"file"),Oe=()=>$.loadDir($.path),ze=N==="local"?_.remote:_.local;return ee.isDir===!0&&je.addEventListener("click",Re=>{Re.target instanceof Element&&Re.target.closest(".tt_sftpAct")!==null||$.loadDir(ne)}),E(je,N==="local"?na:oa,g("btn.transferTo",{target:g(N==="local"?"meta.remote":"meta.local"),path:ze.path}),()=>{if($.path===""||ze.path===""){l(g("error.transferDirsNotReady"),"error");return}R.reset(),R.pulse(0),m(g("msg.transferring",{name:ee.name}),async()=>{let Re=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",direction:N==="local"?"up":"down",...e,localPath:N==="local"?ne:le(ze.path,ee.name),remotePath:N==="local"?le(ze.path,ee.name):ne})}),We=await Re.json().catch(()=>({}));if(!Re.ok||We.ok!==!0)throw R.fail(g("error.transferFailed")),new Error(String(We.error||"HTTP "+Re.status));let we=We.job?.id;if(typeof we!="string"||we==="")throw R.fail(g("error.transferFailed")),new Error(g("error.noTaskId"));await F(we,ee.name)==="canceled"?(R.reset(),l(g("msg.transferCanceled",{name:ee.name}))):(R.done(g("status.done")),setTimeout(()=>R.reset(),1500),l(g("msg.transferred",{name:ee.name}))),await ze.loadDir(ze.path)})}),N!=="local"&&ee.isDir!==!0&&E(je,Bh,g("btn.download",{name:ee.name}),()=>{P(ee,ne)}),E(je,ia,g("btn.rename",{name:ee.name}),()=>{p.placeholder=g("placeholder.newName"),p.value=ee.name,y(N),b=async()=>{let Re=p.value.trim();Re===""||Re===ee.name||(x(),await $.runTask(g("msg.renaming",{name:ee.name}),async()=>{await te("rename",{from:ne,to:le($.path,Re)}),await Oe()}))}}),B(je,()=>$.runTask(g("msg.deleting",{name:ee.name}),async()=>{await te("remove",{path:ne,recursive:ee.isDir===!0}),await Oe(),l(g("msg.deleted",{name:ee.name}))}),ee),je},st=ee=>{if(he.textContent="",$.path!==""&&$.path!=="/"&&/^[A-Za-z]:[\\/]?$/.test($.path)===!1){let be=w(ra,g("list.parentDir"),"","up");be.addEventListener("click",()=>{let je=N==="local"?og($.path):Sd($.path);je!==null&&$.loadDir(je)}),he.appendChild(be)}let ne=js(ee,Lr);if(ne.length===0){let be=document.createElement("div");be.className="tt_addMenuTitle",be.textContent=ee.length>0?g("list.hiddenOnly"):g("list.emptyDir"),he.appendChild(be);return}let ge=500;for(let be of ne.slice(0,ge))be===null||typeof be!="object"||typeof be.name!="string"||be.name===""||he.appendChild(Me(be));if(ne.length>ge){let be=document.createElement("div");be.className="tt_addMenuTitle",be.textContent=g("list.truncated",{rest:ne.length-ge,total:ne.length}),he.appendChild(be)}};$.loadDir=async ee=>{try{let ne=await te("list",{path:ee??$.path});$.path=typeof ne.path=="string"&&ne.path!==""?ne.path:$.path,U.value=$.path;let ge=Array.isArray(ne.entries)?ne.entries:[];$.rawEntries=ge,st(ge),j.textContent=g("list.itemCount",{count:js(ge,Lr).length}),l($.path)}catch(ne){l(String(ne&&ne.message?ne.message:ne),"error")}},$.runTask=qe,$.setBusy=fe,_[N]=$,se.addEventListener("click",()=>{Dm(!Lr)});let He=ee=>{se!==null&&(ee?se.dataset.on="":delete se.dataset.on),$.rawEntries=$.rawEntries??[],st($.rawEntries),j.textContent=g("list.itemCount",{count:js($.rawEntries,ee).length})};return Uo.add(He),$.onShowHidden=He,J.addEventListener("click",()=>{$.runTask(g("list.loading"),()=>$.loadDir($.path))}),Z.addEventListener("click",()=>{$.busy||d||(p.placeholder=g("placeholder.newDirName"),p.value="",y(N),b=async()=>{let ee=p.value.trim();ee!==""&&(x(),await $.runTask(g("msg.creatingDir",{name:ee}),async()=>{await te("mkdir",{path:le($.path,ee),parents:!0}),await $.loadDir($.path)}))})}),U.addEventListener("keydown",ee=>{if(ee.key!=="Enter"||(ee.preventDefault(),$.busy||d))return;let ne=U.value.trim();ne!==""&&$.runTask(g("list.loading"),()=>$.loadDir(ne))}),Y},h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let p=document.createElement("input");p.type="text",p.className="tt_cardInput",p.spellcheck=!1,p.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=g("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=g("btn.cancel"),h.appendChild(p),h.appendChild(v),h.appendChild(S);let b=null,x=()=>{h.style.display="none",p.value="",b=null};v.addEventListener("click",()=>{b?.()}),S.addEventListener("click",x),p.addEventListener("keydown",N=>{N.key==="Enter"?(N.preventDefault(),b?.()):N.key==="Escape"&&(N.stopPropagation(),x())});let w=(N,G,$,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpRow";let k=document.createElement("span");k.className="tt_sftpIcon",k.innerHTML=N,Y!==void 0&&(k.dataset.kind=Y);let j=document.createElement("span");if(j.className="tt_sftpName",j.textContent=G,j.title=G,H.appendChild(k),H.appendChild(j),$!==""){let q=document.createElement("span");q.className="tt_sftpMeta",q.textContent=$,H.appendChild(q)}return H},E=(N,G,$,Y)=>{let H=document.createElement("button");H.type="button",H.className="tt_sftpAct",H.innerHTML=G,H.title=$,H.addEventListener("click",k=>{k.stopPropagation(),Y()}),N.appendChild(H)},B=(N,G,$)=>{let Y=document.createElement("button");Y.type="button",Y.className="tt_sftpAct",Y.innerHTML=Tr,Y.title=$.isDir?g("btn.deleteEntryDir",{name:$.name}):g("btn.deleteEntry",{name:$.name});let H=null;Y.addEventListener("click",k=>{if(k.stopPropagation(),H!==null){clearTimeout(H),H=null,Y.innerHTML=Tr,delete Y.dataset.danger,G();return}Y.textContent=g("btn.confirm"),Y.dataset.danger="",H=setTimeout(()=>{H=null,Y.innerHTML=Tr,delete Y.dataset.danger},4e3)}),N.appendChild(Y)},P=(N,G)=>_.remote.runTask(g("msg.downloading",{name:N.name}),async()=>{R.reset();let $;try{$=await xd({makeBody:Y=>({...e,path:G,...Y>0?{offset:Y}:{}}),onProgress:(Y,H)=>R.set(Y,H),maxMb:sr.maxDownloadMb,registerCancel:Y=>R.setCancel(Y),onResume:Y=>l(g("msg.downloadResuming",{name:N.name,offset:ct(Y)||String(Y)+" B"}),"busy")})}catch(Y){if(di(Y)){R.reset(),l(g("msg.downloadCanceled",{name:N.name}));return}throw R.fail(g("error.downloadFailed")),Y}R.done(g("status.done")),kd($,N.name),setTimeout(()=>R.reset(),1500),l(g("msg.downloaded",{name:N.name,size:ct($.size)||String($.size)+" B"}))}),W=f("local",g("meta.local")),A=f("remote",g("meta.remote"));_.local.wrap=W,_.remote.wrap=A;let V=document.createElement("div");V.className="tt_sftpDual",V.appendChild(W),V.appendChild(A),o.appendChild(V),o.appendChild(h);let O=document.createElement("div");O.className="tt_sftpFoot";let R=Cd();O.appendChild(R.el),O.appendChild(u),o.appendChild(O);let F=async(N,G)=>{let $=!1;R.setCancel(()=>{$||($=!0,fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"cancel",job:N})}).catch(()=>{}))});try{for(;;){await new Promise(j=>setTimeout(j,400));let Y=await fetch("/api/dsh-tty/local-fs/transfer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",job:N})}),H=await Y.json().catch(()=>({}));if(!Y.ok||H.ok!==!0){if($)return"canceled";throw new Error(String(H.error||"HTTP "+Y.status))}let k=H.job;if(k===null||typeof k!="object")throw new Error(g("error.invalidTaskState"));if(k.state==="running"){let j=typeof k.current=="string"&&k.current!==""?k.current:G;l(g("msg.transferring",{name:j}),"busy"),Number.isFinite(k.total)&&k.total>0?R.set(Number(k.bytes)||0,k.total):R.pulse(Number(k.bytes)||0);continue}if(k.state==="canceled")return"canceled";if(k.state!=="done")throw new Error(String(k.error||g("error.transferFailed")));return"done"}}finally{R.setCancel(null)}},I=(N,G)=>{G?N.wrap.dataset.drag="":delete N.wrap.dataset.drag},C=N=>Array.isArray(N?.types)&&N.types.includes("Files");for(let N of[_.local,_.remote]){let G=N.wrap,$=0;G.addEventListener("dragenter",Y=>{N.kind!=="remote"||!C(Y.dataTransfer)||(Y.preventDefault(),$+=1,I(N,!0))}),G.addEventListener("dragover",Y=>{N.kind==="remote"&&(Y.preventDefault(),Y.dataTransfer!==null&&(Y.dataTransfer.dropEffect="copy"))}),G.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&I(N,!1)}),G.addEventListener("drop",Y=>{$=0,I(N,!1);let H=Zc(N.kind,Y.dataTransfer);if(!H.accept){H.reason==="wrongPane"&&(Y.preventDefault(),l(g("error.dropOnLocalPane"),"error"));return}Y.preventDefault(),!(d||_.remote.busy)&&Ed(Y.dataTransfer).then(k=>{(k.length>0||k._limitExceeded===!0)&&L(_.remote,k)})})}let L=async(N,G)=>{let $=sr;if($.maxUploadFiles>0&&G.length>$.maxUploadFiles){l(g("error.uploadCountExceeded",{max:$.maxUploadFiles,count:G.length}),"error");return}let Y=$.maxUploadMb>0?$.maxUploadMb*1024*1024:0,H=G.find(k=>Y>0&&(k.file?.size??0)>Y);if(H!==void 0){l(g("error.uploadTooBig",{size:ct(Y),name:String(H.relPath??"")}),"error");return}if(G._limitExceeded===!0){l(g("error.uploadTotalTooBig"),"error");return}await m(g("msg.uploading"),async()=>{if(N.path===""){l(g("error.transferDirsNotReady"),"error");return}for(let q of Qc(G))await fetch("/api/dsh-tty/sftp/mkdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e,path:c(N.path,q),parents:!0})}).catch(()=>{});R.reset();let k={stopped:!1,abort:null};R.setCancel(()=>k.abort?.());let j=0;try{let q=0;for(let U of G){if(k.stopped)break;q+=1,k.abort=null;try{await wd(U.file,c(N.path,U.relPath),{spec:e,label:`${String(q)}/${String(G.length)} ${U.relPath}`,cancelRef:k,onProgress:(J,Z)=>Number.isFinite(Z)&&Z>0?R.set(J,Z):R.pulse(J),onLabel:J=>l(g("msg.uploadingName",{name:J}),"busy")}),j+=1}catch(J){if(di(J)||k.stopped)break;throw J}}}finally{R.setCancel(null)}k.stopped?(R.reset(),l(g("msg.uploadCanceled",{done:j,total:G.length}))):(R.done(g("status.allDone")),setTimeout(()=>R.reset(),1500),l(g("msg.uploadDoneCount",{count:G.length}))),await N.loadDir(N.path)})},T=ca(),D=T===null?420:Math.round(T.height*.56);bd(o,g("panel.sftpDual",{label:t}),D,i),_.local.loadDir(""),_.remote.loadDir(""),$o=()=>{for(let N of[_.local,_.remote])N!==void 0&&typeof N.onShowHidden=="function"&&Uo.delete(N.onShowHidden)}}var ar=null,qt=null;function gd(){return qt!==null&&ko(qt.ownerKey,xe)?qt.ownerKey:Qr(void 0,xe)}var vd=(e=gd())=>ar!==null||qt!==null&&qt.ownerKey===e;function bd(e,t,r,i){let o=Qr(i,xe),s=Dt!==null&&Dt.ownerKey===o;if(ce!==null&&!Xe&&kt!==null&&!s)try{let a=Xh({title:t,side:"bottom",size:r,min:200,ownerSid:o,onClose:()=>mi(o)});a.element.appendChild(e),qt=a;return}catch(a){console.warn("[dsh-tty] SFTP \u6302\u5230\u7EC8\u7AEF\u6302\u8F7D\u4F4D\u5931\u8D25\uFF0C\u56DE\u9000\u5BF9\u8BDD\u6846\uFF1A"+(a instanceof Error?a.message:String(a)))}let n=document.createElement("div");n.className="tt_sshBackdrop",n.appendChild(e),n.addEventListener("mousedown",a=>{a.target===n&&mi()}),document.body.appendChild(n),ar=n}var Ui=null;function sg(){let e=Ui;if(Ui=null,e!==null)try{e.click()}catch{}}function ng(e){let t=new TextEncoder().encode(e),r="";for(let i of t)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function wd(e,t,r){let{spec:i,label:o="",cancelRef:s,onProgress:n,onLabel:a,onDone:u}=r;return o!==""&&typeof a=="function"&&a(o),new Promise((l,d)=>{let m=ng(JSON.stringify({...i,path:t})),y=new XMLHttpRequest;s.abort=()=>{s.stopped=!0,y.abort()},y.open("POST","/api/dsh-tty/sftp/upload"),y.setRequestHeader("x-dsh-sftp-meta",m),y.upload.addEventListener("progress",f=>{f.lengthComputable?n(f.loaded,f.total):n(0,NaN)});let _=!1,c=f=>{_||(_=!0,f===null?l():d(f))};y.addEventListener("load",()=>{if(y.status===200){u?.(),c(null);return}if(s.stopped)return;let f="HTTP "+y.status;try{let h=JSON.parse(y.responseText);h!==null&&typeof h=="object"&&typeof h.error=="string"&&(f=h.error)}catch{}c(new Error(f))}),y.addEventListener("error",()=>{if(s.stopped){c(new _i);return}c(new Error(g("error.networkError")))}),y.addEventListener("abort",()=>{c(new _i)}),y.send(e)})}function yd(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=i=>String(i).padStart(2,"0");return t.getFullYear()+"-"+r(t.getMonth()+1)+"-"+r(t.getDate())+" "+r(t.getHours())+":"+r(t.getMinutes())}function Sd(e){let t=String(e).replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function og(e){let t=String(e).trim();if(t===""||(t=t.replace(/[\\/]+$/,""),t===""))return null;let r=t.match(/^([A-Za-z]:)(.*)$/);if(r!==null){let o=r[2];if(o==="")return null;let s=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return s<=0?r[1]+"\\":r[1]+o.slice(0,s)}if(t.startsWith("\\\\")||t.startsWith("//")){let o=t.slice(2);if(o.split(/[\\/]/).filter(a=>a!=="").length<=2)return null;let n=Math.max(o.lastIndexOf("\\"),o.lastIndexOf("/"));return t.slice(0,2)+o.slice(0,n)}let i=t.lastIndexOf("/");return i<=0?i===0?"/":null:t.slice(0,i)}function Pi(e,t){return e.endsWith("/")?e+t:e+"/"+t}function Cd(){let e=document.createElement("div");e.className="tt_sftpProgress";let t=document.createElement("div");t.className="tt_sftpTrack";let r=document.createElement("div");r.className="tt_sftpFill",t.appendChild(r);let i=document.createElement("span");i.className="tt_sftpPct",i.textContent="";let o=document.createElement("button");o.type="button",o.className="tt_sftpCancel",o.title=g("btn.cancelTransfer"),o.innerHTML=ts,o.style.display="none";let s=null;o.addEventListener("click",_=>{_.stopPropagation();let c=s;c!==null&&(o.disabled=!0,c())}),e.appendChild(t),e.appendChild(i),e.appendChild(o);let n=_=>{i.textContent=_},a="",u=-1,l=_=>{_!==a&&(a=_,i.textContent=_)},d=_=>{let c=Math.round(_);c!==u&&(u=c,r.style.width=c+"%")},m=()=>{s=null,Ui===o&&(Ui=null),o.style.display="none",o.disabled=!1};return{el:e,reset(){delete e.dataset.active,delete e.dataset.state,a="",u=-1,this._last=void 0,this._lastAt=0,this._rate=void 0,r.style.width="0%",i.textContent="",m()},setCancel(_){if(_==null){m();return}s=_,Ui=o,o.disabled=!1,o.style.display=""},set(_,c){e.dataset.active="",delete e.dataset.state;let f=Date.now();if(this._last!==void 0&&f>this._lastAt){let h=(_-this._last)/((f-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}if(this._last=_,this._lastAt=f,Number.isFinite(c)&&c>0){let h=Math.min(100,Math.max(0,_/c*100));d(h);let p=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l(Math.round(h)+"%"+(p!==""?" \xB7 "+p:""))}else{r.style.width="";let h=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l(ct(_)+(h!==""?" \xB7 "+h:""))}},pulse(_){e.dataset.active="",delete e.dataset.state,r.style.width="45%",r.style.transition="none",setTimeout(()=>{r.style.transition="width .15s linear"},30);let c=Date.now();if(this._last!==void 0&&c>this._lastAt){let h=(_-this._last)/((c-this._lastAt)/1e3);this._rate=this._rate===void 0?h:this._rate*.7+h*.3}this._last=_,this._lastAt=c;let f=this._rate!==void 0&&this._rate>=0?Di(this._rate):"";l((Number.isFinite(_)?ct(_):"\u2026")+(f!==""?" \xB7 "+f:""))},done(_){e.dataset.active="",e.dataset.state="done",r.style.width="100%",u=100,m(),l(_!==void 0&&_!==""?_:g("status.done"))},fail(_){e.dataset.active="",e.dataset.state="error",m(),l(_!==void 0&&_!==""?_:g("status.failed"))},text(_){delete e.dataset.state,_===void 0||_===""?(e.dataset.active="",a="",i.textContent=""):(e.dataset.active="",r.style.width="",u=-1,l(_))}}}async function ag(e,t,r,i=0,o=null,s=0){let n=i>0?i*1024*1024:0,a=Number.isFinite(s)&&s>0?s:0,u=typeof AbortController=="function"?new AbortController:null,l=!1;u!==null&&(t={...t,signal:u.signal},typeof o=="function"&&o(()=>{l=!0,u.abort()}));let d=a,m=null,y;try{if(y=await fetch(e,t),!y.ok){let S="HTTP "+y.status;try{let b=await y.json();b!==null&&typeof b=="object"&&typeof b.error=="string"&&(S=b.error)}catch{}throw new Error(S)}let _=Number(y.headers.get("content-length")),c=y.headers.get("content-range")??"",f=Number(/\/(\d+)\s*$/.exec(c)?.[1]);Number.isFinite(f)&&f>0?m=f:Number.isFinite(_)&&_>0&&(m=a+_);let h=y.body;if(h===null||typeof h.getReader!="function"){let S=await y.blob();if(n>0&&a+S.size>n)throw new Error(g("error.downloadTooBig",{size:ct(n)}));return m!==null&&r(m,m),S}if(n>0&&m!==null&&m>n){try{await h.cancel()}catch{}throw new Error(g("error.downloadTooBig",{size:ct(n)}))}let p=h.getReader(),v=[];for(;;){let{done:S,value:b}=await p.read();if(S)break;if(b!==void 0&&b.byteLength>0){if(d+=b.byteLength,n>0&&d>n){try{await p.cancel()}catch{}throw new Error(g("error.downloadTooBig",{size:ct(n)}))}v.push(b),r(d,m!==null?m:NaN)}}return new Blob(v,{type:"application/octet-stream"})}catch(_){if(l||_!==null&&typeof _=="object"&&_.name==="AbortError")throw new _i;if(_!==null&&typeof _=="object")throw _.received=d,_.total=m,_;let c=new Error(String(_));throw c.received=d,c.total=m,c}}async function xd({url:e="/api/dsh-tty/sftp/download",makeBody:t,onProgress:r,maxMb:i=0,registerCancel:o=null,onResume:s=null}){let n=0,a=0;for(;;)try{return await ag(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t(n))},r,i,o,n)}catch(u){if(di(u))throw u;a+=1;let l=Xc({received:u?.received??0,total:u?.total??null,attempt:a});if(!l.resume)throw u;n=l.offset,typeof s=="function"&&s(n)}}var _i=class extends Error{constructor(){super(g("msg.canceled")),this.name="TransferCanceledError"}};function di(e){return e instanceof _i}function kd(e,t){let r=URL.createObjectURL(e),i=document.createElement("a");i.href=r,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}async function Ed(e){if(e==null)return[];let t=typeof e.items<"u"?[...e.items]:[],r=[];for(let l of t){let d=typeof l.webkitGetAsEntry=="function"?l.webkitGetAsEntry():null;d!==null&&r.push(d)}if(r.length===0)return[...e.files??[]].map(l=>({relPath:l.name,file:l}));let i=[],o=sr.maxUploadFiles,s=sr.maxUploadMb>0?sr.maxUploadMb*1024*1024:0,n=()=>o>0&&i.length>=o,a=0,u=(l,d)=>new Promise(m=>{if(n()){m();return}if(l.isFile===!0){l.file(c=>{s>0&&a+(c.size??0)>s?i._limitExceeded=!0:(i.push({relPath:d+l.name,file:c}),a+=c.size??0),m()},()=>m());return}if(l.isDirectory!==!0){m();return}let y=l.createReader(),_=()=>{y.readEntries(async c=>{if(c.length===0){m();return}for(let f of c){if(n())break;await u(f,d+l.name+"/")}if(n()){m();return}_()},()=>m())};_()});for(let l of r)await u(l,"");return i}function yn(e,t){let r=Qr(t,xe);if(vd(r))return;let i=e!==null&&typeof e=="object"?e:{},o={};if(typeof i.name=="string"&&i.name!=="")o.name=i.name;else{for(let j of["host","username","auth","keyPath","passphrase","password"])typeof i[j]=="string"&&i[j]!==""&&(o[j]=i[j]);let k=Number(i.port);Number.isInteger(k)&&k>=1&&k<=65535&&(o.port=k),i.agentForward===!0&&(o.agentForward=!0)}let s=o.name??(o.username!==void 0?o.username+"@"+String(o.host??""):String(o.host??""));if(ed==="dual"){ig(o,s,r);return}let n=document.createElement("div");n.className="tt_sftpCard";let a=document.createElement("div");a.className="tt_sftpTitleRow";let u=document.createElement("div");u.className="tt_sshTitle",u.innerHTML=$i+"<span></span>",u.lastElementChild.textContent="SFTP \xB7 "+s;let l=document.createElement("button");l.type="button",l.className="tt_close",l.title=g("btn.close"),l.innerHTML=_n,l.addEventListener("click",()=>mi(r)),a.appendChild(u),a.appendChild(l),n.appendChild(a);let d=document.createElement("div");d.className="tt_sftpBar";let m=document.createElement("input");m.type="text",m.className="tt_sftpPath",m.placeholder=g("placeholder.remotePath"),m.spellcheck=!1,m.autocomplete="off";let y=document.createElement("button");y.type="button",y.className="tt_toolBtn",y.innerHTML=sa+"<span>"+g("btn.refresh")+"</span>";let _=document.createElement("button");_.type="button",_.className="tt_toolBtn",_.innerHTML=Oh+"<span>"+g("btn.mkdir")+"</span>";let c=document.createElement("button");c.type="button",c.className="tt_toolBtn",c.innerHTML=$_+"<span>"+g("btn.upload")+"</span>",c.title=g("btn.uploadTitle");let f=document.createElement("input");f.type="file",f.multiple=!0,f.style.display="none",d.appendChild(m),d.appendChild(y),d.appendChild(_),d.appendChild(c),n.appendChild(d),n.appendChild(f);let h=document.createElement("div");h.className="tt_sftpEditor",h.style.display="none";let p=document.createElement("input");p.type="text",p.className="tt_cardInput",p.spellcheck=!1,p.autocomplete="off";let v=document.createElement("button");v.type="button",v.className="tt_toolBtn",v.textContent=g("btn.ok");let S=document.createElement("button");S.type="button",S.className="tt_toolBtn",S.textContent=g("btn.cancel"),h.appendChild(p),h.appendChild(v),h.appendChild(S),n.appendChild(h);let b=null,x=()=>{h.style.display="none",b=null};v.addEventListener("click",()=>{b?.()}),S.addEventListener("click",x),p.addEventListener("keydown",k=>{k.key==="Enter"?(k.preventDefault(),b?.()):k.key==="Escape"&&(k.stopPropagation(),x())});let w=document.createElement("div");w.className="tt_sftpList",n.appendChild(w);let E=document.createElement("div");E.className="tt_sftpFoot";let B=document.createElement("div");B.className="tt_sftpStatus";let P=Cd();E.appendChild(P.el),E.appendChild(B),n.appendChild(E);let W={path:"",busy:!1},A=(k,j)=>{B.textContent=k,j===void 0?delete B.dataset.state:B.dataset.state=j},V=k=>{W.busy=k;for(let j of[y,_,c])j.disabled=k;m.disabled=k},O=async(k,j)=>{let q=await fetch("/api/dsh-tty/sftp/"+k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...o,...j})}),U=await q.json().catch(()=>({}));if(!q.ok||U.ok!==!0)throw new Error(String(U.error||"HTTP "+q.status));return U},R=async(k,j)=>{if(!W.busy){V(!0),A(k,"busy");try{await j()}catch(q){A(String(q&&q.message?q.message:q),"error")}finally{V(!1)}}},F=(k,j,q,U)=>{let J=document.createElement("button");J.type="button",J.className="tt_sftpRow";let Z=document.createElement("span");Z.className="tt_sftpIcon",Z.innerHTML=k,U!==void 0&&(Z.dataset.kind=U);let se=document.createElement("span");if(se.className="tt_sftpName",se.textContent=j,se.title=j,J.appendChild(Z),J.appendChild(se),q!==""){let he=document.createElement("span");he.className="tt_sftpMeta",he.textContent=q,J.appendChild(he)}return J},I=(k,j,q,U)=>{let J=document.createElement("button");J.type="button",J.className="tt_sftpAct",J.innerHTML=j,J.title=q,J.addEventListener("click",Z=>{Z.stopPropagation(),U()}),k.appendChild(J)},C=(k,j,q)=>{let U=document.createElement("button");U.type="button",U.className="tt_sftpAct",U.innerHTML=Tr,U.title=j.isDir?g("btn.deleteEntryDir",{name:j.name}):g("btn.deleteEntry",{name:j.name});let J=null;U.addEventListener("click",Z=>{if(Z.stopPropagation(),!W.busy){if(J!==null){clearTimeout(J),J=null,U.innerHTML=Tr,delete U.dataset.danger,R(g("msg.deleting",{name:j.name}),async()=>{await O("remove",{path:q,recursive:j.isDir===!0}),await T(W.path),A(g("msg.deleted",{name:j.name}))});return}U.textContent=g("btn.confirm"),U.dataset.danger="",J=setTimeout(()=>{J=null,U.innerHTML=Tr,delete U.dataset.danger},4e3)}}),k.appendChild(U)},L=k=>{if(w.textContent="",W.path!==""&&W.path!=="/"){let U=F(ra,g("list.parentDir"),"","up");U.addEventListener("click",()=>{R(g("list.loading"),()=>T(Sd(W.path)))}),w.appendChild(U)}let j=Array.isArray(k)?k:[];if(j.length===0){let U=document.createElement("div");U.className="tt_addMenuTitle",U.textContent=g("list.emptyDir"),w.appendChild(U);return}let q=500;for(let U of j.slice(0,q)){if(U===null||typeof U!="object"||typeof U.name!="string"||U.name==="")continue;let J=Pi(W.path,U.name),Z=[];U.isDir===!0?Z.push(g("meta.dir")):Z.push(ct(Number(U.size))||"\u2014");let se=yd(Number(U.mtime));se!==""&&Z.push(se);let he=F(U.isDir?$i:U.isSymlink?Ph:Dh,U.name,Z.join(" \xB7 "),U.isDir===!0?"dir":U.isSymlink===!0?"link":"file");U.isDir===!0?he.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||R(g("list.loading"),()=>T(J))}):(he.addEventListener("click",fe=>{fe.target instanceof Element&&fe.target.closest(".tt_sftpAct")!==null||D(U,J)}),I(he,Bh,g("btn.download",{name:U.name}),()=>{D(U,J)})),I(he,ia,g("btn.rename",{name:U.name}),()=>{p.placeholder=g("placeholder.newName"),p.value=U.name,h.style.display="",p.focus(),p.select(),b=async()=>{let fe=p.value.trim();fe===""||fe===U.name||(x(),await R(g("msg.renaming",{name:U.name}),async()=>{await O("rename",{from:J,to:Pi(W.path,fe)}),await T(W.path)}))}}),C(he,U,J),w.appendChild(he)}if(j.length>q){let U=document.createElement("div");U.className="tt_addMenuTitle",U.textContent=g("list.truncated",{rest:j.length-q,total:j.length}),w.appendChild(U)}},T=async k=>{try{let j=await O("list",{path:k??W.path});W.path=typeof j.path=="string"&&j.path!==""?j.path:"/",m.value=W.path;let q=Array.isArray(j.entries)?j.entries.length:0;L(j.entries),A(W.path+" \u2014 "+g("list.itemCount",{count:q}))}catch(j){A(String(j&&j.message?j.message:j),"error")}},D=(k,j)=>R(g("msg.downloading",{name:k.name}),async()=>{P.reset();let q;try{q=await xd({makeBody:U=>({...o,path:j,...U>0?{offset:U}:{}}),onProgress:(U,J)=>P.set(U,J),maxMb:sr.maxDownloadMb,registerCancel:U=>P.setCancel(U),onResume:U=>A(g("msg.downloadResuming",{name:k.name,offset:ct(U)||String(U)+" B"}),"busy")})}catch(U){if(di(U)){P.reset(),A(g("msg.downloadCanceled",{name:k.name}));return}throw P.fail(g("error.downloadFailed")),U}P.done(g("status.done")),kd(q,k.name),setTimeout(()=>P.reset(),1500),A(g("msg.downloaded",{name:k.name,size:ct(q.size)||String(q.size)+" B"}))}),N=(k,j,q,U,J)=>wd(k,Pi(W.path,j),{spec:o,label:(U>1?String(q)+"/"+String(U)+" ":"")+j,cancelRef:J,onProgress:(Z,se)=>{Number.isFinite(se)&&se>0?P.set(Z,se):P.pulse(Z)},onLabel:Z=>A(g("msg.uploadingName",{name:Z}),"busy"),onDone:()=>{U===1&&P.done(g("msg.uploadDone"))}}).catch(Z=>{throw di(Z)||P.fail(g("error.uploadFailed")),Z}),G=async k=>R(g("msg.uploading"),async()=>{let j=sr;if(j.maxUploadFiles>0&&k.length>j.maxUploadFiles){A(g("error.uploadCountExceeded",{max:j.maxUploadFiles,count:k.length}),"error"),P.fail(g("status.overLimit"));return}let q=j.maxUploadMb>0?j.maxUploadMb*1024*1024:0,U=k.find(fe=>q>0&&(fe.file?.size??0)>q);if(U!==void 0){A(g("error.uploadTooBig",{size:ct(q),name:String(U.relPath??"")}),"error"),P.fail(g("status.overLimit"));return}if(k._limitExceeded===!0){A(g("error.uploadTotalTooBig"),"error"),P.fail(g("status.overLimit"));return}let J=new Set;for(let fe of k){let te=fe.relPath.lastIndexOf("/");if(te<=0)continue;let qe=fe.relPath.slice(0,te);J.has(qe)||(J.add(qe),await O("mkdir",{path:Pi(W.path,qe),parents:!0}).catch(()=>{}))}P.reset();let Z={stopped:!1,abort:null};P.setCancel(()=>Z.abort?.());let se=0,he=0;try{for(let fe of k){if(Z.stopped)break;se+=1,Z.abort=null;try{await N(fe.file,fe.relPath,se,k.length,Z),he+=1}catch(te){if(di(te)||Z.stopped)break;throw te}}}finally{P.setCancel(null)}if(Z.stopped){P.reset(),A(g("msg.uploadCanceled",{done:he,total:k.length})),await T(W.path);return}P.done(g("status.allDone")),setTimeout(()=>P.reset(),1500),A(g("msg.uploadDoneCount",{count:k.length})),await T(W.path)});y.addEventListener("click",()=>{R(g("list.loading"),()=>T(W.path))}),_.addEventListener("click",()=>{W.busy||(p.placeholder=g("placeholder.newDirName"),p.value="",h.style.display="",p.focus(),b=async()=>{let k=p.value.trim();k!==""&&(x(),await R(g("msg.creatingDir",{name:k}),async()=>{await O("mkdir",{path:Pi(W.path,k)}),await T(W.path)}))})}),c.addEventListener("click",()=>{W.busy===!1&&f.click()}),f.addEventListener("change",()=>{let k=[...f.files??[]].map(j=>({relPath:j.name,file:j}));f.value="",k.length>0&&G(k)});let $=0,Y=k=>{k?w.dataset.drag="":delete w.dataset.drag};n.addEventListener("dragenter",k=>{k.preventDefault(),$+=1,Y(!0)}),n.addEventListener("dragover",k=>{k.preventDefault()}),n.addEventListener("dragleave",()=>{$=Math.max(0,$-1),$===0&&Y(!1)}),n.addEventListener("drop",k=>{k.preventDefault(),$=0,Y(!1),!W.busy&&Ed(k.dataTransfer).then(j=>{(j.length>0||j._limitExceeded===!0)&&G(j)})}),m.addEventListener("keydown",k=>{if(k.key!=="Enter"||(k.preventDefault(),W.busy))return;let j=m.value.trim();j!==""&&R(g("list.loading"),()=>T(j))});let H=ca();bd(n,"SFTP \xB7 "+s,H===null?340:Math.round(H.height*.46),r),R(g("status.connectingEllipsis"),()=>T(""))}function mi(e){let t=e===void 0?gd():e,r=ar,i=qt!==null&&qt.ownerKey===t?qt:null;if(r===null&&i===null)return;sg();let o=$o;$o=null,o?.(),ar=null,i!==null&&(qt=null),r!==null&&r.remove(),i!==null&&i.dispose()}function pa(e){if(ir===null)return;ir.style.display=sh(e);let t=ce!==null?ce.querySelector("[data-act=search]"):null;t!==null&&(e?t.dataset.on="":delete t.dataset.on),e&&ir.focus()}function Ld(){ir!==null&&pa(nh(ir.style.display))}function lg(){return{matchBackground:Ae("--tt-term-search-match"),matchBorder:Ae("--tt-term-search-match-border"),activeMatchBackground:Ae("--tt-term-search-active"),activeMatchBorder:Ae("--tt-term-search-active-border"),matchOverviewRuler:Ae("--tt-term-search-match-border"),activeMatchColorOverviewRuler:Ae("--tt-term-search-active-border")}}function cg(e){let t=Pt();if(t===void 0||t.search===void 0)return;let r=ir.value;if(r==="")return;let i={decorations:lg()};e?t.search.findPrevious(r,i):t.search.findNext(r,i)}function bh(){Ki||ce===null&&!aa()||Rr!==null||(Rr=setTimeout(()=>{Rr=null,un()},Fi),Fi=Math.min(Fi*2,5e3))}function as(e){return e!==null&&typeof e=="object"&&e.persist===!0&&typeof e.persistName=="string"&&e.persistName!==""}function Qo(e){return as(e)||e!==null&&typeof e=="object"&&typeof e.command=="string"&&e.command!==""}function hg(){return wr==="tmux"?{t:"spawn",cwd:jo(),persist:!0,persistName:ua()}:{t:"spawn",cwd:jo()}}async function Td(){if(!Io){Io=!0;try{await dg()}finally{Io=!1}}}var Io=!1;async function dg(){if(await fa(),ce===null){await fg();return}let e=lm(),t=am();if(![...ie.values()].some(n=>n.embedded!==!0)){if(e.length>0||t.length>0){Ne({t:"sessions"});let n=await an("sessions",4e3),a=new Map;if(n!==null&&Array.isArray(n.list))for(let l of n.list)l!==null&&typeof l=="object"&&l.attachable===!0&&a.set(l.sid,l);let u=new Set;for(let l of e){if(a.has(l.sid))mm(l);else if(Qo(l.spawnSpec))gh(l);else continue;as(l.spawnSpec)&&u.add(l.spawnSpec.persistName)}for(let l of t){let d=l.spawnSpec.persistName;u.has(d)||(gh(l),u.add(d))}Kt()}if(![...ie.values()].some(n=>n.embedded!==!0)){if(await dn())return;Yi()}return}let r=[...ie.values()].filter(n=>!n.exited&&(n.embedded!==!0||n.spawned===!0)),i=r.filter(n=>Qo(n.spawnSpec)),o=null;if(i.length>0){Ne({t:"sessions"});let n=await an("sessions",4e3),a=Lo(n!==null?n.list:[]);o=i.filter(u=>!a.has(u.sid));for(let u of o)Ji(u.sid)}let s=o!==null?new Set(o.map(n=>n.sid)):new Set;for(let n of r)s.has(n.sid)||Ne({t:"attach",sid:n.sid})}function ug(){Be!==null&&(Be.readyState===WebSocket.OPEN||Be.readyState===WebSocket.CONNECTING)||un()}async function fg(){let e=[...ie.values()].filter(i=>i.embedded===!0&&!i.exited);if(e.length===0)return;Ne({t:"sessions"});let t=await an("sessions",4e3),r=Lo(t!==null?t.list:[]);for(let i of e)i.spawned===!0&&(r.has(i.sid)?Ne({t:"attach",sid:i.sid}):Qo(i.spawnSpec)?Jh(i):(i.exited=!0,i.live=!1,ei(i,g("status.ended"),g("btn.clickRerun"),"exited")))}function un(){if(Be!==null){try{Be.close()}catch{}Be=null}Ki=!1,clearTimeout(Rr),Rr=null,Us=!0,$s(g("status.connectingEllipsis"),"");try{Be=new WebSocket(P_())}catch(e){Us=!1,$s(g("error.connectFailed",{error:e.message}),"error"),bh();return}Be.onopen=()=>{Us=!1,Fi=1e3,At=null,$s(g("status.connected"),"connected");for(let e of[...No])No.delete(e),ie.has(e.tab.sid)&&Ne(e.frame);Td()},Be.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=t.sid;if(t.t==="ready"){let i=typeof t.target=="string"?t.target:"";Po(r,t.kind==="ssh"?g("status.connectedSsh",{target:i!==""?i+" ":""}):g("status.connectedPid",{pid:t.pid}),"connected");let o=ie.get(r);if(o!==void 0){if(o.exited=!1,o.spawned=!0,o.live=!0,o.errored=!1,o.target=i,o.persistTmux=t.persist===!0,t.kind==="ssh"&&i!==""&&!o.label&&(o.label=i,ut()),Dr(),Bo(r),ei(o,""),vi(o),t.persist===!0){let s=document.fonts!==void 0&&document.fonts.ready!==void 0?document.fonts.ready:Promise.resolve();Promise.race([s,new Promise(n=>setTimeout(n,500))]).then(()=>zh(150))}gi(),tm(r),xr(o.spawnSpec)&&Ne({t:"hidden",sid:r,hidden:!0}),Kt()}}else if(t.t==="hidden"){let i=ie.get(r);if(i!==void 0&&i.embedded!==!0){let o=t.hidden===!0;xr(i.spawnSpec)!==o&&(i.spawnSpec=Mo(i.spawnSpec,o),Kt(),ut(),pi())}}else if(t.t==="sessions")pm(t.list);else if(t.t==="data"){let i=ie.get(r);i!==void 0&&i.term!==null&&(i.term.write(String(t.d??"")),gg())}else if(t.t==="exit"){let i=ie.get(r);if(i!==void 0){i.exited=!0,i.live=!1,i.stats=null,r===xe&&Nr();let o=t.code!==null&&t.code!==void 0?"code="+t.code:"",s=t.signal!==null&&t.signal!==void 0?"signal="+t.signal:"";i.exitDetail=[o,s].filter(Boolean).join(" "),Po(r,g("status.exitedWith",{detail:i.exitDetail}),""),Dr(),Bo(r),ei(i,""),ns(),pi(),gi(),Sn(),Kt()}}else if(t.t==="stats")try{let i=ie.get(r);if(i!==void 0){let o=t.stats;i.stats=ch(o)?o:null,i.statsAt=Date.now(),r===xe&&Nr()}}catch(i){console.warn("[dsh-tty] stats \u5E27\u5904\u7406\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: "+(i instanceof Error?i.message:String(i)))}else if(t.t==="hint"){if(!rn||t.kind!=="failure"||typeof r!="string"||r==="")return;yr.set(r,{exitCode:typeof t.exitCode=="number"?t.exitCode:null,at:typeof t.at=="number"?t.at:Date.now(),dismissed:!1,busy:!1,answer:null,command:"",error:null}),r===xe&&Fr()}else if(t.t==="error")if(Po(r,g("status.error",{message:String(t.m??"")}),"error"),typeof r=="string"){let i=ie.get(r);i!==void 0&&(i.live||(i.errored=!0),Dr(),Bo(r),ei(i,g("status.errored"),g("status.retryHint",{message:String(t.m??"")}),"error"))}else pg(g("btn.clickRetry"))},Be.onclose=()=>{if(Us=!1,!Ki){$s(g("status.disconnectedReconnecting"),"error");for(let e of ie.values())e.exited||ei(e,g("status.disconnected"),g("status.reconnecting"),"info");bh()}},Be.onerror=()=>{}}function pg(e){si!==null&&(si.textContent=e)}function ea(){(ce===null||Xe)&&ta()}var Ks="DSH_TTY_ALLOW_PROXY_COMMAND";function _g(e){let t=new Date(Number(e)*1e3);if(Number.isNaN(t.getTime()))return String(e);let r=i=>String(i).padStart(2,"0");return`${String(t.getFullYear())}-${r(t.getMonth()+1)}-${r(t.getDate())} ${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`}function Md(){return typeof navigator<"u"&&navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText=="function"}async function wh(e){if(Md())try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}return t.remove(),r||gn(g("error.copyFailed"),"error"),r}function ta(){if(ce!==null){Xe&&_a();return}es(),ce=document.createElement("div"),ce.className="tt_modalBackdrop",ce.innerHTML='<div class="tt_modal"><div class="tt_header"><span class="tt_titleIcon">'+pn+'</span><div class="tt_tabbar"><div class="tt_tabs"></div><button type="button" class="tt_tabMore" hidden></button><button type="button" class="tt_tabAdd"></button></div><div class="tt_status"><span class="tt_statusDot"></span><span class="tt_statusText">'+g("status.initializing")+'</span></div><input class="tt_searchInput" style="display:'+Ro+'" placeholder="'+g("placeholder.search")+'" /><span class="tt_toolGroup"><button class="tt_toolBtn tt_iconBtn" data-act="search" title="'+g("btn.searchTitle")+'">'+N_+'</button><button class="tt_toolBtn tt_iconBtn" data-act="clear" title="'+g("btn.clearTitle")+'">'+Mh+'</button></span><span class="tt_winGroup"><button class="tt_min" title="'+g("btn.minimizeTitle")+'">'+W_+'</button><button class="tt_close" title="'+g("btn.closePanelTitle")+'">'+_n+'</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_statsBar" hidden></div><div class="tt_exitBar" hidden></div><button type="button" class="tt_assistBadge" hidden><span class="tt_assistDot"></span><span class="tt_assistBadgeText"></span></button><div class="tt_overlay"></div></div></div></div>',document.body.appendChild(ce),Zs=ce.querySelector(".tt_status"),Mr=ce.querySelector(".tt_statusText"),Br=ce.querySelector(".tt_statusDot"),Te=ce.querySelector(".tt_tabs");let e=ce.querySelector(".tt_tabAdd");e!==null&&(e.title=g("btn.newTab"),e.innerHTML=U_,e.addEventListener("click",()=>{Im(e)})),zt=ce.querySelector(".tt_tabMore"),zt!==null&&(zt.innerHTML=Ah,zt.title=g("btn.tabList"),zt.addEventListener("click",()=>{Nm(zt)})),Te.addEventListener("scroll",pi),Te.addEventListener("wheel",Tm,{passive:!1}),Te.addEventListener("contextmenu",jm),Te.addEventListener("auxclick",zm),Oi=ce.querySelector(".tt_connbar"),Ii=ce.querySelector(".tt_connDot"),Qs=ce.querySelector(".tt_connTarget"),Ct=ce.querySelector(".tt_connBadge"),Ni=ce.querySelector(".tt_connActions"),kt=ce.querySelector(".tt_work"),it=ce.querySelector(".tt_body"),Rt=ce.querySelector(".tt_statsBar"),$t=ce.querySelector(".tt_exitBar"),Vi="",vn(),At=null,Fh(),si=ce.querySelector(".tt_body > .tt_overlay"),gr=ce.querySelector(".tt_assistBadge"),gr!==null&&gr.addEventListener("click",()=>{gr!==null&&Xm(gr)}),Bt(),Fr(),ir=ce.querySelector(".tt_searchInput"),si.addEventListener("click",()=>{si.textContent="",un()}),ce.querySelector("[data-act=search]").addEventListener("click",()=>{Ld()}),ir.addEventListener("keydown",r=>{r.key==="Enter"?(r.preventDefault(),cg(r.shiftKey)):r.key==="Escape"&&(r.stopPropagation(),pa(!1))}),ce.querySelector("[data-act=clear]").addEventListener("click",()=>{let r=Pt();r!==void 0&&r.term!==null&&r.term.clear()}),ce.querySelector(".tt_min").addEventListener("click",()=>{Zi()}),ce.querySelector(".tt_close").addEventListener("click",()=>{Rd()}),ce.addEventListener("mousedown",r=>{ai===null&&r.target===ce&&Zi()}),document.addEventListener("keydown",Dd),Hi=new ResizeObserver(()=>{Xe||(Gs(),hm(Pt()),pi())}),Hi.observe(it),ut(),Dr(),Be!==null&&Be.readyState===WebSocket.OPEN?Td():un()}function Sn(){if(Gi===null)return;let e=[...ie.values()].filter(t=>!t.exited).length;Gi.textContent=ie.size>0?"\xB7 "+e+"/"+ie.size:""}function mg(){rt=document.createElement("div"),rt.className="tt_dock",rt.title=g("btn.restoreDock"),rt.innerHTML='<span class="tt_dockTitle">'+pn+"<span>"+g("panel.title")+'</span><span class="tt_dockCount"></span></span><span class="tt_dockStatus"></span><span class="tt_dockDot"></span><button class="tt_dockClose" title="'+g("btn.closePanelTitle")+'">'+ts+"</button>",Gi=rt.querySelector(".tt_dockCount"),fi=rt.querySelector(".tt_dockStatus"),Or=rt.querySelector(".tt_dockDot"),Sn(),Mr!==null&&(fi.textContent=Mr.textContent),Br!==null&&(Or.dataset.state=Br.dataset.state??""),rt.addEventListener("click",e=>{if(e.target.closest(".tt_dockClose")!==null){e.stopPropagation(),Rd();return}_a()}),document.body.appendChild(rt)}function Zi(){ce===null||Xe||(xt(),Lt(),Bt(),vr(),Xe=!0,ar!==null&&(ar.style.display="none"),pa(!1),ce.dataset.minimized="",Wh(),ss(),Nr(),document.querySelector("[data-dsh-tty-entry]")!==null?gi():(mg(),rt.classList.add("tt_dockCompact")))}function gi(){let e=document.querySelector("[data-dsh-tty-entry]");if(e===null)return;let t=e.querySelector(".tt_sidebarEntryBadge");if(!Xe){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=g("status.minimized");let r=[...ie.values()].filter(o=>!o.exited).length;t.querySelector(".tt_sidebarBadgeCount").textContent=r+"/"+ie.size;let i=t.querySelector(".tt_sidebarBadgeDot");i!==null&&Br!==null&&(i.dataset.state=Br.dataset.state??"")}function gg(){if(!Xe)return;let e=document.querySelector("[data-dsh-tty-entry] .tt_sidebarBadgeDot")??Or;e!==null&&(e.dataset.active="",clearTimeout(en),en=setTimeout(()=>{delete e.dataset.active},900))}function _a(){if(ce===null||!Xe)return;Xe=!1,delete ce.dataset.minimized,ar!==null&&(ar.style.display=""),clearTimeout(en),rt!==null&&(rt.remove(),rt=null),Gi=null,fi=null,Or=null,gi(),Fh(),ss(),Nr(),ns();let e=Pt();if(e!==void 0&&e.fit!==void 0){try{e.fit.fit()}catch{}e.spawned&&!e.exited&&vi(e)}e!==void 0&&e.term!==null&&e.term.focus()}function Rd(){let e=Kc(ie.values());if(!e.confirm){Qi();return}Xe&&_a(),vg(e)}function kr(){if(ai===null)return;ai.remove(),ai=null;let e=Ho;if(Ho=null,e!==null&&typeof e.focus=="function")try{e.focus()}catch{}}function Ad(e){if(ce===null)return;kr();let t=ce.querySelector(".tt_modal");if(t===null)return;let r=document.createElement("div");r.className="tt_confirmLayer",r.innerHTML='<div class="tt_confirmCard" role="dialog" aria-modal="true"><div class="tt_confirmTitle"></div><div class="tt_confirmText"></div><div class="tt_confirmHint"></div><div class="tt_confirmActions"><button type="button" class="tt_toolBtn tt_confirmCancel"></button>'+(e.minimize===!0?'<button type="button" class="tt_toolBtn tt_confirmMin"></button>':"")+'<button type="button" class="tt_toolBtn tt_btnDanger tt_confirmOk"></button></div></div>',r.querySelector(".tt_confirmTitle").textContent=e.title,r.querySelector(".tt_confirmText").textContent=e.text,r.querySelector(".tt_confirmHint").textContent=e.hint;let i=r.querySelector(".tt_confirmCancel");if(i.textContent=g("btn.cancel"),i.addEventListener("click",()=>kr()),e.minimize===!0){let s=r.querySelector(".tt_confirmMin");s.textContent=g("btn.minimize"),s.addEventListener("click",()=>{kr(),Zi()})}let o=r.querySelector(".tt_confirmOk");o.textContent=e.okLabel,o.addEventListener("click",()=>{kr(),e.onOk()}),r.addEventListener("mousedown",s=>{s.target===r&&kr()}),Ho=document.activeElement instanceof HTMLElement?document.activeElement:null,t.appendChild(r),ai=r;try{i.focus()}catch{}}function vg(e){Ad({title:g("confirm.closeTitle",{n:String(e.live)}),text:e.agentLive>0?g("confirm.closeTextAgent",{n:String(e.live),agent:String(e.agentLive)}):g("confirm.closeText",{n:String(e.live)}),hint:g("confirm.closeHint"),okLabel:g("confirm.closeOk",{n:String(e.live)}),onOk:Qi,minimize:!0})}function Qi(){if(ce===null)return;kr(),zi(!0);let e=aa();if(Ki=!e,Xe=!1,xt(),Lt(),or(),Bt(),Vs(),cn(),vr(),mi(),clearTimeout(en),clearTimeout(Rr),Rr=null,Fi=1e3,rt!==null&&(rt.remove(),rt=null),Gi=null,fi=null,Or=null,gi(),Be!==null){for(let t of ie.values())!t.exited&&t.embedded!==!0&&Ne({t:"kill",sid:t.sid});if(!e){try{Be.close()}catch{}Be=null}}Hi!==null&&(Hi.disconnect(),Hi=null);for(let[t,r]of[...ie])if(r.embedded!==!0){if(r.term!==null)try{r.term.dispose()}catch{}ie.delete(t)}xe=null,qi=null,document.removeEventListener("keydown",Dd),ce.remove(),ce=null,kt=null,Zs=null,Mr=null,Br=null,Te=null,zt=null,Oi=null,Ii=null,Qs=null,Ct=null,Ni=null,cn(),Wh(),Rt=null,vn(),At=null,$t=null,Vi="",it=null,si=null,ir=null,is=0;try{sessionStorage.removeItem(tn)}catch{}}function Dd(e){if(e.key==="Escape"&&ce!==null){if(e.preventDefault(),ai!==null){kr();return}if(ar!==null){mi();return}if(oi!==null){vr();return}if(Et!==null){xt();return}Zi()}}function bg(){let e=document.querySelector('[data-pane="sidebar"], [class*="sidebarCol"]');if(e!==null)return e.querySelector('[class*="logoRow"]')?.parentElement??e.firstElementChild}function wg(e){let t=e.querySelector('button[class*="newSession"]');if(t!==null)return t;for(let r of e.children)if(r.tagName==="BUTTON")return r}function yg(){let e=document.createElement("div");return e.dataset.dshTtyEntry="",e.className="tt_sidebarEntry",e.setAttribute("role","button"),e.setAttribute("aria-label",g("panel.title")),e.tabIndex=0,e.innerHTML='<span class="tt_sidebarEntryIcon">'+pn+'</span><span class="tt_sidebarEntryLabel">'+g("panel.title")+"</span>",e.addEventListener("click",t=>{t.preventDefault(),ta()}),e.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" "||t.key==="Spacebar")&&(t.preventDefault(),ta())}),e}function yh(e,t){let r=wg(e);if(r===void 0)return!1;if(t.parentElement!==e){let i=r.closest('[class*="logoRow"]'),o=i!==null&&i.parentElement===e?i:r,s=Array.from(e.children).filter(n=>n instanceof HTMLElement&&n.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 n=s[s.length-1];e.insertBefore(t,n.nextSibling)}else e.insertBefore(t,o.nextElementSibling)}return!0}function Sg(){if(es(),typeof document<"u"&&document.querySelector("[data-dsh-tty-entry]")!==null)return()=>{};let e=yg(),t,r=!1,i=()=>{if(t!==void 0&&!t.isConnected&&(s.disconnect(),t=void 0,r=!1),r){if(document.body.contains(e))return;s.disconnect(),t=void 0,r=!1}t??(t=bg()),t!==void 0&&(r=yh(t,e),r&&s.observe(t,{childList:!0,subtree:!0}))},o=new MutationObserver(()=>{i()});o.observe(document.body,{childList:!0,subtree:!0});let s=new MutationObserver(()=>{if(t===void 0||!t.isConnected){r=!1,i();return}t.contains(e)||(r=yh(t,e))});return i(),()=>{o.disconnect(),s.disconnect(),e.remove()}}window.__ModuleLoader__.load({id:"@hyzyn/dsh-tty",factory:e=>{let t={},r=e("react"),{jsx:i,jsxs:o}=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 n(u){let l=u&&u.view,d=l==="page",[m,y]=r.useState(d),[_,c]=r.useState(null),[f,h]=r.useState(!1),[p,v]=r.useState(!1),[S,b]=r.useState({kind:"",text:""}),[x,w]=r.useState(null),[E,B]=r.useState(""),[P,W]=r.useState(!1),[A,V]=r.useState(Date.now()),O=r.useRef(null),R=r.useRef(null),[F,I]=r.useState([]),[C,L]=r.useState(!1),[T,D]=r.useState({groups:[],loading:!1,failed:!1}),[N,G]=r.useState(!1),$=r.useRef(null),Y=r.useRef(null),H=r.useRef(0),k=M=>i("div",{className:"tt_cardSection",children:M}),j=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json();z.ok&&typeof z.config=="object"&&z.config!==null?(O.current=z.config,R.current=JSON.stringify(he(z.config)),c(z.config),Xi(z.config)):b({kind:"error",text:String(z.error||g("error.configLoadFailed"))})}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},q=async()=>{try{let z=await(await fetch("/api/dsh-tty/shells",{cache:"no-store"})).json();z.ok&&Array.isArray(z.shells)&&I(z.shells)}catch{}},U=(M,z)=>{let K=M.current,X=K===null||K.parentElement===null?null:K.parentElement.querySelector(z);K===null||X===null||(X.style.width=String(Math.round(K.getBoundingClientRect().width))+"px",os(X,K))};r.useLayoutEffect(()=>{if(!N&&!C)return;let M=()=>{N&&U($,".tt_routeList"),C&&U(Y,".tt_shellList")};return M(),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[N,C,T.loading,T.failed,T.groups,F,_?.shell]);let J=async()=>{let M=H.current+1;H.current=M,D(z=>({...z,loading:!0}));try{let K=await(await fetch("/api/dsh-tty/model-catalog",{cache:"no-store"})).json();if(K.ok===!0&&M===H.current){D({groups:Array.isArray(K.groups)?K.groups:[],loading:!1,failed:!1});return}}catch{}M===H.current&&D({groups:[],loading:!1,failed:!0})};r.useEffect(()=>{m&&!f&&(h(!0),j(),q(),J())},[m]);let Z=(M,z)=>c(K=>{let X={...K||{},[M]:z};return O.current=X,X}),se=new Set(["toolsRegistered","platform","shellIntegrationSupported","allowProxyCommandGranted","allowProxyCommandGrantSource","allowProxyCommandGrantedAt"]),he=M=>{let z={};for(let[K,X]of Object.entries(M||{}))se.has(K)||X!==void 0&&(z[K]=X);return z.sshHosts=Array.isArray(M?.sshHosts)?M.sshHosts:[],z.tunnels=Array.isArray(M?.tunnels)?M.tunnels:[],M?.sftpLimits&&typeof M.sftpLimits=="object"&&(z.sftpLimits={maxDownloadMb:Number(M.sftpLimits.maxDownloadMb)||0,maxUploadMb:Number(M.sftpLimits.maxUploadMb)||0,maxUploadFiles:Number(M.sftpLimits.maxUploadFiles)||0}),z};O.current=_;let fe=(M,z)=>c(K=>({...K||{},sftpLimits:{...K?.sftpLimits??{},[M]:z}})),[te,qe]=r.useState(null),[le,Me]=r.useState(null),[st,He]=r.useState(""),[ee,ne]=r.useState(null),[ge,be]=r.useState(""),[je,Oe]=r.useState(""),[ze,Re]=r.useState(""),We=r.useRef(null),[we,_t]=r.useState(!1),[Ze,nt]=r.useState({text:"",kind:""}),[ls,Q]=r.useState(!1),[oe,de]=r.useState({running:!1,ok:!1,text:""}),[ae,pe]=r.useState({}),[ue,Ce]=r.useState([]),[ve,ye]=r.useState({direction:"local",localPort:"",remoteHost:"",remotePort:"",localTargetPort:"",bookName:""}),[Ee,Le]=r.useState(null);r.useEffect(()=>{if(!m)return;let M=!0,z=async()=>{try{let re=await(await fetch("/api/dsh-tty/tunnels",{cache:"no-store"})).json();M&&re.ok&&Array.isArray(re.tunnels)&&Ce(re.tunnels)}catch{}};z();let K=setInterval(z,2e3);return()=>{M=!1,clearInterval(K)}},[m]);let Se=M=>z=>ye(K=>({...K||{},[M]:z.target.value})),De=(M,z)=>ye(K=>({...K||{},[M]:z})),Qe=M=>M?.direction==="remote"?g("meta.tunnelRemote",{host:M.remoteHost||"127.0.0.1",port:String(M.remotePort??0),local:String(M.localTargetPort??0)}):g("meta.tunnelLocal",{local:String(M?.localPort??0),host:M?.remoteHost??"?",port:String(M?.remotePort??0)}),ht=(_?.sshHosts??[]).find(M=>M?.name===ve?.bookName),cr=async M=>{try{let z=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tunnels:M})}),K=await z.json().catch(()=>({}));return!z.ok||!K.ok?(b({kind:"error",text:String(K.error||g("error.saveTunnelFailed"))}),{ok:!1,warnings:[]}):{ok:!0,warnings:Array.isArray(K.warnings)?K.warnings.map(re=>String(re)).filter(re=>re!==""):[]}}catch(z){return b({kind:"error",text:String(z&&z.message?z.message:z)}),{ok:!1,warnings:[]}}},ma=(M,z)=>{if(M.warnings.length>0){b({kind:"warn",text:M.warnings.join(" ")});return}b({kind:"ok",text:z})},ga=()=>Nc(ve,(Array.isArray(_?.sshHosts)?_.sshHosts:[]).map(M=>M?.name),g),Pd=M=>{b({kind:"",text:""}),Le(String(M?.name??"")),ye({direction:M?.direction==="remote"?"remote":"local",bookName:String(M?.bookName??""),localPort:M?.localPort?String(M.localPort):"",remoteHost:String(M?.remoteHost??""),remotePort:M?.remotePort?String(M.remotePort):"",localTargetPort:M?.localTargetPort?String(M.localTargetPort):""})},Bd=()=>{Le(null),b({kind:"",text:""}),ye(M=>({...M||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))},Od=()=>{b({kind:"",text:""});let M=ga();if(!M.ok){b({kind:"error",text:M.error});return}let z=M.tunnel,K=Array.isArray(_?.tunnels)?_.tunnels:[];if(Hc(K,z.name)!==void 0){b({kind:"error",text:g("error.tunnelNameTaken",{name:z.name})});return}let X=[...K,z];c(re=>({...re||{},tunnels:X})),ye(re=>({...re||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),cr(X).then(re=>{re.ok&&ma(re,g("msg.tunnelApplied",{name:z.name}))})},Id=()=>{if(Ee===null)return;b({kind:"",text:""});let M=ga();if(!M.ok){b({kind:"error",text:M.error});return}let z=Array.isArray(_?.tunnels)?_.tunnels:[],K=Fc(z,Ee,M.tunnel,g);if(!K.ok){K.reason==="missing"&&Le(null),b({kind:"error",text:K.error});return}let X=K.tunnels;c(re=>({...re||{},tunnels:X})),cr(X).then(re=>{if(re.ok!==!0){c(_e=>({..._e||{},tunnels:z}));return}Le(null),ye(_e=>({..._e||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""})),ma(re,g("msg.tunnelUpdated",{name:M.tunnel.name}))})},va=(M,z)=>{c(K=>({...K||{},tunnels:M})),cr(M).then(K=>{if(K.ok!==!0){c(X=>({...X||{},tunnels:z}));return}K.warnings.length>0&&b({kind:"warn",text:K.warnings.join(" ")})})},Nd=M=>{let z=Array.isArray(_?.tunnels)?_.tunnels:[];Ee!==null&&String(M??"")===Ee&&(Le(null),ye(K=>({...K||{},localPort:"",remoteHost:"",remotePort:"",localTargetPort:""}))),va(z.filter(K=>K?.name!==M),z)},Hd=(M,z)=>{let K=Array.isArray(_?.tunnels)?_.tunnels:[];va(K.map(X=>X?.name===M?{...X,enabled:z}:X),K)},Fd=M=>{qe(M?.name??null),He(""),de({running:!1,ok:!1,text:""}),be(""),Oe(""),xn(),_t(Ut!==null),Me({name:M?.name??"",host:M?.host??"",port:String(M?.port??22),username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:M?.hostKeyAlias??"",persist:M?.persist!==!1}),kh().then(z=>ne(z)),kn(M?.password??"")},ba=()=>{qe(null),Me(null),He(""),de({running:!1,ok:!1,text:""}),be(""),Oe(""),xn()},Wd=async()=>{if(le===null)return;let M=le.name.trim(),z=le.host.trim(),K=le.username.trim();if(M===""||z===""||K===""){He(g("error.nameHostUserRequired"));return}let X=Number(le.port);if((!Number.isInteger(X)||X<1||X>65535)&&(X=22),(_?.sshHosts??[]).some(_e=>_e?.name===M&&M!==te)){He(g("error.bookNameTaken",{name:M}));return}if(le.auth==="key"&&le.keyPath.trim()===""){He(g("error.keyPathRequired"));return}He("");let re=le.password;if(le.auth==="password"){let _e=await Th(we,le.password,z,X,K,"PASSWORD");if(_e.error!==void 0){He(_e.error);return}_e.value!==void 0&&(re=_e.value)}c(_e=>({..._e||{},sshHosts:(Array.isArray(_e?.sshHosts)?_e.sshHosts:[]).map(ke=>ke?.name===te?{name:M,host:z,port:X,username:K,auth:le.auth,keyPath:le.keyPath.trim(),passphrase:le.passphrase,password:re,agentForward:le.agentForward,hostKeyAlias:String(le.hostKeyAlias??"").trim(),persist:le.persist===!0}:ke)})),pe(_e=>{let ke={..._e};return delete ke[M],te!==M&&delete ke[te],ke}),qe(null),Me(null),de({running:!1,ok:!1,text:""}),b({kind:"ok",text:g("msg.hostEdited",{name:M})})},jd=M=>{te===M&&ba(),pe(z=>{let K={...z};return delete K[M],K}),c(z=>({...z||{},sshHosts:(Array.isArray(z?.sshHosts)?z.sshHosts:[]).filter(K=>K?.name!==M)}))},zd=async M=>{let z=M?.name??"";if(z==="")return;let K={host:M?.host??"",port:Number(M?.port)||22,username:M?.username??"",auth:M?.auth==="key"||M?.auth==="password"?M.auth:"agent",keyPath:M?.keyPath??"",passphrase:M?.passphrase??"",password:M?.password??"",agentForward:M?.agentForward===!0,hostKeyAlias:typeof M?.hostKeyAlias=="string"?M.hostKeyAlias:""};pe(re=>({...re,[z]:{running:!0,text:g("msg.probing")}}));let X=await Ko(K,!0);pe(re=>{let _e=re[z]||{};if(X.result){let ke=X.result.auth?.ok===!0;return{...re,[z]:{running:!1,ok:ke,text:Go(X.result)}}}return{...re,[z]:{running:!1,ok:!1,text:g("error.probeFailed",{detail:String(X.error||g("error.unknown"))})}}})},Ud=async M=>{let z=(Array.isArray(_?.hostKeys)?_.hostKeys:[]).filter(K=>!(K?.host===M?.host&&Number(K?.port)===Number(M?.port)));c(K=>({...K||{},hostKeys:z}));try{let K=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:z})}),X=await K.json().catch(()=>({}));!K.ok||!X.ok?b({kind:"error",text:String(X.error||g("error.hostKeyDeleteFailed"))}):b({kind:"ok",text:g("msg.hostKeyDeleted")})}catch(K){b({kind:"error",text:String(K&&K.message?K.message:K)})}},$d=async()=>{b({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/ssh-config",{cache:"no-store"})).json();if(!z.ok){b({kind:"error",text:String(z.error||g("error.sshConfigReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],X=[...Array.isArray(_?.sshHosts)?_.sshHosts:[]],re=new Set(X.map(Fe=>Fe?.name)),_e=0,ke=0;for(let Fe of K)if(!(Fe===null||typeof Fe!="object"||typeof Fe.name!="string")){if(re.has(Fe.name)){ke+=1;continue}re.add(Fe.name),X.push({name:Fe.name,host:String(Fe.host??Fe.name),port:Number(Fe.port)||22,username:String(Fe.username??""),auth:Fe.auth==="key"?"key":"agent",keyPath:String(Fe.keyPath??""),passphrase:"",password:"",agentForward:!1,hostKeyAlias:typeof Fe.hostKeyAlias=="string"?Fe.hostKeyAlias:""}),_e+=1}c(Fe=>({...Fe||{},sshHosts:X}));let me=Array.isArray(z.proxy)?z.proxy.filter(Fe=>typeof Fe=="string"):[],ot=Number.isInteger(z.proxyCount)?z.proxyCount:me.length,Sr=Array.isArray(z.proxyCommand)?z.proxyCommand.filter(Fe=>typeof Fe=="string"):[],dt=Number.isInteger(z.proxyCommandCount)?z.proxyCommandCount:Sr.length,jr=Number.isInteger(z.skippedOther)?z.skippedOther:0,hr=Number.isInteger(z.droppedOverflow)?z.droppedOverflow:0,Tt=[];ot>0&&Tt.push(g("msg.proxySkipped",{count:ot,names:me.slice(0,5).join(g("list.separator"))+(ot>5?g("meta.etc"):"")})),dt>0&&Tt.push(g("msg.proxyCommandSkipped",{count:dt,names:Sr.slice(0,5).join(g("list.separator"))+(dt>5?g("meta.etc"):"")})),jr>0&&Tt.push(g("msg.skippedNotConcrete",{count:jr})),hr>0&&Tt.push(g("msg.importOverflow",{count:hr}));let La=Tt.length>0?g("list.separatorFull")+Tt.join(g("list.separatorFull")):"";if(_e===0){let Fe=ke>0?g("msg.noNewEntries",{count:ke}):g("msg.noImportableHosts");b({kind:Tt.length>0?"error":"ok",text:Fe+La})}else b({kind:Tt.length>0?"error":"ok",text:g("msg.importedHosts",{added:_e,skipped:ke})+La})}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},wa=M=>M===null||typeof M!="object"?[]:Array.isArray(M.fingerprints)?M.fingerprints.filter(z=>typeof z=="string"&&z!==""):typeof M.fingerprint=="string"&&M.fingerprint!==""?[M.fingerprint]:[],qd=async()=>{b({kind:"",text:""});try{let z=await(await fetch("/api/dsh-tty/known-hosts",{cache:"no-store"})).json();if(!z.ok){b({kind:"error",text:String(z.error||g("error.knownHostsReadFailed"))});return}let K=Array.isArray(z.entries)?z.entries:[],X=[...Array.isArray(_?.hostKeys)?_.hostKeys:[]],re=new Map;for(let me of X)me===null||typeof me!="object"||re.set(String(me.host??"")+":"+String(me.port??22),{record:me,fps:new Set(wa(me))});let _e=0,ke=0;for(let me of K){if(me===null||typeof me!="object"||typeof me.host!="string")continue;let ot=Array.isArray(me.fingerprints)?me.fingerprints.filter(hr=>typeof hr=="string"&&hr!==""):[];if(typeof me.fingerprint=="string"&&me.fingerprint!==""&&ot.push(me.fingerprint),ot.length===0)continue;let Sr=me.host+":"+String(me.port??22),dt=re.get(Sr);if(dt!==void 0){let hr=!1;for(let Tt of ot)dt.fps.has(Tt)||dt.fps.size>=8||(dt.fps.add(Tt),hr=!0);if(!hr){ke+=1;continue}delete dt.record.fingerprint,dt.record.fingerprints=[...dt.fps],_e+=1;continue}let jr={host:me.host,port:Number(me.port)||22,fingerprints:[...new Set(ot)].slice(0,8)};re.set(Sr,{record:jr,fps:new Set(jr.fingerprints)}),X.push(jr),_e+=1}if(_e===0){b({kind:"ok",text:ke>0?g("msg.noNewFingerprints",{count:ke}):g("msg.noImportableKnownHosts")});return}c(me=>({...me||{},hostKeys:X}));try{let me=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostKeys:X})}),ot=await me.json().catch(()=>({}));if(!me.ok||!ot.ok){b({kind:"error",text:String(ot.error||g("error.saveHostKeysFailed"))});return}b({kind:"ok",text:g("msg.importedFingerprints",{added:_e,skipped:ke})+(z.truncated===!0?g("hint.knownHostsTruncated"):"")})}catch(me){b({kind:"error",text:String(me&&me.message?me.message:me)})}}catch(M){b({kind:"error",text:String(M&&M.message?M.message:M)})}},ya=async M=>{let z=M??O.current??_;v(!0),b({kind:"",text:""});let K=he(z);try{let X=await fetch("/api/dsh-tty/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(K)}),re=await X.json();!X.ok||!re.ok?b({kind:"error",text:String(re.error||g("error.saveFailed"))}):(b({kind:"ok",text:g("msg.saved")}),R.current=JSON.stringify(K),re.config&&(O.current=re.config,c(re.config),Xi(re.config)))}catch(X){b({kind:"error",text:String(X&&X.message?X.message:X)})}v(!1)},Cn=M=>"/api/dsh-tty/elevate"+M,Sa=async()=>{try{let z=await(await fetch("/api/dsh-tty/config",{cache:"no-store"})).json(),K=z&&typeof z.config=="object"&&z.config!==null?z.config:null;if(K===null)return;c(X=>{if(X===null)return X;let re={...X,allowProxyCommandGranted:K.allowProxyCommandGranted===!0,allowProxyCommandGrantSource:K.allowProxyCommandGrantSource??null,allowProxyCommandGrantedAt:Number.isFinite(K.allowProxyCommandGrantedAt)?K.allowProxyCommandGrantedAt:null};return O.current=re,re})}catch{}},Ca=async()=>{w(null),W(!1);let M=O.current||{},z=R.current!==null&&JSON.stringify(he(M))===R.current,K={...M,allowProxyCommand:!0};O.current=K,c(K),await Sa(),z?(await ya(K),B(g("elev.granted"))):B(g("elev.grantedNeedSave"))},xa=async()=>{W(!1),B(""),w({phase:"loading"});try{let M=await fetch(Cn(""),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}),z=await M.json().catch(()=>({}));if(!M.ok){w({phase:"error",error:String(z.error||M.status)});return}if(z.status==="granted"){await Ca();return}w({phase:"pending",command:String(z.command??""),expiresAt:Number(z.expiresAt)||0})}catch(M){w({phase:"error",error:String(M&&M.message?M.message:M)})}},Kd=async()=>{B("");try{let M=await fetch(Cn("/revoke"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}),z=await M.json().catch(()=>({}));if(!M.ok){B(g("elev.error")+String(z.error||M.status));return}await Sa(),B(g("elev.revoked"))}catch(M){B(g("elev.error")+String(M&&M.message?M.message:M))}},Gd=async()=>{let M=x===null?"":String(x.command??"");if(M!==""){if(Md())try{await navigator.clipboard.writeText(M),W(!0);return}catch{}W(!1),B(g("elev.copyManual"))}};r.useEffect(()=>{if(x===null||x.phase!=="pending")return;let M=setInterval(()=>V(Date.now()),1e3),z=setInterval(()=>{fetch(Cn("/status"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({capability:Ks})}).then(K=>K.json()).then(K=>{K.status==="granted"&&Ca()}).catch(()=>{})},1500);return()=>{clearInterval(M),clearInterval(z)}},[x]);let Vd=()=>{if(_.allowProxyCommandGrantSource==="env")return i("span",{className:"tt_cardHint",children:g("elev.viaEnv")});let M=_.allowProxyCommandGrantedAt;return o("span",{className:"tt_capState",children:[Number.isFinite(M)?i("span",{children:g("elev.grantedAt",{time:_g(M)})}):null,i("button",{type:"button",className:"tt_toolBtn tt_capRevoke",onClick:()=>{Kd()},children:g("elev.revoke")})]})},Yd=()=>{let M=String(x.command??""),z=x.expiresAt>0?Math.max(0,Math.ceil((x.expiresAt-A)/1e3)):0,K=x.phase==="pending"&&x.expiresAt>0&&z===0,X=()=>{w(null),W(!1)};return o("div",{className:"tt_elevPanel",children:[o("div",{className:"tt_elevHead",children:[i("span",{className:"tt_cardLabel",children:g("elev.title")}),i("button",{type:"button",className:"tt_toolBtn",onClick:X,children:g("elev.close")})]}),i("span",{className:"tt_cardHint",children:g("elev.lockedWhy")}),x.phase==="error"?i("span",{className:"tt_cardHint tt_sshProbeWarn",children:g("elev.error")+String(x.error??"")}):null,x.phase==="loading"?i("span",{className:"tt_cardHint",children:g("elev.loading")}):null,M===""?null:o("div",{className:"tt_elevSteps",children:[i("span",{className:"tt_cardHint",children:g("elev.step")}),i("div",{className:"tt_elevCommand",children:i("code",{children:M})}),o("div",{className:"tt_elevActions",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Gd()},children:g(P?"elev.copied":"elev.copy")}),K?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{xa()},children:g("elev.regenerate")}):i("span",{className:"tt_cardHint",children:g("elev.expiresIn",{sec:z})})]}),i("span",{className:"tt_cardHint",children:g(K?"elev.expired":"elev.waiting")})]}),_.allowProxyCommand===!0&&_.allowProxyCommandGranted!==!0?i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{Z("allowProxyCommand",!1),X()},children:g("elev.disableFirst")}):null,i("span",{className:"tt_cardHint",children:g("elev.otherWay")}),i("span",{className:"tt_cardHint",children:g("elev.envHow",{env:Ks})})]})},Jd=()=>{let M=_.allowProxyCommandGranted===!0,z=_.allowProxyCommand===!0;return o("div",{className:"tt_capBlock",children:[o("label",{className:"tt_cardField tt_cardRow tt_cardToggle tt_cardDanger",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:z,onChange:K=>{if(!M){xa();return}Z("allowProxyCommand",K.target.checked)}}),i("span",{className:"tt_cardLabel",children:g("check.allowProxyCommand")}),z&&!M?i("span",{className:"tt_badgeWarn",children:g("badge.notEffective")}):null]}),i("span",{className:"tt_cardHint",children:g("hint.allowProxyCommand")}),M?Vd():i("span",{className:"tt_cardHint tt_sshProbeWarn",children:g("hint.proxyCommandNotGranted")}),E===""?null:i("span",{className:"tt_cardHint",children:E}),x===null?null:Yd()]})},xn=()=>{We.current!==null&&(clearTimeout(We.current),We.current=null),Re("")},kn=async M=>{let z=ii(M);if(ui()===null){_t(!1),Q(!1),nt({text:g(Ut===null?"error.credPlainUnavailable":"error.credPlainIncomplete"),kind:"muted"});return}if(z===""){Q(!1),nt({text:"",kind:""});return}let K=await Eh(z);if(K.unreported===!0){Q(!1),nt({text:g("status.credUnreported",{ref:z}),kind:"plain"});return}if(K.error!==void 0){Q(!1),nt({text:g("error.credStatusFailed",{error:K.error}),kind:"error"});return}let X=K.view;nt({text:X.configured?g("status.credStored",{ref:z,source:X.source!==""?g("meta.credSource",{source:X.source}):""}):g("status.credUnknown",{ref:z}),kind:X.configured?"ok":"plain"}),Q(X.configured===!0&&X.writable===!0)},Xd=async()=>{let M=ii(le?.password??"");if(M==="")return;let z=await Lh(M);if(z.error!==void 0){nt({text:z.error,kind:"error"});return}Me(K=>({...K||{},password:""})),nt({text:"",kind:""}),Q(!1)},Zd=(M,z)=>{let K=String(le?.[M]??"");if(K===""||K.startsWith("env:")||ze===z){xn(),Me(X=>({...X||{},[M]:"env:"+z})),be(""),M==="password"&&kn("env:"+z);return}Re(z),We.current!==null&&clearTimeout(We.current),We.current=setTimeout(()=>{We.current=null,Re("")},4e3)},ka=(M,z)=>{if(ee===null)return null;if(ee.length===0)return i("span",{className:"tt_cardHint",children:z});let K=ge===M,X=je.trim().toUpperCase(),re=X===""?ee:ee.filter(_e=>_e.toUpperCase().includes(X));return o("div",{className:"tt_credPicker",children:[i("input",{className:"tt_cardInput",value:K?je:"",placeholder:g("placeholder.credRef"),title:g("hint.credRefCandidates"),autoComplete:"off",spellCheck:!1,onFocus:()=>{be(M),Oe("")},onBlur:_e=>{_e.currentTarget.parentElement.contains(_e.relatedTarget)||be("")},onChange:_e=>{Oe(_e.target.value),be(M)}}),...K?[i("div",{className:"tt_envList",children:[...re.length===0?[i("span",{className:"tt_envMore",children:g("list.noCredRef")})]:re.slice(0,30).map(_e=>i("button",{type:"button",className:"tt_envItem","data-danger":ze===_e?"":void 0,onMouseDown:ke=>ke.preventDefault(),onClick:()=>Zd(M,_e),children:ze===_e?g("list.credOverwrite",{name:_e}):_e},_e)),...re.length>30?[i("span",{className:"tt_envMore",children:g("list.moreMatches",{count:re.length-30})})]:[]]},"cred-list-"+M)]:[]]})},Qd=()=>{let z=ii(le?.password??"")!=="",K=ui()===null;return o("div",{className:"tt_sshRow tt_credRow",children:[z?i("button",{type:"button",className:"tt_toolBtn tt_credClear",disabled:ls!==!0,onClick:()=>{Xd()},children:g("btn.clearCredential")}):i("label",{className:"tt_credToggle",title:g("hint.rememberCredentialApply"),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:we,disabled:K,onChange:X=>_t(X.target.checked)}),i("span",{children:g("check.rememberCredentialApply")})]}),Ze.text===""?null:i("span",{className:"tt_credStatus","data-kind":Ze.kind,children:Ze.text}),K&&Ze.text===""?i("span",{className:"tt_credStatus","data-kind":"muted",children:g("error.credPlainUnavailable")}):null]})},Ea=()=>{let M=String(le?.host??"").trim(),z=String(le?.username??"").trim(),K=Number(le?.port);if((!Number.isInteger(K)||K<1||K>65535)&&(K=22),M===""||z==="")return He(g("error.hostUserRequired")),null;let X=le?.auth,re={host:M,port:K,username:z,auth:X};if(X==="key"){let ke=String(le?.keyPath??"").trim();if(ke==="")return He(g("error.keyPathRequired")),null;re.keyPath=ke,le?.passphrase!==""&&(re.passphrase=le.passphrase)}if(X==="password"){let ke=String(le?.password??"");if(ke==="")return He(g("error.passwordRequired")),null;re.password=ke}le?.agentForward===!0&&(re.agentForward=!0);let _e=String(le?.hostKeyAlias??"").trim();return _e!==""&&(re.hostKeyAlias=_e),re},eu=()=>{He("");let M=Ea();M!==null&&(de({running:!0,ok:!1,text:g("msg.probing")}),Ko(M,!1).then(z=>{if(z.result){let K=z.result.auth?.ok===!0;de({running:!1,ok:K,text:Go(z.result)});return}de({running:!1,ok:!1,text:g("error.probeFailed",{detail:String(z.error||g("error.unknown"))})})}))},tu=()=>{He("");let M=Ea();M!==null&&yn(M)},ru=()=>{if(le===null)return null;let M=(z,K,X,re,_e)=>o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:z}),i("input",{className:"tt_cardInput",type:re??"text",value:le[K]??"",placeholder:X??"",autoComplete:"off",spellCheck:!1,onChange:ke=>{let me=ke.target.value;Me(ot=>({...ot||{},[K]:me}))},..._e??{}})]});return o("div",{className:"tt_sshEdit",children:[i("div",{className:"tt_sshSection",children:g("section.connection")}),o("div",{className:"tt_sshGrid",children:[M(g("field.bookName"),"name",g("hint.bookNameConflict")),M(g("field.port"),"port","22")]}),M(g("field.host"),"host",g("placeholder.host")),M(g("field.username"),"username","root"),i("div",{className:"tt_sshSection",children:g("section.auth")}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.authMethod")}),o("select",{className:"tt_cardInput",value:le.auth,onChange:z=>Me(K=>({...K||{},auth:z.target.value})),children:[i("option",{value:"agent",children:g("option.authAgent")}),i("option",{value:"key",children:g("option.authKey")}),i("option",{value:"password",children:g("option.authPassword")})]})]}),...le.auth==="key"?[M(g("field.keyPath"),"keyPath","~/.ssh/id_ed25519"),M(g("field.passphrase"),"passphrase","","password"),ka("passphrase",g("hint.noCredRefPassphrase"))]:[],...le.auth==="password"?[M(g("field.password"),"password","","password",{onBlur:()=>{kn(le.password)}}),Qd(),ka("password",g("hint.noCredRefPasswordApply"))]:[],i("div",{className:"tt_sshSection",children:g("section.options")}),o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:le.agentForward===!0,onChange:z=>Me(K=>({...K||{},agentForward:z.target.checked}))}),i("span",{className:"tt_cardLabel",children:g("check.agentForward")})]}),M(g("field.hostKeyAlias"),"hostKeyAlias",g("placeholder.hostKeyAlias")),i("span",{className:"tt_cardHint",title:g("hint.hostKeyAliasFull"),children:g("hint.hostKeyAlias")}),wr==="tmux"?o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:le.persist===!0,onChange:z=>Me(K=>({...K||{},persist:z.target.checked}))}),i("span",{className:"tt_cardLabel",children:g("check.persist")})]}):null,oe.text!==""?i("div",{className:"tt_sshProbeResult"+(!oe.running&&oe.ok?" tt_sshProbeOk":"")+(!oe.running&&!oe.ok?" tt_sshProbeBad":""),children:oe.text}):null,st!==""?i("span",{className:"tt_cardMessage tt_cardMessageError",children:st}):null,o("div",{className:"tt_sshActions",children:[o("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:ba,children:g("btn.cancel")}),i("button",{type:"button",className:"tt_toolBtn",title:g("btn.browseTitle"),onClick:tu,children:g("btn.fileBrowse")}),i("button",{type:"button",className:"tt_toolBtn",disabled:oe.running,title:g("btn.probeTitle"),onClick:eu,children:oe.running?g("msg.probing"):g("btn.probe")})]}),o("div",{className:"tt_sshActionsGroup",children:[i("button",{type:"button",className:"tt_cardSave",onClick:()=>{Wd()},children:g("btn.apply")}),i("span",{className:"tt_cardHint",children:g("hint.appliedOnSave")})]})]})]})},iu=M=>{let z=typeof M?.assistProvider=="string"?M.assistProvider.trim():"",K=typeof M?.assistModel=="string"?M.assistModel.trim():"";return z!==""&&K!==""?z+"/"+K:z!==""?z:K},su=()=>{if(T.loading)return i("span",{className:"tt_envMore",children:g("list.modelLoading")});if(T.failed)return i("span",{className:"tt_envMore",children:g("list.modelCatalogFailed")});let M=[],z=(_?.assistProvider??"")===""&&(_?.assistModel??"")==="";M.push(i("button",{type:"button",className:"tt_envItem",...z?{"data-active":""}:{},onMouseDown:K=>K.preventDefault(),onClick:()=>{c(K=>({...K||{},assistProvider:"",assistModel:""})),G(!1)},children:g("option.followHostModel")},"assist-route-default"));for(let K of T.groups){let X=String(K.id??"");if(X==="")continue;let re=String(K.name??X),_e=Array.isArray(K.models)?K.models:[];if(_e.length!==0){M.push(i("span",{className:"tt_envMore",children:re},"group-"+X));for(let ke of _e){let me=String(ke.id??"");if(me==="")continue;let ot=String(ke.name??"")===""?me:String(ke.name),Sr=(_?.assistProvider??"")===X&&(_?.assistModel??"")===me;M.push(i("button",{type:"button",className:"tt_envItem",...Sr?{"data-active":""}:{},title:X+"/"+me,onMouseDown:dt=>dt.preventDefault(),onClick:()=>{c(dt=>({...dt||{},assistProvider:X,assistModel:me})),G(!1)},children:ot===me?me:ot},X+"/"+me))}}}return T.groups.length===0&&M.push(i("span",{className:"tt_envMore",children:g("list.noModelCandidate")},"assist-route-empty")),M},wi=(M,z,K,X)=>o("label",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:M}),i("input",{className:"tt_cardInput",value:_[z]??"",placeholder:K??"",onChange:re=>Z(z,re.target.value)}),X?i("span",{className:"tt_cardHint",children:X}):null]}),Wr=(M,z,K,X)=>o("label",{className:"tt_cardField tt_cardRow tt_cardToggle"+(typeof K=="string"&&K!==""?" "+K:""),children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:_[z]===!0,disabled:X===!0&&_[z]!==!0,onChange:re=>Z(z,re.target.checked)}),i("span",{className:"tt_cardLabel",children:M})]}),yi=_?.platform==="win32",En=_?.shellIntegrationSupported===!0;return l==="summary"?g("card.desc"):o(d?"div":"li",{className:d?"tt_pageHost":m?"tt_card tt_cardOpen":"tt_card",children:[d?null:o("button",{type:"button",className:"tt_cardHeader","aria-expanded":m,onClick:()=>y(M=>!M),children:[o("span",{className:"tt_cardHeadText",children:[i("span",{className:"tt_cardName",children:g("card.name")}),i("span",{className:"tt_cardDescription",children:g("card.descFull")})]}),i("span",{className:"dshkit_badge",children:"Kit"}),i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:m?"tt_cardChevron tt_cardChevronOpen":"tt_cardChevron",children:i("path",{d:s,fill:"currentColor"})})]}),d||m?o("div",{className:"tt_cardBody",children:[_===null?i("div",{className:"tt_cardMessage",children:g("list.loadingConfig")}):o("div",{children:[k(g("section.basic")),Wr(g("check.enabled"),"enabled"),Wr(g("check.announce"),"announceToAgent"),yi?o("div",{className:"tt_cardField",children:[o("label",{className:"tt_cardRow",children:[i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:_.shellIntegration===!0,disabled:!En,onChange:M=>Z("shellIntegration",M.target.checked)}),i("span",{className:"tt_cardLabel",children:g(En?"check.shellIntegrationWindows":"check.shellIntegration")})]}),i("span",{className:"tt_cardHint",children:g(En?"hint.shellIntegrationPowerShell":"hint.shellIntegrationWindows")})]}):Wr(g("check.shellIntegrationWindows"),"shellIntegration"),k(g("section.sftp")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("field.sftpStyle")}),o("select",{className:"tt_cardInput",value:_.sftpStyle==="dual"?"dual":"dialog",onChange:M=>Z("sftpStyle",M.target.value),children:[i("option",{value:"dialog",children:g("option.sftpDialog")}),i("option",{value:"dual",children:g("option.sftpDual")})]}),i("span",{className:"tt_cardHint",children:g("hint.sftpDual")})]}),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("field.sftpLimits")}),o("div",{className:"tt_limitGrid",children:[o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.downloadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxDownloadMb))?Number(_.sftpLimits.maxDownloadMb):1024),onChange:M=>fe("maxDownloadMb",Number(M.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.uploadLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxUploadMb))?Number(_.sftpLimits.maxUploadMb):2048),onChange:M=>fe("maxUploadMb",Number(M.target.value)||0)})]}),o("label",{className:"tt_sshRow",children:[i("span",{className:"tt_cardLabel",children:g("field.uploadCountLimit")}),i("input",{className:"tt_cardInput",type:"number",min:0,value:String(Number.isFinite(Number(_?.sftpLimits?.maxUploadFiles))?Number(_.sftpLimits.maxUploadFiles):1e3),onChange:M=>fe("maxUploadFiles",Number(M.target.value)||0)})]})]}),i("span",{className:"tt_cardHint",children:g("hint.sftpLimits")})]}),k(g("section.session")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("field.persistence")}),o("select",{className:"tt_cardInput",value:_.persistence==="tmux"?"tmux":"off",onChange:M=>Z("persistence",M.target.value),children:[i("option",{value:"off",children:g("option.persistOff")}),i("option",{value:"tmux",children:g("option.persistTmux")})]}),i("span",{className:"tt_cardHint",children:g("hint.persistence")+(yi?g("hint.persistenceWindows"):"")}),Wr(g("check.endOnPageClose"),"endOnPageClose"),Wr(g("check.statsEnabled"),"statsEnabled"),i("span",{className:"tt_cardHint",children:g("hint.statsEnabled")}),Jd()]}),k(g("section.assist")),Wr(g("check.assistEnabled"),"assistEnabled"),i("span",{className:"tt_cardHint",children:g("hint.assistEnabled")}),o("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||G(!1)},children:[i("span",{className:"tt_cardLabel",children:g("field.assistRoute")}),i("input",{className:"tt_cardInput tt_routeInput",ref:$,readOnly:!0,value:iu(_),autoComplete:"off",spellCheck:!1,onFocus:()=>{G(!0),T.groups.length===0&&!T.loading&&J()},onClick:()=>{G(!0),T.groups.length===0&&!T.loading&&J()},onKeyDown:M=>{M.key==="Escape"&&G(!1)}}),...N?[i("div",{className:"tt_envList tt_routeList",children:su()},"assist-route-list")]:[],i("span",{className:"tt_cardHint",children:g("hint.assistRoute")})]},"assist-route-field"),wi(g("field.maxSessions"),"maxSessions","4",g("hint.maxSessions")),o("div",{className:"tt_cardField",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||L(!1)},children:[i("span",{className:"tt_cardLabel",children:g(yi?"field.shellWindows":"field.shell")}),i("input",{className:"tt_cardInput",ref:Y,value:_.shell??"",placeholder:g(yi?"placeholder.shellWindows":"placeholder.shell"),autoComplete:"off",spellCheck:!1,onFocus:()=>L(!0),onClick:()=>L(!0),onKeyDown:M=>{M.key==="Escape"&&L(!1)},onChange:M=>{Z("shell",M.target.value),L(!0)}}),...C?[i("div",{className:"tt_envList tt_shellList",children:(()=>{let M=(_.shell??"").trim().toLowerCase(),z=M===""?F:F.filter(K=>K.toLowerCase().includes(M));return z.length===0?i("span",{className:"tt_envMore",children:g("list.noShellCandidate")}):z.map(K=>i("button",{type:"button",className:"tt_envItem",onMouseDown:X=>X.preventDefault(),onClick:()=>{Z("shell",K),L(!1)},children:K},K))})()},"shell-list")]:[],i("span",{className:"tt_cardHint",children:g(yi?"hint.shellCandidatesWindows":"hint.shellCandidates")})]},"shell-field"),wi("TERM","term","xterm-256color",g("hint.term")),wi("COLORTERM","colorTerm","truecolor",""),wi(g("field.cwd"),"cwd","",g("placeholder.cwd")),wi(g("field.grace"),"reconnectGraceSec","120",g("hint.grace")),k(g("section.ssh")),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("panel.sshBook")}),...Array.isArray(_.sshHosts)&&_.sshHosts.length>0?[i("div",{className:"tt_hostList","data-editing":te!==null?"":void 0,children:_.sshHosts.map(M=>o("div",{children:[o("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:M?.name??""}),i("span",{className:"tt_sshHostTarget",children:qo(M??{})})]}),i("button",{type:"button",className:"tt_toolBtn",disabled:ae[M?.name]?.running===!0,onClick:()=>{zd(M)},title:g("btn.probeRowTitle"),children:ae[M?.name]?.running===!0?g("msg.testing"):g("btn.test")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Fd(M),children:g("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>jd(M?.name),children:g("btn.delete")})]}),ae[M?.name]&&ae[M?.name].text?i("div",{className:"tt_sshProbeResult"+(ae[M?.name].ok?" tt_sshProbeOk":" tt_sshProbeBad"),children:ae[M?.name].text}):null,te===M?.name?ru():null]},String(M?.name??"")))})]:[i("span",{className:"tt_cardHint",children:g("list.emptySshHosts")})],o("div",{className:"tt_cardRow",children:[i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{$d()},children:g("btn.importSshConfig")}),i("span",{className:"tt_cardHint",children:g("hint.importSshConfig")})]}),i("span",{className:"tt_cardHint",children:g("hint.sshBook")})]}),o("div",{className:"tt_cardField",children:[o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("panel.tunnels")}),...Array.isArray(_.tunnels)&&_.tunnels.length>0?[i("div",{children:_.tunnels.map(M=>{let z=ue.find(re=>re.name===M?.name),K=z?.state??"stopped",X=Ee!==null&&String(M?.name??"")===Ee;return o("div",{className:"tt_sshHostRow","data-editing":X?"":void 0,children:[i("span",{className:"tt_tunnelDot","data-state":K,title:K}),i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:(M?.name??"")+" \xB7 "+Qe(M??{})}),i("span",{className:"tt_sshHostTarget",children:(M?.bookName??"")+(z?.error?" \xB7 "+z.error:"")+(z?.lastForwardError?" \xB7 "+z.lastForwardError:"")})]}),i("input",{type:"checkbox",className:"tt_cardCheckbox",checked:M?.enabled!==!1,title:g("check.tunnelEnabled"),onChange:re=>Hd(M?.name,re.target.checked)}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>Pd(M),children:g("btn.edit")}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>Nd(M?.name),children:g("btn.delete")})]},String(M?.name??""))})})]:[i("span",{className:"tt_cardHint",children:g("list.emptyTunnels")})],o("div",{className:"tt_sshEdit",children:[o("div",{className:"tt_cardRow tt_tunnelHead",children:[o("div",{className:"tt_segmented",role:"group","aria-label":g("field.direction"),children:[i("button",{type:"button",className:"tt_segmentedBtn","data-active":ve.direction!=="remote"?"":void 0,title:g("option.localForwardTitle"),onClick:()=>De("direction","local"),children:g("option.localForward")}),i("button",{type:"button",className:"tt_segmentedBtn","data-active":ve.direction==="remote"?"":void 0,title:g("option.remoteForwardTitle"),onClick:()=>De("direction","remote"),children:g("option.remoteForward")})]}),o("select",{className:"tt_cardInput",value:ve.bookName,onChange:Se("bookName"),children:[i("option",{value:"",children:g("option.selectBook")}),...Array.isArray(_?.sshHosts)?_.sshHosts.map(M=>i("option",{value:M?.name??"",children:M?.name??""})):[]]})]}),i("span",{className:"tt_cardHint",children:ht!==void 0?g("hint.tunnelViaBook",{book:qo(ht)}):g("hint.tunnelBookEmpty")}),ve.direction==="local"?o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:g("hint.localListenFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.localPort"),value:ve.localPort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.localListenPort"),onChange:Se("localPort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"local",title:g("hint.flowLocalToRemote"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:g("placeholder.remoteHost"),title:g("hint.remoteHostTitle"),value:ve.remoteHost,autoComplete:"off","aria-label":g("field.remoteHost"),onChange:Se("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.port"),value:ve.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.remotePort"),onChange:Se("remotePort")})]})]}):o("div",{className:"tt_tunnelEndpoints",children:[o("div",{className:"tt_tunnelHop",children:[o("div",{className:"tt_tunnelEndpoint",children:[i("input",{className:"tt_cardInput tt_tunnelHost",placeholder:g("placeholder.remoteListenHost"),title:g("hint.remoteListenHost"),value:ve.remoteHost,autoComplete:"off","aria-label":g("field.remoteListenHost"),onChange:Se("remoteHost")}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.listenPort"),value:ve.remotePort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.remoteListenPort"),onChange:Se("remotePort")})]}),i("span",{className:"tt_tunnelArrow","data-direction":"remote",title:g("hint.flowRemoteToLocal"),"aria-hidden":"true",children:"\u2192"})]}),o("div",{className:"tt_tunnelEndpoint",children:[i("span",{className:"tt_tunnelEndpointStatic",title:g("hint.localDialFixed"),children:"127.0.0.1"}),i("span",{className:"tt_tunnelColon",children:":"}),i("input",{className:"tt_cardInput tt_tunnelPort",placeholder:g("placeholder.localTargetPort"),value:ve.localTargetPort,autoComplete:"off",inputMode:"numeric","aria-label":g("field.localTargetPort"),onChange:Se("localTargetPort")})]})]}),i("div",{className:"tt_tunnelEndpoints",children:[i("span",{className:"tt_tunnelEndLabel",children:ve.direction==="local"?g("hint.tunnelLocalSummary"):g("hint.tunnelRemoteSummary")})]}),i("div",{className:"tt_cardRow tt_tunnelActions",children:[Ee===null?i("button",{type:"button",className:"tt_cardSave",onClick:Od,children:g("btn.addTunnel")}):i("button",{type:"button",className:"tt_cardSave",onClick:Id,children:g("btn.saveEdit")}),Ee===null?null:i("button",{type:"button",className:"tt_toolBtn",onClick:Bd,children:g("btn.cancel")}),i("span",{className:"tt_cardHint",children:Ee===null?g("hint.tunnelAdd"):g("hint.tunnelEditing",{name:Ee})})]})]})]}),o("div",{className:"tt_cardField",children:[i("span",{className:"tt_cardLabel",children:g("panel.hostKeys")}),i("button",{type:"button",className:"tt_toolBtn",onClick:()=>{qd()},children:g("btn.importKnownHosts")})]}),...Array.isArray(_.hostKeys)&&_.hostKeys.length>0?[i("div",{className:"tt_hostList",children:_.hostKeys.map((M,z)=>o("div",{className:"tt_sshHostRow",children:[i("div",{className:"tt_sshHostMeta",children:[i("span",{className:"tt_sshHostName",children:String(M?.host??"")+":"+String(M?.port??22)}),i("span",{className:"tt_sshHostTarget",children:wa(M).map(K=>"sha256:"+K).join(" / ")})]}),i("button",{type:"button",className:"tt_toolBtn tt_btnDanger",onClick:()=>{Ud(M)},children:g("btn.delete")})]},String(M?.host??"")+":"+String(M?.port??22)+"#"+String(z)))})]:[i("span",{className:"tt_cardHint",children:g("list.emptyHostKeys")})],i("span",{className:"tt_cardHint",children:g("hint.hostKeys")})]}),o("div",{className:"tt_cardField tt_cardRow",children:[i("button",{className:"tt_cardSave",disabled:p,onClick:()=>{ya()},children:g(p?"msg.saving":"btn.save")}),i("span",{className:"tt_cardMessage"+(S.kind==="ok"?" tt_cardMessageOk":S.kind==="error"?" tt_cardMessageError":S.kind==="warn"?" tt_cardMessageWarn":""),children:S.text})]})]})]}):null]})}t.inject=["slots","sessions"];let a=["@hyzyn/dsh-tty#tty","@hyzyn/dsh-all#tty"];return t.apply=u=>{D_(u),Hh=u.sessions,u.inject(["remote","remote.credentials"],S=>(Ut=S.remote?.credentials??S["remote.credentials"]??null,()=>{Ut=null}));let l=!1,d=()=>{};hn={set(S){if(S!==l){if(l=S,S){d=Sg();return}d(),d=()=>{},Qi(),Dr()}}},sd(!0),fa();let m="@hyzyn/dsh-all",_=[...new Set(a.map(S=>S.split("#")[0]))].find(S=>S!==m),c=!1,f=[];_!==void 0&&u.slots.inject("plugins.bundle.config",()=>{for(c=!0;f.length>0;){let S=f.pop();typeof S=="function"&&S()}return u.slots.register({name:"plugins.bundle.config",key:_},n)});for(let S of a)u.slots.inject("plugins.row.config",()=>{let b=S.split("#")[0]===_;if(b&&c)return;let x=u.slots.register({name:"plugins.row.config",key:S},n);return b&&f.push(x),x});u.slots.inject("settings.kit.item",()=>u.slots.register({name:"settings.kit.item",id:"tty",order:80,label:()=>g("card.name")},n)),u.slots.inject("settings.plugin.item",()=>u.slots.register({name:"settings.plugin.item",key:"tty",order:100},n));let h=u.provide("ttyConnbar",{version:1,addAction:mn,requestRender(){Dr()}}),p=u.provide("ttyTerminal",{version:3,open(S){if(!Pr)return;let b=Gh(S),x=Vh(S,b),w=typeof S?.label=="string"&&S.label!==""?S.label:void 0;if(es(),S?.reuse!==!1){let E=dm(x);if(E!==null)return ea(),lr(E.sid,{user:!0}),E}return ea(),Yi(x,w)},mount(S,b){return Pr?ym(S,b):()=>{}}}),v=u.provide("ttyPanel",{version:2,isOpen(){return ce!==null&&!Xe},mountPane(S){return Xh(S)},minimize(){return Zi(),ce!==null&&Xe}});return()=>{hn=null,Pr=!1,d(),v(),p(),h(),Qi()}},t}});})();
|
|
3667
3767
|
/*! Bundled license information:
|
|
3668
3768
|
|
|
3669
3769
|
@xterm/addon-search/lib/addon-search.mjs:
|