MCPcopy Index your code
hub / github.com/pyscript/pyscript / _renderRows

Method _renderRows

core/src/3rd-party/xterm.js:9–9  ·  view source on GitHub ↗
(e,t)

Source from the content-addressed store, hash-verified

7var we=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{};function De(){throw new Error("setTimeout has not been defined")}function Re(){throw new Error("clearTimeout has not been defined")}var ne=De,oe=Re;typeof we.setTimeout=="function"&&(ne=setTimeout),typeof we.clearTimeout=="function"&&(oe=clearTimeout);function xe(K){if(ne===setTimeout)return setTimeout(K,0);if((ne===De||!ne)&&setTimeout)return ne=setTimeout,setTimeout(K,0);try{return ne(K,0)}catch{try{return ne.call(null,K,0)}catch{return ne.call(this,K,0)}}}function Pe(K){if(oe===clearTimeout)return clearTimeout(K);if((oe===Re||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(K);try{return oe(K)}catch{try{return oe.call(null,K)}catch{return oe.call(this,K)}}}var te=[],ce=!1,ae,ge=-1;function Ie(){!ce||!ae||(ce=!1,ae.length?te=ae.concat(te):ge=-1,te.length&&Ae())}function Ae(){if(!ce){var K=xe(Ie);ce=!0;for(var X=te.length;X;){for(ae=te,te=[];++ge<X;)ae&&ae[ge].run();ge=-1,X=te.length}ae=null,ce=!1,Pe(K)}}function He(K){var X=new Array(arguments.length-1);if(arguments.length>1)for(var J=1;J<arguments.length;J++)X[J-1]=arguments[J];te.push(new Be(K,X)),te.length===1&&!ce&&xe(Ae)}function Be(K,X){this.fun=K,this.array=X}Be.prototype.run=function(){this.fun.apply(null,this.array)};var Fe="browser",We="browser",Ue=!0,Ne={},$e=[],je="",ze={},Ke={},qe={};function he(){}var Ve=he,Ge=he,Xe=he,Je=he,Ye=he,Ze=he,Qe=he;function et(K){throw new Error("process.binding is not supported")}function tt(){return"/"}function it(K){throw new Error("process.chdir is not supported")}function st(){return 0}var le=we.performance||{},rt=le.now||le.mozNow||le.msNow||le.oNow||le.webkitNow||function(){return new Date().getTime()};function nt(K){var X=rt.call(le)*.001,J=Math.floor(X),Q=Math.floor(X%1*1e9);return K&&(J=J-K[0],Q=Q-K[1],Q<0&&(J--,Q+=1e9)),[J,Q]}var ot=new Date;function at(){var K=new Date,X=K-ot;return X/1e3}var ye={nextTick:He,title:Fe,browser:Ue,env:Ne,argv:$e,version:je,versions:ze,on:Ve,addListener:Ge,once:Xe,off:Je,removeListener:Ye,removeAllListeners:Ze,emit:Qe,binding:et,cwd:tt,chdir:it,umask:st,hrtime:nt,platform:We,release:Ke,config:qe,uptime:at};typeof Symbol=="function"&&Symbol.toStringTag&&Object.defineProperty(ye,Symbol.toStringTag,{value:"process",enumerable:!1,writable:!0,configurable:!1});var Ee={exports:{}},Te;function ht(){return Te||(Te=1,(function(K,X){(function(J,Q){K.exports=Q()})(globalThis,(()=>(()=>{var J={4567:function(O,r,o){var l=this&&this.__decorate||function(e,t,a,_){var u,p=arguments.length,c=p<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(c=(p<3?u(c):p>3?u(t,a,c):u(t,a))||c);return p>3&&c&&Object.defineProperty(t,a,c),c},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=o(9042),d=o(9924),v=o(844),g=o(4725),h=o(2585),i=o(3656);let s=r.AccessibilityManager=class extends v.Disposable{constructor(e,t,a,_){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=_,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,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((u=>this._handleResize(u.rows)))),this.register(this._terminal.onRender((u=>this._refreshRows(u.start,u.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((u=>this._handleChar(u)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
8`)))),this.register(this._terminal.onA11yTab((u=>this._handleTab(u)))),this.register(this._terminal.onKey((u=>this._handleKey(u.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,i.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
9`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const a=this._terminal.buffer,_=a.lines.length.toString();for(let u=e;u<=t;u++){const p=a.lines.get(a.ydisp+u),c=[],m=p?.translateToString(!0,void 0,void 0,c)||"",E=(a.ydisp+u+1).toString(),k=this._rowElements[u];k&&(m.length===0?(k.innerText="\xA0",this._rowColumns.set(k,[0,1])):(k.textContent=m,this._rowColumns.set(k,c)),k.setAttribute("aria-posinset",E),k.setAttribute("aria-setsize",_))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const a=e.target,_=this._rowElements[t===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==_)return;let u,p;if(t===0?(u=a,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(u=this._rowElements.shift(),p=a,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){const c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{const c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===a.node&&t.offset>a.offset)&&([t,a]=[a,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const _=this._rowElements.slice(-1)[0];if(a.node.compareDocumentPosition(_)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(a={node:_,offset:_.textContent?.length??0}),!this._rowContainer.contains(a.node))return;const u=({node:m,offset:E})=>{const k=m instanceof Text?m.parentNode:m;let D=parseInt(k?.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const b=this._rowColumns.get(k);if(!b)return console.warn("columns is null. Race condition?"),null;let x=E<b.length?b[E]:b.slice(-1)[0]+1;return x>=this._terminal.cols&&(++D,x=0),{row:D,column:x}},p=u(t),c=u(a);if(p&&c){if(p.row>c.row||p.row===c.row&&p.column>=c.column)throw new Error("invalid range");this._terminal.select(p.column,p.row,(c.row-p.row)*this._terminal.cols-p.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=s=l([f(1,h.IInstantiationService),f(2,g.ICoreBrowserService),f(3,g.IRenderService)],s)},3614:(O,r)=>{function o(d){return d.replace(/\r?\n/g,"\r")}function l(d,v){return v?"\x1B[200~"+d+"\x1B[201~":d}function f(d,v,g,h){d=l(d=o(d),g.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(d,!0),v.value=""}function n(d,v,g){const h=g.getBoundingClientRect(),i=d.clientX-h.left-10,s=d.clientY-h.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${s}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=l,r.copyHandler=function(d,v){d.clipboardData&&d.clipboardData.setData("text/plain",v.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,v,g,h){d.stopPropagation(),d.clipboardData&&f(d.clipboardData.getData("text/plain"),v,g,h)},r.paste=f,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,v,g,h,i){n(d,v,g),i&&h.rightClickSelect(d),v.value=h.selectionText,v.select()}},7239:(O,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const l=o(1505);r.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(f,n,d){this._css.set(f,n,d)}getCss(f,n){return this._css.get(f,n)}setColor(f,n,d){this._color.set(f,n,d)}getColor(f,n){return this._color.get(f,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,l,f,n){o.addEventListener(l,f,n);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(l,f,n))}}}},3551:function(O,r,o){var l=this&&this.__decorate||function(s,e,t,a){var _,u=arguments.length,p=u<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,a);else for(var c=s.length-1;c>=0;c--)(_=s[c])&&(p=(u<3?_(p):u>3?_(e,t,p):_(e,t))||p);return u>3&&p&&Object.defineProperty(e,t,p),p},f=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const n=o(3656),d=o(8460),v=o(844),g=o(2585),h=o(4725);let i=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,a,_){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=a,this._linkProviderService=_,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,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const t=s.composedPath();for(let a=0;a<t.length;a++){const _=t[a];if(_.classList.contains("xterm"))break;if(_.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach((a=>{a?.forEach((_=>{_.link.dispose&&_.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=s.y);let t=!1;for(const[a,_]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(t=this._checkLinkProviderResult(a,s,t)):_.provideLinks(s.y,(u=>{if(this._isMouseOut)return;const p=u?.map((c=>({link:c})));this._activeProviderReplies?.set(a,p),t=this._checkLinkProviderResult(a,s,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)}))}_removeIntersectingLinks(s,e){const t=new Set;for(let a=0;a<e.size;a++){const _=e.get(a);if(_)for(let u=0;u<_.length;u++){const p=_[u],c=p.link.range.start.y<s?0:p.link.range.start.x,m=p.link.range.end.y>s?this._bufferService.cols:p.link.range.end.x;for(let E=c;E<=m;E++){if(t.has(E)){_.splice(u--,1);break}t.add(E)}}}}_checkLinkProviderResult(s,e,t){if(!this._activeProviderReplies)return t;const a=this._activeProviderReplies.get(s);let _=!1;for(let u=0;u<s;u++)this._activeProviderReplies.has(u)&&!this._activeProviderReplies.get(u)||(_=!0);if(!_&&a){const u=a.find((p=>this._linkAtPosition(p.link,e)));u&&(t=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let u=0;u<this._activeProviderReplies.size;u++){const p=this._activeProviderReplies.get(u)?.find((c=>this._linkAtPosition(c.link,e)));if(p){t=!0,this._handleNewLink(p);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t=>{if(!this._currentLink)return;const a=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,_=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=_&&(this._clearCurrentLink(a,_),this._lastMouseEvent)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}}))))}_linkHover(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){const t=s.range,a=this._bufferService.buffer.ydisp,_=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-a-1,t.end.x,t.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(_)}_linkLeave(s,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){const t=s.range.start.y*this._bufferService.cols+s.range.start.x,a=s.range.end.y*this._bufferService.cols+s.range.end.x,_=e.y*this._bufferService.cols+e.x;return t<=_&&_<=a}_positionFromMouseEvent(s,e,t){const a=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,a,_){return{x1:s,y1:e,x2:t,y2:a,cols:this._bufferService.cols,fg:_}}};r.Linkifier=i=l([f(1,h.IMouseService),f(2,h.IRenderService),f(3,g.IBufferService),f(4,h.ILinkProviderService)],i)},9042:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(O,r,o){var l=this&&this.__decorate||function(h,i,s,e){var t,a=arguments.length,_=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(h,i,s,e);else for(var u=h.length-1;u>=0;u--)(t=h[u])&&(_=(a<3?t(_):a>3?t(i,s,_):t(i,s))||_);return a>3&&_&&Object.defineProperty(i,s,_),_},f=this&&this.__param||function(h,i){return function(s,e){i(s,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=o(511),d=o(2585);let v=r.OscLinkProvider=class{constructor(h,i,s){this._bufferService=h,this._optionsService=i,this._oscLinkService=s}provideLinks(h,i){const s=this._bufferService.buffer.lines.get(h-1);if(!s)return void i(void 0);const e=[],t=this._optionsService.rawOptions.linkHandler,a=new n.CellData,_=s.getTrimmedLength();let u=-1,p=-1,c=!1;for(let m=0;m<_;m++)if(p!==-1||s.hasContent(m)){if(s.loadCell(m,a),a.hasExtendedAttrs()&&a.extended.urlId){if(p===-1){p=m,u=a.extended.urlId;continue}c=a.extended.urlId!==u}else p!==-1&&(c=!0);if(c||p!==-1&&m===_-1){const E=this._oscLinkService.getLinkData(u)?.uri;if(E){const k={start:{x:p+1,y:h},end:{x:m+(c||m!==_-1?0:1),y:h}};let D=!1;if(!t?.allowNonHttpProtocols)try{const b=new URL(E);["http:","https:"].includes(b.protocol)||(D=!0)}catch{D=!0}D||e.push({text:E,range:k,activate:(b,x)=>t?t.activate(b,x,k):g(0,x),hover:(b,x)=>t?.hover?.(b,x,k),leave:(b,x)=>t?.leave?.(b,x,k)})}c=!1,a.hasExtendedAttrs()&&a.extended.urlId?(p=m,u=a.extended.urlId):(p=-1,u=-1)}}i(e)}};function g(h,i){if(confirm(`Do you want to navigate to ${i}?
10
11WARNING: This link could potentially be dangerous`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=l([f(0,d.IBufferService),f(1,d.IOptionsService),f(2,d.IOscLinkService)],v)},6193:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,l){this._renderCallback=o,this._coreBrowserService=l,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,l,f){this._rowCount=f,o=o!==void 0?o:0,l=l!==void 0?l: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,l):l,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(O,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const l=o(3614),f=o(3656),n=o(3551),d=o(9042),v=o(3730),g=o(1680),h=o(3107),i=o(5744),s=o(2950),e=o(1296),t=o(428),a=o(4269),_=o(5114),u=o(8934),p=o(3230),c=o(9312),m=o(4725),E=o(6731),k=o(8055),D=o(8969),b=o(8460),x=o(844),T=o(6114),I=o(8437),U=o(2584),P=o(7399),S=o(5941),w=o(9074),y=o(2585),L=o(5435),B=o(4567),H=o(779);class N extends D.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(R={}){super(R),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new b.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new b.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new b.EventEmitter),this._onBlur=this.register(new b.EventEmitter),this._onA11yCharEmitter=this.register(new b.EventEmitter),this._onA11yTabEmitter=this.register(new b.EventEmitter),this._onWillOpen=this.register(new b.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(w.DecorationService),this._instantiationService.setService(y.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(H.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((C,A)=>this.refresh(C,A)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((C=>this._reportWindowsOptions(C)))),this.register(this._inputHandler.onColor((C=>this._handleColorEvent(C)))),this.register((0,b.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,b.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((C=>this._afterResize(C.cols,C.rows)))),this.register((0,x.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(R){if(this._themeService)for(const C of R){let A,M="";switch(C.index){case 256:A="foreground",M="10";break;case 257:A="background",M="11";break;case 258:A="cursor",M="12";break;default:A="ansi",M="4;"+C.index}switch(C.type){case 0:const W=k.color.toColorRGB(A==="ansi"?this._themeService.colors.ansi[C.index]:this._themeService.colors[A]);this.coreService.triggerDataEvent(`${U.C0.ESC}]${M};${(0,S.toRgbString)(W)}${U.C1_ESCAPED.ST}`);break;case 1:if(A==="ansi")this._themeService.modifyColors((F=>F.ansi[C.index]=k.channels.toColor(...C.color)));else{const F=A;this._themeService.modifyColors((z=>z[F]=k.channels.toColor(...C.color)))}break;case 2:this._themeService.restoreColor(C.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(R){R?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(B.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(R){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const R=this.buffer.ybase+this.buffer.y,C=this.buffer.lines.get(R);if(!C)return;const A=Math.min(this.buffer.x,this.cols-1),M=this._renderService.dimensions.css.cell.height,W=C.getWidth(A),F=this._renderService.dimensions.css.cell.width*W,z=this.buffer.y*this._renderService.dimensions.css.cell.height,V=A*this._renderService.dimensions.css.cell.width;this.textarea.style.left=V+"px",this.textarea.style.top=z+"px",this.textarea.style.width=F+"px",this.textarea.style.height=M+"px",this.textarea.style.lineHeight=M+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(C=>{this.hasSelection()&&(0,l.copyHandler)(C,this._selectionService)})));const R=C=>(0,l.handlePasteEvent)(C,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",R)),this.register((0,f.addDisposableDomListener)(this.element,"paste",R)),T.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(C=>{C.button===2&&(0,l.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(C=>{(0,l.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(C=>{C.button===1&&(0,l.moveTextAreaUnderMouseCursor)(C,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(R=>this._keyUp(R)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(R=>this._keyDown(R)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(R=>this._keyPress(R)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(R=>this._compositionHelper.compositionupdate(R)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(R=>this._inputEvent(R)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(R){if(!R)throw new Error("Terminal requires a parent element.");if(R.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=R.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"),R.appendChild(this.element);const C=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),C.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,f.addDisposableDomListener)(this.screenElement,"mousemove",(A=>this.updateCursorStyle(A)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),C.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),T.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(_.CoreBrowserService,this.textarea,R.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(A=>this._handleTextAreaFocus(A)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(E.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(a.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(p.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((A=>this._onRender.fire(A)))),this.onResize((A=>this._renderService.resize(A.cols,A.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(C);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((A=>this.scrollLines(A.amount,A.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(c.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((A=>this.scrollLines(A.amount,A.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((A=>this._renderService.handleSelectionChanged(A.start,A.end,A.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((A=>{this.textarea.value=A,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((A=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(A=>this._selectionService.handleMouseDown(A)))),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(B.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(A=>this._handleScreenReaderModeOptionChange(A)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(A=>{!this._overviewRulerRenderer&&A&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const R=this,C=this.element;function A(F){const z=R._mouseService.getMouseReportCoords(F,R.screenElement);if(!z)return!1;let V,G;switch(F.overrideType||F.type){case"mousemove":G=32,F.buttons===void 0?(V=3,F.button!==void 0&&(V=F.button<3?F.button:3)):V=1&F.buttons?0:4&F.buttons?1:2&F.buttons?2:3;break;case"mouseup":G=0,V=F.button<3?F.button:3;break;case"mousedown":G=1,V=F.button<3?F.button:3;break;case"wheel":if(R._customWheelEventHandler&&R._customWheelEventHandler(F)===!1||R.viewport.getLinesScrolled(F)===0)return!1;G=F.deltaY<0?0:1,V=4;break;default:return!1}return!(G===void 0||V===void 0||V>4)&&R.coreMouseService.triggerMouseEvent({col:z.col,row:z.row,x:z.x,y:z.y,button:V,action:G,ctrl:F.ctrlKey,alt:F.altKey,shift:F.shiftKey})}const M={mouseup:null,wheel:null,mousedrag:null,mousemove:null},W={mouseup:F=>(A(F),F.buttons||(this._document.removeEventListener("mouseup",M.mouseup),M.mousedrag&&this._document.removeEventListener("mousemove",M.mousedrag)),this.cancel(F)),wheel:F=>(A(F),this.cancel(F,!0)),mousedrag:F=>{F.buttons&&A(F)},mousemove:F=>{F.buttons||A(F)}};this.register(this.coreMouseService.onProtocolChange((F=>{F?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(F)),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&F?M.mousemove||(C.addEventListener("mousemove",W.mousemove),M.mousemove=W.mousemove):(C.removeEventListener("mousemove",M.mousemove),M.mousemove=null),16&F?M.wheel||(C.addEventListener("wheel",W.wheel,{passive:!1}),M.wheel=W.wheel):(C.removeEventListener("wheel",M.wheel),M.wheel=null),2&F?M.mouseup||(M.mouseup=W.mouseup):(this._document.removeEventListener("mouseup",M.mouseup),M.mouseup=null),4&F?M.mousedrag||(M.mousedrag=W.mousedrag):(this._document.removeEventListener("mousemove",M.mousedrag),M.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(C,"mousedown",(F=>{if(F.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(F))return A(F),M.mouseup&&this._document.addEventListener("mouseup",M.mouseup),M.mousedrag&&this._document.addEventListener("mousemove",M.mousedrag),this.cancel(F)}))),this.register((0,f.addDisposableDomListener)(C,"wheel",(F=>{if(!M.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(F)===!1)return!1;if(!this.buffer.hasScrollback){const z=this.viewport.getLinesScrolled(F);if(z===0)return;const V=U.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(F.deltaY<0?"A":"B");let G="";for(let Y=0;Y<Math.abs(z);Y++)G+=V;return this.coreService.triggerDataEvent(G,!0),this.cancel(F,!0)}return this.viewport.handleWheel(F)?this.cancel(F):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(C,"touchstart",(F=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(F),this.cancel(F)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(C,"touchmove",(F=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(F)?void 0:this.cancel(F)}),{passive:!1}))}refresh(R,C){this._renderService?.refreshRows(R,C)}updateCursorStyle(R){this._selectionService?.shouldColumnSelect(R)?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(R,C,A=0){A===1?(super.scrollLines(R,C,A),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(R)}paste(R){(0,l.paste)(R,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(R){this._customKeyEventHandler=R}attachCustomWheelEventHandler(R){this._customWheelEventHandler=R}registerLinkProvider(R){return this._linkProviderService.registerLinkProvider(R)}registerCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const C=this._characterJoinerService.register(R);return this.refresh(0,this.rows-1),C}deregisterCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(R)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(R){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+R)}registerDecoration(R){return this._decorationService.registerDecoration(R)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(R,C,A){this._selectionService.setSelection(R,C,A)}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(R,C){this._selectionService?.selectLines(R,C)}_keyDown(R){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;const C=this.browser.isMac&&this.options.macOptionIsMeta&&R.altKey;if(!C&&!this._compositionHelper.keydown(R))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;C||R.key!=="Dead"&&R.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const A=(0,P.evaluateKeyboardEvent)(R,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(R),A.type===3||A.type===2){const M=this.rows-1;return this.scrollLines(A.type===2?-M:M),this.cancel(R,!0)}return A.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,R)||(A.cancel&&this.cancel(R,!0),!A.key||!!(R.key&&!R.ctrlKey&&!R.altKey&&!R.metaKey&&R.key.length===1&&R.key.charCodeAt(0)>=65&&R.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(A.key!==U.C0.ETX&&A.key!==U.C0.CR||(this.textarea.value=""),this._onKey.fire({key:A.key,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(A.key,!0),!this.optionsService.rawOptions.screenReaderMode||R.altKey||R.ctrlKey?this.cancel(R,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(R,C){const A=R.isMac&&!this.options.macOptionIsMeta&&C.altKey&&!C.ctrlKey&&!C.metaKey||R.isWindows&&C.altKey&&C.ctrlKey&&!C.metaKey||R.isWindows&&C.getModifierState("AltGraph");return C.type==="keypress"?A:A&&(!C.keyCode||C.keyCode>47)}_keyUp(R){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1||((function(C){return C.keyCode===16||C.keyCode===17||C.keyCode===18})(R)||this.focus(),this.updateCursorStyle(R),this._keyPressHandled=!1)}_keyPress(R){let C;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;if(this.cancel(R),R.charCode)C=R.charCode;else if(R.which===null||R.which===void 0)C=R.keyCode;else{if(R.which===0||R.charCode===0)return!1;C=R.which}return!(!C||(R.altKey||R.ctrlKey||R.metaKey)&&!this._isThirdLevelShift(this.browser,R)||(C=String.fromCharCode(C),this._onKey.fire({key:C,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(C,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(R){if(R.data&&R.inputType==="insertText"&&(!R.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const C=R.data;return this.coreService.triggerDataEvent(C,!0),this.cancel(R),!0}return!1}resize(R,C){R!==this.cols||C!==this.rows?super.resize(R,C):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(R,C){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(I.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;const R=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=R,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(U.C0.ESC+"[I"):this.coreService.triggerDataEvent(U.C0.ESC+"[O")}_reportWindowsOptions(R){if(this._renderService)switch(R){case L.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const C=this._renderService.dimensions.css.canvas.width.toFixed(0),A=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[4;${A};${C}t`);break;case L.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const M=this._renderService.dimensions.css.cell.width.toFixed(0),W=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[6;${W};${M}t`)}}cancel(R,C){if(this.options.cancelEvents||C)return R.preventDefault(),R.stopPropagation(),!1}}r.Terminal=N},9924:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,l=1e3){this._renderCallback=o,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,l,f){this._rowCount=f,o=o!==void 0?o:0,l=l!==void 0?l: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,l):l;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=n-this._lastRefreshMs,v=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,l)}}},1680:function(O,r,o){var l=this&&this.__decorate||function(s,e,t,a){var _,u=arguments.length,p=u<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,a);else for(var c=s.length-1;c>=0;c--)(_=s[c])&&(p=(u<3?_(p):u>3?_(e,t,p):_(e,t))||p);return u>3&&p&&Object.defineProperty(e,t,p),p},f=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const n=o(3656),d=o(4725),v=o(8460),g=o(844),h=o(2585);let i=r.Viewport=class extends g.Disposable{constructor(s,e,t,a,_,u,p,c){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=a,this._charSizeService=_,this._renderService=u,this._coreBrowserService=p,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((m=>this._activeBuffer=m.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((m=>this._renderDimensions=m))),this._handleThemeChange(c.colors),this.register(c.onChangeColors((m=>this._handleThemeChange(m)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.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(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<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(s,e){const t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){const e=this._getPixelsScrolled(s);return e!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const e=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(s,e){let t,a="";const _=[],u=e??this._bufferService.buffer.lines.length,p=this._bufferService.buffer.lines;for(let c=s;c<u;c++){const m=p.get(c);if(!m)continue;const E=p.get(c+1)?.isWrapped;if(a+=m.translateToString(!E),!E||c===p.length-1){const k=document.createElement("div");k.textContent=a,_.push(k),a.length>0&&(t=k),a=""}}return{bufferElements:_,cursorElement:t}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){const t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){const e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};r.Viewport=i=l([f(2,h.IBufferService),f(3,h.IOptionsService),f(4,d.ICharSizeService),f(5,d.IRenderService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],i)},3107:function(O,r,o){var l=this&&this.__decorate||function(h,i,s,e){var t,a=arguments.length,_=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(h,i,s,e);else for(var u=h.length-1;u>=0;u--)(t=h[u])&&(_=(a<3?t(_):a>3?t(i,s,_):t(i,s))||_);return a>3&&_&&Object.defineProperty(i,s,_),_},f=this&&this.__param||function(h,i){return function(s,e){i(s,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const n=o(4725),d=o(844),v=o(2585);let g=r.BufferDecorationRenderer=class extends d.Disposable{constructor(h,i,s,e,t){super(),this._screenElement=h,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((a=>this._removeDecoration(a)))),this.register((0,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(const h of this._decorationService.decorations)this._renderDecoration(h);this._dimensionsChanged=!1}_renderDecoration(h){this._refreshStyle(h),this._dimensionsChanged&&this._refreshXPosition(h)}_createElement(h){const i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",h?.options?.layer==="top"),i.style.width=`${Math.round((h.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(h.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(h.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const s=h.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(h,i),i}_refreshStyle(h){const i=h.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)h.element&&(h.element.style.display="none",h.onRenderEmitter.fire(h.element));else{let s=this._decorationElements.get(h);s||(s=this._createElement(h),h.element=s,this._decorationElements.set(h,s),this._container.appendChild(s),h.onDispose((()=>{this._decorationElements.delete(h),s.remove()}))),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",h.onRenderEmitter.fire(s)}}_refreshXPosition(h,i=h.element){if(!i)return;const s=h.options.x??0;(h.options.anchor||"left")==="right"?i.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(h){this._decorationElements.get(h)?.remove(),this._decorationElements.delete(h),h.dispose()}};r.BufferDecorationRenderer=g=l([f(1,v.IBufferService),f(2,n.ICoreBrowserService),f(3,v.IDecorationService),f(4,n.IRenderService)],g)},5871:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const l of this._zones)if(l.color===o.options.overviewRulerOptions.color&&l.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,o.marker.line))return;if(this._lineAdjacentToZone(l,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(l,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,l){return l>=o.startBufferLine&&l<=o.endBufferLine}_lineAdjacentToZone(o,l,f){return l>=o.startBufferLine-this._linePadding[f||"full"]&&l<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,l){o.startBufferLine=Math.min(o.startBufferLine,l),o.endBufferLine=Math.max(o.endBufferLine,l)}}},5744:function(O,r,o){var l=this&&this.__decorate||function(t,a,_,u){var p,c=arguments.length,m=c<3?a:u===null?u=Object.getOwnPropertyDescriptor(a,_):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,a,_,u);else for(var E=t.length-1;E>=0;E--)(p=t[E])&&(m=(c<3?p(m):c>3?p(a,_,m):p(a,_))||m);return c>3&&m&&Object.defineProperty(a,_,m),m},f=this&&this.__param||function(t,a){return function(_,u){a(_,u,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const n=o(5871),d=o(4725),v=o(844),g=o(2585),h={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let e=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,a,_,u,p,c,m){super(),this._viewportElement=t,this._screenElement=a,this._bufferService=_,this._decorationService=u,this._renderService=p,this._optionsService=c,this._coreBrowserService=m,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const E=this._canvas.getContext("2d");if(!E)throw new Error("Ctx cannot be null");this._ctx=E,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const t=Math.floor(this._canvas.width/3),a=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=a,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);const t=this._canvas.height/this._bufferService.buffer.lines.length,a=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);h.left=a,h.center=a,h.right=a}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const a of this._decorationService.decorations)this._colorZoneStore.addDecoration(a);this._ctx.lineWidth=1;const t=this._colorZoneStore.zones;for(const a of t)a.position!=="full"&&this._renderColorZone(a);for(const a of t)a.position==="full"&&this._renderColorZone(a);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-h[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[t.position||"full"]))}_queueRefresh(t,a){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=a||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=e=l([f(2,g.IBufferService),f(3,g.IDecorationService),f(4,d.IRenderService),f(5,g.IOptionsService),f(6,d.ICoreBrowserService)],e)},2950:function(O,r,o){var l=this&&this.__decorate||function(h,i,s,e){var t,a=arguments.length,_=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(h,i,s,e);else for(var u=h.length-1;u>=0;u--)(t=h[u])&&(_=(a<3?t(_):a>3?t(i,s,_):t(i,s))||_);return a>3&&_&&Object.defineProperty(i,s,_),_},f=this&&this.__param||function(h,i){return function(s,e){i(s,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const n=o(4725),d=o(2585),v=o(2584);let g=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,i,s,e,t,a){this._textarea=h,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(h){this._compositionView.textContent=h.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(h){if(this._isComposing||this._isSendingComposition){if(h.keyCode===229||h.keyCode===16||h.keyCode===17||h.keyCode===18)return!1;this._finalizeComposition(!1)}return h.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(h){if(this._compositionView.classList.remove("active"),this._isComposing=!1,h){const i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}}),0)}else{this._isSendingComposition=!1;const i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){const h=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const i=this._textarea.value,s=i.replace(h,"");this._dataAlreadySent=s,i.length>h.length?this._coreService.triggerDataEvent(s,!0):i.length<h.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):i.length===h.length&&i!==h&&this._coreService.triggerDataEvent(i,!0)}}),0)}updateCompositionElements(h){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,t=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=t+"px",this._compositionView.style.top=e+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const a=this._compositionView.getBoundingClientRect();this._textarea.style.left=t+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=g=l([f(2,d.IBufferService),f(3,d.IOptionsService),f(4,d.ICoreService),f(5,n.IRenderService)],g)},9806:(O,r)=>{function o(l,f,n){const d=n.getBoundingClientRect(),v=l.getComputedStyle(n),g=parseInt(v.getPropertyValue("padding-left")),h=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-d.left-g,f.clientY-d.top-h]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(l,f,n,d,v,g,h,i,s){if(!g)return;const e=o(l,f,n);return e?(e[0]=Math.ceil((e[0]+(s?h/2:0))/h),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),d+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),v),e):void 0}},9504:(O,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const l=o(2584);function f(i,s,e,t){const a=i-n(i,e),_=s-n(s,e),u=Math.abs(a-_)-(function(p,c,m){let E=0;const k=p-n(p,m),D=c-n(c,m);for(let b=0;b<Math.abs(k-D);b++){const x=d(p,c)==="A"?-1:1;m.buffer.lines.get(k+x*b)?.isWrapped&&E++}return E})(i,s,e);return h(u,g(d(i,s),t))}function n(i,s){let e=0,t=s.buffer.lines.get(i),a=t?.isWrapped;for(;a&&i>=0&&i<s.rows;)e++,t=s.buffer.lines.get(--i),a=t?.isWrapped;return e}function d(i,s){return i>s?"A":"B"}function v(i,s,e,t,a,_){let u=i,p=s,c="";for(;u!==e||p!==t;)u+=a?1:-1,a&&u>_.cols-1?(c+=_.buffer.translateBufferLineToString(p,!1,i,u),u=0,i=0,p++):!a&&u<0&&(c+=_.buffer.translateBufferLineToString(p,!1,0,i+1),u=_.cols-1,i=u,p--);return c+_.buffer.translateBufferLineToString(p,!1,i,u)}function g(i,s){const e=s?"O":"[";return l.C0.ESC+e+i}function h(i,s){i=Math.floor(i);let e="";for(let t=0;t<i;t++)e+=s;return e}r.moveToCellSequence=function(i,s,e,t){const a=e.buffer.x,_=e.buffer.y;if(!e.buffer.hasScrollback)return(function(c,m,E,k,D,b){return f(m,k,D,b).length===0?"":h(v(c,m,c,m-n(m,D),!1,D).length,g("D",b))})(a,_,0,s,e,t)+f(_,s,e,t)+(function(c,m,E,k,D,b){let x;x=f(m,k,D,b).length>0?k-n(k,D):m;const T=k,I=(function(U,P,S,w,y,L){let B;return B=f(S,w,y,L).length>0?w-n(w,y):P,U<S&&B<=w||U>=S&&B<w?"C":"D"})(c,m,E,k,D,b);return h(v(c,x,E,T,I==="C",D).length,g(I,b))})(a,_,i,s,e,t);let u;if(_===s)return u=a>i?"D":"C",h(Math.abs(a-i),g(u,t));u=_>s?"D":"C";const p=Math.abs(_-s);return h((function(c,m){return m.cols-c})(_>s?i:a,e)+(p-1)*e.cols+1+((_>s?a:i)-1),g(u,t))}},1296:function(O,r,o){var l=this&&this.__decorate||function(b,x,T,I){var U,P=arguments.length,S=P<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,x,T,I);else for(var w=b.length-1;w>=0;w--)(U=b[w])&&(S=(P<3?U(S):P>3?U(x,T,S):U(x,T))||S);return P>3&&S&&Object.defineProperty(x,T,S),S},f=this&&this.__param||function(b,x){return function(T,I){x(T,I,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const n=o(3787),d=o(2550),v=o(2223),g=o(6171),h=o(6052),i=o(4725),s=o(8055),e=o(8460),t=o(844),a=o(2585),_="xterm-dom-renderer-owner-",u="xterm-rows",p="xterm-fg-",c="xterm-bg-",m="xterm-focus",E="xterm-selection";let k=1,D=r.DomRenderer=class extends t.Disposable{constructor(b,x,T,I,U,P,S,w,y,L,B,H,N){super(),this._terminal=b,this._document=x,this._element=T,this._screenElement=I,this._viewportElement=U,this._helperContainer=P,this._linkifier2=S,this._charSizeService=y,this._optionsService=L,this._bufferService=B,this._coreBrowserService=H,this._themeService=N,this._terminalClass=k++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors(($=>this._injectCss($)))),this._injectCss(this._themeService.colors),this._rowFactory=w.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(($=>this._handleLinkHover($)))),this.register(this._linkifier2.onHideLinkUnderline(($=>this._handleLinkLeave($)))),this.register((0,t.toDisposable)((()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new 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(){const b=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*b,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*b),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/b),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/b),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const T of this._rowElements)T.style.width=`${this.dimensions.css.canvas.width}px`,T.style.height=`${this.dimensions.css.cell.height}px`,T.style.lineHeight=`${this.dimensions.css.cell.height}px`,T.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const x=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=x,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(b){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let x=`${this._terminalSelector} .${u} { color: ${b.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;x+=`${this._terminalSelector} .${u} .xterm-dim { color: ${s.color.multiplyOpacity(b.foreground,.5).css};}`,x+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const T=`blink_underline_${this._terminalClass}`,I=`blink_bar_${this._terminalClass}`,U=`blink_block_${this._terminalClass}`;x+=`@keyframes ${T} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${I} { 50% { box-shadow: none; }}`,x+=`@keyframes ${U} { 0% { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css}; } 50% { background-color: inherit; color: ${b.cursor.css}; }}`,x+=`${this._terminalSelector} .${u}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${T} 1s step-end infinite;}${this._terminalSelector} .${u}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${u}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${b.cursor.css} !important; color: ${b.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${b.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${b.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${b.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,x+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${b.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${b.selectionInactiveBackgroundOpaque.css};}`;for(const[P,S]of b.ansi.entries())x+=`${this._terminalSelector} .${p}${P} { color: ${S.css}; }${this._terminalSelector} .${p}${P}.xterm-dim { color: ${s.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${c}${P} { background-color: ${S.css}; }`;x+=`${this._terminalSelector} .${p}${v.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(b.background).css}; }${this._terminalSelector} .${p}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(b.background),.5).css}; }${this._terminalSelector} .${c}${v.INVERTED_DEFAULT_COLOR} { background-color: ${b.foreground.css}; }`,this._themeStyleElement.textContent=x}_setDefaultSpacing(){const b=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${b}px`,this._rowFactory.defaultSpacing=b}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(b,x){for(let T=this._rowElements.length;T<=x;T++){const I=this._document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(b,x){this._refreshRowElements(b,x),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(b,x,T){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(b,x,T),this.renderRows(0,this._bufferService.rows-1),!b||!x)return;this._selectionRenderModel.update(this._terminal,b,x,T);const I=this._selectionRenderModel.viewportStartRow,U=this._selectionRenderModel.viewportEndRow,P=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(P>=this._bufferService.rows||S<0)return;const w=this._document.createDocumentFragment();if(T){const y=b[0]>x[0];w.appendChild(this._createSelectionElement(P,y?x[0]:b[0],y?b[0]:x[0],S-P+1))}else{const y=I===P?b[0]:0,L=P===U?x[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(P,y,L));const B=S-P-1;if(w.appendChild(this._createSelectionElement(P+1,0,this._bufferService.cols,B)),P!==S){const H=U===S?x[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(S,0,H))}}this._selectionContainer.appendChild(w)}_createSelectionElement(b,x,T,I=1){const U=this._document.createElement("div"),P=x*this.dimensions.css.cell.width;let S=this.dimensions.css.cell.width*(T-x);return P+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-P),U.style.height=I*this.dimensions.css.cell.height+"px",U.style.top=b*this.dimensions.css.cell.height+"px",U.style.left=`${P}px`,U.style.width=`${S}px`,U}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const b of this._rowElements)b.replaceChildren()}renderRows(b,x){const T=this._bufferService.buffer,I=T.ybase+T.y,U=Math.min(T.x,this._bufferService.cols-1),P=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=b;y<=x;y++){const L=y+T.ydisp,B=this._rowElements[y],H=T.lines.get(L);if(!B||!H)break;B.replaceChildren(...this._rowFactory.createRow(H,L,L===I,S,w,U,P,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!0)}_handleLinkLeave(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!1)}_setCellUnderline(b,x,T,I,U,P){T<0&&(b=0),I<0&&(x=0);const S=this._bufferService.rows-1;T=Math.max(Math.min(T,S),0),I=Math.max(Math.min(I,S),0),U=Math.min(U,this._bufferService.cols);const w=this._bufferService.buffer,y=w.ybase+w.y,L=Math.min(w.x,U-1),B=this._optionsService.rawOptions.cursorBlink,H=this._optionsService.rawOptions.cursorStyle,N=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=T;$<=I;++$){const R=$+w.ydisp,C=this._rowElements[$],A=w.lines.get(R);if(!C||!A)break;C.replaceChildren(...this._rowFactory.createRow(A,R,R===y,H,N,L,B,this.dimensions.css.cell.width,this._widthCache,P?$===T?b:0:-1,P?($===I?x:U)-1:-1))}}};r.DomRenderer=D=l([f(7,a.IInstantiationService),f(8,i.ICharSizeService),f(9,a.IOptionsService),f(10,a.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],D)},3787:function(O,r,o){var l=this&&this.__decorate||function(u,p,c,m){var E,k=arguments.length,D=k<3?p:m===null?m=Object.getOwnPropertyDescriptor(p,c):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(u,p,c,m);else for(var b=u.length-1;b>=0;b--)(E=u[b])&&(D=(k<3?E(D):k>3?E(p,c,D):E(p,c))||D);return k>3&&D&&Object.defineProperty(p,c,D),D},f=this&&this.__param||function(u,p){return function(c,m){p(c,m,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const n=o(2223),d=o(643),v=o(511),g=o(2585),h=o(8055),i=o(4725),s=o(4269),e=o(6171),t=o(3734);let a=r.DomRendererRowFactory=class{constructor(u,p,c,m,E,k,D){this._document=u,this._characterJoinerService=p,this._optionsService=c,this._coreBrowserService=m,this._coreService=E,this._decorationService=k,this._themeService=D,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,p,c){this._selectionStart=u,this._selectionEnd=p,this._columnSelectMode=c}createRow(u,p,c,m,E,k,D,b,x,T,I){const U=[],P=this._characterJoinerService.getJoinedCharacters(p),S=this._themeService.colors;let w,y=u.getNoBgTrimmedLength();c&&y<k+1&&(y=k+1);let L=0,B="",H=0,N=0,$=0,R=!1,C=0,A=!1,M=0;const W=[],F=T!==-1&&I!==-1;for(let z=0;z<y;z++){u.loadCell(z,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let G=!1,Y=z,j=this._workCell;if(P.length>0&&z===P[0][0]){G=!0;const q=P.shift();j=new s.JoinedCellData(this._workCell,u.translateToString(!0,q[0],q[1]),q[1]-q[0]),Y=q[1]-1,V=j.getWidth()}const de=this._isCellInSelection(z,p),me=c&&z===k,Se=F&&z>=T&&z<=I;let Ce=!1;this._decorationService.forEachDecorationAtCell(z,p,void 0,(q=>{Ce=!0}));let ve=j.getChars()||d.WHITESPACE_CELL_CHAR;if(ve===" "&&(j.isUnderline()||j.isOverline())&&(ve="\xA0"),M=V*b-x.get(ve,j.isBold(),j.isItalic()),w){if(L&&(de&&A||!de&&!A&&j.bg===H)&&(de&&A&&S.selectionForeground||j.fg===N)&&j.extended.ext===$&&Se===R&&M===C&&!me&&!G&&!Ce){j.isInvisible()?B+=d.WHITESPACE_CELL_CHAR:B+=ve,L++;continue}L&&(w.textContent=B),w=this._document.createElement("span"),L=0,B=""}else w=this._document.createElement("span");if(H=j.bg,N=j.fg,$=j.extended.ext,R=Se,C=M,A=de,G&&k>=z&&k<=Y&&(k=z),!this._coreService.isCursorHidden&&me&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)D&&W.push("xterm-cursor-blink"),W.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(E)switch(E){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline")}}if(j.isBold()&&W.push("xterm-bold"),j.isItalic()&&W.push("xterm-italic"),j.isDim()&&W.push("xterm-dim"),B=j.isInvisible()?d.WHITESPACE_CELL_CHAR:j.getChars()||d.WHITESPACE_CELL_CHAR,j.isUnderline()&&(W.push(`xterm-underline-${j.extended.underlineStyle}`),B===" "&&(B="\xA0"),!j.isUnderlineColorDefault()))if(j.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(j.getUnderlineColor()).join(",")})`;else{let q=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&q<8&&(q+=8),w.style.textDecorationColor=S.ansi[q].css}j.isOverline()&&(W.push("xterm-overline"),B===" "&&(B="\xA0")),j.isStrikethrough()&&W.push("xterm-strikethrough"),Se&&(w.style.textDecoration="underline");let Z=j.getFgColor(),ue=j.getFgColorMode(),ee=j.getBgColor(),_e=j.getBgColorMode();const be=!!j.isInverse();if(be){const q=Z;Z=ee,ee=q;const Oe=ue;ue=_e,_e=Oe}let se,pe,re,fe=!1;switch(this._decorationService.forEachDecorationAtCell(z,p,void 0,(q=>{q.options.layer!=="top"&&fe||(q.backgroundColorRGB&&(_e=50331648,ee=q.backgroundColorRGB.rgba>>8&16777215,se=q.backgroundColorRGB),q.foregroundColorRGB&&(ue=50331648,Z=q.foregroundColorRGB.rgba>>8&16777215,pe=q.foregroundColorRGB),fe=q.options.layer==="top")})),!fe&&de&&(se=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ee=se.rgba>>8&16777215,_e=50331648,fe=!0,S.selectionForeground&&(ue=50331648,Z=S.selectionForeground.rgba>>8&16777215,pe=S.selectionForeground)),fe&&W.push("xterm-decoration-top"),_e){case 16777216:case 33554432:re=S.ansi[ee],W.push(`xterm-bg-${ee}`);break;case 50331648:re=h.channels.toColor(ee>>16,ee>>8&255,255&ee),this._addStyle(w,`background-color:#${_((ee>>>0).toString(16),"0",6)}`);break;default:be?(re=S.foreground,W.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):re=S.background}switch(se||j.isDim()&&(se=h.color.multiplyOpacity(re,.5)),ue){case 16777216:case 33554432:j.isBold()&&Z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Z+=8),this._applyMinimumContrast(w,re,S.ansi[Z],j,se,void 0)||W.push(`xterm-fg-${Z}`);break;case 50331648:const q=h.channels.toColor(Z>>16&255,Z>>8&255,255&Z);this._applyMinimumContrast(w,re,q,j,se,pe)||this._addStyle(w,`color:#${_(Z.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,re,S.foreground,j,se,pe)||be&&W.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}W.length&&(w.className=W.join(" "),W.length=0),me||G||Ce?w.textContent=B:L++,M!==this.defaultSpacing&&(w.style.letterSpacing=`${M}px`),U.push(w),z=Y}return w&&L&&(w.textContent=B),U}_applyMinimumContrast(u,p,c,m,E,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;const D=this._getContrastCache(m);let b;if(E||k||(b=D.getColor(p.rgba,c.rgba)),b===void 0){const x=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);b=h.color.ensureContrastRatio(E||p,k||c,x),D.setColor((E||p).rgba,(k||c).rgba,b??null)}return!!b&&(this._addStyle(u,`color:${b.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,p){u.setAttribute("style",`${u.getAttribute("style")||""}${p};`)}_isCellInSelection(u,p){const c=this._selectionStart,m=this._selectionEnd;return!(!c||!m)&&(this._columnSelectMode?c[0]<=m[0]?u>=c[0]&&p>=c[1]&&u<m[0]&&p<=m[1]:u<c[0]&&p>=c[1]&&u>=m[0]&&p<=m[1]:p>c[1]&&p<m[1]||c[1]===m[1]&&p===c[1]&&u>=c[0]&&u<m[0]||c[1]<m[1]&&p===m[1]&&u<m[0]||c[1]<m[1]&&p===c[1]&&u>=c[0])}};function _(u,p,c){for(;u.length<c;)u=p+u;return u}r.DomRendererRowFactory=a=l([f(1,i.ICharacterJoinerService),f(2,g.IOptionsService),f(3,i.ICoreBrowserService),f(4,g.ICoreService),f(5,g.IDecorationService),f(6,i.IThemeService)],a)},2550:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o,l){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";const f=o.createElement("span");f.classList.add("xterm-char-measure-element");const n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,n,d,v],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(d),this._container.appendChild(v),l.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,l,f,n){o===this._font&&l===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=o,this._fontSize=l,this._weight=f,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(o,l,f){let n=0;if(!l&&!f&&o.length===1&&(n=o.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const g=this._measure(o,0);return g>0&&(this._flat[n]=g),g}let d=o;l&&(d+="B"),f&&(d+="I");let v=this._holey.get(d);if(v===void 0){let g=0;l&&(g|=1),f&&(g|=2),v=this._measure(o,g),v>0&&this._holey.set(d,v)}return v}_measure(o,l){const f=this._measureElements[l];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(O,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const l=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(O,r)=>{function o(f){return 57508<=f&&f<=57558}function l(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=l,r.allowRescaling=function(f,n,d,v){return n===1&&d>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!l(f)&&!o(f)&&!(function(g){return 57344<=g&&g<=63743})(f)},r.treatGlyphAsBackgroundColor=function(f){return o(f)||(function(n){return 9472<=n&&n<=9631})(f)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(f,n,d=0){return(f-(2*Math.round(n)-d))%(2*Math.round(n))}},6052:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class o{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,n,d,v=!1){if(this.selectionStart=n,this.selectionEnd=d,!n||!d||n[0]===d[0]&&n[1]===d[1])return void this.clear();const g=f.buffers.active.ydisp,h=n[1]-g,i=d[1]-g,s=Math.max(h,0),e=Math.min(i,f.rows-1);s>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=h,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=n[0],this.endCol=d[0])}isCellSelected(f,n,d){return!!this.hasSelection&&(d-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&d>=this.viewportCappedStartRow&&n<this.endCol&&d<=this.viewportCappedEndRow:n<this.startCol&&d>=this.viewportCappedStartRow&&n>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&n>=this.startCol)}}r.createSelectionRenderModel=function(){return new o}},456:(O,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const 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]){const 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(){const o=this.selectionStart,l=this.selectionEnd;return!(!o||!l)&&(o[1]>l[1]||o[1]===l[1]&&o[0]>l[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(O,r,o){var l=this&&this.__decorate||function(e,t,a,_){var u,p=arguments.length,c=p<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(c=(p<3?u(c):p>3?u(t,a,c):u(t,a))||c);return p>3&&c&&Object.defineProperty(t,a,c),c},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const n=o(2585),d=o(8460),v=o(844);let g=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,a){super(),this._optionsService=a,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=g=l([f(2,n.IOptionsService)],g);class h extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,a){t!==void 0&&t>0&&a!==void 0&&a>0&&(this._result.width=t,this._result.height=a)}}class i extends h{constructor(t,a,_){super(),this._document=t,this._parentElement=a,this._optionsService=_,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends h{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const a=this._ctx.measureText("W");if(!("width"in a&&"fontBoundingBoxAscent"in a&&"fontBoundingBoxDescent"in a))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(O,r,o){var l=this&&this.__decorate||function(s,e,t,a){var _,u=arguments.length,p=u<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(s,e,t,a);else for(var c=s.length-1;c>=0;c--)(_=s[c])&&(p=(u<3?_(p):u>3?_(e,t,p):_(e,t))||p);return u>3&&p&&Object.defineProperty(e,t,p),p},f=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const n=o(3734),d=o(643),v=o(511),g=o(2585);class h extends n.AttributeData{constructor(e,t,a){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=a}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=h;let i=r.CharacterJoinerService=class Me{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];const a=[],_=t.translateToString(!0);let u=0,p=0,c=0,m=t.getFg(0),E=t.getBg(0);for(let k=0;k<t.getTrimmedLength();k++)if(t.loadCell(k,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==E){if(k-u>1){const D=this._getJoinedRanges(_,c,p,t,u);for(let b=0;b<D.length;b++)a.push(D[b])}u=k,c=p,m=this._workCell.fg,E=this._workCell.bg}p+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1){const k=this._getJoinedRanges(_,c,p,t,u);for(let D=0;D<k.length;D++)a.push(k[D])}return a}_getJoinedRanges(e,t,a,_,u){const p=e.substring(t,a);let c=[];try{c=this._characterJoiners[0].handler(p)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{const E=this._characterJoiners[m].handler(p);for(let k=0;k<E.length;k++)Me._mergeRanges(c,E[k])}catch(E){console.error(E)}return this._stringRangesToCellRanges(c,_,u),c}_stringRangesToCellRanges(e,t,a){let _=0,u=!1,p=0,c=e[_];if(c){for(let m=a;m<this._bufferService.cols;m++){const E=t.getWidth(m),k=t.getString(m).length||d.WHITESPACE_CELL_CHAR.length;if(E!==0){if(!u&&c[0]<=p&&(c[0]=m,u=!0),c[1]<=p){if(c[1]=m,c=e[++_],!c)break;c[0]<=p?(c[0]=m,u=!0):u=!1}p+=k}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let a=!1;for(let _=0;_<e.length;_++){const u=e[_];if(a){if(t[1]<=u[0])return e[_-1][1]=t[1],e;if(t[1]<=u[1])return e[_-1][1]=Math.max(t[1],u[1]),e.splice(_,1),e;e.splice(_,1),_--}else{if(t[1]<=u[0])return e.splice(_,0,t),e;if(t[1]<=u[1])return u[0]=Math.min(t[0],u[0]),e;t[0]<u[1]&&(u[0]=Math.min(t[0],u[0]),a=!0)}}return a?e[e.length-1][1]=t[1]:e.push(t),e}};r.CharacterJoinerService=i=l([f(0,g.IBufferService)],i)},5114:(O,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const l=o(844),f=o(8460),n=o(3656);class d extends l.Disposable{constructor(h,i,s){super(),this._textarea=h,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(h){this._window!==h&&(this._window=h,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}r.CoreBrowserService=d;class v extends l.Disposable{constructor(h){super(),this._parentWindow=h,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,l.toDisposable)((()=>this.clearListener())))}setWindow(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(O,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const l=o(844);class f extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{const v=this.linkProviders.indexOf(d);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=f},8934:function(O,r,o){var l=this&&this.__decorate||function(g,h,i,s){var e,t=arguments.length,a=t<3?h:s===null?s=Object.getOwnPropertyDescriptor(h,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(g,h,i,s);else for(var _=g.length-1;_>=0;_--)(e=g[_])&&(a=(t<3?e(a):t>3?e(h,i,a):e(h,i))||a);return t>3&&a&&Object.defineProperty(h,i,a),a},f=this&&this.__param||function(g,h){return function(i,s){h(i,s,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const n=o(4725),d=o(9806);let v=r.MouseService=class{constructor(g,h){this._renderService=g,this._charSizeService=h}getCoords(g,h,i,s,e){return(0,d.getCoords)(window,g,h,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(g,h){const i=(0,d.getCoordsRelativeToElement)(window,g,h);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};r.MouseService=v=l([f(0,n.IRenderService),f(1,n.ICharSizeService)],v)},3230:function(O,r,o){var l=this&&this.__decorate||function(e,t,a,_){var u,p=arguments.length,c=p<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(c=(p<3?u(c):p>3?u(t,a,c):u(t,a))||c);return p>3&&c&&Object.defineProperty(t,a,c),c},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const n=o(6193),d=o(4725),v=o(8460),g=o(844),h=o(7226),i=o(2585);let s=r.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,a,_,u,p,c,m){super(),this._rowCount=e,this._charSizeService=_,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new h.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((E,k)=>this._renderRows(E,k)),c),this.register(this._renderDebouncer),this.register(c.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(p.onResize((()=>this._fullRefresh()))),this.register(p.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(a.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(u.onDecorationRegistered((()=>this._fullRefresh()))),this.register(u.onDecorationRemoved((()=>this._fullRefresh()))),this.register(a.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(p.cols,p.rows),this._fullRefresh()}))),this.register(a.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(p.buffer.y,p.buffer.y,!0)))),this.register(m.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(c.window,t),this.register(c.onWindowChange((E=>this._registerIntersectionObserver(E,t))))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){const a=new e.IntersectionObserver((_=>this._handleIntersectionChange(_[_.length-1])),{threshold:0});a.observe(t),this._observerDisposable.value=(0,g.toDisposable)((()=>a.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,a=!1){this._isPaused?this._needsFullRefresh=!0:(a||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((t=>this.refreshRows(t.start,t.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,a){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=a,this._renderer.value?.handleSelectionChanged(e,t,a)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};r.RenderService=s=l([f(2,i.IOptionsService),f(3,d.ICharSizeService),f(4,i.IDecorationService),f(5,i.IBufferService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],s)},9312:function(O,r,o){var l=this&&this.__decorate||function(c,m,E,k){var D,b=arguments.length,x=b<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,E):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(c,m,E,k);else for(var T=c.length-1;T>=0;T--)(D=c[T])&&(x=(b<3?D(x):b>3?D(m,E,x):D(m,E))||x);return b>3&&x&&Object.defineProperty(m,E,x),x},f=this&&this.__param||function(c,m){return function(E,k){m(E,k,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const n=o(9806),d=o(9504),v=o(456),g=o(4725),h=o(8460),i=o(844),s=o(6114),e=o(4841),t=o(511),a=o(2585),_="\xA0",u=new RegExp(_,"g");let p=r.SelectionService=class extends i.Disposable{constructor(c,m,E,k,D,b,x,T,I){super(),this._element=c,this._screenElement=m,this._linkifier=E,this._bufferService=k,this._coreService=D,this._mouseService=b,this._optionsService=x,this._renderService=T,this._coreBrowserService=I,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=U=>this._handleMouseMove(U),this._mouseUpListener=U=>this._handleMouseUp(U),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((U=>this._handleTrim(U))),this.register(this._bufferService.buffers.onBufferActivate((U=>this._handleBufferActivate(U)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const c=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!c||!m||c[0]===m[0]&&c[1]===m[1])}get selectionText(){const c=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!c||!m)return"";const E=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(c[0]===m[0])return"";const D=c[0]<m[0]?c[0]:m[0],b=c[0]<m[0]?m[0]:c[0];for(let x=c[1];x<=m[1];x++){const T=E.translateBufferLineToString(x,!0,D,b);k.push(T)}}else{const D=c[1]===m[1]?m[0]:void 0;k.push(E.translateBufferLineToString(c[1],!0,c[0],D));for(let b=c[1]+1;b<=m[1]-1;b++){const x=E.lines.get(b),T=E.translateBufferLineToString(b,!0);x?.isWrapped?k[k.length-1]+=T:k.push(T)}if(c[1]!==m[1]){const b=E.lines.get(m[1]),x=E.translateBufferLineToString(m[1],!0,0,m[0]);b&&b.isWrapped?k[k.length-1]+=x:k.push(x)}}return k.map((D=>D.replace(u," "))).join(s.isWindows?`\r
12`:`

Callers 1

constructorMethod · 0.80

Calls 8

toStringMethod · 0.80
_announceCharactersMethod · 0.80
renderRowsMethod · 0.80
fireMethod · 0.80
getMethod · 0.45
translateToStringMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected