deckide 3.5.29 → 3.5.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,15 +41,15 @@ Error generating stack: `+h.message+`
|
|
|
41
41
|
`))),this.register(this._terminal.onA11yTab(v=>this._handleTab(v))),this.register(this._terminal.onKey(v=>this._handleKey(v.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new g.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,o.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,w.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(c){for(let p=0;p<c;p++)this._handleChar(" ")}_handleChar(c){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==c&&(this._charsToAnnounce+=c):this._charsToAnnounce+=c,c===`
|
|
42
42
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)),m.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,m.isMac&&this._liveRegion.remove()}_handleKey(c){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(c)||this._charsToConsume.push(c)}_refreshRows(c,p){this._liveRegionDebouncer.refresh(c,p,this._terminal.rows)}_renderRows(c,p){const v=this._terminal.buffer,x=v.lines.length.toString();for(let b=c;b<=p;b++){const y=v.translateBufferLineToString(v.ydisp+b,!0),k=(v.ydisp+b+1).toString(),R=this._rowElements[b];R&&(y.length===0?R.innerText=" ":R.textContent=y,R.setAttribute("aria-posinset",k),R.setAttribute("aria-setsize",x))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(c,p){const v=c.target,x=this._rowElements[p===0?1:this._rowElements.length-2];if(v.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||c.relatedTarget!==x)return;let b,y;if(p===0?(b=v,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(b=this._rowElements.shift(),y=v,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),c.preventDefault(),c.stopImmediatePropagation()}_handleResize(c){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>c;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const c=document.createElement("div");return c.setAttribute("role","listitem"),c.tabIndex=-1,this._refreshRowDimensions(c),c}_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 c=0;c<this._terminal.rows;c++)this._refreshRowDimensions(this._rowElements[c])}}_refreshRowDimensions(c){c.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=s=f([S(1,a.IRenderService)],s)},3614:(_,l)=>{function u(m){return m.replace(/\r?\n/g,"\r")}function f(m,C){return C?"\x1B[200~"+m+"\x1B[201~":m}function S(m,C,w,g){m=f(m=u(m),w.decPrivateModes.bracketedPasteMode&&g.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(m,!0),C.value=""}function d(m,C,w){const g=w.getBoundingClientRect(),a=m.clientX-g.left-10,o=m.clientY-g.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${a}px`,C.style.top=`${o}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=u,l.bracketTextForPaste=f,l.copyHandler=function(m,C){m.clipboardData&&m.clipboardData.setData("text/plain",C.selectionText),m.preventDefault()},l.handlePasteEvent=function(m,C,w,g){m.stopPropagation(),m.clipboardData&&S(m.clipboardData.getData("text/plain"),C,w,g)},l.paste=S,l.moveTextAreaUnderMouseCursor=d,l.rightClickHandler=function(m,C,w,g,a){d(m,C,w),a&&g.rightClickSelect(m),C.value=g.selectionText,C.select()}},7239:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=u(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(S,d,m){this._css.set(S,d,m)}getCss(S,d){return this._css.get(S,d)}setColor(S,d,m){this._color.set(S,d,m)}getColor(S,d){return this._color.get(S,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(u,f,S,d){u.addEventListener(f,S,d);let m=!1;return{dispose:()=>{m||(m=!0,u.removeEventListener(f,S,d))}}}},6465:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier2=void 0;const d=u(3656),m=u(8460),C=u(844),w=u(2585);let g=l.Linkifier2=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(a){super(),this._bufferService=a,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(a){return this._linkProviders.push(a),{dispose:()=>{const o=this._linkProviders.indexOf(a);o!==-1&&this._linkProviders.splice(o,1)}}}attachToDom(a,o,s){this._element=a,this._mouseService=o,this._renderService=s,this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(a){if(this._lastMouseEvent=a,!this._element||!this._mouseService)return;const o=this._positionFromMouseEvent(a,this._element,this._mouseService);if(!o)return;this._isMouseOut=!1;const s=a.composedPath();for(let c=0;c<s.length;c++){const p=s[c];if(p.classList.contains("xterm"))break;if(p.classList.contains("xterm-hover"))return}this._lastBufferCell&&o.x===this._lastBufferCell.x&&o.y===this._lastBufferCell.y||(this._handleHover(o),this._lastBufferCell=o)}_handleHover(a){if(this._activeLine!==a.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(a,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,a)||(this._clearCurrentLink(),this._askForLink(a,!0))}_askForLink(a,o){var s,c;this._activeProviderReplies&&o||((s=this._activeProviderReplies)===null||s===void 0||s.forEach(v=>{v==null||v.forEach(x=>{x.link.dispose&&x.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=a.y);let p=!1;for(const[v,x]of this._linkProviders.entries())o?!((c=this._activeProviderReplies)===null||c===void 0)&&c.get(v)&&(p=this._checkLinkProviderResult(v,a,p)):x.provideLinks(a.y,b=>{var y,k;if(this._isMouseOut)return;const R=b==null?void 0:b.map(O=>({link:O}));(y=this._activeProviderReplies)===null||y===void 0||y.set(v,R),p=this._checkLinkProviderResult(v,a,p),((k=this._activeProviderReplies)===null||k===void 0?void 0:k.size)===this._linkProviders.length&&this._removeIntersectingLinks(a.y,this._activeProviderReplies)})}_removeIntersectingLinks(a,o){const s=new Set;for(let c=0;c<o.size;c++){const p=o.get(c);if(p)for(let v=0;v<p.length;v++){const x=p[v],b=x.link.range.start.y<a?0:x.link.range.start.x,y=x.link.range.end.y>a?this._bufferService.cols:x.link.range.end.x;for(let k=b;k<=y;k++){if(s.has(k)){p.splice(v--,1);break}s.add(k)}}}}_checkLinkProviderResult(a,o,s){var c;if(!this._activeProviderReplies)return s;const p=this._activeProviderReplies.get(a);let v=!1;for(let x=0;x<a;x++)this._activeProviderReplies.has(x)&&!this._activeProviderReplies.get(x)||(v=!0);if(!v&&p){const x=p.find(b=>this._linkAtPosition(b.link,o));x&&(s=!0,this._handleNewLink(x))}if(this._activeProviderReplies.size===this._linkProviders.length&&!s)for(let x=0;x<this._activeProviderReplies.size;x++){const b=(c=this._activeProviderReplies.get(x))===null||c===void 0?void 0:c.find(y=>this._linkAtPosition(y.link,o));if(b){s=!0,this._handleNewLink(b);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(a){if(!this._element||!this._mouseService||!this._currentLink)return;const o=this._positionFromMouseEvent(a,this._element,this._mouseService);o&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,o)&&this._currentLink.link.activate(a,this._currentLink.link.text)}_clearCurrentLink(a,o){this._element&&this._currentLink&&this._lastMouseEvent&&(!a||!o||this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=o)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(a){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._linkAtPosition(a.link,o)&&(this._currentLink=a,this._currentLink.state={decorations:{underline:a.link.decorations===void 0||a.link.decorations.underline,pointerCursor:a.link.decorations===void 0||a.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,a.link,this._lastMouseEvent),a.link.decorations={},Object.defineProperties(a.link.decorations,{pointerCursor:{get:()=>{var s,c;return(c=(s=this._currentLink)===null||s===void 0?void 0:s.state)===null||c===void 0?void 0:c.decorations.pointerCursor},set:s=>{var c,p;!((c=this._currentLink)===null||c===void 0)&&c.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&((p=this._element)===null||p===void 0||p.classList.toggle("xterm-cursor-pointer",s)))}},underline:{get:()=>{var s,c;return(c=(s=this._currentLink)===null||s===void 0?void 0:s.state)===null||c===void 0?void 0:c.decorations.underline},set:s=>{var c,p,v;!((c=this._currentLink)===null||c===void 0)&&c.state&&((v=(p=this._currentLink)===null||p===void 0?void 0:p.state)===null||v===void 0?void 0:v.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(a.link,s))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const c=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,p=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=p&&(this._clearCurrentLink(c,p),this._lastMouseEvent&&this._element)){const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._askForLink(v,!1)}})))}_linkHover(a,o,s){var c;!((c=this._currentLink)===null||c===void 0)&&c.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!0),this._currentLink.state.decorations.pointerCursor&&a.classList.add("xterm-cursor-pointer")),o.hover&&o.hover(s,o.text)}_fireUnderlineEvent(a,o){const s=a.range,c=this._bufferService.buffer.ydisp,p=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-c-1,s.end.x,s.end.y-c-1,void 0);(o?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(p)}_linkLeave(a,o,s){var c;!((c=this._currentLink)===null||c===void 0)&&c.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!1),this._currentLink.state.decorations.pointerCursor&&a.classList.remove("xterm-cursor-pointer")),o.leave&&o.leave(s,o.text)}_linkAtPosition(a,o){const s=a.range.start.y*this._bufferService.cols+a.range.start.x,c=a.range.end.y*this._bufferService.cols+a.range.end.x,p=o.y*this._bufferService.cols+o.x;return s<=p&&p<=c}_positionFromMouseEvent(a,o,s){const c=s.getCoords(a,o,this._bufferService.cols,this._bufferService.rows);if(c)return{x:c[0],y:c[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(a,o,s,c,p){return{x1:a,y1:o,x2:s,y2:c,cols:this._bufferService.cols,fg:p}}};l.Linkifier2=g=f([S(0,w.IBufferService)],g)},9042:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(_,l,u){var f=this&&this.__decorate||function(g,a,o,s){var c,p=arguments.length,v=p<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,o):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(g,a,o,s);else for(var x=g.length-1;x>=0;x--)(c=g[x])&&(v=(p<3?c(v):p>3?c(a,o,v):c(a,o))||v);return p>3&&v&&Object.defineProperty(a,o,v),v},S=this&&this.__param||function(g,a){return function(o,s){a(o,s,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const d=u(511),m=u(2585);let C=l.OscLinkProvider=class{constructor(g,a,o){this._bufferService=g,this._optionsService=a,this._oscLinkService=o}provideLinks(g,a){var o;const s=this._bufferService.buffer.lines.get(g-1);if(!s)return void a(void 0);const c=[],p=this._optionsService.rawOptions.linkHandler,v=new d.CellData,x=s.getTrimmedLength();let b=-1,y=-1,k=!1;for(let R=0;R<x;R++)if(y!==-1||s.hasContent(R)){if(s.loadCell(R,v),v.hasExtendedAttrs()&&v.extended.urlId){if(y===-1){y=R,b=v.extended.urlId;continue}k=v.extended.urlId!==b}else y!==-1&&(k=!0);if(k||y!==-1&&R===x-1){const O=(o=this._oscLinkService.getLinkData(b))===null||o===void 0?void 0:o.uri;if(O){const T={start:{x:y+1,y:g},end:{x:R+(k||R!==x-1?0:1),y:g}};let B=!1;if(!(p!=null&&p.allowNonHttpProtocols))try{const z=new URL(O);["http:","https:"].includes(z.protocol)||(B=!0)}catch{B=!0}B||c.push({text:O,range:T,activate:(z,I)=>p?p.activate(z,I,T):w(0,I),hover:(z,I)=>{var j;return(j=p==null?void 0:p.hover)===null||j===void 0?void 0:j.call(p,z,I,T)},leave:(z,I)=>{var j;return(j=p==null?void 0:p.leave)===null||j===void 0?void 0:j.call(p,z,I,T)}})}k=!1,v.hasExtendedAttrs()&&v.extended.urlId?(y=R,b=v.extended.urlId):(y=-1,b=-1)}}a(c)}};function w(g,a){if(confirm(`Do you want to navigate to ${a}?
|
|
43
43
|
|
|
44
|
-
WARNING: This link could potentially be dangerous`)){const o=window.open();if(o){try{o.opener=null}catch{}o.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=C=f([S(0,m.IBufferService),S(1,m.IOptionsService),S(2,m.IOscLinkService)],C)},6193:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(u,f){this._parentWindow=u,this._renderCallback=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(u,f,S){this._rowCount=S,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._parentWindow.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 u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},5596:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ScreenDprMonitor=void 0;const f=u(844);class S extends f.Disposable{constructor(m){super(),this._parentWindow=m,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,f.toDisposable)(()=>{this.clearListener()}))}setListener(m){this._listener&&this.clearListener(),this._listener=m,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var m;this._outerListener&&((m=this._resolutionMediaMatchList)===null||m===void 0||m.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}l.ScreenDprMonitor=S},3236:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=u(3614),S=u(3656),d=u(6465),m=u(9042),C=u(3730),w=u(1680),g=u(3107),a=u(5744),o=u(2950),s=u(1296),c=u(428),p=u(4269),v=u(5114),x=u(8934),b=u(3230),y=u(9312),k=u(4725),R=u(6731),O=u(8055),T=u(8969),B=u(8460),z=u(844),I=u(6114),j=u(8437),$=u(2584),E=u(7399),A=u(5941),P=u(9074),M=u(2585),H=u(5435),K=u(4567),X=typeof window<"u"?window.document:null;class q extends T.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(D={}){super(D),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.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.linkifier2=this.register(this._instantiationService.createInstance(d.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(M.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((F,W)=>this.refresh(F,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(F=>this._reportWindowsOptions(F))),this.register(this._inputHandler.onColor(F=>this._handleColorEvent(F))),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(F=>this._afterResize(F.cols,F.rows))),this.register((0,z.toDisposable)(()=>{var F,W;this._customKeyEventHandler=void 0,(W=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||W===void 0||W.removeChild(this.element)}))}_handleColorEvent(D){if(this._themeService)for(const F of D){let W,U="";switch(F.index){case 256:W="foreground",U="10";break;case 257:W="background",U="11";break;case 258:W="cursor",U="12";break;default:W="ansi",U="4;"+F.index}switch(F.type){case 0:const re=O.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${U};${(0,A.toRgbString)(re)}${$.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(J=>J.ansi[F.index]=O.rgba.toColor(...F.color));else{const J=W;this._themeService.modifyColors(ae=>ae[J]=O.rgba.toColor(...F.color))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(D){D?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(D){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.updateCursorStyle(D),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var D;return(D=this.textarea)===null||D===void 0?void 0:D.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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 D=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(D);if(!F)return;const W=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,re=F.getWidth(W),J=this._renderService.dimensions.css.cell.width*re,ae=this.buffer.y*this._renderService.dimensions.css.cell.height,we=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=we+"px",this.textarea.style.top=ae+"px",this.textarea.style.width=J+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,S.addDisposableDomListener)(this.element,"copy",F=>{this.hasSelection()&&(0,f.copyHandler)(F,this._selectionService)}));const D=F=>(0,f.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,S.addDisposableDomListener)(this.textarea,"paste",D)),this.register((0,S.addDisposableDomListener)(this.element,"paste",D)),I.isFirefox?this.register((0,S.addDisposableDomListener)(this.element,"mousedown",F=>{F.button===2&&(0,f.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,S.addDisposableDomListener)(this.element,"contextmenu",F=>{(0,f.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,S.addDisposableDomListener)(this.element,"auxclick",F=>{F.button===1&&(0,f.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,S.addDisposableDomListener)(this.textarea,"keyup",D=>this._keyUp(D),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"keydown",D=>this._keyDown(D),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"keypress",D=>this._keyPress(D),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionupdate",D=>this._compositionHelper.compositionupdate(D))),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,S.addDisposableDomListener)(this.textarea,"input",D=>this._inputEvent(D),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(D){var F;if(!D)throw new Error("Terminal requires a parent element.");D.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=D.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),D.appendChild(this.element);const W=X.createDocumentFragment();this._viewportElement=X.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.appendChild(this._viewportElement),this._viewportScrollArea=X.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=X.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=X.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),W.appendChild(this.screenElement),this.textarea=X.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),I.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._instantiationService.createInstance(v.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(k.ICoreBrowserService,this._coreBrowserService),this.register((0,S.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,S.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(c.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(k.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(k.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(p.CharacterJoinerService),this._instantiationService.setService(k.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(b.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(k.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=X.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(k.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.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(y.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(k.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,S.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,S.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),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(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(s.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const D=this,F=this.element;function W(J){const ae=D._mouseService.getMouseReportCoords(J,D.screenElement);if(!ae)return!1;let we,fe;switch(J.overrideType||J.type){case"mousemove":fe=32,J.buttons===void 0?(we=3,J.button!==void 0&&(we=J.button<3?J.button:3)):we=1&J.buttons?0:4&J.buttons?1:2&J.buttons?2:3;break;case"mouseup":fe=0,we=J.button<3?J.button:3;break;case"mousedown":fe=1,we=J.button<3?J.button:3;break;case"wheel":if(D.viewport.getLinesScrolled(J)===0)return!1;fe=J.deltaY<0?0:1,we=4;break;default:return!1}return!(fe===void 0||we===void 0||we>4)&&D.coreMouseService.triggerMouseEvent({col:ae.col,row:ae.row,x:ae.x,y:ae.y,button:we,action:fe,ctrl:J.ctrlKey,alt:J.altKey,shift:J.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},re={mouseup:J=>(W(J),J.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(J)),wheel:J=>(W(J),this.cancel(J,!0)),mousedrag:J=>{J.buttons&&W(J)},mousemove:J=>{J.buttons||W(J)}};this.register(this.coreMouseService.onProtocolChange(J=>{J?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(J)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&J?U.mousemove||(F.addEventListener("mousemove",re.mousemove),U.mousemove=re.mousemove):(F.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&J?U.wheel||(F.addEventListener("wheel",re.wheel,{passive:!1}),U.wheel=re.wheel):(F.removeEventListener("wheel",U.wheel),U.wheel=null),2&J?U.mouseup||(F.addEventListener("mouseup",re.mouseup),U.mouseup=re.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),F.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&J?U.mousedrag||(U.mousedrag=re.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,S.addDisposableDomListener)(F,"mousedown",J=>{if(J.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(J))return W(J),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(J)})),this.register((0,S.addDisposableDomListener)(F,"wheel",J=>{if(!U.wheel){if(!this.buffer.hasScrollback){const ae=this.viewport.getLinesScrolled(J);if(ae===0)return;const we=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(J.deltaY<0?"A":"B");let fe="";for(let ut=0;ut<Math.abs(ae);ut++)fe+=we;return this.coreService.triggerDataEvent(fe,!0),this.cancel(J,!0)}return this.viewport.handleWheel(J)?this.cancel(J):void 0}},{passive:!1})),this.register((0,S.addDisposableDomListener)(F,"touchstart",J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(J),this.cancel(J)},{passive:!0})),this.register((0,S.addDisposableDomListener)(F,"touchmove",J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(J)?void 0:this.cancel(J)},{passive:!1}))}refresh(D,F){var W;(W=this._renderService)===null||W===void 0||W.refreshRows(D,F)}updateCursorStyle(D){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(D)?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(D,F,W=0){var U;W===1?(super.scrollLines(D,F,W),this.refresh(0,this.rows-1)):(U=this.viewport)===null||U===void 0||U.scrollLines(D)}paste(D){(0,f.paste)(D,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(D){this._customKeyEventHandler=D}registerLinkProvider(D){return this.linkifier2.registerLinkProvider(D)}registerCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(D);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(D)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(D){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+D)}registerDecoration(D){return this._decorationService.registerDecoration(D)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(D,F,W){this._selectionService.setSelection(D,F,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var D;(D=this._selectionService)===null||D===void 0||D.clearSelection()}selectAll(){var D;(D=this._selectionService)===null||D===void 0||D.selectAll()}selectLines(D,F){var W;(W=this._selectionService)===null||W===void 0||W.selectLines(D,F)}_keyDown(D){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&D.altKey;if(!F&&!this._compositionHelper.keydown(D))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||D.key!=="Dead"&&D.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const W=(0,E.evaluateKeyboardEvent)(D,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(D),W.type===3||W.type===2){const U=this.rows-1;return this.scrollLines(W.type===2?-U:U),this.cancel(D,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,D)||(W.cancel&&this.cancel(D,!0),!W.key||!!(D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.key.length===1&&D.key.charCodeAt(0)>=65&&D.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==$.C0.ETX&&W.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||D.altKey||D.ctrlKey?this.cancel(D,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(D,F){const W=D.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||D.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||D.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?W:W&&(!F.keyCode||F.keyCode>47)}_keyUp(D){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1||(function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18}(D)||this.focus(),this.updateCursorStyle(D),this._keyPressHandled=!1)}_keyPress(D){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;if(this.cancel(D),D.charCode)F=D.charCode;else if(D.which===null||D.which===void 0)F=D.keyCode;else{if(D.which===0||D.charCode===0)return!1;F=D.which}return!(!F||(D.altKey||D.ctrlKey||D.metaKey)&&!this._isThirdLevelShift(this.browser,D)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(D){if(D.data&&D.inputType==="insertText"&&(!D.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=D.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(D),!0}return!1}resize(D,F){D!==this.cols||F!==this.rows?super.resize(D,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(D,F){var W,U;(W=this._charSizeService)===null||W===void 0||W.measure(),(U=this.viewport)===null||U===void 0||U.syncScrollArea(!0)}clear(){var D;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 F=1;F<this.rows;F++)this.buffer.lines.push(this.buffer.getBlankLine(j.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(D=this.viewport)===null||D===void 0||D.reset(),this.refresh(0,this.rows-1)}}reset(){var D,F;this.options.rows=this.rows,this.options.cols=this.cols;const W=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)===null||D===void 0||D.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=W,this.refresh(0,this.rows-1)}clearTextureAtlas(){var D;(D=this._renderService)===null||D===void 0||D.clearTextureAtlas()}_reportFocus(){var D;!((D=this.element)===null||D===void 0)&&D.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(D){if(this._renderService)switch(D){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${W};${F}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const U=this._renderService.dimensions.css.cell.width.toFixed(0),re=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${re};${U}t`)}}cancel(D,F){if(this.options.cancelEvents||F)return D.preventDefault(),D.stopPropagation(),!1}}l.Terminal=q},9924:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(u,f=1e3){this._renderCallback=u,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,f,S){this._rowCount=S,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=d-this._lastRefreshMs,C=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f)}}},1680:function(_,l,u){var f=this&&this.__decorate||function(o,s,c,p){var v,x=arguments.length,b=x<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(o,s,c,p);else for(var y=o.length-1;y>=0;y--)(v=o[y])&&(b=(x<3?v(b):x>3?v(s,c,b):v(s,c))||b);return x>3&&b&&Object.defineProperty(s,c,b),b},S=this&&this.__param||function(o,s){return function(c,p){s(c,p,o)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const d=u(3656),m=u(4725),C=u(8460),w=u(844),g=u(2585);let a=l.Viewport=class extends w.Disposable{constructor(o,s,c,p,v,x,b,y){super(),this._viewportElement=o,this._scrollArea=s,this._bufferService=c,this._optionsService=p,this._charSizeService=v,this._renderService=x,this._coreBrowserService=b,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 C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(k=>this._renderDimensions=k)),this._handleThemeChange(y.colors),this.register(y.onChangeColors(k=>this._handleThemeChange(k))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(o){this._viewportElement.style.backgroundColor=o.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(o){if(o)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._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const o=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==o&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=o),this._refreshAnimationFrame=null}syncScrollArea(o=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(o);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(o)}_handleScroll(o){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 s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const o=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(o*(this._smoothScrollState.target-this._smoothScrollState.origin)),o<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(o,s){const c=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&c<this._lastRecordedBufferHeight)||(o.cancelable&&o.preventDefault(),!1)}handleWheel(o){const s=this._getPixelsScrolled(o);return s!==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+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(o,s))}scrollLines(o){if(o!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const s=o*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:o,suppressScrollEvent:!1})}_getPixelsScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let s=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getBufferElements(o,s){var c;let p,v="";const x=[],b=s??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let k=o;k<b;k++){const R=y.get(k);if(!R)continue;const O=(c=y.get(k+1))===null||c===void 0?void 0:c.isWrapped;if(v+=R.translateToString(!O),!O||k===y.length-1){const T=document.createElement("div");T.textContent=v,x.push(T),v.length>0&&(p=T),v=""}}return{bufferElements:x,cursorElement:p}}getLinesScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let s=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(o,s){const c=this._optionsService.rawOptions.fastScrollModifier;return c==="alt"&&s.altKey||c==="ctrl"&&s.ctrlKey||c==="shift"&&s.shiftKey?o*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:o*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(o){this._lastTouchY=o.touches[0].pageY}handleTouchMove(o){const s=this._lastTouchY-o.touches[0].pageY;return this._lastTouchY=o.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(o,s))}};l.Viewport=a=f([S(2,g.IBufferService),S(3,g.IOptionsService),S(4,m.ICharSizeService),S(5,m.IRenderService),S(6,m.ICoreBrowserService),S(7,m.IThemeService)],a)},3107:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const d=u(3656),m=u(4725),C=u(844),w=u(2585);let g=l.BufferDecorationRenderer=class extends C.Disposable{constructor(a,o,s,c){super(),this._screenElement=a,this._bufferService=o,this._decorationService=s,this._renderService=c,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((0,d.addDisposableDomListener)(window,"resize",()=>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(p=>this._removeDecoration(p))),this.register((0,C.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 a of this._decorationService.decorations)this._renderDecoration(a);this._dimensionsChanged=!1}_renderDecoration(a){this._refreshStyle(a),this._dimensionsChanged&&this._refreshXPosition(a)}_createElement(a){var o,s;const c=document.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",((o=a==null?void 0:a.options)===null||o===void 0?void 0:o.layer)==="top"),c.style.width=`${Math.round((a.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(a.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(a.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const p=(s=a.options.x)!==null&&s!==void 0?s:0;return p&&p>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(a,c),c}_refreshStyle(a){const o=a.marker.line-this._bufferService.buffers.active.ydisp;if(o<0||o>=this._bufferService.rows)a.element&&(a.element.style.display="none",a.onRenderEmitter.fire(a.element));else{let s=this._decorationElements.get(a);s||(s=this._createElement(a),a.element=s,this._decorationElements.set(a,s),this._container.appendChild(s),a.onDispose(()=>{this._decorationElements.delete(a),s.remove()})),s.style.top=o*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",a.onRenderEmitter.fire(s)}}_refreshXPosition(a,o=a.element){var s;if(!o)return;const c=(s=a.options.x)!==null&&s!==void 0?s:0;(a.options.anchor||"left")==="right"?o.style.right=c?c*this._renderService.dimensions.css.cell.width+"px":"":o.style.left=c?c*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(a){var o;(o=this._decorationElements.get(a))===null||o===void 0||o.remove(),this._decorationElements.delete(a),a.dispose()}};l.BufferDecorationRenderer=g=f([S(1,w.IBufferService),S(2,w.IDecorationService),S(3,m.IRenderService)],g)},5871:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.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(u){if(u.options.overviewRulerOptions){for(const f of this._zones)if(f.color===u.options.overviewRulerOptions.color&&f.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,u.marker.line))return;if(this._lineAdjacentToZone(f,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(f,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,f){return f>=u.startBufferLine&&f<=u.endBufferLine}_lineAdjacentToZone(u,f,S){return f>=u.startBufferLine-this._linePadding[S||"full"]&&f<=u.endBufferLine+this._linePadding[S||"full"]}_addLineToZone(u,f){u.startBufferLine=Math.min(u.startBufferLine,f),u.endBufferLine=Math.max(u.endBufferLine,f)}}},5744:function(_,l,u){var f=this&&this.__decorate||function(p,v,x,b){var y,k=arguments.length,R=k<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,v,x,b);else for(var O=p.length-1;O>=0;O--)(y=p[O])&&(R=(k<3?y(R):k>3?y(v,x,R):y(v,x))||R);return k>3&&R&&Object.defineProperty(v,x,R),R},S=this&&this.__param||function(p,v){return function(x,b){v(x,b,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const d=u(5871),m=u(3656),C=u(4725),w=u(844),g=u(2585),a={full:0,left:0,center:0,right:0},o={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let c=l.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,v,x,b,y,k,R){var O;super(),this._viewportElement=p,this._screenElement=v,this._bufferService=x,this._decorationService=b,this._renderService=y,this._optionsService=k,this._coreBrowseService=R,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(O=this._viewportElement.parentElement)===null||O===void 0||O.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)(()=>{var B;(B=this._canvas)===null||B===void 0||B.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((0,m.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const p=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);o.full=this._canvas.width,o.left=p,o.center=v,o.right=p,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=o.left,s.right=o.left+o.center}_refreshDrawHeightConstants(){a.full=Math.round(2*this._coreBrowseService.dpr);const p=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowseService.dpr);a.left=v,a.center=v,a.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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 v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;const p=this._colorZoneStore.zones;for(const v of p)v.position!=="full"&&this._renderColorZone(v);for(const v of p)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(s[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-a[p.position||"full"]/2),o[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+a[p.position||"full"]))}_queueRefresh(p,v){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};l.OverviewRulerRenderer=c=f([S(2,g.IBufferService),S(3,g.IDecorationService),S(4,C.IRenderService),S(5,g.IOptionsService),S(6,C.ICoreBrowserService)],c)},2950:function(_,l,u){var f=this&&this.__decorate||function(g,a,o,s){var c,p=arguments.length,v=p<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,o):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(g,a,o,s);else for(var x=g.length-1;x>=0;x--)(c=g[x])&&(v=(p<3?c(v):p>3?c(a,o,v):c(a,o))||v);return p>3&&v&&Object.defineProperty(a,o,v),v},S=this&&this.__param||function(g,a){return function(o,s){a(o,s,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const d=u(4725),m=u(2585),C=u(2584);let w=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,a,o,s,c,p){this._textarea=g,this._compositionView=a,this._bufferService=o,this._optionsService=s,this._coreService=c,this._renderService=p,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){const a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let o;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,o=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),o.length>0&&this._coreService.triggerDataEvent(o,!0)}},0)}else{this._isSendingComposition=!1;const a=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(a,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const a=this._textarea.value,o=a.replace(g,"");this._dataAlreadySent=o,a.length>g.length?this._coreService.triggerDataEvent(o,!0):a.length<g.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):a.length===g.length&&a!==g&&this._coreService.triggerDataEvent(a,!0)}},0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),o=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,c=a*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=o+"px",this._compositionView.style.lineHeight=o+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const p=this._compositionView.getBoundingClientRect();this._textarea.style.left=c+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(p.width,1)+"px",this._textarea.style.height=Math.max(p.height,1)+"px",this._textarea.style.lineHeight=p.height+"px"}g||setTimeout(()=>this.updateCompositionElements(!0),0)}}};l.CompositionHelper=w=f([S(2,m.IBufferService),S(3,m.IOptionsService),S(4,m.ICoreService),S(5,d.IRenderService)],w)},9806:(_,l)=>{function u(f,S,d){const m=d.getBoundingClientRect(),C=f.getComputedStyle(d),w=parseInt(C.getPropertyValue("padding-left")),g=parseInt(C.getPropertyValue("padding-top"));return[S.clientX-m.left-w,S.clientY-m.top-g]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=u,l.getCoords=function(f,S,d,m,C,w,g,a,o){if(!w)return;const s=u(f,S,d);return s?(s[0]=Math.ceil((s[0]+(o?g/2:0))/g),s[1]=Math.ceil(s[1]/a),s[0]=Math.min(Math.max(s[0],1),m+(o?1:0)),s[1]=Math.min(Math.max(s[1],1),C),s):void 0}},9504:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=u(2584);function S(a,o,s,c){const p=a-d(a,s),v=o-d(o,s),x=Math.abs(p-v)-function(b,y,k){let R=0;const O=b-d(b,k),T=y-d(y,k);for(let B=0;B<Math.abs(O-T);B++){const z=m(b,y)==="A"?-1:1,I=k.buffer.lines.get(O+z*B);I!=null&&I.isWrapped&&R++}return R}(a,o,s);return g(x,w(m(a,o),c))}function d(a,o){let s=0,c=o.buffer.lines.get(a),p=c==null?void 0:c.isWrapped;for(;p&&a>=0&&a<o.rows;)s++,c=o.buffer.lines.get(--a),p=c==null?void 0:c.isWrapped;return s}function m(a,o){return a>o?"A":"B"}function C(a,o,s,c,p,v){let x=a,b=o,y="";for(;x!==s||b!==c;)x+=p?1:-1,p&&x>v.cols-1?(y+=v.buffer.translateBufferLineToString(b,!1,a,x),x=0,a=0,b++):!p&&x<0&&(y+=v.buffer.translateBufferLineToString(b,!1,0,a+1),x=v.cols-1,a=x,b--);return y+v.buffer.translateBufferLineToString(b,!1,a,x)}function w(a,o){const s=o?"O":"[";return f.C0.ESC+s+a}function g(a,o){a=Math.floor(a);let s="";for(let c=0;c<a;c++)s+=o;return s}l.moveToCellSequence=function(a,o,s,c){const p=s.buffer.x,v=s.buffer.y;if(!s.buffer.hasScrollback)return function(y,k,R,O,T,B){return S(k,O,T,B).length===0?"":g(C(y,k,y,k-d(k,T),!1,T).length,w("D",B))}(p,v,0,o,s,c)+S(v,o,s,c)+function(y,k,R,O,T,B){let z;z=S(k,O,T,B).length>0?O-d(O,T):k;const I=O,j=function($,E,A,P,M,H){let K;return K=S(A,P,M,H).length>0?P-d(P,M):E,$<A&&K<=P||$>=A&&K<P?"C":"D"}(y,k,R,O,T,B);return g(C(y,z,R,I,j==="C",T).length,w(j,B))}(p,v,a,o,s,c);let x;if(v===o)return x=p>a?"D":"C",g(Math.abs(p-a),w(x,c));x=v>o?"D":"C";const b=Math.abs(v-o);return g(function(y,k){return k.cols-y}(v>o?a:p,s)+(b-1)*s.cols+1+((v>o?p:a)-1),w(x,c))}},1296:function(_,l,u){var f=this&&this.__decorate||function(T,B,z,I){var j,$=arguments.length,E=$<3?B:I===null?I=Object.getOwnPropertyDescriptor(B,z):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(T,B,z,I);else for(var A=T.length-1;A>=0;A--)(j=T[A])&&(E=($<3?j(E):$>3?j(B,z,E):j(B,z))||E);return $>3&&E&&Object.defineProperty(B,z,E),E},S=this&&this.__param||function(T,B){return function(z,I){B(z,I,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const d=u(3787),m=u(2550),C=u(2223),w=u(6171),g=u(4725),a=u(8055),o=u(8460),s=u(844),c=u(2585),p="xterm-dom-renderer-owner-",v="xterm-rows",x="xterm-fg-",b="xterm-bg-",y="xterm-focus",k="xterm-selection";let R=1,O=l.DomRenderer=class extends s.Disposable{constructor(T,B,z,I,j,$,E,A,P,M){super(),this._element=T,this._screenElement=B,this._viewportElement=z,this._linkifier2=I,this._charSizeService=$,this._optionsService=E,this._bufferService=A,this._coreBrowserService=P,this._themeService=M,this._terminalClass=R++,this._rowElements=[],this.onRequestRedraw=this.register(new o.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(v),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(k),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(H=>this._injectCss(H))),this._injectCss(this._themeService.colors),this._rowFactory=j.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(H=>this._handleLinkHover(H))),this.register(this._linkifier2.onHideLinkUnderline(H=>this._handleLinkLeave(H))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new m.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const T=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*T,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*T),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/T),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/T),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 z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const B=`${this._terminalSelector} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=B,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(T){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let B=`${this._terminalSelector} .${v} { color: ${T.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;B+=`${this._terminalSelector} .${v} .xterm-dim { color: ${a.color.multiplyOpacity(T.foreground,.5).css};}`,B+=`${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;}`,B+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",B+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${T.cursor.css}; color: ${T.cursorAccent.css}; } 50% { background-color: inherit; color: ${T.cursor.css}; }}`,B+=`${this._terminalSelector} .${v}.${y} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${v}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block { background-color: ${T.cursor.css}; color: ${T.cursorAccent.css};}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${T.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${T.cursor.css} inset;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${T.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,B+=`${this._terminalSelector} .${k} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${k} div { position: absolute; background-color: ${T.selectionBackgroundOpaque.css};}${this._terminalSelector} .${k} div { position: absolute; background-color: ${T.selectionInactiveBackgroundOpaque.css};}`;for(const[z,I]of T.ansi.entries())B+=`${this._terminalSelector} .${x}${z} { color: ${I.css}; }${this._terminalSelector} .${x}${z}.xterm-dim { color: ${a.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${b}${z} { background-color: ${I.css}; }`;B+=`${this._terminalSelector} .${x}${C.INVERTED_DEFAULT_COLOR} { color: ${a.color.opaque(T.background).css}; }${this._terminalSelector} .${x}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${a.color.multiplyOpacity(a.color.opaque(T.background),.5).css}; }${this._terminalSelector} .${b}${C.INVERTED_DEFAULT_COLOR} { background-color: ${T.foreground.css}; }`,this._themeStyleElement.textContent=B}_setDefaultSpacing(){const T=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${T}px`,this._rowFactory.defaultSpacing=T}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(T,B){for(let z=this._rowElements.length;z<=B;z++){const I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>B;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(T,B){this._refreshRowElements(T,B),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(T,B,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(T,B,z),this.renderRows(0,this._bufferService.rows-1),!T||!B)return;const I=T[1]-this._bufferService.buffer.ydisp,j=B[1]-this._bufferService.buffer.ydisp,$=Math.max(I,0),E=Math.min(j,this._bufferService.rows-1);if($>=this._bufferService.rows||E<0)return;const A=document.createDocumentFragment();if(z){const P=T[0]>B[0];A.appendChild(this._createSelectionElement($,P?B[0]:T[0],P?T[0]:B[0],E-$+1))}else{const P=I===$?T[0]:0,M=$===j?B[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement($,P,M));const H=E-$-1;if(A.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,H)),$!==E){const K=j===E?B[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement(E,0,K))}}this._selectionContainer.appendChild(A)}_createSelectionElement(T,B,z,I=1){const j=document.createElement("div");return j.style.height=I*this.dimensions.css.cell.height+"px",j.style.top=T*this.dimensions.css.cell.height+"px",j.style.left=B*this.dimensions.css.cell.width+"px",j.style.width=this.dimensions.css.cell.width*(z-B)+"px",j}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 T of this._rowElements)T.replaceChildren()}renderRows(T,B){const z=this._bufferService.buffer,I=z.ybase+z.y,j=Math.min(z.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,E=this._optionsService.rawOptions.cursorStyle,A=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=T;P<=B;P++){const M=P+z.ydisp,H=this._rowElements[P],K=z.lines.get(M);if(!H||!K)break;H.replaceChildren(...this._rowFactory.createRow(K,M,M===I,E,A,j,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(T){this._setCellUnderline(T.x1,T.x2,T.y1,T.y2,T.cols,!0)}_handleLinkLeave(T){this._setCellUnderline(T.x1,T.x2,T.y1,T.y2,T.cols,!1)}_setCellUnderline(T,B,z,I,j,$){z<0&&(T=0),I<0&&(B=0);const E=this._bufferService.rows-1;z=Math.max(Math.min(z,E),0),I=Math.max(Math.min(I,E),0),j=Math.min(j,this._bufferService.cols);const A=this._bufferService.buffer,P=A.ybase+A.y,M=Math.min(A.x,j-1),H=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let q=z;q<=I;++q){const se=q+A.ydisp,D=this._rowElements[q],F=A.lines.get(se);if(!D||!F)break;D.replaceChildren(...this._rowFactory.createRow(F,se,se===P,K,X,M,H,this.dimensions.css.cell.width,this._widthCache,$?q===z?T:0:-1,$?(q===I?B:j)-1:-1))}}};l.DomRenderer=O=f([S(4,c.IInstantiationService),S(5,g.ICharSizeService),S(6,c.IOptionsService),S(7,c.IBufferService),S(8,g.ICoreBrowserService),S(9,g.IThemeService)],O)},3787:function(_,l,u){var f=this&&this.__decorate||function(x,b,y,k){var R,O=arguments.length,T=O<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,b,y,k);else for(var B=x.length-1;B>=0;B--)(R=x[B])&&(T=(O<3?R(T):O>3?R(b,y,T):R(b,y))||T);return O>3&&T&&Object.defineProperty(b,y,T),T},S=this&&this.__param||function(x,b){return function(y,k){b(y,k,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const d=u(2223),m=u(643),C=u(511),w=u(2585),g=u(8055),a=u(4725),o=u(4269),s=u(6171),c=u(3734);let p=l.DomRendererRowFactory=class{constructor(x,b,y,k,R,O,T){this._document=x,this._characterJoinerService=b,this._optionsService=y,this._coreBrowserService=k,this._coreService=R,this._decorationService=O,this._themeService=T,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,b,y){this._selectionStart=x,this._selectionEnd=b,this._columnSelectMode=y}createRow(x,b,y,k,R,O,T,B,z,I,j){const $=[],E=this._characterJoinerService.getJoinedCharacters(b),A=this._themeService.colors;let P,M=x.getNoBgTrimmedLength();y&&M<O+1&&(M=O+1);let H=0,K="",X=0,q=0,se=0,D=!1,F=0,W=!1,U=0;const re=[],J=I!==-1&&j!==-1;for(let ae=0;ae<M;ae++){x.loadCell(ae,this._workCell);let we=this._workCell.getWidth();if(we===0)continue;let fe=!1,ut=ae,ne=this._workCell;if(E.length>0&&ae===E[0][0]){fe=!0;const pe=E.shift();ne=new o.JoinedCellData(this._workCell,x.translateToString(!0,pe[0],pe[1]),pe[1]-pe[0]),ut=pe[1]-1,we=ne.getWidth()}const ht=this._isCellInSelection(ae,b),Xe=y&&ae===O,Ut=J&&ae>=I&&ae<=j;let Q=!1;this._decorationService.forEachDecorationAtCell(ae,b,void 0,pe=>{Q=!0});let Y=ne.getChars()||m.WHITESPACE_CELL_CHAR;if(Y===" "&&(ne.isUnderline()||ne.isOverline())&&(Y=" "),U=we*B-z.get(Y,ne.isBold(),ne.isItalic()),P){if(H&&(ht&&W||!ht&&!W&&ne.bg===X)&&(ht&&W&&A.selectionForeground||ne.fg===q)&&ne.extended.ext===se&&Ut===D&&U===F&&!Xe&&!fe&&!Q){K+=Y,H++;continue}H&&(P.textContent=K),P=this._document.createElement("span"),H=0,K=""}else P=this._document.createElement("span");if(X=ne.bg,q=ne.fg,se=ne.extended.ext,D=Ut,F=U,W=ht,fe&&O>=ae&&O<=ut&&(O=ae),!this._coreService.isCursorHidden&&Xe){if(re.push("xterm-cursor"),this._coreBrowserService.isFocused)T&&re.push("xterm-cursor-blink"),re.push(k==="bar"?"xterm-cursor-bar":k==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){case"outline":re.push("xterm-cursor-outline");break;case"block":re.push("xterm-cursor-block");break;case"bar":re.push("xterm-cursor-bar");break;case"underline":re.push("xterm-cursor-underline")}}if(ne.isBold()&&re.push("xterm-bold"),ne.isItalic()&&re.push("xterm-italic"),ne.isDim()&&re.push("xterm-dim"),K=ne.isInvisible()?m.WHITESPACE_CELL_CHAR:ne.getChars()||m.WHITESPACE_CELL_CHAR,ne.isUnderline()&&(re.push(`xterm-underline-${ne.extended.underlineStyle}`),K===" "&&(K=" "),!ne.isUnderlineColorDefault()))if(ne.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${c.AttributeData.toColorRGB(ne.getUnderlineColor()).join(",")})`;else{let pe=ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ne.isBold()&&pe<8&&(pe+=8),P.style.textDecorationColor=A.ansi[pe].css}ne.isOverline()&&(re.push("xterm-overline"),K===" "&&(K=" ")),ne.isStrikethrough()&&re.push("xterm-strikethrough"),Ut&&(P.style.textDecoration="underline");let te=ne.getFgColor(),ie=ne.getFgColorMode(),oe=ne.getBgColor(),ce=ne.getBgColorMode();const Be=!!ne.isInverse();if(Be){const pe=te;te=oe,oe=pe;const ni=ie;ie=ce,ce=ni}let me,Tt,We,At=!1;switch(this._decorationService.forEachDecorationAtCell(ae,b,void 0,pe=>{pe.options.layer!=="top"&&At||(pe.backgroundColorRGB&&(ce=50331648,oe=pe.backgroundColorRGB.rgba>>8&16777215,me=pe.backgroundColorRGB),pe.foregroundColorRGB&&(ie=50331648,te=pe.foregroundColorRGB.rgba>>8&16777215,Tt=pe.foregroundColorRGB),At=pe.options.layer==="top")}),!At&&ht&&(me=this._coreBrowserService.isFocused?A.selectionBackgroundOpaque:A.selectionInactiveBackgroundOpaque,oe=me.rgba>>8&16777215,ce=50331648,At=!0,A.selectionForeground&&(ie=50331648,te=A.selectionForeground.rgba>>8&16777215,Tt=A.selectionForeground)),At&&re.push("xterm-decoration-top"),ce){case 16777216:case 33554432:We=A.ansi[oe],re.push(`xterm-bg-${oe}`);break;case 50331648:We=g.rgba.toColor(oe>>16,oe>>8&255,255&oe),this._addStyle(P,`background-color:#${v((oe>>>0).toString(16),"0",6)}`);break;default:Be?(We=A.foreground,re.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):We=A.background}switch(me||ne.isDim()&&(me=g.color.multiplyOpacity(We,.5)),ie){case 16777216:case 33554432:ne.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(P,We,A.ansi[te],ne,me,void 0)||re.push(`xterm-fg-${te}`);break;case 50331648:const pe=g.rgba.toColor(te>>16&255,te>>8&255,255&te);this._applyMinimumContrast(P,We,pe,ne,me,Tt)||this._addStyle(P,`color:#${v(te.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,We,A.foreground,ne,me,void 0)||Be&&re.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}re.length&&(P.className=re.join(" "),re.length=0),Xe||fe||Q?P.textContent=K:H++,U!==this.defaultSpacing&&(P.style.letterSpacing=`${U}px`),$.push(P),ae=ut}return P&&H&&(P.textContent=K),$}_applyMinimumContrast(x,b,y,k,R,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,s.excludeFromContrastRatioDemands)(k.getCode()))return!1;const T=this._getContrastCache(k);let B;if(R||O||(B=T.getColor(b.rgba,y.rgba)),B===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(k.isDim()?2:1);B=g.color.ensureContrastRatio(R||b,O||y,z),T.setColor((R||b).rgba,(O||y).rgba,B??null)}return!!B&&(this._addStyle(x,`color:${B.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,b){x.setAttribute("style",`${x.getAttribute("style")||""}${b};`)}_isCellInSelection(x,b){const y=this._selectionStart,k=this._selectionEnd;return!(!y||!k)&&(this._columnSelectMode?y[0]<=k[0]?x>=y[0]&&b>=y[1]&&x<k[0]&&b<=k[1]:x<y[0]&&b>=y[1]&&x>=k[0]&&b<=k[1]:b>y[1]&&b<k[1]||y[1]===k[1]&&b===y[1]&&x>=y[0]&&x<k[0]||y[1]<k[1]&&b===k[1]&&x<k[0]||y[1]<k[1]&&b===y[1]&&x>=y[0])}};function v(x,b,y){for(;x.length<y;)x=b+x;return x}l.DomRendererRowFactory=p=f([S(1,a.ICharacterJoinerService),S(2,w.IOptionsService),S(3,a.ICoreBrowserService),S(4,w.ICoreService),S(5,w.IDecorationService),S(6,a.IThemeService)],p)},2550:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=u.createElement("span"),S=u.createElement("span");S.style.fontWeight="bold";const d=u.createElement("span");d.style.fontStyle="italic";const m=u.createElement("span");m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[f,S,d,m],this._container.appendChild(f),this._container.appendChild(S),this._container.appendChild(d),this._container.appendChild(m),u.body.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(u,f,S,d){u===this._font&&f===this._fontSize&&S===this._weight&&d===this._weightBold||(this._font=u,this._fontSize=f,this._weight=S,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${S}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${S}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(u,f,S){let d=0;if(!f&&!S&&u.length===1&&(d=u.charCodeAt(0))<256)return this._flat[d]!==-9999?this._flat[d]:this._flat[d]=this._measure(u,0);let m=u;f&&(m+="B"),S&&(m+="I");let C=this._holey.get(m);if(C===void 0){let w=0;f&&(w|=1),S&&(w|=2),C=this._measure(u,w),this._holey.set(m,C)}return C}_measure(u,f){const S=this._measureElements[f];return S.textContent=u.repeat(32),S.offsetWidth/32}}},2223:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=u(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(_,l)=>{function u(f){return 57508<=f&&f<=57558}Object.defineProperty(l,"__esModule",{value:!0}),l.createRenderDimensions=l.excludeFromContrastRatioDemands=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},l.isPowerlineGlyph=u,l.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},l.excludeFromContrastRatioDemands=function(f){return u(f)||function(S){return 9472<=S&&S<=9631}(f)},l.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}}}}},456:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(u){this._bufferService=u,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 u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,f=this.selectionEnd;return!(!u||!f)&&(u[1]>f[1]||u[1]===f[1]&&u[0]>f[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const d=u(2585),m=u(8460),C=u(844);let w=l.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(a,o,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new g(a,o,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const a=this._measureStrategy.measure();a.width===this.width&&a.height===this.height||(this.width=a.width,this.height=a.height,this._onCharSizeChange.fire())}};l.CharSizeService=w=f([S(2,d.IOptionsService)],w);class g{constructor(o,s,c){this._document=o,this._parentElement=s,this._optionsService=c,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const o={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return o.width!==0&&o.height!==0&&(this._result.width=o.width/32,this._result.height=Math.ceil(o.height)),this._result}}},4269:function(_,l,u){var f=this&&this.__decorate||function(o,s,c,p){var v,x=arguments.length,b=x<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(o,s,c,p);else for(var y=o.length-1;y>=0;y--)(v=o[y])&&(b=(x<3?v(b):x>3?v(s,c,b):v(s,c))||b);return x>3&&b&&Object.defineProperty(s,c,b),b},S=this&&this.__param||function(o,s){return function(c,p){s(c,p,o)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const d=u(3734),m=u(643),C=u(511),w=u(2585);class g extends d.AttributeData{constructor(s,c,p){super(),this.content=0,this.combinedData="",this.fg=s.fg,this.bg=s.bg,this.combinedData=c,this._width=p}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(s){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=g;let a=l.CharacterJoinerService=class Gh{constructor(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(s){const c={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(c),c.id}deregister(s){for(let c=0;c<this._characterJoiners.length;c++)if(this._characterJoiners[c].id===s)return this._characterJoiners.splice(c,1),!0;return!1}getJoinedCharacters(s){if(this._characterJoiners.length===0)return[];const c=this._bufferService.buffer.lines.get(s);if(!c||c.length===0)return[];const p=[],v=c.translateToString(!0);let x=0,b=0,y=0,k=c.getFg(0),R=c.getBg(0);for(let O=0;O<c.getTrimmedLength();O++)if(c.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==k||this._workCell.bg!==R){if(O-x>1){const T=this._getJoinedRanges(v,y,b,c,x);for(let B=0;B<T.length;B++)p.push(T[B])}x=O,y=b,k=this._workCell.fg,R=this._workCell.bg}b+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const O=this._getJoinedRanges(v,y,b,c,x);for(let T=0;T<O.length;T++)p.push(O[T])}return p}_getJoinedRanges(s,c,p,v,x){const b=s.substring(c,p);let y=[];try{y=this._characterJoiners[0].handler(b)}catch(k){console.error(k)}for(let k=1;k<this._characterJoiners.length;k++)try{const R=this._characterJoiners[k].handler(b);for(let O=0;O<R.length;O++)Gh._mergeRanges(y,R[O])}catch(R){console.error(R)}return this._stringRangesToCellRanges(y,v,x),y}_stringRangesToCellRanges(s,c,p){let v=0,x=!1,b=0,y=s[v];if(y){for(let k=p;k<this._bufferService.cols;k++){const R=c.getWidth(k),O=c.getString(k).length||m.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!x&&y[0]<=b&&(y[0]=k,x=!0),y[1]<=b){if(y[1]=k,y=s[++v],!y)break;y[0]<=b?(y[0]=k,x=!0):x=!1}b+=O}}y&&(y[1]=this._bufferService.cols)}}static _mergeRanges(s,c){let p=!1;for(let v=0;v<s.length;v++){const x=s[v];if(p){if(c[1]<=x[0])return s[v-1][1]=c[1],s;if(c[1]<=x[1])return s[v-1][1]=Math.max(c[1],x[1]),s.splice(v,1),s;s.splice(v,1),v--}else{if(c[1]<=x[0])return s.splice(v,0,c),s;if(c[1]<=x[1])return x[0]=Math.min(c[0],x[0]),s;c[0]<x[1]&&(x[0]=Math.min(c[0],x[0]),p=!0)}}return p?s[s.length-1][1]=c[1]:s.push(c),s}};l.CharacterJoinerService=a=f([S(0,w.IBufferService)],a)},5114:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0,l.CoreBrowserService=class{constructor(u,f){this._textarea=u,this.window=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}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}}},8934:function(_,l,u){var f=this&&this.__decorate||function(w,g,a,o){var s,c=arguments.length,p=c<3?g:o===null?o=Object.getOwnPropertyDescriptor(g,a):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(w,g,a,o);else for(var v=w.length-1;v>=0;v--)(s=w[v])&&(p=(c<3?s(p):c>3?s(g,a,p):s(g,a))||p);return c>3&&p&&Object.defineProperty(g,a,p),p},S=this&&this.__param||function(w,g){return function(a,o){g(a,o,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const d=u(4725),m=u(9806);let C=l.MouseService=class{constructor(w,g){this._renderService=w,this._charSizeService=g}getCoords(w,g,a,o,s){return(0,m.getCoords)(window,w,g,a,o,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(w,g){const a=(0,m.getCoordsRelativeToElement)(window,w,g);if(this._charSizeService.hasValidSize)return a[0]=Math.min(Math.max(a[0],0),this._renderService.dimensions.css.canvas.width-1),a[1]=Math.min(Math.max(a[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(a[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(a[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(a[0]),y:Math.floor(a[1])}}};l.MouseService=C=f([S(0,d.IRenderService),S(1,d.ICharSizeService)],C)},3230:function(_,l,u){var f=this&&this.__decorate||function(p,v,x,b){var y,k=arguments.length,R=k<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,v,x,b);else for(var O=p.length-1;O>=0;O--)(y=p[O])&&(R=(k<3?y(R):k>3?y(v,x,R):y(v,x))||R);return k>3&&R&&Object.defineProperty(v,x,R),R},S=this&&this.__param||function(p,v){return function(x,b){v(x,b,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const d=u(3656),m=u(6193),C=u(5596),w=u(4725),g=u(8460),a=u(844),o=u(7226),s=u(2585);let c=l.RenderService=class extends a.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,v,x,b,y,k,R,O){if(super(),this._rowCount=p,this._charSizeService=b,this._renderer=this.register(new a.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(R.window,(T,B)=>this._renderRows(T,B)),this.register(this._renderDebouncer),this._screenDprMonitor=new C.ScreenDprMonitor(R.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(k.onResize(()=>this._fullRefresh())),this.register(k.buffers.onBufferActivate(()=>{var T;return(T=this._renderer.value)===null||T===void 0?void 0:T.clear()})),this.register(x.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(y.onDecorationRegistered(()=>this._fullRefresh())),this.register(y.onDecorationRemoved(()=>this._fullRefresh())),this.register(x.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(k.cols,k.rows),this._fullRefresh()})),this.register(x.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(k.buffer.y,k.buffer.y,!0))),this.register((0,d.addDisposableDomListener)(R.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(O.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in R.window){const T=new R.window.IntersectionObserver(B=>this._handleIntersectionChange(B[B.length-1]),{threshold:0});T.observe(v),this.register({dispose:()=>T.disconnect()})}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,v,x=!1){this._isPaused?this._needsFullRefresh=!0:(x||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,v,this._rowCount))}_renderRows(p,v){this._renderer.value&&(p=Math.min(p,this._rowCount-1),v=Math.min(v,this._rowCount-1),this._renderer.value.renderRows(p,v),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:v}),this._onRender.fire({start:p,end:v}),this._isNextRenderRedrawOnly=!0)}resize(p,v){this._rowCount=v,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(p){this._renderer.value=p,this._renderer.value.onRequestRedraw(v=>this.refreshRows(v.start,v.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,v;this._renderer.value&&((v=(p=this._renderer.value).clearTextureAtlas)===null||v===void 0||v.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,v){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(p,v)):this._renderer.value.handleResize(p,v),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)===null||p===void 0||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)===null||p===void 0||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)===null||p===void 0||p.handleFocus()}handleSelectionChanged(p,v,x){var b;this._selectionState.start=p,this._selectionState.end=v,this._selectionState.columnSelectMode=x,(b=this._renderer.value)===null||b===void 0||b.handleSelectionChanged(p,v,x)}handleCursorMove(){var p;(p=this._renderer.value)===null||p===void 0||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)===null||p===void 0||p.clear()}};l.RenderService=c=f([S(2,s.IOptionsService),S(3,w.ICharSizeService),S(4,s.IDecorationService),S(5,s.IBufferService),S(6,w.ICoreBrowserService),S(7,w.IThemeService)],c)},9312:function(_,l,u){var f=this&&this.__decorate||function(y,k,R,O){var T,B=arguments.length,z=B<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,R):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(y,k,R,O);else for(var I=y.length-1;I>=0;I--)(T=y[I])&&(z=(B<3?T(z):B>3?T(k,R,z):T(k,R))||z);return B>3&&z&&Object.defineProperty(k,R,z),z},S=this&&this.__param||function(y,k){return function(R,O){k(R,O,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const d=u(9806),m=u(9504),C=u(456),w=u(4725),g=u(8460),a=u(844),o=u(6114),s=u(4841),c=u(511),p=u(2585),v=" ",x=new RegExp(v,"g");let b=l.SelectionService=class extends a.Disposable{constructor(y,k,R,O,T,B,z,I,j){super(),this._element=y,this._screenElement=k,this._linkifier=R,this._bufferService=O,this._coreService=T,this._mouseService=B,this._optionsService=z,this._renderService=I,this._coreBrowserService=j,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new c.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,a.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 y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!y||!k||y[0]===k[0]&&y[1]===k[1])}get selectionText(){const y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;if(!y||!k)return"";const R=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(y[0]===k[0])return"";const T=y[0]<k[0]?y[0]:k[0],B=y[0]<k[0]?k[0]:y[0];for(let z=y[1];z<=k[1];z++){const I=R.translateBufferLineToString(z,!0,T,B);O.push(I)}}else{const T=y[1]===k[1]?k[0]:void 0;O.push(R.translateBufferLineToString(y[1],!0,y[0],T));for(let B=y[1]+1;B<=k[1]-1;B++){const z=R.lines.get(B),I=R.translateBufferLineToString(B,!0);z!=null&&z.isWrapped?O[O.length-1]+=I:O.push(I)}if(y[1]!==k[1]){const B=R.lines.get(k[1]),z=R.translateBufferLineToString(k[1],!0,0,k[0]);B&&B.isWrapped?O[O.length-1]+=z:O.push(z)}}return O.map(T=>T.replace(x," ")).join(o.isWindows?`\r
|
|
44
|
+
WARNING: This link could potentially be dangerous`)){const o=window.open();if(o){try{o.opener=null}catch{}o.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=C=f([S(0,m.IBufferService),S(1,m.IOptionsService),S(2,m.IOscLinkService)],C)},6193:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(u,f){this._parentWindow=u,this._renderCallback=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(u,f,S){this._rowCount=S,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._parentWindow.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 u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},5596:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ScreenDprMonitor=void 0;const f=u(844);class S extends f.Disposable{constructor(m){super(),this._parentWindow=m,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,f.toDisposable)(()=>{this.clearListener()}))}setListener(m){this._listener&&this.clearListener(),this._listener=m,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var m;this._outerListener&&((m=this._resolutionMediaMatchList)===null||m===void 0||m.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}l.ScreenDprMonitor=S},3236:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=u(3614),S=u(3656),d=u(6465),m=u(9042),C=u(3730),w=u(1680),g=u(3107),a=u(5744),o=u(2950),s=u(1296),c=u(428),p=u(4269),v=u(5114),x=u(8934),b=u(3230),y=u(9312),k=u(4725),R=u(6731),O=u(8055),T=u(8969),B=u(8460),z=u(844),I=u(6114),j=u(8437),$=u(2584),E=u(7399),A=u(5941),P=u(9074),M=u(2585),H=u(5435),K=u(4567),X=typeof window<"u"?window.document:null;class q extends T.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(D={}){super(D),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.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.linkifier2=this.register(this._instantiationService.createInstance(d.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(M.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((F,W)=>this.refresh(F,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(F=>this._reportWindowsOptions(F))),this.register(this._inputHandler.onColor(F=>this._handleColorEvent(F))),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(F=>this._afterResize(F.cols,F.rows))),this.register((0,z.toDisposable)(()=>{var F,W;this._customKeyEventHandler=void 0,(W=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||W===void 0||W.removeChild(this.element)}))}_handleColorEvent(D){if(this._themeService)for(const F of D){let W,U="";switch(F.index){case 256:W="foreground",U="10";break;case 257:W="background",U="11";break;case 258:W="cursor",U="12";break;default:W="ansi",U="4;"+F.index}switch(F.type){case 0:const re=O.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${U};${(0,A.toRgbString)(re)}${$.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(Q=>Q.ansi[F.index]=O.rgba.toColor(...F.color));else{const Q=W;this._themeService.modifyColors(ae=>ae[Q]=O.rgba.toColor(...F.color))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(D){D?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(D){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.updateCursorStyle(D),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var D;return(D=this.textarea)===null||D===void 0?void 0:D.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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 D=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(D);if(!F)return;const W=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,re=F.getWidth(W),Q=this._renderService.dimensions.css.cell.width*re,ae=this.buffer.y*this._renderService.dimensions.css.cell.height,we=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=we+"px",this.textarea.style.top=ae+"px",this.textarea.style.width=Q+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,S.addDisposableDomListener)(this.element,"copy",F=>{this.hasSelection()&&(0,f.copyHandler)(F,this._selectionService)}));const D=F=>(0,f.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,S.addDisposableDomListener)(this.textarea,"paste",D)),this.register((0,S.addDisposableDomListener)(this.element,"paste",D)),I.isFirefox?this.register((0,S.addDisposableDomListener)(this.element,"mousedown",F=>{F.button===2&&(0,f.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,S.addDisposableDomListener)(this.element,"contextmenu",F=>{(0,f.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),I.isLinux&&this.register((0,S.addDisposableDomListener)(this.element,"auxclick",F=>{F.button===1&&(0,f.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,S.addDisposableDomListener)(this.textarea,"keyup",D=>this._keyUp(D),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"keydown",D=>this._keyDown(D),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"keypress",D=>this._keyPress(D),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionupdate",D=>this._compositionHelper.compositionupdate(D))),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,S.addDisposableDomListener)(this.textarea,"input",D=>this._inputEvent(D),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(D){var F;if(!D)throw new Error("Terminal requires a parent element.");D.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=D.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),D.appendChild(this.element);const W=X.createDocumentFragment();this._viewportElement=X.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.appendChild(this._viewportElement),this._viewportScrollArea=X.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=X.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=X.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),W.appendChild(this.screenElement),this.textarea=X.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),I.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._instantiationService.createInstance(v.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(k.ICoreBrowserService,this._coreBrowserService),this.register((0,S.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,S.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(c.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(k.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(k.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(p.CharacterJoinerService),this._instantiationService.setService(k.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(b.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(k.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=X.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(k.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.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(y.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(k.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,S.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(g.BufferDecorationRenderer,this.screenElement)),this.register((0,S.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),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(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(a.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(s.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const D=this,F=this.element;function W(Q){const ae=D._mouseService.getMouseReportCoords(Q,D.screenElement);if(!ae)return!1;let we,fe;switch(Q.overrideType||Q.type){case"mousemove":fe=32,Q.buttons===void 0?(we=3,Q.button!==void 0&&(we=Q.button<3?Q.button:3)):we=1&Q.buttons?0:4&Q.buttons?1:2&Q.buttons?2:3;break;case"mouseup":fe=0,we=Q.button<3?Q.button:3;break;case"mousedown":fe=1,we=Q.button<3?Q.button:3;break;case"wheel":if(D.viewport.getLinesScrolled(Q)===0)return!1;fe=Q.deltaY<0?0:1,we=4;break;default:return!1}return!(fe===void 0||we===void 0||we>4)&&D.coreMouseService.triggerMouseEvent({col:ae.col,row:ae.row,x:ae.x,y:ae.y,button:we,action:fe,ctrl:Q.ctrlKey,alt:Q.altKey,shift:Q.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},re={mouseup:Q=>(W(Q),Q.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(Q)),wheel:Q=>(W(Q),this.cancel(Q,!0)),mousedrag:Q=>{Q.buttons&&W(Q)},mousemove:Q=>{Q.buttons||W(Q)}};this.register(this.coreMouseService.onProtocolChange(Q=>{Q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Q)),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&Q?U.mousemove||(F.addEventListener("mousemove",re.mousemove),U.mousemove=re.mousemove):(F.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&Q?U.wheel||(F.addEventListener("wheel",re.wheel,{passive:!1}),U.wheel=re.wheel):(F.removeEventListener("wheel",U.wheel),U.wheel=null),2&Q?U.mouseup||(F.addEventListener("mouseup",re.mouseup),U.mouseup=re.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),F.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&Q?U.mousedrag||(U.mousedrag=re.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,S.addDisposableDomListener)(F,"mousedown",Q=>{if(Q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Q))return W(Q),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(Q)})),this.register((0,S.addDisposableDomListener)(F,"wheel",Q=>{if(!U.wheel){if(!this.buffer.hasScrollback){const ae=this.viewport.getLinesScrolled(Q);if(ae===0)return;const we=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Q.deltaY<0?"A":"B");let fe="";for(let ut=0;ut<Math.abs(ae);ut++)fe+=we;return this.coreService.triggerDataEvent(fe,!0),this.cancel(Q,!0)}return this.viewport.handleWheel(Q)?this.cancel(Q):void 0}},{passive:!1})),this.register((0,S.addDisposableDomListener)(F,"touchstart",Q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Q),this.cancel(Q)},{passive:!0})),this.register((0,S.addDisposableDomListener)(F,"touchmove",Q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Q)?void 0:this.cancel(Q)},{passive:!1}))}refresh(D,F){var W;(W=this._renderService)===null||W===void 0||W.refreshRows(D,F)}updateCursorStyle(D){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(D)?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(D,F,W=0){var U;W===1?(super.scrollLines(D,F,W),this.refresh(0,this.rows-1)):(U=this.viewport)===null||U===void 0||U.scrollLines(D)}paste(D){(0,f.paste)(D,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(D){this._customKeyEventHandler=D}registerLinkProvider(D){return this.linkifier2.registerLinkProvider(D)}registerCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(D);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(D){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(D)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(D){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+D)}registerDecoration(D){return this._decorationService.registerDecoration(D)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(D,F,W){this._selectionService.setSelection(D,F,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var D;(D=this._selectionService)===null||D===void 0||D.clearSelection()}selectAll(){var D;(D=this._selectionService)===null||D===void 0||D.selectAll()}selectLines(D,F){var W;(W=this._selectionService)===null||W===void 0||W.selectLines(D,F)}_keyDown(D){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&D.altKey;if(!F&&!this._compositionHelper.keydown(D))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||D.key!=="Dead"&&D.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const W=(0,E.evaluateKeyboardEvent)(D,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(D),W.type===3||W.type===2){const U=this.rows-1;return this.scrollLines(W.type===2?-U:U),this.cancel(D,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,D)||(W.cancel&&this.cancel(D,!0),!W.key||!!(D.key&&!D.ctrlKey&&!D.altKey&&!D.metaKey&&D.key.length===1&&D.key.charCodeAt(0)>=65&&D.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==$.C0.ETX&&W.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||D.altKey||D.ctrlKey?this.cancel(D,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(D,F){const W=D.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||D.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||D.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?W:W&&(!F.keyCode||F.keyCode>47)}_keyUp(D){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1||(function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18}(D)||this.focus(),this.updateCursorStyle(D),this._keyPressHandled=!1)}_keyPress(D){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(D)===!1)return!1;if(this.cancel(D),D.charCode)F=D.charCode;else if(D.which===null||D.which===void 0)F=D.keyCode;else{if(D.which===0||D.charCode===0)return!1;F=D.which}return!(!F||(D.altKey||D.ctrlKey||D.metaKey)&&!this._isThirdLevelShift(this.browser,D)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:D}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(D){if(D.data&&D.inputType==="insertText"&&(!D.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=D.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(D),!0}return!1}resize(D,F){D!==this.cols||F!==this.rows?super.resize(D,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(D,F){var W,U;(W=this._charSizeService)===null||W===void 0||W.measure(),(U=this.viewport)===null||U===void 0||U.syncScrollArea(!0)}clear(){var D;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 F=1;F<this.rows;F++)this.buffer.lines.push(this.buffer.getBlankLine(j.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(D=this.viewport)===null||D===void 0||D.reset(),this.refresh(0,this.rows-1)}}reset(){var D,F;this.options.rows=this.rows,this.options.cols=this.cols;const W=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)===null||D===void 0||D.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=W,this.refresh(0,this.rows-1)}clearTextureAtlas(){var D;(D=this._renderService)===null||D===void 0||D.clearTextureAtlas()}_reportFocus(){var D;!((D=this.element)===null||D===void 0)&&D.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(D){if(this._renderService)switch(D){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${W};${F}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const U=this._renderService.dimensions.css.cell.width.toFixed(0),re=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${re};${U}t`)}}cancel(D,F){if(this.options.cancelEvents||F)return D.preventDefault(),D.stopPropagation(),!1}}l.Terminal=q},9924:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(u,f=1e3){this._renderCallback=u,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,f,S){this._rowCount=S,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=d-this._lastRefreshMs,C=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f)}}},1680:function(_,l,u){var f=this&&this.__decorate||function(o,s,c,p){var v,x=arguments.length,b=x<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(o,s,c,p);else for(var y=o.length-1;y>=0;y--)(v=o[y])&&(b=(x<3?v(b):x>3?v(s,c,b):v(s,c))||b);return x>3&&b&&Object.defineProperty(s,c,b),b},S=this&&this.__param||function(o,s){return function(c,p){s(c,p,o)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const d=u(3656),m=u(4725),C=u(8460),w=u(844),g=u(2585);let a=l.Viewport=class extends w.Disposable{constructor(o,s,c,p,v,x,b,y){super(),this._viewportElement=o,this._scrollArea=s,this._bufferService=c,this._optionsService=p,this._charSizeService=v,this._renderService=x,this._coreBrowserService=b,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 C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(k=>this._renderDimensions=k)),this._handleThemeChange(y.colors),this.register(y.onChangeColors(k=>this._handleThemeChange(k))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(o){this._viewportElement.style.backgroundColor=o.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(o){if(o)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._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const o=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==o&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=o),this._refreshAnimationFrame=null}syncScrollArea(o=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(o);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(o)}_handleScroll(o){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 s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const o=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(o*(this._smoothScrollState.target-this._smoothScrollState.origin)),o<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(o,s){const c=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&c<this._lastRecordedBufferHeight)||(o.cancelable&&o.preventDefault(),!1)}handleWheel(o){const s=this._getPixelsScrolled(o);return s!==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+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(o,s))}scrollLines(o){if(o!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const s=o*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:o,suppressScrollEvent:!1})}_getPixelsScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let s=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getBufferElements(o,s){var c;let p,v="";const x=[],b=s??this._bufferService.buffer.lines.length,y=this._bufferService.buffer.lines;for(let k=o;k<b;k++){const R=y.get(k);if(!R)continue;const O=(c=y.get(k+1))===null||c===void 0?void 0:c.isWrapped;if(v+=R.translateToString(!O),!O||k===y.length-1){const T=document.createElement("div");T.textContent=v,x.push(T),v.length>0&&(p=T),v=""}}return{bufferElements:x,cursorElement:p}}getLinesScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let s=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(o,s){const c=this._optionsService.rawOptions.fastScrollModifier;return c==="alt"&&s.altKey||c==="ctrl"&&s.ctrlKey||c==="shift"&&s.shiftKey?o*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:o*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(o){this._lastTouchY=o.touches[0].pageY}handleTouchMove(o){const s=this._lastTouchY-o.touches[0].pageY;return this._lastTouchY=o.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(o,s))}};l.Viewport=a=f([S(2,g.IBufferService),S(3,g.IOptionsService),S(4,m.ICharSizeService),S(5,m.IRenderService),S(6,m.ICoreBrowserService),S(7,m.IThemeService)],a)},3107:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const d=u(3656),m=u(4725),C=u(844),w=u(2585);let g=l.BufferDecorationRenderer=class extends C.Disposable{constructor(a,o,s,c){super(),this._screenElement=a,this._bufferService=o,this._decorationService=s,this._renderService=c,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((0,d.addDisposableDomListener)(window,"resize",()=>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(p=>this._removeDecoration(p))),this.register((0,C.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 a of this._decorationService.decorations)this._renderDecoration(a);this._dimensionsChanged=!1}_renderDecoration(a){this._refreshStyle(a),this._dimensionsChanged&&this._refreshXPosition(a)}_createElement(a){var o,s;const c=document.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",((o=a==null?void 0:a.options)===null||o===void 0?void 0:o.layer)==="top"),c.style.width=`${Math.round((a.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(a.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(a.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const p=(s=a.options.x)!==null&&s!==void 0?s:0;return p&&p>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(a,c),c}_refreshStyle(a){const o=a.marker.line-this._bufferService.buffers.active.ydisp;if(o<0||o>=this._bufferService.rows)a.element&&(a.element.style.display="none",a.onRenderEmitter.fire(a.element));else{let s=this._decorationElements.get(a);s||(s=this._createElement(a),a.element=s,this._decorationElements.set(a,s),this._container.appendChild(s),a.onDispose(()=>{this._decorationElements.delete(a),s.remove()})),s.style.top=o*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",a.onRenderEmitter.fire(s)}}_refreshXPosition(a,o=a.element){var s;if(!o)return;const c=(s=a.options.x)!==null&&s!==void 0?s:0;(a.options.anchor||"left")==="right"?o.style.right=c?c*this._renderService.dimensions.css.cell.width+"px":"":o.style.left=c?c*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(a){var o;(o=this._decorationElements.get(a))===null||o===void 0||o.remove(),this._decorationElements.delete(a),a.dispose()}};l.BufferDecorationRenderer=g=f([S(1,w.IBufferService),S(2,w.IDecorationService),S(3,m.IRenderService)],g)},5871:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.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(u){if(u.options.overviewRulerOptions){for(const f of this._zones)if(f.color===u.options.overviewRulerOptions.color&&f.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,u.marker.line))return;if(this._lineAdjacentToZone(f,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(f,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,f){return f>=u.startBufferLine&&f<=u.endBufferLine}_lineAdjacentToZone(u,f,S){return f>=u.startBufferLine-this._linePadding[S||"full"]&&f<=u.endBufferLine+this._linePadding[S||"full"]}_addLineToZone(u,f){u.startBufferLine=Math.min(u.startBufferLine,f),u.endBufferLine=Math.max(u.endBufferLine,f)}}},5744:function(_,l,u){var f=this&&this.__decorate||function(p,v,x,b){var y,k=arguments.length,R=k<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,v,x,b);else for(var O=p.length-1;O>=0;O--)(y=p[O])&&(R=(k<3?y(R):k>3?y(v,x,R):y(v,x))||R);return k>3&&R&&Object.defineProperty(v,x,R),R},S=this&&this.__param||function(p,v){return function(x,b){v(x,b,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const d=u(5871),m=u(3656),C=u(4725),w=u(844),g=u(2585),a={full:0,left:0,center:0,right:0},o={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let c=l.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,v,x,b,y,k,R){var O;super(),this._viewportElement=p,this._screenElement=v,this._bufferService=x,this._decorationService=b,this._renderService=y,this._optionsService=k,this._coreBrowseService=R,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(O=this._viewportElement.parentElement)===null||O===void 0||O.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)(()=>{var B;(B=this._canvas)===null||B===void 0||B.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((0,m.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const p=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);o.full=this._canvas.width,o.left=p,o.center=v,o.right=p,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=o.left,s.right=o.left+o.center}_refreshDrawHeightConstants(){a.full=Math.round(2*this._coreBrowseService.dpr);const p=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowseService.dpr);a.left=v,a.center=v,a.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*a.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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 v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;const p=this._colorZoneStore.zones;for(const v of p)v.position!=="full"&&this._renderColorZone(v);for(const v of p)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(s[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-a[p.position||"full"]/2),o[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+a[p.position||"full"]))}_queueRefresh(p,v){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};l.OverviewRulerRenderer=c=f([S(2,g.IBufferService),S(3,g.IDecorationService),S(4,C.IRenderService),S(5,g.IOptionsService),S(6,C.ICoreBrowserService)],c)},2950:function(_,l,u){var f=this&&this.__decorate||function(g,a,o,s){var c,p=arguments.length,v=p<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,o):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(g,a,o,s);else for(var x=g.length-1;x>=0;x--)(c=g[x])&&(v=(p<3?c(v):p>3?c(a,o,v):c(a,o))||v);return p>3&&v&&Object.defineProperty(a,o,v),v},S=this&&this.__param||function(g,a){return function(o,s){a(o,s,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const d=u(4725),m=u(2585),C=u(2584);let w=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(g,a,o,s,c,p){this._textarea=g,this._compositionView=a,this._bufferService=o,this._optionsService=s,this._coreService=c,this._renderService=p,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(g){this._compositionView.textContent=g.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(g){if(this._isComposing||this._isSendingComposition){if(g.keyCode===229||g.keyCode===16||g.keyCode===17||g.keyCode===18)return!1;this._finalizeComposition(!1)}return g.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(g){if(this._compositionView.classList.remove("active"),this._isComposing=!1,g){const a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let o;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,o=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),o.length>0&&this._coreService.triggerDataEvent(o,!0)}},0)}else{this._isSendingComposition=!1;const a=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(a,!0)}}_handleAnyTextareaChanges(){const g=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const a=this._textarea.value,o=a.replace(g,"");this._dataAlreadySent=o,a.length>g.length?this._coreService.triggerDataEvent(o,!0):a.length<g.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):a.length===g.length&&a!==g&&this._coreService.triggerDataEvent(a,!0)}},0)}updateCompositionElements(g){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),o=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,c=a*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=o+"px",this._compositionView.style.lineHeight=o+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const p=this._compositionView.getBoundingClientRect();this._textarea.style.left=c+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(p.width,1)+"px",this._textarea.style.height=Math.max(p.height,1)+"px",this._textarea.style.lineHeight=p.height+"px"}g||setTimeout(()=>this.updateCompositionElements(!0),0)}}};l.CompositionHelper=w=f([S(2,m.IBufferService),S(3,m.IOptionsService),S(4,m.ICoreService),S(5,d.IRenderService)],w)},9806:(_,l)=>{function u(f,S,d){const m=d.getBoundingClientRect(),C=f.getComputedStyle(d),w=parseInt(C.getPropertyValue("padding-left")),g=parseInt(C.getPropertyValue("padding-top"));return[S.clientX-m.left-w,S.clientY-m.top-g]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=u,l.getCoords=function(f,S,d,m,C,w,g,a,o){if(!w)return;const s=u(f,S,d);return s?(s[0]=Math.ceil((s[0]+(o?g/2:0))/g),s[1]=Math.ceil(s[1]/a),s[0]=Math.min(Math.max(s[0],1),m+(o?1:0)),s[1]=Math.min(Math.max(s[1],1),C),s):void 0}},9504:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=u(2584);function S(a,o,s,c){const p=a-d(a,s),v=o-d(o,s),x=Math.abs(p-v)-function(b,y,k){let R=0;const O=b-d(b,k),T=y-d(y,k);for(let B=0;B<Math.abs(O-T);B++){const z=m(b,y)==="A"?-1:1,I=k.buffer.lines.get(O+z*B);I!=null&&I.isWrapped&&R++}return R}(a,o,s);return g(x,w(m(a,o),c))}function d(a,o){let s=0,c=o.buffer.lines.get(a),p=c==null?void 0:c.isWrapped;for(;p&&a>=0&&a<o.rows;)s++,c=o.buffer.lines.get(--a),p=c==null?void 0:c.isWrapped;return s}function m(a,o){return a>o?"A":"B"}function C(a,o,s,c,p,v){let x=a,b=o,y="";for(;x!==s||b!==c;)x+=p?1:-1,p&&x>v.cols-1?(y+=v.buffer.translateBufferLineToString(b,!1,a,x),x=0,a=0,b++):!p&&x<0&&(y+=v.buffer.translateBufferLineToString(b,!1,0,a+1),x=v.cols-1,a=x,b--);return y+v.buffer.translateBufferLineToString(b,!1,a,x)}function w(a,o){const s=o?"O":"[";return f.C0.ESC+s+a}function g(a,o){a=Math.floor(a);let s="";for(let c=0;c<a;c++)s+=o;return s}l.moveToCellSequence=function(a,o,s,c){const p=s.buffer.x,v=s.buffer.y;if(!s.buffer.hasScrollback)return function(y,k,R,O,T,B){return S(k,O,T,B).length===0?"":g(C(y,k,y,k-d(k,T),!1,T).length,w("D",B))}(p,v,0,o,s,c)+S(v,o,s,c)+function(y,k,R,O,T,B){let z;z=S(k,O,T,B).length>0?O-d(O,T):k;const I=O,j=function($,E,A,P,M,H){let K;return K=S(A,P,M,H).length>0?P-d(P,M):E,$<A&&K<=P||$>=A&&K<P?"C":"D"}(y,k,R,O,T,B);return g(C(y,z,R,I,j==="C",T).length,w(j,B))}(p,v,a,o,s,c);let x;if(v===o)return x=p>a?"D":"C",g(Math.abs(p-a),w(x,c));x=v>o?"D":"C";const b=Math.abs(v-o);return g(function(y,k){return k.cols-y}(v>o?a:p,s)+(b-1)*s.cols+1+((v>o?p:a)-1),w(x,c))}},1296:function(_,l,u){var f=this&&this.__decorate||function(T,B,z,I){var j,$=arguments.length,E=$<3?B:I===null?I=Object.getOwnPropertyDescriptor(B,z):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(T,B,z,I);else for(var A=T.length-1;A>=0;A--)(j=T[A])&&(E=($<3?j(E):$>3?j(B,z,E):j(B,z))||E);return $>3&&E&&Object.defineProperty(B,z,E),E},S=this&&this.__param||function(T,B){return function(z,I){B(z,I,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const d=u(3787),m=u(2550),C=u(2223),w=u(6171),g=u(4725),a=u(8055),o=u(8460),s=u(844),c=u(2585),p="xterm-dom-renderer-owner-",v="xterm-rows",x="xterm-fg-",b="xterm-bg-",y="xterm-focus",k="xterm-selection";let R=1,O=l.DomRenderer=class extends s.Disposable{constructor(T,B,z,I,j,$,E,A,P,M){super(),this._element=T,this._screenElement=B,this._viewportElement=z,this._linkifier2=I,this._charSizeService=$,this._optionsService=E,this._bufferService=A,this._coreBrowserService=P,this._themeService=M,this._terminalClass=R++,this._rowElements=[],this.onRequestRedraw=this.register(new o.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(v),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(k),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(H=>this._injectCss(H))),this._injectCss(this._themeService.colors),this._rowFactory=j.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(H=>this._handleLinkHover(H))),this.register(this._linkifier2.onHideLinkUnderline(H=>this._handleLinkLeave(H))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new m.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const T=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*T,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*T),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/T),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/T),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 z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const B=`${this._terminalSelector} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=B,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(T){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let B=`${this._terminalSelector} .${v} { color: ${T.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;B+=`${this._terminalSelector} .${v} .xterm-dim { color: ${a.color.multiplyOpacity(T.foreground,.5).css};}`,B+=`${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;}`,B+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",B+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${T.cursor.css}; color: ${T.cursorAccent.css}; } 50% { background-color: inherit; color: ${T.cursor.css}; }}`,B+=`${this._terminalSelector} .${v}.${y} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${v}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block { background-color: ${T.cursor.css}; color: ${T.cursorAccent.css};}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${T.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${T.cursor.css} inset;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${T.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,B+=`${this._terminalSelector} .${k} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${k} div { position: absolute; background-color: ${T.selectionBackgroundOpaque.css};}${this._terminalSelector} .${k} div { position: absolute; background-color: ${T.selectionInactiveBackgroundOpaque.css};}`;for(const[z,I]of T.ansi.entries())B+=`${this._terminalSelector} .${x}${z} { color: ${I.css}; }${this._terminalSelector} .${x}${z}.xterm-dim { color: ${a.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${b}${z} { background-color: ${I.css}; }`;B+=`${this._terminalSelector} .${x}${C.INVERTED_DEFAULT_COLOR} { color: ${a.color.opaque(T.background).css}; }${this._terminalSelector} .${x}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${a.color.multiplyOpacity(a.color.opaque(T.background),.5).css}; }${this._terminalSelector} .${b}${C.INVERTED_DEFAULT_COLOR} { background-color: ${T.foreground.css}; }`,this._themeStyleElement.textContent=B}_setDefaultSpacing(){const T=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${T}px`,this._rowFactory.defaultSpacing=T}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(T,B){for(let z=this._rowElements.length;z<=B;z++){const I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>B;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(T,B){this._refreshRowElements(T,B),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(T,B,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(T,B,z),this.renderRows(0,this._bufferService.rows-1),!T||!B)return;const I=T[1]-this._bufferService.buffer.ydisp,j=B[1]-this._bufferService.buffer.ydisp,$=Math.max(I,0),E=Math.min(j,this._bufferService.rows-1);if($>=this._bufferService.rows||E<0)return;const A=document.createDocumentFragment();if(z){const P=T[0]>B[0];A.appendChild(this._createSelectionElement($,P?B[0]:T[0],P?T[0]:B[0],E-$+1))}else{const P=I===$?T[0]:0,M=$===j?B[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement($,P,M));const H=E-$-1;if(A.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,H)),$!==E){const K=j===E?B[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement(E,0,K))}}this._selectionContainer.appendChild(A)}_createSelectionElement(T,B,z,I=1){const j=document.createElement("div");return j.style.height=I*this.dimensions.css.cell.height+"px",j.style.top=T*this.dimensions.css.cell.height+"px",j.style.left=B*this.dimensions.css.cell.width+"px",j.style.width=this.dimensions.css.cell.width*(z-B)+"px",j}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 T of this._rowElements)T.replaceChildren()}renderRows(T,B){const z=this._bufferService.buffer,I=z.ybase+z.y,j=Math.min(z.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,E=this._optionsService.rawOptions.cursorStyle,A=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=T;P<=B;P++){const M=P+z.ydisp,H=this._rowElements[P],K=z.lines.get(M);if(!H||!K)break;H.replaceChildren(...this._rowFactory.createRow(K,M,M===I,E,A,j,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(T){this._setCellUnderline(T.x1,T.x2,T.y1,T.y2,T.cols,!0)}_handleLinkLeave(T){this._setCellUnderline(T.x1,T.x2,T.y1,T.y2,T.cols,!1)}_setCellUnderline(T,B,z,I,j,$){z<0&&(T=0),I<0&&(B=0);const E=this._bufferService.rows-1;z=Math.max(Math.min(z,E),0),I=Math.max(Math.min(I,E),0),j=Math.min(j,this._bufferService.cols);const A=this._bufferService.buffer,P=A.ybase+A.y,M=Math.min(A.x,j-1),H=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let q=z;q<=I;++q){const se=q+A.ydisp,D=this._rowElements[q],F=A.lines.get(se);if(!D||!F)break;D.replaceChildren(...this._rowFactory.createRow(F,se,se===P,K,X,M,H,this.dimensions.css.cell.width,this._widthCache,$?q===z?T:0:-1,$?(q===I?B:j)-1:-1))}}};l.DomRenderer=O=f([S(4,c.IInstantiationService),S(5,g.ICharSizeService),S(6,c.IOptionsService),S(7,c.IBufferService),S(8,g.ICoreBrowserService),S(9,g.IThemeService)],O)},3787:function(_,l,u){var f=this&&this.__decorate||function(x,b,y,k){var R,O=arguments.length,T=O<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,b,y,k);else for(var B=x.length-1;B>=0;B--)(R=x[B])&&(T=(O<3?R(T):O>3?R(b,y,T):R(b,y))||T);return O>3&&T&&Object.defineProperty(b,y,T),T},S=this&&this.__param||function(x,b){return function(y,k){b(y,k,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const d=u(2223),m=u(643),C=u(511),w=u(2585),g=u(8055),a=u(4725),o=u(4269),s=u(6171),c=u(3734);let p=l.DomRendererRowFactory=class{constructor(x,b,y,k,R,O,T){this._document=x,this._characterJoinerService=b,this._optionsService=y,this._coreBrowserService=k,this._coreService=R,this._decorationService=O,this._themeService=T,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,b,y){this._selectionStart=x,this._selectionEnd=b,this._columnSelectMode=y}createRow(x,b,y,k,R,O,T,B,z,I,j){const $=[],E=this._characterJoinerService.getJoinedCharacters(b),A=this._themeService.colors;let P,M=x.getNoBgTrimmedLength();y&&M<O+1&&(M=O+1);let H=0,K="",X=0,q=0,se=0,D=!1,F=0,W=!1,U=0;const re=[],Q=I!==-1&&j!==-1;for(let ae=0;ae<M;ae++){x.loadCell(ae,this._workCell);let we=this._workCell.getWidth();if(we===0)continue;let fe=!1,ut=ae,ne=this._workCell;if(E.length>0&&ae===E[0][0]){fe=!0;const pe=E.shift();ne=new o.JoinedCellData(this._workCell,x.translateToString(!0,pe[0],pe[1]),pe[1]-pe[0]),ut=pe[1]-1,we=ne.getWidth()}const ht=this._isCellInSelection(ae,b),Xe=y&&ae===O,Ut=Q&&ae>=I&&ae<=j;let J=!1;this._decorationService.forEachDecorationAtCell(ae,b,void 0,pe=>{J=!0});let Y=ne.getChars()||m.WHITESPACE_CELL_CHAR;if(Y===" "&&(ne.isUnderline()||ne.isOverline())&&(Y=" "),U=we*B-z.get(Y,ne.isBold(),ne.isItalic()),P){if(H&&(ht&&W||!ht&&!W&&ne.bg===X)&&(ht&&W&&A.selectionForeground||ne.fg===q)&&ne.extended.ext===se&&Ut===D&&U===F&&!Xe&&!fe&&!J){K+=Y,H++;continue}H&&(P.textContent=K),P=this._document.createElement("span"),H=0,K=""}else P=this._document.createElement("span");if(X=ne.bg,q=ne.fg,se=ne.extended.ext,D=Ut,F=U,W=ht,fe&&O>=ae&&O<=ut&&(O=ae),!this._coreService.isCursorHidden&&Xe){if(re.push("xterm-cursor"),this._coreBrowserService.isFocused)T&&re.push("xterm-cursor-blink"),re.push(k==="bar"?"xterm-cursor-bar":k==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){case"outline":re.push("xterm-cursor-outline");break;case"block":re.push("xterm-cursor-block");break;case"bar":re.push("xterm-cursor-bar");break;case"underline":re.push("xterm-cursor-underline")}}if(ne.isBold()&&re.push("xterm-bold"),ne.isItalic()&&re.push("xterm-italic"),ne.isDim()&&re.push("xterm-dim"),K=ne.isInvisible()?m.WHITESPACE_CELL_CHAR:ne.getChars()||m.WHITESPACE_CELL_CHAR,ne.isUnderline()&&(re.push(`xterm-underline-${ne.extended.underlineStyle}`),K===" "&&(K=" "),!ne.isUnderlineColorDefault()))if(ne.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${c.AttributeData.toColorRGB(ne.getUnderlineColor()).join(",")})`;else{let pe=ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ne.isBold()&&pe<8&&(pe+=8),P.style.textDecorationColor=A.ansi[pe].css}ne.isOverline()&&(re.push("xterm-overline"),K===" "&&(K=" ")),ne.isStrikethrough()&&re.push("xterm-strikethrough"),Ut&&(P.style.textDecoration="underline");let te=ne.getFgColor(),ie=ne.getFgColorMode(),oe=ne.getBgColor(),ce=ne.getBgColorMode();const Be=!!ne.isInverse();if(Be){const pe=te;te=oe,oe=pe;const ni=ie;ie=ce,ce=ni}let me,Tt,We,At=!1;switch(this._decorationService.forEachDecorationAtCell(ae,b,void 0,pe=>{pe.options.layer!=="top"&&At||(pe.backgroundColorRGB&&(ce=50331648,oe=pe.backgroundColorRGB.rgba>>8&16777215,me=pe.backgroundColorRGB),pe.foregroundColorRGB&&(ie=50331648,te=pe.foregroundColorRGB.rgba>>8&16777215,Tt=pe.foregroundColorRGB),At=pe.options.layer==="top")}),!At&&ht&&(me=this._coreBrowserService.isFocused?A.selectionBackgroundOpaque:A.selectionInactiveBackgroundOpaque,oe=me.rgba>>8&16777215,ce=50331648,At=!0,A.selectionForeground&&(ie=50331648,te=A.selectionForeground.rgba>>8&16777215,Tt=A.selectionForeground)),At&&re.push("xterm-decoration-top"),ce){case 16777216:case 33554432:We=A.ansi[oe],re.push(`xterm-bg-${oe}`);break;case 50331648:We=g.rgba.toColor(oe>>16,oe>>8&255,255&oe),this._addStyle(P,`background-color:#${v((oe>>>0).toString(16),"0",6)}`);break;default:Be?(We=A.foreground,re.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):We=A.background}switch(me||ne.isDim()&&(me=g.color.multiplyOpacity(We,.5)),ie){case 16777216:case 33554432:ne.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(P,We,A.ansi[te],ne,me,void 0)||re.push(`xterm-fg-${te}`);break;case 50331648:const pe=g.rgba.toColor(te>>16&255,te>>8&255,255&te);this._applyMinimumContrast(P,We,pe,ne,me,Tt)||this._addStyle(P,`color:#${v(te.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,We,A.foreground,ne,me,void 0)||Be&&re.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}re.length&&(P.className=re.join(" "),re.length=0),Xe||fe||J?P.textContent=K:H++,U!==this.defaultSpacing&&(P.style.letterSpacing=`${U}px`),$.push(P),ae=ut}return P&&H&&(P.textContent=K),$}_applyMinimumContrast(x,b,y,k,R,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,s.excludeFromContrastRatioDemands)(k.getCode()))return!1;const T=this._getContrastCache(k);let B;if(R||O||(B=T.getColor(b.rgba,y.rgba)),B===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(k.isDim()?2:1);B=g.color.ensureContrastRatio(R||b,O||y,z),T.setColor((R||b).rgba,(O||y).rgba,B??null)}return!!B&&(this._addStyle(x,`color:${B.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,b){x.setAttribute("style",`${x.getAttribute("style")||""}${b};`)}_isCellInSelection(x,b){const y=this._selectionStart,k=this._selectionEnd;return!(!y||!k)&&(this._columnSelectMode?y[0]<=k[0]?x>=y[0]&&b>=y[1]&&x<k[0]&&b<=k[1]:x<y[0]&&b>=y[1]&&x>=k[0]&&b<=k[1]:b>y[1]&&b<k[1]||y[1]===k[1]&&b===y[1]&&x>=y[0]&&x<k[0]||y[1]<k[1]&&b===k[1]&&x<k[0]||y[1]<k[1]&&b===y[1]&&x>=y[0])}};function v(x,b,y){for(;x.length<y;)x=b+x;return x}l.DomRendererRowFactory=p=f([S(1,a.ICharacterJoinerService),S(2,w.IOptionsService),S(3,a.ICoreBrowserService),S(4,w.ICoreService),S(5,w.IDecorationService),S(6,a.IThemeService)],p)},2550:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=u.createElement("span"),S=u.createElement("span");S.style.fontWeight="bold";const d=u.createElement("span");d.style.fontStyle="italic";const m=u.createElement("span");m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[f,S,d,m],this._container.appendChild(f),this._container.appendChild(S),this._container.appendChild(d),this._container.appendChild(m),u.body.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(u,f,S,d){u===this._font&&f===this._fontSize&&S===this._weight&&d===this._weightBold||(this._font=u,this._fontSize=f,this._weight=S,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${S}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${S}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(u,f,S){let d=0;if(!f&&!S&&u.length===1&&(d=u.charCodeAt(0))<256)return this._flat[d]!==-9999?this._flat[d]:this._flat[d]=this._measure(u,0);let m=u;f&&(m+="B"),S&&(m+="I");let C=this._holey.get(m);if(C===void 0){let w=0;f&&(w|=1),S&&(w|=2),C=this._measure(u,w),this._holey.set(m,C)}return C}_measure(u,f){const S=this._measureElements[f];return S.textContent=u.repeat(32),S.offsetWidth/32}}},2223:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=u(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(_,l)=>{function u(f){return 57508<=f&&f<=57558}Object.defineProperty(l,"__esModule",{value:!0}),l.createRenderDimensions=l.excludeFromContrastRatioDemands=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},l.isPowerlineGlyph=u,l.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},l.excludeFromContrastRatioDemands=function(f){return u(f)||function(S){return 9472<=S&&S<=9631}(f)},l.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}}}}},456:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(u){this._bufferService=u,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 u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,f=this.selectionEnd;return!(!u||!f)&&(u[1]>f[1]||u[1]===f[1]&&u[0]>f[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const d=u(2585),m=u(8460),C=u(844);let w=l.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(a,o,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new g(a,o,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const a=this._measureStrategy.measure();a.width===this.width&&a.height===this.height||(this.width=a.width,this.height=a.height,this._onCharSizeChange.fire())}};l.CharSizeService=w=f([S(2,d.IOptionsService)],w);class g{constructor(o,s,c){this._document=o,this._parentElement=s,this._optionsService=c,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const o={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return o.width!==0&&o.height!==0&&(this._result.width=o.width/32,this._result.height=Math.ceil(o.height)),this._result}}},4269:function(_,l,u){var f=this&&this.__decorate||function(o,s,c,p){var v,x=arguments.length,b=x<3?s:p===null?p=Object.getOwnPropertyDescriptor(s,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(o,s,c,p);else for(var y=o.length-1;y>=0;y--)(v=o[y])&&(b=(x<3?v(b):x>3?v(s,c,b):v(s,c))||b);return x>3&&b&&Object.defineProperty(s,c,b),b},S=this&&this.__param||function(o,s){return function(c,p){s(c,p,o)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const d=u(3734),m=u(643),C=u(511),w=u(2585);class g extends d.AttributeData{constructor(s,c,p){super(),this.content=0,this.combinedData="",this.fg=s.fg,this.bg=s.bg,this.combinedData=c,this._width=p}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(s){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=g;let a=l.CharacterJoinerService=class Gh{constructor(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(s){const c={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(c),c.id}deregister(s){for(let c=0;c<this._characterJoiners.length;c++)if(this._characterJoiners[c].id===s)return this._characterJoiners.splice(c,1),!0;return!1}getJoinedCharacters(s){if(this._characterJoiners.length===0)return[];const c=this._bufferService.buffer.lines.get(s);if(!c||c.length===0)return[];const p=[],v=c.translateToString(!0);let x=0,b=0,y=0,k=c.getFg(0),R=c.getBg(0);for(let O=0;O<c.getTrimmedLength();O++)if(c.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==k||this._workCell.bg!==R){if(O-x>1){const T=this._getJoinedRanges(v,y,b,c,x);for(let B=0;B<T.length;B++)p.push(T[B])}x=O,y=b,k=this._workCell.fg,R=this._workCell.bg}b+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const O=this._getJoinedRanges(v,y,b,c,x);for(let T=0;T<O.length;T++)p.push(O[T])}return p}_getJoinedRanges(s,c,p,v,x){const b=s.substring(c,p);let y=[];try{y=this._characterJoiners[0].handler(b)}catch(k){console.error(k)}for(let k=1;k<this._characterJoiners.length;k++)try{const R=this._characterJoiners[k].handler(b);for(let O=0;O<R.length;O++)Gh._mergeRanges(y,R[O])}catch(R){console.error(R)}return this._stringRangesToCellRanges(y,v,x),y}_stringRangesToCellRanges(s,c,p){let v=0,x=!1,b=0,y=s[v];if(y){for(let k=p;k<this._bufferService.cols;k++){const R=c.getWidth(k),O=c.getString(k).length||m.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!x&&y[0]<=b&&(y[0]=k,x=!0),y[1]<=b){if(y[1]=k,y=s[++v],!y)break;y[0]<=b?(y[0]=k,x=!0):x=!1}b+=O}}y&&(y[1]=this._bufferService.cols)}}static _mergeRanges(s,c){let p=!1;for(let v=0;v<s.length;v++){const x=s[v];if(p){if(c[1]<=x[0])return s[v-1][1]=c[1],s;if(c[1]<=x[1])return s[v-1][1]=Math.max(c[1],x[1]),s.splice(v,1),s;s.splice(v,1),v--}else{if(c[1]<=x[0])return s.splice(v,0,c),s;if(c[1]<=x[1])return x[0]=Math.min(c[0],x[0]),s;c[0]<x[1]&&(x[0]=Math.min(c[0],x[0]),p=!0)}}return p?s[s.length-1][1]=c[1]:s.push(c),s}};l.CharacterJoinerService=a=f([S(0,w.IBufferService)],a)},5114:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0,l.CoreBrowserService=class{constructor(u,f){this._textarea=u,this.window=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}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}}},8934:function(_,l,u){var f=this&&this.__decorate||function(w,g,a,o){var s,c=arguments.length,p=c<3?g:o===null?o=Object.getOwnPropertyDescriptor(g,a):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(w,g,a,o);else for(var v=w.length-1;v>=0;v--)(s=w[v])&&(p=(c<3?s(p):c>3?s(g,a,p):s(g,a))||p);return c>3&&p&&Object.defineProperty(g,a,p),p},S=this&&this.__param||function(w,g){return function(a,o){g(a,o,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const d=u(4725),m=u(9806);let C=l.MouseService=class{constructor(w,g){this._renderService=w,this._charSizeService=g}getCoords(w,g,a,o,s){return(0,m.getCoords)(window,w,g,a,o,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(w,g){const a=(0,m.getCoordsRelativeToElement)(window,w,g);if(this._charSizeService.hasValidSize)return a[0]=Math.min(Math.max(a[0],0),this._renderService.dimensions.css.canvas.width-1),a[1]=Math.min(Math.max(a[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(a[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(a[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(a[0]),y:Math.floor(a[1])}}};l.MouseService=C=f([S(0,d.IRenderService),S(1,d.ICharSizeService)],C)},3230:function(_,l,u){var f=this&&this.__decorate||function(p,v,x,b){var y,k=arguments.length,R=k<3?v:b===null?b=Object.getOwnPropertyDescriptor(v,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,v,x,b);else for(var O=p.length-1;O>=0;O--)(y=p[O])&&(R=(k<3?y(R):k>3?y(v,x,R):y(v,x))||R);return k>3&&R&&Object.defineProperty(v,x,R),R},S=this&&this.__param||function(p,v){return function(x,b){v(x,b,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const d=u(3656),m=u(6193),C=u(5596),w=u(4725),g=u(8460),a=u(844),o=u(7226),s=u(2585);let c=l.RenderService=class extends a.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,v,x,b,y,k,R,O){if(super(),this._rowCount=p,this._charSizeService=b,this._renderer=this.register(new a.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(R.window,(T,B)=>this._renderRows(T,B)),this.register(this._renderDebouncer),this._screenDprMonitor=new C.ScreenDprMonitor(R.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(k.onResize(()=>this._fullRefresh())),this.register(k.buffers.onBufferActivate(()=>{var T;return(T=this._renderer.value)===null||T===void 0?void 0:T.clear()})),this.register(x.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(y.onDecorationRegistered(()=>this._fullRefresh())),this.register(y.onDecorationRemoved(()=>this._fullRefresh())),this.register(x.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(k.cols,k.rows),this._fullRefresh()})),this.register(x.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(k.buffer.y,k.buffer.y,!0))),this.register((0,d.addDisposableDomListener)(R.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(O.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in R.window){const T=new R.window.IntersectionObserver(B=>this._handleIntersectionChange(B[B.length-1]),{threshold:0});T.observe(v),this.register({dispose:()=>T.disconnect()})}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,v,x=!1){this._isPaused?this._needsFullRefresh=!0:(x||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,v,this._rowCount))}_renderRows(p,v){this._renderer.value&&(p=Math.min(p,this._rowCount-1),v=Math.min(v,this._rowCount-1),this._renderer.value.renderRows(p,v),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:v}),this._onRender.fire({start:p,end:v}),this._isNextRenderRedrawOnly=!0)}resize(p,v){this._rowCount=v,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(p){this._renderer.value=p,this._renderer.value.onRequestRedraw(v=>this.refreshRows(v.start,v.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,v;this._renderer.value&&((v=(p=this._renderer.value).clearTextureAtlas)===null||v===void 0||v.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,v){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(p,v)):this._renderer.value.handleResize(p,v),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)===null||p===void 0||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)===null||p===void 0||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)===null||p===void 0||p.handleFocus()}handleSelectionChanged(p,v,x){var b;this._selectionState.start=p,this._selectionState.end=v,this._selectionState.columnSelectMode=x,(b=this._renderer.value)===null||b===void 0||b.handleSelectionChanged(p,v,x)}handleCursorMove(){var p;(p=this._renderer.value)===null||p===void 0||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)===null||p===void 0||p.clear()}};l.RenderService=c=f([S(2,s.IOptionsService),S(3,w.ICharSizeService),S(4,s.IDecorationService),S(5,s.IBufferService),S(6,w.ICoreBrowserService),S(7,w.IThemeService)],c)},9312:function(_,l,u){var f=this&&this.__decorate||function(y,k,R,O){var T,B=arguments.length,z=B<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,R):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(y,k,R,O);else for(var I=y.length-1;I>=0;I--)(T=y[I])&&(z=(B<3?T(z):B>3?T(k,R,z):T(k,R))||z);return B>3&&z&&Object.defineProperty(k,R,z),z},S=this&&this.__param||function(y,k){return function(R,O){k(R,O,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const d=u(9806),m=u(9504),C=u(456),w=u(4725),g=u(8460),a=u(844),o=u(6114),s=u(4841),c=u(511),p=u(2585),v=" ",x=new RegExp(v,"g");let b=l.SelectionService=class extends a.Disposable{constructor(y,k,R,O,T,B,z,I,j){super(),this._element=y,this._screenElement=k,this._linkifier=R,this._bufferService=O,this._coreService=T,this._mouseService=B,this._optionsService=z,this._renderService=I,this._coreBrowserService=j,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new c.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new g.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new g.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new g.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,a.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 y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!y||!k||y[0]===k[0]&&y[1]===k[1])}get selectionText(){const y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;if(!y||!k)return"";const R=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(y[0]===k[0])return"";const T=y[0]<k[0]?y[0]:k[0],B=y[0]<k[0]?k[0]:y[0];for(let z=y[1];z<=k[1];z++){const I=R.translateBufferLineToString(z,!0,T,B);O.push(I)}}else{const T=y[1]===k[1]?k[0]:void 0;O.push(R.translateBufferLineToString(y[1],!0,y[0],T));for(let B=y[1]+1;B<=k[1]-1;B++){const z=R.lines.get(B),I=R.translateBufferLineToString(B,!0);z!=null&&z.isWrapped?O[O.length-1]+=I:O.push(I)}if(y[1]!==k[1]){const B=R.lines.get(k[1]),z=R.translateBufferLineToString(k[1],!0,0,k[0]);B&&B.isWrapped?O[O.length-1]+=z:O.push(z)}}return O.map(T=>T.replace(x," ")).join(o.isWindows?`\r
|
|
45
45
|
`:`
|
|
46
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(y){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),o.isLinux&&y&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(y){const k=this._getMouseBufferCoords(y),R=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(R&&O&&k)&&this._areCoordsInSelection(k,R,O)}isCellInSelection(y,k){const R=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!R||!O)&&this._areCoordsInSelection([y,k],R,O)}_areCoordsInSelection(y,k,R){return y[1]>k[1]&&y[1]<R[1]||k[1]===R[1]&&y[1]===k[1]&&y[0]>=k[0]&&y[0]<R[0]||k[1]<R[1]&&y[1]===R[1]&&y[0]<R[0]||k[1]<R[1]&&y[1]===k[1]&&y[0]>=k[0]}_selectWordAtCursor(y,k){var R,O;const T=(O=(R=this._linkifier.currentLink)===null||R===void 0?void 0:R.link)===null||O===void 0?void 0:O.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,s.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(y);return!!B&&(this._selectWordAt(B,k),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(y,k){this._model.clearSelection(),y=Math.max(y,0),k=Math.min(k,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,y],this._model.selectionEnd=[this._bufferService.cols,k],this.refresh(),this._onSelectionChange.fire()}_handleTrim(y){this._model.handleTrim(y)&&this.refresh()}_getMouseBufferCoords(y){const k=this._mouseService.getCoords(y,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(k)return k[0]--,k[1]--,k[1]+=this._bufferService.buffer.ydisp,k}_getMouseEventScrollAmount(y){let k=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,y,this._screenElement)[1];const R=this._renderService.dimensions.css.canvas.height;return k>=0&&k<=R?0:(k>R&&(k-=R),k=Math.min(Math.max(k,-50),50),k/=50,k/Math.abs(k)+Math.round(14*k))}shouldForceSelection(y){return o.isMac?y.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:y.shiftKey}handleMouseDown(y){if(this._mouseDownTimeStamp=y.timeStamp,(y.button!==2||!this.hasSelection)&&y.button===0){if(!this._enabled){if(!this.shouldForceSelection(y))return;y.stopPropagation()}y.preventDefault(),this._dragScrollAmount=0,this._enabled&&y.shiftKey?this._handleIncrementalClick(y):y.detail===1?this._handleSingleClick(y):y.detail===2?this._handleDoubleClick(y):y.detail===3&&this._handleTripleClick(y),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(y){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(y))}_handleSingleClick(y){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(y)?3:0,this._model.selectionStart=this._getMouseBufferCoords(y),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const k=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);k&&k.length!==this._model.selectionStart[0]&&k.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(y){this._selectWordAtCursor(y,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(y){const k=this._getMouseBufferCoords(y);k&&(this._activeSelectionMode=2,this._selectLineAt(k[1]))}shouldColumnSelect(y){return y.altKey&&!(o.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(y){if(y.stopImmediatePropagation(),!this._model.selectionStart)return;const k=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(y),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(y),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){const O=R.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}k&&k[0]===this._model.selectionEnd[0]&&k[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const y=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(y.ydisp+this._bufferService.rows,y.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=y.ydisp),this.refresh()}}_handleMouseUp(y){const k=y.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&k<500&&y.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const R=this._mouseService.getCoords(y,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const O=(0,m.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd,R=!(!y||!k||y[0]===k[0]&&y[1]===k[1]);R?y&&k&&(this._oldSelectionStart&&this._oldSelectionEnd&&y[0]===this._oldSelectionStart[0]&&y[1]===this._oldSelectionStart[1]&&k[0]===this._oldSelectionEnd[0]&&k[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(y,k,R)):this._oldHasSelection&&this._fireOnSelectionChange(y,k,R)}_fireOnSelectionChange(y,k,R){this._oldSelectionStart=y,this._oldSelectionEnd=k,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(y){this.clearSelection(),this._trimListener.dispose(),this._trimListener=y.activeBuffer.lines.onTrim(k=>this._handleTrim(k))}_convertViewportColToCharacterIndex(y,k){let R=k;for(let O=0;k>=O;O++){const T=y.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:T>1&&k!==O&&(R+=T-1)}return R}setSelection(y,k,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[y,k],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(y){this._isClickInSelection(y)||(this._selectWordAtCursor(y,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(y,k,R=!0,O=!0){if(y[0]>=this._bufferService.cols)return;const T=this._bufferService.buffer,B=T.lines.get(y[1]);if(!B)return;const z=T.translateBufferLineToString(y[1],!1);let I=this._convertViewportColToCharacterIndex(B,y[0]),j=I;const $=y[0]-I;let E=0,A=0,P=0,M=0;if(z.charAt(I)===" "){for(;I>0&&z.charAt(I-1)===" ";)I--;for(;j<z.length&&z.charAt(j+1)===" ";)j++}else{let X=y[0],q=y[0];B.getWidth(X)===0&&(E++,X--),B.getWidth(q)===2&&(A++,q++);const se=B.getString(q).length;for(se>1&&(M+=se-1,j+=se-1);X>0&&I>0&&!this._isCharWordSeparator(B.loadCell(X-1,this._workCell));){B.loadCell(X-1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===0?(E++,X--):D>1&&(P+=D-1,I-=D-1),I--,X--}for(;q<B.length&&j+1<z.length&&!this._isCharWordSeparator(B.loadCell(q+1,this._workCell));){B.loadCell(q+1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===2?(A++,q++):D>1&&(M+=D-1,j+=D-1),j++,q++}}j++;let H=I+$-E+P,K=Math.min(this._bufferService.cols,j-I+E+A-P-M);if(k||z.slice(I,j).trim()!==""){if(R&&H===0&&B.getCodePoint(0)!==32){const X=T.lines.get(y[1]-1);if(X&&B.isWrapped&&X.getCodePoint(this._bufferService.cols-1)!==32){const q=this._getWordAt([this._bufferService.cols-1,y[1]-1],!1,!0,!1);if(q){const se=this._bufferService.cols-q.start;H-=se,K+=se}}}if(O&&H+K===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const X=T.lines.get(y[1]+1);if(X!=null&&X.isWrapped&&X.getCodePoint(0)!==32){const q=this._getWordAt([0,y[1]+1],!1,!1,!0);q&&(K+=q.length)}}return{start:H,length:K}}}_selectWordAt(y,k){const R=this._getWordAt(y,k);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,y[1]--;this._model.selectionStart=[R.start,y[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(y){const k=this._getWordAt(y,!0);if(k){let R=y[1];for(;k.start<0;)k.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;k.start+k.length>this._bufferService.cols;)k.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?k.start:k.start+k.length,R]}}_isCharWordSeparator(y){return y.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(y.getChars())>=0}_selectLineAt(y){const k=this._bufferService.buffer.getWrappedRangeForLine(y),R={start:{x:0,y:k.first},end:{x:this._bufferService.cols-1,y:k.last}};this._model.selectionStart=[0,k.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,s.getRangeLength)(R,this._bufferService.cols)}};l.SelectionService=b=f([S(3,p.IBufferService),S(4,p.ICoreService),S(5,w.IMouseService),S(6,p.IOptionsService),S(7,w.IRenderService),S(8,w.ICoreBrowserService)],b)},4725:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=u(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService")},6731:function(_,l,u){var f=this&&this.__decorate||function(b,y,k,R){var O,T=arguments.length,B=T<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(b,y,k,R);else for(var z=b.length-1;z>=0;z--)(O=b[z])&&(B=(T<3?O(B):T>3?O(y,k,B):O(y,k))||B);return T>3&&B&&Object.defineProperty(y,k,B),B},S=this&&this.__param||function(b,y){return function(k,R){y(k,R,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const d=u(7239),m=u(8055),C=u(8460),w=u(844),g=u(2585),a=m.css.toColor("#ffffff"),o=m.css.toColor("#000000"),s=m.css.toColor("#ffffff"),c=m.css.toColor("#000000"),p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const b=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],y=[0,95,135,175,215,255];for(let k=0;k<216;k++){const R=y[k/36%6|0],O=y[k/6%6|0],T=y[k%6];b.push({css:m.channels.toCss(R,O,T),rgba:m.channels.toRgba(R,O,T)})}for(let k=0;k<24;k++){const R=8+10*k;b.push({css:m.channels.toCss(R,R,R),rgba:m.channels.toRgba(R,R,R)})}return b})());let v=l.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(b){super(),this._optionsService=b,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:o,cursor:s,cursorAccent:c,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:m.color.blend(o,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:m.color.blend(o,p),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(b={}){const y=this._colors;if(y.foreground=x(b.foreground,a),y.background=x(b.background,o),y.cursor=x(b.cursor,s),y.cursorAccent=x(b.cursorAccent,c),y.selectionBackgroundTransparent=x(b.selectionBackground,p),y.selectionBackgroundOpaque=m.color.blend(y.background,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundTransparent=x(b.selectionInactiveBackground,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundOpaque=m.color.blend(y.background,y.selectionInactiveBackgroundTransparent),y.selectionForeground=b.selectionForeground?x(b.selectionForeground,m.NULL_COLOR):void 0,y.selectionForeground===m.NULL_COLOR&&(y.selectionForeground=void 0),m.color.isOpaque(y.selectionBackgroundTransparent)&&(y.selectionBackgroundTransparent=m.color.opacity(y.selectionBackgroundTransparent,.3)),m.color.isOpaque(y.selectionInactiveBackgroundTransparent)&&(y.selectionInactiveBackgroundTransparent=m.color.opacity(y.selectionInactiveBackgroundTransparent,.3)),y.ansi=l.DEFAULT_ANSI_COLORS.slice(),y.ansi[0]=x(b.black,l.DEFAULT_ANSI_COLORS[0]),y.ansi[1]=x(b.red,l.DEFAULT_ANSI_COLORS[1]),y.ansi[2]=x(b.green,l.DEFAULT_ANSI_COLORS[2]),y.ansi[3]=x(b.yellow,l.DEFAULT_ANSI_COLORS[3]),y.ansi[4]=x(b.blue,l.DEFAULT_ANSI_COLORS[4]),y.ansi[5]=x(b.magenta,l.DEFAULT_ANSI_COLORS[5]),y.ansi[6]=x(b.cyan,l.DEFAULT_ANSI_COLORS[6]),y.ansi[7]=x(b.white,l.DEFAULT_ANSI_COLORS[7]),y.ansi[8]=x(b.brightBlack,l.DEFAULT_ANSI_COLORS[8]),y.ansi[9]=x(b.brightRed,l.DEFAULT_ANSI_COLORS[9]),y.ansi[10]=x(b.brightGreen,l.DEFAULT_ANSI_COLORS[10]),y.ansi[11]=x(b.brightYellow,l.DEFAULT_ANSI_COLORS[11]),y.ansi[12]=x(b.brightBlue,l.DEFAULT_ANSI_COLORS[12]),y.ansi[13]=x(b.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),y.ansi[14]=x(b.brightCyan,l.DEFAULT_ANSI_COLORS[14]),y.ansi[15]=x(b.brightWhite,l.DEFAULT_ANSI_COLORS[15]),b.extendedAnsi){const k=Math.min(y.ansi.length-16,b.extendedAnsi.length);for(let R=0;R<k;R++)y.ansi[R+16]=x(b.extendedAnsi[R],l.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(b){this._restoreColor(b),this._onChangeColors.fire(this.colors)}_restoreColor(b){if(b!==void 0)switch(b){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[b]=this._restoreColors.ansi[b]}else for(let y=0;y<this._restoreColors.ansi.length;++y)this._colors.ansi[y]=this._restoreColors.ansi[y]}modifyColors(b){b(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function x(b,y){if(b!==void 0)try{return m.css.toColor(b)}catch{}return y}l.ThemeService=v=f([S(0,g.IOptionsService)],v)},6349:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=u(8460),S=u(844);class d extends S.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const w=new Array(C);for(let g=0;g<Math.min(C,this.length);g++)w[g]=this._array[this._getCyclicIndex(g)];this._array=w,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let w=this._length;w<C;w++)this._array[w]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,w){this._array[this._getCyclicIndex(C)]=w}push(C){this._array[this._getCyclicIndex(this._length)]=C,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(C,w,...g){if(w){for(let a=C;a<this._length-w;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+w)];this._length-=w,this.onDeleteEmitter.fire({index:C,amount:w})}for(let a=this._length-1;a>=C;a--)this._array[this._getCyclicIndex(a+g.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<g.length;a++)this._array[this._getCyclicIndex(C+a)]=g[a];if(g.length&&this.onInsertEmitter.fire({index:C,amount:g.length}),this._length+g.length>this._maxLength){const a=this._length+g.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=g.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,w,g){if(!(w<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let o=w-1;o>=0;o--)this.set(C+o+g,this.get(C+o));const a=C+w+g-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<w;a++)this.set(C+a+g,this.get(C+a))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}l.CircularList=d},1439:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function u(f,S=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const m in f)d[m]=S<=1?f[m]:f[m]&&u(f[m],S-1);return d}},8055:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;const f=u(6114);let S=0,d=0,m=0,C=0;var w,g,a,o,s;function c(v){const x=v.toString(16);return x.length<2?"0"+x:x}function p(v,x){return v<x?(x+.05)/(v+.05):(v+.05)/(x+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},function(v){v.toCss=function(x,b,y,k){return k!==void 0?`#${c(x)}${c(b)}${c(y)}${c(k)}`:`#${c(x)}${c(b)}${c(y)}`},v.toRgba=function(x,b,y,k=255){return(x<<24|b<<16|y<<8|k)>>>0}}(w||(l.channels=w={})),function(v){function x(b,y){return C=Math.round(255*y),[S,d,m]=s.toChannels(b.rgba),{css:w.toCss(S,d,m,C),rgba:w.toRgba(S,d,m,C)}}v.blend=function(b,y){if(C=(255&y.rgba)/255,C===1)return{css:y.css,rgba:y.rgba};const k=y.rgba>>24&255,R=y.rgba>>16&255,O=y.rgba>>8&255,T=b.rgba>>24&255,B=b.rgba>>16&255,z=b.rgba>>8&255;return S=T+Math.round((k-T)*C),d=B+Math.round((R-B)*C),m=z+Math.round((O-z)*C),{css:w.toCss(S,d,m),rgba:w.toRgba(S,d,m)}},v.isOpaque=function(b){return(255&b.rgba)==255},v.ensureContrastRatio=function(b,y,k){const R=s.ensureContrastRatio(b.rgba,y.rgba,k);if(R)return s.toColor(R>>24&255,R>>16&255,R>>8&255)},v.opaque=function(b){const y=(255|b.rgba)>>>0;return[S,d,m]=s.toChannels(y),{css:w.toCss(S,d,m),rgba:y}},v.opacity=x,v.multiplyOpacity=function(b,y){return C=255&b.rgba,x(b,C*y/255)},v.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(g||(l.color=g={})),function(v){let x,b;if(!f.isNode){const y=document.createElement("canvas");y.width=1,y.height=1;const k=y.getContext("2d",{willReadFrequently:!0});k&&(x=k,x.globalCompositeOperation="copy",b=x.createLinearGradient(0,0,1,1))}v.toColor=function(y){if(y.match(/#[\da-f]{3,8}/i))switch(y.length){case 4:return S=parseInt(y.slice(1,2).repeat(2),16),d=parseInt(y.slice(2,3).repeat(2),16),m=parseInt(y.slice(3,4).repeat(2),16),s.toColor(S,d,m);case 5:return S=parseInt(y.slice(1,2).repeat(2),16),d=parseInt(y.slice(2,3).repeat(2),16),m=parseInt(y.slice(3,4).repeat(2),16),C=parseInt(y.slice(4,5).repeat(2),16),s.toColor(S,d,m,C);case 7:return{css:y,rgba:(parseInt(y.slice(1),16)<<8|255)>>>0};case 9:return{css:y,rgba:parseInt(y.slice(1),16)>>>0}}const k=y.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(k)return S=parseInt(k[1]),d=parseInt(k[2]),m=parseInt(k[3]),C=Math.round(255*(k[5]===void 0?1:parseFloat(k[5]))),s.toColor(S,d,m,C);if(!x||!b)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=b,x.fillStyle=y,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[S,d,m,C]=x.getImageData(0,0,1,1).data,C!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(S,d,m,C),css:y}}}(a||(l.css=a={})),function(v){function x(b,y,k){const R=b/255,O=y/255,T=k/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}v.relativeLuminance=function(b){return x(b>>16&255,b>>8&255,255&b)},v.relativeLuminance2=x}(o||(l.rgb=o={})),function(v){function x(y,k,R){const O=y>>24&255,T=y>>16&255,B=y>>8&255;let z=k>>24&255,I=k>>16&255,j=k>>8&255,$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));for(;$<R&&(z>0||I>0||j>0);)z-=Math.max(0,Math.ceil(.1*z)),I-=Math.max(0,Math.ceil(.1*I)),j-=Math.max(0,Math.ceil(.1*j)),$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));return(z<<24|I<<16|j<<8|255)>>>0}function b(y,k,R){const O=y>>24&255,T=y>>16&255,B=y>>8&255;let z=k>>24&255,I=k>>16&255,j=k>>8&255,$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));for(;$<R&&(z<255||I<255||j<255);)z=Math.min(255,z+Math.ceil(.1*(255-z))),I=Math.min(255,I+Math.ceil(.1*(255-I))),j=Math.min(255,j+Math.ceil(.1*(255-j))),$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));return(z<<24|I<<16|j<<8|255)>>>0}v.ensureContrastRatio=function(y,k,R){const O=o.relativeLuminance(y>>8),T=o.relativeLuminance(k>>8);if(p(O,T)<R){if(T<O){const I=x(y,k,R),j=p(O,o.relativeLuminance(I>>8));if(j<R){const $=b(y,k,R);return j>p(O,o.relativeLuminance($>>8))?I:$}return I}const B=b(y,k,R),z=p(O,o.relativeLuminance(B>>8));if(z<R){const I=x(y,k,R);return z>p(O,o.relativeLuminance(I>>8))?B:I}return B}},v.reduceLuminance=x,v.increaseLuminance=b,v.toChannels=function(y){return[y>>24&255,y>>16&255,y>>8&255,255&y]},v.toColor=function(y,k,R,O){return{css:w.toCss(y,k,R,O),rgba:w.toRgba(y,k,R,O)}}}(s||(l.rgba=s={})),l.toPaddedHex=c,l.contrastRatio=p},8969:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=u(844),S=u(2585),d=u(4348),m=u(7866),C=u(744),w=u(7302),g=u(6975),a=u(8460),o=u(1753),s=u(1480),c=u(7994),p=u(9282),v=u(5435),x=u(5981),b=u(2660);let y=!1;class k extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event(O=>{var T;(T=this._onScrollApi)===null||T===void 0||T.fire(O.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(const T in O)this.optionsService.options[T]=O[T]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new a.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new a.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(O)),this._instantiationService.setService(S.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(S.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(S.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(S.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(S.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(S.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c.CharsetService),this._instantiationService.setService(S.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b.OscLinkService),this._instantiationService.setService(S.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,a.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,a.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,a.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,a.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(T=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(T=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new x.WriteBuffer((T,B)=>this._inputHandler.parse(T,B))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,T){this._writeBuffer.write(O,T)}writeSync(O,T){this._logService.logLevel<=S.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(O,T)}resize(O,T){isNaN(O)||isNaN(T)||(O=Math.max(O,C.MINIMUM_COLS),T=Math.max(T,C.MINIMUM_ROWS),this._bufferService.resize(O,T))}scroll(O,T=!1){this._bufferService.scroll(O,T)}scrollLines(O,T,B){this._bufferService.scrollLines(O,T,B)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const T=O-this._bufferService.buffer.ydisp;T!==0&&this.scrollLines(T)}registerEscHandler(O,T){return this._inputHandler.registerEscHandler(O,T)}registerDcsHandler(O,T){return this._inputHandler.registerDcsHandler(O,T)}registerCsiHandler(O,T){return this._inputHandler.registerCsiHandler(O,T)}registerOscHandler(O,T){return this._inputHandler.registerOscHandler(O,T)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const T=this.optionsService.rawOptions.windowsPty;T&&T.buildNumber!==void 0&&T.buildNumber!==void 0?O=T.backend==="conpty"&&T.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(p.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},()=>((0,p.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)(()=>{for(const T of O)T.dispose()})}}}l.CoreTerminal=k},8460:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===u)return void this._listeners.splice(f,1)}}})),this._event}fire(u,f){const S=[];for(let d=0;d<this._listeners.length;d++)S.push(this._listeners[d]);for(let d=0;d<S.length;d++)S[d].call(void 0,u,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(u,f){return u(S=>f.fire(S))}},5435:function(_,l,u){var f=this&&this.__decorate||function($,E,A,P){var M,H=arguments.length,K=H<3?E:P===null?P=Object.getOwnPropertyDescriptor(E,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,E,A,P);else for(var X=$.length-1;X>=0;X--)(M=$[X])&&(K=(H<3?M(K):H>3?M(E,A,K):M(E,A))||K);return H>3&&K&&Object.defineProperty(E,A,K),K},S=this&&this.__param||function($,E){return function(A,P){E(A,P,$)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const d=u(2584),m=u(7116),C=u(2015),w=u(844),g=u(482),a=u(8437),o=u(8460),s=u(643),c=u(511),p=u(3734),v=u(2585),x=u(6242),b=u(6351),y=u(5941),k={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function O($,E){if($>24)return E.setWinLines||!1;switch($){case 1:return!!E.restoreWin;case 2:return!!E.minimizeWin;case 3:return!!E.setWinPosition;case 4:return!!E.setWinSizePixels;case 5:return!!E.raiseWin;case 6:return!!E.lowerWin;case 7:return!!E.refreshWin;case 8:return!!E.setWinSizeChars;case 9:return!!E.maximizeWin;case 10:return!!E.fullscreenWin;case 11:return!!E.getWinState;case 13:return!!E.getWinPosition;case 14:return!!E.getWinSizePixels;case 15:return!!E.getScreenSizePixels;case 16:return!!E.getCellSizePixels;case 18:return!!E.getWinSizeChars;case 19:return!!E.getScreenSizeChars;case 20:return!!E.getIconTitle;case 21:return!!E.getWinTitle;case 22:return!!E.pushTitle;case 23:return!!E.popTitle;case 24:return!!E.setWinLines}return!1}var T;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(T||(l.WindowsOptionsReportType=T={}));let B=0;class z extends w.Disposable{getAttrData(){return this._curAttrData}constructor(E,A,P,M,H,K,X,q,se=new C.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=A,this._coreService=P,this._logService=M,this._optionsService=H,this._oscLinkService=K,this._coreMouseService=X,this._unicodeService=q,this._parser=se,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new c.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new o.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new o.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new o.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new o.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new o.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new o.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new o.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new o.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new o.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new o.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new o.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(D=>this._activeBuffer=D.activeBuffer)),this._parser.setCsiHandlerFallback((D,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:F.toArray()})}),this._parser.setEscHandlerFallback(D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})}),this._parser.setExecuteHandlerFallback(D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})}),this._parser.setOscHandlerFallback((D,F,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:F,data:W})}),this._parser.setDcsHandlerFallback((D,F,W)=>{F==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:F,payload:W})}),this._parser.setPrintHandler((D,F,W)=>this.print(D,F,W)),this._parser.registerCsiHandler({final:"@"},D=>this.insertChars(D)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},D=>this.scrollLeft(D)),this._parser.registerCsiHandler({final:"A"},D=>this.cursorUp(D)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},D=>this.scrollRight(D)),this._parser.registerCsiHandler({final:"B"},D=>this.cursorDown(D)),this._parser.registerCsiHandler({final:"C"},D=>this.cursorForward(D)),this._parser.registerCsiHandler({final:"D"},D=>this.cursorBackward(D)),this._parser.registerCsiHandler({final:"E"},D=>this.cursorNextLine(D)),this._parser.registerCsiHandler({final:"F"},D=>this.cursorPrecedingLine(D)),this._parser.registerCsiHandler({final:"G"},D=>this.cursorCharAbsolute(D)),this._parser.registerCsiHandler({final:"H"},D=>this.cursorPosition(D)),this._parser.registerCsiHandler({final:"I"},D=>this.cursorForwardTab(D)),this._parser.registerCsiHandler({final:"J"},D=>this.eraseInDisplay(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},D=>this.eraseInDisplay(D,!0)),this._parser.registerCsiHandler({final:"K"},D=>this.eraseInLine(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},D=>this.eraseInLine(D,!0)),this._parser.registerCsiHandler({final:"L"},D=>this.insertLines(D)),this._parser.registerCsiHandler({final:"M"},D=>this.deleteLines(D)),this._parser.registerCsiHandler({final:"P"},D=>this.deleteChars(D)),this._parser.registerCsiHandler({final:"S"},D=>this.scrollUp(D)),this._parser.registerCsiHandler({final:"T"},D=>this.scrollDown(D)),this._parser.registerCsiHandler({final:"X"},D=>this.eraseChars(D)),this._parser.registerCsiHandler({final:"Z"},D=>this.cursorBackwardTab(D)),this._parser.registerCsiHandler({final:"`"},D=>this.charPosAbsolute(D)),this._parser.registerCsiHandler({final:"a"},D=>this.hPositionRelative(D)),this._parser.registerCsiHandler({final:"b"},D=>this.repeatPrecedingCharacter(D)),this._parser.registerCsiHandler({final:"c"},D=>this.sendDeviceAttributesPrimary(D)),this._parser.registerCsiHandler({prefix:">",final:"c"},D=>this.sendDeviceAttributesSecondary(D)),this._parser.registerCsiHandler({final:"d"},D=>this.linePosAbsolute(D)),this._parser.registerCsiHandler({final:"e"},D=>this.vPositionRelative(D)),this._parser.registerCsiHandler({final:"f"},D=>this.hVPosition(D)),this._parser.registerCsiHandler({final:"g"},D=>this.tabClear(D)),this._parser.registerCsiHandler({final:"h"},D=>this.setMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"h"},D=>this.setModePrivate(D)),this._parser.registerCsiHandler({final:"l"},D=>this.resetMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"l"},D=>this.resetModePrivate(D)),this._parser.registerCsiHandler({final:"m"},D=>this.charAttributes(D)),this._parser.registerCsiHandler({final:"n"},D=>this.deviceStatus(D)),this._parser.registerCsiHandler({prefix:"?",final:"n"},D=>this.deviceStatusPrivate(D)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},D=>this.softReset(D)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},D=>this.setCursorStyle(D)),this._parser.registerCsiHandler({final:"r"},D=>this.setScrollRegion(D)),this._parser.registerCsiHandler({final:"s"},D=>this.saveCursor(D)),this._parser.registerCsiHandler({final:"t"},D=>this.windowOptions(D)),this._parser.registerCsiHandler({final:"u"},D=>this.restoreCursor(D)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},D=>this.insertColumns(D)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},D=>this.deleteColumns(D)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},D=>this.selectProtected(D)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},D=>this.requestMode(D,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},D=>this.requestMode(D,!1)),this._parser.setExecuteHandler(d.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(d.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(d.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(d.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(d.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(d.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(d.C1.IND,()=>this.index()),this._parser.setExecuteHandler(d.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(d.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new x.OscHandler(D=>(this.setTitle(D),this.setIconName(D),!0))),this._parser.registerOscHandler(1,new x.OscHandler(D=>this.setIconName(D))),this._parser.registerOscHandler(2,new x.OscHandler(D=>this.setTitle(D))),this._parser.registerOscHandler(4,new x.OscHandler(D=>this.setOrReportIndexedColor(D))),this._parser.registerOscHandler(8,new x.OscHandler(D=>this.setHyperlink(D))),this._parser.registerOscHandler(10,new x.OscHandler(D=>this.setOrReportFgColor(D))),this._parser.registerOscHandler(11,new x.OscHandler(D=>this.setOrReportBgColor(D))),this._parser.registerOscHandler(12,new x.OscHandler(D=>this.setOrReportCursorColor(D))),this._parser.registerOscHandler(104,new x.OscHandler(D=>this.restoreIndexedColor(D))),this._parser.registerOscHandler(110,new x.OscHandler(D=>this.restoreFgColor(D))),this._parser.registerOscHandler(111,new x.OscHandler(D=>this.restoreBgColor(D))),this._parser.registerOscHandler(112,new x.OscHandler(D=>this.restoreCursorColor(D))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const D in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},()=>this.selectCharset("("+D)),this._parser.registerEscHandler({intermediates:")",final:D},()=>this.selectCharset(")"+D)),this._parser.registerEscHandler({intermediates:"*",final:D},()=>this.selectCharset("*"+D)),this._parser.registerEscHandler({intermediates:"+",final:D},()=>this.selectCharset("+"+D)),this._parser.registerEscHandler({intermediates:"-",final:D},()=>this.selectCharset("-"+D)),this._parser.registerEscHandler({intermediates:".",final:D},()=>this.selectCharset("."+D)),this._parser.registerEscHandler({intermediates:"/",final:D},()=>this.selectCharset("/"+D));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(D=>(this._logService.error("Parsing error: ",D),D)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler((D,F)=>this.requestStatusString(D,F)))}_preserveStack(E,A,P,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=A,this._parseStack.decodedLength=P,this._parseStack.position=M}_logSlowResolvingAsync(E){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([E,new Promise((A,P)=>setTimeout(()=>P("#SLOW_TIMEOUT"),5e3))]).catch(A=>{if(A!=="#SLOW_TIMEOUT")throw A;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,A){let P,M=this._activeBuffer.x,H=this._activeBuffer.y,K=0;const X=this._parseStack.paused;if(X){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,A))return this._logSlowResolvingAsync(P),P;M=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>R&&(K=this._parseStack.position+R)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,q=>String.fromCharCode(q)).join("")}"`),typeof E=="string"?E.split("").map(q=>q.charCodeAt(0)):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<R&&(this._parseBuffer=new Uint32Array(Math.min(E.length,R))),X||this._dirtyRowTracker.clearRange(),E.length>R)for(let q=K;q<E.length;q+=R){const se=q+R<E.length?q+R:E.length,D=typeof E=="string"?this._stringDecoder.decode(E.substring(q,se),this._parseBuffer):this._utf8Decoder.decode(E.subarray(q,se),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,D))return this._preserveStack(M,H,D,q),this._logSlowResolvingAsync(P),P}else if(!X){const q=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,q))return this._preserveStack(M,H,q,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===M&&this._activeBuffer.y===H||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(E,A,P){let M,H;const K=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,q=this._bufferService.cols,se=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,F=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-A>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let U=A;U<P;++U){if(M=E[U],H=this._unicodeService.wcwidth(M),M<127&&K){const re=K[String.fromCharCode(M)];re&&(M=re.charCodeAt(0))}if(X&&this._onA11yChar.fire((0,g.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),H||!this._activeBuffer.x){if(this._activeBuffer.x+H-1>=q){if(se){for(;this._activeBuffer.x<q;)W.setCellFromCodePoint(this._activeBuffer.x++,0,1,F.fg,F.bg,F.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=q-1,H===2)continue}if(D&&(W.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(F),F),W.getWidth(q-1)===2&&W.setCellFromCodePoint(q-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),W.setCellFromCodePoint(this._activeBuffer.x++,M,H,F.fg,F.bg,F.extended),H>0)for(;--H;)W.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else W.getWidth(this._activeBuffer.x-1)?W.addCodepointToCell(this._activeBuffer.x-1,M):W.addCodepointToCell(this._activeBuffer.x-2,M)}P-A>0&&(W.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<q&&P-A>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,A){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,A):this._parser.registerCsiHandler(E,P=>!O(P.params[0],this._optionsService.rawOptions.windowOptions)||A(P))}registerDcsHandler(E,A){return this._parser.registerDcsHandler(E,new b.DcsHandler(A))}registerEscHandler(E,A){return this._parser.registerEscHandler(E,A)}registerOscHandler(E,A){return this._parser.registerOscHandler(E,new x.OscHandler(A))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var E;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||E===void 0)&&E.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);A.hasWidth(this._activeBuffer.x)&&!A.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(E,A){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+A):(this._activeBuffer.x=E,this._activeBuffer.y=A),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,A){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+A)}cursorUp(E){const A=this._activeBuffer.y-this._activeBuffer.scrollTop;return A>=0?this._moveCursor(0,-Math.min(A,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){const A=this._activeBuffer.scrollBottom-this._activeBuffer.y;return A>=0?this._moveCursor(0,Math.min(A,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){const A=E.params[0];return A===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:A===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=E.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=E.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){const A=E.params[0];return A===1&&(this._curAttrData.bg|=536870912),A!==2&&A!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,A,P,M=!1,H=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);K.replaceCells(A,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),H),M&&(K.isWrapped=!1)}_resetBufferLine(E,A=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),A),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),P.isWrapped=!1)}eraseInDisplay(E,A=!1){let P;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);P<this._bufferService.rows;P++)this._resetBufferLine(P,A);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,A),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,A);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,A);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(E,A=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,A);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,A)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let A=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;A--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let A=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;A--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let A=E.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(E){let A=E.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(a.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.deleteCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.insertCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.deleteCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){if(!this._parser.precedingCodepoint)return!0;const A=E.params[0]||1,P=new Uint32Array(A);for(let M=0;M<A;++M)P[M]=this._parser.precedingCodepoint;return this.print(P,0,P.length),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[A]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(E,A){const P=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:H}=this._coreMouseService,K=this._coreService,{buffers:X,cols:q}=this._bufferService,{active:se,alt:D}=X,F=this._optionsService.rawOptions,W=ae=>ae?1:2,U=E.params[0];return re=U,J=A?U===2?4:U===4?W(K.modes.insertMode):U===12?3:U===20?W(F.convertEol):0:U===1?W(P.applicationCursorKeys):U===3?F.windowOptions.setWinLines?q===80?2:q===132?1:0:0:U===6?W(P.origin):U===7?W(P.wraparound):U===8?3:U===9?W(M==="X10"):U===12?W(F.cursorBlink):U===25?W(!K.isCursorHidden):U===45?W(P.reverseWraparound):U===66?W(P.applicationKeypad):U===67?4:U===1e3?W(M==="VT200"):U===1002?W(M==="DRAG"):U===1003?W(M==="ANY"):U===1004?W(P.sendFocus):U===1005?4:U===1006?W(H==="SGR"):U===1015?4:U===1016?W(H==="SGR_PIXELS"):U===1048?1:U===47||U===1047||U===1049?W(se===D):U===2004?W(P.bracketedPasteMode):0,K.triggerDataEvent(`${d.C0.ESC}[${A?"":"?"}${re};${J}$y`),!0;var re,J}_updateAttrColor(E,A,P,M,H){return A===2?(E|=50331648,E&=-16777216,E|=p.AttributeData.fromColorRGB([P,M,H])):A===5&&(E&=-50331904,E|=33554432|255&P),E}_extractColor(E,A,P){const M=[0,0,-1,0,0,0];let H=0,K=0;do{if(M[K+H]=E.params[A+K],E.hasSubParams(A+K)){const X=E.getSubParams(A+K);let q=0;do M[1]===5&&(H=1),M[K+q+1+H]=X[q];while(++q<X.length&&q+K+1+H<M.length);break}if(M[1]===5&&K+H>=2||M[1]===2&&K+H>=5)break;M[1]&&(H=1)}while(++K+A<E.length&&K+H<M.length);for(let X=2;X<M.length;++X)M[X]===-1&&(M[X]=0);switch(M[0]){case 38:P.fg=this._updateAttrColor(P.fg,M[1],M[3],M[4],M[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,M[1],M[3],M[4],M[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,M[1],M[3],M[4],M[5])}return K}_processUnderline(E,A){A.extended=A.extended.clone(),(!~E||E>5)&&(E=1),A.extended.underlineStyle=E,A.fg|=268435456,E===0&&(A.fg&=-268435457),A.updateExtended()}_processSGR0(E){E.fg=a.DEFAULT_ATTR_DATA.fg,E.bg=a.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;const A=E.length;let P;const M=this._curAttrData;for(let H=0;H<A;H++)P=E.params[H],P>=30&&P<=37?(M.fg&=-50331904,M.fg|=16777216|P-30):P>=40&&P<=47?(M.bg&=-50331904,M.bg|=16777216|P-40):P>=90&&P<=97?(M.fg&=-50331904,M.fg|=16777224|P-90):P>=100&&P<=107?(M.bg&=-50331904,M.bg|=16777224|P-100):P===0?this._processSGR0(M):P===1?M.fg|=134217728:P===3?M.bg|=67108864:P===4?(M.fg|=268435456,this._processUnderline(E.hasSubParams(H)?E.getSubParams(H)[0]:1,M)):P===5?M.fg|=536870912:P===7?M.fg|=67108864:P===8?M.fg|=1073741824:P===9?M.fg|=2147483648:P===2?M.bg|=134217728:P===21?this._processUnderline(2,M):P===22?(M.fg&=-134217729,M.bg&=-134217729):P===23?M.bg&=-67108865:P===24?(M.fg&=-268435457,this._processUnderline(0,M)):P===25?M.fg&=-536870913:P===27?M.fg&=-67108865:P===28?M.fg&=-1073741825:P===29?M.fg&=2147483647:P===39?(M.fg&=-67108864,M.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):P===49?(M.bg&=-67108864,M.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?H+=this._extractColor(E,H,M):P===53?M.bg|=1073741824:P===55?M.bg&=-1073741825:P===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):P===100?(M.fg&=-67108864,M.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const A=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${A};${P}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){const A=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${A};${P}R`)}return!0}softReset(E){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(E){const A=E.params[0]||1;switch(A){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const P=A%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(E){const A=E.params[0]||1;let P;return(E.length<2||(P=E.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>A&&(this._activeBuffer.scrollTop=A-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(E){if(!O(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;const A=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:A!==2&&this._onRequestWindowsOptionsReport.fire(T.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(T.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:A!==0&&A!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),A!==0&&A!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:A!==0&&A!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),A!==0&&A!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(E){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){const A=[],P=E.split(";");for(;P.length>1;){const M=P.shift(),H=P.shift();if(/^\d+$/.exec(M)){const K=parseInt(M);if(j(K))if(H==="?")A.push({type:0,index:K});else{const X=(0,y.parseColor)(H);X&&A.push({type:1,index:K,color:X})}}}return A.length&&this._onColor.fire(A),!0}setHyperlink(E){const A=E.split(";");return!(A.length<2)&&(A[1]?this._createHyperlink(A[0],A[1]):!A[0]&&this._finishHyperlink())}_createHyperlink(E,A){this._getCurrentLinkId()&&this._finishHyperlink();const P=E.split(":");let M;const H=P.findIndex(K=>K.startsWith("id="));return H!==-1&&(M=P[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:A}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,A){const P=E.split(";");for(let M=0;M<P.length&&!(A>=this._specialColors.length);++M,++A)if(P[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[A]}]);else{const H=(0,y.parseColor)(P[M]);H&&this._onColor.fire([{type:1,index:this._specialColors[A],color:H}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;const A=[],P=E.split(";");for(let M=0;M<P.length;++M)if(/^\d+$/.exec(P[M])){const H=parseInt(P[M]);j(H)&&A.push({type:2,index:H})}return A.length&&this._onColor.fire(A),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(k[E[0]],m.CHARSETS[E[1]]||m.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){const E=new c.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let A=0;A<this._bufferService.rows;++A){const P=this._activeBuffer.ybase+this._activeBuffer.y+A,M=this._activeBuffer.lines.get(P);M&&(M.fill(E),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,A){const P=this._bufferService.buffer,M=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${H}${d.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,A){this._dirtyRowTracker.markRangeDirty(E,A)}}l.InputHandler=z;let I=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,E){$>E&&(B=$,$=E,E=B),$<this.start&&(this.start=$),E>this.end&&(this.end=E)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function j($){return 0<=$&&$<256}I=f([S(0,v.IBufferService)],I)},844:(_,l)=>{function u(f){for(const S of f)S.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const S=this._disposables.indexOf(f);S!==-1&&this._disposables.splice(S,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var S;this._isDisposed||f===this._value||((S=this._value)===null||S===void 0||S.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)===null||f===void 0||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=u,l.getDisposeArrayDisposable=function(f){return{dispose:()=>u(f)}}},1505:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(S,d,m){this._data[S]||(this._data[S]={}),this._data[S][d]=m}get(S,d){return this._data[S]?this._data[S][d]:void 0}clear(){this._data={}}}l.TwoKeyMap=u,l.FourKeyMap=class{constructor(){this._data=new u}set(f,S,d,m,C){this._data.get(f,S)||this._data.set(f,S,new u),this._data.get(f,S).set(d,m,C)}get(f,S,d,m){var C;return(C=this._data.get(f,S))===null||C===void 0?void 0:C.get(d,m)}clear(){this._data.clear()}}},6114:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof navigator>"u";const u=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=u.includes("Firefox"),l.isLegacyEdge=u.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(u),l.getSafariVersion=function(){if(!l.isSafari)return 0;const S=u.match(/Version\/(\d+)/);return S===null||S.length<2?0:parseInt(S[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(u)},6106:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let u=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(u=this._search(this._getKey(f)),this._array.splice(u,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const S=this._getKey(f);if(S===void 0||(u=this._search(S),u===-1)||this._getKey(this._array[u])!==S)return!1;do if(this._array[u]===f)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===S);return!1}*getKeyIterator(f){if(this._array.length!==0&&(u=this._search(f),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===f))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===f)}forEachByKey(f,S){if(this._array.length!==0&&(u=this._search(f),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===f))do S(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===f)}values(){return[...this._array].values()}_search(f){let S=0,d=this._array.length-1;for(;d>=S;){let m=S+d>>1;const C=this._getKey(this._array[m]);if(C>f)d=m-1;else{if(!(C<f)){for(;m>0&&this._getKey(this._array[m-1])===f;)m--;return m}S=m+1}}return S}}},7226:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=u(6114);class S{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(C){this._idleCallback=void 0;let w=0,g=0,a=C.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),g=Math.max(w,g),o=C.timeRemaining(),1.5*g>o)return a-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-w))}ms`),void this._start();a=o}this.clear()}}class d extends S{_requestCallback(C){return setTimeout(()=>C(this._createDeadline(16)))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const w=Date.now()+C;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}l.PriorityTaskQueue=d,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends S{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:d,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=u(643);l.updateWindowsModeWrappedState=function(S){const d=S.buffer.lines.get(S.buffer.ybase+S.buffer.y-1),m=d==null?void 0:d.get(S.cols-1),C=S.buffer.lines.get(S.buffer.ybase+S.buffer.y);C&&m&&(C.isWrapped=m[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&m[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new u;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}l.AttributeData=u;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}constructor(d=0,m=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=m}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=u(6349),S=u(7226),d=u(3734),m=u(8437),C=u(4634),w=u(511),g=u(643),a=u(4863),o=u(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(s,c,p){this._hasScrollback=s,this._optionsService=c,this._bufferService=p,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new S.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,c){return new m.BufferLine(this._bufferService.cols,this.getNullCell(s),c)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const c=s+this._optionsService.rawOptions.scrollback;return c>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:c}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=m.DEFAULT_ATTR_DATA);let c=this._rows;for(;c--;)this.lines.push(this.getBlankLine(s))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(s,c){const p=this.getNullCell(m.DEFAULT_ATTR_DATA);let v=0;const x=this._getCorrectBufferLength(c);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<s)for(let y=0;y<this.lines.length;y++)v+=+this.lines.get(y).resize(s,p);let b=0;if(this._rows<c)for(let y=this._rows;y<c;y++)this.lines.length<c+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(s,p)):this.ybase>0&&this.lines.length<=this.ybase+this.y+b+1?(this.ybase--,b++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(s,p)));else for(let y=this._rows;y>c;y--)this.lines.length>c+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const y=this.lines.length-x;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=x}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,c-1),b&&(this.y+=b),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=c-1,this._isReflowEnabled&&(this._reflow(s,c),this._cols>s))for(let b=0;b<this.lines.length;b++)v+=+this.lines.get(b).resize(s,p);this._cols=s,this._rows=c,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let c=0;for(;this._memoryCleanupPosition<this.lines.length;)if(c+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),c>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,c){this._cols!==s&&(s>this._cols?this._reflowLarger(s,c):this._reflowSmaller(s,c))}_reflowLarger(s,c){const p=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(p.length>0){const v=(0,C.reflowLargerCreateNewLayout)(this.lines,p);(0,C.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(s,c,v.countRemoved)}}_reflowLargerAdjustViewport(s,c,p){const v=this.getNullCell(m.DEFAULT_ATTR_DATA);let x=p;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<c&&this.lines.push(new m.BufferLine(s,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-p,0)}_reflowSmaller(s,c){const p=this.getNullCell(m.DEFAULT_ATTR_DATA),v=[];let x=0;for(let b=this.lines.length-1;b>=0;b--){let y=this.lines.get(b);if(!y||!y.isWrapped&&y.getTrimmedLength()<=s)continue;const k=[y];for(;y.isWrapped&&b>0;)y=this.lines.get(--b),k.unshift(y);const R=this.ybase+this.y;if(R>=b&&R<b+k.length)continue;const O=k[k.length-1].getTrimmedLength(),T=(0,C.reflowSmallerGetNewLineLengths)(k,this._cols,s),B=T.length-k.length;let z;z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const I=[];for(let M=0;M<B;M++){const H=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);I.push(H)}I.length>0&&(v.push({start:b+k.length+x,newLines:I}),x+=I.length),k.push(...I);let j=T.length-1,$=T[j];$===0&&(j--,$=T[j]);let E=k.length-B-1,A=O;for(;E>=0;){const M=Math.min(A,$);if(k[j]===void 0)break;if(k[j].copyCellsFrom(k[E],A-M,$-M,M,!0),$-=M,$===0&&(j--,$=T[j]),A-=M,A===0){E--;const H=Math.max(E,0);A=(0,C.getWrappedLineTrimmedLength)(k,H,this._cols)}}for(let M=0;M<k.length;M++)T[M]<s&&k[M].setCell(T[M],p);let P=B-z;for(;P-- >0;)this.ybase===0?this.y<c-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-c&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+c-1)}if(v.length>0){const b=[],y=[];for(let j=0;j<this.lines.length;j++)y.push(this.lines.get(j));const k=this.lines.length;let R=k-1,O=0,T=v[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let B=0;for(let j=Math.min(this.lines.maxLength-1,k+x-1);j>=0;j--)if(T&&T.start>R+B){for(let $=T.newLines.length-1;$>=0;$--)this.lines.set(j--,T.newLines[$]);j++,b.push({index:R+1,amount:T.newLines.length}),B+=T.newLines.length,T=v[++O]}else this.lines.set(j,y[R--]);let z=0;for(let j=b.length-1;j>=0;j--)b[j].index+=z,this.lines.onInsertEmitter.fire(b[j]),z+=b[j].amount;const I=Math.max(0,k+x-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(s,c,p=0,v){const x=this.lines.get(s);return x?x.translateToString(c,p,v):""}getWrappedRangeForLine(s){let c=s,p=s;for(;c>0&&this.lines.get(c).isWrapped;)c--;for(;p+1<this.lines.length&&this.lines.get(p+1).isWrapped;)p++;return{first:c,last:p}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].line===s&&(this.markers[c].dispose(),this.markers.splice(c--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const c=new a.Marker(s);return this.markers.push(c),c.register(this.lines.onTrim(p=>{c.line-=p,c.line<0&&c.dispose()})),c.register(this.lines.onInsert(p=>{c.line>=p.index&&(c.line+=p.amount)})),c.register(this.lines.onDelete(p=>{c.line>=p.index&&c.line<p.index+p.amount&&c.dispose(),c.line>p.index&&(c.line-=p.amount)})),c.register(c.onDispose(()=>this._removeMarker(c))),c}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=u(3734),S=u(511),d=u(643),m=u(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let C=0;class w{constructor(a,o,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);const c=o||S.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let p=0;p<a;++p)this.setCell(p,c);this.length=a}get(a){const o=this._data[3*a+0],s=2097151&o;return[this._data[3*a+1],2097152&o?this._combined[a]:s?(0,m.stringFromCodePoint)(s):"",o>>22,2097152&o?this._combined[a].charCodeAt(this._combined[a].length-1):s]}set(a,o){this._data[3*a+1]=o[d.CHAR_DATA_ATTR_INDEX],o[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=o[1],this._data[3*a+0]=2097152|a|o[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=o[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(a){return this._data[3*a+0]>>22}hasWidth(a){return 12582912&this._data[3*a+0]}getFg(a){return this._data[3*a+1]}getBg(a){return this._data[3*a+2]}hasContent(a){return 4194303&this._data[3*a+0]}getCodePoint(a){const o=this._data[3*a+0];return 2097152&o?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&o}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){const o=this._data[3*a+0];return 2097152&o?this._combined[a]:2097151&o?(0,m.stringFromCodePoint)(2097151&o):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,o){return C=3*a,o.content=this._data[C+0],o.fg=this._data[C+1],o.bg=this._data[C+2],2097152&o.content&&(o.combinedData=this._combined[a]),268435456&o.bg&&(o.extended=this._extendedAttrs[a]),o}setCell(a,o){2097152&o.content&&(this._combined[a]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[a]=o.extended),this._data[3*a+0]=o.content,this._data[3*a+1]=o.fg,this._data[3*a+2]=o.bg}setCellFromCodePoint(a,o,s,c,p,v){268435456&p&&(this._extendedAttrs[a]=v),this._data[3*a+0]=o|s<<22,this._data[3*a+1]=c,this._data[3*a+2]=p}addCodepointToCell(a,o){let s=this._data[3*a+0];2097152&s?this._combined[a]+=(0,m.stringFromCodePoint)(o):(2097151&s?(this._combined[a]=(0,m.stringFromCodePoint)(2097151&s)+(0,m.stringFromCodePoint)(o),s&=-2097152,s|=2097152):s=o|4194304,this._data[3*a+0]=s)}insertCells(a,o,s,c){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),o<this.length-a){const p=new S.CellData;for(let v=this.length-a-o-1;v>=0;--v)this.setCell(a+o+v,this.loadCell(a+v,p));for(let v=0;v<o;++v)this.setCell(a+v,s)}else for(let p=a;p<this.length;++p)this.setCell(p,s);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs)}deleteCells(a,o,s,c){if(a%=this.length,o<this.length-a){const p=new S.CellData;for(let v=0;v<this.length-a-o;++v)this.setCell(a+v,this.loadCell(a+o+v,p));for(let v=this.length-o;v<this.length;++v)this.setCell(v,s)}else for(let p=a;p<this.length;++p)this.setCell(p,s);a&&this.getWidth(a-1)===2&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodePoint(a,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs)}replaceCells(a,o,s,c,p=!1){if(p)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&!this.isProtected(o)&&this.setCellFromCodePoint(o,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs);a<o&&a<this.length;)this.isProtected(a)||this.setCell(a,s),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs);a<o&&a<this.length;)this.setCell(a++,s)}resize(a,o){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const c=new Uint32Array(s);c.set(this._data),this._data=c}for(let c=this.length;c<a;++c)this.setCell(c,o)}else{this._data=this._data.subarray(0,s);const c=Object.keys(this._combined);for(let v=0;v<c.length;v++){const x=parseInt(c[v],10);x>=a&&delete this._combined[x]}const p=Object.keys(this._extendedAttrs);for(let v=0;v<p.length;v++){const x=parseInt(p[v],10);x>=a&&delete this._extendedAttrs[x]}}return this.length=a,4*s*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const a=new Uint32Array(this._data.length);return a.set(this._data),this._data=a,1}return 0}fill(a,o=!1){if(o)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,a);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,a)}}copyFrom(a){this.length!==a.length?this._data=new Uint32Array(a._data):this._data.set(a._data),this.length=a.length,this._combined={};for(const o in a._combined)this._combined[o]=a._combined[o];this._extendedAttrs={};for(const o in a._extendedAttrs)this._extendedAttrs[o]=a._extendedAttrs[o];this.isWrapped=a.isWrapped}clone(){const a=new w(0);a._data=new Uint32Array(this._data),a.length=this.length;for(const o in this._combined)a._combined[o]=this._combined[o];for(const o in this._extendedAttrs)a._extendedAttrs[o]=this._extendedAttrs[o];return a.isWrapped=this.isWrapped,a}getTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0])return a+(this._data[3*a+0]>>22);return 0}getNoBgTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0]||50331648&this._data[3*a+2])return a+(this._data[3*a+0]>>22);return 0}copyCellsFrom(a,o,s,c,p){const v=a._data;if(p)for(let b=c-1;b>=0;b--){for(let y=0;y<3;y++)this._data[3*(s+b)+y]=v[3*(o+b)+y];268435456&v[3*(o+b)+2]&&(this._extendedAttrs[s+b]=a._extendedAttrs[o+b])}else for(let b=0;b<c;b++){for(let y=0;y<3;y++)this._data[3*(s+b)+y]=v[3*(o+b)+y];268435456&v[3*(o+b)+2]&&(this._extendedAttrs[s+b]=a._extendedAttrs[o+b])}const x=Object.keys(a._combined);for(let b=0;b<x.length;b++){const y=parseInt(x[b],10);y>=o&&(this._combined[y-o+s]=a._combined[y])}}translateToString(a=!1,o=0,s=this.length){a&&(s=Math.min(s,this.getTrimmedLength()));let c="";for(;o<s;){const p=this._data[3*o+0],v=2097151&p;c+=2097152&p?this._combined[o]:v?(0,m.stringFromCodePoint)(v):d.WHITESPACE_CELL_CHAR,o+=p>>22||1}return c}}l.BufferLine=w},4841:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(u,f){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return f*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(_,l)=>{function u(f,S,d){if(S===f.length-1)return f[S].getTrimmedLength();const m=!f[S].hasContent(d-1)&&f[S].getWidth(d-1)===1,C=f[S+1].getWidth(0)===2;return m&&C?d-1:d}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,S,d,m,C){const w=[];for(let g=0;g<f.length-1;g++){let a=g,o=f.get(++a);if(!o.isWrapped)continue;const s=[f.get(g)];for(;a<f.length&&o.isWrapped;)s.push(o),o=f.get(++a);if(m>=g&&m<a){g+=s.length-1;continue}let c=0,p=u(s,c,S),v=1,x=0;for(;v<s.length;){const y=u(s,v,S),k=y-x,R=d-p,O=Math.min(k,R);s[c].copyCellsFrom(s[v],x,p,O,!1),p+=O,p===d&&(c++,p=0),x+=O,x===y&&(v++,x=0),p===0&&c!==0&&s[c-1].getWidth(d-1)===2&&(s[c].copyCellsFrom(s[c-1],d-1,p++,1,!1),s[c-1].setCell(d-1,C))}s[c].replaceCells(p,d,C);let b=0;for(let y=s.length-1;y>0&&(y>c||s[y].getTrimmedLength()===0);y--)b++;b>0&&(w.push(g+s.length-b),w.push(b)),g+=s.length-1}return w},l.reflowLargerCreateNewLayout=function(f,S){const d=[];let m=0,C=S[m],w=0;for(let g=0;g<f.length;g++)if(C===g){const a=S[++m];f.onDeleteEmitter.fire({index:g-w,amount:a}),g+=a-1,w+=a,C=S[++m]}else d.push(g);return{layout:d,countRemoved:w}},l.reflowLargerApplyNewLayout=function(f,S){const d=[];for(let m=0;m<S.length;m++)d.push(f.get(S[m]));for(let m=0;m<d.length;m++)f.set(m,d[m]);f.length=S.length},l.reflowSmallerGetNewLineLengths=function(f,S,d){const m=[],C=f.map((o,s)=>u(f,s,S)).reduce((o,s)=>o+s);let w=0,g=0,a=0;for(;a<C;){if(C-a<d){m.push(C-a);break}w+=d;const o=u(f,g,S);w>o&&(w-=o,g++);const s=f[g].getWidth(w-1)===2;s&&w--;const c=s?d-1:d;m.push(c),a+=c}return m},l.getWrappedLineTrimmedLength=u},5295:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=u(8460),S=u(844),d=u(9092);class m extends S.Disposable{constructor(w,g){super(),this._optionsService=w,this._bufferService=g,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(w,g){this._normal.resize(w,g),this._alt.resize(w,g),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}l.BufferSet=m},511:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=u(482),S=u(643),d=u(3734);class m extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const g=new m;return g.setFromCharData(w),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[S.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(w[S.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(w[S.CHAR_DATA_CHAR_INDEX].length===2){const a=w[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const o=w[S.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=o&&o<=57343?this.content=1024*(a-55296)+o-56320+65536|w[S.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=w[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[S.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=w[S.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[S.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=m},643:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=u(8460),S=u(844);class d{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,S.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}l.Marker=d,d._nextId=1},7116:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(_,l)=>{var u,f,S;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
|
|
46
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(y){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),o.isLinux&&y&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(y){const k=this._getMouseBufferCoords(y),R=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(R&&O&&k)&&this._areCoordsInSelection(k,R,O)}isCellInSelection(y,k){const R=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!R||!O)&&this._areCoordsInSelection([y,k],R,O)}_areCoordsInSelection(y,k,R){return y[1]>k[1]&&y[1]<R[1]||k[1]===R[1]&&y[1]===k[1]&&y[0]>=k[0]&&y[0]<R[0]||k[1]<R[1]&&y[1]===R[1]&&y[0]<R[0]||k[1]<R[1]&&y[1]===k[1]&&y[0]>=k[0]}_selectWordAtCursor(y,k){var R,O;const T=(O=(R=this._linkifier.currentLink)===null||R===void 0?void 0:R.link)===null||O===void 0?void 0:O.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,s.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(y);return!!B&&(this._selectWordAt(B,k),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(y,k){this._model.clearSelection(),y=Math.max(y,0),k=Math.min(k,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,y],this._model.selectionEnd=[this._bufferService.cols,k],this.refresh(),this._onSelectionChange.fire()}_handleTrim(y){this._model.handleTrim(y)&&this.refresh()}_getMouseBufferCoords(y){const k=this._mouseService.getCoords(y,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(k)return k[0]--,k[1]--,k[1]+=this._bufferService.buffer.ydisp,k}_getMouseEventScrollAmount(y){let k=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,y,this._screenElement)[1];const R=this._renderService.dimensions.css.canvas.height;return k>=0&&k<=R?0:(k>R&&(k-=R),k=Math.min(Math.max(k,-50),50),k/=50,k/Math.abs(k)+Math.round(14*k))}shouldForceSelection(y){return o.isMac?y.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:y.shiftKey}handleMouseDown(y){if(this._mouseDownTimeStamp=y.timeStamp,(y.button!==2||!this.hasSelection)&&y.button===0){if(!this._enabled){if(!this.shouldForceSelection(y))return;y.stopPropagation()}y.preventDefault(),this._dragScrollAmount=0,this._enabled&&y.shiftKey?this._handleIncrementalClick(y):y.detail===1?this._handleSingleClick(y):y.detail===2?this._handleDoubleClick(y):y.detail===3&&this._handleTripleClick(y),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(y){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(y))}_handleSingleClick(y){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(y)?3:0,this._model.selectionStart=this._getMouseBufferCoords(y),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const k=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);k&&k.length!==this._model.selectionStart[0]&&k.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(y){this._selectWordAtCursor(y,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(y){const k=this._getMouseBufferCoords(y);k&&(this._activeSelectionMode=2,this._selectLineAt(k[1]))}shouldColumnSelect(y){return y.altKey&&!(o.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(y){if(y.stopImmediatePropagation(),!this._model.selectionStart)return;const k=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(y),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(y),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){const O=R.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}k&&k[0]===this._model.selectionEnd[0]&&k[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const y=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(y.ydisp+this._bufferService.rows,y.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=y.ydisp),this.refresh()}}_handleMouseUp(y){const k=y.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&k<500&&y.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const R=this._mouseService.getCoords(y,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const O=(0,m.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd,R=!(!y||!k||y[0]===k[0]&&y[1]===k[1]);R?y&&k&&(this._oldSelectionStart&&this._oldSelectionEnd&&y[0]===this._oldSelectionStart[0]&&y[1]===this._oldSelectionStart[1]&&k[0]===this._oldSelectionEnd[0]&&k[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(y,k,R)):this._oldHasSelection&&this._fireOnSelectionChange(y,k,R)}_fireOnSelectionChange(y,k,R){this._oldSelectionStart=y,this._oldSelectionEnd=k,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(y){this.clearSelection(),this._trimListener.dispose(),this._trimListener=y.activeBuffer.lines.onTrim(k=>this._handleTrim(k))}_convertViewportColToCharacterIndex(y,k){let R=k;for(let O=0;k>=O;O++){const T=y.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:T>1&&k!==O&&(R+=T-1)}return R}setSelection(y,k,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[y,k],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(y){this._isClickInSelection(y)||(this._selectWordAtCursor(y,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(y,k,R=!0,O=!0){if(y[0]>=this._bufferService.cols)return;const T=this._bufferService.buffer,B=T.lines.get(y[1]);if(!B)return;const z=T.translateBufferLineToString(y[1],!1);let I=this._convertViewportColToCharacterIndex(B,y[0]),j=I;const $=y[0]-I;let E=0,A=0,P=0,M=0;if(z.charAt(I)===" "){for(;I>0&&z.charAt(I-1)===" ";)I--;for(;j<z.length&&z.charAt(j+1)===" ";)j++}else{let X=y[0],q=y[0];B.getWidth(X)===0&&(E++,X--),B.getWidth(q)===2&&(A++,q++);const se=B.getString(q).length;for(se>1&&(M+=se-1,j+=se-1);X>0&&I>0&&!this._isCharWordSeparator(B.loadCell(X-1,this._workCell));){B.loadCell(X-1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===0?(E++,X--):D>1&&(P+=D-1,I-=D-1),I--,X--}for(;q<B.length&&j+1<z.length&&!this._isCharWordSeparator(B.loadCell(q+1,this._workCell));){B.loadCell(q+1,this._workCell);const D=this._workCell.getChars().length;this._workCell.getWidth()===2?(A++,q++):D>1&&(M+=D-1,j+=D-1),j++,q++}}j++;let H=I+$-E+P,K=Math.min(this._bufferService.cols,j-I+E+A-P-M);if(k||z.slice(I,j).trim()!==""){if(R&&H===0&&B.getCodePoint(0)!==32){const X=T.lines.get(y[1]-1);if(X&&B.isWrapped&&X.getCodePoint(this._bufferService.cols-1)!==32){const q=this._getWordAt([this._bufferService.cols-1,y[1]-1],!1,!0,!1);if(q){const se=this._bufferService.cols-q.start;H-=se,K+=se}}}if(O&&H+K===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const X=T.lines.get(y[1]+1);if(X!=null&&X.isWrapped&&X.getCodePoint(0)!==32){const q=this._getWordAt([0,y[1]+1],!1,!1,!0);q&&(K+=q.length)}}return{start:H,length:K}}}_selectWordAt(y,k){const R=this._getWordAt(y,k);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,y[1]--;this._model.selectionStart=[R.start,y[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(y){const k=this._getWordAt(y,!0);if(k){let R=y[1];for(;k.start<0;)k.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;k.start+k.length>this._bufferService.cols;)k.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?k.start:k.start+k.length,R]}}_isCharWordSeparator(y){return y.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(y.getChars())>=0}_selectLineAt(y){const k=this._bufferService.buffer.getWrappedRangeForLine(y),R={start:{x:0,y:k.first},end:{x:this._bufferService.cols-1,y:k.last}};this._model.selectionStart=[0,k.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,s.getRangeLength)(R,this._bufferService.cols)}};l.SelectionService=b=f([S(3,p.IBufferService),S(4,p.ICoreService),S(5,w.IMouseService),S(6,p.IOptionsService),S(7,w.IRenderService),S(8,w.ICoreBrowserService)],b)},4725:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=u(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService")},6731:function(_,l,u){var f=this&&this.__decorate||function(b,y,k,R){var O,T=arguments.length,B=T<3?y:R===null?R=Object.getOwnPropertyDescriptor(y,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(b,y,k,R);else for(var z=b.length-1;z>=0;z--)(O=b[z])&&(B=(T<3?O(B):T>3?O(y,k,B):O(y,k))||B);return T>3&&B&&Object.defineProperty(y,k,B),B},S=this&&this.__param||function(b,y){return function(k,R){y(k,R,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const d=u(7239),m=u(8055),C=u(8460),w=u(844),g=u(2585),a=m.css.toColor("#ffffff"),o=m.css.toColor("#000000"),s=m.css.toColor("#ffffff"),c=m.css.toColor("#000000"),p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const b=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],y=[0,95,135,175,215,255];for(let k=0;k<216;k++){const R=y[k/36%6|0],O=y[k/6%6|0],T=y[k%6];b.push({css:m.channels.toCss(R,O,T),rgba:m.channels.toRgba(R,O,T)})}for(let k=0;k<24;k++){const R=8+10*k;b.push({css:m.channels.toCss(R,R,R),rgba:m.channels.toRgba(R,R,R)})}return b})());let v=l.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(b){super(),this._optionsService=b,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:o,cursor:s,cursorAccent:c,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:m.color.blend(o,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:m.color.blend(o,p),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(b={}){const y=this._colors;if(y.foreground=x(b.foreground,a),y.background=x(b.background,o),y.cursor=x(b.cursor,s),y.cursorAccent=x(b.cursorAccent,c),y.selectionBackgroundTransparent=x(b.selectionBackground,p),y.selectionBackgroundOpaque=m.color.blend(y.background,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundTransparent=x(b.selectionInactiveBackground,y.selectionBackgroundTransparent),y.selectionInactiveBackgroundOpaque=m.color.blend(y.background,y.selectionInactiveBackgroundTransparent),y.selectionForeground=b.selectionForeground?x(b.selectionForeground,m.NULL_COLOR):void 0,y.selectionForeground===m.NULL_COLOR&&(y.selectionForeground=void 0),m.color.isOpaque(y.selectionBackgroundTransparent)&&(y.selectionBackgroundTransparent=m.color.opacity(y.selectionBackgroundTransparent,.3)),m.color.isOpaque(y.selectionInactiveBackgroundTransparent)&&(y.selectionInactiveBackgroundTransparent=m.color.opacity(y.selectionInactiveBackgroundTransparent,.3)),y.ansi=l.DEFAULT_ANSI_COLORS.slice(),y.ansi[0]=x(b.black,l.DEFAULT_ANSI_COLORS[0]),y.ansi[1]=x(b.red,l.DEFAULT_ANSI_COLORS[1]),y.ansi[2]=x(b.green,l.DEFAULT_ANSI_COLORS[2]),y.ansi[3]=x(b.yellow,l.DEFAULT_ANSI_COLORS[3]),y.ansi[4]=x(b.blue,l.DEFAULT_ANSI_COLORS[4]),y.ansi[5]=x(b.magenta,l.DEFAULT_ANSI_COLORS[5]),y.ansi[6]=x(b.cyan,l.DEFAULT_ANSI_COLORS[6]),y.ansi[7]=x(b.white,l.DEFAULT_ANSI_COLORS[7]),y.ansi[8]=x(b.brightBlack,l.DEFAULT_ANSI_COLORS[8]),y.ansi[9]=x(b.brightRed,l.DEFAULT_ANSI_COLORS[9]),y.ansi[10]=x(b.brightGreen,l.DEFAULT_ANSI_COLORS[10]),y.ansi[11]=x(b.brightYellow,l.DEFAULT_ANSI_COLORS[11]),y.ansi[12]=x(b.brightBlue,l.DEFAULT_ANSI_COLORS[12]),y.ansi[13]=x(b.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),y.ansi[14]=x(b.brightCyan,l.DEFAULT_ANSI_COLORS[14]),y.ansi[15]=x(b.brightWhite,l.DEFAULT_ANSI_COLORS[15]),b.extendedAnsi){const k=Math.min(y.ansi.length-16,b.extendedAnsi.length);for(let R=0;R<k;R++)y.ansi[R+16]=x(b.extendedAnsi[R],l.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(b){this._restoreColor(b),this._onChangeColors.fire(this.colors)}_restoreColor(b){if(b!==void 0)switch(b){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[b]=this._restoreColors.ansi[b]}else for(let y=0;y<this._restoreColors.ansi.length;++y)this._colors.ansi[y]=this._restoreColors.ansi[y]}modifyColors(b){b(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function x(b,y){if(b!==void 0)try{return m.css.toColor(b)}catch{}return y}l.ThemeService=v=f([S(0,g.IOptionsService)],v)},6349:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=u(8460),S=u(844);class d extends S.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const w=new Array(C);for(let g=0;g<Math.min(C,this.length);g++)w[g]=this._array[this._getCyclicIndex(g)];this._array=w,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let w=this._length;w<C;w++)this._array[w]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,w){this._array[this._getCyclicIndex(C)]=w}push(C){this._array[this._getCyclicIndex(this._length)]=C,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(C,w,...g){if(w){for(let a=C;a<this._length-w;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+w)];this._length-=w,this.onDeleteEmitter.fire({index:C,amount:w})}for(let a=this._length-1;a>=C;a--)this._array[this._getCyclicIndex(a+g.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<g.length;a++)this._array[this._getCyclicIndex(C+a)]=g[a];if(g.length&&this.onInsertEmitter.fire({index:C,amount:g.length}),this._length+g.length>this._maxLength){const a=this._length+g.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=g.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,w,g){if(!(w<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+g<0)throw new Error("Cannot shift elements in list beyond index 0");if(g>0){for(let o=w-1;o>=0;o--)this.set(C+o+g,this.get(C+o));const a=C+w+g-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<w;a++)this.set(C+a+g,this.get(C+a))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}l.CircularList=d},1439:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function u(f,S=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const m in f)d[m]=S<=1?f[m]:f[m]&&u(f[m],S-1);return d}},8055:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;const f=u(6114);let S=0,d=0,m=0,C=0;var w,g,a,o,s;function c(v){const x=v.toString(16);return x.length<2?"0"+x:x}function p(v,x){return v<x?(x+.05)/(v+.05):(v+.05)/(x+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},function(v){v.toCss=function(x,b,y,k){return k!==void 0?`#${c(x)}${c(b)}${c(y)}${c(k)}`:`#${c(x)}${c(b)}${c(y)}`},v.toRgba=function(x,b,y,k=255){return(x<<24|b<<16|y<<8|k)>>>0}}(w||(l.channels=w={})),function(v){function x(b,y){return C=Math.round(255*y),[S,d,m]=s.toChannels(b.rgba),{css:w.toCss(S,d,m,C),rgba:w.toRgba(S,d,m,C)}}v.blend=function(b,y){if(C=(255&y.rgba)/255,C===1)return{css:y.css,rgba:y.rgba};const k=y.rgba>>24&255,R=y.rgba>>16&255,O=y.rgba>>8&255,T=b.rgba>>24&255,B=b.rgba>>16&255,z=b.rgba>>8&255;return S=T+Math.round((k-T)*C),d=B+Math.round((R-B)*C),m=z+Math.round((O-z)*C),{css:w.toCss(S,d,m),rgba:w.toRgba(S,d,m)}},v.isOpaque=function(b){return(255&b.rgba)==255},v.ensureContrastRatio=function(b,y,k){const R=s.ensureContrastRatio(b.rgba,y.rgba,k);if(R)return s.toColor(R>>24&255,R>>16&255,R>>8&255)},v.opaque=function(b){const y=(255|b.rgba)>>>0;return[S,d,m]=s.toChannels(y),{css:w.toCss(S,d,m),rgba:y}},v.opacity=x,v.multiplyOpacity=function(b,y){return C=255&b.rgba,x(b,C*y/255)},v.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(g||(l.color=g={})),function(v){let x,b;if(!f.isNode){const y=document.createElement("canvas");y.width=1,y.height=1;const k=y.getContext("2d",{willReadFrequently:!0});k&&(x=k,x.globalCompositeOperation="copy",b=x.createLinearGradient(0,0,1,1))}v.toColor=function(y){if(y.match(/#[\da-f]{3,8}/i))switch(y.length){case 4:return S=parseInt(y.slice(1,2).repeat(2),16),d=parseInt(y.slice(2,3).repeat(2),16),m=parseInt(y.slice(3,4).repeat(2),16),s.toColor(S,d,m);case 5:return S=parseInt(y.slice(1,2).repeat(2),16),d=parseInt(y.slice(2,3).repeat(2),16),m=parseInt(y.slice(3,4).repeat(2),16),C=parseInt(y.slice(4,5).repeat(2),16),s.toColor(S,d,m,C);case 7:return{css:y,rgba:(parseInt(y.slice(1),16)<<8|255)>>>0};case 9:return{css:y,rgba:parseInt(y.slice(1),16)>>>0}}const k=y.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(k)return S=parseInt(k[1]),d=parseInt(k[2]),m=parseInt(k[3]),C=Math.round(255*(k[5]===void 0?1:parseFloat(k[5]))),s.toColor(S,d,m,C);if(!x||!b)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=b,x.fillStyle=y,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[S,d,m,C]=x.getImageData(0,0,1,1).data,C!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(S,d,m,C),css:y}}}(a||(l.css=a={})),function(v){function x(b,y,k){const R=b/255,O=y/255,T=k/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}v.relativeLuminance=function(b){return x(b>>16&255,b>>8&255,255&b)},v.relativeLuminance2=x}(o||(l.rgb=o={})),function(v){function x(y,k,R){const O=y>>24&255,T=y>>16&255,B=y>>8&255;let z=k>>24&255,I=k>>16&255,j=k>>8&255,$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));for(;$<R&&(z>0||I>0||j>0);)z-=Math.max(0,Math.ceil(.1*z)),I-=Math.max(0,Math.ceil(.1*I)),j-=Math.max(0,Math.ceil(.1*j)),$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));return(z<<24|I<<16|j<<8|255)>>>0}function b(y,k,R){const O=y>>24&255,T=y>>16&255,B=y>>8&255;let z=k>>24&255,I=k>>16&255,j=k>>8&255,$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));for(;$<R&&(z<255||I<255||j<255);)z=Math.min(255,z+Math.ceil(.1*(255-z))),I=Math.min(255,I+Math.ceil(.1*(255-I))),j=Math.min(255,j+Math.ceil(.1*(255-j))),$=p(o.relativeLuminance2(z,I,j),o.relativeLuminance2(O,T,B));return(z<<24|I<<16|j<<8|255)>>>0}v.ensureContrastRatio=function(y,k,R){const O=o.relativeLuminance(y>>8),T=o.relativeLuminance(k>>8);if(p(O,T)<R){if(T<O){const I=x(y,k,R),j=p(O,o.relativeLuminance(I>>8));if(j<R){const $=b(y,k,R);return j>p(O,o.relativeLuminance($>>8))?I:$}return I}const B=b(y,k,R),z=p(O,o.relativeLuminance(B>>8));if(z<R){const I=x(y,k,R);return z>p(O,o.relativeLuminance(I>>8))?B:I}return B}},v.reduceLuminance=x,v.increaseLuminance=b,v.toChannels=function(y){return[y>>24&255,y>>16&255,y>>8&255,255&y]},v.toColor=function(y,k,R,O){return{css:w.toCss(y,k,R,O),rgba:w.toRgba(y,k,R,O)}}}(s||(l.rgba=s={})),l.toPaddedHex=c,l.contrastRatio=p},8969:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=u(844),S=u(2585),d=u(4348),m=u(7866),C=u(744),w=u(7302),g=u(6975),a=u(8460),o=u(1753),s=u(1480),c=u(7994),p=u(9282),v=u(5435),x=u(5981),b=u(2660);let y=!1;class k extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event(O=>{var T;(T=this._onScrollApi)===null||T===void 0||T.fire(O.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(const T in O)this.optionsService.options[T]=O[T]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new a.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new a.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(O)),this._instantiationService.setService(S.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(S.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(S.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(g.CoreService)),this._instantiationService.setService(S.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(S.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(S.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c.CharsetService),this._instantiationService.setService(S.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b.OscLinkService),this._instantiationService.setService(S.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,a.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,a.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,a.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,a.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(T=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(T=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new x.WriteBuffer((T,B)=>this._inputHandler.parse(T,B))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,T){this._writeBuffer.write(O,T)}writeSync(O,T){this._logService.logLevel<=S.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(O,T)}resize(O,T){isNaN(O)||isNaN(T)||(O=Math.max(O,C.MINIMUM_COLS),T=Math.max(T,C.MINIMUM_ROWS),this._bufferService.resize(O,T))}scroll(O,T=!1){this._bufferService.scroll(O,T)}scrollLines(O,T,B){this._bufferService.scrollLines(O,T,B)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const T=O-this._bufferService.buffer.ydisp;T!==0&&this.scrollLines(T)}registerEscHandler(O,T){return this._inputHandler.registerEscHandler(O,T)}registerDcsHandler(O,T){return this._inputHandler.registerDcsHandler(O,T)}registerCsiHandler(O,T){return this._inputHandler.registerCsiHandler(O,T)}registerOscHandler(O,T){return this._inputHandler.registerOscHandler(O,T)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const T=this.optionsService.rawOptions.windowsPty;T&&T.buildNumber!==void 0&&T.buildNumber!==void 0?O=T.backend==="conpty"&&T.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(p.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},()=>((0,p.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)(()=>{for(const T of O)T.dispose()})}}}l.CoreTerminal=k},8460:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===u)return void this._listeners.splice(f,1)}}})),this._event}fire(u,f){const S=[];for(let d=0;d<this._listeners.length;d++)S.push(this._listeners[d]);for(let d=0;d<S.length;d++)S[d].call(void 0,u,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(u,f){return u(S=>f.fire(S))}},5435:function(_,l,u){var f=this&&this.__decorate||function($,E,A,P){var M,H=arguments.length,K=H<3?E:P===null?P=Object.getOwnPropertyDescriptor(E,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,E,A,P);else for(var X=$.length-1;X>=0;X--)(M=$[X])&&(K=(H<3?M(K):H>3?M(E,A,K):M(E,A))||K);return H>3&&K&&Object.defineProperty(E,A,K),K},S=this&&this.__param||function($,E){return function(A,P){E(A,P,$)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const d=u(2584),m=u(7116),C=u(2015),w=u(844),g=u(482),a=u(8437),o=u(8460),s=u(643),c=u(511),p=u(3734),v=u(2585),x=u(6242),b=u(6351),y=u(5941),k={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function O($,E){if($>24)return E.setWinLines||!1;switch($){case 1:return!!E.restoreWin;case 2:return!!E.minimizeWin;case 3:return!!E.setWinPosition;case 4:return!!E.setWinSizePixels;case 5:return!!E.raiseWin;case 6:return!!E.lowerWin;case 7:return!!E.refreshWin;case 8:return!!E.setWinSizeChars;case 9:return!!E.maximizeWin;case 10:return!!E.fullscreenWin;case 11:return!!E.getWinState;case 13:return!!E.getWinPosition;case 14:return!!E.getWinSizePixels;case 15:return!!E.getScreenSizePixels;case 16:return!!E.getCellSizePixels;case 18:return!!E.getWinSizeChars;case 19:return!!E.getScreenSizeChars;case 20:return!!E.getIconTitle;case 21:return!!E.getWinTitle;case 22:return!!E.pushTitle;case 23:return!!E.popTitle;case 24:return!!E.setWinLines}return!1}var T;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(T||(l.WindowsOptionsReportType=T={}));let B=0;class z extends w.Disposable{getAttrData(){return this._curAttrData}constructor(E,A,P,M,H,K,X,q,se=new C.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=A,this._coreService=P,this._logService=M,this._optionsService=H,this._oscLinkService=K,this._coreMouseService=X,this._unicodeService=q,this._parser=se,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new g.StringToUtf32,this._utf8Decoder=new g.Utf8ToUtf32,this._workCell=new c.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new o.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new o.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new o.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new o.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new o.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new o.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new o.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new o.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new o.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new o.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new o.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(D=>this._activeBuffer=D.activeBuffer)),this._parser.setCsiHandlerFallback((D,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:F.toArray()})}),this._parser.setEscHandlerFallback(D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})}),this._parser.setExecuteHandlerFallback(D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})}),this._parser.setOscHandlerFallback((D,F,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:F,data:W})}),this._parser.setDcsHandlerFallback((D,F,W)=>{F==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:F,payload:W})}),this._parser.setPrintHandler((D,F,W)=>this.print(D,F,W)),this._parser.registerCsiHandler({final:"@"},D=>this.insertChars(D)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},D=>this.scrollLeft(D)),this._parser.registerCsiHandler({final:"A"},D=>this.cursorUp(D)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},D=>this.scrollRight(D)),this._parser.registerCsiHandler({final:"B"},D=>this.cursorDown(D)),this._parser.registerCsiHandler({final:"C"},D=>this.cursorForward(D)),this._parser.registerCsiHandler({final:"D"},D=>this.cursorBackward(D)),this._parser.registerCsiHandler({final:"E"},D=>this.cursorNextLine(D)),this._parser.registerCsiHandler({final:"F"},D=>this.cursorPrecedingLine(D)),this._parser.registerCsiHandler({final:"G"},D=>this.cursorCharAbsolute(D)),this._parser.registerCsiHandler({final:"H"},D=>this.cursorPosition(D)),this._parser.registerCsiHandler({final:"I"},D=>this.cursorForwardTab(D)),this._parser.registerCsiHandler({final:"J"},D=>this.eraseInDisplay(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},D=>this.eraseInDisplay(D,!0)),this._parser.registerCsiHandler({final:"K"},D=>this.eraseInLine(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},D=>this.eraseInLine(D,!0)),this._parser.registerCsiHandler({final:"L"},D=>this.insertLines(D)),this._parser.registerCsiHandler({final:"M"},D=>this.deleteLines(D)),this._parser.registerCsiHandler({final:"P"},D=>this.deleteChars(D)),this._parser.registerCsiHandler({final:"S"},D=>this.scrollUp(D)),this._parser.registerCsiHandler({final:"T"},D=>this.scrollDown(D)),this._parser.registerCsiHandler({final:"X"},D=>this.eraseChars(D)),this._parser.registerCsiHandler({final:"Z"},D=>this.cursorBackwardTab(D)),this._parser.registerCsiHandler({final:"`"},D=>this.charPosAbsolute(D)),this._parser.registerCsiHandler({final:"a"},D=>this.hPositionRelative(D)),this._parser.registerCsiHandler({final:"b"},D=>this.repeatPrecedingCharacter(D)),this._parser.registerCsiHandler({final:"c"},D=>this.sendDeviceAttributesPrimary(D)),this._parser.registerCsiHandler({prefix:">",final:"c"},D=>this.sendDeviceAttributesSecondary(D)),this._parser.registerCsiHandler({final:"d"},D=>this.linePosAbsolute(D)),this._parser.registerCsiHandler({final:"e"},D=>this.vPositionRelative(D)),this._parser.registerCsiHandler({final:"f"},D=>this.hVPosition(D)),this._parser.registerCsiHandler({final:"g"},D=>this.tabClear(D)),this._parser.registerCsiHandler({final:"h"},D=>this.setMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"h"},D=>this.setModePrivate(D)),this._parser.registerCsiHandler({final:"l"},D=>this.resetMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"l"},D=>this.resetModePrivate(D)),this._parser.registerCsiHandler({final:"m"},D=>this.charAttributes(D)),this._parser.registerCsiHandler({final:"n"},D=>this.deviceStatus(D)),this._parser.registerCsiHandler({prefix:"?",final:"n"},D=>this.deviceStatusPrivate(D)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},D=>this.softReset(D)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},D=>this.setCursorStyle(D)),this._parser.registerCsiHandler({final:"r"},D=>this.setScrollRegion(D)),this._parser.registerCsiHandler({final:"s"},D=>this.saveCursor(D)),this._parser.registerCsiHandler({final:"t"},D=>this.windowOptions(D)),this._parser.registerCsiHandler({final:"u"},D=>this.restoreCursor(D)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},D=>this.insertColumns(D)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},D=>this.deleteColumns(D)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},D=>this.selectProtected(D)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},D=>this.requestMode(D,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},D=>this.requestMode(D,!1)),this._parser.setExecuteHandler(d.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(d.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(d.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(d.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(d.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(d.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(d.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(d.C1.IND,()=>this.index()),this._parser.setExecuteHandler(d.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(d.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new x.OscHandler(D=>(this.setTitle(D),this.setIconName(D),!0))),this._parser.registerOscHandler(1,new x.OscHandler(D=>this.setIconName(D))),this._parser.registerOscHandler(2,new x.OscHandler(D=>this.setTitle(D))),this._parser.registerOscHandler(4,new x.OscHandler(D=>this.setOrReportIndexedColor(D))),this._parser.registerOscHandler(8,new x.OscHandler(D=>this.setHyperlink(D))),this._parser.registerOscHandler(10,new x.OscHandler(D=>this.setOrReportFgColor(D))),this._parser.registerOscHandler(11,new x.OscHandler(D=>this.setOrReportBgColor(D))),this._parser.registerOscHandler(12,new x.OscHandler(D=>this.setOrReportCursorColor(D))),this._parser.registerOscHandler(104,new x.OscHandler(D=>this.restoreIndexedColor(D))),this._parser.registerOscHandler(110,new x.OscHandler(D=>this.restoreFgColor(D))),this._parser.registerOscHandler(111,new x.OscHandler(D=>this.restoreBgColor(D))),this._parser.registerOscHandler(112,new x.OscHandler(D=>this.restoreCursorColor(D))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const D in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},()=>this.selectCharset("("+D)),this._parser.registerEscHandler({intermediates:")",final:D},()=>this.selectCharset(")"+D)),this._parser.registerEscHandler({intermediates:"*",final:D},()=>this.selectCharset("*"+D)),this._parser.registerEscHandler({intermediates:"+",final:D},()=>this.selectCharset("+"+D)),this._parser.registerEscHandler({intermediates:"-",final:D},()=>this.selectCharset("-"+D)),this._parser.registerEscHandler({intermediates:".",final:D},()=>this.selectCharset("."+D)),this._parser.registerEscHandler({intermediates:"/",final:D},()=>this.selectCharset("/"+D));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(D=>(this._logService.error("Parsing error: ",D),D)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler((D,F)=>this.requestStatusString(D,F)))}_preserveStack(E,A,P,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=A,this._parseStack.decodedLength=P,this._parseStack.position=M}_logSlowResolvingAsync(E){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([E,new Promise((A,P)=>setTimeout(()=>P("#SLOW_TIMEOUT"),5e3))]).catch(A=>{if(A!=="#SLOW_TIMEOUT")throw A;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,A){let P,M=this._activeBuffer.x,H=this._activeBuffer.y,K=0;const X=this._parseStack.paused;if(X){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,A))return this._logSlowResolvingAsync(P),P;M=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>R&&(K=this._parseStack.position+R)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,q=>String.fromCharCode(q)).join("")}"`),typeof E=="string"?E.split("").map(q=>q.charCodeAt(0)):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<R&&(this._parseBuffer=new Uint32Array(Math.min(E.length,R))),X||this._dirtyRowTracker.clearRange(),E.length>R)for(let q=K;q<E.length;q+=R){const se=q+R<E.length?q+R:E.length,D=typeof E=="string"?this._stringDecoder.decode(E.substring(q,se),this._parseBuffer):this._utf8Decoder.decode(E.subarray(q,se),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,D))return this._preserveStack(M,H,D,q),this._logSlowResolvingAsync(P),P}else if(!X){const q=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,q))return this._preserveStack(M,H,q,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===M&&this._activeBuffer.y===H||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(E,A,P){let M,H;const K=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,q=this._bufferService.cols,se=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,F=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-A>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let U=A;U<P;++U){if(M=E[U],H=this._unicodeService.wcwidth(M),M<127&&K){const re=K[String.fromCharCode(M)];re&&(M=re.charCodeAt(0))}if(X&&this._onA11yChar.fire((0,g.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),H||!this._activeBuffer.x){if(this._activeBuffer.x+H-1>=q){if(se){for(;this._activeBuffer.x<q;)W.setCellFromCodePoint(this._activeBuffer.x++,0,1,F.fg,F.bg,F.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=q-1,H===2)continue}if(D&&(W.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(F),F),W.getWidth(q-1)===2&&W.setCellFromCodePoint(q-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),W.setCellFromCodePoint(this._activeBuffer.x++,M,H,F.fg,F.bg,F.extended),H>0)for(;--H;)W.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else W.getWidth(this._activeBuffer.x-1)?W.addCodepointToCell(this._activeBuffer.x-1,M):W.addCodepointToCell(this._activeBuffer.x-2,M)}P-A>0&&(W.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<q&&P-A>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,A){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,A):this._parser.registerCsiHandler(E,P=>!O(P.params[0],this._optionsService.rawOptions.windowOptions)||A(P))}registerDcsHandler(E,A){return this._parser.registerDcsHandler(E,new b.DcsHandler(A))}registerEscHandler(E,A){return this._parser.registerEscHandler(E,A)}registerOscHandler(E,A){return this._parser.registerOscHandler(E,new x.OscHandler(A))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var E;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||E===void 0)&&E.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);A.hasWidth(this._activeBuffer.x)&&!A.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(E,A){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+A):(this._activeBuffer.x=E,this._activeBuffer.y=A),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,A){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+A)}cursorUp(E){const A=this._activeBuffer.y-this._activeBuffer.scrollTop;return A>=0?this._moveCursor(0,-Math.min(A,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){const A=this._activeBuffer.scrollBottom-this._activeBuffer.y;return A>=0?this._moveCursor(0,Math.min(A,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){const A=E.params[0];return A===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:A===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=E.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=E.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){const A=E.params[0];return A===1&&(this._curAttrData.bg|=536870912),A!==2&&A!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,A,P,M=!1,H=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);K.replaceCells(A,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),H),M&&(K.isWrapped=!1)}_resetBufferLine(E,A=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),A),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),P.isWrapped=!1)}eraseInDisplay(E,A=!1){let P;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);P<this._bufferService.rows;P++)this._resetBufferLine(P,A);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,A),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,A);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,A);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(E,A=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,A);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,A)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let A=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;A--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let A=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;A--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let A=E.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(E){let A=E.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(a.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.deleteCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.insertCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);M.deleteCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){if(!this._parser.precedingCodepoint)return!0;const A=E.params[0]||1,P=new Uint32Array(A);for(let M=0;M<A;++M)P[M]=this._parser.precedingCodepoint;return this.print(P,0,P.length),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[A]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(E,A){const P=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:H}=this._coreMouseService,K=this._coreService,{buffers:X,cols:q}=this._bufferService,{active:se,alt:D}=X,F=this._optionsService.rawOptions,W=ae=>ae?1:2,U=E.params[0];return re=U,Q=A?U===2?4:U===4?W(K.modes.insertMode):U===12?3:U===20?W(F.convertEol):0:U===1?W(P.applicationCursorKeys):U===3?F.windowOptions.setWinLines?q===80?2:q===132?1:0:0:U===6?W(P.origin):U===7?W(P.wraparound):U===8?3:U===9?W(M==="X10"):U===12?W(F.cursorBlink):U===25?W(!K.isCursorHidden):U===45?W(P.reverseWraparound):U===66?W(P.applicationKeypad):U===67?4:U===1e3?W(M==="VT200"):U===1002?W(M==="DRAG"):U===1003?W(M==="ANY"):U===1004?W(P.sendFocus):U===1005?4:U===1006?W(H==="SGR"):U===1015?4:U===1016?W(H==="SGR_PIXELS"):U===1048?1:U===47||U===1047||U===1049?W(se===D):U===2004?W(P.bracketedPasteMode):0,K.triggerDataEvent(`${d.C0.ESC}[${A?"":"?"}${re};${Q}$y`),!0;var re,Q}_updateAttrColor(E,A,P,M,H){return A===2?(E|=50331648,E&=-16777216,E|=p.AttributeData.fromColorRGB([P,M,H])):A===5&&(E&=-50331904,E|=33554432|255&P),E}_extractColor(E,A,P){const M=[0,0,-1,0,0,0];let H=0,K=0;do{if(M[K+H]=E.params[A+K],E.hasSubParams(A+K)){const X=E.getSubParams(A+K);let q=0;do M[1]===5&&(H=1),M[K+q+1+H]=X[q];while(++q<X.length&&q+K+1+H<M.length);break}if(M[1]===5&&K+H>=2||M[1]===2&&K+H>=5)break;M[1]&&(H=1)}while(++K+A<E.length&&K+H<M.length);for(let X=2;X<M.length;++X)M[X]===-1&&(M[X]=0);switch(M[0]){case 38:P.fg=this._updateAttrColor(P.fg,M[1],M[3],M[4],M[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,M[1],M[3],M[4],M[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,M[1],M[3],M[4],M[5])}return K}_processUnderline(E,A){A.extended=A.extended.clone(),(!~E||E>5)&&(E=1),A.extended.underlineStyle=E,A.fg|=268435456,E===0&&(A.fg&=-268435457),A.updateExtended()}_processSGR0(E){E.fg=a.DEFAULT_ATTR_DATA.fg,E.bg=a.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;const A=E.length;let P;const M=this._curAttrData;for(let H=0;H<A;H++)P=E.params[H],P>=30&&P<=37?(M.fg&=-50331904,M.fg|=16777216|P-30):P>=40&&P<=47?(M.bg&=-50331904,M.bg|=16777216|P-40):P>=90&&P<=97?(M.fg&=-50331904,M.fg|=16777224|P-90):P>=100&&P<=107?(M.bg&=-50331904,M.bg|=16777224|P-100):P===0?this._processSGR0(M):P===1?M.fg|=134217728:P===3?M.bg|=67108864:P===4?(M.fg|=268435456,this._processUnderline(E.hasSubParams(H)?E.getSubParams(H)[0]:1,M)):P===5?M.fg|=536870912:P===7?M.fg|=67108864:P===8?M.fg|=1073741824:P===9?M.fg|=2147483648:P===2?M.bg|=134217728:P===21?this._processUnderline(2,M):P===22?(M.fg&=-134217729,M.bg&=-134217729):P===23?M.bg&=-67108865:P===24?(M.fg&=-268435457,this._processUnderline(0,M)):P===25?M.fg&=-536870913:P===27?M.fg&=-67108865:P===28?M.fg&=-1073741825:P===29?M.fg&=2147483647:P===39?(M.fg&=-67108864,M.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):P===49?(M.bg&=-67108864,M.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?H+=this._extractColor(E,H,M):P===53?M.bg|=1073741824:P===55?M.bg&=-1073741825:P===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):P===100?(M.fg&=-67108864,M.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const A=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${A};${P}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){const A=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${A};${P}R`)}return!0}softReset(E){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(E){const A=E.params[0]||1;switch(A){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const P=A%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(E){const A=E.params[0]||1;let P;return(E.length<2||(P=E.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>A&&(this._activeBuffer.scrollTop=A-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(E){if(!O(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;const A=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:A!==2&&this._onRequestWindowsOptionsReport.fire(T.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(T.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:A!==0&&A!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),A!==0&&A!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:A!==0&&A!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),A!==0&&A!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(E){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){const A=[],P=E.split(";");for(;P.length>1;){const M=P.shift(),H=P.shift();if(/^\d+$/.exec(M)){const K=parseInt(M);if(j(K))if(H==="?")A.push({type:0,index:K});else{const X=(0,y.parseColor)(H);X&&A.push({type:1,index:K,color:X})}}}return A.length&&this._onColor.fire(A),!0}setHyperlink(E){const A=E.split(";");return!(A.length<2)&&(A[1]?this._createHyperlink(A[0],A[1]):!A[0]&&this._finishHyperlink())}_createHyperlink(E,A){this._getCurrentLinkId()&&this._finishHyperlink();const P=E.split(":");let M;const H=P.findIndex(K=>K.startsWith("id="));return H!==-1&&(M=P[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:A}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,A){const P=E.split(";");for(let M=0;M<P.length&&!(A>=this._specialColors.length);++M,++A)if(P[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[A]}]);else{const H=(0,y.parseColor)(P[M]);H&&this._onColor.fire([{type:1,index:this._specialColors[A],color:H}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;const A=[],P=E.split(";");for(let M=0;M<P.length;++M)if(/^\d+$/.exec(P[M])){const H=parseInt(P[M]);j(H)&&A.push({type:2,index:H})}return A.length&&this._onColor.fire(A),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(k[E[0]],m.CHARSETS[E[1]]||m.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){const E=new c.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let A=0;A<this._bufferService.rows;++A){const P=this._activeBuffer.ybase+this._activeBuffer.y+A,M=this._activeBuffer.lines.get(P);M&&(M.fill(E),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,A){const P=this._bufferService.buffer,M=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${H}${d.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,A){this._dirtyRowTracker.markRangeDirty(E,A)}}l.InputHandler=z;let I=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,E){$>E&&(B=$,$=E,E=B),$<this.start&&(this.start=$),E>this.end&&(this.end=E)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function j($){return 0<=$&&$<256}I=f([S(0,v.IBufferService)],I)},844:(_,l)=>{function u(f){for(const S of f)S.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const S=this._disposables.indexOf(f);S!==-1&&this._disposables.splice(S,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var S;this._isDisposed||f===this._value||((S=this._value)===null||S===void 0||S.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)===null||f===void 0||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=u,l.getDisposeArrayDisposable=function(f){return{dispose:()=>u(f)}}},1505:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(S,d,m){this._data[S]||(this._data[S]={}),this._data[S][d]=m}get(S,d){return this._data[S]?this._data[S][d]:void 0}clear(){this._data={}}}l.TwoKeyMap=u,l.FourKeyMap=class{constructor(){this._data=new u}set(f,S,d,m,C){this._data.get(f,S)||this._data.set(f,S,new u),this._data.get(f,S).set(d,m,C)}get(f,S,d,m){var C;return(C=this._data.get(f,S))===null||C===void 0?void 0:C.get(d,m)}clear(){this._data.clear()}}},6114:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof navigator>"u";const u=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=u.includes("Firefox"),l.isLegacyEdge=u.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(u),l.getSafariVersion=function(){if(!l.isSafari)return 0;const S=u.match(/Version\/(\d+)/);return S===null||S.length<2?0:parseInt(S[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(u)},6106:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let u=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(u=this._search(this._getKey(f)),this._array.splice(u,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const S=this._getKey(f);if(S===void 0||(u=this._search(S),u===-1)||this._getKey(this._array[u])!==S)return!1;do if(this._array[u]===f)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===S);return!1}*getKeyIterator(f){if(this._array.length!==0&&(u=this._search(f),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===f))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===f)}forEachByKey(f,S){if(this._array.length!==0&&(u=this._search(f),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===f))do S(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===f)}values(){return[...this._array].values()}_search(f){let S=0,d=this._array.length-1;for(;d>=S;){let m=S+d>>1;const C=this._getKey(this._array[m]);if(C>f)d=m-1;else{if(!(C<f)){for(;m>0&&this._getKey(this._array[m-1])===f;)m--;return m}S=m+1}}return S}}},7226:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=u(6114);class S{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(C){this._idleCallback=void 0;let w=0,g=0,a=C.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),g=Math.max(w,g),o=C.timeRemaining(),1.5*g>o)return a-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-w))}ms`),void this._start();a=o}this.clear()}}class d extends S{_requestCallback(C){return setTimeout(()=>C(this._createDeadline(16)))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const w=Date.now()+C;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}l.PriorityTaskQueue=d,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends S{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:d,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=u(643);l.updateWindowsModeWrappedState=function(S){const d=S.buffer.lines.get(S.buffer.ybase+S.buffer.y-1),m=d==null?void 0:d.get(S.cols-1),C=S.buffer.lines.get(S.buffer.ybase+S.buffer.y);C&&m&&(C.isWrapped=m[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&m[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new u;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}l.AttributeData=u;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}constructor(d=0,m=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=m}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=u(6349),S=u(7226),d=u(3734),m=u(8437),C=u(4634),w=u(511),g=u(643),a=u(4863),o=u(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(s,c,p){this._hasScrollback=s,this._optionsService=c,this._bufferService=p,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new S.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,c){return new m.BufferLine(this._bufferService.cols,this.getNullCell(s),c)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const c=s+this._optionsService.rawOptions.scrollback;return c>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:c}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=m.DEFAULT_ATTR_DATA);let c=this._rows;for(;c--;)this.lines.push(this.getBlankLine(s))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(s,c){const p=this.getNullCell(m.DEFAULT_ATTR_DATA);let v=0;const x=this._getCorrectBufferLength(c);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<s)for(let y=0;y<this.lines.length;y++)v+=+this.lines.get(y).resize(s,p);let b=0;if(this._rows<c)for(let y=this._rows;y<c;y++)this.lines.length<c+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(s,p)):this.ybase>0&&this.lines.length<=this.ybase+this.y+b+1?(this.ybase--,b++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(s,p)));else for(let y=this._rows;y>c;y--)this.lines.length>c+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const y=this.lines.length-x;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=x}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,c-1),b&&(this.y+=b),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=c-1,this._isReflowEnabled&&(this._reflow(s,c),this._cols>s))for(let b=0;b<this.lines.length;b++)v+=+this.lines.get(b).resize(s,p);this._cols=s,this._rows=c,this._memoryCleanupQueue.clear(),v>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let c=0;for(;this._memoryCleanupPosition<this.lines.length;)if(c+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),c>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,c){this._cols!==s&&(s>this._cols?this._reflowLarger(s,c):this._reflowSmaller(s,c))}_reflowLarger(s,c){const p=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(p.length>0){const v=(0,C.reflowLargerCreateNewLayout)(this.lines,p);(0,C.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(s,c,v.countRemoved)}}_reflowLargerAdjustViewport(s,c,p){const v=this.getNullCell(m.DEFAULT_ATTR_DATA);let x=p;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<c&&this.lines.push(new m.BufferLine(s,v))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-p,0)}_reflowSmaller(s,c){const p=this.getNullCell(m.DEFAULT_ATTR_DATA),v=[];let x=0;for(let b=this.lines.length-1;b>=0;b--){let y=this.lines.get(b);if(!y||!y.isWrapped&&y.getTrimmedLength()<=s)continue;const k=[y];for(;y.isWrapped&&b>0;)y=this.lines.get(--b),k.unshift(y);const R=this.ybase+this.y;if(R>=b&&R<b+k.length)continue;const O=k[k.length-1].getTrimmedLength(),T=(0,C.reflowSmallerGetNewLineLengths)(k,this._cols,s),B=T.length-k.length;let z;z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const I=[];for(let M=0;M<B;M++){const H=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);I.push(H)}I.length>0&&(v.push({start:b+k.length+x,newLines:I}),x+=I.length),k.push(...I);let j=T.length-1,$=T[j];$===0&&(j--,$=T[j]);let E=k.length-B-1,A=O;for(;E>=0;){const M=Math.min(A,$);if(k[j]===void 0)break;if(k[j].copyCellsFrom(k[E],A-M,$-M,M,!0),$-=M,$===0&&(j--,$=T[j]),A-=M,A===0){E--;const H=Math.max(E,0);A=(0,C.getWrappedLineTrimmedLength)(k,H,this._cols)}}for(let M=0;M<k.length;M++)T[M]<s&&k[M].setCell(T[M],p);let P=B-z;for(;P-- >0;)this.ybase===0?this.y<c-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-c&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+c-1)}if(v.length>0){const b=[],y=[];for(let j=0;j<this.lines.length;j++)y.push(this.lines.get(j));const k=this.lines.length;let R=k-1,O=0,T=v[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let B=0;for(let j=Math.min(this.lines.maxLength-1,k+x-1);j>=0;j--)if(T&&T.start>R+B){for(let $=T.newLines.length-1;$>=0;$--)this.lines.set(j--,T.newLines[$]);j++,b.push({index:R+1,amount:T.newLines.length}),B+=T.newLines.length,T=v[++O]}else this.lines.set(j,y[R--]);let z=0;for(let j=b.length-1;j>=0;j--)b[j].index+=z,this.lines.onInsertEmitter.fire(b[j]),z+=b[j].amount;const I=Math.max(0,k+x-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(s,c,p=0,v){const x=this.lines.get(s);return x?x.translateToString(c,p,v):""}getWrappedRangeForLine(s){let c=s,p=s;for(;c>0&&this.lines.get(c).isWrapped;)c--;for(;p+1<this.lines.length&&this.lines.get(p+1).isWrapped;)p++;return{first:c,last:p}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].line===s&&(this.markers[c].dispose(),this.markers.splice(c--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const c=new a.Marker(s);return this.markers.push(c),c.register(this.lines.onTrim(p=>{c.line-=p,c.line<0&&c.dispose()})),c.register(this.lines.onInsert(p=>{c.line>=p.index&&(c.line+=p.amount)})),c.register(this.lines.onDelete(p=>{c.line>=p.index&&c.line<p.index+p.amount&&c.dispose(),c.line>p.index&&(c.line-=p.amount)})),c.register(c.onDispose(()=>this._removeMarker(c))),c}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=u(3734),S=u(511),d=u(643),m=u(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let C=0;class w{constructor(a,o,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);const c=o||S.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let p=0;p<a;++p)this.setCell(p,c);this.length=a}get(a){const o=this._data[3*a+0],s=2097151&o;return[this._data[3*a+1],2097152&o?this._combined[a]:s?(0,m.stringFromCodePoint)(s):"",o>>22,2097152&o?this._combined[a].charCodeAt(this._combined[a].length-1):s]}set(a,o){this._data[3*a+1]=o[d.CHAR_DATA_ATTR_INDEX],o[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=o[1],this._data[3*a+0]=2097152|a|o[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=o[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(a){return this._data[3*a+0]>>22}hasWidth(a){return 12582912&this._data[3*a+0]}getFg(a){return this._data[3*a+1]}getBg(a){return this._data[3*a+2]}hasContent(a){return 4194303&this._data[3*a+0]}getCodePoint(a){const o=this._data[3*a+0];return 2097152&o?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&o}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){const o=this._data[3*a+0];return 2097152&o?this._combined[a]:2097151&o?(0,m.stringFromCodePoint)(2097151&o):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,o){return C=3*a,o.content=this._data[C+0],o.fg=this._data[C+1],o.bg=this._data[C+2],2097152&o.content&&(o.combinedData=this._combined[a]),268435456&o.bg&&(o.extended=this._extendedAttrs[a]),o}setCell(a,o){2097152&o.content&&(this._combined[a]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[a]=o.extended),this._data[3*a+0]=o.content,this._data[3*a+1]=o.fg,this._data[3*a+2]=o.bg}setCellFromCodePoint(a,o,s,c,p,v){268435456&p&&(this._extendedAttrs[a]=v),this._data[3*a+0]=o|s<<22,this._data[3*a+1]=c,this._data[3*a+2]=p}addCodepointToCell(a,o){let s=this._data[3*a+0];2097152&s?this._combined[a]+=(0,m.stringFromCodePoint)(o):(2097151&s?(this._combined[a]=(0,m.stringFromCodePoint)(2097151&s)+(0,m.stringFromCodePoint)(o),s&=-2097152,s|=2097152):s=o|4194304,this._data[3*a+0]=s)}insertCells(a,o,s,c){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),o<this.length-a){const p=new S.CellData;for(let v=this.length-a-o-1;v>=0;--v)this.setCell(a+o+v,this.loadCell(a+v,p));for(let v=0;v<o;++v)this.setCell(a+v,s)}else for(let p=a;p<this.length;++p)this.setCell(p,s);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs)}deleteCells(a,o,s,c){if(a%=this.length,o<this.length-a){const p=new S.CellData;for(let v=0;v<this.length-a-o;++v)this.setCell(a+v,this.loadCell(a+o+v,p));for(let v=this.length-o;v<this.length;++v)this.setCell(v,s)}else for(let p=a;p<this.length;++p)this.setCell(p,s);a&&this.getWidth(a-1)===2&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodePoint(a,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs)}replaceCells(a,o,s,c,p=!1){if(p)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&!this.isProtected(o)&&this.setCellFromCodePoint(o,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs);a<o&&a<this.length;)this.isProtected(a)||this.setCell(a,s),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodePoint(a-1,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o,0,1,(c==null?void 0:c.fg)||0,(c==null?void 0:c.bg)||0,(c==null?void 0:c.extended)||new f.ExtendedAttrs);a<o&&a<this.length;)this.setCell(a++,s)}resize(a,o){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const c=new Uint32Array(s);c.set(this._data),this._data=c}for(let c=this.length;c<a;++c)this.setCell(c,o)}else{this._data=this._data.subarray(0,s);const c=Object.keys(this._combined);for(let v=0;v<c.length;v++){const x=parseInt(c[v],10);x>=a&&delete this._combined[x]}const p=Object.keys(this._extendedAttrs);for(let v=0;v<p.length;v++){const x=parseInt(p[v],10);x>=a&&delete this._extendedAttrs[x]}}return this.length=a,4*s*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const a=new Uint32Array(this._data.length);return a.set(this._data),this._data=a,1}return 0}fill(a,o=!1){if(o)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,a);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,a)}}copyFrom(a){this.length!==a.length?this._data=new Uint32Array(a._data):this._data.set(a._data),this.length=a.length,this._combined={};for(const o in a._combined)this._combined[o]=a._combined[o];this._extendedAttrs={};for(const o in a._extendedAttrs)this._extendedAttrs[o]=a._extendedAttrs[o];this.isWrapped=a.isWrapped}clone(){const a=new w(0);a._data=new Uint32Array(this._data),a.length=this.length;for(const o in this._combined)a._combined[o]=this._combined[o];for(const o in this._extendedAttrs)a._extendedAttrs[o]=this._extendedAttrs[o];return a.isWrapped=this.isWrapped,a}getTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0])return a+(this._data[3*a+0]>>22);return 0}getNoBgTrimmedLength(){for(let a=this.length-1;a>=0;--a)if(4194303&this._data[3*a+0]||50331648&this._data[3*a+2])return a+(this._data[3*a+0]>>22);return 0}copyCellsFrom(a,o,s,c,p){const v=a._data;if(p)for(let b=c-1;b>=0;b--){for(let y=0;y<3;y++)this._data[3*(s+b)+y]=v[3*(o+b)+y];268435456&v[3*(o+b)+2]&&(this._extendedAttrs[s+b]=a._extendedAttrs[o+b])}else for(let b=0;b<c;b++){for(let y=0;y<3;y++)this._data[3*(s+b)+y]=v[3*(o+b)+y];268435456&v[3*(o+b)+2]&&(this._extendedAttrs[s+b]=a._extendedAttrs[o+b])}const x=Object.keys(a._combined);for(let b=0;b<x.length;b++){const y=parseInt(x[b],10);y>=o&&(this._combined[y-o+s]=a._combined[y])}}translateToString(a=!1,o=0,s=this.length){a&&(s=Math.min(s,this.getTrimmedLength()));let c="";for(;o<s;){const p=this._data[3*o+0],v=2097151&p;c+=2097152&p?this._combined[o]:v?(0,m.stringFromCodePoint)(v):d.WHITESPACE_CELL_CHAR,o+=p>>22||1}return c}}l.BufferLine=w},4841:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(u,f){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return f*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(_,l)=>{function u(f,S,d){if(S===f.length-1)return f[S].getTrimmedLength();const m=!f[S].hasContent(d-1)&&f[S].getWidth(d-1)===1,C=f[S+1].getWidth(0)===2;return m&&C?d-1:d}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,S,d,m,C){const w=[];for(let g=0;g<f.length-1;g++){let a=g,o=f.get(++a);if(!o.isWrapped)continue;const s=[f.get(g)];for(;a<f.length&&o.isWrapped;)s.push(o),o=f.get(++a);if(m>=g&&m<a){g+=s.length-1;continue}let c=0,p=u(s,c,S),v=1,x=0;for(;v<s.length;){const y=u(s,v,S),k=y-x,R=d-p,O=Math.min(k,R);s[c].copyCellsFrom(s[v],x,p,O,!1),p+=O,p===d&&(c++,p=0),x+=O,x===y&&(v++,x=0),p===0&&c!==0&&s[c-1].getWidth(d-1)===2&&(s[c].copyCellsFrom(s[c-1],d-1,p++,1,!1),s[c-1].setCell(d-1,C))}s[c].replaceCells(p,d,C);let b=0;for(let y=s.length-1;y>0&&(y>c||s[y].getTrimmedLength()===0);y--)b++;b>0&&(w.push(g+s.length-b),w.push(b)),g+=s.length-1}return w},l.reflowLargerCreateNewLayout=function(f,S){const d=[];let m=0,C=S[m],w=0;for(let g=0;g<f.length;g++)if(C===g){const a=S[++m];f.onDeleteEmitter.fire({index:g-w,amount:a}),g+=a-1,w+=a,C=S[++m]}else d.push(g);return{layout:d,countRemoved:w}},l.reflowLargerApplyNewLayout=function(f,S){const d=[];for(let m=0;m<S.length;m++)d.push(f.get(S[m]));for(let m=0;m<d.length;m++)f.set(m,d[m]);f.length=S.length},l.reflowSmallerGetNewLineLengths=function(f,S,d){const m=[],C=f.map((o,s)=>u(f,s,S)).reduce((o,s)=>o+s);let w=0,g=0,a=0;for(;a<C;){if(C-a<d){m.push(C-a);break}w+=d;const o=u(f,g,S);w>o&&(w-=o,g++);const s=f[g].getWidth(w-1)===2;s&&w--;const c=s?d-1:d;m.push(c),a+=c}return m},l.getWrappedLineTrimmedLength=u},5295:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=u(8460),S=u(844),d=u(9092);class m extends S.Disposable{constructor(w,g){super(),this._optionsService=w,this._bufferService=g,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(w,g){this._normal.resize(w,g),this._alt.resize(w,g),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}l.BufferSet=m},511:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=u(482),S=u(643),d=u(3734);class m extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const g=new m;return g.setFromCharData(w),g}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[S.CHAR_DATA_ATTR_INDEX],this.bg=0;let g=!1;if(w[S.CHAR_DATA_CHAR_INDEX].length>2)g=!0;else if(w[S.CHAR_DATA_CHAR_INDEX].length===2){const a=w[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const o=w[S.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=o&&o<=57343?this.content=1024*(a-55296)+o-56320+65536|w[S.CHAR_DATA_WIDTH_INDEX]<<22:g=!0}else g=!0}else this.content=w[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[S.CHAR_DATA_WIDTH_INDEX]<<22;g&&(this.combinedData=w[S.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[S.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=m},643:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=u(8460),S=u(844);class d{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,S.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}l.Marker=d,d._nextId=1},7116:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(_,l)=>{var u,f,S;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
|
|
47
47
|
`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""}(u||(l.C0=u={})),function(d){d.PAD="",d.HOP="",d.BPH="",d.NBH="",d.IND="",d.NEL="
",d.SSA="",d.ESA="",d.HTS="",d.HTJ="",d.VTS="",d.PLD="",d.PLU="",d.RI="",d.SS2="",d.SS3="",d.DCS="",d.PU1="",d.PU2="",d.STS="",d.CCH="",d.MW="",d.SPA="",d.EPA="",d.SOS="",d.SGCI="",d.SCI="",d.CSI="",d.ST="",d.OSC="",d.PM="",d.APC=""}(f||(l.C1=f={})),function(d){d.ST=`${u.ESC}\\`}(S||(l.C1_ESCAPED=S={}))},7399:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=u(2584),S={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(d,m,C,w){const g={type:0,cancel:!1,key:void 0},a=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?g.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?g.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?g.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(g.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:if(d.altKey){g.key=f.C0.ESC+f.C0.DEL;break}g.key=f.C0.DEL;break;case 9:if(d.shiftKey){g.key=f.C0.ESC+"[Z";break}g.key=f.C0.HT,g.cancel=!0;break;case 13:g.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,g.cancel=!0;break;case 27:g.key=f.C0.ESC,d.altKey&&(g.key=f.C0.ESC+f.C0.ESC),g.cancel=!0;break;case 37:if(d.metaKey)break;a?(g.key=f.C0.ESC+"[1;"+(a+1)+"D",g.key===f.C0.ESC+"[1;3D"&&(g.key=f.C0.ESC+(C?"b":"[1;5D"))):g.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;a?(g.key=f.C0.ESC+"[1;"+(a+1)+"C",g.key===f.C0.ESC+"[1;3C"&&(g.key=f.C0.ESC+(C?"f":"[1;5C"))):g.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;a?(g.key=f.C0.ESC+"[1;"+(a+1)+"A",C||g.key!==f.C0.ESC+"[1;3A"||(g.key=f.C0.ESC+"[1;5A")):g.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;a?(g.key=f.C0.ESC+"[1;"+(a+1)+"B",C||g.key!==f.C0.ESC+"[1;3B"||(g.key=f.C0.ESC+"[1;5B")):g.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(g.key=f.C0.ESC+"[2~");break;case 46:g.key=a?f.C0.ESC+"[3;"+(a+1)+"~":f.C0.ESC+"[3~";break;case 36:g.key=a?f.C0.ESC+"[1;"+(a+1)+"H":m?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:g.key=a?f.C0.ESC+"[1;"+(a+1)+"F":m?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?g.type=2:d.ctrlKey?g.key=f.C0.ESC+"[5;"+(a+1)+"~":g.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?g.type=3:d.ctrlKey?g.key=f.C0.ESC+"[6;"+(a+1)+"~":g.key=f.C0.ESC+"[6~";break;case 112:g.key=a?f.C0.ESC+"[1;"+(a+1)+"P":f.C0.ESC+"OP";break;case 113:g.key=a?f.C0.ESC+"[1;"+(a+1)+"Q":f.C0.ESC+"OQ";break;case 114:g.key=a?f.C0.ESC+"[1;"+(a+1)+"R":f.C0.ESC+"OR";break;case 115:g.key=a?f.C0.ESC+"[1;"+(a+1)+"S":f.C0.ESC+"OS";break;case 116:g.key=a?f.C0.ESC+"[15;"+(a+1)+"~":f.C0.ESC+"[15~";break;case 117:g.key=a?f.C0.ESC+"[17;"+(a+1)+"~":f.C0.ESC+"[17~";break;case 118:g.key=a?f.C0.ESC+"[18;"+(a+1)+"~":f.C0.ESC+"[18~";break;case 119:g.key=a?f.C0.ESC+"[19;"+(a+1)+"~":f.C0.ESC+"[19~";break;case 120:g.key=a?f.C0.ESC+"[20;"+(a+1)+"~":f.C0.ESC+"[20~";break;case 121:g.key=a?f.C0.ESC+"[21;"+(a+1)+"~":f.C0.ESC+"[21~";break;case 122:g.key=a?f.C0.ESC+"[23;"+(a+1)+"~":f.C0.ESC+"[23~";break;case 123:g.key=a?f.C0.ESC+"[24;"+(a+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(C&&!w||!d.altKey||d.metaKey)!C||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?g.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(g.key=f.C0.US),d.key==="@"&&(g.key=f.C0.NUL)):d.keyCode===65&&(g.type=1);else{const o=S[d.keyCode],s=o==null?void 0:o[d.shiftKey?1:0];if(s)g.key=f.C0.ESC+s;else if(d.keyCode>=65&&d.keyCode<=90){const c=d.ctrlKey?d.keyCode-64:d.keyCode+32;let p=String.fromCharCode(c);d.shiftKey&&(p=p.toUpperCase()),g.key=f.C0.ESC+p}else if(d.keyCode===32)g.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let c=d.code.slice(3,4);d.shiftKey||(c=c.toLowerCase()),g.key=f.C0.ESC+c,g.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?g.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?g.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?g.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?g.key=f.C0.DEL:d.keyCode===219?g.key=f.C0.ESC:d.keyCode===220?g.key=f.C0.FS:d.keyCode===221&&(g.key=f.C0.GS)}return g}},482:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},l.utf32ToString=function(u,f=0,S=u.length){let d="";for(let m=f;m<S;++m){let C=u[m];C>65535?(C-=65536,d+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):d+=String.fromCharCode(C)}return d},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,f){const S=u.length;if(!S)return 0;let d=0,m=0;if(this._interim){const C=u.charCodeAt(m++);56320<=C&&C<=57343?f[d++]=1024*(this._interim-55296)+C-56320+65536:(f[d++]=this._interim,f[d++]=C),this._interim=0}for(let C=m;C<S;++C){const w=u.charCodeAt(C);if(55296<=w&&w<=56319){if(++C>=S)return this._interim=w,d;const g=u.charCodeAt(C);56320<=g&&g<=57343?f[d++]=1024*(w-55296)+g-56320+65536:(f[d++]=w,f[d++]=g)}else w!==65279&&(f[d++]=w)}return d}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,f){const S=u.length;if(!S)return 0;let d,m,C,w,g=0,a=0,o=0;if(this.interim[0]){let p=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let x,b=0;for(;(x=63&this.interim[++b])&&b<4;)v<<=6,v|=x;const y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=y-b;for(;o<k;){if(o>=S)return 0;if(x=u[o++],(192&x)!=128){o--,p=!0;break}this.interim[b++]=x,v<<=6,v|=63&x}p||(y===2?v<128?o--:f[g++]=v:y===3?v<2048||v>=55296&&v<=57343||v===65279||(f[g++]=v):v<65536||v>1114111||(f[g++]=v)),this.interim.fill(0)}const s=S-4;let c=o;for(;c<S;){for(;!(!(c<s)||128&(d=u[c])||128&(m=u[c+1])||128&(C=u[c+2])||128&(w=u[c+3]));)f[g++]=d,f[g++]=m,f[g++]=C,f[g++]=w,c+=4;if(d=u[c++],d<128)f[g++]=d;else if((224&d)==192){if(c>=S)return this.interim[0]=d,g;if(m=u[c++],(192&m)!=128){c--;continue}if(a=(31&d)<<6|63&m,a<128){c--;continue}f[g++]=a}else if((240&d)==224){if(c>=S)return this.interim[0]=d,g;if(m=u[c++],(192&m)!=128){c--;continue}if(c>=S)return this.interim[0]=d,this.interim[1]=m,g;if(C=u[c++],(192&C)!=128){c--;continue}if(a=(15&d)<<12|(63&m)<<6|63&C,a<2048||a>=55296&&a<=57343||a===65279)continue;f[g++]=a}else if((248&d)==240){if(c>=S)return this.interim[0]=d,g;if(m=u[c++],(192&m)!=128){c--;continue}if(c>=S)return this.interim[0]=d,this.interim[1]=m,g;if(C=u[c++],(192&C)!=128){c--;continue}if(c>=S)return this.interim[0]=d,this.interim[1]=m,this.interim[2]=C,g;if(w=u[c++],(192&w)!=128){c--;continue}if(a=(7&d)<<18|(63&m)<<12|(63&C)<<6|63&w,a<65536||a>1114111)continue;f[g++]=a}}return g}}},225:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const u=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],f=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let S;l.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let d=0;d<u.length;++d)S.fill(0,u[d][0],u[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?S[d]:function(m,C){let w,g=0,a=C.length-1;if(m<C[0][0]||m>C[a][1])return!1;for(;a>=g;)if(w=g+a>>1,m>C[w][1])g=w+1;else{if(!(m<C[w][0]))return!0;a=w-1}return!1}(d,f)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}}},5981:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=u(8460),S=u(844);class d extends S.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let g;for(this._isSyncWriting=!0;g=this._writeBuffer.shift();){this._action(g);const a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(w),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(w)}_innerWrite(C=0,w=!0){const g=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const a=this._writeBuffer[this._bufferOffset],o=this._action(a,w);if(o){const c=p=>Date.now()-g>=12?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(g,p);return void o.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(c)}const s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=a.length,Date.now()-g>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=d},5941:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const u=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function S(d,m){const C=d.toString(16),w=C.length<2?"0"+C:C;switch(m){case 4:return C[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}l.parseColor=function(d){if(!d)return;let m=d.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const C=u.exec(m);if(C){const w=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/w*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/w*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/w*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),f.exec(m)&&[3,6,9,12].includes(m.length))){const C=m.length/3,w=[0,0,0];for(let g=0;g<3;++g){const a=parseInt(m.slice(C*g,C*g+C),16);w[g]=C===1?a<<4:C===2?a:C===3?a>>4:a>>8}return w}},l.toRgbString=function(d,m=16){const[C,w,g]=d;return`rgb:${S(C,m)}/${S(w,m)}/${S(g,m)}`}},5770:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=u(482),S=u(8742),d=u(5770),m=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(w,g){this._handlers[w]===void 0&&(this._handlers[w]=[]);const a=this._handlers[w];return a.push(g),{dispose:()=>{const o=a.indexOf(g);o!==-1&&a.splice(o,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(w,g){if(this.reset(),this._ident=w,this._active=this._handlers[w]||m,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].hook(g);else this._handlerFb(this._ident,"HOOK",g)}put(w,g,a){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(w,g,a);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,g,a))}unhook(w,g=!0){if(this._active.length){let a=!1,o=this._active.length-1,s=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,a=g,s=this._stack.fallThrough,this._stack.paused=!1),!s&&a===!1){for(;o>=0&&(a=this._active[o].unhook(w),a!==!0);o--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,a;o--}for(;o>=0;o--)if(a=this._active[o].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",w);this._active=m,this._ident=0}};const C=new S.Params;C.addParam(0),l.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=C,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():C,this._data="",this._hitLimit=!1}put(w,g,a){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,g,a),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let g=!1;if(this._hitLimit)g=!1;else if(w&&(g=this._handler(this._data,this._params),g instanceof Promise))return g.then(a=>(this._params=C,this._data="",this._hitLimit=!1,a));return this._params=C,this._data="",this._hitLimit=!1,g}}},2015:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=u(844),S=u(8742),d=u(6242),m=u(6351);class C{constructor(o){this.table=new Uint8Array(o)}setDefault(o,s){this.table.fill(o<<4|s)}add(o,s,c,p){this.table[s<<8|o]=c<<4|p}addMany(o,s,c,p){for(let v=0;v<o.length;v++)this.table[s<<8|o[v]]=c<<4|p}}l.TransitionTable=C;const w=160;l.VT500_TRANSITION_TABLE=function(){const a=new C(4095),o=Array.apply(null,Array(256)).map((b,y)=>y),s=(b,y)=>o.slice(b,y),c=s(32,127),p=s(0,24);p.push(25),p.push.apply(p,s(28,32));const v=s(0,14);let x;for(x in a.setDefault(1,0),a.addMany(c,0,2,0),v)a.addMany([24,26,153,154],x,3,0),a.addMany(s(128,144),x,3,0),a.addMany(s(144,152),x,3,0),a.add(156,x,0,0),a.add(27,x,11,1),a.add(157,x,4,8),a.addMany([152,158,159],x,0,7),a.add(155,x,11,3),a.add(144,x,11,9);return a.addMany(p,0,3,0),a.addMany(p,1,3,1),a.add(127,1,0,1),a.addMany(p,8,0,8),a.addMany(p,3,3,3),a.add(127,3,0,3),a.addMany(p,4,3,4),a.add(127,4,0,4),a.addMany(p,6,3,6),a.addMany(p,5,3,5),a.add(127,5,0,5),a.addMany(p,2,3,2),a.add(127,2,0,2),a.add(93,1,4,8),a.addMany(c,8,5,8),a.add(127,8,5,8),a.addMany([156,27,24,26,7],8,6,0),a.addMany(s(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(c,7,0,7),a.addMany(p,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(s(64,127),3,7,0),a.addMany(s(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(s(48,60),4,8,4),a.addMany(s(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(s(32,64),6,0,6),a.add(127,6,0,6),a.addMany(s(64,127),6,0,0),a.addMany(s(32,48),3,9,5),a.addMany(s(32,48),5,9,5),a.addMany(s(48,64),5,0,6),a.addMany(s(64,127),5,7,0),a.addMany(s(32,48),4,9,5),a.addMany(s(32,48),1,9,2),a.addMany(s(32,48),2,9,2),a.addMany(s(48,127),2,10,0),a.addMany(s(48,80),1,10,0),a.addMany(s(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(s(96,127),1,10,0),a.add(80,1,11,9),a.addMany(p,9,0,9),a.add(127,9,0,9),a.addMany(s(28,32),9,0,9),a.addMany(s(32,48),9,9,12),a.addMany(s(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(p,11,0,11),a.addMany(s(32,128),11,0,11),a.addMany(s(28,32),11,0,11),a.addMany(p,10,0,10),a.add(127,10,0,10),a.addMany(s(28,32),10,0,10),a.addMany(s(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(s(32,48),10,9,12),a.addMany(p,12,0,12),a.add(127,12,0,12),a.addMany(s(28,32),12,0,12),a.addMany(s(32,48),12,9,12),a.addMany(s(48,64),12,0,11),a.addMany(s(64,127),12,12,13),a.addMany(s(64,127),10,12,13),a.addMany(s(64,127),9,12,13),a.addMany(p,13,13,13),a.addMany(c,13,13,13),a.add(127,13,0,13),a.addMany([27,156,24,26],13,14,0),a.add(w,0,2,0),a.add(w,8,5,8),a.add(w,6,0,6),a.add(w,11,0,11),a.add(w,13,13,13),a}();class g extends f.Disposable{constructor(o=l.VT500_TRANSITION_TABLE){super(),this._transitions=o,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new S.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(s,c,p)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,c)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(o,s=[64,126]){let c=0;if(o.prefix){if(o.prefix.length>1)throw new Error("only one byte as prefix supported");if(c=o.prefix.charCodeAt(0),c&&60>c||c>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(o.intermediates){if(o.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let v=0;v<o.intermediates.length;++v){const x=o.intermediates.charCodeAt(v);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");c<<=8,c|=x}}if(o.final.length!==1)throw new Error("final must be a single byte");const p=o.final.charCodeAt(0);if(s[0]>p||p>s[1])throw new Error(`final must be in range ${s[0]} .. ${s[1]}`);return c<<=8,c|=p,c}identToString(o){const s=[];for(;o;)s.push(String.fromCharCode(255&o)),o>>=8;return s.reverse().join("")}setPrintHandler(o){this._printHandler=o}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(o,s){const c=this._identifier(o,[48,126]);this._escHandlers[c]===void 0&&(this._escHandlers[c]=[]);const p=this._escHandlers[c];return p.push(s),{dispose:()=>{const v=p.indexOf(s);v!==-1&&p.splice(v,1)}}}clearEscHandler(o){this._escHandlers[this._identifier(o,[48,126])]&&delete this._escHandlers[this._identifier(o,[48,126])]}setEscHandlerFallback(o){this._escHandlerFb=o}setExecuteHandler(o,s){this._executeHandlers[o.charCodeAt(0)]=s}clearExecuteHandler(o){this._executeHandlers[o.charCodeAt(0)]&&delete this._executeHandlers[o.charCodeAt(0)]}setExecuteHandlerFallback(o){this._executeHandlerFb=o}registerCsiHandler(o,s){const c=this._identifier(o);this._csiHandlers[c]===void 0&&(this._csiHandlers[c]=[]);const p=this._csiHandlers[c];return p.push(s),{dispose:()=>{const v=p.indexOf(s);v!==-1&&p.splice(v,1)}}}clearCsiHandler(o){this._csiHandlers[this._identifier(o)]&&delete this._csiHandlers[this._identifier(o)]}setCsiHandlerFallback(o){this._csiHandlerFb=o}registerDcsHandler(o,s){return this._dcsParser.registerHandler(this._identifier(o),s)}clearDcsHandler(o){this._dcsParser.clearHandler(this._identifier(o))}setDcsHandlerFallback(o){this._dcsParser.setHandlerFallback(o)}registerOscHandler(o,s){return this._oscParser.registerHandler(o,s)}clearOscHandler(o){this._oscParser.clearHandler(o)}setOscHandlerFallback(o){this._oscParser.setHandlerFallback(o)}setErrorHandler(o){this._errorHandler=o}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(o,s,c,p,v){this._parseStack.state=o,this._parseStack.handlers=s,this._parseStack.handlerPos=c,this._parseStack.transition=p,this._parseStack.chunkPos=v}parse(o,s,c){let p,v=0,x=0,b=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,b=this._parseStack.chunkPos+1;else{if(c===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const y=this._parseStack.handlers;let k=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(c===!1&&k>-1){for(;k>=0&&(p=y[k](this._params),p!==!0);k--)if(p instanceof Promise)return this._parseStack.handlerPos=k,p}this._parseStack.handlers=[];break;case 4:if(c===!1&&k>-1){for(;k>=0&&(p=y[k](),p!==!0);k--)if(p instanceof Promise)return this._parseStack.handlerPos=k,p}this._parseStack.handlers=[];break;case 6:if(v=o[this._parseStack.chunkPos],p=this._dcsParser.unhook(v!==24&&v!==26,c),p)return p;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(v=o[this._parseStack.chunkPos],p=this._oscParser.end(v!==24&&v!==26,c),p)return p;v===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,b=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let y=b;y<s;++y){switch(v=o[y],x=this._transitions.table[this.currentState<<8|(v<160?v:w)],x>>4){case 2:for(let B=y+1;;++B){if(B>=s||(v=o[B])<32||v>126&&v<w){this._printHandler(o,y,B),y=B-1;break}if(++B>=s||(v=o[B])<32||v>126&&v<w){this._printHandler(o,y,B),y=B-1;break}if(++B>=s||(v=o[B])<32||v>126&&v<w){this._printHandler(o,y,B),y=B-1;break}if(++B>=s||(v=o[B])<32||v>126&&v<w){this._printHandler(o,y,B),y=B-1;break}}break;case 3:this._executeHandlers[v]?this._executeHandlers[v]():this._executeHandlerFb(v),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:y,code:v,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const k=this._csiHandlers[this._collect<<8|v];let R=k?k.length-1:-1;for(;R>=0&&(p=k[R](this._params),p!==!0);R--)if(p instanceof Promise)return this._preserveStack(3,k,R,x,y),p;R<0&&this._csiHandlerFb(this._collect<<8|v,this._params),this.precedingCodepoint=0;break;case 8:do switch(v){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(v-48)}while(++y<s&&(v=o[y])>47&&v<60);y--;break;case 9:this._collect<<=8,this._collect|=v;break;case 10:const O=this._escHandlers[this._collect<<8|v];let T=O?O.length-1:-1;for(;T>=0&&(p=O[T](),p!==!0);T--)if(p instanceof Promise)return this._preserveStack(4,O,T,x,y),p;T<0&&this._escHandlerFb(this._collect<<8|v),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|v,this._params);break;case 13:for(let B=y+1;;++B)if(B>=s||(v=o[B])===24||v===26||v===27||v>127&&v<w){this._dcsParser.put(o,y,B),y=B-1;break}break;case 14:if(p=this._dcsParser.unhook(v!==24&&v!==26),p)return this._preserveStack(6,[],0,x,y),p;v===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let B=y+1;;B++)if(B>=s||(v=o[B])<32||v>127&&v<w){this._oscParser.put(o,y,B),y=B-1;break}break;case 6:if(p=this._oscParser.end(v!==24&&v!==26),p)return this._preserveStack(5,[],0,x,y),p;v===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&x}}}l.EscapeSequenceParser=g},6242:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=u(5770),S=u(482),d=[];l.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(m,C){this._handlers[m]===void 0&&(this._handlers[m]=[]);const w=this._handlers[m];return w.push(C),{dispose:()=>{const g=w.indexOf(C);g!==-1&&w.splice(g,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,C,w){if(this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].put(m,C,w);else this._handlerFb(this._id,"PUT",(0,S.utf32ToString)(m,C,w))}start(){this.reset(),this._state=1}put(m,C,w){if(this._state!==3){if(this._state===1)for(;C<w;){const g=m[C++];if(g===59){this._state=2,this._start();break}if(g<48||57<g)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+g-48}this._state===2&&w-C>0&&this._put(m,C,w)}}end(m,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,g=this._active.length-1,a=!1;if(this._stack.paused&&(g=this._stack.loopPosition-1,w=C,a=this._stack.fallThrough,this._stack.paused=!1),!a&&w===!1){for(;g>=0&&(w=this._active[g].end(m),w!==!0);g--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!1,w;g--}for(;g>=0;g--)if(w=this._active[g].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=g,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",m);this._active=d,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,C,w){this._hitLimit||(this._data+=(0,S.utf32ToString)(m,C,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let C=!1;if(this._hitLimit)C=!1;else if(m&&(C=this._handler(this._data),C instanceof Promise))return C.then(w=>(this._data="",this._hitLimit=!1,w));return this._data="",this._hitLimit=!1,C}}},8742:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const u=2147483647;class f{static fromArray(d){const m=new f;if(!d.length)return m;for(let C=Array.isArray(d[0])?1:0;C<d.length;++C){const w=d[C];if(Array.isArray(w))for(let g=0;g<w.length;++g)m.addSubParam(w[g]);else m.addParam(w)}return m}constructor(d=32,m=32){if(this.maxLength=d,this.maxSubParamsLength=m,m>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let m=0;m<this.length;++m){d.push(this.params[m]);const C=this._subParamsIdx[m]>>8,w=255&this._subParamsIdx[m];w-C>0&&d.push(Array.prototype.slice.call(this._subParams,C,w))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>u?u:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>u?u:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const m=this._subParamsIdx[d]>>8,C=255&this._subParamsIdx[d];return C-m>0?this._subParams.subarray(m,C):null}getSubParamsAll(){const d={};for(let m=0;m<this.length;++m){const C=this._subParamsIdx[m]>>8,w=255&this._subParamsIdx[m];w-C>0&&(d[m]=this._subParams.slice(C,w))}return d}addDigit(d){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,w=C[m-1];C[m-1]=~w?Math.min(10*w+d,u):d}}l.Params=f},5741:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,f){const S={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(S),f.dispose=()=>this._wrappedAddonDispose(S),f.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let f=-1;for(let S=0;S<this._addons.length;S++)if(this._addons[S]===u){f=S;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");u.isDisposed=!0,u.dispose.apply(u.instance),this._addons.splice(f,1)}}},8771:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=u(3785),S=u(511);l.BufferApiView=class{constructor(d,m){this._buffer=d,this.type=m}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const m=this._buffer.lines.get(d);if(m)return new f.BufferLineApiView(m)}getNullCell(){return new S.CellData}}},3785:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=u(511);l.BufferLineApiView=class{constructor(S){this._line=S}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(S,d){if(!(S<0||S>=this._line.length))return d?(this._line.loadCell(S,d),d):this._line.loadCell(S,new f.CellData)}translateToString(S,d,m){return this._line.translateToString(S,d,m)}}},8285:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=u(8771),S=u(8460),d=u(844);class m extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new S.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=m},7975:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,f){return this._core.registerCsiHandler(u,S=>f(S.toArray()))}addCsiHandler(u,f){return this.registerCsiHandler(u,f)}registerDcsHandler(u,f){return this._core.registerDcsHandler(u,(S,d)=>f(S,d.toArray()))}addDcsHandler(u,f){return this.registerDcsHandler(u,f)}registerEscHandler(u,f){return this._core.registerEscHandler(u,f)}addEscHandler(u,f){return this.registerEscHandler(u,f)}registerOscHandler(u,f){return this._core.registerOscHandler(u,f)}addOscHandler(u,f){return this.registerOscHandler(u,f)}}},7090:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const d=u(8460),m=u(844),C=u(5295),w=u(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let g=l.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(a){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(a.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(a.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(a,this))}resize(a,o){this.cols=a,this.rows=o,this.buffers.resize(a,o),this._onResize.fire({cols:a,rows:o})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,o=!1){const s=this.buffer;let c;c=this._cachedBlankLine,c&&c.length===this.cols&&c.getFg(0)===a.fg&&c.getBg(0)===a.bg||(c=s.getBlankLine(a,o),this._cachedBlankLine=c),c.isWrapped=o;const p=s.ybase+s.scrollTop,v=s.ybase+s.scrollBottom;if(s.scrollTop===0){const x=s.lines.isFull;v===s.lines.length-1?x?s.lines.recycle().copyFrom(c):s.lines.push(c.clone()):s.lines.splice(v+1,0,c.clone()),x?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{const x=v-p+1;s.lines.shiftElements(p+1,x-1,-1),s.lines.set(v,c.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(a,o,s){const c=this.buffer;if(a<0){if(c.ydisp===0)return;this.isUserScrolling=!0}else a+c.ydisp>=c.ybase&&(this.isUserScrolling=!1);const p=c.ydisp;c.ydisp=Math.max(Math.min(c.ydisp+a,c.ybase),0),p!==c.ydisp&&(o||this._onScroll.fire(c.ydisp))}};l.BufferService=g=f([S(0,w.IOptionsService)],g)},7994:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,f){this._charsets[u]=f,this.glevel===u&&(this.charset=f)}}},1753:function(_,l,u){var f=this&&this.__decorate||function(c,p,v,x){var b,y=arguments.length,k=y<3?p:x===null?x=Object.getOwnPropertyDescriptor(p,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(c,p,v,x);else for(var R=c.length-1;R>=0;R--)(b=c[R])&&(k=(y<3?b(k):y>3?b(p,v,k):b(p,v))||k);return y>3&&k&&Object.defineProperty(p,v,k),k},S=this&&this.__param||function(c,p){return function(v,x){p(v,x,c)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const d=u(2585),m=u(8460),C=u(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:c=>c.button!==4&&c.action===1&&(c.ctrl=!1,c.alt=!1,c.shift=!1,!0)},VT200:{events:19,restrict:c=>c.action!==32},DRAG:{events:23,restrict:c=>c.action!==32||c.button!==3},ANY:{events:31,restrict:c=>!0}};function g(c,p){let v=(c.ctrl?16:0)|(c.shift?4:0)|(c.alt?8:0);return c.button===4?(v|=64,v|=c.action):(v|=3&c.button,4&c.button&&(v|=64),8&c.button&&(v|=128),c.action===32?v|=32:c.action!==0||p||(v|=3)),v}const a=String.fromCharCode,o={DEFAULT:c=>{const p=[g(c,!1)+32,c.col+32,c.row+32];return p[0]>255||p[1]>255||p[2]>255?"":`\x1B[M${a(p[0])}${a(p[1])}${a(p[2])}`},SGR:c=>{const p=c.action===0&&c.button!==4?"m":"M";return`\x1B[<${g(c,!0)};${c.col};${c.row}${p}`},SGR_PIXELS:c=>{const p=c.action===0&&c.button!==4?"m":"M";return`\x1B[<${g(c,!0)};${c.x};${c.y}${p}`}};let s=l.CoreMouseService=class extends C.Disposable{constructor(c,p){super(),this._bufferService=c,this._coreService=p,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const v of Object.keys(w))this.addProtocol(v,w[v]);for(const v of Object.keys(o))this.addEncoding(v,o[v]);this.reset()}addProtocol(c,p){this._protocols[c]=p}addEncoding(c,p){this._encodings[c]=p}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(c){if(!this._protocols[c])throw new Error(`unknown protocol "${c}"`);this._activeProtocol=c,this._onProtocolChange.fire(this._protocols[c].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(c){if(!this._encodings[c])throw new Error(`unknown encoding "${c}"`);this._activeEncoding=c}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(c){if(c.col<0||c.col>=this._bufferService.cols||c.row<0||c.row>=this._bufferService.rows||c.button===4&&c.action===32||c.button===3&&c.action!==32||c.button!==4&&(c.action===2||c.action===3)||(c.col++,c.row++,c.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,c,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(c))return!1;const p=this._encodings[this._activeEncoding](c);return p&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(p):this._coreService.triggerDataEvent(p,!0)),this._lastEvent=c,!0}explainEvents(c){return{down:!!(1&c),up:!!(2&c),drag:!!(4&c),move:!!(8&c),wheel:!!(16&c)}}_equalEvents(c,p,v){if(v){if(c.x!==p.x||c.y!==p.y)return!1}else if(c.col!==p.col||c.row!==p.row)return!1;return c.button===p.button&&c.action===p.action&&c.ctrl===p.ctrl&&c.alt===p.alt&&c.shift===p.shift}};l.CoreMouseService=s=f([S(0,d.IBufferService),S(1,d.ICoreService)],s)},6975:function(_,l,u){var f=this&&this.__decorate||function(s,c,p,v){var x,b=arguments.length,y=b<3?c:v===null?v=Object.getOwnPropertyDescriptor(c,p):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(s,c,p,v);else for(var k=s.length-1;k>=0;k--)(x=s[k])&&(y=(b<3?x(y):b>3?x(c,p,y):x(c,p))||y);return b>3&&y&&Object.defineProperty(c,p,y),y},S=this&&this.__param||function(s,c){return function(p,v){c(p,v,s)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const d=u(1439),m=u(8460),C=u(844),w=u(2585),g=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let o=l.CoreService=class extends C.Disposable{constructor(s,c,p){super(),this._bufferService=s,this._logService=c,this._optionsService=p,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(g),this.decPrivateModes=(0,d.clone)(a)}reset(){this.modes=(0,d.clone)(g),this.decPrivateModes=(0,d.clone)(a)}triggerDataEvent(s,c=!1){if(this._optionsService.rawOptions.disableStdin)return;const p=this._bufferService.buffer;c&&this._optionsService.rawOptions.scrollOnUserInput&&p.ybase!==p.ydisp&&this._onRequestScrollToBottom.fire(),c&&this._onUserInput.fire(),this._logService.debug(`sending data "${s}"`,()=>s.split("").map(v=>v.charCodeAt(0))),this._onData.fire(s)}triggerBinaryEvent(s){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${s}"`,()=>s.split("").map(c=>c.charCodeAt(0))),this._onBinary.fire(s))}};l.CoreService=o=f([S(0,w.IBufferService),S(1,w.ILogService),S(2,w.IOptionsService)],o)},9074:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=u(8055),S=u(8460),d=u(844),m=u(6106);let C=0,w=0;class g extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList(s=>s==null?void 0:s.marker.line),this._onDecorationRegistered=this.register(new S.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new S.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)(()=>this.reset()))}registerDecoration(s){if(s.marker.isDisposed)return;const c=new a(s);if(c){const p=c.marker.onDispose(()=>c.dispose());c.onDispose(()=>{c&&(this._decorations.delete(c)&&this._onDecorationRemoved.fire(c),p.dispose())}),this._decorations.insert(c),this._onDecorationRegistered.fire(c)}return c}reset(){for(const s of this._decorations.values())s.dispose();this._decorations.clear()}*getDecorationsAtCell(s,c,p){var v,x,b;let y=0,k=0;for(const R of this._decorations.getKeyIterator(c))y=(v=R.options.x)!==null&&v!==void 0?v:0,k=y+((x=R.options.width)!==null&&x!==void 0?x:1),s>=y&&s<k&&(!p||((b=R.options.layer)!==null&&b!==void 0?b:"bottom")===p)&&(yield R)}forEachDecorationAtCell(s,c,p,v){this._decorations.forEachByKey(c,x=>{var b,y,k;C=(b=x.options.x)!==null&&b!==void 0?b:0,w=C+((y=x.options.width)!==null&&y!==void 0?y:1),s>=C&&s<w&&(!p||((k=x.options.layer)!==null&&k!==void 0?k:"bottom")===p)&&v(x)})}}l.DecorationService=g;class a extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(s){super(),this.options=s,this.onRenderEmitter=this.register(new S.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new S.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=s.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=u(2585),S=u(8343);class d{constructor(...C){this._entries=new Map;for(const[w,g]of C)this.set(w,g)}set(C,w){const g=this._entries.get(C);return this._entries.set(C,w),g}forEach(C){for(const[w,g]of this._entries.entries())C(w,g)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}l.ServiceCollection=d,l.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(m,C){this._services.set(m,C)}getService(m){return this._services.get(m)}createInstance(m,...C){const w=(0,S.getServiceDependencies)(m).sort((o,s)=>o.index-s.index),g=[];for(const o of w){const s=this._services.get(o.id);if(!s)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${o.id}.`);g.push(s)}const a=w.length>0?w[0].index:C.length;if(C.length!==a)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${a+1} conflicts with ${C.length} static arguments`);return new m(...C,...g)}}},7866:function(_,l,u){var f=this&&this.__decorate||function(a,o,s,c){var p,v=arguments.length,x=v<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(a,o,s,c);else for(var b=a.length-1;b>=0;b--)(p=a[b])&&(x=(v<3?p(x):v>3?p(o,s,x):p(o,s))||x);return v>3&&x&&Object.defineProperty(o,s,x),x},S=this&&this.__param||function(a,o){return function(s,c){o(s,c,a)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const d=u(844),m=u(2585),C={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let w,g=l.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),w=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let o=0;o<a.length;o++)typeof a[o]=="function"&&(a[o]=a[o]())}_log(a,o,s){this._evalLazyOptionalParams(s),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+o,...s)}trace(a,...o){var s,c;this._logLevel<=m.LogLevelEnum.TRACE&&this._log((c=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.trace.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.log,a,o)}debug(a,...o){var s,c;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log((c=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.debug.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.log,a,o)}info(a,...o){var s,c;this._logLevel<=m.LogLevelEnum.INFO&&this._log((c=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.info.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.info,a,o)}warn(a,...o){var s,c;this._logLevel<=m.LogLevelEnum.WARN&&this._log((c=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.warn.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.warn,a,o)}error(a,...o){var s,c;this._logLevel<=m.LogLevelEnum.ERROR&&this._log((c=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.error.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.error,a,o)}};l.LogService=g=f([S(0,m.IOptionsService)],g),l.setTraceLogger=function(a){w=a},l.traceCall=function(a,o,s){if(typeof s.value!="function")throw new Error("not supported");const c=s.value;s.value=function(...p){if(w.logLevel!==m.LogLevelEnum.TRACE)return c.apply(this,p);w.trace(`GlyphRenderer#${c.name}(${p.map(x=>JSON.stringify(x)).join(", ")})`);const v=c.apply(this,p);return w.trace(`GlyphRenderer#${c.name} return`,v),v}}},7302:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=u(8460),S=u(844),d=u(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const m=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends S.Disposable{constructor(g){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const a=Object.assign({},l.DEFAULT_OPTIONS);for(const o in g)if(o in a)try{const s=g[o];a[o]=this._sanitizeAndValidateOption(o,s)}catch(s){console.error(s)}this.rawOptions=a,this.options=Object.assign({},a),this._setupOptions()}onSpecificOptionChange(g,a){return this.onOptionChange(o=>{o===g&&a(this.rawOptions[g])})}onMultipleOptionChange(g,a){return this.onOptionChange(o=>{g.indexOf(o)!==-1&&a()})}_setupOptions(){const g=o=>{if(!(o in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${o}"`);return this.rawOptions[o]},a=(o,s)=>{if(!(o in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${o}"`);s=this._sanitizeAndValidateOption(o,s),this.rawOptions[o]!==s&&(this.rawOptions[o]=s,this._onOptionChange.fire(o))};for(const o in this.rawOptions){const s={get:g.bind(this,o),set:a.bind(this,o)};Object.defineProperty(this.options,o,s)}}_sanitizeAndValidateOption(g,a){switch(g){case"cursorStyle":if(a||(a=l.DEFAULT_OPTIONS[g]),!function(o){return o==="block"||o==="underline"||o==="bar"}(a))throw new Error(`"${a}" is not a valid value for ${g}`);break;case"wordSeparator":a||(a=l.DEFAULT_OPTIONS[g]);break;case"fontWeight":case"fontWeightBold":if(typeof a=="number"&&1<=a&&a<=1e3)break;a=m.includes(a)?a:l.DEFAULT_OPTIONS[g];break;case"cursorWidth":a=Math.floor(a);case"lineHeight":case"tabStopWidth":if(a<1)throw new Error(`${g} cannot be less than 1, value: ${a}`);break;case"minimumContrastRatio":a=Math.max(1,Math.min(21,Math.round(10*a)/10));break;case"scrollback":if((a=Math.min(a,4294967295))<0)throw new Error(`${g} cannot be less than 0, value: ${a}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(a<=0)throw new Error(`${g} cannot be less than or equal to 0, value: ${a}`);break;case"rows":case"cols":if(!a&&a!==0)throw new Error(`${g} must be numeric, value: ${a}`);break;case"windowsPty":a=a??{}}return a}}l.OptionsService=C},2660:function(_,l,u){var f=this&&this.__decorate||function(C,w,g,a){var o,s=arguments.length,c=s<3?w:a===null?a=Object.getOwnPropertyDescriptor(w,g):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(C,w,g,a);else for(var p=C.length-1;p>=0;p--)(o=C[p])&&(c=(s<3?o(c):s>3?o(w,g,c):o(w,g))||c);return s>3&&c&&Object.defineProperty(w,g,c),c},S=this&&this.__param||function(C,w){return function(g,a){w(g,a,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const d=u(2585);let m=l.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const w=this._bufferService.buffer;if(C.id===void 0){const p=w.addMarker(w.ybase+w.y),v={data:C,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(v,p)),this._dataByLinkId.set(v.id,v),v.id}const g=C,a=this._getEntryIdKey(g),o=this._entriesWithId.get(a);if(o)return this.addLineToLink(o.id,w.ybase+w.y),o.id;const s=w.addMarker(w.ybase+w.y),c={id:this._nextId++,key:this._getEntryIdKey(g),data:g,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(c,s)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(C,w){const g=this._dataByLinkId.get(C);if(g&&g.lines.every(a=>a.line!==w)){const a=this._bufferService.buffer.addMarker(w);g.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(g,a))}}getLinkData(C){var w;return(w=this._dataByLinkId.get(C))===null||w===void 0?void 0:w.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,w){const g=C.lines.indexOf(w);g!==-1&&(C.lines.splice(g,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};l.OscLinkService=m=f([S(0,d.IBufferService)],m)},8343:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const u="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(S){return S[f]||[]},l.createDecorator=function(S){if(l.serviceRegistry.has(S))return l.serviceRegistry.get(S);const d=function(m,C,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(g,a,o){a[u]===a?a[f].push({id:g,index:o}):(a[f]=[{id:g,index:o}],a[u]=a)})(d,m,w)};return d.toString=()=>S,l.serviceRegistry.set(S,d),d}},2585:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=u(8343);var S;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.createDecorator)("InstantiationService"),function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"}(S||(l.LogLevelEnum=S={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(_,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=u(8460),S=u(225);l.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const d=new S.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let m=0;const C=d.length;for(let w=0;w<C;++w){let g=d.charCodeAt(w);if(55296<=g&&g<=56319){if(++w>=C)return m+this.wcwidth(g);const a=d.charCodeAt(w);56320<=a&&a<=57343?g=1024*(g-55296)+a-56320+65536:m+=this.wcwidth(a)}m+=this.wcwidth(g)}return m}}}},i={};function n(_){var l=i[_];if(l!==void 0)return l.exports;var u=i[_]={exports:{}};return r[_].call(u.exports,u,u.exports,n),u.exports}var h={};return(()=>{var _=h;Object.defineProperty(_,"__esModule",{value:!0}),_.Terminal=void 0;const l=n(9042),u=n(3236),f=n(844),S=n(5741),d=n(8285),m=n(7975),C=n(7090),w=["cols","rows"];class g extends f.Disposable{constructor(o){super(),this._core=this.register(new u.Terminal(o)),this._addonManager=this.register(new S.AddonManager),this._publicOptions=Object.assign({},this._core.options);const s=p=>this._core.options[p],c=(p,v)=>{this._checkReadonlyOptions(p),this._core.options[p]=v};for(const p in this._core.options){const v={get:s.bind(this,p),set:c.bind(this,p)};Object.defineProperty(this._publicOptions,p,v)}}_checkReadonlyOptions(o){if(w.includes(o))throw new Error(`Option "${o}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const o=this._core.coreService.decPrivateModes;let s="none";switch(this._core.coreMouseService.activeProtocol){case"X10":s="x10";break;case"VT200":s="vt200";break;case"DRAG":s="drag";break;case"ANY":s="any"}return{applicationCursorKeysMode:o.applicationCursorKeys,applicationKeypadMode:o.applicationKeypad,bracketedPasteMode:o.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:s,originMode:o.origin,reverseWraparoundMode:o.reverseWraparound,sendFocusMode:o.sendFocus,wraparoundMode:o.wraparound}}get options(){return this._publicOptions}set options(o){for(const s in o)this._publicOptions[s]=o[s]}blur(){this._core.blur()}focus(){this._core.focus()}resize(o,s){this._verifyIntegers(o,s),this._core.resize(o,s)}open(o){this._core.open(o)}attachCustomKeyEventHandler(o){this._core.attachCustomKeyEventHandler(o)}registerLinkProvider(o){return this._core.registerLinkProvider(o)}registerCharacterJoiner(o){return this._checkProposedApi(),this._core.registerCharacterJoiner(o)}deregisterCharacterJoiner(o){this._checkProposedApi(),this._core.deregisterCharacterJoiner(o)}registerMarker(o=0){return this._verifyIntegers(o),this._core.registerMarker(o)}registerDecoration(o){var s,c,p;return this._checkProposedApi(),this._verifyPositiveIntegers((s=o.x)!==null&&s!==void 0?s:0,(c=o.width)!==null&&c!==void 0?c:0,(p=o.height)!==null&&p!==void 0?p:0),this._core.registerDecoration(o)}hasSelection(){return this._core.hasSelection()}select(o,s,c){this._verifyIntegers(o,s,c),this._core.select(o,s,c)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(o,s){this._verifyIntegers(o,s),this._core.selectLines(o,s)}dispose(){super.dispose()}scrollLines(o){this._verifyIntegers(o),this._core.scrollLines(o)}scrollPages(o){this._verifyIntegers(o),this._core.scrollPages(o)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(o){this._verifyIntegers(o),this._core.scrollToLine(o)}clear(){this._core.clear()}write(o,s){this._core.write(o,s)}writeln(o,s){this._core.write(o),this._core.write(`\r
|
|
48
|
-
`,s)}paste(o){this._core.paste(o)}refresh(o,s){this._verifyIntegers(o,s),this._core.refresh(o,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(o){this._addonManager.loadAddon(this,o)}static get strings(){return l}_verifyIntegers(...o){for(const s of o)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...o){for(const s of o)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}_.Terminal=g})(),h})())})(qh);var $_=qh.exports,Xh={exports:{}};(function(e,t){(function(r,i){e.exports=i()})(self,()=>(()=>{var r={};return(()=>{var i=r;Object.defineProperty(i,"__esModule",{value:!0}),i.FitAddon=void 0,i.FitAddon=class{activate(n){this._terminal=n}dispose(){}fit(){const n=this.proposeDimensions();if(!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;const h=this._terminal._core;this._terminal.rows===n.rows&&this._terminal.cols===n.cols||(h._renderService.clear(),this._terminal.resize(n.cols,n.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const n=this._terminal._core,h=n._renderService.dimensions;if(h.css.cell.width===0||h.css.cell.height===0)return;const _=this._terminal.options.scrollback===0?0:n.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(l.getPropertyValue("height")),f=Math.max(0,parseInt(l.getPropertyValue("width"))),S=window.getComputedStyle(this._terminal.element),d=u-(parseInt(S.getPropertyValue("padding-top"))+parseInt(S.getPropertyValue("padding-bottom"))),m=f-(parseInt(S.getPropertyValue("padding-right"))+parseInt(S.getPropertyValue("padding-left")))-_;return{cols:Math.max(2,Math.floor(m/h.css.cell.width)),rows:Math.max(1,Math.floor(d/h.css.cell.height))}}}})(),r})())})(Xh);var U_=Xh.exports,Yh={exports:{}};(function(e,t){(function(r,i){e.exports=i()})(hf,()=>(()=>{var r={433:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV11=void 0;const u=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],f=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],S=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],d=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let m;function C(w,g){let a,o=0,s=g.length-1;if(w<g[0][0]||w>g[s][1])return!1;for(;s>=o;)if(a=o+s>>1,w>g[a][1])o=a+1;else{if(!(w<g[a][0]))return!0;s=a-1}return!1}l.UnicodeV11=class{constructor(){if(this.version="11",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160);for(let w=0;w<u.length;++w)m.fill(0,u[w][0],u[w][1]+1);for(let w=0;w<S.length;++w)m.fill(2,S[w][0],S[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?m[w]:C(w,f)?0:C(w,d)?2:1}}}},i={};function n(_){var l=i[_];if(l!==void 0)return l.exports;var u=i[_]={exports:{}};return r[_](u,u.exports,n),u.exports}var h={};return(()=>{var _=h;Object.defineProperty(_,"__esModule",{value:!0}),_.Unicode11Addon=void 0;const l=n(433);_.Unicode11Addon=class{activate(u){u.unicode.register(new l.UnicodeV11)}dispose(){}}})(),h})())})(Yh);var W_=Yh.exports,Qh={exports:{}};(function(e,t){(function(r,i){e.exports=i()})(self,()=>(()=>{var r={6:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(f,S,d,m={}){this._terminal=f,this._regex=S,this._handler=d,this._options=m}provideLinks(f,S){const d=u.computeLink(f,this._regex,this._terminal,this._handler);S(this._addCallbacks(d))}_addCallbacks(f){return f.map(S=>(S.leave=this._options.leave,S.hover=(d,m)=>{if(this._options.hover){const{range:C}=S;this._options.hover(d,m,C)}},S))}};class u{static computeLink(S,d,m,C){const w=new RegExp(d.source,(d.flags||"")+"g"),[g,a]=u._getWindowedLineStrings(S-1,m),o=g.join("");let s;const c=[];for(;s=w.exec(o);){const p=s[0];try{const R=new URL(p),O=decodeURI(R.toString());if(p!==O&&p+"/"!==O)continue}catch{continue}const[v,x]=u._mapStrIdx(m,a,0,s.index),[b,y]=u._mapStrIdx(m,v,x,p.length);if(v===-1||x===-1||b===-1||y===-1)continue;const k={start:{x:x+1,y:v+1},end:{x:y,y:b+1}};c.push({range:k,text:p,activate:C})}return c}static _getWindowedLineStrings(S,d){let m,C=S,w=S,g=0,a="";const o=[];if(m=d.buffer.active.getLine(S)){const s=m.translateToString(!0);if(m.isWrapped&&s[0]!==" "){for(g=0;(m=d.buffer.active.getLine(--C))&&g<2048&&(a=m.translateToString(!0),g+=a.length,o.push(a),m.isWrapped&&a.indexOf(" ")===-1););o.reverse()}for(o.push(s),g=0;(m=d.buffer.active.getLine(++w))&&m.isWrapped&&g<2048&&(a=m.translateToString(!0),g+=a.length,o.push(a),a.indexOf(" ")===-1););}return[o,C]}static _mapStrIdx(S,d,m,C){const w=S.buffer.active,g=w.getNullCell();let a=m;for(;C;){const o=w.getLine(d);if(!o)return[-1,-1];for(let s=a;s<o.length;++s){o.getCell(s,g);const c=g.getChars();if(g.getWidth()&&(C-=c.length||1,s===o.length-1&&c==="")){const p=w.getLine(d+1);p&&p.isWrapped&&(p.getCell(0,g),g.getWidth()===2&&(C+=1))}if(C<0)return[d,s]}d++,a=0}return[d,a]}}l.LinkComputer=u}},i={};function n(_){var l=i[_];if(l!==void 0)return l.exports;var u=i[_]={exports:{}};return r[_](u,u.exports,n),u.exports}var h={};return(()=>{var _=h;Object.defineProperty(_,"__esModule",{value:!0}),_.WebLinksAddon=void 0;const l=n(6),u=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(S,d){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}_.WebLinksAddon=class{constructor(S=f,d={}){this._handler=S,this._options=d}activate(S){this._terminal=S;const d=this._options,m=d.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,m,this._handler,d))}dispose(){var S;(S=this._linkProvider)===null||S===void 0||S.dispose()}}})(),h})())})(Qh);var V_=Qh.exports;const K_="",q_="",Jh="保存しました。",G_="デッキを作成する前にワークスペースを追加してください。",X_="ワークスペースを選択してください。",Y_=2e3,Zh='"JetBrains Mono", monospace',ed=14,Q_='"Cascadia Code", "JetBrains Mono", "Consolas", "Menlo", monospace',J_=13,cc="#000000",uc="#ffffff",td="deck-theme",Z_=204;async function ue(e,t={}){const r=await fetch(`${K_}${e}`,{...t,credentials:"include"});if(!r.ok){const i=await r.text();throw new Error(i||`Request failed (${r.status})`)}return r.status===Z_?null:r.json()}const Ue="application/json",rt="POST",rd="PUT",Zi="DELETE";function ev(){return window.location.origin.replace(/^http/,"ws")}function tv(){return ue("/api/ws-token")}function rv(){return ue("/api/workspaces")}function iv(){return ue("/api/config")}function nv(e){return ue("/api/workspaces",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({path:e})})}function sv(e){return ue(`/api/workspaces/${e}`,{method:Zi})}function ov(){return ue("/api/decks")}function lv(e,t){return ue("/api/decks",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({name:e,workspaceId:t})})}function av(e){return ue(`/api/decks/${e}`,{method:Zi})}function cv(e){return ue("/api/decks/order",{method:rd,headers:{"Content-Type":Ue},body:JSON.stringify({deckIds:e})})}function hc(e,t=""){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/files?${r.toString()}`)}function dc(e,t=""){const r=new URLSearchParams({path:e,subpath:t});return ue(`/api/preview?${r.toString()}`)}function uv(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/file?${r.toString()}`)}function hv(e,t,r){return ue("/api/file",{method:rd,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,path:t,contents:r})})}function dv(e,t,r=""){return ue("/api/file",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,path:t,contents:r})})}function fv(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/file?${r.toString()}`,{method:Zi})}function pv(e,t){return ue("/api/dir",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,path:t})})}function _v(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/dir?${r.toString()}`,{method:Zi})}function vv(e,t,r){return ue("/api/terminals",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({deckId:e,title:t,command:r})})}function mv(e){const t=new URLSearchParams({deckId:e});return ue(`/api/terminals?${t.toString()}`)}function gv(e){return ue(`/api/terminals/${e}`,{method:Zi})}function id(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/status?${i.toString()}`)}function yv(e){const t=new URLSearchParams({workspaceId:e});return ue(`/api/git/repos?${t.toString()}`)}function nd(e,t,r){return ue("/api/git/stage",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,paths:t,repoPath:r})})}function sd(e,t,r){return ue("/api/git/unstage",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,paths:t,repoPath:r})})}function Sv(e,t,r){return ue("/api/git/commit",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,message:t,repoPath:r})})}function Cv(e,t,r){return ue("/api/git/discard",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,paths:t,repoPath:r})})}function wv(e,t,r,i){const n={workspaceId:e,path:t,staged:r.toString()};i!==void 0&&(n.repoPath=i);const h=new URLSearchParams(n);return ue(`/api/git/diff?${h.toString()}`)}function xv(e,t){return ue("/api/git/push",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,repoPath:t})})}function bv(e,t){return ue("/api/git/pull",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,repoPath:t})})}function Ev(e,t){return ue("/api/git/fetch",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,repoPath:t})})}function od(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/branch-status?${i.toString()}`)}function ld(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/remotes?${i.toString()}`)}function kv(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/branches?${i.toString()}`)}function Lv(e,t,r){return ue("/api/git/checkout",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,branchName:t,repoPath:r})})}function Dv(e,t,r=!0,i){return ue("/api/git/create-branch",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,branchName:t,checkout:r,repoPath:i})})}function Rv(e,t=50,r){const i={workspaceId:e,limit:String(t)};r!==void 0&&(i.repoPath=r);const n=new URLSearchParams(i);return ue(`/api/git/log?${n.toString()}`)}const Tv="接続が終了しました。",fc=5,pc=1e3,Av=new Set(["Deck deleted","Terminal deleted","Terminal exited","Terminal not found"]),_c=new TextEncoder;function Pv(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function Mv({session:e,wsUrl:t,onDelete:r,onExit:i}){const n=N.useRef(null),h=N.useRef(null),_=N.useRef(null),l=N.useRef(0),u=N.useRef(i);return N.useEffect(()=>{u.current=i},[i]),N.useEffect(()=>{var Xe,Ut;if(!n.current)return;l.current=0,n.current.innerHTML="";const f=new $_.Terminal({cursorBlink:!0,fontFamily:Q_,fontSize:J_,allowProposedApi:!0,scrollback:3e3,convertEol:!1,windowsMode:!1,rightClickSelectsWord:!0,theme:{background:cc,foreground:uc},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),S=new U_.FitAddon,d=new W_.Unicode11Addon,m=new V_.WebLinksAddon;f.loadAddon(S),f.loadAddon(d),f.loadAddon(m),f.unicode.activeVersion="11",h.current=S,f.open(n.current);let C=!0,w=!1,g=0,a=!1;const o=()=>{C=!1,a&&(a=!1,E(!0)),window.requestAnimationFrame(()=>{f.scrollToBottom()})},s=Q=>{const Y=_.current;Y&&Y.readyState===WebSocket.OPEN&&Y.send(JSON.stringify(Q))},c=Q=>{if(C)return;const Y=_.current;Y&&Y.readyState===WebSocket.OPEN&&Y.send(_c.encode(Q))};f.parser.registerCsiHandler({final:"n"},Q=>{const Y=Q.length>0?Q[0]:0;if(Y===6){const te=f.buffer.active,ie=te.cursorY+te.baseY+1,oe=te.cursorX+1;return c(`\x1B[${ie};${oe}R`),!0}else if(Y===5)return c("\x1B[0n"),!0;return!1}),f.parser.registerCsiHandler({final:"c"},Q=>(c("\x1B[?62;1;6;22c"),!0)),f.parser.registerCsiHandler({prefix:">",final:"c"},Q=>(c("\x1B[>1;500;0c"),!0)),f.parser.registerCsiHandler({prefix:"?",final:"p",intermediates:"$"},Q=>{const Y=Q[0]||0,te=f.modes;let ie=0;return Y===1?ie=te.applicationCursorKeysMode?1:2:Y===25?ie=1:Y===1e3?ie=te.mouseTrackingMode==="x10"?1:2:Y===1002?ie=te.mouseTrackingMode==="drag"?1:2:Y===1003?ie=te.mouseTrackingMode==="any"?1:2:Y===1004?ie=te.sendFocusMode?1:2:Y===1006?ie=te.mouseTrackingMode!=="none"?1:2:Y===1049?ie=f.buffer.active.type==="alternate"?1:2:Y===2004?ie=te.bracketedPasteMode?1:2:Y===2026&&(ie=2),c(`\x1B[?${Y};${ie}$y`),!0});const p=Q=>(Q*257).toString(16).padStart(4,"0");f.parser.registerOscHandler(10,Q=>{if(Q==="?"){const Y=uc,te=parseInt(Y.slice(1,3),16),ie=parseInt(Y.slice(3,5),16),oe=parseInt(Y.slice(5,7),16);return c(`\x1B]10;rgb:${p(te)}/${p(ie)}/${p(oe)}\x07`),!0}return!1}),f.parser.registerOscHandler(11,Q=>{if(Q==="?"){const Y=cc,te=parseInt(Y.slice(1,3),16),ie=parseInt(Y.slice(3,5),16),oe=parseInt(Y.slice(5,7),16);return c(`\x1B]11;rgb:${p(te)}/${p(ie)}/${p(oe)}\x07`),!0}return!1}),f.parser.registerOscHandler(12,Q=>Q==="?"?(c("\x1B]12;rgb:ffff/ffff/ffff\x07"),!0):!1),f.parser.registerOscHandler(4,Q=>{const Y=Q.match(/^(\d+);?\?$/);if(Y){const te=parseInt(Y[1]),ie=["0000/0000/0000","cdcb/0000/0000","0000/cdcb/0000","cdcb/cdcb/0000","1e1e/9090/ffff","cdcb/0000/cdcb","0000/cdcb/cdcb","e5e5/e5e5/e5e5"],oe=te<8?ie[te]:"0000/0000/0000";return c(`\x1B]4;${te};rgb:${oe}\x07`),!0}return!1}),f.parser.registerOscHandler(52,Q=>!!Q.includes("?")),f.parser.registerCsiHandler({prefix:">",final:"q"},Q=>(c("\x1BP>|xterm.js(5.0.0)\x1B\\"),!0)),f.parser.registerCsiHandler({prefix:"?",final:"u"},Q=>!0),f.parser.registerCsiHandler({prefix:"?",final:"m"},Q=>Q[0]===4?(c("\x1B[>4;0m"),!0):!1),f.parser.registerCsiHandler({final:"t"},Q=>{const Y=Q[0];return Y===19?(c(`\x1B[9;${f.rows};${f.cols}t`),!0):Y===20?(c("\x1B]LTerminal\x1B\\"),!0):Y===21?(c("\x1B]lTerminal\x1B\\"),!0):!1}),f.parser.registerCsiHandler({prefix:"?",final:"S"},Q=>!0),f.parser.registerDcsHandler({intermediates:"$",final:"q"},(Q,Y)=>Q==="m"?(c("\x1BP1$rm\x1B\\"),!0):Q==='"p'?(c('\x1BP1$r62;1"p\x1B\\'),!0):Q==="r"?(c(`\x1BP1$r1;${f.rows}r\x1B\\`),!0):(c("\x1BP0$r\x1B\\"),!0)),f.parser.registerDcsHandler({intermediates:"+",final:"q"},(Q,Y)=>{try{const ie=(Q.match(/.{2}/g)||[]).map(ce=>String.fromCharCode(parseInt(ce,16))).join(""),oe={TN:"xterm-256color",Co:"256",RGB:"",Tc:"",colors:"256",setrgbf:"\x1B[38;2;%p1%d;%p2%d;%p3%dm",setrgbb:"\x1B[48;2;%p1%d;%p2%d;%p3%dm"};if(ie in oe){const Be=oe[ie].split("").map(me=>me.charCodeAt(0).toString(16).padStart(2,"0")).join("");return c(`\x1BP1+r${Be}\x1B\\`),!0}}catch(te){console.error("[XTGETTCAP] Failed to decode:",te)}return c("\x1BP0+r\x1B\\"),!0}),f.parser.registerCsiHandler({final:"b"},Q=>{const Y=Q[0]||1;return Y>65535?(console.warn(`[REP] Large repeat count ${Y} clamped to 65535 for security`),!0):!1});let v=0,x=0,b=null,y=f.cols,k=f.rows,R=0,O=0,T=((Xe=window.visualViewport)==null?void 0:Xe.scale)??1;const B=(Q,Y)=>{f.cols>0&&(R=Q/f.cols),f.rows>0&&(O=Y/f.rows)},z=n.current.querySelector(".xterm-helper-textarea");z instanceof HTMLTextAreaElement&&(z.setAttribute("spellcheck","false"),z.setAttribute("autocapitalize","off"),z.setAttribute("autocomplete","off"),z.setAttribute("autocorrect","off"));const I=()=>{const Q=f.cols,Y=f.rows;!Q||!Y||Q===y&&Y===k||(y=Q,k=Y,s({type:"resize",cols:Q,rows:Y}))},j=()=>{s({type:"claim"})},$=(Q=!1)=>{var ce;if(a)return;const Y=n.current;if(!Y)return;const te=Y.clientWidth,ie=Y.clientHeight;if(!te||!ie||!Q&&te===v&&ie===x)return;const oe=((ce=window.visualViewport)==null?void 0:ce.scale)??1;if(!Q&&R>0&&O>0){const Be=Math.max(2,Math.floor(te/R)),me=Math.max(1,Math.floor(ie/O)),Tt=Math.abs(te-v),We=Math.abs(ie-x),At=Math.max(R*.75,2),pe=Math.max(O*.75,2),ni=Math.abs(oe-T)>.001;if(Be===y&&me===k){v=te,x=ie,T=oe;return}if(ni&&Tt<At&&We<pe){v=te,x=ie,T=oe;return}}v=te,x=ie,S.fit(),B(te,ie),T=oe,I()},E=(Q=!1)=>{if(b!==null){if(!Q)return;cancelAnimationFrame(b)}b=window.requestAnimationFrame(()=>{b=null,$(Q)})},A=new ResizeObserver(()=>{E()});A.observe(n.current),E();const P=typeof document<"u"?document.fonts:null,M=()=>{D||E(!0)};P==null||P.ready.then(M).catch(()=>{}),(Ut=P==null?void 0:P.addEventListener)==null||Ut.call(P,"loadingdone",M);let H=null,K=null,X=null,q=null,se=null,D=!1,F=0,W=null,U=!1,re=!1;const J=n.current.closest(".terminal-pane"),ae=Q=>{J instanceof HTMLElement&&(Q?J.dataset.terminalFocus="true":delete J.dataset.terminalFocus)},we=()=>{var Y;const Q=(Y=n.current)==null?void 0:Y.querySelector(".xterm-helper-textarea");if(Q instanceof HTMLTextAreaElement)try{Q.focus({preventScroll:!0})}catch{Q.focus()}},fe=()=>{D||we()},ut=()=>{D||(ae(!0),we())},ne=()=>{window.setTimeout(()=>{if(D)return;const Q=n.current;Q&&(Q.contains(document.activeElement)||ae(!1))},0)};n.current.addEventListener("pointerdown",fe,{passive:!0,capture:!0}),n.current.addEventListener("mousedown",fe,{passive:!0,capture:!0}),n.current.addEventListener("touchstart",fe,{passive:!0,capture:!0}),n.current.addEventListener("focusin",ut,!0),n.current.addEventListener("focusout",ne,!0),se=()=>{var Q,Y,te,ie,oe;(Q=n.current)==null||Q.removeEventListener("pointerdown",fe,!0),(Y=n.current)==null||Y.removeEventListener("mousedown",fe,!0),(te=n.current)==null||te.removeEventListener("touchstart",fe,!0),(ie=n.current)==null||ie.removeEventListener("focusin",ut,!0),(oe=n.current)==null||oe.removeEventListener("focusout",ne,!0)};const ht=async(Q=!1)=>{if(!D){C=!0,w=!1,g=0;try{const{token:Y,authEnabled:te}=await tv();if(D)return;const ie=te?`${t}?token=${Y}`:t;let oe=ie;if(Q&&l.current>0){const ce=ie.includes("?")?"&":"?";oe=`${ie}${ce}bufferOffset=${l.current}`}if(Q){const ce=oe.includes("?")?"&":"?";oe=`${oe}${ce}reconnect=1`}if(H=new WebSocket(oe),H.binaryType="arraybuffer",_.current=H,H.addEventListener("open",()=>{var ce;F=0,re=!0,v=0,x=0,R=0,O=0,y=-1,k=-1,T=((ce=window.visualViewport)==null?void 0:ce.scale)??1,E()}),H.addEventListener("message",ce=>{if(typeof ce.data=="string"){let me=null;try{me=JSON.parse(ce.data)}catch{return}if((me==null?void 0:me.type)==="sync"){C=!0,w=!1,g=0,a=!1,l.current=me.offsetBase,me.reset&&(f.reset(),$(!0),a=!0);return}if((me==null?void 0:me.type)==="ready"){w=!0,g===0&&o();return}return}if(ce.data instanceof Blob){ce.data.arrayBuffer().then(Tt=>{if(D)return;const We=new Uint8Array(Tt);g++,f.write(We,()=>{l.current+=We.byteLength,g=Math.max(0,g-1),w&&g===0&&o()})});return}const Be=new Uint8Array(ce.data);g++,f.write(Be,()=>{l.current+=Be.byteLength,g=Math.max(0,g-1),w&&g===0&&o()})}),H.addEventListener("close",ce=>{if(!(D||U)){if(ce.code===1e3&&Av.has(ce.reason)){u.current();return}if(F<fc){F++;const Be=pc*Math.pow(2,F-1);W=setTimeout(()=>ht(!0),Be)}else f.write(`\r
|
|
48
|
+
`,s)}paste(o){this._core.paste(o)}refresh(o,s){this._verifyIntegers(o,s),this._core.refresh(o,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(o){this._addonManager.loadAddon(this,o)}static get strings(){return l}_verifyIntegers(...o){for(const s of o)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...o){for(const s of o)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}_.Terminal=g})(),h})())})(qh);var $_=qh.exports,Xh={exports:{}};(function(e,t){(function(r,i){e.exports=i()})(self,()=>(()=>{var r={};return(()=>{var i=r;Object.defineProperty(i,"__esModule",{value:!0}),i.FitAddon=void 0,i.FitAddon=class{activate(n){this._terminal=n}dispose(){}fit(){const n=this.proposeDimensions();if(!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;const h=this._terminal._core;this._terminal.rows===n.rows&&this._terminal.cols===n.cols||(h._renderService.clear(),this._terminal.resize(n.cols,n.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const n=this._terminal._core,h=n._renderService.dimensions;if(h.css.cell.width===0||h.css.cell.height===0)return;const _=this._terminal.options.scrollback===0?0:n.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(l.getPropertyValue("height")),f=Math.max(0,parseInt(l.getPropertyValue("width"))),S=window.getComputedStyle(this._terminal.element),d=u-(parseInt(S.getPropertyValue("padding-top"))+parseInt(S.getPropertyValue("padding-bottom"))),m=f-(parseInt(S.getPropertyValue("padding-right"))+parseInt(S.getPropertyValue("padding-left")))-_;return{cols:Math.max(2,Math.floor(m/h.css.cell.width)),rows:Math.max(1,Math.floor(d/h.css.cell.height))}}}})(),r})())})(Xh);var U_=Xh.exports,Yh={exports:{}};(function(e,t){(function(r,i){e.exports=i()})(hf,()=>(()=>{var r={433:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV11=void 0;const u=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],f=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],S=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],d=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let m;function C(w,g){let a,o=0,s=g.length-1;if(w<g[0][0]||w>g[s][1])return!1;for(;s>=o;)if(a=o+s>>1,w>g[a][1])o=a+1;else{if(!(w<g[a][0]))return!0;s=a-1}return!1}l.UnicodeV11=class{constructor(){if(this.version="11",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160);for(let w=0;w<u.length;++w)m.fill(0,u[w][0],u[w][1]+1);for(let w=0;w<S.length;++w)m.fill(2,S[w][0],S[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?m[w]:C(w,f)?0:C(w,d)?2:1}}}},i={};function n(_){var l=i[_];if(l!==void 0)return l.exports;var u=i[_]={exports:{}};return r[_](u,u.exports,n),u.exports}var h={};return(()=>{var _=h;Object.defineProperty(_,"__esModule",{value:!0}),_.Unicode11Addon=void 0;const l=n(433);_.Unicode11Addon=class{activate(u){u.unicode.register(new l.UnicodeV11)}dispose(){}}})(),h})())})(Yh);var W_=Yh.exports,Qh={exports:{}};(function(e,t){(function(r,i){e.exports=i()})(self,()=>(()=>{var r={6:(_,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(f,S,d,m={}){this._terminal=f,this._regex=S,this._handler=d,this._options=m}provideLinks(f,S){const d=u.computeLink(f,this._regex,this._terminal,this._handler);S(this._addCallbacks(d))}_addCallbacks(f){return f.map(S=>(S.leave=this._options.leave,S.hover=(d,m)=>{if(this._options.hover){const{range:C}=S;this._options.hover(d,m,C)}},S))}};class u{static computeLink(S,d,m,C){const w=new RegExp(d.source,(d.flags||"")+"g"),[g,a]=u._getWindowedLineStrings(S-1,m),o=g.join("");let s;const c=[];for(;s=w.exec(o);){const p=s[0];try{const R=new URL(p),O=decodeURI(R.toString());if(p!==O&&p+"/"!==O)continue}catch{continue}const[v,x]=u._mapStrIdx(m,a,0,s.index),[b,y]=u._mapStrIdx(m,v,x,p.length);if(v===-1||x===-1||b===-1||y===-1)continue;const k={start:{x:x+1,y:v+1},end:{x:y,y:b+1}};c.push({range:k,text:p,activate:C})}return c}static _getWindowedLineStrings(S,d){let m,C=S,w=S,g=0,a="";const o=[];if(m=d.buffer.active.getLine(S)){const s=m.translateToString(!0);if(m.isWrapped&&s[0]!==" "){for(g=0;(m=d.buffer.active.getLine(--C))&&g<2048&&(a=m.translateToString(!0),g+=a.length,o.push(a),m.isWrapped&&a.indexOf(" ")===-1););o.reverse()}for(o.push(s),g=0;(m=d.buffer.active.getLine(++w))&&m.isWrapped&&g<2048&&(a=m.translateToString(!0),g+=a.length,o.push(a),a.indexOf(" ")===-1););}return[o,C]}static _mapStrIdx(S,d,m,C){const w=S.buffer.active,g=w.getNullCell();let a=m;for(;C;){const o=w.getLine(d);if(!o)return[-1,-1];for(let s=a;s<o.length;++s){o.getCell(s,g);const c=g.getChars();if(g.getWidth()&&(C-=c.length||1,s===o.length-1&&c==="")){const p=w.getLine(d+1);p&&p.isWrapped&&(p.getCell(0,g),g.getWidth()===2&&(C+=1))}if(C<0)return[d,s]}d++,a=0}return[d,a]}}l.LinkComputer=u}},i={};function n(_){var l=i[_];if(l!==void 0)return l.exports;var u=i[_]={exports:{}};return r[_](u,u.exports,n),u.exports}var h={};return(()=>{var _=h;Object.defineProperty(_,"__esModule",{value:!0}),_.WebLinksAddon=void 0;const l=n(6),u=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(S,d){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}_.WebLinksAddon=class{constructor(S=f,d={}){this._handler=S,this._options=d}activate(S){this._terminal=S;const d=this._options,m=d.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,m,this._handler,d))}dispose(){var S;(S=this._linkProvider)===null||S===void 0||S.dispose()}}})(),h})())})(Qh);var V_=Qh.exports;const K_="",q_="",Jh="保存しました。",G_="デッキを作成する前にワークスペースを追加してください。",X_="ワークスペースを選択してください。",Y_=2e3,Zh='"JetBrains Mono", monospace',ed=14,Q_='"Cascadia Code", "JetBrains Mono", "Consolas", "Menlo", monospace',J_=13,cc="#000000",uc="#ffffff",td="deck-theme",Z_=204;async function ue(e,t={}){const r=await fetch(`${K_}${e}`,{...t,credentials:"include"});if(!r.ok){const i=await r.text();throw new Error(i||`Request failed (${r.status})`)}return r.status===Z_?null:r.json()}const Ue="application/json",rt="POST",rd="PUT",Zi="DELETE";function ev(){return window.location.origin.replace(/^http/,"ws")}function tv(){return ue("/api/ws-token")}function rv(){return ue("/api/workspaces")}function iv(){return ue("/api/config")}function nv(e){return ue("/api/workspaces",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({path:e})})}function sv(e){return ue(`/api/workspaces/${e}`,{method:Zi})}function ov(){return ue("/api/decks")}function lv(e,t){return ue("/api/decks",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({name:e,workspaceId:t})})}function av(e){return ue(`/api/decks/${e}`,{method:Zi})}function cv(e){return ue("/api/decks/order",{method:rd,headers:{"Content-Type":Ue},body:JSON.stringify({deckIds:e})})}function hc(e,t=""){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/files?${r.toString()}`)}function dc(e,t=""){const r=new URLSearchParams({path:e,subpath:t});return ue(`/api/preview?${r.toString()}`)}function uv(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/file?${r.toString()}`)}function hv(e,t,r){return ue("/api/file",{method:rd,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,path:t,contents:r})})}function dv(e,t,r=""){return ue("/api/file",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,path:t,contents:r})})}function fv(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/file?${r.toString()}`,{method:Zi})}function pv(e,t){return ue("/api/dir",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,path:t})})}function _v(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return ue(`/api/dir?${r.toString()}`,{method:Zi})}function vv(e,t,r){return ue("/api/terminals",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({deckId:e,title:t,command:r})})}function mv(e){const t=new URLSearchParams({deckId:e});return ue(`/api/terminals?${t.toString()}`)}function gv(e){return ue(`/api/terminals/${e}`,{method:Zi})}function id(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/status?${i.toString()}`)}function yv(e){const t=new URLSearchParams({workspaceId:e});return ue(`/api/git/repos?${t.toString()}`)}function nd(e,t,r){return ue("/api/git/stage",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,paths:t,repoPath:r})})}function sd(e,t,r){return ue("/api/git/unstage",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,paths:t,repoPath:r})})}function Sv(e,t,r){return ue("/api/git/commit",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,message:t,repoPath:r})})}function Cv(e,t,r){return ue("/api/git/discard",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,paths:t,repoPath:r})})}function wv(e,t,r,i){const n={workspaceId:e,path:t,staged:r.toString()};i!==void 0&&(n.repoPath=i);const h=new URLSearchParams(n);return ue(`/api/git/diff?${h.toString()}`)}function xv(e,t){return ue("/api/git/push",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,repoPath:t})})}function bv(e,t){return ue("/api/git/pull",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,repoPath:t})})}function Ev(e,t){return ue("/api/git/fetch",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,repoPath:t})})}function od(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/branch-status?${i.toString()}`)}function ld(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/remotes?${i.toString()}`)}function kv(e,t){const r={workspaceId:e};t!==void 0&&(r.repoPath=t);const i=new URLSearchParams(r);return ue(`/api/git/branches?${i.toString()}`)}function Lv(e,t,r){return ue("/api/git/checkout",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,branchName:t,repoPath:r})})}function Dv(e,t,r=!0,i){return ue("/api/git/create-branch",{method:rt,headers:{"Content-Type":Ue},body:JSON.stringify({workspaceId:e,branchName:t,checkout:r,repoPath:i})})}function Rv(e,t=50,r){const i={workspaceId:e,limit:String(t)};r!==void 0&&(i.repoPath=r);const n=new URLSearchParams(i);return ue(`/api/git/log?${n.toString()}`)}const Tv="接続が終了しました。",fc=5,pc=1e3,Av=new Set(["Deck deleted","Terminal deleted","Terminal exited","Terminal not found"]),_c=new TextEncoder;function Pv(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function Mv({session:e,wsUrl:t,onDelete:r,onExit:i}){const n=N.useRef(null),h=N.useRef(null),_=N.useRef(null),l=N.useRef(0),u=N.useRef(i);return N.useEffect(()=>{u.current=i},[i]),N.useEffect(()=>{var Xe,Ut;if(!n.current)return;l.current=0,n.current.innerHTML="";const f=new $_.Terminal({cursorBlink:!0,fontFamily:Q_,fontSize:J_,allowProposedApi:!0,scrollback:3e3,convertEol:!1,windowsMode:!1,rightClickSelectsWord:!0,theme:{background:cc,foreground:uc},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),S=new U_.FitAddon,d=new W_.Unicode11Addon,m=new V_.WebLinksAddon;f.loadAddon(S),f.loadAddon(d),f.loadAddon(m),f.unicode.activeVersion="11",h.current=S,f.open(n.current);let C=!0,w=!1,g=0,a=!1;const o=()=>{C=!1,a&&(a=!1,E(!0)),window.requestAnimationFrame(()=>{f.scrollToBottom()})},s=J=>{const Y=_.current;Y&&Y.readyState===WebSocket.OPEN&&Y.send(JSON.stringify(J))},c=J=>{if(C)return;const Y=_.current;Y&&Y.readyState===WebSocket.OPEN&&Y.send(_c.encode(J))};f.parser.registerCsiHandler({final:"n"},J=>{const Y=J.length>0?J[0]:0;if(Y===6){const te=f.buffer.active,ie=te.cursorY+te.baseY+1,oe=te.cursorX+1;return c(`\x1B[${ie};${oe}R`),!0}else if(Y===5)return c("\x1B[0n"),!0;return!1}),f.parser.registerCsiHandler({final:"c"},J=>(c("\x1B[?62;1;6;22c"),!0)),f.parser.registerCsiHandler({prefix:">",final:"c"},J=>(c("\x1B[>1;500;0c"),!0)),f.parser.registerCsiHandler({prefix:"?",final:"p",intermediates:"$"},J=>{const Y=J[0]||0,te=f.modes;let ie=0;return Y===1?ie=te.applicationCursorKeysMode?1:2:Y===25?ie=1:Y===1e3?ie=te.mouseTrackingMode==="x10"?1:2:Y===1002?ie=te.mouseTrackingMode==="drag"?1:2:Y===1003?ie=te.mouseTrackingMode==="any"?1:2:Y===1004?ie=te.sendFocusMode?1:2:Y===1006?ie=te.mouseTrackingMode!=="none"?1:2:Y===1049?ie=f.buffer.active.type==="alternate"?1:2:Y===2004?ie=te.bracketedPasteMode?1:2:Y===2026&&(ie=2),c(`\x1B[?${Y};${ie}$y`),!0});const p=J=>(J*257).toString(16).padStart(4,"0");f.parser.registerOscHandler(10,J=>{if(J==="?"){const Y=uc,te=parseInt(Y.slice(1,3),16),ie=parseInt(Y.slice(3,5),16),oe=parseInt(Y.slice(5,7),16);return c(`\x1B]10;rgb:${p(te)}/${p(ie)}/${p(oe)}\x07`),!0}return!1}),f.parser.registerOscHandler(11,J=>{if(J==="?"){const Y=cc,te=parseInt(Y.slice(1,3),16),ie=parseInt(Y.slice(3,5),16),oe=parseInt(Y.slice(5,7),16);return c(`\x1B]11;rgb:${p(te)}/${p(ie)}/${p(oe)}\x07`),!0}return!1}),f.parser.registerOscHandler(12,J=>J==="?"?(c("\x1B]12;rgb:ffff/ffff/ffff\x07"),!0):!1),f.parser.registerOscHandler(4,J=>{const Y=J.match(/^(\d+);?\?$/);if(Y){const te=parseInt(Y[1]),ie=["0000/0000/0000","cdcb/0000/0000","0000/cdcb/0000","cdcb/cdcb/0000","1e1e/9090/ffff","cdcb/0000/cdcb","0000/cdcb/cdcb","e5e5/e5e5/e5e5"],oe=te<8?ie[te]:"0000/0000/0000";return c(`\x1B]4;${te};rgb:${oe}\x07`),!0}return!1}),f.parser.registerOscHandler(52,J=>!!J.includes("?")),f.parser.registerCsiHandler({prefix:">",final:"q"},J=>(c("\x1BP>|xterm.js(5.0.0)\x1B\\"),!0)),f.parser.registerCsiHandler({prefix:"?",final:"u"},J=>!0),f.parser.registerCsiHandler({prefix:"?",final:"m"},J=>J[0]===4?(c("\x1B[>4;0m"),!0):!1),f.parser.registerCsiHandler({final:"t"},J=>{const Y=J[0];return Y===19?(c(`\x1B[9;${f.rows};${f.cols}t`),!0):Y===20?(c("\x1B]LTerminal\x1B\\"),!0):Y===21?(c("\x1B]lTerminal\x1B\\"),!0):!1}),f.parser.registerCsiHandler({prefix:"?",final:"S"},J=>!0),f.parser.registerDcsHandler({intermediates:"$",final:"q"},(J,Y)=>J==="m"?(c("\x1BP1$rm\x1B\\"),!0):J==='"p'?(c('\x1BP1$r62;1"p\x1B\\'),!0):J==="r"?(c(`\x1BP1$r1;${f.rows}r\x1B\\`),!0):(c("\x1BP0$r\x1B\\"),!0)),f.parser.registerDcsHandler({intermediates:"+",final:"q"},(J,Y)=>{try{const ie=(J.match(/.{2}/g)||[]).map(ce=>String.fromCharCode(parseInt(ce,16))).join(""),oe={TN:"xterm-256color",Co:"256",RGB:"",Tc:"",colors:"256",setrgbf:"\x1B[38;2;%p1%d;%p2%d;%p3%dm",setrgbb:"\x1B[48;2;%p1%d;%p2%d;%p3%dm"};if(ie in oe){const Be=oe[ie].split("").map(me=>me.charCodeAt(0).toString(16).padStart(2,"0")).join("");return c(`\x1BP1+r${Be}\x1B\\`),!0}}catch(te){console.error("[XTGETTCAP] Failed to decode:",te)}return c("\x1BP0+r\x1B\\"),!0}),f.parser.registerCsiHandler({final:"b"},J=>{const Y=J[0]||1;return Y>65535?(console.warn(`[REP] Large repeat count ${Y} clamped to 65535 for security`),!0):!1});let v=0,x=0,b=null,y=f.cols,k=f.rows,R=0,O=0,T=((Xe=window.visualViewport)==null?void 0:Xe.scale)??1;const B=(J,Y)=>{f.cols>0&&(R=J/f.cols),f.rows>0&&(O=Y/f.rows)},z=n.current.querySelector(".xterm-helper-textarea");z instanceof HTMLTextAreaElement&&(z.setAttribute("spellcheck","false"),z.setAttribute("autocapitalize","off"),z.setAttribute("autocomplete","off"),z.setAttribute("autocorrect","off"));const I=()=>{const J=f.cols,Y=f.rows;!J||!Y||J===y&&Y===k||(y=J,k=Y,s({type:"resize",cols:J,rows:Y}))},j=()=>{s({type:"claim"})},$=(J=!1)=>{var ce;if(a)return;const Y=n.current;if(!Y)return;const te=Y.clientWidth,ie=Y.clientHeight;if(!te||!ie||!J&&te===v&&ie===x)return;const oe=((ce=window.visualViewport)==null?void 0:ce.scale)??1;if(!J&&R>0&&O>0){const Be=Math.max(2,Math.floor(te/R)),me=Math.max(1,Math.floor(ie/O)),Tt=Math.abs(te-v),We=Math.abs(ie-x),At=Math.max(R*.75,2),pe=Math.max(O*.75,2),ni=Math.abs(oe-T)>.001;if(Be===y&&me===k){v=te,x=ie,T=oe;return}if(ni&&Tt<At&&We<pe){v=te,x=ie,T=oe;return}}v=te,x=ie,S.fit(),B(te,ie),T=oe,I()},E=(J=!1)=>{if(b!==null){if(!J)return;cancelAnimationFrame(b)}b=window.requestAnimationFrame(()=>{b=null,$(J)})},A=new ResizeObserver(()=>{E()});A.observe(n.current),E();const P=typeof document<"u"?document.fonts:null,M=()=>{D||E(!0)};P==null||P.ready.then(M).catch(()=>{}),(Ut=P==null?void 0:P.addEventListener)==null||Ut.call(P,"loadingdone",M);let H=null,K=null,X=null,q=null,se=null,D=!1,F=0,W=null,U=!1,re=!1;const Q=n.current.closest(".terminal-pane"),ae=J=>{Q instanceof HTMLElement&&(J?Q.dataset.terminalFocus="true":delete Q.dataset.terminalFocus)},we=()=>{var Y;const J=(Y=n.current)==null?void 0:Y.querySelector(".xterm-helper-textarea");if(J instanceof HTMLTextAreaElement)try{J.focus({preventScroll:!0})}catch{J.focus()}},fe=()=>{D||we()},ut=()=>{D||(ae(!0),we())},ne=()=>{window.setTimeout(()=>{D||Q&&Q.contains(document.activeElement)||ae(!1)},0)};n.current.addEventListener("pointerdown",fe,{passive:!0,capture:!0}),n.current.addEventListener("mousedown",fe,{passive:!0,capture:!0}),n.current.addEventListener("touchstart",fe,{passive:!0,capture:!0}),n.current.addEventListener("focusin",ut,!0),n.current.addEventListener("focusout",ne,!0),se=()=>{var J,Y,te,ie,oe;(J=n.current)==null||J.removeEventListener("pointerdown",fe,!0),(Y=n.current)==null||Y.removeEventListener("mousedown",fe,!0),(te=n.current)==null||te.removeEventListener("touchstart",fe,!0),(ie=n.current)==null||ie.removeEventListener("focusin",ut,!0),(oe=n.current)==null||oe.removeEventListener("focusout",ne,!0)};const ht=async(J=!1)=>{if(!D){C=!0,w=!1,g=0;try{const{token:Y,authEnabled:te}=await tv();if(D)return;const ie=te?`${t}?token=${Y}`:t;let oe=ie;if(J&&l.current>0){const ce=ie.includes("?")?"&":"?";oe=`${ie}${ce}bufferOffset=${l.current}`}if(J){const ce=oe.includes("?")?"&":"?";oe=`${oe}${ce}reconnect=1`}if(H=new WebSocket(oe),H.binaryType="arraybuffer",_.current=H,H.addEventListener("open",()=>{var ce;F=0,re=!0,v=0,x=0,R=0,O=0,y=-1,k=-1,T=((ce=window.visualViewport)==null?void 0:ce.scale)??1,E()}),H.addEventListener("message",ce=>{if(typeof ce.data=="string"){let me=null;try{me=JSON.parse(ce.data)}catch{return}if((me==null?void 0:me.type)==="sync"){C=!0,w=!1,g=0,a=!1,l.current=me.offsetBase,me.reset&&f.reset(),$(!0),a=!0;return}if((me==null?void 0:me.type)==="ready"){w=!0,g===0&&o();return}return}if(ce.data instanceof Blob){ce.data.arrayBuffer().then(Tt=>{if(D)return;const We=new Uint8Array(Tt);g++,f.write(We,()=>{l.current+=We.byteLength,g=Math.max(0,g-1),w&&g===0&&o()})});return}const Be=new Uint8Array(ce.data);g++,f.write(Be,()=>{l.current+=Be.byteLength,g=Math.max(0,g-1),w&&g===0&&o()})}),H.addEventListener("close",ce=>{if(!(D||U)){if(ce.code===1e3&&Av.has(ce.reason)){u.current();return}if(F<fc){F++;const Be=pc*Math.pow(2,F-1);W=setTimeout(()=>ht(!0),Be)}else f.write(`\r
|
|
49
49
|
\x1B[31m${Tv}\x1B[0m\r
|
|
50
50
|
`)}}),H.addEventListener("error",()=>{}),K&&K.dispose(),K=f.onData(ce=>{C||H&&H.readyState===WebSocket.OPEN&&(j(),H.send(_c.encode(ce)))}),X&&X.dispose(),X=f.onBinary(ce=>{C||H&&H.readyState===WebSocket.OPEN&&(j(),H.send(Pv(ce)))}),!q&&f.textarea){const ce=()=>{j()};f.textarea.addEventListener("focus",ce),q=()=>{var Be;(Be=f.textarea)==null||Be.removeEventListener("focus",ce)}}}catch(Y){if(console.error("[Terminal] Failed to connect:",Y),F<fc&&re){F++;const te=pc*Math.pow(2,F-1);W=setTimeout(()=>ht(!0),te)}else f.write(`\r
|
|
51
51
|
\x1B[31m接続エラー: ${Y instanceof Error?Y.message:"Unknown error"}\x1B[0m\r
|
|
52
|
-
`)}}};return ht(),()=>{var
|
|
52
|
+
`)}}};return ht(),()=>{var J;D=!0,U=!0,W&&clearTimeout(W),b!==null&&cancelAnimationFrame(b),A.disconnect(),(J=P==null?void 0:P.removeEventListener)==null||J.call(P,"loadingdone",M),K&&K.dispose(),X&&X.dispose(),q&&q(),se&&se(),ae(!1),H&&H.close(),_.current=null,h.current=null,f.dispose()}},[e.id,t]),L.jsxs("div",{className:"terminal-tile",children:[L.jsxs("div",{className:"terminal-tile-header",children:[L.jsx("span",{children:e.title}),L.jsx("button",{type:"button",className:"terminal-close-btn",onClick:()=>{window.confirm("このターミナルを閉じますか?")&&r()},"aria-label":"ターミナルを閉じる",children:"×"})]}),L.jsx("div",{className:"terminal-tile-body",ref:n})]})}function Bv(e){if(e<=1)return{cols:1,rows:1};const t=Math.ceil(Math.sqrt(e)),r=Math.ceil(e/t);return{cols:t,rows:r}}function Ov({terminals:e,wsBase:t,onDeleteTerminal:r,onExitTerminal:i}){const{cols:n,rows:h}=Bv(e.length);return L.jsx("section",{className:"terminal-pane",children:e.length===0?L.jsx("div",{className:"terminal-empty",children:L.jsx("span",{className:"terminal-empty-text",children:"ターミナルを追加"})}):L.jsx("div",{className:"terminal-grid",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${h}, minmax(0, 1fr))`},children:e.map(_=>L.jsx(Mv,{session:_,wsUrl:`${t}/api/terminals/${_.id}`,onDelete:()=>r(_.id),onExit:()=>i(_.id)},_.id))})})}const Nv="ワークスペースがありません。";function jv({workspaces:e,selectedWorkspaceId:t,onSelect:r,onDelete:i}){return L.jsx("div",{className:"w-full grid gap-2",children:e.length===0?L.jsx("div",{className:"flex items-center justify-center text-muted text-[13px] p-8",children:Nv}):e.map(n=>L.jsxs("div",{className:tt("flex items-center gap-2 p-4 border border-border rounded bg-panel transition-colors hover:bg-list-hover",n.id===t&&"bg-list-active border-accent"),children:[L.jsxs("button",{type:"button",className:"flex-1 min-w-0 text-left bg-transparent border-0 p-0 cursor-pointer",onClick:()=>r(n.id),children:[L.jsx("div",{className:"font-semibold text-[15px] mb-1",children:n.name}),L.jsx("div",{className:"text-[12px] text-muted font-mono truncate",children:n.path})]}),L.jsx("button",{type:"button",className:"flex-shrink-0 w-7 h-7 flex items-center justify-center rounded bg-transparent border-0 text-muted cursor-pointer hover:bg-[rgba(0,0,0,0.08)] hover:text-ink transition-colors dark:hover:bg-[rgba(255,255,255,0.08)]",title:"\\u524a\\u9664",onClick:h=>{h.stopPropagation(),confirm(`「${n.name}」を削除しますか?`)&&i(n.id)},children:L.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[L.jsx("polyline",{points:"3 6 5 6 21 6"}),L.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]},n.id))})}function Iv({contextMenu:e,onNewFile:t,onNewFolder:r,onDelete:i}){var n;return L.jsxs("div",{className:"fixed z-[1000] min-w-[160px] py-1 bg-panel border border-border rounded-[6px] shadow-[0_4px_12px_rgba(0,0,0,0.15)]",style:{left:e.x,top:e.y},onClick:h=>h.stopPropagation(),children:[(e.isRoot||((n=e.node)==null?void 0:n.type)==="dir")&&L.jsxs(L.Fragment,{children:[L.jsx("button",{type:"button",className:"block w-full px-3 py-1.5 text-[13px] text-left bg-transparent border-0 text-ink cursor-pointer hover:bg-list-hover",onClick:()=>{var h;return t(((h=e.node)==null?void 0:h.path)||"",e.node?1:0)},children:"新規ファイル"}),L.jsx("button",{type:"button",className:"block w-full px-3 py-1.5 text-[13px] text-left bg-transparent border-0 text-ink cursor-pointer hover:bg-list-hover",onClick:()=>{var h;return r(((h=e.node)==null?void 0:h.path)||"",e.node?1:0)},children:"新規フォルダ"})]}),e.node&&!e.isRoot&&L.jsxs(L.Fragment,{children:[e.node.type==="dir"&&L.jsx("div",{className:"h-px my-1 bg-border"}),L.jsx("button",{type:"button",className:"block w-full px-3 py-1.5 text-[13px] text-left bg-transparent border-0 text-[#f14c4c] cursor-pointer hover:bg-[rgba(241,76,76,0.1)]",onClick:()=>i(e.node),children:"削除"})]})]})}const vc="読み込み中...",Fv="ファイル",Hv="更新",zv="ファイルが見つかりません。",$v="戻る";function Uv(e,t){if(!t)return"";const r=t.find(i=>i.path===e||e.endsWith(i.path));return r?`git-tree-${r.status}`:""}const Wv=()=>L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"tree-chevron-icon",children:L.jsx("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}),mc=()=>L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"tree-svg",children:L.jsx("path",{d:"M3.5 7.5h6l2 2h9a1 1 0 0 1 1 1V18a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V7.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})}),gc=()=>L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"tree-svg",children:[L.jsx("path",{d:"M6 3.5h8l4 4V20a1.5 1.5 0 0 1-1.5 1.5H6A1.5 1.5 0 0 1 4.5 20V5A1.5 1.5 0 0 1 6 3.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),L.jsx("path",{d:"M14 3.5V8h4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})]});function ad({root:e,entries:t=[],loading:r,error:i,mode:n="tree",canBack:h,onBack:_,onToggleDir:l,onOpenFile:u,onRefresh:f,onCreateFile:S,onCreateDirectory:d,onDeleteFile:m,onDeleteDirectory:C,gitFiles:w}){const[g,a]=N.useState(null),[o,s]=N.useState(null),[c,p]=N.useState(""),v=N.useRef(null),x=N.useRef(null),b=t??[];N.useEffect(()=>{const j=()=>a(null);if(g)return document.addEventListener("click",j),()=>document.removeEventListener("click",j)},[g]),N.useEffect(()=>{o&&v.current&&v.current.focus()},[o]);const y=N.useCallback((j,$,E=!1)=>{j.preventDefault(),j.stopPropagation();const A=180,P=150,M=Math.min(j.clientX,window.innerWidth-A-4),H=Math.min(j.clientY,window.innerHeight-P-4);a({x:M,y:H,node:$,isRoot:E})},[]),k=N.useCallback((j,$)=>{a(null),s({parentPath:j,type:"file",depth:$}),p("")},[]),R=N.useCallback((j,$)=>{a(null),s({parentPath:j,type:"dir",depth:$}),p("")},[]),O=N.useCallback(j=>{a(null),j.type==="dir"?window.confirm(`フォルダ "${j.name}" を削除しますか?
|
|
53
53
|
中のファイルも全て削除されます。`)&&(C==null||C(j.path)):window.confirm(`ファイル "${j.name}" を削除しますか?`)&&(m==null||m(j.path))},[m,C]),T=N.useCallback(()=>{if(!o||!c.trim()){s(null);return}const j=c.trim();o.type==="file"?S==null||S(o.parentPath,j):d==null||d(o.parentPath,j),s(null),p("")},[o,c,S,d]),B=N.useCallback(j=>{j.key==="Enter"?T():j.key==="Escape"&&s(null)},[T]),z=j=>!o||o.depth!==j?null:L.jsxs("div",{className:"tree-row tree-input-row",style:{paddingLeft:12+j*16},children:[L.jsx("span",{className:"tree-icon","aria-hidden":"true",children:o.type==="dir"?L.jsx(mc,{}):L.jsx(gc,{})}),L.jsx("input",{ref:v,type:"text",className:"tree-input",value:c,onChange:$=>p($.target.value),onKeyDown:B,onBlur:T,placeholder:o.type==="dir"?"フォルダ名":"ファイル名"})]}),I=(j,$)=>j.map(E=>{const A=E.type==="file"?Uv(E.path,w):"";return L.jsxs("div",{children:[L.jsxs("button",{type:"button",className:tt("tree-row",E.type==="dir"&&"is-dir",n==="tree"&&E.expanded&&"is-open",A),style:{paddingLeft:12+$*16},onClick:()=>E.type==="dir"?l(E):u(E),onContextMenu:P=>y(P,E),"aria-expanded":E.type==="dir"&&n==="tree"?E.expanded:void 0,title:E.path,children:[L.jsx("span",{className:"tree-chevron","aria-hidden":"true",children:E.type==="dir"?L.jsx(Wv,{}):null}),L.jsx("span",{className:`tree-icon ${E.type}`,"aria-hidden":"true",children:E.type==="dir"?L.jsx(mc,{}):L.jsx(gc,{})}),L.jsx("span",{className:"tree-label",children:E.name}),E.loading?L.jsx("span",{className:"tree-meta",children:vc}):null]}),n==="tree"&&E.expanded&&E.type==="dir"&&L.jsxs(L.Fragment,{children:[(o==null?void 0:o.parentPath)===E.path&&z($+1),E.children&&E.children.length>0&&I(E.children,$+1)]})]},E.path)});return L.jsxs("section",{className:"panel file-tree",ref:x,children:[L.jsxs("div",{className:"panel-header",children:[L.jsxs("div",{children:[L.jsx("div",{className:"panel-title",children:Fv}),L.jsx("div",{className:"panel-subtitle",children:e})]}),L.jsxs("div",{className:"tree-actions",children:[_?L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:_,disabled:h===!1,children:$v}):null,L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:f,children:Hv})]})]}),L.jsxs("div",{className:"panel-body tree-body",onContextMenu:j=>y(j,null,!0),children:[r?L.jsx("div",{className:"tree-state",children:vc}):null,i?L.jsx("div",{className:"tree-state text-[#f14c4c]",children:i}):null,b.length===0&&!r?L.jsx("div",{className:"tree-state",children:zv}):null,(o==null?void 0:o.parentPath)===""&&z(0),I(b,0)]}),g&&L.jsx(Iv,{contextMenu:g,onNewFile:k,onNewFolder:R,onDelete:O})]})}function ss(){return{files:[],activeFileId:null,tree:[],treeLoading:!1,treeError:null}}function os(){return{terminals:[]}}function Vv(e){const t=e.lastIndexOf(".");return t===-1||t===0?"":e.slice(t+1).toLowerCase()}function Kv(e){const t=Vv(e);return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",h:"c",hpp:"cpp",sh:"shell",bash:"shell",zsh:"shell",fish:"shell",xml:"xml",yaml:"yaml",yml:"yaml",toml:"toml",sql:"sql",graphql:"graphql",vue:"vue",svelte:"svelte",php:"php",r:"r",swift:"swift",kt:"kotlin",dart:"dart",lua:"lua",dockerfile:"dockerfile"}[t]||"plaintext"}function Pe(e){return e instanceof Error?e.message:String(e)}function ls(e){return e.map(t=>({...t,expanded:!1,loading:!1,children:t.type==="dir"?[]:void 0}))}function cd(e){return Kv(e)}function tl(e,t,r){return t?e.map(i=>{if(i.path===t&&i.type==="dir"){const h=[...i.children||[],r].sort((_,l)=>_.type!==l.type?_.type==="dir"?-1:1:_.name.localeCompare(l.name));return{...i,children:h,expanded:!0}}return i.children?{...i,children:tl(i.children,t,r)}:i}):[...e,r].sort((n,h)=>n.type!==h.type?n.type==="dir"?-1:1:n.name.localeCompare(h.name))}function rl(e,t){return e.filter(r=>r.path===t?!1:(r.children&&(r.children=rl(r.children,t)),!0))}function Dr(e,t,r){return e.map(i=>i.path===t?r(i):i.children?{...i,children:Dr(i.children,t,r)}:i)}function yc(e){return e.trim().replace(/[\\/]+$/,"").replace(/\\/g,"/").toLowerCase()}function qv(e){return e.includes("\\")?"\\":"/"}function Gv(e,t){const r=qv(e),i=e.replace(/[\\/]+$/,"");return i?`${i}${r}${t}`:t}function Sc(e){const t=e.replace(/[\\/]+$/,"");if(!t)return e;if(/^[A-Za-z]:$/.test(t))return`${t}\\`;if(t==="/")return"/";const r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));if(t.startsWith("/")&&r===0)return"/";if(r<=0)return t;const i=t.slice(0,r);return/^[A-Za-z]:$/.test(i)?`${i}\\`:i}function ud(){if(typeof window>"u")return{view:"terminal",workspaceId:null,deckIds:[],workspaceMode:"list"};const e=new URLSearchParams(window.location.search),t=e.get("view"),r=e.get("mode"),i=e.get("decks")||e.get("deck"),n=i?i.split(",").filter(Boolean):[];return{view:t==="workspace"?"workspace":"terminal",workspaceId:e.get("workspace"),deckIds:n,workspaceMode:r==="editor"?"editor":"list"}}function Xv(){if(typeof window>"u")return"light";const e=window.localStorage.getItem(td);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ne(e,t=1e4){return Promise.race([e,new Promise((r,i)=>setTimeout(()=>i(new Error("Request timeout")),t))])}const Yv=({isOpen:e,defaultRoot:t,onSubmit:r,onClose:i})=>{const[n,h]=N.useState(""),[_,l]=N.useState([]),[u,f]=N.useState(!1),[S,d]=N.useState(null),[m,C]=N.useState(!1),w=Kh(e,i),g=n.trim()||t,a=N.useMemo(()=>g?Sc(g)!==g:!1,[g]);N.useEffect(()=>{if(!e){l([]),f(!1),d(null);return}let v=!0;return f(!0),d(null),dc(g,"").then(x=>{v&&(l(ls(x)),f(!1))}).catch(x=>{v&&(d(Pe(x)),f(!1))}),()=>{v=!1}},[e,g]),N.useEffect(()=>{e&&(n.trim()||t&&h(t))},[t,e,n]);const o=()=>{e&&(f(!0),d(null),dc(g,"").then(v=>{l(ls(v)),f(!1)}).catch(v=>{d(Pe(v)),f(!1)}))},s=v=>{if(v.type!=="dir")return;const x=Gv(g,v.name);h(x)},c=()=>{if(!g)return;const v=Sc(g);v&&v!==g&&h(v)},p=async v=>{if(v.preventDefault(),!m){C(!0);try{await r(n),h("")}finally{C(!1)}}};return e?L.jsx("div",{className:"fixed inset-0 bg-black/50 grid place-items-center z-[500]",role:"dialog","aria-modal":"true","aria-labelledby":"workspace-modal-title",children:L.jsxs("form",{className:"modal flex flex-col !overflow-hidden",ref:w,onSubmit:p,children:[L.jsx("div",{className:"text-[14px] font-semibold mb-3 shrink-0",id:"workspace-modal-title",children:"ワークスペース追加"}),L.jsxs("label",{className:"grid gap-1 text-xs shrink-0",children:[L.jsx("span",{children:"パス"}),L.jsx("input",{type:"text",className:"bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus",value:n,placeholder:t||"",required:!0,maxLength:500,onChange:v=>h(v.target.value)})]}),L.jsx("div",{className:"flex-1 min-h-0 mt-3",children:L.jsx(ad,{root:g,entries:_,loading:u,error:S,mode:"navigator",canBack:a,onBack:c,onToggleDir:s,onOpenFile:()=>{},onRefresh:o})}),L.jsxs("div",{className:"flex justify-end gap-2 mt-4 shrink-0",children:[L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:i,disabled:m,children:"キャンセル"}),L.jsx("button",{type:"submit",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",disabled:m,children:m?"追加中...":"追加"})]})]})}):null},Qv="ステージ",Jv="アンステージ",Zv="変更を破棄",em="差分を表示",tm={modified:"M",staged:"A",untracked:"U",deleted:"D",renamed:"R",conflicted:"C"};function Cc({file:e,onStage:t,onUnstage:r,onDiscard:i,onShowDiff:n}){const h=`git-${e.status}`,_=tm[e.status];return L.jsxs("div",{className:"git-file-row",children:[L.jsxs("button",{type:"button",className:"git-file-main",onClick:()=>n(e),title:em,children:[L.jsx("span",{className:`git-status-badge ${h}`,children:_}),L.jsx("span",{className:"git-file-path",children:e.path})]}),L.jsx("div",{className:"git-file-actions",children:e.staged?L.jsx("button",{type:"button",className:"git-action-btn",onClick:()=>r(e.path),title:Jv,children:L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M19 13H5v-2h14v2z"})})}):L.jsxs(L.Fragment,{children:[L.jsx("button",{type:"button",className:"git-action-btn",onClick:()=>i(e.path),title:Zv,children:L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}),L.jsx("button",{type:"button",className:"git-action-btn",onClick:()=>t(e.path),title:Qv,children:L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})})]})})]})}const rm="ステージ済みの変更",im="変更",nm="コミット",sm="コミットメッセージを入力...",om="変更はありません",lm="すべてステージ",am="すべてアンステージ",wc="Push",xc="Pull",cm="Pushing...",um="Pulling...";function hm({status:e,branchStatus:t,hasRemote:r,pushing:i,pulling:n,commitMessage:h,onCommitMessageChange:_,onCommit:l,onStageFile:u,onUnstageFile:f,onStageAll:S,onUnstageAll:d,onDiscardFile:m,onShowDiff:C,onPush:w,onPull:g}){const a=e.files.filter(v=>v.staged),o=e.files.filter(v=>!v.staged),s=e.files.length>0,c=a.length>0,p=N.useCallback(v=>{v.key==="Enter"&&(v.ctrlKey||v.metaKey)&&(v.preventDefault(),l())},[l]);return L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"flex flex-col gap-2 px-3",children:[L.jsx("textarea",{className:"border border-border rounded-[2px] p-2 text-[13px] font-[inherit] bg-panel text-ink resize-y min-h-[50px] focus:outline-none focus:border-focus",placeholder:sm,value:h,onChange:v=>_(v.target.value),onKeyDown:p,rows:3}),L.jsx("button",{type:"button",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",onClick:l,disabled:!c||!h.trim(),children:nm})]}),r&&L.jsxs("div",{className:"flex gap-2 px-3 py-2 border-b border-border",children:[L.jsxs("button",{type:"button",className:"flex-1 flex items-center justify-center gap-1.5 px-2.5 py-1.5 bg-transparent border border-border rounded-[2px] text-ink text-xs cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:g,disabled:n||i,title:t!=null&&t.behind?`${t.behind} commits behind`:xc,children:[L.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M12 4v12m0 0l-4-4m4 4l4-4M4 20h16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),n?um:xc,t!=null&&t.behind?` (${t.behind})`:""]}),L.jsxs("button",{type:"button",className:"flex-1 flex items-center justify-center gap-1.5 px-2.5 py-1.5 bg-transparent border border-border rounded-[2px] text-ink text-xs cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:w,disabled:i||n,title:t!=null&&t.ahead?`${t.ahead} commits ahead`:wc,children:[L.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M12 20V8m0 0l4 4m-4-4l-4 4M4 4h16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),i?cm:wc,t!=null&&t.ahead?` (${t.ahead})`:""]})]}),s?L.jsxs(L.Fragment,{children:[a.length>0&&L.jsxs("div",{className:"flex flex-col",children:[L.jsxs("div",{className:"flex items-center justify-between px-3 py-1",children:[L.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted",children:[rm," (",a.length,")"]}),L.jsx("button",{type:"button",className:"w-[22px] h-[22px] p-0 border-0 rounded-[3px] bg-transparent text-ink-muted cursor-pointer flex items-center justify-center hover:bg-list-hover hover:text-ink",onClick:d,title:am,children:L.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M19 13H5v-2h14v2z"})})})]}),L.jsx("div",{className:"flex flex-col",children:a.map(v=>L.jsx(Cc,{file:v,onStage:u,onUnstage:f,onDiscard:m,onShowDiff:C},v.path))})]}),o.length>0&&L.jsxs("div",{className:"flex flex-col",children:[L.jsxs("div",{className:"flex items-center justify-between px-3 py-1",children:[L.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted",children:[im," (",o.length,")"]}),L.jsx("button",{type:"button",className:"w-[22px] h-[22px] p-0 border-0 rounded-[3px] bg-transparent text-ink-muted cursor-pointer flex items-center justify-center hover:bg-list-hover hover:text-ink",onClick:S,title:lm,children:L.jsx("svg",{className:"w-3.5 h-3.5 fill-current",viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})})})]}),L.jsx("div",{className:"flex flex-col",children:o.map(v=>L.jsx(Cc,{file:v,onStage:u,onUnstage:f,onDiscard:m,onShowDiff:C},v.path))})]})]}):L.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:om})]})}const dm="読み込み中...",fm="新規ブランチ",pm="作成",_m="キャンセル";function vm({branches:e,branchesLoading:t,onCheckoutBranch:r,onCreateBranch:i}){const[n,h]=N.useState(!1),[_,l]=N.useState(""),u=N.useCallback(()=>{_.trim()&&(i(_.trim()),l(""),h(!1))},[_,i]),f=N.useCallback(S=>{S.key==="Enter"?(S.preventDefault(),u()):S.key==="Escape"&&(h(!1),l(""))},[u]);return L.jsxs("div",{className:"flex flex-col gap-2",children:[L.jsx("div",{className:"px-3 py-2 border-b border-border",children:n?L.jsxs("div",{className:"flex gap-1.5 items-center",children:[L.jsx("input",{type:"text",className:"flex-1 px-2 py-1 text-xs border border-border rounded-[2px] bg-panel text-ink font-mono focus:outline-none focus:border-focus",placeholder:"ブランチ名...",value:_,onChange:S=>l(S.target.value),onKeyDown:f,autoFocus:!0}),L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:u,disabled:!_.trim(),children:pm}),L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>{h(!1),l("")},children:_m})]}):L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>h(!0),children:fm})}),t?L.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:dm}):L.jsx("div",{className:"flex flex-col",children:e.map(S=>L.jsxs("button",{type:"button",className:tt("flex items-center gap-2 px-3 py-1.5 bg-transparent border-0 text-ink text-[13px] cursor-pointer text-left transition-colors hover:bg-list-hover disabled:cursor-default",S.current&&"bg-list-active cursor-default"),onClick:()=>!S.current&&r(S.name),disabled:S.current,children:[L.jsxs("svg",{className:"w-4 h-4 flex-shrink-0 text-ink-muted",viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M6 3v12M18 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zM6 21a3 3 0 1 1 0-6 3 3 0 0 1 0 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),L.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),L.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono",children:S.name}),S.current&&L.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 bg-accent text-white rounded-[3px]",children:"現在"})]},S.name))})]})}const mm="読み込み中...";function gm({logs:e,logsLoading:t}){return L.jsx("div",{className:"flex flex-col",children:t?L.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:mm}):e.length===0?L.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:"コミット履歴がありません"}):L.jsx("div",{className:"flex flex-col",children:e.map(r=>L.jsxs("div",{className:"flex flex-col gap-0.5 px-3 py-2 border-b border-border hover:bg-list-hover transition-colors",children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("span",{className:"font-mono text-xs text-accent font-semibold",children:r.hashShort}),L.jsx("span",{className:"text-xs text-ink-muted",children:r.author})]}),L.jsx("div",{className:"text-[13px] text-ink overflow-hidden text-ellipsis whitespace-nowrap",children:r.message}),L.jsx("div",{className:"text-[11px] text-muted",children:new Date(r.date).toLocaleString()})]},r.hash))})})}const fi="ソースコントロール",ym="Gitリポジトリではありません",Sm="ワークスペースを選択してください",Cm="読み込み中...",to="更新",wm="変更",xm="ブランチ",bm="履歴",ro="border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover disabled:opacity-50 disabled:cursor-not-allowed",io="flex items-center justify-center h-full text-muted text-[13px] p-5";function Em({status:e,loading:t,error:r,workspaceId:i,branchStatus:n,hasRemote:h,pushing:_,pulling:l,branches:u,branchesLoading:f,logs:S,logsLoading:d,repos:m,selectedRepoPath:C,onSelectRepo:w,onRefresh:g,onStageFile:a,onUnstageFile:o,onStageAll:s,onUnstageAll:c,onCommit:p,onDiscardFile:v,onShowDiff:x,onPush:b,onPull:y,onLoadBranches:k,onCheckoutBranch:R,onCreateBranch:O,onLoadLogs:T}){const[B,z]=N.useState(""),[I,j]=N.useState("changes"),$=N.useCallback(()=>{B.trim()&&(p(B.trim()),z(""))},[B,p]),E=N.useCallback(M=>{j(M),M==="branches"?k():M==="history"&&T()},[k,T]);if(!i)return L.jsxs("section",{className:"panel",children:[L.jsx("div",{className:"panel-header",children:L.jsx("div",{className:"panel-title",children:fi})}),L.jsx("div",{className:"panel-body",children:L.jsx("div",{className:io,children:Sm})})]});if(t)return L.jsxs("section",{className:"panel",children:[L.jsx("div",{className:"panel-header",children:L.jsx("div",{className:"panel-title",children:fi})}),L.jsx("div",{className:"panel-body",children:L.jsx("div",{className:io,children:Cm})})]});if(r)return L.jsxs("section",{className:"panel",children:[L.jsxs("div",{className:"panel-header",children:[L.jsx("div",{className:"panel-title",children:fi}),L.jsx("button",{type:"button",className:ro,onClick:g,children:to})]}),L.jsx("div",{className:"panel-body",children:L.jsx("div",{className:"flex items-center justify-center h-full text-[#f14c4c] text-[13px] p-5",children:r})})]});if(!(e!=null&&e.isGitRepo))return L.jsxs("section",{className:"panel",children:[L.jsxs("div",{className:"panel-header",children:[L.jsx("div",{className:"panel-title",children:fi}),L.jsx("button",{type:"button",className:ro,onClick:g,children:to})]}),L.jsx("div",{className:"panel-body",children:L.jsx("div",{className:io,children:ym})})]});const A=e.files.length>0,P=m.length>1;return L.jsxs("section",{className:"panel",children:[L.jsxs("div",{className:"panel-header",children:[L.jsxs("div",{children:[L.jsx("div",{className:"panel-title",children:fi}),L.jsxs("div",{className:"panel-subtitle flex items-center gap-1.5",children:[L.jsxs("svg",{viewBox:"0 0 24 24",className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":"true",children:[L.jsx("path",{d:"M6 3v12M18 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zM6 21a3 3 0 1 1 0-6 3 3 0 0 1 0 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),L.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),e.branch]})]}),L.jsx("button",{type:"button",className:ro,onClick:g,children:to})]}),P&&L.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-sidebar text-xs",children:[L.jsx("svg",{className:"w-3.5 h-3.5 text-muted flex-shrink-0",viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-6l-2-2H5a2 2 0 0 0-2 2z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),L.jsx("select",{className:"flex-1 min-w-0 bg-panel border border-border rounded-[2px] px-2 py-1 text-[12px] font-mono text-ink focus:outline-none focus:border-focus",value:C||"",onChange:M=>w(M.target.value),children:m.map(M=>L.jsxs("option",{value:M.path,children:[M.name," (",M.branch,") ",M.fileCount>0?`• ${M.fileCount}`:""]},M.path))}),L.jsxs("span",{className:"text-[11px] text-muted font-mono flex-shrink-0",children:[m.length," repos"]})]}),L.jsxs("div",{className:"git-tabs",children:[L.jsxs("button",{type:"button",className:tt("git-tab",I==="changes"&&"active"),onClick:()=>E("changes"),children:[wm,A&&L.jsx("span",{className:"text-[10px] font-semibold bg-accent/20 text-accent rounded-full px-1.5 py-0.5 leading-none",children:e.files.length})]}),L.jsx("button",{type:"button",className:tt("git-tab",I==="branches"&&"active"),onClick:()=>E("branches"),children:xm}),L.jsx("button",{type:"button",className:tt("git-tab",I==="history"&&"active"),onClick:()=>E("history"),children:bm})]}),L.jsxs("div",{className:"panel-body",children:[I==="changes"&&L.jsx(hm,{status:e,branchStatus:n,hasRemote:h,pushing:_,pulling:l,commitMessage:B,onCommitMessageChange:z,onCommit:$,onStageFile:a,onUnstageFile:o,onStageAll:s,onUnstageAll:c,onDiscardFile:v,onShowDiff:x,onPush:b,onPull:y}),I==="branches"&&L.jsx(vm,{branches:u,branchesLoading:f,onCheckoutBranch:R,onCreateBranch:O}),I==="history"&&L.jsx(gm,{logs:S,logsLoading:d})]})]})}function bc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function km(e){if(Array.isArray(e))return e}function Lm(e,t,r){return(t=Bm(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dm(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,n,h,_,l=[],u=!0,f=!1;try{if(h=(r=r.call(e)).next,t!==0)for(;!(u=(i=h.call(r)).done)&&(l.push(i.value),l.length!==t);u=!0);}catch(S){f=!0,n=S}finally{try{if(!u&&r.return!=null&&(_=r.return(),Object(_)!==_))return}finally{if(f)throw n}}return l}}function Rm(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
54
54
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ec(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function kc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ec(Object(r),!0).forEach(function(i){Lm(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ec(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Tm(e,t){if(e==null)return{};var r,i,n=Am(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Am(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function Pm(e,t){return km(e)||Dm(e,t)||Om(e,t)||Rm()}function Mm(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bm(e){var t=Mm(e,"string");return typeof t=="symbol"?t:t+""}function Om(e,t){if(e){if(typeof e=="string")return bc(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bc(e,t):void 0}}function Nm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function Dc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lc(Object(r),!0).forEach(function(i){Nm(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lc(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function jm(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(i){return t.reduceRight(function(n,h){return h(n)},i)}}function gi(e){return function t(){for(var r=this,i=arguments.length,n=new Array(i),h=0;h<i;h++)n[h]=arguments[h];return n.length>=e.length?e.apply(this,n):function(){for(var _=arguments.length,l=new Array(_),u=0;u<_;u++)l[u]=arguments[u];return t.apply(r,[].concat(n,l))}}}function as(e){return{}.toString.call(e).includes("Object")}function Im(e){return!Object.keys(e).length}function qi(e){return typeof e=="function"}function Fm(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Hm(e,t){return as(t)||sr("changeType"),Object.keys(t).some(function(r){return!Fm(e,r)})&&sr("changeField"),t}function zm(e){qi(e)||sr("selectorType")}function $m(e){qi(e)||as(e)||sr("handlerType"),as(e)&&Object.values(e).some(function(t){return!qi(t)})&&sr("handlersType")}function Um(e){e||sr("initialIsRequired"),as(e)||sr("initialType"),Im(e)&&sr("initialContent")}function Wm(e,t){throw new Error(e[t]||e.default)}var Vm={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},sr=gi(Wm)(Vm),Sn={changes:Hm,selector:zm,handler:$m,initial:Um};function Km(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sn.initial(e),Sn.handler(t);var r={current:e},i=gi(Xm)(r,t),n=gi(Gm)(r),h=gi(Sn.changes)(e),_=gi(qm)(r);function l(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(S){return S};return Sn.selector(f),f(r.current)}function u(f){jm(i,n,h,_)(f)}return[l,u]}function qm(e,t){return qi(t)?t(e.current):t}function Gm(e,t){return e.current=Dc(Dc({},e.current),t),t}function Xm(e,t,r){return qi(t)?t(e.current):Object.keys(r).forEach(function(i){var n;return(n=t[i])===null||n===void 0?void 0:n.call(t,e.current[i])}),r}var Ym={create:Km},Qm={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Jm(e){return function t(){for(var r=this,i=arguments.length,n=new Array(i),h=0;h<i;h++)n[h]=arguments[h];return n.length>=e.length?e.apply(this,n):function(){for(var _=arguments.length,l=new Array(_),u=0;u<_;u++)l[u]=arguments[u];return t.apply(r,[].concat(n,l))}}}function Zm(e){return{}.toString.call(e).includes("Object")}function eg(e){return e||Rc("configIsRequired"),Zm(e)||Rc("configType"),e.urls?(tg(),{paths:{vs:e.urls.monacoBase}}):e}function tg(){console.warn(hd.deprecation)}function rg(e,t){throw new Error(e[t]||e.default)}var hd={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
55
55
|
You are using deprecated way of configuration.
|
|
@@ -60,6 +60,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
60
60
|
monaco.config({ paths: { vs: '...' } })
|
|
61
61
|
|
|
62
62
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
63
|
-
`},Rc=Jm(rg)(hd),ig={config:eg},ng=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return function(n){return r.reduceRight(function(h,_){return _(h)},n)}};function dd(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],dd(e[r],t[r]))}),kc(kc({},e),t)}var sg={type:"cancelation",msg:"operation is manually canceled"};function no(e){var t=!1,r=new Promise(function(i,n){e.then(function(h){return t?n(sg):i(h)}),e.catch(n)});return r.cancel=function(){return t=!0},r}var og=["monaco"],lg=Ym.create({config:Qm,isInitialized:!1,resolve:null,reject:null,monaco:null}),fd=Pm(lg,2),en=fd[0],Es=fd[1];function ag(e){var t=ig.config(e),r=t.monaco,i=Tm(t,og);Es(function(n){return{config:dd(n.config,i),monaco:r}})}function cg(){var e=en(function(t){var r=t.monaco,i=t.isInitialized,n=t.resolve;return{monaco:r,isInitialized:i,resolve:n}});if(!e.isInitialized){if(Es({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),no(so);if(window.monaco&&window.monaco.editor)return pd(window.monaco),e.resolve(window.monaco),no(so);ng(ug,dg)(fg)}return no(so)}function ug(e){return document.body.appendChild(e)}function hg(e){var t=document.createElement("script");return e&&(t.src=e),t}function dg(e){var t=en(function(i){var n=i.config,h=i.reject;return{config:n,reject:h}}),r=hg("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function fg(){var e=en(function(r){var i=r.config,n=r.resolve,h=r.reject;return{config:i,resolve:n,reject:h}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var i=r.m||r;pd(i),e.resolve(i)},function(r){e.reject(r)})}function pd(e){en().monaco||Es({monaco:e})}function pg(){return en(function(e){var t=e.monaco;return t})}var so=new Promise(function(e,t){return Es({resolve:e,reject:t})}),_d={config:ag,init:cg,__getMonacoInstance:pg},_g={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},oo=_g,vg={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},mg=vg;function gg({children:e}){return vr.createElement("div",{style:mg.container},e)}var yg=gg,Sg=yg;function Cg({width:e,height:t,isEditorReady:r,loading:i,_ref:n,className:h,wrapperProps:_}){return vr.createElement("section",{style:{...oo.wrapper,width:e,height:t},..._},!r&&vr.createElement(Sg,null,i),vr.createElement("div",{ref:n,style:{...oo.fullWidth,...!r&&oo.hide},className:h}))}var wg=Cg,vd=N.memo(wg);function xg(e){N.useEffect(e,[])}var md=xg;function bg(e,t,r=!0){let i=N.useRef(!0);N.useEffect(i.current||!r?()=>{i.current=!1}:e,t)}var nt=bg;function Ri(){}function zr(e,t,r,i){return Eg(e,i)||kg(e,t,r,i)}function Eg(e,t){return e.editor.getModel(gd(e,t))}function kg(e,t,r,i){return e.editor.createModel(t,r,i?gd(e,i):void 0)}function gd(e,t){return e.Uri.parse(t)}function Lg({original:e,modified:t,language:r,originalLanguage:i,modifiedLanguage:n,originalModelPath:h,modifiedModelPath:_,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:u=!1,theme:f="light",loading:S="Loading...",options:d={},height:m="100%",width:C="100%",className:w,wrapperProps:g={},beforeMount:a=Ri,onMount:o=Ri}){let[s,c]=N.useState(!1),[p,v]=N.useState(!0),x=N.useRef(null),b=N.useRef(null),y=N.useRef(null),k=N.useRef(o),R=N.useRef(a),O=N.useRef(!1);md(()=>{let I=_d.init();return I.then(j=>(b.current=j)&&v(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>x.current?z():I.cancel()}),nt(()=>{if(x.current&&b.current){let I=x.current.getOriginalEditor(),j=zr(b.current,e||"",i||r||"text",h||"");j!==I.getModel()&&I.setModel(j)}},[h],s),nt(()=>{if(x.current&&b.current){let I=x.current.getModifiedEditor(),j=zr(b.current,t||"",n||r||"text",_||"");j!==I.getModel()&&I.setModel(j)}},[_],s),nt(()=>{let I=x.current.getModifiedEditor();I.getOption(b.current.editor.EditorOption.readOnly)?I.setValue(t||""):t!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[t],s),nt(()=>{var I,j;(j=(I=x.current)==null?void 0:I.getModel())==null||j.original.setValue(e||"")},[e],s),nt(()=>{let{original:I,modified:j}=x.current.getModel();b.current.editor.setModelLanguage(I,i||r||"text"),b.current.editor.setModelLanguage(j,n||r||"text")},[r,i,n],s),nt(()=>{var I;(I=b.current)==null||I.editor.setTheme(f)},[f],s),nt(()=>{var I;(I=x.current)==null||I.updateOptions(d)},[d],s);let T=N.useCallback(()=>{var $;if(!b.current)return;R.current(b.current);let I=zr(b.current,e||"",i||r||"text",h||""),j=zr(b.current,t||"",n||r||"text",_||"");($=x.current)==null||$.setModel({original:I,modified:j})},[r,t,n,e,i,h,_]),B=N.useCallback(()=>{var I;!O.current&&y.current&&(x.current=b.current.editor.createDiffEditor(y.current,{automaticLayout:!0,...d}),T(),(I=b.current)==null||I.editor.setTheme(f),c(!0),O.current=!0)},[d,f,T]);N.useEffect(()=>{s&&k.current(x.current,b.current)},[s]),N.useEffect(()=>{!p&&!s&&B()},[p,s,B]);function z(){var j,$,E,A;let I=(j=x.current)==null?void 0:j.getModel();l||(($=I==null?void 0:I.original)==null||$.dispose()),u||((E=I==null?void 0:I.modified)==null||E.dispose()),(A=x.current)==null||A.dispose()}return vr.createElement(vd,{width:C,height:m,isEditorReady:s,loading:S,_ref:y,className:w,wrapperProps:g})}var Dg=Lg,Rg=N.memo(Dg);function Tg(e){let t=N.useRef();return N.useEffect(()=>{t.current=e},[e]),t.current}var Ag=Tg,Cn=new Map;function Pg({defaultValue:e,defaultLanguage:t,defaultPath:r,value:i,language:n,path:h,theme:_="light",line:l,loading:u="Loading...",options:f={},overrideServices:S={},saveViewState:d=!0,keepCurrentModel:m=!1,width:C="100%",height:w="100%",className:g,wrapperProps:a={},beforeMount:o=Ri,onMount:s=Ri,onChange:c,onValidate:p=Ri}){let[v,x]=N.useState(!1),[b,y]=N.useState(!0),k=N.useRef(null),R=N.useRef(null),O=N.useRef(null),T=N.useRef(s),B=N.useRef(o),z=N.useRef(),I=N.useRef(i),j=Ag(h),$=N.useRef(!1),E=N.useRef(!1);md(()=>{let M=_d.init();return M.then(H=>(k.current=H)&&y(!1)).catch(H=>(H==null?void 0:H.type)!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>R.current?P():M.cancel()}),nt(()=>{var H,K,X,q;let M=zr(k.current,e||i||"",t||n||"",h||r||"");M!==((H=R.current)==null?void 0:H.getModel())&&(d&&Cn.set(j,(K=R.current)==null?void 0:K.saveViewState()),(X=R.current)==null||X.setModel(M),d&&((q=R.current)==null||q.restoreViewState(Cn.get(h))))},[h],v),nt(()=>{var M;(M=R.current)==null||M.updateOptions(f)},[f],v),nt(()=>{!R.current||i===void 0||(R.current.getOption(k.current.editor.EditorOption.readOnly)?R.current.setValue(i):i!==R.current.getValue()&&(E.current=!0,R.current.executeEdits("",[{range:R.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),R.current.pushUndoStop(),E.current=!1))},[i],v),nt(()=>{var H,K;let M=(H=R.current)==null?void 0:H.getModel();M&&n&&((K=k.current)==null||K.editor.setModelLanguage(M,n))},[n],v),nt(()=>{var M;l!==void 0&&((M=R.current)==null||M.revealLine(l))},[l],v),nt(()=>{var M;(M=k.current)==null||M.editor.setTheme(_)},[_],v);let A=N.useCallback(()=>{var M;if(!(!O.current||!k.current)&&!$.current){B.current(k.current);let H=h||r,K=zr(k.current,i||e||"",t||n||"",H||"");R.current=(M=k.current)==null?void 0:M.editor.create(O.current,{model:K,automaticLayout:!0,...f},S),d&&R.current.restoreViewState(Cn.get(H)),k.current.editor.setTheme(_),l!==void 0&&R.current.revealLine(l),x(!0),$.current=!0}},[e,t,r,i,n,h,f,S,d,_,l]);N.useEffect(()=>{v&&T.current(R.current,k.current)},[v]),N.useEffect(()=>{!b&&!v&&A()},[b,v,A]),I.current=i,N.useEffect(()=>{var M,H;v&&c&&((M=z.current)==null||M.dispose(),z.current=(H=R.current)==null?void 0:H.onDidChangeModelContent(K=>{E.current||c(R.current.getValue(),K)}))},[v,c]),N.useEffect(()=>{if(v){let M=k.current.editor.onDidChangeMarkers(H=>{var X;let K=(X=R.current.getModel())==null?void 0:X.uri;if(K&&H.find(q=>q.path===K.path)){let q=k.current.editor.getModelMarkers({resource:K});p==null||p(q)}});return()=>{M==null||M.dispose()}}return()=>{}},[v,p]);function P(){var M,H;(M=z.current)==null||M.dispose(),m?d&&Cn.set(h,R.current.saveViewState()):(H=R.current.getModel())==null||H.dispose(),R.current.dispose()}return vr.createElement(vd,{width:C,height:w,isEditorReady:v,loading:u,_ref:O,className:g,wrapperProps:a})}var Mg=Pg,Bg=N.memo(Mg),Og=Bg;const Tc="ファイルを選択してください",Ng="vs-dark",jg="vs";function Ig(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())||"";return{ts:{icon:"TS",color:"#3178c6"},tsx:{icon:"TSX",color:"#3178c6"},js:{icon:"JS",color:"#f7df1e"},jsx:{icon:"JSX",color:"#61dafb"},json:{icon:"{ }",color:"#cbcb41"},html:{icon:"<>",color:"#e34c26"},css:{icon:"#",color:"#264de4"},scss:{icon:"S",color:"#cc6699"},md:{icon:"M↓",color:"#083fa1"},py:{icon:"PY",color:"#3776ab"},go:{icon:"GO",color:"#00add8"},rs:{icon:"RS",color:"#dea584"},java:{icon:"J",color:"#b07219"},sql:{icon:"SQL",color:"#e38c00"},yml:{icon:"Y",color:"#cb171e"},yaml:{icon:"Y",color:"#cb171e"},sh:{icon:"$",color:"#89e051"},bash:{icon:"$",color:"#89e051"},txt:{icon:"TXT",color:"#6a737d"}}[t]||{icon:"📄",color:"var(--ink-muted)"}}function Fg(e){return{typescript:"TypeScript",typescriptreact:"TypeScript React",javascript:"JavaScript",javascriptreact:"JavaScript React",json:"JSON",html:"HTML",css:"CSS",scss:"SCSS",markdown:"Markdown",python:"Python",go:"Go",rust:"Rust",java:"Java",sql:"SQL",yaml:"YAML",shell:"Shell",plaintext:"Plain Text"}[e]||e}function Hg({files:e,activeFileId:t,onSelectFile:r,onCloseFile:i,onChangeFile:n,onSaveFile:h,savingFileId:_,theme:l}){const u=e.find(g=>g.id===t),f=N.useRef(null),[S,d]=N.useState({line:1,column:1}),m=N.useCallback(g=>{f.current=g,g.onDidChangeCursorPosition(a=>{d({line:a.position.lineNumber,column:a.position.column})})},[]);N.useEffect(()=>{const g=a=>{!t||!((a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="s")||(a.preventDefault(),h==null||h(t))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[t,h]);const C=(g,a)=>{g.stopPropagation(),i(a)},w=(g,a)=>{g.button===1&&(g.preventDefault(),i(a))};return e.length===0?L.jsx("div",{className:"editor-container editor-empty",children:L.jsxs("div",{className:"editor-welcome",children:[L.jsx("div",{className:"editor-welcome-icon",children:L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),L.jsx("polyline",{points:"13 2 13 9 20 9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),L.jsx("div",{className:"editor-welcome-text",children:Tc}),L.jsx("div",{className:"editor-welcome-hint",children:"左のファイルツリーからファイルを選択"})]})}):L.jsxs("div",{className:"editor-container",children:[L.jsx("div",{className:"editor-tabs",children:L.jsx("div",{className:"editor-tabs-list",children:e.map(g=>{const{icon:a,color:o}=Ig(g.name),s=g.id===t,c=_===g.id;return L.jsxs("div",{className:tt("editor-tab",s&&"active",g.dirty&&"dirty"),onClick:()=>r(g.id),onMouseDown:p=>w(p,g.id),role:"tab","aria-selected":s,tabIndex:0,children:[L.jsx("span",{className:"editor-tab-icon",style:{color:o},children:a}),L.jsx("span",{className:"editor-tab-name",children:g.name}),g.dirty&&!c&&L.jsx("span",{className:"editor-tab-dirty","aria-label":"未保存",children:"●"}),c&&L.jsx("span",{className:"editor-tab-saving","aria-label":"保存中",children:L.jsx("svg",{viewBox:"0 0 24 24",className:"spin",children:L.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"30 70"})})}),L.jsx("button",{type:"button",className:"editor-tab-close",onClick:p=>C(p,g.id),"aria-label":"閉じる",children:L.jsx("svg",{viewBox:"0 0 24 24",children:L.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]},g.id)})})}),u&&L.jsx("div",{className:"editor-breadcrumb",children:L.jsx("span",{className:"editor-breadcrumb-path",children:u.path})}),L.jsx("div",{className:"editor-content",children:u?L.jsx(Og,{height:"100%",theme:l==="dark"?Ng:jg,language:u.language,value:u.contents,onChange:g=>n(u.id,g??""),onMount:m,options:{fontFamily:Zh,fontSize:ed,fontLigatures:!0,minimap:{enabled:!0,scale:1,showSlider:"mouseover"},smoothScrolling:!0,cursorBlinking:"smooth",cursorSmoothCaretAnimation:"on",renderLineHighlight:"all",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8,bottom:8},lineNumbers:"on",renderWhitespace:"selection",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0}}}):L.jsx("div",{className:"editor-no-file",children:L.jsx("span",{children:Tc})})}),u&&L.jsxs("div",{className:"editor-statusbar",children:[L.jsx("div",{className:"editor-statusbar-left",children:L.jsxs("span",{className:"editor-status-item",children:[L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M6 3v12M18 9a3 3 0 110 6 3 3 0 010-6zM6 21a3 3 0 110-6 3 3 0 010 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),L.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),"main"]})}),L.jsxs("div",{className:"editor-statusbar-right",children:[L.jsxs("span",{className:"editor-status-item",children:["Ln ",S.line,", Col ",S.column]}),L.jsx("span",{className:"editor-status-item",children:"UTF-8"}),L.jsx("span",{className:"editor-status-item",children:Fg(u.language)})]})]})]})}const zg="差分ビューア",$g="読み込み中...",Ug="閉じる",Wg="vs-dark",Vg="vs";function Kg({diff:e,loading:t,theme:r,onClose:i}){const n=e?cd(e.path):"plaintext";return L.jsxs("div",{className:"fixed inset-0 bg-bg z-50 grid grid-rows-[35px_minmax(0,1fr)]",children:[L.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 bg-title-bar border-b border-border",children:[L.jsxs("div",{children:[L.jsx("div",{className:"text-[13px] font-medium",children:zg}),e&&L.jsx("div",{className:"text-xs text-muted font-mono",children:e.path})]}),L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:i,children:Ug})]}),L.jsx("div",{className:"min-h-0 overflow-hidden",children:t?L.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:$g}):e?L.jsx(Rg,{height:"100%",theme:r==="dark"?Wg:Vg,language:n,original:e.original,modified:e.modified,options:{fontFamily:Zh,fontSize:ed,readOnly:!0,renderSideBySide:!0,minimap:{enabled:!1},smoothScrolling:!0}}):null})]})}function qg({activeWorkspace:e,defaultRoot:t,activeWorkspaceState:r,editorWorkspaceId:i,gitState:n,theme:h,savingFileId:_,onCloseWorkspaceEditor:l,onToggleDir:u,onOpenFile:f,onRefreshTree:S,onCreateFile:d,onCreateDirectory:m,onDeleteFile:C,onDeleteDirectory:w,onRefreshGit:g,onSelectRepo:a,onStageFile:o,onUnstageFile:s,onStageAll:c,onUnstageAll:p,onCommit:v,onDiscardFile:x,onShowDiff:b,onCloseDiff:y,onPush:k,onPull:R,onLoadBranches:O,onCheckoutBranch:T,onCreateBranch:B,onLoadLogs:z,onSelectFile:I,onCloseFile:j,onChangeFile:$,onSaveFile:E}){var q,se;const[A,P]=N.useState(!1),[M,H]=N.useState("files"),K=N.useCallback(D=>{f(D),P(!1)},[f]),X=((q=n.status)==null?void 0:q.files.length)??0;return L.jsxs("div",{className:tt("workspace-editor-overlay",A&&"drawer-open"),children:[L.jsxs("div",{className:"workspace-editor-header",children:[L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:l,children:"一覧に戻る"}),L.jsx("button",{type:"button",className:"sidebar-toggle-btn bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover min-h-[44px] min-w-[44px]",onClick:()=>P(D=>!D),"aria-label":"\\u30b5\\u30a4\\u30c9\\u30d0\\u30fc",children:L.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:L.jsx("path",{d:"M3 12h18M3 6h18M3 18h18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),L.jsx("div",{className:"workspace-meta",children:e?e.path:null})]}),L.jsxs("div",{className:"workspace-editor-grid",children:[L.jsxs("div",{className:"activity-bar",children:[L.jsx("button",{type:"button",className:tt("activity-bar-item",M==="files"&&"active"),onClick:()=>H("files"),title:"エクスプローラー",children:L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),L.jsxs("button",{type:"button",className:tt("activity-bar-item",M==="git"&&"active"),onClick:()=>{H("git"),g()},title:"ソースコントロール",children:[L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M6 3v12M18 9a3 3 0 110 6 3 3 0 010-6zM6 21a3 3 0 110-6 3 3 0 010 6z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),L.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),X>0&&L.jsx("span",{className:"activity-bar-badge",children:X})]})]}),L.jsx("div",{className:"sidebar-panel",children:L.jsx("div",{className:"sidebar-content",children:M==="files"?L.jsx(ad,{root:(e==null?void 0:e.path)||t||"",entries:r.tree,loading:r.treeLoading,error:r.treeError,onToggleDir:u,onOpenFile:K,onRefresh:S,onCreateFile:d,onCreateDirectory:m,onDeleteFile:C,onDeleteDirectory:w,gitFiles:(se=n.status)==null?void 0:se.files}):L.jsx(Em,{status:n.status,loading:n.loading,error:n.error,workspaceId:i,branchStatus:n.branchStatus,hasRemote:n.hasRemote,pushing:n.pushing,pulling:n.pulling,branches:n.branches,branchesLoading:n.branchesLoading,logs:n.logs,logsLoading:n.logsLoading,repos:n.repos,selectedRepoPath:n.selectedRepoPath,onSelectRepo:a,onRefresh:g,onStageFile:o,onUnstageFile:s,onStageAll:c,onUnstageAll:p,onCommit:v,onDiscardFile:x,onShowDiff:b,onPush:k,onPull:R,onLoadBranches:O,onCheckoutBranch:T,onCreateBranch:B,onLoadLogs:z})})}),L.jsx(Hg,{files:r.files,activeFileId:r.activeFileId,onSelectFile:I,onCloseFile:j,onChangeFile:$,onSaveFile:E,savingFileId:_,theme:h})]}),L.jsx("div",{className:"sidebar-overlay",onClick:()=>P(!1),"aria-hidden":"true"}),n.diffPath&&L.jsx(Kg,{diff:n.diff,loading:n.diffLoading,theme:h,onClose:y})]})}const Gg="設定",Xg="サーバー設定",Yg="ポート番号",Qg="Basic認証",Jg="Basic認証を有効にする",Zg="ユーザー名",e0="パスワード",t0="※ 12文字以上推奨",r0="キャンセル",i0="保存",n0="※ 設定を保存すると、サーバーが再起動されます",s0="WebSocket設定",o0="接続数上限 (IP毎)",l0="現在の接続数",a0="全接続をクリア",c0="適用",wn="bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus";function u0({isOpen:e,onClose:t,onSave:r}){const[i,n]=N.useState(8787),[h,_]=N.useState(!1),[l,u]=N.useState(""),[f,S]=N.useState(""),[d,m]=N.useState(!1),[C,w]=N.useState(1e3),[g,a]=N.useState(null),[o,s]=N.useState(!1),c=()=>{fetch("/api/ws/stats").then(b=>b.json()).then(b=>{a(b),w(b.limit)}).catch(b=>{console.error("Failed to load WS stats:",b)})};N.useEffect(()=>{if(!e)return;const b=y=>{y.key==="Escape"&&(y.preventDefault(),t())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]),N.useEffect(()=>{e&&(fetch("/api/settings").then(b=>b.json()).then(b=>{n(b.port),_(b.basicAuthEnabled),u(b.basicAuthUser),S(b.basicAuthPassword)}).catch(b=>{console.error("Failed to load settings:",b)}),c())},[e]);const p=async()=>{try{await fetch("/api/ws/limit",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:C})}),c()}catch(b){console.error("Failed to set WS limit:",b)}},v=async()=>{s(!0);try{await fetch("/api/ws/clear",{method:"POST"}),c()}catch(b){console.error("Failed to clear WS connections:",b)}finally{s(!1)}},x=async b=>{b.preventDefault(),m(!0);try{await r({port:i,basicAuthEnabled:h,basicAuthUser:l,basicAuthPassword:f}),t()}catch(y){console.error("Failed to save settings:",y),alert("設定の保存に失敗しました")}finally{m(!1)}};return e?L.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[500]",role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title",onClick:t,children:L.jsxs("div",{className:"modal w-[500px]",onClick:b=>b.stopPropagation(),children:[L.jsxs("div",{className:"flex items-center justify-between mb-4",children:[L.jsx("h2",{className:"m-0 text-[14px] font-semibold",id:"settings-modal-title",children:Gg}),L.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"閉じる",children:"×"})]}),L.jsxs("form",{onSubmit:x,children:[L.jsxs("div",{className:"flex flex-col gap-4",children:[L.jsxs("section",{className:"flex flex-col gap-3",children:[L.jsx("h3",{className:"m-0 text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted border-b border-border pb-2",children:Xg}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"port",className:"text-xs text-ink-muted",children:Yg}),L.jsx("input",{type:"number",id:"port",className:wn,value:i,onChange:b=>n(Number(b.target.value)),min:1024,max:65535,required:!0})]}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("h4",{className:"m-0 text-xs font-semibold text-ink-muted",children:Qg}),L.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[L.jsx("input",{type:"checkbox",checked:h,onChange:b=>_(b.target.checked)}),L.jsx("span",{children:Jg})]})]}),h&&L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"username",className:"text-xs text-ink-muted",children:Zg}),L.jsx("input",{type:"text",id:"username",className:wn,value:l,onChange:b=>u(b.target.value),required:h,autoComplete:"username"})]}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"password",className:"text-xs text-ink-muted",children:e0}),L.jsx("input",{type:"password",id:"password",className:wn,value:f,onChange:b=>S(b.target.value),required:h,minLength:12,autoComplete:"new-password"}),L.jsx("p",{className:"m-0 text-[11px] text-muted",children:t0})]})]})]}),L.jsxs("section",{className:"flex flex-col gap-3",children:[L.jsx("h3",{className:"m-0 text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted border-b border-border pb-2",children:s0}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"wsLimit",className:"text-xs text-ink-muted",children:o0}),L.jsxs("div",{className:"flex gap-2 items-center",children:[L.jsx("input",{type:"number",id:"wsLimit",className:`flex-1 ${wn}`,value:C,onChange:b=>w(Number(b.target.value)),min:1,max:1e4}),L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:p,children:c0})]})]}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{className:"text-xs text-ink-muted",children:l0}),L.jsx("div",{className:"border border-border rounded-[2px] p-2 text-xs bg-bg min-h-[40px] flex flex-col gap-1",children:g&&g.connections.length>0?g.connections.map(({ip:b,count:y})=>L.jsxs("div",{className:"flex justify-between items-center",children:[L.jsx("span",{className:"font-mono text-ink",children:b}),L.jsx("span",{className:"font-semibold text-ink-muted",children:y})]},b)):L.jsx("div",{className:"text-muted text-center",children:"接続なし"})})]}),L.jsx("div",{className:"flex flex-col gap-1",children:L.jsx("button",{type:"button",className:"bg-[#f14c4c] text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",onClick:v,disabled:o,children:o?"クリア中...":a0})})]}),L.jsx("p",{className:"m-0 text-[11px] text-muted italic",children:n0})]}),L.jsxs("div",{className:"flex justify-end gap-2 mt-4 border-t border-border pt-4",children:[L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:t,disabled:d,children:r0}),L.jsx("button",{type:"submit",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",disabled:d,children:d?"保存中...":i0})]})]})]})}):null}const h0=()=>{const[e,t]=N.useState({}),r=N.useCallback((n,h)=>{t(_=>{const l=_[n]||ss();return{..._,[n]:h(l)}})},[]),i=N.useCallback(n=>{t(h=>{const _={...h};return n.forEach(l=>{_[l]||(_[l]=ss())}),_})},[]);return{workspaceStates:e,setWorkspaceStates:t,updateWorkspaceState:r,initializeWorkspaceStates:i}},d0=()=>{const[e,t]=N.useState({}),r=N.useCallback((n,h)=>{t(_=>{const l=_[n]||os();return{..._,[n]:h(l)}})},[]),i=N.useCallback(n=>{t(h=>{const _={...h};return n.forEach(l=>{_[l]||(_[l]=os())}),_})},[]);return{deckStates:e,setDeckStates:t,updateDeckState:r,initializeDeckStates:i}},f0=({setStatusMessage:e,defaultRoot:t,initializeWorkspaceStates:r,setWorkspaceStates:i})=>{const[n,h]=N.useState([]),[_,l]=N.useState(null);N.useEffect(()=>{let S=!0;return rv().then(d=>{S&&(h(d),l(m=>m&&d.some(C=>C.id===m)?m:null),r(d.map(m=>m.id)))}).catch(d=>{S&&e(`ワークスペースを取得できませんでした: ${Pe(d)}`)}),()=>{S=!1}},[e,r]);const u=N.useCallback(async S=>{const m=S.trim()||t;if(!m)return e("パスを入力してください。"),null;const C=yc(m);if(n.some(g=>yc(g.path)===C))return e("同じパスのワークスペースは追加できません。"),null;try{const g=await nv(m);return h(a=>[...a,g]),l(g.id),i(a=>({...a,[g.id]:ss()})),g}catch(g){return e(`ワークスペースを追加できませんでした: ${Pe(g)}`),null}},[n,t,e,i]),f=N.useCallback(async S=>{try{await sv(S),h(d=>d.filter(m=>m.id!==S)),l(d=>d===S?null:d),i(d=>{const m={...d};return delete m[S],m})}catch(d){e(`ワークスペースを削除できませんでした: ${Pe(d)}`)}},[e,i]);return{workspaces:n,editorWorkspaceId:_,setEditorWorkspaceId:l,handleCreateWorkspace:u,handleDeleteWorkspace:f}},p0=({setStatusMessage:e,initializeDeckStates:t,updateDeckState:r,setDeckStates:i,initialDeckIds:n})=>{const[h,_]=N.useState([]),[l,u]=N.useState(n??[]);N.useEffect(()=>{let g=!0;return ov().then(a=>{g&&(_(a),t(a.map(o=>o.id)),a.forEach(o=>{mv(o.id).then(s=>{g&&r(o.id,c=>({...c,terminals:s}))}).catch(()=>{})}))}).catch(a=>{g&&e(`デッキを取得できませんでした: ${Pe(a)}`)}),()=>{g=!1}},[e,t,r]),N.useEffect(()=>{if(h.length===0)return;const g=l.filter(a=>h.some(o=>o.id===a));g.length===l.length&&g.length>0||(g.length>0?u(g):h[0]&&u([h[0].id]))},[h,l]);const f=N.useCallback(async(g,a)=>{try{const o=await lv(g,a);return _(s=>[...s,o]),u(s=>[...s.filter(c=>c!==o.id),o.id]),i(s=>({...s,[o.id]:os()})),o}catch(o){return e(`デッキの作成に失敗しました: ${Pe(o)}`),null}},[e,i]),S=N.useCallback(async g=>{try{await av(g),_(a=>a.filter(o=>o.id!==g)),u(a=>a.filter(o=>o!==g)),i(a=>{const o={...a};return delete o[g],o})}catch(a){e(`デッキの削除に失敗しました: ${Pe(a)}`)}},[e,i]),d=N.useCallback(g=>{_(a=>{const o=g(a);return cv(o.map(s=>s.id)).catch(()=>{}),o})},[]),m=N.useCallback(async(g,a,o,s)=>{try{const c=await vv(g,s,o);r(g,p=>({...p,terminals:[...p.terminals,{id:c.id,title:c.title}]}))}catch(c){e(`ターミナルを起動できませんでした: ${Pe(c)}`)}},[r,e]),C=N.useCallback(async(g,a)=>{try{await gv(a),r(g,o=>({...o,terminals:o.terminals.filter(s=>s.id!==a)}))}catch(o){e(`ターミナルを削除できませんでした: ${Pe(o)}`)}},[r,e]),w=N.useCallback((g,a)=>{r(g,o=>({...o,terminals:o.terminals.filter(s=>s.id!==a)}))},[r]);return{decks:h,activeDeckIds:l,setActiveDeckIds:u,handleCreateDeck:f,handleDeleteDeck:S,handleReorderDecks:d,handleCreateTerminal:m,handleDeleteTerminal:C,handleRemoveTerminalLocal:w}},_0=({editorWorkspaceId:e,activeWorkspaceState:t,updateWorkspaceState:r,setStatusMessage:i})=>{const[n,h]=N.useState(null),_=N.useCallback(()=>{e&&(r(e,a=>({...a,treeLoading:!0,treeError:null})),Ne(hc(e,""),15e3).then(a=>{r(e,o=>({...o,tree:ls(a),treeLoading:!1}))}).catch(a=>{r(e,o=>({...o,treeLoading:!1,treeError:Pe(a)}))}))},[e,r]),l=N.useCallback(a=>{if(!(!e||a.type!=="dir")){if(a.expanded){r(e,o=>({...o,tree:Dr(o.tree,a.path,s=>({...s,expanded:!1}))}));return}if(a.children&&a.children.length>0){r(e,o=>({...o,tree:Dr(o.tree,a.path,s=>({...s,expanded:!0}))}));return}r(e,o=>({...o,tree:Dr(o.tree,a.path,s=>({...s,loading:!0}))})),Ne(hc(e,a.path),15e3).then(o=>{r(e,s=>({...s,tree:Dr(s.tree,a.path,c=>({...c,expanded:!0,loading:!1,children:ls(o)}))}))}).catch(o=>{r(e,s=>({...s,treeError:Pe(o),tree:Dr(s.tree,a.path,c=>({...c,loading:!1}))}))})}},[e,r]),u=N.useCallback(a=>{if(!e||a.type!=="file")return;const o=t.files.find(p=>p.path===a.path);if(o){r(e,p=>({...p,activeFileId:o.id}));return}const s=crypto.randomUUID(),c={id:s,name:a.name,path:a.path,language:cd(a.path),contents:"",dirty:!1};r(e,p=>({...p,files:[...p.files,{...c,contents:"読み込み中..."}],activeFileId:s})),Ne(uv(e,a.path),15e3).then(p=>{r(e,v=>({...v,files:v.files.map(x=>x.id===s?{...x,contents:p.contents}:x)}))}).catch(p=>{r(e,v=>({...v,files:v.files.filter(x=>x.id!==s),activeFileId:v.files.length>1?v.files[0].id:null})),i(`ファイルを開けませんでした: ${Pe(p)}`)})},[e,t.files,r,i]),f=N.useCallback((a,o)=>{e&&r(e,s=>({...s,files:s.files.map(c=>c.id===a?{...c,contents:o,dirty:!0}:c)}))},[e,r]),S=N.useCallback(async a=>{if(!e)return;const o=t.files.find(s=>s.id===a);if(o){h(a);try{await Ne(hv(e,o.path,o.contents),15e3),r(e,s=>({...s,files:s.files.map(c=>c.id===a?{...c,dirty:!1}:c)})),i(Jh)}catch(s){i(`保存に失敗しました: ${Pe(s)}`)}finally{h(null)}}},[e,t.files,r,i]),d=N.useCallback(a=>{e&&r(e,o=>{const s=o.files.findIndex(v=>v.id===a),c=o.files.filter(v=>v.id!==a);let p=o.activeFileId;return o.activeFileId===a&&(c.length===0?p=null:s>=c.length?p=c[c.length-1].id:p=c[s].id),{...o,files:c,activeFileId:p}})},[e,r]),m=N.useCallback(async(a,o)=>{if(!e)return;const s=a?`${a}/${o}`:o;try{await Ne(dv(e,s),15e3);const c={name:o,path:s,type:"file",expanded:!1,loading:!1};r(e,p=>({...p,tree:tl(p.tree,a,c)})),i(`ファイルを作成しました: ${o}`)}catch(c){i(`ファイル作成に失敗しました: ${Pe(c)}`)}},[e,r,i]),C=N.useCallback(async(a,o)=>{if(!e)return;const s=a?`${a}/${o}`:o;try{await Ne(pv(e,s),15e3);const c={name:o,path:s,type:"dir",expanded:!1,loading:!1,children:[]};r(e,p=>({...p,tree:tl(p.tree,a,c)})),i(`フォルダを作成しました: ${o}`)}catch(c){i(`フォルダ作成に失敗しました: ${Pe(c)}`)}},[e,r,i]),w=N.useCallback(async a=>{if(e)try{await Ne(fv(e,a),15e3),r(e,o=>{const s=o.files.filter(v=>v.path!==a);let c=o.activeFileId;const p=o.files.find(v=>v.path===a);return p&&o.activeFileId===p.id&&(c=s.length>0?s[0].id:null),{...o,files:s,activeFileId:c,tree:rl(o.tree,a)}}),i("ファイルを削除しました")}catch(o){i(`ファイル削除に失敗しました: ${Pe(o)}`)}},[e,r,i]),g=N.useCallback(async a=>{if(e)try{await Ne(_v(e,a),15e3),r(e,o=>{const s=o.files.filter(v=>!v.path.startsWith(a+"/")&&v.path!==a);let c=o.activeFileId;const p=o.files.find(v=>v.id===o.activeFileId);return p&&(p.path.startsWith(a+"/")||p.path===a)&&(c=s.length>0?s[0].id:null),{...o,files:s,activeFileId:c,tree:rl(o.tree,a)}}),i("フォルダを削除しました")}catch(o){i(`フォルダ削除に失敗しました: ${Pe(o)}`)}},[e,r,i]);return{savingFileId:n,handleRefreshTree:_,handleToggleDir:l,handleOpenFile:u,handleFileChange:f,handleSaveFile:S,handleCloseFile:d,handleCreateFile:m,handleCreateDirectory:C,handleDeleteFile:w,handleDeleteDirectory:g}};async function v0(e,t,r,i){if(!i.current[e]){i.current[e]=!0,t(e,n=>({...n,loading:!0,reposLoading:!0,error:null}));try{const h=(await Ne(yv(e)).catch(()=>({repos:[]}))).repos;t(e,d=>({...d,repos:h,reposLoading:!1,selectedRepoPath:d.selectedRepoPath??(h.length>0?h[0].path:null)}));const l=(r.current[e]||yi()).selectedRepoPath??(h.length>0?h[0].path:void 0),[u,f,S]=await Promise.all([Ne(id(e,l||void 0)),Ne(od(e,l||void 0)).catch(()=>({ahead:0,behind:0,hasUpstream:!1})),Ne(ld(e,l||void 0)).catch(()=>({hasRemote:!1,remotes:[]}))]);t(e,d=>({...d,status:u,branchStatus:f,hasRemote:S.hasRemote,loading:!1,error:null}))}catch(n){const h=n instanceof Error?n.message:"Failed to get git status";t(e,_=>({..._,status:null,loading:!1,reposLoading:!1,error:h}))}finally{i.current[e]=!1}}}async function m0(e,t,r,i){r(e,n=>({...n,selectedRepoPath:t,loading:!0}));try{const[n,h,_]=await Promise.all([Ne(id(e,t||void 0)),Ne(od(e,t||void 0)).catch(()=>({ahead:0,behind:0,hasUpstream:!1})),Ne(ld(e,t||void 0)).catch(()=>({hasRemote:!1,remotes:[]}))]);r(e,l=>({...l,status:n,branchStatus:h,hasRemote:_.hasRemote,loading:!1,branches:[],logs:[]}))}catch(n){const h=n instanceof Error?n.message:"Failed to get git status";i(h),r(e,_=>({..._,loading:!1}))}}async function g0(e,t,r,i,n){try{await nd(e,[t],r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to stage file")}}async function y0(e,t,r,i,n){try{await sd(e,[t],r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to unstage file")}}async function S0(e,t,r,i,n){if(t.length!==0)try{await nd(e,t,r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to stage files")}}async function C0(e,t,r,i,n){if(t.length!==0)try{await sd(e,t,r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to unstage files")}}async function w0(e,t,r,i,n){try{const h=await Sv(e,t.trim(),r);i(`Committed: ${h.summary.changes} changes, +${h.summary.insertions} -${h.summary.deletions}`),await n()}catch(h){i(h instanceof Error?h.message:"Failed to commit")}}async function x0(e,t,r,i,n){try{await Cv(e,[t],r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to discard changes")}}async function b0(e,t,r,i,n){i(e,h=>({...h,diffPath:t.path,diffLoading:!0,diff:null}));try{const h=await wv(e,t.path,t.staged,r);i(e,_=>({..._,diff:h,diffLoading:!1}))}catch(h){n(h instanceof Error?h.message:"Failed to get diff"),i(e,_=>({..._,diffPath:null,diff:null,diffLoading:!1}))}}async function E0(e,t,r,i,n){r(e,h=>({...h,pushing:!0}));try{const h=await xv(e,t);i(`Pushed to ${h.branch}`),await n()}catch(h){i(h instanceof Error?h.message:"Failed to push")}finally{r(e,h=>({...h,pushing:!1}))}}async function k0(e,t,r,i,n){r(e,h=>({...h,pulling:!0}));try{const h=await bv(e,t);h.summary.changes>0?i(`Pulled: ${h.summary.changes} changes, +${h.summary.insertions} -${h.summary.deletions}`):i("Already up to date"),await n()}catch(h){i(h instanceof Error?h.message:"Failed to pull")}finally{r(e,h=>({...h,pulling:!1}))}}async function L0(e,t,r,i){try{await Ev(e,t),r("Fetched from remote"),await i()}catch(n){r(n instanceof Error?n.message:"Failed to fetch")}}async function D0(e,t,r,i){r(e,n=>({...n,branchesLoading:!0}));try{const n=await Ne(kv(e,t));r(e,h=>({...h,branches:n.branches,branchesLoading:!1}))}catch(n){i(n instanceof Error?n.message:"Failed to load branches"),r(e,h=>({...h,branchesLoading:!1}))}}async function R0(e,t,r,i,n,h){try{await Lv(e,t,r),i(`Switched to branch '${t}'`),await n(),await h()}catch(_){i(_ instanceof Error?_.message:"Failed to checkout branch")}}async function T0(e,t,r,i,n,h,_){try{await Dv(e,t,r,i),n(`Created branch '${t}'${r?" and switched to it":""}`),await h(),await _()}catch(l){n(l instanceof Error?l.message:"Failed to create branch")}}async function A0(e,t,r,i,n){i(e,h=>({...h,logsLoading:!0}));try{const h=await Ne(Rv(e,t,r));i(e,_=>({..._,logs:h.logs,logsLoading:!1}))}catch(h){n(h instanceof Error?h.message:"Failed to load git log"),i(e,_=>({..._,logsLoading:!1}))}}const yi=()=>({status:null,loading:!1,error:null,diffPath:null,diff:null,diffLoading:!1,branchStatus:null,hasRemote:!1,pushing:!1,pulling:!1,branches:[],branchesLoading:!1,logs:[],logsLoading:!1,repos:[],reposLoading:!1,selectedRepoPath:null}),P0=(e,t)=>{const[r,i]=N.useState({}),n=N.useRef({}),h=N.useRef(r);h.current=r;const _=e&&r[e]||yi(),l=N.useCallback((T,B)=>{i(z=>({...z,[T]:B(z[T]||yi())}))},[]),u=N.useCallback(async T=>{const B=T||e;B&&await v0(B,l,h,n)},[e,l]),f=N.useCallback(async T=>{e&&await m0(e,T,l,t)},[e,l,t]),S=N.useCallback(async()=>{const T=Object.keys(h.current);await Promise.all(T.map(B=>u(B)))},[u]),d=N.useCallback(()=>{if(!e)return;const T=h.current[e];return(T==null?void 0:T.selectedRepoPath)||void 0},[e]),m=N.useCallback(async T=>{e&&await g0(e,T,d(),t,u)},[e,d,t,u]),C=N.useCallback(async T=>{e&&await y0(e,T,d(),t,u)},[e,d,t,u]),w=N.useCallback(async()=>{if(!e||!_.status)return;const T=_.status.files.filter(B=>!B.staged).map(B=>B.path);await S0(e,T,d(),t,u)},[e,_.status,d,t,u]),g=N.useCallback(async()=>{if(!e||!_.status)return;const T=_.status.files.filter(B=>B.staged).map(B=>B.path);await C0(e,T,d(),t,u)},[e,_.status,d,t,u]),a=N.useCallback(async T=>{!e||!T.trim()||await w0(e,T,d(),t,u)},[e,d,t,u]),o=N.useCallback(async T=>{e&&await x0(e,T,d(),t,u)},[e,d,t,u]),s=N.useCallback(async T=>{e&&await b0(e,T,d(),l,t)},[e,d,l,t]),c=N.useCallback(()=>{e&&l(e,T=>({...T,diffPath:null,diff:null,diffLoading:!1}))},[e,l]),p=N.useCallback(async()=>{e&&await E0(e,d(),l,t,u)},[e,d,l,t,u]),v=N.useCallback(async()=>{e&&await k0(e,d(),l,t,u)},[e,d,l,t,u]),x=N.useCallback(async()=>{e&&await L0(e,d(),t,u)},[e,d,t,u]),b=N.useCallback(async()=>{e&&await D0(e,d(),l,t)},[e,d,l,t]),y=N.useCallback(async T=>{e&&await R0(e,T,d(),t,u,b)},[e,d,t,u,b]),k=N.useCallback(async(T,B=!0)=>{e&&await T0(e,T,B,d(),t,u,b)},[e,d,t,u,b]),R=N.useCallback(async(T=50)=>{e&&await A0(e,T,d(),l,t)},[e,d,l,t]),O=N.useCallback(T=>r[T]||yi(),[r]);return{gitState:_,gitStates:r,refreshGitStatus:u,refreshAllGitStatuses:S,getGitStateForWorkspace:O,handleSelectRepo:f,handleStageFile:m,handleUnstageFile:C,handleStageAll:w,handleUnstageAll:g,handleCommit:a,handleDiscardFile:o,handleShowDiff:s,handleCloseDiff:c,handlePush:p,handlePull:v,handleFetch:x,handleLoadBranches:b,handleCheckoutBranch:y,handleCreateBranch:k,handleLoadLogs:R}};function M0(){const[e,t]=N.useState(Xv);N.useEffect(()=>{if(!(typeof document>"u")){document.documentElement.dataset.theme=e;try{window.localStorage.setItem(td,e)}catch{}}},[e]);const r=N.useCallback(()=>{t(i=>i==="dark"?"light":"dark")},[]);return{theme:e,handleToggleTheme:r}}function B0({view:e,editorWorkspaceId:t,activeDeckIds:r,workspaceMode:i,setView:n,setEditorWorkspaceId:h,setActiveDeckIds:_,setWorkspaceMode:l}){N.useEffect(()=>{const u=()=>{const f=ud();n(f.view),h(f.workspaceId??null),_(f.deckIds),l(f.workspaceMode)};return window.addEventListener("popstate",u),()=>window.removeEventListener("popstate",u)},[n,h,_,l]),N.useEffect(()=>{const u=new URLSearchParams;u.set("view",e),e==="workspace"&&t&&u.set("workspace",t),r.length>0&&u.set("decks",r.join(",")),e==="workspace"&&i==="editor"&&t&&u.set("mode","editor");const f=u.toString(),S=f?`${window.location.pathname}?${f}`:window.location.pathname;window.history.replaceState(null,"",S)},[e,t,r,i])}function O0(){const[e,t]=N.useState(!1),[r,i]=N.useState(!1),[n,h]=N.useState(!1),_=N.useCallback(()=>t(!0),[]),l=N.useCallback(()=>t(!1),[]),u=N.useCallback(()=>i(!0),[]),f=N.useCallback(()=>i(!1),[]),S=N.useCallback(()=>h(!0),[]),d=N.useCallback(()=>h(!1),[]);return{isWorkspaceModalOpen:e,openWorkspaceModal:_,closeWorkspaceModal:l,isDeckModalOpen:r,openDeckModal:u,closeDeckModal:f,isSettingsModalOpen:n,openSettingsModal:S,closeSettingsModal:d}}const Ac=3;function Pc(e,t,r){const i=e.indexOf(t),n=e.indexOf(r);if(i<0||n<0||i===n)return e;const h=[...e];h.splice(i,1);const _=h.indexOf(r);return h.splice(_,0,t),h}function N0(){const e=ud(),t=N.useRef(null),r=N.useRef(!1),[i,n]=N.useState(e.view),[h,_]=N.useState(e.workspaceMode),[l,u]=N.useState(q_),[f,S]=N.useState(""),[d,m]=N.useState(null),[C,w]=N.useState(null),[g,a]=N.useState(!1),[o,s]=N.useState(!1),[c,p]=N.useState(null),{theme:v,handleToggleTheme:x}=M0(),{isWorkspaceModalOpen:b,openWorkspaceModal:y,closeWorkspaceModal:k,isDeckModalOpen:R,openDeckModal:O,closeDeckModal:T,isSettingsModalOpen:B,openSettingsModal:z,closeSettingsModal:I}=O0(),{workspaceStates:j,setWorkspaceStates:$,updateWorkspaceState:E,initializeWorkspaceStates:A}=h0(),{deckStates:P,setDeckStates:M,updateDeckState:H,initializeDeckStates:K}=d0(),{workspaces:X,editorWorkspaceId:q,setEditorWorkspaceId:se,handleCreateWorkspace:D,handleDeleteWorkspace:F}=f0({setStatusMessage:S,defaultRoot:l,initializeWorkspaceStates:A,setWorkspaceStates:$}),{decks:W,activeDeckIds:U,setActiveDeckIds:re,handleCreateDeck:J,handleDeleteDeck:ae,handleReorderDecks:we,handleCreateTerminal:fe,handleDeleteTerminal:ut,handleRemoveTerminalLocal:ne}=p0({setStatusMessage:S,initializeDeckStates:K,updateDeckState:H,setDeckStates:M,initialDeckIds:e.deckIds}),ht=N.useMemo(()=>ss(),[]),Xe=N.useMemo(()=>os(),[]),Ut=X.find(V=>V.id===q)||null,Q=q&&j[q]||ht,{savingFileId:Y,handleRefreshTree:te,handleToggleDir:ie,handleOpenFile:oe,handleFileChange:ce,handleSaveFile:Be,handleCloseFile:me,handleCreateFile:Tt,handleCreateDirectory:We,handleDeleteFile:At,handleDeleteDirectory:pe}=_0({editorWorkspaceId:q,activeWorkspaceState:Q,updateWorkspaceState:E,setStatusMessage:S}),{gitState:ni,refreshGitStatus:ks,handleSelectRepo:yd,handleStageFile:Sd,handleUnstageFile:Cd,handleStageAll:wd,handleUnstageAll:xd,handleCommit:bd,handleDiscardFile:Ed,handleShowDiff:kd,handleCloseDiff:Ld,handlePush:Dd,handlePull:Rd,handleLoadBranches:Td,handleCheckoutBranch:Ad,handleCreateBranch:Pd,handleLoadLogs:Md}=P0(q,S);B0({view:i,editorWorkspaceId:q,activeDeckIds:U,workspaceMode:h,setView:n,setEditorWorkspaceId:se,setActiveDeckIds:re,setWorkspaceMode:_});const Bd=ev(),Ql=N.useMemo(()=>new Map(X.map(V=>[V.id,V])),[X]),Ls=W;N.useEffect(()=>{let V=!0;return iv().then(ee=>{V&&ee!=null&&ee.defaultRoot&&u(ee.defaultRoot)}).catch(()=>{}),()=>{V=!1}},[]),N.useEffect(()=>{if(f!==Jh)return;const V=setTimeout(()=>S(""),Y_);return()=>clearTimeout(V)},[f]),N.useEffect(()=>{h==="editor"&&!q&&_("list")},[h,q]),N.useEffect(()=>{if(typeof window>"u")return;const V=window.matchMedia("(pointer: fine) and (min-width: 721px)"),ee=()=>s(V.matches);return ee(),V.addEventListener("change",ee),()=>V.removeEventListener("change",ee)},[]);const Pt=N.useCallback(()=>{m(null),w(null),a(!1)},[]),tn=N.useCallback(()=>{r.current=!0,window.setTimeout(()=>{r.current=!1},100)},[]);N.useEffect(()=>{o||Pt()},[o,Pt]);const Ds=N.useRef(null);N.useEffect(()=>{if(h!=="editor"||!q){Ds.current=null;return}Ds.current!==q&&(Ds.current=q,te(),ks())},[h,q,te,ks]);const Od=N.useCallback(()=>{if(X.length===0){S(G_);return}O()},[X.length,O]),Nd=N.useCallback(async(V,ee)=>{if(!ee){S(X_);return}await J(V,ee)&&T()},[J,T]),jd=N.useCallback(async V=>{try{const ee=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});if(!ee.ok){const ge=await ee.text();throw new Error(ge||"Failed to save settings")}await ee.json(),S("設定を保存しました。ブラウザをリロードしてください。"),setTimeout(()=>{window.location.reload()},2e3)}catch(ee){throw console.error("Failed to save settings:",ee),ee}},[]),Id=N.useCallback(V=>{se(V),_("editor")},[se]),Fd=N.useCallback(()=>{_("list")},[]),Hd=N.useCallback(async V=>{await D(V)&&k()},[D,k]),zd=N.useCallback(V=>{const ee=P[V]||Xe;fe(V,ee.terminals.length)},[P,Xe,fe]),$d=N.useCallback(V=>{const ee=P[V]||Xe;fe(V,ee.terminals.length,"claude","Claude Code")},[P,Xe,fe]),Ud=N.useCallback(V=>{const ee=P[V]||Xe;fe(V,ee.terminals.length,"codex","Codex")},[P,Xe,fe]),Wd=N.useCallback((V,ee)=>{ut(V,ee)},[ut]),Vd=N.useCallback((V,ee)=>{ne(V,ee)},[ne]),Kd=N.useCallback(V=>{if(r.current){r.current=!1;return}re([V])},[re]),Jl=N.useCallback(V=>{re(ee=>{const ge=[...ee.filter(_e=>_e!==V),V];return ge.length<=Ac?ge:ge.slice(ge.length-Ac)})},[re]),qd=N.useCallback(V=>{re(ee=>{if(ee.length<=1){const ge=Ls.find(_e=>_e.id!==V);return ge?[ge.id]:ee}return ee.filter(ge=>ge!==V)})},[Ls,re]),Gd=N.useCallback((V,ee)=>{V.preventDefault(),V.stopPropagation(),p({deckId:ee,x:V.clientX,y:V.clientY})},[]),Xd=N.useCallback(()=>{if(!c)return;const{deckId:V}=c;p(null),window.confirm(`このデッキを完全に削除しますか?
|
|
64
|
-
ターミナルもすべて削除されます。`)&&ae(V)},[c,ae]),Zl=N.useCallback(()=>{p(null)},[]),Yd=N.useCallback((V,ee)=>{if(!o){V.preventDefault();return}V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",ee),m(ee),w(null),a(!1)},[o]),Qd=N.useCallback((V,ee)=>{!o||!d||d===ee||(V.preventDefault(),V.dataTransfer.dropEffect="move",w(ee),a(!1))},[o,d]),Jd=N.useCallback((V,ee)=>{V.currentTarget.contains(V.relatedTarget)||w(ge=>ge===ee?null:ge)},[]),Zd=N.useCallback((V,ee)=>{if(!o)return;V.preventDefault();const ge=d||V.dataTransfer.getData("text/plain");if(!ge||ge===ee){Pt();return}we(_e=>{const af=_e.map(kr=>kr.id),cf=Pc(af,ge,ee),uf=new Map(_e.map(kr=>[kr.id,kr]));return cf.map(kr=>uf.get(kr))}),re(_e=>Pc(_e,ge,ee)),tn(),Pt()},[d,o,Pt,re,tn,we]),ef=N.useCallback(V=>{!o||!d||(V.preventDefault(),V.dataTransfer.dropEffect="move",a(!0))},[o,d]),tf=N.useCallback(V=>{V.currentTarget.contains(V.relatedTarget)||a(!1)},[]),rf=N.useCallback(V=>{if(!o)return;V.preventDefault();const ee=d||V.dataTransfer.getData("text/plain");if(!ee){Pt();return}Jl(ee),tn(),Pt()},[d,Jl,o,Pt,tn]),nf=N.useCallback(V=>{q&&E(q,ee=>({...ee,activeFileId:V}))},[q,E]),sf=h==="editor"&&!!q,of=L.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[L.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 flex-shrink-0",children:[L.jsx("button",{type:"button",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90",onClick:y,children:"ワークスペース追加"}),L.jsx(jv,{workspaces:X,selectedWorkspaceId:q,onSelect:Id,onDelete:F})]}),sf&&L.jsx(qg,{activeWorkspace:Ut,defaultRoot:l,activeWorkspaceState:
|
|
65
|
-
ドラッグで並び替え / メインにドロップで分割表示`:`${((ge=Ql.get(V.workspaceId))==null?void 0:ge.path)||V.root}`,children:[L.jsx("span",{className:"deck-tab-name",children:V.name}),L.jsx("span",{className:"deck-tab-close",role:"button","aria-label":"閉じる",onClick:_e=>{_e.stopPropagation(),qd(V.id)},children:"×"})]},V.id)}),L.jsx("button",{type:"button",className:"deck-tab deck-tab-add",onClick:Od,title:"デッキ作成",children:"+"})]})})}),L.jsx("div",{className:tt("terminal-split-container",g&&"is-drop-target"),ref:t,style:{gridTemplateColumns:`repeat(${U.length}, 1fr)`},onDragOver:ef,onDragLeave:tf,onDrop:rf,children:U.length===0?L.jsx("div",{className:"panel flex items-center justify-center text-muted text-[13px] p-5",children:"デッキを作成してください。"}):U.map(V=>{const ee=W.find(_e=>_e.id===V),ge=P[V]||Xe;return ee?L.jsxs("div",{className:"deck-split-pane",children:[L.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b border-border bg-sidebar gap-2 min-h-[28px]",children:[U.length>1&&L.jsx("span",{className:"flex-1 min-w-0 text-[11px] font-semibold text-ink-muted overflow-hidden text-ellipsis whitespace-nowrap",children:ee.name}),L.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[L.jsx("button",{type:"button",className:"topbar-btn-sm",onClick:()=>zd(V),title:"ターミナル追加",children:"+"}),L.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-claude",onClick:()=>$d(V),title:"Claude",children:"C"}),L.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-codex",onClick:()=>Ud(V),title:"Codex",children:"X"})]})]}),L.jsx(Ov,{terminals:ge.terminals,wsBase:Bd,onDeleteTerminal:_e=>Wd(V,_e),onExitTerminal:_e=>Vd(V,_e)})]},V):null})})]});return L.jsxs("div",{className:"app","data-view":i,children:[L.jsx(H_,{activeView:i,onSelect:n,theme:v,onToggleTheme:x,onOpenSettings:z}),L.jsxs("main",{className:"main",children:[i==="workspace"&&of,i==="terminal"&&lf]}),L.jsx(z_,{message:f}),L.jsx(Yv,{isOpen:b,defaultRoot:l,onSubmit:Hd,onClose:k}),L.jsx(F_,{isOpen:R,workspaces:X,onSubmit:Nd,onClose:T}),L.jsx(u0,{isOpen:B,onClose:I,onSave:jd}),c&&L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"fixed inset-0 z-[999]",onClick:Zl,onContextMenu:V=>{V.preventDefault(),Zl()}}),L.jsx("div",{className:"fixed z-[1000] bg-panel border border-border shadow-lg rounded-[2px] py-1 min-w-[140px]",style:{left:c.x,top:c.y},children:L.jsx("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-[13px] text-red-400 bg-transparent border-0 cursor-pointer hover:bg-list-hover",onClick:Xd,children:"デッキを削除"})})]})]})}class j0 extends N.Component{constructor(t){super(t),this.handleReload=()=>{window.location.reload()},this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){console.error("Application error:",t),console.error("Component stack:",r.componentStack)}render(){return this.state.hasError?L.jsx("div",{className:"flex items-center justify-center min-h-screen p-8 bg-bg",children:L.jsxs("div",{className:"max-w-[500px] p-8 bg-panel border border-border text-center",children:[L.jsx("h1",{className:"m-0 mb-4 text-xl text-[#f14c4c]",children:"Something went wrong"}),L.jsx("p",{className:"m-0 mb-6 text-muted",children:"The application encountered an unexpected error."}),this.state.error&&!1,L.jsx("button",{onClick:this.handleReload,className:"px-4 py-2 bg-accent text-white border-0 rounded-[2px] font-medium cursor-pointer hover:opacity-90",children:"Reload Application"})]})}):this.props.children}}lo.createRoot(document.getElementById("root")).render(L.jsx(vr.StrictMode,{children:L.jsx(j0,{children:L.jsx(N0,{})})}));
|
|
63
|
+
`},Rc=Jm(rg)(hd),ig={config:eg},ng=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return function(n){return r.reduceRight(function(h,_){return _(h)},n)}};function dd(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],dd(e[r],t[r]))}),kc(kc({},e),t)}var sg={type:"cancelation",msg:"operation is manually canceled"};function no(e){var t=!1,r=new Promise(function(i,n){e.then(function(h){return t?n(sg):i(h)}),e.catch(n)});return r.cancel=function(){return t=!0},r}var og=["monaco"],lg=Ym.create({config:Qm,isInitialized:!1,resolve:null,reject:null,monaco:null}),fd=Pm(lg,2),en=fd[0],Es=fd[1];function ag(e){var t=ig.config(e),r=t.monaco,i=Tm(t,og);Es(function(n){return{config:dd(n.config,i),monaco:r}})}function cg(){var e=en(function(t){var r=t.monaco,i=t.isInitialized,n=t.resolve;return{monaco:r,isInitialized:i,resolve:n}});if(!e.isInitialized){if(Es({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),no(so);if(window.monaco&&window.monaco.editor)return pd(window.monaco),e.resolve(window.monaco),no(so);ng(ug,dg)(fg)}return no(so)}function ug(e){return document.body.appendChild(e)}function hg(e){var t=document.createElement("script");return e&&(t.src=e),t}function dg(e){var t=en(function(i){var n=i.config,h=i.reject;return{config:n,reject:h}}),r=hg("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function fg(){var e=en(function(r){var i=r.config,n=r.resolve,h=r.reject;return{config:i,resolve:n,reject:h}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var i=r.m||r;pd(i),e.resolve(i)},function(r){e.reject(r)})}function pd(e){en().monaco||Es({monaco:e})}function pg(){return en(function(e){var t=e.monaco;return t})}var so=new Promise(function(e,t){return Es({resolve:e,reject:t})}),_d={config:ag,init:cg,__getMonacoInstance:pg},_g={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},oo=_g,vg={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},mg=vg;function gg({children:e}){return vr.createElement("div",{style:mg.container},e)}var yg=gg,Sg=yg;function Cg({width:e,height:t,isEditorReady:r,loading:i,_ref:n,className:h,wrapperProps:_}){return vr.createElement("section",{style:{...oo.wrapper,width:e,height:t},..._},!r&&vr.createElement(Sg,null,i),vr.createElement("div",{ref:n,style:{...oo.fullWidth,...!r&&oo.hide},className:h}))}var wg=Cg,vd=N.memo(wg);function xg(e){N.useEffect(e,[])}var md=xg;function bg(e,t,r=!0){let i=N.useRef(!0);N.useEffect(i.current||!r?()=>{i.current=!1}:e,t)}var nt=bg;function Ri(){}function zr(e,t,r,i){return Eg(e,i)||kg(e,t,r,i)}function Eg(e,t){return e.editor.getModel(gd(e,t))}function kg(e,t,r,i){return e.editor.createModel(t,r,i?gd(e,i):void 0)}function gd(e,t){return e.Uri.parse(t)}function Lg({original:e,modified:t,language:r,originalLanguage:i,modifiedLanguage:n,originalModelPath:h,modifiedModelPath:_,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:u=!1,theme:f="light",loading:S="Loading...",options:d={},height:m="100%",width:C="100%",className:w,wrapperProps:g={},beforeMount:a=Ri,onMount:o=Ri}){let[s,c]=N.useState(!1),[p,v]=N.useState(!0),x=N.useRef(null),b=N.useRef(null),y=N.useRef(null),k=N.useRef(o),R=N.useRef(a),O=N.useRef(!1);md(()=>{let I=_d.init();return I.then(j=>(b.current=j)&&v(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&console.error("Monaco initialization: error:",j)),()=>x.current?z():I.cancel()}),nt(()=>{if(x.current&&b.current){let I=x.current.getOriginalEditor(),j=zr(b.current,e||"",i||r||"text",h||"");j!==I.getModel()&&I.setModel(j)}},[h],s),nt(()=>{if(x.current&&b.current){let I=x.current.getModifiedEditor(),j=zr(b.current,t||"",n||r||"text",_||"");j!==I.getModel()&&I.setModel(j)}},[_],s),nt(()=>{let I=x.current.getModifiedEditor();I.getOption(b.current.editor.EditorOption.readOnly)?I.setValue(t||""):t!==I.getValue()&&(I.executeEdits("",[{range:I.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),I.pushUndoStop())},[t],s),nt(()=>{var I,j;(j=(I=x.current)==null?void 0:I.getModel())==null||j.original.setValue(e||"")},[e],s),nt(()=>{let{original:I,modified:j}=x.current.getModel();b.current.editor.setModelLanguage(I,i||r||"text"),b.current.editor.setModelLanguage(j,n||r||"text")},[r,i,n],s),nt(()=>{var I;(I=b.current)==null||I.editor.setTheme(f)},[f],s),nt(()=>{var I;(I=x.current)==null||I.updateOptions(d)},[d],s);let T=N.useCallback(()=>{var $;if(!b.current)return;R.current(b.current);let I=zr(b.current,e||"",i||r||"text",h||""),j=zr(b.current,t||"",n||r||"text",_||"");($=x.current)==null||$.setModel({original:I,modified:j})},[r,t,n,e,i,h,_]),B=N.useCallback(()=>{var I;!O.current&&y.current&&(x.current=b.current.editor.createDiffEditor(y.current,{automaticLayout:!0,...d}),T(),(I=b.current)==null||I.editor.setTheme(f),c(!0),O.current=!0)},[d,f,T]);N.useEffect(()=>{s&&k.current(x.current,b.current)},[s]),N.useEffect(()=>{!p&&!s&&B()},[p,s,B]);function z(){var j,$,E,A;let I=(j=x.current)==null?void 0:j.getModel();l||(($=I==null?void 0:I.original)==null||$.dispose()),u||((E=I==null?void 0:I.modified)==null||E.dispose()),(A=x.current)==null||A.dispose()}return vr.createElement(vd,{width:C,height:m,isEditorReady:s,loading:S,_ref:y,className:w,wrapperProps:g})}var Dg=Lg,Rg=N.memo(Dg);function Tg(e){let t=N.useRef();return N.useEffect(()=>{t.current=e},[e]),t.current}var Ag=Tg,Cn=new Map;function Pg({defaultValue:e,defaultLanguage:t,defaultPath:r,value:i,language:n,path:h,theme:_="light",line:l,loading:u="Loading...",options:f={},overrideServices:S={},saveViewState:d=!0,keepCurrentModel:m=!1,width:C="100%",height:w="100%",className:g,wrapperProps:a={},beforeMount:o=Ri,onMount:s=Ri,onChange:c,onValidate:p=Ri}){let[v,x]=N.useState(!1),[b,y]=N.useState(!0),k=N.useRef(null),R=N.useRef(null),O=N.useRef(null),T=N.useRef(s),B=N.useRef(o),z=N.useRef(),I=N.useRef(i),j=Ag(h),$=N.useRef(!1),E=N.useRef(!1);md(()=>{let M=_d.init();return M.then(H=>(k.current=H)&&y(!1)).catch(H=>(H==null?void 0:H.type)!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>R.current?P():M.cancel()}),nt(()=>{var H,K,X,q;let M=zr(k.current,e||i||"",t||n||"",h||r||"");M!==((H=R.current)==null?void 0:H.getModel())&&(d&&Cn.set(j,(K=R.current)==null?void 0:K.saveViewState()),(X=R.current)==null||X.setModel(M),d&&((q=R.current)==null||q.restoreViewState(Cn.get(h))))},[h],v),nt(()=>{var M;(M=R.current)==null||M.updateOptions(f)},[f],v),nt(()=>{!R.current||i===void 0||(R.current.getOption(k.current.editor.EditorOption.readOnly)?R.current.setValue(i):i!==R.current.getValue()&&(E.current=!0,R.current.executeEdits("",[{range:R.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),R.current.pushUndoStop(),E.current=!1))},[i],v),nt(()=>{var H,K;let M=(H=R.current)==null?void 0:H.getModel();M&&n&&((K=k.current)==null||K.editor.setModelLanguage(M,n))},[n],v),nt(()=>{var M;l!==void 0&&((M=R.current)==null||M.revealLine(l))},[l],v),nt(()=>{var M;(M=k.current)==null||M.editor.setTheme(_)},[_],v);let A=N.useCallback(()=>{var M;if(!(!O.current||!k.current)&&!$.current){B.current(k.current);let H=h||r,K=zr(k.current,i||e||"",t||n||"",H||"");R.current=(M=k.current)==null?void 0:M.editor.create(O.current,{model:K,automaticLayout:!0,...f},S),d&&R.current.restoreViewState(Cn.get(H)),k.current.editor.setTheme(_),l!==void 0&&R.current.revealLine(l),x(!0),$.current=!0}},[e,t,r,i,n,h,f,S,d,_,l]);N.useEffect(()=>{v&&T.current(R.current,k.current)},[v]),N.useEffect(()=>{!b&&!v&&A()},[b,v,A]),I.current=i,N.useEffect(()=>{var M,H;v&&c&&((M=z.current)==null||M.dispose(),z.current=(H=R.current)==null?void 0:H.onDidChangeModelContent(K=>{E.current||c(R.current.getValue(),K)}))},[v,c]),N.useEffect(()=>{if(v){let M=k.current.editor.onDidChangeMarkers(H=>{var X;let K=(X=R.current.getModel())==null?void 0:X.uri;if(K&&H.find(q=>q.path===K.path)){let q=k.current.editor.getModelMarkers({resource:K});p==null||p(q)}});return()=>{M==null||M.dispose()}}return()=>{}},[v,p]);function P(){var M,H;(M=z.current)==null||M.dispose(),m?d&&Cn.set(h,R.current.saveViewState()):(H=R.current.getModel())==null||H.dispose(),R.current.dispose()}return vr.createElement(vd,{width:C,height:w,isEditorReady:v,loading:u,_ref:O,className:g,wrapperProps:a})}var Mg=Pg,Bg=N.memo(Mg),Og=Bg;const Tc="ファイルを選択してください",Ng="vs-dark",jg="vs";function Ig(e){var i;const t=((i=e.split(".").pop())==null?void 0:i.toLowerCase())||"";return{ts:{icon:"TS",color:"#3178c6"},tsx:{icon:"TSX",color:"#3178c6"},js:{icon:"JS",color:"#f7df1e"},jsx:{icon:"JSX",color:"#61dafb"},json:{icon:"{ }",color:"#cbcb41"},html:{icon:"<>",color:"#e34c26"},css:{icon:"#",color:"#264de4"},scss:{icon:"S",color:"#cc6699"},md:{icon:"M↓",color:"#083fa1"},py:{icon:"PY",color:"#3776ab"},go:{icon:"GO",color:"#00add8"},rs:{icon:"RS",color:"#dea584"},java:{icon:"J",color:"#b07219"},sql:{icon:"SQL",color:"#e38c00"},yml:{icon:"Y",color:"#cb171e"},yaml:{icon:"Y",color:"#cb171e"},sh:{icon:"$",color:"#89e051"},bash:{icon:"$",color:"#89e051"},txt:{icon:"TXT",color:"#6a737d"}}[t]||{icon:"📄",color:"var(--ink-muted)"}}function Fg(e){return{typescript:"TypeScript",typescriptreact:"TypeScript React",javascript:"JavaScript",javascriptreact:"JavaScript React",json:"JSON",html:"HTML",css:"CSS",scss:"SCSS",markdown:"Markdown",python:"Python",go:"Go",rust:"Rust",java:"Java",sql:"SQL",yaml:"YAML",shell:"Shell",plaintext:"Plain Text"}[e]||e}function Hg({files:e,activeFileId:t,onSelectFile:r,onCloseFile:i,onChangeFile:n,onSaveFile:h,savingFileId:_,theme:l}){const u=e.find(g=>g.id===t),f=N.useRef(null),[S,d]=N.useState({line:1,column:1}),m=N.useCallback(g=>{f.current=g,g.onDidChangeCursorPosition(a=>{d({line:a.position.lineNumber,column:a.position.column})})},[]);N.useEffect(()=>{const g=a=>{!t||!((a.ctrlKey||a.metaKey)&&a.key.toLowerCase()==="s")||(a.preventDefault(),h==null||h(t))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[t,h]);const C=(g,a)=>{g.stopPropagation(),i(a)},w=(g,a)=>{g.button===1&&(g.preventDefault(),i(a))};return e.length===0?L.jsx("div",{className:"editor-container editor-empty",children:L.jsxs("div",{className:"editor-welcome",children:[L.jsx("div",{className:"editor-welcome-icon",children:L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),L.jsx("polyline",{points:"13 2 13 9 20 9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),L.jsx("div",{className:"editor-welcome-text",children:Tc}),L.jsx("div",{className:"editor-welcome-hint",children:"左のファイルツリーからファイルを選択"})]})}):L.jsxs("div",{className:"editor-container",children:[L.jsx("div",{className:"editor-tabs",children:L.jsx("div",{className:"editor-tabs-list",children:e.map(g=>{const{icon:a,color:o}=Ig(g.name),s=g.id===t,c=_===g.id;return L.jsxs("div",{className:tt("editor-tab",s&&"active",g.dirty&&"dirty"),onClick:()=>r(g.id),onMouseDown:p=>w(p,g.id),role:"tab","aria-selected":s,tabIndex:0,children:[L.jsx("span",{className:"editor-tab-icon",style:{color:o},children:a}),L.jsx("span",{className:"editor-tab-name",children:g.name}),g.dirty&&!c&&L.jsx("span",{className:"editor-tab-dirty","aria-label":"未保存",children:"●"}),c&&L.jsx("span",{className:"editor-tab-saving","aria-label":"保存中",children:L.jsx("svg",{viewBox:"0 0 24 24",className:"spin",children:L.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"30 70"})})}),L.jsx("button",{type:"button",className:"editor-tab-close",onClick:p=>C(p,g.id),"aria-label":"閉じる",children:L.jsx("svg",{viewBox:"0 0 24 24",children:L.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]},g.id)})})}),u&&L.jsx("div",{className:"editor-breadcrumb",children:L.jsx("span",{className:"editor-breadcrumb-path",children:u.path})}),L.jsx("div",{className:"editor-content",children:u?L.jsx(Og,{height:"100%",theme:l==="dark"?Ng:jg,language:u.language,value:u.contents,onChange:g=>n(u.id,g??""),onMount:m,options:{fontFamily:Zh,fontSize:ed,fontLigatures:!0,minimap:{enabled:!0,scale:1,showSlider:"mouseover"},smoothScrolling:!0,cursorBlinking:"smooth",cursorSmoothCaretAnimation:"on",renderLineHighlight:"all",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8,bottom:8},lineNumbers:"on",renderWhitespace:"selection",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0}}}):L.jsx("div",{className:"editor-no-file",children:L.jsx("span",{children:Tc})})}),u&&L.jsxs("div",{className:"editor-statusbar",children:[L.jsx("div",{className:"editor-statusbar-left",children:L.jsxs("span",{className:"editor-status-item",children:[L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M6 3v12M18 9a3 3 0 110 6 3 3 0 010-6zM6 21a3 3 0 110-6 3 3 0 010 6z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),L.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"2"})]}),"main"]})}),L.jsxs("div",{className:"editor-statusbar-right",children:[L.jsxs("span",{className:"editor-status-item",children:["Ln ",S.line,", Col ",S.column]}),L.jsx("span",{className:"editor-status-item",children:"UTF-8"}),L.jsx("span",{className:"editor-status-item",children:Fg(u.language)})]})]})]})}const zg="差分ビューア",$g="読み込み中...",Ug="閉じる",Wg="vs-dark",Vg="vs";function Kg({diff:e,loading:t,theme:r,onClose:i}){const n=e?cd(e.path):"plaintext";return L.jsxs("div",{className:"fixed inset-0 bg-bg z-50 grid grid-rows-[35px_minmax(0,1fr)]",children:[L.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 bg-title-bar border-b border-border",children:[L.jsxs("div",{children:[L.jsx("div",{className:"text-[13px] font-medium",children:zg}),e&&L.jsx("div",{className:"text-xs text-muted font-mono",children:e.path})]}),L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:i,children:Ug})]}),L.jsx("div",{className:"min-h-0 overflow-hidden",children:t?L.jsx("div",{className:"flex items-center justify-center h-full text-muted text-[13px] p-5",children:$g}):e?L.jsx(Rg,{height:"100%",theme:r==="dark"?Wg:Vg,language:n,original:e.original,modified:e.modified,options:{fontFamily:Zh,fontSize:ed,readOnly:!0,renderSideBySide:!0,minimap:{enabled:!1},smoothScrolling:!0}}):null})]})}function qg({activeWorkspace:e,defaultRoot:t,activeWorkspaceState:r,editorWorkspaceId:i,gitState:n,theme:h,savingFileId:_,onCloseWorkspaceEditor:l,onToggleDir:u,onOpenFile:f,onRefreshTree:S,onCreateFile:d,onCreateDirectory:m,onDeleteFile:C,onDeleteDirectory:w,onRefreshGit:g,onSelectRepo:a,onStageFile:o,onUnstageFile:s,onStageAll:c,onUnstageAll:p,onCommit:v,onDiscardFile:x,onShowDiff:b,onCloseDiff:y,onPush:k,onPull:R,onLoadBranches:O,onCheckoutBranch:T,onCreateBranch:B,onLoadLogs:z,onSelectFile:I,onCloseFile:j,onChangeFile:$,onSaveFile:E}){var q,se;const[A,P]=N.useState(!1),[M,H]=N.useState("files"),K=N.useCallback(D=>{f(D),P(!1)},[f]),X=((q=n.status)==null?void 0:q.files.length)??0;return L.jsxs("div",{className:tt("workspace-editor-overlay",A&&"drawer-open"),children:[L.jsxs("div",{className:"workspace-editor-header",children:[L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:l,children:"一覧に戻る"}),L.jsx("button",{type:"button",className:"sidebar-toggle-btn bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover min-h-[44px] min-w-[44px]",onClick:()=>P(D=>!D),"aria-label":"\\u30b5\\u30a4\\u30c9\\u30d0\\u30fc",children:L.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:L.jsx("path",{d:"M3 12h18M3 6h18M3 18h18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),L.jsx("div",{className:"workspace-meta",children:e?e.path:null})]}),L.jsxs("div",{className:"workspace-editor-grid",children:[L.jsxs("div",{className:"activity-bar",children:[L.jsx("button",{type:"button",className:tt("activity-bar-item",M==="files"&&"active"),onClick:()=>H("files"),title:"エクスプローラー",children:L.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:L.jsx("path",{d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),L.jsxs("button",{type:"button",className:tt("activity-bar-item",M==="git"&&"active"),onClick:()=>{H("git"),g()},title:"ソースコントロール",children:[L.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[L.jsx("path",{d:"M6 3v12M18 9a3 3 0 110 6 3 3 0 010-6zM6 21a3 3 0 110-6 3 3 0 010 6z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),L.jsx("path",{d:"M18 12c0 3-3 4-6 4s-6-1-6-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})]}),X>0&&L.jsx("span",{className:"activity-bar-badge",children:X})]})]}),L.jsx("div",{className:"sidebar-panel",children:L.jsx("div",{className:"sidebar-content",children:M==="files"?L.jsx(ad,{root:(e==null?void 0:e.path)||t||"",entries:r.tree,loading:r.treeLoading,error:r.treeError,onToggleDir:u,onOpenFile:K,onRefresh:S,onCreateFile:d,onCreateDirectory:m,onDeleteFile:C,onDeleteDirectory:w,gitFiles:(se=n.status)==null?void 0:se.files}):L.jsx(Em,{status:n.status,loading:n.loading,error:n.error,workspaceId:i,branchStatus:n.branchStatus,hasRemote:n.hasRemote,pushing:n.pushing,pulling:n.pulling,branches:n.branches,branchesLoading:n.branchesLoading,logs:n.logs,logsLoading:n.logsLoading,repos:n.repos,selectedRepoPath:n.selectedRepoPath,onSelectRepo:a,onRefresh:g,onStageFile:o,onUnstageFile:s,onStageAll:c,onUnstageAll:p,onCommit:v,onDiscardFile:x,onShowDiff:b,onPush:k,onPull:R,onLoadBranches:O,onCheckoutBranch:T,onCreateBranch:B,onLoadLogs:z})})}),L.jsx(Hg,{files:r.files,activeFileId:r.activeFileId,onSelectFile:I,onCloseFile:j,onChangeFile:$,onSaveFile:E,savingFileId:_,theme:h})]}),L.jsx("div",{className:"sidebar-overlay",onClick:()=>P(!1),"aria-hidden":"true"}),n.diffPath&&L.jsx(Kg,{diff:n.diff,loading:n.diffLoading,theme:h,onClose:y})]})}const Gg="設定",Xg="サーバー設定",Yg="ポート番号",Qg="Basic認証",Jg="Basic認証を有効にする",Zg="ユーザー名",e0="パスワード",t0="※ 12文字以上推奨",r0="キャンセル",i0="保存",n0="※ 設定を保存すると、サーバーが再起動されます",s0="WebSocket設定",o0="接続数上限 (IP毎)",l0="現在の接続数",a0="全接続をクリア",c0="適用",wn="bg-panel border border-border rounded-[2px] px-2 py-1.5 text-[13px] font-mono text-ink focus:outline-none focus:border-focus";function u0({isOpen:e,onClose:t,onSave:r}){const[i,n]=N.useState(8787),[h,_]=N.useState(!1),[l,u]=N.useState(""),[f,S]=N.useState(""),[d,m]=N.useState(!1),[C,w]=N.useState(1e3),[g,a]=N.useState(null),[o,s]=N.useState(!1),c=()=>{fetch("/api/ws/stats").then(b=>b.json()).then(b=>{a(b),w(b.limit)}).catch(b=>{console.error("Failed to load WS stats:",b)})};N.useEffect(()=>{if(!e)return;const b=y=>{y.key==="Escape"&&(y.preventDefault(),t())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]),N.useEffect(()=>{e&&(fetch("/api/settings").then(b=>b.json()).then(b=>{n(b.port),_(b.basicAuthEnabled),u(b.basicAuthUser),S(b.basicAuthPassword)}).catch(b=>{console.error("Failed to load settings:",b)}),c())},[e]);const p=async()=>{try{await fetch("/api/ws/limit",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:C})}),c()}catch(b){console.error("Failed to set WS limit:",b)}},v=async()=>{s(!0);try{await fetch("/api/ws/clear",{method:"POST"}),c()}catch(b){console.error("Failed to clear WS connections:",b)}finally{s(!1)}},x=async b=>{b.preventDefault(),m(!0);try{await r({port:i,basicAuthEnabled:h,basicAuthUser:l,basicAuthPassword:f}),t()}catch(y){console.error("Failed to save settings:",y),alert("設定の保存に失敗しました")}finally{m(!1)}};return e?L.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[500]",role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title",onClick:t,children:L.jsxs("div",{className:"modal w-[500px]",onClick:b=>b.stopPropagation(),children:[L.jsxs("div",{className:"flex items-center justify-between mb-4",children:[L.jsx("h2",{className:"m-0 text-[14px] font-semibold",id:"settings-modal-title",children:Gg}),L.jsx("button",{type:"button",className:"modal-close-btn",onClick:t,"aria-label":"閉じる",children:"×"})]}),L.jsxs("form",{onSubmit:x,children:[L.jsxs("div",{className:"flex flex-col gap-4",children:[L.jsxs("section",{className:"flex flex-col gap-3",children:[L.jsx("h3",{className:"m-0 text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted border-b border-border pb-2",children:Xg}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"port",className:"text-xs text-ink-muted",children:Yg}),L.jsx("input",{type:"number",id:"port",className:wn,value:i,onChange:b=>n(Number(b.target.value)),min:1024,max:65535,required:!0})]}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("h4",{className:"m-0 text-xs font-semibold text-ink-muted",children:Qg}),L.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[L.jsx("input",{type:"checkbox",checked:h,onChange:b=>_(b.target.checked)}),L.jsx("span",{children:Jg})]})]}),h&&L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"username",className:"text-xs text-ink-muted",children:Zg}),L.jsx("input",{type:"text",id:"username",className:wn,value:l,onChange:b=>u(b.target.value),required:h,autoComplete:"username"})]}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"password",className:"text-xs text-ink-muted",children:e0}),L.jsx("input",{type:"password",id:"password",className:wn,value:f,onChange:b=>S(b.target.value),required:h,minLength:12,autoComplete:"new-password"}),L.jsx("p",{className:"m-0 text-[11px] text-muted",children:t0})]})]})]}),L.jsxs("section",{className:"flex flex-col gap-3",children:[L.jsx("h3",{className:"m-0 text-[11px] font-semibold uppercase tracking-[0.5px] text-ink-muted border-b border-border pb-2",children:s0}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{htmlFor:"wsLimit",className:"text-xs text-ink-muted",children:o0}),L.jsxs("div",{className:"flex gap-2 items-center",children:[L.jsx("input",{type:"number",id:"wsLimit",className:`flex-1 ${wn}`,value:C,onChange:b=>w(Number(b.target.value)),min:1,max:1e4}),L.jsx("button",{type:"button",className:"border border-border bg-transparent text-ink px-2.5 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:p,children:c0})]})]}),L.jsxs("div",{className:"flex flex-col gap-1",children:[L.jsx("label",{className:"text-xs text-ink-muted",children:l0}),L.jsx("div",{className:"border border-border rounded-[2px] p-2 text-xs bg-bg min-h-[40px] flex flex-col gap-1",children:g&&g.connections.length>0?g.connections.map(({ip:b,count:y})=>L.jsxs("div",{className:"flex justify-between items-center",children:[L.jsx("span",{className:"font-mono text-ink",children:b}),L.jsx("span",{className:"font-semibold text-ink-muted",children:y})]},b)):L.jsx("div",{className:"text-muted text-center",children:"接続なし"})})]}),L.jsx("div",{className:"flex flex-col gap-1",children:L.jsx("button",{type:"button",className:"bg-[#f14c4c] text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",onClick:v,disabled:o,children:o?"クリア中...":a0})})]}),L.jsx("p",{className:"m-0 text-[11px] text-muted italic",children:n0})]}),L.jsxs("div",{className:"flex justify-end gap-2 mt-4 border-t border-border pt-4",children:[L.jsx("button",{type:"button",className:"bg-transparent text-ink border-0 px-2 py-1 text-xs rounded-[2px] cursor-pointer hover:bg-list-hover",onClick:t,disabled:d,children:r0}),L.jsx("button",{type:"submit",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",disabled:d,children:d?"保存中...":i0})]})]})]})}):null}const h0=()=>{const[e,t]=N.useState({}),r=N.useCallback((n,h)=>{t(_=>{const l=_[n]||ss();return{..._,[n]:h(l)}})},[]),i=N.useCallback(n=>{t(h=>{const _={...h};return n.forEach(l=>{_[l]||(_[l]=ss())}),_})},[]);return{workspaceStates:e,setWorkspaceStates:t,updateWorkspaceState:r,initializeWorkspaceStates:i}},d0=()=>{const[e,t]=N.useState({}),r=N.useCallback((n,h)=>{t(_=>{const l=_[n]||os();return{..._,[n]:h(l)}})},[]),i=N.useCallback(n=>{t(h=>{const _={...h};return n.forEach(l=>{_[l]||(_[l]=os())}),_})},[]);return{deckStates:e,setDeckStates:t,updateDeckState:r,initializeDeckStates:i}},f0=({setStatusMessage:e,defaultRoot:t,initializeWorkspaceStates:r,setWorkspaceStates:i})=>{const[n,h]=N.useState([]),[_,l]=N.useState(null);N.useEffect(()=>{let S=!0;return rv().then(d=>{S&&(h(d),l(m=>m&&d.some(C=>C.id===m)?m:null),r(d.map(m=>m.id)))}).catch(d=>{S&&e(`ワークスペースを取得できませんでした: ${Pe(d)}`)}),()=>{S=!1}},[e,r]);const u=N.useCallback(async S=>{const m=S.trim()||t;if(!m)return e("パスを入力してください。"),null;const C=yc(m);if(n.some(g=>yc(g.path)===C))return e("同じパスのワークスペースは追加できません。"),null;try{const g=await nv(m);return h(a=>[...a,g]),l(g.id),i(a=>({...a,[g.id]:ss()})),g}catch(g){return e(`ワークスペースを追加できませんでした: ${Pe(g)}`),null}},[n,t,e,i]),f=N.useCallback(async S=>{try{await sv(S),h(d=>d.filter(m=>m.id!==S)),l(d=>d===S?null:d),i(d=>{const m={...d};return delete m[S],m})}catch(d){e(`ワークスペースを削除できませんでした: ${Pe(d)}`)}},[e,i]);return{workspaces:n,editorWorkspaceId:_,setEditorWorkspaceId:l,handleCreateWorkspace:u,handleDeleteWorkspace:f}},p0=({setStatusMessage:e,initializeDeckStates:t,updateDeckState:r,setDeckStates:i,initialDeckIds:n})=>{const[h,_]=N.useState([]),[l,u]=N.useState(n??[]);N.useEffect(()=>{let g=!0;return ov().then(a=>{g&&(_(a),t(a.map(o=>o.id)),a.forEach(o=>{mv(o.id).then(s=>{g&&r(o.id,c=>({...c,terminals:s}))}).catch(()=>{})}))}).catch(a=>{g&&e(`デッキを取得できませんでした: ${Pe(a)}`)}),()=>{g=!1}},[e,t,r]),N.useEffect(()=>{if(h.length===0)return;const g=l.filter(a=>h.some(o=>o.id===a));g.length===l.length&&g.length>0||(g.length>0?u(g):h[0]&&u([h[0].id]))},[h,l]);const f=N.useCallback(async(g,a)=>{try{const o=await lv(g,a);return _(s=>[...s,o]),u(s=>[...s.filter(c=>c!==o.id),o.id]),i(s=>({...s,[o.id]:os()})),o}catch(o){return e(`デッキの作成に失敗しました: ${Pe(o)}`),null}},[e,i]),S=N.useCallback(async g=>{try{await av(g),_(a=>a.filter(o=>o.id!==g)),u(a=>a.filter(o=>o!==g)),i(a=>{const o={...a};return delete o[g],o})}catch(a){e(`デッキの削除に失敗しました: ${Pe(a)}`)}},[e,i]),d=N.useCallback(g=>{_(a=>{const o=g(a);return cv(o.map(s=>s.id)).catch(()=>{}),o})},[]),m=N.useCallback(async(g,a,o,s)=>{try{const c=await vv(g,s,o);r(g,p=>({...p,terminals:[...p.terminals,{id:c.id,title:c.title}]}))}catch(c){e(`ターミナルを起動できませんでした: ${Pe(c)}`)}},[r,e]),C=N.useCallback(async(g,a)=>{try{await gv(a),r(g,o=>({...o,terminals:o.terminals.filter(s=>s.id!==a)}))}catch(o){e(`ターミナルを削除できませんでした: ${Pe(o)}`)}},[r,e]),w=N.useCallback((g,a)=>{r(g,o=>({...o,terminals:o.terminals.filter(s=>s.id!==a)}))},[r]);return{decks:h,activeDeckIds:l,setActiveDeckIds:u,handleCreateDeck:f,handleDeleteDeck:S,handleReorderDecks:d,handleCreateTerminal:m,handleDeleteTerminal:C,handleRemoveTerminalLocal:w}},_0=({editorWorkspaceId:e,activeWorkspaceState:t,updateWorkspaceState:r,setStatusMessage:i})=>{const[n,h]=N.useState(null),_=N.useCallback(()=>{e&&(r(e,a=>({...a,treeLoading:!0,treeError:null})),Ne(hc(e,""),15e3).then(a=>{r(e,o=>({...o,tree:ls(a),treeLoading:!1}))}).catch(a=>{r(e,o=>({...o,treeLoading:!1,treeError:Pe(a)}))}))},[e,r]),l=N.useCallback(a=>{if(!(!e||a.type!=="dir")){if(a.expanded){r(e,o=>({...o,tree:Dr(o.tree,a.path,s=>({...s,expanded:!1}))}));return}if(a.children&&a.children.length>0){r(e,o=>({...o,tree:Dr(o.tree,a.path,s=>({...s,expanded:!0}))}));return}r(e,o=>({...o,tree:Dr(o.tree,a.path,s=>({...s,loading:!0}))})),Ne(hc(e,a.path),15e3).then(o=>{r(e,s=>({...s,tree:Dr(s.tree,a.path,c=>({...c,expanded:!0,loading:!1,children:ls(o)}))}))}).catch(o=>{r(e,s=>({...s,treeError:Pe(o),tree:Dr(s.tree,a.path,c=>({...c,loading:!1}))}))})}},[e,r]),u=N.useCallback(a=>{if(!e||a.type!=="file")return;const o=t.files.find(p=>p.path===a.path);if(o){r(e,p=>({...p,activeFileId:o.id}));return}const s=crypto.randomUUID(),c={id:s,name:a.name,path:a.path,language:cd(a.path),contents:"",dirty:!1};r(e,p=>({...p,files:[...p.files,{...c,contents:"読み込み中..."}],activeFileId:s})),Ne(uv(e,a.path),15e3).then(p=>{r(e,v=>({...v,files:v.files.map(x=>x.id===s?{...x,contents:p.contents}:x)}))}).catch(p=>{r(e,v=>({...v,files:v.files.filter(x=>x.id!==s),activeFileId:v.files.length>1?v.files[0].id:null})),i(`ファイルを開けませんでした: ${Pe(p)}`)})},[e,t.files,r,i]),f=N.useCallback((a,o)=>{e&&r(e,s=>({...s,files:s.files.map(c=>c.id===a?{...c,contents:o,dirty:!0}:c)}))},[e,r]),S=N.useCallback(async a=>{if(!e)return;const o=t.files.find(s=>s.id===a);if(o){h(a);try{await Ne(hv(e,o.path,o.contents),15e3),r(e,s=>({...s,files:s.files.map(c=>c.id===a?{...c,dirty:!1}:c)})),i(Jh)}catch(s){i(`保存に失敗しました: ${Pe(s)}`)}finally{h(null)}}},[e,t.files,r,i]),d=N.useCallback(a=>{e&&r(e,o=>{const s=o.files.findIndex(v=>v.id===a),c=o.files.filter(v=>v.id!==a);let p=o.activeFileId;return o.activeFileId===a&&(c.length===0?p=null:s>=c.length?p=c[c.length-1].id:p=c[s].id),{...o,files:c,activeFileId:p}})},[e,r]),m=N.useCallback(async(a,o)=>{if(!e)return;const s=a?`${a}/${o}`:o;try{await Ne(dv(e,s),15e3);const c={name:o,path:s,type:"file",expanded:!1,loading:!1};r(e,p=>({...p,tree:tl(p.tree,a,c)})),i(`ファイルを作成しました: ${o}`)}catch(c){i(`ファイル作成に失敗しました: ${Pe(c)}`)}},[e,r,i]),C=N.useCallback(async(a,o)=>{if(!e)return;const s=a?`${a}/${o}`:o;try{await Ne(pv(e,s),15e3);const c={name:o,path:s,type:"dir",expanded:!1,loading:!1,children:[]};r(e,p=>({...p,tree:tl(p.tree,a,c)})),i(`フォルダを作成しました: ${o}`)}catch(c){i(`フォルダ作成に失敗しました: ${Pe(c)}`)}},[e,r,i]),w=N.useCallback(async a=>{if(e)try{await Ne(fv(e,a),15e3),r(e,o=>{const s=o.files.filter(v=>v.path!==a);let c=o.activeFileId;const p=o.files.find(v=>v.path===a);return p&&o.activeFileId===p.id&&(c=s.length>0?s[0].id:null),{...o,files:s,activeFileId:c,tree:rl(o.tree,a)}}),i("ファイルを削除しました")}catch(o){i(`ファイル削除に失敗しました: ${Pe(o)}`)}},[e,r,i]),g=N.useCallback(async a=>{if(e)try{await Ne(_v(e,a),15e3),r(e,o=>{const s=o.files.filter(v=>!v.path.startsWith(a+"/")&&v.path!==a);let c=o.activeFileId;const p=o.files.find(v=>v.id===o.activeFileId);return p&&(p.path.startsWith(a+"/")||p.path===a)&&(c=s.length>0?s[0].id:null),{...o,files:s,activeFileId:c,tree:rl(o.tree,a)}}),i("フォルダを削除しました")}catch(o){i(`フォルダ削除に失敗しました: ${Pe(o)}`)}},[e,r,i]);return{savingFileId:n,handleRefreshTree:_,handleToggleDir:l,handleOpenFile:u,handleFileChange:f,handleSaveFile:S,handleCloseFile:d,handleCreateFile:m,handleCreateDirectory:C,handleDeleteFile:w,handleDeleteDirectory:g}};async function v0(e,t,r,i){if(!i.current[e]){i.current[e]=!0,t(e,n=>({...n,loading:!0,reposLoading:!0,error:null}));try{const h=(await Ne(yv(e)).catch(()=>({repos:[]}))).repos;t(e,d=>({...d,repos:h,reposLoading:!1,selectedRepoPath:d.selectedRepoPath??(h.length>0?h[0].path:null)}));const l=(r.current[e]||yi()).selectedRepoPath??(h.length>0?h[0].path:void 0),[u,f,S]=await Promise.all([Ne(id(e,l||void 0)),Ne(od(e,l||void 0)).catch(()=>({ahead:0,behind:0,hasUpstream:!1})),Ne(ld(e,l||void 0)).catch(()=>({hasRemote:!1,remotes:[]}))]);t(e,d=>({...d,status:u,branchStatus:f,hasRemote:S.hasRemote,loading:!1,error:null}))}catch(n){const h=n instanceof Error?n.message:"Failed to get git status";t(e,_=>({..._,status:null,loading:!1,reposLoading:!1,error:h}))}finally{i.current[e]=!1}}}async function m0(e,t,r,i){r(e,n=>({...n,selectedRepoPath:t,loading:!0}));try{const[n,h,_]=await Promise.all([Ne(id(e,t||void 0)),Ne(od(e,t||void 0)).catch(()=>({ahead:0,behind:0,hasUpstream:!1})),Ne(ld(e,t||void 0)).catch(()=>({hasRemote:!1,remotes:[]}))]);r(e,l=>({...l,status:n,branchStatus:h,hasRemote:_.hasRemote,loading:!1,branches:[],logs:[]}))}catch(n){const h=n instanceof Error?n.message:"Failed to get git status";i(h),r(e,_=>({..._,loading:!1}))}}async function g0(e,t,r,i,n){try{await nd(e,[t],r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to stage file")}}async function y0(e,t,r,i,n){try{await sd(e,[t],r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to unstage file")}}async function S0(e,t,r,i,n){if(t.length!==0)try{await nd(e,t,r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to stage files")}}async function C0(e,t,r,i,n){if(t.length!==0)try{await sd(e,t,r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to unstage files")}}async function w0(e,t,r,i,n){try{const h=await Sv(e,t.trim(),r);i(`Committed: ${h.summary.changes} changes, +${h.summary.insertions} -${h.summary.deletions}`),await n()}catch(h){i(h instanceof Error?h.message:"Failed to commit")}}async function x0(e,t,r,i,n){try{await Cv(e,[t],r),await n()}catch(h){i(h instanceof Error?h.message:"Failed to discard changes")}}async function b0(e,t,r,i,n){i(e,h=>({...h,diffPath:t.path,diffLoading:!0,diff:null}));try{const h=await wv(e,t.path,t.staged,r);i(e,_=>({..._,diff:h,diffLoading:!1}))}catch(h){n(h instanceof Error?h.message:"Failed to get diff"),i(e,_=>({..._,diffPath:null,diff:null,diffLoading:!1}))}}async function E0(e,t,r,i,n){r(e,h=>({...h,pushing:!0}));try{const h=await xv(e,t);i(`Pushed to ${h.branch}`),await n()}catch(h){i(h instanceof Error?h.message:"Failed to push")}finally{r(e,h=>({...h,pushing:!1}))}}async function k0(e,t,r,i,n){r(e,h=>({...h,pulling:!0}));try{const h=await bv(e,t);h.summary.changes>0?i(`Pulled: ${h.summary.changes} changes, +${h.summary.insertions} -${h.summary.deletions}`):i("Already up to date"),await n()}catch(h){i(h instanceof Error?h.message:"Failed to pull")}finally{r(e,h=>({...h,pulling:!1}))}}async function L0(e,t,r,i){try{await Ev(e,t),r("Fetched from remote"),await i()}catch(n){r(n instanceof Error?n.message:"Failed to fetch")}}async function D0(e,t,r,i){r(e,n=>({...n,branchesLoading:!0}));try{const n=await Ne(kv(e,t));r(e,h=>({...h,branches:n.branches,branchesLoading:!1}))}catch(n){i(n instanceof Error?n.message:"Failed to load branches"),r(e,h=>({...h,branchesLoading:!1}))}}async function R0(e,t,r,i,n,h){try{await Lv(e,t,r),i(`Switched to branch '${t}'`),await n(),await h()}catch(_){i(_ instanceof Error?_.message:"Failed to checkout branch")}}async function T0(e,t,r,i,n,h,_){try{await Dv(e,t,r,i),n(`Created branch '${t}'${r?" and switched to it":""}`),await h(),await _()}catch(l){n(l instanceof Error?l.message:"Failed to create branch")}}async function A0(e,t,r,i,n){i(e,h=>({...h,logsLoading:!0}));try{const h=await Ne(Rv(e,t,r));i(e,_=>({..._,logs:h.logs,logsLoading:!1}))}catch(h){n(h instanceof Error?h.message:"Failed to load git log"),i(e,_=>({..._,logsLoading:!1}))}}const yi=()=>({status:null,loading:!1,error:null,diffPath:null,diff:null,diffLoading:!1,branchStatus:null,hasRemote:!1,pushing:!1,pulling:!1,branches:[],branchesLoading:!1,logs:[],logsLoading:!1,repos:[],reposLoading:!1,selectedRepoPath:null}),P0=(e,t)=>{const[r,i]=N.useState({}),n=N.useRef({}),h=N.useRef(r);h.current=r;const _=e&&r[e]||yi(),l=N.useCallback((T,B)=>{i(z=>({...z,[T]:B(z[T]||yi())}))},[]),u=N.useCallback(async T=>{const B=T||e;B&&await v0(B,l,h,n)},[e,l]),f=N.useCallback(async T=>{e&&await m0(e,T,l,t)},[e,l,t]),S=N.useCallback(async()=>{const T=Object.keys(h.current);await Promise.all(T.map(B=>u(B)))},[u]),d=N.useCallback(()=>{if(!e)return;const T=h.current[e];return(T==null?void 0:T.selectedRepoPath)||void 0},[e]),m=N.useCallback(async T=>{e&&await g0(e,T,d(),t,u)},[e,d,t,u]),C=N.useCallback(async T=>{e&&await y0(e,T,d(),t,u)},[e,d,t,u]),w=N.useCallback(async()=>{if(!e||!_.status)return;const T=_.status.files.filter(B=>!B.staged).map(B=>B.path);await S0(e,T,d(),t,u)},[e,_.status,d,t,u]),g=N.useCallback(async()=>{if(!e||!_.status)return;const T=_.status.files.filter(B=>B.staged).map(B=>B.path);await C0(e,T,d(),t,u)},[e,_.status,d,t,u]),a=N.useCallback(async T=>{!e||!T.trim()||await w0(e,T,d(),t,u)},[e,d,t,u]),o=N.useCallback(async T=>{e&&await x0(e,T,d(),t,u)},[e,d,t,u]),s=N.useCallback(async T=>{e&&await b0(e,T,d(),l,t)},[e,d,l,t]),c=N.useCallback(()=>{e&&l(e,T=>({...T,diffPath:null,diff:null,diffLoading:!1}))},[e,l]),p=N.useCallback(async()=>{e&&await E0(e,d(),l,t,u)},[e,d,l,t,u]),v=N.useCallback(async()=>{e&&await k0(e,d(),l,t,u)},[e,d,l,t,u]),x=N.useCallback(async()=>{e&&await L0(e,d(),t,u)},[e,d,t,u]),b=N.useCallback(async()=>{e&&await D0(e,d(),l,t)},[e,d,l,t]),y=N.useCallback(async T=>{e&&await R0(e,T,d(),t,u,b)},[e,d,t,u,b]),k=N.useCallback(async(T,B=!0)=>{e&&await T0(e,T,B,d(),t,u,b)},[e,d,t,u,b]),R=N.useCallback(async(T=50)=>{e&&await A0(e,T,d(),l,t)},[e,d,l,t]),O=N.useCallback(T=>r[T]||yi(),[r]);return{gitState:_,gitStates:r,refreshGitStatus:u,refreshAllGitStatuses:S,getGitStateForWorkspace:O,handleSelectRepo:f,handleStageFile:m,handleUnstageFile:C,handleStageAll:w,handleUnstageAll:g,handleCommit:a,handleDiscardFile:o,handleShowDiff:s,handleCloseDiff:c,handlePush:p,handlePull:v,handleFetch:x,handleLoadBranches:b,handleCheckoutBranch:y,handleCreateBranch:k,handleLoadLogs:R}};function M0(){const[e,t]=N.useState(Xv);N.useEffect(()=>{if(!(typeof document>"u")){document.documentElement.dataset.theme=e;try{window.localStorage.setItem(td,e)}catch{}}},[e]);const r=N.useCallback(()=>{t(i=>i==="dark"?"light":"dark")},[]);return{theme:e,handleToggleTheme:r}}function B0({view:e,editorWorkspaceId:t,activeDeckIds:r,workspaceMode:i,setView:n,setEditorWorkspaceId:h,setActiveDeckIds:_,setWorkspaceMode:l}){N.useEffect(()=>{const u=()=>{const f=ud();n(f.view),h(f.workspaceId??null),_(f.deckIds),l(f.workspaceMode)};return window.addEventListener("popstate",u),()=>window.removeEventListener("popstate",u)},[n,h,_,l]),N.useEffect(()=>{const u=new URLSearchParams;u.set("view",e),e==="workspace"&&t&&u.set("workspace",t),r.length>0&&u.set("decks",r.join(",")),e==="workspace"&&i==="editor"&&t&&u.set("mode","editor");const f=u.toString(),S=f?`${window.location.pathname}?${f}`:window.location.pathname;window.history.replaceState(null,"",S)},[e,t,r,i])}function O0(){const[e,t]=N.useState(!1),[r,i]=N.useState(!1),[n,h]=N.useState(!1),_=N.useCallback(()=>t(!0),[]),l=N.useCallback(()=>t(!1),[]),u=N.useCallback(()=>i(!0),[]),f=N.useCallback(()=>i(!1),[]),S=N.useCallback(()=>h(!0),[]),d=N.useCallback(()=>h(!1),[]);return{isWorkspaceModalOpen:e,openWorkspaceModal:_,closeWorkspaceModal:l,isDeckModalOpen:r,openDeckModal:u,closeDeckModal:f,isSettingsModalOpen:n,openSettingsModal:S,closeSettingsModal:d}}const Ac=3;function Pc(e,t,r){const i=e.indexOf(t),n=e.indexOf(r);if(i<0||n<0||i===n)return e;const h=[...e];h.splice(i,1);const _=h.indexOf(r);return h.splice(_,0,t),h}function N0(){const e=ud(),t=N.useRef(null),r=N.useRef(!1),[i,n]=N.useState(e.view),[h,_]=N.useState(e.workspaceMode),[l,u]=N.useState(q_),[f,S]=N.useState(""),[d,m]=N.useState(null),[C,w]=N.useState(null),[g,a]=N.useState(!1),[o,s]=N.useState(!1),[c,p]=N.useState(null),{theme:v,handleToggleTheme:x}=M0(),{isWorkspaceModalOpen:b,openWorkspaceModal:y,closeWorkspaceModal:k,isDeckModalOpen:R,openDeckModal:O,closeDeckModal:T,isSettingsModalOpen:B,openSettingsModal:z,closeSettingsModal:I}=O0(),{workspaceStates:j,setWorkspaceStates:$,updateWorkspaceState:E,initializeWorkspaceStates:A}=h0(),{deckStates:P,setDeckStates:M,updateDeckState:H,initializeDeckStates:K}=d0(),{workspaces:X,editorWorkspaceId:q,setEditorWorkspaceId:se,handleCreateWorkspace:D,handleDeleteWorkspace:F}=f0({setStatusMessage:S,defaultRoot:l,initializeWorkspaceStates:A,setWorkspaceStates:$}),{decks:W,activeDeckIds:U,setActiveDeckIds:re,handleCreateDeck:Q,handleDeleteDeck:ae,handleReorderDecks:we,handleCreateTerminal:fe,handleDeleteTerminal:ut,handleRemoveTerminalLocal:ne}=p0({setStatusMessage:S,initializeDeckStates:K,updateDeckState:H,setDeckStates:M,initialDeckIds:e.deckIds}),ht=N.useMemo(()=>ss(),[]),Xe=N.useMemo(()=>os(),[]),Ut=X.find(V=>V.id===q)||null,J=q&&j[q]||ht,{savingFileId:Y,handleRefreshTree:te,handleToggleDir:ie,handleOpenFile:oe,handleFileChange:ce,handleSaveFile:Be,handleCloseFile:me,handleCreateFile:Tt,handleCreateDirectory:We,handleDeleteFile:At,handleDeleteDirectory:pe}=_0({editorWorkspaceId:q,activeWorkspaceState:J,updateWorkspaceState:E,setStatusMessage:S}),{gitState:ni,refreshGitStatus:ks,handleSelectRepo:yd,handleStageFile:Sd,handleUnstageFile:Cd,handleStageAll:wd,handleUnstageAll:xd,handleCommit:bd,handleDiscardFile:Ed,handleShowDiff:kd,handleCloseDiff:Ld,handlePush:Dd,handlePull:Rd,handleLoadBranches:Td,handleCheckoutBranch:Ad,handleCreateBranch:Pd,handleLoadLogs:Md}=P0(q,S);B0({view:i,editorWorkspaceId:q,activeDeckIds:U,workspaceMode:h,setView:n,setEditorWorkspaceId:se,setActiveDeckIds:re,setWorkspaceMode:_});const Bd=ev(),Ql=N.useMemo(()=>new Map(X.map(V=>[V.id,V])),[X]),Ls=W;N.useEffect(()=>{let V=!0;return iv().then(ee=>{V&&ee!=null&&ee.defaultRoot&&u(ee.defaultRoot)}).catch(()=>{}),()=>{V=!1}},[]),N.useEffect(()=>{if(f!==Jh)return;const V=setTimeout(()=>S(""),Y_);return()=>clearTimeout(V)},[f]),N.useEffect(()=>{h==="editor"&&!q&&_("list")},[h,q]),N.useEffect(()=>{if(typeof window>"u")return;const V=window.matchMedia("(pointer: fine) and (min-width: 721px)"),ee=()=>s(V.matches);return ee(),V.addEventListener("change",ee),()=>V.removeEventListener("change",ee)},[]);const Pt=N.useCallback(()=>{m(null),w(null),a(!1)},[]),tn=N.useCallback(()=>{r.current=!0,window.setTimeout(()=>{r.current=!1},100)},[]);N.useEffect(()=>{o||Pt()},[o,Pt]);const Ds=N.useRef(null);N.useEffect(()=>{if(h!=="editor"||!q){Ds.current=null;return}Ds.current!==q&&(Ds.current=q,te(),ks())},[h,q,te,ks]);const Od=N.useCallback(()=>{if(X.length===0){S(G_);return}O()},[X.length,O]),Nd=N.useCallback(async(V,ee)=>{if(!ee){S(X_);return}await Q(V,ee)&&T()},[Q,T]),jd=N.useCallback(async V=>{try{const ee=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});if(!ee.ok){const ge=await ee.text();throw new Error(ge||"Failed to save settings")}await ee.json(),S("設定を保存しました。ブラウザをリロードしてください。"),setTimeout(()=>{window.location.reload()},2e3)}catch(ee){throw console.error("Failed to save settings:",ee),ee}},[]),Id=N.useCallback(V=>{se(V),_("editor")},[se]),Fd=N.useCallback(()=>{_("list")},[]),Hd=N.useCallback(async V=>{await D(V)&&k()},[D,k]),zd=N.useCallback(V=>{const ee=P[V]||Xe;fe(V,ee.terminals.length)},[P,Xe,fe]),$d=N.useCallback(V=>{const ee=P[V]||Xe;fe(V,ee.terminals.length,"claude","Claude Code")},[P,Xe,fe]),Ud=N.useCallback(V=>{const ee=P[V]||Xe;fe(V,ee.terminals.length,"codex","Codex")},[P,Xe,fe]),Wd=N.useCallback((V,ee)=>{ut(V,ee)},[ut]),Vd=N.useCallback((V,ee)=>{ne(V,ee)},[ne]),Kd=N.useCallback(V=>{if(r.current){r.current=!1;return}re([V])},[re]),Jl=N.useCallback(V=>{re(ee=>{const ge=[...ee.filter(_e=>_e!==V),V];return ge.length<=Ac?ge:ge.slice(ge.length-Ac)})},[re]),qd=N.useCallback(V=>{re(ee=>{if(ee.length<=1){const ge=Ls.find(_e=>_e.id!==V);return ge?[ge.id]:ee}return ee.filter(ge=>ge!==V)})},[Ls,re]),Gd=N.useCallback((V,ee)=>{V.preventDefault(),V.stopPropagation(),p({deckId:ee,x:V.clientX,y:V.clientY})},[]),Xd=N.useCallback(()=>{if(!c)return;const{deckId:V}=c;p(null),window.confirm(`このデッキを完全に削除しますか?
|
|
64
|
+
ターミナルもすべて削除されます。`)&&ae(V)},[c,ae]),Zl=N.useCallback(()=>{p(null)},[]),Yd=N.useCallback((V,ee)=>{if(!o){V.preventDefault();return}V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",ee),m(ee),w(null),a(!1)},[o]),Qd=N.useCallback((V,ee)=>{!o||!d||d===ee||(V.preventDefault(),V.dataTransfer.dropEffect="move",w(ee),a(!1))},[o,d]),Jd=N.useCallback((V,ee)=>{V.currentTarget.contains(V.relatedTarget)||w(ge=>ge===ee?null:ge)},[]),Zd=N.useCallback((V,ee)=>{if(!o)return;V.preventDefault();const ge=d||V.dataTransfer.getData("text/plain");if(!ge||ge===ee){Pt();return}we(_e=>{const af=_e.map(kr=>kr.id),cf=Pc(af,ge,ee),uf=new Map(_e.map(kr=>[kr.id,kr]));return cf.map(kr=>uf.get(kr))}),re(_e=>Pc(_e,ge,ee)),tn(),Pt()},[d,o,Pt,re,tn,we]),ef=N.useCallback(V=>{!o||!d||(V.preventDefault(),V.dataTransfer.dropEffect="move",a(!0))},[o,d]),tf=N.useCallback(V=>{V.currentTarget.contains(V.relatedTarget)||a(!1)},[]),rf=N.useCallback(V=>{if(!o)return;V.preventDefault();const ee=d||V.dataTransfer.getData("text/plain");if(!ee){Pt();return}Jl(ee),tn(),Pt()},[d,Jl,o,Pt,tn]),nf=N.useCallback(V=>{q&&E(q,ee=>({...ee,activeFileId:V}))},[q,E]),sf=h==="editor"&&!!q,of=L.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[L.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 flex-shrink-0",children:[L.jsx("button",{type:"button",className:"bg-accent text-white border-0 px-3.5 py-1.5 text-[13px] font-medium rounded-[2px] cursor-pointer hover:opacity-90",onClick:y,children:"ワークスペース追加"}),L.jsx(jv,{workspaces:X,selectedWorkspaceId:q,onSelect:Id,onDelete:F})]}),sf&&L.jsx(qg,{activeWorkspace:Ut,defaultRoot:l,activeWorkspaceState:J,editorWorkspaceId:q,gitState:ni,theme:v,savingFileId:Y,onCloseWorkspaceEditor:Fd,onToggleDir:ie,onOpenFile:oe,onRefreshTree:te,onCreateFile:Tt,onCreateDirectory:We,onDeleteFile:At,onDeleteDirectory:pe,onRefreshGit:ks,onSelectRepo:yd,onStageFile:Sd,onUnstageFile:Cd,onStageAll:wd,onUnstageAll:xd,onCommit:bd,onDiscardFile:Ed,onShowDiff:kd,onCloseDiff:Ld,onPush:Dd,onPull:Rd,onLoadBranches:Td,onCheckoutBranch:Ad,onCreateBranch:Pd,onLoadLogs:Md,onSelectFile:nf,onCloseFile:me,onChangeFile:ce,onSaveFile:Be})]}),lf=L.jsxs("div",{className:"terminal-layout",children:[L.jsx("div",{className:"terminal-topbar",children:L.jsx("div",{className:"topbar-left",children:L.jsxs("div",{className:"deck-tabs",children:[Ls.map(V=>{var ee,ge;return L.jsxs("button",{type:"button",className:tt("deck-tab",U.includes(V.id)&&"active",d===V.id&&"is-dragging",C===V.id&&"is-drag-over"),onClick:()=>Kd(V.id),onContextMenu:_e=>Gd(_e,V.id),draggable:o,onDragStart:_e=>Yd(_e,V.id),onDragOver:_e=>Qd(_e,V.id),onDragLeave:_e=>Jd(_e,V.id),onDrop:_e=>Zd(_e,V.id),onDragEnd:Pt,title:o?`${((ee=Ql.get(V.workspaceId))==null?void 0:ee.path)||V.root}
|
|
65
|
+
ドラッグで並び替え / メインにドロップで分割表示`:`${((ge=Ql.get(V.workspaceId))==null?void 0:ge.path)||V.root}`,children:[L.jsx("span",{className:"deck-tab-name",children:V.name}),L.jsx("span",{className:"deck-tab-close",role:"button","aria-label":"閉じる",onClick:_e=>{_e.stopPropagation(),qd(V.id)},children:"×"})]},V.id)}),L.jsx("button",{type:"button",className:"deck-tab deck-tab-add",onClick:Od,title:"デッキ作成",children:"+"})]})})}),L.jsx("div",{className:tt("terminal-split-container",g&&"is-drop-target"),ref:t,style:{gridTemplateColumns:`repeat(${U.length}, minmax(0, 1fr))`},onDragOver:ef,onDragLeave:tf,onDrop:rf,children:U.length===0?L.jsx("div",{className:"panel flex items-center justify-center text-muted text-[13px] p-5",children:"デッキを作成してください。"}):U.map(V=>{const ee=W.find(_e=>_e.id===V),ge=P[V]||Xe;return ee?L.jsxs("div",{className:"deck-split-pane",children:[L.jsxs("div",{className:"flex items-center justify-between px-2 py-1 border-b border-border bg-sidebar gap-2 min-h-[28px]",children:[U.length>1&&L.jsx("span",{className:"flex-1 min-w-0 text-[11px] font-semibold text-ink-muted overflow-hidden text-ellipsis whitespace-nowrap",children:ee.name}),L.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[L.jsx("button",{type:"button",className:"topbar-btn-sm",onClick:()=>zd(V),title:"ターミナル追加",children:"+"}),L.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-claude",onClick:()=>$d(V),title:"Claude",children:"C"}),L.jsx("button",{type:"button",className:"topbar-btn-sm topbar-btn-codex",onClick:()=>Ud(V),title:"Codex",children:"X"})]})]}),L.jsx(Ov,{terminals:ge.terminals,wsBase:Bd,onDeleteTerminal:_e=>Wd(V,_e),onExitTerminal:_e=>Vd(V,_e)})]},V):null})})]});return L.jsxs("div",{className:"app","data-view":i,children:[L.jsx(H_,{activeView:i,onSelect:n,theme:v,onToggleTheme:x,onOpenSettings:z}),L.jsxs("main",{className:"main",children:[i==="workspace"&&of,i==="terminal"&&lf]}),L.jsx(z_,{message:f}),L.jsx(Yv,{isOpen:b,defaultRoot:l,onSubmit:Hd,onClose:k}),L.jsx(F_,{isOpen:R,workspaces:X,onSubmit:Nd,onClose:T}),L.jsx(u0,{isOpen:B,onClose:I,onSave:jd}),c&&L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"fixed inset-0 z-[999]",onClick:Zl,onContextMenu:V=>{V.preventDefault(),Zl()}}),L.jsx("div",{className:"fixed z-[1000] bg-panel border border-border shadow-lg rounded-[2px] py-1 min-w-[140px]",style:{left:c.x,top:c.y},children:L.jsx("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-[13px] text-red-400 bg-transparent border-0 cursor-pointer hover:bg-list-hover",onClick:Xd,children:"デッキを削除"})})]})]})}class j0 extends N.Component{constructor(t){super(t),this.handleReload=()=>{window.location.reload()},this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){console.error("Application error:",t),console.error("Component stack:",r.componentStack)}render(){return this.state.hasError?L.jsx("div",{className:"flex items-center justify-center min-h-screen p-8 bg-bg",children:L.jsxs("div",{className:"max-w-[500px] p-8 bg-panel border border-border text-center",children:[L.jsx("h1",{className:"m-0 mb-4 text-xl text-[#f14c4c]",children:"Something went wrong"}),L.jsx("p",{className:"m-0 mb-6 text-muted",children:"The application encountered an unexpected error."}),this.state.error&&!1,L.jsx("button",{onClick:this.handleReload,className:"px-4 py-2 bg-accent text-white border-0 rounded-[2px] font-medium cursor-pointer hover:opacity-90",children:"Reload Application"})]})}):this.props.children}}lo.createRoot(document.getElementById("root")).render(L.jsx(vr.StrictMode,{children:L.jsx(j0,{children:L.jsx(N0,{})})}));
|