@tui-sandbox/library 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/browser/assets/{index-Bup5cvb2.js → index-CEBvAIkI.js} +7 -7
- package/dist/browser/assets/{index-Bf37MeF1.css → index-D6fBrqAi.css} +1 -1
- package/dist/browser/index.html +2 -2
- package/dist/src/browser/neovim-client.d.ts +3 -2
- package/dist/src/browser/neovim-client.js +3 -0
- package/dist/src/client/terminal-client.d.ts +3 -2
- package/dist/src/client/terminal-client.js +7 -0
- package/dist/src/server/cypress-support/contents.js +12 -2
- package/dist/src/server/cypress-support/contents.test.js +11 -1
- package/dist/src/server/neovim/index.d.ts +3 -2
- package/dist/src/server/neovim/index.js +18 -0
- package/dist/src/server/server.d.ts +31 -0
- package/dist/src/server/server.js +4 -0
- package/dist/src/server/types.d.ts +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/browser/neovim-client.ts +12 -2
- package/src/client/style.css +6 -0
- package/src/client/terminal-client.ts +15 -2
- package/src/server/cypress-support/contents.test.ts +11 -1
- package/src/server/cypress-support/contents.ts +12 -2
- package/src/server/neovim/index.ts +33 -2
- package/src/server/server.ts +8 -0
- package/src/server/types.ts +7 -0
- package/tsconfig.json +1 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var wr=Object.defineProperty;var Er=(l,e,a)=>e in l?wr(l,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[e]=a;var Ke=(l,e,a)=>Er(l,typeof e!="symbol"?e+"":e,a);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const S of document.querySelectorAll('link[rel="modulepreload"]'))f(S);new MutationObserver(S=>{for(const w of S)if(w.type==="childList")for(const k of w.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&f(k)}).observe(document,{childList:!0,subtree:!0});function a(S){const w={};return S.integrity&&(w.integrity=S.integrity),S.referrerPolicy&&(w.referrerPolicy=S.referrerPolicy),S.crossOrigin==="use-credentials"?w.credentials="include":S.crossOrigin==="anonymous"?w.credentials="omit":w.credentials="same-origin",w}function f(S){if(S.ep)return;S.ep=!0;const w=a(S);fetch(S.href,w)}})();function Oe(l,e,a){return e in l?Object.defineProperty(l,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):l[e]=a,l}function $e(l){const e={subscribe(a){let f=null,S=!1,w=!1,k=!1;function r(){if(f===null){k=!0;return}w||(w=!0,typeof f=="function"?f():f&&f.unsubscribe())}return f=l({next(o){var h;S||(h=a.next)==null||h.call(a,o)},error(o){var h;S||(S=!0,(h=a.error)==null||h.call(a,o),r())},complete(){var o;S||(S=!0,(o=a.complete)==null||o.call(a),r())}}),k&&r(),{unsubscribe:r}},pipe(...a){return a.reduce(xr,e)}};return e}function xr(l,e){return e(l)}function kr(l){const e=new AbortController;return new Promise((f,S)=>{let w=!1;function k(){w||(w=!0,r.unsubscribe())}e.signal.addEventListener("abort",()=>{S(e.signal.reason)});const r=l.subscribe({next(o){w=!0,f(o),k()},error(o){S(o)},complete(){e.abort(),k()}})})}function Rr(l){return e=>{let a=0,f=null;const S=[];function w(){f||(f=e.subscribe({next(r){var o;for(const h of S)(o=h.next)==null||o.call(h,r)},error(r){var o;for(const h of S)(o=h.error)==null||o.call(h,r)},complete(){var r;for(const o of S)(r=o.complete)==null||r.call(o)}}))}function k(){if(a===0&&f){const r=f;f=null,r.unsubscribe()}}return $e(r=>(a++,S.push(r),w(),{unsubscribe(){a--,k();const o=S.findIndex(h=>h===r);o>-1&&S.splice(o,1)}}))}}function Lr(l){let e=l;const a=[],f=k=>{e!==void 0&&k.next(e),a.push(k)},S=k=>{a.splice(a.indexOf(k),1)},w=$e(k=>(f(k),()=>{S(k)}));return w.next=k=>{if(e!==k){e=k;for(const r of a)r.next(k)}},w.get=()=>e,w}function er(l){return $e(e=>{function a(S=0,w=l.op){const k=l.links[S];if(!k)throw new Error("No more links to execute - did you forget to add an ending link?");return k({op:w,next(o){return a(S+1,o)}})}return a().subscribe(e)})}const tr=()=>{},Wt=l=>{Object.freeze&&Object.freeze(l)};function rr(l,e,a){var f,S;const w=e.join(".");return(f=a)[S=w]??(f[S]=new Proxy(tr,{get(k,r){if(!(typeof r!="string"||r==="then"))return rr(l,[...e,r],a)},apply(k,r,o){const h=e[e.length-1];let g={args:o,path:e};return h==="call"?g={args:o.length>=2?[o[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(g={args:o.length>=2?o[1]:[],path:e.slice(0,-1)}),Wt(g.args),Wt(g.path),l(g)}})),a[w]}const Dr=l=>rr(l,[],Object.create(null)),Tr=l=>new Proxy(tr,{get(e,a){if(!(typeof a!="string"||a==="then"))return l(a)}}),pt={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};function Je(l){return!!l&&!Array.isArray(l)&&typeof l=="object"}const Ar=l=>l();function gt(l,e,a){return e in l?Object.defineProperty(l,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):l[e]=a,l}var sr;const Tt=new WeakMap,Br=()=>{};sr=Symbol.toStringTag;let Or=sr;class Ee{subscribe(){let e,a;const{settlement:f}=this;if(f===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const S=Ir();this.subscribers=Pr(this.subscribers,S),e=S.promise,a=()=>{this.subscribers!==null&&(this.subscribers=Nr(this.subscribers,S))}}else{const{status:S}=f;S==="fulfilled"?e=Promise.resolve(f.value):e=Promise.reject(f.reason),a=Br}return Object.assign(e,{unsubscribe:a})}then(e,a){const f=this.subscribe(),{unsubscribe:S}=f;return Object.assign(f.then(e,a),{unsubscribe:S})}catch(e){const a=this.subscribe(),{unsubscribe:f}=a;return Object.assign(a.catch(e),{unsubscribe:f})}finally(e){const a=this.subscribe(),{unsubscribe:f}=a;return Object.assign(a.finally(e),{unsubscribe:f})}static proxy(e){const a=Ee.getSubscribablePromise(e);return typeof a<"u"?a:Ee.createSubscribablePromise(e)}static createSubscribablePromise(e){const a=new Ee(e);return Tt.set(e,a),Tt.set(a,a),a}static getSubscribablePromise(e){return Tt.get(e)}static resolve(e){const a=typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"?e:Promise.resolve(e);return Ee.proxy(a).subscribe()}static async any(e){const f=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.any(f)}finally{f.forEach(({unsubscribe:S})=>{S()})}}static async race(e){const f=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.race(f)}finally{f.forEach(({unsubscribe:S})=>{S()})}}static async raceReferences(e){const a=e.map(Mr);try{return await Promise.race(a)}finally{for(const f of a)f.unsubscribe()}}constructor(e){gt(this,"promise",void 0),gt(this,"subscribers",[]),gt(this,"settlement",null),gt(this,Or,"Unpromise"),typeof e=="function"?this.promise=new Promise(e):this.promise=e;const a=this.promise.then(f=>{const{subscribers:S}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:f},S==null||S.forEach(({resolve:w})=>{w(f)})});"catch"in a&&a.catch(f=>{const{subscribers:S}=this;this.subscribers=null,this.settlement={status:"rejected",reason:f},S==null||S.forEach(({reject:w})=>{w(f)})})}}function Mr(l){return Ee.proxy(l).then(()=>[l])}function Ir(){let l,e;return{promise:new Promise((f,S)=>{l=f,e=S}),resolve:l,reject:e}}function Pr(l,e){return[...l,e]}function Hr(l,e){return[...l.slice(0,e),...l.slice(e+1)]}function Nr(l,e){const a=l.indexOf(e);return a!==-1?Hr(l,a):l}var jt;(jt=Symbol).dispose??(jt.dispose=Symbol());const Fr="ping",Wr="serialized-error";async function jr(l){let e;const a=new Promise(S=>{e=setTimeout(()=>{S(null)},l.timeoutMs)});let f;try{f=await Ee.race([l.promise,a])}finally{clearTimeout(e)}return f===null?await l.onTimeout():f}function Ur(l){const{deserialize:e=k=>k}=l,a=l.signal;let f=null;const S=()=>new ReadableStream({async start(k){const[r,o]=await Promise.all([l.url(),l.init()]),h=f=new l.EventSource(r,o);k.enqueue({type:"connecting",eventSource:f,event:null}),h.addEventListener("open",()=>{k.enqueue({type:"opened",eventSource:h})}),h.addEventListener(Wr,c=>{const _=c;k.enqueue({type:"serialized-error",error:e(JSON.parse(_.data)),eventSource:h})}),h.addEventListener(Fr,()=>{k.enqueue({type:"ping",eventSource:h})}),h.addEventListener("error",c=>{h.readyState===EventSource.CLOSED?k.error(c):k.enqueue({type:"connecting",eventSource:h,event:c})}),h.addEventListener("message",c=>{const _=c,y={data:e(JSON.parse(_.data))};_.lastEventId&&(y.id=_.lastEventId),k.enqueue({type:"data",data:y,eventSource:h})});const g=()=>{k.close(),h.close()};a.aborted?g():a.addEventListener("abort",g)},cancel(){f==null||f.close()}}),w=()=>{const k=S(),r=k.getReader();return{reader:r,cancel:()=>(r.releaseLock(),k.cancel())}};return{[Symbol.asyncIterator](){let k=w();return{async next(){let o=k.reader.read();l.reconnectAfterInactivityMs&&(o=jr({promise:o,timeoutMs:l.reconnectAfterInactivityMs,onTimeout:async()=>(await k.cancel(),k=w(),{value:{type:"timeout",eventSource:f},done:!1})}));const h=await o;return h.done?{value:h.value,done:!0}:{value:h.value,done:!1}},async return(){return await k.cancel(),{value:void 0,done:!0}}}}}}function $r(l,e){if("error"in l){const f=e.deserialize(l.error);return{ok:!1,error:{...l,error:f}}}return{ok:!0,result:{...l.result,...(!l.result.type||l.result.type==="data")&&{type:"data",data:e.deserialize(l.result.data)}}}}class At extends Error{constructor(){super("Unable to transform response from server")}}function zr(l,e){let a;try{a=$r(l,e)}catch{throw new At}if(!a.ok&&(!Je(a.error.error)||typeof a.error.error.code!="number"))throw new At;if(a.ok&&!Je(a.result))throw new At;return a}var Kt,Gt,Yt,Jt,Xt,Qt;typeof window>"u"||"Deno"in window||((Gt=(Kt=globalThis.process)==null?void 0:Kt.env)==null?void 0:Gt.NODE_ENV)==="test"||(Jt=(Yt=globalThis.process)==null?void 0:Yt.env)!=null&&Jt.JEST_WORKER_ID||(Qt=(Xt=globalThis.process)==null?void 0:Xt.env)!=null&&Qt.VITEST_WORKER_ID;function qr(l){return l instanceof pe||l instanceof Error&&l.name==="TRPCClientError"}function Vr(l){return Je(l)&&Je(l.error)&&typeof l.error.code=="number"&&typeof l.error.message=="string"}function Zr(l,e){return typeof l=="string"?l:Je(l)&&typeof l.message=="string"?l.message:e}class pe extends Error{static from(e,a={}){const f=e;return qr(f)?(a.meta&&(f.meta={...f.meta,...a.meta}),f):Vr(f)?new pe(f.error.message,{...a,result:f}):new pe(Zr(f,"Unknown error"),{...a,cause:f})}constructor(e,a){var S,w;const f=a==null?void 0:a.cause;super(e,{cause:f}),Oe(this,"cause",void 0),Oe(this,"shape",void 0),Oe(this,"data",void 0),Oe(this,"meta",void 0),this.meta=a==null?void 0:a.meta,this.cause=f,this.shape=(S=a==null?void 0:a.result)==null?void 0:S.error,this.data=(w=a==null?void 0:a.result)==null?void 0:w.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,pe.prototype)}}class Kr{$request(e){return er({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(Rr())}async requestAsPromise(e){try{const a=this.$request(e);return(await kr(a)).result.data}catch(a){throw pe.from(a)}}query(e,a,f){return this.requestAsPromise({type:"query",path:e,input:a,context:f==null?void 0:f.context,signal:f==null?void 0:f.signal})}mutation(e,a,f){return this.requestAsPromise({type:"mutation",path:e,input:a,context:f==null?void 0:f.context,signal:f==null?void 0:f.signal})}subscription(e,a,f){return this.$request({type:"subscription",path:e,input:a,context:f.context,signal:f.signal}).subscribe({next(w){var k,r,o,h;switch(w.result.type){case"state":{(k=f.onConnectionStateChange)==null||k.call(f,w.result);break}case"started":{(r=f.onStarted)==null||r.call(f,{context:w.context});break}case"stopped":{(o=f.onStopped)==null||o.call(f);break}case"data":case void 0:{(h=f.onData)==null||h.call(f,w.result.data);break}}},error(w){var k;(k=f.onError)==null||k.call(f,w)},complete(){var w;(w=f.onComplete)==null||w.call(f)}})}constructor(e){Oe(this,"links",void 0),Oe(this,"runtime",void 0),Oe(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(a=>a(this.runtime))}}const Gr={query:"query",mutate:"mutation",subscribe:"subscription"},Yr=l=>Gr[l];function Jr(l){const e=Dr(({path:a,args:f})=>{const S=[...a],w=Yr(S.pop()),k=S.join(".");return l[w](k,...f)});return Tr(a=>l.hasOwnProperty(a)?l[a]:a==="__untypedClient"?l:e[a])}function Xr(l){const e=new Kr(l);return Jr(e)}const Ut=l=>typeof l=="function";function Qr(l){if(l)return l;if(typeof window<"u"&&Ut(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Ut(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const $t=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function zt(l){let e=null,a=null;const f=()=>{clearTimeout(a),a=null,e=null};function S(r){var g,c;const o=[[]];let h=0;for(;;){const _=r[h];if(!_)break;const v=o[o.length-1];if(_.aborted){(g=_.reject)==null||g.call(_,new Error("Aborted")),h++;continue}if(l.validate(v.concat(_).map(u=>u.key))){v.push(_),h++;continue}if(v.length===0){(c=_.reject)==null||c.call(_,new Error("Input is too big for a single dispatch")),h++;continue}o.push([])}return o}function w(){const r=S(e);f();for(const o of r){if(!o.length)continue;const h={items:o};for(const c of o)c.batch=h;l.fetch(h.items.map(c=>c.key)).then(async c=>{var _;await Promise.all(c.map(async(v,y)=>{var i,n;const u=h.items[y];try{const t=await Promise.resolve(v);(i=u.resolve)==null||i.call(u,t)}catch(t){(n=u.reject)==null||n.call(u,t)}u.batch=null,u.reject=null,u.resolve=null}));for(const v of h.items)(_=v.reject)==null||_.call(v,new Error("Missing result")),v.batch=null}).catch(c=>{var _;for(const v of h.items)(_=v.reject)==null||_.call(v,c),v.batch=null})}}function k(r){const o={aborted:!1,key:r,batch:null,resolve:$t,reject:$t},h=new Promise((g,c)=>{o.reject=c,o.resolve=g,e||(e=[]),e.push(o)});return a||(a=setTimeout(w)),h}return{load:k}}function es(...l){const e=new AbortController,a=l.length;let f=0;const S=()=>{++f===a&&e.abort()};for(const w of l)w!=null&&w.aborted?S():w==null||w.addEventListener("abort",S,{once:!0});return e.signal}function ts(...l){const e=new AbortController;for(const a of l)a!=null&&a.aborted?e.abort():a==null||a.addEventListener("abort",()=>e.abort(),{once:!0});return e.signal}function ir(l){const e=l;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}function rs(l){return{url:l.url.toString(),fetch:l.fetch,transformer:ir(l.transformer),methodOverride:l.methodOverride}}function ss(l){const e={};for(let a=0;a<l.length;a++){const f=l[a];e[a]=f}return e}const is={query:"GET",mutation:"POST",subscription:"PATCH"};function nr(l){return"input"in l?l.transformer.input.serialize(l.input):ss(l.inputs.map(e=>l.transformer.input.serialize(e)))}const Nt=l=>{const e=l.url.split("?");let f=e[0].replace(/\/$/,"")+"/"+l.path;const S=[];if(e[1]&&S.push(e[1]),"inputs"in l&&S.push("batch=1"),l.type==="query"||l.type==="subscription"){const w=nr(l);w!==void 0&&l.methodOverride!=="POST"&&S.push(`input=${encodeURIComponent(JSON.stringify(w))}`)}return S.length&&(f+="?"+S.join("&")),f},ns=l=>{if(l.type==="query"&&l.methodOverride!=="POST")return;const e=nr(l);return e!==void 0?JSON.stringify(e):void 0},os=l=>ls({...l,contentTypeHeader:"application/json",getUrl:Nt,getBody:ns});class as extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const cs=l=>{var e;if(l!=null&&l.aborted)throw(e=l.throwIfAborted)==null||e.call(l),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new as};async function hs(l){cs(l.signal);const e=l.getUrl(l),a=l.getBody(l),{type:f}=l,S=await(async()=>{const k=await l.headers();return Symbol.iterator in k?Object.fromEntries(k):k})(),w={...l.contentTypeHeader?{"content-type":l.contentTypeHeader}:{},...l.trpcAcceptHeader?{"trpc-accept":l.trpcAcceptHeader}:void 0,...S};return Qr(l.fetch)(e,{method:l.methodOverride??is[f],signal:l.signal,body:a,headers:w})}async function ls(l){const e={},a=await hs(l);e.response=a;const f=await a.json();return e.responseJSON=f,{json:f,meta:e}}function ds(l){const e=rs(l),a=l.maxURLLength??1/0;return()=>{const f=r=>({validate(o){if(a===1/0)return!0;const h=o.map(_=>_.path).join(","),g=o.map(_=>_.input);return Nt({...e,type:r,path:h,inputs:g,signal:null}).length<=a},async fetch(o){const h=o.map(u=>u.path).join(","),g=o.map(u=>u.input),c=es(...o.map(u=>u.signal)),_=await os({...e,path:h,inputs:g,type:r,headers(){return l.headers?typeof l.headers=="function"?l.headers({opList:o}):l.headers:{}},signal:c});return(Array.isArray(_.json)?_.json:o.map(()=>_.json)).map(u=>({meta:_.meta,json:u}))}}),S=zt(f("query")),w=zt(f("mutation")),k={query:S,mutation:w};return({op:r})=>$e(o=>{/* istanbul ignore if -- @preserve */if(r.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const g=k[r.type].load(r);let c;return g.then(_=>{c=_;const v=zr(_.json,e.transformer.output);if(!v.ok){o.error(pe.from(v.error,{meta:_.meta}));return}o.next({context:_.meta,result:v.result}),o.complete()}).catch(_=>{o.error(pe.from(_,{meta:c==null?void 0:c.meta}))}),()=>{}})}}function qt(l){return Array.isArray(l)?l:[l]}function us(l){return e=>{const a=qt(l.true).map(S=>S(e)),f=qt(l.false).map(S=>S(e));return S=>$e(w=>{const k=l.condition(S.op)?a:f;return er({op:S.op,links:k}).subscribe(w)})}}const Ot=(l,...e)=>typeof l=="function"?l(...e):l;function fs(l,e){return!e||l!=null&&typeof l!="object"?l:{...l??{},lastEventId:e}}async function _s(l){let e=await Ot(l.url);if(l.connectionParams){const a=await Ot(l.connectionParams),f=e.includes("?")?"&":"?";e+=f+"connectionParams="+encodeURIComponent(JSON.stringify(a))}return e}const ps=[pt.BAD_GATEWAY,pt.SERVICE_UNAVAILABLE,pt.GATEWAY_TIMEOUT,pt.INTERNAL_SERVER_ERROR];function gs(l){const e=ir(l.transformer);return()=>({op:a})=>$e(f=>{const{type:S,path:w,input:k}=a;/* istanbul ignore if -- @preserve */if(S!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let r;const o=new AbortController,h=ts(a.signal,o.signal),g=Ur({url:async()=>Nt({transformer:e,url:await _s(l),input:fs(k,r),path:w,type:S,signal:null}),init:()=>Ot(l.eventSourceOptions,{op:a}),signal:h,deserialize:e.output.deserialize,EventSource:l.EventSource??globalThis.EventSource,reconnectAfterInactivityMs:l.reconnectAfterInactivityMs}),c=Lr({type:"state",state:"connecting",error:null}),_=c.subscribe({next(v){f.next({result:v})}});return Ar(async()=>{for await(const v of g)switch(v.type){case"ping":break;case"data":const y=v.data;let u;y.id?(r=y.id,u={id:y.id,data:y}):u={data:y.data},f.next({result:u,context:{eventSource:v.eventSource}});break;case"opened":{f.next({result:{type:"started"},context:{eventSource:v.eventSource}}),c.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const i=pe.from({error:v.error});if(ps.includes(v.error.code)){c.next({type:"state",state:"connecting",error:i});break}throw i}case"connecting":{const i=c.get(),n=v.event&&pe.from(v.event);if(!n&&i.state==="connecting")break;c.next({type:"state",state:"connecting",error:n});break}case"timeout":c.next({type:"state",state:"connecting",error:new pe(`Timeout of ${l.reconnectAfterInactivityMs}ms reached while waiting for a response`)})}f.next({result:{type:"stopped"}}),f.complete()}).catch(v=>{f.error(pe.from(v))}),()=>{f.complete(),o.abort(),_.unsubscribe()}})}const vs={version:"1.7.1",latte:{name:"Latte",emoji:"🌻",order:0,dark:!1,colors:{rosewater:{name:"Rosewater",order:0,hex:"#dc8a78",rgb:{r:220,g:138,b:120},hsl:{h:10.799999999999995,s:.5882352941176472,l:.6666666666666667},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#dd7878",rgb:{r:221,g:120,b:120},hsl:{h:0,s:.5976331360946746,l:.6686274509803922},accent:!0},pink:{name:"Pink",order:2,hex:"#ea76cb",rgb:{r:234,g:118,b:203},hsl:{h:316.0344827586207,s:.7341772151898731,l:.6901960784313725},accent:!0},mauve:{name:"Mauve",order:3,hex:"#8839ef",rgb:{r:136,g:57,b:239},hsl:{h:266.0439560439561,s:.8504672897196262,l:.5803921568627451},accent:!0},red:{name:"Red",order:4,hex:"#d20f39",rgb:{r:210,g:15,b:57},hsl:{h:347.0769230769231,s:.8666666666666666,l:.4411764705882353},accent:!0},maroon:{name:"Maroon",order:5,hex:"#e64553",rgb:{r:230,g:69,b:83},hsl:{h:354.78260869565213,s:.76303317535545,l:.5862745098039216},accent:!0},peach:{name:"Peach",order:6,hex:"#fe640b",rgb:{r:254,g:100,b:11},hsl:{h:21.975308641975307,s:.9918367346938776,l:.5196078431372549},accent:!0},yellow:{name:"Yellow",order:7,hex:"#df8e1d",rgb:{r:223,g:142,b:29},hsl:{h:34.948453608247426,s:.7698412698412698,l:.49411764705882355},accent:!0},green:{name:"Green",order:8,hex:"#40a02b",rgb:{r:64,g:160,b:43},hsl:{h:109.23076923076923,s:.5763546798029556,l:.39803921568627454},accent:!0},teal:{name:"Teal",order:9,hex:"#179299",rgb:{r:23,g:146,b:153},hsl:{h:183.23076923076923,s:.7386363636363636,l:.34509803921568627},accent:!0},sky:{name:"Sky",order:10,hex:"#04a5e5",rgb:{r:4,g:165,b:229},hsl:{h:197.0666666666667,s:.965665236051502,l:.45686274509803926},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#209fb5",rgb:{r:32,g:159,b:181},hsl:{h:188.85906040268458,s:.6995305164319249,l:.4176470588235294},accent:!0},blue:{name:"Blue",order:12,hex:"#1e66f5",rgb:{r:30,g:102,b:245},hsl:{h:219.90697674418607,s:.9148936170212768,l:.5392156862745098},accent:!0},lavender:{name:"Lavender",order:13,hex:"#7287fd",rgb:{r:114,g:135,b:253},hsl:{h:230.93525179856115,s:.9720279720279721,l:.7196078431372549},accent:!0},text:{name:"Text",order:14,hex:"#4c4f69",rgb:{r:76,g:79,b:105},hsl:{h:233.79310344827587,s:.16022099447513813,l:.3549019607843137},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#5c5f77",rgb:{r:92,g:95,b:119},hsl:{h:233.33333333333334,s:.1279620853080569,l:.4137254901960784},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#6c6f85",rgb:{r:108,g:111,b:133},hsl:{h:232.79999999999998,s:.10373443983402494,l:.4725490196078431},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#7c7f93",rgb:{r:124,g:127,b:147},hsl:{h:232.17391304347825,s:.09623430962343092,l:.5313725490196078},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#8c8fa1",rgb:{r:140,g:143,b:161},hsl:{h:231.42857142857144,s:.10047846889952144,l:.5901960784313726},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#9ca0b0",rgb:{r:156,g:160,b:176},hsl:{h:228.00000000000003,s:.11235955056179768,l:.6509803921568628},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#acb0be",rgb:{r:172,g:176,b:190},hsl:{h:226.6666666666667,s:.12162162162162159,l:.7098039215686275},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#bcc0cc",rgb:{r:188,g:192,b:204},hsl:{h:225.00000000000003,s:.13559322033898308,l:.7686274509803922},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#ccd0da",rgb:{r:204,g:208,b:218},hsl:{h:222.85714285714292,s:.1590909090909089,l:.8274509803921568},accent:!1},base:{name:"Base",order:23,hex:"#eff1f5",rgb:{r:239,g:241,b:245},hsl:{h:220.00000000000009,s:.23076923076923136,l:.9490196078431372},accent:!1},mantle:{name:"Mantle",order:24,hex:"#e6e9ef",rgb:{r:230,g:233,b:239},hsl:{h:220.00000000000006,s:.21951219512195116,l:.919607843137255},accent:!1},crust:{name:"Crust",order:25,hex:"#dce0e8",rgb:{r:220,g:224,b:232},hsl:{h:220.00000000000006,s:.20689655172413762,l:.8862745098039215},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#5c5f77",rgb:{r:92,g:95,b:119},hsl:{h:233.33333333333334,s:.1279620853080569,l:.4137254901960784},code:0},bright:{name:"Bright Black",hex:"#6c6f85",rgb:{r:108,g:111,b:133},hsl:{h:232.79999999999998,s:.10373443983402494,l:.4725490196078431},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#d20f39",rgb:{r:210,g:15,b:57},hsl:{h:347.0769230769231,s:.8666666666666666,l:.4411764705882353},code:1},bright:{name:"Bright Red",hex:"#de293e",rgb:{r:222,g:41,b:62},hsl:{h:353.0386740331492,s:.7327935222672065,l:.515686274509804},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#40a02b",rgb:{r:64,g:160,b:43},hsl:{h:109.23076923076923,s:.5763546798029556,l:.39803921568627454},code:2},bright:{name:"Bright Green",hex:"#49af3d",rgb:{r:73,g:175,b:61},hsl:{h:113.68421052631581,s:.48305084745762705,l:.4627450980392157},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#df8e1d",rgb:{r:223,g:142,b:29},hsl:{h:34.948453608247426,s:.7698412698412698,l:.49411764705882355},code:3},bright:{name:"Bright Yellow",hex:"#eea02d",rgb:{r:238,g:160,b:45},hsl:{h:35.751295336787564,s:.8502202643171807,l:.5549019607843138},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#1e66f5",rgb:{r:30,g:102,b:245},hsl:{h:219.90697674418607,s:.9148936170212768,l:.5392156862745098},code:4},bright:{name:"Bright Blue",hex:"#456eff",rgb:{r:69,g:110,b:255},hsl:{h:226.77419354838707,s:1,l:.6352941176470588},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#ea76cb",rgb:{r:234,g:118,b:203},hsl:{h:316.0344827586207,s:.7341772151898731,l:.6901960784313725},code:5},bright:{name:"Bright Magenta",hex:"#fe85d8",rgb:{r:254,g:133,b:216},hsl:{h:318.8429752066116,s:.983739837398374,l:.7588235294117647},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#179299",rgb:{r:23,g:146,b:153},hsl:{h:183.23076923076923,s:.7386363636363636,l:.34509803921568627},code:6},bright:{name:"Bright Cyan",hex:"#2d9fa8",rgb:{r:45,g:159,b:168},hsl:{h:184.39024390243904,s:.5774647887323943,l:.4176470588235294},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#acb0be",rgb:{r:172,g:176,b:190},hsl:{h:226.6666666666667,s:.12162162162162159,l:.7098039215686275},code:7},bright:{name:"Bright White",hex:"#bcc0cc",rgb:{r:188,g:192,b:204},hsl:{h:225.00000000000003,s:.13559322033898308,l:.7686274509803922},code:15}}}},frappe:{name:"Frappé",emoji:"🪴",order:1,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f2d5cf",rgb:{r:242,g:213,b:207},hsl:{h:10.2857142857143,s:.5737704918032784,l:.8803921568627451},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#eebebe",rgb:{r:238,g:190,b:190},hsl:{h:0,s:.5853658536585367,l:.8392156862745098},accent:!0},pink:{name:"Pink",order:2,hex:"#f4b8e4",rgb:{r:244,g:184,b:228},hsl:{h:316,s:.7317073170731713,l:.8392156862745098},accent:!0},mauve:{name:"Mauve",order:3,hex:"#ca9ee6",rgb:{r:202,g:158,b:230},hsl:{h:276.66666666666663,s:.5901639344262294,l:.7607843137254902},accent:!0},red:{name:"Red",order:4,hex:"#e78284",rgb:{r:231,g:130,b:132},hsl:{h:358.8118811881188,s:.6778523489932885,l:.7078431372549019},accent:!0},maroon:{name:"Maroon",order:5,hex:"#ea999c",rgb:{r:234,g:153,b:156},hsl:{h:357.77777777777777,s:.6585365853658534,l:.7588235294117647},accent:!0},peach:{name:"Peach",order:6,hex:"#ef9f76",rgb:{r:239,g:159,b:118},hsl:{h:20.33057851239669,s:.7908496732026143,l:.7},accent:!0},yellow:{name:"Yellow",order:7,hex:"#e5c890",rgb:{r:229,g:200,b:144},hsl:{h:39.52941176470588,s:.6204379562043796,l:.7313725490196079},accent:!0},green:{name:"Green",order:8,hex:"#a6d189",rgb:{r:166,g:209,b:137},hsl:{h:95.83333333333331,s:.4390243902439024,l:.6784313725490196},accent:!0},teal:{name:"Teal",order:9,hex:"#81c8be",rgb:{r:129,g:200,b:190},hsl:{h:171.5492957746479,s:.3922651933701657,l:.6450980392156862},accent:!0},sky:{name:"Sky",order:10,hex:"#99d1db",rgb:{r:153,g:209,b:219},hsl:{h:189.09090909090907,s:.47826086956521735,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#85c1dc",rgb:{r:133,g:193,b:220},hsl:{h:198.62068965517244,s:.5541401273885351,l:.692156862745098},accent:!0},blue:{name:"Blue",order:12,hex:"#8caaee",rgb:{r:140,g:170,b:238},hsl:{h:221.6326530612245,s:.7424242424242424,l:.7411764705882353},accent:!0},lavender:{name:"Lavender",order:13,hex:"#babbf1",rgb:{r:186,g:187,b:241},hsl:{h:238.90909090909093,s:.6626506024096385,l:.8372549019607842},accent:!0},text:{name:"Text",order:14,hex:"#c6d0f5",rgb:{r:198,g:208,b:245},hsl:{h:227.2340425531915,s:.7014925373134333,l:.8686274509803922},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#b5bfe2",rgb:{r:181,g:191,b:226},hsl:{h:226.66666666666669,s:.43689320388349495,l:.7980392156862746},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a5adce",rgb:{r:165,g:173,b:206},hsl:{h:228.29268292682926,s:.2949640287769784,l:.7274509803921569},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#949cbb",rgb:{r:148,g:156,b:187},hsl:{h:227.69230769230768,s:.22285714285714275,l:.6568627450980392},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#838ba7",rgb:{r:131,g:139,b:167},hsl:{h:226.66666666666669,s:.16981132075471703,l:.584313725490196},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#737994",rgb:{r:115,g:121,b:148},hsl:{h:229.0909090909091,s:.13360323886639683,l:.515686274509804},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#626880",rgb:{r:98,g:104,b:128},hsl:{h:228.00000000000003,s:.1327433628318584,l:.44313725490196076},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#51576d",rgb:{r:81,g:87,b:109},hsl:{h:227.14285714285714,s:.14736842105263157,l:.37254901960784315},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#414559",rgb:{r:65,g:69,b:89},hsl:{h:230.00000000000003,s:.15584415584415584,l:.30196078431372547},accent:!1},base:{name:"Base",order:23,hex:"#303446",rgb:{r:48,g:52,b:70},hsl:{h:229.0909090909091,s:.18644067796610175,l:.23137254901960785},accent:!1},mantle:{name:"Mantle",order:24,hex:"#292c3c",rgb:{r:41,g:44,b:60},hsl:{h:230.52631578947367,s:.18811881188118806,l:.19803921568627453},accent:!1},crust:{name:"Crust",order:25,hex:"#232634",rgb:{r:35,g:38,b:52},hsl:{h:229.41176470588238,s:.19540229885057467,l:.17058823529411765},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#51576d",rgb:{r:81,g:87,b:109},hsl:{h:227.14285714285714,s:.14736842105263157,l:.37254901960784315},code:0},bright:{name:"Bright Black",hex:"#626880",rgb:{r:98,g:104,b:128},hsl:{h:228.00000000000003,s:.1327433628318584,l:.44313725490196076},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#e78284",rgb:{r:231,g:130,b:132},hsl:{h:358.8118811881188,s:.6778523489932885,l:.7078431372549019},code:1},bright:{name:"Bright Red",hex:"#e67172",rgb:{r:230,g:113,b:114},hsl:{h:359.4871794871795,s:.7005988023952096,l:.6725490196078432},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6d189",rgb:{r:166,g:209,b:137},hsl:{h:95.83333333333331,s:.4390243902439024,l:.6784313725490196},code:2},bright:{name:"Bright Green",hex:"#8ec772",rgb:{r:142,g:199,b:114},hsl:{h:100.23529411764706,s:.431472081218274,l:.6137254901960785},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#e5c890",rgb:{r:229,g:200,b:144},hsl:{h:39.52941176470588,s:.6204379562043796,l:.7313725490196079},code:3},bright:{name:"Bright Yellow",hex:"#d9ba73",rgb:{r:217,g:186,b:115},hsl:{h:41.764705882352935,s:.5730337078651685,l:.6509803921568628},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#8caaee",rgb:{r:140,g:170,b:238},hsl:{h:221.6326530612245,s:.7424242424242424,l:.7411764705882353},code:4},bright:{name:"Bright Blue",hex:"#7b9ef0",rgb:{r:123,g:158,b:240},hsl:{h:222.05128205128207,s:.7959183673469388,l:.711764705882353},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f4b8e4",rgb:{r:244,g:184,b:228},hsl:{h:316,s:.7317073170731713,l:.8392156862745098},code:5},bright:{name:"Bright Magenta",hex:"#f2a4db",rgb:{r:242,g:164,b:219},hsl:{h:317.6923076923077,s:.7499999999999998,l:.7960784313725491},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#81c8be",rgb:{r:129,g:200,b:190},hsl:{h:171.5492957746479,s:.3922651933701657,l:.6450980392156862},code:6},bright:{name:"Bright Cyan",hex:"#5abfb5",rgb:{r:90,g:191,b:181},hsl:{h:174.05940594059405,s:.44104803493449785,l:.5509803921568628},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a5adce",rgb:{r:165,g:173,b:206},hsl:{h:228.29268292682926,s:.2949640287769784,l:.7274509803921569},code:7},bright:{name:"Bright White",hex:"#b5bfe2",rgb:{r:181,g:191,b:226},hsl:{h:226.66666666666669,s:.43689320388349495,l:.7980392156862746},code:15}}}},macchiato:{name:"Macchiato",emoji:"🌺",order:2,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f4dbd6",rgb:{r:244,g:219,b:214},hsl:{h:9.999999999999963,s:.5769230769230775,l:.8980392156862745},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#f0c6c6",rgb:{r:240,g:198,b:198},hsl:{h:0,s:.5833333333333333,l:.8588235294117648},accent:!0},pink:{name:"Pink",order:2,hex:"#f5bde6",rgb:{r:245,g:189,b:230},hsl:{h:316.0714285714286,s:.7368421052631583,l:.8509803921568628},accent:!0},mauve:{name:"Mauve",order:3,hex:"#c6a0f6",rgb:{r:198,g:160,b:246},hsl:{h:266.51162790697674,s:.8269230769230772,l:.7960784313725491},accent:!0},red:{name:"Red",order:4,hex:"#ed8796",rgb:{r:237,g:135,b:150},hsl:{h:351.1764705882353,s:.7391304347826088,l:.7294117647058824},accent:!0},maroon:{name:"Maroon",order:5,hex:"#ee99a0",rgb:{r:238,g:153,b:160},hsl:{h:355.05882352941177,s:.7142857142857143,l:.7666666666666666},accent:!0},peach:{name:"Peach",order:6,hex:"#f5a97f",rgb:{r:245,g:169,b:127},hsl:{h:21.355932203389827,s:.8550724637681162,l:.7294117647058824},accent:!0},yellow:{name:"Yellow",order:7,hex:"#eed49f",rgb:{r:238,g:212,b:159},hsl:{h:40.253164556962034,s:.6991150442477877,l:.7784313725490196},accent:!0},green:{name:"Green",order:8,hex:"#a6da95",rgb:{r:166,g:218,b:149},hsl:{h:105.21739130434783,s:.4825174825174825,l:.7196078431372549},accent:!0},teal:{name:"Teal",order:9,hex:"#8bd5ca",rgb:{r:139,g:213,b:202},hsl:{h:171.08108108108107,s:.46835443037974706,l:.6901960784313725},accent:!0},sky:{name:"Sky",order:10,hex:"#91d7e3",rgb:{r:145,g:215,b:227},hsl:{h:188.78048780487802,s:.5942028985507245,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#7dc4e4",rgb:{r:125,g:196,b:228},hsl:{h:198.64077669902912,s:.6560509554140128,l:.692156862745098},accent:!0},blue:{name:"Blue",order:12,hex:"#8aadf4",rgb:{r:138,g:173,b:244},hsl:{h:220.188679245283,s:.8281250000000003,l:.7490196078431373},accent:!0},lavender:{name:"Lavender",order:13,hex:"#b7bdf8",rgb:{r:183,g:189,b:248},hsl:{h:234.46153846153848,s:.8227848101265824,l:.8450980392156863},accent:!0},text:{name:"Text",order:14,hex:"#cad3f5",rgb:{r:202,g:211,b:245},hsl:{h:227.4418604651163,s:.6825396825396831,l:.8764705882352941},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#b8c0e0",rgb:{r:184,g:192,b:224},hsl:{h:228,s:.39215686274509803,l:.8},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a5adcb",rgb:{r:165,g:173,b:203},hsl:{h:227.36842105263156,s:.2676056338028167,l:.7215686274509804},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#939ab7",rgb:{r:147,g:154,b:183},hsl:{h:228.33333333333331,s:.2000000000000001,l:.6470588235294117},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#8087a2",rgb:{r:128,g:135,b:162},hsl:{h:227.6470588235294,s:.1545454545454545,l:.5686274509803921},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#6e738d",rgb:{r:110,g:115,b:141},hsl:{h:230.32258064516128,s:.12350597609561753,l:.49215686274509807},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#5b6078",rgb:{r:91,g:96,b:120},hsl:{h:229.65517241379308,s:.13744075829383887,l:.4137254901960784},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#494d64",rgb:{r:73,g:77,b:100},hsl:{h:231.11111111111114,s:.15606936416184972,l:.3392156862745098},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#363a4f",rgb:{r:54,g:58,b:79},hsl:{h:230.4,s:.1879699248120301,l:.2607843137254902},accent:!1},base:{name:"Base",order:23,hex:"#24273a",rgb:{r:36,g:39,b:58},hsl:{h:231.8181818181818,s:.23404255319148934,l:.1843137254901961},accent:!1},mantle:{name:"Mantle",order:24,hex:"#1e2030",rgb:{r:30,g:32,b:48},hsl:{h:233.33333333333334,s:.23076923076923075,l:.15294117647058825},accent:!1},crust:{name:"Crust",order:25,hex:"#181926",rgb:{r:24,g:25,b:38},hsl:{h:235.71428571428572,s:.22580645161290322,l:.12156862745098039},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#494d64",rgb:{r:73,g:77,b:100},hsl:{h:231.11111111111114,s:.15606936416184972,l:.3392156862745098},code:0},bright:{name:"Bright Black",hex:"#5b6078",rgb:{r:91,g:96,b:120},hsl:{h:229.65517241379308,s:.13744075829383887,l:.4137254901960784},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#ed8796",rgb:{r:237,g:135,b:150},hsl:{h:351.1764705882353,s:.7391304347826088,l:.7294117647058824},code:1},bright:{name:"Bright Red",hex:"#ec7486",rgb:{r:236,g:116,b:134},hsl:{h:351,s:.759493670886076,l:.6901960784313725},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6da95",rgb:{r:166,g:218,b:149},hsl:{h:105.21739130434783,s:.4825174825174825,l:.7196078431372549},code:2},bright:{name:"Bright Green",hex:"#8ccf7f",rgb:{r:140,g:207,b:127},hsl:{h:110.24999999999999,s:.45454545454545453,l:.6549019607843137},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#eed49f",rgb:{r:238,g:212,b:159},hsl:{h:40.253164556962034,s:.6991150442477877,l:.7784313725490196},code:3},bright:{name:"Bright Yellow",hex:"#e1c682",rgb:{r:225,g:198,b:130},hsl:{h:42.94736842105264,s:.6129032258064515,l:.696078431372549},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#8aadf4",rgb:{r:138,g:173,b:244},hsl:{h:220.188679245283,s:.8281250000000003,l:.7490196078431373},code:4},bright:{name:"Bright Blue",hex:"#78a1f6",rgb:{r:120,g:161,b:246},hsl:{h:220.47619047619048,s:.8750000000000002,l:.7176470588235294},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f5bde6",rgb:{r:245,g:189,b:230},hsl:{h:316.0714285714286,s:.7368421052631583,l:.8509803921568628},code:5},bright:{name:"Bright Magenta",hex:"#f2a9dd",rgb:{r:242,g:169,b:221},hsl:{h:317.26027397260276,s:.7373737373737372,l:.8058823529411765},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#8bd5ca",rgb:{r:139,g:213,b:202},hsl:{h:171.08108108108107,s:.46835443037974706,l:.6901960784313725},code:6},bright:{name:"Bright Cyan",hex:"#63cbc0",rgb:{r:99,g:203,b:192},hsl:{h:173.65384615384616,s:.4999999999999998,l:.592156862745098},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a5adcb",rgb:{r:165,g:173,b:203},hsl:{h:227.36842105263156,s:.2676056338028167,l:.7215686274509804},code:7},bright:{name:"Bright White",hex:"#b8c0e0",rgb:{r:184,g:192,b:224},hsl:{h:228,s:.39215686274509803,l:.8},code:15}}}},mocha:{name:"Mocha",emoji:"🌿",order:3,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f5e0dc",rgb:{r:245,g:224,b:220},hsl:{h:9.599999999999968,s:.555555555555556,l:.911764705882353},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#f2cdcd",rgb:{r:242,g:205,b:205},hsl:{h:0,s:.587301587301587,l:.8764705882352941},accent:!0},pink:{name:"Pink",order:2,hex:"#f5c2e7",rgb:{r:245,g:194,b:231},hsl:{h:316.4705882352941,s:.7183098591549301,l:.8607843137254902},accent:!0},mauve:{name:"Mauve",order:3,hex:"#cba6f7",rgb:{r:203,g:166,b:247},hsl:{h:267.4074074074074,s:.8350515463917528,l:.8098039215686275},accent:!0},red:{name:"Red",order:4,hex:"#f38ba8",rgb:{r:243,g:139,b:168},hsl:{h:343.2692307692308,s:.8124999999999998,l:.7490196078431373},accent:!0},maroon:{name:"Maroon",order:5,hex:"#eba0ac",rgb:{r:235,g:160,b:172},hsl:{h:350.4,s:.6521739130434779,l:.7745098039215685},accent:!0},peach:{name:"Peach",order:6,hex:"#fab387",rgb:{r:250,g:179,b:135},hsl:{h:22.95652173913043,s:.92,l:.7549019607843137},accent:!0},yellow:{name:"Yellow",order:7,hex:"#f9e2af",rgb:{r:249,g:226,b:175},hsl:{h:41.35135135135135,s:.8604651162790699,l:.8313725490196078},accent:!0},green:{name:"Green",order:8,hex:"#a6e3a1",rgb:{r:166,g:227,b:161},hsl:{h:115.45454545454544,s:.5409836065573769,l:.7607843137254902},accent:!0},teal:{name:"Teal",order:9,hex:"#94e2d5",rgb:{r:148,g:226,b:213},hsl:{h:170.00000000000003,s:.5735294117647057,l:.7333333333333334},accent:!0},sky:{name:"Sky",order:10,hex:"#89dceb",rgb:{r:137,g:220,b:235},hsl:{h:189.18367346938774,s:.7101449275362316,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#74c7ec",rgb:{r:116,g:199,b:236},hsl:{h:198.5,s:.759493670886076,l:.6901960784313725},accent:!0},blue:{name:"Blue",order:12,hex:"#89b4fa",rgb:{r:137,g:180,b:250},hsl:{h:217.1681415929203,s:.9186991869918699,l:.7588235294117647},accent:!0},lavender:{name:"Lavender",order:13,hex:"#b4befe",rgb:{r:180,g:190,b:254},hsl:{h:231.89189189189187,s:.9736842105263159,l:.8509803921568628},accent:!0},text:{name:"Text",order:14,hex:"#cdd6f4",rgb:{r:205,g:214,b:244},hsl:{h:226.15384615384616,s:.6393442622950825,l:.8803921568627451},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#bac2de",rgb:{r:186,g:194,b:222},hsl:{h:226.66666666666669,s:.35294117647058837,l:.8},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a6adc8",rgb:{r:166,g:173,b:200},hsl:{h:227.6470588235294,s:.23611111111111102,l:.7176470588235294},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#9399b2",rgb:{r:147,g:153,b:178},hsl:{h:228.38709677419354,s:.16756756756756758,l:.6372549019607843},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#7f849c",rgb:{r:127,g:132,b:156},hsl:{h:229.65517241379308,s:.12775330396475776,l:.5549019607843138},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#6c7086",rgb:{r:108,g:112,b:134},hsl:{h:230.7692307692308,s:.10743801652892565,l:.4745098039215686},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#585b70",rgb:{r:88,g:91,b:112},hsl:{h:232.5,s:.12,l:.39215686274509803},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#45475a",rgb:{r:69,g:71,b:90},hsl:{h:234.2857142857143,s:.13207547169811326,l:.31176470588235294},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#313244",rgb:{r:49,g:50,b:68},hsl:{h:236.84210526315792,s:.16239316239316234,l:.22941176470588237},accent:!1},base:{name:"Base",order:23,hex:"#1e1e2e",rgb:{r:30,g:30,b:46},hsl:{h:240,s:.21052631578947367,l:.14901960784313725},accent:!1},mantle:{name:"Mantle",order:24,hex:"#181825",rgb:{r:24,g:24,b:37},hsl:{h:240,s:.2131147540983607,l:.11960784313725491},accent:!1},crust:{name:"Crust",order:25,hex:"#11111b",rgb:{r:17,g:17,b:27},hsl:{h:240,s:.22727272727272727,l:.08627450980392157},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#45475a",rgb:{r:69,g:71,b:90},hsl:{h:234.2857142857143,s:.13207547169811326,l:.31176470588235294},code:0},bright:{name:"Bright Black",hex:"#585b70",rgb:{r:88,g:91,b:112},hsl:{h:232.5,s:.12,l:.39215686274509803},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#f38ba8",rgb:{r:243,g:139,b:168},hsl:{h:343.2692307692308,s:.8124999999999998,l:.7490196078431373},code:1},bright:{name:"Bright Red",hex:"#f37799",rgb:{r:243,g:119,b:153},hsl:{h:343.54838709677415,s:.8378378378378376,l:.7098039215686274},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6e3a1",rgb:{r:166,g:227,b:161},hsl:{h:115.45454545454544,s:.5409836065573769,l:.7607843137254902},code:2},bright:{name:"Bright Green",hex:"#89d88b",rgb:{r:137,g:216,b:139},hsl:{h:121.51898734177213,s:.5031847133757963,l:.692156862745098},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#f9e2af",rgb:{r:249,g:226,b:175},hsl:{h:41.35135135135135,s:.8604651162790699,l:.8313725490196078},code:3},bright:{name:"Bright Yellow",hex:"#ebd391",rgb:{r:235,g:211,b:145},hsl:{h:44,s:.692307692307692,l:.7450980392156863},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#89b4fa",rgb:{r:137,g:180,b:250},hsl:{h:217.1681415929203,s:.9186991869918699,l:.7588235294117647},code:4},bright:{name:"Bright Blue",hex:"#74a8fc",rgb:{r:116,g:168,b:252},hsl:{h:217.05882352941174,s:.9577464788732396,l:.7215686274509804},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f5c2e7",rgb:{r:245,g:194,b:231},hsl:{h:316.4705882352941,s:.7183098591549301,l:.8607843137254902},code:5},bright:{name:"Bright Magenta",hex:"#f2aede",rgb:{r:242,g:174,b:222},hsl:{h:317.6470588235294,s:.7234042553191488,l:.8156862745098039},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#94e2d5",rgb:{r:148,g:226,b:213},hsl:{h:170.00000000000003,s:.5735294117647057,l:.7333333333333334},code:6},bright:{name:"Bright Cyan",hex:"#6bd7ca",rgb:{r:107,g:215,b:202},hsl:{h:172.77777777777777,s:.5744680851063831,l:.6313725490196078},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a6adc8",rgb:{r:166,g:173,b:200},hsl:{h:227.6470588235294,s:.23611111111111102,l:.7176470588235294},code:7},bright:{name:"Bright White",hex:"#bac2de",rgb:{r:186,g:194,b:222},hsl:{h:226.66666666666669,s:.35294117647058837,l:.8},code:15}}}}},vt=l=>Object.entries(l),{version:Di,...ms}=vs,or=vt(ms).reduce((l,[e,a])=>(l[e]={...a,colorEntries:vt(a.colors),ansiColorEntries:vt(a.ansiColors)},l),{});vt(or);var ar={exports:{}};(function(l,e){(function(a,f){l.exports=f()})(self,()=>(()=>{var a={};return(()=>{var f=a;Object.defineProperty(f,"__esModule",{value:!0}),f.FitAddon=void 0,f.FitAddon=class{activate(S){this._terminal=S}dispose(){}fit(){const S=this.proposeDimensions();if(!S||!this._terminal||isNaN(S.cols)||isNaN(S.rows))return;const w=this._terminal._core;this._terminal.rows===S.rows&&this._terminal.cols===S.cols||(w._renderService.clear(),this._terminal.resize(S.cols,S.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const S=this._terminal._core,w=S._renderService.dimensions;if(w.css.cell.width===0||w.css.cell.height===0)return;const k=this._terminal.options.scrollback===0?0:S.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),c=o-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),_=h-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-k;return{cols:Math.max(2,Math.floor(_/w.css.cell.width)),rows:Math.max(1,Math.floor(c/w.css.cell.height))}}}})(),a})())})(ar);var bs=ar.exports,cr={exports:{}};(function(l,e){(function(a,f){l.exports=f()})(globalThis,()=>(()=>{var a={4567:function(k,r,o){var h=this&&this.__decorate||function(t,s,d,b){var m,C=arguments.length,p=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,d,b);else for(var E=t.length-1;E>=0;E--)(m=t[E])&&(p=(C<3?m(p):C>3?m(s,d,p):m(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},g=this&&this.__param||function(t,s){return function(d,b){s(d,b,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const c=o(9042),_=o(9924),v=o(844),y=o(4725),u=o(2585),i=o(3656);let n=r.AccessibilityManager=class extends v.Disposable{constructor(t,s,d,b){super(),this._terminal=t,this._coreBrowserService=d,this._renderService=b,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 m=0;m<this._terminal.rows;m++)this._rowElements[m]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[m]);if(this._topBoundaryFocusListener=m=>this._handleBoundaryFocus(m,0),this._bottomBoundaryFocusListener=m=>this._handleBoundaryFocus(m,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new _.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(m=>this._handleResize(m.rows))),this.register(this._terminal.onRender(m=>this._refreshRows(m.start,m.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(m=>this._handleChar(m))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
|
-
`))),this.register(this._terminal.onA11yTab(m=>this._handleTab(m))),this.register(this._terminal.onKey(m=>this._handleKey(m.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(
|
|
3
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,s){this._liveRegionDebouncer.refresh(t,s,this._terminal.rows)}_renderRows(t,s){const d=this._terminal.buffer,b=d.lines.length.toString();for(let m=t;m<=s;m++){const C=d.lines.get(d.ydisp+m),p=[],E=(C==null?void 0:C.translateToString(!0,void 0,void 0,p))||"",T=(d.ydisp+m+1).toString(),B=this._rowElements[m];B&&(E.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=E,this._rowColumns.set(B,p)),B.setAttribute("aria-posinset",T),B.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,s){const d=t.target,b=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||t.relatedTarget!==b)return;let m,C;if(s===0?(m=d,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(m=this._rowElements.shift(),C=d,this._rowContainer.removeChild(m)),m.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{const p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const t=document.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:t.anchorNode,offset:t.anchorOffset},d={node:t.focusNode,offset:t.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const b=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:b,offset:((E=b.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(d.node))return;const m=({node:T,offset:B})=>{const O=T instanceof Text?T.parentNode:T;let D=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const P=this._rowColumns.get(O);if(!P)return console.warn("columns is null. Race condition?"),null;let N=B<P.length?P[B]:P.slice(-1)[0]+1;return N>=this._terminal.cols&&(++D,N=0),{row:D,column:N}},C=m(s),p=m(d);if(C&&p){if(C.row>p.row||C.row===p.row&&C.column>=p.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(p.row-C.row)*this._terminal.cols-C.column+p.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_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 t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=n=h([g(1,u.IInstantiationService),g(2,y.ICoreBrowserService),g(3,y.IRenderService)],n)},3614:(k,r)=>{function o(_){return _.replace(/\r?\n/g,"\r")}function h(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function g(_,v,y,u){_=h(_=o(_),y.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(_,!0),v.value=""}function c(_,v,y){const u=y.getBoundingClientRect(),i=_.clientX-u.left-10,n=_.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${n}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=h,r.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,v,y,u){_.stopPropagation(),_.clipboardData&&g(_.clipboardData.getData("text/plain"),v,y,u)},r.paste=g,r.moveTextAreaUnderMouseCursor=c,r.rightClickHandler=function(_,v,y,u,i){c(_,v,y),i&&u.rightClickSelect(_),v.value=u.selectionText,v.select()}},7239:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const h=o(1505);r.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(g,c,_){this._css.set(g,c,_)}getCss(g,c){return this._css.get(g,c)}setColor(g,c,_){this._color.set(g,c,_)}getColor(g,c){return this._color.get(g,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,h,g,c){o.addEventListener(h,g,c);let _=!1;return{dispose:()=>{_||(_=!0,o.removeEventListener(h,g,c))}}}},3551:function(k,r,o){var h=this&&this.__decorate||function(n,t,s,d){var b,m=arguments.length,C=m<3?t:d===null?d=Object.getOwnPropertyDescriptor(t,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,t,s,d);else for(var p=n.length-1;p>=0;p--)(b=n[p])&&(C=(m<3?b(C):m>3?b(t,s,C):b(t,s))||C);return m>3&&C&&Object.defineProperty(t,s,C),C},g=this&&this.__param||function(n,t){return function(s,d){t(s,d,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const c=o(3656),_=o(8460),v=o(844),y=o(2585),u=o(4725);let i=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(n,t,s,d,b){super(),this._element=n,this._mouseService=t,this._renderService=s,this._bufferService=d,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var m;this._lastMouseEvent=void 0,(m=this._activeProviderReplies)==null||m.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const t=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const s=n.composedPath();for(let d=0;d<s.length;d++){const b=s[d];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,t){var d,b;this._activeProviderReplies&&t||((d=this._activeProviderReplies)==null||d.forEach(m=>{m==null||m.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let s=!1;for(const[m,C]of this._linkProviderService.linkProviders.entries())t?(b=this._activeProviderReplies)!=null&&b.get(m)&&(s=this._checkLinkProviderResult(m,n,s)):C.provideLinks(n.y,p=>{var T,B;if(this._isMouseOut)return;const E=p==null?void 0:p.map(O=>({link:O}));(T=this._activeProviderReplies)==null||T.set(m,E),s=this._checkLinkProviderResult(m,n,s),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,t){const s=new Set;for(let d=0;d<t.size;d++){const b=t.get(d);if(b)for(let m=0;m<b.length;m++){const C=b[m],p=C.link.range.start.y<n?0:C.link.range.start.x,E=C.link.range.end.y>n?this._bufferService.cols:C.link.range.end.x;for(let T=p;T<=E;T++){if(s.has(T)){b.splice(m--,1);break}s.add(T)}}}}_checkLinkProviderResult(n,t,s){var m;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(n);let b=!1;for(let C=0;C<n;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(b=!0);if(!b&&d){const C=d.find(p=>this._linkAtPosition(p.link,t));C&&(s=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let C=0;C<this._activeProviderReplies.size;C++){const p=(m=this._activeProviderReplies.get(C))==null?void 0:m.find(E=>this._linkAtPosition(E.link,t));if(p){s=!0,this._handleNewLink(p);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const t=this._positionFromMouseEvent(n,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,t){this._currentLink&&this._lastMouseEvent&&(!n||!t||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(n.link,t)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,b,m;(d=this._currentLink)!=null&&d.state&&((m=(b=this._currentLink)==null?void 0:b.state)==null?void 0:m.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(d,b),this._lastMouseEvent)){const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._askForLink(m,!1)}})))}_linkHover(n,t,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(n,t){const s=n.range,d=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(n,t,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(n,t){const s=n.range.start.y*this._bufferService.cols+n.range.start.x,d=n.range.end.y*this._bufferService.cols+n.range.end.x,b=t.y*this._bufferService.cols+t.x;return s<=b&&b<=d}_positionFromMouseEvent(n,t,s){const d=s.getCoords(n,t,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,t,s,d,b){return{x1:n,y1:t,x2:s,y2:d,cols:this._bufferService.cols,fg:b}}};r.Linkifier=i=h([g(1,u.IMouseService),g(2,u.IRenderService),g(3,y.IBufferService),g(4,u.ILinkProviderService)],i)},9042:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(k,r,o){var h=this&&this.__decorate||function(u,i,n,t){var s,d=arguments.length,b=d<3?i:t===null?t=Object.getOwnPropertyDescriptor(i,n):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,i,n,t);else for(var m=u.length-1;m>=0;m--)(s=u[m])&&(b=(d<3?s(b):d>3?s(i,n,b):s(i,n))||b);return d>3&&b&&Object.defineProperty(i,n,b),b},g=this&&this.__param||function(u,i){return function(n,t){i(n,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const c=o(511),_=o(2585);let v=r.OscLinkProvider=class{constructor(u,i,n){this._bufferService=u,this._optionsService=i,this._oscLinkService=n}provideLinks(u,i){var E;const n=this._bufferService.buffer.lines.get(u-1);if(!n)return void i(void 0);const t=[],s=this._optionsService.rawOptions.linkHandler,d=new c.CellData,b=n.getTrimmedLength();let m=-1,C=-1,p=!1;for(let T=0;T<b;T++)if(C!==-1||n.hasContent(T)){if(n.loadCell(T,d),d.hasExtendedAttrs()&&d.extended.urlId){if(C===-1){C=T,m=d.extended.urlId;continue}p=d.extended.urlId!==m}else C!==-1&&(p=!0);if(p||C!==-1&&T===b-1){const B=(E=this._oscLinkService.getLinkData(m))==null?void 0:E.uri;if(B){const O={start:{x:C+1,y:u},end:{x:T+(p||T!==b-1?0:1),y:u}};let D=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const P=new URL(B);["http:","https:"].includes(P.protocol)||(D=!0)}catch{D=!0}D||t.push({text:B,range:O,activate:(P,N)=>s?s.activate(P,N,O):y(0,N),hover:(P,N)=>{var U;return(U=s==null?void 0:s.hover)==null?void 0:U.call(s,P,N,O)},leave:(P,N)=>{var U;return(U=s==null?void 0:s.leave)==null?void 0:U.call(s,P,N,O)}})}p=!1,d.hasExtendedAttrs()&&d.extended.urlId?(C=T,m=d.extended.urlId):(C=-1,m=-1)}}i(t)}};function y(u,i){if(confirm(`Do you want to navigate to ${i}?
|
|
1
|
+
var wr=Object.defineProperty;var Er=(l,e,a)=>e in l?wr(l,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[e]=a;var Ke=(l,e,a)=>Er(l,typeof e!="symbol"?e+"":e,a);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const S of document.querySelectorAll('link[rel="modulepreload"]'))_(S);new MutationObserver(S=>{for(const w of S)if(w.type==="childList")for(const R of w.addedNodes)R.tagName==="LINK"&&R.rel==="modulepreload"&&_(R)}).observe(document,{childList:!0,subtree:!0});function a(S){const w={};return S.integrity&&(w.integrity=S.integrity),S.referrerPolicy&&(w.referrerPolicy=S.referrerPolicy),S.crossOrigin==="use-credentials"?w.credentials="include":S.crossOrigin==="anonymous"?w.credentials="omit":w.credentials="same-origin",w}function _(S){if(S.ep)return;S.ep=!0;const w=a(S);fetch(S.href,w)}})();function Oe(l,e,a){return e in l?Object.defineProperty(l,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):l[e]=a,l}function $e(l){const e={subscribe(a){let _=null,S=!1,w=!1,R=!1;function t(){if(_===null){R=!0;return}w||(w=!0,typeof _=="function"?_():_&&_.unsubscribe())}return _=l({next(o){var h;S||(h=a.next)==null||h.call(a,o)},error(o){var h;S||(S=!0,(h=a.error)==null||h.call(a,o),t())},complete(){var o;S||(S=!0,(o=a.complete)==null||o.call(a),t())}}),R&&t(),{unsubscribe:t}},pipe(...a){return a.reduce(xr,e)}};return e}function xr(l,e){return e(l)}function kr(l){const e=new AbortController;return new Promise((_,S)=>{let w=!1;function R(){w||(w=!0,t.unsubscribe())}e.signal.addEventListener("abort",()=>{S(e.signal.reason)});const t=l.subscribe({next(o){w=!0,_(o),R()},error(o){S(o)},complete(){e.abort(),R()}})})}function Rr(l){return e=>{let a=0,_=null;const S=[];function w(){_||(_=e.subscribe({next(t){var o;for(const h of S)(o=h.next)==null||o.call(h,t)},error(t){var o;for(const h of S)(o=h.error)==null||o.call(h,t)},complete(){var t;for(const o of S)(t=o.complete)==null||t.call(o)}}))}function R(){if(a===0&&_){const t=_;_=null,t.unsubscribe()}}return $e(t=>(a++,S.push(t),w(),{unsubscribe(){a--,R();const o=S.findIndex(h=>h===t);o>-1&&S.splice(o,1)}}))}}function Lr(l){let e=l;const a=[],_=R=>{e!==void 0&&R.next(e),a.push(R)},S=R=>{a.splice(a.indexOf(R),1)},w=$e(R=>(_(R),()=>{S(R)}));return w.next=R=>{if(e!==R){e=R;for(const t of a)t.next(R)}},w.get=()=>e,w}function tr(l){return $e(e=>{function a(S=0,w=l.op){const R=l.links[S];if(!R)throw new Error("No more links to execute - did you forget to add an ending link?");return R({op:w,next(o){return a(S+1,o)}})}return a().subscribe(e)})}const rr=()=>{},jt=l=>{Object.freeze&&Object.freeze(l)};function sr(l,e,a){var _,S;const w=e.join(".");return(_=a)[S=w]??(_[S]=new Proxy(rr,{get(R,t){if(!(typeof t!="string"||t==="then"))return sr(l,[...e,t],a)},apply(R,t,o){const h=e[e.length-1];let f={args:o,path:e};return h==="call"?f={args:o.length>=2?[o[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(f={args:o.length>=2?o[1]:[],path:e.slice(0,-1)}),jt(f.args),jt(f.path),l(f)}})),a[w]}const Dr=l=>sr(l,[],Object.create(null)),Tr=l=>new Proxy(rr,{get(e,a){if(!(typeof a!="string"||a==="then"))return l(a)}}),pt={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};function Je(l){return!!l&&!Array.isArray(l)&&typeof l=="object"}const Ar=l=>l();function gt(l,e,a){return e in l?Object.defineProperty(l,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):l[e]=a,l}var ir;const Tt=new WeakMap,Br=()=>{};ir=Symbol.toStringTag;let Or=ir;class Ee{subscribe(){let e,a;const{settlement:_}=this;if(_===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const S=Ir();this.subscribers=Pr(this.subscribers,S),e=S.promise,a=()=>{this.subscribers!==null&&(this.subscribers=Nr(this.subscribers,S))}}else{const{status:S}=_;S==="fulfilled"?e=Promise.resolve(_.value):e=Promise.reject(_.reason),a=Br}return Object.assign(e,{unsubscribe:a})}then(e,a){const _=this.subscribe(),{unsubscribe:S}=_;return Object.assign(_.then(e,a),{unsubscribe:S})}catch(e){const a=this.subscribe(),{unsubscribe:_}=a;return Object.assign(a.catch(e),{unsubscribe:_})}finally(e){const a=this.subscribe(),{unsubscribe:_}=a;return Object.assign(a.finally(e),{unsubscribe:_})}static proxy(e){const a=Ee.getSubscribablePromise(e);return typeof a<"u"?a:Ee.createSubscribablePromise(e)}static createSubscribablePromise(e){const a=new Ee(e);return Tt.set(e,a),Tt.set(a,a),a}static getSubscribablePromise(e){return Tt.get(e)}static resolve(e){const a=typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"?e:Promise.resolve(e);return Ee.proxy(a).subscribe()}static async any(e){const _=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.any(_)}finally{_.forEach(({unsubscribe:S})=>{S()})}}static async race(e){const _=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.race(_)}finally{_.forEach(({unsubscribe:S})=>{S()})}}static async raceReferences(e){const a=e.map(Mr);try{return await Promise.race(a)}finally{for(const _ of a)_.unsubscribe()}}constructor(e){gt(this,"promise",void 0),gt(this,"subscribers",[]),gt(this,"settlement",null),gt(this,Or,"Unpromise"),typeof e=="function"?this.promise=new Promise(e):this.promise=e;const a=this.promise.then(_=>{const{subscribers:S}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:_},S==null||S.forEach(({resolve:w})=>{w(_)})});"catch"in a&&a.catch(_=>{const{subscribers:S}=this;this.subscribers=null,this.settlement={status:"rejected",reason:_},S==null||S.forEach(({reject:w})=>{w(_)})})}}function Mr(l){return Ee.proxy(l).then(()=>[l])}function Ir(){let l,e;return{promise:new Promise((_,S)=>{l=_,e=S}),resolve:l,reject:e}}function Pr(l,e){return[...l,e]}function Hr(l,e){return[...l.slice(0,e),...l.slice(e+1)]}function Nr(l,e){const a=l.indexOf(e);return a!==-1?Hr(l,a):l}var Ut;(Ut=Symbol).dispose??(Ut.dispose=Symbol());const Fr="ping",Wr="serialized-error",jr="connected";async function Ur(l){let e;const a=new Promise(S=>{e=setTimeout(()=>{S(null)},l.timeoutMs)});let _;try{_=await Ee.race([l.promise,a])}finally{clearTimeout(e)}return _===null?await l.onTimeout():_}function $r(l){const{deserialize:e=t=>t}=l;let a={};const _=l.signal;let S=null;const w=()=>new ReadableStream({async start(t){const[o,h]=await Promise.all([l.url(),l.init()]),f=S=new l.EventSource(o,h);t.enqueue({type:"connecting",eventSource:S,event:null}),f.addEventListener(jr,p=>{const y=JSON.parse(p.data);a=y,t.enqueue({type:"connected",options:y,eventSource:f})}),f.addEventListener(Wr,p=>{const v=p;t.enqueue({type:"serialized-error",error:e(JSON.parse(v.data)),eventSource:f})}),f.addEventListener(Fr,()=>{t.enqueue({type:"ping",eventSource:f})}),f.addEventListener("error",p=>{f.readyState===EventSource.CLOSED?t.error(p):t.enqueue({type:"connecting",eventSource:f,event:p})}),f.addEventListener("message",p=>{const v=p,u={data:e(JSON.parse(v.data))};v.lastEventId&&(u.id=v.lastEventId),t.enqueue({type:"data",data:u,eventSource:f})});const c=()=>{t.close(),f.close()};_.aborted?c():_.addEventListener("abort",c)},cancel(){S==null||S.close()}}),R=()=>{const t=w(),o=t.getReader();return{reader:o,cancel:()=>(o.releaseLock(),t.cancel())}};return{[Symbol.asyncIterator](){let t=R();return{async next(){let h=t.reader.read();const f=a.reconnectAfterInactivityMs;f&&(h=Ur({promise:h,timeoutMs:f,onTimeout:async()=>(await t.cancel(),t=R(),{value:{type:"timeout",ms:f,eventSource:S},done:!1})}));const c=await h;return c.done?{value:c.value,done:!0}:{value:c.value,done:!1}},async return(){return await t.cancel(),{value:void 0,done:!0}}}}}}function zr(l,e){if("error"in l){const _=e.deserialize(l.error);return{ok:!1,error:{...l,error:_}}}return{ok:!0,result:{...l.result,...(!l.result.type||l.result.type==="data")&&{type:"data",data:e.deserialize(l.result.data)}}}}class At extends Error{constructor(){super("Unable to transform response from server")}}function qr(l,e){let a;try{a=zr(l,e)}catch{throw new At}if(!a.ok&&(!Je(a.error.error)||typeof a.error.error.code!="number"))throw new At;if(a.ok&&!Je(a.result))throw new At;return a}var Gt,Yt,Jt,Xt,Qt,er;typeof window>"u"||"Deno"in window||((Yt=(Gt=globalThis.process)==null?void 0:Gt.env)==null?void 0:Yt.NODE_ENV)==="test"||(Xt=(Jt=globalThis.process)==null?void 0:Jt.env)!=null&&Xt.JEST_WORKER_ID||(er=(Qt=globalThis.process)==null?void 0:Qt.env)!=null&&er.VITEST_WORKER_ID;function Vr(l){return l instanceof pe||l instanceof Error&&l.name==="TRPCClientError"}function Zr(l){return Je(l)&&Je(l.error)&&typeof l.error.code=="number"&&typeof l.error.message=="string"}function Kr(l,e){return typeof l=="string"?l:Je(l)&&typeof l.message=="string"?l.message:e}class pe extends Error{static from(e,a={}){const _=e;return Vr(_)?(a.meta&&(_.meta={..._.meta,...a.meta}),_):Zr(_)?new pe(_.error.message,{...a,result:_}):new pe(Kr(_,"Unknown error"),{...a,cause:_})}constructor(e,a){var S,w;const _=a==null?void 0:a.cause;super(e,{cause:_}),Oe(this,"cause",void 0),Oe(this,"shape",void 0),Oe(this,"data",void 0),Oe(this,"meta",void 0),this.meta=a==null?void 0:a.meta,this.cause=_,this.shape=(S=a==null?void 0:a.result)==null?void 0:S.error,this.data=(w=a==null?void 0:a.result)==null?void 0:w.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,pe.prototype)}}class Gr{$request(e){return tr({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(Rr())}async requestAsPromise(e){try{const a=this.$request(e);return(await kr(a)).result.data}catch(a){throw pe.from(a)}}query(e,a,_){return this.requestAsPromise({type:"query",path:e,input:a,context:_==null?void 0:_.context,signal:_==null?void 0:_.signal})}mutation(e,a,_){return this.requestAsPromise({type:"mutation",path:e,input:a,context:_==null?void 0:_.context,signal:_==null?void 0:_.signal})}subscription(e,a,_){return this.$request({type:"subscription",path:e,input:a,context:_.context,signal:_.signal}).subscribe({next(w){var R,t,o,h;switch(w.result.type){case"state":{(R=_.onConnectionStateChange)==null||R.call(_,w.result);break}case"started":{(t=_.onStarted)==null||t.call(_,{context:w.context});break}case"stopped":{(o=_.onStopped)==null||o.call(_);break}case"data":case void 0:{(h=_.onData)==null||h.call(_,w.result.data);break}}},error(w){var R;(R=_.onError)==null||R.call(_,w)},complete(){var w;(w=_.onComplete)==null||w.call(_)}})}constructor(e){Oe(this,"links",void 0),Oe(this,"runtime",void 0),Oe(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(a=>a(this.runtime))}}const Yr={query:"query",mutate:"mutation",subscribe:"subscription"},Jr=l=>Yr[l];function Xr(l){const e=Dr(({path:a,args:_})=>{const S=[...a],w=Jr(S.pop()),R=S.join(".");return l[w](R,..._)});return Tr(a=>l.hasOwnProperty(a)?l[a]:a==="__untypedClient"?l:e[a])}function Qr(l){const e=new Gr(l);return Xr(e)}const $t=l=>typeof l=="function";function es(l){if(l)return l;if(typeof window<"u"&&$t(window.fetch))return window.fetch;if(typeof globalThis<"u"&&$t(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const zt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function qt(l){let e=null,a=null;const _=()=>{clearTimeout(a),a=null,e=null};function S(t){var f,c;const o=[[]];let h=0;for(;;){const p=t[h];if(!p)break;const v=o[o.length-1];if(p.aborted){(f=p.reject)==null||f.call(p,new Error("Aborted")),h++;continue}if(l.validate(v.concat(p).map(u=>u.key))){v.push(p),h++;continue}if(v.length===0){(c=p.reject)==null||c.call(p,new Error("Input is too big for a single dispatch")),h++;continue}o.push([])}return o}function w(){const t=S(e);_();for(const o of t){if(!o.length)continue;const h={items:o};for(const c of o)c.batch=h;l.fetch(h.items.map(c=>c.key)).then(async c=>{var p;await Promise.all(c.map(async(v,y)=>{var i,n;const u=h.items[y];try{const r=await Promise.resolve(v);(i=u.resolve)==null||i.call(u,r)}catch(r){(n=u.reject)==null||n.call(u,r)}u.batch=null,u.reject=null,u.resolve=null}));for(const v of h.items)(p=v.reject)==null||p.call(v,new Error("Missing result")),v.batch=null}).catch(c=>{var p;for(const v of h.items)(p=v.reject)==null||p.call(v,c),v.batch=null})}}function R(t){const o={aborted:!1,key:t,batch:null,resolve:zt,reject:zt},h=new Promise((f,c)=>{o.reject=c,o.resolve=f,e||(e=[]),e.push(o)});return a||(a=setTimeout(w)),h}return{load:R}}function ts(...l){const e=new AbortController,a=l.length;let _=0;const S=()=>{++_===a&&e.abort()};for(const w of l)w!=null&&w.aborted?S():w==null||w.addEventListener("abort",S,{once:!0});return e.signal}function rs(...l){const e=new AbortController;for(const a of l)a!=null&&a.aborted?e.abort():a==null||a.addEventListener("abort",()=>e.abort(),{once:!0});return e.signal}function nr(l){const e=l;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}function ss(l){return{url:l.url.toString(),fetch:l.fetch,transformer:nr(l.transformer),methodOverride:l.methodOverride}}function is(l){const e={};for(let a=0;a<l.length;a++){const _=l[a];e[a]=_}return e}const ns={query:"GET",mutation:"POST",subscription:"PATCH"};function or(l){return"input"in l?l.transformer.input.serialize(l.input):is(l.inputs.map(e=>l.transformer.input.serialize(e)))}const Nt=l=>{const e=l.url.split("?");let _=e[0].replace(/\/$/,"")+"/"+l.path;const S=[];if(e[1]&&S.push(e[1]),"inputs"in l&&S.push("batch=1"),l.type==="query"||l.type==="subscription"){const w=or(l);w!==void 0&&l.methodOverride!=="POST"&&S.push(`input=${encodeURIComponent(JSON.stringify(w))}`)}return S.length&&(_+="?"+S.join("&")),_},os=l=>{if(l.type==="query"&&l.methodOverride!=="POST")return;const e=or(l);return e!==void 0?JSON.stringify(e):void 0},as=l=>ds({...l,contentTypeHeader:"application/json",getUrl:Nt,getBody:os});class cs extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const hs=l=>{var e;if(l!=null&&l.aborted)throw(e=l.throwIfAborted)==null||e.call(l),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new cs};async function ls(l){hs(l.signal);const e=l.getUrl(l),a=l.getBody(l),{type:_}=l,S=await(async()=>{const R=await l.headers();return Symbol.iterator in R?Object.fromEntries(R):R})(),w={...l.contentTypeHeader?{"content-type":l.contentTypeHeader}:{},...l.trpcAcceptHeader?{"trpc-accept":l.trpcAcceptHeader}:void 0,...S};return es(l.fetch)(e,{method:l.methodOverride??ns[_],signal:l.signal,body:a,headers:w})}async function ds(l){const e={},a=await ls(l);e.response=a;const _=await a.json();return e.responseJSON=_,{json:_,meta:e}}function us(l){const e=ss(l),a=l.maxURLLength??1/0;return()=>{const _=t=>({validate(o){if(a===1/0)return!0;const h=o.map(p=>p.path).join(","),f=o.map(p=>p.input);return Nt({...e,type:t,path:h,inputs:f,signal:null}).length<=a},async fetch(o){const h=o.map(u=>u.path).join(","),f=o.map(u=>u.input),c=ts(...o.map(u=>u.signal)),p=await as({...e,path:h,inputs:f,type:t,headers(){return l.headers?typeof l.headers=="function"?l.headers({opList:o}):l.headers:{}},signal:c});return(Array.isArray(p.json)?p.json:o.map(()=>p.json)).map(u=>({meta:p.meta,json:u}))}}),S=qt(_("query")),w=qt(_("mutation")),R={query:S,mutation:w};return({op:t})=>$e(o=>{/* istanbul ignore if -- @preserve */if(t.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const f=R[t.type].load(t);let c;return f.then(p=>{c=p;const v=qr(p.json,e.transformer.output);if(!v.ok){o.error(pe.from(v.error,{meta:p.meta}));return}o.next({context:p.meta,result:v.result}),o.complete()}).catch(p=>{o.error(pe.from(p,{meta:c==null?void 0:c.meta}))}),()=>{}})}}function Vt(l){return Array.isArray(l)?l:[l]}function fs(l){return e=>{const a=Vt(l.true).map(S=>S(e)),_=Vt(l.false).map(S=>S(e));return S=>$e(w=>{const R=l.condition(S.op)?a:_;return tr({op:S.op,links:R}).subscribe(w)})}}const Ot=(l,...e)=>typeof l=="function"?l(...e):l;function _s(l,e){return!e||l!=null&&typeof l!="object"?l:{...l??{},lastEventId:e}}async function ps(l){let e=await Ot(l.url);if(l.connectionParams){const a=await Ot(l.connectionParams),_=e.includes("?")?"&":"?";e+=_+"connectionParams="+encodeURIComponent(JSON.stringify(a))}return e}const gs=[pt.BAD_GATEWAY,pt.SERVICE_UNAVAILABLE,pt.GATEWAY_TIMEOUT,pt.INTERNAL_SERVER_ERROR];function vs(l){const e=nr(l.transformer);return()=>({op:a})=>$e(_=>{const{type:S,path:w,input:R}=a;/* istanbul ignore if -- @preserve */if(S!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let t;const o=new AbortController,h=rs(a.signal,o.signal),f=$r({url:async()=>Nt({transformer:e,url:await ps(l),input:_s(R,t),path:w,type:S,signal:null}),init:()=>Ot(l.eventSourceOptions,{op:a}),signal:h,deserialize:e.output.deserialize,EventSource:l.EventSource??globalThis.EventSource}),c=Lr({type:"state",state:"connecting",error:null}),p=c.subscribe({next(v){_.next({result:v})}});return Ar(async()=>{for await(const v of f)switch(v.type){case"ping":break;case"data":const y=v.data;let u;y.id?(t=y.id,u={id:y.id,data:y}):u={data:y.data},_.next({result:u,context:{eventSource:v.eventSource}});break;case"connected":{_.next({result:{type:"started"},context:{eventSource:v.eventSource}}),c.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const i=pe.from({error:v.error});if(gs.includes(v.error.code)){c.next({type:"state",state:"connecting",error:i});break}throw i}case"connecting":{const i=c.get(),n=v.event&&pe.from(v.event);if(!n&&i.state==="connecting")break;c.next({type:"state",state:"connecting",error:n});break}case"timeout":c.next({type:"state",state:"connecting",error:new pe(`Timeout of ${v.ms}ms reached while waiting for a response`)})}_.next({result:{type:"stopped"}}),_.complete()}).catch(v=>{_.error(pe.from(v))}),()=>{_.complete(),o.abort(),p.unsubscribe()}})}const ms={version:"1.7.1",latte:{name:"Latte",emoji:"🌻",order:0,dark:!1,colors:{rosewater:{name:"Rosewater",order:0,hex:"#dc8a78",rgb:{r:220,g:138,b:120},hsl:{h:10.799999999999995,s:.5882352941176472,l:.6666666666666667},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#dd7878",rgb:{r:221,g:120,b:120},hsl:{h:0,s:.5976331360946746,l:.6686274509803922},accent:!0},pink:{name:"Pink",order:2,hex:"#ea76cb",rgb:{r:234,g:118,b:203},hsl:{h:316.0344827586207,s:.7341772151898731,l:.6901960784313725},accent:!0},mauve:{name:"Mauve",order:3,hex:"#8839ef",rgb:{r:136,g:57,b:239},hsl:{h:266.0439560439561,s:.8504672897196262,l:.5803921568627451},accent:!0},red:{name:"Red",order:4,hex:"#d20f39",rgb:{r:210,g:15,b:57},hsl:{h:347.0769230769231,s:.8666666666666666,l:.4411764705882353},accent:!0},maroon:{name:"Maroon",order:5,hex:"#e64553",rgb:{r:230,g:69,b:83},hsl:{h:354.78260869565213,s:.76303317535545,l:.5862745098039216},accent:!0},peach:{name:"Peach",order:6,hex:"#fe640b",rgb:{r:254,g:100,b:11},hsl:{h:21.975308641975307,s:.9918367346938776,l:.5196078431372549},accent:!0},yellow:{name:"Yellow",order:7,hex:"#df8e1d",rgb:{r:223,g:142,b:29},hsl:{h:34.948453608247426,s:.7698412698412698,l:.49411764705882355},accent:!0},green:{name:"Green",order:8,hex:"#40a02b",rgb:{r:64,g:160,b:43},hsl:{h:109.23076923076923,s:.5763546798029556,l:.39803921568627454},accent:!0},teal:{name:"Teal",order:9,hex:"#179299",rgb:{r:23,g:146,b:153},hsl:{h:183.23076923076923,s:.7386363636363636,l:.34509803921568627},accent:!0},sky:{name:"Sky",order:10,hex:"#04a5e5",rgb:{r:4,g:165,b:229},hsl:{h:197.0666666666667,s:.965665236051502,l:.45686274509803926},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#209fb5",rgb:{r:32,g:159,b:181},hsl:{h:188.85906040268458,s:.6995305164319249,l:.4176470588235294},accent:!0},blue:{name:"Blue",order:12,hex:"#1e66f5",rgb:{r:30,g:102,b:245},hsl:{h:219.90697674418607,s:.9148936170212768,l:.5392156862745098},accent:!0},lavender:{name:"Lavender",order:13,hex:"#7287fd",rgb:{r:114,g:135,b:253},hsl:{h:230.93525179856115,s:.9720279720279721,l:.7196078431372549},accent:!0},text:{name:"Text",order:14,hex:"#4c4f69",rgb:{r:76,g:79,b:105},hsl:{h:233.79310344827587,s:.16022099447513813,l:.3549019607843137},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#5c5f77",rgb:{r:92,g:95,b:119},hsl:{h:233.33333333333334,s:.1279620853080569,l:.4137254901960784},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#6c6f85",rgb:{r:108,g:111,b:133},hsl:{h:232.79999999999998,s:.10373443983402494,l:.4725490196078431},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#7c7f93",rgb:{r:124,g:127,b:147},hsl:{h:232.17391304347825,s:.09623430962343092,l:.5313725490196078},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#8c8fa1",rgb:{r:140,g:143,b:161},hsl:{h:231.42857142857144,s:.10047846889952144,l:.5901960784313726},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#9ca0b0",rgb:{r:156,g:160,b:176},hsl:{h:228.00000000000003,s:.11235955056179768,l:.6509803921568628},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#acb0be",rgb:{r:172,g:176,b:190},hsl:{h:226.6666666666667,s:.12162162162162159,l:.7098039215686275},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#bcc0cc",rgb:{r:188,g:192,b:204},hsl:{h:225.00000000000003,s:.13559322033898308,l:.7686274509803922},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#ccd0da",rgb:{r:204,g:208,b:218},hsl:{h:222.85714285714292,s:.1590909090909089,l:.8274509803921568},accent:!1},base:{name:"Base",order:23,hex:"#eff1f5",rgb:{r:239,g:241,b:245},hsl:{h:220.00000000000009,s:.23076923076923136,l:.9490196078431372},accent:!1},mantle:{name:"Mantle",order:24,hex:"#e6e9ef",rgb:{r:230,g:233,b:239},hsl:{h:220.00000000000006,s:.21951219512195116,l:.919607843137255},accent:!1},crust:{name:"Crust",order:25,hex:"#dce0e8",rgb:{r:220,g:224,b:232},hsl:{h:220.00000000000006,s:.20689655172413762,l:.8862745098039215},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#5c5f77",rgb:{r:92,g:95,b:119},hsl:{h:233.33333333333334,s:.1279620853080569,l:.4137254901960784},code:0},bright:{name:"Bright Black",hex:"#6c6f85",rgb:{r:108,g:111,b:133},hsl:{h:232.79999999999998,s:.10373443983402494,l:.4725490196078431},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#d20f39",rgb:{r:210,g:15,b:57},hsl:{h:347.0769230769231,s:.8666666666666666,l:.4411764705882353},code:1},bright:{name:"Bright Red",hex:"#de293e",rgb:{r:222,g:41,b:62},hsl:{h:353.0386740331492,s:.7327935222672065,l:.515686274509804},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#40a02b",rgb:{r:64,g:160,b:43},hsl:{h:109.23076923076923,s:.5763546798029556,l:.39803921568627454},code:2},bright:{name:"Bright Green",hex:"#49af3d",rgb:{r:73,g:175,b:61},hsl:{h:113.68421052631581,s:.48305084745762705,l:.4627450980392157},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#df8e1d",rgb:{r:223,g:142,b:29},hsl:{h:34.948453608247426,s:.7698412698412698,l:.49411764705882355},code:3},bright:{name:"Bright Yellow",hex:"#eea02d",rgb:{r:238,g:160,b:45},hsl:{h:35.751295336787564,s:.8502202643171807,l:.5549019607843138},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#1e66f5",rgb:{r:30,g:102,b:245},hsl:{h:219.90697674418607,s:.9148936170212768,l:.5392156862745098},code:4},bright:{name:"Bright Blue",hex:"#456eff",rgb:{r:69,g:110,b:255},hsl:{h:226.77419354838707,s:1,l:.6352941176470588},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#ea76cb",rgb:{r:234,g:118,b:203},hsl:{h:316.0344827586207,s:.7341772151898731,l:.6901960784313725},code:5},bright:{name:"Bright Magenta",hex:"#fe85d8",rgb:{r:254,g:133,b:216},hsl:{h:318.8429752066116,s:.983739837398374,l:.7588235294117647},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#179299",rgb:{r:23,g:146,b:153},hsl:{h:183.23076923076923,s:.7386363636363636,l:.34509803921568627},code:6},bright:{name:"Bright Cyan",hex:"#2d9fa8",rgb:{r:45,g:159,b:168},hsl:{h:184.39024390243904,s:.5774647887323943,l:.4176470588235294},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#acb0be",rgb:{r:172,g:176,b:190},hsl:{h:226.6666666666667,s:.12162162162162159,l:.7098039215686275},code:7},bright:{name:"Bright White",hex:"#bcc0cc",rgb:{r:188,g:192,b:204},hsl:{h:225.00000000000003,s:.13559322033898308,l:.7686274509803922},code:15}}}},frappe:{name:"Frappé",emoji:"🪴",order:1,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f2d5cf",rgb:{r:242,g:213,b:207},hsl:{h:10.2857142857143,s:.5737704918032784,l:.8803921568627451},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#eebebe",rgb:{r:238,g:190,b:190},hsl:{h:0,s:.5853658536585367,l:.8392156862745098},accent:!0},pink:{name:"Pink",order:2,hex:"#f4b8e4",rgb:{r:244,g:184,b:228},hsl:{h:316,s:.7317073170731713,l:.8392156862745098},accent:!0},mauve:{name:"Mauve",order:3,hex:"#ca9ee6",rgb:{r:202,g:158,b:230},hsl:{h:276.66666666666663,s:.5901639344262294,l:.7607843137254902},accent:!0},red:{name:"Red",order:4,hex:"#e78284",rgb:{r:231,g:130,b:132},hsl:{h:358.8118811881188,s:.6778523489932885,l:.7078431372549019},accent:!0},maroon:{name:"Maroon",order:5,hex:"#ea999c",rgb:{r:234,g:153,b:156},hsl:{h:357.77777777777777,s:.6585365853658534,l:.7588235294117647},accent:!0},peach:{name:"Peach",order:6,hex:"#ef9f76",rgb:{r:239,g:159,b:118},hsl:{h:20.33057851239669,s:.7908496732026143,l:.7},accent:!0},yellow:{name:"Yellow",order:7,hex:"#e5c890",rgb:{r:229,g:200,b:144},hsl:{h:39.52941176470588,s:.6204379562043796,l:.7313725490196079},accent:!0},green:{name:"Green",order:8,hex:"#a6d189",rgb:{r:166,g:209,b:137},hsl:{h:95.83333333333331,s:.4390243902439024,l:.6784313725490196},accent:!0},teal:{name:"Teal",order:9,hex:"#81c8be",rgb:{r:129,g:200,b:190},hsl:{h:171.5492957746479,s:.3922651933701657,l:.6450980392156862},accent:!0},sky:{name:"Sky",order:10,hex:"#99d1db",rgb:{r:153,g:209,b:219},hsl:{h:189.09090909090907,s:.47826086956521735,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#85c1dc",rgb:{r:133,g:193,b:220},hsl:{h:198.62068965517244,s:.5541401273885351,l:.692156862745098},accent:!0},blue:{name:"Blue",order:12,hex:"#8caaee",rgb:{r:140,g:170,b:238},hsl:{h:221.6326530612245,s:.7424242424242424,l:.7411764705882353},accent:!0},lavender:{name:"Lavender",order:13,hex:"#babbf1",rgb:{r:186,g:187,b:241},hsl:{h:238.90909090909093,s:.6626506024096385,l:.8372549019607842},accent:!0},text:{name:"Text",order:14,hex:"#c6d0f5",rgb:{r:198,g:208,b:245},hsl:{h:227.2340425531915,s:.7014925373134333,l:.8686274509803922},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#b5bfe2",rgb:{r:181,g:191,b:226},hsl:{h:226.66666666666669,s:.43689320388349495,l:.7980392156862746},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a5adce",rgb:{r:165,g:173,b:206},hsl:{h:228.29268292682926,s:.2949640287769784,l:.7274509803921569},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#949cbb",rgb:{r:148,g:156,b:187},hsl:{h:227.69230769230768,s:.22285714285714275,l:.6568627450980392},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#838ba7",rgb:{r:131,g:139,b:167},hsl:{h:226.66666666666669,s:.16981132075471703,l:.584313725490196},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#737994",rgb:{r:115,g:121,b:148},hsl:{h:229.0909090909091,s:.13360323886639683,l:.515686274509804},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#626880",rgb:{r:98,g:104,b:128},hsl:{h:228.00000000000003,s:.1327433628318584,l:.44313725490196076},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#51576d",rgb:{r:81,g:87,b:109},hsl:{h:227.14285714285714,s:.14736842105263157,l:.37254901960784315},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#414559",rgb:{r:65,g:69,b:89},hsl:{h:230.00000000000003,s:.15584415584415584,l:.30196078431372547},accent:!1},base:{name:"Base",order:23,hex:"#303446",rgb:{r:48,g:52,b:70},hsl:{h:229.0909090909091,s:.18644067796610175,l:.23137254901960785},accent:!1},mantle:{name:"Mantle",order:24,hex:"#292c3c",rgb:{r:41,g:44,b:60},hsl:{h:230.52631578947367,s:.18811881188118806,l:.19803921568627453},accent:!1},crust:{name:"Crust",order:25,hex:"#232634",rgb:{r:35,g:38,b:52},hsl:{h:229.41176470588238,s:.19540229885057467,l:.17058823529411765},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#51576d",rgb:{r:81,g:87,b:109},hsl:{h:227.14285714285714,s:.14736842105263157,l:.37254901960784315},code:0},bright:{name:"Bright Black",hex:"#626880",rgb:{r:98,g:104,b:128},hsl:{h:228.00000000000003,s:.1327433628318584,l:.44313725490196076},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#e78284",rgb:{r:231,g:130,b:132},hsl:{h:358.8118811881188,s:.6778523489932885,l:.7078431372549019},code:1},bright:{name:"Bright Red",hex:"#e67172",rgb:{r:230,g:113,b:114},hsl:{h:359.4871794871795,s:.7005988023952096,l:.6725490196078432},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6d189",rgb:{r:166,g:209,b:137},hsl:{h:95.83333333333331,s:.4390243902439024,l:.6784313725490196},code:2},bright:{name:"Bright Green",hex:"#8ec772",rgb:{r:142,g:199,b:114},hsl:{h:100.23529411764706,s:.431472081218274,l:.6137254901960785},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#e5c890",rgb:{r:229,g:200,b:144},hsl:{h:39.52941176470588,s:.6204379562043796,l:.7313725490196079},code:3},bright:{name:"Bright Yellow",hex:"#d9ba73",rgb:{r:217,g:186,b:115},hsl:{h:41.764705882352935,s:.5730337078651685,l:.6509803921568628},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#8caaee",rgb:{r:140,g:170,b:238},hsl:{h:221.6326530612245,s:.7424242424242424,l:.7411764705882353},code:4},bright:{name:"Bright Blue",hex:"#7b9ef0",rgb:{r:123,g:158,b:240},hsl:{h:222.05128205128207,s:.7959183673469388,l:.711764705882353},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f4b8e4",rgb:{r:244,g:184,b:228},hsl:{h:316,s:.7317073170731713,l:.8392156862745098},code:5},bright:{name:"Bright Magenta",hex:"#f2a4db",rgb:{r:242,g:164,b:219},hsl:{h:317.6923076923077,s:.7499999999999998,l:.7960784313725491},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#81c8be",rgb:{r:129,g:200,b:190},hsl:{h:171.5492957746479,s:.3922651933701657,l:.6450980392156862},code:6},bright:{name:"Bright Cyan",hex:"#5abfb5",rgb:{r:90,g:191,b:181},hsl:{h:174.05940594059405,s:.44104803493449785,l:.5509803921568628},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a5adce",rgb:{r:165,g:173,b:206},hsl:{h:228.29268292682926,s:.2949640287769784,l:.7274509803921569},code:7},bright:{name:"Bright White",hex:"#b5bfe2",rgb:{r:181,g:191,b:226},hsl:{h:226.66666666666669,s:.43689320388349495,l:.7980392156862746},code:15}}}},macchiato:{name:"Macchiato",emoji:"🌺",order:2,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f4dbd6",rgb:{r:244,g:219,b:214},hsl:{h:9.999999999999963,s:.5769230769230775,l:.8980392156862745},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#f0c6c6",rgb:{r:240,g:198,b:198},hsl:{h:0,s:.5833333333333333,l:.8588235294117648},accent:!0},pink:{name:"Pink",order:2,hex:"#f5bde6",rgb:{r:245,g:189,b:230},hsl:{h:316.0714285714286,s:.7368421052631583,l:.8509803921568628},accent:!0},mauve:{name:"Mauve",order:3,hex:"#c6a0f6",rgb:{r:198,g:160,b:246},hsl:{h:266.51162790697674,s:.8269230769230772,l:.7960784313725491},accent:!0},red:{name:"Red",order:4,hex:"#ed8796",rgb:{r:237,g:135,b:150},hsl:{h:351.1764705882353,s:.7391304347826088,l:.7294117647058824},accent:!0},maroon:{name:"Maroon",order:5,hex:"#ee99a0",rgb:{r:238,g:153,b:160},hsl:{h:355.05882352941177,s:.7142857142857143,l:.7666666666666666},accent:!0},peach:{name:"Peach",order:6,hex:"#f5a97f",rgb:{r:245,g:169,b:127},hsl:{h:21.355932203389827,s:.8550724637681162,l:.7294117647058824},accent:!0},yellow:{name:"Yellow",order:7,hex:"#eed49f",rgb:{r:238,g:212,b:159},hsl:{h:40.253164556962034,s:.6991150442477877,l:.7784313725490196},accent:!0},green:{name:"Green",order:8,hex:"#a6da95",rgb:{r:166,g:218,b:149},hsl:{h:105.21739130434783,s:.4825174825174825,l:.7196078431372549},accent:!0},teal:{name:"Teal",order:9,hex:"#8bd5ca",rgb:{r:139,g:213,b:202},hsl:{h:171.08108108108107,s:.46835443037974706,l:.6901960784313725},accent:!0},sky:{name:"Sky",order:10,hex:"#91d7e3",rgb:{r:145,g:215,b:227},hsl:{h:188.78048780487802,s:.5942028985507245,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#7dc4e4",rgb:{r:125,g:196,b:228},hsl:{h:198.64077669902912,s:.6560509554140128,l:.692156862745098},accent:!0},blue:{name:"Blue",order:12,hex:"#8aadf4",rgb:{r:138,g:173,b:244},hsl:{h:220.188679245283,s:.8281250000000003,l:.7490196078431373},accent:!0},lavender:{name:"Lavender",order:13,hex:"#b7bdf8",rgb:{r:183,g:189,b:248},hsl:{h:234.46153846153848,s:.8227848101265824,l:.8450980392156863},accent:!0},text:{name:"Text",order:14,hex:"#cad3f5",rgb:{r:202,g:211,b:245},hsl:{h:227.4418604651163,s:.6825396825396831,l:.8764705882352941},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#b8c0e0",rgb:{r:184,g:192,b:224},hsl:{h:228,s:.39215686274509803,l:.8},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a5adcb",rgb:{r:165,g:173,b:203},hsl:{h:227.36842105263156,s:.2676056338028167,l:.7215686274509804},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#939ab7",rgb:{r:147,g:154,b:183},hsl:{h:228.33333333333331,s:.2000000000000001,l:.6470588235294117},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#8087a2",rgb:{r:128,g:135,b:162},hsl:{h:227.6470588235294,s:.1545454545454545,l:.5686274509803921},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#6e738d",rgb:{r:110,g:115,b:141},hsl:{h:230.32258064516128,s:.12350597609561753,l:.49215686274509807},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#5b6078",rgb:{r:91,g:96,b:120},hsl:{h:229.65517241379308,s:.13744075829383887,l:.4137254901960784},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#494d64",rgb:{r:73,g:77,b:100},hsl:{h:231.11111111111114,s:.15606936416184972,l:.3392156862745098},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#363a4f",rgb:{r:54,g:58,b:79},hsl:{h:230.4,s:.1879699248120301,l:.2607843137254902},accent:!1},base:{name:"Base",order:23,hex:"#24273a",rgb:{r:36,g:39,b:58},hsl:{h:231.8181818181818,s:.23404255319148934,l:.1843137254901961},accent:!1},mantle:{name:"Mantle",order:24,hex:"#1e2030",rgb:{r:30,g:32,b:48},hsl:{h:233.33333333333334,s:.23076923076923075,l:.15294117647058825},accent:!1},crust:{name:"Crust",order:25,hex:"#181926",rgb:{r:24,g:25,b:38},hsl:{h:235.71428571428572,s:.22580645161290322,l:.12156862745098039},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#494d64",rgb:{r:73,g:77,b:100},hsl:{h:231.11111111111114,s:.15606936416184972,l:.3392156862745098},code:0},bright:{name:"Bright Black",hex:"#5b6078",rgb:{r:91,g:96,b:120},hsl:{h:229.65517241379308,s:.13744075829383887,l:.4137254901960784},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#ed8796",rgb:{r:237,g:135,b:150},hsl:{h:351.1764705882353,s:.7391304347826088,l:.7294117647058824},code:1},bright:{name:"Bright Red",hex:"#ec7486",rgb:{r:236,g:116,b:134},hsl:{h:351,s:.759493670886076,l:.6901960784313725},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6da95",rgb:{r:166,g:218,b:149},hsl:{h:105.21739130434783,s:.4825174825174825,l:.7196078431372549},code:2},bright:{name:"Bright Green",hex:"#8ccf7f",rgb:{r:140,g:207,b:127},hsl:{h:110.24999999999999,s:.45454545454545453,l:.6549019607843137},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#eed49f",rgb:{r:238,g:212,b:159},hsl:{h:40.253164556962034,s:.6991150442477877,l:.7784313725490196},code:3},bright:{name:"Bright Yellow",hex:"#e1c682",rgb:{r:225,g:198,b:130},hsl:{h:42.94736842105264,s:.6129032258064515,l:.696078431372549},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#8aadf4",rgb:{r:138,g:173,b:244},hsl:{h:220.188679245283,s:.8281250000000003,l:.7490196078431373},code:4},bright:{name:"Bright Blue",hex:"#78a1f6",rgb:{r:120,g:161,b:246},hsl:{h:220.47619047619048,s:.8750000000000002,l:.7176470588235294},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f5bde6",rgb:{r:245,g:189,b:230},hsl:{h:316.0714285714286,s:.7368421052631583,l:.8509803921568628},code:5},bright:{name:"Bright Magenta",hex:"#f2a9dd",rgb:{r:242,g:169,b:221},hsl:{h:317.26027397260276,s:.7373737373737372,l:.8058823529411765},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#8bd5ca",rgb:{r:139,g:213,b:202},hsl:{h:171.08108108108107,s:.46835443037974706,l:.6901960784313725},code:6},bright:{name:"Bright Cyan",hex:"#63cbc0",rgb:{r:99,g:203,b:192},hsl:{h:173.65384615384616,s:.4999999999999998,l:.592156862745098},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a5adcb",rgb:{r:165,g:173,b:203},hsl:{h:227.36842105263156,s:.2676056338028167,l:.7215686274509804},code:7},bright:{name:"Bright White",hex:"#b8c0e0",rgb:{r:184,g:192,b:224},hsl:{h:228,s:.39215686274509803,l:.8},code:15}}}},mocha:{name:"Mocha",emoji:"🌿",order:3,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f5e0dc",rgb:{r:245,g:224,b:220},hsl:{h:9.599999999999968,s:.555555555555556,l:.911764705882353},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#f2cdcd",rgb:{r:242,g:205,b:205},hsl:{h:0,s:.587301587301587,l:.8764705882352941},accent:!0},pink:{name:"Pink",order:2,hex:"#f5c2e7",rgb:{r:245,g:194,b:231},hsl:{h:316.4705882352941,s:.7183098591549301,l:.8607843137254902},accent:!0},mauve:{name:"Mauve",order:3,hex:"#cba6f7",rgb:{r:203,g:166,b:247},hsl:{h:267.4074074074074,s:.8350515463917528,l:.8098039215686275},accent:!0},red:{name:"Red",order:4,hex:"#f38ba8",rgb:{r:243,g:139,b:168},hsl:{h:343.2692307692308,s:.8124999999999998,l:.7490196078431373},accent:!0},maroon:{name:"Maroon",order:5,hex:"#eba0ac",rgb:{r:235,g:160,b:172},hsl:{h:350.4,s:.6521739130434779,l:.7745098039215685},accent:!0},peach:{name:"Peach",order:6,hex:"#fab387",rgb:{r:250,g:179,b:135},hsl:{h:22.95652173913043,s:.92,l:.7549019607843137},accent:!0},yellow:{name:"Yellow",order:7,hex:"#f9e2af",rgb:{r:249,g:226,b:175},hsl:{h:41.35135135135135,s:.8604651162790699,l:.8313725490196078},accent:!0},green:{name:"Green",order:8,hex:"#a6e3a1",rgb:{r:166,g:227,b:161},hsl:{h:115.45454545454544,s:.5409836065573769,l:.7607843137254902},accent:!0},teal:{name:"Teal",order:9,hex:"#94e2d5",rgb:{r:148,g:226,b:213},hsl:{h:170.00000000000003,s:.5735294117647057,l:.7333333333333334},accent:!0},sky:{name:"Sky",order:10,hex:"#89dceb",rgb:{r:137,g:220,b:235},hsl:{h:189.18367346938774,s:.7101449275362316,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#74c7ec",rgb:{r:116,g:199,b:236},hsl:{h:198.5,s:.759493670886076,l:.6901960784313725},accent:!0},blue:{name:"Blue",order:12,hex:"#89b4fa",rgb:{r:137,g:180,b:250},hsl:{h:217.1681415929203,s:.9186991869918699,l:.7588235294117647},accent:!0},lavender:{name:"Lavender",order:13,hex:"#b4befe",rgb:{r:180,g:190,b:254},hsl:{h:231.89189189189187,s:.9736842105263159,l:.8509803921568628},accent:!0},text:{name:"Text",order:14,hex:"#cdd6f4",rgb:{r:205,g:214,b:244},hsl:{h:226.15384615384616,s:.6393442622950825,l:.8803921568627451},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#bac2de",rgb:{r:186,g:194,b:222},hsl:{h:226.66666666666669,s:.35294117647058837,l:.8},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a6adc8",rgb:{r:166,g:173,b:200},hsl:{h:227.6470588235294,s:.23611111111111102,l:.7176470588235294},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#9399b2",rgb:{r:147,g:153,b:178},hsl:{h:228.38709677419354,s:.16756756756756758,l:.6372549019607843},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#7f849c",rgb:{r:127,g:132,b:156},hsl:{h:229.65517241379308,s:.12775330396475776,l:.5549019607843138},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#6c7086",rgb:{r:108,g:112,b:134},hsl:{h:230.7692307692308,s:.10743801652892565,l:.4745098039215686},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#585b70",rgb:{r:88,g:91,b:112},hsl:{h:232.5,s:.12,l:.39215686274509803},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#45475a",rgb:{r:69,g:71,b:90},hsl:{h:234.2857142857143,s:.13207547169811326,l:.31176470588235294},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#313244",rgb:{r:49,g:50,b:68},hsl:{h:236.84210526315792,s:.16239316239316234,l:.22941176470588237},accent:!1},base:{name:"Base",order:23,hex:"#1e1e2e",rgb:{r:30,g:30,b:46},hsl:{h:240,s:.21052631578947367,l:.14901960784313725},accent:!1},mantle:{name:"Mantle",order:24,hex:"#181825",rgb:{r:24,g:24,b:37},hsl:{h:240,s:.2131147540983607,l:.11960784313725491},accent:!1},crust:{name:"Crust",order:25,hex:"#11111b",rgb:{r:17,g:17,b:27},hsl:{h:240,s:.22727272727272727,l:.08627450980392157},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#45475a",rgb:{r:69,g:71,b:90},hsl:{h:234.2857142857143,s:.13207547169811326,l:.31176470588235294},code:0},bright:{name:"Bright Black",hex:"#585b70",rgb:{r:88,g:91,b:112},hsl:{h:232.5,s:.12,l:.39215686274509803},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#f38ba8",rgb:{r:243,g:139,b:168},hsl:{h:343.2692307692308,s:.8124999999999998,l:.7490196078431373},code:1},bright:{name:"Bright Red",hex:"#f37799",rgb:{r:243,g:119,b:153},hsl:{h:343.54838709677415,s:.8378378378378376,l:.7098039215686274},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6e3a1",rgb:{r:166,g:227,b:161},hsl:{h:115.45454545454544,s:.5409836065573769,l:.7607843137254902},code:2},bright:{name:"Bright Green",hex:"#89d88b",rgb:{r:137,g:216,b:139},hsl:{h:121.51898734177213,s:.5031847133757963,l:.692156862745098},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#f9e2af",rgb:{r:249,g:226,b:175},hsl:{h:41.35135135135135,s:.8604651162790699,l:.8313725490196078},code:3},bright:{name:"Bright Yellow",hex:"#ebd391",rgb:{r:235,g:211,b:145},hsl:{h:44,s:.692307692307692,l:.7450980392156863},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#89b4fa",rgb:{r:137,g:180,b:250},hsl:{h:217.1681415929203,s:.9186991869918699,l:.7588235294117647},code:4},bright:{name:"Bright Blue",hex:"#74a8fc",rgb:{r:116,g:168,b:252},hsl:{h:217.05882352941174,s:.9577464788732396,l:.7215686274509804},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f5c2e7",rgb:{r:245,g:194,b:231},hsl:{h:316.4705882352941,s:.7183098591549301,l:.8607843137254902},code:5},bright:{name:"Bright Magenta",hex:"#f2aede",rgb:{r:242,g:174,b:222},hsl:{h:317.6470588235294,s:.7234042553191488,l:.8156862745098039},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#94e2d5",rgb:{r:148,g:226,b:213},hsl:{h:170.00000000000003,s:.5735294117647057,l:.7333333333333334},code:6},bright:{name:"Bright Cyan",hex:"#6bd7ca",rgb:{r:107,g:215,b:202},hsl:{h:172.77777777777777,s:.5744680851063831,l:.6313725490196078},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a6adc8",rgb:{r:166,g:173,b:200},hsl:{h:227.6470588235294,s:.23611111111111102,l:.7176470588235294},code:7},bright:{name:"Bright White",hex:"#bac2de",rgb:{r:186,g:194,b:222},hsl:{h:226.66666666666669,s:.35294117647058837,l:.8},code:15}}}}},vt=l=>Object.entries(l),{version:Ti,...bs}=ms,ar=vt(bs).reduce((l,[e,a])=>(l[e]={...a,colorEntries:vt(a.colors),ansiColorEntries:vt(a.ansiColors)},l),{});vt(ar);var cr={exports:{}};(function(l,e){(function(a,_){l.exports=_()})(self,()=>(()=>{var a={};return(()=>{var _=a;Object.defineProperty(_,"__esModule",{value:!0}),_.FitAddon=void 0,_.FitAddon=class{activate(S){this._terminal=S}dispose(){}fit(){const S=this.proposeDimensions();if(!S||!this._terminal||isNaN(S.cols)||isNaN(S.rows))return;const w=this._terminal._core;this._terminal.rows===S.rows&&this._terminal.cols===S.cols||(w._renderService.clear(),this._terminal.resize(S.cols,S.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const S=this._terminal._core,w=S._renderService.dimensions;if(w.css.cell.width===0||w.css.cell.height===0)return;const R=this._terminal.options.scrollback===0?0:S.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),c=o-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),p=h-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-R;return{cols:Math.max(2,Math.floor(p/w.css.cell.width)),rows:Math.max(1,Math.floor(c/w.css.cell.height))}}}})(),a})())})(cr);var Ss=cr.exports,hr={exports:{}};(function(l,e){(function(a,_){l.exports=_()})(globalThis,()=>(()=>{var a={4567:function(R,t,o){var h=this&&this.__decorate||function(r,s,d,b){var m,C=arguments.length,g=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,b);else for(var E=r.length-1;E>=0;E--)(m=r[E])&&(g=(C<3?m(g):C>3?m(s,d,g):m(s,d))||g);return C>3&&g&&Object.defineProperty(s,d,g),g},f=this&&this.__param||function(r,s){return function(d,b){s(d,b,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const c=o(9042),p=o(9924),v=o(844),y=o(4725),u=o(2585),i=o(3656);let n=t.AccessibilityManager=class extends v.Disposable{constructor(r,s,d,b){super(),this._terminal=r,this._coreBrowserService=d,this._renderService=b,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 m=0;m<this._terminal.rows;m++)this._rowElements[m]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[m]);if(this._topBoundaryFocusListener=m=>this._handleBoundaryFocus(m,0),this._bottomBoundaryFocusListener=m=>this._handleBoundaryFocus(m,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 p.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(m=>this._handleResize(m.rows))),this.register(this._terminal.onRender(m=>this._refreshRows(m.start,m.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(m=>this._handleChar(m))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
|
+
`))),this.register(this._terminal.onA11yTab(m=>this._handleTab(m))),this.register(this._terminal.onKey(m=>this._handleKey(m.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(r){for(let s=0;s<r;s++)this._handleChar(" ")}_handleChar(r){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==r&&(this._charsToAnnounce+=r):this._charsToAnnounce+=r,r===`
|
|
3
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(r){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(r)||this._charsToConsume.push(r)}_refreshRows(r,s){this._liveRegionDebouncer.refresh(r,s,this._terminal.rows)}_renderRows(r,s){const d=this._terminal.buffer,b=d.lines.length.toString();for(let m=r;m<=s;m++){const C=d.lines.get(d.ydisp+m),g=[],E=(C==null?void 0:C.translateToString(!0,void 0,void 0,g))||"",T=(d.ydisp+m+1).toString(),B=this._rowElements[m];B&&(E.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=E,this._rowColumns.set(B,g)),B.setAttribute("aria-posinset",T),B.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(r,s){const d=r.target,b=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||r.relatedTarget!==b)return;let m,C;if(s===0?(m=d,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(m=this._rowElements.shift(),C=d,this._rowContainer.removeChild(m)),m.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),r.preventDefault(),r.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const r=document.getSelection();if(!r)return;if(r.isCollapsed)return void(this._rowContainer.contains(r.anchorNode)&&this._terminal.clearSelection());if(!r.anchorNode||!r.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:r.anchorNode,offset:r.anchorOffset},d={node:r.focusNode,offset:r.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const b=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:b,offset:((E=b.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(d.node))return;const m=({node:T,offset:B})=>{const O=T instanceof Text?T.parentNode:T;let D=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const P=this._rowColumns.get(O);if(!P)return console.warn("columns is null. Race condition?"),null;let N=B<P.length?P[B]:P.slice(-1)[0]+1;return N>=this._terminal.cols&&(++D,N=0),{row:D,column:N}},C=m(s),g=m(d);if(C&&g){if(C.row>g.row||C.row===g.row&&C.column>=g.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(g.row-C.row)*this._terminal.cols-C.column+g.column)}}_handleResize(r){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);for(;this._rowElements.length>r;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const r=this._coreBrowserService.mainDocument.createElement("div");return r.setAttribute("role","listitem"),r.tabIndex=-1,this._refreshRowDimensions(r),r}_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 r=0;r<this._terminal.rows;r++)this._refreshRowDimensions(this._rowElements[r])}}_refreshRowDimensions(r){r.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=n=h([f(1,u.IInstantiationService),f(2,y.ICoreBrowserService),f(3,y.IRenderService)],n)},3614:(R,t)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function h(p,v){return v?"\x1B[200~"+p+"\x1B[201~":p}function f(p,v,y,u){p=h(p=o(p),y.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),v.value=""}function c(p,v,y){const u=y.getBoundingClientRect(),i=p.clientX-u.left-10,n=p.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${n}px`,v.style.zIndex="1000",v.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=o,t.bracketTextForPaste=h,t.copyHandler=function(p,v){p.clipboardData&&p.clipboardData.setData("text/plain",v.selectionText),p.preventDefault()},t.handlePasteEvent=function(p,v,y,u){p.stopPropagation(),p.clipboardData&&f(p.clipboardData.getData("text/plain"),v,y,u)},t.paste=f,t.moveTextAreaUnderMouseCursor=c,t.rightClickHandler=function(p,v,y,u,i){c(p,v,y),i&&u.rightClickSelect(p),v.value=u.selectionText,v.select()}},7239:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=o(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(f,c,p){this._css.set(f,c,p)}getCss(f,c){return this._css.get(f,c)}setColor(f,c,p){this._color.set(f,c,p)}getColor(f,c){return this._color.get(f,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(o,h,f,c){o.addEventListener(h,f,c);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(h,f,c))}}}},3551:function(R,t,o){var h=this&&this.__decorate||function(n,r,s,d){var b,m=arguments.length,C=m<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(b=n[g])&&(C=(m<3?b(C):m>3?b(r,s,C):b(r,s))||C);return m>3&&C&&Object.defineProperty(r,s,C),C},f=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const c=o(3656),p=o(8460),v=o(844),y=o(2585),u=o(4725);let i=t.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(n,r,s,d,b){super(),this._element=n,this._mouseService=r,this._renderService=s,this._bufferService=d,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var m;this._lastMouseEvent=void 0,(m=this._activeProviderReplies)==null||m.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const r=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;const s=n.composedPath();for(let d=0;d<s.length;d++){const b=s[d];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&r.x===this._lastBufferCell.x&&r.y===this._lastBufferCell.y||(this._handleHover(r),this._lastBufferCell=r)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,r){var d,b;this._activeProviderReplies&&r||((d=this._activeProviderReplies)==null||d.forEach(m=>{m==null||m.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let s=!1;for(const[m,C]of this._linkProviderService.linkProviders.entries())r?(b=this._activeProviderReplies)!=null&&b.get(m)&&(s=this._checkLinkProviderResult(m,n,s)):C.provideLinks(n.y,g=>{var T,B;if(this._isMouseOut)return;const E=g==null?void 0:g.map(O=>({link:O}));(T=this._activeProviderReplies)==null||T.set(m,E),s=this._checkLinkProviderResult(m,n,s),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,r){const s=new Set;for(let d=0;d<r.size;d++){const b=r.get(d);if(b)for(let m=0;m<b.length;m++){const C=b[m],g=C.link.range.start.y<n?0:C.link.range.start.x,E=C.link.range.end.y>n?this._bufferService.cols:C.link.range.end.x;for(let T=g;T<=E;T++){if(s.has(T)){b.splice(m--,1);break}s.add(T)}}}}_checkLinkProviderResult(n,r,s){var m;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(n);let b=!1;for(let C=0;C<n;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(b=!0);if(!b&&d){const C=d.find(g=>this._linkAtPosition(g.link,r));C&&(s=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let C=0;C<this._activeProviderReplies.size;C++){const g=(m=this._activeProviderReplies.get(C))==null?void 0:m.find(E=>this._linkAtPosition(E.link,r));if(g){s=!0,this._handleNewLink(g);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const r=this._positionFromMouseEvent(n,this._element,this._mouseService);r&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,r){this._currentLink&&this._lastMouseEvent&&(!n||!r||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(n.link,r)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,b,m;(d=this._currentLink)!=null&&d.state&&((m=(b=this._currentLink)==null?void 0:b.state)==null?void 0:m.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(d,b),this._lastMouseEvent)){const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._askForLink(m,!1)}})))}_linkHover(n,r,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(s,r.text)}_fireUnderlineEvent(n,r){const s=n.range,d=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(n,r,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(s,r.text)}_linkAtPosition(n,r){const s=n.range.start.y*this._bufferService.cols+n.range.start.x,d=n.range.end.y*this._bufferService.cols+n.range.end.x,b=r.y*this._bufferService.cols+r.x;return s<=b&&b<=d}_positionFromMouseEvent(n,r,s){const d=s.getCoords(n,r,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,r,s,d,b){return{x1:n,y1:r,x2:s,y2:d,cols:this._bufferService.cols,fg:b}}};t.Linkifier=i=h([f(1,u.IMouseService),f(2,u.IRenderService),f(3,y.IBufferService),f(4,u.ILinkProviderService)],i)},9042:(R,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(R,t,o){var h=this&&this.__decorate||function(u,i,n,r){var s,d=arguments.length,b=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,i,n,r);else for(var m=u.length-1;m>=0;m--)(s=u[m])&&(b=(d<3?s(b):d>3?s(i,n,b):s(i,n))||b);return d>3&&b&&Object.defineProperty(i,n,b),b},f=this&&this.__param||function(u,i){return function(n,r){i(n,r,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const c=o(511),p=o(2585);let v=t.OscLinkProvider=class{constructor(u,i,n){this._bufferService=u,this._optionsService=i,this._oscLinkService=n}provideLinks(u,i){var E;const n=this._bufferService.buffer.lines.get(u-1);if(!n)return void i(void 0);const r=[],s=this._optionsService.rawOptions.linkHandler,d=new c.CellData,b=n.getTrimmedLength();let m=-1,C=-1,g=!1;for(let T=0;T<b;T++)if(C!==-1||n.hasContent(T)){if(n.loadCell(T,d),d.hasExtendedAttrs()&&d.extended.urlId){if(C===-1){C=T,m=d.extended.urlId;continue}g=d.extended.urlId!==m}else C!==-1&&(g=!0);if(g||C!==-1&&T===b-1){const B=(E=this._oscLinkService.getLinkData(m))==null?void 0:E.uri;if(B){const O={start:{x:C+1,y:u},end:{x:T+(g||T!==b-1?0:1),y:u}};let D=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const P=new URL(B);["http:","https:"].includes(P.protocol)||(D=!0)}catch{D=!0}D||r.push({text:B,range:O,activate:(P,N)=>s?s.activate(P,N,O):y(0,N),hover:(P,N)=>{var U;return(U=s==null?void 0:s.hover)==null?void 0:U.call(s,P,N,O)},leave:(P,N)=>{var U;return(U=s==null?void 0:s.leave)==null?void 0:U.call(s,P,N,O)}})}g=!1,d.hasExtendedAttrs()&&d.extended.urlId?(C=T,m=d.extended.urlId):(C=-1,m=-1)}}i(r)}};function y(u,i){if(confirm(`Do you want to navigate to ${i}?
|
|
4
4
|
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=h([g(0,_.IBufferService),g(1,_.IOptionsService),g(2,_.IOscLinkService)],v)},6193:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,h){this._renderCallback=o,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,h,g){this._rowCount=g,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const h=o(3614),g=o(3656),c=o(3551),_=o(9042),v=o(3730),y=o(1680),u=o(3107),i=o(5744),n=o(2950),t=o(1296),s=o(428),d=o(4269),b=o(5114),m=o(8934),C=o(3230),p=o(9312),E=o(4725),T=o(6731),B=o(8055),O=o(8969),D=o(8460),P=o(844),N=o(6114),U=o(8437),G=o(2584),$=o(7399),x=o(5941),L=o(9074),A=o(2585),M=o(5435),F=o(4567),z=o(779);class J extends O.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(I={}){super(I),this.browser=N,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new P.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(A.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,W)=>this.refresh(R,W))),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,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(R=>this._afterResize(R.cols,R.rows))),this.register((0,P.toDisposable)(()=>{var R,W;this._customKeyEventHandler=void 0,(W=(R=this.element)==null?void 0:R.parentNode)==null||W.removeChild(this.element)}))}_handleColorEvent(I){if(this._themeService)for(const R of I){let W,H="";switch(R.index){case 256:W="foreground",H="10";break;case 257:W="background",H="11";break;case 258:W="cursor",H="12";break;default:W="ansi",H="4;"+R.index}switch(R.type){case 0:const Z=B.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${H};${(0,x.toRgbString)(Z)}${G.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(q=>q.ansi[R.index]=B.channels.toColor(...R.color));else{const q=W;this._themeService.modifyColors(ie=>ie[q]=B.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(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 I=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(I);if(!R)return;const W=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,Z=R.getWidth(W),q=this._renderService.dimensions.css.cell.width*Z,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=q+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,h.copyHandler)(R,this._selectionService)}));const I=R=>(0,h.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,g.addDisposableDomListener)(this.element,"paste",I)),N.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,h.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),N.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,h.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",I=>this._keyUp(I),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",I=>this._keyDown(I),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",I=>this._keyPress(I),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",I=>this._compositionHelper.compositionupdate(I))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,g.addDisposableDomListener)(this.textarea,"input",I=>this._inputEvent(I),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(I){var W;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((W=this.element)==null?void 0:W.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.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"),I.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,g.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),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",_.promptLabel),N.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(b.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(H=>this._onRender.fire(H))),this.onResize(H=>this._renderService.resize(H.cols,H.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(m.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.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(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(H=>this.scrollLines(H.amount,H.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(p.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(H=>this.scrollLines(H.amount,H.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",H=>this._selectionService.handleMouseDown(H))),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(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(t.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const I=this,R=this.element;function W(q){const ie=I._mouseService.getMouseReportCoords(q,I.screenElement);if(!ie)return!1;let ce,he;switch(q.overrideType||q.type){case"mousemove":he=32,q.buttons===void 0?(ce=3,q.button!==void 0&&(ce=q.button<3?q.button:3)):ce=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":he=0,ce=q.button<3?q.button:3;break;case"mousedown":he=1,ce=q.button<3?q.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(q)===!1||I.viewport.getLinesScrolled(q)===0)return!1;he=q.deltaY<0?0:1,ce=4;break;default:return!1}return!(he===void 0||ce===void 0||ce>4)&&I.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ce,action:he,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:q=>(W(q),q.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(q)),wheel:q=>(W(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&W(q)},mousemove:q=>{q.buttons||W(q)}};this.register(this.coreMouseService.onProtocolChange(q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&q?H.mousemove||(R.addEventListener("mousemove",Z.mousemove),H.mousemove=Z.mousemove):(R.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&q?H.wheel||(R.addEventListener("wheel",Z.wheel,{passive:!1}),H.wheel=Z.wheel):(R.removeEventListener("wheel",H.wheel),H.wheel=null),2&q?H.mouseup||(H.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&q?H.mousedrag||(H.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(R,"mousedown",q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return W(q),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(q)})),this.register((0,g.addDisposableDomListener)(R,"wheel",q=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(q);if(ie===0)return;const ce=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B");let he="";for(let ue=0;ue<Math.abs(ie);ue++)he+=ce;return this.coreService.triggerDataEvent(he,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}},{passive:!1})),this.register((0,g.addDisposableDomListener)(R,"touchstart",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)},{passive:!0})),this.register((0,g.addDisposableDomListener)(R,"touchmove",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)},{passive:!1}))}refresh(I,R){var W;(W=this._renderService)==null||W.refreshRows(I,R)}updateCursorStyle(I){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(I)?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(I,R,W=0){var H;W===1?(super.scrollLines(I,R,W),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(I)}paste(I){(0,h.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,R,W){this._selectionService.setSelection(I,R,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,R){var W;(W=this._selectionService)==null||W.selectLines(I,R)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!R&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const W=(0,$.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),W.type===3||W.type===2){const H=this.rows-1;return this.scrollLines(W.type===2?-H:H),this.cancel(I,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(W.cancel&&this.cancel(I,!0),!W.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==G.C0.ETX&&W.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,R){const W=I.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||I.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||I.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?W:W&&(!R.keyCode||R.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)R=I.charCode;else if(I.which===null||I.which===void 0)R=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;R=I.which}return!(!R||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=I.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(I),!0}return!1}resize(I,R){I!==this.cols||R!==this.rows?super.resize(I,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,R){var W,H;(W=this._charSizeService)==null||W.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var I;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(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var R,W;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(W=this.viewport)==null||W.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${W};${R}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${Z};${H}t`)}}cancel(I,R){if(this.options.cancelEvents||R)return I.preventDefault(),I.stopPropagation(),!1}}r.Terminal=J},9924:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,h=1e3){this._renderCallback=o,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,h,g){this._rowCount=g,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=c-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h)}}},1680:function(k,r,o){var h=this&&this.__decorate||function(n,t,s,d){var b,m=arguments.length,C=m<3?t:d===null?d=Object.getOwnPropertyDescriptor(t,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,t,s,d);else for(var p=n.length-1;p>=0;p--)(b=n[p])&&(C=(m<3?b(C):m>3?b(t,s,C):b(t,s))||C);return m>3&&C&&Object.defineProperty(t,s,C),C},g=this&&this.__param||function(n,t){return function(s,d){t(s,d,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const c=o(3656),_=o(4725),v=o(8460),y=o(844),u=o(2585);let i=r.Viewport=class extends y.Disposable{constructor(n,t,s,d,b,m,C,p){super(),this._viewportElement=n,this._scrollArea=t,this._bufferService=s,this._optionsService=d,this._charSizeService=b,this._renderService=m,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 v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(p.colors),this.register(p.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)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 t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){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 t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,t){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&s<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const t=this._getPixelsScrolled(n);return t!==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+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(n,t))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const t=n*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let t=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(n,t){var p;let s,d="";const b=[],m=t??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let E=n;E<m;E++){const T=C.get(E);if(!T)continue;const B=(p=C.get(E+1))==null?void 0:p.isWrapped;if(d+=T.translateToString(!B),!B||E===C.length-1){const O=document.createElement("div");O.textContent=d,b.push(O),d.length>0&&(s=O),d=""}}return{bufferElements:b,cursorElement:s}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let t=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(n,t){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&t.altKey||s==="ctrl"&&t.ctrlKey||s==="shift"&&t.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const t=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(n,t))}};r.Viewport=i=h([g(2,u.IBufferService),g(3,u.IOptionsService),g(4,_.ICharSizeService),g(5,_.IRenderService),g(6,_.ICoreBrowserService),g(7,_.IThemeService)],i)},3107:function(k,r,o){var h=this&&this.__decorate||function(u,i,n,t){var s,d=arguments.length,b=d<3?i:t===null?t=Object.getOwnPropertyDescriptor(i,n):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,i,n,t);else for(var m=u.length-1;m>=0;m--)(s=u[m])&&(b=(d<3?s(b):d>3?s(i,n,b):s(i,n))||b);return d>3&&b&&Object.defineProperty(i,n,b),b},g=this&&this.__param||function(u,i){return function(n,t){i(n,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const c=o(4725),_=o(844),v=o(2585);let y=r.BufferDecorationRenderer=class extends _.Disposable{constructor(u,i,n,t,s){super(),this._screenElement=u,this._bufferService=i,this._coreBrowserService=n,this._decorationService=t,this._renderService=s,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,_.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 u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){var t;const i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((t=u==null?void 0:u.options)==null?void 0:t.layer)==="top"),i.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=u.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(u,i),i}_refreshStyle(u){const i=u.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let n=this._decorationElements.get(u);n||(n=this._createElement(u),u.element=n,this._decorationElements.set(u,n),this._container.appendChild(n),u.onDispose(()=>{this._decorationElements.delete(u),n.remove()})),n.style.top=i*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(n)}}_refreshXPosition(u,i=u.element){if(!i)return;const n=u.options.x??0;(u.options.anchor||"left")==="right"?i.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){var i;(i=this._decorationElements.get(u))==null||i.remove(),this._decorationElements.delete(u),u.dispose()}};r.BufferDecorationRenderer=y=h([g(1,v.IBufferService),g(2,c.ICoreBrowserService),g(3,v.IDecorationService),g(4,c.IRenderService)],y)},5871:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const h of this._zones)if(h.color===o.options.overviewRulerOptions.color&&h.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,o.marker.line))return;if(this._lineAdjacentToZone(h,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(h,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,h){return h>=o.startBufferLine&&h<=o.endBufferLine}_lineAdjacentToZone(o,h,g){return h>=o.startBufferLine-this._linePadding[g||"full"]&&h<=o.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(o,h){o.startBufferLine=Math.min(o.startBufferLine,h),o.endBufferLine=Math.max(o.endBufferLine,h)}}},5744:function(k,r,o){var h=this&&this.__decorate||function(s,d,b,m){var C,p=arguments.length,E=p<3?d:m===null?m=Object.getOwnPropertyDescriptor(d,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,b,m);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(E=(p<3?C(E):p>3?C(d,b,E):C(d,b))||E);return p>3&&E&&Object.defineProperty(d,b,E),E},g=this&&this.__param||function(s,d){return function(b,m){d(b,m,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const c=o(5871),_=o(4725),v=o(844),y=o(2585),u={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let t=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,b,m,C,p,E){var B;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=b,this._decorationService=m,this._renderService=C,this._optionsService=p,this._coreBrowserService=E,this._colorZoneStore=new c.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(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{var O;(O=this._canvas)==null||O.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 s=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=s,i.center=d,i.right=s,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=i.left,n.right=i.left+i.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);u.left=d,u.center=d,u.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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 s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(n[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-u[s.position||"full"]/2),i[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=t=h([g(2,y.IBufferService),g(3,y.IDecorationService),g(4,_.IRenderService),g(5,y.IOptionsService),g(6,_.ICoreBrowserService)],t)},2950:function(k,r,o){var h=this&&this.__decorate||function(u,i,n,t){var s,d=arguments.length,b=d<3?i:t===null?t=Object.getOwnPropertyDescriptor(i,n):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,i,n,t);else for(var m=u.length-1;m>=0;m--)(s=u[m])&&(b=(d<3?s(b):d>3?s(i,n,b):s(i,n))||b);return d>3&&b&&Object.defineProperty(i,n,b),b},g=this&&this.__param||function(u,i){return function(n,t){i(n,t,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const c=o(4725),_=o(2585),v=o(2584);let y=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,i,n,t,s,d){this._textarea=u,this._compositionView=i,this._bufferService=n,this._optionsService=t,this._coreService=s,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(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){const i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){const u=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const i=this._textarea.value,n=i.replace(u,"");this._dataAlreadySent=n,i.length>u.length?this._coreService.triggerDataEvent(n,!0):i.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):i.length===u.length&&i!==u&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,t=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=t+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"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=s+"px",this._textarea.style.top=t+"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"}u||setTimeout(()=>this.updateCompositionElements(!0),0)}}};r.CompositionHelper=y=h([g(2,_.IBufferService),g(3,_.IOptionsService),g(4,_.ICoreService),g(5,c.IRenderService)],y)},9806:(k,r)=>{function o(h,g,c){const _=c.getBoundingClientRect(),v=h.getComputedStyle(c),y=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[g.clientX-_.left-y,g.clientY-_.top-u]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(h,g,c,_,v,y,u,i,n){if(!y)return;const t=o(h,g,c);return t?(t[0]=Math.ceil((t[0]+(n?u/2:0))/u),t[1]=Math.ceil(t[1]/i),t[0]=Math.min(Math.max(t[0],1),_+(n?1:0)),t[1]=Math.min(Math.max(t[1],1),v),t):void 0}},9504:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const h=o(2584);function g(i,n,t,s){const d=i-c(i,t),b=n-c(n,t),m=Math.abs(d-b)-function(C,p,E){let T=0;const B=C-c(C,E),O=p-c(p,E);for(let D=0;D<Math.abs(B-O);D++){const P=_(C,p)==="A"?-1:1,N=E.buffer.lines.get(B+P*D);N!=null&&N.isWrapped&&T++}return T}(i,n,t);return u(m,y(_(i,n),s))}function c(i,n){let t=0,s=n.buffer.lines.get(i),d=s==null?void 0:s.isWrapped;for(;d&&i>=0&&i<n.rows;)t++,s=n.buffer.lines.get(--i),d=s==null?void 0:s.isWrapped;return t}function _(i,n){return i>n?"A":"B"}function v(i,n,t,s,d,b){let m=i,C=n,p="";for(;m!==t||C!==s;)m+=d?1:-1,d&&m>b.cols-1?(p+=b.buffer.translateBufferLineToString(C,!1,i,m),m=0,i=0,C++):!d&&m<0&&(p+=b.buffer.translateBufferLineToString(C,!1,0,i+1),m=b.cols-1,i=m,C--);return p+b.buffer.translateBufferLineToString(C,!1,i,m)}function y(i,n){const t=n?"O":"[";return h.C0.ESC+t+i}function u(i,n){i=Math.floor(i);let t="";for(let s=0;s<i;s++)t+=n;return t}r.moveToCellSequence=function(i,n,t,s){const d=t.buffer.x,b=t.buffer.y;if(!t.buffer.hasScrollback)return function(p,E,T,B,O,D){return g(E,B,O,D).length===0?"":u(v(p,E,p,E-c(E,O),!1,O).length,y("D",D))}(d,b,0,n,t,s)+g(b,n,t,s)+function(p,E,T,B,O,D){let P;P=g(E,B,O,D).length>0?B-c(B,O):E;const N=B,U=function(G,$,x,L,A,M){let F;return F=g(x,L,A,M).length>0?L-c(L,A):$,G<x&&F<=L||G>=x&&F<L?"C":"D"}(p,E,T,B,O,D);return u(v(p,P,T,N,U==="C",O).length,y(U,D))}(d,b,i,n,t,s);let m;if(b===n)return m=d>i?"D":"C",u(Math.abs(d-i),y(m,s));m=b>n?"D":"C";const C=Math.abs(b-n);return u(function(p,E){return E.cols-p}(b>n?i:d,t)+(C-1)*t.cols+1+((b>n?d:i)-1),y(m,s))}},1296:function(k,r,o){var h=this&&this.__decorate||function(D,P,N,U){var G,$=arguments.length,x=$<3?P:U===null?U=Object.getOwnPropertyDescriptor(P,N):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(D,P,N,U);else for(var L=D.length-1;L>=0;L--)(G=D[L])&&(x=($<3?G(x):$>3?G(P,N,x):G(P,N))||x);return $>3&&x&&Object.defineProperty(P,N,x),x},g=this&&this.__param||function(D,P){return function(N,U){P(N,U,D)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const c=o(3787),_=o(2550),v=o(2223),y=o(6171),u=o(6052),i=o(4725),n=o(8055),t=o(8460),s=o(844),d=o(2585),b="xterm-dom-renderer-owner-",m="xterm-rows",C="xterm-fg-",p="xterm-bg-",E="xterm-focus",T="xterm-selection";let B=1,O=r.DomRenderer=class extends s.Disposable{constructor(D,P,N,U,G,$,x,L,A,M,F,z,J){super(),this._terminal=D,this._document=P,this._element=N,this._screenElement=U,this._viewportElement=G,this._helperContainer=$,this._linkifier2=x,this._charSizeService=A,this._optionsService=M,this._bufferService=F,this._coreBrowserService=z,this._themeService=J,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,u.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new t.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(m),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(ee=>this._injectCss(ee))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(ee=>this._handleLinkHover(ee))),this.register(this._linkifier2.onHideLinkUnderline(ee=>this._handleLinkLeave(ee))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 N of this._rowElements)N.style.width=`${this.dimensions.css.canvas.width}px`,N.style.height=`${this.dimensions.css.cell.height}px`,N.style.lineHeight=`${this.dimensions.css.cell.height}px`,N.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const P=`${this._terminalSelector} .${m} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=P,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let P=`${this._terminalSelector} .${m} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;P+=`${this._terminalSelector} .${m} .xterm-dim { color: ${n.color.multiplyOpacity(D.foreground,.5).css};}`,P+=`${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 N=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;P+=`@keyframes ${N} { 50% { border-bottom-style: hidden; }}`,P+=`@keyframes ${U} { 50% { box-shadow: none; }}`,P+=`@keyframes ${G} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,P+=`${this._terminalSelector} .${m}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${m}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${m}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,P+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[$,x]of D.ansi.entries())P+=`${this._terminalSelector} .${C}${$} { color: ${x.css}; }${this._terminalSelector} .${C}${$}.xterm-dim { color: ${n.color.multiplyOpacity(x,.5).css}; }${this._terminalSelector} .${p}${$} { background-color: ${x.css}; }`;P+=`${this._terminalSelector} .${C}${v.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${p}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=P}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,P){for(let N=this._rowElements.length;N<=P;N++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>P;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,P){this._refreshRowElements(D,P),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,P,N){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,P,N),this.renderRows(0,this._bufferService.rows-1),!D||!P)return;this._selectionRenderModel.update(this._terminal,D,P,N);const U=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,x=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||x<0)return;const L=this._document.createDocumentFragment();if(N){const A=D[0]>P[0];L.appendChild(this._createSelectionElement($,A?P[0]:D[0],A?D[0]:P[0],x-$+1))}else{const A=U===$?D[0]:0,M=$===G?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement($,A,M));const F=x-$-1;if(L.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,F)),$!==x){const z=G===x?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(x,0,z))}}this._selectionContainer.appendChild(L)}_createSelectionElement(D,P,N,U=1){const G=this._document.createElement("div"),$=P*this.dimensions.css.cell.width;let x=this.dimensions.css.cell.width*(N-P);return $+x>this.dimensions.css.canvas.width&&(x=this.dimensions.css.canvas.width-$),G.style.height=U*this.dimensions.css.cell.height+"px",G.style.top=D*this.dimensions.css.cell.height+"px",G.style.left=`${$}px`,G.style.width=`${x}px`,G}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 D of this._rowElements)D.replaceChildren()}renderRows(D,P){const N=this._bufferService.buffer,U=N.ybase+N.y,G=Math.min(N.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,x=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let A=D;A<=P;A++){const M=A+N.ydisp,F=this._rowElements[A],z=N.lines.get(M);if(!F||!z)break;F.replaceChildren(...this._rowFactory.createRow(z,M,M===U,x,L,G,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,P,N,U,G,$){N<0&&(D=0),U<0&&(P=0);const x=this._bufferService.rows-1;N=Math.max(Math.min(N,x),0),U=Math.max(Math.min(U,x),0),G=Math.min(G,this._bufferService.cols);const L=this._bufferService.buffer,A=L.ybase+L.y,M=Math.min(L.x,G-1),F=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=N;ee<=U;++ee){const I=ee+L.ydisp,R=this._rowElements[ee],W=L.lines.get(I);if(!R||!W)break;R.replaceChildren(...this._rowFactory.createRow(W,I,I===A,z,J,M,F,this.dimensions.css.cell.width,this._widthCache,$?ee===N?D:0:-1,$?(ee===U?P:G)-1:-1))}}};r.DomRenderer=O=h([g(7,d.IInstantiationService),g(8,i.ICharSizeService),g(9,d.IOptionsService),g(10,d.IBufferService),g(11,i.ICoreBrowserService),g(12,i.IThemeService)],O)},3787:function(k,r,o){var h=this&&this.__decorate||function(m,C,p,E){var T,B=arguments.length,O=B<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,p):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(m,C,p,E);else for(var D=m.length-1;D>=0;D--)(T=m[D])&&(O=(B<3?T(O):B>3?T(C,p,O):T(C,p))||O);return B>3&&O&&Object.defineProperty(C,p,O),O},g=this&&this.__param||function(m,C){return function(p,E){C(p,E,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const c=o(2223),_=o(643),v=o(511),y=o(2585),u=o(8055),i=o(4725),n=o(4269),t=o(6171),s=o(3734);let d=r.DomRendererRowFactory=class{constructor(m,C,p,E,T,B,O){this._document=m,this._characterJoinerService=C,this._optionsService=p,this._coreBrowserService=E,this._coreService=T,this._decorationService=B,this._themeService=O,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(m,C,p){this._selectionStart=m,this._selectionEnd=C,this._columnSelectMode=p}createRow(m,C,p,E,T,B,O,D,P,N,U){const G=[],$=this._characterJoinerService.getJoinedCharacters(C),x=this._themeService.colors;let L,A=m.getNoBgTrimmedLength();p&&A<B+1&&(A=B+1);let M=0,F="",z=0,J=0,ee=0,I=!1,R=0,W=!1,H=0;const Z=[],q=N!==-1&&U!==-1;for(let ie=0;ie<A;ie++){m.loadCell(ie,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let he=!1,ue=ie,te=this._workCell;if($.length>0&&ie===$[0][0]){he=!0;const oe=$.shift();te=new n.JoinedCellData(this._workCell,m.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),ue=oe[1]-1,ce=te.getWidth()}const ze=this._isCellInSelection(ie,C),kt=p&&ie===B,Rt=q&&ie>=N&&ie<=U;let Lt=!1;this._decorationService.forEachDecorationAtCell(ie,C,void 0,oe=>{Lt=!0});let ft=te.getChars()||_.WHITESPACE_CELL_CHAR;if(ft===" "&&(te.isUnderline()||te.isOverline())&&(ft=" "),H=ce*D-P.get(ft,te.isBold(),te.isItalic()),L){if(M&&(ze&&W||!ze&&!W&&te.bg===z)&&(ze&&W&&x.selectionForeground||te.fg===J)&&te.extended.ext===ee&&Rt===I&&H===R&&!kt&&!he&&!Lt){te.isInvisible()?F+=_.WHITESPACE_CELL_CHAR:F+=ft,M++;continue}M&&(L.textContent=F),L=this._document.createElement("span"),M=0,F=""}else L=this._document.createElement("span");if(z=te.bg,J=te.fg,ee=te.extended.ext,I=Rt,R=H,W=ze,he&&B>=ie&&B<=ue&&(B=ie),!this._coreService.isCursorHidden&&kt&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(te.isBold()&&Z.push("xterm-bold"),te.isItalic()&&Z.push("xterm-italic"),te.isDim()&&Z.push("xterm-dim"),F=te.isInvisible()?_.WHITESPACE_CELL_CHAR:te.getChars()||_.WHITESPACE_CELL_CHAR,te.isUnderline()&&(Z.push(`xterm-underline-${te.extended.underlineStyle}`),F===" "&&(F=" "),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let oe=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&oe<8&&(oe+=8),L.style.textDecorationColor=x.ansi[oe].css}te.isOverline()&&(Z.push("xterm-overline"),F===" "&&(F=" ")),te.isStrikethrough()&&Z.push("xterm-strikethrough"),Rt&&(L.style.textDecoration="underline");let _e=te.getFgColor(),qe=te.getFgColorMode(),be=te.getBgColor(),Ve=te.getBgColorMode();const Dt=!!te.isInverse();if(Dt){const oe=_e;_e=be,be=oe;const Cr=qe;qe=Ve,Ve=Cr}let ke,_t,Re,Ze=!1;switch(this._decorationService.forEachDecorationAtCell(ie,C,void 0,oe=>{oe.options.layer!=="top"&&Ze||(oe.backgroundColorRGB&&(Ve=50331648,be=oe.backgroundColorRGB.rgba>>8&16777215,ke=oe.backgroundColorRGB),oe.foregroundColorRGB&&(qe=50331648,_e=oe.foregroundColorRGB.rgba>>8&16777215,_t=oe.foregroundColorRGB),Ze=oe.options.layer==="top")}),!Ze&&ze&&(ke=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,be=ke.rgba>>8&16777215,Ve=50331648,Ze=!0,x.selectionForeground&&(qe=50331648,_e=x.selectionForeground.rgba>>8&16777215,_t=x.selectionForeground)),Ze&&Z.push("xterm-decoration-top"),Ve){case 16777216:case 33554432:Re=x.ansi[be],Z.push(`xterm-bg-${be}`);break;case 50331648:Re=u.channels.toColor(be>>16,be>>8&255,255&be),this._addStyle(L,`background-color:#${b((be>>>0).toString(16),"0",6)}`);break;default:Dt?(Re=x.foreground,Z.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):Re=x.background}switch(ke||te.isDim()&&(ke=u.color.multiplyOpacity(Re,.5)),qe){case 16777216:case 33554432:te.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(L,Re,x.ansi[_e],te,ke,void 0)||Z.push(`xterm-fg-${_e}`);break;case 50331648:const oe=u.channels.toColor(_e>>16&255,_e>>8&255,255&_e);this._applyMinimumContrast(L,Re,oe,te,ke,_t)||this._addStyle(L,`color:#${b(_e.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Re,x.foreground,te,ke,_t)||Dt&&Z.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}Z.length&&(L.className=Z.join(" "),Z.length=0),kt||he||Lt?L.textContent=F:M++,H!==this.defaultSpacing&&(L.style.letterSpacing=`${H}px`),G.push(L),ie=ue}return L&&M&&(L.textContent=F),G}_applyMinimumContrast(m,C,p,E,T,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const O=this._getContrastCache(E);let D;if(T||B||(D=O.getColor(C.rgba,p.rgba)),D===void 0){const P=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=u.color.ensureContrastRatio(T||C,B||p,P),O.setColor((T||C).rgba,(B||p).rgba,D??null)}return!!D&&(this._addStyle(m,`color:${D.css}`),!0)}_getContrastCache(m){return m.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(m,C){m.setAttribute("style",`${m.getAttribute("style")||""}${C};`)}_isCellInSelection(m,C){const p=this._selectionStart,E=this._selectionEnd;return!(!p||!E)&&(this._columnSelectMode?p[0]<=E[0]?m>=p[0]&&C>=p[1]&&m<E[0]&&C<=E[1]:m<p[0]&&C>=p[1]&&m>=E[0]&&C<=E[1]:C>p[1]&&C<E[1]||p[1]===E[1]&&C===p[1]&&m>=p[0]&&m<E[0]||p[1]<E[1]&&C===E[1]&&m<E[0]||p[1]<E[1]&&C===p[1]&&m>=p[0])}};function b(m,C,p){for(;m.length<p;)m=C+m;return m}r.DomRendererRowFactory=d=h([g(1,i.ICharacterJoinerService),g(2,y.IOptionsService),g(3,i.ICoreBrowserService),g(4,y.ICoreService),g(5,y.IDecorationService),g(6,i.IThemeService)],d)},2550:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=o.createElement("span");g.classList.add("xterm-char-measure-element");const c=o.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[g,c,_,v],this._container.appendChild(g),this._container.appendChild(c),this._container.appendChild(_),this._container.appendChild(v),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(o,h,g,c){o===this._font&&h===this._fontSize&&g===this._weight&&c===this._weightBold||(this._font=o,this._fontSize=h,this._weight=g,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(o,h,g){let c=0;if(!h&&!g&&o.length===1&&(c=o.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const y=this._measure(o,0);return y>0&&(this._flat[c]=y),y}let _=o;h&&(_+="B"),g&&(_+="I");let v=this._holey.get(_);if(v===void 0){let y=0;h&&(y|=1),g&&(y|=2),v=this._measure(o,y),v>0&&this._holey.set(_,v)}return v}_measure(o,h){const g=this._measureElements[h];return g.textContent=o.repeat(32),g.offsetWidth/32}}},2223:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const h=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(k,r)=>{function o(g){return 57508<=g&&g<=57558}function h(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},r.isEmoji=h,r.allowRescaling=function(g,c,_,v){return c===1&&_>Math.ceil(1.5*v)&&g!==void 0&&g>255&&!h(g)&&!o(g)&&!function(y){return 57344<=y&&y<=63743}(g)},r.treatGlyphAsBackgroundColor=function(g){return o(g)||function(c){return 9472<=c&&c<=9631}(g)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(g,c,_=0){return(g-(2*Math.round(c)-_))%(2*Math.round(c))}},6052:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class o{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,c,_,v=!1){if(this.selectionStart=c,this.selectionEnd=_,!c||!_||c[0]===_[0]&&c[1]===_[1])return void this.clear();const y=g.buffers.active.ydisp,u=c[1]-y,i=_[1]-y,n=Math.max(u,0),t=Math.min(i,g.rows-1);n>=g.rows||t<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=u,this.viewportEndRow=i,this.viewportCappedStartRow=n,this.viewportCappedEndRow=t,this.startCol=c[0],this.endCol=_[0])}isCellSelected(g,c,_){return!!this.hasSelection&&(_-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&_>=this.viewportCappedStartRow&&c<this.endCol&&_<=this.viewportCappedEndRow:c<this.startCol&&_>=this.viewportCappedStartRow&&c>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&c>=this.startCol)}}r.createSelectionRenderModel=function(){return new o}},456:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,h=this.selectionEnd;return!(!o||!h)&&(o[1]>h[1]||o[1]===h[1]&&o[0]>h[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(k,r,o){var h=this&&this.__decorate||function(t,s,d,b){var m,C=arguments.length,p=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,d,b);else for(var E=t.length-1;E>=0;E--)(m=t[E])&&(p=(C<3?m(p):C>3?m(s,d,p):m(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},g=this&&this.__param||function(t,s){return function(d,b){s(d,b,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const c=o(2585),_=o(8460),v=o(844);let y=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(t,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new i(t,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const t=this._measureStrategy.measure();t.width===this.width&&t.height===this.height||(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};r.CharSizeService=y=h([g(2,c.IOptionsService)],y);class u extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class i extends u{constructor(s,d,b){super(),this._document=s,this._parentElement=d,this._optionsService=b,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 n extends u{constructor(s){super(),this._optionsService=s,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 s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(k,r,o){var h=this&&this.__decorate||function(n,t,s,d){var b,m=arguments.length,C=m<3?t:d===null?d=Object.getOwnPropertyDescriptor(t,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,t,s,d);else for(var p=n.length-1;p>=0;p--)(b=n[p])&&(C=(m<3?b(C):m>3?b(t,s,C):b(t,s))||C);return m>3&&C&&Object.defineProperty(t,s,C),C},g=this&&this.__param||function(n,t){return function(s,d){t(s,d,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const c=o(3734),_=o(643),v=o(511),y=o(2585);class u extends c.AttributeData{constructor(t,s,d){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=s,this._width=d}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=u;let i=r.CharacterJoinerService=class hr{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(t){const s={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(s),s.id}deregister(t){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===t)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(t);if(!s||s.length===0)return[];const d=[],b=s.translateToString(!0);let m=0,C=0,p=0,E=s.getFg(0),T=s.getBg(0);for(let B=0;B<s.getTrimmedLength();B++)if(s.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==T){if(B-m>1){const O=this._getJoinedRanges(b,p,C,s,m);for(let D=0;D<O.length;D++)d.push(O[D])}m=B,p=C,E=this._workCell.fg,T=this._workCell.bg}C+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-m>1){const B=this._getJoinedRanges(b,p,C,s,m);for(let O=0;O<B.length;O++)d.push(B[O])}return d}_getJoinedRanges(t,s,d,b,m){const C=t.substring(s,d);let p=[];try{p=this._characterJoiners[0].handler(C)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const T=this._characterJoiners[E].handler(C);for(let B=0;B<T.length;B++)hr._mergeRanges(p,T[B])}catch(T){console.error(T)}return this._stringRangesToCellRanges(p,b,m),p}_stringRangesToCellRanges(t,s,d){let b=0,m=!1,C=0,p=t[b];if(p){for(let E=d;E<this._bufferService.cols;E++){const T=s.getWidth(E),B=s.getString(E).length||_.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!m&&p[0]<=C&&(p[0]=E,m=!0),p[1]<=C){if(p[1]=E,p=t[++b],!p)break;p[0]<=C?(p[0]=E,m=!0):m=!1}C+=B}}p&&(p[1]=this._bufferService.cols)}}static _mergeRanges(t,s){let d=!1;for(let b=0;b<t.length;b++){const m=t[b];if(d){if(s[1]<=m[0])return t[b-1][1]=s[1],t;if(s[1]<=m[1])return t[b-1][1]=Math.max(s[1],m[1]),t.splice(b,1),t;t.splice(b,1),b--}else{if(s[1]<=m[0])return t.splice(b,0,s),t;if(s[1]<=m[1])return m[0]=Math.min(s[0],m[0]),t;s[0]<m[1]&&(m[0]=Math.min(s[0],m[0]),d=!0)}}return d?t[t.length-1][1]=s[1]:t.push(s),t}};r.CharacterJoinerService=i=h([g(0,y.IBufferService)],i)},5114:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const h=o(844),g=o(8460),c=o(3656);class _ extends h.Disposable{constructor(u,i,n){super(),this._textarea=u,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(t=>this._screenDprMonitor.setWindow(t))),this.register((0,g.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(u){this._window!==u&&(this._window=u,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}r.CoreBrowserService=_;class v extends h.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new g.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(u){this._parentWindow=u,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var u;this._outerListener&&((u=this._resolutionMediaMatchList)==null||u.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:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const h=o(844);class g extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=g},8934:function(k,r,o){var h=this&&this.__decorate||function(y,u,i,n){var t,s=arguments.length,d=s<3?u:n===null?n=Object.getOwnPropertyDescriptor(u,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(y,u,i,n);else for(var b=y.length-1;b>=0;b--)(t=y[b])&&(d=(s<3?t(d):s>3?t(u,i,d):t(u,i))||d);return s>3&&d&&Object.defineProperty(u,i,d),d},g=this&&this.__param||function(y,u){return function(i,n){u(i,n,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const c=o(4725),_=o(9806);let v=r.MouseService=class{constructor(y,u){this._renderService=y,this._charSizeService=u}getCoords(y,u,i,n,t){return(0,_.getCoords)(window,y,u,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(y,u){const i=(0,_.getCoordsRelativeToElement)(window,y,u);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};r.MouseService=v=h([g(0,c.IRenderService),g(1,c.ICharSizeService)],v)},3230:function(k,r,o){var h=this&&this.__decorate||function(t,s,d,b){var m,C=arguments.length,p=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,d,b);else for(var E=t.length-1;E>=0;E--)(m=t[E])&&(p=(C<3?m(p):C>3?m(s,d,p):m(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},g=this&&this.__param||function(t,s){return function(d,b){s(d,b,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const c=o(6193),_=o(4725),v=o(8460),y=o(844),u=o(7226),i=o(2585);let n=r.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(t,s,d,b,m,C,p,E){super(),this._rowCount=t,this._charSizeService=b,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new y.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer((T,B)=>this._renderRows(T,B),p),this.register(this._renderDebouncer),this.register(p.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var T;return(T=this._renderer.value)==null?void 0:T.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(m.onDecorationRegistered(()=>this._fullRefresh())),this.register(m.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(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(p.window,s),this.register(p.onWindowChange(T=>this._registerIntersectionObserver(T,s)))}_registerIntersectionObserver(t,s){if("IntersectionObserver"in t){const d=new t.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,y.toDisposable)(()=>d.disconnect())}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.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(t,s,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,s,this._rowCount))}_renderRows(t,s){this._renderer.value&&(t=Math.min(t,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(t,s),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:s}),this._onRender.fire({start:t,end:s}),this._isNextRenderRedrawOnly=!0)}resize(t,s){this._rowCount=s,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(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw(s=>this.refreshRows(s.start,s.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var t,s;this._renderer.value&&((s=(t=this._renderer.value).clearTextureAtlas)==null||s.call(t),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(t,s)}):this._renderer.value.handleResize(t,s),this._fullRefresh())}handleCharSizeChanged(){var t;(t=this._renderer.value)==null||t.handleCharSizeChanged()}handleBlur(){var t;(t=this._renderer.value)==null||t.handleBlur()}handleFocus(){var t;(t=this._renderer.value)==null||t.handleFocus()}handleSelectionChanged(t,s,d){var b;this._selectionState.start=t,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(b=this._renderer.value)==null||b.handleSelectionChanged(t,s,d)}handleCursorMove(){var t;(t=this._renderer.value)==null||t.handleCursorMove()}clear(){var t;(t=this._renderer.value)==null||t.clear()}};r.RenderService=n=h([g(2,i.IOptionsService),g(3,_.ICharSizeService),g(4,i.IDecorationService),g(5,i.IBufferService),g(6,_.ICoreBrowserService),g(7,_.IThemeService)],n)},9312:function(k,r,o){var h=this&&this.__decorate||function(p,E,T,B){var O,D=arguments.length,P=D<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(p,E,T,B);else for(var N=p.length-1;N>=0;N--)(O=p[N])&&(P=(D<3?O(P):D>3?O(E,T,P):O(E,T))||P);return D>3&&P&&Object.defineProperty(E,T,P),P},g=this&&this.__param||function(p,E){return function(T,B){E(T,B,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const c=o(9806),_=o(9504),v=o(456),y=o(4725),u=o(8460),i=o(844),n=o(6114),t=o(4841),s=o(511),d=o(2585),b=" ",m=new RegExp(b,"g");let C=r.SelectionService=class extends i.Disposable{constructor(p,E,T,B,O,D,P,N,U){super(),this._element=p,this._screenElement=E,this._linkifier=T,this._bufferService=B,this._coreService=O,this._mouseService=D,this._optionsService=P,this._renderService=N,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(G=>this._handleTrim(G)),this.register(this._bufferService.buffers.onBufferActivate(G=>this._handleBufferActivate(G))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const p=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!p||!E||p[0]===E[0]&&p[1]===E[1])}get selectionText(){const p=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!p||!E)return"";const T=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(p[0]===E[0])return"";const O=p[0]<E[0]?p[0]:E[0],D=p[0]<E[0]?E[0]:p[0];for(let P=p[1];P<=E[1];P++){const N=T.translateBufferLineToString(P,!0,O,D);B.push(N)}}else{const O=p[1]===E[1]?E[0]:void 0;B.push(T.translateBufferLineToString(p[1],!0,p[0],O));for(let D=p[1]+1;D<=E[1]-1;D++){const P=T.lines.get(D),N=T.translateBufferLineToString(D,!0);P!=null&&P.isWrapped?B[B.length-1]+=N:B.push(N)}if(p[1]!==E[1]){const D=T.lines.get(E[1]),P=T.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?B[B.length-1]+=P:B.push(P)}}return B.map(O=>O.replace(m," ")).join(n.isWindows?`\r
|
|
5
|
+
WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=v=h([f(0,p.IBufferService),f(1,p.IOptionsService),f(2,p.IOscLinkService)],v)},6193:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(o,h){this._renderCallback=o,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,h,f){this._rowCount=f,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=o(3614),f=o(3656),c=o(3551),p=o(9042),v=o(3730),y=o(1680),u=o(3107),i=o(5744),n=o(2950),r=o(1296),s=o(428),d=o(4269),b=o(5114),m=o(8934),C=o(3230),g=o(9312),E=o(4725),T=o(6731),B=o(8055),O=o(8969),D=o(8460),P=o(844),N=o(6114),U=o(8437),G=o(2584),$=o(7399),x=o(5941),L=o(9074),A=o(2585),M=o(5435),F=o(4567),z=o(779);class J extends O.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(I={}){super(I),this.browser=N,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new P.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(A.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((k,W)=>this.refresh(k,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(k=>this._reportWindowsOptions(k))),this.register(this._inputHandler.onColor(k=>this._handleColorEvent(k))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(k=>this._afterResize(k.cols,k.rows))),this.register((0,P.toDisposable)(()=>{var k,W;this._customKeyEventHandler=void 0,(W=(k=this.element)==null?void 0:k.parentNode)==null||W.removeChild(this.element)}))}_handleColorEvent(I){if(this._themeService)for(const k of I){let W,H="";switch(k.index){case 256:W="foreground",H="10";break;case 257:W="background",H="11";break;case 258:W="cursor",H="12";break;default:W="ansi",H="4;"+k.index}switch(k.type){case 0:const Z=B.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${H};${(0,x.toRgbString)(Z)}${G.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(q=>q.ansi[k.index]=B.channels.toColor(...k.color));else{const q=W;this._themeService.modifyColors(ie=>ie[q]=B.channels.toColor(...k.color))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 I=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(I);if(!k)return;const W=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,Z=k.getWidth(W),q=this._renderService.dimensions.css.cell.width*Z,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=q+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",k=>{this.hasSelection()&&(0,h.copyHandler)(k,this._selectionService)}));const I=k=>(0,h.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,f.addDisposableDomListener)(this.element,"paste",I)),N.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",k=>{k.button===2&&(0,h.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",k=>{(0,h.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),N.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",k=>{k.button===1&&(0,h.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",I=>this._keyUp(I),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",I=>this._keyDown(I),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",I=>this._keyPress(I),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",I=>this._compositionHelper.compositionupdate(I))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,f.addDisposableDomListener)(this.textarea,"input",I=>this._inputEvent(I),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(I){var W;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((W=this.element)==null?void 0:W.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.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"),I.appendChild(this.element);const k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,f.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),N.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(b.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(H=>this._onRender.fire(H))),this.onResize(H=>this._renderService.resize(H.cols,H.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(m.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(H=>this.scrollLines(H.amount,H.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(g.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(H=>this.scrollLines(H.amount,H.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",H=>this._selectionService.handleMouseDown(H))),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(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(r.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const I=this,k=this.element;function W(q){const ie=I._mouseService.getMouseReportCoords(q,I.screenElement);if(!ie)return!1;let ce,he;switch(q.overrideType||q.type){case"mousemove":he=32,q.buttons===void 0?(ce=3,q.button!==void 0&&(ce=q.button<3?q.button:3)):ce=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":he=0,ce=q.button<3?q.button:3;break;case"mousedown":he=1,ce=q.button<3?q.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(q)===!1||I.viewport.getLinesScrolled(q)===0)return!1;he=q.deltaY<0?0:1,ce=4;break;default:return!1}return!(he===void 0||ce===void 0||ce>4)&&I.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ce,action:he,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:q=>(W(q),q.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(q)),wheel:q=>(W(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&W(q)},mousemove:q=>{q.buttons||W(q)}};this.register(this.coreMouseService.onProtocolChange(q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&q?H.mousemove||(k.addEventListener("mousemove",Z.mousemove),H.mousemove=Z.mousemove):(k.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&q?H.wheel||(k.addEventListener("wheel",Z.wheel,{passive:!1}),H.wheel=Z.wheel):(k.removeEventListener("wheel",H.wheel),H.wheel=null),2&q?H.mouseup||(H.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&q?H.mousedrag||(H.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(k,"mousedown",q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return W(q),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(q)})),this.register((0,f.addDisposableDomListener)(k,"wheel",q=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(q);if(ie===0)return;const ce=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B");let he="";for(let ue=0;ue<Math.abs(ie);ue++)he+=ce;return this.coreService.triggerDataEvent(he,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}},{passive:!1})),this.register((0,f.addDisposableDomListener)(k,"touchstart",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)},{passive:!0})),this.register((0,f.addDisposableDomListener)(k,"touchmove",q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)},{passive:!1}))}refresh(I,k){var W;(W=this._renderService)==null||W.refreshRows(I,k)}updateCursorStyle(I){var k;(k=this._selectionService)!=null&&k.shouldColumnSelect(I)?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(I,k,W=0){var H;W===1?(super.scrollLines(I,k,W),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(I)}paste(I){(0,h.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const k=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,k,W){this._selectionService.setSelection(I,k,W)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,k){var W;(W=this._selectionService)==null||W.selectLines(I,k)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const k=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!k&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const W=(0,$.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),W.type===3||W.type===2){const H=this.rows-1;return this.scrollLines(W.type===2?-H:H),this.cancel(I,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(W.cancel&&this.cancel(I,!0),!W.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==G.C0.ETX&&W.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,k){const W=I.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||I.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||I.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?W:W&&(!k.keyCode||k.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||(function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18}(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)k=I.charCode;else if(I.which===null||I.which===void 0)k=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;k=I.which}return!(!k||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const k=I.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(I),!0}return!1}resize(I,k){I!==this.cols||k!==this.rows?super.resize(I,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,k){var W,H;(W=this._charSizeService)==null||W.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var I;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 k=1;k<this.rows;k++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var k,W;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(k=this._selectionService)==null||k.reset(),this._decorationService.reset(),(W=this.viewport)==null||W.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const k=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${W};${k}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${Z};${H}t`)}}cancel(I,k){if(this.options.cancelEvents||k)return I.preventDefault(),I.stopPropagation(),!1}}t.Terminal=J},9924:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(o,h=1e3){this._renderCallback=o,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,h,f){this._rowCount=f,o=o!==void 0?o:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=c-this._lastRefreshMs,v=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,h)}}},1680:function(R,t,o){var h=this&&this.__decorate||function(n,r,s,d){var b,m=arguments.length,C=m<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(b=n[g])&&(C=(m<3?b(C):m>3?b(r,s,C):b(r,s))||C);return m>3&&C&&Object.defineProperty(r,s,C),C},f=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const c=o(3656),p=o(4725),v=o(8460),y=o(844),u=o(2585);let i=t.Viewport=class extends y.Disposable{constructor(n,r,s,d,b,m,C,g){super(),this._viewportElement=n,this._scrollArea=r,this._bufferService=s,this._optionsService=d,this._charSizeService=b,this._renderService=m,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 v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(g.colors),this.register(g.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)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 r=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==r&&(this._lastRecordedBufferHeight=r,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){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 r=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,r){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(r<0&&this._viewportElement.scrollTop!==0||r>0&&s<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const r=this._getPixelsScrolled(n);return r!==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+r:this._smoothScrollState.target+=r,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=r,this._bubbleScroll(n,r))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const r=n*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+r,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let r=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?r*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._currentRowHeight*this._bufferService.rows),r}getBufferElements(n,r){var g;let s,d="";const b=[],m=r??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let E=n;E<m;E++){const T=C.get(E);if(!T)continue;const B=(g=C.get(E+1))==null?void 0:g.isWrapped;if(d+=T.translateToString(!B),!B||E===C.length-1){const O=document.createElement("div");O.textContent=d,b.push(O),d.length>0&&(s=O),d=""}}return{bufferElements:b,cursorElement:s}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let r=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=this._currentRowHeight+0,this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(n,r){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&r.altKey||s==="ctrl"&&r.ctrlKey||s==="shift"&&r.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const r=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,r!==0&&(this._viewportElement.scrollTop+=r,this._bubbleScroll(n,r))}};t.Viewport=i=h([f(2,u.IBufferService),f(3,u.IOptionsService),f(4,p.ICharSizeService),f(5,p.IRenderService),f(6,p.ICoreBrowserService),f(7,p.IThemeService)],i)},3107:function(R,t,o){var h=this&&this.__decorate||function(u,i,n,r){var s,d=arguments.length,b=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,i,n,r);else for(var m=u.length-1;m>=0;m--)(s=u[m])&&(b=(d<3?s(b):d>3?s(i,n,b):s(i,n))||b);return d>3&&b&&Object.defineProperty(i,n,b),b},f=this&&this.__param||function(u,i){return function(n,r){i(n,r,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const c=o(4725),p=o(844),v=o(2585);let y=t.BufferDecorationRenderer=class extends p.Disposable{constructor(u,i,n,r,s){super(),this._screenElement=u,this._bufferService=i,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,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,p.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 u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){var r;const i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((r=u==null?void 0:u.options)==null?void 0:r.layer)==="top"),i.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=u.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(u,i),i}_refreshStyle(u){const i=u.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let n=this._decorationElements.get(u);n||(n=this._createElement(u),u.element=n,this._decorationElements.set(u,n),this._container.appendChild(n),u.onDispose(()=>{this._decorationElements.delete(u),n.remove()})),n.style.top=i*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(n)}}_refreshXPosition(u,i=u.element){if(!i)return;const n=u.options.x??0;(u.options.anchor||"left")==="right"?i.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){var i;(i=this._decorationElements.get(u))==null||i.remove(),this._decorationElements.delete(u),u.dispose()}};t.BufferDecorationRenderer=y=h([f(1,v.IBufferService),f(2,c.ICoreBrowserService),f(3,v.IDecorationService),f(4,c.IRenderService)],y)},5871:(R,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(o){if(o.options.overviewRulerOptions){for(const h of this._zones)if(h.color===o.options.overviewRulerOptions.color&&h.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,o.marker.line))return;if(this._lineAdjacentToZone(h,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(h,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,h){return h>=o.startBufferLine&&h<=o.endBufferLine}_lineAdjacentToZone(o,h,f){return h>=o.startBufferLine-this._linePadding[f||"full"]&&h<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,h){o.startBufferLine=Math.min(o.startBufferLine,h),o.endBufferLine=Math.max(o.endBufferLine,h)}}},5744:function(R,t,o){var h=this&&this.__decorate||function(s,d,b,m){var C,g=arguments.length,E=g<3?d:m===null?m=Object.getOwnPropertyDescriptor(d,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,b,m);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(E=(g<3?C(E):g>3?C(d,b,E):C(d,b))||E);return g>3&&E&&Object.defineProperty(d,b,E),E},f=this&&this.__param||function(s,d){return function(b,m){d(b,m,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const c=o(5871),p=o(4725),v=o(844),y=o(2585),u={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let r=t.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,b,m,C,g,E){var B;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=b,this._decorationService=m,this._renderService=C,this._optionsService=g,this._coreBrowserService=E,this._colorZoneStore=new c.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(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{var O;(O=this._canvas)==null||O.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 s=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=s,i.center=d,i.right=s,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=i.left,n.right=i.left+i.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);u.left=d,u.center=d,u.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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 s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(n[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-u[s.position||"full"]/2),i[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||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=r=h([f(2,y.IBufferService),f(3,y.IDecorationService),f(4,p.IRenderService),f(5,y.IOptionsService),f(6,p.ICoreBrowserService)],r)},2950:function(R,t,o){var h=this&&this.__decorate||function(u,i,n,r){var s,d=arguments.length,b=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,i,n,r);else for(var m=u.length-1;m>=0;m--)(s=u[m])&&(b=(d<3?s(b):d>3?s(i,n,b):s(i,n))||b);return d>3&&b&&Object.defineProperty(i,n,b),b},f=this&&this.__param||function(u,i){return function(n,r){i(n,r,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const c=o(4725),p=o(2585),v=o(2584);let y=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,i,n,r,s,d){this._textarea=u,this._compositionView=i,this._bufferService=n,this._optionsService=r,this._coreService=s,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(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){const i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){const u=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const i=this._textarea.value,n=i.replace(u,"");this._dataAlreadySent=n,i.length>u.length?this._coreService.triggerDataEvent(n,!0):i.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):i.length===u.length&&i!==u&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"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=s+"px",this._textarea.style.top=r+"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"}u||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=y=h([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,p.ICoreService),f(5,c.IRenderService)],y)},9806:(R,t)=>{function o(h,f,c){const p=c.getBoundingClientRect(),v=h.getComputedStyle(c),y=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-p.left-y,f.clientY-p.top-u]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=o,t.getCoords=function(h,f,c,p,v,y,u,i,n){if(!y)return;const r=o(h,f,c);return r?(r[0]=Math.ceil((r[0]+(n?u/2:0))/u),r[1]=Math.ceil(r[1]/i),r[0]=Math.min(Math.max(r[0],1),p+(n?1:0)),r[1]=Math.min(Math.max(r[1],1),v),r):void 0}},9504:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=o(2584);function f(i,n,r,s){const d=i-c(i,r),b=n-c(n,r),m=Math.abs(d-b)-function(C,g,E){let T=0;const B=C-c(C,E),O=g-c(g,E);for(let D=0;D<Math.abs(B-O);D++){const P=p(C,g)==="A"?-1:1,N=E.buffer.lines.get(B+P*D);N!=null&&N.isWrapped&&T++}return T}(i,n,r);return u(m,y(p(i,n),s))}function c(i,n){let r=0,s=n.buffer.lines.get(i),d=s==null?void 0:s.isWrapped;for(;d&&i>=0&&i<n.rows;)r++,s=n.buffer.lines.get(--i),d=s==null?void 0:s.isWrapped;return r}function p(i,n){return i>n?"A":"B"}function v(i,n,r,s,d,b){let m=i,C=n,g="";for(;m!==r||C!==s;)m+=d?1:-1,d&&m>b.cols-1?(g+=b.buffer.translateBufferLineToString(C,!1,i,m),m=0,i=0,C++):!d&&m<0&&(g+=b.buffer.translateBufferLineToString(C,!1,0,i+1),m=b.cols-1,i=m,C--);return g+b.buffer.translateBufferLineToString(C,!1,i,m)}function y(i,n){const r=n?"O":"[";return h.C0.ESC+r+i}function u(i,n){i=Math.floor(i);let r="";for(let s=0;s<i;s++)r+=n;return r}t.moveToCellSequence=function(i,n,r,s){const d=r.buffer.x,b=r.buffer.y;if(!r.buffer.hasScrollback)return function(g,E,T,B,O,D){return f(E,B,O,D).length===0?"":u(v(g,E,g,E-c(E,O),!1,O).length,y("D",D))}(d,b,0,n,r,s)+f(b,n,r,s)+function(g,E,T,B,O,D){let P;P=f(E,B,O,D).length>0?B-c(B,O):E;const N=B,U=function(G,$,x,L,A,M){let F;return F=f(x,L,A,M).length>0?L-c(L,A):$,G<x&&F<=L||G>=x&&F<L?"C":"D"}(g,E,T,B,O,D);return u(v(g,P,T,N,U==="C",O).length,y(U,D))}(d,b,i,n,r,s);let m;if(b===n)return m=d>i?"D":"C",u(Math.abs(d-i),y(m,s));m=b>n?"D":"C";const C=Math.abs(b-n);return u(function(g,E){return E.cols-g}(b>n?i:d,r)+(C-1)*r.cols+1+((b>n?d:i)-1),y(m,s))}},1296:function(R,t,o){var h=this&&this.__decorate||function(D,P,N,U){var G,$=arguments.length,x=$<3?P:U===null?U=Object.getOwnPropertyDescriptor(P,N):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(D,P,N,U);else for(var L=D.length-1;L>=0;L--)(G=D[L])&&(x=($<3?G(x):$>3?G(P,N,x):G(P,N))||x);return $>3&&x&&Object.defineProperty(P,N,x),x},f=this&&this.__param||function(D,P){return function(N,U){P(N,U,D)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const c=o(3787),p=o(2550),v=o(2223),y=o(6171),u=o(6052),i=o(4725),n=o(8055),r=o(8460),s=o(844),d=o(2585),b="xterm-dom-renderer-owner-",m="xterm-rows",C="xterm-fg-",g="xterm-bg-",E="xterm-focus",T="xterm-selection";let B=1,O=t.DomRenderer=class extends s.Disposable{constructor(D,P,N,U,G,$,x,L,A,M,F,z,J){super(),this._terminal=D,this._document=P,this._element=N,this._screenElement=U,this._viewportElement=G,this._helperContainer=$,this._linkifier2=x,this._charSizeService=A,this._optionsService=M,this._bufferService=F,this._coreBrowserService=z,this._themeService=J,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,u.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new r.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(m),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(ee=>this._injectCss(ee))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(ee=>this._handleLinkHover(ee))),this.register(this._linkifier2.onHideLinkUnderline(ee=>this._handleLinkLeave(ee))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new p.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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 N of this._rowElements)N.style.width=`${this.dimensions.css.canvas.width}px`,N.style.height=`${this.dimensions.css.cell.height}px`,N.style.lineHeight=`${this.dimensions.css.cell.height}px`,N.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const P=`${this._terminalSelector} .${m} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=P,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let P=`${this._terminalSelector} .${m} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;P+=`${this._terminalSelector} .${m} .xterm-dim { color: ${n.color.multiplyOpacity(D.foreground,.5).css};}`,P+=`${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 N=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;P+=`@keyframes ${N} { 50% { border-bottom-style: hidden; }}`,P+=`@keyframes ${U} { 50% { box-shadow: none; }}`,P+=`@keyframes ${G} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,P+=`${this._terminalSelector} .${m}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${m}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${m}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,P+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[$,x]of D.ansi.entries())P+=`${this._terminalSelector} .${C}${$} { color: ${x.css}; }${this._terminalSelector} .${C}${$}.xterm-dim { color: ${n.color.multiplyOpacity(x,.5).css}; }${this._terminalSelector} .${g}${$} { background-color: ${x.css}; }`;P+=`${this._terminalSelector} .${C}${v.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${g}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=P}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,P){for(let N=this._rowElements.length;N<=P;N++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>P;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,P){this._refreshRowElements(D,P),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,P,N){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,P,N),this.renderRows(0,this._bufferService.rows-1),!D||!P)return;this._selectionRenderModel.update(this._terminal,D,P,N);const U=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,x=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||x<0)return;const L=this._document.createDocumentFragment();if(N){const A=D[0]>P[0];L.appendChild(this._createSelectionElement($,A?P[0]:D[0],A?D[0]:P[0],x-$+1))}else{const A=U===$?D[0]:0,M=$===G?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement($,A,M));const F=x-$-1;if(L.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,F)),$!==x){const z=G===x?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(x,0,z))}}this._selectionContainer.appendChild(L)}_createSelectionElement(D,P,N,U=1){const G=this._document.createElement("div"),$=P*this.dimensions.css.cell.width;let x=this.dimensions.css.cell.width*(N-P);return $+x>this.dimensions.css.canvas.width&&(x=this.dimensions.css.canvas.width-$),G.style.height=U*this.dimensions.css.cell.height+"px",G.style.top=D*this.dimensions.css.cell.height+"px",G.style.left=`${$}px`,G.style.width=`${x}px`,G}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 D of this._rowElements)D.replaceChildren()}renderRows(D,P){const N=this._bufferService.buffer,U=N.ybase+N.y,G=Math.min(N.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,x=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let A=D;A<=P;A++){const M=A+N.ydisp,F=this._rowElements[A],z=N.lines.get(M);if(!F||!z)break;F.replaceChildren(...this._rowFactory.createRow(z,M,M===U,x,L,G,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,P,N,U,G,$){N<0&&(D=0),U<0&&(P=0);const x=this._bufferService.rows-1;N=Math.max(Math.min(N,x),0),U=Math.max(Math.min(U,x),0),G=Math.min(G,this._bufferService.cols);const L=this._bufferService.buffer,A=L.ybase+L.y,M=Math.min(L.x,G-1),F=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=N;ee<=U;++ee){const I=ee+L.ydisp,k=this._rowElements[ee],W=L.lines.get(I);if(!k||!W)break;k.replaceChildren(...this._rowFactory.createRow(W,I,I===A,z,J,M,F,this.dimensions.css.cell.width,this._widthCache,$?ee===N?D:0:-1,$?(ee===U?P:G)-1:-1))}}};t.DomRenderer=O=h([f(7,d.IInstantiationService),f(8,i.ICharSizeService),f(9,d.IOptionsService),f(10,d.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],O)},3787:function(R,t,o){var h=this&&this.__decorate||function(m,C,g,E){var T,B=arguments.length,O=B<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,g):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(m,C,g,E);else for(var D=m.length-1;D>=0;D--)(T=m[D])&&(O=(B<3?T(O):B>3?T(C,g,O):T(C,g))||O);return B>3&&O&&Object.defineProperty(C,g,O),O},f=this&&this.__param||function(m,C){return function(g,E){C(g,E,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const c=o(2223),p=o(643),v=o(511),y=o(2585),u=o(8055),i=o(4725),n=o(4269),r=o(6171),s=o(3734);let d=t.DomRendererRowFactory=class{constructor(m,C,g,E,T,B,O){this._document=m,this._characterJoinerService=C,this._optionsService=g,this._coreBrowserService=E,this._coreService=T,this._decorationService=B,this._themeService=O,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(m,C,g){this._selectionStart=m,this._selectionEnd=C,this._columnSelectMode=g}createRow(m,C,g,E,T,B,O,D,P,N,U){const G=[],$=this._characterJoinerService.getJoinedCharacters(C),x=this._themeService.colors;let L,A=m.getNoBgTrimmedLength();g&&A<B+1&&(A=B+1);let M=0,F="",z=0,J=0,ee=0,I=!1,k=0,W=!1,H=0;const Z=[],q=N!==-1&&U!==-1;for(let ie=0;ie<A;ie++){m.loadCell(ie,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let he=!1,ue=ie,te=this._workCell;if($.length>0&&ie===$[0][0]){he=!0;const oe=$.shift();te=new n.JoinedCellData(this._workCell,m.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),ue=oe[1]-1,ce=te.getWidth()}const ze=this._isCellInSelection(ie,C),kt=g&&ie===B,Rt=q&&ie>=N&&ie<=U;let Lt=!1;this._decorationService.forEachDecorationAtCell(ie,C,void 0,oe=>{Lt=!0});let ft=te.getChars()||p.WHITESPACE_CELL_CHAR;if(ft===" "&&(te.isUnderline()||te.isOverline())&&(ft=" "),H=ce*D-P.get(ft,te.isBold(),te.isItalic()),L){if(M&&(ze&&W||!ze&&!W&&te.bg===z)&&(ze&&W&&x.selectionForeground||te.fg===J)&&te.extended.ext===ee&&Rt===I&&H===k&&!kt&&!he&&!Lt){te.isInvisible()?F+=p.WHITESPACE_CELL_CHAR:F+=ft,M++;continue}M&&(L.textContent=F),L=this._document.createElement("span"),M=0,F=""}else L=this._document.createElement("span");if(z=te.bg,J=te.fg,ee=te.extended.ext,I=Rt,k=H,W=ze,he&&B>=ie&&B<=ue&&(B=ie),!this._coreService.isCursorHidden&&kt&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(te.isBold()&&Z.push("xterm-bold"),te.isItalic()&&Z.push("xterm-italic"),te.isDim()&&Z.push("xterm-dim"),F=te.isInvisible()?p.WHITESPACE_CELL_CHAR:te.getChars()||p.WHITESPACE_CELL_CHAR,te.isUnderline()&&(Z.push(`xterm-underline-${te.extended.underlineStyle}`),F===" "&&(F=" "),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let oe=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&oe<8&&(oe+=8),L.style.textDecorationColor=x.ansi[oe].css}te.isOverline()&&(Z.push("xterm-overline"),F===" "&&(F=" ")),te.isStrikethrough()&&Z.push("xterm-strikethrough"),Rt&&(L.style.textDecoration="underline");let _e=te.getFgColor(),qe=te.getFgColorMode(),be=te.getBgColor(),Ve=te.getBgColorMode();const Dt=!!te.isInverse();if(Dt){const oe=_e;_e=be,be=oe;const Cr=qe;qe=Ve,Ve=Cr}let ke,_t,Re,Ze=!1;switch(this._decorationService.forEachDecorationAtCell(ie,C,void 0,oe=>{oe.options.layer!=="top"&&Ze||(oe.backgroundColorRGB&&(Ve=50331648,be=oe.backgroundColorRGB.rgba>>8&16777215,ke=oe.backgroundColorRGB),oe.foregroundColorRGB&&(qe=50331648,_e=oe.foregroundColorRGB.rgba>>8&16777215,_t=oe.foregroundColorRGB),Ze=oe.options.layer==="top")}),!Ze&&ze&&(ke=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,be=ke.rgba>>8&16777215,Ve=50331648,Ze=!0,x.selectionForeground&&(qe=50331648,_e=x.selectionForeground.rgba>>8&16777215,_t=x.selectionForeground)),Ze&&Z.push("xterm-decoration-top"),Ve){case 16777216:case 33554432:Re=x.ansi[be],Z.push(`xterm-bg-${be}`);break;case 50331648:Re=u.channels.toColor(be>>16,be>>8&255,255&be),this._addStyle(L,`background-color:#${b((be>>>0).toString(16),"0",6)}`);break;default:Dt?(Re=x.foreground,Z.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):Re=x.background}switch(ke||te.isDim()&&(ke=u.color.multiplyOpacity(Re,.5)),qe){case 16777216:case 33554432:te.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(L,Re,x.ansi[_e],te,ke,void 0)||Z.push(`xterm-fg-${_e}`);break;case 50331648:const oe=u.channels.toColor(_e>>16&255,_e>>8&255,255&_e);this._applyMinimumContrast(L,Re,oe,te,ke,_t)||this._addStyle(L,`color:#${b(_e.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Re,x.foreground,te,ke,_t)||Dt&&Z.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}Z.length&&(L.className=Z.join(" "),Z.length=0),kt||he||Lt?L.textContent=F:M++,H!==this.defaultSpacing&&(L.style.letterSpacing=`${H}px`),G.push(L),ie=ue}return L&&M&&(L.textContent=F),G}_applyMinimumContrast(m,C,g,E,T,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,r.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const O=this._getContrastCache(E);let D;if(T||B||(D=O.getColor(C.rgba,g.rgba)),D===void 0){const P=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=u.color.ensureContrastRatio(T||C,B||g,P),O.setColor((T||C).rgba,(B||g).rgba,D??null)}return!!D&&(this._addStyle(m,`color:${D.css}`),!0)}_getContrastCache(m){return m.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(m,C){m.setAttribute("style",`${m.getAttribute("style")||""}${C};`)}_isCellInSelection(m,C){const g=this._selectionStart,E=this._selectionEnd;return!(!g||!E)&&(this._columnSelectMode?g[0]<=E[0]?m>=g[0]&&C>=g[1]&&m<E[0]&&C<=E[1]:m<g[0]&&C>=g[1]&&m>=E[0]&&C<=E[1]:C>g[1]&&C<E[1]||g[1]===E[1]&&C===g[1]&&m>=g[0]&&m<E[0]||g[1]<E[1]&&C===E[1]&&m<E[0]||g[1]<E[1]&&C===g[1]&&m>=g[0])}};function b(m,C,g){for(;m.length<g;)m=C+m;return m}t.DomRendererRowFactory=d=h([f(1,i.ICharacterJoinerService),f(2,y.IOptionsService),f(3,i.ICoreBrowserService),f(4,y.ICoreService),f(5,y.IDecorationService),f(6,i.IThemeService)],d)},2550:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(o,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=o.createElement("span");f.classList.add("xterm-char-measure-element");const c=o.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const p=o.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,c,p,v],this._container.appendChild(f),this._container.appendChild(c),this._container.appendChild(p),this._container.appendChild(v),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(o,h,f,c){o===this._font&&h===this._fontSize&&f===this._weight&&c===this._weightBold||(this._font=o,this._fontSize=h,this._weight=f,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(o,h,f){let c=0;if(!h&&!f&&o.length===1&&(c=o.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const y=this._measure(o,0);return y>0&&(this._flat[c]=y),y}let p=o;h&&(p+="B"),f&&(p+="I");let v=this._holey.get(p);if(v===void 0){let y=0;h&&(y|=1),f&&(y|=2),v=this._measure(o,y),v>0&&this._holey.set(p,v)}return v}_measure(o,h){const f=this._measureElements[h];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=o(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(R,t)=>{function o(f){return 57508<=f&&f<=57558}function h(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(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(f){if(!f)throw new Error("value must not be falsy");return f},t.isPowerlineGlyph=o,t.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},t.isEmoji=h,t.allowRescaling=function(f,c,p,v){return c===1&&p>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!h(f)&&!o(f)&&!function(y){return 57344<=y&&y<=63743}(f)},t.treatGlyphAsBackgroundColor=function(f){return o(f)||function(c){return 9472<=c&&c<=9631}(f)},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(f,c,p=0){return(f-(2*Math.round(c)-p))%(2*Math.round(c))}},6052:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class o{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,c,p,v=!1){if(this.selectionStart=c,this.selectionEnd=p,!c||!p||c[0]===p[0]&&c[1]===p[1])return void this.clear();const y=f.buffers.active.ydisp,u=c[1]-y,i=p[1]-y,n=Math.max(u,0),r=Math.min(i,f.rows-1);n>=f.rows||r<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=u,this.viewportEndRow=i,this.viewportCappedStartRow=n,this.viewportCappedEndRow=r,this.startCol=c[0],this.endCol=p[0])}isCellSelected(f,c,p){return!!this.hasSelection&&(p-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&p>=this.viewportCappedStartRow&&c<this.endCol&&p<=this.viewportCappedEndRow:c<this.startCol&&p>=this.viewportCappedStartRow&&c>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&c>=this.startCol)}}t.createSelectionRenderModel=function(){return new o}},456:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,h=this.selectionEnd;return!(!o||!h)&&(o[1]>h[1]||o[1]===h[1]&&o[0]>h[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(R,t,o){var h=this&&this.__decorate||function(r,s,d,b){var m,C=arguments.length,g=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,b);else for(var E=r.length-1;E>=0;E--)(m=r[E])&&(g=(C<3?m(g):C>3?m(s,d,g):m(s,d))||g);return C>3&&g&&Object.defineProperty(s,d,g),g},f=this&&this.__param||function(r,s){return function(d,b){s(d,b,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const c=o(2585),p=o(8460),v=o(844);let y=t.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(r,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new i(r,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const r=this._measureStrategy.measure();r.width===this.width&&r.height===this.height||(this.width=r.width,this.height=r.height,this._onCharSizeChange.fire())}};t.CharSizeService=y=h([f(2,c.IOptionsService)],y);class u extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class i extends u{constructor(s,d,b){super(),this._document=s,this._parentElement=d,this._optionsService=b,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 n extends u{constructor(s){super(),this._optionsService=s,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 s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(R,t,o){var h=this&&this.__decorate||function(n,r,s,d){var b,m=arguments.length,C=m<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(b=n[g])&&(C=(m<3?b(C):m>3?b(r,s,C):b(r,s))||C);return m>3&&C&&Object.defineProperty(r,s,C),C},f=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const c=o(3734),p=o(643),v=o(511),y=o(2585);class u extends c.AttributeData{constructor(r,s,d){super(),this.content=0,this.combinedData="",this.fg=r.fg,this.bg=r.bg,this.combinedData=s,this._width=d}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(r){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=u;let i=t.CharacterJoinerService=class lr{constructor(r){this._bufferService=r,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(r){const s={id:this._nextCharacterJoinerId++,handler:r};return this._characterJoiners.push(s),s.id}deregister(r){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===r)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(r){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(r);if(!s||s.length===0)return[];const d=[],b=s.translateToString(!0);let m=0,C=0,g=0,E=s.getFg(0),T=s.getBg(0);for(let B=0;B<s.getTrimmedLength();B++)if(s.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==T){if(B-m>1){const O=this._getJoinedRanges(b,g,C,s,m);for(let D=0;D<O.length;D++)d.push(O[D])}m=B,g=C,E=this._workCell.fg,T=this._workCell.bg}C+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-m>1){const B=this._getJoinedRanges(b,g,C,s,m);for(let O=0;O<B.length;O++)d.push(B[O])}return d}_getJoinedRanges(r,s,d,b,m){const C=r.substring(s,d);let g=[];try{g=this._characterJoiners[0].handler(C)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const T=this._characterJoiners[E].handler(C);for(let B=0;B<T.length;B++)lr._mergeRanges(g,T[B])}catch(T){console.error(T)}return this._stringRangesToCellRanges(g,b,m),g}_stringRangesToCellRanges(r,s,d){let b=0,m=!1,C=0,g=r[b];if(g){for(let E=d;E<this._bufferService.cols;E++){const T=s.getWidth(E),B=s.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!m&&g[0]<=C&&(g[0]=E,m=!0),g[1]<=C){if(g[1]=E,g=r[++b],!g)break;g[0]<=C?(g[0]=E,m=!0):m=!1}C+=B}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(r,s){let d=!1;for(let b=0;b<r.length;b++){const m=r[b];if(d){if(s[1]<=m[0])return r[b-1][1]=s[1],r;if(s[1]<=m[1])return r[b-1][1]=Math.max(s[1],m[1]),r.splice(b,1),r;r.splice(b,1),b--}else{if(s[1]<=m[0])return r.splice(b,0,s),r;if(s[1]<=m[1])return m[0]=Math.min(s[0],m[0]),r;s[0]<m[1]&&(m[0]=Math.min(s[0],m[0]),d=!0)}}return d?r[r.length-1][1]=s[1]:r.push(s),r}};t.CharacterJoinerService=i=h([f(0,y.IBufferService)],i)},5114:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=o(844),f=o(8460),c=o(3656);class p extends h.Disposable{constructor(u,i,n){super(),this._textarea=u,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(u){this._window!==u&&(this._window=u,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=p;class v extends h.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(u){this._parentWindow=u,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var u;this._outerListener&&((u=this._resolutionMediaMatchList)==null||u.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:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=o(844);class f extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const v=this.linkProviders.indexOf(p);v!==-1&&this.linkProviders.splice(v,1)}}}}t.LinkProviderService=f},8934:function(R,t,o){var h=this&&this.__decorate||function(y,u,i,n){var r,s=arguments.length,d=s<3?u:n===null?n=Object.getOwnPropertyDescriptor(u,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(y,u,i,n);else for(var b=y.length-1;b>=0;b--)(r=y[b])&&(d=(s<3?r(d):s>3?r(u,i,d):r(u,i))||d);return s>3&&d&&Object.defineProperty(u,i,d),d},f=this&&this.__param||function(y,u){return function(i,n){u(i,n,y)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const c=o(4725),p=o(9806);let v=t.MouseService=class{constructor(y,u){this._renderService=y,this._charSizeService=u}getCoords(y,u,i,n,r){return(0,p.getCoords)(window,y,u,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(y,u){const i=(0,p.getCoordsRelativeToElement)(window,y,u);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=v=h([f(0,c.IRenderService),f(1,c.ICharSizeService)],v)},3230:function(R,t,o){var h=this&&this.__decorate||function(r,s,d,b){var m,C=arguments.length,g=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,b);else for(var E=r.length-1;E>=0;E--)(m=r[E])&&(g=(C<3?m(g):C>3?m(s,d,g):m(s,d))||g);return C>3&&g&&Object.defineProperty(s,d,g),g},f=this&&this.__param||function(r,s){return function(d,b){s(d,b,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const c=o(6193),p=o(4725),v=o(8460),y=o(844),u=o(7226),i=o(2585);let n=t.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(r,s,d,b,m,C,g,E){super(),this._rowCount=r,this._charSizeService=b,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new y.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer((T,B)=>this._renderRows(T,B),g),this.register(this._renderDebouncer),this.register(g.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var T;return(T=this._renderer.value)==null?void 0:T.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(m.onDecorationRegistered(()=>this._fullRefresh())),this.register(m.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(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(g.window,s),this.register(g.onWindowChange(T=>this._registerIntersectionObserver(T,s)))}_registerIntersectionObserver(r,s){if("IntersectionObserver"in r){const d=new r.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,y.toDisposable)(()=>d.disconnect())}}_handleIntersectionChange(r){this._isPaused=r.isIntersecting===void 0?r.intersectionRatio===0:!r.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(r,s,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(r,s,this._rowCount))}_renderRows(r,s){this._renderer.value&&(r=Math.min(r,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(r,s),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:r,end:s}),this._onRender.fire({start:r,end:s}),this._isNextRenderRedrawOnly=!0)}resize(r,s){this._rowCount=s,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(r){this._renderer.value=r,this._renderer.value&&(this._renderer.value.onRequestRedraw(s=>this.refreshRows(s.start,s.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(r){return this._renderDebouncer.addRefreshCallback(r)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var r,s;this._renderer.value&&((s=(r=this._renderer.value).clearTextureAtlas)==null||s.call(r),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(r,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(r,s)}):this._renderer.value.handleResize(r,s),this._fullRefresh())}handleCharSizeChanged(){var r;(r=this._renderer.value)==null||r.handleCharSizeChanged()}handleBlur(){var r;(r=this._renderer.value)==null||r.handleBlur()}handleFocus(){var r;(r=this._renderer.value)==null||r.handleFocus()}handleSelectionChanged(r,s,d){var b;this._selectionState.start=r,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(b=this._renderer.value)==null||b.handleSelectionChanged(r,s,d)}handleCursorMove(){var r;(r=this._renderer.value)==null||r.handleCursorMove()}clear(){var r;(r=this._renderer.value)==null||r.clear()}};t.RenderService=n=h([f(2,i.IOptionsService),f(3,p.ICharSizeService),f(4,i.IDecorationService),f(5,i.IBufferService),f(6,p.ICoreBrowserService),f(7,p.IThemeService)],n)},9312:function(R,t,o){var h=this&&this.__decorate||function(g,E,T,B){var O,D=arguments.length,P=D<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(g,E,T,B);else for(var N=g.length-1;N>=0;N--)(O=g[N])&&(P=(D<3?O(P):D>3?O(E,T,P):O(E,T))||P);return D>3&&P&&Object.defineProperty(E,T,P),P},f=this&&this.__param||function(g,E){return function(T,B){E(T,B,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const c=o(9806),p=o(9504),v=o(456),y=o(4725),u=o(8460),i=o(844),n=o(6114),r=o(4841),s=o(511),d=o(2585),b=" ",m=new RegExp(b,"g");let C=t.SelectionService=class extends i.Disposable{constructor(g,E,T,B,O,D,P,N,U){super(),this._element=g,this._screenElement=E,this._linkifier=T,this._bufferService=B,this._coreService=O,this._mouseService=D,this._optionsService=P,this._renderService=N,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(G=>this._handleTrim(G)),this.register(this._bufferService.buffers.onBufferActivate(G=>this._handleBufferActivate(G))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!g||!E||g[0]===E[0]&&g[1]===E[1])}get selectionText(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!g||!E)return"";const T=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(g[0]===E[0])return"";const O=g[0]<E[0]?g[0]:E[0],D=g[0]<E[0]?E[0]:g[0];for(let P=g[1];P<=E[1];P++){const N=T.translateBufferLineToString(P,!0,O,D);B.push(N)}}else{const O=g[1]===E[1]?E[0]:void 0;B.push(T.translateBufferLineToString(g[1],!0,g[0],O));for(let D=g[1]+1;D<=E[1]-1;D++){const P=T.lines.get(D),N=T.translateBufferLineToString(D,!0);P!=null&&P.isWrapped?B[B.length-1]+=N:B.push(N)}if(g[1]!==E[1]){const D=T.lines.get(E[1]),P=T.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?B[B.length-1]+=P:B.push(P)}}return B.map(O=>O.replace(m," ")).join(n.isWindows?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(p){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.isLinux&&p&&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(p){const E=this._getMouseBufferCoords(p),T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(T&&B&&E)&&this._areCoordsInSelection(E,T,B)}isCellInSelection(p,E){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!T||!B)&&this._areCoordsInSelection([p,E],T,B)}_areCoordsInSelection(p,E,T){return p[1]>E[1]&&p[1]<T[1]||E[1]===T[1]&&p[1]===E[1]&&p[0]>=E[0]&&p[0]<T[0]||E[1]<T[1]&&p[1]===T[1]&&p[0]<T[0]||E[1]<T[1]&&p[1]===E[1]&&p[0]>=E[0]}_selectWordAtCursor(p,E){var O,D;const T=(D=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:D.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(p);return!!B&&(this._selectWordAt(B,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(p,E){this._model.clearSelection(),p=Math.max(p,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,p],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(p){this._model.handleTrim(p)&&this.refresh()}_getMouseBufferCoords(p){const E=this._mouseService.getCoords(p,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(p){let E=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,p,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=T?0:(E>T&&(E-=T),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(p){return n.isMac?p.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:p.shiftKey}handleMouseDown(p){if(this._mouseDownTimeStamp=p.timeStamp,(p.button!==2||!this.hasSelection)&&p.button===0){if(!this._enabled){if(!this.shouldForceSelection(p))return;p.stopPropagation()}p.preventDefault(),this._dragScrollAmount=0,this._enabled&&p.shiftKey?this._handleIncrementalClick(p):p.detail===1?this._handleSingleClick(p):p.detail===2?this._handleDoubleClick(p):p.detail===3&&this._handleTripleClick(p),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(p){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(p))}_handleSingleClick(p){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(p)?3:0,this._model.selectionStart=this._getMouseBufferCoords(p),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(p){this._selectWordAtCursor(p,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(p){const E=this._getMouseBufferCoords(p);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(p){return p.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(p){if(p.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(p),!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(p),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const B=T.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const p=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(p.ydisp+this._bufferService.rows,p.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=p.ydisp),this.refresh()}}_handleMouseUp(p){const E=p.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&p.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(p,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const B=(0,_.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const p=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,T=!(!p||!E||p[0]===E[0]&&p[1]===E[1]);T?p&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&p[0]===this._oldSelectionStart[0]&&p[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(p,E,T)):this._oldHasSelection&&this._fireOnSelectionChange(p,E,T)}_fireOnSelectionChange(p,E,T){this._oldSelectionStart=p,this._oldSelectionEnd=E,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(p){this.clearSelection(),this._trimListener.dispose(),this._trimListener=p.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(p,E){let T=E;for(let B=0;E>=B;B++){const O=p.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&E!==B&&(T+=O-1)}return T}setSelection(p,E,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[p,E],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(p){this._isClickInSelection(p)||(this._selectWordAtCursor(p,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(p,E,T=!0,B=!0){if(p[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,D=O.lines.get(p[1]);if(!D)return;const P=O.translateBufferLineToString(p[1],!1);let N=this._convertViewportColToCharacterIndex(D,p[0]),U=N;const G=p[0]-N;let $=0,x=0,L=0,A=0;if(P.charAt(N)===" "){for(;N>0&&P.charAt(N-1)===" ";)N--;for(;U<P.length&&P.charAt(U+1)===" ";)U++}else{let z=p[0],J=p[0];D.getWidth(z)===0&&($++,z--),D.getWidth(J)===2&&(x++,J++);const ee=D.getString(J).length;for(ee>1&&(A+=ee-1,U+=ee-1);z>0&&N>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,z--):I>1&&(L+=I-1,N-=I-1),N--,z--}for(;J<D.length&&U+1<P.length&&!this._isCharWordSeparator(D.loadCell(J+1,this._workCell));){D.loadCell(J+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,J++):I>1&&(A+=I-1,U+=I-1),U++,J++}}U++;let M=N+G-$+L,F=Math.min(this._bufferService.cols,U-N+$+x-L-A);if(E||P.slice(N,U).trim()!==""){if(T&&M===0&&D.getCodePoint(0)!==32){const z=O.lines.get(p[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,p[1]-1],!1,!0,!1);if(J){const ee=this._bufferService.cols-J.start;M-=ee,F+=ee}}}if(B&&M+F===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const z=O.lines.get(p[1]+1);if(z!=null&&z.isWrapped&&z.getCodePoint(0)!==32){const J=this._getWordAt([0,p[1]+1],!1,!1,!0);J&&(F+=J.length)}}return{start:M,length:F}}}_selectWordAt(p,E){const T=this._getWordAt(p,E);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,p[1]--;this._model.selectionStart=[T.start,p[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(p){const E=this._getWordAt(p,!0);if(E){let T=p[1];for(;E.start<0;)E.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,T]}}_isCharWordSeparator(p){return p.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(p.getChars())>=0}_selectLineAt(p){const E=this._bufferService.buffer.getWrappedRangeForLine(p),T={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,t.getRangeLength)(T,this._bufferService.cols)}};r.SelectionService=C=h([g(3,d.IBufferService),g(4,d.ICoreService),g(5,y.IMouseService),g(6,d.IOptionsService),g(7,y.IRenderService),g(8,y.ICoreBrowserService)],C)},4725:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const h=o(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService"),r.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(k,r,o){var h=this&&this.__decorate||function(C,p,E,T){var B,O=arguments.length,D=O<3?p:T===null?T=Object.getOwnPropertyDescriptor(p,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,p,E,T);else for(var P=C.length-1;P>=0;P--)(B=C[P])&&(D=(O<3?B(D):O>3?B(p,E,D):B(p,E))||D);return O>3&&D&&Object.defineProperty(p,E,D),D},g=this&&this.__param||function(C,p){return function(E,T){p(E,T,C)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const c=o(7239),_=o(8055),v=o(8460),y=o(844),u=o(2585),i=_.css.toColor("#ffffff"),n=_.css.toColor("#000000"),t=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],p=[0,95,135,175,215,255];for(let E=0;E<216;E++){const T=p[E/36%6|0],B=p[E/6%6|0],O=p[E%6];C.push({css:_.channels.toCss(T,B,O),rgba:_.channels.toRgba(T,B,O)})}for(let E=0;E<24;E++){const T=8+10*E;C.push({css:_.channels.toCss(T,T,T),rgba:_.channels.toRgba(T,T,T)})}return C})());let b=r.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:n,cursor:t,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:_.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:_.color.blend(n,d),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(C={}){const p=this._colors;if(p.foreground=m(C.foreground,i),p.background=m(C.background,n),p.cursor=m(C.cursor,t),p.cursorAccent=m(C.cursorAccent,s),p.selectionBackgroundTransparent=m(C.selectionBackground,d),p.selectionBackgroundOpaque=_.color.blend(p.background,p.selectionBackgroundTransparent),p.selectionInactiveBackgroundTransparent=m(C.selectionInactiveBackground,p.selectionBackgroundTransparent),p.selectionInactiveBackgroundOpaque=_.color.blend(p.background,p.selectionInactiveBackgroundTransparent),p.selectionForeground=C.selectionForeground?m(C.selectionForeground,_.NULL_COLOR):void 0,p.selectionForeground===_.NULL_COLOR&&(p.selectionForeground=void 0),_.color.isOpaque(p.selectionBackgroundTransparent)&&(p.selectionBackgroundTransparent=_.color.opacity(p.selectionBackgroundTransparent,.3)),_.color.isOpaque(p.selectionInactiveBackgroundTransparent)&&(p.selectionInactiveBackgroundTransparent=_.color.opacity(p.selectionInactiveBackgroundTransparent,.3)),p.ansi=r.DEFAULT_ANSI_COLORS.slice(),p.ansi[0]=m(C.black,r.DEFAULT_ANSI_COLORS[0]),p.ansi[1]=m(C.red,r.DEFAULT_ANSI_COLORS[1]),p.ansi[2]=m(C.green,r.DEFAULT_ANSI_COLORS[2]),p.ansi[3]=m(C.yellow,r.DEFAULT_ANSI_COLORS[3]),p.ansi[4]=m(C.blue,r.DEFAULT_ANSI_COLORS[4]),p.ansi[5]=m(C.magenta,r.DEFAULT_ANSI_COLORS[5]),p.ansi[6]=m(C.cyan,r.DEFAULT_ANSI_COLORS[6]),p.ansi[7]=m(C.white,r.DEFAULT_ANSI_COLORS[7]),p.ansi[8]=m(C.brightBlack,r.DEFAULT_ANSI_COLORS[8]),p.ansi[9]=m(C.brightRed,r.DEFAULT_ANSI_COLORS[9]),p.ansi[10]=m(C.brightGreen,r.DEFAULT_ANSI_COLORS[10]),p.ansi[11]=m(C.brightYellow,r.DEFAULT_ANSI_COLORS[11]),p.ansi[12]=m(C.brightBlue,r.DEFAULT_ANSI_COLORS[12]),p.ansi[13]=m(C.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),p.ansi[14]=m(C.brightCyan,r.DEFAULT_ANSI_COLORS[14]),p.ansi[15]=m(C.brightWhite,r.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(p.ansi.length-16,C.extendedAnsi.length);for(let T=0;T<E;T++)p.ansi[T+16]=m(C.extendedAnsi[T],r.DEFAULT_ANSI_COLORS[T+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 p=0;p<this._restoreColors.ansi.length;++p)this._colors.ansi[p]=this._restoreColors.ansi[p]}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 m(C,p){if(C!==void 0)try{return _.css.toColor(C)}catch{}return p}r.ThemeService=b=h([g(0,u.IOptionsService)],b)},6349:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const h=o(8460),g=o(844);class c extends g.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;const y=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)y[u]=this._array[this._getCyclicIndex(u)];this._array=y,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let y=this._length;y<v;y++)this._array[y]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,y){this._array[this._getCyclicIndex(v)]=y}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,y,...u){if(y){for(let i=v;i<this._length-y;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+y)];this._length-=y,this.onDeleteEmitter.fire({index:v,amount:y})}for(let i=this._length-1;i>=v;i--)this._array[this._getCyclicIndex(i+u.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<u.length;i++)this._array[this._getCyclicIndex(v+i)]=u[i];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){const i=this._length+u.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,y,u){if(!(y<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let n=y-1;n>=0;n--)this.set(v+n+u,this.get(v+n));const i=v+y+u-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<y;i++)this.set(v+i+u,this.get(v+i))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=c},1439:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(h,g=5){if(typeof h!="object")return h;const c=Array.isArray(h)?[]:{};for(const _ in h)c[_]=g<=1?h[_]:h[_]&&o(h[_],g-1);return c}},8055:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let o=0,h=0,g=0,c=0;var _,v,y,u,i;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function t(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,b,m,C){return C!==void 0?`#${n(d)}${n(b)}${n(m)}${n(C)}`:`#${n(d)}${n(b)}${n(m)}`},s.toRgba=function(d,b,m,C=255){return(d<<24|b<<16|m<<8|C)>>>0},s.toColor=function(d,b,m,C){return{css:s.toCss(d,b,m,C),rgba:s.toRgba(d,b,m,C)}}}(_||(r.channels=_={})),function(s){function d(b,m){return c=Math.round(255*m),[o,h,g]=i.toChannels(b.rgba),{css:_.toCss(o,h,g,c),rgba:_.toRgba(o,h,g,c)}}s.blend=function(b,m){if(c=(255&m.rgba)/255,c===1)return{css:m.css,rgba:m.rgba};const C=m.rgba>>24&255,p=m.rgba>>16&255,E=m.rgba>>8&255,T=b.rgba>>24&255,B=b.rgba>>16&255,O=b.rgba>>8&255;return o=T+Math.round((C-T)*c),h=B+Math.round((p-B)*c),g=O+Math.round((E-O)*c),{css:_.toCss(o,h,g),rgba:_.toRgba(o,h,g)}},s.isOpaque=function(b){return(255&b.rgba)==255},s.ensureContrastRatio=function(b,m,C){const p=i.ensureContrastRatio(b.rgba,m.rgba,C);if(p)return _.toColor(p>>24&255,p>>16&255,p>>8&255)},s.opaque=function(b){const m=(255|b.rgba)>>>0;return[o,h,g]=i.toChannels(m),{css:_.toCss(o,h,g),rgba:m}},s.opacity=d,s.multiplyOpacity=function(b,m){return c=255&b.rgba,d(b,c*m/255)},s.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(v||(r.color=v={})),function(s){let d,b;try{const m=document.createElement("canvas");m.width=1,m.height=1;const C=m.getContext("2d",{willReadFrequently:!0});C&&(d=C,d.globalCompositeOperation="copy",b=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(m){if(m.match(/#[\da-f]{3,8}/i))switch(m.length){case 4:return o=parseInt(m.slice(1,2).repeat(2),16),h=parseInt(m.slice(2,3).repeat(2),16),g=parseInt(m.slice(3,4).repeat(2),16),_.toColor(o,h,g);case 5:return o=parseInt(m.slice(1,2).repeat(2),16),h=parseInt(m.slice(2,3).repeat(2),16),g=parseInt(m.slice(3,4).repeat(2),16),c=parseInt(m.slice(4,5).repeat(2),16),_.toColor(o,h,g,c);case 7:return{css:m,rgba:(parseInt(m.slice(1),16)<<8|255)>>>0};case 9:return{css:m,rgba:parseInt(m.slice(1),16)>>>0}}const C=m.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 o=parseInt(C[1]),h=parseInt(C[2]),g=parseInt(C[3]),c=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),_.toColor(o,h,g,c);if(!d||!b)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=b,d.fillStyle=m,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,h,g,c]=d.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(o,h,g,c),css:m}}}(y||(r.css=y={})),function(s){function d(b,m,C){const p=b/255,E=m/255,T=C/255;return .2126*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}s.relativeLuminance=function(b){return d(b>>16&255,b>>8&255,255&b)},s.relativeLuminance2=d}(u||(r.rgb=u={})),function(s){function d(m,C,p){const E=m>>24&255,T=m>>16&255,B=m>>8&255;let O=C>>24&255,D=C>>16&255,P=C>>8&255,N=t(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));for(;N<p&&(O>0||D>0||P>0);)O-=Math.max(0,Math.ceil(.1*O)),D-=Math.max(0,Math.ceil(.1*D)),P-=Math.max(0,Math.ceil(.1*P)),N=t(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}function b(m,C,p){const E=m>>24&255,T=m>>16&255,B=m>>8&255;let O=C>>24&255,D=C>>16&255,P=C>>8&255,N=t(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));for(;N<p&&(O<255||D<255||P<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),D=Math.min(255,D+Math.ceil(.1*(255-D))),P=Math.min(255,P+Math.ceil(.1*(255-P))),N=t(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}s.blend=function(m,C){if(c=(255&C)/255,c===1)return C;const p=C>>24&255,E=C>>16&255,T=C>>8&255,B=m>>24&255,O=m>>16&255,D=m>>8&255;return o=B+Math.round((p-B)*c),h=O+Math.round((E-O)*c),g=D+Math.round((T-D)*c),_.toRgba(o,h,g)},s.ensureContrastRatio=function(m,C,p){const E=u.relativeLuminance(m>>8),T=u.relativeLuminance(C>>8);if(t(E,T)<p){if(T<E){const D=d(m,C,p),P=t(E,u.relativeLuminance(D>>8));if(P<p){const N=b(m,C,p);return P>t(E,u.relativeLuminance(N>>8))?D:N}return D}const B=b(m,C,p),O=t(E,u.relativeLuminance(B>>8));if(O<p){const D=d(m,C,p);return O>t(E,u.relativeLuminance(D>>8))?B:D}return B}},s.reduceLuminance=d,s.increaseLuminance=b,s.toChannels=function(m){return[m>>24&255,m>>16&255,m>>8&255,255&m]}}(i||(r.rgba=i={})),r.toPaddedHex=n,r.contrastRatio=t},8969:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const h=o(844),g=o(2585),c=o(4348),_=o(7866),v=o(744),y=o(7302),u=o(6975),i=o(8460),n=o(1753),t=o(1480),s=o(7994),d=o(9282),b=o(5435),m=o(5981),C=o(2660);let p=!1;class E extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(B=>{var O;(O=this._onScrollApi)==null||O.fire(B.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(B){for(const O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new y.OptionsService(B)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(t.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.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(O=>{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(O=>{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 m.WriteBuffer((O,D)=>this._inputHandler.parse(O,D))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=g.LogLevelEnum.WARN&&!p&&(this._logService.warn("writeSync is unreliable and will be removed soon."),p=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,v.MINIMUM_COLS),O=Math.max(O,v.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,D){this._bufferService.scrollLines(B,O,D)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const O of B)O.dispose()})}}}r.CoreTerminal=E},8460:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===o)return void this._listeners.splice(h,1)}}})),this._event}fire(o,h){const g=[];for(let c=0;c<this._listeners.length;c++)g.push(this._listeners[c]);for(let c=0;c<g.length;c++)g[c].call(void 0,o,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(o,h){return o(g=>h.fire(g))},r.runAndSubscribe=function(o,h){return h(void 0),o(g=>h(g))}},5435:function(k,r,o){var h=this&&this.__decorate||function($,x,L,A){var M,F=arguments.length,z=F<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate($,x,L,A);else for(var J=$.length-1;J>=0;J--)(M=$[J])&&(z=(F<3?M(z):F>3?M(x,L,z):M(x,L))||z);return F>3&&z&&Object.defineProperty(x,L,z),z},g=this&&this.__param||function($,x){return function(L,A){x(L,A,$)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const c=o(2584),_=o(7116),v=o(2015),y=o(844),u=o(482),i=o(8437),n=o(8460),t=o(643),s=o(511),d=o(3734),b=o(2585),m=o(1480),C=o(6242),p=o(6351),E=o(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O($,x){if($>24)return x.setWinLines||!1;switch($){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var D;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(r.WindowsOptionsReportType=D={}));let P=0;class N extends y.Disposable{getAttrData(){return this._curAttrData}constructor(x,L,A,M,F,z,J,ee,I=new v.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=L,this._coreService=A,this._logService=M,this._optionsService=F,this._oscLinkService=z,this._coreMouseService=J,this._unicodeService=ee,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:W.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,W,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:W,data:H})}),this._parser.setDcsHandlerFallback((R,W,H)=>{W==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:W,payload:H})}),this._parser.setPrintHandler((R,W,H)=>this.print(R,W,H)),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(c.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(c.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(c.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(c.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(c.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(c.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(c.C1.IND,()=>this.index()),this._parser.setExecuteHandler(c.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(c.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 _.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 p.DcsHandler((R,W)=>this.requestStatusString(R,W)))}_preserveStack(x,L,A,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=A,this._parseStack.position=M}_logSlowResolvingAsync(x){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([x,new Promise((L,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,L){let A,M=this._activeBuffer.x,F=this._activeBuffer.y,z=0;const J=this._parseStack.paused;if(J){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(A),A;M=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>B&&(z=this._parseStack.position+B)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,R=>String.fromCharCode(R)).join("")}"`),typeof x=="string"?x.split("").map(R=>R.charCodeAt(0)):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(x.length,B))),J||this._dirtyRowTracker.clearRange(),x.length>B)for(let R=z;R<x.length;R+=B){const W=R+B<x.length?R+B:x.length,H=typeof x=="string"?this._stringDecoder.decode(x.substring(R,W),this._parseBuffer):this._utf8Decoder.decode(x.subarray(R,W),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,F,H,R),this._logSlowResolvingAsync(A),A}else if(!J){const R=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,R))return this._preserveStack(M,F,R,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===M&&this._activeBuffer.y===F||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(x,L,A){let M,F;const z=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,W=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-L>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let Z=this._parser.precedingJoinState;for(let q=L;q<A;++q){if(M=x[q],M<127&&z){const ue=z[String.fromCharCode(M)];ue&&(M=ue.charCodeAt(0))}const ie=this._unicodeService.charProperties(M,Z);F=m.UnicodeService.extractWidth(ie);const ce=m.UnicodeService.extractShouldJoin(ie),he=ce?m.UnicodeService.extractWidth(Z):0;if(Z=ie,J&&this._onA11yChar.fire((0,u.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-he>ee){if(I){const ue=H;let te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&H instanceof i.BufferLine&&H.copyCellsFrom(ue,te,0,he,!1);te<ee;)ue.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=ee-1,F===2)continue}if(ce&&this._activeBuffer.x){const ue=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ue,M,F);for(let te=F-he;--te>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(R&&(H.insertCells(this._activeBuffer.x,F-he,this._activeBuffer.getNullCell(W)),H.getWidth(ee-1)===2&&H.setCellFromCodepoint(ee-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,W)),H.setCellFromCodepoint(this._activeBuffer.x++,M,F,W),F>0)for(;--F;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=Z,this._activeBuffer.x<ee&&A-L>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,L){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,L):this._parser.registerCsiHandler(x,A=>!O(A.params[0],this._optionsService.rawOptions.windowOptions)||L(A))}registerDcsHandler(x,L){return this._parser.registerDcsHandler(x,new p.DcsHandler(L))}registerEscHandler(x,L){return this._parser.registerEscHandler(x,L)}registerOscHandler(x,L){return this._parser.registerOscHandler(x,new C.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var x;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&&((x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&x.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const x=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-x),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(x=this._bufferService.cols-1){this._activeBuffer.x=Math.min(x,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(x,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=x,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+L)}cursorUp(x){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,x.params[0]||1)):this._moveCursor(0,x.params[0]||1),!0}cursorForward(x){return this._moveCursor(x.params[0]||1,0),!0}cursorBackward(x){return this._moveCursor(-(x.params[0]||1),0),!0}cursorNextLine(x){return this.cursorDown(x),this._activeBuffer.x=0,!0}cursorPrecedingLine(x){return this.cursorUp(x),this._activeBuffer.x=0,!0}cursorCharAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(x){return this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1),!0}charPosAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(x){return this._moveCursor(x.params[0]||1,0),!0}linePosAbsolute(x){return this._setCursor(this._activeBuffer.x,(x.params[0]||1)-1),!0}vPositionRelative(x){return this._moveCursor(0,x.params[0]||1),!0}hVPosition(x){return this.cursorPosition(x),!0}tabClear(x){const L=x.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const L=x.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,L,A,M=!1,F=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);z.replaceCells(L,A,this._activeBuffer.getNullCell(this._eraseAttrData()),F),M&&(z.isWrapped=!1)}_resetBufferLine(x,L=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),A.isWrapped=!1)}eraseInDisplay(x,L=!1){let A;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);A<this._bufferService.rows;A++)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(x,L=!1){switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;L--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let L=x.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(x){let L=x.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(x.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(x){const L=this._parser.precedingJoinState;if(!L)return!0;const A=x.params[0]||1,M=m.UnicodeService.extractWidth(L),F=this._activeBuffer.x-M,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),J=new Uint32Array(z.length*A);let ee=0;for(let R=0;R<z.length;){const W=z.codePointAt(R)||0;J[ee++]=W,R+=W>65535?2:1}let I=ee;for(let R=1;R<A;++R)J.copyWithin(I,0,ee),I+=ee;return this.print(J,0,I),!0}sendDeviceAttributesPrimary(x){return x.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(x){return x.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),x.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(x,L){const A=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:F}=this._coreMouseService,z=this._coreService,{buffers:J,cols:ee}=this._bufferService,{active:I,alt:R}=J,W=this._optionsService.rawOptions,H=ce=>ce?1:2,Z=x.params[0];return q=Z,ie=L?Z===2?4:Z===4?H(z.modes.insertMode):Z===12?3:Z===20?H(W.convertEol):0:Z===1?H(A.applicationCursorKeys):Z===3?W.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:Z===6?H(A.origin):Z===7?H(A.wraparound):Z===8?3:Z===9?H(M==="X10"):Z===12?H(W.cursorBlink):Z===25?H(!z.isCursorHidden):Z===45?H(A.reverseWraparound):Z===66?H(A.applicationKeypad):Z===67?4:Z===1e3?H(M==="VT200"):Z===1002?H(M==="DRAG"):Z===1003?H(M==="ANY"):Z===1004?H(A.sendFocus):Z===1005?4:Z===1006?H(F==="SGR"):Z===1015?4:Z===1016?H(F==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?H(I===R):Z===2004?H(A.bracketedPasteMode):0,z.triggerDataEvent(`${c.C0.ESC}[${L?"":"?"}${q};${ie}$y`),!0;var q,ie}_updateAttrColor(x,L,A,M,F){return L===2?(x|=50331648,x&=-16777216,x|=d.AttributeData.fromColorRGB([A,M,F])):L===5&&(x&=-50331904,x|=33554432|255&A),x}_extractColor(x,L,A){const M=[0,0,-1,0,0,0];let F=0,z=0;do{if(M[z+F]=x.params[L+z],x.hasSubParams(L+z)){const J=x.getSubParams(L+z);let ee=0;do M[1]===5&&(F=1),M[z+ee+1+F]=J[ee];while(++ee<J.length&&ee+z+1+F<M.length);break}if(M[1]===5&&z+F>=2||M[1]===2&&z+F>=5)break;M[1]&&(F=1)}while(++z+L<x.length&&z+F<M.length);for(let J=2;J<M.length;++J)M[J]===-1&&(M[J]=0);switch(M[0]){case 38:A.fg=this._updateAttrColor(A.fg,M[1],M[3],M[4],M[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,M[1],M[3],M[4],M[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,M[1],M[3],M[4],M[5])}return z}_processUnderline(x,L){L.extended=L.extended.clone(),(!~x||x>5)&&(x=1),L.extended.underlineStyle=x,L.fg|=268435456,x===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(x){x.fg=i.DEFAULT_ATTR_DATA.fg,x.bg=i.DEFAULT_ATTR_DATA.bg,x.extended=x.extended.clone(),x.extended.underlineStyle=0,x.extended.underlineColor&=-67108864,x.updateExtended()}charAttributes(x){if(x.length===1&&x.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=x.length;let A;const M=this._curAttrData;for(let F=0;F<L;F++)A=x.params[F],A>=30&&A<=37?(M.fg&=-50331904,M.fg|=16777216|A-30):A>=40&&A<=47?(M.bg&=-50331904,M.bg|=16777216|A-40):A>=90&&A<=97?(M.fg&=-50331904,M.fg|=16777224|A-90):A>=100&&A<=107?(M.bg&=-50331904,M.bg|=16777224|A-100):A===0?this._processSGR0(M):A===1?M.fg|=134217728:A===3?M.bg|=67108864:A===4?(M.fg|=268435456,this._processUnderline(x.hasSubParams(F)?x.getSubParams(F)[0]:1,M)):A===5?M.fg|=536870912:A===7?M.fg|=67108864:A===8?M.fg|=1073741824:A===9?M.fg|=2147483648:A===2?M.bg|=134217728:A===21?this._processUnderline(2,M):A===22?(M.fg&=-134217729,M.bg&=-134217729):A===23?M.bg&=-67108865:A===24?(M.fg&=-268435457,this._processUnderline(0,M)):A===25?M.fg&=-536870913:A===27?M.fg&=-67108865:A===28?M.fg&=-1073741825:A===29?M.fg&=2147483647:A===39?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):A===49?(M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?F+=this._extractColor(x,F,M):A===53?M.bg|=1073741824:A===55?M.bg&=-1073741825:A===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):A===100?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${L};${A}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${L};${A}R`)}return!0}softReset(x){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.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(x){const L=x.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const A=L%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(x){const L=x.params[0]||1;let A;return(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(x){if(!O(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(x){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(x){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(x){return this._windowTitle=x,this._onTitleChange.fire(x),!0}setIconName(x){return this._iconName=x,!0}setOrReportIndexedColor(x){const L=[],A=x.split(";");for(;A.length>1;){const M=A.shift(),F=A.shift();if(/^\d+$/.exec(M)){const z=parseInt(M);if(G(z))if(F==="?")L.push({type:0,index:z});else{const J=(0,E.parseColor)(F);J&&L.push({type:1,index:z,color:J})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(x){const L=x.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(x,L){this._getCurrentLinkId()&&this._finishHyperlink();const A=x.split(":");let M;const F=A.findIndex(z=>z.startsWith("id="));return F!==-1&&(M=A[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,L){const A=x.split(";");for(let M=0;M<A.length&&!(L>=this._specialColors.length);++M,++L)if(A[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const F=(0,E.parseColor)(A[M]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}return!0}setOrReportFgColor(x){return this._setOrReportSpecialColor(x,0)}setOrReportBgColor(x){return this._setOrReportSpecialColor(x,1)}setOrReportCursorColor(x){return this._setOrReportSpecialColor(x,2)}restoreIndexedColor(x){if(!x)return this._onColor.fire([{type:2}]),!0;const L=[],A=x.split(";");for(let M=0;M<A.length;++M)if(/^\d+$/.exec(A[M])){const F=parseInt(A[M]);G(F)&&L.push({type:2,index:F})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(x){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(x){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(x){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),!0}selectCharset(x){return x.length!==2?(this.selectDefaultCharset(),!0):(x[0]==="/"||this._charsetService.setgCharset(T[x[0]],_.CHARSETS[x[1]]||_.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const x=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,x,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(x){return this._charsetService.setgLevel(x),!0}screenAlignmentPattern(){const x=new s.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const A=this._activeBuffer.ybase+this._activeBuffer.y+L,M=this._activeBuffer.lines.get(A);M&&(M.fill(x),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,L){const A=this._bufferService.buffer,M=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${F}${c.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,L){this._dirtyRowTracker.markRangeDirty(x,L)}}r.InputHandler=N;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,x){$>x&&(P=$,$=x,x=P),$<this.start&&(this.start=$),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G($){return 0<=$&&$<256}U=h([g(0,b.IBufferService)],U)},844:(k,r)=>{function o(h){for(const g of h)g.dispose();h.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const g=this._disposables.indexOf(h);g!==-1&&this._disposables.splice(g,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var g;this._isDisposed||h===this._value||((g=this._value)==null||g.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}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=o,r.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},1505:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,c,_){this._data[g]||(this._data[g]={}),this._data[g][c]=_}get(g,c){return this._data[g]?this._data[g][c]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(h,g,c,_,v){this._data.get(h,g)||this._data.set(h,g,new o),this._data.get(h,g).set(c,_,v)}get(h,g,c,_){var v;return(v=this._data.get(h,g))==null?void 0:v.get(c,_)}clear(){this._data.clear()}}},6114:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const o=r.isNode?"node":navigator.userAgent,h=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(o)},6106:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(o=this._search(this._getKey(h)),this._array.splice(o,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const g=this._getKey(h);if(g===void 0||(o=this._search(g),o===-1)||this._getKey(this._array[o])!==g)return!1;do if(this._array[o]===h)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===g);return!1}*getKeyIterator(h){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===h)}forEachByKey(h,g){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do g(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===h)}values(){return[...this._array].values()}_search(h){let g=0,c=this._array.length-1;for(;c>=g;){let _=g+c>>1;const v=this._getKey(this._array[_]);if(v>h)c=_-1;else{if(!(v<h)){for(;_>0&&this._getKey(this._array[_-1])===h;)_--;return _}g=_+1}}return g}}},7226:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const h=o(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let y=0,u=0,i=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),u=Math.max(y,u),n=v.timeRemaining(),1.5*u>n)return i-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-y))}ms`),void this._start();i=n}this.clear()}}class c extends g{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const y=Date.now()+v;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}r.PriorityTaskQueue=c,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:c,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const h=o(643);r.updateWindowsModeWrappedState=function(g){const c=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),_=c==null?void 0:c.get(g.cols-1),v=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);v&&_&&(v.isWrapped=_[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&_[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new o;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,_=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const h=o(6349),g=o(7226),c=o(3734),_=o(8437),v=o(4634),y=o(511),u=o(643),i=o(4863),n=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,s,d){this._hasScrollback=t,this._optionsService=s,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=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.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(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,s){return new _.BufferLine(this._bufferService.cols,this.getNullCell(t),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;const s=t+this._optionsService.rawOptions.scrollback;return s>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:s}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=_.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(t))}}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(t,s){const d=this.getNullCell(_.DEFAULT_ATTR_DATA);let b=0;const m=this._getCorrectBufferLength(s);if(m>this.lines.maxLength&&(this.lines.maxLength=m),this.lines.length>0){if(this._cols<t)for(let p=0;p<this.lines.length;p++)b+=+this.lines.get(p).resize(t,d);let C=0;if(this._rows<s)for(let p=this._rows;p<s;p++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new _.BufferLine(t,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 _.BufferLine(t,d)));else for(let p=this._rows;p>s;p--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(m<this.lines.maxLength){const p=this.lines.length-m;p>0&&(this.lines.trimStart(p),this.ybase=Math.max(this.ybase-p,0),this.ydisp=Math.max(this.ydisp-p,0),this.savedY=Math.max(this.savedY-p,0)),this.lines.maxLength=m}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,s-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(t,s),this._cols>t))for(let C=0;C<this.lines.length;C++)b+=+this.lines.get(C).resize(t,d);this._cols=t,this._rows=s,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return t}get _isReflowEnabled(){const t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,s){this._cols!==t&&(t>this._cols?this._reflowLarger(t,s):this._reflowSmaller(t,s))}_reflowLarger(t,s){const d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(d.length>0){const b=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(t,s,b.countRemoved)}}_reflowLargerAdjustViewport(t,s,d){const b=this.getNullCell(_.DEFAULT_ATTR_DATA);let m=d;for(;m-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new _.BufferLine(t,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(t,s){const d=this.getNullCell(_.DEFAULT_ATTR_DATA),b=[];let m=0;for(let C=this.lines.length-1;C>=0;C--){let p=this.lines.get(C);if(!p||!p.isWrapped&&p.getTrimmedLength()<=t)continue;const E=[p];for(;p.isWrapped&&C>0;)p=this.lines.get(--C),E.unshift(p);const T=this.ybase+this.y;if(T>=C&&T<C+E.length)continue;const B=E[E.length-1].getTrimmedLength(),O=(0,v.reflowSmallerGetNewLineLengths)(E,this._cols,t),D=O.length-E.length;let P;P=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const N=[];for(let A=0;A<D;A++){const M=this.getBlankLine(_.DEFAULT_ATTR_DATA,!0);N.push(M)}N.length>0&&(b.push({start:C+E.length+m,newLines:N}),m+=N.length),E.push(...N);let U=O.length-1,G=O[U];G===0&&(U--,G=O[U]);let $=E.length-D-1,x=B;for(;$>=0;){const A=Math.min(x,G);if(E[U]===void 0)break;if(E[U].copyCellsFrom(E[$],x-A,G-A,A,!0),G-=A,G===0&&(U--,G=O[U]),x-=A,x===0){$--;const M=Math.max($,0);x=(0,v.getWrappedLineTrimmedLength)(E,M,this._cols)}}for(let A=0;A<E.length;A++)O[A]<t&&E[A].setCell(O[A],d);let L=D-P;for(;L-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+m)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+s-1)}if(b.length>0){const C=[],p=[];for(let U=0;U<this.lines.length;U++)p.push(this.lines.get(U));const E=this.lines.length;let T=E-1,B=0,O=b[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+m);let D=0;for(let U=Math.min(this.lines.maxLength-1,E+m-1);U>=0;U--)if(O&&O.start>T+D){for(let G=O.newLines.length-1;G>=0;G--)this.lines.set(U--,O.newLines[G]);U++,C.push({index:T+1,amount:O.newLines.length}),D+=O.newLines.length,O=b[++B]}else this.lines.set(U,p[T--]);let P=0;for(let U=C.length-1;U>=0;U--)C[U].index+=P,this.lines.onInsertEmitter.fire(C[U]),P+=C[U].amount;const N=Math.max(0,E+m-this.lines.maxLength);N>0&&this.lines.onTrimEmitter.fire(N)}}translateBufferLineToString(t,s,d=0,b){const m=this.lines.get(t);return m?m.translateToString(s,d,b):""}getWrappedRangeForLine(t){let s=t,d=t;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===t&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose(),this.markers.splice(t--,1);this._isClearing=!1}addMarker(t){const s=new i.Marker(t);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}}},8437:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const h=o(3734),g=o(511),c=o(643),_=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class y{constructor(i,n,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);const s=n||g.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let d=0;d<i;++d)this.setCell(d,s);this.length=i}get(i){const n=this._data[3*i+0],t=2097151&n;return[this._data[3*i+1],2097152&n?this._combined[i]:t?(0,_.stringFromCodePoint)(t):"",n>>22,2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):t]}set(i,n){this._data[3*i+1]=n[c.CHAR_DATA_ATTR_INDEX],n[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=n[1],this._data[3*i+0]=2097152|i|n[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=n[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&n}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i]:2097151&n?(0,_.stringFromCodePoint)(2097151&n):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,n){return v=3*i,n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+2],2097152&n.content&&(n.combinedData=this._combined[i]),268435456&n.bg&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){2097152&n.content&&(this._combined[i]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[i]=n.extended),this._data[3*i+0]=n.content,this._data[3*i+1]=n.fg,this._data[3*i+2]=n.bg}setCellFromCodepoint(i,n,t,s){268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=n|t<<22,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}addCodepointToCell(i,n,t){let s=this._data[3*i+0];2097152&s?this._combined[i]+=(0,_.stringFromCodePoint)(n):2097151&s?(this._combined[i]=(0,_.stringFromCodePoint)(2097151&s)+(0,_.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,t&&(s&=-12582913,s|=t<<22),this._data[3*i+0]=s}insertCells(i,n,t){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,t),n<this.length-i){const s=new g.CellData;for(let d=this.length-i-n-1;d>=0;--d)this.setCell(i+n+d,this.loadCell(i+d,s));for(let d=0;d<n;++d)this.setCell(i+d,t)}else for(let s=i;s<this.length;++s)this.setCell(s,t);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,t)}deleteCells(i,n,t){if(i%=this.length,n<this.length-i){const s=new g.CellData;for(let d=0;d<this.length-i-n;++d)this.setCell(i+d,this.loadCell(i+n+d,s));for(let d=this.length-n;d<this.length;++d)this.setCell(d,t)}else for(let s=i;s<this.length;++s)this.setCell(s,t);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,t),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,t)}replaceCells(i,n,t,s=!1){if(s)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,t),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,t);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,t),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,t),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,t);i<n&&i<this.length;)this.setCell(i++,t)}resize(i,n){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const t=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*t)this._data=new Uint32Array(this._data.buffer,0,t);else{const s=new Uint32Array(t);s.set(this._data),this._data=s}for(let s=this.length;s<i;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,t);const s=Object.keys(this._combined);for(let b=0;b<s.length;b++){const m=parseInt(s[b],10);m>=i&&delete this._combined[m]}const d=Object.keys(this._extendedAttrs);for(let b=0;b<d.length;b++){const m=parseInt(d[b],10);m>=i&&delete this._extendedAttrs[m]}}return this.length=i,4*t*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,i);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(const n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(const n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){const i=new y(0);i._data=new Uint32Array(this._data),i.length=this.length;for(const n in this._combined)i._combined[n]=this._combined[n];for(const n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,n,t,s,d){const b=i._data;if(d)for(let C=s-1;C>=0;C--){for(let p=0;p<3;p++)this._data[3*(t+C)+p]=b[3*(n+C)+p];268435456&b[3*(n+C)+2]&&(this._extendedAttrs[t+C]=i._extendedAttrs[n+C])}else for(let C=0;C<s;C++){for(let p=0;p<3;p++)this._data[3*(t+C)+p]=b[3*(n+C)+p];268435456&b[3*(n+C)+2]&&(this._extendedAttrs[t+C]=i._extendedAttrs[n+C])}const m=Object.keys(i._combined);for(let C=0;C<m.length;C++){const p=parseInt(m[C],10);p>=n&&(this._combined[p-n+t]=i._combined[p])}}translateToString(i,n,t,s){n=n??0,t=t??this.length,i&&(t=Math.min(t,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;n<t;){const b=this._data[3*n+0],m=2097151&b,C=2097152&b?this._combined[n]:m?(0,_.stringFromCodePoint)(m):c.WHITESPACE_CELL_CHAR;if(d+=C,s)for(let p=0;p<C.length;++p)s.push(n);n+=b>>22||1}return s&&s.push(n),d}}r.BufferLine=y},4841:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,h){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return h*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(k,r)=>{function o(h,g,c){if(g===h.length-1)return h[g].getTrimmedLength();const _=!h[g].hasContent(c-1)&&h[g].getWidth(c-1)===1,v=h[g+1].getWidth(0)===2;return _&&v?c-1:c}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,g,c,_,v){const y=[];for(let u=0;u<h.length-1;u++){let i=u,n=h.get(++i);if(!n.isWrapped)continue;const t=[h.get(u)];for(;i<h.length&&n.isWrapped;)t.push(n),n=h.get(++i);if(_>=u&&_<i){u+=t.length-1;continue}let s=0,d=o(t,s,g),b=1,m=0;for(;b<t.length;){const p=o(t,b,g),E=p-m,T=c-d,B=Math.min(E,T);t[s].copyCellsFrom(t[b],m,d,B,!1),d+=B,d===c&&(s++,d=0),m+=B,m===p&&(b++,m=0),d===0&&s!==0&&t[s-1].getWidth(c-1)===2&&(t[s].copyCellsFrom(t[s-1],c-1,d++,1,!1),t[s-1].setCell(c-1,v))}t[s].replaceCells(d,c,v);let C=0;for(let p=t.length-1;p>0&&(p>s||t[p].getTrimmedLength()===0);p--)C++;C>0&&(y.push(u+t.length-C),y.push(C)),u+=t.length-1}return y},r.reflowLargerCreateNewLayout=function(h,g){const c=[];let _=0,v=g[_],y=0;for(let u=0;u<h.length;u++)if(v===u){const i=g[++_];h.onDeleteEmitter.fire({index:u-y,amount:i}),u+=i-1,y+=i,v=g[++_]}else c.push(u);return{layout:c,countRemoved:y}},r.reflowLargerApplyNewLayout=function(h,g){const c=[];for(let _=0;_<g.length;_++)c.push(h.get(g[_]));for(let _=0;_<c.length;_++)h.set(_,c[_]);h.length=g.length},r.reflowSmallerGetNewLineLengths=function(h,g,c){const _=[],v=h.map((n,t)=>o(h,t,g)).reduce((n,t)=>n+t);let y=0,u=0,i=0;for(;i<v;){if(v-i<c){_.push(v-i);break}y+=c;const n=o(h,u,g);y>n&&(y-=n,u++);const t=h[u].getWidth(y-1)===2;t&&y--;const s=t?c-1:c;_.push(s),i+=s}return _},r.getWrappedLineTrimmedLength=o},5295:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const h=o(8460),g=o(844),c=o(9092);class _ extends g.Disposable{constructor(y,u){super(),this._optionsService=y,this._bufferService=u,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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(y,u){this._normal.resize(y,u),this._alt.resize(y,u),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}r.BufferSet=_},511:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const h=o(482),g=o(643),c=o(3734);class _ extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const u=new _;return u.setFromCharData(y),u}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(y){this.fg=y[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(y[g.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(y[g.CHAR_DATA_CHAR_INDEX].length===2){const i=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const n=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(i-55296)+n-56320+65536|y[g.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[g.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=y[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const h=o(8460),g=o(844);class c{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=c._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,g.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=c,c._nextId=1},7116:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(k,r)=>{var o,h,g;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
|
|
8
|
-
`,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""}(o||(r.C0=o={})),function(c){c.PAD="",c.HOP="",c.BPH="",c.NBH="",c.IND="",c.NEL="
",c.SSA="",c.ESA="",c.HTS="",c.HTJ="",c.VTS="",c.PLD="",c.PLU="",c.RI="",c.SS2="",c.SS3="",c.DCS="",c.PU1="",c.PU2="",c.STS="",c.CCH="",c.MW="",c.SPA="",c.EPA="",c.SOS="",c.SGCI="",c.SCI="",c.CSI="",c.ST="",c.OSC="",c.PM="",c.APC=""}(h||(r.C1=h={})),function(c){c.ST=`${o.ESC}\\`}(g||(r.C1_ESCAPED=g={}))},7399:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const h=o(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(c,_,v,y){const u={type:0,cancel:!1,key:void 0},i=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?u.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?u.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?u.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(u.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:u.key=c.ctrlKey?"\b":h.C0.DEL,c.altKey&&(u.key=h.C0.ESC+u.key);break;case 9:if(c.shiftKey){u.key=h.C0.ESC+"[Z";break}u.key=h.C0.HT,u.cancel=!0;break;case 13:u.key=c.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,u.cancel=!0;break;case 27:u.key=h.C0.ESC,c.altKey&&(u.key=h.C0.ESC+h.C0.ESC),u.cancel=!0;break;case 37:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"D",u.key===h.C0.ESC+"[1;3D"&&(u.key=h.C0.ESC+(v?"b":"[1;5D"))):u.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"C",u.key===h.C0.ESC+"[1;3C"&&(u.key=h.C0.ESC+(v?"f":"[1;5C"))):u.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"A",v||u.key!==h.C0.ESC+"[1;3A"||(u.key=h.C0.ESC+"[1;5A")):u.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"B",v||u.key!==h.C0.ESC+"[1;3B"||(u.key=h.C0.ESC+"[1;5B")):u.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(u.key=h.C0.ESC+"[2~");break;case 46:u.key=i?h.C0.ESC+"[3;"+(i+1)+"~":h.C0.ESC+"[3~";break;case 36:u.key=i?h.C0.ESC+"[1;"+(i+1)+"H":_?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:u.key=i?h.C0.ESC+"[1;"+(i+1)+"F":_?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:c.shiftKey?u.type=2:c.ctrlKey?u.key=h.C0.ESC+"[5;"+(i+1)+"~":u.key=h.C0.ESC+"[5~";break;case 34:c.shiftKey?u.type=3:c.ctrlKey?u.key=h.C0.ESC+"[6;"+(i+1)+"~":u.key=h.C0.ESC+"[6~";break;case 112:u.key=i?h.C0.ESC+"[1;"+(i+1)+"P":h.C0.ESC+"OP";break;case 113:u.key=i?h.C0.ESC+"[1;"+(i+1)+"Q":h.C0.ESC+"OQ";break;case 114:u.key=i?h.C0.ESC+"[1;"+(i+1)+"R":h.C0.ESC+"OR";break;case 115:u.key=i?h.C0.ESC+"[1;"+(i+1)+"S":h.C0.ESC+"OS";break;case 116:u.key=i?h.C0.ESC+"[15;"+(i+1)+"~":h.C0.ESC+"[15~";break;case 117:u.key=i?h.C0.ESC+"[17;"+(i+1)+"~":h.C0.ESC+"[17~";break;case 118:u.key=i?h.C0.ESC+"[18;"+(i+1)+"~":h.C0.ESC+"[18~";break;case 119:u.key=i?h.C0.ESC+"[19;"+(i+1)+"~":h.C0.ESC+"[19~";break;case 120:u.key=i?h.C0.ESC+"[20;"+(i+1)+"~":h.C0.ESC+"[20~";break;case 121:u.key=i?h.C0.ESC+"[21;"+(i+1)+"~":h.C0.ESC+"[21~";break;case 122:u.key=i?h.C0.ESC+"[23;"+(i+1)+"~":h.C0.ESC+"[23~";break;case 123:u.key=i?h.C0.ESC+"[24;"+(i+1)+"~":h.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(v&&!y||!c.altKey||c.metaKey)!v||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?u.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(u.key=h.C0.US),c.key==="@"&&(u.key=h.C0.NUL)):c.keyCode===65&&(u.type=1);else{const n=g[c.keyCode],t=n==null?void 0:n[c.shiftKey?1:0];if(t)u.key=h.C0.ESC+t;else if(c.keyCode>=65&&c.keyCode<=90){const s=c.ctrlKey?c.keyCode-64:c.keyCode+32;let d=String.fromCharCode(s);c.shiftKey&&(d=d.toUpperCase()),u.key=h.C0.ESC+d}else if(c.keyCode===32)u.key=h.C0.ESC+(c.ctrlKey?h.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let s=c.code.slice(3,4);c.shiftKey||(s=s.toLowerCase()),u.key=h.C0.ESC+s,u.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?u.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?u.key=h.C0.NUL:c.keyCode>=51&&c.keyCode<=55?u.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?u.key=h.C0.DEL:c.keyCode===219?u.key=h.C0.ESC:c.keyCode===220?u.key=h.C0.FS:c.keyCode===221&&(u.key=h.C0.GS)}return u}},482:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,h=0,g=o.length){let c="";for(let _=h;_<g;++_){let v=o[_];v>65535?(v-=65536,c+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):c+=String.fromCharCode(v)}return c},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const g=o.length;if(!g)return 0;let c=0,_=0;if(this._interim){const v=o.charCodeAt(_++);56320<=v&&v<=57343?h[c++]=1024*(this._interim-55296)+v-56320+65536:(h[c++]=this._interim,h[c++]=v),this._interim=0}for(let v=_;v<g;++v){const y=o.charCodeAt(v);if(55296<=y&&y<=56319){if(++v>=g)return this._interim=y,c;const u=o.charCodeAt(v);56320<=u&&u<=57343?h[c++]=1024*(y-55296)+u-56320+65536:(h[c++]=y,h[c++]=u)}else y!==65279&&(h[c++]=y)}return c}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const g=o.length;if(!g)return 0;let c,_,v,y,u=0,i=0,n=0;if(this.interim[0]){let d=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let m,C=0;for(;(m=63&this.interim[++C])&&C<4;)b<<=6,b|=m;const p=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=p-C;for(;n<E;){if(n>=g)return 0;if(m=o[n++],(192&m)!=128){n--,d=!0;break}this.interim[C++]=m,b<<=6,b|=63&m}d||(p===2?b<128?n--:h[u++]=b:p===3?b<2048||b>=55296&&b<=57343||b===65279||(h[u++]=b):b<65536||b>1114111||(h[u++]=b)),this.interim.fill(0)}const t=g-4;let s=n;for(;s<g;){for(;!(!(s<t)||128&(c=o[s])||128&(_=o[s+1])||128&(v=o[s+2])||128&(y=o[s+3]));)h[u++]=c,h[u++]=_,h[u++]=v,h[u++]=y,s+=4;if(c=o[s++],c<128)h[u++]=c;else if((224&c)==192){if(s>=g)return this.interim[0]=c,u;if(_=o[s++],(192&_)!=128){s--;continue}if(i=(31&c)<<6|63&_,i<128){s--;continue}h[u++]=i}else if((240&c)==224){if(s>=g)return this.interim[0]=c,u;if(_=o[s++],(192&_)!=128){s--;continue}if(s>=g)return this.interim[0]=c,this.interim[1]=_,u;if(v=o[s++],(192&v)!=128){s--;continue}if(i=(15&c)<<12|(63&_)<<6|63&v,i<2048||i>=55296&&i<=57343||i===65279)continue;h[u++]=i}else if((248&c)==240){if(s>=g)return this.interim[0]=c,u;if(_=o[s++],(192&_)!=128){s--;continue}if(s>=g)return this.interim[0]=c,this.interim[1]=_,u;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=g)return this.interim[0]=c,this.interim[1]=_,this.interim[2]=v,u;if(y=o[s++],(192&y)!=128){s--;continue}if(i=(7&c)<<18|(63&_)<<12|(63&v)<<6|63&y,i<65536||i>1114111)continue;h[u++]=i}}return u}}},225:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const h=o(1480),g=[[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]],c=[[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 _;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;v<g.length;++v)_.fill(0,g[v][0],g[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?_[v]:function(y,u){let i,n=0,t=u.length-1;if(y<u[0][0]||y>u[t][1])return!1;for(;t>=n;)if(i=n+t>>1,y>u[i][1])n=i+1;else{if(!(y<u[i][0]))return!0;t=i-1}return!1}(v,c)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,y){let u=this.wcwidth(v),i=u===0&&y!==0;if(i){const n=h.UnicodeService.extractWidth(y);n===0?i=!1:n>u&&(u=n)}return h.UnicodeService.createPropertyValue(0,u,i)}}},5981:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const h=o(8460),g=o(844);class c extends g.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(y),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(y)}_innerWrite(v=0,y=!0){const u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const i=this._writeBuffer[this._bufferOffset],n=this._action(i,y);if(n){const s=d=>Date.now()-u>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(u,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const t=this._callbacks[this._bufferOffset];if(t&&t(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-u>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=c},5941:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function g(c,_){const v=c.toString(16),y=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}r.parseColor=function(c){if(!c)return;let _=c.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const v=o.exec(_);if(v){const y=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/y*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/y*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/y*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),h.exec(_)&&[3,6,9,12].includes(_.length))){const v=_.length/3,y=[0,0,0];for(let u=0;u<3;++u){const i=parseInt(_.slice(v*u,v*u+v),16);y[u]=v===1?i<<4:v===2?i:v===3?i>>4:i>>8}return y}},r.toRgbString=function(c,_=16){const[v,y,u]=c;return`rgb:${g(v,_)}/${g(y,_)}/${g(u,_)}`}},5770:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const h=o(482),g=o(8742),c=o(5770),_=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(y,u){this._handlers[y]===void 0&&(this._handlers[y]=[]);const i=this._handlers[y];return i.push(u),{dispose:()=>{const n=i.indexOf(u);n!==-1&&i.splice(n,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(y,u){if(this.reset(),this._ident=y,this._active=this._handlers[y]||_,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(y,u,i){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(y,u,i);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(y,u,i))}unhook(y,u=!0){if(this._active.length){let i=!1,n=this._active.length-1,t=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=u,t=this._stack.fallThrough,this._stack.paused=!1),!t&&i===!1){for(;n>=0&&(i=this._active[n].unhook(y),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",y);this._active=_,this._ident=0}};const v=new g.Params;v.addParam(0),r.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=v,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():v,this._data="",this._hitLimit=!1}put(y,u,i){this._hitLimit||(this._data+=(0,h.utf32ToString)(y,u,i),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let u=!1;if(this._hitLimit)u=!1;else if(y&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then(i=>(this._params=v,this._data="",this._hitLimit=!1,i));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const h=o(844),g=o(8742),c=o(6242),_=o(6351);class v{constructor(n){this.table=new Uint8Array(n)}setDefault(n,t){this.table.fill(n<<4|t)}add(n,t,s,d){this.table[t<<8|n]=s<<4|d}addMany(n,t,s,d){for(let b=0;b<n.length;b++)this.table[t<<8|n[b]]=s<<4|d}}r.TransitionTable=v;const y=160;r.VT500_TRANSITION_TABLE=function(){const i=new v(4095),n=Array.apply(null,Array(256)).map((C,p)=>p),t=(C,p)=>n.slice(C,p),s=t(32,127),d=t(0,24);d.push(25),d.push.apply(d,t(28,32));const b=t(0,14);let m;for(m in i.setDefault(1,0),i.addMany(s,0,2,0),b)i.addMany([24,26,153,154],m,3,0),i.addMany(t(128,144),m,3,0),i.addMany(t(144,152),m,3,0),i.add(156,m,0,0),i.add(27,m,11,1),i.add(157,m,4,8),i.addMany([152,158,159],m,0,7),i.add(155,m,11,3),i.add(144,m,11,9);return i.addMany(d,0,3,0),i.addMany(d,1,3,1),i.add(127,1,0,1),i.addMany(d,8,0,8),i.addMany(d,3,3,3),i.add(127,3,0,3),i.addMany(d,4,3,4),i.add(127,4,0,4),i.addMany(d,6,3,6),i.addMany(d,5,3,5),i.add(127,5,0,5),i.addMany(d,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(t(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(d,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(t(64,127),3,7,0),i.addMany(t(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(t(48,60),4,8,4),i.addMany(t(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(t(32,64),6,0,6),i.add(127,6,0,6),i.addMany(t(64,127),6,0,0),i.addMany(t(32,48),3,9,5),i.addMany(t(32,48),5,9,5),i.addMany(t(48,64),5,0,6),i.addMany(t(64,127),5,7,0),i.addMany(t(32,48),4,9,5),i.addMany(t(32,48),1,9,2),i.addMany(t(32,48),2,9,2),i.addMany(t(48,127),2,10,0),i.addMany(t(48,80),1,10,0),i.addMany(t(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(t(96,127),1,10,0),i.add(80,1,11,9),i.addMany(d,9,0,9),i.add(127,9,0,9),i.addMany(t(28,32),9,0,9),i.addMany(t(32,48),9,9,12),i.addMany(t(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(d,11,0,11),i.addMany(t(32,128),11,0,11),i.addMany(t(28,32),11,0,11),i.addMany(d,10,0,10),i.add(127,10,0,10),i.addMany(t(28,32),10,0,10),i.addMany(t(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(t(32,48),10,9,12),i.addMany(d,12,0,12),i.add(127,12,0,12),i.addMany(t(28,32),12,0,12),i.addMany(t(32,48),12,9,12),i.addMany(t(48,64),12,0,11),i.addMany(t(64,127),12,12,13),i.addMany(t(64,127),10,12,13),i.addMany(t(64,127),9,12,13),i.addMany(d,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(y,0,2,0),i.add(y,8,5,8),i.add(y,6,0,6),i.add(y,11,0,11),i.add(y,13,13,13),i}();class u extends h.Disposable{constructor(n=r.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,d)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,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 c.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,t=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<n.intermediates.length;++b){const m=n.intermediates.charCodeAt(b);if(32>m||m>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=m}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(t[0]>d||d>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=d,s}identToString(n){const t=[];for(;n;)t.push(String.fromCharCode(255&n)),n>>=8;return t.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,t){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(t),{dispose:()=>{const b=d.indexOf(t);b!==-1&&d.splice(b,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,t){this._executeHandlers[n.charCodeAt(0)]=t}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,t){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(t),{dispose:()=>{const b=d.indexOf(t);b!==-1&&d.splice(b,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,t){return this._dcsParser.registerHandler(this._identifier(n),t)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,t){return this._oscParser.registerHandler(n,t)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,t,s,d,b){this._parseStack.state=n,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=b}parse(n,t,s){let d,b=0,m=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const p=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&E>-1){for(;E>=0&&(d=p[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&E>-1){for(;E>=0&&(d=p[E](),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 6:if(b=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(b!==24&&b!==26,s),d)return d;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=n[this._parseStack.chunkPos],d=this._oscParser.end(b!==24&&b!==26,s),d)return d;b===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 p=C;p<t;++p){switch(b=n[p],m=this._transitions.table[this.currentState<<8|(b<160?b:y)],m>>4){case 2:for(let D=p+1;;++D){if(D>=t||(b=n[D])<32||b>126&&b<y){this._printHandler(n,p,D),p=D-1;break}if(++D>=t||(b=n[D])<32||b>126&&b<y){this._printHandler(n,p,D),p=D-1;break}if(++D>=t||(b=n[D])<32||b>126&&b<y){this._printHandler(n,p,D),p=D-1;break}if(++D>=t||(b=n[D])<32||b>126&&b<y){this._printHandler(n,p,D),p=D-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:p,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|b];let T=E?E.length-1:-1;for(;T>=0&&(d=E[T](this._params),d!==!0);T--)if(d instanceof Promise)return this._preserveStack(3,E,T,m,p),d;T<0&&this._csiHandlerFb(this._collect<<8|b,this._params),this.precedingJoinState=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++p<t&&(b=n[p])>47&&b<60);p--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const B=this._escHandlers[this._collect<<8|b];let O=B?B.length-1:-1;for(;O>=0&&(d=B[O](),d!==!0);O--)if(d instanceof Promise)return this._preserveStack(4,B,O,m,p),d;O<0&&this._escHandlerFb(this._collect<<8|b),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|b,this._params);break;case 13:for(let D=p+1;;++D)if(D>=t||(b=n[D])===24||b===26||b===27||b>127&&b<y){this._dcsParser.put(n,p,D),p=D-1;break}break;case 14:if(d=this._dcsParser.unhook(b!==24&&b!==26),d)return this._preserveStack(6,[],0,m,p),d;b===27&&(m|=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 D=p+1;;D++)if(D>=t||(b=n[D])<32||b>127&&b<y){this._oscParser.put(n,p,D),p=D-1;break}break;case 6:if(d=this._oscParser.end(b!==24&&b!==26),d)return this._preserveStack(5,[],0,m,p),d;b===27&&(m|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&m}}}r.EscapeSequenceParser=u},6242:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const h=o(5770),g=o(482),c=[];r.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);const y=this._handlers[_];return y.push(v),{dispose:()=>{const u=y.indexOf(v);u!==-1&&y.splice(u,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,y){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(_,v,y);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(_,v,y))}start(){this.reset(),this._state=1}put(_,v,y){if(this._state!==3){if(this._state===1)for(;v<y;){const u=_[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&y-v>0&&this._put(_,v,y)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,u=this._active.length-1,i=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,y=v,i=this._stack.fallThrough,this._stack.paused=!1),!i&&y===!1){for(;u>=0&&(y=this._active[u].end(_),y!==!0);u--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,y;u--}for(;u>=0;u--)if(y=this._active[u].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",_);this._active=c,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,y){this._hitLimit||(this._data+=(0,g.utf32ToString)(_,v,y),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then(y=>(this._data="",this._hitLimit=!1,y));return this._data="",this._hitLimit=!1,v}}},8742:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const o=2147483647;class h{static fromArray(c){const _=new h;if(!c.length)return _;for(let v=Array.isArray(c[0])?1:0;v<c.length;++v){const y=c[v];if(Array.isArray(y))for(let u=0;u<y.length;++u)_.addSubParam(y[u]);else _.addParam(y)}return _}constructor(c=32,_=32){if(this.maxLength=c,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new h(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let _=0;_<this.length;++_){c.push(this.params[_]);const v=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];y-v>0&&c.push(Array.prototype.slice.call(this._subParams,v,y))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>o?o:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>o?o:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const _=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){const c={};for(let _=0;_<this.length;++_){const v=this._subParamsIdx[_]>>8,y=255&this._subParamsIdx[_];y-v>0&&(c[_]=this._subParams.slice(v,y))}return c}addDigit(c){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,y=v[_-1];v[_-1]=~y?Math.min(10*y+c,o):c}}r.Params=h},5741:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,h){const g={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(g),h.dispose=()=>this._wrappedAddonDispose(g),h.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let h=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===o){h=g;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(h,1)}}},8771:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const h=o(3785),g=o(511);r.BufferApiView=class{constructor(c,_){this._buffer=c,this.type=_}init(c){return this._buffer=c,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(c){const _=this._buffer.lines.get(c);if(_)return new h.BufferLineApiView(_)}getNullCell(){return new g.CellData}}},3785:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const h=o(511);r.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,c){if(!(g<0||g>=this._line.length))return c?(this._line.loadCell(g,c),c):this._line.loadCell(g,new h.CellData)}translateToString(g,c,_){return this._line.translateToString(g,c,_)}}},8285:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const h=o(8771),g=o(8460),c=o(844);class _ extends c.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new g.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)}}r.BufferNamespaceApi=_},7975:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,h){return this._core.registerCsiHandler(o,g=>h(g.toArray()))}addCsiHandler(o,h){return this.registerCsiHandler(o,h)}registerDcsHandler(o,h){return this._core.registerDcsHandler(o,(g,c)=>h(g,c.toArray()))}addDcsHandler(o,h){return this.registerDcsHandler(o,h)}registerEscHandler(o,h){return this._core.registerEscHandler(o,h)}addEscHandler(o,h){return this.registerEscHandler(o,h)}registerOscHandler(o,h){return this._core.registerOscHandler(o,h)}addOscHandler(o,h){return this.registerOscHandler(o,h)}}},7090:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(k,r,o){var h=this&&this.__decorate||function(i,n,t,s){var d,b=arguments.length,m=b<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,n,t,s);else for(var C=i.length-1;C>=0;C--)(d=i[C])&&(m=(b<3?d(m):b>3?d(n,t,m):d(n,t))||m);return b>3&&m&&Object.defineProperty(n,t,m),m},g=this&&this.__param||function(i,n){return function(t,s){n(t,s,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const c=o(8460),_=o(844),v=o(5295),y=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(i,this))}resize(i,n){this.cols=i,this.rows=n,this.buffers.resize(i,n),this._onResize.fire({cols:i,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,n=!1){const t=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===i.fg&&s.getBg(0)===i.bg||(s=t.getBlankLine(i,n),this._cachedBlankLine=s),s.isWrapped=n;const d=t.ybase+t.scrollTop,b=t.ybase+t.scrollBottom;if(t.scrollTop===0){const m=t.lines.isFull;b===t.lines.length-1?m?t.lines.recycle().copyFrom(s):t.lines.push(s.clone()):t.lines.splice(b+1,0,s.clone()),m?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const m=b-d+1;t.lines.shiftElements(d+1,m-1,-1),t.lines.set(b,s.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(i,n,t){const s=this.buffer;if(i<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else i+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),d!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};r.BufferService=u=h([g(0,y.IOptionsService)],u)},7994:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,h){this._charsets[o]=h,this.glevel===o&&(this.charset=h)}}},1753:function(k,r,o){var h=this&&this.__decorate||function(s,d,b,m){var C,p=arguments.length,E=p<3?d:m===null?m=Object.getOwnPropertyDescriptor(d,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,b,m);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(E=(p<3?C(E):p>3?C(d,b,E):C(d,b))||E);return p>3&&E&&Object.defineProperty(d,b,E),E},g=this&&this.__param||function(s,d){return function(b,m){d(b,m,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const c=o(2585),_=o(8460),v=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function u(s,d){let b=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(b|=64,b|=s.action):(b|=3&s.button,4&s.button&&(b|=64),8&s.button&&(b|=128),s.action===32?b|=32:s.action!==0||d||(b|=3)),b}const i=String.fromCharCode,n={DEFAULT:s=>{const d=[u(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${i(d[0])}${i(d[1])}${i(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.x};${s.y}${d}`}};let t=r.CoreMouseService=class extends v.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const b of Object.keys(y))this.addProtocol(b,y[b]);for(const b of Object.keys(n))this.addEncoding(b,n[b]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,b){if(b){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};r.CoreMouseService=t=h([g(0,c.IBufferService),g(1,c.ICoreService)],t)},6975:function(k,r,o){var h=this&&this.__decorate||function(t,s,d,b){var m,C=arguments.length,p=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,s,d,b);else for(var E=t.length-1;E>=0;E--)(m=t[E])&&(p=(C<3?m(p):C>3?m(s,d,p):m(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},g=this&&this.__param||function(t,s){return function(d,b){s(d,b,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const c=o(1439),_=o(8460),v=o(844),y=o(2585),u=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=r.CoreService=class extends v.Disposable{constructor(t,s,d){super(),this._bufferService=t,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(u),this.decPrivateModes=(0,c.clone)(i)}reset(){this.modes=(0,c.clone)(u),this.decPrivateModes=(0,c.clone)(i)}triggerDataEvent(t,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,()=>t.split("").map(b=>b.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,()=>t.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(t))}};r.CoreService=n=h([g(0,y.IBufferService),g(1,y.ILogService),g(2,y.IOptionsService)],n)},9074:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const h=o(8055),g=o(8460),c=o(844),_=o(6106);let v=0,y=0;class u extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)(()=>this.reset()))}registerDecoration(t){if(t.marker.isDisposed)return;const s=new i(t);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,s,d){let b=0,m=0;for(const C of this._decorations.getKeyIterator(s))b=C.options.x??0,m=b+(C.options.width??1),t>=b&&t<m&&(!d||(C.options.layer??"bottom")===d)&&(yield C)}forEachDecorationAtCell(t,s,d,b){this._decorations.forEachByKey(s,m=>{v=m.options.x??0,y=v+(m.options.width??1),t>=v&&t<y&&(!d||(m.options.layer??"bottom")===d)&&b(m)})}}r.DecorationService=u;class i extends c.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(t){super(),this.options=t,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const h=o(2585),g=o(8343);class c{constructor(...v){this._entries=new Map;for(const[y,u]of v)this.set(y,u)}set(v,y){const u=this._entries.get(v);return this._entries.set(v,y),u}forEach(v){for(const[y,u]of this._entries.entries())v(y,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=c,r.InstantiationService=class{constructor(){this._services=new c,this._services.set(h.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){const y=(0,g.getServiceDependencies)(_).sort((n,t)=>n.index-t.index),u=[];for(const n of y){const t=this._services.get(n.id);if(!t)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${n.id}.`);u.push(t)}const i=y.length>0?y[0].index:v.length;if(v.length!==i)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${i+1} conflicts with ${v.length} static arguments`);return new _(...v,...u)}}},7866:function(k,r,o){var h=this&&this.__decorate||function(i,n,t,s){var d,b=arguments.length,m=b<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,n,t,s);else for(var C=i.length-1;C>=0;C--)(d=i[C])&&(m=(b<3?d(m):b>3?d(n,t,m):d(n,t))||m);return b>3&&m&&Object.defineProperty(n,t,m),m},g=this&&this.__param||function(i,n){return function(t,s){n(t,s,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const c=o(844),_=o(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let y,u=r.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let n=0;n<i.length;n++)typeof i[n]=="function"&&(i[n]=i[n]())}_log(i,n,t){this._evalLazyOptionalParams(t),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...t)}trace(i,...n){var t;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.trace.bind(this._optionsService.options.logger))??console.log,i,n)}debug(i,...n){var t;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.debug.bind(this._optionsService.options.logger))??console.log,i,n)}info(i,...n){var t;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.info.bind(this._optionsService.options.logger))??console.info,i,n)}warn(i,...n){var t;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.warn.bind(this._optionsService.options.logger))??console.warn,i,n)}error(i,...n){var t;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.error.bind(this._optionsService.options.logger))??console.error,i,n)}};r.LogService=u=h([g(0,_.IOptionsService)],u),r.setTraceLogger=function(i){y=i},r.traceCall=function(i,n,t){if(typeof t.value!="function")throw new Error("not supported");const s=t.value;t.value=function(...d){if(y.logLevel!==_.LogLevelEnum.TRACE)return s.apply(this,d);y.trace(`GlyphRenderer#${s.name}(${d.map(m=>JSON.stringify(m)).join(", ")})`);const b=s.apply(this,d);return y.trace(`GlyphRenderer#${s.name} return`,b),b}}},7302:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const h=o(8460),g=o(844),c=o(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends g.Disposable{constructor(u){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...r.DEFAULT_OPTIONS};for(const n in u)if(n in i)try{const t=u[n];i[n]=this._sanitizeAndValidateOption(n,t)}catch(t){console.error(t)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,g.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(u,i){return this.onOptionChange(n=>{n===u&&i(this.rawOptions[u])})}onMultipleOptionChange(u,i){return this.onOptionChange(n=>{u.indexOf(n)!==-1&&i()})}_setupOptions(){const u=n=>{if(!(n in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,t)=>{if(!(n in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);t=this._sanitizeAndValidateOption(n,t),this.rawOptions[n]!==t&&(this.rawOptions[n]=t,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const t={get:u.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,t)}}_sanitizeAndValidateOption(u,i){switch(u){case"cursorStyle":if(i||(i=r.DEFAULT_OPTIONS[u]),!function(n){return n==="block"||n==="underline"||n==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${u}`);break;case"wordSeparator":i||(i=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=_.includes(i)?i:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${u} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${u} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}r.OptionsService=v},2660:function(k,r,o){var h=this&&this.__decorate||function(v,y,u,i){var n,t=arguments.length,s=t<3?y:i===null?i=Object.getOwnPropertyDescriptor(y,u):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,y,u,i);else for(var d=v.length-1;d>=0;d--)(n=v[d])&&(s=(t<3?n(s):t>3?n(y,u,s):n(y,u))||s);return t>3&&s&&Object.defineProperty(y,u,s),s},g=this&&this.__param||function(v,y){return function(u,i){y(u,i,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const c=o(2585);let _=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const y=this._bufferService.buffer;if(v.id===void 0){const d=y.addMarker(y.ybase+y.y),b={data:v,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(b,d)),this._dataByLinkId.set(b.id,b),b.id}const u=v,i=this._getEntryIdKey(u),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,y.ybase+y.y),n.id;const t=y.addMarker(y.ybase+y.y),s={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[t]};return t.onDispose(()=>this._removeMarkerFromLink(s,t)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,y){const u=this._dataByLinkId.get(v);if(u&&u.lines.every(i=>i.line!==y)){const i=this._bufferService.buffer.addMarker(y);u.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(u,i))}}getLinkData(v){var y;return(y=this._dataByLinkId.get(v))==null?void 0:y.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,y){const u=v.lines.indexOf(y);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=_=h([g(0,c.IBufferService)],_)},8343:(k,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const o="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(g){return g[h]||[]},r.createDecorator=function(g){if(r.serviceRegistry.has(g))return r.serviceRegistry.get(g);const c=function(_,v,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,i,n){i[o]===i?i[h].push({id:u,index:n}):(i[h]=[{id:u,index:n}],i[o]=i)})(c,_,y)};return c.toString=()=>g,r.serviceRegistry.set(g,c),c}},2585:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const h=o(8343);var g;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"}(g||(r.LogLevelEnum=g={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(k,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const h=o(8460),g=o(225);class c{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,y,u=!1){return(16777215&v)<<3|(3&y)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const v=new g.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let y=0,u=0;const i=v.length;for(let n=0;n<i;++n){let t=v.charCodeAt(n);if(55296<=t&&t<=56319){if(++n>=i)return y+this.wcwidth(t);const b=v.charCodeAt(n);56320<=b&&b<=57343?t=1024*(t-55296)+b-56320+65536:y+=this.wcwidth(b)}const s=this.charProperties(t,u);let d=c.extractWidth(s);c.extractShouldJoin(s)&&(d-=c.extractWidth(u)),y+=d,u=s}return y}charProperties(v,y){return this._activeProvider.charProperties(v,y)}}r.UnicodeService=c}},f={};function S(k){var r=f[k];if(r!==void 0)return r.exports;var o=f[k]={exports:{}};return a[k].call(o.exports,o,o.exports,S),o.exports}var w={};return(()=>{var k=w;Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;const r=S(9042),o=S(3236),h=S(844),g=S(5741),c=S(8285),_=S(7975),v=S(7090),y=["cols","rows"];class u extends h.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const t=d=>this._core.options[d],s=(d,b)=>{this._checkReadonlyOptions(d),this._core.options[d]=b};for(const d in this._core.options){const b={get:t.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,b)}}_checkReadonlyOptions(n){if(y.includes(n))throw new Error(`Option "${n}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const t in n)this._publicOptions[t]=n[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,t=!0){this._core.input(n,t)}resize(n,t){this._verifyIntegers(n,t),this._core.resize(n,t)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,t,s){this._verifyIntegers(n,t,s),this._core.select(n,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,t){this._verifyIntegers(n,t),this._core.selectLines(n,t)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,t){this._core.write(n,t)}writeln(n,t){this._core.write(n),this._core.write(`\r
|
|
9
|
-
`,t)}paste(n){this._core.paste(n)}refresh(n,t){this._verifyIntegers(n,t),this._core.refresh(n,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return r}_verifyIntegers(...n){for(const t of n)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const t of n)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}k.Terminal=u})(),w})())})(cr);var Ss=cr.exports,ne;(function(l){l.assertEqual=S=>S;function e(S){}l.assertIs=e;function a(S){throw new Error}l.assertNever=a,l.arrayToEnum=S=>{const w={};for(const k of S)w[k]=k;return w},l.getValidEnumValues=S=>{const w=l.objectKeys(S).filter(r=>typeof S[S[r]]!="number"),k={};for(const r of w)k[r]=S[r];return l.objectValues(k)},l.objectValues=S=>l.objectKeys(S).map(function(w){return S[w]}),l.objectKeys=typeof Object.keys=="function"?S=>Object.keys(S):S=>{const w=[];for(const k in S)Object.prototype.hasOwnProperty.call(S,k)&&w.push(k);return w},l.find=(S,w)=>{for(const k of S)if(w(k))return k},l.isInteger=typeof Number.isInteger=="function"?S=>Number.isInteger(S):S=>typeof S=="number"&&isFinite(S)&&Math.floor(S)===S;function f(S,w=" | "){return S.map(k=>typeof k=="string"?`'${k}'`:k).join(w)}l.joinValues=f,l.jsonStringifyReplacer=(S,w)=>typeof w=="bigint"?w.toString():w})(ne||(ne={}));var Mt;(function(l){l.mergeShapes=(e,a)=>({...e,...a})})(Mt||(Mt={}));const K=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Le=l=>{switch(typeof l){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(l)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(l)?K.array:l===null?K.null:l.then&&typeof l.then=="function"&&l.catch&&typeof l.catch=="function"?K.promise:typeof Map<"u"&&l instanceof Map?K.map:typeof Set<"u"&&l instanceof Set?K.set:typeof Date<"u"&&l instanceof Date?K.date:K.object;default:return K.unknown}},j=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ys=l=>JSON.stringify(l,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{constructor(e){super(),this.issues=[],this.addIssue=f=>{this.issues=[...this.issues,f]},this.addIssues=(f=[])=>{this.issues=[...this.issues,...f]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const a=e||function(w){return w.message},f={_errors:[]},S=w=>{for(const k of w.issues)if(k.code==="invalid_union")k.unionErrors.map(S);else if(k.code==="invalid_return_type")S(k.returnTypeError);else if(k.code==="invalid_arguments")S(k.argumentsError);else if(k.path.length===0)f._errors.push(a(k));else{let r=f,o=0;for(;o<k.path.length;){const h=k.path[o];o===k.path.length-1?(r[h]=r[h]||{_errors:[]},r[h]._errors.push(a(k))):r[h]=r[h]||{_errors:[]},r=r[h],o++}}};return S(this),f}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},f=[];for(const S of this.issues)S.path.length>0?(a[S.path[0]]=a[S.path[0]]||[],a[S.path[0]].push(e(S))):f.push(e(S));return{formErrors:f,fieldErrors:a}}get formErrors(){return this.flatten()}}fe.create=l=>new fe(l);const We=(l,e)=>{let a;switch(l.code){case j.invalid_type:l.received===K.undefined?a="Required":a=`Expected ${l.expected}, received ${l.received}`;break;case j.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(l.expected,ne.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:a=`Unrecognized key(s) in object: ${ne.joinValues(l.keys,", ")}`;break;case j.invalid_union:a="Invalid input";break;case j.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ne.joinValues(l.options)}`;break;case j.invalid_enum_value:a=`Invalid enum value. Expected ${ne.joinValues(l.options)}, received '${l.received}'`;break;case j.invalid_arguments:a="Invalid function arguments";break;case j.invalid_return_type:a="Invalid function return type";break;case j.invalid_date:a="Invalid date";break;case j.invalid_string:typeof l.validation=="object"?"includes"in l.validation?(a=`Invalid input: must include "${l.validation.includes}"`,typeof l.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${l.validation.position}`)):"startsWith"in l.validation?a=`Invalid input: must start with "${l.validation.startsWith}"`:"endsWith"in l.validation?a=`Invalid input: must end with "${l.validation.endsWith}"`:ne.assertNever(l.validation):l.validation!=="regex"?a=`Invalid ${l.validation}`:a="Invalid";break;case j.too_small:l.type==="array"?a=`Array must contain ${l.exact?"exactly":l.inclusive?"at least":"more than"} ${l.minimum} element(s)`:l.type==="string"?a=`String must contain ${l.exact?"exactly":l.inclusive?"at least":"over"} ${l.minimum} character(s)`:l.type==="number"?a=`Number must be ${l.exact?"exactly equal to ":l.inclusive?"greater than or equal to ":"greater than "}${l.minimum}`:l.type==="date"?a=`Date must be ${l.exact?"exactly equal to ":l.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(l.minimum))}`:a="Invalid input";break;case j.too_big:l.type==="array"?a=`Array must contain ${l.exact?"exactly":l.inclusive?"at most":"less than"} ${l.maximum} element(s)`:l.type==="string"?a=`String must contain ${l.exact?"exactly":l.inclusive?"at most":"under"} ${l.maximum} character(s)`:l.type==="number"?a=`Number must be ${l.exact?"exactly":l.inclusive?"less than or equal to":"less than"} ${l.maximum}`:l.type==="bigint"?a=`BigInt must be ${l.exact?"exactly":l.inclusive?"less than or equal to":"less than"} ${l.maximum}`:l.type==="date"?a=`Date must be ${l.exact?"exactly":l.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(l.maximum))}`:a="Invalid input";break;case j.custom:a="Invalid input";break;case j.invalid_intersection_types:a="Intersection results could not be merged";break;case j.not_multiple_of:a=`Number must be a multiple of ${l.multipleOf}`;break;case j.not_finite:a="Number must be finite";break;default:a=e.defaultError,ne.assertNever(l)}return{message:a}};let lr=We;function Cs(l){lr=l}function mt(){return lr}const bt=l=>{const{data:e,path:a,errorMaps:f,issueData:S}=l,w=[...a,...S.path||[]],k={...S,path:w};if(S.message!==void 0)return{...S,path:w,message:S.message};let r="";const o=f.filter(h=>!!h).slice().reverse();for(const h of o)r=h(k,{data:e,defaultError:r}).message;return{...S,path:w,message:r}},ws=[];function V(l,e){const a=mt(),f=bt({issueData:e,data:l.data,path:l.path,errorMaps:[l.common.contextualErrorMap,l.schemaErrorMap,a,a===We?void 0:We].filter(S=>!!S)});l.common.issues.push(f)}class le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const f=[];for(const S of a){if(S.status==="aborted")return Q;S.status==="dirty"&&e.dirty(),f.push(S.value)}return{status:e.value,value:f}}static async mergeObjectAsync(e,a){const f=[];for(const S of a){const w=await S.key,k=await S.value;f.push({key:w,value:k})}return le.mergeObjectSync(e,f)}static mergeObjectSync(e,a){const f={};for(const S of a){const{key:w,value:k}=S;if(w.status==="aborted"||k.status==="aborted")return Q;w.status==="dirty"&&e.dirty(),k.status==="dirty"&&e.dirty(),w.value!=="__proto__"&&(typeof k.value<"u"||S.alwaysSet)&&(f[w.value]=k.value)}return{status:e.value,value:f}}}const Q=Object.freeze({status:"aborted"}),Ne=l=>({status:"dirty",value:l}),de=l=>({status:"valid",value:l}),It=l=>l.status==="aborted",Pt=l=>l.status==="dirty",Xe=l=>l.status==="valid",Qe=l=>typeof Promise<"u"&&l instanceof Promise;function St(l,e,a,f){if(typeof e=="function"?l!==e||!f:!e.has(l))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(l)}function dr(l,e,a,f,S){if(typeof e=="function"?l!==e||!S:!e.has(l))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(l,a),a}var Y;(function(l){l.errToObj=e=>typeof e=="string"?{message:e}:e||{},l.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));var Ge,Ye;class ye{constructor(e,a,f,S){this._cachedPath=[],this.parent=e,this.data=a,this._path=f,this._key=S}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Vt=(l,e)=>{if(Xe(e))return{success:!0,data:e.value};if(!l.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new fe(l.common.issues);return this._error=a,this._error}}};function re(l){if(!l)return{};const{errorMap:e,invalid_type_error:a,required_error:f,description:S}=l;if(e&&(a||f))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:S}:{errorMap:(k,r)=>{var o,h;const{message:g}=l;return k.code==="invalid_enum_value"?{message:g??r.defaultError}:typeof r.data>"u"?{message:(o=g??f)!==null&&o!==void 0?o:r.defaultError}:k.code!=="invalid_type"?{message:r.defaultError}:{message:(h=g??a)!==null&&h!==void 0?h:r.defaultError}},description:S}}class se{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Le(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:Le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:Le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Qe(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const f=this.safeParse(e,a);if(f.success)return f.data;throw f.error}safeParse(e,a){var f;const S={common:{issues:[],async:(f=a==null?void 0:a.async)!==null&&f!==void 0?f:!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)},w=this._parseSync({data:e,path:S.path,parent:S});return Vt(S,w)}async parseAsync(e,a){const f=await this.safeParseAsync(e,a);if(f.success)return f.data;throw f.error}async safeParseAsync(e,a){const f={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)},S=this._parse({data:e,path:f.path,parent:f}),w=await(Qe(S)?S:Promise.resolve(S));return Vt(f,w)}refine(e,a){const f=S=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(S):a;return this._refinement((S,w)=>{const k=e(S),r=()=>w.addIssue({code:j.custom,...f(S)});return typeof Promise<"u"&&k instanceof Promise?k.then(o=>o?!0:(r(),!1)):k?!0:(r(),!1)})}refinement(e,a){return this._refinement((f,S)=>e(f)?!0:(S.addIssue(typeof a=="function"?a(f,S):a),!1))}_refinement(e){return new me({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Se.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this,this._def)}promise(){return Ue.create(this,this._def)}or(e){return st.create([this,e],this._def)}and(e){return it.create(this,e,this._def)}transform(e){return new me({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ht({...re(this._def),innerType:this,defaultValue:a,typeName:X.ZodDefault})}brand(){return new Ft({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new lt({...re(this._def),innerType:this,catchValue:a,typeName:X.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return ut.create(this,e)}readonly(){return dt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Es=/^c[^\s-]{8,}$/i,xs=/^[0-9a-z]+$/,ks=/^[0-9A-HJKMNP-TV-Z]{26}$/,Rs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ls=/^[a-z0-9_-]{21}$/i,Ds=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ts=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,As="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bt;const Bs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Os=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ms=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ur="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Is=new RegExp(`^${ur}$`);function fr(l){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return l.precision?e=`${e}\\.\\d{${l.precision}}`:l.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Ps(l){return new RegExp(`^${fr(l)}$`)}function _r(l){let e=`${ur}T${fr(l)}`;const a=[];return a.push(l.local?"Z?":"Z"),l.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function Hs(l,e){return!!((e==="v4"||!e)&&Bs.test(l)||(e==="v6"||!e)&&Os.test(l))}class ge extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.string,received:w.parsedType}),Q}const f=new le;let S;for(const w of this._def.checks)if(w.kind==="min")e.data.length<w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_small,minimum:w.value,type:"string",inclusive:!0,exact:!1,message:w.message}),f.dirty());else if(w.kind==="max")e.data.length>w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_big,maximum:w.value,type:"string",inclusive:!0,exact:!1,message:w.message}),f.dirty());else if(w.kind==="length"){const k=e.data.length>w.value,r=e.data.length<w.value;(k||r)&&(S=this._getOrReturnCtx(e,S),k?V(S,{code:j.too_big,maximum:w.value,type:"string",inclusive:!0,exact:!0,message:w.message}):r&&V(S,{code:j.too_small,minimum:w.value,type:"string",inclusive:!0,exact:!0,message:w.message}),f.dirty())}else if(w.kind==="email")Ts.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"email",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="emoji")Bt||(Bt=new RegExp(As,"u")),Bt.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"emoji",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="uuid")Rs.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"uuid",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="nanoid")Ls.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"nanoid",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="cuid")Es.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"cuid",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="cuid2")xs.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"cuid2",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="ulid")ks.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"ulid",code:j.invalid_string,message:w.message}),f.dirty());else if(w.kind==="url")try{new URL(e.data)}catch{S=this._getOrReturnCtx(e,S),V(S,{validation:"url",code:j.invalid_string,message:w.message}),f.dirty()}else w.kind==="regex"?(w.regex.lastIndex=0,w.regex.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"regex",code:j.invalid_string,message:w.message}),f.dirty())):w.kind==="trim"?e.data=e.data.trim():w.kind==="includes"?e.data.includes(w.value,w.position)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:{includes:w.value,position:w.position},message:w.message}),f.dirty()):w.kind==="toLowerCase"?e.data=e.data.toLowerCase():w.kind==="toUpperCase"?e.data=e.data.toUpperCase():w.kind==="startsWith"?e.data.startsWith(w.value)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:{startsWith:w.value},message:w.message}),f.dirty()):w.kind==="endsWith"?e.data.endsWith(w.value)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:{endsWith:w.value},message:w.message}),f.dirty()):w.kind==="datetime"?_r(w).test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:"datetime",message:w.message}),f.dirty()):w.kind==="date"?Is.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:"date",message:w.message}),f.dirty()):w.kind==="time"?Ps(w).test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:"time",message:w.message}),f.dirty()):w.kind==="duration"?Ds.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"duration",code:j.invalid_string,message:w.message}),f.dirty()):w.kind==="ip"?Hs(e.data,w.version)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"ip",code:j.invalid_string,message:w.message}),f.dirty()):w.kind==="base64"?Ms.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"base64",code:j.invalid_string,message:w.message}),f.dirty()):ne.assertNever(w);return{status:f.value,value:e.data}}_regex(e,a,f){return this.refinement(S=>e.test(S),{validation:a,code:j.invalid_string,...Y.errToObj(f)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}datetime(e){var a,f;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(a=e==null?void 0:e.offset)!==null&&a!==void 0?a:!1,local:(f=e==null?void 0:e.local)!==null&&f!==void 0?f:!1,...Y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...Y.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...Y.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...Y.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...Y.errToObj(a)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ge.create=l=>{var e;return new ge({checks:[],typeName:X.ZodString,coerce:(e=l==null?void 0:l.coerce)!==null&&e!==void 0?e:!1,...re(l)})};function Ns(l,e){const a=(l.toString().split(".")[1]||"").length,f=(e.toString().split(".")[1]||"").length,S=a>f?a:f,w=parseInt(l.toFixed(S).replace(".","")),k=parseInt(e.toFixed(S).replace(".",""));return w%k/Math.pow(10,S)}class De extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.number,received:w.parsedType}),Q}let f;const S=new le;for(const w of this._def.checks)w.kind==="int"?ne.isInteger(e.data)||(f=this._getOrReturnCtx(e,f),V(f,{code:j.invalid_type,expected:"integer",received:"float",message:w.message}),S.dirty()):w.kind==="min"?(w.inclusive?e.data<w.value:e.data<=w.value)&&(f=this._getOrReturnCtx(e,f),V(f,{code:j.too_small,minimum:w.value,type:"number",inclusive:w.inclusive,exact:!1,message:w.message}),S.dirty()):w.kind==="max"?(w.inclusive?e.data>w.value:e.data>=w.value)&&(f=this._getOrReturnCtx(e,f),V(f,{code:j.too_big,maximum:w.value,type:"number",inclusive:w.inclusive,exact:!1,message:w.message}),S.dirty()):w.kind==="multipleOf"?Ns(e.data,w.value)!==0&&(f=this._getOrReturnCtx(e,f),V(f,{code:j.not_multiple_of,multipleOf:w.value,message:w.message}),S.dirty()):w.kind==="finite"?Number.isFinite(e.data)||(f=this._getOrReturnCtx(e,f),V(f,{code:j.not_finite,message:w.message}),S.dirty()):ne.assertNever(w);return{status:S.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,f,S){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:f,message:Y.toString(S)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const f of this._def.checks){if(f.kind==="finite"||f.kind==="int"||f.kind==="multipleOf")return!0;f.kind==="min"?(a===null||f.value>a)&&(a=f.value):f.kind==="max"&&(e===null||f.value<e)&&(e=f.value)}return Number.isFinite(a)&&Number.isFinite(e)}}De.create=l=>new De({checks:[],typeName:X.ZodNumber,coerce:(l==null?void 0:l.coerce)||!1,...re(l)});class Te extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==K.bigint){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.bigint,received:w.parsedType}),Q}let f;const S=new le;for(const w of this._def.checks)w.kind==="min"?(w.inclusive?e.data<w.value:e.data<=w.value)&&(f=this._getOrReturnCtx(e,f),V(f,{code:j.too_small,type:"bigint",minimum:w.value,inclusive:w.inclusive,message:w.message}),S.dirty()):w.kind==="max"?(w.inclusive?e.data>w.value:e.data>=w.value)&&(f=this._getOrReturnCtx(e,f),V(f,{code:j.too_big,type:"bigint",maximum:w.value,inclusive:w.inclusive,message:w.message}),S.dirty()):w.kind==="multipleOf"?e.data%w.value!==BigInt(0)&&(f=this._getOrReturnCtx(e,f),V(f,{code:j.not_multiple_of,multipleOf:w.value,message:w.message}),S.dirty()):ne.assertNever(w);return{status:S.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,f,S){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:f,message:Y.toString(S)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Te.create=l=>{var e;return new Te({checks:[],typeName:X.ZodBigInt,coerce:(e=l==null?void 0:l.coerce)!==null&&e!==void 0?e:!1,...re(l)})};class et extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){const f=this._getOrReturnCtx(e);return V(f,{code:j.invalid_type,expected:K.boolean,received:f.parsedType}),Q}return de(e.data)}}et.create=l=>new et({typeName:X.ZodBoolean,coerce:(l==null?void 0:l.coerce)||!1,...re(l)});class Ie extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.date,received:w.parsedType}),Q}if(isNaN(e.data.getTime())){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_date}),Q}const f=new le;let S;for(const w of this._def.checks)w.kind==="min"?e.data.getTime()<w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_small,message:w.message,inclusive:!0,exact:!1,minimum:w.value,type:"date"}),f.dirty()):w.kind==="max"?e.data.getTime()>w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_big,message:w.message,inclusive:!0,exact:!1,maximum:w.value,type:"date"}),f.dirty()):ne.assertNever(w);return{status:f.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Ie.create=l=>new Ie({checks:[],coerce:(l==null?void 0:l.coerce)||!1,typeName:X.ZodDate,...re(l)});class yt extends se{_parse(e){if(this._getType(e)!==K.symbol){const f=this._getOrReturnCtx(e);return V(f,{code:j.invalid_type,expected:K.symbol,received:f.parsedType}),Q}return de(e.data)}}yt.create=l=>new yt({typeName:X.ZodSymbol,...re(l)});class tt extends se{_parse(e){if(this._getType(e)!==K.undefined){const f=this._getOrReturnCtx(e);return V(f,{code:j.invalid_type,expected:K.undefined,received:f.parsedType}),Q}return de(e.data)}}tt.create=l=>new tt({typeName:X.ZodUndefined,...re(l)});class rt extends se{_parse(e){if(this._getType(e)!==K.null){const f=this._getOrReturnCtx(e);return V(f,{code:j.invalid_type,expected:K.null,received:f.parsedType}),Q}return de(e.data)}}rt.create=l=>new rt({typeName:X.ZodNull,...re(l)});class je extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return de(e.data)}}je.create=l=>new je({typeName:X.ZodAny,...re(l)});class Me extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return de(e.data)}}Me.create=l=>new Me({typeName:X.ZodUnknown,...re(l)});class xe extends se{_parse(e){const a=this._getOrReturnCtx(e);return V(a,{code:j.invalid_type,expected:K.never,received:a.parsedType}),Q}}xe.create=l=>new xe({typeName:X.ZodNever,...re(l)});class Ct extends se{_parse(e){if(this._getType(e)!==K.undefined){const f=this._getOrReturnCtx(e);return V(f,{code:j.invalid_type,expected:K.void,received:f.parsedType}),Q}return de(e.data)}}Ct.create=l=>new Ct({typeName:X.ZodVoid,...re(l)});class ve extends se{_parse(e){const{ctx:a,status:f}=this._processInputParams(e),S=this._def;if(a.parsedType!==K.array)return V(a,{code:j.invalid_type,expected:K.array,received:a.parsedType}),Q;if(S.exactLength!==null){const k=a.data.length>S.exactLength.value,r=a.data.length<S.exactLength.value;(k||r)&&(V(a,{code:k?j.too_big:j.too_small,minimum:r?S.exactLength.value:void 0,maximum:k?S.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:S.exactLength.message}),f.dirty())}if(S.minLength!==null&&a.data.length<S.minLength.value&&(V(a,{code:j.too_small,minimum:S.minLength.value,type:"array",inclusive:!0,exact:!1,message:S.minLength.message}),f.dirty()),S.maxLength!==null&&a.data.length>S.maxLength.value&&(V(a,{code:j.too_big,maximum:S.maxLength.value,type:"array",inclusive:!0,exact:!1,message:S.maxLength.message}),f.dirty()),a.common.async)return Promise.all([...a.data].map((k,r)=>S.type._parseAsync(new ye(a,k,a.path,r)))).then(k=>le.mergeArray(f,k));const w=[...a.data].map((k,r)=>S.type._parseSync(new ye(a,k,a.path,r)));return le.mergeArray(f,w)}get element(){return this._def.type}min(e,a){return new ve({...this._def,minLength:{value:e,message:Y.toString(a)}})}max(e,a){return new ve({...this._def,maxLength:{value:e,message:Y.toString(a)}})}length(e,a){return new ve({...this._def,exactLength:{value:e,message:Y.toString(a)}})}nonempty(e){return this.min(1,e)}}ve.create=(l,e)=>new ve({type:l,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(e)});function He(l){if(l instanceof ae){const e={};for(const a in l.shape){const f=l.shape[a];e[a]=Se.create(He(f))}return new ae({...l._def,shape:()=>e})}else return l instanceof ve?new ve({...l._def,type:He(l.element)}):l instanceof Se?Se.create(He(l.unwrap())):l instanceof Be?Be.create(He(l.unwrap())):l instanceof Ce?Ce.create(l.items.map(e=>He(e))):l}class ae extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ne.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==K.object){const h=this._getOrReturnCtx(e);return V(h,{code:j.invalid_type,expected:K.object,received:h.parsedType}),Q}const{status:f,ctx:S}=this._processInputParams(e),{shape:w,keys:k}=this._getCached(),r=[];if(!(this._def.catchall instanceof xe&&this._def.unknownKeys==="strip"))for(const h in S.data)k.includes(h)||r.push(h);const o=[];for(const h of k){const g=w[h],c=S.data[h];o.push({key:{status:"valid",value:h},value:g._parse(new ye(S,c,S.path,h)),alwaysSet:h in S.data})}if(this._def.catchall instanceof xe){const h=this._def.unknownKeys;if(h==="passthrough")for(const g of r)o.push({key:{status:"valid",value:g},value:{status:"valid",value:S.data[g]}});else if(h==="strict")r.length>0&&(V(S,{code:j.unrecognized_keys,keys:r}),f.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const g of r){const c=S.data[g];o.push({key:{status:"valid",value:g},value:h._parse(new ye(S,c,S.path,g)),alwaysSet:g in S.data})}}return S.common.async?Promise.resolve().then(async()=>{const h=[];for(const g of o){const c=await g.key,_=await g.value;h.push({key:c,value:_,alwaysSet:g.alwaysSet})}return h}).then(h=>le.mergeObjectSync(f,h)):le.mergeObjectSync(f,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,f)=>{var S,w,k,r;const o=(k=(w=(S=this._def).errorMap)===null||w===void 0?void 0:w.call(S,a,f).message)!==null&&k!==void 0?k:f.defaultError;return a.code==="unrecognized_keys"?{message:(r=Y.errToObj(e).message)!==null&&r!==void 0?r:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const a={};return ne.objectKeys(e).forEach(f=>{e[f]&&this.shape[f]&&(a[f]=this.shape[f])}),new ae({...this._def,shape:()=>a})}omit(e){const a={};return ne.objectKeys(this.shape).forEach(f=>{e[f]||(a[f]=this.shape[f])}),new ae({...this._def,shape:()=>a})}deepPartial(){return He(this)}partial(e){const a={};return ne.objectKeys(this.shape).forEach(f=>{const S=this.shape[f];e&&!e[f]?a[f]=S:a[f]=S.optional()}),new ae({...this._def,shape:()=>a})}required(e){const a={};return ne.objectKeys(this.shape).forEach(f=>{if(e&&!e[f])a[f]=this.shape[f];else{let w=this.shape[f];for(;w instanceof Se;)w=w._def.innerType;a[f]=w}}),new ae({...this._def,shape:()=>a})}keyof(){return pr(ne.objectKeys(this.shape))}}ae.create=(l,e)=>new ae({shape:()=>l,unknownKeys:"strip",catchall:xe.create(),typeName:X.ZodObject,...re(e)});ae.strictCreate=(l,e)=>new ae({shape:()=>l,unknownKeys:"strict",catchall:xe.create(),typeName:X.ZodObject,...re(e)});ae.lazycreate=(l,e)=>new ae({shape:l,unknownKeys:"strip",catchall:xe.create(),typeName:X.ZodObject,...re(e)});class st extends se{_parse(e){const{ctx:a}=this._processInputParams(e),f=this._def.options;function S(w){for(const r of w)if(r.result.status==="valid")return r.result;for(const r of w)if(r.result.status==="dirty")return a.common.issues.push(...r.ctx.common.issues),r.result;const k=w.map(r=>new fe(r.ctx.common.issues));return V(a,{code:j.invalid_union,unionErrors:k}),Q}if(a.common.async)return Promise.all(f.map(async w=>{const k={...a,common:{...a.common,issues:[]},parent:null};return{result:await w._parseAsync({data:a.data,path:a.path,parent:k}),ctx:k}})).then(S);{let w;const k=[];for(const o of f){const h={...a,common:{...a.common,issues:[]},parent:null},g=o._parseSync({data:a.data,path:a.path,parent:h});if(g.status==="valid")return g;g.status==="dirty"&&!w&&(w={result:g,ctx:h}),h.common.issues.length&&k.push(h.common.issues)}if(w)return a.common.issues.push(...w.ctx.common.issues),w.result;const r=k.map(o=>new fe(o));return V(a,{code:j.invalid_union,unionErrors:r}),Q}}get options(){return this._def.options}}st.create=(l,e)=>new st({options:l,typeName:X.ZodUnion,...re(e)});const we=l=>l instanceof ot?we(l.schema):l instanceof me?we(l.innerType()):l instanceof at?[l.value]:l instanceof Ae?l.options:l instanceof ct?ne.objectValues(l.enum):l instanceof ht?we(l._def.innerType):l instanceof tt?[void 0]:l instanceof rt?[null]:l instanceof Se?[void 0,...we(l.unwrap())]:l instanceof Be?[null,...we(l.unwrap())]:l instanceof Ft||l instanceof dt?we(l.unwrap()):l instanceof lt?we(l._def.innerType):[];class xt extends se{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.object)return V(a,{code:j.invalid_type,expected:K.object,received:a.parsedType}),Q;const f=this.discriminator,S=a.data[f],w=this.optionsMap.get(S);return w?a.common.async?w._parseAsync({data:a.data,path:a.path,parent:a}):w._parseSync({data:a.data,path:a.path,parent:a}):(V(a,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[f]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,f){const S=new Map;for(const w of a){const k=we(w.shape[e]);if(!k.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of k){if(S.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);S.set(r,w)}}return new xt({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:S,...re(f)})}}function Ht(l,e){const a=Le(l),f=Le(e);if(l===e)return{valid:!0,data:l};if(a===K.object&&f===K.object){const S=ne.objectKeys(e),w=ne.objectKeys(l).filter(r=>S.indexOf(r)!==-1),k={...l,...e};for(const r of w){const o=Ht(l[r],e[r]);if(!o.valid)return{valid:!1};k[r]=o.data}return{valid:!0,data:k}}else if(a===K.array&&f===K.array){if(l.length!==e.length)return{valid:!1};const S=[];for(let w=0;w<l.length;w++){const k=l[w],r=e[w],o=Ht(k,r);if(!o.valid)return{valid:!1};S.push(o.data)}return{valid:!0,data:S}}else return a===K.date&&f===K.date&&+l==+e?{valid:!0,data:l}:{valid:!1}}class it extends se{_parse(e){const{status:a,ctx:f}=this._processInputParams(e),S=(w,k)=>{if(It(w)||It(k))return Q;const r=Ht(w.value,k.value);return r.valid?((Pt(w)||Pt(k))&&a.dirty(),{status:a.value,value:r.data}):(V(f,{code:j.invalid_intersection_types}),Q)};return f.common.async?Promise.all([this._def.left._parseAsync({data:f.data,path:f.path,parent:f}),this._def.right._parseAsync({data:f.data,path:f.path,parent:f})]).then(([w,k])=>S(w,k)):S(this._def.left._parseSync({data:f.data,path:f.path,parent:f}),this._def.right._parseSync({data:f.data,path:f.path,parent:f}))}}it.create=(l,e,a)=>new it({left:l,right:e,typeName:X.ZodIntersection,...re(a)});class Ce extends se{_parse(e){const{status:a,ctx:f}=this._processInputParams(e);if(f.parsedType!==K.array)return V(f,{code:j.invalid_type,expected:K.array,received:f.parsedType}),Q;if(f.data.length<this._def.items.length)return V(f,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&f.data.length>this._def.items.length&&(V(f,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const w=[...f.data].map((k,r)=>{const o=this._def.items[r]||this._def.rest;return o?o._parse(new ye(f,k,f.path,r)):null}).filter(k=>!!k);return f.common.async?Promise.all(w).then(k=>le.mergeArray(a,k)):le.mergeArray(a,w)}get items(){return this._def.items}rest(e){return new Ce({...this._def,rest:e})}}Ce.create=(l,e)=>{if(!Array.isArray(l))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:l,typeName:X.ZodTuple,rest:null,...re(e)})};class nt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:f}=this._processInputParams(e);if(f.parsedType!==K.object)return V(f,{code:j.invalid_type,expected:K.object,received:f.parsedType}),Q;const S=[],w=this._def.keyType,k=this._def.valueType;for(const r in f.data)S.push({key:w._parse(new ye(f,r,f.path,r)),value:k._parse(new ye(f,f.data[r],f.path,r)),alwaysSet:r in f.data});return f.common.async?le.mergeObjectAsync(a,S):le.mergeObjectSync(a,S)}get element(){return this._def.valueType}static create(e,a,f){return a instanceof se?new nt({keyType:e,valueType:a,typeName:X.ZodRecord,...re(f)}):new nt({keyType:ge.create(),valueType:e,typeName:X.ZodRecord,...re(a)})}}class wt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:f}=this._processInputParams(e);if(f.parsedType!==K.map)return V(f,{code:j.invalid_type,expected:K.map,received:f.parsedType}),Q;const S=this._def.keyType,w=this._def.valueType,k=[...f.data.entries()].map(([r,o],h)=>({key:S._parse(new ye(f,r,f.path,[h,"key"])),value:w._parse(new ye(f,o,f.path,[h,"value"]))}));if(f.common.async){const r=new Map;return Promise.resolve().then(async()=>{for(const o of k){const h=await o.key,g=await o.value;if(h.status==="aborted"||g.status==="aborted")return Q;(h.status==="dirty"||g.status==="dirty")&&a.dirty(),r.set(h.value,g.value)}return{status:a.value,value:r}})}else{const r=new Map;for(const o of k){const h=o.key,g=o.value;if(h.status==="aborted"||g.status==="aborted")return Q;(h.status==="dirty"||g.status==="dirty")&&a.dirty(),r.set(h.value,g.value)}return{status:a.value,value:r}}}}wt.create=(l,e,a)=>new wt({valueType:e,keyType:l,typeName:X.ZodMap,...re(a)});class Pe extends se{_parse(e){const{status:a,ctx:f}=this._processInputParams(e);if(f.parsedType!==K.set)return V(f,{code:j.invalid_type,expected:K.set,received:f.parsedType}),Q;const S=this._def;S.minSize!==null&&f.data.size<S.minSize.value&&(V(f,{code:j.too_small,minimum:S.minSize.value,type:"set",inclusive:!0,exact:!1,message:S.minSize.message}),a.dirty()),S.maxSize!==null&&f.data.size>S.maxSize.value&&(V(f,{code:j.too_big,maximum:S.maxSize.value,type:"set",inclusive:!0,exact:!1,message:S.maxSize.message}),a.dirty());const w=this._def.valueType;function k(o){const h=new Set;for(const g of o){if(g.status==="aborted")return Q;g.status==="dirty"&&a.dirty(),h.add(g.value)}return{status:a.value,value:h}}const r=[...f.data.values()].map((o,h)=>w._parse(new ye(f,o,f.path,h)));return f.common.async?Promise.all(r).then(o=>k(o)):k(r)}min(e,a){return new Pe({...this._def,minSize:{value:e,message:Y.toString(a)}})}max(e,a){return new Pe({...this._def,maxSize:{value:e,message:Y.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}Pe.create=(l,e)=>new Pe({valueType:l,minSize:null,maxSize:null,typeName:X.ZodSet,...re(e)});class Fe extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.function)return V(a,{code:j.invalid_type,expected:K.function,received:a.parsedType}),Q;function f(r,o){return bt({data:r,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,mt(),We].filter(h=>!!h),issueData:{code:j.invalid_arguments,argumentsError:o}})}function S(r,o){return bt({data:r,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,mt(),We].filter(h=>!!h),issueData:{code:j.invalid_return_type,returnTypeError:o}})}const w={errorMap:a.common.contextualErrorMap},k=a.data;if(this._def.returns instanceof Ue){const r=this;return de(async function(...o){const h=new fe([]),g=await r._def.args.parseAsync(o,w).catch(v=>{throw h.addIssue(f(o,v)),h}),c=await Reflect.apply(k,this,g);return await r._def.returns._def.type.parseAsync(c,w).catch(v=>{throw h.addIssue(S(c,v)),h})})}else{const r=this;return de(function(...o){const h=r._def.args.safeParse(o,w);if(!h.success)throw new fe([f(o,h.error)]);const g=Reflect.apply(k,this,h.data),c=r._def.returns.safeParse(g,w);if(!c.success)throw new fe([S(g,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Fe({...this._def,args:Ce.create(e).rest(Me.create())})}returns(e){return new Fe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,f){return new Fe({args:e||Ce.create([]).rest(Me.create()),returns:a||Me.create(),typeName:X.ZodFunction,...re(f)})}}class ot extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}ot.create=(l,e)=>new ot({getter:l,typeName:X.ZodLazy,...re(e)});class at extends se{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return V(a,{received:a.data,code:j.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}at.create=(l,e)=>new at({value:l,typeName:X.ZodLiteral,...re(e)});function pr(l,e){return new Ae({values:l,typeName:X.ZodEnum,...re(e)})}class Ae extends se{constructor(){super(...arguments),Ge.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),f=this._def.values;return V(a,{expected:ne.joinValues(f),received:a.parsedType,code:j.invalid_type}),Q}if(St(this,Ge)||dr(this,Ge,new Set(this._def.values)),!St(this,Ge).has(e.data)){const a=this._getOrReturnCtx(e),f=this._def.values;return V(a,{received:a.data,code:j.invalid_enum_value,options:f}),Q}return de(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Ae.create(e,{...this._def,...a})}exclude(e,a=this._def){return Ae.create(this.options.filter(f=>!e.includes(f)),{...this._def,...a})}}Ge=new WeakMap;Ae.create=pr;class ct extends se{constructor(){super(...arguments),Ye.set(this,void 0)}_parse(e){const a=ne.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(e);if(f.parsedType!==K.string&&f.parsedType!==K.number){const S=ne.objectValues(a);return V(f,{expected:ne.joinValues(S),received:f.parsedType,code:j.invalid_type}),Q}if(St(this,Ye)||dr(this,Ye,new Set(ne.getValidEnumValues(this._def.values))),!St(this,Ye).has(e.data)){const S=ne.objectValues(a);return V(f,{received:f.data,code:j.invalid_enum_value,options:S}),Q}return de(e.data)}get enum(){return this._def.values}}Ye=new WeakMap;ct.create=(l,e)=>new ct({values:l,typeName:X.ZodNativeEnum,...re(e)});class Ue extends se{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.promise&&a.common.async===!1)return V(a,{code:j.invalid_type,expected:K.promise,received:a.parsedType}),Q;const f=a.parsedType===K.promise?a.data:Promise.resolve(a.data);return de(f.then(S=>this._def.type.parseAsync(S,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ue.create=(l,e)=>new Ue({type:l,typeName:X.ZodPromise,...re(e)});class me extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:f}=this._processInputParams(e),S=this._def.effect||null,w={addIssue:k=>{V(f,k),k.fatal?a.abort():a.dirty()},get path(){return f.path}};if(w.addIssue=w.addIssue.bind(w),S.type==="preprocess"){const k=S.transform(f.data,w);if(f.common.async)return Promise.resolve(k).then(async r=>{if(a.value==="aborted")return Q;const o=await this._def.schema._parseAsync({data:r,path:f.path,parent:f});return o.status==="aborted"?Q:o.status==="dirty"||a.value==="dirty"?Ne(o.value):o});{if(a.value==="aborted")return Q;const r=this._def.schema._parseSync({data:k,path:f.path,parent:f});return r.status==="aborted"?Q:r.status==="dirty"||a.value==="dirty"?Ne(r.value):r}}if(S.type==="refinement"){const k=r=>{const o=S.refinement(r,w);if(f.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(f.common.async===!1){const r=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});return r.status==="aborted"?Q:(r.status==="dirty"&&a.dirty(),k(r.value),{status:a.value,value:r.value})}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(r=>r.status==="aborted"?Q:(r.status==="dirty"&&a.dirty(),k(r.value).then(()=>({status:a.value,value:r.value}))))}if(S.type==="transform")if(f.common.async===!1){const k=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(!Xe(k))return k;const r=S.transform(k.value,w);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:r}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(k=>Xe(k)?Promise.resolve(S.transform(k.value,w)).then(r=>({status:a.value,value:r})):k);ne.assertNever(S)}}me.create=(l,e,a)=>new me({schema:l,typeName:X.ZodEffects,effect:e,...re(a)});me.createWithPreprocess=(l,e,a)=>new me({schema:e,effect:{type:"preprocess",transform:l},typeName:X.ZodEffects,...re(a)});class Se extends se{_parse(e){return this._getType(e)===K.undefined?de(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(l,e)=>new Se({innerType:l,typeName:X.ZodOptional,...re(e)});class Be extends se{_parse(e){return this._getType(e)===K.null?de(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(l,e)=>new Be({innerType:l,typeName:X.ZodNullable,...re(e)});class ht extends se{_parse(e){const{ctx:a}=this._processInputParams(e);let f=a.data;return a.parsedType===K.undefined&&(f=this._def.defaultValue()),this._def.innerType._parse({data:f,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ht.create=(l,e)=>new ht({innerType:l,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class lt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),f={...a,common:{...a.common,issues:[]}},S=this._def.innerType._parse({data:f.data,path:f.path,parent:{...f}});return Qe(S)?S.then(w=>({status:"valid",value:w.status==="valid"?w.value:this._def.catchValue({get error(){return new fe(f.common.issues)},input:f.data})})):{status:"valid",value:S.status==="valid"?S.value:this._def.catchValue({get error(){return new fe(f.common.issues)},input:f.data})}}removeCatch(){return this._def.innerType}}lt.create=(l,e)=>new lt({innerType:l,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Et extends se{_parse(e){if(this._getType(e)!==K.nan){const f=this._getOrReturnCtx(e);return V(f,{code:j.invalid_type,expected:K.nan,received:f.parsedType}),Q}return{status:"valid",value:e.data}}}Et.create=l=>new Et({typeName:X.ZodNaN,...re(l)});const Fs=Symbol("zod_brand");class Ft extends se{_parse(e){const{ctx:a}=this._processInputParams(e),f=a.data;return this._def.type._parse({data:f,path:a.path,parent:a})}unwrap(){return this._def.type}}class ut extends se{_parse(e){const{status:a,ctx:f}=this._processInputParams(e);if(f.common.async)return(async()=>{const w=await this._def.in._parseAsync({data:f.data,path:f.path,parent:f});return w.status==="aborted"?Q:w.status==="dirty"?(a.dirty(),Ne(w.value)):this._def.out._parseAsync({data:w.value,path:f.path,parent:f})})();{const S=this._def.in._parseSync({data:f.data,path:f.path,parent:f});return S.status==="aborted"?Q:S.status==="dirty"?(a.dirty(),{status:"dirty",value:S.value}):this._def.out._parseSync({data:S.value,path:f.path,parent:f})}}static create(e,a){return new ut({in:e,out:a,typeName:X.ZodPipeline})}}class dt extends se{_parse(e){const a=this._def.innerType._parse(e),f=S=>(Xe(S)&&(S.value=Object.freeze(S.value)),S);return Qe(a)?a.then(S=>f(S)):f(a)}unwrap(){return this._def.innerType}}dt.create=(l,e)=>new dt({innerType:l,typeName:X.ZodReadonly,...re(e)});function gr(l,e={},a){return l?je.create().superRefine((f,S)=>{var w,k;if(!l(f)){const r=typeof e=="function"?e(f):typeof e=="string"?{message:e}:e,o=(k=(w=r.fatal)!==null&&w!==void 0?w:a)!==null&&k!==void 0?k:!0,h=typeof r=="string"?{message:r}:r;S.addIssue({code:"custom",...h,fatal:o})}}):je.create()}const Ws={object:ae.lazycreate};var X;(function(l){l.ZodString="ZodString",l.ZodNumber="ZodNumber",l.ZodNaN="ZodNaN",l.ZodBigInt="ZodBigInt",l.ZodBoolean="ZodBoolean",l.ZodDate="ZodDate",l.ZodSymbol="ZodSymbol",l.ZodUndefined="ZodUndefined",l.ZodNull="ZodNull",l.ZodAny="ZodAny",l.ZodUnknown="ZodUnknown",l.ZodNever="ZodNever",l.ZodVoid="ZodVoid",l.ZodArray="ZodArray",l.ZodObject="ZodObject",l.ZodUnion="ZodUnion",l.ZodDiscriminatedUnion="ZodDiscriminatedUnion",l.ZodIntersection="ZodIntersection",l.ZodTuple="ZodTuple",l.ZodRecord="ZodRecord",l.ZodMap="ZodMap",l.ZodSet="ZodSet",l.ZodFunction="ZodFunction",l.ZodLazy="ZodLazy",l.ZodLiteral="ZodLiteral",l.ZodEnum="ZodEnum",l.ZodEffects="ZodEffects",l.ZodNativeEnum="ZodNativeEnum",l.ZodOptional="ZodOptional",l.ZodNullable="ZodNullable",l.ZodDefault="ZodDefault",l.ZodCatch="ZodCatch",l.ZodPromise="ZodPromise",l.ZodBranded="ZodBranded",l.ZodPipeline="ZodPipeline",l.ZodReadonly="ZodReadonly"})(X||(X={}));const js=(l,e={message:`Input not instance of ${l.name}`})=>gr(a=>a instanceof l,e),vr=ge.create,mr=De.create,Us=Et.create,$s=Te.create,br=et.create,zs=Ie.create,qs=yt.create,Vs=tt.create,Zs=rt.create,Ks=je.create,Gs=Me.create,Ys=xe.create,Js=Ct.create,Xs=ve.create,Qs=ae.create,ei=ae.strictCreate,ti=st.create,ri=xt.create,si=it.create,ii=Ce.create,ni=nt.create,oi=wt.create,ai=Pe.create,ci=Fe.create,hi=ot.create,li=at.create,di=Ae.create,ui=ct.create,fi=Ue.create,Zt=me.create,_i=Se.create,pi=Be.create,gi=me.createWithPreprocess,vi=ut.create,mi=()=>vr().optional(),bi=()=>mr().optional(),Si=()=>br().optional(),yi={string:l=>ge.create({...l,coerce:!0}),number:l=>De.create({...l,coerce:!0}),boolean:l=>et.create({...l,coerce:!0}),bigint:l=>Te.create({...l,coerce:!0}),date:l=>Ie.create({...l,coerce:!0})},Ci=Q;var wi=Object.freeze({__proto__:null,defaultErrorMap:We,setErrorMap:Cs,getErrorMap:mt,makeIssue:bt,EMPTY_PATH:ws,addIssueToContext:V,ParseStatus:le,INVALID:Q,DIRTY:Ne,OK:de,isAborted:It,isDirty:Pt,isValid:Xe,isAsync:Qe,get util(){return ne},get objectUtil(){return Mt},ZodParsedType:K,getParsedType:Le,ZodType:se,datetimeRegex:_r,ZodString:ge,ZodNumber:De,ZodBigInt:Te,ZodBoolean:et,ZodDate:Ie,ZodSymbol:yt,ZodUndefined:tt,ZodNull:rt,ZodAny:je,ZodUnknown:Me,ZodNever:xe,ZodVoid:Ct,ZodArray:ve,ZodObject:ae,ZodUnion:st,ZodDiscriminatedUnion:xt,ZodIntersection:it,ZodTuple:Ce,ZodRecord:nt,ZodMap:wt,ZodSet:Pe,ZodFunction:Fe,ZodLazy:ot,ZodLiteral:at,ZodEnum:Ae,ZodNativeEnum:ct,ZodPromise:Ue,ZodEffects:me,ZodTransformer:me,ZodOptional:Se,ZodNullable:Be,ZodDefault:ht,ZodCatch:lt,ZodNaN:Et,BRAND:Fs,ZodBranded:Ft,ZodPipeline:ut,ZodReadonly:dt,custom:gr,Schema:se,ZodSchema:se,late:Ws,get ZodFirstPartyTypeKind(){return X},coerce:yi,any:Ks,array:Xs,bigint:$s,boolean:br,date:zs,discriminatedUnion:ri,effect:Zt,enum:di,function:ci,instanceof:js,intersection:si,lazy:hi,literal:li,map:oi,nan:Us,nativeEnum:ui,never:Ys,null:Zs,nullable:pi,number:mr,object:Qs,oboolean:Si,onumber:bi,optional:_i,ostring:mi,pipeline:vi,preprocess:gi,promise:fi,record:ni,set:ai,strictObject:ei,string:vr,symbol:qs,transformer:Zt,tuple:ii,undefined:Vs,union:ti,unknown:Gs,void:Js,NEVER:Ci,ZodIssueCode:j,quotelessJson:ys,ZodError:fe});function Ei(l){const e=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(l);if(!e)return;if(!e[1]||!e[2]||!e[3]||!e[4])throw new Error(`Mouse event: Invalid match for data ${l}`);const a=parseInt(e[1],10),f=parseInt(e[2],10),S=parseInt(e[3],10),w=e[4]==="m";return console.log(`Mouse event: buttonCode=${a}, column=${f}, row=${S}, isRelease=${w}`),l}function xi(l,e){const a=new Ss.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),f=or.macchiato.colors;a.options.theme={background:f.base.hex,black:f.crust.hex,brightBlack:f.surface2.hex,blue:f.blue.hex,brightBlue:f.blue.hex,brightCyan:f.sky.hex,brightRed:f.maroon.hex,brightYellow:f.yellow.hex,cursor:f.text.hex,cyan:f.sky.hex,foreground:f.text.hex,green:f.green.hex,magenta:f.lavender.hex,red:f.red.hex,white:f.text.hex,yellow:f.yellow.hex};const S=new bs.FitAddon;return a.loadAddon(S),a.open(l),S.fit(),window.addEventListener("resize",()=>{S.fit()}),a.onData(w=>{if(typeof w!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(w)}'`);const k=Ei(w);k&&e.onMouseEvent(k)}),a.onKey(w=>{e.onKeyPress(w)}),a}function ki(){let l=wi.string().safeParse(sessionStorage.getItem("tabId")).data;return l||(l=Math.random().toString(36),sessionStorage.setItem("tabId",l)),{tabId:l}}class Ri{constructor(e){Ke(this,"ready");Ke(this,"tabId");Ke(this,"terminal");Ke(this,"trpc");const a=Xr({links:[us({condition:w=>w.type==="subscription",true:gs({url:"/trpc"}),false:ds({url:"/trpc"})})]});this.trpc=a,this.tabId=ki();const f=this.tabId,S=xi(e,{onMouseEvent(w){a.neovim.sendStdin.mutate({tabId:f,data:w}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(w){a.neovim.sendStdin.mutate({tabId:f,data:w.key})}});this.terminal=S,this.ready=new Promise(w=>{console.log("Subscribing to Neovim stdout"),a.neovim.onStdout.subscribe({client:f},{onStarted(){w()},onData(k){S.write(k)},onError(k){console.error("Error from Neovim",k)}})})}async startNeovim(e){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:e.filename,additionalEnvironmentVariables:e.additionalEnvironmentVariables,startupScriptModifications:e.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(e){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}}const Sr=document.querySelector("#app");if(!Sr)throw new Error("No app element found");const yr=new Ri(Sr);window.startNeovim=async function(l){return await yr.startNeovim({additionalEnvironmentVariables:l==null?void 0:l.additionalEnvironmentVariables,filename:(l==null?void 0:l.filename)??"initial-file.txt",startupScriptModifications:(l==null?void 0:l.startupScriptModifications)??[]})};window.runBlockingShellCommand=async function(l){return yr.runBlockingShellCommand(l)};
|
|
7
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.isLinux&&g&&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(g){const E=this._getMouseBufferCoords(g),T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(T&&B&&E)&&this._areCoordsInSelection(E,T,B)}isCellInSelection(g,E){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!T||!B)&&this._areCoordsInSelection([g,E],T,B)}_areCoordsInSelection(g,E,T){return g[1]>E[1]&&g[1]<T[1]||E[1]===T[1]&&g[1]===E[1]&&g[0]>=E[0]&&g[0]<T[0]||E[1]<T[1]&&g[1]===T[1]&&g[0]<T[0]||E[1]<T[1]&&g[1]===E[1]&&g[0]>=E[0]}_selectWordAtCursor(g,E){var O,D;const T=(D=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:D.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(g);return!!B&&(this._selectWordAt(B,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,E){this._model.clearSelection(),g=Math.max(g,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const E=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(g){let E=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=T?0:(E>T&&(E-=T),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(g){return n.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(g),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(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const E=this._getMouseBufferCoords(g);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(g){return g.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!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(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const B=T.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const E=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const B=(0,p.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,T=!(!g||!E||g[0]===E[0]&&g[1]===E[1]);T?g&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,E,T)):this._oldHasSelection&&this._fireOnSelectionChange(g,E,T)}_fireOnSelectionChange(g,E,T){this._oldSelectionStart=g,this._oldSelectionEnd=E,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(g,E){let T=E;for(let B=0;E>=B;B++){const O=g.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&E!==B&&(T+=O-1)}return T}setSelection(g,E,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,E],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,E,T=!0,B=!0){if(g[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,D=O.lines.get(g[1]);if(!D)return;const P=O.translateBufferLineToString(g[1],!1);let N=this._convertViewportColToCharacterIndex(D,g[0]),U=N;const G=g[0]-N;let $=0,x=0,L=0,A=0;if(P.charAt(N)===" "){for(;N>0&&P.charAt(N-1)===" ";)N--;for(;U<P.length&&P.charAt(U+1)===" ";)U++}else{let z=g[0],J=g[0];D.getWidth(z)===0&&($++,z--),D.getWidth(J)===2&&(x++,J++);const ee=D.getString(J).length;for(ee>1&&(A+=ee-1,U+=ee-1);z>0&&N>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,z--):I>1&&(L+=I-1,N-=I-1),N--,z--}for(;J<D.length&&U+1<P.length&&!this._isCharWordSeparator(D.loadCell(J+1,this._workCell));){D.loadCell(J+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,J++):I>1&&(A+=I-1,U+=I-1),U++,J++}}U++;let M=N+G-$+L,F=Math.min(this._bufferService.cols,U-N+$+x-L-A);if(E||P.slice(N,U).trim()!==""){if(T&&M===0&&D.getCodePoint(0)!==32){const z=O.lines.get(g[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(J){const ee=this._bufferService.cols-J.start;M-=ee,F+=ee}}}if(B&&M+F===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const z=O.lines.get(g[1]+1);if(z!=null&&z.isWrapped&&z.getCodePoint(0)!==32){const J=this._getWordAt([0,g[1]+1],!1,!1,!0);J&&(F+=J.length)}}return{start:M,length:F}}}_selectWordAt(g,E){const T=this._getWordAt(g,E);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[T.start,g[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(g){const E=this._getWordAt(g,!0);if(E){let T=g[1];for(;E.start<0;)E.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,T]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const E=this._bufferService.buffer.getWrappedRangeForLine(g),T={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols)}};t.SelectionService=C=h([f(3,d.IBufferService),f(4,d.ICoreService),f(5,y.IMouseService),f(6,d.IOptionsService),f(7,y.IRenderService),f(8,y.ICoreBrowserService)],C)},4725:(R,t,o)=>{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=o(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(R,t,o){var h=this&&this.__decorate||function(C,g,E,T){var B,O=arguments.length,D=O<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,g,E,T);else for(var P=C.length-1;P>=0;P--)(B=C[P])&&(D=(O<3?B(D):O>3?B(g,E,D):B(g,E))||D);return O>3&&D&&Object.defineProperty(g,E,D),D},f=this&&this.__param||function(C,g){return function(E,T){g(E,T,C)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const c=o(7239),p=o(8055),v=o(8460),y=o(844),u=o(2585),i=p.css.toColor("#ffffff"),n=p.css.toColor("#000000"),r=p.css.toColor("#ffffff"),s=p.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let E=0;E<216;E++){const T=g[E/36%6|0],B=g[E/6%6|0],O=g[E%6];C.push({css:p.channels.toCss(T,B,O),rgba:p.channels.toRgba(T,B,O)})}for(let E=0;E<24;E++){const T=8+10*E;C.push({css:p.channels.toCss(T,T,T),rgba:p.channels.toRgba(T,T,T)})}return C})());let b=t.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:n,cursor:r,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:p.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:p.color.blend(n,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 g=this._colors;if(g.foreground=m(C.foreground,i),g.background=m(C.background,n),g.cursor=m(C.cursor,r),g.cursorAccent=m(C.cursorAccent,s),g.selectionBackgroundTransparent=m(C.selectionBackground,d),g.selectionBackgroundOpaque=p.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=m(C.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=p.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=C.selectionForeground?m(C.selectionForeground,p.NULL_COLOR):void 0,g.selectionForeground===p.NULL_COLOR&&(g.selectionForeground=void 0),p.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=p.color.opacity(g.selectionBackgroundTransparent,.3)),p.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=p.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=t.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=m(C.black,t.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=m(C.red,t.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=m(C.green,t.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=m(C.yellow,t.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=m(C.blue,t.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=m(C.magenta,t.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=m(C.cyan,t.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=m(C.white,t.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=m(C.brightBlack,t.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=m(C.brightRed,t.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=m(C.brightGreen,t.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=m(C.brightYellow,t.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=m(C.brightBlue,t.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=m(C.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=m(C.brightCyan,t.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=m(C.brightWhite,t.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(g.ansi.length-16,C.extendedAnsi.length);for(let T=0;T<E;T++)g.ansi[T+16]=m(C.extendedAnsi[T],t.DEFAULT_ANSI_COLORS[T+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 g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}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 m(C,g){if(C!==void 0)try{return p.css.toColor(C)}catch{}return g}t.ThemeService=b=h([f(0,u.IOptionsService)],b)},6349:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=o(8460),f=o(844);class c extends f.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;const y=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)y[u]=this._array[this._getCyclicIndex(u)];this._array=y,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let y=this._length;y<v;y++)this._array[y]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,y){this._array[this._getCyclicIndex(v)]=y}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,y,...u){if(y){for(let i=v;i<this._length-y;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+y)];this._length-=y,this.onDeleteEmitter.fire({index:v,amount:y})}for(let i=this._length-1;i>=v;i--)this._array[this._getCyclicIndex(i+u.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<u.length;i++)this._array[this._getCyclicIndex(v+i)]=u[i];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){const i=this._length+u.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,y,u){if(!(y<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let n=y-1;n>=0;n--)this.set(v+n+u,this.get(v+n));const i=v+y+u-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<y;i++)this.set(v+i+u,this.get(v+i))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}t.CircularList=c},1439:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function o(h,f=5){if(typeof h!="object")return h;const c=Array.isArray(h)?[]:{};for(const p in h)c[p]=f<=1?h[p]:h[p]&&o(h[p],f-1);return c}},8055:(R,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 o=0,h=0,f=0,c=0;var p,v,y,u,i;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function r(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,b,m,C){return C!==void 0?`#${n(d)}${n(b)}${n(m)}${n(C)}`:`#${n(d)}${n(b)}${n(m)}`},s.toRgba=function(d,b,m,C=255){return(d<<24|b<<16|m<<8|C)>>>0},s.toColor=function(d,b,m,C){return{css:s.toCss(d,b,m,C),rgba:s.toRgba(d,b,m,C)}}}(p||(t.channels=p={})),function(s){function d(b,m){return c=Math.round(255*m),[o,h,f]=i.toChannels(b.rgba),{css:p.toCss(o,h,f,c),rgba:p.toRgba(o,h,f,c)}}s.blend=function(b,m){if(c=(255&m.rgba)/255,c===1)return{css:m.css,rgba:m.rgba};const C=m.rgba>>24&255,g=m.rgba>>16&255,E=m.rgba>>8&255,T=b.rgba>>24&255,B=b.rgba>>16&255,O=b.rgba>>8&255;return o=T+Math.round((C-T)*c),h=B+Math.round((g-B)*c),f=O+Math.round((E-O)*c),{css:p.toCss(o,h,f),rgba:p.toRgba(o,h,f)}},s.isOpaque=function(b){return(255&b.rgba)==255},s.ensureContrastRatio=function(b,m,C){const g=i.ensureContrastRatio(b.rgba,m.rgba,C);if(g)return p.toColor(g>>24&255,g>>16&255,g>>8&255)},s.opaque=function(b){const m=(255|b.rgba)>>>0;return[o,h,f]=i.toChannels(m),{css:p.toCss(o,h,f),rgba:m}},s.opacity=d,s.multiplyOpacity=function(b,m){return c=255&b.rgba,d(b,c*m/255)},s.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(v||(t.color=v={})),function(s){let d,b;try{const m=document.createElement("canvas");m.width=1,m.height=1;const C=m.getContext("2d",{willReadFrequently:!0});C&&(d=C,d.globalCompositeOperation="copy",b=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(m){if(m.match(/#[\da-f]{3,8}/i))switch(m.length){case 4:return o=parseInt(m.slice(1,2).repeat(2),16),h=parseInt(m.slice(2,3).repeat(2),16),f=parseInt(m.slice(3,4).repeat(2),16),p.toColor(o,h,f);case 5:return o=parseInt(m.slice(1,2).repeat(2),16),h=parseInt(m.slice(2,3).repeat(2),16),f=parseInt(m.slice(3,4).repeat(2),16),c=parseInt(m.slice(4,5).repeat(2),16),p.toColor(o,h,f,c);case 7:return{css:m,rgba:(parseInt(m.slice(1),16)<<8|255)>>>0};case 9:return{css:m,rgba:parseInt(m.slice(1),16)>>>0}}const C=m.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 o=parseInt(C[1]),h=parseInt(C[2]),f=parseInt(C[3]),c=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),p.toColor(o,h,f,c);if(!d||!b)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=b,d.fillStyle=m,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,h,f,c]=d.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,h,f,c),css:m}}}(y||(t.css=y={})),function(s){function d(b,m,C){const g=b/255,E=m/255,T=C/255;return .2126*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}s.relativeLuminance=function(b){return d(b>>16&255,b>>8&255,255&b)},s.relativeLuminance2=d}(u||(t.rgb=u={})),function(s){function d(m,C,g){const E=m>>24&255,T=m>>16&255,B=m>>8&255;let O=C>>24&255,D=C>>16&255,P=C>>8&255,N=r(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));for(;N<g&&(O>0||D>0||P>0);)O-=Math.max(0,Math.ceil(.1*O)),D-=Math.max(0,Math.ceil(.1*D)),P-=Math.max(0,Math.ceil(.1*P)),N=r(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}function b(m,C,g){const E=m>>24&255,T=m>>16&255,B=m>>8&255;let O=C>>24&255,D=C>>16&255,P=C>>8&255,N=r(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));for(;N<g&&(O<255||D<255||P<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),D=Math.min(255,D+Math.ceil(.1*(255-D))),P=Math.min(255,P+Math.ceil(.1*(255-P))),N=r(u.relativeLuminance2(O,D,P),u.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}s.blend=function(m,C){if(c=(255&C)/255,c===1)return C;const g=C>>24&255,E=C>>16&255,T=C>>8&255,B=m>>24&255,O=m>>16&255,D=m>>8&255;return o=B+Math.round((g-B)*c),h=O+Math.round((E-O)*c),f=D+Math.round((T-D)*c),p.toRgba(o,h,f)},s.ensureContrastRatio=function(m,C,g){const E=u.relativeLuminance(m>>8),T=u.relativeLuminance(C>>8);if(r(E,T)<g){if(T<E){const D=d(m,C,g),P=r(E,u.relativeLuminance(D>>8));if(P<g){const N=b(m,C,g);return P>r(E,u.relativeLuminance(N>>8))?D:N}return D}const B=b(m,C,g),O=r(E,u.relativeLuminance(B>>8));if(O<g){const D=d(m,C,g);return O>r(E,u.relativeLuminance(D>>8))?B:D}return B}},s.reduceLuminance=d,s.increaseLuminance=b,s.toChannels=function(m){return[m>>24&255,m>>16&255,m>>8&255,255&m]}}(i||(t.rgba=i={})),t.toPaddedHex=n,t.contrastRatio=r},8969:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=o(844),f=o(2585),c=o(4348),p=o(7866),v=o(744),y=o(7302),u=o(6975),i=o(8460),n=o(1753),r=o(1480),s=o(7994),d=o(9282),b=o(5435),m=o(5981),C=o(2660);let g=!1;class E extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(B=>{var O;(O=this._onScrollApi)==null||O.fire(B.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(B){for(const O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new y.OptionsService(B)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.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(O=>{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(O=>{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 m.WriteBuffer((O,D)=>this._inputHandler.parse(O,D))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=f.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,v.MINIMUM_COLS),O=Math.max(O,v.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,D){this._bufferService.scrollLines(B,O,D)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)(()=>{for(const O of B)O.dispose()})}}}t.CoreTerminal=E},8460:(R,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=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===o)return void this._listeners.splice(h,1)}}})),this._event}fire(o,h){const f=[];for(let c=0;c<this._listeners.length;c++)f.push(this._listeners[c]);for(let c=0;c<f.length;c++)f[c].call(void 0,o,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(o,h){return o(f=>h.fire(f))},t.runAndSubscribe=function(o,h){return h(void 0),o(f=>h(f))}},5435:function(R,t,o){var h=this&&this.__decorate||function($,x,L,A){var M,F=arguments.length,z=F<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate($,x,L,A);else for(var J=$.length-1;J>=0;J--)(M=$[J])&&(z=(F<3?M(z):F>3?M(x,L,z):M(x,L))||z);return F>3&&z&&Object.defineProperty(x,L,z),z},f=this&&this.__param||function($,x){return function(L,A){x(L,A,$)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const c=o(2584),p=o(7116),v=o(2015),y=o(844),u=o(482),i=o(8437),n=o(8460),r=o(643),s=o(511),d=o(3734),b=o(2585),m=o(1480),C=o(6242),g=o(6351),E=o(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O($,x){if($>24)return x.setWinLines||!1;switch($){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var D;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(t.WindowsOptionsReportType=D={}));let P=0;class N extends y.Disposable{getAttrData(){return this._curAttrData}constructor(x,L,A,M,F,z,J,ee,I=new v.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=L,this._coreService=A,this._logService=M,this._optionsService=F,this._oscLinkService=z,this._coreMouseService=J,this._unicodeService=ee,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._parser.setCsiHandlerFallback((k,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:W.toArray()})}),this._parser.setEscHandlerFallback(k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})}),this._parser.setExecuteHandlerFallback(k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})}),this._parser.setOscHandlerFallback((k,W,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:W,data:H})}),this._parser.setDcsHandlerFallback((k,W,H)=>{W==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:W,payload:H})}),this._parser.setPrintHandler((k,W,H)=>this.print(k,W,H)),this._parser.registerCsiHandler({final:"@"},k=>this.insertChars(k)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},k=>this.scrollLeft(k)),this._parser.registerCsiHandler({final:"A"},k=>this.cursorUp(k)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},k=>this.scrollRight(k)),this._parser.registerCsiHandler({final:"B"},k=>this.cursorDown(k)),this._parser.registerCsiHandler({final:"C"},k=>this.cursorForward(k)),this._parser.registerCsiHandler({final:"D"},k=>this.cursorBackward(k)),this._parser.registerCsiHandler({final:"E"},k=>this.cursorNextLine(k)),this._parser.registerCsiHandler({final:"F"},k=>this.cursorPrecedingLine(k)),this._parser.registerCsiHandler({final:"G"},k=>this.cursorCharAbsolute(k)),this._parser.registerCsiHandler({final:"H"},k=>this.cursorPosition(k)),this._parser.registerCsiHandler({final:"I"},k=>this.cursorForwardTab(k)),this._parser.registerCsiHandler({final:"J"},k=>this.eraseInDisplay(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},k=>this.eraseInDisplay(k,!0)),this._parser.registerCsiHandler({final:"K"},k=>this.eraseInLine(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},k=>this.eraseInLine(k,!0)),this._parser.registerCsiHandler({final:"L"},k=>this.insertLines(k)),this._parser.registerCsiHandler({final:"M"},k=>this.deleteLines(k)),this._parser.registerCsiHandler({final:"P"},k=>this.deleteChars(k)),this._parser.registerCsiHandler({final:"S"},k=>this.scrollUp(k)),this._parser.registerCsiHandler({final:"T"},k=>this.scrollDown(k)),this._parser.registerCsiHandler({final:"X"},k=>this.eraseChars(k)),this._parser.registerCsiHandler({final:"Z"},k=>this.cursorBackwardTab(k)),this._parser.registerCsiHandler({final:"`"},k=>this.charPosAbsolute(k)),this._parser.registerCsiHandler({final:"a"},k=>this.hPositionRelative(k)),this._parser.registerCsiHandler({final:"b"},k=>this.repeatPrecedingCharacter(k)),this._parser.registerCsiHandler({final:"c"},k=>this.sendDeviceAttributesPrimary(k)),this._parser.registerCsiHandler({prefix:">",final:"c"},k=>this.sendDeviceAttributesSecondary(k)),this._parser.registerCsiHandler({final:"d"},k=>this.linePosAbsolute(k)),this._parser.registerCsiHandler({final:"e"},k=>this.vPositionRelative(k)),this._parser.registerCsiHandler({final:"f"},k=>this.hVPosition(k)),this._parser.registerCsiHandler({final:"g"},k=>this.tabClear(k)),this._parser.registerCsiHandler({final:"h"},k=>this.setMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"h"},k=>this.setModePrivate(k)),this._parser.registerCsiHandler({final:"l"},k=>this.resetMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"l"},k=>this.resetModePrivate(k)),this._parser.registerCsiHandler({final:"m"},k=>this.charAttributes(k)),this._parser.registerCsiHandler({final:"n"},k=>this.deviceStatus(k)),this._parser.registerCsiHandler({prefix:"?",final:"n"},k=>this.deviceStatusPrivate(k)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},k=>this.softReset(k)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},k=>this.setCursorStyle(k)),this._parser.registerCsiHandler({final:"r"},k=>this.setScrollRegion(k)),this._parser.registerCsiHandler({final:"s"},k=>this.saveCursor(k)),this._parser.registerCsiHandler({final:"t"},k=>this.windowOptions(k)),this._parser.registerCsiHandler({final:"u"},k=>this.restoreCursor(k)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},k=>this.insertColumns(k)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},k=>this.deleteColumns(k)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},k=>this.selectProtected(k)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},k=>this.requestMode(k,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},k=>this.requestMode(k,!1)),this._parser.setExecuteHandler(c.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(c.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(c.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(c.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(c.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(c.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(c.C1.IND,()=>this.index()),this._parser.setExecuteHandler(c.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(c.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(k=>(this.setTitle(k),this.setIconName(k),!0))),this._parser.registerOscHandler(1,new C.OscHandler(k=>this.setIconName(k))),this._parser.registerOscHandler(2,new C.OscHandler(k=>this.setTitle(k))),this._parser.registerOscHandler(4,new C.OscHandler(k=>this.setOrReportIndexedColor(k))),this._parser.registerOscHandler(8,new C.OscHandler(k=>this.setHyperlink(k))),this._parser.registerOscHandler(10,new C.OscHandler(k=>this.setOrReportFgColor(k))),this._parser.registerOscHandler(11,new C.OscHandler(k=>this.setOrReportBgColor(k))),this._parser.registerOscHandler(12,new C.OscHandler(k=>this.setOrReportCursorColor(k))),this._parser.registerOscHandler(104,new C.OscHandler(k=>this.restoreIndexedColor(k))),this._parser.registerOscHandler(110,new C.OscHandler(k=>this.restoreFgColor(k))),this._parser.registerOscHandler(111,new C.OscHandler(k=>this.restoreBgColor(k))),this._parser.registerOscHandler(112,new C.OscHandler(k=>this.restoreCursorColor(k))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const k in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},()=>this.selectCharset("("+k)),this._parser.registerEscHandler({intermediates:")",final:k},()=>this.selectCharset(")"+k)),this._parser.registerEscHandler({intermediates:"*",final:k},()=>this.selectCharset("*"+k)),this._parser.registerEscHandler({intermediates:"+",final:k},()=>this.selectCharset("+"+k)),this._parser.registerEscHandler({intermediates:"-",final:k},()=>this.selectCharset("-"+k)),this._parser.registerEscHandler({intermediates:".",final:k},()=>this.selectCharset("."+k)),this._parser.registerEscHandler({intermediates:"/",final:k},()=>this.selectCharset("/"+k));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(k=>(this._logService.error("Parsing error: ",k),k)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler((k,W)=>this.requestStatusString(k,W)))}_preserveStack(x,L,A,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=A,this._parseStack.position=M}_logSlowResolvingAsync(x){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([x,new Promise((L,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,L){let A,M=this._activeBuffer.x,F=this._activeBuffer.y,z=0;const J=this._parseStack.paused;if(J){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(A),A;M=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>B&&(z=this._parseStack.position+B)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,k=>String.fromCharCode(k)).join("")}"`),typeof x=="string"?x.split("").map(k=>k.charCodeAt(0)):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(x.length,B))),J||this._dirtyRowTracker.clearRange(),x.length>B)for(let k=z;k<x.length;k+=B){const W=k+B<x.length?k+B:x.length,H=typeof x=="string"?this._stringDecoder.decode(x.substring(k,W),this._parseBuffer):this._utf8Decoder.decode(x.subarray(k,W),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,F,H,k),this._logSlowResolvingAsync(A),A}else if(!J){const k=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,k))return this._preserveStack(M,F,k,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===M&&this._activeBuffer.y===F||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(x,L,A){let M,F;const z=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,W=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-L>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let Z=this._parser.precedingJoinState;for(let q=L;q<A;++q){if(M=x[q],M<127&&z){const ue=z[String.fromCharCode(M)];ue&&(M=ue.charCodeAt(0))}const ie=this._unicodeService.charProperties(M,Z);F=m.UnicodeService.extractWidth(ie);const ce=m.UnicodeService.extractShouldJoin(ie),he=ce?m.UnicodeService.extractWidth(Z):0;if(Z=ie,J&&this._onA11yChar.fire((0,u.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-he>ee){if(I){const ue=H;let te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&H instanceof i.BufferLine&&H.copyCellsFrom(ue,te,0,he,!1);te<ee;)ue.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=ee-1,F===2)continue}if(ce&&this._activeBuffer.x){const ue=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ue,M,F);for(let te=F-he;--te>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(k&&(H.insertCells(this._activeBuffer.x,F-he,this._activeBuffer.getNullCell(W)),H.getWidth(ee-1)===2&&H.setCellFromCodepoint(ee-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,W)),H.setCellFromCodepoint(this._activeBuffer.x++,M,F,W),F>0)for(;--F;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=Z,this._activeBuffer.x<ee&&A-L>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,L){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,L):this._parser.registerCsiHandler(x,A=>!O(A.params[0],this._optionsService.rawOptions.windowOptions)||L(A))}registerDcsHandler(x,L){return this._parser.registerDcsHandler(x,new g.DcsHandler(L))}registerEscHandler(x,L){return this._parser.registerEscHandler(x,L)}registerOscHandler(x,L){return this._parser.registerOscHandler(x,new C.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var x;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&&((x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&x.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const x=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-x),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(x=this._bufferService.cols-1){this._activeBuffer.x=Math.min(x,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(x,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=x,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+L)}cursorUp(x){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,x.params[0]||1)):this._moveCursor(0,x.params[0]||1),!0}cursorForward(x){return this._moveCursor(x.params[0]||1,0),!0}cursorBackward(x){return this._moveCursor(-(x.params[0]||1),0),!0}cursorNextLine(x){return this.cursorDown(x),this._activeBuffer.x=0,!0}cursorPrecedingLine(x){return this.cursorUp(x),this._activeBuffer.x=0,!0}cursorCharAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(x){return this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1),!0}charPosAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(x){return this._moveCursor(x.params[0]||1,0),!0}linePosAbsolute(x){return this._setCursor(this._activeBuffer.x,(x.params[0]||1)-1),!0}vPositionRelative(x){return this._moveCursor(0,x.params[0]||1),!0}hVPosition(x){return this.cursorPosition(x),!0}tabClear(x){const L=x.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const L=x.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,L,A,M=!1,F=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);z.replaceCells(L,A,this._activeBuffer.getNullCell(this._eraseAttrData()),F),M&&(z.isWrapped=!1)}_resetBufferLine(x,L=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),A.isWrapped=!1)}eraseInDisplay(x,L=!1){let A;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);A<this._bufferService.rows;A++)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(x,L=!1){switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;L--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let L=x.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(x){let L=x.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(x.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(x){const L=this._parser.precedingJoinState;if(!L)return!0;const A=x.params[0]||1,M=m.UnicodeService.extractWidth(L),F=this._activeBuffer.x-M,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),J=new Uint32Array(z.length*A);let ee=0;for(let k=0;k<z.length;){const W=z.codePointAt(k)||0;J[ee++]=W,k+=W>65535?2:1}let I=ee;for(let k=1;k<A;++k)J.copyWithin(I,0,ee),I+=ee;return this.print(J,0,I),!0}sendDeviceAttributesPrimary(x){return x.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(x){return x.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),x.params[L]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(x,L){const A=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:F}=this._coreMouseService,z=this._coreService,{buffers:J,cols:ee}=this._bufferService,{active:I,alt:k}=J,W=this._optionsService.rawOptions,H=ce=>ce?1:2,Z=x.params[0];return q=Z,ie=L?Z===2?4:Z===4?H(z.modes.insertMode):Z===12?3:Z===20?H(W.convertEol):0:Z===1?H(A.applicationCursorKeys):Z===3?W.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:Z===6?H(A.origin):Z===7?H(A.wraparound):Z===8?3:Z===9?H(M==="X10"):Z===12?H(W.cursorBlink):Z===25?H(!z.isCursorHidden):Z===45?H(A.reverseWraparound):Z===66?H(A.applicationKeypad):Z===67?4:Z===1e3?H(M==="VT200"):Z===1002?H(M==="DRAG"):Z===1003?H(M==="ANY"):Z===1004?H(A.sendFocus):Z===1005?4:Z===1006?H(F==="SGR"):Z===1015?4:Z===1016?H(F==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?H(I===k):Z===2004?H(A.bracketedPasteMode):0,z.triggerDataEvent(`${c.C0.ESC}[${L?"":"?"}${q};${ie}$y`),!0;var q,ie}_updateAttrColor(x,L,A,M,F){return L===2?(x|=50331648,x&=-16777216,x|=d.AttributeData.fromColorRGB([A,M,F])):L===5&&(x&=-50331904,x|=33554432|255&A),x}_extractColor(x,L,A){const M=[0,0,-1,0,0,0];let F=0,z=0;do{if(M[z+F]=x.params[L+z],x.hasSubParams(L+z)){const J=x.getSubParams(L+z);let ee=0;do M[1]===5&&(F=1),M[z+ee+1+F]=J[ee];while(++ee<J.length&&ee+z+1+F<M.length);break}if(M[1]===5&&z+F>=2||M[1]===2&&z+F>=5)break;M[1]&&(F=1)}while(++z+L<x.length&&z+F<M.length);for(let J=2;J<M.length;++J)M[J]===-1&&(M[J]=0);switch(M[0]){case 38:A.fg=this._updateAttrColor(A.fg,M[1],M[3],M[4],M[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,M[1],M[3],M[4],M[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,M[1],M[3],M[4],M[5])}return z}_processUnderline(x,L){L.extended=L.extended.clone(),(!~x||x>5)&&(x=1),L.extended.underlineStyle=x,L.fg|=268435456,x===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(x){x.fg=i.DEFAULT_ATTR_DATA.fg,x.bg=i.DEFAULT_ATTR_DATA.bg,x.extended=x.extended.clone(),x.extended.underlineStyle=0,x.extended.underlineColor&=-67108864,x.updateExtended()}charAttributes(x){if(x.length===1&&x.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=x.length;let A;const M=this._curAttrData;for(let F=0;F<L;F++)A=x.params[F],A>=30&&A<=37?(M.fg&=-50331904,M.fg|=16777216|A-30):A>=40&&A<=47?(M.bg&=-50331904,M.bg|=16777216|A-40):A>=90&&A<=97?(M.fg&=-50331904,M.fg|=16777224|A-90):A>=100&&A<=107?(M.bg&=-50331904,M.bg|=16777224|A-100):A===0?this._processSGR0(M):A===1?M.fg|=134217728:A===3?M.bg|=67108864:A===4?(M.fg|=268435456,this._processUnderline(x.hasSubParams(F)?x.getSubParams(F)[0]:1,M)):A===5?M.fg|=536870912:A===7?M.fg|=67108864:A===8?M.fg|=1073741824:A===9?M.fg|=2147483648:A===2?M.bg|=134217728:A===21?this._processUnderline(2,M):A===22?(M.fg&=-134217729,M.bg&=-134217729):A===23?M.bg&=-67108865:A===24?(M.fg&=-268435457,this._processUnderline(0,M)):A===25?M.fg&=-536870913:A===27?M.fg&=-67108865:A===28?M.fg&=-1073741825:A===29?M.fg&=2147483647:A===39?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):A===49?(M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?F+=this._extractColor(x,F,M):A===53?M.bg|=1073741824:A===55?M.bg&=-1073741825:A===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):A===100?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${L};${A}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${L};${A}R`)}return!0}softReset(x){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.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(x){const L=x.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const A=L%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(x){const L=x.params[0]||1;let A;return(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(x){if(!O(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(x){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(x){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(x){return this._windowTitle=x,this._onTitleChange.fire(x),!0}setIconName(x){return this._iconName=x,!0}setOrReportIndexedColor(x){const L=[],A=x.split(";");for(;A.length>1;){const M=A.shift(),F=A.shift();if(/^\d+$/.exec(M)){const z=parseInt(M);if(G(z))if(F==="?")L.push({type:0,index:z});else{const J=(0,E.parseColor)(F);J&&L.push({type:1,index:z,color:J})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(x){const L=x.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(x,L){this._getCurrentLinkId()&&this._finishHyperlink();const A=x.split(":");let M;const F=A.findIndex(z=>z.startsWith("id="));return F!==-1&&(M=A[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,L){const A=x.split(";");for(let M=0;M<A.length&&!(L>=this._specialColors.length);++M,++L)if(A[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const F=(0,E.parseColor)(A[M]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}return!0}setOrReportFgColor(x){return this._setOrReportSpecialColor(x,0)}setOrReportBgColor(x){return this._setOrReportSpecialColor(x,1)}setOrReportCursorColor(x){return this._setOrReportSpecialColor(x,2)}restoreIndexedColor(x){if(!x)return this._onColor.fire([{type:2}]),!0;const L=[],A=x.split(";");for(let M=0;M<A.length;++M)if(/^\d+$/.exec(A[M])){const F=parseInt(A[M]);G(F)&&L.push({type:2,index:F})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(x){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(x){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(x){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,p.DEFAULT_CHARSET),!0}selectCharset(x){return x.length!==2?(this.selectDefaultCharset(),!0):(x[0]==="/"||this._charsetService.setgCharset(T[x[0]],p.CHARSETS[x[1]]||p.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 x=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,x,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(x){return this._charsetService.setgLevel(x),!0}screenAlignmentPattern(){const x=new s.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const A=this._activeBuffer.ybase+this._activeBuffer.y+L,M=this._activeBuffer.lines.get(A);M&&(M.fill(x),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,L){const A=this._bufferService.buffer,M=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${F}${c.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,L){this._dirtyRowTracker.markRangeDirty(x,L)}}t.InputHandler=N;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,x){$>x&&(P=$,$=x,x=P),$<this.start&&(this.start=$),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G($){return 0<=$&&$<256}U=h([f(0,b.IBufferService)],U)},844:(R,t)=>{function o(h){for(const f of h)f.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 f=this._disposables.indexOf(h);f!==-1&&this._disposables.splice(f,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var f;this._isDisposed||h===this._value||((f=this._value)==null||f.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=o,t.getDisposeArrayDisposable=function(h){return{dispose:()=>o(h)}}},1505:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,c,p){this._data[f]||(this._data[f]={}),this._data[f][c]=p}get(f,c){return this._data[f]?this._data[f][c]:void 0}clear(){this._data={}}}t.TwoKeyMap=o,t.FourKeyMap=class{constructor(){this._data=new o}set(h,f,c,p,v){this._data.get(h,f)||this._data.set(h,f,new o),this._data.get(h,f).set(c,p,v)}get(h,f,c,p){var v;return(v=this._data.get(h,f))==null?void 0:v.get(c,p)}clear(){this._data.clear()}}},6114:(R,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 o=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.getSafariVersion=function(){if(!t.isSafari)return 0;const f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[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(o)},6106:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let o=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(o=this._search(this._getKey(h)),this._array.splice(o,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const f=this._getKey(h);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===h)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(h){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===h)}forEachByKey(h,f){if(this._array.length!==0&&(o=this._search(h),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===h))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===h)}values(){return[...this._array].values()}_search(h){let f=0,c=this._array.length-1;for(;c>=f;){let p=f+c>>1;const v=this._getKey(this._array[p]);if(v>h)c=p-1;else{if(!(v<h)){for(;p>0&&this._getKey(this._array[p-1])===h;)p--;return p}f=p+1}}return f}}},7226:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let y=0,u=0,i=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),u=Math.max(y,u),n=v.timeRemaining(),1.5*u>n)return i-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-y))}ms`),void this._start();i=n}this.clear()}}class c extends f{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const y=Date.now()+v;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}t.PriorityTaskQueue=c,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:c,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=o(643);t.updateWindowsModeWrappedState=function(f){const c=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),p=c==null?void 0:c.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&p&&(v.isWrapped=p[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&p[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new o;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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=o;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,p=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=p}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=o(6349),f=o(7226),c=o(3734),p=o(8437),v=o(4634),y=o(511),u=o(643),i=o(4863),n=o(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(r,s,d){this._hasScrollback=r,this._optionsService=s,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=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,s){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows}_getCorrectBufferLength(r){if(!this._hasScrollback)return r;const s=r+this._optionsService.rawOptions.scrollback;return s>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(r))}}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(r,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=0;const m=this._getCorrectBufferLength(s);if(m>this.lines.maxLength&&(this.lines.maxLength=m),this.lines.length>0){if(this._cols<r)for(let g=0;g<this.lines.length;g++)b+=+this.lines.get(g).resize(r,d);let C=0;if(this._rows<s)for(let g=this._rows;g<s;g++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,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 p.BufferLine(r,d)));else for(let g=this._rows;g>s;g--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(m<this.lines.maxLength){const g=this.lines.length-m;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=m}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,s-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(r,s),this._cols>r))for(let C=0;C<this.lines.length;C++)b+=+this.lines.get(C).resize(r,d);this._cols=r,this._rows=s,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let r=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,r=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return r}get _isReflowEnabled(){const r=this._optionsService.rawOptions.windowsPty;return r&&r.buildNumber?this._hasScrollback&&r.backend==="conpty"&&r.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(r,s){this._cols!==r&&(r>this._cols?this._reflowLarger(r,s):this._reflowSmaller(r,s))}_reflowLarger(r,s){const d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(d.length>0){const b=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(r,s,b.countRemoved)}}_reflowLargerAdjustViewport(r,s,d){const b=this.getNullCell(p.DEFAULT_ATTR_DATA);let m=d;for(;m-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new p.BufferLine(r,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(r,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA),b=[];let m=0;for(let C=this.lines.length-1;C>=0;C--){let g=this.lines.get(C);if(!g||!g.isWrapped&&g.getTrimmedLength()<=r)continue;const E=[g];for(;g.isWrapped&&C>0;)g=this.lines.get(--C),E.unshift(g);const T=this.ybase+this.y;if(T>=C&&T<C+E.length)continue;const B=E[E.length-1].getTrimmedLength(),O=(0,v.reflowSmallerGetNewLineLengths)(E,this._cols,r),D=O.length-E.length;let P;P=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const N=[];for(let A=0;A<D;A++){const M=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);N.push(M)}N.length>0&&(b.push({start:C+E.length+m,newLines:N}),m+=N.length),E.push(...N);let U=O.length-1,G=O[U];G===0&&(U--,G=O[U]);let $=E.length-D-1,x=B;for(;$>=0;){const A=Math.min(x,G);if(E[U]===void 0)break;if(E[U].copyCellsFrom(E[$],x-A,G-A,A,!0),G-=A,G===0&&(U--,G=O[U]),x-=A,x===0){$--;const M=Math.max($,0);x=(0,v.getWrappedLineTrimmedLength)(E,M,this._cols)}}for(let A=0;A<E.length;A++)O[A]<r&&E[A].setCell(O[A],d);let L=D-P;for(;L-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+m)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+s-1)}if(b.length>0){const C=[],g=[];for(let U=0;U<this.lines.length;U++)g.push(this.lines.get(U));const E=this.lines.length;let T=E-1,B=0,O=b[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+m);let D=0;for(let U=Math.min(this.lines.maxLength-1,E+m-1);U>=0;U--)if(O&&O.start>T+D){for(let G=O.newLines.length-1;G>=0;G--)this.lines.set(U--,O.newLines[G]);U++,C.push({index:T+1,amount:O.newLines.length}),D+=O.newLines.length,O=b[++B]}else this.lines.set(U,g[T--]);let P=0;for(let U=C.length-1;U>=0;U--)C[U].index+=P,this.lines.onInsertEmitter.fire(C[U]),P+=C[U].amount;const N=Math.max(0,E+m-this.lines.maxLength);N>0&&this.lines.onTrimEmitter.fire(N)}}translateBufferLineToString(r,s,d=0,b){const m=this.lines.get(r);return m?m.translateToString(s,d,b):""}getWrappedRangeForLine(r){let s=r,d=r;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}setupTabStops(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.rawOptions.tabStopWidth)this.tabs[r]=!0}prevStop(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r}nextStop(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r}clearMarkers(r){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===r&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].dispose(),this.markers.splice(r--,1);this._isClearing=!1}addMarker(r){const s=new i.Marker(r);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},8437:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=o(3734),f=o(511),c=o(643),p=o(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class y{constructor(i,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);const s=n||f.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let d=0;d<i;++d)this.setCell(d,s);this.length=i}get(i){const n=this._data[3*i+0],r=2097151&n;return[this._data[3*i+1],2097152&n?this._combined[i]:r?(0,p.stringFromCodePoint)(r):"",n>>22,2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):r]}set(i,n){this._data[3*i+1]=n[c.CHAR_DATA_ATTR_INDEX],n[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=n[1],this._data[3*i+0]=2097152|i|n[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=n[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&n}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i]:2097151&n?(0,p.stringFromCodePoint)(2097151&n):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,n){return v=3*i,n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+2],2097152&n.content&&(n.combinedData=this._combined[i]),268435456&n.bg&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){2097152&n.content&&(this._combined[i]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[i]=n.extended),this._data[3*i+0]=n.content,this._data[3*i+1]=n.fg,this._data[3*i+2]=n.bg}setCellFromCodepoint(i,n,r,s){268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=n|r<<22,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}addCodepointToCell(i,n,r){let s=this._data[3*i+0];2097152&s?this._combined[i]+=(0,p.stringFromCodePoint)(n):2097151&s?(this._combined[i]=(0,p.stringFromCodePoint)(2097151&s)+(0,p.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,r&&(s&=-12582913,s|=r<<22),this._data[3*i+0]=s}insertCells(i,n,r){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length-i){const s=new f.CellData;for(let d=this.length-i-n-1;d>=0;--d)this.setCell(i+n+d,this.loadCell(i+d,s));for(let d=0;d<n;++d)this.setCell(i+d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(i,n,r){if(i%=this.length,n<this.length-i){const s=new f.CellData;for(let d=0;d<this.length-i-n;++d)this.setCell(i+d,this.loadCell(i+n+d,s));for(let d=this.length-n;d<this.length;++d)this.setCell(d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,r)}replaceCells(i,n,r,s=!1){if(s)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,r),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.setCell(i++,r)}resize(i,n){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<i;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);const s=Object.keys(this._combined);for(let b=0;b<s.length;b++){const m=parseInt(s[b],10);m>=i&&delete this._combined[m]}const d=Object.keys(this._extendedAttrs);for(let b=0;b<d.length;b++){const m=parseInt(d[b],10);m>=i&&delete this._extendedAttrs[m]}}return this.length=i,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,i);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(const n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(const n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){const i=new y(0);i._data=new Uint32Array(this._data),i.length=this.length;for(const n in this._combined)i._combined[n]=this._combined[n];for(const n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,n,r,s,d){const b=i._data;if(d)for(let C=s-1;C>=0;C--){for(let g=0;g<3;g++)this._data[3*(r+C)+g]=b[3*(n+C)+g];268435456&b[3*(n+C)+2]&&(this._extendedAttrs[r+C]=i._extendedAttrs[n+C])}else for(let C=0;C<s;C++){for(let g=0;g<3;g++)this._data[3*(r+C)+g]=b[3*(n+C)+g];268435456&b[3*(n+C)+2]&&(this._extendedAttrs[r+C]=i._extendedAttrs[n+C])}const m=Object.keys(i._combined);for(let C=0;C<m.length;C++){const g=parseInt(m[C],10);g>=n&&(this._combined[g-n+r]=i._combined[g])}}translateToString(i,n,r,s){n=n??0,r=r??this.length,i&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;n<r;){const b=this._data[3*n+0],m=2097151&b,C=2097152&b?this._combined[n]:m?(0,p.stringFromCodePoint)(m):c.WHITESPACE_CELL_CHAR;if(d+=C,s)for(let g=0;g<C.length;++g)s.push(n);n+=b>>22||1}return s&&s.push(n),d}}t.BufferLine=y},4841:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(o,h){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return h*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(R,t)=>{function o(h,f,c){if(f===h.length-1)return h[f].getTrimmedLength();const p=!h[f].hasContent(c-1)&&h[f].getWidth(c-1)===1,v=h[f+1].getWidth(0)===2;return p&&v?c-1:c}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,f,c,p,v){const y=[];for(let u=0;u<h.length-1;u++){let i=u,n=h.get(++i);if(!n.isWrapped)continue;const r=[h.get(u)];for(;i<h.length&&n.isWrapped;)r.push(n),n=h.get(++i);if(p>=u&&p<i){u+=r.length-1;continue}let s=0,d=o(r,s,f),b=1,m=0;for(;b<r.length;){const g=o(r,b,f),E=g-m,T=c-d,B=Math.min(E,T);r[s].copyCellsFrom(r[b],m,d,B,!1),d+=B,d===c&&(s++,d=0),m+=B,m===g&&(b++,m=0),d===0&&s!==0&&r[s-1].getWidth(c-1)===2&&(r[s].copyCellsFrom(r[s-1],c-1,d++,1,!1),r[s-1].setCell(c-1,v))}r[s].replaceCells(d,c,v);let C=0;for(let g=r.length-1;g>0&&(g>s||r[g].getTrimmedLength()===0);g--)C++;C>0&&(y.push(u+r.length-C),y.push(C)),u+=r.length-1}return y},t.reflowLargerCreateNewLayout=function(h,f){const c=[];let p=0,v=f[p],y=0;for(let u=0;u<h.length;u++)if(v===u){const i=f[++p];h.onDeleteEmitter.fire({index:u-y,amount:i}),u+=i-1,y+=i,v=f[++p]}else c.push(u);return{layout:c,countRemoved:y}},t.reflowLargerApplyNewLayout=function(h,f){const c=[];for(let p=0;p<f.length;p++)c.push(h.get(f[p]));for(let p=0;p<c.length;p++)h.set(p,c[p]);h.length=f.length},t.reflowSmallerGetNewLineLengths=function(h,f,c){const p=[],v=h.map((n,r)=>o(h,r,f)).reduce((n,r)=>n+r);let y=0,u=0,i=0;for(;i<v;){if(v-i<c){p.push(v-i);break}y+=c;const n=o(h,u,f);y>n&&(y-=n,u++);const r=h[u].getWidth(y-1)===2;r&&y--;const s=r?c-1:c;p.push(s),i+=s}return p},t.getWrappedLineTrimmedLength=o},5295:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=o(8460),f=o(844),c=o(9092);class p extends f.Disposable{constructor(y,u){super(),this._optionsService=y,this._bufferService=u,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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(y,u){this._normal.resize(y,u),this._alt.resize(y,u),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}t.BufferSet=p},511:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=o(482),f=o(643),c=o(3734);class p extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const u=new p;return u.setFromCharData(y),u}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(y){this.fg=y[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(y[f.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(y[f.CHAR_DATA_CHAR_INDEX].length===2){const i=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const n=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(i-55296)+n-56320+65536|y[f.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[f.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=y[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=p},643:(R,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:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=o(8460),f=o(844);class c{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=c._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,f.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}t.Marker=c,c._nextId=1},7116:(R,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:(R,t)=>{var o,h,f;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
|
|
8
|
+
`,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""}(o||(t.C0=o={})),function(c){c.PAD="",c.HOP="",c.BPH="",c.NBH="",c.IND="",c.NEL="
",c.SSA="",c.ESA="",c.HTS="",c.HTJ="",c.VTS="",c.PLD="",c.PLU="",c.RI="",c.SS2="",c.SS3="",c.DCS="",c.PU1="",c.PU2="",c.STS="",c.CCH="",c.MW="",c.SPA="",c.EPA="",c.SOS="",c.SGCI="",c.SCI="",c.CSI="",c.ST="",c.OSC="",c.PM="",c.APC=""}(h||(t.C1=h={})),function(c){c.ST=`${o.ESC}\\`}(f||(t.C1_ESCAPED=f={}))},7399:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=o(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(c,p,v,y){const u={type:0,cancel:!1,key:void 0},i=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?u.key=p?h.C0.ESC+"OA":h.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?u.key=p?h.C0.ESC+"OD":h.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?u.key=p?h.C0.ESC+"OC":h.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(u.key=p?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:u.key=c.ctrlKey?"\b":h.C0.DEL,c.altKey&&(u.key=h.C0.ESC+u.key);break;case 9:if(c.shiftKey){u.key=h.C0.ESC+"[Z";break}u.key=h.C0.HT,u.cancel=!0;break;case 13:u.key=c.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,u.cancel=!0;break;case 27:u.key=h.C0.ESC,c.altKey&&(u.key=h.C0.ESC+h.C0.ESC),u.cancel=!0;break;case 37:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"D",u.key===h.C0.ESC+"[1;3D"&&(u.key=h.C0.ESC+(v?"b":"[1;5D"))):u.key=p?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"C",u.key===h.C0.ESC+"[1;3C"&&(u.key=h.C0.ESC+(v?"f":"[1;5C"))):u.key=p?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"A",v||u.key!==h.C0.ESC+"[1;3A"||(u.key=h.C0.ESC+"[1;5A")):u.key=p?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(c.metaKey)break;i?(u.key=h.C0.ESC+"[1;"+(i+1)+"B",v||u.key!==h.C0.ESC+"[1;3B"||(u.key=h.C0.ESC+"[1;5B")):u.key=p?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(u.key=h.C0.ESC+"[2~");break;case 46:u.key=i?h.C0.ESC+"[3;"+(i+1)+"~":h.C0.ESC+"[3~";break;case 36:u.key=i?h.C0.ESC+"[1;"+(i+1)+"H":p?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:u.key=i?h.C0.ESC+"[1;"+(i+1)+"F":p?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:c.shiftKey?u.type=2:c.ctrlKey?u.key=h.C0.ESC+"[5;"+(i+1)+"~":u.key=h.C0.ESC+"[5~";break;case 34:c.shiftKey?u.type=3:c.ctrlKey?u.key=h.C0.ESC+"[6;"+(i+1)+"~":u.key=h.C0.ESC+"[6~";break;case 112:u.key=i?h.C0.ESC+"[1;"+(i+1)+"P":h.C0.ESC+"OP";break;case 113:u.key=i?h.C0.ESC+"[1;"+(i+1)+"Q":h.C0.ESC+"OQ";break;case 114:u.key=i?h.C0.ESC+"[1;"+(i+1)+"R":h.C0.ESC+"OR";break;case 115:u.key=i?h.C0.ESC+"[1;"+(i+1)+"S":h.C0.ESC+"OS";break;case 116:u.key=i?h.C0.ESC+"[15;"+(i+1)+"~":h.C0.ESC+"[15~";break;case 117:u.key=i?h.C0.ESC+"[17;"+(i+1)+"~":h.C0.ESC+"[17~";break;case 118:u.key=i?h.C0.ESC+"[18;"+(i+1)+"~":h.C0.ESC+"[18~";break;case 119:u.key=i?h.C0.ESC+"[19;"+(i+1)+"~":h.C0.ESC+"[19~";break;case 120:u.key=i?h.C0.ESC+"[20;"+(i+1)+"~":h.C0.ESC+"[20~";break;case 121:u.key=i?h.C0.ESC+"[21;"+(i+1)+"~":h.C0.ESC+"[21~";break;case 122:u.key=i?h.C0.ESC+"[23;"+(i+1)+"~":h.C0.ESC+"[23~";break;case 123:u.key=i?h.C0.ESC+"[24;"+(i+1)+"~":h.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(v&&!y||!c.altKey||c.metaKey)!v||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?u.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(u.key=h.C0.US),c.key==="@"&&(u.key=h.C0.NUL)):c.keyCode===65&&(u.type=1);else{const n=f[c.keyCode],r=n==null?void 0:n[c.shiftKey?1:0];if(r)u.key=h.C0.ESC+r;else if(c.keyCode>=65&&c.keyCode<=90){const s=c.ctrlKey?c.keyCode-64:c.keyCode+32;let d=String.fromCharCode(s);c.shiftKey&&(d=d.toUpperCase()),u.key=h.C0.ESC+d}else if(c.keyCode===32)u.key=h.C0.ESC+(c.ctrlKey?h.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let s=c.code.slice(3,4);c.shiftKey||(s=s.toLowerCase()),u.key=h.C0.ESC+s,u.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?u.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?u.key=h.C0.NUL:c.keyCode>=51&&c.keyCode<=55?u.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?u.key=h.C0.DEL:c.keyCode===219?u.key=h.C0.ESC:c.keyCode===220?u.key=h.C0.FS:c.keyCode===221&&(u.key=h.C0.GS)}return u}},482:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},t.utf32ToString=function(o,h=0,f=o.length){let c="";for(let p=h;p<f;++p){let v=o[p];v>65535?(v-=65536,c+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):c+=String.fromCharCode(v)}return c},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,h){const f=o.length;if(!f)return 0;let c=0,p=0;if(this._interim){const v=o.charCodeAt(p++);56320<=v&&v<=57343?h[c++]=1024*(this._interim-55296)+v-56320+65536:(h[c++]=this._interim,h[c++]=v),this._interim=0}for(let v=p;v<f;++v){const y=o.charCodeAt(v);if(55296<=y&&y<=56319){if(++v>=f)return this._interim=y,c;const u=o.charCodeAt(v);56320<=u&&u<=57343?h[c++]=1024*(y-55296)+u-56320+65536:(h[c++]=y,h[c++]=u)}else y!==65279&&(h[c++]=y)}return c}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,h){const f=o.length;if(!f)return 0;let c,p,v,y,u=0,i=0,n=0;if(this.interim[0]){let d=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let m,C=0;for(;(m=63&this.interim[++C])&&C<4;)b<<=6,b|=m;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=g-C;for(;n<E;){if(n>=f)return 0;if(m=o[n++],(192&m)!=128){n--,d=!0;break}this.interim[C++]=m,b<<=6,b|=63&m}d||(g===2?b<128?n--:h[u++]=b:g===3?b<2048||b>=55296&&b<=57343||b===65279||(h[u++]=b):b<65536||b>1114111||(h[u++]=b)),this.interim.fill(0)}const r=f-4;let s=n;for(;s<f;){for(;!(!(s<r)||128&(c=o[s])||128&(p=o[s+1])||128&(v=o[s+2])||128&(y=o[s+3]));)h[u++]=c,h[u++]=p,h[u++]=v,h[u++]=y,s+=4;if(c=o[s++],c<128)h[u++]=c;else if((224&c)==192){if(s>=f)return this.interim[0]=c,u;if(p=o[s++],(192&p)!=128){s--;continue}if(i=(31&c)<<6|63&p,i<128){s--;continue}h[u++]=i}else if((240&c)==224){if(s>=f)return this.interim[0]=c,u;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=f)return this.interim[0]=c,this.interim[1]=p,u;if(v=o[s++],(192&v)!=128){s--;continue}if(i=(15&c)<<12|(63&p)<<6|63&v,i<2048||i>=55296&&i<=57343||i===65279)continue;h[u++]=i}else if((248&c)==240){if(s>=f)return this.interim[0]=c,u;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=f)return this.interim[0]=c,this.interim[1]=p,u;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=f)return this.interim[0]=c,this.interim[1]=p,this.interim[2]=v,u;if(y=o[s++],(192&y)!=128){s--;continue}if(i=(7&c)<<18|(63&p)<<12|(63&v)<<6|63&y,i<65536||i>1114111)continue;h[u++]=i}}return u}}},225:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=o(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],c=[[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 p;t.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let v=0;v<f.length;++v)p.fill(0,f[v][0],f[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?p[v]:function(y,u){let i,n=0,r=u.length-1;if(y<u[0][0]||y>u[r][1])return!1;for(;r>=n;)if(i=n+r>>1,y>u[i][1])n=i+1;else{if(!(y<u[i][0]))return!0;r=i-1}return!1}(v,c)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,y){let u=this.wcwidth(v),i=u===0&&y!==0;if(i){const n=h.UnicodeService.extractWidth(y);n===0?i=!1:n>u&&(u=n)}return h.UnicodeService.createPropertyValue(0,u,i)}}},5981:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=o(8460),f=o(844);class c extends f.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(y),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(y)}_innerWrite(v=0,y=!0){const u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const i=this._writeBuffer[this._bufferOffset],n=this._action(i,y);if(n){const s=d=>Date.now()-u>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(u,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-u>=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=c},5941:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const o=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function f(c,p){const v=c.toString(16),y=v.length<2?"0"+v:v;switch(p){case 4:return v[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}t.parseColor=function(c){if(!c)return;let p=c.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const v=o.exec(p);if(v){const y=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/y*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/y*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),h.exec(p)&&[3,6,9,12].includes(p.length))){const v=p.length/3,y=[0,0,0];for(let u=0;u<3;++u){const i=parseInt(p.slice(v*u,v*u+v),16);y[u]=v===1?i<<4:v===2?i:v===3?i>>4:i>>8}return y}},t.toRgbString=function(c,p=16){const[v,y,u]=c;return`rgb:${f(v,p)}/${f(y,p)}/${f(u,p)}`}},5770:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=o(482),f=o(8742),c=o(5770),p=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(y,u){this._handlers[y]===void 0&&(this._handlers[y]=[]);const i=this._handlers[y];return i.push(u),{dispose:()=>{const n=i.indexOf(u);n!==-1&&i.splice(n,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(y,u){if(this.reset(),this._ident=y,this._active=this._handlers[y]||p,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(y,u,i){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(y,u,i);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(y,u,i))}unhook(y,u=!0){if(this._active.length){let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=u,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(y),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const v=new f.Params;v.addParam(0),t.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=v,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():v,this._data="",this._hitLimit=!1}put(y,u,i){this._hitLimit||(this._data+=(0,h.utf32ToString)(y,u,i),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let u=!1;if(this._hitLimit)u=!1;else if(y&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then(i=>(this._params=v,this._data="",this._hitLimit=!1,i));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=o(844),f=o(8742),c=o(6242),p=o(6351);class v{constructor(n){this.table=new Uint8Array(n)}setDefault(n,r){this.table.fill(n<<4|r)}add(n,r,s,d){this.table[r<<8|n]=s<<4|d}addMany(n,r,s,d){for(let b=0;b<n.length;b++)this.table[r<<8|n[b]]=s<<4|d}}t.TransitionTable=v;const y=160;t.VT500_TRANSITION_TABLE=function(){const i=new v(4095),n=Array.apply(null,Array(256)).map((C,g)=>g),r=(C,g)=>n.slice(C,g),s=r(32,127),d=r(0,24);d.push(25),d.push.apply(d,r(28,32));const b=r(0,14);let m;for(m in i.setDefault(1,0),i.addMany(s,0,2,0),b)i.addMany([24,26,153,154],m,3,0),i.addMany(r(128,144),m,3,0),i.addMany(r(144,152),m,3,0),i.add(156,m,0,0),i.add(27,m,11,1),i.add(157,m,4,8),i.addMany([152,158,159],m,0,7),i.add(155,m,11,3),i.add(144,m,11,9);return i.addMany(d,0,3,0),i.addMany(d,1,3,1),i.add(127,1,0,1),i.addMany(d,8,0,8),i.addMany(d,3,3,3),i.add(127,3,0,3),i.addMany(d,4,3,4),i.add(127,4,0,4),i.addMany(d,6,3,6),i.addMany(d,5,3,5),i.add(127,5,0,5),i.addMany(d,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(r(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(d,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(r(64,127),3,7,0),i.addMany(r(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(r(48,60),4,8,4),i.addMany(r(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(r(32,64),6,0,6),i.add(127,6,0,6),i.addMany(r(64,127),6,0,0),i.addMany(r(32,48),3,9,5),i.addMany(r(32,48),5,9,5),i.addMany(r(48,64),5,0,6),i.addMany(r(64,127),5,7,0),i.addMany(r(32,48),4,9,5),i.addMany(r(32,48),1,9,2),i.addMany(r(32,48),2,9,2),i.addMany(r(48,127),2,10,0),i.addMany(r(48,80),1,10,0),i.addMany(r(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(r(96,127),1,10,0),i.add(80,1,11,9),i.addMany(d,9,0,9),i.add(127,9,0,9),i.addMany(r(28,32),9,0,9),i.addMany(r(32,48),9,9,12),i.addMany(r(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(d,11,0,11),i.addMany(r(32,128),11,0,11),i.addMany(r(28,32),11,0,11),i.addMany(d,10,0,10),i.add(127,10,0,10),i.addMany(r(28,32),10,0,10),i.addMany(r(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(r(32,48),10,9,12),i.addMany(d,12,0,12),i.add(127,12,0,12),i.addMany(r(28,32),12,0,12),i.addMany(r(32,48),12,9,12),i.addMany(r(48,64),12,0,11),i.addMany(r(64,127),12,12,13),i.addMany(r(64,127),10,12,13),i.addMany(r(64,127),9,12,13),i.addMany(d,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(y,0,2,0),i.add(y,8,5,8),i.add(y,6,0,6),i.add(y,11,0,11),i.add(y,13,13,13),i}();class u extends h.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,s,d)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,s)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,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 c.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,r=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<n.intermediates.length;++b){const m=n.intermediates.charCodeAt(b);if(32>m||m>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=m}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(r[0]>d||d>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return s<<=8,s|=d,s}identToString(n){const r=[];for(;n;)r.push(String.fromCharCode(255&n)),n>>=8;return r.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,r){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(r),{dispose:()=>{const b=d.indexOf(r);b!==-1&&d.splice(b,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,r){this._executeHandlers[n.charCodeAt(0)]=r}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,r){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(r),{dispose:()=>{const b=d.indexOf(r);b!==-1&&d.splice(b,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,r){return this._dcsParser.registerHandler(this._identifier(n),r)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,r){return this._oscParser.registerHandler(n,r)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,r,s,d,b){this._parseStack.state=n,this._parseStack.handlers=r,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=b}parse(n,r,s){let d,b=0,m=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 6:if(b=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(b!==24&&b!==26,s),d)return d;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=n[this._parseStack.chunkPos],d=this._oscParser.end(b!==24&&b!==26,s),d)return d;b===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 g=C;g<r;++g){switch(b=n[g],m=this._transitions.table[this.currentState<<8|(b<160?b:y)],m>>4){case 2:for(let D=g+1;;++D){if(D>=r||(b=n[D])<32||b>126&&b<y){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(b=n[D])<32||b>126&&b<y){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(b=n[D])<32||b>126&&b<y){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(b=n[D])<32||b>126&&b<y){this._printHandler(n,g,D),g=D-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|b];let T=E?E.length-1:-1;for(;T>=0&&(d=E[T](this._params),d!==!0);T--)if(d instanceof Promise)return this._preserveStack(3,E,T,m,g),d;T<0&&this._csiHandlerFb(this._collect<<8|b,this._params),this.precedingJoinState=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++g<r&&(b=n[g])>47&&b<60);g--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const B=this._escHandlers[this._collect<<8|b];let O=B?B.length-1:-1;for(;O>=0&&(d=B[O](),d!==!0);O--)if(d instanceof Promise)return this._preserveStack(4,B,O,m,g),d;O<0&&this._escHandlerFb(this._collect<<8|b),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|b,this._params);break;case 13:for(let D=g+1;;++D)if(D>=r||(b=n[D])===24||b===26||b===27||b>127&&b<y){this._dcsParser.put(n,g,D),g=D-1;break}break;case 14:if(d=this._dcsParser.unhook(b!==24&&b!==26),d)return this._preserveStack(6,[],0,m,g),d;b===27&&(m|=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 D=g+1;;D++)if(D>=r||(b=n[D])<32||b>127&&b<y){this._oscParser.put(n,g,D),g=D-1;break}break;case 6:if(d=this._oscParser.end(b!==24&&b!==26),d)return this._preserveStack(5,[],0,m,g),d;b===27&&(m|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&m}}}t.EscapeSequenceParser=u},6242:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=o(5770),f=o(482),c=[];t.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,v){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(v),{dispose:()=>{const u=y.indexOf(v);u!==-1&&y.splice(u,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,v,y){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(p,v,y);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(p,v,y))}start(){this.reset(),this._state=1}put(p,v,y){if(this._state!==3){if(this._state===1)for(;v<y;){const u=p[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&y-v>0&&this._put(p,v,y)}}end(p,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,u=this._active.length-1,i=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,y=v,i=this._stack.fallThrough,this._stack.paused=!1),!i&&y===!1){for(;u>=0&&(y=this._active[u].end(p),y!==!0);u--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,y;u--}for(;u>=0;u--)if(y=this._active[u].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",p);this._active=c,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,v,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(p,v,y),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let v=!1;if(this._hitLimit)v=!1;else if(p&&(v=this._handler(this._data),v instanceof Promise))return v.then(y=>(this._data="",this._hitLimit=!1,y));return this._data="",this._hitLimit=!1,v}}},8742:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const o=2147483647;class h{static fromArray(c){const p=new h;if(!c.length)return p;for(let v=Array.isArray(c[0])?1:0;v<c.length;++v){const y=c[v];if(Array.isArray(y))for(let u=0;u<y.length;++u)p.addSubParam(y[u]);else p.addParam(y)}return p}constructor(c=32,p=32){if(this.maxLength=c,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new h(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let p=0;p<this.length;++p){c.push(this.params[p]);const v=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-v>0&&c.push(Array.prototype.slice.call(this._subParams,v,y))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>o?o:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>o?o:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const p=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];return v-p>0?this._subParams.subarray(p,v):null}getSubParamsAll(){const c={};for(let p=0;p<this.length;++p){const v=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-v>0&&(c[p]=this._subParams.slice(v,y))}return c}addDigit(c){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,y=v[p-1];v[p-1]=~y?Math.min(10*y+c,o):c}}t.Params=h},5741:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,h){const f={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(f),h.dispose=()=>this._wrappedAddonDispose(f),h.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let h=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){h=f;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(h,1)}}},8771:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=o(3785),f=o(511);t.BufferApiView=class{constructor(c,p){this._buffer=c,this.type=p}init(c){return this._buffer=c,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(c){const p=this._buffer.lines.get(c);if(p)return new h.BufferLineApiView(p)}getNullCell(){return new f.CellData}}},3785:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=o(511);t.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,c){if(!(f<0||f>=this._line.length))return c?(this._line.loadCell(f,c),c):this._line.loadCell(f,new h.CellData)}translateToString(f,c,p){return this._line.translateToString(f,c,p)}}},8285:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=o(8771),f=o(8460),c=o(844);class p extends c.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new f.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=p},7975:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,h){return this._core.registerCsiHandler(o,f=>h(f.toArray()))}addCsiHandler(o,h){return this.registerCsiHandler(o,h)}registerDcsHandler(o,h){return this._core.registerDcsHandler(o,(f,c)=>h(f,c.toArray()))}addDcsHandler(o,h){return this.registerDcsHandler(o,h)}registerEscHandler(o,h){return this._core.registerEscHandler(o,h)}addEscHandler(o,h){return this.registerEscHandler(o,h)}registerOscHandler(o,h){return this._core.registerOscHandler(o,h)}addOscHandler(o,h){return this.registerOscHandler(o,h)}}},7090:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(R,t,o){var h=this&&this.__decorate||function(i,n,r,s){var d,b=arguments.length,m=b<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,n,r,s);else for(var C=i.length-1;C>=0;C--)(d=i[C])&&(m=(b<3?d(m):b>3?d(n,r,m):d(n,r))||m);return b>3&&m&&Object.defineProperty(n,r,m),m},f=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const c=o(8460),p=o(844),v=o(5295),y=o(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let u=t.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(i,this))}resize(i,n){this.cols=i,this.rows=n,this.buffers.resize(i,n),this._onResize.fire({cols:i,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,n=!1){const r=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===i.fg&&s.getBg(0)===i.bg||(s=r.getBlankLine(i,n),this._cachedBlankLine=s),s.isWrapped=n;const d=r.ybase+r.scrollTop,b=r.ybase+r.scrollBottom;if(r.scrollTop===0){const m=r.lines.isFull;b===r.lines.length-1?m?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(b+1,0,s.clone()),m?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const m=b-d+1;r.lines.shiftElements(d+1,m-1,-1),r.lines.set(b,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(i,n,r){const s=this.buffer;if(i<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else i+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),d!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};t.BufferService=u=h([f(0,y.IOptionsService)],u)},7994:(R,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(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,h){this._charsets[o]=h,this.glevel===o&&(this.charset=h)}}},1753:function(R,t,o){var h=this&&this.__decorate||function(s,d,b,m){var C,g=arguments.length,E=g<3?d:m===null?m=Object.getOwnPropertyDescriptor(d,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,b,m);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(E=(g<3?C(E):g>3?C(d,b,E):C(d,b))||E);return g>3&&E&&Object.defineProperty(d,b,E),E},f=this&&this.__param||function(s,d){return function(b,m){d(b,m,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const c=o(2585),p=o(8460),v=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function u(s,d){let b=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(b|=64,b|=s.action):(b|=3&s.button,4&s.button&&(b|=64),8&s.button&&(b|=128),s.action===32?b|=32:s.action!==0||d||(b|=3)),b}const i=String.fromCharCode,n={DEFAULT:s=>{const d=[u(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${i(d[0])}${i(d[1])}${i(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.x};${s.y}${d}`}};let r=t.CoreMouseService=class extends v.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const b of Object.keys(y))this.addProtocol(b,y[b]);for(const b of Object.keys(n))this.addEncoding(b,n[b]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,b){if(b){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=r=h([f(0,c.IBufferService),f(1,c.ICoreService)],r)},6975:function(R,t,o){var h=this&&this.__decorate||function(r,s,d,b){var m,C=arguments.length,g=C<3?s:b===null?b=Object.getOwnPropertyDescriptor(s,d):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,b);else for(var E=r.length-1;E>=0;E--)(m=r[E])&&(g=(C<3?m(g):C>3?m(s,d,g):m(s,d))||g);return C>3&&g&&Object.defineProperty(s,d,g),g},f=this&&this.__param||function(r,s){return function(d,b){s(d,b,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const c=o(1439),p=o(8460),v=o(844),y=o(2585),u=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=t.CoreService=class extends v.Disposable{constructor(r,s,d){super(),this._bufferService=r,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(u),this.decPrivateModes=(0,c.clone)(i)}reset(){this.modes=(0,c.clone)(u),this.decPrivateModes=(0,c.clone)(i)}triggerDataEvent(r,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,()=>r.split("").map(b=>b.charCodeAt(0))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,()=>r.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(r))}};t.CoreService=n=h([f(0,y.IBufferService),f(1,y.ILogService),f(2,y.IOptionsService)],n)},9074:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=o(8055),f=o(8460),c=o(844),p=o(6106);let v=0,y=0;class u extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList(r=>r==null?void 0:r.marker.line),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)(()=>this.reset()))}registerDecoration(r){if(r.marker.isDisposed)return;const s=new i(r);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const r of this._decorations.values())r.dispose();this._decorations.clear()}*getDecorationsAtCell(r,s,d){let b=0,m=0;for(const C of this._decorations.getKeyIterator(s))b=C.options.x??0,m=b+(C.options.width??1),r>=b&&r<m&&(!d||(C.options.layer??"bottom")===d)&&(yield C)}forEachDecorationAtCell(r,s,d,b){this._decorations.forEachByKey(s,m=>{v=m.options.x??0,y=v+(m.options.width??1),r>=v&&r<y&&(!d||(m.options.layer??"bottom")===d)&&b(m)})}}t.DecorationService=u;class i extends c.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(r){super(),this.options=r,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=r.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=o(2585),f=o(8343);class c{constructor(...v){this._entries=new Map;for(const[y,u]of v)this.set(y,u)}set(v,y){const u=this._entries.get(v);return this._entries.set(v,y),u}forEach(v){for(const[y,u]of this._entries.entries())v(y,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}t.ServiceCollection=c,t.InstantiationService=class{constructor(){this._services=new c,this._services.set(h.IInstantiationService,this)}setService(p,v){this._services.set(p,v)}getService(p){return this._services.get(p)}createInstance(p,...v){const y=(0,f.getServiceDependencies)(p).sort((n,r)=>n.index-r.index),u=[];for(const n of y){const r=this._services.get(n.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${n.id}.`);u.push(r)}const i=y.length>0?y[0].index:v.length;if(v.length!==i)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${i+1} conflicts with ${v.length} static arguments`);return new p(...v,...u)}}},7866:function(R,t,o){var h=this&&this.__decorate||function(i,n,r,s){var d,b=arguments.length,m=b<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,n,r,s);else for(var C=i.length-1;C>=0;C--)(d=i[C])&&(m=(b<3?d(m):b>3?d(n,r,m):d(n,r))||m);return b>3&&m&&Object.defineProperty(n,r,m),m},f=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const c=o(844),p=o(2585),v={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,u=t.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let n=0;n<i.length;n++)typeof i[n]=="function"&&(i[n]=i[n]())}_log(i,n,r){this._evalLazyOptionalParams(r),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...r)}trace(i,...n){var r;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,i,n)}debug(i,...n){var r;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,i,n)}info(i,...n){var r;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,i,n)}warn(i,...n){var r;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,i,n)}error(i,...n){var r;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,i,n)}};t.LogService=u=h([f(0,p.IOptionsService)],u),t.setTraceLogger=function(i){y=i},t.traceCall=function(i,n,r){if(typeof r.value!="function")throw new Error("not supported");const s=r.value;r.value=function(...d){if(y.logLevel!==p.LogLevelEnum.TRACE)return s.apply(this,d);y.trace(`GlyphRenderer#${s.name}(${d.map(m=>JSON.stringify(m)).join(", ")})`);const b=s.apply(this,d);return y.trace(`GlyphRenderer#${s.name} return`,b),b}}},7302:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=o(8460),f=o(844),c=o(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:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends f.Disposable{constructor(u){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const n in u)if(n in i)try{const r=u[n];i[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,f.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(u,i){return this.onOptionChange(n=>{n===u&&i(this.rawOptions[u])})}onMultipleOptionChange(u,i){return this.onOptionChange(n=>{u.indexOf(n)!==-1&&i()})}_setupOptions(){const u=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,r)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const r={get:u.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(u,i){switch(u){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[u]),!function(n){return n==="block"||n==="underline"||n==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${u}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=p.includes(i)?i:t.DEFAULT_OPTIONS[u];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${u} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${u} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=v},2660:function(R,t,o){var h=this&&this.__decorate||function(v,y,u,i){var n,r=arguments.length,s=r<3?y:i===null?i=Object.getOwnPropertyDescriptor(y,u):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,y,u,i);else for(var d=v.length-1;d>=0;d--)(n=v[d])&&(s=(r<3?n(s):r>3?n(y,u,s):n(y,u))||s);return r>3&&s&&Object.defineProperty(y,u,s),s},f=this&&this.__param||function(v,y){return function(u,i){y(u,i,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const c=o(2585);let p=t.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const y=this._bufferService.buffer;if(v.id===void 0){const d=y.addMarker(y.ybase+y.y),b={data:v,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(b,d)),this._dataByLinkId.set(b.id,b),b.id}const u=v,i=this._getEntryIdKey(u),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,y.ybase+y.y),n.id;const r=y.addMarker(y.ybase+y.y),s={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(s,r)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,y){const u=this._dataByLinkId.get(v);if(u&&u.lines.every(i=>i.line!==y)){const i=this._bufferService.buffer.addMarker(y);u.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(u,i))}}getLinkData(v){var y;return(y=this._dataByLinkId.get(v))==null?void 0:y.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,y){const u=v.lines.indexOf(y);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};t.OscLinkService=p=h([f(0,c.IBufferService)],p)},8343:(R,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const o="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(f){return f[h]||[]},t.createDecorator=function(f){if(t.serviceRegistry.has(f))return t.serviceRegistry.get(f);const c=function(p,v,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,i,n){i[o]===i?i[h].push({id:u,index:n}):(i[h]=[{id:u,index:n}],i[o]=i)})(c,p,y)};return c.toString=()=>f,t.serviceRegistry.set(f,c),c}},2585:(R,t,o)=>{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=o(8343);var f;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(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"}(f||(t.LogLevelEnum=f={})),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:(R,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=o(8460),f=o(225);class c{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,y,u=!1){return(16777215&v)<<3|(3&y)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let y=0,u=0;const i=v.length;for(let n=0;n<i;++n){let r=v.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return y+this.wcwidth(r);const b=v.charCodeAt(n);56320<=b&&b<=57343?r=1024*(r-55296)+b-56320+65536:y+=this.wcwidth(b)}const s=this.charProperties(r,u);let d=c.extractWidth(s);c.extractShouldJoin(s)&&(d-=c.extractWidth(u)),y+=d,u=s}return y}charProperties(v,y){return this._activeProvider.charProperties(v,y)}}t.UnicodeService=c}},_={};function S(R){var t=_[R];if(t!==void 0)return t.exports;var o=_[R]={exports:{}};return a[R].call(o.exports,o,o.exports,S),o.exports}var w={};return(()=>{var R=w;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;const t=S(9042),o=S(3236),h=S(844),f=S(5741),c=S(8285),p=S(7975),v=S(7090),y=["cols","rows"];class u extends h.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};const r=d=>this._core.options[d],s=(d,b)=>{this._checkReadonlyOptions(d),this._core.options[d]=b};for(const d in this._core.options){const b={get:r.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,b)}}_checkReadonlyOptions(n){if(y.includes(n))throw new Error(`Option "${n}" 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 p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=this._core.coreService.decPrivateModes;let r="none";switch(this._core.coreMouseService.activeProtocol){case"X10":r="x10";break;case"VT200":r="vt200";break;case"DRAG":r="drag";break;case"ANY":r="any"}return{applicationCursorKeysMode:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const r in n)this._publicOptions[r]=n[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,r=!0){this._core.input(n,r)}resize(n,r){this._verifyIntegers(n,r),this._core.resize(n,r)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,r,s){this._verifyIntegers(n,r,s),this._core.select(n,r,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,r){this._verifyIntegers(n,r),this._core.selectLines(n,r)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,r){this._core.write(n,r)}writeln(n,r){this._core.write(n),this._core.write(`\r
|
|
9
|
+
`,r)}paste(n){this._core.paste(n)}refresh(n,r){this._verifyIntegers(n,r),this._core.refresh(n,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const r of n)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const r of n)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}R.Terminal=u})(),w})())})(hr);var ys=hr.exports,ne;(function(l){l.assertEqual=S=>S;function e(S){}l.assertIs=e;function a(S){throw new Error}l.assertNever=a,l.arrayToEnum=S=>{const w={};for(const R of S)w[R]=R;return w},l.getValidEnumValues=S=>{const w=l.objectKeys(S).filter(t=>typeof S[S[t]]!="number"),R={};for(const t of w)R[t]=S[t];return l.objectValues(R)},l.objectValues=S=>l.objectKeys(S).map(function(w){return S[w]}),l.objectKeys=typeof Object.keys=="function"?S=>Object.keys(S):S=>{const w=[];for(const R in S)Object.prototype.hasOwnProperty.call(S,R)&&w.push(R);return w},l.find=(S,w)=>{for(const R of S)if(w(R))return R},l.isInteger=typeof Number.isInteger=="function"?S=>Number.isInteger(S):S=>typeof S=="number"&&isFinite(S)&&Math.floor(S)===S;function _(S,w=" | "){return S.map(R=>typeof R=="string"?`'${R}'`:R).join(w)}l.joinValues=_,l.jsonStringifyReplacer=(S,w)=>typeof w=="bigint"?w.toString():w})(ne||(ne={}));var Mt;(function(l){l.mergeShapes=(e,a)=>({...e,...a})})(Mt||(Mt={}));const K=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Le=l=>{switch(typeof l){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(l)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(l)?K.array:l===null?K.null:l.then&&typeof l.then=="function"&&l.catch&&typeof l.catch=="function"?K.promise:typeof Map<"u"&&l instanceof Map?K.map:typeof Set<"u"&&l instanceof Set?K.set:typeof Date<"u"&&l instanceof Date?K.date:K.object;default:return K.unknown}},j=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Cs=l=>JSON.stringify(l,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{constructor(e){super(),this.issues=[],this.addIssue=_=>{this.issues=[...this.issues,_]},this.addIssues=(_=[])=>{this.issues=[...this.issues,..._]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const a=e||function(w){return w.message},_={_errors:[]},S=w=>{for(const R of w.issues)if(R.code==="invalid_union")R.unionErrors.map(S);else if(R.code==="invalid_return_type")S(R.returnTypeError);else if(R.code==="invalid_arguments")S(R.argumentsError);else if(R.path.length===0)_._errors.push(a(R));else{let t=_,o=0;for(;o<R.path.length;){const h=R.path[o];o===R.path.length-1?(t[h]=t[h]||{_errors:[]},t[h]._errors.push(a(R))):t[h]=t[h]||{_errors:[]},t=t[h],o++}}};return S(this),_}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},_=[];for(const S of this.issues)S.path.length>0?(a[S.path[0]]=a[S.path[0]]||[],a[S.path[0]].push(e(S))):_.push(e(S));return{formErrors:_,fieldErrors:a}}get formErrors(){return this.flatten()}}fe.create=l=>new fe(l);const We=(l,e)=>{let a;switch(l.code){case j.invalid_type:l.received===K.undefined?a="Required":a=`Expected ${l.expected}, received ${l.received}`;break;case j.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(l.expected,ne.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:a=`Unrecognized key(s) in object: ${ne.joinValues(l.keys,", ")}`;break;case j.invalid_union:a="Invalid input";break;case j.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ne.joinValues(l.options)}`;break;case j.invalid_enum_value:a=`Invalid enum value. Expected ${ne.joinValues(l.options)}, received '${l.received}'`;break;case j.invalid_arguments:a="Invalid function arguments";break;case j.invalid_return_type:a="Invalid function return type";break;case j.invalid_date:a="Invalid date";break;case j.invalid_string:typeof l.validation=="object"?"includes"in l.validation?(a=`Invalid input: must include "${l.validation.includes}"`,typeof l.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${l.validation.position}`)):"startsWith"in l.validation?a=`Invalid input: must start with "${l.validation.startsWith}"`:"endsWith"in l.validation?a=`Invalid input: must end with "${l.validation.endsWith}"`:ne.assertNever(l.validation):l.validation!=="regex"?a=`Invalid ${l.validation}`:a="Invalid";break;case j.too_small:l.type==="array"?a=`Array must contain ${l.exact?"exactly":l.inclusive?"at least":"more than"} ${l.minimum} element(s)`:l.type==="string"?a=`String must contain ${l.exact?"exactly":l.inclusive?"at least":"over"} ${l.minimum} character(s)`:l.type==="number"?a=`Number must be ${l.exact?"exactly equal to ":l.inclusive?"greater than or equal to ":"greater than "}${l.minimum}`:l.type==="date"?a=`Date must be ${l.exact?"exactly equal to ":l.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(l.minimum))}`:a="Invalid input";break;case j.too_big:l.type==="array"?a=`Array must contain ${l.exact?"exactly":l.inclusive?"at most":"less than"} ${l.maximum} element(s)`:l.type==="string"?a=`String must contain ${l.exact?"exactly":l.inclusive?"at most":"under"} ${l.maximum} character(s)`:l.type==="number"?a=`Number must be ${l.exact?"exactly":l.inclusive?"less than or equal to":"less than"} ${l.maximum}`:l.type==="bigint"?a=`BigInt must be ${l.exact?"exactly":l.inclusive?"less than or equal to":"less than"} ${l.maximum}`:l.type==="date"?a=`Date must be ${l.exact?"exactly":l.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(l.maximum))}`:a="Invalid input";break;case j.custom:a="Invalid input";break;case j.invalid_intersection_types:a="Intersection results could not be merged";break;case j.not_multiple_of:a=`Number must be a multiple of ${l.multipleOf}`;break;case j.not_finite:a="Number must be finite";break;default:a=e.defaultError,ne.assertNever(l)}return{message:a}};let dr=We;function ws(l){dr=l}function mt(){return dr}const bt=l=>{const{data:e,path:a,errorMaps:_,issueData:S}=l,w=[...a,...S.path||[]],R={...S,path:w};if(S.message!==void 0)return{...S,path:w,message:S.message};let t="";const o=_.filter(h=>!!h).slice().reverse();for(const h of o)t=h(R,{data:e,defaultError:t}).message;return{...S,path:w,message:t}},Es=[];function V(l,e){const a=mt(),_=bt({issueData:e,data:l.data,path:l.path,errorMaps:[l.common.contextualErrorMap,l.schemaErrorMap,a,a===We?void 0:We].filter(S=>!!S)});l.common.issues.push(_)}class le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const _=[];for(const S of a){if(S.status==="aborted")return Q;S.status==="dirty"&&e.dirty(),_.push(S.value)}return{status:e.value,value:_}}static async mergeObjectAsync(e,a){const _=[];for(const S of a){const w=await S.key,R=await S.value;_.push({key:w,value:R})}return le.mergeObjectSync(e,_)}static mergeObjectSync(e,a){const _={};for(const S of a){const{key:w,value:R}=S;if(w.status==="aborted"||R.status==="aborted")return Q;w.status==="dirty"&&e.dirty(),R.status==="dirty"&&e.dirty(),w.value!=="__proto__"&&(typeof R.value<"u"||S.alwaysSet)&&(_[w.value]=R.value)}return{status:e.value,value:_}}}const Q=Object.freeze({status:"aborted"}),Ne=l=>({status:"dirty",value:l}),de=l=>({status:"valid",value:l}),It=l=>l.status==="aborted",Pt=l=>l.status==="dirty",Xe=l=>l.status==="valid",Qe=l=>typeof Promise<"u"&&l instanceof Promise;function St(l,e,a,_){if(typeof e=="function"?l!==e||!_:!e.has(l))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(l)}function ur(l,e,a,_,S){if(typeof e=="function"?l!==e||!S:!e.has(l))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(l,a),a}var Y;(function(l){l.errToObj=e=>typeof e=="string"?{message:e}:e||{},l.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));var Ge,Ye;class ye{constructor(e,a,_,S){this._cachedPath=[],this.parent=e,this.data=a,this._path=_,this._key=S}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Zt=(l,e)=>{if(Xe(e))return{success:!0,data:e.value};if(!l.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new fe(l.common.issues);return this._error=a,this._error}}};function re(l){if(!l)return{};const{errorMap:e,invalid_type_error:a,required_error:_,description:S}=l;if(e&&(a||_))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:S}:{errorMap:(R,t)=>{var o,h;const{message:f}=l;return R.code==="invalid_enum_value"?{message:f??t.defaultError}:typeof t.data>"u"?{message:(o=f??_)!==null&&o!==void 0?o:t.defaultError}:R.code!=="invalid_type"?{message:t.defaultError}:{message:(h=f??a)!==null&&h!==void 0?h:t.defaultError}},description:S}}class se{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Le(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:Le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:Le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Qe(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const _=this.safeParse(e,a);if(_.success)return _.data;throw _.error}safeParse(e,a){var _;const S={common:{issues:[],async:(_=a==null?void 0:a.async)!==null&&_!==void 0?_:!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)},w=this._parseSync({data:e,path:S.path,parent:S});return Zt(S,w)}async parseAsync(e,a){const _=await this.safeParseAsync(e,a);if(_.success)return _.data;throw _.error}async safeParseAsync(e,a){const _={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)},S=this._parse({data:e,path:_.path,parent:_}),w=await(Qe(S)?S:Promise.resolve(S));return Zt(_,w)}refine(e,a){const _=S=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(S):a;return this._refinement((S,w)=>{const R=e(S),t=()=>w.addIssue({code:j.custom,..._(S)});return typeof Promise<"u"&&R instanceof Promise?R.then(o=>o?!0:(t(),!1)):R?!0:(t(),!1)})}refinement(e,a){return this._refinement((_,S)=>e(_)?!0:(S.addIssue(typeof a=="function"?a(_,S):a),!1))}_refinement(e){return new me({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Se.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this,this._def)}promise(){return Ue.create(this,this._def)}or(e){return st.create([this,e],this._def)}and(e){return it.create(this,e,this._def)}transform(e){return new me({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ht({...re(this._def),innerType:this,defaultValue:a,typeName:X.ZodDefault})}brand(){return new Ft({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new lt({...re(this._def),innerType:this,catchValue:a,typeName:X.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return ut.create(this,e)}readonly(){return dt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xs=/^c[^\s-]{8,}$/i,ks=/^[0-9a-z]+$/,Rs=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ls=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ds=/^[a-z0-9_-]{21}$/i,Ts=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,As=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Bs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bt;const Os=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ms=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Is=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ps=new RegExp(`^${fr}$`);function _r(l){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return l.precision?e=`${e}\\.\\d{${l.precision}}`:l.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Hs(l){return new RegExp(`^${_r(l)}$`)}function pr(l){let e=`${fr}T${_r(l)}`;const a=[];return a.push(l.local?"Z?":"Z"),l.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function Ns(l,e){return!!((e==="v4"||!e)&&Os.test(l)||(e==="v6"||!e)&&Ms.test(l))}class ge extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.string,received:w.parsedType}),Q}const _=new le;let S;for(const w of this._def.checks)if(w.kind==="min")e.data.length<w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_small,minimum:w.value,type:"string",inclusive:!0,exact:!1,message:w.message}),_.dirty());else if(w.kind==="max")e.data.length>w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_big,maximum:w.value,type:"string",inclusive:!0,exact:!1,message:w.message}),_.dirty());else if(w.kind==="length"){const R=e.data.length>w.value,t=e.data.length<w.value;(R||t)&&(S=this._getOrReturnCtx(e,S),R?V(S,{code:j.too_big,maximum:w.value,type:"string",inclusive:!0,exact:!0,message:w.message}):t&&V(S,{code:j.too_small,minimum:w.value,type:"string",inclusive:!0,exact:!0,message:w.message}),_.dirty())}else if(w.kind==="email")As.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"email",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="emoji")Bt||(Bt=new RegExp(Bs,"u")),Bt.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"emoji",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="uuid")Ls.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"uuid",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="nanoid")Ds.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"nanoid",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="cuid")xs.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"cuid",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="cuid2")ks.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"cuid2",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="ulid")Rs.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"ulid",code:j.invalid_string,message:w.message}),_.dirty());else if(w.kind==="url")try{new URL(e.data)}catch{S=this._getOrReturnCtx(e,S),V(S,{validation:"url",code:j.invalid_string,message:w.message}),_.dirty()}else w.kind==="regex"?(w.regex.lastIndex=0,w.regex.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"regex",code:j.invalid_string,message:w.message}),_.dirty())):w.kind==="trim"?e.data=e.data.trim():w.kind==="includes"?e.data.includes(w.value,w.position)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:{includes:w.value,position:w.position},message:w.message}),_.dirty()):w.kind==="toLowerCase"?e.data=e.data.toLowerCase():w.kind==="toUpperCase"?e.data=e.data.toUpperCase():w.kind==="startsWith"?e.data.startsWith(w.value)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:{startsWith:w.value},message:w.message}),_.dirty()):w.kind==="endsWith"?e.data.endsWith(w.value)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:{endsWith:w.value},message:w.message}),_.dirty()):w.kind==="datetime"?pr(w).test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:"datetime",message:w.message}),_.dirty()):w.kind==="date"?Ps.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:"date",message:w.message}),_.dirty()):w.kind==="time"?Hs(w).test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{code:j.invalid_string,validation:"time",message:w.message}),_.dirty()):w.kind==="duration"?Ts.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"duration",code:j.invalid_string,message:w.message}),_.dirty()):w.kind==="ip"?Ns(e.data,w.version)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"ip",code:j.invalid_string,message:w.message}),_.dirty()):w.kind==="base64"?Is.test(e.data)||(S=this._getOrReturnCtx(e,S),V(S,{validation:"base64",code:j.invalid_string,message:w.message}),_.dirty()):ne.assertNever(w);return{status:_.value,value:e.data}}_regex(e,a,_){return this.refinement(S=>e.test(S),{validation:a,code:j.invalid_string,...Y.errToObj(_)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}datetime(e){var a,_;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(a=e==null?void 0:e.offset)!==null&&a!==void 0?a:!1,local:(_=e==null?void 0:e.local)!==null&&_!==void 0?_:!1,...Y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...Y.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...Y.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...Y.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...Y.errToObj(a)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ge.create=l=>{var e;return new ge({checks:[],typeName:X.ZodString,coerce:(e=l==null?void 0:l.coerce)!==null&&e!==void 0?e:!1,...re(l)})};function Fs(l,e){const a=(l.toString().split(".")[1]||"").length,_=(e.toString().split(".")[1]||"").length,S=a>_?a:_,w=parseInt(l.toFixed(S).replace(".","")),R=parseInt(e.toFixed(S).replace(".",""));return w%R/Math.pow(10,S)}class De extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.number,received:w.parsedType}),Q}let _;const S=new le;for(const w of this._def.checks)w.kind==="int"?ne.isInteger(e.data)||(_=this._getOrReturnCtx(e,_),V(_,{code:j.invalid_type,expected:"integer",received:"float",message:w.message}),S.dirty()):w.kind==="min"?(w.inclusive?e.data<w.value:e.data<=w.value)&&(_=this._getOrReturnCtx(e,_),V(_,{code:j.too_small,minimum:w.value,type:"number",inclusive:w.inclusive,exact:!1,message:w.message}),S.dirty()):w.kind==="max"?(w.inclusive?e.data>w.value:e.data>=w.value)&&(_=this._getOrReturnCtx(e,_),V(_,{code:j.too_big,maximum:w.value,type:"number",inclusive:w.inclusive,exact:!1,message:w.message}),S.dirty()):w.kind==="multipleOf"?Fs(e.data,w.value)!==0&&(_=this._getOrReturnCtx(e,_),V(_,{code:j.not_multiple_of,multipleOf:w.value,message:w.message}),S.dirty()):w.kind==="finite"?Number.isFinite(e.data)||(_=this._getOrReturnCtx(e,_),V(_,{code:j.not_finite,message:w.message}),S.dirty()):ne.assertNever(w);return{status:S.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,_,S){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:_,message:Y.toString(S)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const _ of this._def.checks){if(_.kind==="finite"||_.kind==="int"||_.kind==="multipleOf")return!0;_.kind==="min"?(a===null||_.value>a)&&(a=_.value):_.kind==="max"&&(e===null||_.value<e)&&(e=_.value)}return Number.isFinite(a)&&Number.isFinite(e)}}De.create=l=>new De({checks:[],typeName:X.ZodNumber,coerce:(l==null?void 0:l.coerce)||!1,...re(l)});class Te extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==K.bigint){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.bigint,received:w.parsedType}),Q}let _;const S=new le;for(const w of this._def.checks)w.kind==="min"?(w.inclusive?e.data<w.value:e.data<=w.value)&&(_=this._getOrReturnCtx(e,_),V(_,{code:j.too_small,type:"bigint",minimum:w.value,inclusive:w.inclusive,message:w.message}),S.dirty()):w.kind==="max"?(w.inclusive?e.data>w.value:e.data>=w.value)&&(_=this._getOrReturnCtx(e,_),V(_,{code:j.too_big,type:"bigint",maximum:w.value,inclusive:w.inclusive,message:w.message}),S.dirty()):w.kind==="multipleOf"?e.data%w.value!==BigInt(0)&&(_=this._getOrReturnCtx(e,_),V(_,{code:j.not_multiple_of,multipleOf:w.value,message:w.message}),S.dirty()):ne.assertNever(w);return{status:S.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,_,S){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:_,message:Y.toString(S)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Te.create=l=>{var e;return new Te({checks:[],typeName:X.ZodBigInt,coerce:(e=l==null?void 0:l.coerce)!==null&&e!==void 0?e:!1,...re(l)})};class et extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){const _=this._getOrReturnCtx(e);return V(_,{code:j.invalid_type,expected:K.boolean,received:_.parsedType}),Q}return de(e.data)}}et.create=l=>new et({typeName:X.ZodBoolean,coerce:(l==null?void 0:l.coerce)||!1,...re(l)});class Ie extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_type,expected:K.date,received:w.parsedType}),Q}if(isNaN(e.data.getTime())){const w=this._getOrReturnCtx(e);return V(w,{code:j.invalid_date}),Q}const _=new le;let S;for(const w of this._def.checks)w.kind==="min"?e.data.getTime()<w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_small,message:w.message,inclusive:!0,exact:!1,minimum:w.value,type:"date"}),_.dirty()):w.kind==="max"?e.data.getTime()>w.value&&(S=this._getOrReturnCtx(e,S),V(S,{code:j.too_big,message:w.message,inclusive:!0,exact:!1,maximum:w.value,type:"date"}),_.dirty()):ne.assertNever(w);return{status:_.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Ie.create=l=>new Ie({checks:[],coerce:(l==null?void 0:l.coerce)||!1,typeName:X.ZodDate,...re(l)});class yt extends se{_parse(e){if(this._getType(e)!==K.symbol){const _=this._getOrReturnCtx(e);return V(_,{code:j.invalid_type,expected:K.symbol,received:_.parsedType}),Q}return de(e.data)}}yt.create=l=>new yt({typeName:X.ZodSymbol,...re(l)});class tt extends se{_parse(e){if(this._getType(e)!==K.undefined){const _=this._getOrReturnCtx(e);return V(_,{code:j.invalid_type,expected:K.undefined,received:_.parsedType}),Q}return de(e.data)}}tt.create=l=>new tt({typeName:X.ZodUndefined,...re(l)});class rt extends se{_parse(e){if(this._getType(e)!==K.null){const _=this._getOrReturnCtx(e);return V(_,{code:j.invalid_type,expected:K.null,received:_.parsedType}),Q}return de(e.data)}}rt.create=l=>new rt({typeName:X.ZodNull,...re(l)});class je extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return de(e.data)}}je.create=l=>new je({typeName:X.ZodAny,...re(l)});class Me extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return de(e.data)}}Me.create=l=>new Me({typeName:X.ZodUnknown,...re(l)});class xe extends se{_parse(e){const a=this._getOrReturnCtx(e);return V(a,{code:j.invalid_type,expected:K.never,received:a.parsedType}),Q}}xe.create=l=>new xe({typeName:X.ZodNever,...re(l)});class Ct extends se{_parse(e){if(this._getType(e)!==K.undefined){const _=this._getOrReturnCtx(e);return V(_,{code:j.invalid_type,expected:K.void,received:_.parsedType}),Q}return de(e.data)}}Ct.create=l=>new Ct({typeName:X.ZodVoid,...re(l)});class ve extends se{_parse(e){const{ctx:a,status:_}=this._processInputParams(e),S=this._def;if(a.parsedType!==K.array)return V(a,{code:j.invalid_type,expected:K.array,received:a.parsedType}),Q;if(S.exactLength!==null){const R=a.data.length>S.exactLength.value,t=a.data.length<S.exactLength.value;(R||t)&&(V(a,{code:R?j.too_big:j.too_small,minimum:t?S.exactLength.value:void 0,maximum:R?S.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:S.exactLength.message}),_.dirty())}if(S.minLength!==null&&a.data.length<S.minLength.value&&(V(a,{code:j.too_small,minimum:S.minLength.value,type:"array",inclusive:!0,exact:!1,message:S.minLength.message}),_.dirty()),S.maxLength!==null&&a.data.length>S.maxLength.value&&(V(a,{code:j.too_big,maximum:S.maxLength.value,type:"array",inclusive:!0,exact:!1,message:S.maxLength.message}),_.dirty()),a.common.async)return Promise.all([...a.data].map((R,t)=>S.type._parseAsync(new ye(a,R,a.path,t)))).then(R=>le.mergeArray(_,R));const w=[...a.data].map((R,t)=>S.type._parseSync(new ye(a,R,a.path,t)));return le.mergeArray(_,w)}get element(){return this._def.type}min(e,a){return new ve({...this._def,minLength:{value:e,message:Y.toString(a)}})}max(e,a){return new ve({...this._def,maxLength:{value:e,message:Y.toString(a)}})}length(e,a){return new ve({...this._def,exactLength:{value:e,message:Y.toString(a)}})}nonempty(e){return this.min(1,e)}}ve.create=(l,e)=>new ve({type:l,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(e)});function He(l){if(l instanceof ae){const e={};for(const a in l.shape){const _=l.shape[a];e[a]=Se.create(He(_))}return new ae({...l._def,shape:()=>e})}else return l instanceof ve?new ve({...l._def,type:He(l.element)}):l instanceof Se?Se.create(He(l.unwrap())):l instanceof Be?Be.create(He(l.unwrap())):l instanceof Ce?Ce.create(l.items.map(e=>He(e))):l}class ae extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ne.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==K.object){const h=this._getOrReturnCtx(e);return V(h,{code:j.invalid_type,expected:K.object,received:h.parsedType}),Q}const{status:_,ctx:S}=this._processInputParams(e),{shape:w,keys:R}=this._getCached(),t=[];if(!(this._def.catchall instanceof xe&&this._def.unknownKeys==="strip"))for(const h in S.data)R.includes(h)||t.push(h);const o=[];for(const h of R){const f=w[h],c=S.data[h];o.push({key:{status:"valid",value:h},value:f._parse(new ye(S,c,S.path,h)),alwaysSet:h in S.data})}if(this._def.catchall instanceof xe){const h=this._def.unknownKeys;if(h==="passthrough")for(const f of t)o.push({key:{status:"valid",value:f},value:{status:"valid",value:S.data[f]}});else if(h==="strict")t.length>0&&(V(S,{code:j.unrecognized_keys,keys:t}),_.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const f of t){const c=S.data[f];o.push({key:{status:"valid",value:f},value:h._parse(new ye(S,c,S.path,f)),alwaysSet:f in S.data})}}return S.common.async?Promise.resolve().then(async()=>{const h=[];for(const f of o){const c=await f.key,p=await f.value;h.push({key:c,value:p,alwaysSet:f.alwaysSet})}return h}).then(h=>le.mergeObjectSync(_,h)):le.mergeObjectSync(_,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,_)=>{var S,w,R,t;const o=(R=(w=(S=this._def).errorMap)===null||w===void 0?void 0:w.call(S,a,_).message)!==null&&R!==void 0?R:_.defaultError;return a.code==="unrecognized_keys"?{message:(t=Y.errToObj(e).message)!==null&&t!==void 0?t:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const a={};return ne.objectKeys(e).forEach(_=>{e[_]&&this.shape[_]&&(a[_]=this.shape[_])}),new ae({...this._def,shape:()=>a})}omit(e){const a={};return ne.objectKeys(this.shape).forEach(_=>{e[_]||(a[_]=this.shape[_])}),new ae({...this._def,shape:()=>a})}deepPartial(){return He(this)}partial(e){const a={};return ne.objectKeys(this.shape).forEach(_=>{const S=this.shape[_];e&&!e[_]?a[_]=S:a[_]=S.optional()}),new ae({...this._def,shape:()=>a})}required(e){const a={};return ne.objectKeys(this.shape).forEach(_=>{if(e&&!e[_])a[_]=this.shape[_];else{let w=this.shape[_];for(;w instanceof Se;)w=w._def.innerType;a[_]=w}}),new ae({...this._def,shape:()=>a})}keyof(){return gr(ne.objectKeys(this.shape))}}ae.create=(l,e)=>new ae({shape:()=>l,unknownKeys:"strip",catchall:xe.create(),typeName:X.ZodObject,...re(e)});ae.strictCreate=(l,e)=>new ae({shape:()=>l,unknownKeys:"strict",catchall:xe.create(),typeName:X.ZodObject,...re(e)});ae.lazycreate=(l,e)=>new ae({shape:l,unknownKeys:"strip",catchall:xe.create(),typeName:X.ZodObject,...re(e)});class st extends se{_parse(e){const{ctx:a}=this._processInputParams(e),_=this._def.options;function S(w){for(const t of w)if(t.result.status==="valid")return t.result;for(const t of w)if(t.result.status==="dirty")return a.common.issues.push(...t.ctx.common.issues),t.result;const R=w.map(t=>new fe(t.ctx.common.issues));return V(a,{code:j.invalid_union,unionErrors:R}),Q}if(a.common.async)return Promise.all(_.map(async w=>{const R={...a,common:{...a.common,issues:[]},parent:null};return{result:await w._parseAsync({data:a.data,path:a.path,parent:R}),ctx:R}})).then(S);{let w;const R=[];for(const o of _){const h={...a,common:{...a.common,issues:[]},parent:null},f=o._parseSync({data:a.data,path:a.path,parent:h});if(f.status==="valid")return f;f.status==="dirty"&&!w&&(w={result:f,ctx:h}),h.common.issues.length&&R.push(h.common.issues)}if(w)return a.common.issues.push(...w.ctx.common.issues),w.result;const t=R.map(o=>new fe(o));return V(a,{code:j.invalid_union,unionErrors:t}),Q}}get options(){return this._def.options}}st.create=(l,e)=>new st({options:l,typeName:X.ZodUnion,...re(e)});const we=l=>l instanceof ot?we(l.schema):l instanceof me?we(l.innerType()):l instanceof at?[l.value]:l instanceof Ae?l.options:l instanceof ct?ne.objectValues(l.enum):l instanceof ht?we(l._def.innerType):l instanceof tt?[void 0]:l instanceof rt?[null]:l instanceof Se?[void 0,...we(l.unwrap())]:l instanceof Be?[null,...we(l.unwrap())]:l instanceof Ft||l instanceof dt?we(l.unwrap()):l instanceof lt?we(l._def.innerType):[];class xt extends se{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.object)return V(a,{code:j.invalid_type,expected:K.object,received:a.parsedType}),Q;const _=this.discriminator,S=a.data[_],w=this.optionsMap.get(S);return w?a.common.async?w._parseAsync({data:a.data,path:a.path,parent:a}):w._parseSync({data:a.data,path:a.path,parent:a}):(V(a,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[_]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,_){const S=new Map;for(const w of a){const R=we(w.shape[e]);if(!R.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const t of R){if(S.has(t))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(t)}`);S.set(t,w)}}return new xt({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:S,...re(_)})}}function Ht(l,e){const a=Le(l),_=Le(e);if(l===e)return{valid:!0,data:l};if(a===K.object&&_===K.object){const S=ne.objectKeys(e),w=ne.objectKeys(l).filter(t=>S.indexOf(t)!==-1),R={...l,...e};for(const t of w){const o=Ht(l[t],e[t]);if(!o.valid)return{valid:!1};R[t]=o.data}return{valid:!0,data:R}}else if(a===K.array&&_===K.array){if(l.length!==e.length)return{valid:!1};const S=[];for(let w=0;w<l.length;w++){const R=l[w],t=e[w],o=Ht(R,t);if(!o.valid)return{valid:!1};S.push(o.data)}return{valid:!0,data:S}}else return a===K.date&&_===K.date&&+l==+e?{valid:!0,data:l}:{valid:!1}}class it extends se{_parse(e){const{status:a,ctx:_}=this._processInputParams(e),S=(w,R)=>{if(It(w)||It(R))return Q;const t=Ht(w.value,R.value);return t.valid?((Pt(w)||Pt(R))&&a.dirty(),{status:a.value,value:t.data}):(V(_,{code:j.invalid_intersection_types}),Q)};return _.common.async?Promise.all([this._def.left._parseAsync({data:_.data,path:_.path,parent:_}),this._def.right._parseAsync({data:_.data,path:_.path,parent:_})]).then(([w,R])=>S(w,R)):S(this._def.left._parseSync({data:_.data,path:_.path,parent:_}),this._def.right._parseSync({data:_.data,path:_.path,parent:_}))}}it.create=(l,e,a)=>new it({left:l,right:e,typeName:X.ZodIntersection,...re(a)});class Ce extends se{_parse(e){const{status:a,ctx:_}=this._processInputParams(e);if(_.parsedType!==K.array)return V(_,{code:j.invalid_type,expected:K.array,received:_.parsedType}),Q;if(_.data.length<this._def.items.length)return V(_,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&_.data.length>this._def.items.length&&(V(_,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const w=[..._.data].map((R,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new ye(_,R,_.path,t)):null}).filter(R=>!!R);return _.common.async?Promise.all(w).then(R=>le.mergeArray(a,R)):le.mergeArray(a,w)}get items(){return this._def.items}rest(e){return new Ce({...this._def,rest:e})}}Ce.create=(l,e)=>{if(!Array.isArray(l))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:l,typeName:X.ZodTuple,rest:null,...re(e)})};class nt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:_}=this._processInputParams(e);if(_.parsedType!==K.object)return V(_,{code:j.invalid_type,expected:K.object,received:_.parsedType}),Q;const S=[],w=this._def.keyType,R=this._def.valueType;for(const t in _.data)S.push({key:w._parse(new ye(_,t,_.path,t)),value:R._parse(new ye(_,_.data[t],_.path,t)),alwaysSet:t in _.data});return _.common.async?le.mergeObjectAsync(a,S):le.mergeObjectSync(a,S)}get element(){return this._def.valueType}static create(e,a,_){return a instanceof se?new nt({keyType:e,valueType:a,typeName:X.ZodRecord,...re(_)}):new nt({keyType:ge.create(),valueType:e,typeName:X.ZodRecord,...re(a)})}}class wt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:_}=this._processInputParams(e);if(_.parsedType!==K.map)return V(_,{code:j.invalid_type,expected:K.map,received:_.parsedType}),Q;const S=this._def.keyType,w=this._def.valueType,R=[..._.data.entries()].map(([t,o],h)=>({key:S._parse(new ye(_,t,_.path,[h,"key"])),value:w._parse(new ye(_,o,_.path,[h,"value"]))}));if(_.common.async){const t=new Map;return Promise.resolve().then(async()=>{for(const o of R){const h=await o.key,f=await o.value;if(h.status==="aborted"||f.status==="aborted")return Q;(h.status==="dirty"||f.status==="dirty")&&a.dirty(),t.set(h.value,f.value)}return{status:a.value,value:t}})}else{const t=new Map;for(const o of R){const h=o.key,f=o.value;if(h.status==="aborted"||f.status==="aborted")return Q;(h.status==="dirty"||f.status==="dirty")&&a.dirty(),t.set(h.value,f.value)}return{status:a.value,value:t}}}}wt.create=(l,e,a)=>new wt({valueType:e,keyType:l,typeName:X.ZodMap,...re(a)});class Pe extends se{_parse(e){const{status:a,ctx:_}=this._processInputParams(e);if(_.parsedType!==K.set)return V(_,{code:j.invalid_type,expected:K.set,received:_.parsedType}),Q;const S=this._def;S.minSize!==null&&_.data.size<S.minSize.value&&(V(_,{code:j.too_small,minimum:S.minSize.value,type:"set",inclusive:!0,exact:!1,message:S.minSize.message}),a.dirty()),S.maxSize!==null&&_.data.size>S.maxSize.value&&(V(_,{code:j.too_big,maximum:S.maxSize.value,type:"set",inclusive:!0,exact:!1,message:S.maxSize.message}),a.dirty());const w=this._def.valueType;function R(o){const h=new Set;for(const f of o){if(f.status==="aborted")return Q;f.status==="dirty"&&a.dirty(),h.add(f.value)}return{status:a.value,value:h}}const t=[..._.data.values()].map((o,h)=>w._parse(new ye(_,o,_.path,h)));return _.common.async?Promise.all(t).then(o=>R(o)):R(t)}min(e,a){return new Pe({...this._def,minSize:{value:e,message:Y.toString(a)}})}max(e,a){return new Pe({...this._def,maxSize:{value:e,message:Y.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}Pe.create=(l,e)=>new Pe({valueType:l,minSize:null,maxSize:null,typeName:X.ZodSet,...re(e)});class Fe extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.function)return V(a,{code:j.invalid_type,expected:K.function,received:a.parsedType}),Q;function _(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,mt(),We].filter(h=>!!h),issueData:{code:j.invalid_arguments,argumentsError:o}})}function S(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,mt(),We].filter(h=>!!h),issueData:{code:j.invalid_return_type,returnTypeError:o}})}const w={errorMap:a.common.contextualErrorMap},R=a.data;if(this._def.returns instanceof Ue){const t=this;return de(async function(...o){const h=new fe([]),f=await t._def.args.parseAsync(o,w).catch(v=>{throw h.addIssue(_(o,v)),h}),c=await Reflect.apply(R,this,f);return await t._def.returns._def.type.parseAsync(c,w).catch(v=>{throw h.addIssue(S(c,v)),h})})}else{const t=this;return de(function(...o){const h=t._def.args.safeParse(o,w);if(!h.success)throw new fe([_(o,h.error)]);const f=Reflect.apply(R,this,h.data),c=t._def.returns.safeParse(f,w);if(!c.success)throw new fe([S(f,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Fe({...this._def,args:Ce.create(e).rest(Me.create())})}returns(e){return new Fe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,_){return new Fe({args:e||Ce.create([]).rest(Me.create()),returns:a||Me.create(),typeName:X.ZodFunction,...re(_)})}}class ot extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}ot.create=(l,e)=>new ot({getter:l,typeName:X.ZodLazy,...re(e)});class at extends se{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return V(a,{received:a.data,code:j.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}at.create=(l,e)=>new at({value:l,typeName:X.ZodLiteral,...re(e)});function gr(l,e){return new Ae({values:l,typeName:X.ZodEnum,...re(e)})}class Ae extends se{constructor(){super(...arguments),Ge.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),_=this._def.values;return V(a,{expected:ne.joinValues(_),received:a.parsedType,code:j.invalid_type}),Q}if(St(this,Ge)||ur(this,Ge,new Set(this._def.values)),!St(this,Ge).has(e.data)){const a=this._getOrReturnCtx(e),_=this._def.values;return V(a,{received:a.data,code:j.invalid_enum_value,options:_}),Q}return de(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Ae.create(e,{...this._def,...a})}exclude(e,a=this._def){return Ae.create(this.options.filter(_=>!e.includes(_)),{...this._def,...a})}}Ge=new WeakMap;Ae.create=gr;class ct extends se{constructor(){super(...arguments),Ye.set(this,void 0)}_parse(e){const a=ne.getValidEnumValues(this._def.values),_=this._getOrReturnCtx(e);if(_.parsedType!==K.string&&_.parsedType!==K.number){const S=ne.objectValues(a);return V(_,{expected:ne.joinValues(S),received:_.parsedType,code:j.invalid_type}),Q}if(St(this,Ye)||ur(this,Ye,new Set(ne.getValidEnumValues(this._def.values))),!St(this,Ye).has(e.data)){const S=ne.objectValues(a);return V(_,{received:_.data,code:j.invalid_enum_value,options:S}),Q}return de(e.data)}get enum(){return this._def.values}}Ye=new WeakMap;ct.create=(l,e)=>new ct({values:l,typeName:X.ZodNativeEnum,...re(e)});class Ue extends se{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.promise&&a.common.async===!1)return V(a,{code:j.invalid_type,expected:K.promise,received:a.parsedType}),Q;const _=a.parsedType===K.promise?a.data:Promise.resolve(a.data);return de(_.then(S=>this._def.type.parseAsync(S,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ue.create=(l,e)=>new Ue({type:l,typeName:X.ZodPromise,...re(e)});class me extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:_}=this._processInputParams(e),S=this._def.effect||null,w={addIssue:R=>{V(_,R),R.fatal?a.abort():a.dirty()},get path(){return _.path}};if(w.addIssue=w.addIssue.bind(w),S.type==="preprocess"){const R=S.transform(_.data,w);if(_.common.async)return Promise.resolve(R).then(async t=>{if(a.value==="aborted")return Q;const o=await this._def.schema._parseAsync({data:t,path:_.path,parent:_});return o.status==="aborted"?Q:o.status==="dirty"||a.value==="dirty"?Ne(o.value):o});{if(a.value==="aborted")return Q;const t=this._def.schema._parseSync({data:R,path:_.path,parent:_});return t.status==="aborted"?Q:t.status==="dirty"||a.value==="dirty"?Ne(t.value):t}}if(S.type==="refinement"){const R=t=>{const o=S.refinement(t,w);if(_.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(_.common.async===!1){const t=this._def.schema._parseSync({data:_.data,path:_.path,parent:_});return t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),R(t.value),{status:a.value,value:t.value})}else return this._def.schema._parseAsync({data:_.data,path:_.path,parent:_}).then(t=>t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),R(t.value).then(()=>({status:a.value,value:t.value}))))}if(S.type==="transform")if(_.common.async===!1){const R=this._def.schema._parseSync({data:_.data,path:_.path,parent:_});if(!Xe(R))return R;const t=S.transform(R.value,w);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}else return this._def.schema._parseAsync({data:_.data,path:_.path,parent:_}).then(R=>Xe(R)?Promise.resolve(S.transform(R.value,w)).then(t=>({status:a.value,value:t})):R);ne.assertNever(S)}}me.create=(l,e,a)=>new me({schema:l,typeName:X.ZodEffects,effect:e,...re(a)});me.createWithPreprocess=(l,e,a)=>new me({schema:e,effect:{type:"preprocess",transform:l},typeName:X.ZodEffects,...re(a)});class Se extends se{_parse(e){return this._getType(e)===K.undefined?de(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(l,e)=>new Se({innerType:l,typeName:X.ZodOptional,...re(e)});class Be extends se{_parse(e){return this._getType(e)===K.null?de(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(l,e)=>new Be({innerType:l,typeName:X.ZodNullable,...re(e)});class ht extends se{_parse(e){const{ctx:a}=this._processInputParams(e);let _=a.data;return a.parsedType===K.undefined&&(_=this._def.defaultValue()),this._def.innerType._parse({data:_,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ht.create=(l,e)=>new ht({innerType:l,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class lt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),_={...a,common:{...a.common,issues:[]}},S=this._def.innerType._parse({data:_.data,path:_.path,parent:{..._}});return Qe(S)?S.then(w=>({status:"valid",value:w.status==="valid"?w.value:this._def.catchValue({get error(){return new fe(_.common.issues)},input:_.data})})):{status:"valid",value:S.status==="valid"?S.value:this._def.catchValue({get error(){return new fe(_.common.issues)},input:_.data})}}removeCatch(){return this._def.innerType}}lt.create=(l,e)=>new lt({innerType:l,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Et extends se{_parse(e){if(this._getType(e)!==K.nan){const _=this._getOrReturnCtx(e);return V(_,{code:j.invalid_type,expected:K.nan,received:_.parsedType}),Q}return{status:"valid",value:e.data}}}Et.create=l=>new Et({typeName:X.ZodNaN,...re(l)});const Ws=Symbol("zod_brand");class Ft extends se{_parse(e){const{ctx:a}=this._processInputParams(e),_=a.data;return this._def.type._parse({data:_,path:a.path,parent:a})}unwrap(){return this._def.type}}class ut extends se{_parse(e){const{status:a,ctx:_}=this._processInputParams(e);if(_.common.async)return(async()=>{const w=await this._def.in._parseAsync({data:_.data,path:_.path,parent:_});return w.status==="aborted"?Q:w.status==="dirty"?(a.dirty(),Ne(w.value)):this._def.out._parseAsync({data:w.value,path:_.path,parent:_})})();{const S=this._def.in._parseSync({data:_.data,path:_.path,parent:_});return S.status==="aborted"?Q:S.status==="dirty"?(a.dirty(),{status:"dirty",value:S.value}):this._def.out._parseSync({data:S.value,path:_.path,parent:_})}}static create(e,a){return new ut({in:e,out:a,typeName:X.ZodPipeline})}}class dt extends se{_parse(e){const a=this._def.innerType._parse(e),_=S=>(Xe(S)&&(S.value=Object.freeze(S.value)),S);return Qe(a)?a.then(S=>_(S)):_(a)}unwrap(){return this._def.innerType}}dt.create=(l,e)=>new dt({innerType:l,typeName:X.ZodReadonly,...re(e)});function vr(l,e={},a){return l?je.create().superRefine((_,S)=>{var w,R;if(!l(_)){const t=typeof e=="function"?e(_):typeof e=="string"?{message:e}:e,o=(R=(w=t.fatal)!==null&&w!==void 0?w:a)!==null&&R!==void 0?R:!0,h=typeof t=="string"?{message:t}:t;S.addIssue({code:"custom",...h,fatal:o})}}):je.create()}const js={object:ae.lazycreate};var X;(function(l){l.ZodString="ZodString",l.ZodNumber="ZodNumber",l.ZodNaN="ZodNaN",l.ZodBigInt="ZodBigInt",l.ZodBoolean="ZodBoolean",l.ZodDate="ZodDate",l.ZodSymbol="ZodSymbol",l.ZodUndefined="ZodUndefined",l.ZodNull="ZodNull",l.ZodAny="ZodAny",l.ZodUnknown="ZodUnknown",l.ZodNever="ZodNever",l.ZodVoid="ZodVoid",l.ZodArray="ZodArray",l.ZodObject="ZodObject",l.ZodUnion="ZodUnion",l.ZodDiscriminatedUnion="ZodDiscriminatedUnion",l.ZodIntersection="ZodIntersection",l.ZodTuple="ZodTuple",l.ZodRecord="ZodRecord",l.ZodMap="ZodMap",l.ZodSet="ZodSet",l.ZodFunction="ZodFunction",l.ZodLazy="ZodLazy",l.ZodLiteral="ZodLiteral",l.ZodEnum="ZodEnum",l.ZodEffects="ZodEffects",l.ZodNativeEnum="ZodNativeEnum",l.ZodOptional="ZodOptional",l.ZodNullable="ZodNullable",l.ZodDefault="ZodDefault",l.ZodCatch="ZodCatch",l.ZodPromise="ZodPromise",l.ZodBranded="ZodBranded",l.ZodPipeline="ZodPipeline",l.ZodReadonly="ZodReadonly"})(X||(X={}));const Us=(l,e={message:`Input not instance of ${l.name}`})=>vr(a=>a instanceof l,e),mr=ge.create,br=De.create,$s=Et.create,zs=Te.create,Sr=et.create,qs=Ie.create,Vs=yt.create,Zs=tt.create,Ks=rt.create,Gs=je.create,Ys=Me.create,Js=xe.create,Xs=Ct.create,Qs=ve.create,ei=ae.create,ti=ae.strictCreate,ri=st.create,si=xt.create,ii=it.create,ni=Ce.create,oi=nt.create,ai=wt.create,ci=Pe.create,hi=Fe.create,li=ot.create,di=at.create,ui=Ae.create,fi=ct.create,_i=Ue.create,Kt=me.create,pi=Se.create,gi=Be.create,vi=me.createWithPreprocess,mi=ut.create,bi=()=>mr().optional(),Si=()=>br().optional(),yi=()=>Sr().optional(),Ci={string:l=>ge.create({...l,coerce:!0}),number:l=>De.create({...l,coerce:!0}),boolean:l=>et.create({...l,coerce:!0}),bigint:l=>Te.create({...l,coerce:!0}),date:l=>Ie.create({...l,coerce:!0})},wi=Q;var Ei=Object.freeze({__proto__:null,defaultErrorMap:We,setErrorMap:ws,getErrorMap:mt,makeIssue:bt,EMPTY_PATH:Es,addIssueToContext:V,ParseStatus:le,INVALID:Q,DIRTY:Ne,OK:de,isAborted:It,isDirty:Pt,isValid:Xe,isAsync:Qe,get util(){return ne},get objectUtil(){return Mt},ZodParsedType:K,getParsedType:Le,ZodType:se,datetimeRegex:pr,ZodString:ge,ZodNumber:De,ZodBigInt:Te,ZodBoolean:et,ZodDate:Ie,ZodSymbol:yt,ZodUndefined:tt,ZodNull:rt,ZodAny:je,ZodUnknown:Me,ZodNever:xe,ZodVoid:Ct,ZodArray:ve,ZodObject:ae,ZodUnion:st,ZodDiscriminatedUnion:xt,ZodIntersection:it,ZodTuple:Ce,ZodRecord:nt,ZodMap:wt,ZodSet:Pe,ZodFunction:Fe,ZodLazy:ot,ZodLiteral:at,ZodEnum:Ae,ZodNativeEnum:ct,ZodPromise:Ue,ZodEffects:me,ZodTransformer:me,ZodOptional:Se,ZodNullable:Be,ZodDefault:ht,ZodCatch:lt,ZodNaN:Et,BRAND:Ws,ZodBranded:Ft,ZodPipeline:ut,ZodReadonly:dt,custom:vr,Schema:se,ZodSchema:se,late:js,get ZodFirstPartyTypeKind(){return X},coerce:Ci,any:Gs,array:Qs,bigint:zs,boolean:Sr,date:qs,discriminatedUnion:si,effect:Kt,enum:ui,function:hi,instanceof:Us,intersection:ii,lazy:li,literal:di,map:ai,nan:$s,nativeEnum:fi,never:Js,null:Ks,nullable:gi,number:br,object:ei,oboolean:yi,onumber:Si,optional:pi,ostring:bi,pipeline:mi,preprocess:vi,promise:_i,record:oi,set:ci,strictObject:ti,string:mr,symbol:Vs,transformer:Kt,tuple:ni,undefined:Zs,union:ri,unknown:Ys,void:Xs,NEVER:wi,ZodIssueCode:j,quotelessJson:Cs,ZodError:fe});function xi(l){const e=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(l);if(!e)return;if(!e[1]||!e[2]||!e[3]||!e[4])throw new Error(`Mouse event: Invalid match for data ${l}`);const a=parseInt(e[1],10),_=parseInt(e[2],10),S=parseInt(e[3],10),w=e[4]==="m";return console.log(`Mouse event: buttonCode=${a}, column=${_}, row=${S}, isRelease=${w}`),l}function ki(l,e){const a=new ys.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),_=ar.macchiato.colors;a.options.theme={background:_.base.hex,black:_.crust.hex,brightBlack:_.surface2.hex,blue:_.blue.hex,brightBlue:_.blue.hex,brightCyan:_.sky.hex,brightRed:_.maroon.hex,brightYellow:_.yellow.hex,cursor:_.text.hex,cyan:_.sky.hex,foreground:_.text.hex,green:_.green.hex,magenta:_.lavender.hex,red:_.red.hex,white:_.text.hex,yellow:_.yellow.hex};const S=new Ss.FitAddon;return a.loadAddon(S),a.open(l),S.fit(),window.addEventListener("resize",()=>{S.fit()}),a.onData(w=>{if(typeof w!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(w)}'`);const R=xi(w);R&&e.onMouseEvent(R)}),a.onKey(w=>{e.onKeyPress(w)}),a}function Ri(){let l=Ei.string().safeParse(sessionStorage.getItem("tabId")).data;return l||(l=Math.random().toString(36),sessionStorage.setItem("tabId",l)),{tabId:l}}class Li{constructor(e){Ke(this,"ready");Ke(this,"tabId");Ke(this,"terminal");Ke(this,"trpc");const a=Qr({links:[fs({condition:w=>w.type==="subscription",true:vs({url:"/trpc"}),false:us({url:"/trpc"})})]});this.trpc=a,this.tabId=Ri();const _=this.tabId,S=ki(e,{onMouseEvent(w){a.neovim.sendStdin.mutate({tabId:_,data:w}).catch(R=>{console.error("Error sending mouse event",R)})},onKeyPress(w){a.neovim.sendStdin.mutate({tabId:_,data:w.key})}});this.terminal=S,this.ready=new Promise(w=>{console.log("Subscribing to Neovim stdout"),a.neovim.onStdout.subscribe({client:_},{onStarted(){w()},onData(R){S.write(R)},onError(R){console.error("Error from Neovim",R)}})})}async startNeovim(e){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:e.filename,additionalEnvironmentVariables:e.additionalEnvironmentVariables,startupScriptModifications:e.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(e){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}async runLuaCode(e){return await this.ready,this.trpc.neovim.runLuaCode.mutate({luaCode:e.luaCode,tabId:this.tabId})}}const yr=document.querySelector("#app");if(!yr)throw new Error("No app element found");const Wt=new Li(yr);window.startNeovim=async function(l){return await Wt.startNeovim({additionalEnvironmentVariables:l==null?void 0:l.additionalEnvironmentVariables,filename:(l==null?void 0:l.filename)??"initial-file.txt",startupScriptModifications:(l==null?void 0:l.startupScriptModifications)??[]})};window.runBlockingShellCommand=async function(l){return Wt.runBlockingShellCommand(l)};window.runLuaCode=async function(l){return Wt.runLuaCode(l)};
|