tring-chat 0.1.16 → 0.1.18

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.
@@ -0,0 +1,77 @@
1
+ var cs=Object.defineProperty;var ds=(p,v,b)=>v in p?cs(p,v,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[v]=b;var te=(p,v,b)=>ds(p,typeof v!="symbol"?v+"":v,b);(function(){const v=document.createElement("link").relList;if(v&&v.supports&&v.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))L(A);new MutationObserver(A=>{for(const I of A)if(I.type==="childList")for(const M of I.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&L(M)}).observe(document,{childList:!0,subtree:!0});function b(A){const I={};return A.integrity&&(I.integrity=A.integrity),A.referrerPolicy&&(I.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?I.credentials="include":A.crossOrigin==="anonymous"?I.credentials="omit":I.credentials="same-origin",I}function L(A){if(A.ep)return;A.ep=!0;const I=b(A);fetch(A.href,I)}})();const us=16,_s={code:"Space",ctrl:!0};function fs(){const p=[];for(let v=1;v<=10;v++){const b=v===10?0:v;p.push({slot:v,code:`Digit${b}`,legend:String(b)})}for(let v=11;v<=us;v++){const b=v-10;p.push({slot:v,code:`Digit${b}`,ctrl:!0,legend:`Ctrl+${b}`}),p.push({slot:v,code:`Digit${b}`,shift:!0,legend:`Shift+${b}`})}return p}const Si=fs(),ps={KeyN:"next-done",KeyP:"projects",KeyC:"new-session",KeyR:"rename",KeyX:"kill",KeyM:"mark-seen",KeyO:"orchestrator",Escape:"close"};function Ci(p,v){return v.code===p.code&&v.ctrlKey===!!p.ctrl&&v.shiftKey===!!p.shift&&!v.altKey&&!v.metaKey}function Wt(p){return Ci(_s,p)}function gs(p){for(const v of Si)if(Ci(v,p))return v.slot;return null}function vs(p){return p.ctrlKey||p.altKey||p.metaKey?null:ps[p.code]??null}const ms="\x1B\r";function Ss(p){return p.code!=="Enter"&&p.code!=="NumpadEnter"?!1:(p.ctrlKey||p.shiftKey)&&!p.altKey&&!p.metaKey}function Cs(p,v){return!v&&p.code==="KeyV"&&p.ctrlKey&&!p.shiftKey&&!p.altKey&&!p.metaKey}function Ut(p){return Si.filter(v=>v.slot===p).map(v=>v.legend).join(" / ")}function bs(p){const v=p.indexOf(0);return v<0?null:{id:new TextDecoder().decode(p.subarray(0,v)),data:p.subarray(v+1)}}const ii="tring.token";function ws(p,v,b){const L=new URLSearchParams(p).get("token");if(L){try{v.setItem(ii,L)}catch{}try{b==null||b()}catch{}return L}try{return v.getItem(ii)??void 0}catch{return}}const bt=location.origin,Ue=ws(location.search,localStorage,()=>{const p=new URL(location.href);p.searchParams.delete("token"),history.replaceState(null,"",`${p.pathname}${p.search}${p.hash}`)});async function wt(p){const v=await fetch(`${bt}${p}`,{headers:Ue?{authorization:`Bearer ${Ue}`}:{}}),b=await v.json().catch(()=>({}));if(!v.ok)throw new Error(b.error??`request failed (${v.status})`);return b}async function ys(p,v){const b=await fetch(`${bt}${p}`,{method:"POST",headers:{...Ue?{authorization:`Bearer ${Ue}`}:{},"content-type":"application/json"},body:JSON.stringify({})}),L=await b.json().catch(()=>({}));if(!b.ok)throw new Error(L.error??`request failed (${b.status})`);return L}async function Es(p){const v=p instanceof File?`?name=${encodeURIComponent(p.name)}`:"",b=await fetch(`${bt}/api/upload${v}`,{method:"POST",headers:{...Ue?{authorization:`Bearer ${Ue}`}:{},"content-type":p.type||"application/octet-stream"},body:p}),L=await b.json().catch(()=>({}));if(!b.ok||!L.path)throw new Error(L.error??`upload failed (${b.status})`);return L.path}class Ls{constructor(v,b=Ue){te(this,"ws",null);te(this,"retry",0);te(this,"closed",!1);this.h=v,this.token=b}connect(){const v=bt.replace(/^http/,"ws"),b=new WebSocket(v);b.binaryType="arraybuffer",this.ws=b,b.onopen=()=>{this.retry=0,this.send({type:"hello",...this.token?{token:this.token}:{}}),this.h.onOpen()},b.onmessage=L=>{if(L.data instanceof ArrayBuffer){const A=bs(new Uint8Array(L.data));A&&this.h.onOutput(A.id,A.data);return}this.h.onMessage(JSON.parse(String(L.data)))},b.onclose=()=>{this.ws=null,this.h.onClose(),!this.closed&&(this.retry=Math.min(this.retry+1,8),setTimeout(()=>this.connect(),Math.min(200*this.retry,2e3)))}}send(v){var b;((b=this.ws)==null?void 0:b.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(v))}dispose(){var v;this.closed=!0,(v=this.ws)==null||v.close()}}const xs=4e3,ye=p=>typeof p=="string"&&p.trim()?p:void 0;function Te(p,v=xs){return p.length<=v?p:`${p.slice(0,v)}
2
+ … ${p.length-v} more characters`}function ks(p){if(p.kind==="reply")return{heading:"Finished — waiting for you",body:Te(p.message??""),mono:!1};if(p.kind==="question")return{heading:"Question",body:"",mono:!1};const v=p.input??{},b=p.tool??"tool",L=ye(v.description),A=ye(v.file_path)??ye(v.notebook_path)??ye(v.path);switch(b){case"Bash":return{heading:"Run a command",tool:b,body:Te(ye(v.command)??""),mono:!0,...L?{note:L}:{}};case"Edit":case"MultiEdit":return{heading:"Edit a file",tool:b,body:Te(Rs(v,A)),mono:!0};case"Write":return{heading:"Write a file",tool:b,body:Te(`${A??""}
3
+
4
+ ${ye(v.content)??""}`),mono:!0};case"NotebookEdit":return{heading:"Edit a notebook",tool:b,body:Te(A??""),mono:!0};case"WebFetch":return{heading:"Fetch a web page",tool:b,body:Te(ye(v.url)??""),mono:!0,...ye(v.prompt)?{note:ye(v.prompt)}:{}};case"WebSearch":return{heading:"Search the web",tool:b,body:Te(ye(v.query)??""),mono:!1};case"ExitPlanMode":return{heading:"Approve the plan",tool:b,body:Te(ye(v.plan)??""),mono:!1}}return{heading:b.startsWith("mcp__")?`Use ${b.split("__")[1]??"an MCP"} tool`:`Use ${b}`,tool:b,body:Te(JSON.stringify(v,null,2)),mono:!0,...L?{note:L}:{}}}function Rs(p,v){const L=(Array.isArray(p.edits)?p.edits:[p]).map(A=>{const I=ye(A.old_string)??"",M=ye(A.new_string)??"";return[...I.split(`
5
+ `).map(t=>`- ${t}`),...M.split(`
6
+ `).map(t=>`+ ${t}`)].join(`
7
+ `)});return[v??"",...L].join(`
8
+
9
+ `)}function si(p,v,b){var A;const L={};for(const[I,M]of p.entries()){const t=[...v.get(I)??[]],a=(A=b.get(I))==null?void 0:A.trim();if(a&&t.push(a),t.length===0)return null;L[M.question]=M.multiSelect?t.join(", "):t[t.length-1]}return L}function Lt(p){const v=Math.max(0,Math.round(p/1e3));return v<60?`${v}s`:v<3600?`${Math.floor(v/60)}m`:`${Math.floor(v/3600)}h`}const xt="tring.orchestrator",Ds=350;function Q(p,v,b){const L=document.createElement(p);return v&&(L.className=v),b!==void 0&&(L.textContent=b),L}function xe(p,v,b,L){const A=Q("button",`btn ${v}`,p);return A.type="button",L&&(A.title=L),A.onclick=I=>{I.stopPropagation(),b()},A}class bi{constructor(v,b){te(this,"el",Q("div","inbox"));te(this,"list",Q("div","inbox-list"));te(this,"empty",Q("div","inbox-empty"));te(this,"banner",Q("div","inbox-banner"));te(this,"autoBox",Q("input"));te(this,"history",Q("details","inbox-history"));te(this,"historyList",Q("ol","inbox-history-list"));te(this,"historySummary",Q("summary"));te(this,"cards",new Map);te(this,"items",[]);te(this,"shown",!1);te(this,"armedAt",0);te(this,"ticker",null);this.cb=b,this.el.hidden=!0,this.el.tabIndex=-1;const L=Q("div","inbox-head");L.append(Q("span","inbox-title","Orchestrator"),Q("span","inbox-hint","a allow · d deny · t answer in terminal · o open · 1–9 pick · ↑↓ move · Ctrl+Space then o to leave")),this.autoBox.type="checkbox",this.autoBox.onchange=()=>this.cb.onAuto(this.autoBox.checked);const A=Q("label","inbox-auto");A.title="A small Claude model approves routine permission prompts (tests, builds, edits inside the project). Pushes, deletes, sudo, secrets, publishing, MCP tools, plans and questions always come to you. It never denies.",A.append(this.autoBox,Q("span",void 0,"AI approves routine prompts")),L.append(A),this.history.hidden=!0,this.history.append(this.historySummary,this.historyList),this.banner.hidden=!0,this.el.append(L,this.banner,this.history,this.list,this.empty),this.el.addEventListener("keydown",I=>this.onKey(I)),v.append(this.el)}get isOpen(){return this.shown}static wanted(){try{return localStorage.getItem(xt)==="1"}catch{return!1}}open(){this.shown=!0,this.el.hidden=!1;try{localStorage.setItem(xt,"1")}catch{}this.render(),this.checkHooks(),this.ticker??(this.ticker=setInterval(()=>this.paintAges(),5e3)),this.focusCard(0,!1)}close(){this.shown=!1,this.el.hidden=!0;try{localStorage.setItem(xt,"0")}catch{}this.ticker&&clearInterval(this.ticker),this.ticker=null}countFor(v){return this.items.filter(b=>b.sessionId===v).length}get count(){return this.items.length}setItems(v){const b=new Set(this.items.map(A=>A.id)),L=this.focusedCardId();return this.items=v,this.render(),this.shown&&L&&!this.cards.has(L)?this.focusCard(0,!0):this.shown&&!L&&document.activeElement===this.el&&this.focusCard(0,!0),v.filter(A=>!b.has(A.id))}setAuto(v,b){this.autoBox.checked=v,this.history.hidden=b.length===0;const L=b.filter(A=>A.verdict==="allow").length;this.historySummary.textContent=`AI decisions: ${L} approved for you, ${b.length-L} left for you`,this.historyList.replaceChildren(...b.map(A=>{const I=Q("li",`hist-${A.verdict}`),M=this.cb.label(A.sessionId);return I.append(Q("span","hist-verdict",A.verdict==="allow"?"approved":"asked you"),Q("span","hist-who",M?`${M.slot} ${M.name}`:"closed session"),Q("code","hist-what",A.what||A.tool),Q("span","hist-reason",A.reason),Q("span","hist-age",Lt(Date.now()-A.at))),I}))}repaint(){for(const v of this.cards.values())v.paintHeader()}render(){const v=new Set(this.items.map(b=>b.id));for(const[b,L]of this.cards)v.has(b)||(L.root.remove(),this.cards.delete(b));for(const b of this.items){let L=this.cards.get(b.id);L||(L=this.build(b),this.cards.set(b.id,L)),this.list.append(L.root)}this.empty.hidden=this.items.length>0,this.empty.textContent="Nothing is waiting on you. Cards appear here when an agent asks for permission, asks a question, or finishes."}async checkHooks(){try{const v=await this.cb.hooks();if(this.banner.hidden=v.installed,v.installed)return;this.banner.replaceChildren(Q("span",void 0,`Claude Code hooks are not installed, so agents cannot reach this inbox. They go in ${v.path} and do nothing outside tring.`),xe("Install hooks","primary",()=>{this.cb.installHooks().then(()=>this.checkHooks(),b=>{this.banner.replaceChildren(Q("span",void 0,`Could not install: ${b.message}`))})}),Q("span","inbox-note","Restart running claude sessions to pick them up."))}catch{this.banner.hidden=!0}}focusedCardId(){const v=document.activeElement;for(const[b,L]of this.cards)if(L.root.contains(v))return b;return null}focusCard(v,b){const L=[...this.cards.values()][Math.max(0,Math.min(v,this.cards.size-1))];b&&(this.armedAt=performance.now()+Ds),L?L.root.focus({preventScroll:!1}):this.el.focus()}paintAges(){for(const v of this.cards.values()){const b=v.root.querySelector(".card-age");b&&(b.textContent=Lt(Date.now()-v.item.createdAt))}}onKey(v){if(v.ctrlKey||v.metaKey||v.altKey)return;const b=v.target,L=b.tagName==="TEXTAREA"||b.tagName==="INPUT",A=[...this.cards.keys()],I=A.indexOf(this.focusedCardId()??"");if(!L&&(v.key==="ArrowDown"||v.key==="j")){v.preventDefault(),this.focusCard(I+1,!1);return}if(!L&&(v.key==="ArrowUp"||v.key==="k")){v.preventDefault(),this.focusCard(Math.max(0,I-1),!1);return}if(!(I<0)){if(performance.now()<this.armedAt){v.preventDefault();return}this.cards.get(A[I]).key(v)&&v.preventDefault()}}build(v){const b=ks(v),L=Q("section",`card card-${v.kind}`);L.tabIndex=0;const A=Q("header","card-head"),I=Q("span","card-slot"),M=Q("span","card-name"),t=Q("span","card-where"),a=Q("span","card-heading",b.heading),h=Q("span","card-age",Lt(Date.now()-v.createdAt));A.append(I,M,t,a,h);const l=()=>{const o=this.cb.label(v.sessionId);I.textContent=o?String(o.slot):"?",M.textContent=(o==null?void 0:o.name)??"session",t.textContent=o!=null&&o.elsewhere?`in ${o.elsewhere}`:"",o!=null&&o.color?L.style.setProperty("--tint",o.color):L.style.removeProperty("--tint")};l(),L.append(A);const s=(o,e)=>this.cb.onAnswer(v.id,o,e),c=()=>this.cb.onOpen(v.sessionId),_=Q("div","card-actions");let g=()=>!1;if(v.kind==="permission"){b.note&&L.append(Q("p","card-note",b.note)),L.append(Q(b.mono?"pre":"p","card-body",b.body)),b.tool&&L.append(Q("div","card-tool",b.tool));const o=Q("input","card-reason");o.placeholder="Why not? (optional, Enter to deny)",o.hidden=!0;const e=()=>{if(o.hidden){o.hidden=!1,o.focus();return}s("deny",{message:o.value})};o.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),s("deny",{message:o.value})),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),o.hidden=!0,L.focus())}),_.append(xe("Allow","primary",()=>s("allow"),"a"),xe("Deny","danger",e,"d"),xe("Answer in terminal","",()=>s("terminal"),"t"),xe("Open","",c,"o")),L.append(_,o),g=r=>r.target!==L?!1:r.key==="a"?(s("allow"),!0):r.key==="d"?(e(),!0):r.key==="t"?(s("terminal"),!0):r.key==="o"?(c(),!0):!1}if(v.kind==="question"){const o=v.questions??[],e=new Map,r=new Map,i=xe("Send answers","primary",()=>n()),n=()=>{const C=si(o,e,r);C&&s("allow",{answers:C})},d=()=>{i.disabled=si(o,e,r)===null},S=o.length===1&&!o[0].multiSelect,f=[];for(const[C,u]of o.entries()){const m=Q("div","card-question");u.header&&m.append(Q("span","card-chip",u.header)),m.append(Q("p","card-ask",u.question));const w=Q("div","card-options");for(const[E,x]of u.options.entries()){const T=Q("button","option");T.type="button",T.append(Q("b",void 0,`${E+1}`),Q("span",void 0,x.label)),x.description&&T.append(Q("small",void 0,x.description)),T.onclick=F=>{F.stopPropagation();const $=e.get(C)??new Set;u.multiSelect?$.has(x.label)?$.delete(x.label):$.add(x.label):($.clear(),$.add(x.label)),e.set(C,$),Array.from(w.querySelectorAll(".option")).forEach((N,H)=>{N.classList.toggle("picked",$.has(u.options[H].label))}),d(),S&&n()},C===0&&f.push(T),w.append(T)}const k=Q("input","card-other");k.placeholder="Or type your own answer",k.addEventListener("input",()=>{r.set(C,k.value),d()}),k.addEventListener("keydown",E=>{E.key==="Enter"&&(E.preventDefault(),E.stopPropagation(),n()),E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),L.focus())}),m.append(w,k),L.append(m)}d(),_.append(...S?[]:[i],xe("Answer in terminal","",()=>s("terminal"),"t"),xe("Open","",c,"o")),L.append(_),g=C=>{if(C.target!==L)return!1;const u=Number(C.key);return u>=1&&u<=9&&f[u-1]?(f[u-1].click(),!0):C.key==="t"?(s("terminal"),!0):C.key==="o"?(c(),!0):C.key==="Enter"&&!S?(n(),!0):!1}}if(v.kind==="reply"){L.append(Q("div","card-message",b.body));const o=Q("textarea","card-reply");o.rows=2,o.placeholder="Reply… (Enter sends, Shift+Enter for a new line)";const e=()=>{const r=o.value.trim();r&&this.cb.onReply(v.id,r)};o.addEventListener("keydown",r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),r.stopPropagation(),e()),r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),L.focus())}),_.append(xe("Send","primary",e),xe("Dismiss","",()=>s("terminal"),"x"),xe("Open","",c,"o")),L.append(o,_),g=r=>r.target!==L?!1:r.key==="Enter"||r.key==="r"?(o.focus(),!0):r.key==="x"?(s("terminal"),!0):r.key==="o"?(c(),!0):!1}return{item:v,root:L,paintHeader:l,key:g}}}var As=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},wi={exports:{}};(function(p,v){(function(b,L){p.exports=L()})(globalThis,()=>(()=>{var b={4567:function(M,t,a){var h=this&&this.__decorate||function(i,n,d,S){var f,C=arguments.length,u=C<3?n:S===null?S=Object.getOwnPropertyDescriptor(n,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,n,d,S);else for(var m=i.length-1;m>=0;m--)(f=i[m])&&(u=(C<3?f(u):C>3?f(n,d,u):f(n,d))||u);return C>3&&u&&Object.defineProperty(n,d,u),u},l=this&&this.__param||function(i,n){return function(d,S){n(d,S,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=a(9042),c=a(9924),_=a(844),g=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends _.Disposable{constructor(i,n,d,S){super(),this._terminal=i,this._coreBrowserService=d,this._renderService=S,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let f=0;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);if(this._topBoundaryFocusListener=f=>this._handleBoundaryFocus(f,0),this._bottomBoundaryFocusListener=f=>this._handleBoundaryFocus(f,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new c.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(f=>this._handleResize(f.rows))),this.register(this._terminal.onRender(f=>this._refreshRows(f.start,f.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(f=>this._handleChar(f))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
10
+ `))),this.register(this._terminal.onA11yTab(f=>this._handleTab(f))),this.register(this._terminal.onKey(f=>this._handleKey(f.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,_.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let n=0;n<i;n++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
11
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,n){this._liveRegionDebouncer.refresh(i,n,this._terminal.rows)}_renderRows(i,n){const d=this._terminal.buffer,S=d.lines.length.toString();for(let f=i;f<=n;f++){const C=d.lines.get(d.ydisp+f),u=[],m=(C==null?void 0:C.translateToString(!0,void 0,void 0,u))||"",w=(d.ydisp+f+1).toString(),k=this._rowElements[f];k&&(m.length===0?(k.innerText=" ",this._rowColumns.set(k,[0,1])):(k.textContent=m,this._rowColumns.set(k,u)),k.setAttribute("aria-posinset",w),k.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,n){const d=i.target,S=this._rowElements[n===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(n===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==S)return;let f,C;if(n===0?(f=d,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(f=this._rowElements.shift(),C=d,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{const u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var m;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:i.anchorNode,offset:i.anchorOffset},d={node:i.focusNode,offset:i.focusOffset};if((n.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===d.node&&n.offset>d.offset)&&([n,d]=[d,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const S=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:S,offset:((m=S.textContent)==null?void 0:m.length)??0}),!this._rowContainer.contains(d.node))return;const f=({node:w,offset:k})=>{const E=w instanceof Text?w.parentNode:w;let x=parseInt(E==null?void 0:E.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;const T=this._rowColumns.get(E);if(!T)return console.warn("columns is null. Race condition?"),null;let F=k<T.length?T[k]:T.slice(-1)[0]+1;return F>=this._terminal.cols&&(++x,F=0),{row:x,column:F}},C=f(n),u=f(d);if(C&&u){if(C.row>u.row||C.row===u.row&&C.column>=u.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(u.row-C.row)*this._terminal.cols-C.column+u.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=r=h([l(1,o.IInstantiationService),l(2,g.ICoreBrowserService),l(3,g.IRenderService)],r)},3614:(M,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,_){return _?"\x1B[200~"+c+"\x1B[201~":c}function l(c,_,g,o){c=h(c=a(c),g.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(c,!0),_.value=""}function s(c,_,g){const o=g.getBoundingClientRect(),e=c.clientX-o.left-10,r=c.clientY-o.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${e}px`,_.style.top=`${r}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,_){c.clipboardData&&c.clipboardData.setData("text/plain",_.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,_,g,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),_,g,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(c,_,g,o,e){s(c,_,g),e&&o.rightClickSelect(c),_.value=o.selectionText,_.select()}},7239:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,s,c){this._css.set(l,s,c)}getCss(l,s){return this._css.get(l,s)}setColor(l,s,c){this._color.set(l,s,c)}getColor(l,s){return this._color.get(l,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},3551:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,d){var S,f=arguments.length,C=f<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,i,n,d);else for(var u=r.length-1;u>=0;u--)(S=r[u])&&(C=(f<3?S(C):f>3?S(i,n,C):S(i,n))||C);return f>3&&C&&Object.defineProperty(i,n,C),C},l=this&&this.__param||function(r,i){return function(n,d){i(n,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=a(3656),c=a(8460),_=a(844),g=a(2585),o=a(4725);let e=t.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(r,i,n,d,S){super(),this._element=r,this._mouseService=i,this._renderService=n,this._bufferService=d,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)(()=>{var f;this._lastMouseEvent=void 0,(f=this._activeProviderReplies)==null||f.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const n=r.composedPath();for(let d=0;d<n.length;d++){const S=n[d];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){var d,S;this._activeProviderReplies&&i||((d=this._activeProviderReplies)==null||d.forEach(f=>{f==null||f.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=r.y);let n=!1;for(const[f,C]of this._linkProviderService.linkProviders.entries())i?(S=this._activeProviderReplies)!=null&&S.get(f)&&(n=this._checkLinkProviderResult(f,r,n)):C.provideLinks(r.y,u=>{var w,k;if(this._isMouseOut)return;const m=u==null?void 0:u.map(E=>({link:E}));(w=this._activeProviderReplies)==null||w.set(f,m),n=this._checkLinkProviderResult(f,r,n),((k=this._activeProviderReplies)==null?void 0:k.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)})}_removeIntersectingLinks(r,i){const n=new Set;for(let d=0;d<i.size;d++){const S=i.get(d);if(S)for(let f=0;f<S.length;f++){const C=S[f],u=C.link.range.start.y<r?0:C.link.range.start.x,m=C.link.range.end.y>r?this._bufferService.cols:C.link.range.end.x;for(let w=u;w<=m;w++){if(n.has(w)){S.splice(f--,1);break}n.add(w)}}}}_checkLinkProviderResult(r,i,n){var f;if(!this._activeProviderReplies)return n;const d=this._activeProviderReplies.get(r);let S=!1;for(let C=0;C<r;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(S=!0);if(!S&&d){const C=d.find(u=>this._linkAtPosition(u.link,i));C&&(n=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let C=0;C<this._activeProviderReplies.size;C++){const u=(f=this._activeProviderReplies.get(C))==null?void 0:f.find(m=>this._linkAtPosition(m.link,i));if(u){n=!0,this._handleNewLink(u);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>{var n,d;return(d=(n=this._currentLink)==null?void 0:n.state)==null?void 0:d.decorations.pointerCursor},set:n=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,d;return(d=(n=this._currentLink)==null?void 0:n.state)==null?void 0:d.decorations.underline},set:n=>{var d,S,f;(d=this._currentLink)!=null&&d.state&&((f=(S=this._currentLink)==null?void 0:S.state)==null?void 0:f.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;const d=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(d,S),this._lastMouseEvent)){const f=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);f&&this._askForLink(f,!1)}})))}_linkHover(r,i,n){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(r,i){const n=r.range,d=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-d-1,n.end.x,n.end.y-d-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(r,i,n){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(r,i){const n=r.range.start.y*this._bufferService.cols+r.range.start.x,d=r.range.end.y*this._bufferService.cols+r.range.end.x,S=i.y*this._bufferService.cols+i.x;return n<=S&&S<=d}_positionFromMouseEvent(r,i,n){const d=n.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,n,d,S){return{x1:r,y1:i,x2:n,y2:d,cols:this._bufferService.cols,fg:S}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,g.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,d=arguments.length,S=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(o,e,r,i);else for(var f=o.length-1;f>=0;f--)(n=o[f])&&(S=(d<3?n(S):d>3?n(e,r,S):n(e,r))||S);return d>3&&S&&Object.defineProperty(e,r,S),S},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const s=a(511),c=a(2585);let _=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){var m;const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],n=this._optionsService.rawOptions.linkHandler,d=new s.CellData,S=r.getTrimmedLength();let f=-1,C=-1,u=!1;for(let w=0;w<S;w++)if(C!==-1||r.hasContent(w)){if(r.loadCell(w,d),d.hasExtendedAttrs()&&d.extended.urlId){if(C===-1){C=w,f=d.extended.urlId;continue}u=d.extended.urlId!==f}else C!==-1&&(u=!0);if(u||C!==-1&&w===S-1){const k=(m=this._oscLinkService.getLinkData(f))==null?void 0:m.uri;if(k){const E={start:{x:C+1,y:o},end:{x:w+(u||w!==S-1?0:1),y:o}};let x=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{const T=new URL(k);["http:","https:"].includes(T.protocol)||(x=!0)}catch{x=!0}x||i.push({text:k,range:E,activate:(T,F)=>n?n.activate(T,F,E):g(0,F),hover:(T,F)=>{var $;return($=n==null?void 0:n.hover)==null?void 0:$.call(n,T,F,E)},leave:(T,F)=>{var $;return($=n==null?void 0:n.leave)==null?void 0:$.call(n,T,F,E)}})}u=!1,d.hasExtendedAttrs()&&d.extended.urlId?(C=w,f=d.extended.urlId):(C=-1,f=-1)}}e(i)}};function g(o,e){if(confirm(`Do you want to navigate to ${e}?
12
+
13
+ WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=_=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],_)},6193:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),s=a(3551),c=a(9042),_=a(3730),g=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),n=a(428),d=a(4269),S=a(5114),f=a(8934),C=a(3230),u=a(9312),m=a(4725),w=a(6731),k=a(8055),E=a(8969),x=a(8460),T=a(844),F=a(6114),$=a(8437),N=a(2584),H=a(7399),y=a(5941),D=a(9074),B=a(2585),P=a(5435),U=a(4567),q=a(779);class Y extends E.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(O={}){super(O),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new T.MutableDisposable),this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new x.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new x.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new x.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new x.EventEmitter),this._onBlur=this.register(new x.EventEmitter),this._onA11yCharEmitter=this.register(new x.EventEmitter),this._onA11yTabEmitter=this.register(new x.EventEmitter),this._onWillOpen=this.register(new x.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,j)=>this.refresh(R,j))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(R=>this._reportWindowsOptions(R))),this.register(this._inputHandler.onColor(R=>this._handleColorEvent(R))),this.register((0,x.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,x.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,x.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(R=>this._afterResize(R.cols,R.rows))),this.register((0,T.toDisposable)(()=>{var R,j;this._customKeyEventHandler=void 0,(j=(R=this.element)==null?void 0:R.parentNode)==null||j.removeChild(this.element)}))}_handleColorEvent(O){if(this._themeService)for(const R of O){let j,W="";switch(R.index){case 256:j="foreground",W="10";break;case 257:j="background",W="11";break;case 258:j="cursor",W="12";break;default:j="ansi",W="4;"+R.index}switch(R.type){case 0:const V=k.color.toColorRGB(j==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[j]);this.coreService.triggerDataEvent(`${N.C0.ESC}]${W};${(0,y.toRgbString)(V)}${N.C1_ESCAPED.ST}`);break;case 1:if(j==="ansi")this._themeService.modifyColors(K=>K.ansi[R.index]=k.channels.toColor(...R.color));else{const K=j;this._themeService.modifyColors(ee=>ee[K]=k.channels.toColor(...R.color))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(O){O?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(O){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var O;return(O=this.textarea)==null?void 0:O.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(N.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 O=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(O);if(!R)return;const j=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,V=R.getWidth(j),K=this._renderService.dimensions.css.cell.width*V,ee=this.buffer.y*this._renderService.dimensions.css.cell.height,J=j*this._renderService.dimensions.css.cell.width;this.textarea.style.left=J+"px",this.textarea.style.top=ee+"px",this.textarea.style.width=K+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,h.copyHandler)(R,this._selectionService)}));const O=R=>(0,h.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",O)),this.register((0,l.addDisposableDomListener)(this.element,"paste",O)),F.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,h.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",O=>this._keyUp(O),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",O=>this._keyDown(O),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",O=>this._keyPress(O),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",O=>this._compositionHelper.compositionupdate(O))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",O=>this._inputEvent(O),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(O){var j;if(!O)throw new Error("Terminal requires a parent element.");if(O.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((j=this.element)==null?void 0:j.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=O.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),O.appendChild(this.element);const R=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),R.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),F.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(S.CoreBrowserService,this.textarea,O.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(w.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(f.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(R);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(u.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const O=this,R=this.element;function j(K){const ee=O._mouseService.getMouseReportCoords(K,O.screenElement);if(!ee)return!1;let J,he;switch(K.overrideType||K.type){case"mousemove":he=32,K.buttons===void 0?(J=3,K.button!==void 0&&(J=K.button<3?K.button:3)):J=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":he=0,J=K.button<3?K.button:3;break;case"mousedown":he=1,J=K.button<3?K.button:3;break;case"wheel":if(O._customWheelEventHandler&&O._customWheelEventHandler(K)===!1||O.viewport.getLinesScrolled(K)===0)return!1;he=K.deltaY<0?0:1,J=4;break;default:return!1}return!(he===void 0||J===void 0||J>4)&&O.coreMouseService.triggerMouseEvent({col:ee.col,row:ee.row,x:ee.x,y:ee.y,button:J,action:he,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},V={mouseup:K=>(j(K),K.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(K)),wheel:K=>(j(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&j(K)},mousemove:K=>{K.buttons||j(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),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&K?W.mousemove||(R.addEventListener("mousemove",V.mousemove),W.mousemove=V.mousemove):(R.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&K?W.wheel||(R.addEventListener("wheel",V.wheel,{passive:!1}),W.wheel=V.wheel):(R.removeEventListener("wheel",W.wheel),W.wheel=null),2&K?W.mouseup||(W.mouseup=V.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&K?W.mousedrag||(W.mousedrag=V.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(R,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return j(K),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(K)})),this.register((0,l.addDisposableDomListener)(R,"wheel",K=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const ee=this.viewport.getLinesScrolled(K);if(ee===0)return;const J=N.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let he="";for(let fe=0;fe<Math.abs(ee);fe++)he+=J;return this.coreService.triggerDataEvent(he,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(R,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,l.addDisposableDomListener)(R,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(O,R){var j;(j=this._renderService)==null||j.refreshRows(O,R)}updateCursorStyle(O){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(O)?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(O,R,j=0){var W;j===1?(super.scrollLines(O,R,j),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(O)}paste(O){(0,h.paste)(O,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(O){this._customKeyEventHandler=O}attachCustomWheelEventHandler(O){this._customWheelEventHandler=O}registerLinkProvider(O){return this._linkProviderService.registerLinkProvider(O)}registerCharacterJoiner(O){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(O);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(O){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(O)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(O){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+O)}registerDecoration(O){return this._decorationService.registerDecoration(O)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(O,R,j){this._selectionService.setSelection(O,R,j)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var O;(O=this._selectionService)==null||O.clearSelection()}selectAll(){var O;(O=this._selectionService)==null||O.selectAll()}selectLines(O,R){var j;(j=this._selectionService)==null||j.selectLines(O,R)}_keyDown(O){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&O.altKey;if(!R&&!this._compositionHelper.keydown(O))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||O.key!=="Dead"&&O.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const j=(0,H.evaluateKeyboardEvent)(O,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(O),j.type===3||j.type===2){const W=this.rows-1;return this.scrollLines(j.type===2?-W:W),this.cancel(O,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,O)||(j.cancel&&this.cancel(O,!0),!j.key||!!(O.key&&!O.ctrlKey&&!O.altKey&&!O.metaKey&&O.key.length===1&&O.key.charCodeAt(0)>=65&&O.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(j.key!==N.C0.ETX&&j.key!==N.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:O}),this._showCursor(),this.coreService.triggerDataEvent(j.key,!0),!this.optionsService.rawOptions.screenReaderMode||O.altKey||O.ctrlKey?this.cancel(O,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(O,R){const j=O.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||O.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||O.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?j:j&&(!R.keyCode||R.keyCode>47)}_keyUp(O){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(O)||this.focus(),this.updateCursorStyle(O),this._keyPressHandled=!1)}_keyPress(O){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(O)===!1)return!1;if(this.cancel(O),O.charCode)R=O.charCode;else if(O.which===null||O.which===void 0)R=O.keyCode;else{if(O.which===0||O.charCode===0)return!1;R=O.which}return!(!R||(O.altKey||O.ctrlKey||O.metaKey)&&!this._isThirdLevelShift(this.browser,O)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:O}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(O){if(O.data&&O.inputType==="insertText"&&(!O.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=O.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(O),!0}return!1}resize(O,R){O!==this.cols||R!==this.rows?super.resize(O,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(O,R){var j,W;(j=this._charSizeService)==null||j.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var O;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine($.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(O=this.viewport)==null||O.reset(),this.refresh(0,this.rows-1)}}reset(){var R,j;this.options.rows=this.rows,this.options.cols=this.cols;const O=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(j=this.viewport)==null||j.reset(),this._customKeyEventHandler=O,this.refresh(0,this.rows-1)}clearTextureAtlas(){var O;(O=this._renderService)==null||O.clearTextureAtlas()}_reportFocus(){var O;(O=this.element)!=null&&O.classList.contains("focus")?this.coreService.triggerDataEvent(N.C0.ESC+"[I"):this.coreService.triggerDataEvent(N.C0.ESC+"[O")}_reportWindowsOptions(O){if(this._renderService)switch(O){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),j=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${N.C0.ESC}[4;${j};${R}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),V=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${N.C0.ESC}[6;${V};${W}t`)}}cancel(O,R){if(this.options.cancelEvents||R)return O.preventDefault(),O.stopPropagation(),!1}}t.Terminal=Y},9924:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=s-this._lastRefreshMs,_=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,d){var S,f=arguments.length,C=f<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,i,n,d);else for(var u=r.length-1;u>=0;u--)(S=r[u])&&(C=(f<3?S(C):f>3?S(i,n,C):S(i,n))||C);return f>3&&C&&Object.defineProperty(i,n,C),C},l=this&&this.__param||function(r,i){return function(n,d){i(n,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),c=a(4725),_=a(8460),g=a(844),o=a(2585);let e=t.Viewport=class extends g.Disposable{constructor(r,i,n,d,S,f,C,u){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=n,this._optionsService=d,this._charSizeService=S,this._renderService=f,this._coreBrowserService=C,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 _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(m=>this._renderDimensions=m)),this._handleThemeChange(u.colors),this.register(u.onChangeColors(m=>this._handleThemeChange(m))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.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(r){if(r)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){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 i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<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(r,i){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&n<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);return i!==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+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){var u;let n,d="";const S=[],f=i??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let m=r;m<f;m++){const w=C.get(m);if(!w)continue;const k=(u=C.get(m+1))==null?void 0:u.isWrapped;if(d+=w.translateToString(!k),!k||m===C.length-1){const E=document.createElement("div");E.textContent=d,S.push(E),d.length>0&&(n=E),d=""}}return{bufferElements:S,cursorElement:n}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&i.altKey||n==="ctrl"&&i.ctrlKey||n==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,d=arguments.length,S=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(o,e,r,i);else for(var f=o.length-1;f>=0;f--)(n=o[f])&&(S=(d<3?n(S):d>3?n(e,r,S):n(e,r))||S);return d>3&&S&&Object.defineProperty(e,r,S),S},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=a(4725),c=a(844),_=a(2585);let g=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,n){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(d=>this._removeDecoration(d))),this.register((0,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 o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose(()=>{this._decorationElements.delete(o),r.remove()})),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){var e;(e=this._decorationElements.get(o))==null||e.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=g=h([l(1,_.IBufferService),l(2,s.ICoreBrowserService),l(3,_.IDecorationService),l(4,s.IRenderService)],g)},5871:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(M,t,a){var h=this&&this.__decorate||function(n,d,S,f){var C,u=arguments.length,m=u<3?d:f===null?f=Object.getOwnPropertyDescriptor(d,S):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,d,S,f);else for(var w=n.length-1;w>=0;w--)(C=n[w])&&(m=(u<3?C(m):u>3?C(d,S,m):C(d,S))||m);return u>3&&m&&Object.defineProperty(d,S,m),m},l=this&&this.__param||function(n,d){return function(S,f){d(S,f,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const s=a(5871),c=a(4725),_=a(844),g=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(n,d,S,f,C,u,m){var k;super(),this._viewportElement=n,this._screenElement=d,this._bufferService=S,this._decorationService=f,this._renderService=C,this._optionsService=u,this._coreBrowserService=m,this._colorZoneStore=new s.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(k=this._viewportElement.parentElement)==null||k.insertBefore(this._canvas,this._viewportElement);const w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)(()=>{var E;(E=this._canvas)==null||E.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const n=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=n,e.center=d,e.right=n,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const n=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(n,12),6)*this._coreBrowserService.dpr);o.left=d,o.center=d,o.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const n=this._colorZoneStore.zones;for(const d of n)d.position!=="full"&&this._renderColorZone(d);for(const d of n)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(r[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-o[n.position||"full"]/2),e[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[n.position||"full"]))}_queueRefresh(n,d){this._shouldUpdateDimensions=n||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([l(2,g.IBufferService),l(3,g.IDecorationService),l(4,c.IRenderService),l(5,g.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,d=arguments.length,S=d<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(o,e,r,i);else for(var f=o.length-1;f>=0;f--)(n=o[f])&&(S=(d<3?n(S):d>3?n(e,r,S):n(e,r))||S);return d>3&&S&&Object.defineProperty(e,r,S),S},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=a(4725),c=a(2585),_=a(2584);let g=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,n,d){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=d,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=g=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,s.IRenderService)],g)},9806:(M,t)=>{function a(h,l,s){const c=s.getBoundingClientRect(),_=h.getComputedStyle(s),g=parseInt(_.getPropertyValue("padding-left")),o=parseInt(_.getPropertyValue("padding-top"));return[l.clientX-c.left-g,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,s,c,_,g,o,e,r){if(!g)return;const i=a(h,l,s);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),_),i):void 0}},9504:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,n){const d=e-s(e,i),S=r-s(r,i),f=Math.abs(d-S)-function(C,u,m){let w=0;const k=C-s(C,m),E=u-s(u,m);for(let x=0;x<Math.abs(k-E);x++){const T=c(C,u)==="A"?-1:1,F=m.buffer.lines.get(k+T*x);F!=null&&F.isWrapped&&w++}return w}(e,r,i);return o(f,g(c(e,r),n))}function s(e,r){let i=0,n=r.buffer.lines.get(e),d=n==null?void 0:n.isWrapped;for(;d&&e>=0&&e<r.rows;)i++,n=r.buffer.lines.get(--e),d=n==null?void 0:n.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function _(e,r,i,n,d,S){let f=e,C=r,u="";for(;f!==i||C!==n;)f+=d?1:-1,d&&f>S.cols-1?(u+=S.buffer.translateBufferLineToString(C,!1,e,f),f=0,e=0,C++):!d&&f<0&&(u+=S.buffer.translateBufferLineToString(C,!1,0,e+1),f=S.cols-1,e=f,C--);return u+S.buffer.translateBufferLineToString(C,!1,e,f)}function g(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=r;return i}t.moveToCellSequence=function(e,r,i,n){const d=i.buffer.x,S=i.buffer.y;if(!i.buffer.hasScrollback)return function(u,m,w,k,E,x){return l(m,k,E,x).length===0?"":o(_(u,m,u,m-s(m,E),!1,E).length,g("D",x))}(d,S,0,r,i,n)+l(S,r,i,n)+function(u,m,w,k,E,x){let T;T=l(m,k,E,x).length>0?k-s(k,E):m;const F=k,$=function(N,H,y,D,B,P){let U;return U=l(y,D,B,P).length>0?D-s(D,B):H,N<y&&U<=D||N>=y&&U<D?"C":"D"}(u,m,w,k,E,x);return o(_(u,T,w,F,$==="C",E).length,g($,x))}(d,S,e,r,i,n);let f;if(S===r)return f=d>e?"D":"C",o(Math.abs(d-e),g(f,n));f=S>r?"D":"C";const C=Math.abs(S-r);return o(function(u,m){return m.cols-u}(S>r?e:d,i)+(C-1)*i.cols+1+((S>r?d:e)-1),g(f,n))}},1296:function(M,t,a){var h=this&&this.__decorate||function(x,T,F,$){var N,H=arguments.length,y=H<3?T:$===null?$=Object.getOwnPropertyDescriptor(T,F):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(x,T,F,$);else for(var D=x.length-1;D>=0;D--)(N=x[D])&&(y=(H<3?N(y):H>3?N(T,F,y):N(T,F))||y);return H>3&&y&&Object.defineProperty(T,F,y),y},l=this&&this.__param||function(x,T){return function(F,$){T(F,$,x)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),c=a(2550),_=a(2223),g=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),n=a(844),d=a(2585),S="xterm-dom-renderer-owner-",f="xterm-rows",C="xterm-fg-",u="xterm-bg-",m="xterm-focus",w="xterm-selection";let k=1,E=t.DomRenderer=class extends n.Disposable{constructor(x,T,F,$,N,H,y,D,B,P,U,q,Y){super(),this._terminal=x,this._document=T,this._element=F,this._screenElement=$,this._viewportElement=N,this._helperContainer=H,this._linkifier2=y,this._charSizeService=B,this._optionsService=P,this._bufferService=U,this._coreBrowserService=q,this._themeService=Y,this._terminalClass=k++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(f),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(w),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(G=>this._injectCss(G))),this._injectCss(this._themeService.colors),this._rowFactory=D.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(G=>this._handleLinkHover(G))),this.register(this._linkifier2.onHideLinkUnderline(G=>this._handleLinkLeave(G))),this.register((0,n.toDisposable)(()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new c.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const x=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*x,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*x),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/x),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/x),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 F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const T=`${this._terminalSelector} .${f} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=T,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(x){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let T=`${this._terminalSelector} .${f} { color: ${x.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;T+=`${this._terminalSelector} .${f} .xterm-dim { color: ${r.color.multiplyOpacity(x.foreground,.5).css};}`,T+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const F=`blink_underline_${this._terminalClass}`,$=`blink_bar_${this._terminalClass}`,N=`blink_block_${this._terminalClass}`;T+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,T+=`@keyframes ${$} { 50% { box-shadow: none; }}`,T+=`@keyframes ${N} { 0% { background-color: ${x.cursor.css}; color: ${x.cursorAccent.css}; } 50% { background-color: inherit; color: ${x.cursor.css}; }}`,T+=`${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${f}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block { background-color: ${x.cursor.css}; color: ${x.cursorAccent.css};}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${x.cursor.css} !important; color: ${x.cursorAccent.css} !important;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${x.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${x.cursor.css} inset;}${this._terminalSelector} .${f} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${x.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,T+=`${this._terminalSelector} .${w} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${w} div { position: absolute; background-color: ${x.selectionBackgroundOpaque.css};}${this._terminalSelector} .${w} div { position: absolute; background-color: ${x.selectionInactiveBackgroundOpaque.css};}`;for(const[H,y]of x.ansi.entries())T+=`${this._terminalSelector} .${C}${H} { color: ${y.css}; }${this._terminalSelector} .${C}${H}.xterm-dim { color: ${r.color.multiplyOpacity(y,.5).css}; }${this._terminalSelector} .${u}${H} { background-color: ${y.css}; }`;T+=`${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(x.background).css}; }${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(x.background),.5).css}; }${this._terminalSelector} .${u}${_.INVERTED_DEFAULT_COLOR} { background-color: ${x.foreground.css}; }`,this._themeStyleElement.textContent=T}_setDefaultSpacing(){const x=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${x}px`,this._rowFactory.defaultSpacing=x}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(x,T){for(let F=this._rowElements.length;F<=T;F++){const $=this._document.createElement("div");this._rowContainer.appendChild($),this._rowElements.push($)}for(;this._rowElements.length>T;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(x,T){this._refreshRowElements(x,T),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(x,T,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(x,T,F),this.renderRows(0,this._bufferService.rows-1),!x||!T)return;this._selectionRenderModel.update(this._terminal,x,T,F);const $=this._selectionRenderModel.viewportStartRow,N=this._selectionRenderModel.viewportEndRow,H=this._selectionRenderModel.viewportCappedStartRow,y=this._selectionRenderModel.viewportCappedEndRow;if(H>=this._bufferService.rows||y<0)return;const D=this._document.createDocumentFragment();if(F){const B=x[0]>T[0];D.appendChild(this._createSelectionElement(H,B?T[0]:x[0],B?x[0]:T[0],y-H+1))}else{const B=$===H?x[0]:0,P=H===N?T[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(H,B,P));const U=y-H-1;if(D.appendChild(this._createSelectionElement(H+1,0,this._bufferService.cols,U)),H!==y){const q=N===y?T[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(y,0,q))}}this._selectionContainer.appendChild(D)}_createSelectionElement(x,T,F,$=1){const N=this._document.createElement("div"),H=T*this.dimensions.css.cell.width;let y=this.dimensions.css.cell.width*(F-T);return H+y>this.dimensions.css.canvas.width&&(y=this.dimensions.css.canvas.width-H),N.style.height=$*this.dimensions.css.cell.height+"px",N.style.top=x*this.dimensions.css.cell.height+"px",N.style.left=`${H}px`,N.style.width=`${y}px`,N}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 x of this._rowElements)x.replaceChildren()}renderRows(x,T){const F=this._bufferService.buffer,$=F.ybase+F.y,N=Math.min(F.x,this._bufferService.cols-1),H=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=x;B<=T;B++){const P=B+F.ydisp,U=this._rowElements[B],q=F.lines.get(P);if(!U||!q)break;U.replaceChildren(...this._rowFactory.createRow(q,P,P===$,y,D,N,H,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${this._terminalClass}`}_handleLinkHover(x){this._setCellUnderline(x.x1,x.x2,x.y1,x.y2,x.cols,!0)}_handleLinkLeave(x){this._setCellUnderline(x.x1,x.x2,x.y1,x.y2,x.cols,!1)}_setCellUnderline(x,T,F,$,N,H){F<0&&(x=0),$<0&&(T=0);const y=this._bufferService.rows-1;F=Math.max(Math.min(F,y),0),$=Math.max(Math.min($,y),0),N=Math.min(N,this._bufferService.cols);const D=this._bufferService.buffer,B=D.ybase+D.y,P=Math.min(D.x,N-1),U=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,Y=this._optionsService.rawOptions.cursorInactiveStyle;for(let G=F;G<=$;++G){const O=G+D.ydisp,R=this._rowElements[G],j=D.lines.get(O);if(!R||!j)break;R.replaceChildren(...this._rowFactory.createRow(j,O,O===B,q,Y,P,U,this.dimensions.css.cell.width,this._widthCache,H?G===F?x:0:-1,H?(G===$?T:N)-1:-1))}}};t.DomRenderer=E=h([l(7,d.IInstantiationService),l(8,e.ICharSizeService),l(9,d.IOptionsService),l(10,d.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],E)},3787:function(M,t,a){var h=this&&this.__decorate||function(f,C,u,m){var w,k=arguments.length,E=k<3?C:m===null?m=Object.getOwnPropertyDescriptor(C,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,C,u,m);else for(var x=f.length-1;x>=0;x--)(w=f[x])&&(E=(k<3?w(E):k>3?w(C,u,E):w(C,u))||E);return k>3&&E&&Object.defineProperty(C,u,E),E},l=this&&this.__param||function(f,C){return function(u,m){C(u,m,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),c=a(643),_=a(511),g=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),n=a(3734);let d=t.DomRendererRowFactory=class{constructor(f,C,u,m,w,k,E){this._document=f,this._characterJoinerService=C,this._optionsService=u,this._coreBrowserService=m,this._coreService=w,this._decorationService=k,this._themeService=E,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(f,C,u){this._selectionStart=f,this._selectionEnd=C,this._columnSelectMode=u}createRow(f,C,u,m,w,k,E,x,T,F,$){const N=[],H=this._characterJoinerService.getJoinedCharacters(C),y=this._themeService.colors;let D,B=f.getNoBgTrimmedLength();u&&B<k+1&&(B=k+1);let P=0,U="",q=0,Y=0,G=0,O=!1,R=0,j=!1,W=0;const V=[],K=F!==-1&&$!==-1;for(let ee=0;ee<B;ee++){f.loadCell(ee,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let he=!1,fe=ee,Z=this._workCell;if(H.length>0&&ee===H[0][0]){he=!0;const ie=H.shift();Z=new r.JoinedCellData(this._workCell,f.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),fe=ie[1]-1,J=Z.getWidth()}const Re=this._isCellInSelection(ee,C),Ke=u&&ee===k,ae=K&&ee>=F&&ee<=$;let se=!1;this._decorationService.forEachDecorationAtCell(ee,C,void 0,ie=>{se=!0});let re=Z.getChars()||c.WHITESPACE_CELL_CHAR;if(re===" "&&(Z.isUnderline()||Z.isOverline())&&(re=" "),W=J*x-T.get(re,Z.isBold(),Z.isItalic()),D){if(P&&(Re&&j||!Re&&!j&&Z.bg===q)&&(Re&&j&&y.selectionForeground||Z.fg===Y)&&Z.extended.ext===G&&ae===O&&W===R&&!Ke&&!he&&!se){Z.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=re,P++;continue}P&&(D.textContent=U),D=this._document.createElement("span"),P=0,U=""}else D=this._document.createElement("span");if(q=Z.bg,Y=Z.fg,G=Z.extended.ext,O=ae,R=W,j=Re,he&&k>=ee&&k<=fe&&(k=ee),!this._coreService.isCursorHidden&&Ke&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)E&&V.push("xterm-cursor-blink"),V.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(w)switch(w){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline")}}if(Z.isBold()&&V.push("xterm-bold"),Z.isItalic()&&V.push("xterm-italic"),Z.isDim()&&V.push("xterm-dim"),U=Z.isInvisible()?c.WHITESPACE_CELL_CHAR:Z.getChars()||c.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(V.push(`xterm-underline-${Z.extended.underlineStyle}`),U===" "&&(U=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${n.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let ie=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&ie<8&&(ie+=8),D.style.textDecorationColor=y.ansi[ie].css}Z.isOverline()&&(V.push("xterm-overline"),U===" "&&(U=" ")),Z.isStrikethrough()&&V.push("xterm-strikethrough"),ae&&(D.style.textDecoration="underline");let X=Z.getFgColor(),oe=Z.getFgColorMode(),_e=Z.getBgColor(),ue=Z.getBgColorMode();const Me=!!Z.isInverse();if(Me){const ie=X;X=_e,_e=ie;const Je=oe;oe=ue,ue=Je}let Se,Ee,pe,de=!1;switch(this._decorationService.forEachDecorationAtCell(ee,C,void 0,ie=>{ie.options.layer!=="top"&&de||(ie.backgroundColorRGB&&(ue=50331648,_e=ie.backgroundColorRGB.rgba>>8&16777215,Se=ie.backgroundColorRGB),ie.foregroundColorRGB&&(oe=50331648,X=ie.foregroundColorRGB.rgba>>8&16777215,Ee=ie.foregroundColorRGB),de=ie.options.layer==="top")}),!de&&Re&&(Se=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,_e=Se.rgba>>8&16777215,ue=50331648,de=!0,y.selectionForeground&&(oe=50331648,X=y.selectionForeground.rgba>>8&16777215,Ee=y.selectionForeground)),de&&V.push("xterm-decoration-top"),ue){case 16777216:case 33554432:pe=y.ansi[_e],V.push(`xterm-bg-${_e}`);break;case 50331648:pe=o.channels.toColor(_e>>16,_e>>8&255,255&_e),this._addStyle(D,`background-color:#${S((_e>>>0).toString(16),"0",6)}`);break;default:Me?(pe=y.foreground,V.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):pe=y.background}switch(Se||Z.isDim()&&(Se=o.color.multiplyOpacity(pe,.5)),oe){case 16777216:case 33554432:Z.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(D,pe,y.ansi[X],Z,Se,void 0)||V.push(`xterm-fg-${X}`);break;case 50331648:const ie=o.channels.toColor(X>>16&255,X>>8&255,255&X);this._applyMinimumContrast(D,pe,ie,Z,Se,Ee)||this._addStyle(D,`color:#${S(X.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,pe,y.foreground,Z,Se,Ee)||Me&&V.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}V.length&&(D.className=V.join(" "),V.length=0),Ke||he||se?D.textContent=U:P++,W!==this.defaultSpacing&&(D.style.letterSpacing=`${W}px`),N.push(D),ee=fe}return D&&P&&(D.textContent=U),N}_applyMinimumContrast(f,C,u,m,w,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(m.getCode()))return!1;const E=this._getContrastCache(m);let x;if(w||k||(x=E.getColor(C.rgba,u.rgba)),x===void 0){const T=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);x=o.color.ensureContrastRatio(w||C,k||u,T),E.setColor((w||C).rgba,(k||u).rgba,x??null)}return!!x&&(this._addStyle(f,`color:${x.css}`),!0)}_getContrastCache(f){return f.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(f,C){f.setAttribute("style",`${f.getAttribute("style")||""}${C};`)}_isCellInSelection(f,C){const u=this._selectionStart,m=this._selectionEnd;return!(!u||!m)&&(this._columnSelectMode?u[0]<=m[0]?f>=u[0]&&C>=u[1]&&f<m[0]&&C<=m[1]:f<u[0]&&C>=u[1]&&f>=m[0]&&C<=m[1]:C>u[1]&&C<m[1]||u[1]===m[1]&&C===u[1]&&f>=u[0]&&f<m[0]||u[1]<m[1]&&C===m[1]&&f<m[0]||u[1]<m[1]&&C===u[1]&&f>=u[0])}};function S(f,C,u){for(;f.length<u;)f=C+f;return f}t.DomRendererRowFactory=d=h([l(1,e.ICharacterJoinerService),l(2,g.IOptionsService),l(3,e.ICoreBrowserService),l(4,g.ICoreService),l(5,g.IDecorationService),l(6,e.IThemeService)],d)},2550:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const _=a.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[l,s,c,_],this._container.appendChild(l),this._container.appendChild(s),this._container.appendChild(c),this._container.appendChild(_),h.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(a,h,l,s){a===this._font&&h===this._fontSize&&l===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,h,l){let s=0;if(!h&&!l&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const g=this._measure(a,0);return g>0&&(this._flat[s]=g),g}let c=a;h&&(c+="B"),l&&(c+="I");let _=this._holey.get(c);if(_===void 0){let g=0;h&&(g|=1),l&&(g|=2),_=this._measure(a,g),_>0&&this._holey.set(c,_)}return _}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,_){return s===1&&c>Math.ceil(1.5*_)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(g){return 57344<=g&&g<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(s){return 9472<=s&&s<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},6052:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,s,c,_=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const g=l.buffers.active.ydisp,o=s[1]-g,e=c[1]-g,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(a){this._bufferService=a,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 a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(M,t,a){var h=this&&this.__decorate||function(i,n,d,S){var f,C=arguments.length,u=C<3?n:S===null?S=Object.getOwnPropertyDescriptor(n,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,n,d,S);else for(var m=i.length-1;m>=0;m--)(f=i[m])&&(u=(C<3?f(u):C>3?f(n,d,u):f(n,d))||u);return C>3&&u&&Object.defineProperty(n,d,u),u},l=this&&this.__param||function(i,n){return function(d,S){n(d,S,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const s=a(2585),c=a(8460),_=a(844);let g=t.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,n,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,n,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=g=h([l(2,s.IOptionsService)],g);class o extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,d){n!==void 0&&n>0&&d!==void 0&&d>0&&(this._result.width=n,this._result.height=d)}}class e extends o{constructor(n,d,S){super(),this._document=n,this._parentElement=d,this._optionsService=S,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,d){var S,f=arguments.length,C=f<3?i:d===null?d=Object.getOwnPropertyDescriptor(i,n):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,i,n,d);else for(var u=r.length-1;u>=0;u--)(S=r[u])&&(C=(f<3?S(C):f>3?S(i,n,C):S(i,n))||C);return f>3&&C&&Object.defineProperty(i,n,C),C},l=this&&this.__param||function(r,i){return function(n,d){i(n,d,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),c=a(643),_=a(511),g=a(2585);class o extends s.AttributeData{constructor(i,n,d){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=n,this._width=d}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class yi{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(i){const n={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(n),n.id}deregister(i){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===i)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(i);if(!n||n.length===0)return[];const d=[],S=n.translateToString(!0);let f=0,C=0,u=0,m=n.getFg(0),w=n.getBg(0);for(let k=0;k<n.getTrimmedLength();k++)if(n.loadCell(k,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==m||this._workCell.bg!==w){if(k-f>1){const E=this._getJoinedRanges(S,u,C,n,f);for(let x=0;x<E.length;x++)d.push(E[x])}f=k,u=C,m=this._workCell.fg,w=this._workCell.bg}C+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-f>1){const k=this._getJoinedRanges(S,u,C,n,f);for(let E=0;E<k.length;E++)d.push(k[E])}return d}_getJoinedRanges(i,n,d,S,f){const C=i.substring(n,d);let u=[];try{u=this._characterJoiners[0].handler(C)}catch(m){console.error(m)}for(let m=1;m<this._characterJoiners.length;m++)try{const w=this._characterJoiners[m].handler(C);for(let k=0;k<w.length;k++)yi._mergeRanges(u,w[k])}catch(w){console.error(w)}return this._stringRangesToCellRanges(u,S,f),u}_stringRangesToCellRanges(i,n,d){let S=0,f=!1,C=0,u=i[S];if(u){for(let m=d;m<this._bufferService.cols;m++){const w=n.getWidth(m),k=n.getString(m).length||c.WHITESPACE_CELL_CHAR.length;if(w!==0){if(!f&&u[0]<=C&&(u[0]=m,f=!0),u[1]<=C){if(u[1]=m,u=i[++S],!u)break;u[0]<=C?(u[0]=m,f=!0):f=!1}C+=k}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(i,n){let d=!1;for(let S=0;S<i.length;S++){const f=i[S];if(d){if(n[1]<=f[0])return i[S-1][1]=n[1],i;if(n[1]<=f[1])return i[S-1][1]=Math.max(n[1],f[1]),i.splice(S,1),i;i.splice(S,1),S--}else{if(n[1]<=f[0])return i.splice(S,0,n),i;if(n[1]<=f[1])return f[0]=Math.min(n[0],f[0]),i;n[0]<f[1]&&(f[0]=Math.min(n[0],f[0]),d=!0)}}return d?i[i.length-1][1]=n[1]:i.push(n),i}};t.CharacterJoinerService=e=h([l(0,g.IBufferService)],e)},5114:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),s=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=c;class _ extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const _=this.linkProviders.indexOf(c);_!==-1&&this.linkProviders.splice(_,1)}}}}t.LinkProviderService=l},8934:function(M,t,a){var h=this&&this.__decorate||function(g,o,e,r){var i,n=arguments.length,d=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(g,o,e,r);else for(var S=g.length-1;S>=0;S--)(i=g[S])&&(d=(n<3?i(d):n>3?i(o,e,d):i(o,e))||d);return n>3&&d&&Object.defineProperty(o,e,d),d},l=this&&this.__param||function(g,o){return function(e,r){o(e,r,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),c=a(9806);let _=t.MouseService=class{constructor(g,o){this._renderService=g,this._charSizeService=o}getCoords(g,o,e,r,i){return(0,c.getCoords)(window,g,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(g,o){const e=(0,c.getCoordsRelativeToElement)(window,g,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=_=h([l(0,s.IRenderService),l(1,s.ICharSizeService)],_)},3230:function(M,t,a){var h=this&&this.__decorate||function(i,n,d,S){var f,C=arguments.length,u=C<3?n:S===null?S=Object.getOwnPropertyDescriptor(n,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,n,d,S);else for(var m=i.length-1;m>=0;m--)(f=i[m])&&(u=(C<3?f(u):C>3?f(n,d,u):f(n,d))||u);return C>3&&u&&Object.defineProperty(n,d,u),u},l=this&&this.__param||function(i,n){return function(d,S){n(d,S,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const s=a(6193),c=a(4725),_=a(8460),g=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,n,d,S,f,C,u,m){super(),this._rowCount=i,this._charSizeService=S,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer((w,k)=>this._renderRows(w,k),u),this.register(this._renderDebouncer),this.register(u.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var w;return(w=this._renderer.value)==null?void 0:w.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(f.onDecorationRegistered(()=>this._fullRefresh())),this.register(f.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(C.buffer.y,C.buffer.y,!0))),this.register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(u.window,n),this.register(u.onWindowChange(w=>this._registerIntersectionObserver(w,n)))}_registerIntersectionObserver(i,n){if("IntersectionObserver"in i){const d=new i.IntersectionObserver(S=>this._handleIntersectionChange(S[S.length-1]),{threshold:0});d.observe(n),this._observerDisposable.value=(0,g.toDisposable)(()=>d.disconnect())}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.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(i,n,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,n,this._rowCount))}_renderRows(i,n){this._renderer.value&&(i=Math.min(i,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(i,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:n}),this._onRender.fire({start:i,end:n}),this._isNextRenderRedrawOnly=!0)}resize(i,n){this._rowCount=n,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(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(n=>this.refreshRows(n.start,n.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,n;this._renderer.value&&((n=(i=this._renderer.value).clearTextureAtlas)==null||n.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(i,n)}):this._renderer.value.handleResize(i,n),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,n,d){var S;this._selectionState.start=i,this._selectionState.end=n,this._selectionState.columnSelectMode=d,(S=this._renderer.value)==null||S.handleSelectionChanged(i,n,d)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=r=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],r)},9312:function(M,t,a){var h=this&&this.__decorate||function(u,m,w,k){var E,x=arguments.length,T=x<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(u,m,w,k);else for(var F=u.length-1;F>=0;F--)(E=u[F])&&(T=(x<3?E(T):x>3?E(m,w,T):E(m,w))||T);return x>3&&T&&Object.defineProperty(m,w,T),T},l=this&&this.__param||function(u,m){return function(w,k){m(w,k,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),c=a(9504),_=a(456),g=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),n=a(511),d=a(2585),S=" ",f=new RegExp(S,"g");let C=t.SelectionService=class extends e.Disposable{constructor(u,m,w,k,E,x,T,F,$){super(),this._element=u,this._screenElement=m,this._linkifier=w,this._bufferService=k,this._coreService=E,this._mouseService=x,this._optionsService=T,this._renderService=F,this._coreBrowserService=$,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=N=>this._handleMouseMove(N),this._mouseUpListener=N=>this._handleMouseUp(N),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(N=>this._handleTrim(N)),this.register(this._bufferService.buffers.onBufferActivate(N=>this._handleBufferActivate(N))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.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 u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!u||!m||u[0]===m[0]&&u[1]===m[1])}get selectionText(){const u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!u||!m)return"";const w=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(u[0]===m[0])return"";const E=u[0]<m[0]?u[0]:m[0],x=u[0]<m[0]?m[0]:u[0];for(let T=u[1];T<=m[1];T++){const F=w.translateBufferLineToString(T,!0,E,x);k.push(F)}}else{const E=u[1]===m[1]?m[0]:void 0;k.push(w.translateBufferLineToString(u[1],!0,u[0],E));for(let x=u[1]+1;x<=m[1]-1;x++){const T=w.lines.get(x),F=w.translateBufferLineToString(x,!0);T!=null&&T.isWrapped?k[k.length-1]+=F:k.push(F)}if(u[1]!==m[1]){const x=w.lines.get(m[1]),T=w.translateBufferLineToString(m[1],!0,0,m[0]);x&&x.isWrapped?k[k.length-1]+=T:k.push(T)}}return k.map(E=>E.replace(f," ")).join(r.isWindows?`\r
14
+ `:`
15
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(u){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),r.isLinux&&u&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(u){const m=this._getMouseBufferCoords(u),w=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(w&&k&&m)&&this._areCoordsInSelection(m,w,k)}isCellInSelection(u,m){const w=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!w||!k)&&this._areCoordsInSelection([u,m],w,k)}_areCoordsInSelection(u,m,w){return u[1]>m[1]&&u[1]<w[1]||m[1]===w[1]&&u[1]===m[1]&&u[0]>=m[0]&&u[0]<w[0]||m[1]<w[1]&&u[1]===w[1]&&u[0]<w[0]||m[1]<w[1]&&u[1]===m[1]&&u[0]>=m[0]}_selectWordAtCursor(u,m){var E,x;const w=(x=(E=this._linkifier.currentLink)==null?void 0:E.link)==null?void 0:x.range;if(w)return this._model.selectionStart=[w.start.x-1,w.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(w,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const k=this._getMouseBufferCoords(u);return!!k&&(this._selectWordAt(k,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(u,m){this._model.clearSelection(),u=Math.max(u,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,u],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(u){this._model.handleTrim(u)&&this.refresh()}_getMouseBufferCoords(u){const m=this._mouseService.getCoords(u,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(u){let m=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,u,this._screenElement)[1];const w=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=w?0:(m>w&&(m-=w),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(u){return r.isMac?u.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:u.shiftKey}handleMouseDown(u){if(this._mouseDownTimeStamp=u.timeStamp,(u.button!==2||!this.hasSelection)&&u.button===0){if(!this._enabled){if(!this.shouldForceSelection(u))return;u.stopPropagation()}u.preventDefault(),this._dragScrollAmount=0,this._enabled&&u.shiftKey?this._handleIncrementalClick(u):u.detail===1?this._handleSingleClick(u):u.detail===2?this._handleDoubleClick(u):u.detail===3&&this._handleTripleClick(u),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(u){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(u))}_handleSingleClick(u){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(u)?3:0,this._model.selectionStart=this._getMouseBufferCoords(u),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(u){this._selectWordAtCursor(u,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(u){const m=this._getMouseBufferCoords(u);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(u){return u.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(u){if(u.stopImmediatePropagation(),!this._model.selectionStart)return;const m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(u),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(u),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const w=this._bufferService.buffer;if(this._model.selectionEnd[1]<w.lines.length){const k=w.lines.get(this._model.selectionEnd[1]);k&&k.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const u=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(u.ydisp+this._bufferService.rows,u.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=u.ydisp),this.refresh()}}_handleMouseUp(u){const m=u.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&u.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const w=this._mouseService.getCoords(u,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(w&&w[0]!==void 0&&w[1]!==void 0){const k=(0,c.moveToCellSequence)(w[0]-1,w[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const u=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,w=!(!u||!m||u[0]===m[0]&&u[1]===m[1]);w?u&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&u[0]===this._oldSelectionStart[0]&&u[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(u,m,w)):this._oldHasSelection&&this._fireOnSelectionChange(u,m,w)}_fireOnSelectionChange(u,m,w){this._oldSelectionStart=u,this._oldSelectionEnd=m,this._oldHasSelection=w,this._onSelectionChange.fire()}_handleBufferActivate(u){this.clearSelection(),this._trimListener.dispose(),this._trimListener=u.activeBuffer.lines.onTrim(m=>this._handleTrim(m))}_convertViewportColToCharacterIndex(u,m){let w=m;for(let k=0;m>=k;k++){const E=u.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?w--:E>1&&m!==k&&(w+=E-1)}return w}setSelection(u,m,w){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[u,m],this._model.selectionStartLength=w,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(u){this._isClickInSelection(u)||(this._selectWordAtCursor(u,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(u,m,w=!0,k=!0){if(u[0]>=this._bufferService.cols)return;const E=this._bufferService.buffer,x=E.lines.get(u[1]);if(!x)return;const T=E.translateBufferLineToString(u[1],!1);let F=this._convertViewportColToCharacterIndex(x,u[0]),$=F;const N=u[0]-F;let H=0,y=0,D=0,B=0;if(T.charAt(F)===" "){for(;F>0&&T.charAt(F-1)===" ";)F--;for(;$<T.length&&T.charAt($+1)===" ";)$++}else{let q=u[0],Y=u[0];x.getWidth(q)===0&&(H++,q--),x.getWidth(Y)===2&&(y++,Y++);const G=x.getString(Y).length;for(G>1&&(B+=G-1,$+=G-1);q>0&&F>0&&!this._isCharWordSeparator(x.loadCell(q-1,this._workCell));){x.loadCell(q-1,this._workCell);const O=this._workCell.getChars().length;this._workCell.getWidth()===0?(H++,q--):O>1&&(D+=O-1,F-=O-1),F--,q--}for(;Y<x.length&&$+1<T.length&&!this._isCharWordSeparator(x.loadCell(Y+1,this._workCell));){x.loadCell(Y+1,this._workCell);const O=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,Y++):O>1&&(B+=O-1,$+=O-1),$++,Y++}}$++;let P=F+N-H+D,U=Math.min(this._bufferService.cols,$-F+H+y-D-B);if(m||T.slice(F,$).trim()!==""){if(w&&P===0&&x.getCodePoint(0)!==32){const q=E.lines.get(u[1]-1);if(q&&x.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const Y=this._getWordAt([this._bufferService.cols-1,u[1]-1],!1,!0,!1);if(Y){const G=this._bufferService.cols-Y.start;P-=G,U+=G}}}if(k&&P+U===this._bufferService.cols&&x.getCodePoint(this._bufferService.cols-1)!==32){const q=E.lines.get(u[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const Y=this._getWordAt([0,u[1]+1],!1,!1,!0);Y&&(U+=Y.length)}}return{start:P,length:U}}}_selectWordAt(u,m){const w=this._getWordAt(u,m);if(w){for(;w.start<0;)w.start+=this._bufferService.cols,u[1]--;this._model.selectionStart=[w.start,u[1]],this._model.selectionStartLength=w.length}}_selectToWordAt(u){const m=this._getWordAt(u,!0);if(m){let w=u[1];for(;m.start<0;)m.start+=this._bufferService.cols,w--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,w++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,w]}}_isCharWordSeparator(u){return u.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars())>=0}_selectLineAt(u){const m=this._bufferService.buffer.getWrappedRangeForLine(u),w={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(w,this._bufferService.cols)}};t.SelectionService=C=h([l(3,d.IBufferService),l(4,d.ICoreService),l(5,g.IMouseService),l(6,d.IOptionsService),l(7,g.IRenderService),l(8,g.ICoreBrowserService)],C)},4725:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const h=a(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(M,t,a){var h=this&&this.__decorate||function(C,u,m,w){var k,E=arguments.length,x=E<3?u:w===null?w=Object.getOwnPropertyDescriptor(u,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(C,u,m,w);else for(var T=C.length-1;T>=0;T--)(k=C[T])&&(x=(E<3?k(x):E>3?k(u,m,x):k(u,m))||x);return E>3&&x&&Object.defineProperty(u,m,x),x},l=this&&this.__param||function(C,u){return function(m,w){u(m,w,C)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=a(7239),c=a(8055),_=a(8460),g=a(844),o=a(2585),e=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),n=c.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],u=[0,95,135,175,215,255];for(let m=0;m<216;m++){const w=u[m/36%6|0],k=u[m/6%6|0],E=u[m%6];C.push({css:c.channels.toCss(w,k,E),rgba:c.channels.toRgba(w,k,E)})}for(let m=0;m<24;m++){const w=8+10*m;C.push({css:c.channels.toCss(w,w,w),rgba:c.channels.toRgba(w,w,w)})}return C})());let S=t.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:n,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:c.color.blend(r,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:c.color.blend(r,d),ansi:t.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(C={}){const u=this._colors;if(u.foreground=f(C.foreground,e),u.background=f(C.background,r),u.cursor=f(C.cursor,i),u.cursorAccent=f(C.cursorAccent,n),u.selectionBackgroundTransparent=f(C.selectionBackground,d),u.selectionBackgroundOpaque=c.color.blend(u.background,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundTransparent=f(C.selectionInactiveBackground,u.selectionBackgroundTransparent),u.selectionInactiveBackgroundOpaque=c.color.blend(u.background,u.selectionInactiveBackgroundTransparent),u.selectionForeground=C.selectionForeground?f(C.selectionForeground,c.NULL_COLOR):void 0,u.selectionForeground===c.NULL_COLOR&&(u.selectionForeground=void 0),c.color.isOpaque(u.selectionBackgroundTransparent)&&(u.selectionBackgroundTransparent=c.color.opacity(u.selectionBackgroundTransparent,.3)),c.color.isOpaque(u.selectionInactiveBackgroundTransparent)&&(u.selectionInactiveBackgroundTransparent=c.color.opacity(u.selectionInactiveBackgroundTransparent,.3)),u.ansi=t.DEFAULT_ANSI_COLORS.slice(),u.ansi[0]=f(C.black,t.DEFAULT_ANSI_COLORS[0]),u.ansi[1]=f(C.red,t.DEFAULT_ANSI_COLORS[1]),u.ansi[2]=f(C.green,t.DEFAULT_ANSI_COLORS[2]),u.ansi[3]=f(C.yellow,t.DEFAULT_ANSI_COLORS[3]),u.ansi[4]=f(C.blue,t.DEFAULT_ANSI_COLORS[4]),u.ansi[5]=f(C.magenta,t.DEFAULT_ANSI_COLORS[5]),u.ansi[6]=f(C.cyan,t.DEFAULT_ANSI_COLORS[6]),u.ansi[7]=f(C.white,t.DEFAULT_ANSI_COLORS[7]),u.ansi[8]=f(C.brightBlack,t.DEFAULT_ANSI_COLORS[8]),u.ansi[9]=f(C.brightRed,t.DEFAULT_ANSI_COLORS[9]),u.ansi[10]=f(C.brightGreen,t.DEFAULT_ANSI_COLORS[10]),u.ansi[11]=f(C.brightYellow,t.DEFAULT_ANSI_COLORS[11]),u.ansi[12]=f(C.brightBlue,t.DEFAULT_ANSI_COLORS[12]),u.ansi[13]=f(C.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),u.ansi[14]=f(C.brightCyan,t.DEFAULT_ANSI_COLORS[14]),u.ansi[15]=f(C.brightWhite,t.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const m=Math.min(u.ansi.length-16,C.extendedAnsi.length);for(let w=0;w<m;w++)u.ansi[w+16]=f(C.extendedAnsi[w],t.DEFAULT_ANSI_COLORS[w+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let u=0;u<this._restoreColors.ansi.length;++u)this._colors.ansi[u]=this._restoreColors.ansi[u]}modifyColors(C){C(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 f(C,u){if(C!==void 0)try{return c.css.toColor(C)}catch{}return u}t.ThemeService=S=h([l(0,o.IOptionsService)],S)},6349:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class s extends l.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.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(_){if(this._maxLength===_)return;const g=new Array(_);for(let o=0;o<Math.min(_,this.length);o++)g[o]=this._array[this._getCyclicIndex(o)];this._array=g,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let g=this._length;g<_;g++)this._array[g]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,g){this._array[this._getCyclicIndex(_)]=g}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,g,...o){if(g){for(let e=_;e<this._length-g;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+g)];this._length-=g,this.onDeleteEmitter.fire({index:_,amount:g})}for(let e=this._length-1;e>=_;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(_+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:_,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,g,o){if(!(g<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=g-1;r>=0;r--)this.set(_+r+o,this.get(_+r));const e=_+g+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<g;e++)this.set(_+e+o,this.get(_+e))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}t.CircularList=s},1439:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,l=5){if(typeof h!="object")return h;const s=Array.isArray(h)?[]:{};for(const c in h)s[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return s}},8055:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,s=0;var c,_,g,o,e;function r(n){const d=n.toString(16);return d.length<2?"0"+d:d}function i(n,d){return n<d?(d+.05)/(n+.05):(n+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(n){n.toCss=function(d,S,f,C){return C!==void 0?`#${r(d)}${r(S)}${r(f)}${r(C)}`:`#${r(d)}${r(S)}${r(f)}`},n.toRgba=function(d,S,f,C=255){return(d<<24|S<<16|f<<8|C)>>>0},n.toColor=function(d,S,f,C){return{css:n.toCss(d,S,f,C),rgba:n.toRgba(d,S,f,C)}}}(c||(t.channels=c={})),function(n){function d(S,f){return s=Math.round(255*f),[a,h,l]=e.toChannels(S.rgba),{css:c.toCss(a,h,l,s),rgba:c.toRgba(a,h,l,s)}}n.blend=function(S,f){if(s=(255&f.rgba)/255,s===1)return{css:f.css,rgba:f.rgba};const C=f.rgba>>24&255,u=f.rgba>>16&255,m=f.rgba>>8&255,w=S.rgba>>24&255,k=S.rgba>>16&255,E=S.rgba>>8&255;return a=w+Math.round((C-w)*s),h=k+Math.round((u-k)*s),l=E+Math.round((m-E)*s),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},n.isOpaque=function(S){return(255&S.rgba)==255},n.ensureContrastRatio=function(S,f,C){const u=e.ensureContrastRatio(S.rgba,f.rgba,C);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},n.opaque=function(S){const f=(255|S.rgba)>>>0;return[a,h,l]=e.toChannels(f),{css:c.toCss(a,h,l),rgba:f}},n.opacity=d,n.multiplyOpacity=function(S,f){return s=255&S.rgba,d(S,s*f/255)},n.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}}(_||(t.color=_={})),function(n){let d,S;try{const f=document.createElement("canvas");f.width=1,f.height=1;const C=f.getContext("2d",{willReadFrequently:!0});C&&(d=C,d.globalCompositeOperation="copy",S=d.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return a=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),s=parseInt(f.slice(4,5).repeat(2),16),c.toColor(a,h,l,s);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}const C=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return a=parseInt(C[1]),h=parseInt(C[2]),l=parseInt(C[3]),s=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),c.toColor(a,h,l,s);if(!d||!S)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=S,d.fillStyle=f,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,s]=d.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,s),css:f}}}(g||(t.css=g={})),function(n){function d(S,f,C){const u=S/255,m=f/255,w=C/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}n.relativeLuminance=function(S){return d(S>>16&255,S>>8&255,255&S)},n.relativeLuminance2=d}(o||(t.rgb=o={})),function(n){function d(f,C,u){const m=f>>24&255,w=f>>16&255,k=f>>8&255;let E=C>>24&255,x=C>>16&255,T=C>>8&255,F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));for(;F<u&&(E>0||x>0||T>0);)E-=Math.max(0,Math.ceil(.1*E)),x-=Math.max(0,Math.ceil(.1*x)),T-=Math.max(0,Math.ceil(.1*T)),F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));return(E<<24|x<<16|T<<8|255)>>>0}function S(f,C,u){const m=f>>24&255,w=f>>16&255,k=f>>8&255;let E=C>>24&255,x=C>>16&255,T=C>>8&255,F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));for(;F<u&&(E<255||x<255||T<255);)E=Math.min(255,E+Math.ceil(.1*(255-E))),x=Math.min(255,x+Math.ceil(.1*(255-x))),T=Math.min(255,T+Math.ceil(.1*(255-T))),F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));return(E<<24|x<<16|T<<8|255)>>>0}n.blend=function(f,C){if(s=(255&C)/255,s===1)return C;const u=C>>24&255,m=C>>16&255,w=C>>8&255,k=f>>24&255,E=f>>16&255,x=f>>8&255;return a=k+Math.round((u-k)*s),h=E+Math.round((m-E)*s),l=x+Math.round((w-x)*s),c.toRgba(a,h,l)},n.ensureContrastRatio=function(f,C,u){const m=o.relativeLuminance(f>>8),w=o.relativeLuminance(C>>8);if(i(m,w)<u){if(w<m){const x=d(f,C,u),T=i(m,o.relativeLuminance(x>>8));if(T<u){const F=S(f,C,u);return T>i(m,o.relativeLuminance(F>>8))?x:F}return x}const k=S(f,C,u),E=i(m,o.relativeLuminance(k>>8));if(E<u){const x=d(f,C,u);return E>i(m,o.relativeLuminance(x>>8))?k:x}return k}},n.reduceLuminance=d,n.increaseLuminance=S,n.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),s=a(4348),c=a(7866),_=a(744),g=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),n=a(7994),d=a(9282),S=a(5435),f=a(5981),C=a(2660);let u=!1;class m extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event(k=>{var E;(E=this._onScrollApi)==null||E.fire(k.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(k){for(const E in k)this.optionsService.options[E]=k[E]}constructor(k){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new g.OptionsService(k)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(n.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.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(E=>{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(E=>{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 f.WriteBuffer((E,x)=>this._inputHandler.parse(E,x))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(k,E){this._writeBuffer.write(k,E)}writeSync(k,E){this._logService.logLevel<=l.LogLevelEnum.WARN&&!u&&(this._logService.warn("writeSync is unreliable and will be removed soon."),u=!0),this._writeBuffer.writeSync(k,E)}input(k,E=!0){this.coreService.triggerDataEvent(k,E)}resize(k,E){isNaN(k)||isNaN(E)||(k=Math.max(k,_.MINIMUM_COLS),E=Math.max(E,_.MINIMUM_ROWS),this._bufferService.resize(k,E))}scroll(k,E=!1){this._bufferService.scroll(k,E)}scrollLines(k,E,x){this._bufferService.scrollLines(k,E,x)}scrollPages(k){this.scrollLines(k*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(k){const E=k-this._bufferService.buffer.ydisp;E!==0&&this.scrollLines(E)}registerEscHandler(k,E){return this._inputHandler.registerEscHandler(k,E)}registerDcsHandler(k,E){return this._inputHandler.registerDcsHandler(k,E)}registerCsiHandler(k,E){return this._inputHandler.registerCsiHandler(k,E)}registerOscHandler(k,E){return this._inputHandler.registerOscHandler(k,E)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let k=!1;const E=this.optionsService.rawOptions.windowsPty;E&&E.buildNumber!==void 0&&E.buildNumber!==void 0?k=E.backend==="conpty"&&E.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(k=!0),k?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const k=[];k.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),k.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const E of k)E.dispose()})}}}t.CoreTerminal=m},8460:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},5435:function(M,t,a){var h=this&&this.__decorate||function(H,y,D,B){var P,U=arguments.length,q=U<3?y:B===null?B=Object.getOwnPropertyDescriptor(y,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(H,y,D,B);else for(var Y=H.length-1;Y>=0;Y--)(P=H[Y])&&(q=(U<3?P(q):U>3?P(y,D,q):P(y,D))||q);return U>3&&q&&Object.defineProperty(y,D,q),q},l=this&&this.__param||function(H,y){return function(D,B){y(D,B,H)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=a(2584),c=a(7116),_=a(2015),g=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),n=a(511),d=a(3734),S=a(2585),f=a(1480),C=a(6242),u=a(6351),m=a(5941),w={"(":0,")":1,"*":2,"+":3,"-":1,".":2},k=131072;function E(H,y){if(H>24)return y.setWinLines||!1;switch(H){case 1:return!!y.restoreWin;case 2:return!!y.minimizeWin;case 3:return!!y.setWinPosition;case 4:return!!y.setWinSizePixels;case 5:return!!y.raiseWin;case 6:return!!y.lowerWin;case 7:return!!y.refreshWin;case 8:return!!y.setWinSizeChars;case 9:return!!y.maximizeWin;case 10:return!!y.fullscreenWin;case 11:return!!y.getWinState;case 13:return!!y.getWinPosition;case 14:return!!y.getWinSizePixels;case 15:return!!y.getScreenSizePixels;case 16:return!!y.getCellSizePixels;case 18:return!!y.getWinSizeChars;case 19:return!!y.getScreenSizeChars;case 20:return!!y.getIconTitle;case 21:return!!y.getWinTitle;case 22:return!!y.pushTitle;case 23:return!!y.popTitle;case 24:return!!y.setWinLines}return!1}var x;(function(H){H[H.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",H[H.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(x||(t.WindowsOptionsReportType=x={}));let T=0;class F extends g.Disposable{getAttrData(){return this._curAttrData}constructor(y,D,B,P,U,q,Y,G,O=new _.EscapeSequenceParser){super(),this._bufferService=y,this._charsetService=D,this._coreService=B,this._logService=P,this._optionsService=U,this._oscLinkService=q,this._coreMouseService=Y,this._unicodeService=G,this._parser=O,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new n.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.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 $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:j.toArray()})}),this._parser.setEscHandlerFallback(R=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback(R=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,j,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:j,data:W})}),this._parser.setDcsHandlerFallback((R,j,W)=>{j==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:j,payload:W})}),this._parser.setPrintHandler((R,j,W)=>this.print(R,j,W)),this._parser.registerCsiHandler({final:"@"},R=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},R=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},R=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},R=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},R=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},R=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},R=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},R=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},R=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},R=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},R=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},R=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},R=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},R=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},R=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},R=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},R=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},R=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},R=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},R=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},R=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},R=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},R=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},R=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},R=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},R=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},R=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},R=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},R=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},R=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},R=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},R=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},R=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},R=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},R=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},R=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},R=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},R=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},R=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},R=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},R=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},R=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},R=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},R=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},R=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},R=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},R=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},R=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},R=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},R=>this.requestMode(R,!1)),this._parser.setExecuteHandler(s.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(s.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(s.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(s.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(s.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(s.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(s.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(s.C1.IND,()=>this.index()),this._parser.setExecuteHandler(s.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(s.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(R=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new C.OscHandler(R=>this.setIconName(R))),this._parser.registerOscHandler(2,new C.OscHandler(R=>this.setTitle(R))),this._parser.registerOscHandler(4,new C.OscHandler(R=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new C.OscHandler(R=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new C.OscHandler(R=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new C.OscHandler(R=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new C.OscHandler(R=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new C.OscHandler(R=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new C.OscHandler(R=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new C.OscHandler(R=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new C.OscHandler(R=>this.restoreCursorColor(R))),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 R in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(R=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new u.DcsHandler((R,j)=>this.requestStatusString(R,j)))}_preserveStack(y,D,B,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=y,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=B,this._parseStack.position=P}_logSlowResolvingAsync(y){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([y,new Promise((D,B)=>setTimeout(()=>B("#SLOW_TIMEOUT"),5e3))]).catch(D=>{if(D!=="#SLOW_TIMEOUT")throw D;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(y,D){let B,P=this._activeBuffer.x,U=this._activeBuffer.y,q=0;const Y=this._parseStack.paused;if(Y){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,D))return this._logSlowResolvingAsync(B),B;P=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,y.length>k&&(q=this._parseStack.position+k)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof y=="string"?` "${y}"`:` "${Array.prototype.map.call(y,R=>String.fromCharCode(R)).join("")}"`),typeof y=="string"?y.split("").map(R=>R.charCodeAt(0)):y),this._parseBuffer.length<y.length&&this._parseBuffer.length<k&&(this._parseBuffer=new Uint32Array(Math.min(y.length,k))),Y||this._dirtyRowTracker.clearRange(),y.length>k)for(let R=q;R<y.length;R+=k){const j=R+k<y.length?R+k:y.length,W=typeof y=="string"?this._stringDecoder.decode(y.substring(R,j),this._parseBuffer):this._utf8Decoder.decode(y.subarray(R,j),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,W))return this._preserveStack(P,U,W,R),this._logSlowResolvingAsync(B),B}else if(!Y){const R=typeof y=="string"?this._stringDecoder.decode(y,this._parseBuffer):this._utf8Decoder.decode(y,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,R))return this._preserveStack(P,U,R,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===P&&this._activeBuffer.y===U||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),O=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);O<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(O,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(y,D,B){let P,U;const q=this._charsetService.charset,Y=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,O=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,j=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-D>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let V=this._parser.precedingJoinState;for(let K=D;K<B;++K){if(P=y[K],P<127&&q){const fe=q[String.fromCharCode(P)];fe&&(P=fe.charCodeAt(0))}const ee=this._unicodeService.charProperties(P,V);U=f.UnicodeService.extractWidth(ee);const J=f.UnicodeService.extractShouldJoin(ee),he=J?f.UnicodeService.extractWidth(V):0;if(V=ee,Y&&this._onA11yChar.fire((0,o.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-he>G){if(O){const fe=W;let Z=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&W instanceof e.BufferLine&&W.copyCellsFrom(fe,Z,0,he,!1);Z<G;)fe.setCellFromCodepoint(Z++,0,1,j)}else if(this._activeBuffer.x=G-1,U===2)continue}if(J&&this._activeBuffer.x){const fe=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-fe,P,U);for(let Z=U-he;--Z>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(R&&(W.insertCells(this._activeBuffer.x,U-he,this._activeBuffer.getNullCell(j)),W.getWidth(G-1)===2&&W.setCellFromCodepoint(G-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,j)),W.setCellFromCodepoint(this._activeBuffer.x++,P,U,j),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=V,this._activeBuffer.x<G&&B-D>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(y,D){return y.final!=="t"||y.prefix||y.intermediates?this._parser.registerCsiHandler(y,D):this._parser.registerCsiHandler(y,B=>!E(B.params[0],this._optionsService.rawOptions.windowOptions)||D(B))}registerDcsHandler(y,D){return this._parser.registerDcsHandler(y,new u.DcsHandler(D))}registerEscHandler(y,D){return this._parser.registerEscHandler(y,D)}registerOscHandler(y,D){return this._parser.registerOscHandler(y,new C.OscHandler(D))}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 y;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&&((y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&y.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);D.hasWidth(this._activeBuffer.x)&&!D.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const y=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-y),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(y=this._bufferService.cols-1){this._activeBuffer.x=Math.min(y,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(y,D){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=y,this._activeBuffer.y=this._activeBuffer.scrollTop+D):(this._activeBuffer.x=y,this._activeBuffer.y=D),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(y,D){this._restrictCursor(),this._setCursor(this._activeBuffer.x+y,this._activeBuffer.y+D)}cursorUp(y){const D=this._activeBuffer.y-this._activeBuffer.scrollTop;return D>=0?this._moveCursor(0,-Math.min(D,y.params[0]||1)):this._moveCursor(0,-(y.params[0]||1)),!0}cursorDown(y){const D=this._activeBuffer.scrollBottom-this._activeBuffer.y;return D>=0?this._moveCursor(0,Math.min(D,y.params[0]||1)):this._moveCursor(0,y.params[0]||1),!0}cursorForward(y){return this._moveCursor(y.params[0]||1,0),!0}cursorBackward(y){return this._moveCursor(-(y.params[0]||1),0),!0}cursorNextLine(y){return this.cursorDown(y),this._activeBuffer.x=0,!0}cursorPrecedingLine(y){return this.cursorUp(y),this._activeBuffer.x=0,!0}cursorCharAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(y){return this._setCursor(y.length>=2?(y.params[1]||1)-1:0,(y.params[0]||1)-1),!0}charPosAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(y){return this._moveCursor(y.params[0]||1,0),!0}linePosAbsolute(y){return this._setCursor(this._activeBuffer.x,(y.params[0]||1)-1),!0}vPositionRelative(y){return this._moveCursor(0,y.params[0]||1),!0}hVPosition(y){return this.cursorPosition(y),!0}tabClear(y){const D=y.params[0];return D===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:D===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=y.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=y.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(y){const D=y.params[0];return D===1&&(this._curAttrData.bg|=536870912),D!==2&&D!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(y,D,B,P=!1,U=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);q.replaceCells(D,B,this._activeBuffer.getNullCell(this._eraseAttrData()),U),P&&(q.isWrapped=!1)}_resetBufferLine(y,D=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),D),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+y),B.isWrapped=!1)}eraseInDisplay(y,D=!1){let B;switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);B<this._bufferService.rows;B++)this._resetBufferLine(B,D);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,D),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,D);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,D);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(y,D=!1){switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,D);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,D)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(y){this._restrictCursor();let D=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;D--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(y){this._restrictCursor();let D=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;D--;)this._activeBuffer.lines.splice(B,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}insertChars(y){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.insertCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(y){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.deleteCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(y){let D=y.params[0]||1;for(;D--;)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(y){let D=y.params[0]||1;for(;D--;)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(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(y){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(y.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(y){const D=this._parser.precedingJoinState;if(!D)return!0;const B=y.params[0]||1,P=f.UnicodeService.extractWidth(D),U=this._activeBuffer.x-P,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Y=new Uint32Array(q.length*B);let G=0;for(let R=0;R<q.length;){const j=q.codePointAt(R)||0;Y[G++]=j,R+=j>65535?2:1}let O=G;for(let R=1;R<B;++R)Y.copyWithin(O,0,G),O+=G;return this.print(Y,0,O),!0}sendDeviceAttributesPrimary(y){return y.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(y){return y.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(y.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(y){return(this._optionsService.rawOptions.termName+"").indexOf(y)===0}setMode(y){for(let D=0;D<y.length;D++)switch(y.params[D]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(y){for(let D=0;D<y.length;D++)switch(y.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.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(y){for(let D=0;D<y.length;D++)switch(y.params[D]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(y){for(let D=0;D<y.length;D++)switch(y.params[D]){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(),y.params[D]===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(y,D){const B=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:U}=this._coreMouseService,q=this._coreService,{buffers:Y,cols:G}=this._bufferService,{active:O,alt:R}=Y,j=this._optionsService.rawOptions,W=J=>J?1:2,V=y.params[0];return K=V,ee=D?V===2?4:V===4?W(q.modes.insertMode):V===12?3:V===20?W(j.convertEol):0:V===1?W(B.applicationCursorKeys):V===3?j.windowOptions.setWinLines?G===80?2:G===132?1:0:0:V===6?W(B.origin):V===7?W(B.wraparound):V===8?3:V===9?W(P==="X10"):V===12?W(j.cursorBlink):V===25?W(!q.isCursorHidden):V===45?W(B.reverseWraparound):V===66?W(B.applicationKeypad):V===67?4:V===1e3?W(P==="VT200"):V===1002?W(P==="DRAG"):V===1003?W(P==="ANY"):V===1004?W(B.sendFocus):V===1005?4:V===1006?W(U==="SGR"):V===1015?4:V===1016?W(U==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?W(O===R):V===2004?W(B.bracketedPasteMode):0,q.triggerDataEvent(`${s.C0.ESC}[${D?"":"?"}${K};${ee}$y`),!0;var K,ee}_updateAttrColor(y,D,B,P,U){return D===2?(y|=50331648,y&=-16777216,y|=d.AttributeData.fromColorRGB([B,P,U])):D===5&&(y&=-50331904,y|=33554432|255&B),y}_extractColor(y,D,B){const P=[0,0,-1,0,0,0];let U=0,q=0;do{if(P[q+U]=y.params[D+q],y.hasSubParams(D+q)){const Y=y.getSubParams(D+q);let G=0;do P[1]===5&&(U=1),P[q+G+1+U]=Y[G];while(++G<Y.length&&G+q+1+U<P.length);break}if(P[1]===5&&q+U>=2||P[1]===2&&q+U>=5)break;P[1]&&(U=1)}while(++q+D<y.length&&q+U<P.length);for(let Y=2;Y<P.length;++Y)P[Y]===-1&&(P[Y]=0);switch(P[0]){case 38:B.fg=this._updateAttrColor(B.fg,P[1],P[3],P[4],P[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,P[1],P[3],P[4],P[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,P[1],P[3],P[4],P[5])}return q}_processUnderline(y,D){D.extended=D.extended.clone(),(!~y||y>5)&&(y=1),D.extended.underlineStyle=y,D.fg|=268435456,y===0&&(D.fg&=-268435457),D.updateExtended()}_processSGR0(y){y.fg=e.DEFAULT_ATTR_DATA.fg,y.bg=e.DEFAULT_ATTR_DATA.bg,y.extended=y.extended.clone(),y.extended.underlineStyle=0,y.extended.underlineColor&=-67108864,y.updateExtended()}charAttributes(y){if(y.length===1&&y.params[0]===0)return this._processSGR0(this._curAttrData),!0;const D=y.length;let B;const P=this._curAttrData;for(let U=0;U<D;U++)B=y.params[U],B>=30&&B<=37?(P.fg&=-50331904,P.fg|=16777216|B-30):B>=40&&B<=47?(P.bg&=-50331904,P.bg|=16777216|B-40):B>=90&&B<=97?(P.fg&=-50331904,P.fg|=16777224|B-90):B>=100&&B<=107?(P.bg&=-50331904,P.bg|=16777224|B-100):B===0?this._processSGR0(P):B===1?P.fg|=134217728:B===3?P.bg|=67108864:B===4?(P.fg|=268435456,this._processUnderline(y.hasSubParams(U)?y.getSubParams(U)[0]:1,P)):B===5?P.fg|=536870912:B===7?P.fg|=67108864:B===8?P.fg|=1073741824:B===9?P.fg|=2147483648:B===2?P.bg|=134217728:B===21?this._processUnderline(2,P):B===22?(P.fg&=-134217729,P.bg&=-134217729):B===23?P.bg&=-67108865:B===24?(P.fg&=-268435457,this._processUnderline(0,P)):B===25?P.fg&=-536870913:B===27?P.fg&=-67108865:B===28?P.fg&=-1073741825:B===29?P.fg&=2147483647:B===39?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):B===49?(P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?U+=this._extractColor(y,U,P):B===53?P.bg|=1073741824:B===55?P.bg&=-1073741825:B===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):B===100?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(y){switch(y.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const D=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${D};${B}R`)}return!0}deviceStatusPrivate(y){if(y.params[0]===6){const D=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${D};${B}R`)}return!0}softReset(y){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.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(y){const D=y.params[0]||1;switch(D){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 B=D%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(y){const D=y.params[0]||1;let B;return(y.length<2||(B=y.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>D&&(this._activeBuffer.scrollTop=D-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(y){if(!E(y.params[0],this._optionsService.rawOptions.windowOptions))return!0;const D=y.length>1?y.params[1]:0;switch(y.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire(x.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(x.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:D!==0&&D!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),D!==0&&D!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:D!==0&&D!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),D!==0&&D!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(y){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(y){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(y){return this._windowTitle=y,this._onTitleChange.fire(y),!0}setIconName(y){return this._iconName=y,!0}setOrReportIndexedColor(y){const D=[],B=y.split(";");for(;B.length>1;){const P=B.shift(),U=B.shift();if(/^\d+$/.exec(P)){const q=parseInt(P);if(N(q))if(U==="?")D.push({type:0,index:q});else{const Y=(0,m.parseColor)(U);Y&&D.push({type:1,index:q,color:Y})}}}return D.length&&this._onColor.fire(D),!0}setHyperlink(y){const D=y.split(";");return!(D.length<2)&&(D[1]?this._createHyperlink(D[0],D[1]):!D[0]&&this._finishHyperlink())}_createHyperlink(y,D){this._getCurrentLinkId()&&this._finishHyperlink();const B=y.split(":");let P;const U=B.findIndex(q=>q.startsWith("id="));return U!==-1&&(P=B[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:D}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(y,D){const B=y.split(";");for(let P=0;P<B.length&&!(D>=this._specialColors.length);++P,++D)if(B[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const U=(0,m.parseColor)(B[P]);U&&this._onColor.fire([{type:1,index:this._specialColors[D],color:U}])}return!0}setOrReportFgColor(y){return this._setOrReportSpecialColor(y,0)}setOrReportBgColor(y){return this._setOrReportSpecialColor(y,1)}setOrReportCursorColor(y){return this._setOrReportSpecialColor(y,2)}restoreIndexedColor(y){if(!y)return this._onColor.fire([{type:2}]),!0;const D=[],B=y.split(";");for(let P=0;P<B.length;++P)if(/^\d+$/.exec(B[P])){const U=parseInt(B[P]);N(U)&&D.push({type:2,index:U})}return D.length&&this._onColor.fire(D),!0}restoreFgColor(y){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(y){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(y){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,c.DEFAULT_CHARSET),!0}selectCharset(y){return y.length!==2?(this.selectDefaultCharset(),!0):(y[0]==="/"||this._charsetService.setgCharset(w[y[0]],c.CHARSETS[y[1]]||c.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 y=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,y,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=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(y){return this._charsetService.setgLevel(y),!0}screenAlignmentPattern(){const y=new n.CellData;y.content=4194373,y.fg=this._curAttrData.fg,y.bg=this._curAttrData.bg,this._setCursor(0,0);for(let D=0;D<this._bufferService.rows;++D){const B=this._activeBuffer.ybase+this._activeBuffer.y+D,P=this._activeBuffer.lines.get(B);P&&(P.fill(y),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(y,D){const B=this._bufferService.buffer,P=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(y==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:y==='"p'?'P1$r61;1"p':y==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:y==="m"?"P1$r0m":y===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(y,D){this._dirtyRowTracker.markRangeDirty(y,D)}}t.InputHandler=F;let $=class{constructor(H){this._bufferService=H,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(H){H<this.start?this.start=H:H>this.end&&(this.end=H)}markRangeDirty(H,y){H>y&&(T=H,H=y,y=T),H<this.start&&(this.start=H),y>this.end&&(this.end=y)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function N(H){return 0<=H&&H<256}$=h([l(0,S.IBufferService)],$)},844:(M,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,s,c,_){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(s,c,_)}get(h,l,s,c){var _;return(_=this._data.get(h,l))==null?void 0:_.get(s,c)}clear(){this._data.clear()}}},6114:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,s=this._array.length-1;for(;s>=l;){let c=l+s>>1;const _=this._getKey(this._array[c]);if(_>h)s=c-1;else{if(!(_<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let g=0,o=0,e=_.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),o=Math.max(g,o),r=_.timeRemaining(),1.5*o>r)return e-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-g))}ms`),void this._start();e=r}this.clear()}}class s extends l{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const g=Date.now()+_;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const s=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=s==null?void 0:s.get(l.cols-1),_=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);_&&c&&(_.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),s=a(3734),c=a(8437),_=a(4634),g=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,n,d){this._hasScrollback=i,this._optionsService=n,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,n){return new c.BufferLine(this._bufferService.cols,this.getNullCell(i),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const n=i+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.DEFAULT_ATTR_DATA);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,n){const d=this.getNullCell(c.DEFAULT_ATTR_DATA);let S=0;const f=this._getCorrectBufferLength(n);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<i)for(let u=0;u<this.lines.length;u++)S+=+this.lines.get(u).resize(i,d);let C=0;if(this._rows<n)for(let u=this._rows;u<n;u++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new c.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,d)));else for(let u=this._rows;u>n;u--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){const u=this.lines.length-f;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=f}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,n-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(i,n),this._cols>i))for(let C=0;C<this.lines.length;C++)S+=+this.lines.get(C).resize(i,d);this._cols=i,this._rows=n,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,n){this._cols!==i&&(i>this._cols?this._reflowLarger(i,n):this._reflowSmaller(i,n))}_reflowLarger(i,n){const d=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(d.length>0){const S=(0,_.reflowLargerCreateNewLayout)(this.lines,d);(0,_.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(i,n,S.countRemoved)}}_reflowLargerAdjustViewport(i,n,d){const S=this.getNullCell(c.DEFAULT_ATTR_DATA);let f=d;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new c.BufferLine(i,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,n){const d=this.getNullCell(c.DEFAULT_ATTR_DATA),S=[];let f=0;for(let C=this.lines.length-1;C>=0;C--){let u=this.lines.get(C);if(!u||!u.isWrapped&&u.getTrimmedLength()<=i)continue;const m=[u];for(;u.isWrapped&&C>0;)u=this.lines.get(--C),m.unshift(u);const w=this.ybase+this.y;if(w>=C&&w<C+m.length)continue;const k=m[m.length-1].getTrimmedLength(),E=(0,_.reflowSmallerGetNewLineLengths)(m,this._cols,i),x=E.length-m.length;let T;T=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+x):Math.max(0,this.lines.length-this.lines.maxLength+x);const F=[];for(let B=0;B<x;B++){const P=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);F.push(P)}F.length>0&&(S.push({start:C+m.length+f,newLines:F}),f+=F.length),m.push(...F);let $=E.length-1,N=E[$];N===0&&($--,N=E[$]);let H=m.length-x-1,y=k;for(;H>=0;){const B=Math.min(y,N);if(m[$]===void 0)break;if(m[$].copyCellsFrom(m[H],y-B,N-B,B,!0),N-=B,N===0&&($--,N=E[$]),y-=B,y===0){H--;const P=Math.max(H,0);y=(0,_.getWrappedLineTrimmedLength)(m,P,this._cols)}}for(let B=0;B<m.length;B++)E[B]<i&&m[B].setCell(E[B],d);let D=x-T;for(;D-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+x,this.ybase+n-1)}if(S.length>0){const C=[],u=[];for(let $=0;$<this.lines.length;$++)u.push(this.lines.get($));const m=this.lines.length;let w=m-1,k=0,E=S[k];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let x=0;for(let $=Math.min(this.lines.maxLength-1,m+f-1);$>=0;$--)if(E&&E.start>w+x){for(let N=E.newLines.length-1;N>=0;N--)this.lines.set($--,E.newLines[N]);$++,C.push({index:w+1,amount:E.newLines.length}),x+=E.newLines.length,E=S[++k]}else this.lines.set($,u[w--]);let T=0;for(let $=C.length-1;$>=0;$--)C[$].index+=T,this.lines.onInsertEmitter.fire(C[$]),T+=C[$].amount;const F=Math.max(0,m+f-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(i,n,d=0,S){const f=this.lines.get(i);return f?f.translateToString(n,d,S):""}getWrappedRangeForLine(i){let n=i,d=i;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:n,last:d}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let n=0;n<this.markers.length;n++)this.markers[n].line===i&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const n=new e.Marker(i);return this.markers.push(n),n.register(this.lines.onTrim(d=>{n.line-=d,n.line<0&&n.dispose()})),n.register(this.lines.onInsert(d=>{n.line>=d.index&&(n.line+=d.amount)})),n.register(this.lines.onDelete(d=>{n.line>=d.index&&n.line<d.index+d.amount&&n.dispose(),n.line>d.index&&(n.line-=d.amount)})),n.register(n.onDispose(()=>this._removeMarker(n))),n}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),s=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let _=0;class g{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=r||l.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let d=0;d<e;++d)this.setCell(d,n);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[s.CHAR_DATA_ATTR_INDEX],r[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,c.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return _=3*e,r.content=this._data[_+0],r.fg=this._data[_+1],r.bg=this._data[_+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,n){268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,r,i){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,c.stringFromCodePoint)(r):2097151&n?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&n)+(0,c.stringFromCodePoint)(r),n&=-2097152,n|=2097152):n=r|4194304,i&&(n&=-12582913,n|=i<<22),this._data[3*e+0]=n}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const n=new l.CellData;for(let d=this.length-e-r-1;d>=0;--d)this.setCell(e+r+d,this.loadCell(e+d,n));for(let d=0;d<r;++d)this.setCell(e+d,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,r,i){if(e%=this.length,r<this.length-e){const n=new l.CellData;for(let d=0;d<this.length-e-r;++d)this.setCell(e+d,this.loadCell(e+r+d,n));for(let d=this.length-r;d<this.length;++d)this.setCell(d,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,r,i,n=!1){if(n)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<e;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);const n=Object.keys(this._combined);for(let S=0;S<n.length;S++){const f=parseInt(n[S],10);f>=e&&delete this._combined[f]}const d=Object.keys(this._extendedAttrs);for(let S=0;S<d.length;S++){const f=parseInt(d[S],10);f>=e&&delete this._extendedAttrs[f]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new g(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,i,n,d){const S=e._data;if(d)for(let C=n-1;C>=0;C--){for(let u=0;u<3;u++)this._data[3*(i+C)+u]=S[3*(r+C)+u];268435456&S[3*(r+C)+2]&&(this._extendedAttrs[i+C]=e._extendedAttrs[r+C])}else for(let C=0;C<n;C++){for(let u=0;u<3;u++)this._data[3*(i+C)+u]=S[3*(r+C)+u];268435456&S[3*(r+C)+2]&&(this._extendedAttrs[i+C]=e._extendedAttrs[r+C])}const f=Object.keys(e._combined);for(let C=0;C<f.length;C++){const u=parseInt(f[C],10);u>=r&&(this._combined[u-r+i]=e._combined[u])}}translateToString(e,r,i,n){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let d="";for(;r<i;){const S=this._data[3*r+0],f=2097151&S,C=2097152&S?this._combined[r]:f?(0,c.stringFromCodePoint)(f):s.WHITESPACE_CELL_CHAR;if(d+=C,n)for(let u=0;u<C.length;++u)n.push(r);r+=S>>22||1}return n&&n.push(r),d}}t.BufferLine=g},4841:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(M,t)=>{function a(h,l,s){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(s-1)&&h[l].getWidth(s-1)===1,_=h[l+1].getWidth(0)===2;return c&&_?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,s,c,_){const g=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let n=0,d=a(i,n,l),S=1,f=0;for(;S<i.length;){const u=a(i,S,l),m=u-f,w=s-d,k=Math.min(m,w);i[n].copyCellsFrom(i[S],f,d,k,!1),d+=k,d===s&&(n++,d=0),f+=k,f===u&&(S++,f=0),d===0&&n!==0&&i[n-1].getWidth(s-1)===2&&(i[n].copyCellsFrom(i[n-1],s-1,d++,1,!1),i[n-1].setCell(s-1,_))}i[n].replaceCells(d,s,_);let C=0;for(let u=i.length-1;u>0&&(u>n||i[u].getTrimmedLength()===0);u--)C++;C>0&&(g.push(o+i.length-C),g.push(C)),o+=i.length-1}return g},t.reflowLargerCreateNewLayout=function(h,l){const s=[];let c=0,_=l[c],g=0;for(let o=0;o<h.length;o++)if(_===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-g,amount:e}),o+=e-1,g+=e,_=l[++c]}else s.push(o);return{layout:s,countRemoved:g}},t.reflowLargerApplyNewLayout=function(h,l){const s=[];for(let c=0;c<l.length;c++)s.push(h.get(l[c]));for(let c=0;c<s.length;c++)h.set(c,s[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,s){const c=[],_=h.map((r,i)=>a(h,i,l)).reduce((r,i)=>r+i);let g=0,o=0,e=0;for(;e<_;){if(_-e<s){c.push(_-e);break}g+=s;const r=a(h,o,l);g>r&&(g-=r,o++);const i=h[o].getWidth(g-1)===2;i&&g--;const n=i?s-1:s;c.push(n),e+=n}return c},t.getWrappedLineTrimmedLength=a},5295:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),s=a(9092);class c extends l.Disposable{constructor(g,o){super(),this._optionsService=g,this._bufferService=o,this._onBufferActivate=this.register(new h.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 s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.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(g){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(g),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(g,o){this._normal.resize(g,o),this._alt.resize(g,o),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}t.BufferSet=c},511:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),s=a(3734);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const o=new c;return o.setFromCharData(g),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(g[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(g[l.CHAR_DATA_CHAR_INDEX].length===2){const e=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|g[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=g[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},643:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),l=a(844);class s{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}t.Marker=s,s._nextId=1},7116:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(M,t)=>{var a,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
16
+ `,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""}(a||(t.C0=a={})),function(s){s.PAD="€",s.HOP="",s.BPH="‚",s.NBH="ƒ",s.IND="„",s.NEL="…",s.SSA="†",s.ESA="‡",s.HTS="ˆ",s.HTJ="‰",s.VTS="Š",s.PLD="‹",s.PLU="Œ",s.RI="",s.SS2="Ž",s.SS3="",s.DCS="",s.PU1="‘",s.PU2="’",s.STS="“",s.CCH="”",s.MW="•",s.SPA="–",s.EPA="—",s.SOS="˜",s.SGCI="™",s.SCI="š",s.CSI="›",s.ST="œ",s.OSC="",s.PM="ž",s.APC="Ÿ"}(h||(t.C1=h={})),function(s){s.ST=`${a.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={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:["'",'"']};t.evaluateKeyboardEvent=function(s,c,_,g){const o={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=s.ctrlKey?"\b":h.C0.DEL,s.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(s.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=s.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,s.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(_?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(_?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",_||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",_||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:s.shiftKey||s.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:s.shiftKey?o.type=2:s.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:s.shiftKey?o.type=3:s.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(_&&!g||!s.altKey||s.metaKey)!_||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?o.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(o.key=h.C0.US),s.key==="@"&&(o.key=h.C0.NUL)):s.keyCode===65&&(o.type=1);else{const r=l[s.keyCode],i=r==null?void 0:r[s.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const n=s.ctrlKey?s.keyCode-64:s.keyCode+32;let d=String.fromCharCode(n);s.shiftKey&&(d=d.toUpperCase()),o.key=h.C0.ESC+d}else if(s.keyCode===32)o.key=h.C0.ESC+(s.ctrlKey?h.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let n=s.code.slice(3,4);s.shiftKey||(n=n.toLowerCase()),o.key=h.C0.ESC+n,o.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?o.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?o.key=h.C0.NUL:s.keyCode>=51&&s.keyCode<=55?o.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?o.key=h.C0.DEL:s.keyCode===219?o.key=h.C0.ESC:s.keyCode===220?o.key=h.C0.FS:s.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let s="";for(let c=h;c<l;++c){let _=a[c];_>65535?(_-=65536,s+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):s+=String.fromCharCode(_)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let s=0,c=0;if(this._interim){const _=a.charCodeAt(c++);56320<=_&&_<=57343?h[s++]=1024*(this._interim-55296)+_-56320+65536:(h[s++]=this._interim,h[s++]=_),this._interim=0}for(let _=c;_<l;++_){const g=a.charCodeAt(_);if(55296<=g&&g<=56319){if(++_>=l)return this._interim=g,s;const o=a.charCodeAt(_);56320<=o&&o<=57343?h[s++]=1024*(g-55296)+o-56320+65536:(h[s++]=g,h[s++]=o)}else g!==65279&&(h[s++]=g)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let s,c,_,g,o=0,e=0,r=0;if(this.interim[0]){let d=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let f,C=0;for(;(f=63&this.interim[++C])&&C<4;)S<<=6,S|=f;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=u-C;for(;r<m;){if(r>=l)return 0;if(f=a[r++],(192&f)!=128){r--,d=!0;break}this.interim[C++]=f,S<<=6,S|=63&f}d||(u===2?S<128?r--:h[o++]=S:u===3?S<2048||S>=55296&&S<=57343||S===65279||(h[o++]=S):S<65536||S>1114111||(h[o++]=S)),this.interim.fill(0)}const i=l-4;let n=r;for(;n<l;){for(;!(!(n<i)||128&(s=a[n])||128&(c=a[n+1])||128&(_=a[n+2])||128&(g=a[n+3]));)h[o++]=s,h[o++]=c,h[o++]=_,h[o++]=g,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(e=(31&s)<<6|63&c,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(_=a[n++],(192&_)!=128){n--;continue}if(e=(15&s)<<12|(63&c)<<6|63&_,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(_=a[n++],(192&_)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=_,o;if(g=a[n++],(192&g)!=128){n--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&_)<<6|63&g,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),l=[[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]],s=[[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 c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let _=0;_<l.length;++_)c.fill(0,l[_][0],l[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?c[_]:function(g,o){let e,r=0,i=o.length-1;if(g<o[0][0]||g>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,g>o[e][1])r=e+1;else{if(!(g<o[e][0]))return!0;i=e-1}return!1}(_,s)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,g){let o=this.wcwidth(_),e=o===0&&g!==0;if(e){const r=h.UnicodeService.extractWidth(g);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class s extends l.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,g){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(g),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(g)}_innerWrite(_=0,g=!0){const o=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,g);if(r){const n=d=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(o,d);return void r.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(n)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=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()}}t.WriteBuffer=s},5941:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const a=/^([\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})$/,h=/^[\da-f]+$/;function l(s,c){const _=s.toString(16),g=_.length<2?"0"+_:_;switch(c){case 4:return _[0];case 8:return g;case 12:return(g+g).slice(0,3);default:return g+g}}t.parseColor=function(s){if(!s)return;let c=s.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const _=a.exec(c);if(_){const g=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/g*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/g*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/g*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const _=c.length/3,g=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(_*o,_*o+_),16);g[o]=_===1?e<<4:_===2?e:_===3?e>>4:e>>8}return g}},t.toRgbString=function(s,c=16){const[_,g,o]=s;return`rgb:${l(_,c)}/${l(g,c)}/${l(o,c)}`}},5770:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),l=a(8742),s=a(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(g,o){this._handlers[g]===void 0&&(this._handlers[g]=[]);const e=this._handlers[g];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}reset(){if(this._active.length)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].unhook(!1);this._stack.paused=!1,this._active=c,this._ident=0}hook(g,o){if(this.reset(),this._ident=g,this._active=this._handlers[g]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(g,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(g,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(g,o,e))}unhook(g,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(g),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",g);this._active=c,this._ident=0}};const _=new l.Params;_.addParam(0),t.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=_,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():_,this._data="",this._hitLimit=!1}put(g,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(g,o,e),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let o=!1;if(this._hitLimit)o=!1;else if(g&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then(e=>(this._params=_,this._data="",this._hitLimit=!1,e));return this._params=_,this._data="",this._hitLimit=!1,o}}},2015:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),l=a(8742),s=a(6242),c=a(6351);class _{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,n,d){this.table[i<<8|r]=n<<4|d}addMany(r,i,n,d){for(let S=0;S<r.length;S++)this.table[i<<8|r[S]]=n<<4|d}}t.TransitionTable=_;const g=160;t.VT500_TRANSITION_TABLE=function(){const e=new _(4095),r=Array.apply(null,Array(256)).map((C,u)=>u),i=(C,u)=>r.slice(C,u),n=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const S=i(0,14);let f;for(f in e.setDefault(1,0),e.addMany(n,0,2,0),S)e.addMany([24,26,153,154],f,3,0),e.addMany(i(128,144),f,3,0),e.addMany(i(144,152),f,3,0),e.add(156,f,0,0),e.add(27,f,11,1),e.add(157,f,4,8),e.addMany([152,158,159],f,0,7),e.add(155,f,11,3),e.add(144,f,11,9);return e.addMany(d,0,3,0),e.addMany(d,1,3,1),e.add(127,1,0,1),e.addMany(d,8,0,8),e.addMany(d,3,3,3),e.add(127,3,0,3),e.addMany(d,4,3,4),e.add(127,4,0,4),e.addMany(d,6,3,6),e.addMany(d,5,3,5),e.add(127,5,0,5),e.addMany(d,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(d,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(d,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(d,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(d,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(d,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(d,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(g,0,2,0),e.add(g,8,5,8),e.add(g,6,0,6),e.add(g,11,0,11),e.add(g,13,13,13),e}();class o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,d)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(r,i=[64,126]){let n=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=r.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<r.intermediates.length;++S){const f=r.intermediates.charCodeAt(S);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=f}}if(r.final.length!==1)throw new Error("final must be a single byte");const d=r.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=d,n}identToString(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const n=this._identifier(r,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);const d=this._escHandlers[n];return d.push(i),{dispose:()=>{const S=d.indexOf(i);S!==-1&&d.splice(S,1)}}}clearEscHandler(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const n=this._identifier(r);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);const d=this._csiHandlers[n];return d.push(i),{dispose:()=>{const S=d.indexOf(i);S!==-1&&d.splice(S,1)}}}clearCsiHandler(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(r,i,n,d,S){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=d,this._parseStack.chunkPos=S}parse(r,i,n){let d,S=0,f=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const u=this._parseStack.handlers;let m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&m>-1){for(;m>=0&&(d=u[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._parseStack.handlerPos=m,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&m>-1){for(;m>=0&&(d=u[m](),d!==!0);m--)if(d instanceof Promise)return this._parseStack.handlerPos=m,d}this._parseStack.handlers=[];break;case 6:if(S=r[this._parseStack.chunkPos],d=this._dcsParser.unhook(S!==24&&S!==26,n),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=r[this._parseStack.chunkPos],d=this._oscParser.end(S!==24&&S!==26,n),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let u=C;u<i;++u){switch(S=r[u],f=this._transitions.table[this.currentState<<8|(S<160?S:g)],f>>4){case 2:for(let x=u+1;;++x){if(x>=i||(S=r[x])<32||S>126&&S<g){this._printHandler(r,u,x),u=x-1;break}if(++x>=i||(S=r[x])<32||S>126&&S<g){this._printHandler(r,u,x),u=x-1;break}if(++x>=i||(S=r[x])<32||S>126&&S<g){this._printHandler(r,u,x),u=x-1;break}if(++x>=i||(S=r[x])<32||S>126&&S<g){this._printHandler(r,u,x),u=x-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const m=this._csiHandlers[this._collect<<8|S];let w=m?m.length-1:-1;for(;w>=0&&(d=m[w](this._params),d!==!0);w--)if(d instanceof Promise)return this._preserveStack(3,m,w,f,u),d;w<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++u<i&&(S=r[u])>47&&S<60);u--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const k=this._escHandlers[this._collect<<8|S];let E=k?k.length-1:-1;for(;E>=0&&(d=k[E](),d!==!0);E--)if(d instanceof Promise)return this._preserveStack(4,k,E,f,u),d;E<0&&this._escHandlerFb(this._collect<<8|S),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|S,this._params);break;case 13:for(let x=u+1;;++x)if(x>=i||(S=r[x])===24||S===26||S===27||S>127&&S<g){this._dcsParser.put(r,u,x),u=x-1;break}break;case 14:if(d=this._dcsParser.unhook(S!==24&&S!==26),d)return this._preserveStack(6,[],0,f,u),d;S===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let x=u+1;;x++)if(x>=i||(S=r[x])<32||S>127&&S<g){this._oscParser.put(r,u,x),u=x-1;break}break;case 6:if(d=this._oscParser.end(S!==24&&S!==26),d)return this._preserveStack(5,[],0,f,u),d;S===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&f}}}t.EscapeSequenceParser=o},6242:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,_){this._handlers[c]===void 0&&(this._handlers[c]=[]);const g=this._handlers[c];return g.push(_),{dispose:()=>{const o=g.indexOf(_);o!==-1&&g.splice(o,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,_,g){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,_,g);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,_,g))}start(){this.reset(),this._state=1}put(c,_,g){if(this._state!==3){if(this._state===1)for(;_<g;){const o=c[_++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&g-_>0&&this._put(c,_,g)}}end(c,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,g=_,e=this._stack.fallThrough,this._stack.paused=!1),!e&&g===!1){for(;o>=0&&(g=this._active[o].end(c),g!==!0);o--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,g;o--}for(;o>=0;o--)if(g=this._active[o].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",c);this._active=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,_,g){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,_,g),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let _=!1;if(this._hitLimit)_=!1;else if(c&&(_=this._handler(this._data),_ instanceof Promise))return _.then(g=>(this._data="",this._hitLimit=!1,g));return this._data="",this._hitLimit=!1,_}}},8742:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(s){const c=new h;if(!s.length)return c;for(let _=Array.isArray(s[0])?1:0;_<s.length;++_){const g=s[_];if(Array.isArray(g))for(let o=0;o<g.length;++o)c.addSubParam(g[o]);else c.addParam(g)}return c}constructor(s=32,c=32){if(this.maxLength=s,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new h(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let c=0;c<this.length;++c){s.push(this.params[c]);const _=this._subParamsIdx[c]>>8,g=255&this._subParamsIdx[c];g-_>0&&s.push(Array.prototype.slice.call(this._subParams,_,g))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>a?a:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>a?a:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const c=this._subParamsIdx[s]>>8,_=255&this._subParamsIdx[s];return _-c>0?this._subParams.subarray(c,_):null}getSubParamsAll(){const s={};for(let c=0;c<this.length;++c){const _=this._subParamsIdx[c]>>8,g=255&this._subParamsIdx[c];g-_>0&&(s[c]=this._subParams.slice(_,g))}return s}addDigit(s){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,g=_[c-1];_[c-1]=~g?Math.min(10*g+s,a):s}}t.Params=h},5741:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(s,c){this._buffer=s,this.type=c}init(s){return this._buffer=s,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(s){const c=this._buffer.lines.get(s);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,s){if(!(l<0||l>=this._line.length))return s?(this._line.loadCell(l,s),s):this._line.loadCell(l,new h.CellData)}translateToString(l,s,c){return this._line.translateToString(l,s,c)}}},8285:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),s=a(844);class c extends s.Disposable{constructor(g){super(),this._core=g,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.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)}}t.BufferNamespaceApi=c},7975:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,l=>h(l.toArray()))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,(l,s)=>h(l,s.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,n){var d,S=arguments.length,f=S<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,r,i,n);else for(var C=e.length-1;C>=0;C--)(d=e[C])&&(f=(S<3?d(f):S>3?d(r,i,f):d(r,i))||f);return S>3&&f&&Object.defineProperty(r,i,f),f},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=a(8460),c=a(844),_=a(5295),g=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){const i=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=i.getBlankLine(e,r),this._cachedBlankLine=n),n.isWrapped=r;const d=i.ybase+i.scrollTop,S=i.ybase+i.scrollBottom;if(i.scrollTop===0){const f=i.lines.isFull;S===i.lines.length-1?f?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(S+1,0,n.clone()),f?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const f=S-d+1;i.lines.shiftElements(d+1,f-1,-1),i.lines.set(S,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const d=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),d!==n.ydisp&&(r||this._onScroll.fire(n.ydisp))}};t.BufferService=o=h([l(0,g.IOptionsService)],o)},7994:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(M,t,a){var h=this&&this.__decorate||function(n,d,S,f){var C,u=arguments.length,m=u<3?d:f===null?f=Object.getOwnPropertyDescriptor(d,S):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,d,S,f);else for(var w=n.length-1;w>=0;w--)(C=n[w])&&(m=(u<3?C(m):u>3?C(d,S,m):C(d,S))||m);return u>3&&m&&Object.defineProperty(d,S,m),m},l=this&&this.__param||function(n,d){return function(S,f){d(S,f,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=a(2585),c=a(8460),_=a(844),g={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function o(n,d){let S=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(S|=64,S|=n.action):(S|=3&n.button,4&n.button&&(S|=64),8&n.button&&(S|=128),n.action===32?S|=32:n.action!==0||d||(S|=3)),S}const e=String.fromCharCode,r={DEFAULT:n=>{const d=[o(n,!1)+32,n.col+32,n.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${e(d[0])}${e(d[1])}${e(d[2])}`},SGR:n=>{const d=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.col};${n.row}${d}`},SGR_PIXELS:n=>{const d=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.x};${n.y}${d}`}};let i=t.CoreMouseService=class extends _.Disposable{constructor(n,d){super(),this._bufferService=n,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const S of Object.keys(g))this.addProtocol(S,g[S]);for(const S of Object.keys(r))this.addEncoding(S,r[S]);this.reset()}addProtocol(n,d){this._protocols[n]=d}addEncoding(n,d){this._encodings[n]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw new Error(`unknown protocol "${n}"`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw new Error(`unknown encoding "${n}"`);this._activeEncoding=n}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(n))return!1;const d=this._encodings[this._activeEncoding](n);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,d,S){if(S){if(n.x!==d.x||n.y!==d.y)return!1}else if(n.col!==d.col||n.row!==d.row)return!1;return n.button===d.button&&n.action===d.action&&n.ctrl===d.ctrl&&n.alt===d.alt&&n.shift===d.shift}};t.CoreMouseService=i=h([l(0,s.IBufferService),l(1,s.ICoreService)],i)},6975:function(M,t,a){var h=this&&this.__decorate||function(i,n,d,S){var f,C=arguments.length,u=C<3?n:S===null?S=Object.getOwnPropertyDescriptor(n,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,n,d,S);else for(var m=i.length-1;m>=0;m--)(f=i[m])&&(u=(C<3?f(u):C>3?f(n,d,u):f(n,d))||u);return C>3&&u&&Object.defineProperty(n,d,u),u},l=this&&this.__param||function(i,n){return function(d,S){n(d,S,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=a(1439),c=a(8460),_=a(844),g=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let r=t.CoreService=class extends _.Disposable{constructor(i,n,d){super(),this._bufferService=i,this._logService=n,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,n=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(S=>S.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(n=>n.charCodeAt(0))),this._onBinary.fire(i))}};t.CoreService=r=h([l(0,g.IBufferService),l(1,g.ILogService),l(2,g.IOptionsService)],r)},9074:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),s=a(844),c=a(6106);let _=0,g=0;class o extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,s.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const n=new e(i);if(n){const d=n.marker.onDispose(()=>n.dispose());n.onDispose(()=>{n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),d.dispose())}),this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,n,d){let S=0,f=0;for(const C of this._decorations.getKeyIterator(n))S=C.options.x??0,f=S+(C.options.width??1),i>=S&&i<f&&(!d||(C.options.layer??"bottom")===d)&&(yield C)}forEachDecorationAtCell(i,n,d,S){this._decorations.forEachByKey(n,f=>{_=f.options.x??0,g=_+(f.options.width??1),i>=_&&i<g&&(!d||(f.options.layer??"bottom")===d)&&S(f)})}}t.DecorationService=o;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class s{constructor(..._){this._entries=new Map;for(const[g,o]of _)this.set(g,o)}set(_,g){const o=this._entries.get(_);return this._entries.set(_,g),o}forEach(_){for(const[g,o]of this._entries.entries())_(g,o)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}t.ServiceCollection=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(h.IInstantiationService,this)}setService(c,_){this._services.set(c,_)}getService(c){return this._services.get(c)}createInstance(c,..._){const g=(0,l.getServiceDependencies)(c).sort((r,i)=>r.index-i.index),o=[];for(const r of g){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=g.length>0?g[0].index:_.length;if(_.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${_.length} static arguments`);return new c(..._,...o)}}},7866:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,n){var d,S=arguments.length,f=S<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,r,i,n);else for(var C=e.length-1;C>=0;C--)(d=e[C])&&(f=(S<3?d(f):S>3?d(r,i,f):d(r,i))||f);return S>3&&f&&Object.defineProperty(r,i,f),f},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(844),c=a(2585),_={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let g,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),g=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){g=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(...d){if(g.logLevel!==c.LogLevelEnum.TRACE)return n.apply(this,d);g.trace(`GlyphRenderer#${n.name}(${d.map(f=>JSON.stringify(f)).join(", ")})`);const S=n.apply(this,d);return g.trace(`GlyphRenderer#${n.name} return`,S),S}}},7302:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),s=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(r=>{r===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(r=>{o.indexOf(r)!==-1&&e()})}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(r){return r==="block"||r==="underline"||r==="bar"}(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=_},2660:function(M,t,a){var h=this&&this.__decorate||function(_,g,o,e){var r,i=arguments.length,n=i<3?g:e===null?e=Object.getOwnPropertyDescriptor(g,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(_,g,o,e);else for(var d=_.length-1;d>=0;d--)(r=_[d])&&(n=(i<3?r(n):i>3?r(g,o,n):r(g,o))||n);return i>3&&n&&Object.defineProperty(g,o,n),n},l=this&&this.__param||function(_,g){return function(o,e){g(o,e,_)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=a(2585);let c=t.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const g=this._bufferService.buffer;if(_.id===void 0){const d=g.addMarker(g.ybase+g.y),S={data:_,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(S,d)),this._dataByLinkId.set(S.id,S),S.id}const o=_,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,g.ybase+g.y),r.id;const i=g.addMarker(g.ybase+g.y),n={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(n,i)),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(_,g){const o=this._dataByLinkId.get(_);if(o&&o.lines.every(e=>e.line!==g)){const e=this._bufferService.buffer.addMarker(g);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(_){var g;return(g=this._dataByLinkId.get(_))==null?void 0:g.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,g){const o=_.lines.indexOf(g);o!==-1&&(_.lines.splice(o,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};t.OscLinkService=c=h([l(0,s.IBufferService)],c)},8343:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(c,_,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,c,g)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},2585:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class s{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,g,o=!1){return(16777215&_)<<3|(3&g)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const _=new l.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let g=0,o=0;const e=_.length;for(let r=0;r<e;++r){let i=_.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return g+this.wcwidth(i);const S=_.charCodeAt(r);56320<=S&&S<=57343?i=1024*(i-55296)+S-56320+65536:g+=this.wcwidth(S)}const n=this.charProperties(i,o);let d=s.extractWidth(n);s.extractShouldJoin(n)&&(d-=s.extractWidth(o)),g+=d,o=n}return g}charProperties(_,g){return this._activeProvider.charProperties(_,g)}}t.UnicodeService=s}},L={};function A(M){var t=L[M];if(t!==void 0)return t.exports;var a=L[M]={exports:{}};return b[M].call(a.exports,a,a.exports,A),a.exports}var I={};return(()=>{var M=I;Object.defineProperty(M,"__esModule",{value:!0}),M.Terminal=void 0;const t=A(9042),a=A(3236),h=A(844),l=A(5741),s=A(8285),c=A(7975),_=A(7090),g=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],n=(d,S)=>{this._checkReadonlyOptions(d),this._core.options[d]=S};for(const d in this._core.options){const S={get:i.bind(this,d),set:n.bind(this,d)};Object.defineProperty(this._publicOptions,d,S)}}_checkReadonlyOptions(r){if(g.includes(r))throw new Error(`Option "${r}" 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 c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.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 s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,n){this._verifyIntegers(r,i,n),this._core.select(r,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
17
+ `,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}M.Terminal=o})(),I})())})(wi);var Ms=wi.exports,Ei={exports:{}};(function(p,v){(function(b,L){p.exports=L()})(self,()=>(()=>{var b={};return(()=>{var L=b;Object.defineProperty(L,"__esModule",{value:!0}),L.FitAddon=void 0,L.FitAddon=class{activate(A){this._terminal=A}dispose(){}fit(){const A=this.proposeDimensions();if(!A||!this._terminal||isNaN(A.cols)||isNaN(A.rows))return;const I=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||(I._renderService.clear(),this._terminal.resize(A.cols,A.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const A=this._terminal._core,I=A._renderService.dimensions;if(I.css.cell.width===0||I.css.cell.height===0)return;const M=this._terminal.options.scrollback===0?0:A.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),s=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-M;return{cols:Math.max(2,Math.floor(c/I.css.cell.width)),rows:Math.max(1,Math.floor(s/I.css.cell.height))}}}})(),b})())})(Ei);var Ts=Ei.exports,Li={exports:{}};(function(p,v){(function(b,L){p.exports=L()})(self,()=>(()=>{var b={965:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),s=a(855),c=a(859),_=a(381),g=11,o=g*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,n=0;class d extends c.Disposable{constructor(f,C,u,m){super(),this._terminal=f,this._gl=C,this._dimensions=u,this._optionsService=m,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const w=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(w.getParameter(w.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(w.getParameter(w.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,_.createProgram)(w,`#version 300 es
18
+ layout (location = 0) in vec2 a_unitquad;
19
+ layout (location = 1) in vec2 a_cellpos;
20
+ layout (location = 2) in vec2 a_offset;
21
+ layout (location = 3) in vec2 a_size;
22
+ layout (location = 4) in float a_texpage;
23
+ layout (location = 5) in vec2 a_texcoord;
24
+ layout (location = 6) in vec2 a_texsize;
25
+
26
+ uniform mat4 u_projection;
27
+ uniform vec2 u_resolution;
28
+
29
+ out vec2 v_texcoord;
30
+ flat out int v_texpage;
31
+
32
+ void main() {
33
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
34
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
35
+ v_texpage = int(a_texpage);
36
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
37
+ }`,function($){let N="";for(let H=1;H<$;H++)N+=` else if (v_texpage == ${H}) { outColor = texture(u_texture[${H}], v_texcoord); }`;return`#version 300 es
38
+ precision lowp float;
39
+
40
+ in vec2 v_texcoord;
41
+ flat in int v_texpage;
42
+
43
+ uniform sampler2D u_texture[${$}];
44
+
45
+ out vec4 outColor;
46
+
47
+ void main() {
48
+ if (v_texpage == 0) {
49
+ outColor = texture(u_texture[0], v_texcoord);
50
+ } ${N}
51
+ }`}(l.TextureAtlas.maxAtlasPages))),this.register((0,c.toDisposable)(()=>w.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(w.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=w.createVertexArray(),w.bindVertexArray(this._vertexArrayObject);const k=new Float32Array([0,0,1,0,0,1,1,1]),E=w.createBuffer();this.register((0,c.toDisposable)(()=>w.deleteBuffer(E))),w.bindBuffer(w.ARRAY_BUFFER,E),w.bufferData(w.ARRAY_BUFFER,k,w.STATIC_DRAW),w.enableVertexAttribArray(0),w.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const x=new Uint8Array([0,1,2,3]),T=w.createBuffer();this.register((0,c.toDisposable)(()=>w.deleteBuffer(T))),w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,T),w.bufferData(w.ELEMENT_ARRAY_BUFFER,x,w.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(w.createBuffer()),this.register((0,c.toDisposable)(()=>w.deleteBuffer(this._attributesBuffer))),w.bindBuffer(w.ARRAY_BUFFER,this._attributesBuffer),w.enableVertexAttribArray(2),w.vertexAttribPointer(2,2,w.FLOAT,!1,o,0),w.vertexAttribDivisor(2,1),w.enableVertexAttribArray(3),w.vertexAttribPointer(3,2,w.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(3,1),w.enableVertexAttribArray(4),w.vertexAttribPointer(4,1,w.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(4,1),w.enableVertexAttribArray(5),w.vertexAttribPointer(5,2,w.FLOAT,!1,o,5*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(5,1),w.enableVertexAttribArray(6),w.vertexAttribPointer(6,2,w.FLOAT,!1,o,7*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(6,1),w.enableVertexAttribArray(1),w.vertexAttribPointer(1,2,w.FLOAT,!1,o,9*Float32Array.BYTES_PER_ELEMENT),w.vertexAttribDivisor(1,1),w.useProgram(this._program);const F=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++)F[$]=$;w.uniform1iv(this._textureLocation,F),w.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),this._atlasTextures=[];for(let $=0;$<l.TextureAtlas.maxAtlasPages;$++){const N=new _.GLTexture((0,h.throwIfFalsy)(w.createTexture()));this.register((0,c.toDisposable)(()=>w.deleteTexture(N.texture))),w.activeTexture(w.TEXTURE0+$),w.bindTexture(w.TEXTURE_2D,N.texture),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE),w.texImage2D(w.TEXTURE_2D,0,w.RGBA,1,1,0,w.RGBA,w.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[$]=N}w.enable(w.BLEND),w.blendFunc(w.SRC_ALPHA,w.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(f,C,u,m,w,k,E,x,T){this._updateCell(this._vertices.attributes,f,C,u,m,w,k,E,x,T)}_updateCell(f,C,u,m,w,k,E,x,T,F){r=(u*this._terminal.cols+C)*g,m!==s.NULL_CELL_CODE&&m!==void 0?this._atlas&&(e=x&&x.length>1?this._atlas.getRasterizedGlyphCombinedChar(x,w,k,E,!1):this._atlas.getRasterizedGlyph(m,w,k,E,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),w!==F&&e.offset.x>i?(n=e.offset.x-i,f[r]=-(e.offset.x-n)+this._dimensions.device.char.left,f[r+1]=-e.offset.y+this._dimensions.device.char.top,f[r+2]=(e.size.x-n)/this._dimensions.device.canvas.width,f[r+3]=e.size.y/this._dimensions.device.canvas.height,f[r+4]=e.texturePage,f[r+5]=e.texturePositionClipSpace.x+n/this._atlas.pages[e.texturePage].canvas.width,f[r+6]=e.texturePositionClipSpace.y,f[r+7]=e.sizeClipSpace.x-n/this._atlas.pages[e.texturePage].canvas.width,f[r+8]=e.sizeClipSpace.y):(f[r]=-e.offset.x+this._dimensions.device.char.left,f[r+1]=-e.offset.y+this._dimensions.device.char.top,f[r+2]=e.size.x/this._dimensions.device.canvas.width,f[r+3]=e.size.y/this._dimensions.device.canvas.height,f[r+4]=e.texturePage,f[r+5]=e.texturePositionClipSpace.x,f[r+6]=e.texturePositionClipSpace.y,f[r+7]=e.sizeClipSpace.x,f[r+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(m,T,e.size.x,this._dimensions.device.cell.width)&&(f[r+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):f.fill(0,r,r+g-1-2)}clear(){const f=this._terminal,C=f.cols*f.rows*g;this._vertices.count!==C?this._vertices.attributes=new Float32Array(C):this._vertices.attributes.fill(0);let u=0;for(;u<this._vertices.attributesBuffers.length;u++)this._vertices.count!==C?this._vertices.attributesBuffers[u]=new Float32Array(C):this._vertices.attributesBuffers[u].fill(0);this._vertices.count=C,u=0;for(let m=0;m<f.rows;m++)for(let w=0;w<f.cols;w++)this._vertices.attributes[u+9]=w/f.cols,this._vertices.attributes[u+10]=m/f.rows,u+=g}handleResize(){const f=this._gl;f.useProgram(this._program),f.viewport(0,0,f.canvas.width,f.canvas.height),f.uniform2f(this._resolutionLocation,f.canvas.width,f.canvas.height),this.clear()}render(f){if(!this._atlas)return;const C=this._gl;C.useProgram(this._program),C.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const u=this._vertices.attributesBuffers[this._activeBuffer];let m=0;for(let w=0;w<f.lineLengths.length;w++){const k=w*this._terminal.cols*g,E=this._vertices.attributes.subarray(k,k+f.lineLengths[w]*g);u.set(E,m),m+=E.length}C.bindBuffer(C.ARRAY_BUFFER,this._attributesBuffer),C.bufferData(C.ARRAY_BUFFER,u.subarray(0,m),C.STREAM_DRAW);for(let w=0;w<this._atlas.pages.length;w++)this._atlas.pages[w].version!==this._atlasTextures[w].version&&this._bindAtlasPageTexture(C,this._atlas,w);C.drawElementsInstanced(C.TRIANGLE_STRIP,4,C.UNSIGNED_BYTE,0,m/g)}setAtlas(f){this._atlas=f;for(const C of this._atlasTextures)C.version=-1}_bindAtlasPageTexture(f,C,u){f.activeTexture(f.TEXTURE0+u),f.bindTexture(f.TEXTURE_2D,this._atlasTextures[u].texture),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,C.pages[u].canvas),f.generateMipmap(f.TEXTURE_2D),this._atlasTextures[u].version=C.pages[u].version}setDimensions(f){this._dimensions=f}}t.GlyphRenderer=d},742:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),l=a(859),s=a(310),c=a(381),_=8*Float32Array.BYTES_PER_ELEMENT;class g{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,r=0,i=0,n=0,d=0,S=0;class f extends l.Disposable{constructor(u,m,w,k){super(),this._terminal=u,this._gl=m,this._dimensions=w,this._themeService=k,this._vertices=new g,this._verticesCursor=new g;const E=this._gl;this._program=(0,h.throwIfFalsy)((0,c.createProgram)(E,`#version 300 es
52
+ layout (location = 0) in vec2 a_position;
53
+ layout (location = 1) in vec2 a_size;
54
+ layout (location = 2) in vec4 a_color;
55
+ layout (location = 3) in vec2 a_unitquad;
56
+
57
+ uniform mat4 u_projection;
58
+
59
+ out vec4 v_color;
60
+
61
+ void main() {
62
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
63
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
64
+ v_color = a_color;
65
+ }`,`#version 300 es
66
+ precision lowp float;
67
+
68
+ in vec4 v_color;
69
+
70
+ out vec4 outColor;
71
+
72
+ void main() {
73
+ outColor = v_color;
74
+ }`)),this.register((0,l.toDisposable)(()=>E.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(E.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=E.createVertexArray(),E.bindVertexArray(this._vertexArrayObject);const x=new Float32Array([0,0,1,0,0,1,1,1]),T=E.createBuffer();this.register((0,l.toDisposable)(()=>E.deleteBuffer(T))),E.bindBuffer(E.ARRAY_BUFFER,T),E.bufferData(E.ARRAY_BUFFER,x,E.STATIC_DRAW),E.enableVertexAttribArray(3),E.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),$=E.createBuffer();this.register((0,l.toDisposable)(()=>E.deleteBuffer($))),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,$),E.bufferData(E.ELEMENT_ARRAY_BUFFER,F,E.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(E.createBuffer()),this.register((0,l.toDisposable)(()=>E.deleteBuffer(this._attributesBuffer))),E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.enableVertexAttribArray(0),E.vertexAttribPointer(0,2,E.FLOAT,!1,_,0),E.vertexAttribDivisor(0,1),E.enableVertexAttribArray(1),E.vertexAttribPointer(1,2,E.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),E.vertexAttribDivisor(1,1),E.enableVertexAttribArray(2),E.vertexAttribPointer(2,4,E.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),E.vertexAttribDivisor(2,1),this._updateCachedColors(k.colors),this.register(this._themeService.onChangeColors(N=>{this._updateCachedColors(N),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(u){const m=this._gl;m.useProgram(this._program),m.bindVertexArray(this._vertexArrayObject),m.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.bufferData(m.ARRAY_BUFFER,u.attributes,m.DYNAMIC_DRAW),m.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,m.UNSIGNED_BYTE,0,u.count)}handleResize(){this._updateViewportRectangle()}setDimensions(u){this._dimensions=u}_updateCachedColors(u){this._bgFloat=this._colorToFloat32Array(u.background),this._cursorFloat=this._colorToFloat32Array(u.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(u){const m=this._terminal,w=this._vertices;let k,E,x,T,F,$,N,H,y,D,B,P=1;for(k=0;k<m.rows;k++){for(x=-1,T=0,F=0,$=!1,E=0;E<m.cols;E++)N=(k*m.cols+E)*s.RENDER_MODEL_INDICIES_PER_CELL,H=u.cells[N+s.RENDER_MODEL_BG_OFFSET],y=u.cells[N+s.RENDER_MODEL_FG_OFFSET],D=!!(67108864&y),(H!==T||y!==F&&($||D))&&((T!==0||$&&F!==0)&&(B=8*P++,this._updateRectangle(w,B,F,T,x,E,k)),x=E,T=H,F=y,$=D);(T!==0||$&&F!==0)&&(B=8*P++,this._updateRectangle(w,B,F,T,x,m.cols,k))}w.count=P}updateCursor(u){const m=this._verticesCursor,w=u.cursor;if(!w||w.style==="block")return void(m.count=0);let k,E=0;w.style!=="bar"&&w.style!=="outline"||(k=8*E++,this._addRectangleFloat(m.attributes,k,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.style==="bar"?w.dpr*w.cursorWidth:w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),w.style!=="underline"&&w.style!=="outline"||(k=8*E++,this._addRectangleFloat(m.attributes,k,w.x*this._dimensions.device.cell.width,(w.y+1)*this._dimensions.device.cell.height-w.dpr,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat)),w.style==="outline"&&(k=8*E++,this._addRectangleFloat(m.attributes,k,w.x*this._dimensions.device.cell.width,w.y*this._dimensions.device.cell.height,w.width*this._dimensions.device.cell.width,w.dpr,this._cursorFloat),k=8*E++,this._addRectangleFloat(m.attributes,k,(w.x+w.width)*this._dimensions.device.cell.width-w.dpr,w.y*this._dimensions.device.cell.height,w.dpr,this._dimensions.device.cell.height,this._cursorFloat)),m.count=E}_updateRectangle(u,m,w,k,E,x,T){if(67108864&w)switch(50331648&w){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&w].rgba;break;case 50331648:o=(16777215&w)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&k){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&k].rgba;break;case 50331648:o=(16777215&k)<<8;break;default:o=this._themeService.colors.background.rgba}u.attributes.length<m+4&&(u.attributes=(0,c.expandFloat32Array)(u.attributes,this._terminal.rows*this._terminal.cols*8)),e=E*this._dimensions.device.cell.width,r=T*this._dimensions.device.cell.height,i=(o>>24&255)/255,n=(o>>16&255)/255,d=(o>>8&255)/255,S=1,this._addRectangle(u.attributes,m,e,r,(x-E)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,n,d,S)}_addRectangle(u,m,w,k,E,x,T,F,$,N){u[m]=w/this._dimensions.device.canvas.width,u[m+1]=k/this._dimensions.device.canvas.height,u[m+2]=E/this._dimensions.device.canvas.width,u[m+3]=x/this._dimensions.device.canvas.height,u[m+4]=T,u[m+5]=F,u[m+6]=$,u[m+7]=N}_addRectangleFloat(u,m,w,k,E,x,T){u[m]=w/this._dimensions.device.canvas.width,u[m+1]=k/this._dimensions.device.canvas.height,u[m+2]=E/this._dimensions.device.canvas.width,u[m+3]=x/this._dimensions.device.canvas.height,u[m+4]=T[0],u[m+5]=T[1],u[m+6]=T[2],u[m+7]=T[3]}_colorToFloat32Array(u){return new Float32Array([(u.rgba>>24&255)/255,(u.rgba>>16&255)/255,(u.rgba>>8&255)/255,(255&u.rgba)/255])}}t.RectangleRenderer=f},310:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,s){const c=l*s*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),s=a(627),c=a(457),_=a(56),g=a(374),o=a(345),e=a(859),r=a(147),i=a(782),n=a(855),d=a(965),S=a(742),f=a(310),C=a(733);class u extends e.Disposable{constructor(E,x,T,F,$,N,H,y,D){super(),this._terminal=E,this._characterJoinerService=x,this._charSizeService=T,this._coreBrowserService=F,this._coreService=$,this._decorationService=N,this._optionsService=H,this._themeService=y,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new f.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new C.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,H,this._themeService)],this.dimensions=(0,g.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(H.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const B={antialias:!1,depth:!1,preserveDrawingBuffer:D};if(this._gl=this._canvas.getContext("webgl2",B),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",P=>{console.log("webglcontextlost event received"),P.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(P)},3e3)})),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",P=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(P,U)=>this._setCanvasDevicePixelDimensions(P,U)),this.register(this._coreBrowserService.onWindowChange(P=>{this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,P,(U,q)=>this._setCanvasDevicePixelDimensions(U,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var P;for(const U of this._renderLayers)U.dispose();(P=this._canvas.parentElement)==null||P.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var E;return(E=this._charAtlas)==null?void 0:E.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(E,x){var T,F,$,N;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const H of this._renderLayers)H.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(T=this._rectangleRenderer.value)==null||T.setDimensions(this.dimensions),(F=this._rectangleRenderer.value)==null||F.handleResize(),($=this._glyphRenderer.value)==null||$.setDimensions(this.dimensions),(N=this._glyphRenderer.value)==null||N.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var E;for(const x of this._renderLayers)x.handleBlur(this._terminal);(E=this._cursorBlinkStateManager.value)==null||E.pause(),this._requestRedrawViewport()}handleFocus(){var E;for(const x of this._renderLayers)x.handleFocus(this._terminal);(E=this._cursorBlinkStateManager.value)==null||E.resume(),this._requestRedrawViewport()}handleSelectionChanged(E,x,T){for(const F of this._renderLayers)F.handleSelectionChanged(this._terminal,E,x,T);this._model.selection.update(this._core,E,x,T),this._requestRedrawViewport()}handleCursorMove(){var E;for(const x of this._renderLayers)x.handleCursorMove(this._terminal);(E=this._cursorBlinkStateManager.value)==null||E.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new S.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new d.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var x;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const E=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==E&&(this._onChangeTextureAtlas.fire(E.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(E.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(E.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=E,this._charAtlas.warmUp(),(x=this._glyphRenderer.value)==null||x.setAtlas(this._charAtlas)}_clearModel(E){var x;this._model.clear(),E&&((x=this._glyphRenderer.value)==null||x.clear())}clearTextureAtlas(){var E;(E=this._charAtlas)==null||E.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var E;this._clearModel(!0);for(const x of this._renderLayers)x.reset(this._terminal);(E=this._cursorBlinkStateManager.value)==null||E.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(E){return-1}deregisterCharacterJoiner(E){return!1}renderRows(E,x){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const T of this._renderLayers)T.handleGridChanged(this._terminal,E,x);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(E,x),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(E,x){const T=this._core;let F,$,N,H,y,D,B,P,U,q,Y,G,O,R,j=this._workCell;E=w(E,T.rows-1,0),x=w(x,T.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=W-T.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,T.cols-1);let ee=-1;const J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let he=!1;for($=E;$<=x;$++)for(N=$+T.buffer.ydisp,H=T.buffer.lines.get(N),this._model.lineLengths[$]=0,y=this._characterJoinerService.getJoinedCharacters(N),O=0;O<T.cols;O++)if(F=this._cellColorResolver.result.bg,H.loadCell(O,j),O===0&&(F=this._cellColorResolver.result.bg),D=!1,B=O,y.length>0&&O===y[0][0]&&(D=!0,P=y.shift(),j=new m(j,H.translateToString(!0,P[0],P[1]),P[1]-P[0]),B=P[1]-1),U=j.getChars(),q=j.getCode(),G=($*T.cols+O)*f.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(j,O,N,this.dimensions.device.cell.width),J&&N===W&&(O===K&&(this._model.cursor={x:K,y:V,width:j.getWidth(),style:this._coreBrowserService.isFocused?T.options.cursorStyle||"block":T.options.cursorInactiveStyle,cursorWidth:T.options.cursorWidth,dpr:this._devicePixelRatio},ee=K+j.getWidth()-1),O>=K&&O<=ee&&(this._coreBrowserService.isFocused&&(T.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&T.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==n.NULL_CELL_CODE&&(this._model.lineLengths[$]=O+1),(this._model.cells[G]!==q||this._model.cells[G+f.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[G+f.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[G+f.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(he=!0,U.length>1&&(q|=f.COMBINED_CHAR_BIT_MASK),this._model.cells[G]=q,this._model.cells[G+f.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[G+f.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[G+f.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Y=j.getWidth(),this._glyphRenderer.value.updateCell(O,$,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,Y,F),D))for(j=this._workCell,O++;O<B;O++)R=($*T.cols+O)*f.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(O,$,n.NULL_CELL_CODE,0,0,0,n.NULL_CELL_CHAR,0,0),this._model.cells[R]=n.NULL_CELL_CODE,this._model.cells[R+f.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[R+f.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[R+f.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;he&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(E,x){this._canvas.width===E&&this._canvas.height===x||(this._canvas.width=E,this._canvas.height=x,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const E=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:E,end:E})}}t.WebglRenderer=u;class m extends r.AttributeData{constructor(E,x,T){super(),this.content=0,this.combinedData="",this.fg=E.fg,this.bg=E.bg,this.combinedData=x,this._width=T}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(E){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function w(k,E,x=0){return Math.max(Math.min(k,E),x)}t.JoinedCellData=m},381:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function l(s,c,_){const g=(0,h.throwIfFalsy)(s.createShader(c));if(s.shaderSource(g,_),s.compileShader(g),s.getShaderParameter(g,s.COMPILE_STATUS))return g;console.error(s.getShaderInfoLog(g)),s.deleteShader(g)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,c,_){const g=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(g,(0,h.throwIfFalsy)(l(s,s.VERTEX_SHADER,c))),s.attachShader(g,(0,h.throwIfFalsy)(l(s,s.FRAGMENT_SHADER,_))),s.linkProgram(g),s.getProgramParameter(g,s.LINK_STATUS))return g;console.error(s.getProgramInfoLog(g)),s.deleteProgram(g)},t.createShader=l,t.expandFloat32Array=function(s,c){const _=Math.min(2*s.length,c),g=new Float32Array(_);for(let o=0;o<s.length;o++)g[o]=s[o];return g},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),s=a(374),c=a(859);class _ extends c.Disposable{constructor(o,e,r,i,n,d,S,f){super(),this._container=e,this._alpha=n,this._coreBrowserService=d,this._optionsService=S,this._themeService=f,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(C=>{this._refreshCharAtlas(o,C),this.reset(o)})),this.register((0,c.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=_},733:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),s=a(592);class c extends s.BaseRenderLayer{constructor(g,o,e,r,i,n,d){super(e,g,"link",o,!0,i,n,d),this.register(r.onShowLinkUnderline(S=>this._handleShowLinkUnderline(S))),this.register(r.onHideLinkUnderline(S=>this._handleHideLinkUnderline(S)))}resize(g,o){super.resize(g,o),this._state=void 0}reset(g){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const g=this._state.y2-this._state.y1-1;g>0&&this._clearCells(0,this._state.y1+1,this._state.cols,g),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(g){if(g.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:g.fg!==void 0&&(0,h.is256Color)(g.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[g.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,g.y1===g.y2)this._fillBottomLineAtCells(g.x1,g.y1,g.x2-g.x1);else{this._fillBottomLineAtCells(g.x1,g.y1,g.cols-g.x1);for(let o=g.y1+1;o<g.y2;o++)this._fillBottomLineAtCells(0,o,g.cols);this._fillBottomLineAtCells(0,g.y2,g.x2)}this._state=g}_handleHideLinkUnderline(g){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},274:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),s=a(374);let c,_=0,g=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(n,d,S,f,C,u){this._terminal=n,this._optionService=d,this._selectionRenderModel=S,this._decorationService=f,this._coreBrowserService=C,this._themeService=u,this.result={fg:0,bg:0,ext:0}}resolve(n,d,S,f){if(this.result.bg=n.bg,this.result.fg=n.fg,this.result.ext=268435456&n.bg?n.extended.ext:0,g=0,_=0,e=!1,o=!1,r=!1,c=this._themeService.colors,i=0,n.getCode()!==h.NULL_CELL_CODE&&n.extended.underlineStyle===4){const C=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=d*f%(2*Math.round(C))}if(this._decorationService.forEachDecorationAtCell(d,S,"bottom",C=>{C.backgroundColorRGB&&(g=C.backgroundColorRGB.rgba>>8&16777215,e=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,o=!0)}),r=this._selectionRenderModel.isCellSelected(this._terminal,d,S),r){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}g=l.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else g=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(_=c.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(n.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))_=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:_=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:_=(16777215&this.result.fg)<<8|255;break;default:_=this._themeService.colors.foreground.rgba}_=l.rgba.blend(_,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(d,S,"top",C=>{C.backgroundColorRGB&&(g=C.backgroundColorRGB.rgba>>8&16777215,e=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(g=r?-16777216&n.bg&-134217729|g|50331648:-16777216&n.bg|g|50331648),o&&(_=-16777216&n.fg&-67108865|_|50331648),67108864&this.result.fg&&(e&&!o&&(_=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648,o=!0),!e&&o&&(g=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648,e=!0)),c=void 0,this.result.bg=e?g:this.result.bg,this.result.fg=o?_:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),s=[];t.acquireTextureAtlas=function(c,_,g,o,e,r,i,n){const d=(0,l.generateConfig)(o,e,r,i,_,g,n);for(let C=0;C<s.length;C++){const u=s[C],m=u.ownedBy.indexOf(c);if(m>=0){if((0,l.configEquals)(u.config,d))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),s.splice(C,1)):u.ownedBy.splice(m,1);break}}for(let C=0;C<s.length;C++){const u=s[C];if((0,l.configEquals)(u.config,d))return u.ownedBy.push(c),u.atlas}const S=c._core,f={atlas:new h.TextureAtlas(document,d,S.unicodeService),config:d,ownedBy:[c]};return s.push(f),f.atlas},t.removeTerminalFromCache=function(c){for(let _=0;_<s.length;_++){const g=s[_].ownedBy.indexOf(c);if(g!==-1){s[_].ownedBy.length===1?(s[_].atlas.dispose(),s.splice(_,1)):s[_].ownedBy.splice(g,1);break}}}},197:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,s,c,_,g,o,e){const r={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:g.customGlyphs,devicePixelRatio:e,letterSpacing:g.letterSpacing,lineHeight:g.lineHeight,deviceCellWidth:l,deviceCellHeight:s,deviceCharWidth:c,deviceCharHeight:_,fontFamily:g.fontFamily,fontSize:g.fontSize,fontWeight:g.fontWeight,fontWeightBold:g.fontWeightBold,allowTransparency:g.allowTransparency,drawBoldTextInBrightColors:g.drawBoldTextInBrightColors,minimumContrastRatio:g.minimumContrastRatio,colors:r}},t.configEquals=function(l,s){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==s.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===s.devicePixelRatio&&l.customGlyphs===s.customGlyphs&&l.lineHeight===s.lineHeight&&l.letterSpacing===s.letterSpacing&&l.fontFamily===s.fontFamily&&l.fontSize===s.fontSize&&l.fontWeight===s.fontWeight&&l.fontWeightBold===s.fontWeightBold&&l.allowTransparency===s.allowTransparency&&l.deviceCharWidth===s.deviceCharWidth&&l.deviceCharHeight===s.deviceCharHeight&&l.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&l.minimumContrastRatio===s.minimumContrastRatio&&l.colors.foreground.rgba===s.colors.foreground.rgba&&l.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,n,d,S,f){const C=t.blockElementDefinitions[e];if(C)return function(k,E,x,T,F,$){for(let N=0;N<E.length;N++){const H=E[N],y=F/8,D=$/8;k.fillRect(x+H.x*y,T+H.y*D,H.w*y,H.h*D)}}(o,C,r,i,n,d),!0;const u=l[e];if(u)return function(k,E,x,T,F,$){let N=s.get(E);N||(N=new Map,s.set(E,N));const H=k.fillStyle;if(typeof H!="string")throw new Error(`Unexpected fillStyle type "${H}"`);let y=N.get(H);if(!y){const D=E[0].length,B=E.length,P=k.canvas.ownerDocument.createElement("canvas");P.width=D,P.height=B;const U=(0,h.throwIfFalsy)(P.getContext("2d")),q=new ImageData(D,B);let Y,G,O,R;if(H.startsWith("#"))Y=parseInt(H.slice(1,3),16),G=parseInt(H.slice(3,5),16),O=parseInt(H.slice(5,7),16),R=H.length>7&&parseInt(H.slice(7,9),16)||1;else{if(!H.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${H}" when drawing pattern glyph`);[Y,G,O,R]=H.substring(5,H.length-1).split(",").map(j=>parseFloat(j))}for(let j=0;j<B;j++)for(let W=0;W<D;W++)q.data[4*(j*D+W)]=Y,q.data[4*(j*D+W)+1]=G,q.data[4*(j*D+W)+2]=O,q.data[4*(j*D+W)+3]=E[j][W]*(255*R);U.putImageData(q,0,0),y=(0,h.throwIfFalsy)(k.createPattern(P,null)),N.set(H,y)}k.fillStyle=y,k.fillRect(x,T,F,$)}(o,u,r,i,n,d),!0;const m=t.boxDrawingDefinitions[e];if(m)return function(k,E,x,T,F,$,N){k.strokeStyle=k.fillStyle;for(const[H,y]of Object.entries(E)){let D;k.beginPath(),k.lineWidth=N*Number.parseInt(H),D=typeof y=="function"?y(.15,.15/$*F):y;for(const B of D.split(" ")){const P=B[0],U=_[P];if(!U){console.error(`Could not find drawing instructions for "${P}"`);continue}const q=B.substring(1).split(",");q[0]&&q[1]&&U(k,g(q,F,$,x,T,!0,N))}k.stroke(),k.closePath()}}(o,m,r,i,n,d,f),!0;const w=t.powerlineDefinitions[e];return!!w&&(function(k,E,x,T,F,$,N,H){const y=new Path2D;y.rect(x,T,F,$),k.clip(y),k.beginPath();const D=N/12;k.lineWidth=H*D;for(const B of E.d.split(" ")){const P=B[0],U=_[P];if(!U){console.error(`Could not find drawing instructions for "${P}"`);continue}const q=B.substring(1).split(",");q[0]&&q[1]&&U(k,g(q,F,$,x,T,!1,H,(E.leftPadding??0)*(D/2),(E.rightPadding??0)*(D/2)))}E.type===1?(k.strokeStyle=k.fillStyle,k.stroke()):k.fill(),k.closePath()}(o,w,r,i,n,d,S,f),!0)};const s=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const _={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function g(o,e,r,i,n,d,S,f=0,C=0){const u=o.map(m=>parseFloat(m)||parseInt(m));if(u.length<2)throw new Error("Too few arguments for instruction");for(let m=0;m<u.length;m+=2)u[m]*=e-f*S-C*S,d&&u[m]!==0&&(u[m]=c(Math.round(u[m]+.5)-.5,e,0)),u[m]+=i+f*S;for(let m=1;m<u.length;m+=2)u[m]*=r,d&&u[m]!==0&&(u[m]=c(Math.round(u[m]+.5)-.5,r,0)),u[m]+=n;return u}},56:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,s,c){let _=new s.ResizeObserver(g=>{const o=g.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return _==null||_.disconnect(),void(_=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)});try{_.observe(l,{box:["device-pixel-content-box"]})}catch{_.disconnect(),_=void 0}return(0,h.toDisposable)(()=>_==null?void 0:_.disconnect())}},374:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,_){return s===1&&c>Math.ceil(1.5*_)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(g){return 57344<=g&&g<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(s){return 9472<=s&&s<=9631}(l)},t.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}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},296:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,s,c,_=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const g=l.buffers.active.ydisp,o=s[1]-g,e=c[1]-g,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),s=a(374),c=a(160),_=a(345),g=a(485),o=a(385),e=a(147),r=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let n;class d{get pages(){return this._pages}constructor(m,w,k){this._document=m,this._config=w,this._unicodeService=k,this._didWarmUp=!1,this._cacheMap=new g.FourKeyMap,this._cacheMapCombined=new g.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new _.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=C(m,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const m of this.pages)m.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const m=new o.IdleTaskQueue;for(let w=33;w<126;w++)m.enqueue(()=>{if(!this._cacheMap.get(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const k=this._drawToCache(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(w,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,k)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const m of this._pages)m.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(d.maxAtlasPages&&this._pages.length>=Math.max(4,d.maxAtlasPages)){const w=this._pages.filter(N=>2*N.canvas.width<=(d.maxTextureSize||4096)).sort((N,H)=>H.canvas.width!==N.canvas.width?H.canvas.width-N.canvas.width:H.percentageUsed-N.percentageUsed);let k=-1,E=0;for(let N=0;N<w.length;N++)if(w[N].canvas.width!==E)k=N,E=w[N].canvas.width;else if(N-k==3)break;const x=w.slice(k,k+4),T=x.map(N=>N.glyphs[0].texturePage).sort((N,H)=>N>H?1:-1),F=this.pages.length-x.length,$=this._mergePages(x,F);$.version++;for(let N=T.length-1;N>=0;N--)this._deletePage(T[N]);this.pages.push($),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire($.canvas)}const m=new S(this._document,this._textureSize);return this._pages.push(m),this._activePages.push(m),this._onAddTextureAtlasCanvas.fire(m.canvas),m}_mergePages(m,w){const k=2*m[0].canvas.width,E=new S(this._document,k,m);for(const[x,T]of m.entries()){const F=x*T.canvas.width%k,$=Math.floor(x/2)*T.canvas.height;E.ctx.drawImage(T.canvas,F,$);for(const H of T.glyphs)H.texturePage=w,H.sizeClipSpace.x=H.size.x/k,H.sizeClipSpace.y=H.size.y/k,H.texturePosition.x+=F,H.texturePosition.y+=$,H.texturePositionClipSpace.x=H.texturePosition.x/k,H.texturePositionClipSpace.y=H.texturePosition.y/k;this._onRemoveTextureAtlasCanvas.fire(T.canvas);const N=this._activePages.indexOf(T);N!==-1&&this._activePages.splice(N,1)}return E}_deletePage(m){this._pages.splice(m,1);for(let w=m;w<this._pages.length;w++){const k=this._pages[w];for(const E of k.glyphs)E.texturePage--;k.version++}}getRasterizedGlyphCombinedChar(m,w,k,E,x){return this._getFromCacheMap(this._cacheMapCombined,m,w,k,E,x)}getRasterizedGlyph(m,w,k,E,x){return this._getFromCacheMap(this._cacheMap,m,w,k,E,x)}_getFromCacheMap(m,w,k,E,x,T=!1){return n=m.get(w,k,E,x),n||(n=this._drawToCache(w,k,E,x,T),m.set(w,k,E,x,n)),n}_getColorFromAnsiIndex(m){if(m>=this._config.colors.ansi.length)throw new Error("No color found for idx "+m);return this._config.colors.ansi[m]}_getBackgroundColor(m,w,k,E){if(this._config.allowTransparency)return c.NULL_COLOR;let x;switch(m){case 16777216:case 33554432:x=this._getColorFromAnsiIndex(w);break;case 50331648:const T=e.AttributeData.toColorRGB(w);x=c.channels.toColor(T[0],T[1],T[2]);break;default:x=k?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return x}_getForegroundColor(m,w,k,E,x,T,F,$,N,H){const y=this._getMinimumContrastColor(m,w,k,E,x,T,F,N,$,H);if(y)return y;let D;switch(x){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&N&&T<8&&(T+=8),D=this._getColorFromAnsiIndex(T);break;case 50331648:const B=e.AttributeData.toColorRGB(T);D=c.channels.toColor(B[0],B[1],B[2]);break;default:D=F?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(D=c.color.opaque(D)),$&&(D=c.color.multiplyOpacity(D,h.DIM_OPACITY)),D}_resolveBackgroundRgba(m,w,k){switch(m){case 16777216:case 33554432:return this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;default:return k?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(m,w,k,E){switch(m){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&E&&w<8&&(w+=8),this._getColorFromAnsiIndex(w).rgba;case 50331648:return w<<8;default:return k?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(m,w,k,E,x,T,F,$,N,H){if(this._config.minimumContrastRatio===1||H)return;const y=this._getContrastCache(N),D=y.getColor(m,E);if(D!==void 0)return D||void 0;const B=this._resolveBackgroundRgba(w,k,F),P=this._resolveForegroundRgba(x,T,F,$),U=c.rgba.ensureContrastRatio(B,P,this._config.minimumContrastRatio/(N?2:1));if(!U)return void y.setColor(m,E,null);const q=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return y.setColor(m,E,q),q}_getContrastCache(m){return m?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(m,w,k,E,x=!1){const T=typeof m=="number"?String.fromCharCode(m):m,F=Math.min(this._config.deviceCellWidth*Math.max(T.length,2)+4,this._textureSize);this._tmpCanvas.width<F&&(this._tmpCanvas.width=F);const $=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<$&&(this._tmpCanvas.height=$),this._tmpCtx.save(),this._workAttributeData.fg=k,this._workAttributeData.bg=w,this._workAttributeData.extended.ext=E,this._workAttributeData.isInvisible())return i;const N=!!this._workAttributeData.isBold(),H=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),D=!!this._workAttributeData.isItalic(),B=!!this._workAttributeData.isUnderline(),P=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),Y=this._workAttributeData.getFgColorMode(),G=this._workAttributeData.getBgColor(),O=this._workAttributeData.getBgColorMode();if(H){const X=q;q=G,G=X;const oe=Y;Y=O,O=oe}const R=this._getBackgroundColor(O,G,H,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=R.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const j=N?this._config.fontWeightBold:this._config.fontWeight,W=D?"italic":"";this._tmpCtx.font=`${W} ${j} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const V=T.length===1&&(0,s.isPowerlineGlyph)(T.charCodeAt(0)),K=T.length===1&&(0,s.isRestrictedPowerlineGlyph)(T.charCodeAt(0)),ee=this._getForegroundColor(w,O,G,k,Y,q,H,y,N,(0,s.treatGlyphAsBackgroundColor)(T.charCodeAt(0)));this._tmpCtx.fillStyle=ee.css;const J=K?0:4;let he=!1;this._config.customGlyphs!==!1&&(he=(0,l.tryDrawCustomChar)(this._tmpCtx,T,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let fe,Z=!V;if(fe=typeof m=="number"?this._unicodeService.wcwidth(m):this._unicodeService.getStringCellWidth(m),B){this._tmpCtx.save();const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),oe=X%2==1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let pe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&pe<8&&(pe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(pe).css}this._tmpCtx.beginPath();const _e=J,ue=Math.ceil(J+this._config.deviceCharHeight)-oe-(x?2*X:0),Me=ue+X,Se=ue+2*X;let Ee=this._workAttributeData.getUnderlineVariantOffset();for(let pe=0;pe<fe;pe++){this._tmpCtx.save();const de=_e+pe*this._config.deviceCellWidth,ie=_e+(pe+1)*this._config.deviceCellWidth,Je=de+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(de,ue),this._tmpCtx.lineTo(ie,ue),this._tmpCtx.moveTo(de,Se),this._tmpCtx.lineTo(ie,Se);break;case 3:const ut=X<=1?Se:Math.ceil(J+this._config.deviceCharHeight-X/2)-oe,_t=X<=1?ue:Math.ceil(J+this._config.deviceCharHeight+X/2)-oe,Qt=new Path2D;Qt.rect(de,ue,this._config.deviceCellWidth,Se-ue),this._tmpCtx.clip(Qt),this._tmpCtx.moveTo(de-this._config.deviceCellWidth/2,Me),this._tmpCtx.bezierCurveTo(de-this._config.deviceCellWidth/2,_t,de,_t,de,Me),this._tmpCtx.bezierCurveTo(de,ut,Je,ut,Je,Me),this._tmpCtx.bezierCurveTo(Je,_t,ie,_t,ie,Me),this._tmpCtx.bezierCurveTo(ie,ut,ie+this._config.deviceCellWidth/2,ut,ie+this._config.deviceCellWidth/2,Me);break;case 4:const ft=Ee===0?0:Ee>=X?2*X-Ee:X-Ee;Ee>=X||ft===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(de+ft,ue),this._tmpCtx.lineTo(ie,ue)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(de,ue),this._tmpCtx.lineTo(de+ft,ue),this._tmpCtx.moveTo(de+ft+X,ue),this._tmpCtx.lineTo(ie,ue)),Ee=(0,s.computeNextVariantOffset)(ie-de,X,Ee);break;case 5:const as=.6,hs=.3,Et=ie-de,ei=Math.floor(as*Et),ti=Math.floor(hs*Et),ls=Et-ei-ti;this._tmpCtx.setLineDash([ei,ti,ls]),this._tmpCtx.moveTo(de,ue),this._tmpCtx.lineTo(ie,ue);break;default:this._tmpCtx.moveTo(de,ue),this._tmpCtx.lineTo(ie,ue)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!he&&this._config.fontSize>=12&&!this._config.allowTransparency&&T!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const pe=this._tmpCtx.measureText(T);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in pe&&pe.actualBoundingBoxDescent>0){this._tmpCtx.save();const de=new Path2D;de.rect(_e,ue-Math.ceil(X/2),this._config.deviceCellWidth*fe,Se-ue+Math.ceil(X/2)),this._tmpCtx.clip(de),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=R.css,this._tmpCtx.strokeText(T,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),oe=X%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+oe),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*fe,J+oe),this._tmpCtx.stroke()}if(he||this._tmpCtx.fillText(T,J,J+this._config.deviceCharHeight),T==="_"&&!this._config.allowTransparency){let X=f(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),R,ee,Z);if(X)for(let oe=1;oe<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=R.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(T,J,J+this._config.deviceCharHeight-oe),X=f(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),R,ee,Z),X);oe++);}if(P){const X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),oe=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+Math.floor(this._config.deviceCharHeight/2)-oe),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*fe,J+Math.floor(this._config.deviceCharHeight/2)-oe),this._tmpCtx.stroke()}this._tmpCtx.restore();const Re=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Ke;if(Ke=this._config.allowTransparency?function(X){for(let oe=0;oe<X.data.length;oe+=4)if(X.data[oe+3]>0)return!1;return!0}(Re):f(Re,R,ee,Z),Ke)return i;const ae=this._findGlyphBoundingBox(Re,this._workBoundingBox,F,K,he,J);let se,re;for(;;){if(this._activePages.length===0){const X=this._createNewPage();se=X,re=X.currentRow,re.height=ae.size.y;break}se=this._activePages[this._activePages.length-1],re=se.currentRow;for(const X of this._activePages)ae.size.y<=X.currentRow.height&&(se=X,re=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(const oe of this._activePages[X].fixedRows)oe.height<=re.height&&ae.size.y<=oe.height&&(se=this._activePages[X],re=oe);if(re.y+ae.size.y>=se.canvas.height||re.height>ae.size.y+2){let X=!1;if(se.currentRow.y+se.currentRow.height+ae.size.y>=se.canvas.height){let oe;for(const _e of this._activePages)if(_e.currentRow.y+_e.currentRow.height+ae.size.y<_e.canvas.height){oe=_e;break}if(oe)se=oe;else if(d.maxAtlasPages&&this._pages.length>=d.maxAtlasPages&&re.y+ae.size.y<=se.canvas.height&&re.height>=ae.size.y&&re.x+ae.size.x<=se.canvas.width)X=!0;else{const _e=this._createNewPage();se=_e,re=_e.currentRow,re.height=ae.size.y,X=!0}}X||(se.currentRow.height>0&&se.fixedRows.push(se.currentRow),re={x:0,y:se.currentRow.y+se.currentRow.height,height:ae.size.y},se.fixedRows.push(re),se.currentRow={x:0,y:re.y+re.height,height:0})}if(re.x+ae.size.x<=se.canvas.width)break;re===se.currentRow?(re.x=0,re.y+=re.height,re.height=0):se.fixedRows.splice(se.fixedRows.indexOf(re),1)}return ae.texturePage=this._pages.indexOf(se),ae.texturePosition.x=re.x,ae.texturePosition.y=re.y,ae.texturePositionClipSpace.x=re.x/se.canvas.width,ae.texturePositionClipSpace.y=re.y/se.canvas.height,ae.sizeClipSpace.x/=se.canvas.width,ae.sizeClipSpace.y/=se.canvas.height,re.height=Math.max(re.height,ae.size.y),re.x+=ae.size.x,se.ctx.putImageData(Re,ae.texturePosition.x-this._workBoundingBox.left,ae.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ae.size.x,ae.size.y),se.addGlyph(ae),se.version++,ae}_findGlyphBoundingBox(m,w,k,E,x,T){w.top=0;const F=E?this._config.deviceCellHeight:this._tmpCanvas.height,$=E?this._config.deviceCellWidth:k;let N=!1;for(let H=0;H<F;H++){for(let y=0;y<$;y++){const D=H*this._tmpCanvas.width*4+4*y+3;if(m.data[D]!==0){w.top=H,N=!0;break}}if(N)break}w.left=0,N=!1;for(let H=0;H<T+$;H++){for(let y=0;y<F;y++){const D=y*this._tmpCanvas.width*4+4*H+3;if(m.data[D]!==0){w.left=H,N=!0;break}}if(N)break}w.right=$,N=!1;for(let H=T+$-1;H>=T;H--){for(let y=0;y<F;y++){const D=y*this._tmpCanvas.width*4+4*H+3;if(m.data[D]!==0){w.right=H,N=!0;break}}if(N)break}w.bottom=F,N=!1;for(let H=F-1;H>=0;H--){for(let y=0;y<$;y++){const D=H*this._tmpCanvas.width*4+4*y+3;if(m.data[D]!==0){w.bottom=H,N=!0;break}}if(N)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:w.right-w.left+1,y:w.bottom-w.top+1},sizeClipSpace:{x:w.right-w.left+1,y:w.bottom-w.top+1},offset:{x:-w.left+T+(E||x?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-w.top+T+(E||x?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=d;class S{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(m){this._glyphs.push(m),this._usedPixels+=m.size.x*m.size.y}constructor(m,w,k){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],k)for(const E of k)this._glyphs.push(...E.glyphs),this._usedPixels+=E._usedPixels;this.canvas=C(m,w,w),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function f(u,m,w,k){const E=m.rgba>>>24,x=m.rgba>>>16&255,T=m.rgba>>>8&255,F=w.rgba>>>24,$=w.rgba>>>16&255,N=w.rgba>>>8&255,H=Math.floor((Math.abs(E-F)+Math.abs(x-$)+Math.abs(T-N))/12);let y=!0;for(let D=0;D<u.data.length;D+=4)u.data[D]===E&&u.data[D+1]===x&&u.data[D+2]===T||k&&Math.abs(u.data[D]-E)+Math.abs(u.data[D+1]-x)+Math.abs(u.data[D+2]-T)<H?u.data[D+3]=0:y=!1;return y}function C(u,m,w){const k=u.createElement("canvas");return k.width=m,k.height=w,k}},160:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,s=0;var c,_,g,o,e;function r(n){const d=n.toString(16);return d.length<2?"0"+d:d}function i(n,d){return n<d?(d+.05)/(n+.05):(n+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(n){n.toCss=function(d,S,f,C){return C!==void 0?`#${r(d)}${r(S)}${r(f)}${r(C)}`:`#${r(d)}${r(S)}${r(f)}`},n.toRgba=function(d,S,f,C=255){return(d<<24|S<<16|f<<8|C)>>>0},n.toColor=function(d,S,f,C){return{css:n.toCss(d,S,f,C),rgba:n.toRgba(d,S,f,C)}}}(c||(t.channels=c={})),function(n){function d(S,f){return s=Math.round(255*f),[a,h,l]=e.toChannels(S.rgba),{css:c.toCss(a,h,l,s),rgba:c.toRgba(a,h,l,s)}}n.blend=function(S,f){if(s=(255&f.rgba)/255,s===1)return{css:f.css,rgba:f.rgba};const C=f.rgba>>24&255,u=f.rgba>>16&255,m=f.rgba>>8&255,w=S.rgba>>24&255,k=S.rgba>>16&255,E=S.rgba>>8&255;return a=w+Math.round((C-w)*s),h=k+Math.round((u-k)*s),l=E+Math.round((m-E)*s),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},n.isOpaque=function(S){return(255&S.rgba)==255},n.ensureContrastRatio=function(S,f,C){const u=e.ensureContrastRatio(S.rgba,f.rgba,C);if(u)return c.toColor(u>>24&255,u>>16&255,u>>8&255)},n.opaque=function(S){const f=(255|S.rgba)>>>0;return[a,h,l]=e.toChannels(f),{css:c.toCss(a,h,l),rgba:f}},n.opacity=d,n.multiplyOpacity=function(S,f){return s=255&S.rgba,d(S,s*f/255)},n.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}}(_||(t.color=_={})),function(n){let d,S;try{const f=document.createElement("canvas");f.width=1,f.height=1;const C=f.getContext("2d",{willReadFrequently:!0});C&&(d=C,d.globalCompositeOperation="copy",S=d.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(f){if(f.match(/#[\da-f]{3,8}/i))switch(f.length){case 4:return a=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(f.slice(1,2).repeat(2),16),h=parseInt(f.slice(2,3).repeat(2),16),l=parseInt(f.slice(3,4).repeat(2),16),s=parseInt(f.slice(4,5).repeat(2),16),c.toColor(a,h,l,s);case 7:return{css:f,rgba:(parseInt(f.slice(1),16)<<8|255)>>>0};case 9:return{css:f,rgba:parseInt(f.slice(1),16)>>>0}}const C=f.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return a=parseInt(C[1]),h=parseInt(C[2]),l=parseInt(C[3]),s=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),c.toColor(a,h,l,s);if(!d||!S)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=S,d.fillStyle=f,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,h,l,s]=d.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,s),css:f}}}(g||(t.css=g={})),function(n){function d(S,f,C){const u=S/255,m=f/255,w=C/255;return .2126*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))}n.relativeLuminance=function(S){return d(S>>16&255,S>>8&255,255&S)},n.relativeLuminance2=d}(o||(t.rgb=o={})),function(n){function d(f,C,u){const m=f>>24&255,w=f>>16&255,k=f>>8&255;let E=C>>24&255,x=C>>16&255,T=C>>8&255,F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));for(;F<u&&(E>0||x>0||T>0);)E-=Math.max(0,Math.ceil(.1*E)),x-=Math.max(0,Math.ceil(.1*x)),T-=Math.max(0,Math.ceil(.1*T)),F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));return(E<<24|x<<16|T<<8|255)>>>0}function S(f,C,u){const m=f>>24&255,w=f>>16&255,k=f>>8&255;let E=C>>24&255,x=C>>16&255,T=C>>8&255,F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));for(;F<u&&(E<255||x<255||T<255);)E=Math.min(255,E+Math.ceil(.1*(255-E))),x=Math.min(255,x+Math.ceil(.1*(255-x))),T=Math.min(255,T+Math.ceil(.1*(255-T))),F=i(o.relativeLuminance2(E,x,T),o.relativeLuminance2(m,w,k));return(E<<24|x<<16|T<<8|255)>>>0}n.blend=function(f,C){if(s=(255&C)/255,s===1)return C;const u=C>>24&255,m=C>>16&255,w=C>>8&255,k=f>>24&255,E=f>>16&255,x=f>>8&255;return a=k+Math.round((u-k)*s),h=E+Math.round((m-E)*s),l=x+Math.round((w-x)*s),c.toRgba(a,h,l)},n.ensureContrastRatio=function(f,C,u){const m=o.relativeLuminance(f>>8),w=o.relativeLuminance(C>>8);if(i(m,w)<u){if(w<m){const x=d(f,C,u),T=i(m,o.relativeLuminance(x>>8));if(T<u){const F=S(f,C,u);return T>i(m,o.relativeLuminance(F>>8))?x:F}return x}const k=S(f,C,u),E=i(m,o.relativeLuminance(k>>8));if(E<u){const x=d(f,C,u);return E>i(m,o.relativeLuminance(x>>8))?k:x}return k}},n.reduceLuminance=d,n.increaseLuminance=S,n.toChannels=function(f){return[f>>24&255,f>>16&255,f>>8&255,255&f]}}(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},345:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},859:(M,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,s,c,_){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(s,c,_)}get(h,l,s,c){var _;return(_=this._data.get(h,l))==null?void 0:_.get(s,c)}clear(){this._data.clear()}}},399:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let g=0,o=0,e=_.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),o=Math.max(g,o),r=_.timeRemaining(),1.5*o>r)return e-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-g))}ms`),void this._start();e=r}this.clear()}}class s extends l{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const g=Date.now()+_;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},147:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),s=a(147);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const o=new c;return o.setFromCharData(g),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(g[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(g[l.CHAR_DATA_CHAR_INDEX].length===2){const e=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|g[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=g[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},855:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let s="";for(let c=h;c<l;++c){let _=a[c];_>65535?(_-=65536,s+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):s+=String.fromCharCode(_)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let s=0,c=0;if(this._interim){const _=a.charCodeAt(c++);56320<=_&&_<=57343?h[s++]=1024*(this._interim-55296)+_-56320+65536:(h[s++]=this._interim,h[s++]=_),this._interim=0}for(let _=c;_<l;++_){const g=a.charCodeAt(_);if(55296<=g&&g<=56319){if(++_>=l)return this._interim=g,s;const o=a.charCodeAt(_);56320<=o&&o<=57343?h[s++]=1024*(g-55296)+o-56320+65536:(h[s++]=g,h[s++]=o)}else g!==65279&&(h[s++]=g)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let s,c,_,g,o=0,e=0,r=0;if(this.interim[0]){let d=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let f,C=0;for(;(f=63&this.interim[++C])&&C<4;)S<<=6,S|=f;const u=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=u-C;for(;r<m;){if(r>=l)return 0;if(f=a[r++],(192&f)!=128){r--,d=!0;break}this.interim[C++]=f,S<<=6,S|=63&f}d||(u===2?S<128?r--:h[o++]=S:u===3?S<2048||S>=55296&&S<=57343||S===65279||(h[o++]=S):S<65536||S>1114111||(h[o++]=S)),this.interim.fill(0)}const i=l-4;let n=r;for(;n<l;){for(;!(!(n<i)||128&(s=a[n])||128&(c=a[n+1])||128&(_=a[n+2])||128&(g=a[n+3]));)h[o++]=s,h[o++]=c,h[o++]=_,h[o++]=g,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(e=(31&s)<<6|63&c,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(_=a[n++],(192&_)!=128){n--;continue}if(e=(15&s)<<12|(63&c)<<6|63&_,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(_=a[n++],(192&_)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=_,o;if(g=a[n++],(192&g)!=128){n--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&_)<<6|63&g,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,n){var d,S=arguments.length,f=S<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,r,i,n);else for(var C=e.length-1;C>=0;C--)(d=e[C])&&(f=(S<3?d(f):S>3?d(r,i,f):d(r,i))||f);return S>3&&f&&Object.defineProperty(r,i,f),f},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(859),c=a(97),_={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let g,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),g=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){var i;this._logLevel<=c.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,r)}debug(e,...r){var i;this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,r)}info(e,...r){var i;this._logLevel<=c.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,r)}warn(e,...r){var i;this._logLevel<=c.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,r)}error(e,...r){var i;this._logLevel<=c.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){g=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(...d){if(g.logLevel!==c.LogLevelEnum.TRACE)return n.apply(this,d);g.trace(`GlyphRenderer#${n.name}(${d.map(f=>JSON.stringify(f)).join(", ")})`);const S=n.apply(this,d);return g.trace(`GlyphRenderer#${n.name} return`,S),S}}},726:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(c,_,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,c,g)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},97:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},L={};function A(M){var t=L[M];if(t!==void 0)return t.exports;var a=L[M]={exports:{}};return b[M].call(a.exports,a,a.exports,A),a.exports}var I={};return(()=>{var M=I;Object.defineProperty(M,"__esModule",{value:!0}),M.WebglAddon=void 0;const t=A(345),a=A(859),h=A(399),l=A(666),s=A(776);class c extends a.Disposable{constructor(g){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=g,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(g){const o=g._core;if(!g.element)return void this.register(o.onWillOpen(()=>this.activate(g)));this._terminal=g;const e=o.coreService,r=o.optionsService,i=o,n=i._renderService,d=i._characterJoinerService,S=i._charSizeService,f=i._coreBrowserService,C=i._decorationService,u=i._logService,m=i._themeService;(0,s.setTraceLogger)(u),this._renderer=this.register(new l.WebglRenderer(g,d,S,f,e,C,r,m,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const w=this._terminal._core._renderService;w.setRenderer(this._terminal._core._createRenderer()),w.handleResize(g.cols,g.rows)}))}get textureAtlas(){var g;return(g=this._renderer)==null?void 0:g.textureAtlas}clearTextureAtlas(){var g;(g=this._renderer)==null||g.clearTextureAtlas()}}M.WebglAddon=c})(),I})())})(Li);var Bs=Li.exports,xi={exports:{}};(function(p,v){(function(b,L){p.exports=L()})(As,()=>(()=>{var b={433:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV11=void 0;const h=a(938),l=[[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]],s=[[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]],c=[[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]],_=[[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 g;function o(e,r){let i,n=0,d=r.length-1;if(e<r[0][0]||e>r[d][1])return!1;for(;d>=n;)if(i=n+d>>1,e>r[i][1])n=i+1;else{if(!(e<r[i][0]))return!0;d=i-1}return!1}t.UnicodeV11=class{constructor(){if(this.version="11",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160);for(let e=0;e<l.length;++e)g.fill(0,l[e][0],l[e][1]+1);for(let e=0;e<c.length;++e)g.fill(2,c[e][0],c[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?g[e]:o(e,s)?0:o(e,_)?2:1}charProperties(e,r){let i=this.wcwidth(e),n=i===0&&r!==0;if(n){const d=h.UnicodeService.extractWidth(r);d===0?n=!1:d>i&&(i=d)}return h.UnicodeService.createPropertyValue(0,i,n)}}},345:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},490:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(938),l=[[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]],s=[[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 c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let _=0;_<l.length;++_)c.fill(0,l[_][0],l[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?c[_]:function(g,o){let e,r=0,i=o.length-1;if(g<o[0][0]||g>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,g>o[e][1])r=e+1;else{if(!(g<o[e][0]))return!0;i=e-1}return!1}(_,s)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,g){let o=this.wcwidth(_),e=o===0&&g!==0;if(e){const r=h.UnicodeService.extractWidth(g);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},938:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(345),l=a(490);class s{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,g,o=!1){return(16777215&_)<<3|(3&g)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const _=new l.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let g=0,o=0;const e=_.length;for(let r=0;r<e;++r){let i=_.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return g+this.wcwidth(i);const S=_.charCodeAt(r);56320<=S&&S<=57343?i=1024*(i-55296)+S-56320+65536:g+=this.wcwidth(S)}const n=this.charProperties(i,o);let d=s.extractWidth(n);s.extractShouldJoin(n)&&(d-=s.extractWidth(o)),g+=d,o=n}return g}charProperties(_,g){return this._activeProvider.charProperties(_,g)}}t.UnicodeService=s}},L={};function A(M){var t=L[M];if(t!==void 0)return t.exports;var a=L[M]={exports:{}};return b[M](a,a.exports,A),a.exports}var I={};return(()=>{var M=I;Object.defineProperty(M,"__esModule",{value:!0}),M.Unicode11Addon=void 0;const t=A(433);M.Unicode11Addon=class{activate(a){a.unicode.register(new t.UnicodeV11)}dispose(){}}})(),I})())})(xi);var Ps=xi.exports;const Os={background:"#040c0a",foreground:"#dceee7",cursor:"#3ee9a4",cursorAccent:"#040c0a",selectionBackground:"rgba(15, 174, 124, 0.35)"},Is=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],kt=[0,95,135,175,215,255];function ri(p,v){if(p<0)return v;if(p<16)return Is[p]??v;if(p<232){const b=p-16,L=kt[Math.floor(b/36)%6],A=kt[Math.floor(b/6)%6],I=kt[b%6];return`rgb(${L},${A},${I})`}if(p<256){const b=8+(p-232)*10;return`rgb(${b},${b},${b})`}return`#${(p&16777215).toString(16).padStart(6,"0")}`}function Fs(p,v){let b=!1,L=!1,A=!1;const I=()=>{A||(A=!0,setTimeout(M,0))},M=()=>{if(A=!1,!b){if(L){L=!1,I();return}p.value!==""&&(p.value="")}},t=()=>{L=!0};p.addEventListener("keydown",t),p.addEventListener("input",t),p.addEventListener("compositionstart",()=>{b=!0}),p.addEventListener("compositionend",()=>{b=!1,L=!0,I()}),v(I)}const ni="\x1Bc",Hs=/Mac|iPhone|iPad/.test(navigator.platform);class $s{constructor(v){te(this,"term");te(this,"fit",new Ts.FitAddon);te(this,"onInput",null);te(this,"shouldSendKey",null);te(this,"onSelect",null);te(this,"webglLosses",0);this.term=new Ms.Terminal({theme:Os,fontFamily:"'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!0,macOptionClickForcesSelection:!0,scrollback:5e3}),this.term.loadAddon(this.fit),this.term.loadAddon(new Ps.Unicode11Addon),this.term.unicode.activeVersion="11",this.term.open(v),this.loadWebgl(),this.term.onData(b=>{var L;return(L=this.onInput)==null?void 0:L.call(this,b)}),this.term.textarea&&Fs(this.term.textarea,b=>this.term.onData(b)),this.term.attachCustomKeyEventHandler(b=>{var L,A;return((L=this.shouldSendKey)==null?void 0:L.call(this,b))===!1||b.type==="keydown"&&Cs(b,Hs)?!1:b.type==="keydown"&&Ss(b)?(b.preventDefault(),(A=this.onInput)==null||A.call(this,ms),!1):!0}),this.bindTouchScroll(v),this.bindCopyOnSelect(v),this.fitNow()}loadWebgl(){let v;try{v=new Bs.WebglAddon,this.term.loadAddon(v)}catch{return}v.onContextLoss(()=>{v.dispose(),++this.webglLosses<3&&this.loadWebgl(),this.term.refresh(0,this.term.rows-1)})}bindTouchScroll(v){let b=0,L=0;v.addEventListener("touchstart",A=>{A.touches.length===1&&(b=A.touches[0].clientY,L=0)},{capture:!0,passive:!0}),v.addEventListener("touchmove",A=>{if(A.touches.length!==1||!this.wantsWheel())return;A.preventDefault(),A.stopPropagation();const I=A.touches[0];L+=(b-I.clientY)/this.rowHeight(),b=I.clientY;const M=Math.trunc(L);if(M===0)return;L-=M;const t=v.querySelector(".xterm-screen");if(!t)return;const a={deltaY:Math.sign(M),deltaMode:WheelEvent.DOM_DELTA_LINE,clientX:I.clientX,clientY:I.clientY,bubbles:!0,cancelable:!0};for(let h=0;h<Math.abs(M);h++)t.dispatchEvent(new WheelEvent("wheel",a))},{capture:!0,passive:!1})}bindCopyOnSelect(v){v.addEventListener("mouseup",()=>{queueMicrotask(()=>{var L;const b=this.term.getSelection();b&&((L=this.onSelect)==null||L.call(this,b))})})}wantsWheel(){return this.term.modes.mouseTrackingMode!=="none"||this.term.buffer.active.type==="alternate"}rowHeight(){var L;const v=(L=this.term.element)==null?void 0:L.querySelector(".xterm-screen"),b=v&&this.term.rows>0?v.clientHeight/this.term.rows:0;return b>0?b:16}replay(v){this.term.write(ni+v)}write(v){this.term.write(v)}paste(v){this.term.paste(v)}clear(){this.term.write(ni)}focus(){this.term.focus()}fitNow(){try{this.fit.fit()}catch{}return{cols:this.term.cols,rows:this.term.rows}}}function Ns(p){const v=[];let b=0,L=0,A=!1;for(const I of p.split(`
75
+ `)){const M=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(I);if(M){b=Number(M[1]),L=Number(M[2]),A=!0,v.push({kind:"hunk",text:I});continue}A&&(I.startsWith("+")?v.push({kind:"add",old:null,new:L++,text:I.slice(1)}):I.startsWith("-")?v.push({kind:"del",old:b++,new:null,text:I.slice(1)}):I.startsWith(" ")&&v.push({kind:"ctx",old:b++,new:L++,text:I.slice(1)}))}return v}const ki=240;function Ws(p,v){return Math.round(Math.max(ki,Math.min(p,v*.75)))}const Us=2e3,Ri="tring.diffPanel",oi=420;function Ce(p,v){const b=document.createElement("div");return b.className=p,v!==void 0&&(b.textContent=v),b}function Be(p,v){const b=document.createElement("span");return b.className=p,b.textContent=v,b}function js(){try{const p=JSON.parse(localStorage.getItem(Ri)??"{}");return{width:typeof p.width=="number"?p.width:oi,open:p.open===!0}}catch{return{width:oi,open:!1}}}class zs{constructor(v,b){te(this,"el",Ce("diff-panel"));te(this,"handle",Ce("diff-handle"));te(this,"title",Be("diff-title",""));te(this,"plus",Be("diff-plus",""));te(this,"minus",Be("diff-minus",""));te(this,"scroll",Ce("diff-scroll"));te(this,"sessionId",null);te(this,"timer",null);te(this,"inflight",!1);te(this,"last","");te(this,"width");te(this,"opened");this.cell=v,this.onLayout=b;const L=Ce("diff-head"),A=document.createElement("button");A.type="button",A.className="diff-close",A.textContent="✕",A.title="Close diff viewer",A.onclick=()=>this.close(),L.append(this.title,this.plus,this.minus,A),this.el.append(L,this.scroll),v.append(this.handle,this.el);const I=js();this.width=Math.max(ki,I.width),this.opened=I.open,this.bindResize(),this.paint(),this.opened&&this.startPolling()}get isOpen(){return this.opened}open(){this.opened||(this.opened=!0,this.paint(),this.save(),this.onLayout(),this.startPolling())}close(){this.opened&&(this.opened=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.paint(),this.save(),this.onLayout())}toggle(){this.opened?this.close():this.open()}setSession(v){v!==this.sessionId&&(this.sessionId=v,this.last="",this.note(v?"loading…":"no session"),this.opened&&this.tick())}paint(){this.el.hidden=!this.opened,this.handle.hidden=!this.opened,this.el.style.width=`${this.width}px`}save(){try{localStorage.setItem(Ri,JSON.stringify({width:this.width,open:this.opened}))}catch{}}startPolling(){this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>void this.tick(),Us),this.tick()}async tick(){const v=this.sessionId;if(!(!v||this.inflight||!this.opened)){this.inflight=!0;try{const b=await wt(`/api/sessions/${encodeURIComponent(v)}/diff`);if(v!==this.sessionId||!this.opened)return;const L=JSON.stringify(b);if(L===this.last)return;this.last=L,this.render(b)}catch(b){if(v!==this.sessionId)return;this.last="",this.note(b.message)}finally{this.inflight=!1}}}note(v){this.title.textContent="",this.plus.textContent="",this.minus.textContent="",this.scroll.replaceChildren(Ce("diff-note",v))}render(v){if("error"in v)return this.note(v.error);const{files:b}=v;let L=0,A=0;for(const a of b)L+=a.added,A+=a.removed;if(this.title.textContent=`${b.length} file${b.length===1?"":"s"} changed`,this.plus.textContent=`+${L}`,this.minus.textContent=`-${A}`,b.length===0){this.scroll.replaceChildren(Ce("diff-note","no uncommitted changes"));return}const I=Ce("diff-files"),M=Ce("diff-body");for(const a of b){const h=this.fileSection(a),l=document.createElement("button");l.type="button",l.className="diff-file-row",l.append(Be("path",a.path),Be("diff-plus",`+${a.added}`),Be("diff-minus",`-${a.removed}`)),l.onclick=()=>h.scrollIntoView({block:"start"}),I.append(l),M.append(h)}v.truncated&&I.append(Ce("diff-note","some diffs are over the 1 MB limit and not shown"));const t=this.scroll.scrollTop;this.scroll.replaceChildren(I,M),this.scroll.scrollTop=t}fileSection(v){const b=Ce("diff-file");if(b.append(Ce("diff-file-head",v.path)),v.note)return b.append(Ce("diff-note",v.note)),b;for(const L of Ns(v.patch)){if(L.kind==="hunk"){b.append(Ce("dl dl-hunk",L.text));continue}const A=Ce(`dl dl-${L.kind}`);A.append(Be("ln",L.old===null?"":String(L.old)),Be("ln",L.new===null?"":String(L.new)),Be("tx",L.text)),b.append(A)}return b}bindResize(){let v=0;this.handle.addEventListener("pointerdown",L=>{L.preventDefault(),v=this.el.getBoundingClientRect().right,this.handle.setPointerCapture(L.pointerId),this.handle.classList.add("dragging")}),this.handle.addEventListener("pointermove",L=>{this.handle.hasPointerCapture(L.pointerId)&&(this.width=Ws(v-L.clientX,this.cell.clientWidth),this.el.style.width=`${this.width}px`)});const b=L=>{this.handle.hasPointerCapture(L.pointerId)&&(this.handle.releasePointerCapture(L.pointerId),this.handle.classList.remove("dragging"),this.save(),this.onLayout())};this.handle.addEventListener("pointerup",b),this.handle.addEventListener("pointercancel",b)}}function qs(p,v){if(!p)return null;const b=v.find(A=>A.id===p.id);if(b)return b.slot===p.slot?p:{id:b.id,slot:b.slot};const L=v.find(A=>A.slot===p.slot);return L?{id:L.id,slot:L.slot}:null}const Di=/^image\/(png|jpeg|gif|webp)$/;function Ks(p){return/\s/.test(p)?`"${p}"`:p}function Vs(p){for(const v of["dragover","drop"])p.addEventListener(v,b=>b.preventDefault())}function Gs(p,v){let b=0;const L=I=>{p.classList.toggle("dropping",I)},A=I=>{var M;return Array.from(((M=I.dataTransfer)==null?void 0:M.types)??[]).includes("Files")};p.addEventListener("dragenter",I=>{A(I)&&(I.preventDefault(),b++,L(!0))}),p.addEventListener("dragover",I=>{A(I)&&(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="copy"))}),p.addEventListener("dragleave",()=>{b=Math.max(0,b-1),b===0&&L(!1)}),p.addEventListener("drop",I=>{var M;A(I)&&(I.preventDefault(),b=0,L(!1),Ys(Array.from(((M=I.dataTransfer)==null?void 0:M.files)??[]),v))})}function Xs(p){const v=document.createElement("input");return v.type="file",v.multiple=!0,v.hidden=!0,v.addEventListener("change",()=>{const b=Array.from(v.files??[]);v.value="",b.length>0&&p(b)}),document.body.append(v),()=>v.click()}async function Ys(p,v){if(p.length===0)return v.onError("nothing to drop");await at(p,v)}async function at(p,v){if(!v.ready()){v.onError("focus a session first — the file goes into its prompt");return}const b=[];for(const L of p)try{b.push(Ks(await v.upload(L)))}catch(A){v.onError(A.message);break}b.length>0&&v.insert(b.join(" ")+" ")}function Js(p){const v=p,b=v.SpeechRecognition??v.webkitSpeechRecognition;return b?()=>new b:null}function Rt(p,v){return p?v?v.toLowerCase().startsWith(p.toLowerCase())?v:`${p} ${v}`:p:v}function Zs(p){var L;let v="",b="";for(const A of Array.from(p)){const I=((L=A[0])==null?void 0:L.transcript.trim())??"";A.isFinal?v=Rt(v,I):b=Rt(b,I)}return Rt(v,b)}function Qs(p){switch(p){case"aborted":return null;case"no-speech":return"no speech heard — tap the mic and talk";case"not-allowed":return"the microphone was refused — voice input needs https and microphone permission";case"service-not-allowed":return"speech recognition is turned off on this device";case"audio-capture":return"no microphone available";case"network":return"speech recognition needs a network connection";case"language-not-supported":return"speech recognition does not support this language";default:return`speech recognition failed (${p})`}}class er{constructor(v,b,L){te(this,"rec",null);this.make=v,this.cb=b,this.lang=L}get listening(){return this.rec!==null}toggle(){this.rec?this.rec.stop():this.start()}cancel(){const v=this.rec;v&&(this.rec=null,v.abort(),this.cb.onListening(!1))}start(){const v=this.make();v.lang=this.lang,v.continuous=!0,v.interimResults=!0;let b="";v.addEventListener("result",L=>{b=Zs(L.results),this.cb.onHeard(b)}),v.addEventListener("error",L=>{const A=Qs(L.error);A&&this.cb.onError(A)}),v.addEventListener("end",()=>{this.rec===v&&(this.rec=null,this.cb.onListening(!1),b&&this.cb.onText(b))});try{v.start()}catch(L){this.cb.onError(`speech recognition failed (${L.message})`);return}this.rec=v,this.cb.onListening(!0),this.cb.onHeard("")}}const tr=6;function ir(p,v){let b=null,L=null;const A=h=>Number(h.dataset.slot),I=(h,l)=>{var c;const s=((c=document.elementFromPoint(h,l))==null?void 0:c.closest(".tile[data-slot]"))??null;return s&&p.contains(s)?s:null},M=h=>{h!==L&&(L==null||L.classList.remove("drop-target"),L=h,L==null||L.classList.add("drop-target"))},t=()=>{b==null||b.from.classList.remove("dragging"),document.body.classList.remove("tile-dragging"),M(null),b=null},a=()=>{const h=l=>{l.stopPropagation(),l.preventDefault()};window.addEventListener("click",h,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",h,{capture:!0}),0)};p.addEventListener("pointerdown",h=>{if(h.button!==0||!(h.target instanceof Element)||h.target.closest(".tile-action"))return;const l=h.target.closest(".tile[data-slot]");if(!l)return;const s=v.sessionAt(A(l));s&&(b={id:s,from:l,pointer:h.pointerId,x:h.clientX,y:h.clientY,active:!1})}),window.addEventListener("pointermove",h=>{if(!b||h.pointerId!==b.pointer)return;if(!b.active){if(Math.hypot(h.clientX-b.x,h.clientY-b.y)<tr)return;b.active=!0,b.from.classList.add("dragging"),document.body.classList.add("tile-dragging")}const l=I(h.clientX,h.clientY);M(l&&l!==b.from?l:null)}),window.addEventListener("pointerup",h=>{if(!b||h.pointerId!==b.pointer)return;const{id:l,active:s}=b,c=L;t(),s&&(a(),c&&v.onMove(l,A(c)))}),window.addEventListener("pointercancel",t),window.addEventListener("keydown",h=>{h.key!=="Escape"||!(b!=null&&b.active)||(h.stopPropagation(),h.preventDefault(),t())},{capture:!0})}function Ai(p){return Array.from(p??[]).filter(v=>Di.test(v.type))}function sr(p,v){p.addEventListener("paste",b=>{var A;const L=Ai((A=b.clipboardData)==null?void 0:A.files);L.length!==0&&(b.preventDefault(),b.stopPropagation(),at(L,v))},{capture:!0})}async function rr(p){const v=[];let b="";for(const L of p){const A=L.types.find(I=>Di.test(I));A?v.push(await L.getType(A)):L.types.includes("text/plain")&&(b+=await(await L.getType("text/plain")).text())}return{images:v,text:b}}async function nr(p){if(!p.ready()){p.onError("focus a session first — the paste goes into its prompt");return}let v;try{v=await navigator.clipboard.read()}catch{p.fallback();return}const{images:b,text:L}=await rr(v);b.length>0?await at(b,p):L?p.insert(L):p.onError("nothing on the clipboard to paste")}function Mi(p,v,b){var t,a;let L=Math.max(0,v);for(;L>0&&((t=p.getLine(L))!=null&&t.isWrapped);)L--;let A=Math.min(p.length,b);for(;A<p.length&&((a=p.getLine(A))!=null&&a.isWrapped);)A++;const I=[];let M=null;for(let h=L;h<A;h++){const l=p.getLine(h);if(!l)continue;const s=l.translateToString(!1);l.isWrapped&&M!==null?M+=s:(M!==null&&I.push(M.trimEnd()),M=s)}return M!==null&&I.push(M.trimEnd()),I}function or(p,v){const b=Mi(p,p.viewportY,p.viewportY+v);for(;b.length>0&&b[b.length-1]==="";)b.pop();return b.join(`
76
+ `)}const ar=/https?:\/\/[^\s<>"'`]+/g,hr=/[.,;:!?)\]}'"]+$/;function lr(p){const v=new Set;for(const b of p.match(ar)??[]){const L=b.replace(hr,"");L.length>8&&v.add(L)}return[...v]}const cr=300;function dr(p,v=cr){const b=Mi(p,p.length-v,p.length);return lr(b.reverse().join(`
77
+ `))}async function Ti(p){var L;try{if((L=navigator.clipboard)!=null&&L.writeText)return await navigator.clipboard.writeText(p),!0}catch{}const v=document.createElement("textarea");v.value=p,v.setAttribute("readonly",""),v.style.position="fixed",v.style.opacity="0",document.body.append(v),v.select();let b=!1;try{b=document.execCommand("copy")}catch{b=!1}return v.remove(),b}const ai="#071411",ur="#dceee7";class _r{constructor(v){te(this,"ctx");te(this,"last",null);this.canvas=v,this.ctx=v.getContext("2d",{alpha:!1})}paint(v=this.last){if(!this.ctx||!v)return;this.last=v;const b=window.devicePixelRatio||1,L=this.canvas.clientWidth,A=this.canvas.clientHeight;if(L===0||A===0)return;(this.canvas.width!==Math.round(L*b)||this.canvas.height!==Math.round(A*b))&&(this.canvas.width=Math.round(L*b),this.canvas.height=Math.round(A*b));const I=this.ctx;I.setTransform(b,0,0,b,0,0),I.fillStyle=ai,I.fillRect(0,0,L,A);const M=L/Math.max(v.cols,1),t=Math.max(M/.6,1),a=A/Math.max(v.rows.length,1);I.textBaseline="top",I.font=`${t}px ${getComputedStyle(document.body).getPropertyValue("--mono")}`;for(let h=0;h<v.rows.length;h++){const l=v.rows[h];if(!l)continue;let s=0;for(const c of l){const _=c.text.length*M;c.bg>=0&&(I.fillStyle=ri(c.bg,ai),I.fillRect(s,h*a,_,a)),c.text.trim()!==""&&(I.fillStyle=ri(c.fg,ur),I.fillText(c.text,s,h*a)),s+=_}}}refresh(){this.last&&this.paint(this.last)}}const tt=[4,8,12,16],hi=16;function Bi(p){return p<12?fr(p/2):pr(p/4+1)}function fr(p){const v=new Map;for(let b=1;b<=p;b++)v.set(b,{row:1,col:b});for(let b=0;b<p;b++)v.set(p+1+b,{row:3,col:p-b});return{cols:p,rows:3,rowTemplate:"1fr 3fr 1fr",focus:`2 / 1 / 3 / ${p+1}`,cells:v}}function pr(p){const v=[];for(let b=1;b<=p;b++)v.push({row:1,col:b});for(let b=2;b<=p-1;b++)v.push({row:b,col:p});for(let b=p;b>=1;b--)v.push({row:p,col:b});for(let b=p-1;b>=2;b--)v.push({row:b,col:1});return{cols:p,rows:p,rowTemplate:`repeat(${p}, 1fr)`,focus:`2 / 2 / ${p} / ${p}`,cells:new Map(v.map((b,L)=>[L+1,b]))}}const Pi="tring.ring";let Oi=gr();function gr(){try{const p=Number(localStorage.getItem(Pi));return vr(p)?p:hi}catch{return hi}}function vr(p){return tt.includes(p)}function rt(){return Oi}function mr(p){Oi=p;try{localStorage.setItem(Pi,String(p))}catch{}}function Sr(p,v,b){const L=Bi(b);p.style.gridTemplateColumns=`repeat(${L.cols}, 1fr)`,p.style.gridTemplateRows=L.rowTemplate,v.style.gridArea=L.focus}function Cr(p,v,b){const L=Bi(b).cells.get(v);L&&(p.style.gridRow=String(L.row),p.style.gridColumn=String(L.col))}const Ii="tring.sound";let pt=null,jt=br();function br(){try{return localStorage.getItem(Ii)!=="off"}catch{return!0}}function Ze(){return jt}function wr(p){jt=p;try{localStorage.setItem(Ii,p?"on":"off")}catch{}p&&zt()}async function zt(){try{return pt??(pt=new AudioContext),pt.state==="suspended"&&await pt.resume(),pt}catch{return null}}document.addEventListener("pointerdown",()=>void zt(),{once:!0});function li(p,v,b,L,A){const I=p.createOscillator(),M=p.createGain();I.type="sine",I.frequency.setValueAtTime(b,v),M.gain.setValueAtTime(0,v),M.gain.linearRampToValueAtTime(L,v+.004),M.gain.exponentialRampToValueAtTime(1e-4,v+A),I.connect(M).connect(p.destination),I.start(v),I.stop(v+A)}function ci(){jt&&zt().then(p=>{if(!p)return;const v=p.currentTime;for(const b of[0,.085])li(p,v+b,1568,.13,.55),li(p,v+b,2349,.05,.4)})}const Fi="tring.usage",Hi="tring.usage.view",$i=(p,v)=>{try{const b=localStorage.getItem(p);return b===null?v:JSON.parse(b)}catch{return v}},Ni=(p,v)=>{try{localStorage.setItem(p,JSON.stringify(v))}catch{}};let qt=$i(Fi,!1);const Tt=()=>qt;function yr(p){qt=p,Ni(Fi,p)}const Er=()=>qt&&$i(Hi,!1),Wi=p=>Ni(Hi,p),Lr=()=>wt("/api/usage");function Qe(p){return p>=1e9?`${(p/1e9).toFixed(1)}B`:p>=1e6?`${(p/1e6).toFixed(1)}M`:p>=1e3?`${Math.round(p/1e3)}k`:String(p)}const di=p=>`$${p.toFixed(2)}`,ui=p=>new Date(p).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function le(p,v,b){const L=document.createElement(p);return v&&(L.className=v),b!==void 0&&(L.textContent=b),L}function Ui(p,v,b=!0){const L=Math.min(100,p/v*100),A=le("div","meter"),I=le("i");return I.style.width=`${L}%`,b&&(L>=90?I.classList.add("hot"):L>=75&&I.classList.add("warm")),A.append(I),A.setAttribute("role","progressbar"),A.setAttribute("aria-valuenow",String(Math.round(L))),A}function Bt(p,v,b){p.replaceChildren();const L=le("div","usage");if(b){L.append(le("h2",void 0,"Claude usage")),L.append(le("p","hint",b)),p.append(L);return}if(!v){L.append(le("p","hint","asking Claude Code…")),p.append(L);return}if(v.limits.length>0){for(const M of v.limits)L.append(xr(M));L.append(le("p","source","from Claude Code’s own /usage"))}else{const M=v.window;L.append(_i("5-hour window",`${Qe(M.tokens)} tokens`,M.resetsAt?`resets ${ui(M.resetsAt)}`:"nothing running")),L.append(_i("This week",`${Qe(v.week.tokens)} tokens`,"rolling 7 days")),L.append(le("p","source",`${v.limitsError??"Claude Code’s own limits are unavailable"} — so these are counted from transcripts, with no percentage to show.`))}const A=le("div","utotals"),I=(M,t)=>{const a=le("div","ucell");return a.append(le("b",void 0,t),le("span",void 0,M)),a};if(A.append(I("tokens today",Qe(v.today.tokens))),A.append(I("today, est.",di(v.today.cost))),A.append(I("this week, est.",di(v.week.cost))),A.append(I("cache reads, 7d",Qe(v.week.cacheReadTokens))),L.append(A),v.projects.length>0){L.append(le("h3",void 0,"By project, last 7 days"));const M=v.projects[0].tokens,t=le("div","uprojects");for(const a of v.projects.slice(0,8)){const h=le("div","uproject");h.append(le("span","nm",a.name)),h.append(Ui(a.tokens,M,!1)),h.append(le("span","tag",Qe(a.tokens))),t.append(h)}L.append(t)}L.append(le("p","hint",`Token counts and costs are read from transcripts on this machine. Updated ${ui(v.scannedAt)}.`)),p.append(L)}function xr(p){const v=le("div","urow"),b=le("div","uhead");if(b.append(le("span","ulabel",p.label)),b.append(le("span","upct",`${p.percent}%`)),v.append(b),v.append(Ui(p.percent,100)),p.resets){const L=le("div","ufoot");L.append(le("span","unote",`resets ${p.resets}`)),v.append(L)}return v}function _i(p,v,b){const L=le("div","urow"),A=le("div","uhead");A.append(le("span","ulabel",p)),A.append(le("span","upct",v)),L.append(A);const I=le("div","ufoot");return I.append(le("span","unote",b)),L.append(I),L}function kr(p,v,b,L,A,I=!1,M={open:!1,count:0}){p.replaceChildren();const t=document.createElement("div");t.className="logo",t.title="tring";for(let s=0;s<9;s++)t.append(document.createElement("i"));p.append(t);for(const s of v){const c=s.sessions.filter(o=>o.status==="done").length,_=document.createElement("button");_.className="tab"+(!I&&s.id===b?" active":""),_.title=s.root;const g=document.createElement("span");if(g.className="nm",g.textContent=s.name,_.append(g),c>0){const o=document.createElement("span");o.className="badge",o.textContent=String(c),_.append(o)}_.onclick=()=>L.onSelect(s.id),_.oncontextmenu=o=>{o.preventDefault(),L.onContext(s.id,{x:o.clientX,y:o.clientY})},p.append(_)}if(Tt()){const s=document.createElement("button");s.className="tab pinned"+(I?" active":""),s.title="Claude usage";const c=document.createElement("span");c.className="nm",c.textContent="Usage",s.append(c),s.onclick=()=>L.onUsage(),p.append(s)}{const s=document.createElement("button");s.className="tab pinned"+(M.open?" active":""),s.title="Orchestrator — every agent waiting on you (Ctrl+Space, o)";const c=document.createElement("span");if(c.className="nm",c.textContent="Orchestrator",s.append(c),M.count>0){const _=document.createElement("span");_.className="badge asking",_.textContent=String(M.count),s.append(_)}s.onclick=()=>L.onInbox(),p.append(s)}const a=document.createElement("button");a.className="add",a.textContent="+",a.title="New project",a.onclick=()=>L.onAdd(),p.append(a);const h=document.createElement("button");h.className="iconbtn"+(Ze()?" on":""),h.innerHTML=Dr(Ze()),h.title=Ze()?"Sound on — click to mute":"Sound off — click to unmute",h.setAttribute("aria-label",h.title),h.setAttribute("aria-pressed",String(Ze())),h.onclick=()=>{wr(!Ze()),L.onSoundToggle()},h.style.marginLeft=A?"0":"auto",p.append(h);const l=document.createElement("button");if(l.className="iconbtn",l.innerHTML=Rr(),l.title="Settings",l.setAttribute("aria-label",l.title),l.onclick=()=>L.onSettings(),p.append(l),A){const s=document.createElement("button");s.className="update",s.textContent=`v${A.latest} available`,s.title=`You are on ${A.current}`,s.onclick=()=>L.onUpdate(A),p.insertBefore(s,h)}}function Rr(){return ji('<path d="M6.09 3.71 L6.43 1.18 L9.57 1.18 L9.91 3.71 L10.76 4.2 L13.12 3.23 L14.69 5.95 L12.67 7.51 L12.67 8.49 L14.69 10.05 L13.12 12.77 L10.76 11.8 L9.91 12.29 L9.57 14.82 L6.43 14.82 L6.09 12.29 L5.24 11.8 L2.88 12.77 L1.31 10.05 L3.33 8.49 L3.33 7.51 L1.31 5.95 L2.88 3.23 L5.24 4.2 Z"/><circle cx="8" cy="8" r="2.4"/>')}function ji(p){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${p}</svg>`}function Dr(p){return ji(`<path d="M8 2a3 3 0 0 1 3 3v3l1.4 2.1a.5.5 0 0 1-.4.8H4a.5.5 0 0 1-.4-.8L5 8V5a3 3 0 0 1 3-3z"/><path d="M6.6 12.6a1.5 1.5 0 0 0 2.8 0"/>${p?"":'<path d="M2.5 2.5l11 11"/>'}`)}const zi="(max-width: 720px)";function Ar(p){return p?{key:String(p.slot),name:p.name??p.title??"shell",status:p.status}:{key:"—",name:"pick a session",status:"idle"}}function Mr(p,v,b){const{focused:L,done:A,listening:I}=v,M=Ar(L),t=fi("nav"),a=document.createElement("button");a.className=`current st-${M.status}`,a.title="Switch session",a.setAttribute("aria-haspopup","dialog");const h=gt("key",M.key),l=gt("nm",M.name),s=gt("tag",L?M.status:"");a.append(h,l,s,Tr()),a.onclick=()=>b.onOpen(),t.append(a);const c=document.createElement("button");c.className="next",c.disabled=A===0,c.title=A>0?`Next finished session (${A})`:"No finished sessions",c.setAttribute("aria-label",c.title),c.innerHTML=Ve('<path d="M5 3l6 5-6 5"/>'),A>0&&c.append(gt("badge",String(A))),c.onclick=()=>b.onNext(),t.append(c);const _=fi("tools"),g=et("esc","Escape",L?"Send Escape":"Focus a session to send Escape",!L);g.textContent="Esc",pi(g),g.onclick=()=>b.onEsc(),_.append(g);const o=et("paste","Paste",L?"Paste from the clipboard":"Focus a session to paste",!L);o.innerHTML=Ve('<rect x="4" y="3" width="8" height="11" rx="1.5"/><path d="M6 3V2h4v1M6.5 7h3M6.5 10h3"/>'),o.onclick=()=>b.onPaste(),_.append(o);const e=et("attach","Attach",L?"Attach a photo or file":"Focus a session to attach a file",!L);if(e.innerHTML=Ve('<path d="M13 7.5l-5.3 5.3a3.2 3.2 0 0 1-4.5-4.5L8.8 2.7a2.1 2.1 0 0 1 3 3L6.3 11.2a1 1 0 0 1-1.5-1.5L9.5 5"/>'),e.onclick=()=>b.onAttach(),_.append(e),b.onMic){const i=b.onMic,n=et("mic",I?"Stop listening":"Talk",I?"Stop listening and insert the words":L?"Talk: what you say is typed into the prompt":"Focus a session to talk",!L&&!I);n.classList.toggle("listening",I),n.setAttribute("aria-pressed",String(I)),n.innerHTML=Ve('<rect x="5.5" y="1.5" width="5" height="8" rx="2.5"/><path d="M3 7.5a5 5 0 0 0 10 0M8 12.5V15"/>'),pi(n),n.onclick=()=>i(),_.append(n)}const r=et("copy","Copy",L?"Copy text off the screen":"Focus a session to copy",!L);r.innerHTML=Ve('<rect x="6" y="6" width="8" height="8" rx="1.5"/><path d="M4 10H3.5A1.5 1.5 0 0 1 2 8.5v-5A1.5 1.5 0 0 1 3.5 2h5A1.5 1.5 0 0 1 10 3.5V4"/>'),r.onclick=()=>b.onCopy(),_.append(r),p.replaceChildren(t,_)}function fi(p){const v=document.createElement("div");return v.className=`row ${p}`,v}function et(p,v,b,L){const A=document.createElement("button");return A.className=p,A.disabled=L,A.title=b,A.setAttribute("aria-label",v),A}function pi(p){p.onmousedown=v=>v.preventDefault()}function gt(p,v){const b=document.createElement("span");return b.className=p,b.textContent=v,b}function Tr(){const p=document.createElement("span");return p.className="chev",p.innerHTML=Ve('<path d="M4 6l4 4 4-4"/>'),p}function Ve(p){return`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${p}</svg>`}const Oe=document.getElementById("overlay");let Pt=null;function ht(){return!Oe.hidden}function ne(){Oe.hidden=!0,Oe.replaceChildren();const p=Pt;Pt=null,p==null||p()}function Ae(p,v={}){var b;Pt=v.onClosed??null,Oe.replaceChildren(p),Oe.hidden=!1,v.dismissible!==!1?Oe.onclick=L=>{L.target===Oe&&ne()}:Oe.onclick=null,(b=p.querySelector("input, button"))==null||b.focus()}function z(p,v,b){const L=document.createElement(p);return v&&(L.className=v),b!==void 0&&(L.textContent=b),L}function qi(p){const v=z("div","browser"),b=z("div","crumb"),L=z("div","dirlist");v.append(b,L);let A=!1;async function I(M){if(!A){A=!0,L.replaceChildren(z("div","dirnote","loading…"));try{const t=M?`?path=${encodeURIComponent(M)}`:"",a=await wt(`/api/fs${t}`);if(p.value=a.path,b.replaceChildren(),a.parent){const h=z("button","up","↑ "+a.parent);h.type="button",h.onclick=()=>void I(a.parent),b.append(h)}else b.append(z("span","dirnote",a.path));L.replaceChildren(),a.entries.length===0&&L.append(z("div","dirnote","no subdirectories"));for(const h of a.entries){const l=z("button",void 0,h.name);l.type="button",l.onclick=()=>void I(h.path),L.append(l)}}catch(t){L.replaceChildren(z("div","dirnote",t.message))}finally{A=!1}}}return p.addEventListener("change",()=>void I(p.value.trim()||void 0)),I(p.value.trim()||void 0),v}function Br(p,v,b,L){const A=z("div","panel picker");A.append(z("h2",void 0,p?p.name:"No project")),A.append(z("p","hint",`${b} session${b===1?"":"s"} finished across all projects`));const I=z("div","rows"),M=new Map;for(const c of(p==null?void 0:p.sessions)??[])M.set(c.slot,c);const t=window.matchMedia(zi).matches;for(let c=1;c<=rt();c++){const _=M.get(c),g=z("button",`row st-${(_==null?void 0:_.status)??"idle"}`);(_==null?void 0:_.status)==="busy"&&g.classList.add("dim"),_||g.classList.add("dim"),g.append(z("span","key",t?String(c):Ut(c))),g.append(z("span","nm",_?_.name??_.title??_.cwd.split("/").pop()??"shell":"— empty")),_&&g.append(z("span","tag",_.status)),g.onclick=()=>{ne(),L.onPickSlot(c)},I.append(g)}A.append(I);const a=z("div","picker-actions"),h=z("button","btn","Next finished");h.type="button",h.disabled=b===0,h.onclick=()=>{ne(),L.onNextDone()};const l=z("button","btn","New session");l.type="button",l.onclick=()=>{ne(),L.onNewSession()},a.append(h,l),A.append(a);const s=z("div","legend");s.innerHTML="<b>n</b> next finished &nbsp; <b>p</b> projects &nbsp; <b>c</b> new session &nbsp; <b>r</b> rename &nbsp; <b>x</b> kill &nbsp; <b>m</b> mark seen &nbsp; <b>o</b> orchestrator &nbsp; <b>esc</b> close",A.append(s),Ae(A),A.dataset.projects=String(v.length)}function Pr(p,v){const b=z("div","panel");b.append(z("h2",void 0,"Projects")),b.append(z("p","hint",`Each project owns its own ${rt()} slots.`));const L=z("div","rows");p.forEach((A,I)=>{const M=A.sessions.filter(a=>a.status==="done").length,t=z("button","row st-done");t.append(z("span","key",I<9?String(I+1):"—")),t.append(z("span","nm",A.name)),t.append(z("span","tag",M>0?`${M} done`:A.root)),t.onclick=()=>{ne(),v(A.id)},L.append(t)}),b.append(L),Ae(b)}function Ki(p,v){const b=z("div","panel");b.append(z("h2",void 0,p.title)),b.append(z("p","hint",p.blocking?"A project is a name and a root directory. New sessions start there.":"New sessions in this project start in its root directory."));const L=z("form"),A=z("input");A.value=p.name??"",A.placeholder="api-service",A.required=!0;const I=z("label","field");I.append(z("span",void 0,"Project name"),A);const M=z("input");M.value=p.root??"",M.placeholder="/home/you/code/api-service",M.required=!0,M.disabled=!!p.rootLocked;const t=z("label","field");t.append(z("span",void 0,p.rootLocked?"Root directory (fixed after creation)":"Root directory"),M),L.append(I,t),p.rootLocked||L.append(qi(M));const a=z("div","actions");if(p.onDelete){const l=z("button","btn danger","Delete project");l.type="button",l.onclick=()=>{var s;ne(),(s=p.onDelete)==null||s.call(p)},a.append(l),a.style.justifyContent="space-between"}if(!p.blocking){const l=z("button","btn","Cancel");l.type="button",l.onclick=()=>ne(),a.append(l)}const h=z("button","btn primary",p.onDelete?"Save":"Create");h.type="submit",a.append(h),L.append(a),L.onsubmit=l=>{l.preventDefault(),!(!A.value.trim()||!M.value.trim())&&(ne(),v(A.value.trim(),M.value.trim()))},b.append(L),Ae(b,{dismissible:!p.blocking}),A.focus(),A.select()}function Or(p,v){const b=z("div","panel");b.append(z("h2",void 0,`New session in slot ${p.slot}`)),b.append(z("p","hint","Defaults to the project root."));const L=z("form"),A=(s,c,_)=>{const g=z("input");g.value=c,g.placeholder=_;const o=z("label","field");return o.append(z("span",void 0,s),g),L.append(o),g},I=A("Working directory",p.cwd,p.cwd);L.append(qi(I));const M=A("Command (optional)","","claude"),t=A("Name (optional)","","agent"),a=z("div","actions"),h=z("button","btn","Cancel");h.type="button",h.onclick=()=>ne();const l=z("button","btn primary","Start");l.type="submit",a.append(h,l),L.append(a),L.onsubmit=s=>{s.preventDefault(),ne(),v({cwd:I.value.trim()||p.cwd,command:M.value.trim()||null,name:t.value.trim()||null})},b.append(L),Ae(b)}const Ir=["#f87171","#b91c1c","#fb923c","#c2410c","#fbbf24","#b45309","#a3e635","#4d7c0f","#4ade80","#15803d","#2dd4bf","#0f766e","#22d3ee","#0e7490","#60a5fa","#1d4ed8","#818cf8","#4338ca","#c084fc","#7e22ce","#f472b6","#be185d","#94a3b8","#475569"];function Fr(p,v,b,L){const A=z("div","panel");A.append(z("h2",void 0,`Slot ${p.slot}`)),A.append(z("p","hint",p.cwd));const I=z("form"),M=z("input");M.value=p.name??"",M.placeholder=p.title??"shell";const t=z("label","field");t.append(z("span",void 0,"Name"),M),I.append(t);let a=p.color;const h=z("div","swatches"),l=()=>{for(const i of Array.from(h.children))i.classList.toggle("active",i.dataset.color===(a??""))},s=(i,n)=>{const d=z("button","swatch");d.type="button",d.dataset.color=i??"",d.title=n,d.setAttribute("aria-label",n),i?d.style.setProperty("--tint",i):d.classList.add("none"),d.onclick=()=>{a=i,l()},h.append(d)};s(null,"No colour");for(const i of Ir)s(i,i);l();const c=z("div","field");c.append(z("span",void 0,"Border colour"),h),I.append(c);const _=z("div","actions"),g=z("button","btn danger","Delete");g.type="button",g.onclick=()=>{ne(),b()};const o=z("button","btn diff-toggle",L.open?"Hide diff viewer":"Diff viewer");o.type="button",o.style.marginRight="auto",o.onclick=()=>{ne(),L.onToggle()};const e=z("button","btn","Cancel");e.type="button",e.onclick=()=>ne();const r=z("button","btn primary","Save");r.type="submit",_.append(g,o,e,r),I.append(_),I.onsubmit=i=>{i.preventDefault(),ne(),v({name:M.value.trim(),color:a})},A.append(I),Ae(A),M.focus(),M.select()}function Hr(p,v){const b=z("div","panel");b.append(z("h2",void 0,"Settings"));let L=p.ring;const A=z("div","field ring-size");A.append(z("span",void 0,"Terminals around the focus"));const I=z("div","choices");for(const s of tt){const c=z("button","choice"+(s===L?" active":""));c.type="button",c.append(z("b",void 0,String(s))),c.append(z("span",void 0,s<12?"wide centre":"full ring")),c.onclick=()=>{L=s;for(const _ of Array.from(I.children))_.classList.remove("active");c.classList.add("active")},I.append(c)}A.append(I),b.append(A),b.append(z("p","hint ring-size","Slots stay where they are. Shrinking needs the slots above the new size to be empty first, so nothing is killed or hidden behind your back."));const M=z("label","field toggle"),t=z("input");t.type="checkbox",t.checked=p.usage,M.append(t,z("span",void 0,"Enable Claude usage monitoring")),b.append(M),b.append(z("p","hint","The tab asks Claude Code for the real numbers with `claude -p /usage`, which it answers locally and bills nothing. Nothing is read from your credentials, and nothing leaves this machine."));const a=z("div","actions"),h=z("button","btn","Cancel");h.type="button",h.onclick=()=>ne();const l=z("button","btn primary","Save");l.onclick=()=>{ne(),v({ring:L,usage:t.checked})},a.append(h,l),b.append(a),Ae(b)}function $r(p,v){const b=z("div","panel");b.append(z("h2",void 0,`tring ${v} is available`)),b.append(z("p","hint",`You are running ${p}. Update with:`));const L=z("pre","cmd","npm i -g tring-chat");b.append(L),b.append(z("p","hint","Running sessions are not affected until you restart the daemon."));const A=z("div","actions"),I=z("button","btn","Copy command");I.onclick=()=>{var t;(t=navigator.clipboard)==null||t.writeText("npm i -g tring-chat").then(()=>{I.textContent="Copied"},()=>{I.textContent="Copy failed"})};const M=z("button","btn primary","Close");M.onclick=()=>ne(),A.append(I,M),b.append(A),Ae(b)}function Vi(p,v,b){const L=z("div","panel");L.append(z("h2",void 0,p)),L.append(z("p","hint",v));const A=z("div","actions"),I=z("button","btn","Cancel");I.onclick=()=>ne();const M=z("button","btn primary","Confirm");M.onclick=()=>{ne(),b()},A.append(I,M),L.append(A),Ae(L)}function Nr(p){const v=z("div","panel paste-sheet");v.append(z("h2",void 0,"Paste")),v.append(z("p","hint","The clipboard could not be read directly. Long-press the box and paste: text is typed into the terminal, an image goes in as a path."));const b=z("textarea","paste-box");b.rows=4,b.placeholder="paste here",b.autocomplete="off",b.autocapitalize="off",b.spellcheck=!1,b.addEventListener("paste",M=>{var a;const t=Ai((a=M.clipboardData)==null?void 0:a.files);t.length!==0&&(M.preventDefault(),ne(),p.onImages(t))}),v.append(b);const L=z("div","actions"),A=z("button","btn","Cancel");A.onclick=()=>ne();const I=z("button","btn primary","Insert");I.onclick=()=>{const M=b.value;ne(),M&&p.onText(M)},L.append(A,I),v.append(L),Ae(v),b.focus()}function Wr(p,v){const b=z("div","panel copy-sheet");b.append(z("h2",void 0,"Copy"));const L=(a,h,l="btn")=>{const s=z("button",l,a);return s.type="button",s.onclick=()=>{v(h).then(c=>{s.textContent=c?"Copied":"Copy failed",setTimeout(()=>{s.textContent=a},1500)})},s};if(p.links.length>0){b.append(z("p","hint","Links on screen, the latest first."));const a=z("div","links");for(const h of p.links){const l=z("div","link");l.append(z("span","url",h),L("Copy",h)),a.append(l)}b.append(a)}b.append(z("p","hint",p.text?"The screen as text. Long-press to select part of it, or copy all of it.":"Nothing on the screen yet."));const A=z("pre","copy-box",p.text);b.append(A);const I=z("div","actions"),M=z("button","btn","Close");M.onclick=()=>ne();const t=L("Copy screen",p.text,"btn primary");t.disabled=p.text==="",I.append(M,t),b.append(I),Ae(b)}const Ur=document.getElementById("bar"),Dt=document.getElementById("switcher"),Ie=document.getElementById("ring"),nt=document.getElementById("usage");let we=[],Pe=null,ce=null,it=null,Ot=null,gi="",At=!1,ge=null,It=null,Fe="ring",mt=null;const Kt=window.matchMedia(zi),Ct=new Map,St=new Map,Ft=new Map,Vt=new Map;let Ht=null,$t=null;const ke=document.createElement("div");ke.className="focus-cell";const Gt=document.createElement("div");Gt.className="term-host";ke.append(Gt);const st=new zs(ke,()=>ct()),ve=new $s(Gt),Le=new bi(ke,{label:p=>{const v=He(p);if(!v)return null;const b=we.find(L=>L.id===v.projectId);return{name:v.name??v.title??"shell",slot:v.slot,color:v.color,elsewhere:v.projectId!==Pe?(b==null?void 0:b.name)??"another project":null}},onAnswer:(p,v,b)=>me.send({type:"answer",itemId:p,decision:v,...b}),onReply:(p,v)=>me.send({type:"reply",itemId:p,text:v}),onOpen:p=>Zr(p),hooks:()=>wt("/api/hooks"),installHooks:async()=>{await ys("/api/hooks")},onAuto:p=>me.send({type:"autoAnswer",enabled:p})});let vi=!1;const me=new Ls({onOpen:()=>{yt(),Qr()},onClose:()=>Ne("daemon disconnected — reconnecting"),onOutput:(p,v)=>{p===ce&&ve.write(v)},onMessage:qr});ve.onInput=p=>{ce&&me.send({type:"input",id:ce,data:p})};Vs(window);const Ge={upload:Es,ready:()=>ce!==null,insert:p=>{ve.paste(p),ve.focus()},onError:Ne};Gs(ke,Ge);ir(Ie,{sessionAt:p=>{var v;return(v=ze(p))==null?void 0:v.id},onMove:(p,v)=>me.send({type:"move",id:p,slot:v})});sr(ke,Ge);const jr=Xs(p=>{zr(p)});async function zr(p){const[v]=p,b=Ne(p.length===1&&v?`uploading ${v.name}…`:`uploading ${p.length} files…`);await at(p,Ge),De===b&&yt()}const Xe=document.createElement("div");Xe.className="heard";Xe.hidden=!0;Xe.setAttribute("aria-live","polite");ke.append(Xe);const mi=Js(window),be=mi&&new er(mi,{onListening:p=>{Xe.hidden=!p,lt()},onHeard:p=>{Xe.textContent=p||"listening… tap the mic again to finish"},onText:p=>{ce&&ve.paste(p+" ")},onError:Ne},navigator.language);ve.shouldSendKey=p=>!ht()&&!Wt(p);ve.onSelect=p=>{Ti(p).then(v=>{v||Ne("could not copy the selection"),ve.focus()})};const Xt=()=>we.find(p=>p.id===Pe)??null,je=()=>{var p;return((p=Xt())==null?void 0:p.sessions)??[]},ze=p=>je().find(v=>v.slot===p),He=p=>we.flatMap(v=>v.sessions).find(v=>v.id===p);function Ye(){const p=Math.max(0,...je().map(v=>v.slot));return tt.find(v=>v>=p&&v>=rt())??tt[tt.length-1]}const Gi=()=>we.reduce((p,v)=>p+v.sessions.filter(b=>b.status==="done").length,0);function qr(p){var v,b;switch(p.type){case"state":{we=p.projects,It=p.update??It;const L=new Set(we.flatMap(A=>A.sessions).map(A=>A.id));for(const A of St.keys())L.has(A)||St.delete(A);Pe=p.activeProjectId??((v=we[0])==null?void 0:v.id)??null,Xi(),en(),nn(),rn(),Er()&&ts(),an();break}case"status":{const L=He(p.id),A=L==null?void 0:L.status;L&&(L.status=p.status,L.since=p.since,L.title=p.title),p.status==="done"&&A!=="done"&&p.notable&&ci(),We();break}case"screen":p.id===ce&&ve.replay(p.ansi);break;case"snapshot":{St.set(p.id,p.snapshot),(b=Ct.get(p.id))==null||b.paint(p.snapshot);break}case"exit":We();break;case"error":Ne(p.message);break;case"autoAnswer":Le.setAuto(p.enabled,p.history);break;case"inbox":{const L=Le.setItems(p.items);vi&&L.length>0&&ci(),vi=!0,We();break}}}const Kr=()=>({onSelect:p=>ot(p),onAdd:()=>is(!1),onContext:p=>on(p),onUpdate:p=>$r(p.current,p.latest),onSoundToggle:()=>We(),onSettings:()=>tn(),onUsage:()=>ts(),onInbox:()=>Ji()}),qe=()=>kr(Ur,we,Pe,Kr(),It,Fe==="usage",{open:Le.isOpen,count:Le.count});function Xi(){qe(),Vr(),We()}function Vr(){const p=Ye(),v=`${Pe}|${p}|`+je().map(b=>`${b.slot}:${b.id}`).sort().join(",");if(v!==gi){gi=v,Sr(Ie,ke,p);for(const b of Array.from(Ie.children))b!==ke&&b.remove();ke.parentElement!==Ie&&Ie.append(ke),Ft.clear(),Ct.clear();for(let b=1;b<=p;b++){const L=ze(b),A=document.createElement("div");if(A.className="tile",A.tabIndex=0,A.onmousedown=I=>I.preventDefault(),Cr(A,b,p),A.dataset.slot=String(b),!L)A.classList.add("empty"),A.textContent=`+ ${Ut(b)}`,A.onclick=()=>Zt(b);else{const I=document.createElement("canvas");A.append(I);const M=new _r(I);Ct.set(L.id,M);const t=St.get(L.id);t&&M.paint(t);const a=document.createElement("div");a.className="label";const h=vt("slot-badge");h.textContent=String(b),a.append(h,vt("big-nm")),A.append(a);const l=document.createElement("div");l.className="meta";const s=document.createElement("span");s.className="key",s.textContent=String(b),l.append(s,vt("nm"),vt("cwd")),A.append(l),A.onclick=()=>$e(L.id),A.oncontextmenu=_=>{_.preventDefault(),ss(L.id)};const c=document.createElement("button");c.className="tile-action",c.onclick=_=>{_.stopPropagation(),me.send({type:"respawn",id:L.id})},A.append(c),Yi(A,L)}Ft.set(b,A),Ie.append(A)}requestAnimationFrame(()=>ct())}}const vt=p=>{const v=document.createElement("span");return v.className=p,v};function Yi(p,v){if(p.classList.remove("st-idle","st-busy","st-done","st-exited","viewing","asking"),p.style.removeProperty("--tint"),!v)return;p.classList.add(`st-${v.status}`),v.id===ce&&p.classList.add("viewing"),Le.countFor(v.id)>0&&p.classList.add("asking"),v.color&&p.style.setProperty("--tint",v.color);const b=v.name??v.title??"shell",L=p.querySelector(".nm");L&&(L.textContent=b);const A=p.querySelector(".big-nm");A&&(A.textContent=b);const I=p.querySelector(".cwd");I&&(I.textContent=v.cwd.split("/").filter(Boolean).pop()??""),p.title=`${Ut(v.slot)} — ${v.cwd}`;const M=p.querySelector(".tile-action"),t=Gr(v);M&&(M.hidden=!t,t&&(M.textContent=t.label,M.title=t.title))}function Gr(p){return p.status==="exited"?{label:"↻",title:p.command?`Restart: ${p.command}`:`Restart shell (exit ${p.exitCode??"?"})`}:p.command&&p.status==="idle"?{label:"▸",title:`Run: ${p.command}`}:null}function We(){for(let v=1;v<=Ye();v++){const b=Ft.get(v);b&&Yi(b,ze(v))}qe(),lt(),Le.repaint();const p=Gi();document.title=p>0?`(${p}) tring`:"tring"}let Mt="";function lt(){if(Dt.hidden=!Kt.matches||Fe!=="ring",Dt.hidden){Mt="",be==null||be.cancel();return}const p=ce?He(ce)??null:null,v=je().filter(A=>A.status==="done").length,b=(be==null?void 0:be.listening)??!1,L=`${p==null?void 0:p.id}|${p==null?void 0:p.status}|${p==null?void 0:p.name}|${p==null?void 0:p.title}|${v}|${b}`;L!==Mt&&(Mt=L,Mr(Dt,{focused:p,done:v,listening:b},{onOpen:ns,onNext:Jt,onEsc:Xr,onPaste:Yr,onAttach:jr,onCopy:Jr,onMic:be?()=>be.toggle():void 0}))}function Xr(){ce&&me.send({type:"input",id:ce,data:"\x1B"})}function Yr(){nr({...Ge,fallback:()=>Nr({onText:Ge.insert,onImages:p=>{at(p,Ge)}})})}function Jr(){if(!ce)return;const p=ve.term.buffer.active;Wr({text:or(p,ve.term.rows),links:dr(p)},Ti)}function ct(){const{cols:p,rows:v}=ve.fitNow();ce&&me.send({type:"resize",cols:p,rows:v});for(const b of Ct.values())b.refresh()}function $e(p,v=!1){dt(),!v&&Le.isOpen&&Yt(),Qi(p),ce&&!Le.isOpen&&ve.focus()}function Ji(){Le.isOpen?Yt():Zi()}function Zi(){dt(),Le.open(),qe()}function Yt(){Le.close(),qe(),ce&&ve.focus()}function Zr(p){const v=He(p);if(v){if(Yt(),v.projectId!==Pe){Vt.set(v.projectId,v.id),ot(v.projectId);return}$e(v.id)}}function Qi(p){if(p&&p===ce)return;be==null||be.cancel();const v=p?He(p):void 0;if(ce&&(Ot=ce),ce=(v==null?void 0:v.id)??null,it=(v==null?void 0:v.slot)??null,st.setSession(ce),!v){ve.clear(),We();return}Vt.set(v.projectId,v.id);const{cols:b,rows:L}=ve.fitNow();me.send({type:"focus",id:v.id,cols:b,rows:L}),ve.focus(),We()}function Qr(){if(!ce)return;const{cols:p,rows:v}=ve.fitNow();me.send({type:"focus",id:ce,cols:p,rows:v})}function en(){if(ce===null||it===null)return;const p=qs({id:ce,slot:it},je());if(p&&p.id===ce){it=p.slot;return}Qi((p==null?void 0:p.id)??null)}function es(p){const v=ze(p);v?$e(v.id):Zt(p)}function ts(){Fe!=="usage"&&(Fe="usage",Ie.hidden=!0,nt.hidden=!1,Bt(nt,null,null),Nt(),mt=setInterval(()=>void Nt(),3e4),Wi(!0),qe(),lt())}function dt(){Fe!=="ring"&&(Fe="ring",mt&&clearInterval(mt),mt=null,nt.hidden=!0,Ie.hidden=!1,Wi(!1),qe(),lt(),requestAnimationFrame(()=>ct()))}async function Nt(){if(Fe==="usage")try{Bt(nt,await Lr(),null)}catch(p){Bt(nt,null,p.message)}}function tn(){Hr({ring:rt(),usage:Tt()},p=>{p.usage!==Tt()&&(yr(p.usage),p.usage||dt()),p.ring!==rt()?sn(p.ring):(qe(),Nt())})}function sn(p){mr(p),Xi();const v=Ye();v!==p?Ne(`slots above ${p} are still in use — the ring stays at ${v} until they are closed`):yt()}function ot(p){dt(),p!==Pe&&(Pe=p,be==null||be.cancel(),ce=null,it=null,st.setSession(null),ve.clear(),Ht=p,me.send({type:"activateProject",projectId:p}))}function rn(){const p=$t;if(p===null)return;const v=ze(p);v&&($t=null,$e(v.id,!0))}function nn(){const p=Ht;if(!p||p!==Pe)return;Ht=null;const v=Vt.get(p);v&&je().some(b=>b.id===v)&&$e(v,!0)}function Jt(){var A;const p=je(),v=ze(((A=He(ce??""))==null?void 0:A.slot)??0),b=(v==null?void 0:v.slot)??0,L=Ye();for(let I=1;I<=L;I++){const M=(b+I-1)%L+1,t=p.find(a=>a.slot===M);if((t==null?void 0:t.status)==="done")return $e(t.id)}}function Zt(p){const v=Xt();v&&Or({cwd:v.root,slot:p},b=>{Kt.matches&&($t=p),me.send({type:"create",projectId:v.id,slot:p,cwd:b.cwd,...b.command?{command:b.command}:{},...b.name?{name:b.name}:{}})})}function is(p){Ki({title:p?"Create your first project":"New project",root:"",blocking:p},(v,b)=>me.send({type:"createProject",name:v,root:b}))}function ss(p){const v=He(p);v&&Fr(v,b=>{b.name!==(v.name??"")&&me.send({type:"rename",id:p,name:b.name}),b.color!==v.color&&me.send({type:"color",id:p,color:b.color})},()=>rs(v),{open:st.isOpen,onToggle:()=>{st.isOpen||$e(p),st.toggle()}})}function rs(p){Vi("Delete session",`Slot ${p.slot} — ${p.cwd}. The slot goes back to empty.`,()=>me.send({type:"kill",id:p.id}))}function on(p){const v=we.find(b=>b.id===p);v&&Ki({title:"Project settings",name:v.name,root:v.root,rootLocked:!0,onDelete:()=>{const b=v.sessions.length;Vi(`Delete ${v.name}?`,b>0?`This kills ${b} session${b===1?"":"s"} in this project.`:"This project has no running sessions.",()=>me.send({type:"deleteProject",projectId:p}))}},b=>me.send({type:"renameProject",projectId:p,name:b}))}function an(){if(we.length>0){At=!1;return}At||ht()||(At=!0,is(!0))}document.addEventListener("keydown",p=>{if(ht())return hn(p);Wt(p)&&(p.preventDefault(),ns())});document.addEventListener("click",()=>{ht()||Fe!=="ring"||!ce||Le.isOpen||ve.focus()});function ns(){ht()||(dt(),ge="picker",Br(Xt(),we,Gi(),{onPickSlot:p=>{ge=null,es(p)},onPickProject:p=>{ge=null,ot(p)},onNextDone:()=>{ge=null,Jt()},onNewSession:()=>{ge=null,os()}}))}function os(){const p=Ye(),v=[...Array(p)].map((b,L)=>L+1).find(b=>!ze(b));v?Zt(v):Ne(`all ${p} slots are full`)}function hn(p){if(ge===null)return;if(ge==="projects"){const A=Number(p.key);if(A>=1&&A<=9&&we[A-1]){p.preventDefault();const I=we[A-1];ne(),ge=null,ot(I.id);return}}const v=gs(p);if(v!==null&&v<=Ye()&&ge==="picker"){p.preventDefault(),ne(),ge=null,es(v);return}if(Wt(p)||p.code==="Space"){p.preventDefault(),ne(),ge=null,Ot&&$e(Ot);return}const b=vs(p);if(!b)return;p.preventDefault();const L=ce?He(ce):void 0;switch(b){case"close":ne(),ge=null;break;case"next-done":ne(),ge=null,Jt();break;case"projects":ne(),ge="projects",Pr(we,A=>{ge=null,ot(A)});break;case"new-session":ne(),ge=null,os();break;case"rename":if(!L)break;ne(),ge=null,ss(L.id);break;case"kill":if(!L)break;ne(),ge=null,rs(L);break;case"orchestrator":ne(),ge=null,Ji();break;case"mark-seen":L&&me.send({type:"ack",id:L.id}),ne(),ge=null;break}}let De=null;function Ne(p){return yt(),De=document.createElement("div"),De.id="toast",De.textContent=p,document.body.append(De),De}function yt(){De==null||De.remove(),De=null}"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});window.addEventListener("resize",()=>ct());Kt.addEventListener("change",()=>{lt(),requestAnimationFrame(()=>ct())});bi.wanted()&&Zi();me.connect();